diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index b8562f0652..29054f949d 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -127,6 +127,7 @@ set(viewer_SOURCE_FILES fsfloaterblocklist.cpp fsfloatergroup.cpp fsfloaterplacedetails.cpp + fsfloaterposestand.cpp fsfloaterprofile.cpp fsfloatersearch.cpp fsfloaterteleporthistory.cpp @@ -775,6 +776,7 @@ set(viewer_HEADER_FILES fsfloaterblocklist.h fsfloatergroup.h fsfloaterplacedetails.h + fsfloaterposestand.h fsfloaterprofile.h fsfloatersearch.h fsfloaterteleporthistory.h diff --git a/indra/newview/app_settings/posestand.xml b/indra/newview/app_settings/posestand.xml new file mode 100644 index 0000000000..68d7bd1790 --- /dev/null +++ b/indra/newview/app_settings/posestand.xml @@ -0,0 +1,59 @@ + + + febde518-eba6-1628-9070-a2c227852324 + + name + T-pose + + 8c607ae7-80a9-0004-5186-4e2bedafb256 + + name + Arms Down, Legs together + + 7ec0f76c-88ac-b9f2-778f-8fd95a30c7fc + + name + Arms down, sitting + + a0f213b6-5506-3cf8-32ac-cfc9684048e7 + + name + Arms downward, Legs straight + + 9e95943d-8020-e622-a4e0-4c9f8058091a + + name + Arms downward, Legs apart + + 6c5e15de-7079-f558-d635-7123b7379dec + + name + Arms foreward, Legs apart + + 58401663-f5d3-828c-6cb5-ff618308e6be + + name + Arms foreward, Legs together + + 7598be4b-6b1d-afaf-bc5e-0708fa3c214a + + name + Arms straight, Legs apart + + 5acb15c0-1b14-6276-bd52-afdaad13cc1d + + name + Arms straight, sitting + + b28ee0ca-81b3-82f0-c3a3-5308efacf774 + + name + Arms upward, Legs apart + + e2f67928-18ab-3991-4612-658cd88a1b4f + + name + Arms upward, Legs together + + + \ No newline at end of file diff --git a/indra/newview/fsfloaterposestand.cpp b/indra/newview/fsfloaterposestand.cpp new file mode 100644 index 0000000000..dcaf9f53da --- /dev/null +++ b/indra/newview/fsfloaterposestand.cpp @@ -0,0 +1,95 @@ +/* + * @file fsfloaterposestand.cpp + * @brief It's a pose stand! + * + * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): + * Cinder Roxley wrote this file. As long as you retain this notice you can do + * whatever you want with this stuff. If we meet some day, and you think this + * stuff is worth it, you can buy me a beer in return + * ---------------------------------------------------------------------------- + */ + +#include "llviewerprecompiledheaders.h" +#include "fsfloaterposestand.h" + +#include "llagent.h" +#include "llsdserialize.h" +#include "llvoavatarself.h" + +FSFloaterPoseStand::FSFloaterPoseStand(const LLSD& key) +: LLFloater(key), + mCurrentPose(LLUUID::null), + mComboPose(NULL) +{ +} + +FSFloaterPoseStand::~FSFloaterPoseStand() +{ +} + +BOOL FSFloaterPoseStand::postBuild() +{ + mComboPose = getChild("pose_combo"); + mComboPose->setCommitCallback(boost::bind(&FSFloaterPoseStand::onCommitCombo, this)); + loadPoses(); + onCommitCombo(); + + return TRUE; +} + +// virtual +void FSFloaterPoseStand::onOpen(const LLSD& key) +{ + setPose(mCurrentPose.asString()); +} + +// virtual +void FSFloaterPoseStand::onClose(bool app_quitting) +{ + stopPose(); +} + +void FSFloaterPoseStand::loadPoses() +{ + const std::string pose_filename = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "posestand.xml"); + llifstream pose_file(pose_filename); + LLSD poses; + if (pose_file.is_open()) + { + if(LLSDSerialize::fromXML(poses, pose_file) >= 1) + { + for(LLSD::map_iterator p_itr = poses.beginMap(); p_itr != poses.endMap(); ++p_itr) + { + mComboPose->add(p_itr->second["name"], LLUUID(p_itr->first)); + } + } + pose_file.close(); + } +} + +void FSFloaterPoseStand::onCommitCombo() +{ + std::string selected_pose = mComboPose->getValue(); + setPose(selected_pose); +} + +void FSFloaterPoseStand::setPose(std::string new_pose) +{ + if (isAgentAvatarValid()) + { + if (mCurrentPose.notNull()) + gAgent.sendAnimationRequest(mCurrentPose, ANIM_REQUEST_STOP); + mCurrentPose.set(new_pose); + gAgent.sendAnimationRequest(mCurrentPose, ANIM_REQUEST_START); + } +} + +void FSFloaterPoseStand::stopPose() +{ + if (isAgentAvatarValid() && mCurrentPose != LLUUID::null) + { + gAgent.sendAnimationRequest(mCurrentPose, ANIM_REQUEST_STOP); + mCurrentPose.setNull(); + } +} diff --git a/indra/newview/fsfloaterposestand.h b/indra/newview/fsfloaterposestand.h new file mode 100644 index 0000000000..58f35770fb --- /dev/null +++ b/indra/newview/fsfloaterposestand.h @@ -0,0 +1,40 @@ + /* + * @file fsfloaterposestand.h + * @brief Pose stand definitions + * + * ---------------------------------------------------------------------------- + * "THE BEER-WARE LICENSE" (Revision 42): + * Cinder Roxley wrote this file. As long as you retain this notice you can do + * whatever you want with this stuff. If we meet some day, and you think this + * stuff is worth it, you can buy me a beer in return + * ---------------------------------------------------------------------------- + */ + +#ifndef FS_FSFLOATERPOSESTAND_H +#define FS_FSFLOATERPOSESTAND_H + +#include "llfloater.h" +#include "llcombobox.h" + +class FSFloaterPoseStand +: public LLFloater +{ + LOG_CLASS(FSFloaterPoseStand); +public: + FSFloaterPoseStand(const LLSD& key); + BOOL postBuild(); +private: + ~FSFloaterPoseStand(); + + virtual void onOpen(const LLSD& key); + virtual void onClose(bool app_quitting); + void loadPoses(); + void stopPose(); + void onCommitCombo(); + void setPose(std::string new_pose); + + LLComboBox* mComboPose; + LLUUID mCurrentPose; +}; + +#endif // FS_FLOATERPOSESTAND_H diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 23f8a0ebc1..6d93b0383e 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -151,6 +151,7 @@ #include "fsfloaterblocklist.h" #include "fsfloatergroup.h" #include "fsfloaterplacedetails.h" +#include "fsfloaterposestand.h" #include "fsfloaterprofile.h" #include "fsfloatersearch.h" #include "fsfloaterteleporthistory.h" @@ -370,6 +371,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("floater_profile", "floater_profile_view.xml",&LLFloaterReg::build); LLFloaterReg::add("fs_blocklist", "floater_fs_blocklist.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("fs_group", "floater_fs_group.xml",&LLFloaterReg::build); + LLFloaterReg::add("fs_posestand", "floater_fs_posestand.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("fs_placedetails", "floater_fs_placedetails.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("fs_teleporthistory", "floater_fs_teleporthistory.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("group_titles", "floater_fs_group_titles.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/skins/default/xui/en/floater_fs_posestand.xml b/indra/newview/skins/default/xui/en/floater_fs_posestand.xml new file mode 100644 index 0000000000..aefbf327e0 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_fs_posestand.xml @@ -0,0 +1,21 @@ + + + + + diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 71ccc3fd44..9c1db6b1ec 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -267,6 +267,14 @@ function="Floater.Toggle" parameter="money_tracker" /> + + + +