Exemplo n.º 1
0
 public void Unassign(List <Node> targetNodes, BindInfo bindPose)
 {
     if (bindPose)
     {
         foreach (Node node in targetNodes)
         {
             BoneWeight boneWeight = GetBoneWeight(node);
             boneWeight.Unassign(bindPoses.IndexOf(bindPose));
             SetBoneWeight(node, boneWeight);
         }
     }
 }
Exemplo n.º 2
0
        public static BoneWeight Weight(BoneWeight boneWeight, int weightIndex, string[] names,
                                        bool mixedBoneIndex = false, bool mixedWeight = false)
        {
            int   boneIndex = 0;
            float weight    = 0f;

            boneWeight.GetWeight(weightIndex, out boneIndex, out weight);

            EditorGUIUtility.labelWidth = 30f;

            EditorGUILayout.BeginHorizontal();

            EditorGUI.BeginChangeCheck();

            EditorGUI.showMixedValue = mixedBoneIndex;
            int newBoneIndex = EditorGUILayout.Popup(boneIndex + 1, names, GUILayout.Width(100f)) - 1;

            EditorGUI.BeginDisabledGroup(newBoneIndex == -1);

            EditorGUI.showMixedValue = mixedWeight;
            weight = EditorGUILayout.Slider(weight, 0f, 1f);

            EditorGUI.EndDisabledGroup();

            EditorGUILayout.EndHorizontal();

            if (EditorGUI.EndChangeCheck())
            {
                if (newBoneIndex == -1)
                {
                    boneWeight.Unassign(boneIndex);
                }

                boneWeight.SetWeight(weightIndex, newBoneIndex, weight);
            }

            return(boneWeight);
        }
Exemplo n.º 3
0
		public static BoneWeight Weight(BoneWeight boneWeight,int weightIndex, string[] names, bool mixedBoneIndex = false, bool mixedWeight = false)
		{
			int boneIndex = 0;
			float weight = 0f;
			
			boneWeight.GetWeight(weightIndex,out boneIndex,out weight);
			
			EditorGUIUtility.labelWidth = 30f;
			
			EditorGUILayout.BeginHorizontal();

			EditorGUI.BeginChangeCheck();

			EditorGUI.showMixedValue = mixedBoneIndex;
			int newBoneIndex = EditorGUILayout.Popup(boneIndex + 1,names,GUILayout.Width(100f)) - 1;

			EditorGUI.BeginDisabledGroup(newBoneIndex == -1);

			EditorGUI.showMixedValue = mixedWeight;
			weight = EditorGUILayout.Slider(weight,0f,1f);
			
			EditorGUI.EndDisabledGroup();
			
			EditorGUILayout.EndHorizontal();

			if(EditorGUI.EndChangeCheck())
			{
				if(newBoneIndex == -1)
				{
					boneWeight.Unassign(boneIndex);
				}
				boneWeight.SetWeight(weightIndex,newBoneIndex,weight);
			}
			
			return boneWeight;
		}