コード例 #1
0
        static void Setup(AnimationHolder ah)
        {
            ah.name = ahName;
            if (!ah.transform.parent || !ah.transform.parent.GetComponent <AnimationCarrier>())
            {
                ah.transform.parent             = new GameObject(parentName).AddComponent <AnimationCarrier>().transform;
                ah.transform.parent.position    = Vector3.zero;
                ah.transform.parent.eulerAngles = Vector3.zero;
            }
            ah.animationObjectsParentNonAR = GameObject.Find(aopNARName);
            if (!ah.animationObjectsParentNonAR)
            {
                ah.animationObjectsParentNonAR = new GameObject(aopNARName);
            }

            ah.animationObjectsParentAR = GameObject.Find(aopARName);
            if (!ah.animationObjectsParentAR)
            {
                ah.animationObjectsParentAR = new GameObject(aopARName);
            }

            Transform aopn = ah.animationObjectsParentNonAR.transform;
            Transform aop  = ah.animationObjectsParentAR.transform;

            ah.transform.position    = aopn.position = aop.position = Vector3.zero;
            ah.transform.eulerAngles = aopn.eulerAngles = aop.eulerAngles = Vector3.zero;
            ah.transform.localScale  = aopn.localScale = aop.localScale = Vector3.one;
            aop.transform.parent     = aopn.transform.parent = ah.transform.parent;
            ah.cam = Camera.main.gameObject;
        }
コード例 #2
0
        void NewStep()
        {
            AnimationHolder ah = (AnimationHolder)target;

            Selection.activeGameObject = AnimationStep.CreateEmpty(ah, defStepName).gameObject;
            InitLists();
        }
コード例 #3
0
        void LoadCameraPosition()
        {
            AnimationStep   step   = (AnimationStep)target;
            AnimationHolder holder = step.transform.parent.GetComponent <AnimationHolder>();

            step.cameraPosition.ApplyWorld(holder.cam);
            SceneView.lastActiveSceneView.AlignViewToObject(holder.cam.transform);
        }
コード例 #4
0
        public static AnimationStep CreateEmpty(AnimationHolder holder, string name)
        {
            GameObject carrier = new GameObject();

            carrier.transform.parent           = holder.transform;
            carrier.transform.localPosition    = Vector3.zero;
            carrier.transform.localEulerAngles = Vector3.zero;
            carrier.transform.localScale       = Vector3.one;
            carrier.name = name;
            return(carrier.AddComponent <AnimationStep>());
        }
コード例 #5
0
        void SaveCameraPosition()
        {
            AnimationStep   step   = (AnimationStep)target;
            AnimationHolder holder = step.transform.parent.GetComponent <AnimationHolder>();
            Transform       t      = holder.cam.transform;

            t.position                      = SceneView.lastActiveSceneView.camera.transform.position;
            t.eulerAngles                   = SceneView.lastActiveSceneView.camera.transform.eulerAngles;
            step.cameraPosition             = new TransformData();
            step.cameraPosition.position    = t.position;
            step.cameraPosition.eulerAngles = t.eulerAngles;
            step.cameraPosition.localScale  = t.localScale;
        }
コード例 #6
0
 internal void Initialize(AnimationHolder holder)
 {
     this.holder       = holder;
     animationElements = new List <AnimationElement>();
     foreach (Transform child in transform)
     {
         AnimationElement ae = child.gameObject.GetComponent <AnimationElement>();
         if (!ae)
         {
             Debug.LogError("Object " + child.name + " is not an AnimationElement");
         }
         animationElements.Add(ae);
         ae.Initialize(this, holder);
     }
 }
コード例 #7
0
ファイル: AnimationElement.cs プロジェクト: jiripolcar/VAM
 internal void Initialize(AnimationStep step, AnimationHolder holder)
 {
     this.step               = step;
     this.holder             = holder;
     animationElementObjects = new List <AnimationElementObject>();
     foreach (Transform child in transform)
     {
         AnimationElementObject aeo = child.gameObject.GetComponent <AnimationElementObject>();
         if (!aeo)
         {
             Debug.LogError(name + ": Object " + child.name + " is not an AnimationElementObject");
         }
         animationElementObjects.Add(aeo);
     }
 }
コード例 #8
0
        static public void Clear()
        {
            AnimationHolder ah = FindOrCreateAH();

            if (ah)
            {
                ah.ClearInEditor();
            }

            /*
             * for (int i = ah.animationObjectsParentAR.transform.childCount; i >= 0; i--)
             *  DestroyImmediate(ah.animationObjectsParentAR.transform.GetChild(i));
             *
             * for (int i = ah.animationObjectsParentNonAR.transform.childCount; i >= 0; i--)
             *  DestroyImmediate(ah.animationObjectsParentNonAR.transform.GetChild(i));*/
        }