コード例 #1
0
    def colllect_renderlayer_members(self, name):
        """Return renerlayer members in short name

        This method is implemented with Maya API 1.0.

        (NOTE)
        `editRenderLayerMembers` can only return either full path or just
        node name. And using `listConnections` to list out the connection
        between renerlayer's `renderInfo` and node's `renderLayerInfo` to
        find members, doesn't work with defaultRenderLayer.

        """
        import maya.OpenMaya as om_v1
        import maya.OpenMayaRender as omrender_v1

        members = set()

        mobj = omrender_v1.MFnRenderLayer.findLayerByName(name)
        layer = omrender_v1.MFnRenderLayer(mobj)

        marray = om_v1.MObjectArray()
        layer.listMembers(marray)

        for index in range(marray.length()):
            mobj = marray[index]
            # Assume all member `hasFn(om_v1.MFn.kDagNode)`
            node = om_v1.MFnDagNode(mobj)
            members.add(node.partialPathName())

        return list(members)
コード例 #2
0
 def _GetCurrentRenderLayerName(self):
     currentRenderLayerObj = OMR.MFnRenderLayer.currentLayer()
     currentRenderLayer = OMR.MFnRenderLayer(currentRenderLayerObj)
     return currentRenderLayer.name()
コード例 #3
0
 def _GetDefaultRenderLayerName(self):
     defaultRenderLayerObj = OMR.MFnRenderLayer.defaultRenderLayer()
     defaultRenderLayer = OMR.MFnRenderLayer(defaultRenderLayerObj)
     return defaultRenderLayer.name()
コード例 #4
0
 def __init__(self):
     self.render_Layer = OpenMayaRender.MFnRenderLayer()