本文整理汇总了Python中Red9.core.Red9_Meta.convertMClassType方法的典型用法代码示例。如果您正苦于以下问题:Python Red9_Meta.convertMClassType方法的具体用法?Python Red9_Meta.convertMClassType怎么用?Python Red9_Meta.convertMClassType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Red9.core.Red9_Meta
的用法示例。
在下文中一共展示了Red9_Meta.convertMClassType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1:
# 需要导入模块: from Red9.core import Red9_Meta [as 别名]
# 或者: from Red9.core.Red9_Meta import convertMClassType [as 别名]
#...what if we give a node an unknown mClass?
mc.createNode('network', n = 'invalidMClass')#...let's make a null via cmd call
mc.addAttr ('invalidMClass', ln = 'mClass', dt = 'string')
mc.setAttr('invalidMClass.mClass','noIdea',type = 'string')
o3 = r9Meta.MetaClass('invalidMClass')#...and instantiating it
o3#...it's gonna reuturn as a MetaClass because it's mClass is unknown
cgmMeta.cgmNode('invalidMClass')#...I can also call it as a cgmNode with no issue because no valid mClass is set
o3.mClass = 'cgmNode'#...if i set it's mClass to a known mClass however
r9Meta.MetaClass('invalidMClass')#...it's gonna now always return as a cgmNode as it's a valid mClass value
#...so, long story short. Manually changing a node's mClass attribute is not a reliable method of changing the type it instantiates to
#...The right way...
#r9's method
n3 = r9Meta.MetaClass(nodeType='network', name='r9Convert')#...let's make one via meta call
r9Meta.convertMClassType(n3,'cgmNode')#... This converts our node to a cgmNode type
#cgm's Method
cgmMeta.validateObjArg(n3.mNode,'MetaClass',setLogLevel = 'debug')#...this initially wont' change because our current class is a subclass of MetaClass, trust that this is a feature and not a bug
cgmMeta.validateObjArg(n3.mNode,'MetaClass',setClass = True, setLogLevel = 'debug')#...this pass will get it as we have our setClass flag on
cgmMeta.validateObjArg(n3.mNode,'cgmNode',setClass = True, setLogLevel = 'info')#...convert it back and get out of debug
#==============================================================================================
#>> Data storage
#==============================================================================================
mc.file(new=True,f=True)#...let's start with a clean file
#Go to the outliner and make sure DAG objects only is off
n1 = r9Meta.MetaClass(nodeType='network', name='r9Example')#...let's make one via meta call
#>>Json =========================================================================