示例#1
0
 private void OnEnable()
 {
     this.skeletonUtility = SkeletonUtility.GetInParent <SkeletonUtility>(base.get_transform());
     if (this.skeletonUtility == null)
     {
         return;
     }
     this.skeletonUtility.RegisterBone(this);
     this.skeletonUtility.OnReset += new SkeletonUtility.SkeletonUtilityDelegate(this.HandleOnReset);
 }
    void FindRenderer()
    {
        if (skeletonRenderer.objectReferenceValue == null)
        {
            SkeletonRenderer parentRenderer = SkeletonUtility.GetInParent <SkeletonRenderer>(component.transform);

            if (parentRenderer != null)
            {
                skeletonRenderer.objectReferenceValue = (UnityEngine.Object)parentRenderer;
            }
        }
    }
    void OnEnable()
    {
        skeletonUtility = SkeletonUtility.GetInParent <SkeletonUtility>(transform);

        if (skeletonUtility == null)
        {
            return;
        }

        skeletonUtility.RegisterBone(this);
        skeletonUtility.OnReset += HandleOnReset;
    }
    override public void OnInspectorGUI()
    {
        if (needsReset)
        {
            component.Reset();
            component.DoUpdate();
            needsReset = false;
            SceneView.RepaintAll();
        }
        serializedObject.Update();

        // FindRenderer()
        if (skeletonRenderer.objectReferenceValue == null)
        {
            SkeletonRenderer parentRenderer = SkeletonUtility.GetInParent <SkeletonRenderer>(component.transform);

            if (parentRenderer != null)
            {
                skeletonRenderer.objectReferenceValue = (UnityEngine.Object)parentRenderer;
            }
        }

        EditorGUILayout.PropertyField(skeletonRenderer);

        if (component.valid)
        {
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.PropertyField(boneName);
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
                needsReset = true;
                serializedObject.Update();
            }

            EditorGUILayout.PropertyField(followBoneRotation);
            EditorGUILayout.PropertyField(followZPosition);
        }
        else
        {
            GUILayout.Label("INVALID");
        }

        if (serializedObject.ApplyModifiedProperties() ||
            (Event.current.type == EventType.ValidateCommand && Event.current.commandName == "UndoRedoPerformed")
            )
        {
            component.Reset();
        }
    }
示例#5
0
 protected virtual void OnEnable()
 {
     this.utilBone        = base.GetComponent <SkeletonUtilityBone>();
     this.skeletonUtility = SkeletonUtility.GetInParent <SkeletonUtility>(base.get_transform());
     this.skeletonUtility.RegisterConstraint(this);
 }
 protected virtual void OnEnable()
 {
     utilBone        = GetComponent <SkeletonUtilityBone>();
     skeletonUtility = SkeletonUtility.GetInParent <SkeletonUtility>(transform);
     skeletonUtility.RegisterConstraint(this);
 }