View Full Version : [MEL/Python] Create new material type
01-10-2011, 03:33 PM
it's my second time posting here and I really hope you can help me.
The problem is: I want to create a new material type (a very simple one to start off...) that maya users can pick from the list of all materials (lambert, phong, blinn, ...). Just like, for example, Mental Ray materials.
Of course once selected and assigned to an object, it must show some particular attributes and the UI elements to adjust them, just like any other surface/mr material.
Is it possible to do something like this in Mel or Python?
For example in 3ds Max, by using maxscript, I can create new materials and define a custom UI that it is showed in the material configuration panel.
I hope this is not something already discussed/solved in other threads (btw, if it is please link them to me... :) ).
Thanks in advance for any help or hint you can give.
01-11-2011, 01:57 AM
Yes the powerful python could do this~ Check this link dude:
01-11-2011, 11:08 AM
First of all, thanks for your reply.
I actually checked that example (and a bunch of others from the maya scripts directory) but it seems to me that it just create a color utility (that can be used in hypershade) and not a new material type.
Am i missing something? :banghead:
I found that the 'devkit/plug-ins' maya directory contains some c++ written shaders but I'd rather stick to python/mel for portability reasons.
01-11-2011, 01:38 PM
what you want is in 'devkit/plug-ins/scripted'. that's the python equivalents. take a look at geomShader.py
01-11-2011, 02:18 PM
currently, I'm trying to figure out something that is based on that script.
I'll post some code as soon as I assemble something that can be useful AND usable. :D
I changed the node classification string of the node and now I am able to access the new material and edit all its defined attributes.
kPluginNodeClassify = "shader/surface"
mplugin.registerNode( kPluginNodeName, kPluginNodeId, nodeCreator,
nodeInitializer, OpenMayaMPx.MPxNode.kDependNode, kPluginNodeClassify )
Now i JUST need to write down how to update the viewports to reflect the actual attribute modifications...
01-11-2011, 02:18 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.