本文整理汇总了Python中Red9.core.Red9_Meta.getMClassInstances方法的典型用法代码示例。如果您正苦于以下问题:Python Red9_Meta.getMClassInstances方法的具体用法?Python Red9_Meta.getMClassInstances怎么用?Python Red9_Meta.getMClassInstances使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Red9.core.Red9_Meta
的用法示例。
在下文中一共展示了Red9_Meta.getMClassInstances方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: enumerate
# 需要导入模块: from Red9.core import Red9_Meta [as 别名]
# 或者: from Red9.core.Red9_Meta import getMClassInstances [as 别名]
n1 = r9Meta.MetaClass(name = 'MetaClass_1', nodeType='network')
n2 = r9Meta.MetaClass(name = 'MetaClass_child', nodeType = 'network')
c1 = cgmMeta.cgmNode(name = 'cgmNode_1')
c2 = cgmMeta.cgmObject(name = 'cgmObject_1')
#Let's set some attrs so we can search with an enumerated loop
for i,o in enumerate([n1,n2,c1,c2]):
o.addAttr('testAttr',i)
n1.connectChild(n2, 'childNode', srcAttr='parentNode')#...wire this so we can see some stuff later
n1.connectChild(c1, 'childNode2', srcAttr='parentNode')#...and another
#>>Instance query =========================================================================
#Okay, now let's search some stuff
#First, a call just to see some info about meta class inheritance as registered in the subclass registry
r9Meta.getMClassInstances(r9Meta.MetaClass)
#...make it more readable
for o in r9Meta.getMClassInstances(r9Meta.MetaClass):print o
#...as you can see there are a lot of subclasses. What if we just wanted to see subclasses to cgmObject
for o in r9Meta.getMClassInstances(cgmMeta.cgmObject):print o#...quite a few less
#>>getMetaNodes =========================================================================
#...just to make seeing stuff a little easier, we're gonna make a little pass through function
def _res(l):
for o in l:print o
_res(r9Meta.getMetaNodes())#...returns all metaNodes in the scene
_res(r9Meta.getMetaNodes(dataType = ''))#...returns as dag strings
_res(r9Meta.getMetaNodes(mTypes = 'cgmObject'))#...only returns a given meta type
_res(r9Meta.getMetaNodes(mTypes = r9Meta.MetaClass))#...only returns a given meta type