Skip to content

Commit

Permalink
Add option in Singularity menu to Resync Anims
Browse files Browse the repository at this point in the history
#close SV-1321
  • Loading branch information
LiruMouse committed May 27, 2016
1 parent 8ff1f46 commit e5886e0
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 14 deletions.
32 changes: 18 additions & 14 deletions indra/newview/chatbar_as_cmdline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,23 @@ void invrepair()
gInventory.collectDescendents(gInventory.getRootFolderID(),cats,items,FALSE);//,objectnamematches);
}

void resync_anims()
{
for (S32 i = 0; i < gObjectList.getNumObjects(); ++i)
{
LLViewerObject* object = gObjectList.getObject(i);
if (object && object->isAvatar())
{
LLVOAvatar& avatarp = *(LLVOAvatar*)object;
for (const auto& playpair : avatarp.mPlayingAnimations)
{
avatarp.stopMotion(playpair.first, TRUE);
avatarp.startMotion(playpair.first);
}
}
}
}

#ifdef PROF_CTRL_CALLS
bool sort_calls(const std::pair<std::string, U32>& left, const std::pair<std::string, U32>& right)
{
Expand Down Expand Up @@ -446,20 +463,7 @@ bool cmd_line_chat(std::string data, EChatType type)
}
else if (cmd == utf8str_tolower(sResyncAnimCommand)) // Resync Animations
{
for (S32 i = 0; i < gObjectList.getNumObjects(); i++)
{
LLViewerObject* object = gObjectList.getObject(i);
if (object && object->isAvatar())
{
LLVOAvatar& avatarp = *(LLVOAvatar*)object;
for (LLVOAvatar::AnimIterator it = avatarp.mPlayingAnimations.begin(), end = avatarp.mPlayingAnimations.end(); it != end; ++it)
{
const std::pair<LLUUID, S32>& playpair = *it;
avatarp.stopMotion(playpair.first, TRUE);
avatarp.startMotion(playpair.first);
}
}
}
resync_anims();
return false;
}
else if (cmd == utf8str_tolower(sKeyToName))
Expand Down
10 changes: 10 additions & 0 deletions indra/newview/llviewermenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2634,6 +2634,15 @@ class LLObjectData : public view_listener_t
}
};

class LLSyncAnimations : public view_listener_t
{
bool handleEvent(const LLSD& userdata)
{
void resync_anims();
resync_anims();
return false;
}
}
class LLCanIHasKillEmAll : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
Expand Down Expand Up @@ -9494,6 +9503,7 @@ void initialize_menus()
addMenu(new SinguCheckPoseStand(), "CheckPoseStand");
addMenu(new SinguRebake(), "Rebake");
addMenu(new SinguVisibleDebugConsole(), "VisibleRegionDebugConsole");
addMenu(new LLSyncAnimations(), "Tools.ResyncAnimations");

// [RLVa:KB] - Checked: 2010-01-18 (RLVa-1.1.0m) | Added: RLVa-1.1.0m | OK
if (rlv_handler_t::isEnabled())
Expand Down
4 changes: 4 additions & 0 deletions indra/newview/skins/default/xui/en-us/menu_viewer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,10 @@
<on_click function="ToggleControl" userdata="Nimble"/>
<on_check control="Nimble"/>
</menu_item_check>
<menu_item_call label="Resync Animations" name="Resync Animations">
<menu_item_call.on_click
function="Tools.ResyncAnimations" />
</menu_item_check>
<menu_item_separator mouse_opaque="true" name="separators3"/>
<menu_item_check label="Region Tracker" name="Region Tracker">
<on_click function="ShowFloater" userdata="region_tracker"/>
Expand Down

0 comments on commit e5886e0

Please sign in to comment.