diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 7c66f8821..c065cd9c1 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -3592,7 +3592,7 @@ S32 LLVolume::lineSegmentIntersect(const LLVector3& start, const LLVector3& end, if (face == -1) // ALL_SIDES { start_face = 0; - end_face = getNumFaces() - 1; + end_face = getNumVolumeFaces() - 1; } else { diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index ad43d2263..44bfe9d7a 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -64,6 +64,8 @@ include_directories( ) set(viewer_SOURCE_FILES + aoremotectrl.cpp + floaterao.cpp floatervoicelicense.cpp cofmgr.cpp ascentdaycyclemanager.cpp @@ -93,7 +95,6 @@ set(viewer_SOURCE_FILES llagentlanguage.cpp llagentpilot.cpp llanimstatelabels.cpp - llao.cpp llappviewer.cpp llassetconverter.cpp llassetuploadresponders.cpp @@ -532,6 +533,8 @@ set(viewer_HEADER_FILES CMakeLists.txt ViewerInstall.cmake + aoremotectrl.h + floaterao.h floatervoicelicense.h cofmgr.h ascentdaycyclemanager.h @@ -559,7 +562,6 @@ set(viewer_HEADER_FILES llagentlanguage.h llagentpilot.h llanimstatelabels.h - llao.h llappearance.h llappviewer.h llassetconverter.h diff --git a/indra/newview/aoremotectrl.cpp b/indra/newview/aoremotectrl.cpp new file mode 100644 index 000000000..8cafdd98e --- /dev/null +++ b/indra/newview/aoremotectrl.cpp @@ -0,0 +1,122 @@ +/** +* @file aoremotectrl.cpp +* @brief toolbar remote for toggling the viewer AO +* +* $LicenseInfo:firstyear=2009&license=viewergpl$ +* +* Copyright (c) 2010, McCabe Maxsted +* +* Imprudence Viewer Source Code +* The source code in this file ("Source Code") is provided to you +* under the terms of the GNU General Public License, version 2.0 +* ("GPL"). Terms of the GPL can be found in doc/GPL-license.txt in +* this distribution, or online at +* http://secondlifegrid.net/programs/open_source/licensing/gplv2 +* +* There are special exceptions to the terms and conditions of the GPL as +* it is applied to this Source Code. View the full text of the exception +* in the file doc/FLOSS-exception.txt in this software distribution, or +* online at http://secondlifegrid.net/programs/open_source/licensing/flossexception +* +* By copying, modifying or distributing this software, you acknowledge +* that you have read and understood your obligations described above, +* and agree to abide by those obligations. +* +* ALL SOURCE CODE IS PROVIDED "AS IS." THE AUTHOR MAKES NO +* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, +* COMPLETENESS OR PERFORMANCE. +* $/LicenseInfo$ +*/ + +#include "llviewerprecompiledheaders.h" + +#include "aoremotectrl.h" + +#include "floaterao.h" +#include "llbutton.h" +#include "lloverlaybar.h" +#include "lluictrlfactory.h" +#include "llviewercontrol.h" + + +AORemoteCtrl::AORemoteCtrl() +{ + setIsChrome(TRUE); + build(); + setFocusRoot(TRUE); +} + +AORemoteCtrl::~AORemoteCtrl() +{ +} + +void AORemoteCtrl::draw() +{ + LLButton* expand_button = getChild("popup_btn"); + if (expand_button) + { + if (expand_button->getToggleState()) + { + expand_button->setImageOverlay("arrow_down.tga"); + } + else + { + expand_button->setImageOverlay("arrow_up.tga"); + } + } + + LLPanel::draw(); +} + +void AORemoteCtrl::build() +{ + if (gSavedSettings.getBOOL("ShowAOSitPopup")) + { + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_ao_remote_expanded.xml"); + } + else + { + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_ao_remote.xml"); + } +} + +BOOL AORemoteCtrl::postBuild() +{ + + childSetAction("ao_btn", onClickToggleAO, this); + childSetAction("ao_sit_btn", onClickToggleAOSit, this); + childSetAction("ao_show_btn", onClickShowAO, this); + childSetAction("popup_btn", onClickPopupBtn, this); + + return TRUE; +} + +// static +void AORemoteCtrl::onClickToggleAO(void* data) +{ + BOOL ao_enable = gSavedSettings.getBOOL("AOEnabled"); + gSavedSettings.setBOOL("AOEnabled", !ao_enable); +} + +//static +void AORemoteCtrl::onClickToggleAOSit(void* data) +{ + BOOL sit_enable = gSavedSettings.getBOOL("AOSitsEnabled"); + gSavedSettings.setBOOL("AOSitsEnabled", !sit_enable); +} + +//static +void AORemoteCtrl::onClickShowAO(void* data) +{ + LLFloaterAO::show(NULL); +} + +//static +void AORemoteCtrl::onClickPopupBtn(void* data) +{ + AORemoteCtrl* remotep = (AORemoteCtrl*)data; + + remotep->deleteAllChildren(); + remotep->build(); + gOverlayBar->layoutButtons(); +} diff --git a/indra/newview/aoremotectrl.h b/indra/newview/aoremotectrl.h new file mode 100644 index 000000000..ca74e0de6 --- /dev/null +++ b/indra/newview/aoremotectrl.h @@ -0,0 +1,54 @@ +/** +* @file aoremotectrl.h +* @brief toolbar remote for toggling the viewer AO +* +* $LicenseInfo:firstyear=2009&license=viewergpl$ +* +* Copyright (c) 2010, McCabe Maxsted +* +* Imprudence Viewer Source Code +* The source code in this file ("Source Code") is provided to you +* under the terms of the GNU General Public License, version 2.0 +* ("GPL"). Terms of the GPL can be found in doc/GPL-license.txt in +* this distribution, or online at +* http://secondlifegrid.net/programs/open_source/licensing/gplv2 +* +* There are special exceptions to the terms and conditions of the GPL as +* it is applied to this Source Code. View the full text of the exception +* in the file doc/FLOSS-exception.txt in this software distribution, or +* online at http://secondlifegrid.net/programs/open_source/licensing/flossexception +* +* By copying, modifying or distributing this software, you acknowledge +* that you have read and understood your obligations described above, +* and agree to abide by those obligations. +* +* ALL SOURCE CODE IS PROVIDED "AS IS." THE AUTHOR MAKES NO +* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, +* COMPLETENESS OR PERFORMANCE. +* $/LicenseInfo$ +*/ + +#ifndef AOREMOTECTRL_H +#define AOREMOTECTRL_H + +#include "llpanel.h" + +class AORemoteCtrl : public LLPanel +{ +public: + AORemoteCtrl(); + virtual ~AORemoteCtrl(); + /*virtual*/ BOOL postBuild(); + /*virtual*/ void draw(); + +private: + + void build(); + + static void onClickToggleAO(void* data); + static void onClickToggleAOSit(void* data); + static void onClickShowAO(void* data); + static void onClickPopupBtn(void* data); +}; + +#endif // AOREMOTECTRL_H diff --git a/indra/newview/app_settings/ao_template.ini b/indra/newview/app_settings/ao_template.ini new file mode 100644 index 000000000..03f02e305 --- /dev/null +++ b/indra/newview/app_settings/ao_template.ini @@ -0,0 +1,103 @@ +############################################################ +############################################################ +## +## IMPRUDENCE AO TEMPLATE +## +############################################################ +## +## INSTRUCTIONS: +## +## 1. Detach any AO you are currently wearing or it will interfere. +## +## 2. Place all of the animations you want ot use into a folder in your inventory. +## +## 3. Place the notecard for the AO in the *SAME* folder. +## +## 4. Find the line that matches the animation you're changing. +## For example, if you're adding a walk animation, +## find the line that starts with [ Walking ] +## +## If the notecard already has walking animations, the line will look something like this: +## [ Walking ]SexyWalk1|SexyWalk2 +## +## 5. Type the name of the new animation at the end of this line. +## If the line already contains some animations, type '|' before +## typing the animation name. Once you're done, the line should look like this: +## [ Walking ]NewWalkAnim +## or +## [ Walking ]SexyWalk1|SexyWalk2|NewWalkAnim +## +## 6. Once you're done, save the notecard. +## +## 7. Open the client AO window (CTRL-SHIFT-O) then drag the notecard onto the indicated spot. +## +## 8. Press the "Reload" button in the AO. +## +############################################################ + +############################################################ +############################################################ +## +## LIST YOUR ANIMATIONS HERE +## +############################################################ +############################################################ + + +[ Standing ] +[ Walking ] +[ Sitting ] +[ Sitting On Ground ] +[ Crouching ] +[ Crouch Walking ] +[ Landing ] +[ Standing Up ] +[ Falling ] +[ Flying Down ] +[ Flying Up ] +[ Flying ] +[ Flying Slow ] +[ Hovering ] +[ Jumping ] +[ Pre Jumping ] +[ Running ] +[ Turning Right ] +[ Turning Left ] +[ Floating ] +[ Swimming Forward ] +[ Swimming Up ] +[ Swimming Down ] + + +############################################################# +############################################################# +## +## FOR ADVANCED USERS ONLY +## +############################################################# +## +## Lines starting with a # are treated as comments and ignored. Blank lines are ignored. Valid lines look like this: +## +## [ Walking ]SexyWalk1|SexyWalk2|SexyWalk3 +## +## The token (in this case, [ Walking ] - note the spaces inside the [ ]) identifies the animation to be overridden. The rest is a list of +## animations, separated by the '|' (pipe) character. You can specify multiple animations for Stands, Walks, Sits, and GroundSits. +## Multiple animations on any other line are invalid. You can list as many animations as you want. +## +## You can repeat tokens, so you can split the Stands up across multiple lines. Use the [ Standing ] token in each line, and +## the viewer will add the animation lists together. +## +## Each 'animation name' can be a comma-separated list of animations, which will be played together. For example: +## [ Walking ]SexyWalk1UpperBody,SexyWalk1LowerBody|SexyWalk2|SexyWalk3 +## +## Note the ',' between SexyWalk1UpperBody and SexyWalk1LowerBody - this tells AO to treat these as a single +## 'animation' and play them together. The '|' between this 'animation' and SexyWalk2 tells AO to treat SexyWalk2 and +## SexyWalk3 as separate walk animations. You can use this to layer animations on top of each other. +## +## Do not add any spaces around animation names!!! +## +## If you have read and understood these instructions, feel free to delete these lines. +## +## Imprudence's AO notecard system is based on the ZHAO-II HUD by Second Life resident Ziggy Puff. +## +############################################################ \ No newline at end of file diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 172da1165..1d5664fbc 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -8,7 +8,140 @@ settings_sh.xml settings_rlv.xml + + + + ShowAOSitPopup + + Comment + Show AO sit popup + Persist + 1 + Type + Boolean + Value + 0 + + EnableAORemote + + Comment + Enable AO quick access remote in toolbar + Persist + 1 + Type + Boolean + Value + 0 + + + DisableInternalFlyUpAnimation + + Comment + Disables the internal hover up animation (on your local computer only). Enable if you use an AO and wear hand attachments like rings, prim nails etc. that often loose their correct position while flying. + Persist + 1 + Type + Boolean + Value + 0 + + + AOEnabled + + Comment + Turn on Animation Overrider + Persist + 1 + Type + Boolean + Value + 0 + + AOAdvanced + + Comment + Advanced options + Persist + 0 + Type + Boolean + Value + 0 + + AOSitsEnabled + + Comment + Overrides sit animations. + Persist + 1 + Type + Boolean + Value + 1 + + AONoStandsInMouselook + + Comment + Disables stand anims during mouselook + Persist + 1 + Type + Boolean + Value + 1 + + AOStandInterval + + Comment + AO stand time in seconds + Persist + 1 + Type + F32 + Value + 20 + + AOStandRandomize + + Comment + Randomize stand anims + Persist + 1 + Type + Boolean + Value + 0 + + AORect + + Comment + Rectangle for AO window + Persist + 1 + Type + Rect + Value + + 0 + 100 + 100 + 100 + + + + ClientDefinitionsURL + + Comment + Where to fetch updated client definitions from + Persist + 1 + Type + String + Value + http://app.singularityviewer.org/client_definitions.xml + + LastSelectedGrid Comment @@ -194,28 +327,6 @@ Value 3 - AO.Enabled - - Comment - Enable animation overrider - Persist - 1 - Type - Boolean - Value - 0 - - AO.Period - - Comment - Period when changing stands in seconds - Persist - 1 - Type - F32 - Value - 20.0 - Blacklist.Settings Comment @@ -5982,7 +6093,7 @@ Type String Value - MtBkLfRg.ttf + Ubuntu-R.ttf FontSansSerifBundledFallback @@ -6004,7 +6115,7 @@ Type String Value - MtBdLfRg.ttf + Ubuntu-B.ttf FontSansSerifFallback @@ -6026,7 +6137,7 @@ Type F32 Value - 1.0 + 0.95 FontScreenDPI @@ -13135,6 +13246,17 @@ Value 1 + WarnFirstAO + + Comment + Enables FirstAO warning dialog + Persist + 1 + Type + Boolean + Value + 1 + WarnFirstAppearance Comment diff --git a/indra/newview/app_settings/settings_per_account.xml b/indra/newview/app_settings/settings_per_account.xml index 1d04fe3e7..25fce02fa 100644 --- a/indra/newview/app_settings/settings_per_account.xml +++ b/indra/newview/app_settings/settings_per_account.xml @@ -8,6 +8,197 @@ + + + AOConfigNotecardID + + Comment + InventoryItemID of the AO config notecard + Persist + 1 + Type + String + Value + + + AODefaultWalk + + Comment + Default walk anim + Persist + 1 + Type + String + Value + + + AODefaultSit + + Comment + Default sit anim + Persist + 1 + Type + String + Value + + + AODefaultRun + + Comment + Default run anim + Persist + 1 + Type + String + Value + + + AODefaultJump + + Comment + Default jump anim + Persist + 1 + Type + String + Value + + + AODefaultGroundSit + + Comment + Default groundsit anim + Persist + 1 + Type + String + Value + + + AODefaultCrouch + + Comment + Default crouch anim + Persist + 1 + Type + String + Value + + + AODefaultCrouchWalk + + Comment + Default crouchwalk anim + Persist + 1 + Type + String + Value + + + AODefaultFall + + Comment + Default fall anim + Persist + 1 + Type + String + Value + + + AODefaultHover + + Comment + Default hover anim + Persist + 1 + Type + String + Value + + + AODefaultFly + + Comment + Default fly anim + Persist + 1 + Type + String + Value + + + AODefaultFlySlow + + Comment + Default flyslow anim + Persist + 1 + Type + String + Value + + + AODefaultFlyUp + + Comment + Default flyup anim + Persist + 1 + Type + String + Value + + + AODefaultFlyDown + + Comment + Default flydown anim + Persist + 1 + Type + String + Value + + + AODefaultLand + + Comment + Default land anim + Persist + 1 + Type + String + Value + + + AODefaultStandUp + + Comment + Default standup anim + Persist + 1 + Type + String + Value + + + AODefaultPreJump + + Comment + Default prejump anim + Persist + 1 + Type + String + Value + + + + diff --git a/indra/newview/floaterao.cpp b/indra/newview/floaterao.cpp new file mode 100644 index 000000000..489a838eb --- /dev/null +++ b/indra/newview/floaterao.cpp @@ -0,0 +1,1432 @@ +/** + * @file llfloaterao.cpp + * @brief clientside animation overrider + * by Skills Hak + */ + +#include "llviewerprecompiledheaders.h" + +#include "floaterao.h" + +#include "llagent.h" +#include "llvoavatar.h" +#include "llanimationstates.h" +#include "lluictrlfactory.h" +#include "llinventoryview.h" +#include "llstartup.h" +#include "llpreviewnotecard.h" +#include "llviewertexteditor.h" +#include "llcheckboxctrl.h" +#include "llcombobox.h" +#include "llspinctrl.h" +#include "chatbar_as_cmdline.h" +//#include "llfloaterchat.h" +#include "llfirstuse.h" + +#include "llinventory.h" +#include "llinventoryview.h" +#include "roles_constants.h" +#include "llviewerregion.h" + +#include "llpanelinventory.h" +#include "llinventorybridge.h" + +#include "llboost.h" +#include + +// Uncomment and use instead if we ever add the chatbar as a command line - MC +void cmdline_printchat(std::string message); + +class AONotecardCallback : public LLInventoryCallback +{ +public: + AONotecardCallback(std::string &filename) + { + mFileName = filename; + } + + void fire(const LLUUID &inv_item) + { + if (!mFileName.empty()) + { + LLPreviewNotecard* nc; + nc = (LLPreviewNotecard*)LLPreview::find(inv_item); + if(nc) + { + nc->open(); + LLTextEditor *text = nc->getEditor(); + if (text) + { + text->clear(); + text->makePristine(); + + std::ifstream file(mFileName.c_str()); + + std::string line; + while (!file.eof()) + { + getline(file, line); + line = line + "\n"; + text->insertText(line); + } + file.close(); + + nc->saveIfNeeded(); + } + } + } + } + +private: + std::string mFileName; +}; + +AOInvTimer* gAOInvTimer = NULL; + + +// ------------------------------------------------------- + +AOStandTimer* mAOStandTimer; + +AOStandTimer::AOStandTimer() : LLEventTimer( gSavedSettings.getF32("AOStandInterval") ) +{ + AOStandTimer::tick(); +} +AOStandTimer::~AOStandTimer() +{ +// llinfos << "dead" << llendl; +} +void AOStandTimer::reset() +{ + mPeriod = gSavedSettings.getF32("AOStandInterval"); + mEventTimer.reset(); +// llinfos << "reset" << llendl; +} +BOOL AOStandTimer::tick() +{ + LLFloaterAO::stand_iterator++; +// llinfos << "tick" << llendl; + LLFloaterAO::ChangeStand(); + return FALSE; +// return LLFloaterAO::ChangeStand(); //timer is always active now .. +} + +// ------------------------------------------------------- + +AOInvTimer::AOInvTimer() : LLEventTimer( (F32)1.0 ) +{ +} +AOInvTimer::~AOInvTimer() +{ +} +BOOL AOInvTimer::tick() +{ + if (!(gSavedSettings.getBOOL("AOEnabled"))) return TRUE; + if(LLStartUp::getStartupState() >= STATE_INVENTORY_SEND) + { + if(gInventory.isEverythingFetched()) + { +// cmdline_printchat("Inventory fetched, loading AO."); + LLFloaterAO::init(); + return TRUE; + } + } + return FALSE; +} +// NC DROP ------------------------------------------------------- + +class AONoteCardDropTarget : public LLView +{ +public: + AONoteCardDropTarget(const std::string& name, const LLRect& rect, void (*callback)(LLViewerInventoryItem*)); + ~AONoteCardDropTarget(); + + void doDrop(EDragAndDropType cargo_type, void* cargo_data); + + // + // LLView functionality + virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg); +protected: + void (*mDownCallback)(LLViewerInventoryItem*); +}; + + +AONoteCardDropTarget::AONoteCardDropTarget(const std::string& name, const LLRect& rect, + void (*callback)(LLViewerInventoryItem*)) : + LLView(name, rect, NOT_MOUSE_OPAQUE, FOLLOWS_ALL), + mDownCallback(callback) +{ +} + +AONoteCardDropTarget::~AONoteCardDropTarget() +{ +} + +void AONoteCardDropTarget::doDrop(EDragAndDropType cargo_type, void* cargo_data) +{ +// llinfos << "AONoteCardDropTarget::doDrop()" << llendl; +} + +BOOL AONoteCardDropTarget::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, + EDragAndDropType cargo_type, + void* cargo_data, + EAcceptance* accept, + std::string& tooltip_msg) +{ + BOOL handled = FALSE; + if(getParent()) + { + handled = TRUE; + LLViewerInventoryItem* inv_item = (LLViewerInventoryItem*)cargo_data; + if(gInventory.getItem(inv_item->getUUID())) + { + *accept = ACCEPT_YES_COPY_SINGLE; + if(drop) + { + mDownCallback(inv_item); + } + } + else + { + *accept = ACCEPT_NO; + } + } + return handled; +} + +AONoteCardDropTarget * LLFloaterAO::mAOItemDropTarget; + + +// STUFF ------------------------------------------------------- + +int LLFloaterAO::mAnimationState = 0; +int LLFloaterAO::stand_iterator = 0; + +LLUUID LLFloaterAO::invfolderid = LLUUID::null; +LLUUID LLFloaterAO::mCurrentStandId = LLUUID::null; + +LLComboBox* mcomboBox_stands; +LLComboBox* mcomboBox_walks; +LLComboBox* mcomboBox_runs; +LLComboBox* mcomboBox_jumps; +LLComboBox* mcomboBox_sits; +LLComboBox* mcomboBox_gsits; +LLComboBox* mcomboBox_crouchs; +LLComboBox* mcomboBox_cwalks; +LLComboBox* mcomboBox_falls; +LLComboBox* mcomboBox_hovers; +LLComboBox* mcomboBox_flys; +LLComboBox* mcomboBox_flyslows; +LLComboBox* mcomboBox_flyups; +LLComboBox* mcomboBox_flydowns; +LLComboBox* mcomboBox_lands; +LLComboBox* mcomboBox_standups; +LLComboBox* mcomboBox_prejumps; + +struct struct_overrides +{ + LLUUID orig_id; + LLUUID ao_id; + int state; +}; +std::vector mAOOverrides; + +struct struct_stands +{ + LLUUID ao_id; + std::string anim_name; +}; +std::vector mAOStands; + +struct struct_tokens +{ + std::string token; + int state; +}; +std::vector mAOTokens; + +LLFloaterAO* LLFloaterAO::sInstance = NULL; + +LLFloaterAO::LLFloaterAO() +:LLFloater(std::string("floater_ao")) +{ +// init(); + llassert_always(sInstance == NULL); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_ao.xml"); + sInstance = this; +} + +LLFloaterAO::~LLFloaterAO() +{ + sInstance=NULL; + mcomboBox_stands = 0; + mcomboBox_walks = 0; + mcomboBox_runs = 0; + mcomboBox_jumps = 0; + mcomboBox_sits = 0; + mcomboBox_gsits = 0; + mcomboBox_crouchs = 0; + mcomboBox_cwalks = 0; + mcomboBox_falls = 0; + mcomboBox_hovers = 0; + mcomboBox_flys = 0; + mcomboBox_flyslows = 0; + mcomboBox_flyups = 0; + mcomboBox_flydowns = 0; + mcomboBox_lands = 0; + mcomboBox_standups = 0; + mcomboBox_prejumps = 0; + delete mAOItemDropTarget; + mAOItemDropTarget = NULL; +// llinfos << "floater destroyed" << llendl; +} + +void LLFloaterAO::show(void*) +{ + if (!sInstance) + { + sInstance = new LLFloaterAO(); + updateLayout(sInstance); + init(); + + sInstance->open(); + } + else + { + sInstance->close(); + } + LLFirstUse::useAO(); +} + +bool LLFloaterAO::getInstance() +{ + if (sInstance) + return true; + else + return false; +} + +BOOL LLFloaterAO::postBuild() +{ + LLView *target_view = getChild("ao_notecard"); + if(target_view) + { + if (mAOItemDropTarget) + { + delete mAOItemDropTarget; + } + mAOItemDropTarget = new AONoteCardDropTarget("drop target", target_view->getRect(), AOItemDrop);//, mAvatarID); + addChild(mAOItemDropTarget); + } + if(LLStartUp::getStartupState() == STATE_STARTED) + { + LLUUID itemidimport = (LLUUID)gSavedPerAccountSettings.getString("AOConfigNotecardID"); + LLViewerInventoryItem* itemimport = gInventory.getItem(itemidimport); + if(itemimport) + { + childSetValue("ao_nc_text","Currently set to: "+itemimport->getName()); + } + else if(itemidimport.isNull()) + { + childSetValue("ao_nc_text","Currently not set"); + } + else + { + childSetValue("ao_nc_text","Currently set to a item not on this account"); + } + } + else + { + childSetValue("ao_nc_text","Not logged in"); + } + childSetAction("more_btn", onClickMore, this); + childSetAction("less_btn", onClickLess, this); + + childSetAction("reloadcard",onClickReloadCard,this); + childSetAction("opencard",onClickOpenCard,this); + childSetAction("newcard",onClickNewCard,this); + childSetAction("prevstand",onClickPrevStand,this); + childSetAction("nextstand",onClickNextStand,this); + childSetCommitCallback("AOEnabled",onClickToggleAO); + childSetCommitCallback("AOSitsEnabled",onClickToggleSits); + childSetCommitCallback("standtime",onSpinnerCommit); + mcomboBox_stands = getChild("stands"); + mcomboBox_walks = getChild("walks"); + mcomboBox_runs = getChild("runs"); + mcomboBox_jumps = getChild("jumps"); + mcomboBox_sits = getChild("sits"); + mcomboBox_gsits = getChild("gsits"); + mcomboBox_crouchs = getChild("crouchs"); + mcomboBox_cwalks = getChild("cwalks"); + mcomboBox_falls = getChild("falls"); + mcomboBox_hovers = getChild("hovers"); + mcomboBox_flys = getChild("flys"); + mcomboBox_flyslows = getChild("flyslows"); + mcomboBox_flyups = getChild("flyups"); + mcomboBox_flydowns = getChild("flydowns"); + mcomboBox_lands = getChild("lands"); + mcomboBox_standups = getChild("standups"); + mcomboBox_prejumps = getChild("prejumps"); + getChild("stands")->setCommitCallback(onComboBoxCommit); + getChild("walks")->setCommitCallback(onComboBoxCommit); + getChild("runs")->setCommitCallback(onComboBoxCommit); + getChild("jumps")->setCommitCallback(onComboBoxCommit); + getChild("sits")->setCommitCallback(onComboBoxCommit); + getChild("gsits")->setCommitCallback(onComboBoxCommit); + getChild("crouchs")->setCommitCallback(onComboBoxCommit); + getChild("cwalks")->setCommitCallback(onComboBoxCommit); + getChild("falls")->setCommitCallback(onComboBoxCommit); + getChild("hovers")->setCommitCallback(onComboBoxCommit); + getChild("flys")->setCommitCallback(onComboBoxCommit); + getChild("flyslows")->setCommitCallback(onComboBoxCommit); + getChild("flyups")->setCommitCallback(onComboBoxCommit); + getChild("flydowns")->setCommitCallback(onComboBoxCommit); + getChild("lands")->setCommitCallback(onComboBoxCommit); + getChild("standups")->setCommitCallback(onComboBoxCommit); + getChild("prejumps")->setCommitCallback(onComboBoxCommit); + + return TRUE; +} + +void LLFloaterAO::onSpinnerCommit(LLUICtrl* ctrl, void* userdata) +{ + LLSpinCtrl* spin = (LLSpinCtrl*) ctrl; + if(spin) + { + if (spin->getName() == "standtime") + { + if (mAOStandTimer) mAOStandTimer->reset(); + } + } +} + +void LLFloaterAO::onComboBoxCommit(LLUICtrl* ctrl, void* userdata) +{ + LLComboBox* box = (LLComboBox*)ctrl; + if(box) + { + if (box->getName() == "stands") + { + stand_iterator = box->getCurrentIndex(); + cmdline_printchat(llformat("Changing stand to %s.",mAOStands[stand_iterator].anim_name.c_str())); + ChangeStand(); + } + else + { + int state = STATE_AGENT_IDLE; + std::string stranim = box->getValue().asString(); +// llinfos << "state " << (gAgent.getAvatarObject()->mIsSitting) << " - " << getAnimationState() << llendl; + if (box->getName() == "walks") + { + gAgent.sendAnimationRequest(GetAnimID(ANIM_AGENT_WALK), ANIM_REQUEST_STOP); + gSavedPerAccountSettings.setString("AODefaultWalk",stranim); + state = STATE_AGENT_WALK; + } + else if (box->getName() == "runs") + { + gAgent.sendAnimationRequest(GetAnimID(ANIM_AGENT_RUN), ANIM_REQUEST_STOP); + gSavedPerAccountSettings.setString("AODefaultRun",stranim); + state = STATE_AGENT_RUN; + } + else if (box->getName() == "jumps") + { + gAgent.sendAnimationRequest(GetAnimID(ANIM_AGENT_JUMP), ANIM_REQUEST_STOP); + gSavedPerAccountSettings.setString("AODefaultJump",stranim); + state = STATE_AGENT_JUMP; + } + else if (box->getName() == "sits") + { + if (gAgent.getAvatarObject() && (gSavedSettings.getBOOL("AOEnabled")) && (gSavedSettings.getBOOL("AOSitsEnabled"))) + { + if ((gAgent.getAvatarObject()->mIsSitting) && (getAnimationState() == STATE_AGENT_SIT)) + { +// llinfos << "sitting " << GetAnimID(ANIM_AGENT_SIT) << " " << getAssetIDByName(stranim) << llendl; + gAgent.sendAnimationRequest(GetAnimID(ANIM_AGENT_SIT), ANIM_REQUEST_STOP); + gAgent.sendAnimationRequest(getAssetIDByName(stranim), ANIM_REQUEST_START); + } + } + gSavedPerAccountSettings.setString("AODefaultSit",stranim); + state = STATE_AGENT_SIT; + } + else if (box->getName() == "gsits") + { +// llinfos << "gsitting " << GetAnimID(ANIM_AGENT_SIT_GROUND) << " " << getAssetIDByName(stranim) << llendl; + if (gAgent.getAvatarObject()) + { + if ((gAgent.getAvatarObject()->mIsSitting) && (getAnimationState() == STATE_AGENT_GROUNDSIT)) + { +// llinfos << "gsitting " << GetAnimID(ANIM_AGENT_SIT_GROUND) << " " << getAssetIDByName(stranim) << llendl; + gAgent.sendAnimationRequest(GetAnimID(ANIM_AGENT_SIT_GROUND), ANIM_REQUEST_STOP); + gAgent.sendAnimationRequest(getAssetIDByName(stranim), ANIM_REQUEST_START); + } + } + gSavedPerAccountSettings.setString("AODefaultGroundSit",stranim); + state = STATE_AGENT_GROUNDSIT; + } + else if (box->getName() == "crouchs") + { + gAgent.sendAnimationRequest(GetAnimID(ANIM_AGENT_CROUCH), ANIM_REQUEST_STOP); + gSavedPerAccountSettings.setString("AODefaultCrouch",stranim); + state = STATE_AGENT_CROUCH; + } + else if (box->getName() == "cwalks") + { + gAgent.sendAnimationRequest(GetAnimID(ANIM_AGENT_CROUCHWALK), ANIM_REQUEST_STOP); + gSavedPerAccountSettings.setString("AODefaultCrouchWalk",stranim); + state = STATE_AGENT_CROUCHWALK; + } + else if (box->getName() == "falls") + { + gAgent.sendAnimationRequest(GetAnimID(ANIM_AGENT_FALLDOWN), ANIM_REQUEST_STOP); + gSavedPerAccountSettings.setString("AODefaultFall",stranim); + state = STATE_AGENT_FALLDOWN; + } + else if (box->getName() == "hovers") + { + gAgent.sendAnimationRequest(GetAnimID(ANIM_AGENT_HOVER), ANIM_REQUEST_STOP); + gSavedPerAccountSettings.setString("AODefaultHover",stranim); + state = STATE_AGENT_HOVER; + } + else if (box->getName() == "flys") + { + gAgent.sendAnimationRequest(GetAnimID(ANIM_AGENT_FLY), ANIM_REQUEST_STOP); + gSavedPerAccountSettings.setString("AODefaultFly",stranim); + state = STATE_AGENT_FLY; + } + else if (box->getName() == "flyslows") + { + gAgent.sendAnimationRequest(GetAnimID(ANIM_AGENT_FLYSLOW), ANIM_REQUEST_STOP); + gSavedPerAccountSettings.setString("AODefaultFlySlow",stranim); + state = STATE_AGENT_FLYSLOW; + } + else if (box->getName() == "flyups") + { + gAgent.sendAnimationRequest(GetAnimID(ANIM_AGENT_HOVER_UP), ANIM_REQUEST_STOP); + gSavedPerAccountSettings.setString("AODefaultFlyUp",stranim); + state = STATE_AGENT_HOVER_UP; + } + else if (box->getName() == "flydowns") + { + gAgent.sendAnimationRequest(GetAnimID(ANIM_AGENT_HOVER_DOWN), ANIM_REQUEST_STOP); + gSavedPerAccountSettings.setString("AODefaultFlyDown",stranim); + state = STATE_AGENT_HOVER_DOWN; + } + else if (box->getName() == "lands") + { + gAgent.sendAnimationRequest(GetAnimID(ANIM_AGENT_LAND), ANIM_REQUEST_STOP); + gSavedPerAccountSettings.setString("AODefaultLand",stranim); + state = STATE_AGENT_LAND; + } + else if (box->getName() == "standups") + { + gAgent.sendAnimationRequest(GetAnimID(ANIM_AGENT_STAND), ANIM_REQUEST_STOP); + gSavedPerAccountSettings.setString("AODefaultStandUp",stranim); + state = STATE_AGENT_STAND; + } + else if (box->getName() == "prejumps") + { + gAgent.sendAnimationRequest(GetAnimID(ANIM_AGENT_PRE_JUMP), ANIM_REQUEST_STOP); + gSavedPerAccountSettings.setString("AODefaultPreJump",stranim); + state = STATE_AGENT_PRE_JUMP; + } + for (std::vector::iterator iter = mAOOverrides.begin(); iter != mAOOverrides.end(); ++iter) + { + if (state == iter->state) + { + iter->ao_id = getAssetIDByName(stranim); + } + } + } + } +} + +void LLFloaterAO::updateLayout(LLFloaterAO* floater) +{ + if (floater) + { + BOOL advanced = gSavedSettings.getBOOL( "AOAdvanced"); + if (advanced) + { + floater->reshape(610,380); //view->getRect().getWidth(), view->getUIWinHeightLong()); + } + else + { + floater->reshape(200,380); //view->getRect().getWidth(), view->getUIWinHeightShort()); + } + + floater->childSetVisible("more_btn", !advanced); + floater->childSetVisible("less_btn", advanced); + + floater->childSetVisible("tabcontainer", advanced); + floater->childSetVisible("tabdefaultanims", advanced); + + floater->childSetVisible("textdefaultwalk", advanced); + floater->childSetVisible("textdefaultrun", advanced); + floater->childSetVisible("textdefaultjump", advanced); + floater->childSetVisible("textdefaultsit", advanced); + floater->childSetVisible("textdefaultgsit", advanced); + floater->childSetVisible("textdefaultcrouch", advanced); + floater->childSetVisible("textdefaultcrouchwalk", advanced); + floater->childSetVisible("textdefaultfall", advanced); + floater->childSetVisible("textdefaulthover", advanced); + floater->childSetVisible("textdefaultfly", advanced); + floater->childSetVisible("textdefaultflyslow", advanced); + floater->childSetVisible("textdefaultflyup", advanced); + floater->childSetVisible("textdefaultflydown", advanced); + floater->childSetVisible("textdefaultland", advanced); + floater->childSetVisible("textdefaultstandup", advanced); + floater->childSetVisible("textdefaultprejump", advanced); + + + floater->childSetVisible("walks", advanced); + floater->childSetVisible("runs", advanced); + floater->childSetVisible("jumps", advanced); + floater->childSetVisible("sits", advanced); + floater->childSetVisible("gsits", advanced); + floater->childSetVisible("crouchs", advanced); + floater->childSetVisible("crouchwalks", advanced); + floater->childSetVisible("falls", advanced); + floater->childSetVisible("hovers", advanced); + floater->childSetVisible("flys", advanced); + floater->childSetVisible("flyslows", advanced); + floater->childSetVisible("flyups", advanced); + floater->childSetVisible("flydowns", advanced); + floater->childSetVisible("lands", advanced); + floater->childSetVisible("standups", advanced); + floater->childSetVisible("prejumps", advanced); + } +} + +void LLFloaterAO::init() +{ + mAOStands.clear(); + mAOTokens.clear(); + mAOOverrides.clear(); + + struct_tokens tokenloader; + tokenloader.token = + tokenloader.token = "[ Sitting On Ground ]"; tokenloader.state = STATE_AGENT_GROUNDSIT; mAOTokens.push_back(tokenloader); // 0 + tokenloader.token = "[ Sitting ]"; tokenloader.state = STATE_AGENT_SIT; mAOTokens.push_back(tokenloader); // 1 + tokenloader.token = "[ Crouching ]"; tokenloader.state = STATE_AGENT_CROUCH; mAOTokens.push_back(tokenloader); // 3 + tokenloader.token = "[ Crouch Walking ]"; tokenloader.state = STATE_AGENT_CROUCHWALK; mAOTokens.push_back(tokenloader); // 4 + tokenloader.token = "[ Standing Up ]"; tokenloader.state = STATE_AGENT_STANDUP; mAOTokens.push_back(tokenloader); // 6 + tokenloader.token = "[ Falling ]"; tokenloader.state = STATE_AGENT_FALLDOWN; mAOTokens.push_back(tokenloader); // 7 + tokenloader.token = "[ Flying Down ]"; tokenloader.state = STATE_AGENT_HOVER_DOWN; mAOTokens.push_back(tokenloader); // 8 + tokenloader.token = "[ Flying Up ]"; tokenloader.state = STATE_AGENT_HOVER_UP; mAOTokens.push_back(tokenloader); // 9 + tokenloader.token = "[ Flying Slow ]"; tokenloader.state = STATE_AGENT_FLYSLOW; mAOTokens.push_back(tokenloader); // 10 + tokenloader.token = "[ Flying ]"; tokenloader.state = STATE_AGENT_FLY; mAOTokens.push_back(tokenloader); // 11 + tokenloader.token = "[ Hovering ]"; tokenloader.state = STATE_AGENT_HOVER; mAOTokens.push_back(tokenloader); // 12 + tokenloader.token = "[ Jumping ]"; tokenloader.state = STATE_AGENT_JUMP; mAOTokens.push_back(tokenloader); // 13 + tokenloader.token = "[ Pre Jumping ]"; tokenloader.state = STATE_AGENT_PRE_JUMP; mAOTokens.push_back(tokenloader); // 14 + tokenloader.token = "[ Running ]"; tokenloader.state = STATE_AGENT_RUN; mAOTokens.push_back(tokenloader); // 15 + tokenloader.token = "[ Turning Right ]"; tokenloader.state = STATE_AGENT_TURNRIGHT; mAOTokens.push_back(tokenloader); // 16 + tokenloader.token = "[ Turning Left ]"; tokenloader.state = STATE_AGENT_TURNLEFT; mAOTokens.push_back(tokenloader); // 17 + tokenloader.token = "[ Walking ]"; tokenloader.state = STATE_AGENT_WALK; mAOTokens.push_back(tokenloader); // 18 + tokenloader.token = "[ Landing ]"; tokenloader.state = STATE_AGENT_LAND; mAOTokens.push_back(tokenloader); // 19 + tokenloader.token = "[ Standing ]"; tokenloader.state = STATE_AGENT_STAND; mAOTokens.push_back(tokenloader); // 20 + tokenloader.token = "[ Swimming Down ]"; tokenloader.state = 999; mAOTokens.push_back(tokenloader); // 21 + tokenloader.token = "[ Swimming Up ]"; tokenloader.state = 999; mAOTokens.push_back(tokenloader); // 22 + tokenloader.token = "[ Swimming Forward ]"; tokenloader.state = 999; mAOTokens.push_back(tokenloader); // 23 + tokenloader.token = "[ Floating ]"; tokenloader.state = 999; mAOTokens.push_back(tokenloader); // 24 + + struct_overrides overrideloader; + overrideloader.orig_id = ANIM_AGENT_WALK; overrideloader.ao_id = LLUUID::null; overrideloader.state = STATE_AGENT_WALK; mAOOverrides.push_back(overrideloader); + overrideloader.orig_id = ANIM_AGENT_RUN; overrideloader.ao_id = LLUUID::null; overrideloader.state = STATE_AGENT_RUN; mAOOverrides.push_back(overrideloader); + overrideloader.orig_id = ANIM_AGENT_PRE_JUMP; overrideloader.ao_id = LLUUID::null; overrideloader.state = STATE_AGENT_PRE_JUMP; mAOOverrides.push_back(overrideloader); + overrideloader.orig_id = ANIM_AGENT_JUMP; overrideloader.ao_id = LLUUID::null; overrideloader.state = STATE_AGENT_JUMP; mAOOverrides.push_back(overrideloader); + overrideloader.orig_id = ANIM_AGENT_TURNLEFT; overrideloader.ao_id = LLUUID::null; overrideloader.state = STATE_AGENT_TURNLEFT; mAOOverrides.push_back(overrideloader); + overrideloader.orig_id = ANIM_AGENT_TURNRIGHT; overrideloader.ao_id = LLUUID::null; overrideloader.state = STATE_AGENT_TURNRIGHT; mAOOverrides.push_back(overrideloader); + + overrideloader.orig_id = ANIM_AGENT_SIT; overrideloader.ao_id = LLUUID::null; overrideloader.state = STATE_AGENT_SIT; mAOOverrides.push_back(overrideloader); + overrideloader.orig_id = ANIM_AGENT_SIT_FEMALE; overrideloader.ao_id = LLUUID::null; overrideloader.state = STATE_AGENT_SIT; mAOOverrides.push_back(overrideloader); + overrideloader.orig_id = ANIM_AGENT_SIT_GENERIC; overrideloader.ao_id = LLUUID::null; overrideloader.state = STATE_AGENT_SIT; mAOOverrides.push_back(overrideloader); + overrideloader.orig_id = ANIM_AGENT_SIT_GROUND; overrideloader.ao_id = LLUUID::null; overrideloader.state = STATE_AGENT_GROUNDSIT; mAOOverrides.push_back(overrideloader); + overrideloader.orig_id = ANIM_AGENT_SIT_GROUND_CONSTRAINED; overrideloader.ao_id = LLUUID::null; overrideloader.state = STATE_AGENT_GROUNDSIT; mAOOverrides.push_back(overrideloader); + + overrideloader.orig_id = ANIM_AGENT_HOVER; overrideloader.ao_id = LLUUID::null; overrideloader.state = STATE_AGENT_HOVER; mAOOverrides.push_back(overrideloader); + overrideloader.orig_id = ANIM_AGENT_HOVER_DOWN; overrideloader.ao_id = LLUUID::null; overrideloader.state = STATE_AGENT_HOVER_DOWN; mAOOverrides.push_back(overrideloader); + overrideloader.orig_id = ANIM_AGENT_HOVER_UP; overrideloader.ao_id = LLUUID::null; overrideloader.state = STATE_AGENT_HOVER_UP; mAOOverrides.push_back(overrideloader); + + overrideloader.orig_id = ANIM_AGENT_CROUCH; overrideloader.ao_id = LLUUID::null; overrideloader.state = STATE_AGENT_CROUCH; mAOOverrides.push_back(overrideloader); + overrideloader.orig_id = ANIM_AGENT_CROUCHWALK; overrideloader.ao_id = LLUUID::null; overrideloader.state = STATE_AGENT_CROUCHWALK; mAOOverrides.push_back(overrideloader); + + overrideloader.orig_id = ANIM_AGENT_FALLDOWN; overrideloader.ao_id = LLUUID::null; overrideloader.state = STATE_AGENT_FALLDOWN; mAOOverrides.push_back(overrideloader); + overrideloader.orig_id = ANIM_AGENT_STANDUP; overrideloader.ao_id = LLUUID::null; overrideloader.state = STATE_AGENT_STANDUP; mAOOverrides.push_back(overrideloader); + overrideloader.orig_id = ANIM_AGENT_LAND; overrideloader.ao_id = LLUUID::null; overrideloader.state = STATE_AGENT_LAND; mAOOverrides.push_back(overrideloader); + + overrideloader.orig_id = ANIM_AGENT_FLY; overrideloader.ao_id = LLUUID::null; overrideloader.state = STATE_AGENT_FLY; mAOOverrides.push_back(overrideloader); + overrideloader.orig_id = ANIM_AGENT_FLYSLOW; overrideloader.ao_id = LLUUID::null; overrideloader.state = STATE_AGENT_FLYSLOW; mAOOverrides.push_back(overrideloader); + + BOOL success = TRUE; + + if(LLStartUp::getStartupState() >= STATE_INVENTORY_SEND) + { + if(gInventory.isEverythingFetched()) + { + LLUUID configncitem = (LLUUID)gSavedPerAccountSettings.getString("AOConfigNotecardID"); + if (configncitem.notNull()) + { + success = FALSE; + const LLInventoryItem* item = gInventory.getItem(configncitem); + if(item) + { + if (gAgent.allowOperation(PERM_COPY, item->getPermissions(),GP_OBJECT_MANIPULATE) || gAgent.isGodlike()) + { + if(!item->getAssetUUID().isNull()) + { + LLUUID* new_uuid = new LLUUID(configncitem); + LLHost source_sim = LLHost::invalid; + invfolderid = item->getParentUUID(); + gAssetStorage->getInvItemAsset(source_sim, + gAgent.getID(), + gAgent.getSessionID(), + item->getPermissions().getOwner(), + LLUUID::null, + item->getUUID(), + item->getAssetUUID(), + item->getType(), + &onNotecardLoadComplete, + (void*)new_uuid, + TRUE); + success = TRUE; + } + } + } + } + } + } + + if (!success) + { + cmdline_printchat("Could not read the specified Config Notecard"); + } + +// mAnimationState = 0; +// mCurrentStandId = LLUUID::null; +// setAnimationState(STATE_AGENT_IDLE); + +} + +void LLFloaterAO::onClickMore(void* data) +{ + gSavedSettings.setBOOL( "AOAdvanced", TRUE ); + updateLayout(sInstance); +} +void LLFloaterAO::onClickLess(void* data) +{ + gSavedSettings.setBOOL( "AOAdvanced", FALSE ); + updateLayout(sInstance); +} + +void LLFloaterAO::onClickToggleAO(LLUICtrl *, void*) +{ + run(); +} + +void LLFloaterAO::onClickToggleSits(LLUICtrl *, void*) +{ + run(); +} + + +void LLFloaterAO::run() +{ + setAnimationState(STATE_AGENT_IDLE); // reset state + int state = getAnimationState(); // check if sitting or hovering + if ((state == STATE_AGENT_IDLE) || (state == STATE_AGENT_STAND)) + { + if (gSavedSettings.getBOOL("AOEnabled")) + { + if (mAOStandTimer) + { + mAOStandTimer->reset(); + ChangeStand(); + } + else + { + mAOStandTimer = new AOStandTimer(); + } + } + else + { + stopMotion(getCurrentStandId(), FALSE, TRUE); //stop stand first then set state + setAnimationState(STATE_AGENT_IDLE); + } + } + else + { + if (state == STATE_AGENT_SIT) gAgent.sendAnimationRequest(GetAnimIDFromState(state), (gSavedSettings.getBOOL("AOEnabled") && gSavedSettings.getBOOL("AOSitsEnabled")) ? ANIM_REQUEST_START : ANIM_REQUEST_STOP); + else gAgent.sendAnimationRequest(GetAnimIDFromState(state), gSavedSettings.getBOOL("AOEnabled") ? ANIM_REQUEST_START : ANIM_REQUEST_STOP); + } +} + +int LLFloaterAO::getAnimationState() +{ + if (gAgent.getAvatarObject()) + { + if (gAgent.getAvatarObject()->mIsSitting) setAnimationState(STATE_AGENT_SIT); + else if (gAgent.getFlying()) setAnimationState(STATE_AGENT_HOVER); + } + return mAnimationState; +} + +void LLFloaterAO::setAnimationState(const int state) +{ + mAnimationState = state; +} + +LLUUID LLFloaterAO::getCurrentStandId() +{ + return mCurrentStandId; +} + +void LLFloaterAO::setCurrentStandId(const LLUUID& id) +{ + mCurrentStandId = id; +} + +void LLFloaterAO::AOItemDrop(LLViewerInventoryItem* item) +{ + gSavedPerAccountSettings.setString("AOConfigNotecardID", item->getUUID().asString()); + sInstance->childSetValue("ao_nc_text","Currently set to: "+item->getName()); +} + +LLUUID LLFloaterAO::GetAnimID(const LLUUID& id) +{ + for (std::vector::iterator iter = mAOOverrides.begin(); iter != mAOOverrides.end(); ++iter) + { + if (iter->orig_id == id) return iter->ao_id; + } + return LLUUID::null; +} + +int LLFloaterAO::GetStateFromAnimID(const LLUUID& id) +{ + for (std::vector::iterator iter = mAOOverrides.begin(); iter != mAOOverrides.end(); ++iter) + { + if (iter->orig_id == id) return iter->state; + } + return STATE_AGENT_IDLE; +} + +LLUUID LLFloaterAO::GetAnimIDFromState(const int state) +{ + for (std::vector::iterator iter = mAOOverrides.begin(); iter != mAOOverrides.end(); ++iter) + { + if (iter->state == state) return iter->ao_id; + } + return LLUUID::null; +} + +int LLFloaterAO::GetStateFromToken(std::string strtoken) +{ + for (std::vector::iterator iter = mAOTokens.begin(); iter != mAOTokens.end(); ++iter) + { + if (iter->token == strtoken) return iter->state; + } + return STATE_AGENT_IDLE; +} + +void LLFloaterAO::onClickPrevStand(void* user_data) +{ + if (!(mAOStands.size() > 0)) return; + stand_iterator=stand_iterator-1; + if (stand_iterator < 0) stand_iterator = int( mAOStands.size()-stand_iterator); + if (stand_iterator > int( mAOStands.size()-1)) stand_iterator = 0; + cmdline_printchat(llformat("Changing stand to %s.",mAOStands[stand_iterator].anim_name.c_str())); + ChangeStand(); +} + +void LLFloaterAO::onClickNextStand(void* user_data) +{ + if (!(mAOStands.size() > 0)) return; + stand_iterator=stand_iterator+1; + if (stand_iterator < 0) stand_iterator = int( mAOStands.size()-stand_iterator); + if (stand_iterator > int( mAOStands.size()-1)) stand_iterator = 0; + cmdline_printchat(llformat("Changing stand to %s.",mAOStands[stand_iterator].anim_name.c_str())); + ChangeStand(); +} + +BOOL LLFloaterAO::ChangeStand() +{ + if (gSavedSettings.getBOOL("AOEnabled")) + { + if (gAgent.getAvatarObject()) + { + if (gSavedSettings.getBOOL("AONoStandsInMouselook") && gAgent.cameraMouselook()) return FALSE; + + if (gAgent.getAvatarObject()->mIsSitting) + { +// stopMotion(getCurrentStandId(), FALSE, TRUE); //stop stand first then set state +// if (getAnimationState() != STATE_AGENT_GROUNDSIT) setAnimationState(STATE_AGENT_SIT); +// setCurrentStandId(LLUUID::null); + return FALSE; + } + } + if ((getAnimationState() == STATE_AGENT_IDLE) || (getAnimationState() == STATE_AGENT_STAND))// stands have lowest priority + { + if (!(mAOStands.size() > 0)) return TRUE; + if (gSavedSettings.getBOOL("AOStandRandomize")) + { + stand_iterator = ll_rand(mAOStands.size()-1); + } + if (stand_iterator < 0) stand_iterator = int( mAOStands.size()-stand_iterator); + if (stand_iterator > int( mAOStands.size()-1)) stand_iterator = 0; + + int stand_iterator_previous = stand_iterator -1; + + if (stand_iterator_previous < 0) stand_iterator_previous = int( mAOStands.size()-1); + + if (mAOStands[stand_iterator].ao_id.notNull()) + { + stopMotion(getCurrentStandId(), FALSE, TRUE); //stop stand first then set state + startMotion(mAOStands[stand_iterator].ao_id, 0, TRUE); + + setAnimationState(STATE_AGENT_STAND); + setCurrentStandId(mAOStands[stand_iterator].ao_id); + if ((sInstance)&&(mcomboBox_stands)) mcomboBox_stands->selectNthItem(stand_iterator); +// llinfos << "changing stand to " << mAOStands[stand_iterator].anim_name << llendl; + return FALSE; + } + } + } + else + { + stopMotion(getCurrentStandId(), FALSE, TRUE); + return TRUE; //stop if ao is off + } + return TRUE; +} + + +BOOL LLFloaterAO::startMotion(const LLUUID& id, F32 time_offset, BOOL stand) +{ + if (stand) + { + if (id.notNull()) + { + BOOL sitting = FALSE; + if (gAgent.getAvatarObject()) + { + sitting = gAgent.getAvatarObject()->mIsSitting; + } + if (sitting) return FALSE; + gAgent.sendAnimationRequest(id, ANIM_REQUEST_START); + return TRUE; + } + } + else + { + if (GetAnimID(id).notNull() && gSavedSettings.getBOOL("AOEnabled")) + { + stopMotion(getCurrentStandId(), FALSE, TRUE); //stop stand first then set state + setAnimationState(GetStateFromAnimID(id)); + +// llinfos << " state " << getAnimationState() << " start anim " << id << " overriding with " << GetAnimID(id) << llendl; + if ((GetStateFromAnimID(id) == STATE_AGENT_SIT) && !(gSavedSettings.getBOOL("AOSitsEnabled"))) return TRUE; + gAgent.sendAnimationRequest(GetAnimID(id), ANIM_REQUEST_START); + return TRUE; + } + } + return FALSE; +} + +BOOL LLFloaterAO::stopMotion(const LLUUID& id, BOOL stop_immediate, BOOL stand) +{ + if (stand) + { + setAnimationState(STATE_AGENT_IDLE); + gAgent.sendAnimationRequest(id, ANIM_REQUEST_STOP); + return TRUE; + } + else + { + if (GetAnimID(id).notNull() && gSavedSettings.getBOOL("AOEnabled")) + { +// llinfos << " state " << getAnimationState() << "/" << GetStateFromAnimID(id) << "(now 0) stop anim " << id << " overriding with " << GetAnimID(id) << llendl; + if (getAnimationState() == GetStateFromAnimID(id)) + { + setAnimationState(STATE_AGENT_IDLE); + } + ChangeStand(); // startMotion(getCurrentStandId(), 0, TRUE); + gAgent.sendAnimationRequest(GetAnimID(id), ANIM_REQUEST_STOP); + return TRUE; + } + } + return FALSE; +} + +void LLFloaterAO::onClickReloadCard(void* user_data) +{ + if(gInventory.isEverythingFetched()) + { + LLFloaterAO::init(); + } +} + +void LLFloaterAO::onClickOpenCard(void* user_data) +{ + if(gInventory.isEverythingFetched()) + { + LLUUID configncitem = (LLUUID)gSavedPerAccountSettings.getString("AOConfigNotecardID"); + if (configncitem.notNull()) + { + const LLInventoryItem* item = gInventory.getItem(configncitem); + if(item) + { + if (gAgent.allowOperation(PERM_COPY, item->getPermissions(),GP_OBJECT_MANIPULATE) || gAgent.isGodlike()) + { + if(!item->getAssetUUID().isNull()) + open_notecard((LLViewerInventoryItem*)item, std::string("Note: ") + item->getName(), LLUUID::null, FALSE); + // open_notecard((LLViewerInventoryItem*)item, std::string("Note: ") + item->getName(), LLUUID::null, FALSE, LLUUID::null, FALSE); + } + } + } + } +} + +void LLFloaterAO::onClickNewCard(void* user_data) +{ + // load the template file from app_settings/ao_template.ini then + // create a new properly-formatted notecard in the user's inventory + std::string ao_template = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "ao_template.ini"); + if (!ao_template.empty()) + { + LLPointer cb = new AONotecardCallback(ao_template); + create_inventory_item(gAgent.getID(), gAgent.getSessionID(), + LLUUID::null, LLTransactionID::tnull, "New AO Notecard", + "Drop this notecard in your AO window to use", LLAssetType::AT_NOTECARD, + LLInventoryType::IT_NOTECARD, NOT_WEARABLE, PERM_ALL, cb); + } + else + { + llwarns << "Can't find ao_template.ini in app_settings!" << llendl; + } +} + +struct AOAssetInfo +{ + std::string path; + std::string name; +}; + +void LLFloaterAO::onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLAssetType::EType type,void* user_data, S32 status, LLExtStat ext_status) +{ + if(status == LL_ERR_NOERR) + { + S32 size = vfs->getSize(asset_uuid, type); + U8* buffer = new U8[size]; + vfs->getData(asset_uuid, type, buffer, 0, size); + + if(type == LLAssetType::AT_NOTECARD) + { + LLViewerTextEditor* edit = new LLViewerTextEditor("",LLRect(0,0,0,0),S32_MAX,""); + if(edit->importBuffer((char*)buffer, (S32)size)) + { + llinfos << "ao nc decode success" << llendl; + std::string card = edit->getText(); + edit->die(); + + if (mcomboBox_stands) + { + mcomboBox_stands->clear(); + mcomboBox_stands->removeall(); + } + if (mcomboBox_walks) mcomboBox_walks->clear(); + if (mcomboBox_runs) mcomboBox_runs->clear(); + if (mcomboBox_jumps) mcomboBox_jumps->clear(); + if (mcomboBox_sits) mcomboBox_sits->clear(); + if (mcomboBox_gsits) mcomboBox_gsits->clear(); + if (mcomboBox_crouchs) mcomboBox_cwalks->clear(); + if (mcomboBox_cwalks) mcomboBox_cwalks->clear(); + if (mcomboBox_falls) mcomboBox_falls->clear(); + if (mcomboBox_hovers) mcomboBox_hovers->clear(); + if (mcomboBox_flys) mcomboBox_flys->clear(); + if (mcomboBox_flyslows) mcomboBox_flyslows->clear(); + if (mcomboBox_flyups) mcomboBox_flyups->clear(); + if (mcomboBox_flydowns) mcomboBox_flydowns->clear(); + if (mcomboBox_lands) mcomboBox_lands->clear(); + if (mcomboBox_standups) mcomboBox_standups->clear(); + if (mcomboBox_prejumps) mcomboBox_prejumps->clear(); + + + struct_stands loader; + + typedef boost::tokenizer > tokenizer; + boost::char_separator sep("\n"); + tokenizer tokline(card, sep); + + for (tokenizer::iterator line = tokline.begin(); line != tokline.end(); ++line) + { +// llinfos << *line << llendl; + std::string strline(*line); +// llinfos << "uncommented line: " << strline << llendl; + + boost::regex type("^(\\s*)(\\[ )(.*)( \\])"); + boost::smatch what; + if (boost::regex_search(strline, what, type)) + { +// llinfos << "type: " << what[0] << llendl; +// llinfos << "anims in type: " << boost::regex_replace(strline, type, "") << llendl; + + boost::char_separator sep("|,"); + std::string stranimnames(boost::regex_replace(strline, type, "")); + tokenizer tokanimnames(stranimnames, sep); + for (tokenizer::iterator anim = tokanimnames.begin(); anim != tokanimnames.end(); ++anim) + { + std::string strtoken(what[0]); + std::string stranim(*anim); + LLUUID animid(getAssetIDByName(stranim)); + +// llinfos << invfolderid.asString().c_str() << llendl; +// llinfos << "anim: " << stranim.c_str() << " assetid: " << animid << llendl; + if (!(animid.notNull())) + { + cmdline_printchat(llformat("Warning: animation '%s' could not be found (Section: %s).",stranim.c_str(),strtoken.c_str())); + } + else + { + switch(GetStateFromToken(strtoken.c_str())) + { + case STATE_AGENT_STAND: + loader.ao_id = animid; loader.anim_name = stranim.c_str(); mAOStands.push_back(loader); + if(mcomboBox_stands != NULL) mcomboBox_stands->add(stranim.c_str(), ADD_BOTTOM, TRUE); + break; + case STATE_AGENT_WALK: + { + if (sInstance && (mcomboBox_walks != NULL)) + { + //llinfos << "1 anim: " << stranim.c_str() << " assetid: " << animid << llendl; + if (!(mcomboBox_walks->selectByValue(stranim.c_str()))) mcomboBox_walks->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } + } + break; + case STATE_AGENT_RUN: + { + if (sInstance && (mcomboBox_runs != NULL)) + { + if (!(mcomboBox_runs->selectByValue(stranim.c_str()))) mcomboBox_runs->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } + } + break; + case STATE_AGENT_JUMP: + { + if (sInstance && (mcomboBox_jumps != NULL)) + { + if (!(mcomboBox_jumps->selectByValue(stranim.c_str()))) mcomboBox_jumps->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } + } + break; + case STATE_AGENT_SIT: + { + if (sInstance && (mcomboBox_sits != NULL)) + { + if (!(mcomboBox_sits->selectByValue(stranim.c_str()))) mcomboBox_sits->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } + } + break; + case STATE_AGENT_GROUNDSIT: + { + if (sInstance && (mcomboBox_gsits != NULL)) + { + if (!(mcomboBox_gsits->selectByValue(stranim.c_str()))) mcomboBox_gsits->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } + } + break; + case STATE_AGENT_CROUCH: + { + if (sInstance && (mcomboBox_crouchs != NULL)) + { + if (!(mcomboBox_crouchs->selectByValue(stranim.c_str()))) mcomboBox_crouchs->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } + } + break; + case STATE_AGENT_CROUCHWALK: + { + if (sInstance && (mcomboBox_cwalks != NULL)) + { + if (!(mcomboBox_cwalks->selectByValue(stranim.c_str()))) mcomboBox_cwalks->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } + } + break; + case STATE_AGENT_FALLDOWN: + { + if (sInstance && (mcomboBox_falls != NULL)) + { + if (!(mcomboBox_falls->selectByValue(stranim.c_str()))) mcomboBox_falls->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } + } + break; + case STATE_AGENT_HOVER: + { + if (sInstance && (mcomboBox_hovers != NULL)) + { + if (!(mcomboBox_hovers->selectByValue(stranim.c_str()))) mcomboBox_hovers->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } + } + break; + case STATE_AGENT_FLY: + { + if (sInstance && (mcomboBox_flys != NULL)) + { + if (!(mcomboBox_flys->selectByValue(stranim.c_str()))) mcomboBox_flys->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } + } + break; + case STATE_AGENT_FLYSLOW: + { + if (sInstance && (mcomboBox_flyslows != NULL)) + { + if (!(mcomboBox_flyslows->selectByValue(stranim.c_str()))) mcomboBox_flyslows->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } + } + break; + case STATE_AGENT_HOVER_UP: + { + if (sInstance && (mcomboBox_flyups != NULL)) + { + if (!(mcomboBox_flyups->selectByValue(stranim.c_str()))) mcomboBox_flyups->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } + } + break; + case STATE_AGENT_HOVER_DOWN: + { + if (sInstance && (mcomboBox_flydowns != NULL)) + { + if (!(mcomboBox_flydowns->selectByValue(stranim.c_str()))) mcomboBox_flydowns->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } + } + break; + case STATE_AGENT_LAND: + { + if (sInstance && (mcomboBox_lands != NULL)) + { + if (!(mcomboBox_lands->selectByValue(stranim.c_str()))) mcomboBox_lands->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } + } + break; + case STATE_AGENT_STANDUP: + { + if (sInstance && (mcomboBox_standups != NULL)) + { + if (!(mcomboBox_standups->selectByValue(stranim.c_str()))) mcomboBox_standups->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } + } + break; + case STATE_AGENT_PRE_JUMP: + { + if (sInstance && (mcomboBox_prejumps != NULL)) + { + if (!(mcomboBox_prejumps->selectByValue(stranim.c_str()))) mcomboBox_prejumps->add(stranim.c_str(), ADD_BOTTOM, TRUE); //check if exist + } + } + break; + } + for (std::vector::iterator iter = mAOOverrides.begin(); iter != mAOOverrides.end(); ++iter) + { + if (GetStateFromToken(strtoken.c_str()) == iter->state) + { + iter->ao_id = animid; + } + } + } + } + } + } + llinfos << "ao nc read sucess" << llendl; + + for (std::vector::iterator iter = mAOOverrides.begin(); iter != mAOOverrides.end(); ++iter) + { + switch(iter->state) + { + + case STATE_AGENT_WALK: + { + std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultWalk"); + SetDefault(mcomboBox_walks,iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + } + break; + case STATE_AGENT_RUN: + { + std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultRun"); + SetDefault(mcomboBox_runs,iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + } + break; + case STATE_AGENT_JUMP: + { + std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultJump"); + SetDefault(mcomboBox_jumps,iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + } + break; + case STATE_AGENT_SIT: + { + std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultSit"); + SetDefault(mcomboBox_sits,iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + } + break; + case STATE_AGENT_CROUCH: + { + std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultCrouch"); + SetDefault(mcomboBox_crouchs,iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + } + break; + case STATE_AGENT_GROUNDSIT: + { + std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultGroundSit"); + SetDefault(mcomboBox_gsits,iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + } + break; + case STATE_AGENT_CROUCHWALK: + { + std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultCrouchWalk"); + SetDefault(mcomboBox_cwalks,iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + } + break; + case STATE_AGENT_FALLDOWN: + { + std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFall"); + SetDefault(mcomboBox_falls,iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + } + break; + case STATE_AGENT_HOVER: + { + std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultHover"); + SetDefault(mcomboBox_hovers,iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + } + break; + case STATE_AGENT_FLY: + { + std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFly"); + SetDefault(mcomboBox_flys,iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + } + break; + case STATE_AGENT_HOVER_UP: + { + std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFlyUp"); + SetDefault(mcomboBox_flyups,iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + } + break; + case STATE_AGENT_FLYSLOW: + { + std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFlySlow"); + SetDefault(mcomboBox_flyslows,iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + } + break; + case STATE_AGENT_HOVER_DOWN: + { + std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultFlyDown"); + SetDefault(mcomboBox_flydowns,iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + } + break; + case STATE_AGENT_LAND: + { + std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultLand"); + SetDefault(mcomboBox_lands,iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + } + break; + case STATE_AGENT_STANDUP: + { + std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultStandUp"); + SetDefault(mcomboBox_standups,iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + } + break; + case STATE_AGENT_PRE_JUMP: + { + std::string defaultanim = gSavedPerAccountSettings.getString("AODefaultPreJump"); + SetDefault(mcomboBox_prejumps,iter->ao_id,defaultanim); + if (getAssetIDByName(defaultanim) != LLUUID::null) iter->ao_id = getAssetIDByName(defaultanim); + } + break; + } + } + run(); + } + else + { + llinfos << "ao nc decode error" << llendl; + } + } + } + else + { + llinfos << "ao nc read error" << llendl; + } +} + +BOOL LLFloaterAO::SetDefault(void* userdata, LLUUID ao_id, std::string defaultanim) +{ + if (sInstance && (userdata)) + { + LLComboBox *box = (LLComboBox *) userdata; + if (LLUUID::null == ao_id) + { + box->clear(); + box->removeall(); + } + else + { + box->selectByValue(defaultanim); + } + } + return TRUE; +} + +class ObjectNameMatches : public LLInventoryCollectFunctor +{ +public: + ObjectNameMatches(std::string name) + { + sName = name; + } + virtual ~ObjectNameMatches() {} + virtual bool operator()(LLInventoryCategory* cat, + LLInventoryItem* item) + { + if(item) + { + if (item->getParentUUID() == LLFloaterAO::invfolderid) + { + return (item->getName() == sName); + } + return false; + } + return false; + } +private: + std::string sName; +}; + +const LLUUID& LLFloaterAO::getAssetIDByName(const std::string& name) +{ + if (name.empty() || !(gInventory.isEverythingFetched())) return LLUUID::null; + + LLViewerInventoryCategory::cat_array_t cats; + LLViewerInventoryItem::item_array_t items; + ObjectNameMatches objectnamematches(name); + gInventory.collectDescendentsIf(LLUUID::null,cats,items,FALSE,objectnamematches); + + if (items.count()) + { + return items[0]->getAssetUUID(); + } + return LLUUID::null; +}; diff --git a/indra/newview/floaterao.h b/indra/newview/floaterao.h new file mode 100644 index 000000000..cf8ee2252 --- /dev/null +++ b/indra/newview/floaterao.h @@ -0,0 +1,131 @@ + +#ifndef LL_LLFLOATERAO_H +#define LL_LLFLOATERAO_H + +#include "llfloater.h" +#include "llviewercontrol.h" +#include "llagent.h" + + +class AONoteCardDropTarget; + +const int STATE_AGENT_IDLE = 0; +const int STATE_AGENT_WALK = 1; +const int STATE_AGENT_RUN = 2; +const int STATE_AGENT_STAND = 3; + +const int STATE_AGENT_PRE_JUMP = 4; +const int STATE_AGENT_JUMP = 5; +const int STATE_AGENT_TURNLEFT = 6; +const int STATE_AGENT_TURNRIGHT = 7; + +const int STATE_AGENT_SIT = 8; +const int STATE_AGENT_GROUNDSIT = 9; + +const int STATE_AGENT_HOVER = 10; +const int STATE_AGENT_HOVER_DOWN = 11; +const int STATE_AGENT_HOVER_UP = 12; + +const int STATE_AGENT_CROUCH = 13; +const int STATE_AGENT_CROUCHWALK = 14; +const int STATE_AGENT_FALLDOWN = 15; +const int STATE_AGENT_STANDUP = 16; +const int STATE_AGENT_LAND = 17; + +const int STATE_AGENT_FLY = 18; +const int STATE_AGENT_FLYSLOW = 19; + + + + + +class AOStandTimer : public LLEventTimer +{ +public: + AOStandTimer(); + ~AOStandTimer(); + virtual BOOL tick(); + virtual void reset(); +}; + +class AOInvTimer : public LLEventTimer +{ +public: + AOInvTimer(); + ~AOInvTimer(); + BOOL tick(); +}; + +class LLFloaterAO : public LLFloater +{ +public: + + LLFloaterAO(); + virtual BOOL postBuild(); + virtual ~LLFloaterAO(); + + static void show(void*); + static void init(); + + static void onClickToggleAO(LLUICtrl *, void*); + static void onClickToggleSits(LLUICtrl *, void*); + static void run(); + static void updateLayout(LLFloaterAO* floater); + + static BOOL loadAnims(); + + static int getAnimationState(); + static void setAnimationState(int state); + static void setStates(const LLUUID& id, BOOL start); + + static LLUUID getCurrentStandId(); + static void setCurrentStandId(const LLUUID& id); + static int stand_iterator; + static BOOL ChangeStand(); + + static BOOL startMotion(const LLUUID& id, F32 time_offset = 0.f, BOOL stand = FALSE); + static BOOL stopMotion(const LLUUID& id, BOOL stop_immediate, BOOL stand = FALSE); + + static LLUUID GetAnimID(const LLUUID& id); + + static int GetStateFromAnimID(const LLUUID& id); + static LLUUID GetAnimIDFromState(const int state); + static int GetStateFromToken(std::string strtoken); + + static void onClickLess(void* data) ; + static void onClickMore(void* data) ; + + static void onClickPrevStand(void* userdata); + static void onClickNextStand(void* userdata); + static void onClickReloadCard(void* userdata); + static void onClickOpenCard(void* userdata); + static void onClickNewCard(void* userdata); + + static LLUUID invfolderid; + static const LLUUID& getAssetIDByName(const std::string& name); + + static bool getInstance(); + +private: + + static LLFloaterAO* sInstance; + static int mAnimationState; + static LLUUID mCurrentStandId; + + static AONoteCardDropTarget* mAOItemDropTarget; + static void AOItemDrop(LLViewerInventoryItem* item); + static void onSpinnerCommit(LLUICtrl* ctrl, void* userdata); + static void onComboBoxCommit(LLUICtrl* ctrl, void* userdata); + static BOOL SetDefault(void *userdata, LLUUID ao_id, std::string defaultanim); + + BOOL mDirty; + +protected: + + static void onNotecardLoadComplete(LLVFS *vfs,const LLUUID& asset_uuid,LLAssetType::EType type,void* user_data, S32 status, LLExtStat ext_status); + +}; + +extern AOInvTimer* gAOInvTimer; + +#endif diff --git a/indra/newview/fonts/DejaVuSansCondensed-Bold.ttf b/indra/newview/fonts/DejaVuSansCondensed-Bold.ttf new file mode 100644 index 000000000..9edd89c3d Binary files /dev/null and b/indra/newview/fonts/DejaVuSansCondensed-Bold.ttf differ diff --git a/indra/newview/fonts/DejaVuSansCondensed.ttf b/indra/newview/fonts/DejaVuSansCondensed.ttf index 988aa1b7b..826e619b7 100644 Binary files a/indra/newview/fonts/DejaVuSansCondensed.ttf and b/indra/newview/fonts/DejaVuSansCondensed.ttf differ diff --git a/indra/newview/fonts/MtBdLfRg.ttf b/indra/newview/fonts/MtBdLfRg.ttf deleted file mode 100644 index 86c344e0e..000000000 Binary files a/indra/newview/fonts/MtBdLfRg.ttf and /dev/null differ diff --git a/indra/newview/fonts/MtBkLfRg.ttf b/indra/newview/fonts/MtBkLfRg.ttf deleted file mode 100644 index 5940d4d42..000000000 Binary files a/indra/newview/fonts/MtBkLfRg.ttf and /dev/null differ diff --git a/indra/newview/fonts/Readme.txt b/indra/newview/fonts/Readme.txt deleted file mode 100644 index 36cb32e1e..000000000 --- a/indra/newview/fonts/Readme.txt +++ /dev/null @@ -1,22 +0,0 @@ -Copyright Information Regarding Fonts, Disclaimer of Warranties - -This license applies to the files named MtBkLfRg.ttf and MtBdLfRg.ttf -in this directory, referred to hereafter as "Meta font software files". - -The Meta font software files contained in this folder are the -copyrighted property of FSI FontShop International ("FSI") and are -licensed by FSI solely for use by Linden Research, Inc. and by -residents or users of Second Life in the Second Life environment, -subject to the Second Life Terms of Service. These Meta font software -files may not be copied by residents or developers of Second Life or -used by them for any other purpose whatsoever. - -FSI and its suppliers make no warranties express or implied relating -to the Meta font software, including without limitation, warranties as -to non-infringement of third party rights, merchantability, or fitness -for any particular purpose. In no event will FSI or its suppliers be -liable to you for any damages, including without limitation, -consequential, incidental or special damages, including any lost -profits or lost savings, even if a FSI representative has been advised -of the possibility of such damages, or for any claim by any third -party. diff --git a/indra/newview/fonts/Ubuntu-B.ttf b/indra/newview/fonts/Ubuntu-B.ttf new file mode 100644 index 000000000..28bae1f12 Binary files /dev/null and b/indra/newview/fonts/Ubuntu-B.ttf differ diff --git a/indra/newview/fonts/Ubuntu-R.ttf b/indra/newview/fonts/Ubuntu-R.ttf new file mode 100644 index 000000000..9388194f1 Binary files /dev/null and b/indra/newview/fonts/Ubuntu-R.ttf differ diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 971964cdb..1e455d9b3 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -67,6 +67,7 @@ #include "llface.h" #include "llfirstuse.h" #include "llfloater.h" +#include "floaterao.h" #include "llfloateractivespeakers.h" #include "llfloateravatarinfo.h" #include "llfloaterbuildoptions.h" @@ -139,9 +140,6 @@ #include "llviewerjoystick.h" #include "llfollowcam.h" -#include "llao.h" -#include "llfollowcam.h" - // [RLVa:KB] - Checked: 2010-09-27 (RLVa-1.1.3b) #include "rlvhandler.h" #include "rlvinventory.h" @@ -4073,6 +4071,7 @@ void LLAgent::changeCameraToMouselook(BOOL animate) if( mCameraMode != CAMERA_MODE_MOUSELOOK ) { gFocusMgr.setKeyboardFocus( NULL ); + if (gSavedSettings.getBOOL("AONoStandsInMouselook")) LLFloaterAO::stopMotion(LLFloaterAO::getCurrentStandId(), FALSE,TRUE); mLastCameraMode = mCameraMode; mCameraMode = CAMERA_MODE_MOUSELOOK; @@ -4995,12 +4994,8 @@ void LLAgent::requestStopMotion( LLMotion* motion ) void LLAgent::onAnimStop(const LLUUID& id) { // handle automatic state transitions (based on completion of animation playback) - if(LLAO::isStand(id)) + if (id == ANIM_AGENT_STAND) { - // - if(LLAO::isEnabled()) - LLAO::mTimer->pause();//Timer only pauses if its not paused, check is inside function. - // stopFidget(); } else if (id == ANIM_AGENT_AWAY) diff --git a/indra/newview/llao.cpp b/indra/newview/llao.cpp deleted file mode 100644 index a14f6cb4a..000000000 --- a/indra/newview/llao.cpp +++ /dev/null @@ -1,574 +0,0 @@ -// -/* DOUBLE EDIT REACH AROUND -Rewritten by Hg Beeks - -*/ - -#include "llviewerprecompiledheaders.h" - -#include "llagent.h" -#include "llanimstatelabels.h" -#include "llao.h" -#include "llfilepicker.h" -#include "llinventorymodel.h" -#include "llscrolllistctrl.h" -#include "llsdserialize.h" -#include "lluictrlfactory.h" -#include "llviewercontrol.h" -#include "llvoavatar.h" -//this is for debugging ;D -//#define AO_DEBUG - -//static variables -std::list LLAO::mStandOverrides; -LLSD LLAO::mAnimationOverrides; -S32 LLAO::mAnimationIndex; -LLUUID LLAO::mLastAnimation; - -std::map LLAO::mOverrides; -LLFloaterAO* LLFloaterAO::sInstance; -BOOL LLAO::mEnabled = FALSE; -F32 LLAO::mPeriod; -LLAOStandTimer* LLAO::mTimer = NULL; - -class ObjectNameMatches : public LLInventoryCollectFunctor -{ -public: - ObjectNameMatches(std::string name) - { - sName = name; - } - virtual ~ObjectNameMatches() {} - virtual bool operator()(LLInventoryCategory* cat, - LLInventoryItem* item) - { - if(item) - { - return (item->getName() == sName); - } - return false; - } -private: - std::string sName; -}; - -const LLUUID& LLAO::getAssetIDByName(const std::string& name) -{ - if (name.empty()) return LLUUID::null; - - LLViewerInventoryCategory::cat_array_t cats; - LLViewerInventoryItem::item_array_t items; - ObjectNameMatches objectnamematches(name); - gInventory.collectDescendentsIf(LLUUID::null,cats,items,FALSE,objectnamematches); - - if (items.count()) - { - return items[0]->getAssetUUID(); - } - return LLUUID::null; -}; - -LLUUID LLAO::getFrontUUID() -{ - if (!LLAO::mStandOverrides.empty()) - return LLUUID(LLAO::getAssetIDByName(LLAO::mStandOverrides.front())); - else - return LLUUID::null; -} - -LLUUID LLAO::getBackUUID() -{ - if (!LLAO::mStandOverrides.empty()) - return LLUUID(LLAO::getAssetIDByName(LLAO::mStandOverrides.back())); - else - return LLUUID::null; -} - -LLAOStandTimer::LLAOStandTimer(F32 period) : LLEventTimer(period) -{ -} -BOOL LLAOStandTimer::tick() -{ - if(!mPaused && LLAO::isEnabled() && !LLAO::mStandOverrides.empty()) - { -#ifdef AO_DEBUG - llinfos << "tick" << llendl; -#endif - LLVOAvatar* avatarp = gAgent.getAvatarObject(); - if (avatarp) - { - for ( LLVOAvatar::AnimIterator anim_it = - avatarp->mPlayingAnimations.begin(); - anim_it != avatarp->mPlayingAnimations.end(); - anim_it++) - { - if(LLAO::isStand(anim_it->first)) - { - //back is always last played, front is next - avatarp->stopMotion(LLAO::getBackUUID()); -#ifdef AO_DEBUG - //llinfos << "Stopping " << LLAO::mStandOverrides.back() << llendl; -#endif - avatarp->startMotion(LLAO::getFrontUUID()); -#ifdef AO_DEBUG - //llinfos << "Starting " << LLAO::mStandOverrides.front() << llendl; -#endif - LLAO::mStandOverrides.push_back(LLAO::mStandOverrides.front()); - LLAO::mStandOverrides.pop_front(); - LLFloaterAO* ao = LLFloaterAO::sInstance; - if(ao) - { - //ao->mStandsCombo->setSimple(LLStringExplicit(LLAO::mStandOverrides.back().asString())); - } - break; - } - } - } - } - return FALSE; -} - -void LLAOStandTimer::pause() -{ - if(mPaused) return; -#ifdef AO_DEBUG - llinfos << "Pausing AO Timer...." << llendl; -#endif - LLVOAvatar* avatarp = gAgent.getAvatarObject(); - if (avatarp) - { -#ifdef AO_DEBUG - //llinfos << "Stopping " << LLAO::mStandOverrides.back() << llendl; -#endif - gAgent.sendAnimationRequest(LLAO::getBackUUID(), ANIM_REQUEST_STOP); - avatarp->stopMotion(LLAO::getBackUUID()); - } - mEventTimer.reset(); - mEventTimer.stop(); - mPaused = TRUE; -} - -void LLAOStandTimer::resume() -{ - if(!mPaused) return; -#ifdef AO_DEBUG - llinfos << "Unpausing AO Timer...." << llendl; -#endif - LLVOAvatar* avatarp = gAgent.getAvatarObject(); - if (avatarp) - { -#ifdef AO_DEBUG - //llinfos << "Starting " << LLAO::mStandOverrides.back() << llendl; -#endif - gAgent.sendAnimationRequest(LLAO::getBackUUID(), ANIM_REQUEST_START); - avatarp->startMotion(LLAO::getBackUUID()); - } - mEventTimer.reset(); - mEventTimer.start(); - mPaused = FALSE; -} - -// Used for sorting -struct SortItemPtrsByName -{ - bool operator()(const LLInventoryItem* i1, const LLInventoryItem* i2) - { - return (LLStringUtil::compareDict(i1->getName(), i2->getName()) < 0); - } -}; - - -void LLAOStandTimer::reset() -{ - mEventTimer.reset(); -} - -//static -void LLAO::setup() -{ - mEnabled = gSavedSettings.getBOOL("AO.Enabled"); - mPeriod = gSavedSettings.getF32("AO.Period"); - mTimer = new LLAOStandTimer(mPeriod); - mAnimationIndex = 0; - mLastAnimation = LLUUID::null; - gSavedSettings.getControl("AO.Enabled")->getSignal()->connect(boost::bind(&handleAOEnabledChanged, _1)); - gSavedSettings.getControl("AO.Period")->getSignal()->connect(boost::bind(&handleAOPeriodChanged, _1)); -} -//static -void LLAO::runAnims(BOOL enabled) -{ - LLVOAvatar* avatarp = gAgent.getAvatarObject(); - if (avatarp) - { - for ( LLVOAvatar::AnimIterator anim_it = - avatarp->mPlayingAnimations.begin(); - anim_it != avatarp->mPlayingAnimations.end(); - anim_it++) - { - if(LLAO::mOverrides.find(anim_it->first) != LLAO::mOverrides.end()) - { - LLUUID anim_id = mOverrides[anim_it->first]; - // this is an override anim - if(enabled) - { - // make override start - avatarp->startMotion(anim_id); - } - else - { - avatarp->stopMotion(anim_id); - gAgent.sendAnimationRequest(anim_id, ANIM_REQUEST_STOP); - } - } - } - if(mTimer) - { - if(enabled) - mTimer->resume(); - else - mTimer->pause(); - } - } -} -//static -bool LLAO::handleAOPeriodChanged(const LLSD& newvalue) -{ - F32 value = (F32)newvalue.asReal(); - mPeriod = value; - return true; -} -//static -bool LLAO::handleAOEnabledChanged(const LLSD& newvalue) -{ - BOOL value = newvalue.asBoolean(); - mEnabled = value; - runAnims(value); - return true; -} -//static -BOOL LLAO::isStand(LLUUID _id) -{ - std::string id = _id.asString(); - //ALL KNOWN STANDS - if(id == "2408fe9e-df1d-1d7d-f4ff-1384fa7b350f") return TRUE; - if(id == "15468e00-3400-bb66-cecc-646d7c14458e") return TRUE; - if(id == "370f3a20-6ca6-9971-848c-9a01bc42ae3c") return TRUE; - if(id == "42b46214-4b44-79ae-deb8-0df61424ff4b") return TRUE; - if(id == "f22fed8b-a5ed-2c93-64d5-bdd8b93c889f") return TRUE; - return FALSE; -} - -BOOL LLAO::isVoice(LLUUID _id) -{ - std::string id = _id.asString(); - //ALL KNOWN VOICE ANIMS - if(id == "3557510a-5eb4-d0ce-0b91-67c72aa75312") return TRUE; - if(id == "a71890f1-0dab-8744-fd47-7defaf411dbf") return TRUE; - if(id == "c1802201-5f4e-366f-7f78-2d08ec6ea54a") return TRUE; - if(id == "68db359f-4c9c-0932-5f1e-e95e3a0b19bc") return TRUE; - if(id == "7ef0d5c0-3346-06e4-5cfc-f081db108baa") return TRUE; - if(id == "28a3f544-268d-da71-7da6-82c8dd522cb9") return TRUE; - if(id == "cc340155-3e9d-60fe-d8e3-9e9abc7062d1") return TRUE; - if(id == "55fe6788-8a16-d998-2f63-3c1eab2b6009") return TRUE; - if(id == "69d5a8ed-9ec6-6dac-842f-d92d82e69428") return TRUE; - if(id == "9a7f3201-7bbd-4f75-b762-24270536e4e3") return TRUE; - if(id == "37694185-3107-d418-3a20-0181424e542d") return TRUE; - if(id == "cb1139b6-e7c3-fdc7-a9c1-e21673d7a50e") return TRUE; - if(id == "bbf194d1-a118-1312-998b-8145cec6eaff") return TRUE; - if(id == "593e9a3d-58d8-c594-d6dd-f4b98965202e") return TRUE; - if(id == "2b78c24a-2451-6135-fc49-ad274552bb68") return TRUE; - if(id == "0f645c60-3151-2805-b6f7-28e710ed22ac") return TRUE; - return FALSE; -} - -//static -void LLAO::refresh() -{ - mOverrides.clear(); - mAnimationOverrides.clear(); - LLSD settings = gSavedPerAccountSettings.getLLSD("AO.Settings"); - //S32 version = (S32)settings["version"].asInteger(); - mAnimationOverrides = settings["overrides"]; - llinfos << "Stand count: " << mAnimationOverrides["Stands"].size() << llendl; -} - -//static ------------- Floater -void LLFloaterAO::show() -{ - if(sInstance) - sInstance->open(); - else - (new LLFloaterAO())->open(); -} - -LLFloaterAO::LLFloaterAO() -: LLFloater() -{ - sInstance = this; - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_ao.xml"); -} - -LLFloaterAO::~LLFloaterAO() -{ - sInstance = NULL; -} - -BOOL LLFloaterAO::postBuild(void) -{ - LLComboBox* combo; - LLScrollListCtrl* list; - - childSetAction("btn_save", onClickSave, this); - childSetAction("btn_load", onClickLoad, this); - - combo = getChild( "combo_anim_type"); - combo->setCommitCallback(onCommitType); - combo->setCallbackUserData(this); - combo->selectFirstItem(); - mAnimTypeCombo = combo; - mCurrentAnimType = mAnimTypeCombo->getValue().asString(); - - combo = getChild( "combo_anim_list"); - mAnimListCombo = combo; - childSetAction("combo_anim_add", onClickAnimAdd, this); - childSetAction("combo_anim_delete", onClickAnimRemove, this); - - list = getChild("active_anim_list"); - mAnimationList = list; - - addAnimations(); - - refresh(); - - return TRUE; -} - -void LLFloaterAO::refresh() -{ - mAnimationList->deleteAllItems(); - S32 count = LLAO::mAnimationOverrides[mCurrentAnimType].size(); - llinfos << "Refreshed, building animation list for " << mCurrentAnimType << ", Count:" << count << llendl; - int i; - for(i = 0; i < count; i++) - { - std::string name = LLAO::mAnimationOverrides[mCurrentAnimType][i].asString(); - llinfos << "Adding " << name << llendl; - mAnimationList->addSimpleElement(name, ADD_BOTTOM); - } -} -// static -void LLFloaterAO::onCommitType(LLUICtrl* ctrl, void* user_data) -{ - LLFloaterAO* floater = (LLFloaterAO*)user_data; - floater->mCurrentAnimType = floater->mAnimTypeCombo->getValue().asString(); - floater->refresh(); -} - -void LLFloaterAO::addAnimations() -{ - mAnimListCombo->removeall(); - - std::string none_text = getString("none_text"); - mAnimListCombo->add(none_text, LLUUID::null); - - S32 i; - // Get all inventory items that are animations - LLViewerInventoryCategory::cat_array_t cats; - LLViewerInventoryItem::item_array_t items; - LLIsTypeWithPermissions is_copyable_animation(LLAssetType::AT_ANIMATION, - PERM_NONE, - gAgent.getID(), - gAgent.getGroupID()); - gInventory.collectDescendentsIf(gAgent.getInventoryRootID(), - cats, - items, - LLInventoryModel::EXCLUDE_TRASH, - is_copyable_animation); - - // Copy into something we can sort - std::vector animations; - - S32 count = items.count(); - for(i = 0; i < count; ++i) - { - animations.push_back( items.get(i) ); - } - - // Do the sort - std::sort(animations.begin(), animations.end(), SortItemPtrsByName()); - - // And load up the combobox - std::vector::iterator it; - for (it = animations.begin(); it != animations.end(); ++it) - { - LLInventoryItem* item = *it; - mAnimListCombo->add(item->getName(), item->getAssetUUID(), ADD_BOTTOM); - } -} - -// static -void LLFloaterAO::onCommitAnim(LLUICtrl* ctrl, void* user_data) -{ - LLFloaterAO* floater = (LLFloaterAO*)user_data; - LLSD settings; - settings["version"] = 2; - settings["overrides"] = LLAO::mAnimationOverrides; - gSavedPerAccountSettings.setLLSD("AO.Settings", settings); - LLAO::refresh(); - floater->refresh(); -} - - -//static -void LLFloaterAO::onClickAnimRemove(void* user_data) -{ - LLFloaterAO* floater = (LLFloaterAO*)user_data; - std::vector items = floater->mAnimationList->getAllSelected(); - for (std::vector::iterator iter = items.begin(); iter != items.end(); ++iter) - { - LLScrollListItem* item = *iter; - if (item->getValue().asString() != "") - { - std::string anim_name = item->getValue().asString(); - S32 count = LLAO::mAnimationOverrides[floater->mCurrentAnimType].size(); - S32 index; - LLSD new_list; - for (index = 0; index < count; index++) - { - if (LLAO::mAnimationOverrides[floater->mCurrentAnimType][index].isDefined()) - { - std::string this_anim = LLAO::mAnimationOverrides[floater->mCurrentAnimType][index].asString(); - if (this_anim != anim_name) - { - new_list.append(this_anim); - } - } - } - LLAO::mAnimationOverrides[floater->mCurrentAnimType] = new_list; - } - } - onCommitAnim(NULL,user_data); -} -//static -void LLFloaterAO::onClickAnimAdd(void* user_data) -{ - LLFloaterAO* floater = (LLFloaterAO*)user_data; - std::string anim_name = floater->mAnimListCombo->getSimple(); - if (anim_name == "") - return; - LLUUID id(LLAO::getAssetIDByName(anim_name)); -#ifdef AO_DEBUG - llinfos << "Attempting to add " << anim_name << " (" << id << ") " << " to " << floater->mCurrentAnimType << llendl; -#endif - if(id.notNull() && !LLAO::mAnimationOverrides[floater->mCurrentAnimType].has(anim_name)) - { -#ifdef AO_DEBUG - llinfos << "Actually adding animation, this should be refreshed. Count:" << LLAO::mAnimationOverrides[floater->mCurrentAnimType].size() << llendl; -#endif - LLAO::mAnimationOverrides[floater->mCurrentAnimType].append(anim_name); -#ifdef AO_DEBUG - llinfos << "Added animation. Count:" << LLAO::mAnimationOverrides[floater->mCurrentAnimType].size() << llendl; -#endif - LLAO::mTimer->reset(); - } - onCommitAnim(NULL,user_data); -} - -BOOL LLFloaterAO::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, - EDragAndDropType cargo_type, - void* cargo_data, - EAcceptance* accept, - std::string& tooltip_msg) -{ - BOOL handled = TRUE; - switch(cargo_type) - { - case DAD_ANIMATION: - { - LLInventoryItem* item = (LLInventoryItem*)cargo_data; - if (item - && gInventory.getItem(item->getUUID())) - { - if (drop) - { - if (cargo_type == DAD_ANIMATION) - { - std::string anim_name = item->getName(); - if (anim_name == "") - return true; - LLUUID id(LLAO::getAssetIDByName(anim_name)); -#ifdef AO_DEBUG - llinfos << "Actually adding animation, this should be refreshed. Count:" << LLAO::mAnimationOverrides[mCurrentAnimType].size() << llendl; -#endif - LLAO::mAnimationOverrides[mCurrentAnimType].append(anim_name); -#ifdef AO_DEBUG - llinfos << "Added animation. Count:" << LLAO::mAnimationOverrides[mCurrentAnimType].size() << llendl; -#endif - LLAO::mTimer->reset(); - onCommitAnim(NULL,this); - } - refresh(); - } - *accept = ACCEPT_YES_COPY_MULTI; - } - else - { - // Not in user's inventory means it was in object inventory - *accept = ACCEPT_NO; - } - break; - } - default: - *accept = ACCEPT_NO; - if (tooltip_msg.empty()) - { - tooltip_msg.assign("Only animations can be added to the AO."); - } - break; - } - return handled; -} - - -//static -void LLFloaterAO::onClickSave(void* user_data) -{ - LLFilePicker& file_picker = LLFilePicker::instance(); - if(file_picker.getSaveFile( LLFilePicker::FFSAVE_AO, LLDir::getScrubbedFileName("untitled.ao"))) - { - std::string file_name = file_picker.getFirstFile(); - llofstream export_file(file_name); - LLSDSerialize::toPrettyXML(gSavedPerAccountSettings.getLLSD("AO.Settings"), export_file); - export_file.close(); - } -} - -//static -void LLFloaterAO::onClickLoad(void* user_data) -{ - LLFloaterAO* floater = (LLFloaterAO*)user_data; - - LLFilePicker& file_picker = LLFilePicker::instance(); - if(file_picker.getOpenFile(LLFilePicker::FFLOAD_AO)) - { - std::string file_name = file_picker.getFirstFile(); - llifstream xml_file(file_name); - if(!xml_file.is_open()) return; - LLSD data; - if(LLSDSerialize::fromXML(data, xml_file) >= 1) - { - if(LLAO::isEnabled()) - LLAO::runAnims(FALSE); - - gSavedPerAccountSettings.setLLSD("AO.Settings", data); - LLAO::refresh(); - - if(LLAO::isEnabled()) - LLAO::runAnims(TRUE); - - floater->refresh(); - } - xml_file.close(); - } -} -// \ No newline at end of file diff --git a/indra/newview/llao.h b/indra/newview/llao.h deleted file mode 100644 index a54d71543..000000000 --- a/indra/newview/llao.h +++ /dev/null @@ -1,89 +0,0 @@ -// -#ifndef LL_LLAO_H -#define LL_LLAO_H - -//this is for debugging ;D -//#define AO_DEBUG - -#include "llfloater.h" -#include "llcombobox.h" - -class LLAOStandTimer : public LLEventTimer -{ -public: - LLAOStandTimer(F32 period); - BOOL tick(); - void pause(); - void resume(); - void reset(); - -private: - BOOL mPaused; -}; - -class LLAO -{ -public: - static void setup(); - static std::map mOverrides; - static std::list mStandOverrides; - //Animation LLSD for full animation options -HgB - static LLSD mAnimationOverrides; - static S32 mAnimationIndex; - static LLUUID mLastAnimation; - static BOOL isEnabled(){ return mEnabled; } - static BOOL isStand(LLUUID _id); - static BOOL isVoice(LLUUID _id); - static void refresh(); - static void runAnims(BOOL enabled); - static bool handleAOEnabledChanged(const LLSD& newvalue); - static bool handleAOPeriodChanged(const LLSD& newvalue); - static const LLUUID& getAssetIDByName(const std::string& name); - static LLUUID getFrontUUID(); - static LLUUID getBackUUID(); - static LLAOStandTimer* mTimer; - - //Horribly hacked-up stuff from llpreviewgesture.h, try to fix in the near future. -HgB - /*virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, - EDragAndDropType cargo_type, - void* cargo_data, - EAcceptance* accept, - std::string& tooltip_msg);*/ - -private: - static BOOL mEnabled; - static F32 mPeriod; -}; - -class LLFloaterAO : public LLFloater -{ -public: - static LLFloaterAO* sInstance; - static void show(); - LLFloaterAO(); - void addAnimations(); - BOOL postBuild(void); - void refresh(); - static void onCommitAnim(LLUICtrl* ctrl, void* user_data); - static void onCommitType(LLUICtrl* ctrl,void* user_data); - static void onClickAnimRemove(void* user_data); - static void onClickAnimAdd(void* user_data); - static void onClickSave(void* user_data); - static void onClickLoad(void* user_data); - virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, - EDragAndDropType cargo_type, - void* cargo_data, - EAcceptance* accept, - std::string& tooltip_msg); -private: - LLComboBox* mAnimListCombo; - LLComboBox* mAnimTypeCombo; - LLScrollListCtrl* mAnimationList; - std::string mCurrentAnimType; - virtual ~LLFloaterAO(); -protected: - static void onCommitAnimation(LLUICtrl* ctrl, void* data); -}; - -#endif -// diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 8ebb51e26..a3742afe1 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -99,7 +99,6 @@ #include "llimageworker.h" // -#include "llao.h" //for setting up listener #include "lldelayeduidelete.h" #include "llbuildnewviewsscheduler.h" // @@ -160,6 +159,7 @@ #include "llvosurfacepatch.h" // includes for idle() idleShutdown() +#include "floaterao.h" #include "llviewercontrol.h" #include "lleventnotifier.h" #include "llcallbacklist.h" @@ -678,10 +678,6 @@ bool LLAppViewer::init() settings_to_globals(); // Setup settings listeners settings_setup_listeners(); - // - // Setup AO settings listener - LLAO::setup(); - // // Modify settings based on system configuration and compile options settings_modify(); @@ -1757,6 +1753,7 @@ bool LLAppViewer::initConfiguration() LLFirstUse::addConfigVariable("FirstTeleport"); LLFirstUse::addConfigVariable("FirstOverrideKeys"); LLFirstUse::addConfigVariable("FirstAttach"); + LLFirstUse::addConfigVariable("FirstAO"); LLFirstUse::addConfigVariable("FirstAppearance"); LLFirstUse::addConfigVariable("FirstInventory"); LLFirstUse::addConfigVariable("FirstSandbox"); diff --git a/indra/newview/llfirstuse.cpp b/indra/newview/llfirstuse.cpp index a0e43b404..4c7cedf9b 100644 --- a/indra/newview/llfirstuse.cpp +++ b/indra/newview/llfirstuse.cpp @@ -203,6 +203,17 @@ void LLFirstUse::useAttach() // nothing for now } +// static +void LLFirstUse::useAO() +{ + if (gSavedSettings.getWarning("FirstAO")) + { + gSavedSettings.setWarning("FirstAO", FALSE); + + LLNotifications::instance().add("FirstAO"); + } +} + // static void LLFirstUse::useAppearance() { diff --git a/indra/newview/llfirstuse.h b/indra/newview/llfirstuse.h index d688959d6..bb05d8df8 100644 --- a/indra/newview/llfirstuse.h +++ b/indra/newview/llfirstuse.h @@ -103,6 +103,7 @@ public: static void useTeleport(); static void useOverrideKeys(); static void useAttach(); + static void useAO(); static void useAppearance(); static void useInventory(); static void useSandbox(); diff --git a/indra/newview/lloverlaybar.cpp b/indra/newview/lloverlaybar.cpp index cf517b0bf..badeed15f 100644 --- a/indra/newview/lloverlaybar.cpp +++ b/indra/newview/lloverlaybar.cpp @@ -37,6 +37,7 @@ #include "lloverlaybar.h" +#include "aoremotectrl.h" #include "llaudioengine.h" #include "importtracker.h" #include "llrender.h" @@ -116,6 +117,13 @@ void* LLOverlayBar::createAdvSettings(void* userdata) return self->mAdvSettings; } +void* LLOverlayBar::createAORemote(void* userdata) +{ + LLOverlayBar *self = (LLOverlayBar*)userdata; + self->mAORemote = new AORemoteCtrl(); + return self->mAORemote; +} + void* LLOverlayBar::createChatBar(void* userdata) { gChatBar = new LLChatBar(); @@ -126,6 +134,7 @@ LLOverlayBar::LLOverlayBar() : LLPanel(), mMediaRemote(NULL), mVoiceRemote(NULL), + mAORemote(NULL), mMusicState(STOPPED), mOriginalIMLabel("") { @@ -138,6 +147,7 @@ LLOverlayBar::LLOverlayBar() factory_map["media_remote"] = LLCallbackMap(LLOverlayBar::createMediaRemote, this); factory_map["voice_remote"] = LLCallbackMap(LLOverlayBar::createVoiceRemote, this); factory_map["Adv_Settings"] = LLCallbackMap(LLOverlayBar::createAdvSettings, this); + factory_map["ao_remote"] = LLCallbackMap(LLOverlayBar::createAORemote, this); factory_map["chat_bar"] = LLCallbackMap(LLOverlayBar::createChatBar, this); LLUICtrlFactory::getInstance()->buildPanel(this, "panel_overlaybar.xml", &factory_map); @@ -157,6 +167,13 @@ bool updateChatVisible(const LLSD &data) return true; } +bool updateAORemote(const LLSD &data) +{ + gOverlayBar->childSetVisible("ao_remote_container", gSavedSettings.getBOOL("EnableAORemote")); + return true; +} + + BOOL LLOverlayBar::postBuild() { childSetAction("New IM",onClickIMReceived,this); @@ -180,8 +197,10 @@ BOOL LLOverlayBar::postBuild() gSavedSettings.getControl("wlfAdvSettingsPopup")->getSignal()->connect(&updateAdvSettingsPopup); gSavedSettings.getControl("ChatVisible")->getSignal()->connect(&updateChatVisible); + gSavedSettings.getControl("EnableAORemote")->getSignal()->connect(&updateAORemote); childSetVisible("AdvSettings_container", !sAdvSettingsPopup); childSetVisible("AdvSettings_container_exp", sAdvSettingsPopup); + childSetVisible("ao_remote_container", gSavedSettings.getBOOL("EnableAORemote")); return TRUE; } @@ -345,6 +364,7 @@ void LLOverlayBar::refresh() buttons_changed = TRUE; } + moveChildToBackOfTabGroup(mAORemote); moveChildToBackOfTabGroup(mMediaRemote); moveChildToBackOfTabGroup(mVoiceRemote); @@ -362,6 +382,7 @@ void LLOverlayBar::refresh() childSetVisible("voice_remote_container", FALSE); childSetVisible("AdvSettings_container", FALSE); childSetVisible("AdvSettings_container_exp", FALSE); + childSetVisible("ao_remote_container", FALSE); childSetVisible("state_buttons", FALSE); } else @@ -371,6 +392,7 @@ void LLOverlayBar::refresh() childSetVisible("voice_remote_container", LLVoiceClient::voiceEnabled()); childSetVisible("AdvSettings_container", !sAdvSettingsPopup);//!gSavedSettings.getBOOL("wlfAdvSettingsPopup")); childSetVisible("AdvSettings_container_exp", sAdvSettingsPopup);//gSavedSettings.getBOOL("wlfAdvSettingsPopup")); + childSetVisible("ao_remote_container", gSavedSettings.getBOOL("EnableAORemote")); childSetVisible("state_buttons", TRUE); } } diff --git a/indra/newview/lloverlaybar.h b/indra/newview/lloverlaybar.h index 4822ce046..53c0a8f9f 100644 --- a/indra/newview/lloverlaybar.h +++ b/indra/newview/lloverlaybar.h @@ -51,6 +51,7 @@ class LLStatGraph; class LLSlider; class LLVoiceRemoteCtrl; class wlfPanel_AdvSettings; +class AORemoteCtrl; class LLOverlayBar : public LLPanel @@ -94,6 +95,7 @@ protected: static void* createMediaRemote(void* userdata); static void* createVoiceRemote(void* userdata); static void* createAdvSettings(void* userdata); + static void* createAORemote(void* userdata); static void* createChatBar(void* userdata); void enableMediaButtons(); @@ -103,6 +105,7 @@ protected: LLVoiceRemoteCtrl* mVoiceRemote; LLButton* mCancelBtn; wlfPanel_AdvSettings* mAdvSettings; + AORemoteCtrl* mAORemote; bool mBuilt; // dialog constructed yet? enum { STOPPED=0, PLAYING=1, PAUSED=2 }; S32 mMusicState; diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp index b97a2e09b..c2c3e8869 100644 --- a/indra/newview/llpreviewnotecard.cpp +++ b/indra/newview/llpreviewnotecard.cpp @@ -767,4 +767,9 @@ LLUUID LLPreviewNotecard::getItemID() } // +LLTextEditor* LLPreviewNotecard::getEditor() +{ + return getChild("Notecard Editor"); +} + // EOF diff --git a/indra/newview/llpreviewnotecard.h b/indra/newview/llpreviewnotecard.h index 0342bdc83..c3bf0e2f9 100644 --- a/indra/newview/llpreviewnotecard.h +++ b/indra/newview/llpreviewnotecard.h @@ -43,6 +43,7 @@ // This class allows us to edit notecards //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +class LLTextEditor; class LLViewerTextEditor; class LLButton; @@ -84,16 +85,18 @@ public: // asset system. :( void refreshFromInventory(); - // - LLUUID getNotecardItemID(); - LLUUID getObjectID(); - virtual LLUUID getItemID(); + // + LLUUID getNotecardItemID(); + LLUUID getObjectID(); + virtual LLUUID getItemID(); // -protected: - virtual void loadAsset(); + LLTextEditor* getEditor(); bool saveIfNeeded(LLInventoryItem* copyitem = NULL); +protected: + virtual void loadAsset(); + static LLPreviewNotecard* getInstance(const LLUUID& uuid); static void onLoadComplete(LLVFS *vfs, @@ -102,7 +105,7 @@ protected: void* user_data, S32 status, LLExtStat ext_status); static void onClickSave(void* data); - // + // static void onClickGetItems(void* data); static void onSaveComplete(const LLUUID& asset_uuid, @@ -122,9 +125,9 @@ protected: LLUUID mNotecardItemID; LLUUID mObjectID; - // - virtual BOOL canSaveAs() const; - virtual void saveAs(); + // + virtual BOOL canSaveAs() const; + virtual void saveAs(); // }; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 1c3c2c634..b67178de1 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -53,6 +53,7 @@ #include "hippogridmanager.h" #include "hippolimits.h" +#include "floaterao.h" #include "llares.h" #include "llcachename.h" @@ -203,7 +204,6 @@ //#include "llactivation.h" #include "wlfPanel_AdvSettings.h" //Lower right Windlight and Rendering options #include "ascentdaycyclemanager.h" -#include "llao.h" #include "llfloaterblacklist.h" #include "scriptcounter.h" // @@ -984,9 +984,6 @@ bool idle_startup() // Overwrite default user settings with user settings LLAppViewer::instance()->loadSettingsFromDirectory("Account"); - //User settings are loaded, get the AO settings - HgB - LLAO::refresh(); - // Need to set the LastLogoff time here if we don't have one. LastLogoff is used for "Recent Items" calculation // and startup time is close enough if we don't have a real value. if (gSavedPerAccountSettings.getU32("LastLogoff") == 0) @@ -2861,6 +2858,12 @@ bool idle_startup() gFloaterWorldMap->observeFriends(); } + // Start the AO now that settings have loaded and login successful -- MC + if (!gAOInvTimer) + { + gAOInvTimer = new AOInvTimer(); + } + gViewerWindow->showCursor(); gViewerWindow->getWindow()->resetBusyCount(); gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 7e8810d90..8729d5714 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -244,7 +244,6 @@ #include "dofloaterhex.h" #include "hgfloatertexteditor.h" #include "llfloatermessagelog.h" -#include "llao.h" #include "llfloatervfs.h" #include "llfloatervfsexplorer.h" // @@ -252,6 +251,7 @@ #include "scriptcounter.h" #include "llfloaterdisplayname.h" #include "llavatarnamecache.h" +#include "floaterao.h" #include "hippogridmanager.h" @@ -426,13 +426,46 @@ void handle_leave_god_mode(void*); // void handle_fake_away_status(void*); void handle_area_search(void*); -void handle_pose_stand_ltao(void*); -void handle_pose_stand_ltah(void*); -void handle_pose_stand_ltad(void*); -void handle_pose_stand_loau(void*); -void handle_pose_stand_loao(void*); -void handle_pose_stand_lhao(void*); -void handle_pose_stand_stop(void*); + +// for pose stand +LLUUID current_pose = LLUUID::null; + +void set_current_pose(std::string anim) +{ + if (current_pose == LLUUID::null) + gSavedSettings.setF32("AscentAvatarZModifier", gSavedSettings.getF32("AscentAvatarZModifier") + 7.5); + + gAgent.sendAgentSetAppearance(); + gAgent.sendAnimationRequest(current_pose, ANIM_REQUEST_STOP); + current_pose.set(anim); + gAgent.sendAnimationRequest(current_pose, ANIM_REQUEST_START); +} +void handle_pose_stand(void*) +{ + set_current_pose("038fcec9-5ebd-8a8e-0e2e-6e71a0a1ac53"); +} +void handle_pose_stand_stop(void*) +{ + if (current_pose != LLUUID::null) + { + gSavedSettings.setF32("AscentAvatarZModifier", gSavedSettings.getF32("AscentAvatarZModifier") - 7.5); + gAgent.sendAgentSetAppearance(); + gAgent.sendAnimationRequest(current_pose, ANIM_REQUEST_STOP); + current_pose = LLUUID::null; + } +} + +void handle_toggle_pose(void* userdata) { + if(current_pose.isNull()) + handle_pose_stand(userdata); + else + handle_pose_stand_stop(userdata); +} + +BOOL handle_check_pose(void* userdata) { + return current_pose.notNull(); +} + void handle_force_ground_sit(void*); void handle_phantom_avatar(void*); @@ -570,9 +603,6 @@ BOOL enable_region_owner(void*); void menu_toggle_attached_lights(void* user_data); void menu_toggle_attached_particles(void* user_data); -// for pose stand -LLUUID current_pose = LLUUID::null; - class LLMenuParcelObserver : public LLParcelObserver { public: @@ -769,12 +799,7 @@ void init_menus() menu->append(new LLMenuItemCallGL( "Force Ground Sit", &handle_force_ground_sit, NULL)); menu->append(new LLMenuItemCallGL( "Phantom Avatar", &handle_phantom_avatar, NULL)); menu->appendSeparator(); - menu->append(new LLMenuItemCheckGL( "Enable AO", - &menu_toggle_control, - NULL, - &menu_check_control, - (void*)"AO.Enabled")); - menu->append(new LLMenuItemCallGL( "Edit AO...", + menu->append(new LLMenuItemCallGL( "Animation Override...", &handle_edit_ao, NULL)); menu->append(new LLMenuItemCheckGL( "Nimble", &menu_toggle_control, @@ -799,7 +824,7 @@ void init_menus() // // Add in the pose stand ------------------------------------------- - LLMenuGL* sub = new LLMenuGL("Pose Stand..."); + /*LLMenuGL* sub = new LLMenuGL("Pose Stand..."); menu->appendMenu(sub); sub->append(new LLMenuItemCallGL( "Legs Together Arms Out", &handle_pose_stand_ltao, NULL)); @@ -809,7 +834,9 @@ void init_menus() sub->append(new LLMenuItemCallGL( "Legs Out Arms Out", &handle_pose_stand_loao, NULL)); sub->append(new LLMenuItemCallGL( "Legs Half Arms Out", &handle_pose_stand_lhao, NULL)); sub->append(new LLMenuItemCallGL( "Stop Pose Stand", &handle_pose_stand_stop, NULL)); - // ------------------------------------------------------ + // ------------------------------------------------------*/ + + menu->append(new LLMenuItemCheckGL("Pose Stand",&handle_toggle_pose, NULL, &handle_check_pose, NULL)); //these should always be last in a sub menu menu->createJumpKeys(); @@ -840,6 +867,7 @@ void init_menus() LLRect menuBarRect = gLoginMenuBarView->getRect(); menu = new LLMenuGL(CLIENT_MENU_NAME); + menu->setCanTearOff(FALSE); menu->append(new LLMenuItemCallGL("Debug Settings...", LLFloaterSettingsDebug::show, NULL, NULL)); gLoginMenuBarView->appendMenu(menu); menu->updateParent(LLMenuGL::sMenuContainer); @@ -3620,7 +3648,7 @@ void handle_open_message_log(void*) void handle_edit_ao(void*) { - LLFloaterAO::show(); + LLFloaterAO::show(NULL); } void handle_local_assets(void*) @@ -3654,56 +3682,6 @@ void handle_close_all_notifications(void*) } } -// -// The following animations were made by Charley Levenque and are -// not public property or free to use via UUID. When replicating -// this code, please supply your own animations. - -void set_current_pose(std::string anim) -{ - if (current_pose == LLUUID::null) - gSavedSettings.setF32("AscentAvatarZModifier", gSavedSettings.getF32("AscentAvatarZModifier") + 7.5); - - gAgent.sendAgentSetAppearance(); - gAgent.sendAnimationRequest(current_pose, ANIM_REQUEST_STOP); - current_pose.set(anim); - gAgent.sendAnimationRequest(current_pose, ANIM_REQUEST_START); -} -void handle_pose_stand_ltao(void*) -{ - set_current_pose("6c082c7b-f70e-9da0-0451-54793f869ff4"); -} -void handle_pose_stand_ltah(void*) -{ - set_current_pose("45e59c14-913b-c58c-2a55-c0a5c1eeef53"); -} -void handle_pose_stand_ltad(void*) -{ - set_current_pose("421d6bb4-94a9-3c42-4593-f2bc1f6a26e6"); -} -void handle_pose_stand_loau(void*) -{ - set_current_pose("8b3bb239-d610-1c0f-4d1a-69d29bc17e2c"); -} -void handle_pose_stand_loao(void*) -{ - set_current_pose("4d70e328-48b6-dc6a-0be1-85dd6b333e81"); -} -void handle_pose_stand_lhao(void*) -{ - set_current_pose("f088eaf0-f1c9-8cf1-99c8-09df96bb13ae"); -} -void handle_pose_stand_stop(void*) -{ - if (current_pose != LLUUID::null) - { - gSavedSettings.setF32("AscentAvatarZModifier", gSavedSettings.getF32("AscentAvatarZModifier") - 7.5); - gAgent.sendAgentSetAppearance(); - gAgent.sendAnimationRequest(current_pose, ANIM_REQUEST_STOP); - current_pose = LLUUID::null; - } -} -// --------------------------------------------------- void handle_area_search(void*) { JCFloaterAreaSearch::toggle(); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 696a225aa..dc8d1bf12 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -93,10 +93,10 @@ #include "llsdserialize.h" //For the client definitions #include "llcachename.h" +#include "floaterao.h" // #include "llfloaterexploreanimations.h" -#include "llao.h" #include "llimagemetadatareader.h" // @@ -2727,10 +2727,6 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) // trigger fidget anims if (isAnyAnimationSignaled(AGENT_STAND_ANIMS, NUM_AGENT_STAND_ANIMS)) { - // - if(LLAO::isEnabled()) - LLAO::mTimer->resume();//Timer only pauses if its not paused, check is inside function. - // agent.fidget(); } } @@ -3333,8 +3329,9 @@ void LLVOAvatar::idleUpdateWindEffect() bool LLVOAvatar::updateClientTags() { - std::string client_list_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "client_definitions.xml"); - LLSD response = LLHTTPClient::blockingGet("http://46.4.144.79/client_definitions.xml"); + std::string client_list_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "client_tags_sg1.xml"); + std::string client_list_url = gSavedSettings.getString("ClientDefinitionsURL"); + LLSD response = LLHTTPClient::blockingGet(client_list_url); if(response.has("body")) { const LLSD &client_list = response["body"]; @@ -3354,11 +3351,11 @@ bool LLVOAvatar::updateClientTags() bool LLVOAvatar::loadClientTags() { //Changed the file name to keep Emerald from overwriting it. Hokey stuff in there, and it's missing clients. -HGB - std::string client_list_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "client_definitions.xml"); + std::string client_list_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "client_tags_sg1.xml"); if(!LLFile::isfile(client_list_filename)) { - client_list_filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "client_definitions.xml"); + client_list_filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "client_tags_sg1.xml"); } if(LLFile::isfile(client_list_filename)) @@ -5544,9 +5541,13 @@ void LLVOAvatar::processAnimationStateChanges() if (found_anim == mSignaledAnimations.end()) { - - - + if (mIsSelf) + { + if ((gSavedSettings.getBOOL("AOEnabled")) && LLFloaterAO::stopMotion(anim_it->first, FALSE)) // if the AO replaced this anim serverside then stop it serverside + { +// return TRUE; //no local stop needed + } + } processSingleAnimationStateChange(anim_it->first, FALSE); // @@ -5572,6 +5573,11 @@ void LLVOAvatar::processAnimationStateChanges() // if (processSingleAnimationStateChange(anim_it->first, TRUE)) { + if (mIsSelf && gSavedSettings.getBOOL("AOEnabled")) // AO is only for ME + { + LLFloaterAO::startMotion(anim_it->first, 0,FALSE); // AO overrides the anim if needed + } + mPlayingAnimations[anim_it->first] = anim_it->second; ++anim_it; continue; @@ -5581,16 +5587,6 @@ void LLVOAvatar::processAnimationStateChanges() ++anim_it; } - - - - - - - - - - // clear source information for animations which have been stopped if (mIsSelf) { @@ -5646,6 +5642,14 @@ void LLVOAvatar::undeform() if (found_anim == mSignaledAnimations.end()) { + if (mIsSelf) + { + if ((gSavedSettings.getBOOL("AOEnabled")) && LLFloaterAO::stopMotion(anim_it->first, FALSE)) // if the AO replaced this anim serverside then stop it serverside + { +// return TRUE; //no local stop needed + } + } + processSingleAnimationStateChange(anim_it->first, FALSE); mPlayingAnimations.erase(anim_it++); continue; @@ -5786,81 +5790,16 @@ std::string LLVOAvatar::getIdleTime() //----------------------------------------------------------------------------- BOOL LLVOAvatar::startMotion(const LLUUID& id, F32 time_offset) { - LLMemType mt(LLMemType::MTYPE_AVATAR); - // - if(mIsSelf) + // [Ansariel Hiller]: Disable pesky hover up animation that changes + // hand and finger position and often breaks correct + // fit of prim nails, rings etc. when flying and + // using an AO. + if ("62c5de58-cb33-5743-3d07-9e4cd4352864" == id.getString() && gSavedSettings.getBOOL("DisableInternalFlyUpAnimation")) { - if(LLAO::isEnabled()) - { - std::string ao_id; - if (LLAO::isStand(id)) - { - ao_id = "Stands"; - } - else if (LLAO::isVoice(id)) - { - ao_id = "Voices"; - } - else - { - ao_id = id.asString(); - } - if (LLAO::mAnimationOverrides[ao_id].size() > 0) - { - if (LLAO::mLastAnimation.notNull()) - { - gAgent.sendAnimationRequest(LLAO::mLastAnimation, ANIM_REQUEST_STOP); - stopMotion(LLAO::mLastAnimation, true); - llinfos << "Stopping old animation." << llendl; - } - std::string anim_name; - LLUUID new_anim = LLUUID::null; - - while (new_anim.isNull()) - { - LLAO::mAnimationIndex++; - if (LLAO::mAnimationOverrides[ao_id].size() <= LLAO::mAnimationIndex) - { - LLAO::mAnimationIndex = 0; - } - anim_name = static_cast (LLAO::mAnimationOverrides[ao_id][LLAO::mAnimationIndex]); - new_anim = LLAO::getAssetIDByName(anim_name); - - if (new_anim.isNull()) - { - LLChat chat; - chat.mSourceType = CHAT_SOURCE_SYSTEM; - chat.mText = llformat("Could not find animation %s, skipping and moving to next.", anim_name.c_str()); - LLFloaterChat::addChat(chat); - } - } - llinfos << "Switching to anim #" << LLAO::mAnimationIndex << ": " << anim_name << "(UUID " << new_anim << ")" << llendl; - gAgent.sendAnimationRequest(new_anim, ANIM_REQUEST_START); - startMotion(new_anim, time_offset); - - //LLMotion* motion = findMotion(new_anim); - - /*if (motion) - { - motion->setDeactivateCallback(&endAnimCallback, (void *)(new LLHandle(self->getHandle()))); - }*/ - - LLAO::mLastAnimation = new_anim; - } - /*if(LLAO::mOverrides.find(id) != LLAO::mOverrides.end()) - { - // avoid infinite loops! - if( (id != LLAO::mOverrides[id]) - && (LLAO::mOverrides.find(LLAO::mOverrides[id]) == LLAO::mOverrides.end()) ) - { - //llinfos << "AO: Replacing " << id.asString() << " with " << LLAO::mOverrides[id].asString() << llendl; - gAgent.sendAnimationRequest(LLAO::mOverrides[id], ANIM_REQUEST_START); - startMotion(LLAO::mOverrides[id], time_offset); - } - }*/ - } + return TRUE; } - // + + LLMemType mt(LLMemType::MTYPE_AVATAR); // start special case female walk for female avatars if (getSex() == SEX_FEMALE) @@ -5880,36 +5819,6 @@ BOOL LLVOAvatar::startMotion(const LLUUID& id, F32 time_offset) gAgent.setAFK(); } - if( id == ANIM_AGENT_BUSY || - id == ANIM_AGENT_CROUCH || - id == ANIM_AGENT_CROUCHWALK || - id == ANIM_AGENT_FEMALE_WALK || - id == ANIM_AGENT_FLY || - id == ANIM_AGENT_FLYSLOW || - id == ANIM_AGENT_HOVER || - id == ANIM_AGENT_HOVER_DOWN || - id == ANIM_AGENT_HOVER_UP || - id == ANIM_AGENT_JUMP || - id == ANIM_AGENT_LAND || - id == ANIM_AGENT_PRE_JUMP || - id == ANIM_AGENT_RUN || - id == ANIM_AGENT_SHOUT || - id == ANIM_AGENT_SIT || - id == ANIM_AGENT_SIT_FEMALE || - id == ANIM_AGENT_SIT_GENERIC || - id == ANIM_AGENT_SIT_GROUND || - id == ANIM_AGENT_SIT_GROUND_CONSTRAINED || - id == ANIM_AGENT_SNAPSHOT || - id == ANIM_AGENT_STAND || - id == ANIM_AGENT_TURNLEFT || - id == ANIM_AGENT_TURNRIGHT || - id == ANIM_AGENT_TYPE || - id == ANIM_AGENT_WALK || - id == ANIM_AGENT_WHISPER || - id == ANIM_AGENT_WHISPER - ) - mIdleTimer.reset(); - return LLCharacter::startMotion(id, time_offset); } @@ -5920,50 +5829,8 @@ BOOL LLVOAvatar::stopMotion(const LLUUID& id, BOOL stop_immediate) { if (mIsSelf) { - - // - if(LLAO::isEnabled()) - { - std::string ao_id; - if (LLAO::isStand(id)) - { - ao_id = "Stands"; - } - else if (LLAO::isVoice(id)) - { - ao_id = "Voices"; - } - else - { - ao_id = id.asString(); - } - if (LLAO::mAnimationOverrides[ao_id].size() > 0) - { - LLUUID new_anim = LLAO::getAssetIDByName(LLAO::mAnimationOverrides[ao_id][LLAO::mAnimationIndex]); - gAgent.sendAnimationRequest(new_anim, ANIM_REQUEST_STOP); - stopMotion(new_anim, stop_immediate); - LLAO::mLastAnimation.setNull(); - } - /*if( (LLAO::mOverrides.find(id) != LLAO::mOverrides.end()) - && (id != LLAO::mOverrides[id]) ) - { - gAgent.sendAnimationRequest(LLAO::mOverrides[id], ANIM_REQUEST_STOP); - stopMotion(LLAO::mOverrides[id], stop_immediate); - }*/ - } - else //if this code ever works without crashing the viewer -HgB - { - if (!LLAO::mLastAnimation.isNull()) - { - llinfos << "Stopped last animation automatically. May not have needed to be stopped yet." << llendl; - gAgent.sendAnimationRequest(LLAO::mLastAnimation, ANIM_REQUEST_STOP); - LLAO::mLastAnimation = LLUUID::null; - } - } - // gAgent.onAnimStop(id); } - if (id == ANIM_AGENT_WALK) { @@ -5973,10 +5840,6 @@ BOOL LLVOAvatar::stopMotion(const LLUUID& id, BOOL stop_immediate) { LLCharacter::stopMotion(ANIM_AGENT_SIT_FEMALE, stop_immediate); } - - if(id == ANIM_AGENT_AWAY || - id == ANIM_AGENT_BUSY) - mIdleTimer.reset(); return LLCharacter::stopMotion(id, stop_immediate); } @@ -6010,6 +5873,11 @@ void LLVOAvatar::stopMotionFromSource(const LLUUID& source_id) //----------------------------------------------------------------------------- LLVector3 LLVOAvatar::getVolumePos(S32 joint_index, LLVector3& volume_offset) { + if(joint_index < 0) + { + return LLVector3::zero; + } + if (joint_index > mNumCollisionVolumes) { return LLVector3::zero; @@ -7367,6 +7235,7 @@ void LLVOAvatar::sitOnObject(LLViewerObject *sit_object) gPipeline.markMoved(mDrawable, TRUE); mIsSitting = TRUE; + LLFloaterAO::ChangeStand(); mRoot.getXform()->setParent(&sit_object->mDrawable->mXform); // LLVOAvatar::sitOnObject mRoot.setPosition(getPosition()); mRoot.updateWorldMatrixChildren(); @@ -7443,6 +7312,7 @@ void LLVOAvatar::getOffObject() mRoot.getXform()->update(); startMotion(ANIM_AGENT_BODY_NOISE); + LLFloaterAO::ChangeStand(); if (mIsSelf) { diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 8ac628e32..f0da8ddba 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -2057,7 +2057,7 @@ BOOL LLVOVolume::lineSegmentIntersect(const LLVector3& start, const LLVector3& e if (face == -1) { start_face = 0; - end_face = volume->getNumFaces(); + end_face = volume->getNumVolumeFaces(); } else { diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index fcb2424c7..6bfd93afd 100644 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -1322,12 +1322,13 @@ void LLWorldMapView::drawAvatar(F32 x_pixels, F32 dot_radius) { const F32 HEIGHT_THRESHOLD = 7.f; - LLUIImagePtr dot_image = sAvatarSmallImage; + LLUIImagePtr dot_image = sAvatarLevelImage; if (relative_z == 16000.f) // Unknown altitude (0m or > 1020m) { - F32 mag = color.length(); - color=color*0.5f + LLColor4(mag, mag, mag)*0.25f; + //F32 mag = color.length(); + //color=color*0.5f + LLColor4(mag, mag, mag)*0.25f; + dot_image = sAvatarSmallImage; } else if (relative_z < -HEIGHT_THRESHOLD) { diff --git a/indra/newview/skins/default/textures/icon_top_pick.tga b/indra/newview/skins/default/textures/icon_top_pick.tga index 7fe119a81..0b34882d2 100644 Binary files a/indra/newview/skins/default/textures/icon_top_pick.tga and b/indra/newview/skins/default/textures/icon_top_pick.tga differ diff --git a/indra/newview/skins/default/xui/en-us/floater_ao.xml b/indra/newview/skins/default/xui/en-us/floater_ao.xml index 394e3aea3..28d6d9178 100644 --- a/indra/newview/skins/default/xui/en-us/floater_ao.xml +++ b/indra/newview/skins/default/xui/en-us/floater_ao.xml @@ -1,101 +1,247 @@ - - - - Action: - - - - Crouch - - - Crouchwalk - - - Fall - - - Fly - - - Fly Down - - - Fly Up - - - Ground Sit - - - Hover - - - Land (Soft) - - - Land (Medium) - - - Land (Hard) - - - Jump - - - Pre-Jump - - - Run - - - Sit - - - Slow Fly - - - Stand - - - Stride - - - Turn Left - - - Turn Right - - - Typing - - - Voice - - - Walk - - + + - - Animations: - - - -