当前位置: 首页>>代码示例>>Python>>正文


Python Red9_Meta.getMClassInstances方法代码示例

本文整理汇总了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
开发者ID:Italic-,项目名称:maya-prefs,代码行数:33,代码来源:help_introToMeta.py


注:本文中的Red9.core.Red9_Meta.getMClassInstances方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。