Example #1
0
        public override void OnHandleMove(pb_Transform transform)
        {
            pb_Transform delta = (transform - handleTransformOrigin);

            if (global)
            {
                Transform.SetTRS(handleTransformOrigin);

                Transform[] parents = new Transform[pb_Selection.GameObjects.Count];

                for (int i = 0; i < pb_Selection.GameObjects.Count; i++)
                {
                    GameObject go = pb_Selection.GameObjects[i];
                    go.transform.SetTRS(selectionTransformOrigin[i]);
                    parents[i]          = go.transform.parent;
                    go.transform.parent = Transform;
                }

                Transform.SetTRS(transform);

                for (int i = 0; i < pb_Selection.GameObjects.Count; i++)
                {
                    pb_Selection.GameObjects[i].transform.parent = parents[i];
                }
            }
            else
            {
                for (int i = 0; i < pb_Selection.GameObjects.Count; i++)
                {
                    GameObject go = pb_Selection.GameObjects[i];
                    go.transform.SetTRS(selectionTransformOrigin[i] + delta);
                }
            }
        }
Example #2
0
        public void ApplyState(Hashtable values)
        {
            this.target = (Transform)values["target"];
            pb_Transform ser = (pb_Transform)values["transform"];

            this.target.SetTRS(ser);
        }
Example #3
0
        public override void OnHandleBegin(pb_Transform transform)
        {
            handleTransformOrigin = transform;
            CacheSelectionTransforms();

            List <IUndo> undoGroup = pb_Selection.gameObjects.Select(x => (IUndo) new UndoTransform(x.transform)).ToList();

            Undo.RegisterStates(undoGroup, handle.GetTool().ToString() + " Tool");
        }
Example #4
0
        /**
         * Store the transform of each selected gameObject in selectionTransformOrigin array.
         */
        void CacheSelectionTransforms()
        {
            int count = pb_Selection.gameObjects.Count;

            selectionTransformOrigin = new pb_Transform[count];
            for (int i = 0; i < count; i++)
            {
                selectionTransformOrigin[i] = new pb_Transform(pb_Selection.gameObjects[i].transform);
            }
        }
Example #5
0
#pragma warning restore IDE1006

        /**
         * Set a UnityEngine.Transform with a Runtime.pb_Transform.
         */
        public static void SetTRS(this Transform transform, pb_Transform pbTransform)
        {
            transform.position      = pbTransform.Position;
            transform.localRotation = pbTransform.Rotation;
            transform.localScale    = pbTransform.Scale;
        }
Example #6
0
 /**
  * Called any time a handle is moved.  OnHandleBegin will always be called prior, and OnHandleFinish will be called
  * post.
  */
 public virtual void OnHandleMove(pb_Transform transform)
 {
 }
Example #7
0
 /**
  *	`OnHandleBegin` is called at the start of a handle interaction.  `transform` is the handle's transform
  *	prior to any movement.
  */
 public virtual void OnHandleBegin(pb_Transform transform)
 {
 }