From 11ac92acccb4ca4ab7d26aed90487c3f21c5a02e Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 30 May 2014 22:49:17 -0500 Subject: [PATCH] adds the name of the sequence just completed for simple FSMs and the like. example usage: function shapeBaseData::onEndSequence(%this, %obj, %slot, %name) { %script = "on" @ %name; if(%this.isMethod(%script)) %this.call(%script, %obj); } function fooData::onDeploy(%this,%obj) { error("fooData::onDeploy" SPC %this SPC %obj); } --- Engine/source/T3D/shapeBase.cpp | 7 ++++--- Engine/source/T3D/shapeBase.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Engine/source/T3D/shapeBase.cpp b/Engine/source/T3D/shapeBase.cpp index eff6bd855..4a4156965 100644 --- a/Engine/source/T3D/shapeBase.cpp +++ b/Engine/source/T3D/shapeBase.cpp @@ -114,11 +114,12 @@ IMPLEMENT_CALLBACK( ShapeBaseData, onTrigger, void, ( ShapeBase* obj, S32 index, "@param index Index of the trigger that changed\n" "@param state New state of the trigger\n" ); -IMPLEMENT_CALLBACK( ShapeBaseData, onEndSequence, void, ( ShapeBase* obj, S32 slot ), ( obj, slot ), +IMPLEMENT_CALLBACK(ShapeBaseData, onEndSequence, void, (ShapeBase* obj, S32 slot, const String &name), (obj, slot, name), "@brief Called when a thread playing a non-cyclic sequence reaches the end of the " "sequence.\n\n" "@param obj The ShapeBase object\n" - "@param slot Thread slot that finished playing\n" ); + "@param slot Thread slot that finished playing\n" + "@param name Thread name that finished playing\n"); IMPLEMENT_CALLBACK( ShapeBaseData, onForceUncloak, void, ( ShapeBase* obj, const char* reason ), ( obj, reason ), "@brief Called when the object is forced to uncloak.\n\n" @@ -2352,7 +2353,7 @@ void ShapeBase::advanceThreads(F32 dt) st.atEnd = true; updateThread(st); if (!isGhost()) { - mDataBlock->onEndSequence_callback( this, i ); + mDataBlock->onEndSequence_callback(this, i, this->getThreadSequenceName(i)); } } diff --git a/Engine/source/T3D/shapeBase.h b/Engine/source/T3D/shapeBase.h index 0bb54faf4..51a450437 100644 --- a/Engine/source/T3D/shapeBase.h +++ b/Engine/source/T3D/shapeBase.h @@ -648,7 +648,7 @@ public: DECLARE_CALLBACK( void, onCollision, ( ShapeBase* obj, SceneObject* collObj, VectorF vec, F32 len ) ); DECLARE_CALLBACK( void, onDamage, ( ShapeBase* obj, F32 delta ) ); DECLARE_CALLBACK( void, onTrigger, ( ShapeBase* obj, S32 index, bool state ) ); - DECLARE_CALLBACK( void, onEndSequence, ( ShapeBase* obj, S32 slot ) ); + DECLARE_CALLBACK( void, onEndSequence, (ShapeBase* obj, S32 slot, const String &name)); DECLARE_CALLBACK( void, onForceUncloak, ( ShapeBase* obj, const char* reason ) ); /// @} };