From cd17687f01420952712a500107e0f93e7ab8d5f8 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Fri, 15 Aug 2008 23:45:34 -0500 Subject: Second Life viewer sources 1.19.1.0 --- linden/indra/newview/llfloateranimpreview.cpp | 89 ++++++++++++++------------- 1 file changed, 47 insertions(+), 42 deletions(-) (limited to 'linden/indra/newview/llfloateranimpreview.cpp') diff --git a/linden/indra/newview/llfloateranimpreview.cpp b/linden/indra/newview/llfloateranimpreview.cpp index 0fed525..0b486b3 100644 --- a/linden/indra/newview/llfloateranimpreview.cpp +++ b/linden/indra/newview/llfloateranimpreview.cpp @@ -46,6 +46,7 @@ #include "llcombobox.h" #include "lldrawable.h" #include "lldrawpoolavatar.h" +#include "llglimmediate.h" #include "llface.h" #include "llkeyframemotion.h" #include "lllineeditor.h" @@ -280,7 +281,7 @@ BOOL LLFloaterAnimPreview::postBuild() childSetValue("hand_pose_combo", LLHandMotion::getHandPoseName(motionp->getHandPose())); childSetValue("ease_in_time", LLSD(motionp->getEaseInDuration())); childSetValue("ease_out_time", LLSD(motionp->getEaseOutDuration())); - mEnabled = TRUE; + setEnabled(TRUE); char seconds_string[128]; /*Flawfinder: ignore*/ snprintf(seconds_string, sizeof(seconds_string), " - %.2f seconds", motionp->getDuration()); /* Flawfinder: ignore */ @@ -291,8 +292,8 @@ BOOL LLFloaterAnimPreview::postBuild() delete mAnimPreview; mAnimPreview = NULL; mMotionID.setNull(); - childSetValue("bad_animation_text", childGetText("failed_to_initialize")); - mEnabled = FALSE; + childSetValue("bad_animation_text", getString("failed_to_initialize")); + setEnabled(FALSE); } } else @@ -301,20 +302,20 @@ BOOL LLFloaterAnimPreview::postBuild() { if (loaderp->getDuration() > MAX_ANIM_DURATION) { - LLUIString out_str = childGetText("anim_too_long"); + LLUIString out_str = getString("anim_too_long"); out_str.setArg("[LENGTH]", llformat("%.1f", loaderp->getDuration())); out_str.setArg("[MAX_LENGTH]", llformat("%.1f", MAX_ANIM_DURATION)); childSetValue("bad_animation_text", out_str.getString()); } else { - LLUIString out_str = childGetText("failed_file_read"); + LLUIString out_str = getString("failed_file_read"); out_str.setArg("[STATUS]", loaderp->getStatus()); // *TODO:Translate childSetValue("bad_animation_text", out_str.getString()); } } - mEnabled = FALSE; + setEnabled(FALSE); mMotionID.setNull(); mAnimPreview = NULL; } @@ -334,7 +335,7 @@ LLFloaterAnimPreview::~LLFloaterAnimPreview() delete mAnimPreview; mAnimPreview = NULL; - mEnabled = FALSE; + setEnabled(FALSE); } //----------------------------------------------------------------------------- @@ -349,21 +350,21 @@ void LLFloaterAnimPreview::draw() if (mMotionID.notNull() && mAnimPreview) { - glColor3f(1.f, 1.f, 1.f); + gGL.color3f(1.f, 1.f, 1.f); mAnimPreview->bindTexture(); - glBegin( GL_QUADS ); + gGL.begin( GL_QUADS ); { - glTexCoord2f(0.f, 1.f); - glVertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT); - glTexCoord2f(0.f, 0.f); - glVertex2i(PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD); - glTexCoord2f(1.f, 0.f); - glVertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD); - glTexCoord2f(1.f, 1.f); - glVertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT); + gGL.texCoord2f(0.f, 1.f); + gGL.vertex2i(PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT); + gGL.texCoord2f(0.f, 0.f); + gGL.vertex2i(PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD); + gGL.texCoord2f(1.f, 0.f); + gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_HPAD + PREF_BUTTON_HEIGHT + PREVIEW_HPAD); + gGL.texCoord2f(1.f, 1.f); + gGL.vertex2i(r.getWidth() - PREVIEW_HPAD, PREVIEW_TEXTURE_HEIGHT); } - glEnd(); + gGL.end(); mAnimPreview->unbindTexture(); @@ -507,7 +508,7 @@ void LLFloaterAnimPreview::onMouseCaptureLost() void LLFloaterAnimPreview::onBtnPlay(void* user_data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)user_data; - if (!previewp->mEnabled) return; + if (!previewp->getEnabled()) return; if (previewp->mMotionID.notNull() && previewp->mAnimPreview) { @@ -538,7 +539,7 @@ void LLFloaterAnimPreview::onBtnPlay(void* user_data) void LLFloaterAnimPreview::onBtnStop(void* user_data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)user_data; - if (!previewp->mEnabled) return; + if (!previewp->getEnabled()) return; if (previewp->mMotionID.notNull() && previewp->mAnimPreview) { @@ -563,7 +564,7 @@ void LLFloaterAnimPreview::onBtnStop(void* user_data) void LLFloaterAnimPreview::onSliderMove(LLUICtrl* ctrl, void*user_data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)user_data; - if (!previewp->mEnabled) return; + if (!previewp->getEnabled()) return; if (previewp->mAnimPreview) { @@ -609,7 +610,7 @@ void LLFloaterAnimPreview::onCommitBaseAnim(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->mEnabled) return; + if (!previewp->getEnabled()) return; if (previewp->mAnimPreview) { @@ -639,7 +640,7 @@ void LLFloaterAnimPreview::onCommitLoop(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->mEnabled) return; + if (!previewp->getEnabled()) return; LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); @@ -657,7 +658,7 @@ void LLFloaterAnimPreview::onCommitLoop(LLUICtrl* ctrl, void* data) void LLFloaterAnimPreview::onCommitLoopIn(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->mEnabled) return; + if (!previewp->getEnabled()) return; LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); @@ -677,7 +678,7 @@ void LLFloaterAnimPreview::onCommitLoopIn(LLUICtrl* ctrl, void* data) void LLFloaterAnimPreview::onCommitLoopOut(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->mEnabled) return; + if (!previewp->getEnabled()) return; LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); @@ -697,7 +698,7 @@ void LLFloaterAnimPreview::onCommitLoopOut(LLUICtrl* ctrl, void* data) void LLFloaterAnimPreview::onCommitName(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->mEnabled) return; + if (!previewp->getEnabled()) return; LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); @@ -716,7 +717,7 @@ void LLFloaterAnimPreview::onCommitName(LLUICtrl* ctrl, void* data) void LLFloaterAnimPreview::onCommitHandPose(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->mEnabled) return; + if (!previewp->getEnabled()) return; LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); @@ -731,7 +732,7 @@ void LLFloaterAnimPreview::onCommitHandPose(LLUICtrl* ctrl, void* data) void LLFloaterAnimPreview::onCommitEmote(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->mEnabled) return; + if (!previewp->getEnabled()) return; LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); @@ -746,7 +747,7 @@ void LLFloaterAnimPreview::onCommitEmote(LLUICtrl* ctrl, void* data) void LLFloaterAnimPreview::onCommitPriority(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->mEnabled) return; + if (!previewp->getEnabled()) return; LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); @@ -760,7 +761,7 @@ void LLFloaterAnimPreview::onCommitPriority(LLUICtrl* ctrl, void* data) void LLFloaterAnimPreview::onCommitEaseIn(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->mEnabled) return; + if (!previewp->getEnabled()) return; LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); @@ -775,7 +776,7 @@ void LLFloaterAnimPreview::onCommitEaseIn(LLUICtrl* ctrl, void* data) void LLFloaterAnimPreview::onCommitEaseOut(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->mEnabled) return; + if (!previewp->getEnabled()) return; LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); @@ -791,7 +792,7 @@ BOOL LLFloaterAnimPreview::validateEaseIn(LLUICtrl* spin, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->mEnabled) return FALSE; + if (!previewp->getEnabled()) return FALSE; LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); @@ -812,7 +813,7 @@ BOOL LLFloaterAnimPreview::validateEaseOut(LLUICtrl* spin, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->mEnabled) return FALSE; + if (!previewp->getEnabled()) return FALSE; LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); @@ -833,7 +834,7 @@ BOOL LLFloaterAnimPreview::validateLoopIn(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->mEnabled) return FALSE; + if (!previewp->getEnabled()) return FALSE; F32 loop_in_value = (F32)previewp->childGetValue("loop_in_point").asReal(); F32 loop_out_value = (F32)previewp->childGetValue("loop_out_point").asReal(); @@ -862,7 +863,7 @@ BOOL LLFloaterAnimPreview::validateLoopOut(LLUICtrl* spin, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->mEnabled) return FALSE; + if (!previewp->getEnabled()) return FALSE; F32 loop_out_value = (F32)previewp->childGetValue("loop_out_point").asReal(); F32 loop_in_value = (F32)previewp->childGetValue("loop_in_point").asReal(); @@ -947,7 +948,7 @@ void LLFloaterAnimPreview::refresh() void LLFloaterAnimPreview::onBtnOK(void* userdata) { LLFloaterAnimPreview* floaterp = (LLFloaterAnimPreview*)userdata; - if (!floaterp->mEnabled) return; + if (!floaterp->getEnabled()) return; if (floaterp->mAnimPreview) { @@ -1040,25 +1041,27 @@ BOOL LLPreviewAnimation::render() LLVOAvatar* avatarp = mDummyAvatar; glMatrixMode(GL_PROJECTION); - glPushMatrix(); + gGL.pushMatrix(); glLoadIdentity(); glOrtho(0.0f, mWidth, 0.0f, mHeight, -1.0f, 1.0f); glMatrixMode(GL_MODELVIEW); - glPushMatrix(); + gGL.pushMatrix(); glLoadIdentity(); LLGLSUIDefault def; LLGLSNoTexture gls_no_texture; - glColor4f(0.15f, 0.2f, 0.3f, 1.f); + gGL.color4f(0.15f, 0.2f, 0.3f, 1.f); gl_rect_2d_simple( mWidth, mHeight ); glMatrixMode(GL_PROJECTION); - glPopMatrix(); + gGL.popMatrix(); glMatrixMode(GL_MODELVIEW); - glPopMatrix(); + gGL.popMatrix(); + + gGL.stop(); LLVector3 target_pos = avatarp->mRoot.getWorldPosition(); @@ -1105,7 +1108,8 @@ BOOL LLPreviewAnimation::render() LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)avatarp->mDrawable->getFace(0)->getPool(); avatarPoolp->renderAvatars(avatarp); // renders only one avatar } - + + gGL.start(); return TRUE; } @@ -1153,3 +1157,4 @@ void LLPreviewAnimation::pan(F32 right, F32 up) } + -- cgit v1.1