Hi Carlos,

Dependency Nodes are basically (once created) like other dependency nodes
in Maya.  So, you can (once the plugin is loaded, either through script or
through the plugins manager) call createNode('<your plugin's node name>"),
which will create your node, and then you just connect and/or set attrs on
that node.  It's identical to, say, a multiplyDivide node or a
plusMinusAverage.

Hope that helps,

Joe

On Tue, Jan 13, 2015 at 1:32 AM, Carlos Montes <[email protected]>
wrote:

> Hello, everyone. I have just finished Robert Galanakis' "*Practical Maya
> Programming with Python*" book, where in its Chapter 8 a dependency graph
> plug-in is developed. My problem is, I don't know how it can be used or
> invoked inside Maya; using plug-ins for this software is new for me. I will
> provide some code from the book to try to expose where my doubtfulness
> resides, but the question remains the
>
> In Chapter 7, he teaches us a* Command plug-in* can be called with
> pymel.core's loadPlugin in the Script Editor, and then a plugin_name
> variable that was defined inside the Python plugin file can be used as a
> method that invokes the plugin.
>
> This is what it would look like in the Script Editor's Python tab, for a
> Command plug-in to be used :
>
> import pymel.core as pmc
> pmc.loadPlugin('playsoundplugin.py')
> pmc.playSound()
>
> Inside 'playsoundplugin.py', that variable called plugin_name is defined
> as the method you invoke to play a Sound in Maya, by using a creator
> function and initializing the plugin with registerCommand.
>
> plugin_name = 'playSound'
>
> def create_plugin():
>     return OpenMayaMPx.asMPxPtr(SoundPlayer())
>
> def initializePlugin(mobject):
>    plugin = OpenMayaMPx.MFnPlugin(mobject)
>    plugin.registerCommand(plugin_name, create_plugin)
>
> It's very straightforward, and it all makes sense with has been taught in
> the book; he even offers a very interesting way to add flags to the command
> call.
> For Chapter 8, though, he doesn't show how we can use the quite complex 
> *Dependency
> Node plugin* where he creates a node and its attributes with
> specifications and concrete subclasses. The plugin takes three input
> values, and a compute function takes care of determining two output
> attributes.
>
> Similar to the Command plugin creation, the node plugin also uses similar
> creator and initialization functions; but this time, a new type with the
> 'circler' name is created:
>
> def register_circler(fnplugin):
>     inputnames = ['input', 'scale', 'frames']
>     reg, dereg = create_node(NT_DEPENDSNODE, 'circler', 0x60005, [ value1,
> value2, value3 ])
>     reg(fnplugin)
>
> def initializePlugin(mobject):
>     register_circler(OpenMayaMPx.MFnPlugin(mobject))
>
> And here is where my question is; Command plug-ins can be called with the
> plugin_name variable, but how can I use a Dependency Node plugin then? How
> can I create this dependency node with input and output attributes inside
> Maya? Do all Dependency Node plugins share the same procedure to be used?
>
> I hope the question is not too vague or non understandable. Thank you for
> reading.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/4ca53150-27e0-46bb-9e71-ff2afbe69e24%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/4ca53150-27e0-46bb-9e71-ff2afbe69e24%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAM33%3Da4t5UACZeQAm66aah5hfEPP_ADwuqg2%3DGQEMUvGfiPhJQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to