Community
Maya Forum
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Create Custom Transform Node with Set the Icon

1 REPLY 1
Reply
Message 1 of 2
subing85
307 Views, 1 Reply

Create Custom Transform Node with Set the Icon

I am looking to create one custom Transform node with set the icon or even while creating I need to manage the MObject or MDagth,  there is any way to manage the MObject in the initialize the plugin source code?

 

I know this is not a new thing in prodection,  any one can help that should be appreciable.

 

For example, this function I need to integrated the custon Transform  plugin  code.

 

from maya import OpenMaya

OpenMaya.MFnDependencyNode(mobject)
fn.setIcon("test.png")
fn.setLocked(True)

 

 

Here is my example of custon Transform  plugin  code,

 

from maya import OpenMaya
from maya import OpenMayaMPx

class SceneNode(OpenMayaMPx.MPxTransform):

mobject = OpenMaya.MObject()
dagPath = OpenMaya.MDagPath()

nodeId = OpenMaya.MTypeId(0x8700)
kTransformMatrixID = OpenMaya.MTypeId(0x87015)
kPluginNodeTypeName = "pipeSceneNode"

def __init__(self):
OpenMayaMPx.MPxTransform.__init__(self)

@classmethod
def creator(cls):
return OpenMayaMPx.asMPxPtr( SceneNode() )

@classmethod
def initializer(cls):
numFn = OpenMaya.MFnNumericAttribute()
cls.myAttr = numFn.create(
"testAttri", "testAttri", OpenMaya.MFnNumericData.kDouble, 0.0
)
numFn.setKeyable(True)
numFn.setAffectsWorldSpace(True)
cls.addAttribute(cls.myAttr)

def initializePlugin(mobject):
mplugin = OpenMayaMPx.MFnPlugin (mobject, "Pipe-Studio","0.0.1")
matrix = OpenMayaMPx.MPxTransformationMatrix
mplugin.registerTransform(
SceneNode.kPluginNodeTypeName, SceneNode.nodeId, SceneNode.creator, SceneNode.initializer,
matrix, SceneNode.kTransformMatrixID, SceneNode.drawOverride
)

def uninitializePlugin(mobject):
mplugin = OpenMayaMPx.MFnPlugin(mobject)
mplugin.deregisterNode(SceneNode.nodeId)


 

Tags (1)
Labels (1)
1 REPLY 1
Message 2 of 2
brentmc
in reply to: subing85

Hi,

 

Move the code to set the icon inside the initializer method.

Brent McPherson
Principle Engineer

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report