Exemplo n.º 1
0
        private void DrawTackEffect(TackPoint tackPoint)
        {
            EditorGUI.BeginChangeCheck();
            var se       = EditorGUILayout.IntField("se", tackPoint.motionData_.mEffect.se);
            var particle = (enParticleEffect)EditorGUILayout.EnumPopup("particle", (enParticleEffect)tackPoint.motionData_.mEffect.particle);
            var special  = (enSpecialEffect)EditorGUILayout.EnumPopup("special", (enSpecialEffect)tackPoint.motionData_.mEffect.special);

            if (EditorGUI.EndChangeCheck())
            {
                var    lastData = tackPoint.motionData_.mEffect;
                Action action   = () =>
                {
                    tackPoint.motionData_.mEffect.se       = se;
                    tackPoint.motionData_.mEffect.particle = (int)particle;
                    tackPoint.motionData_.mEffect.special  = (int)special;
                };

                ARIMotionMainWindow.tackCmd_.Do(
                    new MotionCommand(MethodBase.GetCurrentMethod().Name,
                                      () => { action(); },
                                      () => { tackPoint.motionData_.mEffect = lastData; }));

                TackPoint.Emit(new OnTrackEvent(OnTrackEvent.EventType.EVENT_TACK_CHANGE, null));
            }
        }
Exemplo 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);
        }
Exemplo n.º 3
0
        private void DrawTackPassive(TackPoint tackPoint)
        {
            EditorGUI.BeginChangeCheck();
            var isLeft = EditorGUILayout.Toggle("isLeft", tackPoint.motionData_.mPassive.isLeft);
            var isBack = EditorGUILayout.Toggle("isBack", tackPoint.motionData_.mPassive.isBack);
            var faceNo = EditorGUILayout.IntField("faceNo", tackPoint.motionData_.mPassive.faceNo);

            if (EditorGUI.EndChangeCheck())
            {
                var    lastData = tackPoint.motionData_.mPassive;
                Action action   = () =>
                {
                    tackPoint.motionData_.mPassive.isLeft = isLeft;
                    tackPoint.motionData_.mPassive.isBack = isBack;
                    tackPoint.motionData_.mPassive.faceNo = faceNo;
                };

                ARIMotionMainWindow.tackCmd_.Do(
                    new MotionCommand(MethodBase.GetCurrentMethod().Name,
                                      () => { action(); },
                                      () => { tackPoint.motionData_.mPassive = lastData; }));

                TackPoint.Emit(new OnTrackEvent(OnTrackEvent.EventType.EVENT_TACK_CHANGE, null));
            }
        }
Exemplo n.º 4
0
 private void UpdateTackTitle(TackPoint tackPoint)
 {
     //var newTitle = EditorGUILayout.TextField("title", tackPoint.title_);
     //if (newTitle != tackPoint.title_)
     //{
     //	tackPoint.BeforeSave();
     //	tackPoint.title_ = newTitle;
     //	tackPoint.Save();
     //}
 }
Exemplo n.º 5
0
        public TackPoint NewTackToEmptyFrame(int frame, int timelineType)
        {
            var newTackPoint = new TackPoint(
                tackPoints_.Count,
                frame,
                WindowSettings.DEFAULT_TACK_SPAN,
                timelineType
                );

            return(newTackPoint);
        }
Exemplo n.º 6
0
        private void DrawTackSpan(TackPoint tackPoint)
        {
            var start = tackPoint.start_;

            GUILayout.Label("start : " + start);
            var span = tackPoint.span_;
            var end  = start + span - 1;

            GUILayout.Label("end : " + end);
            GUILayout.Label("span : " + span);
        }
Exemplo n.º 7
0
        public void PasteTackToEmptyFrame(int frame, TackPoint clipTack)
        {
            var newTackPoint = new TackPoint(
                tackPoints_.Count,
                frame,
                clipTack
                );

            tackPoints_.Add(newTackPoint);

            ApplyTextureToTacks(index_);
        }
Exemplo n.º 8
0
        public void AddNewTackToEmptyFrame(int frame, TackPoint newTackPoint)
        {
            //var newTackPoint = new TackPoint(
            //	tackPoints_.Count,
            //	frame,
            //	WindowSettings.DEFAULT_TACK_SPAN,
            //	timelineType
            //);
            tackPoints_.Add(newTackPoint);

            ApplyTextureToTacks(index_);
        }
Exemplo n.º 9
0
        //private void DrawTackAtari(TackPoint tackPoint)
        //{
        //	EditorGUI.BeginChangeCheck();
        //	var power = EditorGUILayout.IntField("power", tackPoint.motionData_.mAtari.power);
        //	var isBomb = EditorGUILayout.Toggle("isBomb", tackPoint.motionData_.mAtari.isBomb);
        //	var isHitReset = EditorGUILayout.Toggle("isHitReset", tackPoint.motionData_.mAtari.isHitReset);
        //	var effect = (enAtariEffect)EditorGUILayout.EnumPopup("effect", (enAtariEffect)tackPoint.motionData_.mAtari.effect);

        //	var isHead = EditorGUILayout.Toggle("isHead", tackPoint.motionData_.mAtari.isHead);
        //	var isBody = EditorGUILayout.Toggle("isBody", tackPoint.motionData_.mAtari.isBody);
        //	var isLeftArm = EditorGUILayout.Toggle("isLeftArm", tackPoint.motionData_.mAtari.isLeftArm);
        //	var isRightArm = EditorGUILayout.Toggle("isRightArm", tackPoint.motionData_.mAtari.isRightArm);
        //	var isLeftLeg = EditorGUILayout.Toggle("isLeftLeg", tackPoint.motionData_.mAtari.isLeftLeg);
        //	var isRightLeg = EditorGUILayout.Toggle("isRightLeg", tackPoint.motionData_.mAtari.isRightLeg);
        //	var isAnt = EditorGUILayout.Toggle("isAnt", tackPoint.motionData_.mAtari.isAnt);
        //	var isRightAnt = EditorGUILayout.Toggle("isRightAnt", tackPoint.motionData_.mAtari.isRightAnt);

        //	if (EditorGUI.EndChangeCheck())
        //	{
        //		var lastData = tackPoint.motionData_.mAtari;
        //		Action action = () =>
        //		{
        //			tackPoint.motionData_.mAtari.power = power;
        //			tackPoint.motionData_.mAtari.isHitReset = isHitReset;
        //			tackPoint.motionData_.mAtari.isBomb = isBomb;
        //			tackPoint.motionData_.mAtari.effect = (int)effect;
        //			tackPoint.motionData_.mAtari.isHead = isHead;
        //			tackPoint.motionData_.mAtari.isBody = isBody;
        //			tackPoint.motionData_.mAtari.isLeftArm = isLeftArm;
        //			tackPoint.motionData_.mAtari.isRightArm = isRightArm;
        //			tackPoint.motionData_.mAtari.isLeftLeg = isLeftLeg;
        //			tackPoint.motionData_.mAtari.isRightLeg = isRightLeg;
        //			tackPoint.motionData_.mAtari.isAnt = isAnt;
        //			tackPoint.motionData_.mAtari.isRightAnt = isRightAnt;
        //		};

        //		JMMotionMainWindow.tackCmd_.Do(
        //			new MotionCommand(MethodBase.GetCurrentMethod().Name,
        //			() => { action(); },
        //			() => { tackPoint.motionData_.mAtari = lastData; }));

        //		TackPoint.Emit(new OnTrackEvent(OnTrackEvent.EventType.EVENT_TACK_CHANGE, null));
        //	}
        //}
        //private void DrawTackHold(TackPoint tackPoint)
        //{
        //	EditorGUI.BeginChangeCheck();
        //	int selectedIndex = GetMotionIndex(tackPoint.motionData_.mHold.motionId);
        //	var motionId = EditorGUILayout.Popup("motionId", selectedIndex, GetAllMotionList().ToArray());
        //	var posX = EditorGUILayout.IntField("posX", (int)tackPoint.motionData_.mHold.pos.x);
        //	var posY = EditorGUILayout.IntField("posY", (int)tackPoint.motionData_.mHold.pos.y);
        //	var rotate = (enPartsRotate)EditorGUILayout.EnumPopup("rotate", (enPartsRotate)tackPoint.motionData_.mHold.rotate);
        //	var mirror = EditorGUILayout.Toggle("mirror", tackPoint.motionData_.mHold.mirror);
        //	var isFront = EditorGUILayout.Toggle("isFront", tackPoint.motionData_.mHold.isFront);
        //	var curveX = (enCurve)EditorGUILayout.EnumPopup("curveX", (enCurve)tackPoint.motionData_.mHold.curveX);
        //	var curveY = (enCurve)EditorGUILayout.EnumPopup("curveY", (enCurve)tackPoint.motionData_.mHold.curveY);

        //	if (EditorGUI.EndChangeCheck())
        //	{
        //		var lastData = tackPoint.motionData_.mHold;
        //		Action action = () =>
        //		{
        //			tackPoint.motionData_.mHold.motionId = JMMotionMainWindow.fileList_[motionId];
        //			tackPoint.motionData_.mHold.pos.x = posX;
        //			tackPoint.motionData_.mHold.pos.y = posY;
        //			tackPoint.motionData_.mHold.rotate = (int)rotate;
        //			tackPoint.motionData_.mHold.mirror = mirror;
        //			tackPoint.motionData_.mHold.isFront = isFront;
        //			tackPoint.motionData_.mHold.curveX = (int)curveX;
        //			tackPoint.motionData_.mHold.curveY = (int)curveY;
        //		};

        //		JMMotionMainWindow.tackCmd_.Do(
        //			new MotionCommand(MethodBase.GetCurrentMethod().Name,
        //			() => { action(); },
        //			() => { tackPoint.motionData_.mHold = lastData; }));

        //		TackPoint.Emit(new OnTrackEvent(OnTrackEvent.EventType.EVENT_TACK_CHANGE, null));
        //	}
        //}
        //private void DrawTackThrow(TackPoint tackPoint)
        //{
        //	EditorGUI.BeginChangeCheck();

        //	var posX = EditorGUILayout.IntField("posX", (int)tackPoint.motionData_.mThrow.pos.x);
        //	var posY = EditorGUILayout.IntField("posY", (int)tackPoint.motionData_.mThrow.pos.y);
        //	var deltaX = EditorGUILayout.IntField("deltaX", (int)tackPoint.motionData_.mThrow.delta.x);
        //	var deltaY = EditorGUILayout.IntField("deltaY", (int)tackPoint.motionData_.mThrow.delta.y);
        //	var isLiner = EditorGUILayout.Toggle("mirror", tackPoint.motionData_.mThrow.isLiner);

        //	if (EditorGUI.EndChangeCheck())
        //	{

        //		var lastData = tackPoint.motionData_.mThrow;
        //		Action action = () =>
        //		{
        //			tackPoint.motionData_.mThrow.pos.x = posX;
        //			tackPoint.motionData_.mThrow.pos.y = posY;
        //			tackPoint.motionData_.mThrow.delta.x = deltaX;
        //			tackPoint.motionData_.mThrow.delta.y = deltaY;
        //			tackPoint.motionData_.mThrow.isLiner = isLiner;
        //		};

        //		JMMotionMainWindow.tackCmd_.Do(
        //			new MotionCommand(MethodBase.GetCurrentMethod().Name,
        //			() => { action(); },
        //			() => { tackPoint.motionData_.mThrow = lastData; }));

        //		TackPoint.Emit(new OnTrackEvent(OnTrackEvent.EventType.EVENT_TACK_CHANGE, null));
        //	}
        //}
        private void DrawTackAni(TackPoint tackPoint)
        {
            EditorGUI.BeginChangeCheck();
            var paletteAni = (enPaletteAni)EditorGUILayout.EnumPopup("paletteAni", (enPaletteAni)tackPoint.motionData_.mColor.palette);
            //var transformAni = (enTransformAni)EditorGUILayout.EnumPopup("transformAni", (enTransformAni)tackPoint.motionData_.mAni.transformAni);
            var alphaAni = (enAlphaAni)EditorGUILayout.EnumPopup("alphaAni", (enAlphaAni)tackPoint.motionData_.mColor.alphaAni);
            var alphaVar = EditorGUILayout.IntField("alphaVar", (int)tackPoint.motionData_.mColor.alphaVar);

            var isThorax    = EditorGUILayout.Toggle("isThorax", tackPoint.motionData_.mColor.isBody);
            var isHead      = EditorGUILayout.Toggle("isHead", tackPoint.motionData_.mColor.isHead);
            var isLeftArm   = EditorGUILayout.Toggle("isLeftArm", tackPoint.motionData_.mColor.isLeftArm);
            var isRightArm  = EditorGUILayout.Toggle("isRightArm", tackPoint.motionData_.mColor.isRightArm);
            var isLeftHand  = EditorGUILayout.Toggle("isLeftHand", tackPoint.motionData_.mColor.isLeftHand);
            var isRightHand = EditorGUILayout.Toggle("isRightHand", tackPoint.motionData_.mColor.isRightHand);
            var isLeftLeg   = EditorGUILayout.Toggle("isLeftLeg", tackPoint.motionData_.mColor.isLeftLeg);
            var isRightLeg  = EditorGUILayout.Toggle("isRightLeg", tackPoint.motionData_.mColor.isRightLeg);
            var isLeftFoot  = EditorGUILayout.Toggle("isLeftFoot", tackPoint.motionData_.mColor.isLeftFoot);
            var isRightFoot = EditorGUILayout.Toggle("isRightFoot", tackPoint.motionData_.mColor.isRightFoot);
            var isAnt       = EditorGUILayout.Toggle("isAnt", tackPoint.motionData_.mColor.isAnt);

            if (EditorGUI.EndChangeCheck())
            {
                var    lastData = tackPoint.motionData_.mColor;
                Action action   = () =>
                {
                    tackPoint.motionData_.mColor.palette = (int)paletteAni;
                    //tackPoint.motionData_.mAni.transformAni = (int)transformAni;
                    tackPoint.motionData_.mColor.alphaAni    = (int)alphaAni;
                    tackPoint.motionData_.mColor.alphaVar    = alphaVar;
                    tackPoint.motionData_.mColor.isBody      = isThorax;
                    tackPoint.motionData_.mColor.isHead      = isHead;
                    tackPoint.motionData_.mColor.isLeftArm   = isLeftArm;
                    tackPoint.motionData_.mColor.isRightArm  = isRightArm;
                    tackPoint.motionData_.mColor.isLeftHand  = isLeftHand;
                    tackPoint.motionData_.mColor.isRightHand = isRightHand;
                    tackPoint.motionData_.mColor.isLeftLeg   = isLeftLeg;
                    tackPoint.motionData_.mColor.isRightLeg  = isRightLeg;
                    tackPoint.motionData_.mColor.isLeftFoot  = isLeftFoot;
                    tackPoint.motionData_.mColor.isRightFoot = isRightFoot;
                    tackPoint.motionData_.mColor.isAnt       = isAnt;
                };

                ARIMotionMainWindow.tackCmd_.Do(
                    new MotionCommand(MethodBase.GetCurrentMethod().Name,
                                      () => { action(); },
                                      () => { tackPoint.motionData_.mColor = lastData; }));

                TackPoint.Emit(new OnTrackEvent(OnTrackEvent.EventType.EVENT_TACK_CHANGE, null));
            }
        }
Exemplo n.º 10
0
        //�R�s�y�p
        public TackPoint(int index, int start, TackPoint srcTack)
        {
            this.tackId_ = WindowSettings.ID_HEADER_TACK + Guid.NewGuid().ToString();
            this.index_  = index;
            this.start_  = start;            //�C���f�b�N�X�ƃX�^�[�g�ʒu�͐V�K

            this.IsExistTack_ = true;

            //���f�[�^�lj��̍ۂ̓R�R�ɒlj�
            //this.title_ = srcTack.title_;
            this.span_         = srcTack.span_;
            this.timelineType_ = srcTack.timelineType_;

            //�e��^�C�����C��
            switch ((TimelineType)this.timelineType_)
            {
            case TimelineType.TL_POS:
                motionData_.mPos = srcTack.motionData_.mPos;
                break;

            case TimelineType.TL_TRANSFORM:
                motionData_.mTransform = srcTack.motionData_.mTransform;
                break;

            case TimelineType.TL_MOVE:
                motionData_.mMove = srcTack.motionData_.mMove;
                break;

            //case TimelineType.TL_ATARI: motionData_.mAtari = srcTack.motionData_.mAtari; break;
            //case TimelineType.TL_HOLD: motionData_.mHold = srcTack.motionData_.mHold; break;
            //case TimelineType.TL_THROW: motionData_.mThrow = srcTack.motionData_.mThrow; break;
            case TimelineType.TL_COLOR:
                motionData_.mColor = srcTack.motionData_.mColor;
                break;

            case TimelineType.TL_EFFECT:
                motionData_.mEffect = srcTack.motionData_.mEffect;
                break;

            case TimelineType.TL_PASSIVE:
                motionData_.mPassive = srcTack.motionData_.mPassive;
                break;

            default:
                Debug.LogError("other timelineType_");
                break;
            }
        }
Exemplo n.º 11
0
        public void PasteTackToTimeline(string timelineId, int frame, TackPoint clipTack)
        {
            if (clipTack != null)
            {
                var targetTimeline = TimelinesByIds(new List <string> {
                    timelineId
                })[0];

                //targetTimeline.PasteTackToEmptyFrame(frame, clipTack);
                if (targetTimeline.timelineType_ == clipTack.timelineType_)
                {
                    targetTimeline.PasteTackToEmptyFrame(frame, clipTack);
                    //targetTimeline.AddNewTackToEmptyFrame(frame, clipTack);
                }
            }
        }
Exemplo n.º 12
0
        private void UndoKey()
        {
            if (Event.current.type != EventType.KeyDown)
            {
                return;
            }

            if (Event.current.keyCode == KeyCode.Z)
            {
                ARIMotionMainWindow.tackCmd_.Undo();
                TackPoint.Emit(new OnTrackEvent(OnTrackEvent.EventType.EVENT_TACK_CHANGE, null));
            }
            else if (Event.current.keyCode == KeyCode.Y)
            {
                ARIMotionMainWindow.tackCmd_.Redo();
                TackPoint.Emit(new OnTrackEvent(OnTrackEvent.EventType.EVENT_TACK_CHANGE, null));
            }
        }
Exemplo n.º 13
0
        public TackPoint GetTackById(string selectObjectId)
        {
            TackPoint res = null;

            foreach (var timelineTrack in timelineTracks_)
            {
                if (ARIMotionScoreWindow.IsTackId(selectObjectId))
                {
                    res = timelineTrack.GetTackById(selectObjectId);
                    //見つかったら抜けないとNULLで上書きしてしまう
                    if (res != null)
                    {
                        break;
                    }
                }
            }

            return(res);
        }
Exemplo n.º 14
0
        private void DrawTackTransform(TackPoint tackPoint)
        {
            EditorGUI.BeginChangeCheck();
            var AntRotate       = (enPartsRotate)EditorGUILayout.EnumPopup("Ant.rotate", (enPartsRotate)tackPoint.motionData_.mTransform.ant.rotate);
            var headRotate      = (enPartsRotate)EditorGUILayout.EnumPopup("head.rotate", (enPartsRotate)tackPoint.motionData_.mTransform.head.rotate);
            var bodyRotate      = (enPartsRotate)EditorGUILayout.EnumPopup("body.rotate", (enPartsRotate)tackPoint.motionData_.mTransform.body.rotate);
            var leftArmRotate   = (enPartsRotate)EditorGUILayout.EnumPopup("leftArm.rotate", (enPartsRotate)tackPoint.motionData_.mTransform.leftArm.rotate);
            var rightArmRotate  = (enPartsRotate)EditorGUILayout.EnumPopup("rightArm.rotate", (enPartsRotate)tackPoint.motionData_.mTransform.rightArm.rotate);
            var leftHandRotate  = (enPartsRotate)EditorGUILayout.EnumPopup("leftHand.rotate", (enPartsRotate)tackPoint.motionData_.mTransform.leftHand.rotate);
            var rightHandRotate = (enPartsRotate)EditorGUILayout.EnumPopup("rightHand.rotate", (enPartsRotate)tackPoint.motionData_.mTransform.rightHand.rotate);
            var leftLegRotate   = (enPartsRotate)EditorGUILayout.EnumPopup("leftLeg.rotate", (enPartsRotate)tackPoint.motionData_.mTransform.leftLeg.rotate);
            var rightLegRotate  = (enPartsRotate)EditorGUILayout.EnumPopup("rightLeg.rotate", (enPartsRotate)tackPoint.motionData_.mTransform.rightLeg.rotate);
            var leftFootRotate  = (enPartsRotate)EditorGUILayout.EnumPopup("leftFoot.rotate", (enPartsRotate)tackPoint.motionData_.mTransform.leftFoot.rotate);
            var rightFootRotate = (enPartsRotate)EditorGUILayout.EnumPopup("rightFoot.rotate", (enPartsRotate)tackPoint.motionData_.mTransform.rightFoot.rotate);

            if (EditorGUI.EndChangeCheck())
            {
                var    lastData = tackPoint.motionData_.mTransform;
                Action action   = () =>
                {
                    tackPoint.motionData_.mTransform.ant.rotate  = (int)AntRotate;
                    tackPoint.motionData_.mTransform.head.rotate = (int)headRotate;
                    tackPoint.motionData_.mTransform.body.rotate = (int)bodyRotate;

                    tackPoint.motionData_.mTransform.leftArm.rotate   = (int)leftArmRotate;
                    tackPoint.motionData_.mTransform.rightArm.rotate  = (int)rightArmRotate;
                    tackPoint.motionData_.mTransform.leftHand.rotate  = (int)leftHandRotate;
                    tackPoint.motionData_.mTransform.rightHand.rotate = (int)rightHandRotate;
                    tackPoint.motionData_.mTransform.leftLeg.rotate   = (int)leftLegRotate;
                    tackPoint.motionData_.mTransform.rightLeg.rotate  = (int)rightLegRotate;
                    tackPoint.motionData_.mTransform.leftFoot.rotate  = (int)leftFootRotate;
                    tackPoint.motionData_.mTransform.rightFoot.rotate = (int)rightFootRotate;
                };

                ARIMotionMainWindow.tackCmd_.Do(
                    new MotionCommand(MethodBase.GetCurrentMethod().Name,
                                      () => { action(); },
                                      () => { tackPoint.motionData_.mTransform = lastData; }));

                TackPoint.Emit(new OnTrackEvent(OnTrackEvent.EventType.EVENT_TACK_CHANGE, null));
            }
        }
Exemplo n.º 15
0
        private void DrawTackMove(TackPoint tackPoint)
        {
            EditorGUI.BeginChangeCheck();
            var deltaX     = EditorGUILayout.IntField("delta.x", (int)tackPoint.motionData_.mMove.delta.x);
            var deltaY     = EditorGUILayout.IntField("delta.y", (int)tackPoint.motionData_.mMove.delta.y);
            var accelX     = EditorGUILayout.FloatField("accel.x", tackPoint.motionData_.mMove.accel.x);
            var accelY     = EditorGUILayout.FloatField("accel.y", tackPoint.motionData_.mMove.accel.y);
            var decelMag   = EditorGUILayout.FloatField("decelMag", tackPoint.motionData_.mMove.decelMag);
            var isZeroGrv  = EditorGUILayout.Toggle("isZeroGrv", tackPoint.motionData_.mMove.isZeroGrv);
            var isZeroFric = EditorGUILayout.Toggle("isZeroFric", tackPoint.motionData_.mMove.isZeroFric);
            var isKeepX    = EditorGUILayout.Toggle("isKeepX", tackPoint.motionData_.mMove.isKeepX);
            var isKeepY    = EditorGUILayout.Toggle("isKeepY", tackPoint.motionData_.mMove.isKeepY);

            //var isNoLand = EditorGUILayout.Toggle("isNoLand", tackPoint.motionData_.mMove.isNoLand);
            if (EditorGUI.EndChangeCheck())
            {
                var    lastData = tackPoint.motionData_.mMove;
                Action action   = () =>
                {
                    tackPoint.motionData_.mMove.delta.x  = deltaX;
                    tackPoint.motionData_.mMove.delta.y  = deltaY;
                    tackPoint.motionData_.mMove.accel.x  = accelX;
                    tackPoint.motionData_.mMove.accel.y  = accelY;
                    tackPoint.motionData_.mMove.decelMag = decelMag;
                    //tackPoint.motionData_.mMove.decel.x = decelX;
                    //tackPoint.motionData_.mMove.decel.y = decelY;
                    tackPoint.motionData_.mMove.isZeroGrv  = isZeroGrv;
                    tackPoint.motionData_.mMove.isZeroFric = isZeroFric;
                    tackPoint.motionData_.mMove.isKeepX    = isKeepX;
                    tackPoint.motionData_.mMove.isKeepY    = isKeepY;
                };

                ARIMotionMainWindow.tackCmd_.Do(
                    new MotionCommand(MethodBase.GetCurrentMethod().Name,
                                      () => { action(); },
                                      () => { tackPoint.motionData_.mMove = lastData; }));

                //tackPoint.motionData_.mMove.isNoLand = isNoLand;
                TackPoint.Emit(new OnTrackEvent(OnTrackEvent.EventType.EVENT_TACK_CHANGE, null));
            }
        }
Exemplo n.º 16
0
        //スコアファイルを単体JSONに分ける
        ScoreComponent LoadScore(Dictionary <string, object> deserialized)
        {
            var scoreTimelines   = deserialized[TimeFlowShikiSettings.TIMEFLOWSHIKI_DATA_SCORE_TIMELINES] as List <object>;
            var currentTimelines = new List <TimelineTrack>();

            foreach (var scoreTimeline in scoreTimelines)
            {
                var scoreTimelineDict = scoreTimeline as Dictionary <string, object>;

                var timelineTacks = scoreTimelineDict[TimeFlowShikiSettings.TIMEFLOWSHIKI_DATA_TIMELINE_TACKS] as List <object>;
                var currentTacks  = new List <TackPoint>();
                foreach (var timelineTack in timelineTacks)
                {
                    var timelineTacksDict = timelineTack as Dictionary <string, object>;
                    var newTack           = new TackPoint(currentTacks.Count, timelineTacksDict);
                    currentTacks.Add(newTack);
                }
                var newTimeline = new TimelineTrack(currentTimelines.Count, scoreTimelineDict, currentTacks);
                currentTimelines.Add(newTimeline);
            }
            var newScore = new ScoreComponent(deserialized, currentTimelines);

            return(newScore);
        }
Exemplo n.º 17
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;
        }
Exemplo n.º 18
0
        void EmitAfterDraw(OnTrackEvent onTrackEvent)
        {
            var type = onTrackEvent.eventType;

            switch (type)
            {
            case OnTrackEvent.EventType.EVENT_TIMELINE_ADDTACK: {
                var targetTimelineId = onTrackEvent.activeObjectId;
                var targetFramePos   = onTrackEvent.frame;

                var activeAuto = GetActiveScore();

                Undo.RecordObject(this, "Add Tack");

                string id = MethodBase.GetCurrentMethod().Name;

                TackPoint newTackPoint = activeAuto.NewTackToTimeline(targetTimelineId, targetFramePos);
                var       delId        = newTackPoint.tackId_;
                Action    action       = () => {
                    activeAuto.PasteTackToTimeline(targetTimelineId, targetFramePos, newTackPoint);
                    activeAuto.SqueezeTack();
                };

                Action undo = () => {
                    activeAuto.DeleteObjectById(delId, false);
                    activeAuto.SqueezeTack();
                };

                ARIMotionMainWindow.scoreCmd_.Do(new MotionCommand(id, action, undo));


                return;
            }

            case OnTrackEvent.EventType.EVENT_TIMELINE_PASTETACK: {
                var targetTimelineId = onTrackEvent.activeObjectId;
                var targetFramePos   = onTrackEvent.frame;
                var activeAuto       = GetActiveScore();

                Undo.RecordObject(this, "Paste Tack");

                //activeAuto.PasteTackToTimeline(targetTimelineId, targetFramePos, clipTack_);
                //activeAuto.SqueezeTack();

                string id = MethodBase.GetCurrentMethod().Name;

                TackPoint newTackPoint = clipTack_;

                Action action = () => {
                    activeAuto.PasteTackToTimeline(targetTimelineId, targetFramePos, newTackPoint);
                    activeAuto.SqueezeTack();
                };

                Action undo = () => {
                    activeAuto.DeleteObjectById(newTackPoint.tackId_, false);
                    activeAuto.SqueezeTack();
                };

                ARIMotionMainWindow.scoreCmd_.Do(new MotionCommand(id, action, undo));

                return;
            }
            }
        }
Exemplo n.º 19
0
 public void UpdateSubWindow(TackPoint tackPoint)
 {
     this.tackPoint = tackPoint;
 }
Exemplo n.º 20
0
 public void UpdateTackPoint(TackPoint tackPoint)
 {
     this.tackPoint = tackPoint;
 }
Exemplo n.º 21
0
        private void DrawTackPos(TackPoint tackPoint)
        {
            EditorGUI.BeginChangeCheck();
            var bodyX = EditorGUILayout.IntField("body.pos.x", (int)tackPoint.motionData_.mPos.body.pos.x);
            var bodyY = EditorGUILayout.IntField("body.pos.y", (int)tackPoint.motionData_.mPos.body.pos.y);
            var headX = EditorGUILayout.IntField("head.pos.x", (int)tackPoint.motionData_.mPos.head.pos.x);
            var headY = EditorGUILayout.IntField("head.pos.y", (int)tackPoint.motionData_.mPos.head.pos.y);
            // var leftArmX = EditorGUILayout.IntField("leftArm.pos.x", (int)tackPoint.motionData_.mPos.leftArm.pos.x);
            // var leftArmY = EditorGUILayout.IntField("leftArm.pos.y", (int)tackPoint.motionData_.mPos.leftArm.pos.y);
            // var rightArmX = EditorGUILayout.IntField("rightArm.pos.x", (int)tackPoint.motionData_.mPos.rightArm.pos.x);
            // var rightArmY = EditorGUILayout.IntField("rightArm.pos.y", (int)tackPoint.motionData_.mPos.rightArm.pos.y);

            var leftHandX  = EditorGUILayout.IntField("leftHand.pos.x", (int)tackPoint.motionData_.mPos.leftHand.pos.x);
            var leftHandY  = EditorGUILayout.IntField("leftHand.pos.y", (int)tackPoint.motionData_.mPos.leftHand.pos.y);
            var rightHandX = EditorGUILayout.IntField("rightHand.pos.x", (int)tackPoint.motionData_.mPos.rightHand.pos.x);
            var rightHandY = EditorGUILayout.IntField("rightHand.pos.y", (int)tackPoint.motionData_.mPos.rightHand.pos.y);

            // var leftLegX = EditorGUILayout.IntField("leftLeg.pos.x", (int)tackPoint.motionData_.mPos.leftLeg.pos.x);
            // var leftLegY = EditorGUILayout.IntField("leftLeg.pos.y", (int)tackPoint.motionData_.mPos.leftLeg.pos.y);
            // var rightLegX = EditorGUILayout.IntField("rightLeg.pos.x", (int)tackPoint.motionData_.mPos.rightLeg.pos.x);
            // var rightLegY = EditorGUILayout.IntField("rightLeg.pos.y", (int)tackPoint.motionData_.mPos.rightLeg.pos.y);

            var leftFootX  = EditorGUILayout.IntField("leftFoot.pos.x", (int)tackPoint.motionData_.mPos.leftFoot.pos.x);
            var leftFootY  = EditorGUILayout.IntField("leftFoot.pos.y", (int)tackPoint.motionData_.mPos.leftFoot.pos.y);
            var rightFootX = EditorGUILayout.IntField("rightFoot.pos.x", (int)tackPoint.motionData_.mPos.rightFoot.pos.x);
            var rightFootY = EditorGUILayout.IntField("rightFoot.pos.y", (int)tackPoint.motionData_.mPos.rightFoot.pos.y);

            // var antX = EditorGUILayout.IntField("ant.pos.x", (int)tackPoint.motionData_.mPos.ant.pos.x);
            // var antY = EditorGUILayout.IntField("ant.pos.y", (int)tackPoint.motionData_.mPos.ant.pos.y);

            var armX = EditorGUILayout.IntField("arm.pos.x", (int)tackPoint.motionData_.mPos.arm.pos.x);
            var legY = EditorGUILayout.IntField("leg.pos.x", (int)tackPoint.motionData_.mPos.leg.pos.x);

            var bodyCurveX = (enCurve)EditorGUILayout.EnumPopup("body.curveX", (enCurve)tackPoint.motionData_.mPos.body.curveX);
            var bodyCurveY = (enCurve)EditorGUILayout.EnumPopup("body.curveY", (enCurve)tackPoint.motionData_.mPos.body.curveY);
            var headCurveX = (enCurve)EditorGUILayout.EnumPopup("head.curveX", (enCurve)tackPoint.motionData_.mPos.head.curveX);
            var headCurveY = (enCurve)EditorGUILayout.EnumPopup("head.curveY", (enCurve)tackPoint.motionData_.mPos.head.curveY);

            // var leftArmCurveX = (enCurve)EditorGUILayout.EnumPopup("leftArm.curveX", (enCurve)tackPoint.motionData_.mPos.leftArm.curveX);
            // var leftArmCurveY = (enCurve)EditorGUILayout.EnumPopup("leftArm.curveY", (enCurve)tackPoint.motionData_.mPos.leftArm.curveY);
            // var rightArmCurveX = (enCurve)EditorGUILayout.EnumPopup("rightArm.curveX", (enCurve)tackPoint.motionData_.mPos.rightArm.curveX);
            // var rightArmCurveY = (enCurve)EditorGUILayout.EnumPopup("rightArm.curveY", (enCurve)tackPoint.motionData_.mPos.rightArm.curveY);

            var leftHandCurveX  = (enCurve)EditorGUILayout.EnumPopup("leftHand.curveX", (enCurve)tackPoint.motionData_.mPos.leftHand.curveX);
            var leftHandCurveY  = (enCurve)EditorGUILayout.EnumPopup("leftHand.curveY", (enCurve)tackPoint.motionData_.mPos.leftHand.curveY);
            var rightHandCurveX = (enCurve)EditorGUILayout.EnumPopup("rightHand.curveX", (enCurve)tackPoint.motionData_.mPos.rightHand.curveX);
            var rightHandCurveY = (enCurve)EditorGUILayout.EnumPopup("rightHand.curveY", (enCurve)tackPoint.motionData_.mPos.rightHand.curveY);

            // var leftLegCurveX = (enCurve)EditorGUILayout.EnumPopup("leftLeg.curveX", (enCurve)tackPoint.motionData_.mPos.leftLeg.curveX);
            // var leftLegCurveY = (enCurve)EditorGUILayout.EnumPopup("leftLeg.curveY", (enCurve)tackPoint.motionData_.mPos.leftLeg.curveY);
            // var rightLegCurveX = (enCurve)EditorGUILayout.EnumPopup("rightLeg.curveX", (enCurve)tackPoint.motionData_.mPos.rightLeg.curveX);
            // var rightLegCurveY = (enCurve)EditorGUILayout.EnumPopup("rightLeg.curveY", (enCurve)tackPoint.motionData_.mPos.rightLeg.curveY);

            var leftFootCurveX  = (enCurve)EditorGUILayout.EnumPopup("leftFoot.curveX", (enCurve)tackPoint.motionData_.mPos.leftFoot.curveX);
            var leftFootCurveY  = (enCurve)EditorGUILayout.EnumPopup("leftFoot.curveY", (enCurve)tackPoint.motionData_.mPos.leftFoot.curveY);
            var rightFootCurveX = (enCurve)EditorGUILayout.EnumPopup("rightFoot.curveX", (enCurve)tackPoint.motionData_.mPos.rightFoot.curveX);
            var rightFootCurveY = (enCurve)EditorGUILayout.EnumPopup("rightFoot.curveY", (enCurve)tackPoint.motionData_.mPos.rightFoot.curveY);

            // var AntCurveX = (enCurve)EditorGUILayout.EnumPopup("Ant.curveX", (enCurve)tackPoint.motionData_.mPos.ant.curveX);
            // var AntCurveY = (enCurve)EditorGUILayout.EnumPopup("Ant.curveY", (enCurve)tackPoint.motionData_.mPos.ant.curveY);

            var ArmCurveX = (enCurve)EditorGUILayout.EnumPopup("arm.curveX", (enCurve)tackPoint.motionData_.mPos.arm.curveX);
            var LegCurveX = (enCurve)EditorGUILayout.EnumPopup("leg.curveX", (enCurve)tackPoint.motionData_.mPos.leg.curveX);

            if (EditorGUI.EndChangeCheck())
            {
                var    lastData = tackPoint.motionData_.mPos;
                Action action   = () =>
                {
                    tackPoint.motionData_.mPos.body.pos.x = bodyX;
                    tackPoint.motionData_.mPos.body.pos.y = bodyY;
                    tackPoint.motionData_.mPos.head.pos.x = headX;
                    tackPoint.motionData_.mPos.head.pos.y = headY;
                    // tackPoint.motionData_.mPos.leftArm.pos.x = leftArmX;
                    // tackPoint.motionData_.mPos.leftArm.pos.y = leftArmY;
                    // tackPoint.motionData_.mPos.rightArm.pos.x = rightArmX;
                    // tackPoint.motionData_.mPos.rightArm.pos.y = rightArmY;
                    tackPoint.motionData_.mPos.leftHand.pos.x  = leftHandX;
                    tackPoint.motionData_.mPos.leftHand.pos.y  = leftHandY;
                    tackPoint.motionData_.mPos.rightHand.pos.x = rightHandX;
                    tackPoint.motionData_.mPos.rightHand.pos.y = rightHandY;
                    // tackPoint.motionData_.mPos.leftLeg.pos.x = leftLegX;
                    // tackPoint.motionData_.mPos.leftLeg.pos.y = leftLegY;
                    // tackPoint.motionData_.mPos.rightLeg.pos.x = rightLegX;
                    // tackPoint.motionData_.mPos.rightLeg.pos.y = rightLegY;
                    tackPoint.motionData_.mPos.leftFoot.pos.x  = leftFootX;
                    tackPoint.motionData_.mPos.leftFoot.pos.y  = leftFootY;
                    tackPoint.motionData_.mPos.rightFoot.pos.x = rightFootX;
                    tackPoint.motionData_.mPos.rightFoot.pos.y = rightFootY;
                    // tackPoint.motionData_.mPos.ant.pos.x = antX;
                    // tackPoint.motionData_.mPos.ant.pos.y = antY;
                    tackPoint.motionData_.mPos.arm.pos.x = armX;
                    tackPoint.motionData_.mPos.leg.pos.x = legY;

                    tackPoint.motionData_.mPos.body.curveX = (int)bodyCurveX;
                    tackPoint.motionData_.mPos.body.curveY = (int)bodyCurveY;
                    tackPoint.motionData_.mPos.head.curveX = (int)headCurveX;
                    tackPoint.motionData_.mPos.head.curveY = (int)headCurveY;
                    // tackPoint.motionData_.mPos.leftArm.curveX = (int)leftArmCurveX;
                    // tackPoint.motionData_.mPos.leftArm.curveY = (int)leftArmCurveY;
                    // tackPoint.motionData_.mPos.rightArm.curveX = (int)rightArmCurveX;
                    // tackPoint.motionData_.mPos.rightArm.curveY = (int)rightArmCurveY;
                    tackPoint.motionData_.mPos.leftHand.curveX  = (int)leftHandCurveX;
                    tackPoint.motionData_.mPos.leftHand.curveY  = (int)leftHandCurveY;
                    tackPoint.motionData_.mPos.rightHand.curveX = (int)rightHandCurveX;
                    tackPoint.motionData_.mPos.rightHand.curveY = (int)rightHandCurveY;
                    // tackPoint.motionData_.mPos.leftLeg.curveX = (int)leftLegCurveX;
                    // tackPoint.motionData_.mPos.leftLeg.curveY = (int)leftLegCurveY;
                    // tackPoint.motionData_.mPos.rightLeg.curveX = (int)rightLegCurveX;
                    // tackPoint.motionData_.mPos.rightLeg.curveY = (int)rightLegCurveY;
                    tackPoint.motionData_.mPos.leftFoot.curveX  = (int)leftFootCurveX;
                    tackPoint.motionData_.mPos.leftFoot.curveY  = (int)leftFootCurveY;
                    tackPoint.motionData_.mPos.rightFoot.curveX = (int)rightFootCurveX;
                    tackPoint.motionData_.mPos.rightFoot.curveY = (int)rightFootCurveY;
                    // tackPoint.motionData_.mPos.ant.curveX = (int)AntCurveX;
                    // tackPoint.motionData_.mPos.ant.curveY = (int)AntCurveY;

                    tackPoint.motionData_.mPos.arm.curveX = (int)ArmCurveX;
                    tackPoint.motionData_.mPos.leg.curveX = (int)LegCurveX;
                };

                ARIMotionMainWindow.tackCmd_.Do(
                    new MotionCommand(MethodBase.GetCurrentMethod().Name,
                                      () => { action(); },
                                      () => { tackPoint.motionData_.mPos = lastData; }));

                TackPoint.Emit(new OnTrackEvent(OnTrackEvent.EventType.EVENT_TACK_CHANGE, null));
            }
        }
Exemplo n.º 22
0
        void Emit(OnTrackEvent onTrackEvent)
        {
            var type = onTrackEvent.eventType;

            // tack events.
            switch (type)
            {
            case OnTrackEvent.EventType.EVENT_UNSELECTED: {
                manipulateTargets = new ManipulateTargets(new List <string>());

                Undo.RecordObject(this, "Unselect");

                var activeAuto = GetActiveScore();
                activeAuto.DeactivateAllObjects();
                activeAuto.SetScoreInspector();
                parent_.RepaintAllWindow();
                return;
            }

            case OnTrackEvent.EventType.EVENT_OBJECT_SELECTED: {
                manipulateTargets = new ManipulateTargets(new List <string> {
                        onTrackEvent.activeObjectId
                    });

                var activeAuto = GetActiveScore();

                Undo.RecordObject(this, "Select");
                activeAuto.ActivateObjectsAndDeactivateOthers(manipulateTargets.activeObjectIds);
                parent_.RepaintAllWindow();
                return;
            }

            //各種タイムライン
            case OnTrackEvent.EventType.EVENT_SCORE_ADDTIMELINE_POS:
            case OnTrackEvent.EventType.EVENT_SCORE_ADDTIMELINE_TRANSFORM:
            case OnTrackEvent.EventType.EVENT_SCORE_ADDTIMELINE_MOVE:
            case OnTrackEvent.EventType.EVENT_SCORE_ADDTIMELINE_COLOR:
            case OnTrackEvent.EventType.EVENT_SCORE_ADDTIMELINE_EFFECT:
            case OnTrackEvent.EventType.EVENT_SCORE_ADDTIMELINE_PASSIVE: {
                int timelineType = 0;
                //各種タイムライン
                switch (type)
                {
                case OnTrackEvent.EventType.EVENT_SCORE_ADDTIMELINE_POS:
                    timelineType = (int)TimelineType.TL_POS; break;

                case OnTrackEvent.EventType.EVENT_SCORE_ADDTIMELINE_TRANSFORM:
                    timelineType = (int)TimelineType.TL_TRANSFORM; break;

                case OnTrackEvent.EventType.EVENT_SCORE_ADDTIMELINE_MOVE:
                    timelineType = (int)TimelineType.TL_MOVE; break;

                case OnTrackEvent.EventType.EVENT_SCORE_ADDTIMELINE_COLOR:
                    timelineType = (int)TimelineType.TL_COLOR; break;

                case OnTrackEvent.EventType.EVENT_SCORE_ADDTIMELINE_EFFECT:
                    timelineType = (int)TimelineType.TL_EFFECT; break;

                case OnTrackEvent.EventType.EVENT_SCORE_ADDTIMELINE_PASSIVE:
                    timelineType = (int)TimelineType.TL_PASSIVE; break;
                }

                var activeAuto    = GetActiveScore();
                var tackPoints    = new List <TackPoint>();
                var newTimeline   = new TimelineTrack(activeAuto.timelineTracks_.Count, timelineType, tackPoints);
                var newTimelineId = newTimeline.timelineId_;
                Undo.RecordObject(this, "Add Timeline");

                //activeAuto.timelineTracks.Add(newTimeline);

                string id = MethodBase.GetCurrentMethod().Name;

                Action action = () => {
                    activeAuto.timelineTracks_.Add(newTimeline);
                };

                Action undo = () => {
                    activeAuto.DeleteObjectById(newTimelineId, false);
                };

                ARIMotionMainWindow.scoreCmd_.Do(new MotionCommand(id, action, undo));

                parent_.NeedSave();
                return;
            }

            case OnTrackEvent.EventType.EVENT_SCORE_BEFORESAVE: {
                Undo.RecordObject(this, "Update Score Title");
                return;
            }

            case OnTrackEvent.EventType.EVENT_SCORE_SAVE: {
                parent_.NeedSave();
                return;
            }

            /*
             *      timeline events.
             */
            case OnTrackEvent.EventType.EVENT_TIMELINE_ADDTACK: {
                eventStacks_.Add(onTrackEvent.Copy());
                return;
            }


            case OnTrackEvent.EventType.EVENT_TIMELINE_PASTETACK: {
                eventStacks_.Add(onTrackEvent.Copy());
                return;
            }

            case OnTrackEvent.EventType.EVENT_TIMELINE_DELETE: {
                var targetTimelineId = onTrackEvent.activeObjectId;
                var activeAuto       = GetActiveScore();


                Undo.RecordObject(this, "Delete Timeline");

                string id = MethodBase.GetCurrentMethod().Name;

                Action action = () => {
                    activeAuto.DeleteObjectById(targetTimelineId, false);
                };

                Action undo = () => {
                    activeAuto.DeleteObjectById(targetTimelineId, true);
                };

                ARIMotionMainWindow.scoreCmd_.Do(new MotionCommand(id, action, undo));


                //activeAuto.DeleteObjectById(targetTimelineId);
                parent_.NeedSave();
                return;
            }

            case OnTrackEvent.EventType.EVENT_TIMELINE_BEFORESAVE: {
                Undo.RecordObject(this, "Update Timeline Title");
                return;
            }

            case OnTrackEvent.EventType.EVENT_TIMELINE_SAVE: {
                parent_.NeedSave();
                return;
            }


            /*
             *      tack events.
             */
            case OnTrackEvent.EventType.EVENT_TACK_MOVING: {
                var movingTackId = onTrackEvent.activeObjectId;

                var activeAuto = GetActiveScore();

                activeAuto.SetMovingTackToTimelimes(movingTackId);
                break;
            }

            case OnTrackEvent.EventType.EVENT_TACK_MOVED: {
                Undo.RecordObject(this, "Move Tack");

                return;
            }

            case OnTrackEvent.EventType.EVENT_TACK_MOVED_AFTER: {
                var targetTackId = onTrackEvent.activeObjectId;

                var activeAuto          = GetActiveScore();
                var activeTimelineIndex = activeAuto.GetTackContainedTimelineIndex(targetTackId);
                if (0 <= activeTimelineIndex)
                {
                    //タックの移動後処理
                    activeAuto.timelineTracks_[activeTimelineIndex].UpdateByTackMoved(targetTackId);

                    //Repaint();
                    parent_.NeedSave();
                }
                return;
            }

            case OnTrackEvent.EventType.EVENT_TACK_DELETED: {
                var targetTackId = onTrackEvent.activeObjectId;
                var activeAuto   = GetActiveScore();

                Undo.RecordObject(this, "Delete Tack");


                string id = MethodBase.GetCurrentMethod().Name;

                Action action = () => {
                    activeAuto.DeleteObjectById(targetTackId, false);
                    activeAuto.SqueezeTack();
                };

                Action undo = () => {
                    activeAuto.DeleteObjectById(targetTackId, true);
                    activeAuto.SqueezeTack();
                };

                ARIMotionMainWindow.scoreCmd_.Do(new MotionCommand(id, action, undo));

                //Repaint();
                parent_.NeedSave();
                return;
            }

            case OnTrackEvent.EventType.EVENT_TACK_COPY: {
                var targetTackId = onTrackEvent.activeObjectId;
                var activeAuto   = GetActiveScore();
                clipTack_ = activeAuto.GetTackById(targetTackId);
                return;
            }


            case OnTrackEvent.EventType.EVENT_TACK_BEFORESAVE: {
                Undo.RecordObject(this, "Update Tack Title");
                return;
            }

            case OnTrackEvent.EventType.EVENT_TACK_SAVE: {
                parent_.NeedSave();
                return;
            }


            case OnTrackEvent.EventType.EVENT_TACK_CHANGE: {
                parent_.NeedSave();
                parent_.subWindow_.SetupPartsData(false);                        //サブウインドウにも反映させる
                parent_.RepaintAllWindow();
                return;
            }


            default: {
                //親に投げる
                ParentEmit(onTrackEvent);
                //Debug.LogError("no match type:" + type);
                break;
            }
            }
        }
Exemplo n.º 23
0
        //キー入力によるスパンの変更
        void ChangeStartAll(bool isForwerd)
        {
            if (!HasValidScore())
            {
                return;
            }

            var score = GetActiveScore();

            if (manipulateTargets.activeObjectIds.Any())
            {
                if (manipulateTargets.activeObjectIds.Count == 1)
                {
                    var activeId = manipulateTargets.activeObjectIds[0];
                    List <TackPoint> tackPoints = null;
                    if (IsTimelineId(activeId))
                    {
                        TimelineTrack timelineTrack = score.TimelineById(activeId);
                        tackPoints = timelineTrack.tackPoints_;
                    }
                    else if (IsTackId(activeId))
                    {
                        var tack = score.TackById(activeId);
                        tackPoints = score.TimelinesByType((TimelineType)tack.timelineType_);
                    }

                    if (tackPoints != null)
                    {
                        Undo.RecordObject(this, "ChangeSpan");

                        List <Action> cmdDo   = new List <Action>();
                        List <Action> cmdUndo = new List <Action>();
                        string        id      = MethodBase.GetCurrentMethod().Name;

                        foreach (var item in tackPoints)
                        {
                            TackPoint tack     = item;
                            int       newStart = (isForwerd)
                                                                ? item.start_ - 1
                                                                : item.start_ + 1;

                            int lastStart = item.start_;


                            Action action = () => {
                                tack.UpdatePos(newStart, tack.span_);
                                score.SqueezeTack();
                            };

                            Action undo = () => {
                                tack.UpdatePos(lastStart, tack.span_);
                                score.SqueezeTack();
                            };

                            //コマンドPos
                            cmdDo.Add(action);
                            cmdUndo.Add(undo);
                        }

                        cmdDo.Add(() => score.SqueezeTack());
                        cmdUndo.Add(() => score.SqueezeTack());

                        if (cmdDo.Any())
                        {
                            ARIMotionMainWindow.tackCmd_.Do(new MotionCommand(id,
                                                                              () => { foreach (var cmd in cmdDo)
                                                                                      {
                                                                                          cmd();
                                                                                      }
                                                                              },
                                                                              () => { foreach (var cmd in cmdUndo)
                                                                                      {
                                                                                          cmd();
                                                                                      }
                                                                              }));
                        }

                        Emit(new OnTrackEvent(OnTrackEvent.EventType.EVENT_TACK_SAVE, null));
                        parent_.RepaintAllWindow();
                    }
                }
                else
                {
                    // select multiple objects.
                }
            }
        }