Exemple #1
0
    def clean_rig(self):
        self.jnt_input_grp.setAttr("visibility", 0)
        self.parts_grp.setAttr("visibility", 0)
        self.guides_grp.setAttr("visibility", 0)

        for loc in self.created_locs:
            loc_shape = loc.getShape()
            loc_shape.setAttr("visibility", 0)

        for ctrl in self.created_fk_ctrls:
            rig_lib.clean_ctrl(ctrl, 14, trs="ts")

        for ctrl in self.created_ik_ctrls:
            rig_lib.clean_ctrl(ctrl, 17, trs="s")

        rig_lib.clean_ctrl(self.created_pelvis_ctrl, 14, trs="t")

        if len(self.model.space_list) > 0:
            if self.model.ik_creation_switch == 0:
                self.created_fk_ctrls[-1].setAttr("space", len(self.model.space_list))
            else:
                self.created_ik_ctrls[-1].setAttr("space", len(self.model.space_list))

        info_crv = rig_lib.signature_shape_curve("{0}_INFO".format(self.model.module_name))
        info_crv.getShape().setAttr("visibility", 0)
        info_crv.setAttr("hiddenInOutliner", 1)
        info_crv.setAttr("translateX", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("translateY", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("translateZ", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("rotateX", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("rotateY", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("rotateZ", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("scaleX", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("scaleY", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("scaleZ", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("visibility", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("overrideEnabled", 1)
        info_crv.setAttr("overrideDisplayType", 2)
        pmc.parent(info_crv, self.parts_grp)

        rig_lib.add_parameter_as_extra_attr(info_crv, "Module", "horizontal_spine")
        rig_lib.add_parameter_as_extra_attr(info_crv, "parent_Module", self.model.selected_module)
        rig_lib.add_parameter_as_extra_attr(info_crv, "parent_output", self.model.selected_output)
        rig_lib.add_parameter_as_extra_attr(info_crv, "how_many_jnts", self.model.how_many_jnts)
        rig_lib.add_parameter_as_extra_attr(info_crv, "how_many_ctrls", self.model.how_many_ctrls)
        rig_lib.add_parameter_as_extra_attr(info_crv, "ik_creation", self.model.ik_creation_switch)
        rig_lib.add_parameter_as_extra_attr(info_crv, "stretch_creation", self.model.stretch_creation_switch)
        rig_lib.add_parameter_as_extra_attr(info_crv, "local_spaces", self.model.space_list)

        if not pmc.objExists("jnts_to_SKN_SET"):
            skn_set = pmc.createNode("objectSet", n="jnts_to_SKN_SET")
        else:
            skn_set = pmc.ls("jnts_to_SKN_SET", type="objectSet")[0]
        for jnt in self.jnts_to_skin:
            if type(jnt) == list:
                for obj in jnt:
                    skn_set.add(obj)
            else:
                skn_set.add(jnt)
Exemple #2
0
    def clean_rig(self):
        self.jnt_input_grp.setAttr("visibility", 0)
        self.parts_grp.setAttr("visibility", 0)

        all_ctrls = self.top_ctrls + self.bot_ctrls + self.sides_ctrls
        all_fol = self.top_ctrls_fol + self.bot_ctrls_fol + self.sides_ctrls_fol

        for i, ctrl in enumerate(all_ctrls):
            if all_fol[i].getAttr("translateX") > 0.02:
                color_value = 6
            elif all_fol[i].getAttr("translateX") < -0.02:
                color_value = 13
            else:
                color_value = 14

            all_fol[i].getShape().setAttr("visibility", 0)

            rig_lib.clean_ctrl(ctrl, color_value, trs="s")
            rig_lib.clean_ctrl(ctrl.getParent(), color_value, trs="trs")
            rig_lib.clean_ctrl(ctrl.getParent().getParent(), color_value, trs="trs")
            rig_lib.clean_ctrl(ctrl.getParent().getParent().getParent(), color_value, trs="trs")

        info_crv = rig_lib.signature_shape_curve("{0}_INFO".format(self.model.module_name))
        info_crv.getShape().setAttr("visibility", 0)
        info_crv.setAttr("hiddenInOutliner", 1)
        info_crv.setAttr("translateX", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("translateY", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("translateZ", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("rotateX", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("rotateY", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("rotateZ", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("scaleX", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("scaleY", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("scaleZ", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("visibility", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("overrideEnabled", 1)
        info_crv.setAttr("overrideDisplayType", 2)
        pmc.parent(info_crv, self.parts_grp)

        rig_lib.add_parameter_as_extra_attr(info_crv, "Module", "ribbons")
        rig_lib.add_parameter_as_extra_attr(info_crv, "mesh_to_follow", self.model.mesh_to_follow)
        rig_lib.add_parameter_as_extra_attr(info_crv, "top_creation_switch", self.model.top_creation_switch)
        rig_lib.add_parameter_as_extra_attr(info_crv, "top_selection", self.model.top_selection)
        rig_lib.add_parameter_as_extra_attr(info_crv, "bot_creation_switch", self.model.bot_creation_switch)
        rig_lib.add_parameter_as_extra_attr(info_crv, "bot_selection", self.model.bot_selection)
        rig_lib.add_parameter_as_extra_attr(info_crv, "how_many_top_ctrls", self.model.how_many_top_ctrls)
        rig_lib.add_parameter_as_extra_attr(info_crv, "how_many_bot_ctrls", self.model.how_many_bot_ctrls)
        rig_lib.add_parameter_as_extra_attr(info_crv, "loft_axis", self.model.loft_axis)

        if not pmc.objExists("facial_jnts_to_SKN_SET"):
            skn_set = pmc.createNode("objectSet", n="facial_jnts_to_SKN_SET")
        else:
            skn_set = pmc.ls("facial_jnts_to_SKN_SET", type="objectSet")[0]
        for jnt in self.jnts_to_skin:
            if type(jnt) == list:
                for obj in jnt:
                    skn_set.add(obj)
            else:
                skn_set.add(jnt)
Exemple #3
0
    def clean_rig(self):
        self.jnt_input_grp.setAttr("visibility", 0)
        self.parts_grp.setAttr("visibility", 0)
        self.guides_grp.setAttr("visibility", 0)

        rig_lib.clean_ctrl(self.created_ctrls[0], 18, trs="s")
        rig_lib.clean_ctrl(self.created_ctrls[0].getParent(), 18, trs="trs")
        rig_lib.clean_ctrl(self.created_ctrls[1], 6, trs="ts")
        rig_lib.clean_ctrl(self.created_ctrls[2], 13, trs="ts")

        info_crv = rig_lib.signature_shape_curve("{0}_INFO".format(
            self.model.module_name))
        info_crv.getShape().setAttr("visibility", 0)
        info_crv.setAttr("hiddenInOutliner", 1)
        info_crv.setAttr("translateX",
                         lock=True,
                         keyable=False,
                         channelBox=False)
        info_crv.setAttr("translateY",
                         lock=True,
                         keyable=False,
                         channelBox=False)
        info_crv.setAttr("translateZ",
                         lock=True,
                         keyable=False,
                         channelBox=False)
        info_crv.setAttr("rotateX", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("rotateY", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("rotateZ", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("scaleX", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("scaleY", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("scaleZ", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("visibility",
                         lock=True,
                         keyable=False,
                         channelBox=False)
        info_crv.setAttr("overrideEnabled", 1)
        info_crv.setAttr("overrideDisplayType", 2)
        pmc.parent(info_crv, self.parts_grp)

        rig_lib.add_parameter_as_extra_attr(info_crv, "Module", "head")
        rig_lib.add_parameter_as_extra_attr(info_crv, "parent_Module",
                                            self.model.selected_module)
        rig_lib.add_parameter_as_extra_attr(info_crv, "parent_output",
                                            self.model.selected_output)

        if not pmc.objExists("jnts_to_SKN_SET"):
            skn_set = pmc.createNode("objectSet", n="jnts_to_SKN_SET")
        else:
            skn_set = pmc.ls("jnts_to_SKN_SET", type="objectSet")[0]
        for jnt in self.jnts_to_skin:
            if type(jnt) == list:
                for obj in jnt:
                    skn_set.add(obj)
            else:
                skn_set.add(jnt)
Exemple #4
0
    def execute(self):
        self.prebuild()

        self.delete_existing_objects()
        self.connect_to_parent()

        cog_shape = rig_lib.large_box_curve("{0}_CTRL_shape".format(self.model.module_name))
        cog_ctrl = rig_lib.create_jnttype_ctrl(name="{0}_CTRL".format(self.model.module_name), shape=cog_shape,
                                               drawstyle=2)
        cog_ofs = pmc.group(cog_ctrl, n="{0}_ctrl_OFS".format(self.model.module_name))
        cog_ofs.setAttr("translate", pmc.xform(self.guide, q=1, ws=1, translation=1))
        pmc.parent(cog_ofs, self.ctrl_input_grp)

        rig_lib.create_output(name="{0}_OUTPUT".format(self.model.module_name), parent=cog_ctrl)

        rig_lib.clean_ctrl(cog_ctrl, 20, trs="s")

        self.jnt_input_grp.setAttr("visibility", 0)
        self.parts_grp.setAttr("visibility", 0)
        self.guides_grp.setAttr("visibility", 0)

        info_crv = rig_lib.signature_shape_curve("{0}_INFO".format(self.model.module_name))
        info_crv.getShape().setAttr("visibility", 0)
        info_crv.setAttr("hiddenInOutliner", 1)
        info_crv.setAttr("translateX", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("translateY", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("translateZ", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("rotateX", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("rotateY", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("rotateZ", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("scaleX", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("scaleY", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("scaleZ", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("visibility", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("overrideEnabled", 1)
        info_crv.setAttr("overrideDisplayType", 2)
        pmc.parent(info_crv, self.parts_grp)

        rig_lib.add_parameter_as_extra_attr(info_crv, "Module", "cog")
        rig_lib.add_parameter_as_extra_attr(info_crv, "parent_Module", self.model.selected_module)
        rig_lib.add_parameter_as_extra_attr(info_crv, "parent_output", self.model.selected_output)

        pmc.select(cl=1)
Exemple #5
0
    def execute(self):
        self.prebuild()
        check_list = [
            "{0}_RIG".format(self.model.character_name), "GEO_GRP", "CTRL_GRP",
            "JNT_GRP", "MESH_GRP", "PARTS_GRP", "global_CTRL",
            "{0}_global_OUTPUT".format(self.model.module_name),
            "{0}_local_INPUT".format(self.model.module_name),
            "{0}_local_ctrl_OFS".format(self.model.module_name),
            "{0}_local_CTRL".format(self.model.module_name),
            "{0}_local_ctrl_OUTPUT".format(self.model.module_name),
            "{0}_global_scale_MDL".format(self.model.module_name)
        ]
        if rig_lib.exists_check(check_list):
            pmc.select(cl=1)
            return

        if rig_lib.exists_check("{0}_RIG".format(self.model.character_name)):
            pmc.delete("{0}_RIG".format(self.model.character_name))

        main_grp = pmc.group(em=1,
                             n="{0}_RIG".format(self.model.character_name))
        geo_grp = pmc.group(em=1, n="GEO_GRP")
        ctrl_grp = pmc.group(em=1, n="CTRL_GRP")
        jnt_grp = pmc.group(em=1, n="JNT_GRP")
        mesh_grp = pmc.group(em=1, n="MESH_GRP")
        parts_grp = pmc.group(em=1, n="PARTS_GRP")
        global_shape = rig_lib.square_arrow_curve(
            "{0}_global_CTRL_shape".format(self.model.module_name))
        global_ctrl = rig_lib.create_jnttype_ctrl(name="global_CTRL",
                                                  shape=global_shape,
                                                  drawstyle=2)
        global_output = pmc.spaceLocator(p=(0, 0, 0),
                                         n="{0}_global_OUTPUT".format(
                                             self.model.module_name))
        global_output.visibility.set(0)

        pmc.parent(geo_grp, ctrl_grp, jnt_grp, mesh_grp, parts_grp,
                   global_ctrl, main_grp)
        pmc.parent(global_output, global_ctrl, r=1)
        local_input = pmc.group(em=1,
                                n="{0}_local_ctrl_INPUT".format(
                                    self.model.module_name))
        pmc.parent(local_input, ctrl_grp, r=1)

        rig_lib.matrix_constraint(global_output, local_input, srt="trs")

        local_shape = pmc.circle(c=(0, 0, 0),
                                 nr=(0, 1, 0),
                                 sw=360,
                                 r=5,
                                 d=3,
                                 s=8,
                                 n="{0}_local_CTRL_shape".format(
                                     self.model.module_name),
                                 ch=0)[0]
        local_ctrl = rig_lib.create_jnttype_ctrl(name="{0}_local_CTRL".format(
            self.model.module_name),
                                                 shape=local_shape,
                                                 drawstyle=2)
        pmc.parent(local_ctrl, local_input, r=1)

        rig_lib.create_output(name="{0}_local_ctrl_OUTPUT".format(
            self.model.module_name),
                              parent=local_ctrl)

        global_scale_mult_node = pmc.createNode(
            "multDoubleLinear",
            n="{0}_global_mult_local_scale_MDL".format(self.model.module_name))

        global_ctrl.scaleY >> global_ctrl.scaleX
        global_ctrl.scaleY >> global_ctrl.scaleZ
        local_ctrl.scaleY >> local_ctrl.scaleX
        local_ctrl.scaleY >> local_ctrl.scaleZ
        global_ctrl.scaleY >> global_scale_mult_node.input1
        local_ctrl.scaleY >> global_scale_mult_node.input2
        pmc.aliasAttr("global_scale", global_ctrl.scaleY)
        pmc.aliasAttr("local_scale", local_ctrl.scaleY)

        global_ctrl.setAttr("scaleX",
                            lock=True,
                            keyable=False,
                            channelBox=False)
        global_ctrl.setAttr("scaleY", keyable=False, channelBox=True)
        global_ctrl.setAttr("scaleZ",
                            lock=True,
                            keyable=False,
                            channelBox=False)
        local_ctrl.setAttr("scaleX",
                           lock=True,
                           keyable=False,
                           channelBox=False)
        local_ctrl.setAttr("scaleY", keyable=False, channelBox=True)
        local_ctrl.setAttr("scaleZ",
                           lock=True,
                           keyable=False,
                           channelBox=False)

        rig_lib.clean_ctrl(global_ctrl, 3, trs="")
        rig_lib.clean_ctrl(local_ctrl, 17, trs="")

        info_crv = rig_lib.signature_shape_curve("{0}_INFO".format(
            self.model.module_name))
        info_crv.getShape().setAttr("visibility", 0)
        info_crv.setAttr("hiddenInOutliner", 1)
        info_crv.setAttr("translateX",
                         lock=True,
                         keyable=False,
                         channelBox=False)
        info_crv.setAttr("translateY",
                         lock=True,
                         keyable=False,
                         channelBox=False)
        info_crv.setAttr("translateZ",
                         lock=True,
                         keyable=False,
                         channelBox=False)
        info_crv.setAttr("rotateX", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("rotateY", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("rotateZ", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("scaleX", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("scaleY", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("scaleZ", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("visibility",
                         lock=True,
                         keyable=False,
                         channelBox=False)
        info_crv.setAttr("overrideEnabled", 1)
        info_crv.setAttr("overrideDisplayType", 2)
        pmc.parent(info_crv, parts_grp)

        rig_lib.add_parameter_as_extra_attr(info_crv, "Module",
                                            "mandatory_base")
        rig_lib.add_parameter_as_extra_attr(info_crv, "character_name",
                                            self.model.character_name)

        pmc.select(cl=1)
Exemple #6
0
    def clean_rig(self):
        self.guides_grp.setAttr("visibility", 0)

        for i, fol in enumerate(self.follicles):
            fol.getShape().setAttr("visibility", 0)

            if fol.getAttr("translateX") > 0.02:
                color_value = 6
            elif fol.getAttr("translateX") < -0.02:
                color_value = 13
            else:
                color_value = 14

            rig_lib.clean_ctrl(self.ctrls[i], color_value, trs="s")
            rig_lib.clean_ctrl(self.ctrls[i].getParent(),
                               color_value,
                               trs="trs")
            rig_lib.clean_ctrl(self.ctrls[i].getParent().getParent(),
                               color_value,
                               trs="trs")

            info_crv = rig_lib.signature_shape_curve("{0}_INFO".format(
                self.model.module_name))
            info_crv.getShape().setAttr("visibility", 0)
            info_crv.setAttr("hiddenInOutliner", 1)
            info_crv.setAttr("translateX",
                             lock=True,
                             keyable=False,
                             channelBox=False)
            info_crv.setAttr("translateY",
                             lock=True,
                             keyable=False,
                             channelBox=False)
            info_crv.setAttr("translateZ",
                             lock=True,
                             keyable=False,
                             channelBox=False)
            info_crv.setAttr("rotateX",
                             lock=True,
                             keyable=False,
                             channelBox=False)
            info_crv.setAttr("rotateY",
                             lock=True,
                             keyable=False,
                             channelBox=False)
            info_crv.setAttr("rotateZ",
                             lock=True,
                             keyable=False,
                             channelBox=False)
            info_crv.setAttr("scaleX",
                             lock=True,
                             keyable=False,
                             channelBox=False)
            info_crv.setAttr("scaleY",
                             lock=True,
                             keyable=False,
                             channelBox=False)
            info_crv.setAttr("scaleZ",
                             lock=True,
                             keyable=False,
                             channelBox=False)
            info_crv.setAttr("visibility",
                             lock=True,
                             keyable=False,
                             channelBox=False)
            info_crv.setAttr("overrideEnabled", 1)
            info_crv.setAttr("overrideDisplayType", 2)
            pmc.parent(info_crv, self.parts_grp)

            rig_lib.add_parameter_as_extra_attr(info_crv, "Module",
                                                "blendshapes_ctrls")
            rig_lib.add_parameter_as_extra_attr(info_crv, "mesh_to_follow",
                                                self.model.mesh_to_follow)
            rig_lib.add_parameter_as_extra_attr(info_crv, "how_many_ctrls",
                                                self.model.how_many_ctrls)
Exemple #7
0
    def clean_rig(self):
        self.jnt_input_grp.setAttr("visibility", 0)
        self.parts_grp.setAttr("visibility", 0)
        self.guides_grp.setAttr("visibility", 0)

        if self.model.side == "Left":
            color_value = 6
        else:
            color_value = 13

        if self.model.fk_ik_type == "three_chains":
            fk_visibility_ctrl = pmc.ls("{0}_fk_visibility_MDL".format(
                self.model.selected_module))[0]
            rig_lib.clean_ctrl(
                self.toes_ctrl,
                color_value,
                trs="t",
                visibility_dependence=fk_visibility_ctrl.output1D)

        if self.model.fk_ik_type == "one_chain":
            fk_visibility_ctrl = pmc.ls("{0}_fk_visibility_MDL".format(
                self.model.selected_module))[0]
            rig_lib.clean_ctrl(
                self.created_ctrtl_jnts[1],
                color_value,
                trs="t",
                visibility_dependence=fk_visibility_ctrl.output1D)

            self.created_ctrtl_jnts[0].setAttr("drawStyle", 2)
            self.created_ctrtl_jnts[2].setAttr("drawStyle", 2)

        self.created_locs[2].setAttr("visibility", 0)

        info_crv = rig_lib.signature_shape_curve("{0}_INFO".format(
            self.model.module_name))
        info_crv.getShape().setAttr("visibility", 0)
        info_crv.setAttr("hiddenInOutliner", 1)
        info_crv.setAttr("translateX",
                         lock=True,
                         keyable=False,
                         channelBox=False)
        info_crv.setAttr("translateY",
                         lock=True,
                         keyable=False,
                         channelBox=False)
        info_crv.setAttr("translateZ",
                         lock=True,
                         keyable=False,
                         channelBox=False)
        info_crv.setAttr("rotateX", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("rotateY", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("rotateZ", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("scaleX", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("scaleY", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("scaleZ", lock=True, keyable=False, channelBox=False)
        info_crv.setAttr("visibility",
                         lock=True,
                         keyable=False,
                         channelBox=False)
        info_crv.setAttr("overrideEnabled", 1)
        info_crv.setAttr("overrideDisplayType", 2)
        pmc.parent(info_crv, self.parts_grp)

        rig_lib.add_parameter_as_extra_attr(info_crv, "Module", "foot")
        rig_lib.add_parameter_as_extra_attr(info_crv, "parent_Module",
                                            self.model.selected_module)
        rig_lib.add_parameter_as_extra_attr(info_crv, "parent_output",
                                            self.model.selected_output)
        rig_lib.add_parameter_as_extra_attr(info_crv, "side", self.model.side)
        rig_lib.add_parameter_as_extra_attr(info_crv, "fk_ik_type",
                                            self.model.fk_ik_type)

        if not pmc.objExists("jnts_to_SKN_SET"):
            skn_set = pmc.createNode("objectSet", n="jnts_to_SKN_SET")
        else:
            skn_set = pmc.ls("jnts_to_SKN_SET", type="objectSet")[0]
        for jnt in self.jnts_to_skin:
            if type(jnt) == list:
                for obj in jnt:
                    skn_set.add(obj)
            else:
                skn_set.add(jnt)