On Mar 12, 2009, at 2:06 PM, ryant wrote:
> > I have not done a ton with manipulators but I think I can answer some: > > "problem 1: `pluginInfo -dependNode` returns Manipulators!" > > This makes sense to me I have a node I created and I added a > manipulator to it that allows you to edit attributes on that node. It > creates handles that are in the same spot as the OpenGL lines that I > created. The manipulator is dependent on the node and nodes attribute > is dependant on the manipulator since its driven by where the > manipulator is moved by the user. If I click the "I" button next to my > plugin it shows: > > Plug-in Features > Commands: > rtCylinder > > Tools: > rtCylinderManipCtxCmd > > Dependency nodes: > rtCylinder > rtCylinderManip > > When init my locator I have this in the code: > > # Notify Maya that there is an associated manipulator for this > particular type of node > # This is the only change necessary to the baseLocator node to have it > work with a manipulator > OpenMayaMPx.MPxManipContainer.addToManipConnectTable > ( rtCylinderLocatorId ); > > So maya knows it needs that manipulator. > > "problem 2: I don't know how to use MEL or API to find out if an > object type is a manipulator prior to creating it" > > My manipulator is created when I hit the "t" button in Maya. Maya > handles all of this. It also deletes it for me when I change contexts. > Why would you need to figure out its type and how would you create it > outside of the context of a plugin with a node that it is attached to. > What are you doing with the manipulator. Why do you want to do with > it? i'm trying NOT to make one. i'm trying to get the lineage of each depend node made by a plugin. but pluginInfo -dependNode returns a manipulator. so i need some way to tell that this thing is a manipulator so that i don't create it. > > "problem 3: `nodeType -inherited` requires a real object, so i have > to > create an object to find out it's inheritance. > >>>> res = cmds.createNode( u'shaveBrushManip' ) >>>> cmds.nodeType(res) > None >>>> cmds.nodeType(res, inherited=1) > None" > > I dont think its ok to create manipulators this way. You might be able > to, but it needs to be "manipulating" something. There are examples of > how to use manipulators in the Python API examples in maya devkit > folder. my point is that createNode shouldn't even let me create a manipulator. if it just raised an error and said you can't create a manipulator then there would not be a problem. as soon as i create a manipulator this way, i cannot unload the plugin because it says the resource is in use. creating a new scene isn't enough to get rid of it. only restarting maya will work. > > "problem 4: `createNode` allows you to create manipulators but > `delete` > won't delete them." > > Again I dont know what your doing but I dont think you can use > createNode to create a manipulator. I think this is a API only thing. > If I use createNode to create the manipulator I have it errors out > because my manipulator is dependent on my node and requires attributes > from that node to feed into it. Without those my manipulator fails and > nothing gets created. I suppose if you had a manipulator with no > dependencies to any attributes it might create some sort of node. I > havent tried that. i was able to use dg/dag modifiers to create each node, test if it's a manipulator using obj.hasFn( MFn.kManipulator3d ) ( thanks to john creson for this suggestion), get its lineage, and then use dg/ dag.undoIt() to clean things up (thanks to paul for this one). -chad > > If any of this happens to be misinformation I am sorry, just trying to > explain what I can to help. > > RyanT > Technical Artist > www.rtrowbridge.com/blog > NaughtyDog Inc. > > > > > On Mar 12, 12:10 pm, chadrik <[email protected]> wrote: >> I'm running into a lot of walls here with how Maya handles >> manipulators. My goal is to determine the inheritance of each node >> loaded by a plugin. >> >> problem 1: `pluginInfo -dependNode` returns Manipulators! >> >> >>> cmds.pluginInfo('shaveNode', query=1, dependNode=1) >> [u'shaveHair', u'shaveGlobals', u'shaveShadowNode', u'shaveNode', >> u'shaveBackground', u'shaveVertexShader', u'shaveVolumeShader', >> u'shaveBrushManip'] >> >> the last item, 'shaveBrushManip', is a manipulator, so why is this >> returned in the list of dependency nodes? >> >> problem 2: I don't know how to use MEL or API to find out if an >> object type is a manipulator prior to creating it >> >> problem 3: `nodeType -inherited` requires a real object, so i have to >> create an object to find out it's inheritance. >> >> >>> res = cmds.createNode( u'shaveBrushManip' ) >> >>> cmds.nodeType(res) >> None >> >>>cmds.nodeType(res, inherited=1) >> None >> >> once i do this, i can see that the inheritance is None, which gives >> me >> a good clue that it's a manipulator, but that leads me to the next >> problem. >> >> problem 4: `createNode` allows you to create manipulators but >> `delete` >> won't delete them. >> why does create*NODE* allow me to create a manipulator when nothing >> else will recognize what has been created? is there a way to delete >> manipulators or get any kind of information about them? >> >> >>> res = cmds.createNode( u'shaveBrushManip' ) >> >>> print res >> Manipulator2 >> >>> cmds.ls(type='shaveBrushManip') # ls won't list it >> [] >> cmds.delete( res) # delete won't delete it >> Traceback (most recent call last): >> File "<maya console>", line 1, in <module> >> TypeError: Object Manipulator2 is invalid >> >> a solution to any one of these problems would be great. clearly, >> most >> of them are in Autodesk's court, but perhaps there are commands in >> the >> API or MEL that i don't know about for working with and deleting >> manipulators? >> >> -chad > > --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/python_inside_maya -~----------~----~----~----~------~----~------~--~---
