Custom transform node (C++) plugin

Custom transform node (C++) plugin

MehdiZangenehBar
Advocate Advocate
723 Views
10 Replies
Message 1 of 11

Custom transform node (C++) plugin

MehdiZangenehBar
Advocate
Advocate

My goal is to create a simple custom transform node using C++ plugin. This node should work as regular node in the outliner and it can be extended from existing class for example "Locator" node.

It would be great if someone show me an example.
Thanks.

0 Likes
724 Views
10 Replies
Replies (10)
Message 2 of 11

brentmc
Autodesk
Autodesk

Hi,

A locator node is shape node and the footPrintNode example in the Maya SDK shows how to make a custom locator derived from MPxLocator.

A custom transform is different and the rockingTransform example in the Maya SDK shows how to create a custom transform node derived from MPxTransform. (that adds extra data into the transform matrix)

Brent McPherson
Principle Engineer
Message 3 of 11

MehdiZangenehBar
Advocate
Advocate

Let me explain my goal little bit more, maybe you could advise me more. In short, I need to lock the rigged character for the end user. My pipeline is to add special node (could be a locator) with plugin. So if the plugin let us the rig works, otherwise we can't move the rig. The user permission can be retrive using HTTP request inside the plugin.
So I do nothing with the locator, just extend it, add my condition in one of the events. It could be break the transform or delete the node or someting like that to prevent user to continue using the rig.
Would you please show me most simplest code with minimum structure to extend locator and add this functionallity?

0 Likes
Message 4 of 11

brentmc
Autodesk
Autodesk

I have not heard of anything similar before but if you have other custom plugin nodes in the rig they could be candidates for this as well.

Really depends on how you want to restrict the rig and I'm not sure a custom locator will work well in that regard so I think you will need to experiment with different aspects of the rig and find out what works well.

Brent McPherson
Principle Engineer
0 Likes
Message 5 of 11

MehdiZangenehBar
Advocate
Advocate
OK, regarding to the extending the locator. I'm looking for MINIMUM code we need to implement that. Which parts of the code are essential?
0 Likes
Message 6 of 11

jmreinhart
Advisor
Advisor

So we can break your question down into 3 questsion:

 

1 . How can I trigger some code when a user opens a Maya rig?

2. How can I check if a user has permission to use that file?

3. How can I prevent them from using the rig if they don't have permission?

 

 

Question 1:

You could use a scriptNode: https://download.autodesk.com/us/maya/2011help/CommandsPython/scriptNode.html 

A script node can be triggered when the file is open, and that script node will run some code.

However it's very easy to prevent a script node from running, since they can be disabled in Maya>Options 

 

You could create a plugin using the Maya API, and set it up so that plugin creates a callback when it is loaded.

But again, the user can just prevent the plugin from loading, by default Maya will ask for their permission before loading it.

 

So, forcing Maya to run some code when a user opens a file is possible, but it's not going to give you any kind of security. 

 

Question 2:

In this other forum post a user reccomends LimeLM as a way to impliment license/user verification

https://forums.autodesk.com/t5/maya-programming/license-mechanism-and-mfnplugin/m-p/9886343

I've never used it, but it seems like a good place to start.

 

Question 3:

You could have the scriptnode delete stuff out of the rig to make it unusable, but if the scriptnode is disabled it won't matter.

 

Basically, what you are trying to do is only possible if there is a custom node in your rig that is 100% required for it to function, because you can use LimeLM to prevent a user without a license from loading your plugin, and therefore the custom node would be missing and the rig wouldn't work. 

 

If you're just trying to put a password of sorts on a Maya scene that uses Vanilla nodes, there isn't a way to do that.

 

 

 

 

 

 

 

 

0 Likes
Message 7 of 11

MehdiZangenehBar
Advocate
Advocate

My pipeline is little bit different than what you think:

  • We create a custom node plugin (extended locator) and check the registration on plugin load-update-delete,.. event, NOT any maya load or any scene related callback. This checking could be happen in Maya startup, when the application loads plugins.
  • Then we create our rig parts using the custom node which is nessecary to rig functionallity works correctly.
    So the rig works if plugin is loaded and custom node registered and works correctly. Otherwise the user get the missing class message at Maya startup. Rig will be loaded with missed nodes, So it's not working.

Am I thinking correctly?

0 Likes
Message 8 of 11

MehdiZangenehBar
Advocate
Advocate

@jmreinhart wrote:

Basically, what you are trying to do is only possible if there is a custom node in your rig that is 100% required for it to function, because you can use LimeLM to prevent a user without a license from loading your plugin, and therefore the custom node would be missing and the rig wouldn't work. 


That's it.

0 Likes
Message 9 of 11

jmreinhart
Advisor
Advisor

So it sounds like LimeLM is the solution for you. 

0 Likes
Message 10 of 11

MehdiZangenehBar
Advocate
Advocate

How we could use that?, it seems complicated...

0 Likes
Message 11 of 11

jmreinhart
Advisor
Advisor

The thing that you want to do is quite complicate unfortunately. 

I would suggest reaching out directly to the user on this forum:

https://forums.autodesk.com/t5/maya-programming/license-mechanism-and-mfnplugin/m-p/9886343 

who suggested it, since they have experience using it.