Skip to content
Snippets Groups Projects
Commit 63b99e53 authored by NiranV's avatar NiranV
Browse files

Added: First attempt at a timeline feature for animations. Allows fast...

Added: First attempt at a timeline feature for animations. Allows fast forwarding and reversing animations to any given point in time.
parent bb2eeef2
No related branches found
No related tags found
No related merge requests found
......@@ -180,6 +180,8 @@ class LLMotion
const LLPointer<LLJointState> findJointState(const std::string jointName);
const LLPointer<LLJointState> findJointState(LLJoint *joint);
U8 mJointSignature[3][LL_CHARACTER_MAX_ANIMATED_JOINTS]; // signature of which joints are animated at what priority
protected:
// called when a motion is activated
// must return TRUE to indicate success, or else
......@@ -212,7 +214,6 @@ class LLMotion
F32 mSendStopTimestamp; // time when simulator should be told to stop this motion
F32 mResidualWeight; // blend weight at beginning of stop motion phase
F32 mFadeWeight; // for fading in and out based on LOD
U8 mJointSignature[3][LL_CHARACTER_MAX_ANIMATED_JOINTS]; // signature of which joints are animated at what priority
void (*mDeactivateCallback)(void* data);
void* mDeactivateCallbackUserData;
};
......
......@@ -38,13 +38,19 @@
#include "lluictrlfactory.h"
#include "lluictrlfactory.h"
#include "lldatapacker.h"
//BD
#include "llmotion.h"
extern LLAgent gAgent;
const S32 NUM_JOINT_SIGNATURE_STRIDES = LL_CHARACTER_MAX_ANIMATED_JOINTS / 4;
LLPreviewAnim::LLPreviewAnim(const LLSD& key)
: LLPreview( key )
{
mCommitCallbackRegistrar.add("PreviewAnim.Play", boost::bind(&LLPreviewAnim::play, this, _2));
mCommitCallbackRegistrar.add("PreviewAnim.Time", boost::bind(&LLPreviewAnim::time, this, _1, _2));
}
// virtual
......@@ -53,8 +59,10 @@ BOOL LLPreviewAnim::postBuild()
const LLInventoryItem* item = getItem();
if(item)
{
gAgentAvatarp->createMotion(item->getAssetUUID()); // preload the animation
LLMotion* motion = gAgentAvatarp->createMotion(item->getAssetUUID()); // preload the animation
getChild<LLUICtrl>("desc")->setValue(item->getDescription());
getChild<LLSliderCtrl>("time")->setMaxValue(motion->getDuration());
}
childSetCommitCallback("desc", LLPreview::onText, this);
......@@ -133,6 +141,25 @@ void LLPreviewAnim::play(const LLSD& param)
}
}
void LLPreviewAnim::time(LLUICtrl* ctrl, const LLSD& param)
{
const LLInventoryItem *item = getItem();
LLUUID itemID = item->getAssetUUID();
LLMotion* motion = gAgentAvatarp->findMotion(itemID);
if (motion)
{
/*U8 last_joint_signature[LL_CHARACTER_MAX_ANIMATED_JOINTS];
memset(&last_joint_signature, 0, sizeof(U8) * LL_CHARACTER_MAX_ANIMATED_JOINTS);
for (S32 i = 0; i < NUM_JOINT_SIGNATURE_STRIDES; i++)
{
*((U32*)&last_joint_signature[i * 4]) = *(U32*)&(motion->mJointSignature[0][i * 4]);
}
motion->onUpdate(ctrl->getValue().asReal(), last_joint_signature);*/
motion->activate(ctrl->getValue().asReal());
}
}
// virtual
void LLPreviewAnim::draw()
{
......
......@@ -40,6 +40,9 @@ class LLPreviewAnim : public LLPreview
void draw();
void cleanup();
void play(const LLSD& param);
void time(LLUICtrl* time, const LLSD& param);
F32 nTime;
protected:
......
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater
legacy_header_height="18"
height="94"
height="113"
layout="topleft"
name="preview_anim"
width="283">
width="285">
<floater.string
name="Title">
Animation: [NAME]
......@@ -89,4 +89,21 @@
function="PreviewAnim.Play"
parameter="Locally" />
</button>
<slider
decimal_digits="3"
follows="left|top"
can_edit_text="true"
height="14"
top_pad="4"
increment="0.001"
initial_value="0.00"
width="268"
left="7"
min_value="-60"
mouse_opaque="true"
name="time"
show_text="true">
<slider.commit_callback
function="PreviewAnim.Time"/>
</slider>
</floater>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment