Re: [Maya-Python] getting a node's typeID

2024-03-14 Thread isabelle boeve
for future reference to those that looked for an answer to this issue (as 
was I)
This is how you get a node's typeID

import maya.OpenMaya as OpenMaya

node = cmds.ls("network1")[0]
sel = OpenMaya.MSelectionList()
mobj = OpenMaya.MObject()
OpenMaya.MGlobal.getActiveSelectionList(sel)
sel.getDependNode(0, mobj)
fn = OpenMaya.MFnDependencyNode(mobj)

id = fn.typeId().id()
print(hex(id))

On Friday 24 September 2010 at 17:26:23 UTC+2 Jan Berger wrote:

>
> I`m not sure I have enough info to give specific advice, I presume the 
> node may not exist that you want to get the typeId for?
> If MDGModifier does not do the job how about just creating one and then 
> use MGlobal::deleteNode() to get rid of it?
> Just a thought... 
>
> At 09:56 PM 9/22/2010, you wrote:
>
> On Sep 22, 2010, at 9:39 PM, Jan Berger wrote:
>
>
> there is MFnDependencyNode::typeId() 
> to get it for a specific node type I guess one would need to use the 
> create function beforehand
>
>
> yes, it's not a static/class method so the MFnDependencyNode class needs 
> to be instantiated to use that method... meaning you need an existing 
> node.  i've done some very nasty things using dg modifiers to create 
> "ghosedt" nodes that do not yet exist to find out their type, the revert 
> the dgmod, but i'd rather not have to do that.
>
> -chad
>
>
>
>
>
> At 08:26 PM 9/22/2010, you wrote:
>
> i've searched for this before without avail, but it's biting me again in a 
> different context, so i thought i'd check:
>
> is there a way to get the typeId of a node without having an existing 
> instance of the node?
>
> i would expect a static method on MFnDependencyNode, like the following:
>
>  MFnDependencyNode.getTypeId('transform')
>
> but i can't find anything
>
> -chad
>
>
> -- 
> http://groups.google.com/group/python_inside_maya
>
>
> Jan Berger  
> j...@janberger.de :: www.janberger.de 
>
> -- 
> http://groups.google.com/group/python_inside_maya
>
>
> -- 
> http://groups.google.com/group/python_inside_maya 
>
> Jan Berger  
> j...@janberger.de :: www.janberger.de 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/55817ad2-a7c4-4fa4-9e1d-1040380fa1a8n%40googlegroups.com.


Re: [Maya-Python] getting a node's typeID

2010-09-24 Thread Jan Berger


I`m not sure I have enough info to give specific advice, I presume 
the node may not exist that you want to get the typeId for?
If MDGModifier does not do the job how about just creating one and 
then use MGlobal::deleteNode() to get rid of it?

Just a thought...

At 09:56 PM 9/22/2010, you wrote:


On Sep 22, 2010, at 9:39 PM, Jan Berger wrote:



there is MFnDependencyNode::typeId()
to get it for a specific node type I guess one would need to use 
the create function beforehand


yes, it's not a static/class method so the MFnDependencyNode class 
needs to be instantiated to use that method... meaning you need an 
existing node.  i've done some very nasty things using dg modifiers 
to create ghosedt nodes that do not yet exist to find out their 
type, the revert the dgmod, but i'd rather not have to do that.


-chad






At 08:26 PM 9/22/2010, you wrote:
i've searched for this before without avail, but it's biting me 
again in a different context, so i thought i'd check:


is there a way to get the typeId of a node without having an 
existing instance of the node?


i would expect a static method on MFnDependencyNode, like the following:

MFnDependencyNode.getTypeId('transform')

but i can't find anything

-chad


--
http://groups.google.com/group/python_inside_maya


Jan Berger
mailto:j...@janberger.dej...@janberger.de :: www.janberger.de

--
http://groups.google.com/group/python_inside_mayahttp://groups.google.com/group/python_inside_maya


--
http://groups.google.com/group/python_inside_maya


Jan Berger
j...@janberger.de :: www.janberger.de  


--
http://groups.google.com/group/python_inside_maya

[Maya-Python] getting a node's typeID

2010-09-22 Thread Chad Dombrova
i've searched for this before without avail, but it's biting me again in a 
different context, so i thought i'd check:

is there a way to get the typeId of a node without having an existing instance 
of the node?

i would expect a static method on MFnDependencyNode, like the following:

MFnDependencyNode.getTypeId('transform')

but i can't find anything

-chad


-- 
http://groups.google.com/group/python_inside_maya


Re: [Maya-Python] getting a node's typeID

2010-09-22 Thread Jan Berger


there is MFnDependencyNode::typeId()
to get it for a specific node type I guess one would need to use the 
create function beforehand



At 08:26 PM 9/22/2010, you wrote:
i've searched for this before without avail, but it's biting me 
again in a different context, so i thought i'd check:


is there a way to get the typeId of a node without having an 
existing instance of the node?


i would expect a static method on MFnDependencyNode, like the following:

MFnDependencyNode.getTypeId('transform')

but i can't find anything

-chad


--
http://groups.google.com/group/python_inside_maya


Jan Berger
j...@janberger.de :: www.janberger.de  


--
http://groups.google.com/group/python_inside_maya

Re: [Maya-Python] getting a node's typeID

2010-09-22 Thread Chad Dombrova

On Sep 22, 2010, at 9:39 PM, Jan Berger wrote:

 
 there is MFnDependencyNode::typeId() 
 to get it for a specific node type I guess one would need to use the create 
 function beforehand

yes, it's not a static/class method so the MFnDependencyNode class needs to be 
instantiated to use that method... meaning you need an existing node.  i've 
done some very nasty things using dg modifiers to create ghosedt nodes that 
do not yet exist to find out their type, the revert the dgmod, but i'd rather 
not have to do that.

-chad



 
 
 At 08:26 PM 9/22/2010, you wrote:
 i've searched for this before without avail, but it's biting me again in a 
 different context, so i thought i'd check:
 
 is there a way to get the typeId of a node without having an existing 
 instance of the node?
 
 i would expect a static method on MFnDependencyNode, like the following:
 
  MFnDependencyNode.getTypeId('transform')
 
 but i can't find anything
 
 -chad
 
 
 -- 
 http://groups.google.com/group/python_inside_maya
 Jan Berger  
 j...@janberger.de :: www.janberger.de
 
 
 -- 
 http://groups.google.com/group/python_inside_maya

-- 
http://groups.google.com/group/python_inside_maya