Wrapping a Shader Node

Wrapping a Shader Node

Anonymous
Not applicable
457 Views
3 Replies
Message 1 of 4

Wrapping a Shader Node

Anonymous
Not applicable
Perhaps someone can point me in the right direction....

We are adding Maya support to our 3D game engine, and are porting over concepts from Max. Everything is pretty straightforward, except one. In Max we extend the standard material in order to create a new specialized interface for the material (which has some additional properties and such). This is a straight forward thing to do in MaxScript, but I cannot seem to find anything similar in MEL.

I'm not trying to change the fundamental shader in anyway. Just wrap a new UI over it, with its own attributes, mapping some to things on the original shader (say the Lamber one). The exporter we use will pick up these attributes which are meaningful to the game engine.

Any ideas how to accomplish something like this in MEL?

-- David
0 Likes
458 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
not sure if this is your answer, but in maya a node, such as MyNode, has it's attributes displayed according to the mel script in it's AETemplate. Usually called AEMyNodeTemplate. As long as that template is in the script path, those controls will be used for all instances of that node. The shell plugin in the devkit has a fairly extensive example of a node template.
0 Likes
Message 3 of 4

Anonymous
Not applicable
Yes, so that would let me change, like the LambertShader node... but I don't want to do that. I want a new node that is not the LambertShader but rather is just an extension of it. I take it this isn't possible? It's trivial in MaxScript. 😕

-- David
0 Likes
Message 4 of 4

Anonymous
Not applicable
......that would be sweet......but don't think it possible......the node in the scene graph is just an instance of a class, and it's ui is the mel script template....since you really are not changing the node, maya won't know you added attributes or be able to change the template to a different one ....maybe a scriptJob...(but what a waste of resources)....so you are kind of stuck with just adding attributes and having them appear as "extra Attributes" on the attribute editor.....most ppl write their own nodes.....could you have a simple node to contain your attributes then attach that node to the lambert via messaging attributes so you can query connections and attribute values?

another edit:: And I think you can only derive from a base class, so I doubt you can just copy/derive from their c++ coded lambert to add your own attributes too.
0 Likes