1

I would like to find out if anyone has suggestions on how to create a script that can easily be edited to create a custom Maya node with just adding in some arbitrary values of any type.

Basically, I would want to be able to specify an attribute type (string type, float type, ect), and to be able to fill in the values for those types and have the script generate a custom node easily.

Excited to hear back any suggestions.

Jascha
  • 11
  • 3
  • What are you trying to do exactly? – Green Cell Jun 30 '18 at 17:10
  • I wanted to find out if I could have a .json file that acts as a “template” to fill in the data of a custom Maya API node as well as to be able to loop over multiple “templates” that will generate multiple custom nodes at the same time. I’m trying to see if there are alternative ways to create my own nodes without having to hard code a custom node? – Jascha Jul 03 '18 at 10:22

1 Answers1

1

You can create an empty group node and add any arbitrary attribute to it. This has the disadvantage that you cannot filter by node type. But you can use a special naming convention to filter for these type of nodes.

If you need your own node type, you can easily create your own nodetype with a simple python api script. Then you can fill in any additional attributes as you like.

haggi krey
  • 1,885
  • 1
  • 7
  • 9
  • Thank you very much for your response. I think I was vague in my question. Here's a link to an example of a custom node with string attributes. [link](https://github.com/JaschaW/Maya-API-Custom-String-Node/blob/master/jwCustom_Node) in that script its only using string attributes at the moment, I want to basically automate that process through another script if that makes sense? – Jascha Jun 29 '18 at 14:21
  • That's what I meant with creating your own node type. If I understand correctly, you want to create such a node with different attributes, e.g. one with string and int, another with float and bool. And you want to automate this process. I'd suggest to create one node with no attributes at all as a python plugin the same way it is done in the link. And in your scripts you simply create a new node of this type and add and manipulate attributes with the addAttr() and setAttr() commands. – haggi krey Jun 29 '18 at 15:47
  • Out of curiosity, why wouldn't you hard code some of these attributes within the node itself? Say for example, I wanted to create a custom render node, I know that the render node has a certain core functionality that suits the pipeline, if extra attributes are needed I can either add them on the fly or if I see that certain attributes are becoming more common I add them to the node? – Jascha Jun 30 '18 at 07:50
  • I had the impression that you want to want to be flexible with all attributes. All attributes which you need everytime you create this node can be implemented into the node itself. – haggi krey Jun 30 '18 at 10:28