[MEL/Python] Create new material type

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  01 January 2011
[MEL/Python] Create new material type

Hi all,
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 January 2011
Yes the powerful python could do this~ Check this link dude:
http://download.autodesk.com/us/may...py-example.html
__________________
You are the reason I love CGTalk, my kind-hearted friends!
 
  01 January 2011
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?

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 January 2011
what you want is in 'devkit/plug-ins/scripted'. that's the python equivalents. take a look at geomShader.py

:nathaN
 
  01 January 2011
thanks Nathan,
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.

EDIT:
Quick update

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...

Last edited by inglobetechnologies : 01 January 2011 at 11:31 AM.
 
  01 January 2011
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 09:04 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.