diff options
Diffstat (limited to 'indra/llcharacter/llcharacter.h')
-rw-r--r-- | indra/llcharacter/llcharacter.h | 96 |
1 files changed, 57 insertions, 39 deletions
diff --git a/indra/llcharacter/llcharacter.h b/indra/llcharacter/llcharacter.h index a5719b0685..a6347fcc3c 100644 --- a/indra/llcharacter/llcharacter.h +++ b/indra/llcharacter/llcharacter.h @@ -2,30 +2,25 @@ * @file llcharacter.h * @brief Implementation of LLCharacter class. * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -41,7 +36,7 @@ #include "llmotioncontroller.h" #include "llvisualparam.h" #include "string_table.h" -#include "llmemory.h" +#include "llpointer.h" #include "llthread.h" class LLPolyMesh; @@ -137,13 +132,16 @@ public: //------------------------------------------------------------------------- // registers a motion with the character // returns true if successfull - BOOL addMotion( const LLUUID& id, LLMotionConstructor create ); + BOOL registerMotion( const LLUUID& id, LLMotionConstructor create ); void removeMotion( const LLUUID& id ); - // returns an instance of a registered motion + // returns an instance of a registered motion, creating one if necessary LLMotion* createMotion( const LLUUID &id ); + // returns an existing instance of a registered motion + LLMotion* findMotion( const LLUUID &id ); + // start a motion // returns true if successful, false if an error occurred virtual BOOL startMotion( const LLUUID& id, F32 start_offset = 0.f); @@ -161,12 +159,16 @@ public: virtual void requestStopMotion( LLMotion* motion ); // periodic update function, steps the motion controller - void updateMotion(BOOL force_update = FALSE); + enum e_update_t { NORMAL_UPDATE, HIDDEN_UPDATE, FORCE_UPDATE }; + void updateMotions(e_update_t update_type); LLAnimPauseRequest requestPause(); - BOOL areAnimationsPaused() { return mMotionController.isPaused(); } + BOOL areAnimationsPaused() const { return mMotionController.isPaused(); } void setAnimTimeFactor(F32 factor) { mMotionController.setTimeFactor(factor); } void setTimeStep(F32 time_step) { mMotionController.setTimeStep(time_step); } + + LLMotionController& getMotionController() { return mMotionController; } + // Releases all motion instances which should result in // no cached references to character joint data. This is // useful if a character wants to rebuild it's skeleton. @@ -195,16 +197,16 @@ public: void addVisualParam(LLVisualParam *param); void addSharedVisualParam(LLVisualParam *param); - BOOL setVisualParamWeight(LLVisualParam *which_param, F32 weight, BOOL set_by_user = FALSE ); - BOOL setVisualParamWeight(const char* param_name, F32 weight, BOOL set_by_user = FALSE ); - BOOL setVisualParamWeight(S32 index, F32 weight, BOOL set_by_user = FALSE ); + virtual BOOL setVisualParamWeight(LLVisualParam *which_param, F32 weight, BOOL upload_bake = FALSE ); + virtual BOOL setVisualParamWeight(const char* param_name, F32 weight, BOOL upload_bake = FALSE ); + virtual BOOL setVisualParamWeight(S32 index, F32 weight, BOOL upload_bake = FALSE ); // get visual param weight by param or name F32 getVisualParamWeight(LLVisualParam *distortion); F32 getVisualParamWeight(const char* param_name); F32 getVisualParamWeight(S32 index); - // set all morph weights to 0 + // set all morph weights to defaults void clearVisualParamWeights(); // visual parameter accessors @@ -220,14 +222,29 @@ public: return (mCurIterator++)->second; } - LLVisualParam* getVisualParam(S32 id) + S32 getVisualParamCountInGroup(const EVisualParamGroup group) const { - VisualParamIndexMap_t::iterator iter = mVisualParamIndexMap.find(id); + S32 rtn = 0; + for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); + iter != mVisualParamIndexMap.end(); + /**/ ) + { + if ((iter++)->second->getGroup() == group) + { + ++rtn; + } + } + return rtn; + } + + LLVisualParam* getVisualParam(S32 id) const + { + visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.find(id); return (iter == mVisualParamIndexMap.end()) ? 0 : iter->second; } S32 getVisualParamID(LLVisualParam *id) { - VisualParamIndexMap_t::iterator iter; + visual_param_index_map_t::iterator iter; for (iter = mVisualParamIndexMap.begin(); iter != mVisualParamIndexMap.end(); iter++) { if (iter->second == id) @@ -235,11 +252,11 @@ public: } return 0; } - S32 getVisualParamCount() { return (S32)mVisualParamIndexMap.size(); } + S32 getVisualParamCount() const { return (S32)mVisualParamIndexMap.size(); } LLVisualParam* getVisualParam(const char *name); - ESex getSex() { return mSex; } + ESex getSex() const { return mSex; } void setSex( ESex sex ) { mSex = sex; } U32 getAppearanceSerialNum() const { return mAppearanceSerialNum; } @@ -265,11 +282,12 @@ protected: private: // visual parameter stuff - typedef std::map<S32, LLVisualParam *> VisualParamIndexMap_t; - VisualParamIndexMap_t mVisualParamIndexMap; - VisualParamIndexMap_t::iterator mCurIterator; - typedef std::map<char *, LLVisualParam *> VisualParamNameMap_t; - VisualParamNameMap_t mVisualParamNameMap; + typedef std::map<S32, LLVisualParam *> visual_param_index_map_t; + typedef std::map<char *, LLVisualParam *> visual_param_name_map_t; + + visual_param_index_map_t::iterator mCurIterator; + visual_param_index_map_t mVisualParamIndexMap; + visual_param_name_map_t mVisualParamNameMap; static LLStringTable sVisualParamNames; }; |