Ejemplo n.º 1
0
        //中割り
        public static MotionPosState MakeIntermediate2(MotionPos stPos, MotionPos edPos,
                                                       float start, float span, float pos)
        {
            MotionPosState res   = new MotionPosState();
            float          frame = (((pos + 1) - start) / span);    //0~1

            foreach (enEditPartsType item in Enum.GetValues(typeof(enEditPartsType)))
            {
                float posx = IntermediateCurve(frame, edPos.GetCurveX(item), stPos.GetPos(item).x, edPos.GetPos(item).x);
                float posy = IntermediateCurve(frame, edPos.GetCurveY(item), stPos.GetPos(item).y, edPos.GetPos(item).y);

                if ((item != enEditPartsType.Arm) &&
                    (item != enEditPartsType.Leg))
                {
                    //ArmLegAnt以外
                    res.SetPos(item, new Vector2Int(
                                   (int)Math.Round(posx),
                                   (int)Math.Round(posy)));
                }
            }

            float armX = IntermediateCurve(frame, edPos.GetCurveX(enEditPartsType.Arm), stPos.GetPos(enEditPartsType.Arm).x, edPos.GetPos(enEditPartsType.Arm).x);
            float legX = IntermediateCurve(frame, edPos.GetCurveX(enEditPartsType.Leg), stPos.GetPos(enEditPartsType.Leg).x, edPos.GetPos(enEditPartsType.Leg).x);

            armX = (armX * BasePosition.CORE_ANGLE_MAG) + BasePosition.CORE_ANGLE;
            legX = (legX * BasePosition.CORE_ANGLE_MAG) + BasePosition.CORE_ANGLE;

            armX = Mathf.Cos(armX * Mathf.Deg2Rad) * BasePosition.CORE_BREAST_SIZE;
            legX = Mathf.Cos(legX * Mathf.Deg2Rad) * BasePosition.CORE_WAIST_SIZE;

            res.SetPosJoint((int)Math.Round(armX), (int)Math.Round(legX));

            return(res);
        }
Ejemplo n.º 2
0
        List <MotionPosState> GetIntermediatePos()
        {
            List <MotionPosState> res = new List <MotionPosState>();
            int nowFrame = 0;

            for (int i = 0; i < tackPoints_.Count; i++)
            {
                var       nowTack  = tackPoints_[i];
                TackPoint prevTack = (i > 0)
                                        ? tackPoints_[i - 1]
                                        : new TackPoint();

                for (int i2 = 0; i2 < nowTack.span_; i2++)
                {
                    var intermediate = MotionPos.MakeIntermediate2(
                        prevTack.motionData_.mPos,
                        nowTack.motionData_.mPos,
                        nowTack.start_, nowTack.span_, nowFrame);
                    res.Add(intermediate);
                    nowFrame++;
                }
            }

            return(res);
        }
Ejemplo n.º 3
0
        //遅延命令
        public void Emit(OnTrackEvent onTrackEvent)
        {
            var type = onTrackEvent.eventType;

            // tack events.
            switch (type)
            {
            case OnTrackEvent.EventType.EVENT_PARTS_MOVED:
            {
                //Undo.RecordObject(this, "Parts Moved");
                //Debug.Log("Parts Moved");
                parent_.NeedSave();
                return;
            }

            case OnTrackEvent.EventType.EVENT_PARTS_COPY:
            {
                var activeTack = parent_.GetActiveScore().GetActiveTackPoint();
                clipPos_ = activeTack.motionData_.mPos;

                return;
            }

            case OnTrackEvent.EventType.EVENT_PARTS_PASTE:
            {
                Undo.RecordObject(this, "Parts Paste");
                var activeTack = parent_.GetActiveScore().GetActiveTackPoint();
                activeTack.motionData_.mPos = clipPos_;
                SetupPartsData(true);
                return;
            }

            default:
            {
                //親に投げる
                ParentEmit(onTrackEvent);
                break;
            }
            }
        }
Ejemplo n.º 4
0
        ////タックのデータをサブウインドウに移す
        // void SetHoldPartsData(enPartsType partsType, Vector2Int pos, PartsTransformState partsTransform, MotionHoldState motionHold)
        //{
        //	//この段階でエディタ用のパーツごとの位置補正がされるので、全体反転や全体回転もここで加味する
        //	//反転が入っている場合は左右があるパーツは、X位置を反転させ、逆側の基礎位置を使用する
        //	if (motionHold.mirror) pos.x = -pos.x;
        //	//回転が入っている場合は基礎位置設定後、原点パーツが原点になるように移動させ、原点を中心に回転し、移動させた分をそのまま戻す

        //	pos += BasePosition.GetPosEdit(partsType, motionHold.mirror);
        //	//HOLDは足下原点ではなく、ボディ原点にする
        //	pos -= BasePosition.GetPosEdit(enPartsType.Body, false);
        //	Vector2Int tempPos = pos;
        //	switch ((enPartsRotate)motionHold.rotate)
        //	{
        //		case enPartsRotate.Rotate0:
        //			break;
        //		case enPartsRotate.Rotate90:
        //			pos.x = -tempPos.y;
        //			pos.y = tempPos.x;
        //			break;
        //		case enPartsRotate.Rotate180:
        //			pos.x = -tempPos.x;
        //			pos.y = -tempPos.y;
        //			break;
        //		case enPartsRotate.Rotate270:
        //			pos.x = tempPos.y;
        //			pos.y = -tempPos.x;
        //			break;
        //	}
        //	//pos += BasePosition.GetPosEdit(enPartsType.Body, false);
        //	partsTransform.rotate = ((partsTransform.rotate + motionHold.rotate) % 360);

        //}

        void SetupPartsPos()
        {
            //Pos
            var selectedFrameAndPrevPos = parent_.GetActiveScore().GetSelectedFrameAndPrevPos(selectedFrame_);

            if (selectedFrameAndPrevPos.Count == 0)
            {
                return;
            }

            TackPoint prevTack = (selectedFrameAndPrevPos.Count == 2)
                                ? selectedFrameAndPrevPos[1]
                                : new TackPoint(); //最初のタックは前がないのでニュートラル

            TackPoint selectedTack = selectedFrameAndPrevPos[0];

            //中間モーション生成
            var intermediate = MotionPos.MakeIntermediate2(
                prevTack.motionData_.mPos,
                selectedTack.motionData_.mPos,
                selectedTack.start_, selectedTack.span_, selectedFrame_);

            sendMotion_.stPos = intermediate;
        }
Ejemplo n.º 5
0
 public MotionTackPos()
 {
     this.data = new MotionPos();
 }
Ejemplo n.º 6
0
 public MotionTackPos(int start, int span, MotionPos data) : base(start, span)
 {
     this.data = data;
 }