Hi everyone!
I am quite new to Maya and currently developing a node plugin using Python.
That node is a locator and I wanted to change node color using color chooser shown in customized attribute template editor.
Right now, I used ‘createColor’ function in MFnNumericAttribute() class to create this attribute, as shown below.
import maya.api.OpenMaya as om
numFn = om.MFnNumericAttribute()
Node.Color = numFn.createColor("nodeColor", 'noc')
So that there will be a color chooser in attribute editor, but I wanted to choose the color of node in run time.
I am drawing the node using MPxDrawOverride in ‘maya.api.OpenMayaRender’ and trying to get color value in runTime, my code is
plug_color = om.MPlug( objPath.node(), Node.Color )
colorObj = plug_color.asMObject()
colorVal = om.MDataBlock.inputValue(colorObj)
I checked MDataBlock and it says inputValue can accept MPlug and MObject, but it always returns an error: descriptor ‘inputValue’ requires a ‘OpenMaya.MDataBlock’ object but received a ‘OpenMaya.MObject’.
Anyone has encountered this problems before? can you help me?
Thank you!