Basic built-in pose stand

Cinders 2013-03-05 22:06:19 -07:00
parent fdb836901a
commit 2a5c30e33d
7 changed files with 227 additions and 0 deletions

View File

@ -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

View File

@ -0,0 +1,59 @@
<llsd>
<map>
<key>febde518-eba6-1628-9070-a2c227852324</key>
<map>
<key>name</key>
<string>T-pose</string>
</map>
<key>8c607ae7-80a9-0004-5186-4e2bedafb256</key>
<map>
<key>name</key>
<string>Arms Down, Legs together</string>
</map>
<key>7ec0f76c-88ac-b9f2-778f-8fd95a30c7fc</key>
<map>
<key>name</key>
<string>Arms down, sitting</string>
</map>
<key>a0f213b6-5506-3cf8-32ac-cfc9684048e7</key>
<map>
<key>name</key>
<string>Arms downward, Legs straight</string>
</map>
<key>9e95943d-8020-e622-a4e0-4c9f8058091a</key>
<map>
<key>name</key>
<string>Arms downward, Legs apart</string>
</map>
<key>6c5e15de-7079-f558-d635-7123b7379dec</key>
<map>
<key>name</key>
<string>Arms foreward, Legs apart</string>
</map>
<key>58401663-f5d3-828c-6cb5-ff618308e6be</key>
<map>
<key>name</key>
<string>Arms foreward, Legs together</string>
</map>
<key>7598be4b-6b1d-afaf-bc5e-0708fa3c214a</key>
<map>
<key>name</key>
<string>Arms straight, Legs apart</string>
</map>
<key>5acb15c0-1b14-6276-bd52-afdaad13cc1d</key>
<map>
<key>name</key>
<string>Arms straight, sitting</string>
</map>
<key>b28ee0ca-81b3-82f0-c3a3-5308efacf774</key>
<map>
<key>name</key>
<string>Arms upward, Legs apart</string>
</map>
<key>e2f67928-18ab-3991-4612-658cd88a1b4f</key>
<map>
<key>name</key>
<string>Arms upward, Legs together</string>
</map>
</map>
</llsd>

View File

@ -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 <cinder@cinderblocks.biz>
* ----------------------------------------------------------------------------
*/
#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<LLComboBox>("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();
}
}

View File

@ -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 <cinder@cinderblocks.biz>
* ----------------------------------------------------------------------------
*/
#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

View File

@ -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<FSFloaterProfile>);
LLFloaterReg::add("fs_blocklist", "floater_fs_blocklist.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<FSFloaterBlocklist>);
LLFloaterReg::add("fs_group", "floater_fs_group.xml",&LLFloaterReg::build<FSFloaterGroup>);
LLFloaterReg::add("fs_posestand", "floater_fs_posestand.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<FSFloaterPoseStand>);
LLFloaterReg::add("fs_placedetails", "floater_fs_placedetails.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<FSFloaterPlaceDetails>);
LLFloaterReg::add("fs_teleporthistory", "floater_fs_teleporthistory.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<FSFloaterTeleportHistory>);
LLFloaterReg::add("group_titles", "floater_fs_group_titles.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<FSGroupTitles>);

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater
height="48"
width="200"
help_topic="pose_stand"
layout="topleft"
legacy_header_height="18"
name="floater_fs_posestand"
single_instance="true"
title="Pose Stand">
<combo_box
follows="right|top"
layout="topleft"
height="23"
allow_text_entry="false"
top="20"
left="5"
name="pose_combo"
width="190"/>
</floater>

View File

@ -267,6 +267,14 @@
function="Floater.Toggle"
parameter="money_tracker" />
</menu_item_call>
<menu_item_call
label="Pose Stand..."
name="pose_stand">
<menu_item_call.on_click
function="Floater.Show"
parameter="fs_posestand" />
</menu_item_call>
<menu
create_jump_keys="true"