diff --git a/niflib.cpp b/niflib.cpp index 9d75b5627fe1375b016d4d4310af12fec0be8c8b..b8db6ddb04022540f04cfc73d505419c2d3c43a2 100644 --- a/niflib.cpp +++ b/niflib.cpp @@ -822,7 +822,6 @@ void MergeNifTrees( const Ref<NiNode> & target, const Ref<NiControllerSequence> if ( ctlr == NULL ) { throw runtime_error ("Non-NiSingleInterpolatorController controller found in KF file."); } - ctlr->SetFlags( 12 ); //TODO: This should be set from real data in the NiControllerSequence. This default is for clamp/active. node->AddController( StaticCast<NiTimeController>(ctlr) ); } @@ -841,6 +840,19 @@ void MergeNifTrees( const Ref<NiNode> & target, const Ref<NiControllerSequence> ctlr->SetStopTime( right->GetStopTime() ); ctlr->SetFrequency( right->GetFrequency() ); ctlr->SetPhase( 0.0f ); //TODO: Is phase somewhere in NiControllerSequence? + + //Set cycle type as well + switch ( right->GetCycleType() ) { + case NiControllerSequence::CYCLE_LOOP: + ctlr->SetFlags( 8 ); //Active + break; + case NiControllerSequence::CYCLE_CLAMP: + ctlr->SetFlags( 12 ); //Active+Clamp + break; + case NiControllerSequence::CYCLE_REVERSE: + ctlr->SetFlags( 10 ); //Active+Reverse + break; + } } } } diff --git a/obj/NiControllerSequence.cpp b/obj/NiControllerSequence.cpp index c5d333c5c8b017929bf8bbddd49e05ecee61cf35..1d0d108b5c599941570c6b1250c7b9e00dd82a09 100644 --- a/obj/NiControllerSequence.cpp +++ b/obj/NiControllerSequence.cpp @@ -170,3 +170,11 @@ float NiControllerSequence::GetStopTime() const { void NiControllerSequence::SetStopTime( float value ) { stopTime = value; } + +NiControllerSequence::CycleType NiControllerSequence::GetCycleType() const { + return CycleType(cycleType); +} + +void NiControllerSequence::SetCycleType( NiControllerSequence::CycleType n ) { + cycleType = n; +} \ No newline at end of file diff --git a/obj/NiControllerSequence.h b/obj/NiControllerSequence.h index 7c00491db977bbf1135487fe0e54147e1809a62c..40f47757efd1f84f09333ffad1d3cedc704ac8e5 100644 --- a/obj/NiControllerSequence.h +++ b/obj/NiControllerSequence.h @@ -43,6 +43,12 @@ public: virtual list<NiObjectRef> GetRefs() const; virtual const Type & GetType() const; + enum CycleType { + CYCLE_LOOP = 0, + CYCLE_REVERSE = 1, + CYCLE_CLAMP = 2 + }; + /*! Sets the name and block reference to the NiTextKeyExtraData block which will be used by this controller sequence to specify the keyframe labels or "notes." * \param new_name The name of the NiTextKeyExtraData block to use. * \param txt_key A reference to the NiTextKeyExtraData object to use. @@ -94,6 +100,9 @@ public: float GetStopTime() const; void SetStopTime( float value ); + CycleType GetCycleType() const; + void SetCycleType( CycleType n ); + protected: NiControllerManager * NiControllerSequence::Parent() const; NI_CONTROLLER_SEQUENCE_MEMBERS