예제 #1
0
파일: rigging.py 프로젝트: rBrenick/b-tools
def smooth_skin_or_hik_full_body_key():
    if is_skinning():
        ctx = pm.currentCtx()
        pm.artAttrSkinPaintCtx(ctx, e=True, selectedattroper="smooth")
        pm.artAttrSkinPaintCtx(ctx, e=True, clear=True)
    else:
        pm.mel.HIKSetFullBodyKey()
예제 #2
0
파일: rigging.py 프로젝트: rBrenick/b-tools
def delete_history_or_remove_skinning():
    if is_skinning():
        ctx = pm.currentCtx()
        pm.artAttrSkinPaintCtx(ctx, e=True, selectedattroper="absolute")
        pm.artAttrSkinPaintCtx(ctx, e=True, opacity=1.0)
        pm.artAttrSkinPaintCtx(ctx, e=True, value=0.0)
        pm.artAttrSkinPaintCtx(ctx, e=True, clear=True)

    else:
        pm.mel.DeleteHistory()
예제 #3
0
파일: rigging.py 프로젝트: rBrenick/b-tools
def set_key_or_scale_skinweights(weight_value=1.1):
    if is_skinning():
        ctx = pm.currentCtx()
        pm.artAttrSkinPaintCtx(ctx, e=True, selectedattroper="scale")
        if weight_value > 1:
            pm.artAttrSkinPaintCtx(ctx, e=True, maxvalue=weight_value)
        pm.artAttrSkinPaintCtx(ctx, e=True, value=weight_value)
        pm.artAttrSkinPaintCtx(ctx, e=True, clear=True)

    else:
        pm.mel.SetKey()
예제 #4
0
 def onPaintSkinWeight(self):
     currentSelection, get_joint = self.getCurrentSelection(
         assertBone=False)
     pm.select(currentSelection)
     if pm.currentCtx() != 'artAttrSkinContext':
         mm.eval('artAttrSkinToolScript 3;')
     lastJoint = pm.artAttrSkinPaintCtx(pm.currentCtx(),
                                        query=True,
                                        influence=True)
     # artAttrSkinPaintCtx(currentCtx(), edit=True, influence=get_joint[0])
     if get_joint:
         mm.eval('''
         artAttrSkinToolScript 3;
         artSkinInflListChanging "%s" 0;
         artSkinInflListChanging "%s" 1;
         artSkinInflListChanged artAttrSkinPaintCtx;
         artAttrSkinPaintModePaintSelect 1 artAttrSkinPaintCtx;''' %
                 (lastJoint, unicode(get_joint[0])))
예제 #5
0
파일: rigging.py 프로젝트: rBrenick/b-tools
def select_influence_below_or_go_to_min_frame(weight_value=None):
    if is_skinning():
        ctx = pm.currentCtx()

        if not weight_value:
            weight_value = pm.optionVar.get(
                k.OptionVars.SelectVerticesBelowInfluence, 0.01)

        pm.mel.artSkinSelectVertices("artAttrSkinPaintCtx", 0,
                                     0)  # Select affected vertices

        sel = pm.selected()
        target_joint = pm.artAttrSkinPaintCtx(ctx, q=True, influence=True)
        sel_mesh = sel[0].node().getTransform()
        skincluster = pm.PyNode(pm.mel.findRelatedSkinCluster(sel_mesh))

        if not skincluster:
            pm.warning("No Skin Cluster found from selection")
            return

        get_data = skincluster.getPointsAffectedByInfluence(target_joint)
        weight_data = get_data[1]
        vert_data = []
        if len(get_data[0]) > 0:
            for each in get_data[0][0]:
                vert_data.append(each.currentItemIndex())

        sel_list = []
        for vert, weight in zip(vert_data, weight_data):
            if weight < weight_value:
                sel_list.append(sel_mesh.name() + ".vtx[{}]".format(vert))

        if not sel_list:
            sys.stdout.write(
                "No Vertices found below value: {}\n".format(weight_value))
            deselect_skin_vertices_or_unsnap_vertices()
            return

        pm.select(sel_list, replace=True)

    else:
        pm.mel.GoToMinFrame()
예제 #6
0
 def onSetWeightClick(self):
     currentSelection, bones_list = self.getCurrentSelection()
     rul.skin_weight_setter(currentSelection,
                            bones_list,
                            skin_value=self.weightValue,
                            normalized=self.normalizeToggle,
                            hierachy=self.hierachyToggle)
     self.lastSelection = currentSelection
     # show Skin Paint Tools
     if pm.currentCtx() != 'artAttrSkinContext':
         mm.eval('artAttrSkinToolScript 3;')
     lastJoint = pm.artAttrSkinPaintCtx(pm.currentCtx(),
                                        query=True,
                                        influence=True)
     # artAttrSkinPaintCtx(currentCtx(), edit=True, influence=get_joint[0])
     mm.eval('''
     artAttrSkinToolScript 3;
     artSkinInflListChanging "%s" 0;
     artSkinInflListChanging "%s" 1;
     artSkinInflListChanged artAttrSkinPaintCtx;
     artAttrSkinPaintModePaintSelect 1 artAttrSkinPaintCtx;''' %
             (lastJoint, unicode(bones_list[0])))