No Problem, Carlos!

Glad I could help! Also, now that I think about it, it will also show up just fine in the node editor as well :) Good find on the dependency graph!

Joe

On 1/13/2015 7:13 PM, Carlos Montes wrote:
I see, so it will become visible in, say, the Hypergraph or the Connection Editor, and I can then manipulate its inputs like I do with other nodes.

That makes a lot of sense! Thank you. I also foundthis helpful read from Autodesk <http://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2015/ENU/Maya-SDK/files/GUID-AABB9BB4-816F-4C7C-A526-69B0568E1587-htm.html> that describes what we can do with the Dependency Graph and how it works.

Thanks again, Joe!

On Tuesday, January 13, 2015 at 11:16:22 AM UTC-8, Joe Weidenbach wrote:

    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] <javascript:>> 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] <javascript:>.
        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
        <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] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/56ecaf12-006e-4143-8dda-af80874f4246%40googlegroups.com <https://groups.google.com/d/msgid/python_inside_maya/56ecaf12-006e-4143-8dda-af80874f4246%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.



---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com

--
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/54B69BED.9080503%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to