Skip to content
Snippets Groups Projects
Commit 7e0c0fe6 authored by Shon Ferguson's avatar Shon Ferguson
Browse files

Cycle type is now set correctly on controllers created or modified by MergeNifTrees function.

parent 889114f3
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
}
}
}
......
......@@ -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
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment