Today, we are going to look at a little bit inside of fragment graph's connect element. For the first two attributes, from and to are self-explanatory. Essentially this allows connecting from one fragment's output to another fragment's input. However, the “name” attribute is not well explained.
The fragment graph is designed like the dependency graph in Maya. Connecting different nodes and having outputs after running through a series of fragments you'll get the result. But unlike the dependency graph, the fragment graph cannot accept inputs having the same name. For example, if you have a fragment f1 that you would like to create multiple instances and then connect to different fragments.
<connect from="f1.output" to="f2.input"/>
<connect from="f1.output" to="f3.input"/>
In this case, you will have to rename the output of f1 with the “name” attribute so Maya will create multiple instances of f1 to connect them properly. Otherwise, only the first one will be connected.
<connect from="f1.output" to="f2.input" name="f2Input"/>
<connect from="f1.output" to="f3.input" name="f3Input"/>
But there is also an exception here. When you are declaring an input struct for the alias output like this:
<properties>
<struct name=\"fileTexturePluginFragmentOutput\" struct_name=\"fileTexturePluginFragmentOutput\" />
</properties>
<outputs>
<alias name=\"fileTexturePluginFragmentOutput\" struct_name=\"fileTexturePluginFragmentOutput\" />
<float3 name=\"outColor\" />
<float name=\"outAlpha\" />
</outputs>
The input(properties) “name” shouldn't be changed if you want to connect its output in your graph. After you've changed its name, Maya will try to create another instance of the renamed structure. After the input name is changed, Maya can't find the alias with original name and so the fragment graph can't be created.
The conclusion for correctly using the “name” attribute of the connect element:
- Rename the input attribute when reusing the same fragment's input for multiple outputs.
- Don't rename an alias output.
I'm writing this comment in the hope that some Autodesk Maya developer will read this. You have added MExternalDropCallback class way in Maya 2013 (http://around-the-corner.typepad.com/adn/2012/06/whats-new-in-the-maya-2013-api.html) which helps dropping stuff into Maya UI from custom Qt widgets. But as far as I'm concerned (and other people to: https://groups.google.com/forum/#!topic/python_inside_maya/EyY6QY4jPhc) there is no hook for dragging and dropping objects from Maya UI into custom Qt widgets. It would be very nice I you would think about adding some class or extending MExternalDropCallback to support that behaviour.
Posted by: Makal | July 20, 2016 at 08:53 AM