cgmNode | cgmObject | cgmObjectSet | cgmOptionVar | cgmDynParentGroup

cgmNode

This is our root metaClass which almost all other cgmMetaClasses are descendants of. It itself is a subclass of r9Meta.MetaClass and thus inherits all functions added to the core Red9 metaclass

Superclass : r9Meta.MetaClass
Subclass:  cgmObject, cgmObjectSet
Location: cgm.core.cgm_Meta.cgmNode

What are the differences between a cgmMeta.cgmNode and a r9Meta.MetaClass

  • Added functions
  • msgList/datList handling
  • connectChild/Children/Parent nodes — we wanted a different connection type than the one red9 used. Ours is objChild.msgHook → objHolder.msgAttr. If memory serves, red9s is objChild.msgAttr → objHolder.msgAttr.
  • Component mode ability – ability to say metaClass a vertice or ep
  • Message handling in general – we allow for message like storage of attributes and not just nodes
  • Access to the insanity of the NameFactory and all the wonders therein. See cgmObject for examples.

Arguments

  • node (string)- Node to initialize
  • name (string) -Name for the node
  • nodeType– (string) – type of node to create if it doesn’t exist
  • setClass – (bool) – whether to set the mClass attribute on initialization

Properties

  • p_referencePrefix– (getReferencePrefix ) – get the reference prefix
  • p_nameBase – clean name string
  • p_nameLong – node long name
  • p_nameShort – node short name
  • p_parent – get/set parent of an object (set only currently on cgmObject)

Examples

Message Treatment – We have some extra message tools…

msgLists – This is our answer to the frustration with how multiMessage attrs work in maya when you need lists to be intact.
#>>msgList ====================================================================================
#Let's look at the concept of the msgList
mi_catcherObj = cgmMeta.cgmObject(name = 'msgListCather')

#First we're gonna make some objects to deal with, say 5
md_msgListObjs = {}
ml_msgListObjs = []
for i in range(5):
  try:mObj= cgmMeta.cgmObject('msgListObj_%i'%i)
  except:mObj= cgmMeta.cgmObject(name = 'msgListObj_%i'%i)
  md_msgListObjs[i] = mObj
  ml_msgListObjs.append(mObj)

#Connect the first two objects, you can pass metaclass or string objects
mi_catcherObj.msgList_connect([ml_msgListObjs[0],ml_msgListObjs[1].mNode],'msgAttr','connectBack')
ml_msgListObjs[0].connectBack#what do you know, we connected back to our holder we can also dance a little with that...
ml_msgListObjs[0].connectBack.msgAttr_0.connectBack.msgAttr_1#The mind truly spins....:)

#Let's query it
mi_catcherObj.msgList_get('msgAttr')#Query our list, it's going to default to do it as meta

#Say we wanted just the objlist
mi_catcherObj.msgList_get('msgAttr',asMeta=False)

#We can also do a getMessage call which offers a few more options
mi_catcherObj.msgList_getMessage('msgAttr',longNames = True)

#Appending is supported
mi_catcherObj.msgList_append(ml_msgListObjs[2],'msgAttr')
mi_catcherObj.msgList_get('msgAttr',False) #What do you know, we have the new on there...

#Indexing is supported
mi_catcherObj.msgList_index(ml_msgListObjs[2],'msgAttr')
#As is checking if we have a msgList on an attr name
mi_catcherObj.msgList_exists('msgAttr')
mi_catcherObj.msgList_exists('isAnyoneThere')#Nope...

#Let's remove the first
mi_catcherObj.msgList_remove(ml_msgListObjs[0],'msgAttr')
mi_catcherObj.msgList_get('msgAttr',False) #We Removed the first

#Let's store em all
mi_catcherObj.msgList_connect(ml_msgListObjs,'msgAttr','connectBack')
#Let's delete number 2....
ml_msgListObjs[2].delete()
mi_catcherObj.msgList_get('msgAttr',asMeta=False,cull = False)#That entry is empty now...When cull is off, on by default
#What if we want to clean this list without the empty
mi_catcherObj.msgList_clean('msgAttr')
#And we have a clean list again...

#Say we wanna purge this data...
mi_catcherObj.msgList_purge('msgAttr')#Our attrs are gone... so sad....
#==============================================================================================

Other calls – A sampling of other calls…

#>>Other Calls ================================================================================
mi_cv.getMayaType()#Because maya's type return thing isn't so hot....
mi_sphere.getMayaType()
mi_sphere.doDuplicate()#its gonna give us a duplicate, but only a null?....
mi_dup = mi_sphere.doDuplicate(parentOnly=False)#Now it works

mi_loc = mi_sphere.doLoc()#We can loc items with the same maker cgmLocinator uses
mi_cvLoc = mi_cv.doLoc()#We can loc components too...

#We're gonna add an enum to look at something...
mi_sphere.addAttr('testEnum',attrType = 'enum')
mi_sphere.testEnum#nice, but what if we want as a string
mi_sphere.getEnumValueString('testEnum')

mi_loc.returnPositionOutPlug()#This is a wip one but it works for most necessary things, handy for nodal work
#==============================================================================================

 

Road Map

Change Log