Pushing this code up - Even if we can't get the AO working, at least this doesn't CRASH.

Signed-off-by: Beeks <HgDelirium@gmail.com>
This commit is contained in:
Beeks
2010-09-11 05:01:39 -04:00
parent d01da05d94
commit 2f79566311
4 changed files with 506 additions and 287 deletions

View File

@@ -4969,14 +4969,7 @@ void LLAgent::requestStopMotion( LLMotion* motion )
void LLAgent::onAnimStop(const LLUUID& id)
{
// handle automatic state transitions (based on completion of animation playback)
if(id == ANIM_AGENT_STAND
// <edit>
// I really do not like doing this
|| id == ANIM_AGENT_STAND_1
|| id == ANIM_AGENT_STAND_2
|| id == ANIM_AGENT_STAND_3
|| id == ANIM_AGENT_STAND_4)
// </edit>
if(LLAO::isStand(id))
{
// <edit>
if(LLAO::isEnabled())

View File

@@ -1,24 +1,92 @@
// <edit>
/* DOUBLE EDIT REACH AROUND
Rewritten by Hg Beeks
We will handle drag-and-drop in the future. Reminder - Look in llPreviewGesture for handleDragAndDrop. -HgB
*/
#include "llviewerprecompiledheaders.h"
#include "llao.h"
#include "llviewercontrol.h"
#include "lluictrlfactory.h"
#include "llfilepicker.h"
#include "llsdserialize.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
#define AO_DEBUG
//static variables
std::list<LLUUID> LLAO::mStandOverrides;
std::list<std::string> LLAO::mStandOverrides;
std::list<std::string> LLAO::mWalkOverrides;
std::list<std::string> LLAO::mRunOverrides;
std::list<std::string> LLAO::mCrouchwalkOverrides;
std::list<std::string> LLAO::mFlyOverrides;
std::list<std::string> LLAO::mTurnLeftOverrides;
std::list<std::string> LLAO::mTurnRightOverrides;
std::list<std::string> LLAO::mJumpOverrides;
std::list<std::string> LLAO::mFlyUpOverrides;
std::list<std::string> LLAO::mFlyDownOverrides;
std::list<std::string> LLAO::mCrouchOverrides;
std::list<std::string> LLAO::mHoverOverrides;
std::list<std::string> LLAO::mSitOverrides;
std::list<std::string> LLAO::mPreJumpOverrides;
std::list<std::string> LLAO::mFallOverrides;
std::list<std::string> LLAO::mStrideOverrides;
std::list<std::string> LLAO::mSoftLandOverrides;
std::list<std::string> LLAO::mMediumLandOverrides;
std::list<std::string> LLAO::mHardLandOverrides;
std::list<std::string> LLAO::mSlowFlyOverrides;
std::list<std::string> LLAO::mGroundSitOverrides;
std::map<LLUUID,LLUUID> 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;
};
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)
{
}
@@ -40,20 +108,20 @@ BOOL LLAOStandTimer::tick()
if(LLAO::isStand(anim_it->first))
{
//back is always last played, front is next
avatarp->stopMotion(LLAO::mStandOverrides.back());
avatarp->stopMotion(LLAO::getBackUUID());
#ifdef AO_DEBUG
llinfos << "Stopping " << LLAO::mStandOverrides.back().asString() << llendl;
//llinfos << "Stopping " << LLAO::mStandOverrides.back() << llendl;
#endif
avatarp->startMotion(LLAO::mStandOverrides.front());
avatarp->startMotion(LLAO::getFrontUUID());
#ifdef AO_DEBUG
llinfos << "Starting " << LLAO::mStandOverrides.front().asString() << llendl;
//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()));
//ao->mStandsCombo->setSimple(LLStringExplicit(LLAO::mStandOverrides.back().asString()));
}
break;
}
@@ -73,10 +141,10 @@ void LLAOStandTimer::pause()
if (avatarp)
{
#ifdef AO_DEBUG
llinfos << "Stopping " << LLAO::mStandOverrides.back().asString() << llendl;
//llinfos << "Stopping " << LLAO::mStandOverrides.back() << llendl;
#endif
gAgent.sendAnimationRequest(LLAO::mStandOverrides.back(), ANIM_REQUEST_STOP);
avatarp->stopMotion(LLAO::mStandOverrides.back());
gAgent.sendAnimationRequest(LLAO::getBackUUID(), ANIM_REQUEST_STOP);
avatarp->stopMotion(LLAO::getBackUUID());
}
mEventTimer.reset();
mEventTimer.stop();
@@ -93,20 +161,31 @@ void LLAOStandTimer::resume()
if (avatarp)
{
#ifdef AO_DEBUG
llinfos << "Starting " << LLAO::mStandOverrides.back().asString() << llendl;
//llinfos << "Starting " << LLAO::mStandOverrides.back() << llendl;
#endif
gAgent.sendAnimationRequest(LLAO::mStandOverrides.back(), ANIM_REQUEST_START);
avatarp->startMotion(LLAO::mStandOverrides.back());
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()
{
@@ -179,11 +258,48 @@ BOOL LLAO::isStand(LLUUID _id)
if(id == "f22fed8b-a5ed-2c93-64d5-bdd8b93c889f") return TRUE;
return FALSE;
}
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;
};
//static
void LLAO::refresh()
{
mOverrides.clear();
mStandOverrides.clear();
mWalkOverrides.clear();
mRunOverrides.clear();
mCrouchwalkOverrides.clear();
mFlyOverrides.clear();
mTurnLeftOverrides.clear();
mTurnRightOverrides.clear();
mJumpOverrides.clear();
mFlyUpOverrides.clear();
mFlyDownOverrides.clear();
mCrouchOverrides.clear();
mHoverOverrides.clear();
mSitOverrides.clear();
mPreJumpOverrides.clear();
mFallOverrides.clear();
mStrideOverrides.clear();
mSoftLandOverrides.clear();
mMediumLandOverrides.clear();
mHardLandOverrides.clear();
mSlowFlyOverrides.clear();
mGroundSitOverrides.clear();
LLSD settings = gSavedPerAccountSettings.getLLSD("AO.Settings");
//S32 version = (S32)settings["version"].asInteger();
LLSD overrides = settings["overrides"];
@@ -191,29 +307,118 @@ void LLAO::refresh()
LLSD::map_iterator sd_end = overrides.endMap();
for( ; sd_it != sd_end; sd_it++)
{
if(sd_it->second.asString() == "" )
{
continue;
}
if(sd_it->first == "stands")
{
for(LLSD::array_iterator itr = sd_it->second.beginArray();
itr != sd_it->second.endArray(); ++itr)
{
//list of listness
if(itr->asUUID().notNull())
mStandOverrides.push_back(itr->asUUID());
if(itr->asString() != "")
mStandOverrides.push_back(itr->asString());
}
// ignore if override is null key...
if(sd_it->second.asUUID().isNull()
// don't allow override to be used as a trigger
|| mOverrides.find(sd_it->second.asUUID()) != mOverrides.end())
continue;
else if(LLAO::isStand(LLUUID(sd_it->first)))
//list of listness
mStandOverrides.push_back(sd_it->second.asUUID());
else
//add to the list
mOverrides[LLUUID(sd_it->first)] = sd_it->second.asUUID();
}
}
}
//static
std::list<std::string>* LLAO::getOverrideList(const std::string name)
{
std::list<std::string> *anim_list;
if (name == "Stand")
anim_list = &mStandOverrides;
else if (name == "Walk")
anim_list = &mWalkOverrides;
else if (name == "Run")
anim_list = &mRunOverrides;
else if (name == "Crouchwalk")
anim_list = &mCrouchwalkOverrides;
else if (name == "Fly")
anim_list = &mFlyOverrides;
else if (name == "TurnLeft")
anim_list = &mTurnLeftOverrides;
else if (name == "TurnRight")
anim_list = &mTurnRightOverrides;
else if (name == "Jump")
anim_list = &mJumpOverrides;
else if (name == "FlyUp")
anim_list = &mFlyUpOverrides;
else if (name == "FlyDown")
anim_list = &mFlyDownOverrides;
else if (name == "Crouch")
anim_list = &mCrouchOverrides;
else if (name == "Hover")
anim_list = &mHoverOverrides;
else if (name == "Sit")
anim_list = &mSitOverrides;
else if (name == "PreJump")
anim_list = &mPreJumpOverrides;
else if (name == "Fall")
anim_list = &mFallOverrides;
else if (name == "Stride")
anim_list = &mStrideOverrides;
else if (name == "SoftLand")
anim_list = &mSoftLandOverrides;
else if (name == "MediumLand")
anim_list = &mMediumLandOverrides;
else if (name == "HardLand")
anim_list = &mHardLandOverrides;
else if (name == "SlowFly")
anim_list = &mSlowFlyOverrides;
else
anim_list = &mGroundSitOverrides;
return anim_list;
}
void LLAO::pushTo(std::string name, std::string value)
{
if (name == "Stand")
mStandOverrides.push_back(value);
else if (name == "Walk")
mWalkOverrides.push_back(value);
else if (name == "Run")
mRunOverrides.push_back(value);
else if (name == "Crouchwalk")
mCrouchwalkOverrides.push_back(value);
else if (name == "Fly")
mFlyOverrides.push_back(value);
else if (name == "TurnLeft")
mTurnLeftOverrides.push_back(value);
else if (name == "TurnRight")
mTurnRightOverrides.push_back(value);
else if (name == "Jump")
mJumpOverrides.push_back(value);
else if (name == "FlyUp")
mFlyUpOverrides.push_back(value);
else if (name == "FlyDown")
mFlyDownOverrides.push_back(value);
else if (name == "Crouch")
mCrouchOverrides.push_back(value);
else if (name == "Hover")
mHoverOverrides.push_back(value);
else if (name == "Sit")
mSitOverrides.push_back(value);
else if (name == "PreJump")
mPreJumpOverrides.push_back(value);
else if (name == "Fall")
mFallOverrides.push_back(value);
else if (name == "Stride")
mStrideOverrides.push_back(value);
else if (name == "SoftLand")
mSoftLandOverrides.push_back(value);
else if (name == "MediumLand")
mMediumLandOverrides.push_back(value);
else if (name == "HardLand")
mHardLandOverrides.push_back(value);
else if (name == "SlowFly")
mSlowFlyOverrides.push_back(value);
else
mGroundSitOverrides.push_back(value);
}
//static ------------- Floater
void LLFloaterAO::show()
{
if(sInstance)
@@ -236,147 +441,134 @@ LLFloaterAO::~LLFloaterAO()
BOOL LLFloaterAO::postBuild(void)
{
LLComboBox* combo;
LLScrollListCtrl* list;
childSetAction("btn_save", onClickSave, this);
childSetAction("btn_load", onClickLoad, this);
childSetCommitCallback("line_walking", onCommitAnim, this);
childSetCommitCallback("line_running", onCommitAnim, this);
childSetCommitCallback("line_crouchwalk", onCommitAnim, this);
childSetCommitCallback("line_flying", onCommitAnim, this);
childSetCommitCallback("line_turn_left", onCommitAnim, this);
childSetCommitCallback("line_turn_right", onCommitAnim, this);
childSetCommitCallback("line_jumping", onCommitAnim, this);
childSetCommitCallback("line_fly_up", onCommitAnim, this);
childSetCommitCallback("line_crouching", onCommitAnim, this);
childSetCommitCallback("line_fly_down", onCommitAnim, this);
LLComboBox* combo = getChild<LLComboBox>( "combo_stands");
combo->setAllowTextEntry(TRUE,36,TRUE);
combo->setCommitCallback(onCommitStands);
combo = getChild<LLComboBox>( "combo_anim_type");
combo->setCommitCallback(onCommitType);
combo->setCallbackUserData(this);
mStandsCombo = combo;
childSetAction("combo_stands_add", onClickStandAdd, this);
childSetAction("combo_stands_delete", onClickStandRemove, this);
childSetCommitCallback("line_hover", onCommitAnim, this);
childSetCommitCallback("line_sitting", onCommitAnim, this);
childSetCommitCallback("line_prejump", onCommitAnim, this);
childSetCommitCallback("line_falling", onCommitAnim, this);
childSetCommitCallback("line_stride", onCommitAnim, this);
childSetCommitCallback("line_soft_landing", onCommitAnim, this);
childSetCommitCallback("line_medium_landing", onCommitAnim, this);
childSetCommitCallback("line_hard_landing", onCommitAnim, this);
childSetCommitCallback("line_flying_slow", onCommitAnim, this);
childSetCommitCallback("line_sitting_on_ground", onCommitAnim, this);
mAnimTypeCombo = combo;
combo = getChild<LLComboBox>( "combo_anim_list");
mAnimListCombo = combo;
childSetAction("combo_anim_add", onClickAnimAdd, this);
childSetAction("combo_anim_delete", onClickAnimRemove, this);
list = getChild<LLScrollListCtrl>("combo_anim_list");
mAnimationList = list;
addAnimations();
refresh();
return TRUE;
}
std::string LLFloaterAO::idstr(LLUUID id)
{
if(id.notNull()) return id.asString();
else return "";
}
void LLFloaterAO::refresh()
{
childSetText("line_walking", idstr(LLAO::mOverrides[LLUUID("6ed24bd8-91aa-4b12-ccc7-c97c857ab4e0")]));
childSetText("line_running", idstr(LLAO::mOverrides[LLUUID("05ddbff8-aaa9-92a1-2b74-8fe77a29b445")]));
childSetText("line_crouchwalk", idstr(LLAO::mOverrides[LLUUID("47f5f6fb-22e5-ae44-f871-73aaaf4a6022")]));
childSetText("line_flying", idstr(LLAO::mOverrides[LLUUID("aec4610c-757f-bc4e-c092-c6e9caf18daf")]));
childSetText("line_turn_left", idstr(LLAO::mOverrides[LLUUID("56e0ba0d-4a9f-7f27-6117-32f2ebbf6135")]));
childSetText("line_turn_right", idstr(LLAO::mOverrides[LLUUID("2d6daa51-3192-6794-8e2e-a15f8338ec30")]));
childSetText("line_jumping", idstr(LLAO::mOverrides[LLUUID("2305bd75-1ca9-b03b-1faa-b176b8a8c49e")]));
childSetText("line_fly_up", idstr(LLAO::mOverrides[LLUUID("62c5de58-cb33-5743-3d07-9e4cd4352864")]));
childSetText("line_crouching", idstr(LLAO::mOverrides[LLUUID("201f3fdf-cb1f-dbec-201f-7333e328ae7c")]));
childSetText("line_fly_down", idstr(LLAO::mOverrides[LLUUID("20f063ea-8306-2562-0b07-5c853b37b31e")]));
mStandsCombo->clearRows();
for(std::list<LLUUID>::iterator itr = LLAO::mStandOverrides.begin();itr != LLAO::mStandOverrides.end();
std::list<std::string> *animation_list = LLAO::getOverrideList(mCurrentAnimType);
llinfos << "Refreshed, building animation list for " << mCurrentAnimType << ", Count:" << animation_list->size() << llendl;
for(std::list<std::string>::iterator itr = animation_list->begin();itr != animation_list->end();
itr++)
{
mStandsCombo->add((*itr).asString());
llinfos << "Adding " << itr->c_str() << llendl;
mAnimationList->addElement((*itr), ADD_BOTTOM);
}
mStandsCombo->setSimple(LLStringExplicit(LLAO::mStandOverrides.back().asString()));
childSetText("line_hover", idstr(LLAO::mOverrides[LLUUID("4ae8016b-31b9-03bb-c401-b1ea941db41d")]));
childSetText("line_sitting", idstr(LLAO::mOverrides[LLUUID("1a5fe8ac-a804-8a5d-7cbd-56bd83184568")]));
childSetText("line_prejump", idstr(LLAO::mOverrides[LLUUID("7a4e87fe-de39-6fcb-6223-024b00893244")]));
childSetText("line_falling", idstr(LLAO::mOverrides[LLUUID("666307d9-a860-572d-6fd4-c3ab8865c094")]));
childSetText("line_stride", idstr(LLAO::mOverrides[LLUUID("1cb562b0-ba21-2202-efb3-30f82cdf9595")]));
childSetText("line_soft_landing", idstr(LLAO::mOverrides[LLUUID("7a17b059-12b2-41b1-570a-186368b6aa6f")]));
childSetText("line_medium_landing", idstr(LLAO::mOverrides[LLUUID("f4f00d6e-b9fe-9292-f4cb-0ae06ea58d57")]));
childSetText("line_hard_landing", idstr(LLAO::mOverrides[LLUUID("3da1d753-028a-5446-24f3-9c9b856d9422")]));
childSetText("line_flying_slow", idstr(LLAO::mOverrides[LLUUID("2b5a38b2-5e00-3a97-a495-4c826bc443e6")]));
childSetText("line_sitting_on_ground", idstr(LLAO::mOverrides[LLUUID("1a2bd58e-87ff-0df8-0b4c-53e047b0bb6e")]));
}
// static
void LLFloaterAO::onCommitStands(LLUICtrl* ctrl, void* user_data)
void LLFloaterAO::onCommitType(LLUICtrl* ctrl, void* user_data)
{
//LLFloaterAO* floater = (LLFloaterAO*)user_data;
LLUUID id = ctrl->getValue().asUUID();
std::list<LLUUID>::iterator itr = std::find(LLAO::mStandOverrides.begin(),LLAO::mStandOverrides.end(),id);
LLVOAvatar* avatarp = gAgent.getAvatarObject();
if(id.notNull() && itr != LLAO::mStandOverrides.end())
{
//back is always last played
avatarp->stopMotion(LLAO::mStandOverrides.back());
avatarp->startMotion(id);
LLAO::mStandOverrides.push_back(id);
LLAO::mStandOverrides.erase(itr);
LLAO::mTimer->reset();
}
onCommitAnim(NULL,user_data);
LLFloaterAO* floater = (LLFloaterAO*)user_data;
floater->mCurrentAnimType = floater->mAnimTypeCombo->getSimple();
floater->refresh();
}
void LLFloaterAO::addAnimations()
{
mAnimListCombo->removeall();
std::string none_text = getString("none_text");
mAnimListCombo->add(none_text, LLUUID::null);
// 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_ITEM_UNRESTRICTED,
gAgent.getID(),
gAgent.getGroupID());
gInventory.collectDescendentsIf(gAgent.getInventoryRootID(),
cats,
items,
LLInventoryModel::EXCLUDE_TRASH,
is_copyable_animation);
// Copy into something we can sort
std::vector<LLInventoryItem*> 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<LLInventoryItem*>::iterator it;
for (it = animations.begin(); it != animations.end(); ++it)
{
LLInventoryItem* item = *it;
llinfos << "Adding " << item->getName() << " to animation list." << llendl;
mAnimListCombo->add(item->getName(), item->getAssetUUID(), ADD_BOTTOM);
}
}
void generateAnimationSet(std::string name, std::list<std::string> anim_list, LLSD& overrides)
{
for(std::list<std::string>::iterator itr = anim_list.begin();
itr != anim_list.end();
itr++)
{
overrides[name].append((*itr));
}
}
// static
void LLFloaterAO::onCommitAnim(LLUICtrl* ctrl, void* user_data)
{
LLFloaterAO* floater = (LLFloaterAO*)user_data;
//LLUUID animid(getAssetIDByName(stranim)); ------------------------------------------- IMPORTANT FOR LATER
LLSD overrides;
LLUUID id;
id = LLUUID(floater->childGetValue("line_walking").asString());
if(id.notNull()) overrides["6ed24bd8-91aa-4b12-ccc7-c97c857ab4e0"] = id;
id = LLUUID(floater->childGetValue("line_running").asString());
if(id.notNull()) overrides["05ddbff8-aaa9-92a1-2b74-8fe77a29b445"] = id;
id = LLUUID(floater->childGetValue("line_crouchwalk").asString());
if(id.notNull()) overrides["47f5f6fb-22e5-ae44-f871-73aaaf4a6022"] = id;
id = LLUUID(floater->childGetValue("line_flying").asString());
if(id.notNull()) overrides["aec4610c-757f-bc4e-c092-c6e9caf18daf"] = id;
id = LLUUID(floater->childGetValue("line_turn_left").asString());
if(id.notNull()) overrides["56e0ba0d-4a9f-7f27-6117-32f2ebbf6135"] = id;
id = LLUUID(floater->childGetValue("line_turn_right").asString());
if(id.notNull()) overrides["2d6daa51-3192-6794-8e2e-a15f8338ec30"] = id;
id = LLUUID(floater->childGetValue("line_jumping").asString());
if(id.notNull()) overrides["2305bd75-1ca9-b03b-1faa-b176b8a8c49e"] = id;
id = LLUUID(floater->childGetValue("line_fly_up").asString());
if(id.notNull()) overrides["62c5de58-cb33-5743-3d07-9e4cd4352864"] = id;
id = LLUUID(floater->childGetValue("line_crouching").asString());
if(id.notNull()) overrides["201f3fdf-cb1f-dbec-201f-7333e328ae7c"] = id;
id = LLUUID(floater->childGetValue("line_fly_down").asString());
if(id.notNull()) overrides["20f063ea-8306-2562-0b07-5c853b37b31e"] = id;
id = LLUUID(floater->childGetValue("line_hover").asString());
if(id.notNull()) overrides["4ae8016b-31b9-03bb-c401-b1ea941db41d"] = id;
id = LLUUID(floater->childGetValue("line_sitting").asString());
if(id.notNull()) overrides["1a5fe8ac-a804-8a5d-7cbd-56bd83184568"] = id;
id = LLUUID(floater->childGetValue("line_prejump").asString());
if(id.notNull()) overrides["7a4e87fe-de39-6fcb-6223-024b00893244"] = id;
id = LLUUID(floater->childGetValue("line_falling").asString());
if(id.notNull()) overrides["666307d9-a860-572d-6fd4-c3ab8865c094"] = id;
id = LLUUID(floater->childGetValue("line_stride").asString());
if(id.notNull()) overrides["1cb562b0-ba21-2202-efb3-30f82cdf9595"] = id;
id = LLUUID(floater->childGetValue("line_soft_landing").asString());
if(id.notNull()) overrides["7a17b059-12b2-41b1-570a-186368b6aa6f"] = id;
id = LLUUID(floater->childGetValue("line_medium_landing").asString());
if(id.notNull()) overrides["f4f00d6e-b9fe-9292-f4cb-0ae06ea58d57"] = id;
id = LLUUID(floater->childGetValue("line_hard_landing").asString());
if(id.notNull()) overrides["3da1d753-028a-5446-24f3-9c9b856d9422"] = id;
id = LLUUID(floater->childGetValue("line_flying_slow").asString());
if(id.notNull()) overrides["2b5a38b2-5e00-3a97-a495-4c826bc443e6"] = id;
id = LLUUID(floater->childGetValue("line_sitting_on_ground").asString());
if(id.notNull()) overrides["1a2bd58e-87ff-0df8-0b4c-53e047b0bb6e"] = id;
for(std::list<LLUUID>::iterator itr = LLAO::mStandOverrides.begin();itr != LLAO::mStandOverrides.end();
itr++)
/*if (!(animid.notNull()))
{
overrides["stands"].append((*itr));
}
cmdline_printchat(llformat("Warning: animation '%s' could not be found (Section: %s).",stranim.c_str(),strtoken.c_str()));
}*/
LLSD overrides;
generateAnimationSet("stands", LLAO::mStandOverrides, overrides);
generateAnimationSet("walks", LLAO::mWalkOverrides, overrides);
generateAnimationSet("runs", LLAO::mRunOverrides, overrides);
generateAnimationSet("crouchwalks", LLAO::mCrouchwalkOverrides, overrides);
generateAnimationSet("flies", LLAO::mFlyOverrides, overrides);
generateAnimationSet("turnlefts", LLAO::mTurnLeftOverrides, overrides);
generateAnimationSet("turnrights", LLAO::mTurnRightOverrides, overrides);
generateAnimationSet("jumps", LLAO::mJumpOverrides, overrides);
generateAnimationSet("flyups", LLAO::mFlyUpOverrides, overrides);
generateAnimationSet("flydowns", LLAO::mFlyDownOverrides, overrides);
generateAnimationSet("crouches", LLAO::mCrouchOverrides, overrides);
generateAnimationSet("hovers", LLAO::mHoverOverrides, overrides);
generateAnimationSet("sits", LLAO::mSitOverrides, overrides);
generateAnimationSet("prejumps", LLAO::mPreJumpOverrides, overrides);
generateAnimationSet("falls", LLAO::mFallOverrides, overrides);
generateAnimationSet("strides", LLAO::mStrideOverrides, overrides);
generateAnimationSet("softlands", LLAO::mSoftLandOverrides, overrides);
generateAnimationSet("mediumlands", LLAO::mMediumLandOverrides, overrides);
generateAnimationSet("hardlands", LLAO::mHardLandOverrides, overrides);
generateAnimationSet("slowflies", LLAO::mSlowFlyOverrides, overrides);
generateAnimationSet("groundsits", LLAO::mGroundSitOverrides, overrides);
LLSD settings;
settings["version"] = 2;
settings["overrides"] = overrides;
@@ -385,12 +577,22 @@ void LLFloaterAO::onCommitAnim(LLUICtrl* ctrl, void* user_data)
floater->refresh();
}
//static
void LLFloaterAO::onClickStandRemove(void* user_data)
void LLFloaterAO::onClickAnimRemove(void* user_data)
{
LLFloaterAO* floater = (LLFloaterAO*)user_data;
LLUUID id = floater->mStandsCombo->getValue().asUUID();
std::list<LLUUID>::iterator itr = std::find(LLAO::mStandOverrides.begin(),LLAO::mStandOverrides.end(),id);
std::vector<LLScrollListItem*> items = floater->mAnimationList->getAllSelected();
for (std::vector<LLScrollListItem*>::iterator iter = items.begin(); iter != items.end(); ++iter)
{
LLScrollListItem* item = *iter;
if (item->getValue().asString() != "")
{
//avatar_names.push_back(item->getColumn(0)->getValue().asString());
//avatar_ids.push_back(item->getUUID());
}
}
/*std::list<std::string>::iterator itr = std::find(LLAO::mStandOverrides.begin(),LLAO::mStandOverrides.end(),id);
LLVOAvatar* avatarp = gAgent.getAvatarObject();
if(id.notNull() && itr != LLAO::mStandOverrides.end())
{
@@ -404,23 +606,26 @@ void LLFloaterAO::onClickStandRemove(void* user_data)
floater->refresh();
LLAO::mTimer->reset();
}
onCommitAnim(NULL,user_data);
onCommitAnim(NULL,user_data);*/
}
//static
void LLFloaterAO::onClickStandAdd(void* user_data)
void LLFloaterAO::onClickAnimAdd(void* user_data)
{
LLFloaterAO* floater = (LLFloaterAO*)user_data;
LLUUID id = floater->mStandsCombo->getValue().asUUID();
std::list<LLUUID>::iterator itr = std::find(LLAO::mStandOverrides.begin(),LLAO::mStandOverrides.end(),id);
LLVOAvatar* avatarp = gAgent.getAvatarObject();
if(id.notNull() && itr == LLAO::mStandOverrides.end())
std::string anim_name = floater->mAnimListCombo->getSimple();
LLUUID id(LLAO::getAssetIDByName(anim_name));
std::list<std::string>* animation_list = LLAO::getOverrideList(floater->mCurrentAnimType);
std::list<std::string>::iterator itr = std::find(animation_list->begin(),
animation_list->end(),
anim_name);
#ifdef AO_DEBUG
llinfos << "Attempting to add " << anim_name << " (" << id << ") " << " to " << floater->mCurrentAnimType << llendl;
#endif
if(id.notNull() && (itr == animation_list->end()))
{
//back is always last played
avatarp->stopMotion(LLAO::mStandOverrides.back());
avatarp->startMotion(id);
LLAO::mStandOverrides.push_back(id);
floater->refresh();
llinfos << "Actually adding animation, this should be refreshed. Count:" << animation_list->size() << llendl;
LLAO::pushTo(floater->mCurrentAnimType, anim_name);
llinfos << "Added animation. Count:" << animation_list->size() << llendl;
LLAO::mTimer->reset();
}
onCommitAnim(NULL,user_data);
@@ -466,5 +671,4 @@ void LLFloaterAO::onClickLoad(void* user_data)
xml_file.close();
}
}
// </edit>
// </edit>

View File

@@ -16,6 +16,7 @@ public:
void pause();
void resume();
void reset();
private:
BOOL mPaused;
};
@@ -25,14 +26,48 @@ class LLAO
public:
static void setup();
static std::map<LLUUID,LLUUID> mOverrides;
static std::list<LLUUID> mStandOverrides;
static std::list<std::string> mStandOverrides;
static std::list<std::string> mWalkOverrides;
static std::list<std::string> mRunOverrides;
static std::list<std::string> mCrouchwalkOverrides;
static std::list<std::string> mFlyOverrides;
static std::list<std::string> mTurnLeftOverrides;
static std::list<std::string> mTurnRightOverrides;
static std::list<std::string> mJumpOverrides;
static std::list<std::string> mFlyUpOverrides;
static std::list<std::string> mFlyDownOverrides;
static std::list<std::string> mCrouchOverrides;
static std::list<std::string> mHoverOverrides;
static std::list<std::string> mSitOverrides;
static std::list<std::string> mPreJumpOverrides;
static std::list<std::string> mFallOverrides;
static std::list<std::string> mStrideOverrides;
static std::list<std::string> mSoftLandOverrides;
static std::list<std::string> mMediumLandOverrides;
static std::list<std::string> mHardLandOverrides;
static std::list<std::string> mSlowFlyOverrides;
static std::list<std::string> mGroundSitOverrides;
static BOOL isEnabled(){ return mEnabled; }
static BOOL isStand(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 std::list<std::string>* getOverrideList(const std::string name);
static void pushTo(std::string name, std::string value);
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;
@@ -44,19 +79,24 @@ 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 onCommitStands(LLUICtrl* ctrl,void* user_data);
static void onClickStandRemove(void* user_data);
static void onClickStandAdd(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);
private:
LLComboBox* mAnimListCombo;
LLComboBox* mAnimTypeCombo;
LLScrollListCtrl* mAnimationList;
std::string mCurrentAnimType;
virtual ~LLFloaterAO();
std::string idstr(LLUUID id); // silly utility
public:
LLComboBox* mStandsCombo;
protected:
static void onCommitAnimation(LLUICtrl* ctrl, void* data);
};
#endif

View File

@@ -1,114 +1,96 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater can_close="true" can_drag_on_left="false" can_minimize="true" can_resize="false"
width="410" height="590"
<floater can_close="true" can_drag_on_left="false" can_minimize="true" can_resize="true"
width="305" height="590" min_width="305" min_height="400"
name="AO Editor" title="AO Editor" rect_control="FloaterAORect">
<button bottom="-50" halign="center" height="24" label="Load..." left="220" name="btn_load" width="80" />
<button bottom="-50" halign="center" height="24" label="Save..." left_delta="90" name="btn_save" width="80" />
<text follows="top|left" height="15" left="10" name="text_stand1" bottom="-80">
Stands:
<text follows="top|left" height="15" left="10" name="text_stand1" bottom="-40">
Action:
</text>
<combo_box name="combo_stands" max_length="36" allow_text_entry="true" follows="top|left|right" height="20" left="100" width="250" bottom_delta="0">
<combo_box name="combo_anim_type" max_length="36" allow_text_entry="true" follows="top||left|right" height="20" left="100" right="-7" bottom_delta="0">
<combo_item type="string" length="1" enabled="true" name="Stand" value="Stand">
Stand
</combo_item>
<combo_item type="string" length="1" enabled="true" name="Walk" value="Walk">
Walk
</combo_item>
<combo_item type="string" length="1" enabled="true" name="Run" value="Run">
Run
</combo_item>
<combo_item type="string" length="1" enabled="true" name="Crouchwalk" value="Crouchwalk">
Crouchwalk
</combo_item>
<combo_item type="string" length="1" enabled="true" name="Fly" value="Fly">
Fly
</combo_item>
<combo_item type="string" length="1" enabled="true" name="TurnLeft" value="TurnLeft">
Turn Left
</combo_item>
<combo_item type="string" length="1" enabled="true" name="TurnRight" value="TurnRight">
Turn Right
</combo_item>
<combo_item type="string" length="1" enabled="true" name="Jump" value="Jump">
Jump
</combo_item>
<combo_item type="string" length="1" enabled="true" name="FlyUp" value="FlyUp">
Fly Up
</combo_item>
<combo_item type="string" length="1" enabled="true" name="FlyDown" value="FlyDown">
Fly Down
</combo_item>
<combo_item type="string" length="1" enabled="true" name="Crouch" value="Crouch">
Crouch
</combo_item>
<combo_item type="string" length="1" enabled="true" name="Hover" value="Hover">
Hover
</combo_item>
<combo_item type="string" length="1" enabled="true" name="Sit" value="Sit">
Sit
</combo_item>
<combo_item type="string" length="1" enabled="true" name="PreJump" value="PreJump">
Pre-Jump
</combo_item>
<combo_item type="string" length="1" enabled="true" name="Fall" value="Fall">
Fall
</combo_item>
<combo_item type="string" length="1" enabled="true" name="Stride" value="Stride">
Stride
</combo_item>
<combo_item type="string" length="1" enabled="true" name="SoftLand" value="SoftLand">
Land (Soft)
</combo_item>
<combo_item type="string" length="1" enabled="true" name="MediumLand" value="MediumLand">
Land (Medium)
</combo_item>
<combo_item type="string" length="1" enabled="true" name="HardLand" value="HardLand">
Land (Hard)
</combo_item>
<combo_item type="string" length="1" enabled="true" name="SlowFly" value="SlowFly">
Slow Fly
</combo_item>
<combo_item type="string" length="1" enabled="true" name="GroundSit" value="GroundSit">
Ground Sit
</combo_item>
</combo_box>
<button bottom_delta="0" height="20" label="✔" left="355" name="combo_stands_add" width="21" />
<button bottom_delta="0" height="20" label="X" left="380" name="combo_stands_delete" width="21" />
<text follows="top|left" height="15" left="10" name="text_walking" bottom_delta="-25">
Walking:
Animations:
</text>
<line_editor follows="top|left|right" height="19" max_length="36" name="line_walking"
width="300" left="100" bottom_delta="0" />
<combo_box name="combo_anim_list" max_length="36" allow_text_entry="true" follows="top|left|right" height="20" left="100" right="-52" bottom_delta="0">
</combo_box>
<button follows="top|right" bottom_delta="0" height="20" label="✔" right="-29" name="combo_anim_add" width="21" />
<button follows="top|right" bottom_delta="0" height="20" label="X" right="-7" name="combo_anim_delete" width="21" />
<text follows="top|left" height="15" left="10" name="text_running" bottom_delta="-25">
Running:
Current List:
</text>
<line_editor follows="top|left|right" height="19" max_length="36" name="line_running"
width="300" left="100" bottom_delta="0" />
<text follows="top|left" height="15" left="10" name="text_crouchwalk" bottom_delta="-25">
Crouchwalk:
</text>
<line_editor follows="top|left|right" height="19" max_length="36" name="line_crouchwalk"
width="300" left="100" bottom_delta="0" />
<text follows="top|left" height="15" left="10" name="text_flying" bottom_delta="-25">
Flying:
</text>
<line_editor follows="top|left|right" height="19" max_length="36" name="line_flying"
width="300" left="100" bottom_delta="0" />
<text follows="top|left" height="15" left="10" name="text_turn_left" bottom_delta="-25">
Turn Left:
</text>
<line_editor follows="top|left|right" height="19" max_length="36" name="line_turn_left"
width="300" left="100" bottom_delta="0" />
<text follows="top|left" height="15" left="10" name="text_turn_right" bottom_delta="-25">
Turn Right:
</text>
<line_editor follows="top|left|right" height="19" max_length="36" name="line_turn_right"
width="300" left="100" bottom_delta="0" />
<text follows="top|left" height="15" left="10" name="text_jumping" bottom_delta="-25">
Jumping:
</text>
<line_editor follows="top|left|right" height="19" max_length="36" name="line_jumping"
width="300" left="100" bottom_delta="0" />
<text follows="top|left" height="15" left="10" name="text_fly_up" bottom_delta="-25">
Fly Up:
</text>
<line_editor follows="top|left|right" height="19" max_length="36" name="line_fly_up"
width="300" left="100" bottom_delta="0" />
<text follows="top|left" height="15" left="10" name="text_crouching" bottom_delta="-25">
Crouching:
</text>
<line_editor follows="top|left|right" height="19" max_length="36" name="line_crouching"
width="300" left="100" bottom_delta="0" />
<text follows="top|left" height="15" left="10" name="text_fly_down" bottom_delta="-25">
Fly Down:
</text>
<line_editor follows="top|left|right" height="19" max_length="36" name="line_fly_down"
width="300" left="100" bottom_delta="0" />
<text follows="top|left" height="15" left="10" name="text_hover" bottom_delta="-25">
Hover:
</text>
<line_editor follows="top|left|right" height="19" max_length="36" name="line_hover"
width="300" left="100" bottom_delta="0" />
<text follows="top|left" height="15" left="10" name="text_sitting" bottom_delta="-25">
Sitting:
</text>
<line_editor follows="top|left|right" height="19" max_length="36" name="line_sitting"
width="300" left="100" bottom_delta="0" />
<text follows="top|left" height="15" left="10" name="text_prejump" bottom_delta="-25">
PreJump:
</text>
<line_editor follows="top|left|right" height="19" max_length="36" name="line_prejump"
width="300" left="100" bottom_delta="0" />
<text follows="top|left" height="15" left="10" name="text_falling" bottom_delta="-25">
Falling:
</text>
<line_editor follows="top|left|right" height="19" max_length="36" name="line_falling"
width="300" left="100" bottom_delta="0" />
<text follows="top|left" height="15" left="10" name="text_stride" bottom_delta="-25">
Stride:
</text>
<line_editor follows="top|left|right" height="19" max_length="36" name="line_stride"
width="300" left="100" bottom_delta="0" />
<text follows="top|left" height="15" left="10" name="text_soft_landing" bottom_delta="-25">
Soft Landing:
</text>
<line_editor follows="top|left|right" height="19" max_length="36" name="line_soft_landing"
width="300" left="100" bottom_delta="0" />
<text follows="top|left" height="15" left="10" name="text_medium_landing" bottom_delta="-25">
Medium Landing:
</text>
<line_editor follows="top|left|right" height="19" max_length="36" name="line_medium_landing"
width="300" left="100" bottom_delta="0" />
<text follows="top|left" height="15" left="10" name="text_hard_landing" bottom_delta="-25">
Hard Landing:
</text>
<line_editor follows="top|left|right" height="19" max_length="36" name="line_hard_landing"
width="300" left="100" bottom_delta="0" />
<text follows="top|left" height="15" left="10" name="text_flying_slow" bottom_delta="-25">
Flying Slow:
</text>
<line_editor follows="top|left|right" height="19" max_length="36" name="line_flying_slow"
width="300" left="100" bottom_delta="0" />
<text follows="top|left" height="15" left="10" name="text_sitting_on_ground" bottom_delta="-25">
Sitting on Ground:
</text>
<line_editor follows="top|left|right" height="19" max_length="36" name="line_sitting_on_ground"
width="300" left="100" bottom_delta="0" />
<scroll_list bottom="35" can_resize="true" column_padding="0" draw_heading="true"
follows="left|top|bottom|right" left="7" multi_select="true" right="-7"
name="active_anim_list" width="280" search_column="1"
tool_tip="Hold shift or control while clicking to select multiple files"
top="-68">
<column name="file_type" width="0" />
<column dynamicwidth="true" label="Animation" name="anim_name" tool_tip="Name of the animation." />
</scroll_list>
<button follows="left|bottom" bottom="7" halign="center" height="24" label="Load..."
left="120" name="btn_load" width="80" />
<button follows="left|bottom" bottom="7" halign="center" height="24" label="Save..."
left_delta="90" name="btn_save" width="80" />
</floater>