コード例 #1
0
    def create_materials(self):
        """Iterates over all selected Nodes and applies a Material"""
        # With No Selection just create a Material Node
        if not self.nodes:
            m = rs_mat.RSMat()
            m.create_material()

            # Setup OpenGL Shaders
            o = ogl.rsOGL()
            o.link(m.get_material_builder())
            self.count += 1

        # Check if Called Via RightClickMenu
        if isinstance(self.nodes, Iterable):
            for n in self.nodes:
                # Check against OBJ-Level Nodes and Subnets
                if n.type().category() != hou.objNodeTypeCategory():
                    break
                if not n.isSubNetwork():
                    m = rs_mat.RSMat(self.context, n.name(), None)
                    m.create_material()
                    n.parm("shop_materialpath").set(m.get_path())

                    # Setup OpenGL Shaders
                    o = ogl.rsOGL()
                    o.link(m.get_material_builder())
                    self.count += 1
        else:
            # For Calling Via Right Click Menu
            if self.nodes.type().category() != hou.objNodeTypeCategory():
                return
            if not self.nodes.isSubNetwork():
                m = rs_mat.RSMat(self.context, self.nodes.name(), None)
                m.create_material()
                self.nodes.parm("shop_materialpath").set(m.get_path())

                # Setup OpenGL Shaders
                o = ogl.rsOGL()
                o.link(m.get_material_builder())
                self.count += 1
        self.display_message()
コード例 #2
0
ファイル: core.py プロジェクト: eglaubauf/egRedshiftTools
    def create_material(self):
        """Creates a RS-Material with the context given"""
        # Create RS Material
        if self.get_context_name() != "mat":
            self.context = self.context.createNode("matnet")

        # Create Material
        self.material = eg_RSMat.RSMat(self.context, self.name, self.files)
        self.material.create_material(self.cc_diffuse, self.diff_linear, self.triplanar)

        # Apply Material to Selection
        if self.apply:
            self.apply_mat()

        # Create OGL Attributes
        if self.ogl:
            self.create_ogl_attribs()
コード例 #3
0
    def createMaterialFromMantra(self):

        for material in self.mantra_mats:

            name = material.name()

            context = material.node("..")

            materialHandler = rs_mat.RSMat(context, name)
            materialHandler.create_material()

            mb = materialHandler.get_material_builder()

            self.transferAttributes(material, materialHandler)

            if self.convert_and_replace:
                material.destroy()
                mb.setName(name)

            #material.parm("shop_materialpath").set(materialHandler.get_path())

            # Link OpenGl
            o = ogl.rsOGL()
            o.link(mb)