diff options
author | simon@Simon-PC.lindenlab.com <simon@Simon-PC.lindenlab.com> | 2012-10-31 15:05:52 -0700 |
---|---|---|
committer | simon@Simon-PC.lindenlab.com <simon@Simon-PC.lindenlab.com> | 2012-10-31 15:05:52 -0700 |
commit | 2126cdb9a25da4dcc4c81659038b85bcff17c4ee (patch) | |
tree | 24e4ad084adf78afe64e674d0a087c2b4a85fd42 /indra | |
parent | 58a73b4fc1e39df13c3c11a6f286cdeeace26c4f (diff) |
MAINT-1560 : Make Slow Motion Animations affect all avatars. Added new menu.
Reviewed by Kelly
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llcharacter/llmotioncontroller.cpp | 3 | ||||
-rw-r--r-- | indra/llcharacter/llmotioncontroller.h | 6 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 53 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_viewer.xml | 44 |
4 files changed, 94 insertions, 12 deletions
diff --git a/indra/llcharacter/llmotioncontroller.cpp b/indra/llcharacter/llmotioncontroller.cpp index 829dda9993..e9fb91ad73 100644 --- a/indra/llcharacter/llmotioncontroller.cpp +++ b/indra/llcharacter/llmotioncontroller.cpp @@ -42,6 +42,7 @@ const U32 MAX_MOTION_INSTANCES = 32; //----------------------------------------------------------------------------- // Constants and statics //----------------------------------------------------------------------------- +F32 LLMotionController::sCurrentTimeFactor = 1.f; LLMotionRegistry LLMotionController::sRegistry; //----------------------------------------------------------------------------- @@ -125,7 +126,7 @@ LLMotion *LLMotionRegistry::createMotion( const LLUUID &id ) // Class Constructor //----------------------------------------------------------------------------- LLMotionController::LLMotionController() - : mTimeFactor(1.f), + : mTimeFactor(sCurrentTimeFactor), mCharacter(NULL), mAnimTime(0.f), mPrevTimerElapsed(0.f), diff --git a/indra/llcharacter/llmotioncontroller.h b/indra/llcharacter/llmotioncontroller.h index b996f708d2..52eaf557b1 100644 --- a/indra/llcharacter/llmotioncontroller.h +++ b/indra/llcharacter/llmotioncontroller.h @@ -168,6 +168,9 @@ public: const LLFrameTimer& getFrameTimer() { return mTimer; } + static F32 getCurrentTimeFactor() { return sCurrentTimeFactor; }; + static void setCurrentTimeFactor(F32 factor) { sCurrentTimeFactor = factor; }; + protected: // internal operations act on motion instances directly // as there can be duplicate motions per id during blending overlap @@ -187,7 +190,8 @@ protected: void deactivateStoppedMotions(); protected: - F32 mTimeFactor; + F32 mTimeFactor; // 1.f for normal speed + static F32 sCurrentTimeFactor; // Value to use for initialization static LLMotionRegistry sRegistry; LLPoseBlender mPoseBlender; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index c66fbb006b..d69acbbd07 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -1638,6 +1638,54 @@ class LLAdvancedForceParamsToDefault : public view_listener_t }; +////////////////////////// +// ANIMATION SPEED // +////////////////////////// + +// Utility function to set all AV time factors to the same global value +static void set_all_animation_time_factors(F32 time_factor) +{ + LLMotionController::setCurrentTimeFactor(time_factor); + for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin(); + iter != LLCharacter::sInstances.end(); ++iter) + { + (*iter)->setAnimTimeFactor(time_factor); + } +} + +class LLAdvancedAnimTenFaster : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + //llinfos << "LLAdvancedAnimTenFaster" << llendl; + F32 time_factor = LLMotionController::getCurrentTimeFactor(); + time_factor = llmin(time_factor + 0.1f, 2.f); // Upper limit is 200% speed + set_all_animation_time_factors(time_factor); + return true; + } +}; + +class LLAdvancedAnimTenSlower : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + //llinfos << "LLAdvancedAnimTenSlower" << llendl; + F32 time_factor = LLMotionController::getCurrentTimeFactor(); + time_factor = llmax(time_factor - 0.1f, 0.1f); // Lower limit is at 10% of normal speed + set_all_animation_time_factors(time_factor); + return true; + } +}; + +class LLAdvancedAnimResetAll : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) + { + set_all_animation_time_factors(1.f); + return true; + } +}; + ////////////////////////// // RELOAD VERTEX SHADER // @@ -8407,6 +8455,11 @@ void initialize_menus() view_listener_t::addMenu(new LLAdvancedTestMale(), "Advanced.TestMale"); view_listener_t::addMenu(new LLAdvancedTestFemale(), "Advanced.TestFemale"); + // Advanced > Character > Animation Speed + view_listener_t::addMenu(new LLAdvancedAnimTenFaster(), "Advanced.AnimTenFaster"); + view_listener_t::addMenu(new LLAdvancedAnimTenSlower(), "Advanced.AnimTenSlower"); + view_listener_t::addMenu(new LLAdvancedAnimResetAll(), "Advanced.AnimResetAll"); + // Advanced > Character (toplevel) view_listener_t::addMenu(new LLAdvancedForceParamsToDefault(), "Advanced.ForceParamsToDefault"); view_listener_t::addMenu(new LLAdvancedReloadVertexShader(), "Advanced.ReloadVertexShader"); diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 59d268c53a..0fc1982a86 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -3178,6 +3178,40 @@ parameter="AllowSelectAvatar" /> </menu_item_check> </menu> + <menu + create_jump_keys="true" + label="Animation Speed" + name="Animation Speed" + tear_off="true"> + <menu_item_call + label="All Animations 10% Faster" + name="All Animations 10 Faster"> + <menu_item_call.on_click + function="Advanced.AnimTenFaster" /> + </menu_item_call> + <menu_item_call + label="All Animations 10% Slower" + name="All Animations 10 Slower"> + <menu_item_call.on_click + function="Advanced.AnimTenSlower" /> + </menu_item_call> + <menu_item_call + label="Reset All Animation Speed" + name="Reset All Animation Speed"> + <menu_item_call.on_click + function="Advanced.AnimResetAll" /> + </menu_item_call> + <menu_item_check + label="Slow Motion Animations" + name="Slow Motion Animations"> + <menu_item_check.on_check + function="CheckControl" + parameter="SlowMotionAnimation" /> + <menu_item_check.on_click + function="ToggleControl" + parameter="SlowMotionAnimation" /> + </menu_item_check> + </menu> <menu_item_call label="Force Params to Default" name="Force Params to Default"> @@ -3195,16 +3229,6 @@ parameter="" /> </menu_item_check> <menu_item_check - label="Slow Motion Animations" - name="Slow Motion Animations"> - <menu_item_check.on_check - function="CheckControl" - parameter="SlowMotionAnimation" /> - <menu_item_check.on_click - function="ToggleControl" - parameter="SlowMotionAnimation" /> - </menu_item_check> - <menu_item_check label="Show Look At" name="Show Look At"> <menu_item_check.on_check |