BindBones() публичный Метод

public BindBones ( ) : void
Результат void
Пример #1
0
 private void Bind()
 {
     if (!spriteMeshCache.isBound && spriteMeshCache.spriteMeshInstance)
     {
         spriteMeshCache.RegisterUndo("Bind bones");
         spriteMeshCache.BindBones();
         spriteMeshCache.CalculateAutomaticWeights();
     }
 }
        protected override void DoWindow(int windowId)
        {
            GUI.color = Color.white;

            EditorGUILayout.BeginHorizontal();

            sliceToggle = GUILayout.Toggle(sliceToggle, new GUIContent("Slice", "Slice the sprite"),
                                           EditorStyles.miniButton, GUILayout.Width(50f));

            EditorGUILayout.Space();

            bool holeToggle = GUILayout.Toggle(tool == MeshTool.Hole, new GUIContent("Hole", "Create holes (H)"),
                                               EditorStyles.miniButton, GUILayout.Width(50f));

            if (holeToggle)
            {
                tool = MeshTool.Hole;
            }
            else
            {
                tool = MeshTool.None;
            }

            EditorGUILayout.Space();

            EditorGUI.BeginDisabledGroup(!spriteMeshCache.spriteMeshInstance);

            if (GUILayout.Toggle(spriteMeshCache.isBound, new GUIContent("Bind", "Bind bones"),
                                 EditorStyles.miniButtonLeft, GUILayout.Width(50f)))
            {
                if (!spriteMeshCache.isBound && spriteMeshCache.spriteMeshInstance)
                {
                    spriteMeshCache.RegisterUndo("Bind bones");
                    spriteMeshCache.BindBones();
                    spriteMeshCache.CalculateAutomaticWeights();
                }
            }

            EditorGUI.EndDisabledGroup();

            if (GUILayout.Toggle(!spriteMeshCache.isBound, new GUIContent("Unbind", "Clear binding data"),
                                 EditorStyles.miniButtonRight, GUILayout.Width(50f)))
            {
                if (spriteMeshCache.isBound)
                {
                    spriteMeshCache.RegisterUndo("Clear weights");
                    spriteMeshCache.ClearWeights();
                }
            }

            GUILayout.Space(1f);

            EditorGUILayout.EndHorizontal();
        }