@classmethod
    def enable_matte(cls, color=0):
        """enables matte on selected objects
        """
        #
        # Enable Matte on Selected Objects
        #
        colors = [
            [0, 0, 0, 0],  # Not Visible
            [1, 0, 0, 0],  # Red
            [0, 1, 0, 0],  # Green
            [0, 0, 1, 0],  # Blue
            [0, 0, 0, 1],  # Alpha
        ]
        arnold_shaders = (
            pm.nt.AiStandard, pm.nt.AiHair, pm.nt.AiSkin, pm.nt.AiUtility
        )

        for node in pm.ls(sl=1, dag=1, type=[pm.nt.Mesh, pm.nt.NurbsSurface,
                                             'aiStandIn']):
            obj = node
            #if isinstance(node, pm.nt.Mesh):
            #    obj = node
            #elif isinstance(node, pm.nt.Transform):
            #    obj = node.getShape()

            shading_nodes = pm.listConnections(obj, type='shadingEngine')
            for shadingNode in shading_nodes:
                shader = shadingNode.attr('surfaceShader').connections()[0]
                if isinstance(shader, arnold_shaders):
                    try:
                        pm.editRenderLayerAdjustment(shader.attr("aiEnableMatte"))
                        pm.editRenderLayerAdjustment(shader.attr("aiMatteColor"))
                        pm.editRenderLayerAdjustment(shader.attr("aiMatteColorA"))
                        shader.attr("aiEnableMatte").set(1)
                        shader.attr("aiMatteColor").set(colors[color][0:3], type='double3')
                        shader.attr("aiMatteColorA").set(colors[color][3])
                    except __HOLE__ as e:
                        # there is some connections
                        print(str(e))
dataset/ETHPy150Open eoyilmaz/anima/anima/env/mayaEnv/toolbox.py/Render.enable_matte