Example #1
0
        private void AttachLimbMarker()
        {
            var chara = FkCharaMgr.FindSelectChara();

            if (chara == null)
            {
                return;
            }
            chara.Limbs().Foreach(b =>
            {
                var marker = BoneMarker.Create(b.Transform);
                _limbMarkers.Add(marker);
                marker.OnDrag = (m) =>
                {
                    var screenVec = m.MouseEndPos - m.MouseStartPos;
                    var pos       = Kit.MapScreenVecToWorld(screenVec, b.Transform.position);
                    FkJointAssist.MoveEnd(b.GuideObject, pos);
                };
                marker.OnMidClick = (m) =>
                {
//                    ClearLimbMarker();
                    DisableLimbMarker();
                    _follower = b;
                    AttachSelectorMarker();
                };
                marker.OnRightClick = (m) => { ToggleLockBone(b, m); };
                marker.OnLeftDown   = (m) => { UndoRedoHelper.Record(); };
                marker.OnLeftUp     = (m) => { UndoRedoHelper.Finish(); };
            });
        }
Example #2
0
        private void InnerUpdate()
        {
            var go = Context.GuideObjectManager().selectObject;

            if (go == null)
            {
                return;
            }
            float angle = 0.5f;
            float dist  = 0.002f;

            if (Input.anyKeyDown)
            {
                UndoRedoHelper.Record();
            }
            if (Input.GetKey(KeyCode.LeftShift))
            {
                angle /= 4;
                dist  /= 4;
            }
            _counter++;
            if (Input.GetKey(KeyCode.LeftShift) && Input.GetKeyDown(KeyCode.R))
            {
                go.Reset();
            }
            //
            else if (Input.GetKey(KeyCode.E) && Input.GetMouseButton(0))
            {
                go.Rotate(angle, 0, 0);
            }
            else if (Input.GetKey(KeyCode.E) && Input.GetMouseButton(1))
            {
                go.Rotate(-angle, 0, 0);
            }
            //
            else if (Input.GetKey(KeyCode.S) && Input.GetMouseButton(0))
            {
                go.Rotate(0, angle, 0);
            }
            else if (Input.GetKey(KeyCode.S) && Input.GetMouseButton(1))
            {
                go.Rotate(0, -angle, 0);
            }
            //
            else if (Input.GetKey(KeyCode.D) && Input.GetMouseButton(0))
            {
                go.Rotate(0, 0, angle);
            }
            else if (Input.GetKey(KeyCode.D) && Input.GetMouseButton(1))
            {
                go.Rotate(0, 0, -angle);
            }
            //
            else if (Input.GetKey(KeyCode.X) && Input.GetMouseButton(0))
            {
                FkJointAssist.Forward(go, dist);
            }
            else if (Input.GetKey(KeyCode.X) && Input.GetMouseButton(1))
            {
                FkJointAssist.Forward(go, -dist);
            }
            //
            else if (Input.GetKey(KeyCode.C) && Input.GetMouseButton(0))
            {
                FkJointAssist.Tangent(go, angle);
            }
            else if (Input.GetKey(KeyCode.C) && Input.GetMouseButton(1))
            {
                FkJointAssist.Tangent(go, -angle);
            }
            //
            else if (Input.GetKey(KeyCode.V) && Input.GetMouseButton(0))
            {
                FkJointAssist.Normals(go, angle);
            }
            else if (Input.GetKey(KeyCode.V) && Input.GetMouseButton(1))
            {
                FkJointAssist.Normals(go, -angle);
            }
            //
            else if (Input.GetKey(KeyCode.B) && Input.GetMouseButton(0))
            {
                FkJointAssist.Revolution(go, angle);
            }
            else if (Input.GetKey(KeyCode.B) && Input.GetMouseButton(1))
            {
                FkJointAssist.Revolution(go, -angle);
            }
            //
            else if (Input.GetKey(KeyCode.G) && Input.GetMouseButton(0))
            {
                FkJointAssist.MoveEndX(go, dist);
            }
            else if (Input.GetKey(KeyCode.G) && Input.GetMouseButton(1))
            {
                FkJointAssist.MoveEndX(go, -dist);
            }
            //
            else if (Input.GetKey(KeyCode.Y) && Input.GetMouseButton(0))
            {
                FkJointAssist.MoveEndY(go, dist);
            }
            else if (Input.GetKey(KeyCode.Y) && Input.GetMouseButton(1))
            {
                FkJointAssist.MoveEndY(go, -dist);
            }
            //
            else if (Input.GetKey(KeyCode.H) && Input.GetMouseButton(0))
            {
                FkJointAssist.MoveEndZ(go, dist);
            }
            else if (Input.GetKey(KeyCode.H) && Input.GetMouseButton(1))
            {
                FkJointAssist.MoveEndZ(go, -dist);
            }
            //
            else
            {
                if (_counter > 1)
                {
                    UndoRedoHelper.Finish();
//                    FinishRotate();
                }
                _counter = 0;
//                _oldRot = CollectOldRot();
            }
        }