Compare commits
16 Commits
1.7.3
...
SunshineRe
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
69e0738096 | ||
|
|
0b31537bfe | ||
|
|
776a977824 | ||
|
|
5cf091b8b2 | ||
|
|
bea4bc6a1a | ||
|
|
9596514c79 | ||
|
|
5ada2d4b6f | ||
|
|
dd15b9234f | ||
|
|
d03d145be4 | ||
|
|
1083d7e0ef | ||
|
|
cdaa4b4e99 | ||
|
|
295fcb53b0 | ||
|
|
389c35e08e | ||
|
|
003aa6a4eb | ||
|
|
f9d205b869 | ||
|
|
e08afcb963 |
@@ -48,6 +48,7 @@ add_custom_target(prepare DEPENDS ${prepare_depends})
|
|||||||
add_subdirectory(cmake)
|
add_subdirectory(cmake)
|
||||||
add_subdirectory(${LIBS_OPEN_PREFIX}aistatemachine)
|
add_subdirectory(${LIBS_OPEN_PREFIX}aistatemachine)
|
||||||
add_subdirectory(${LIBS_OPEN_PREFIX}llaudio)
|
add_subdirectory(${LIBS_OPEN_PREFIX}llaudio)
|
||||||
|
add_subdirectory(${LIBS_OPEN_PREFIX}llappearance)
|
||||||
add_subdirectory(${LIBS_OPEN_PREFIX}llcharacter)
|
add_subdirectory(${LIBS_OPEN_PREFIX}llcharacter)
|
||||||
add_subdirectory(${LIBS_OPEN_PREFIX}llcommon)
|
add_subdirectory(${LIBS_OPEN_PREFIX}llcommon)
|
||||||
add_subdirectory(${LIBS_OPEN_PREFIX}llimage)
|
add_subdirectory(${LIBS_OPEN_PREFIX}llimage)
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ set(cmake_SOURCE_FILES
|
|||||||
Hunspell.cmake
|
Hunspell.cmake
|
||||||
JPEG.cmake
|
JPEG.cmake
|
||||||
LLAddBuildTest.cmake
|
LLAddBuildTest.cmake
|
||||||
|
LLAppearance.cmake
|
||||||
LLAudio.cmake
|
LLAudio.cmake
|
||||||
LLCharacter.cmake
|
LLCharacter.cmake
|
||||||
LLCommon.cmake
|
LLCommon.cmake
|
||||||
|
|||||||
11
indra/cmake/LLAppearance.cmake
Normal file
11
indra/cmake/LLAppearance.cmake
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# -*- cmake -*-
|
||||||
|
|
||||||
|
include(Variables)
|
||||||
|
|
||||||
|
set(LLAPPEARANCE_INCLUDE_DIRS
|
||||||
|
${LIBS_OPEN_DIR}/llappearance
|
||||||
|
)
|
||||||
|
|
||||||
|
set(LLAPPEARANCE_LIBRARIES llappearance)
|
||||||
|
|
||||||
|
|
||||||
89
indra/llappearance/CMakeLists.txt
Normal file
89
indra/llappearance/CMakeLists.txt
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
# -*- cmake -*-
|
||||||
|
|
||||||
|
project(llappearance)
|
||||||
|
|
||||||
|
include(00-Common)
|
||||||
|
include(LLCommon)
|
||||||
|
include(LLCharacter)
|
||||||
|
include(LLImage)
|
||||||
|
include(LLInventory)
|
||||||
|
include(LLMath)
|
||||||
|
include(LLMessage)
|
||||||
|
include(LLRender)
|
||||||
|
include(LLVFS)
|
||||||
|
include(LLWindow)
|
||||||
|
include(LLXML)
|
||||||
|
include(Linking)
|
||||||
|
|
||||||
|
include_directories(
|
||||||
|
${LLCOMMON_INCLUDE_DIRS}
|
||||||
|
${LLCHARACTER_INCLUDE_DIRS}
|
||||||
|
${LLIMAGE_INCLUDE_DIRS}
|
||||||
|
${LLINVENTORY_INCLUDE_DIRS}
|
||||||
|
${LLMATH_INCLUDE_DIRS}
|
||||||
|
${LLRENDER_INCLUDE_DIRS}
|
||||||
|
${LLVFS_INCLUDE_DIRS}
|
||||||
|
${LLWINDOW_INCLUDE_DIRS}
|
||||||
|
${LLXML_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
set(llappearance_SOURCE_FILES
|
||||||
|
llavatarappearance.cpp
|
||||||
|
llavatarjoint.cpp
|
||||||
|
llavatarjointmesh.cpp
|
||||||
|
lldriverparam.cpp
|
||||||
|
lllocaltextureobject.cpp
|
||||||
|
llpolyskeletaldistortion.cpp
|
||||||
|
llpolymesh.cpp
|
||||||
|
llpolymorph.cpp
|
||||||
|
lltexglobalcolor.cpp
|
||||||
|
lltexlayer.cpp
|
||||||
|
lltexlayerparams.cpp
|
||||||
|
lltexturemanagerbridge.cpp
|
||||||
|
llwearable.cpp
|
||||||
|
llwearabledata.cpp
|
||||||
|
llwearabletype.cpp
|
||||||
|
llviewervisualparam.cpp
|
||||||
|
llavatarappearancedefines.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
set(llappearance_HEADER_FILES
|
||||||
|
CMakeLists.txt
|
||||||
|
|
||||||
|
llavatarappearance.h
|
||||||
|
llavatarjoint.h
|
||||||
|
llavatarjointmesh.h
|
||||||
|
lldriverparam.h
|
||||||
|
lljointpickname.h
|
||||||
|
lllocaltextureobject.h
|
||||||
|
llpolyskeletaldistortion.h
|
||||||
|
llpolymesh.h
|
||||||
|
llpolymorph.h
|
||||||
|
lltexglobalcolor.h
|
||||||
|
lltexlayer.h
|
||||||
|
lltexlayerparams.h
|
||||||
|
lltexturemanagerbridge.h
|
||||||
|
llwearable.h
|
||||||
|
llwearabledata.h
|
||||||
|
llwearabletype.h
|
||||||
|
llviewervisualparam.h
|
||||||
|
llavatarappearancedefines.h
|
||||||
|
)
|
||||||
|
|
||||||
|
set_source_files_properties(${llappearance_HEADER_FILES}
|
||||||
|
PROPERTIES HEADER_FILE_ONLY TRUE)
|
||||||
|
|
||||||
|
list(APPEND llappearance_SOURCE_FILES ${llappearance_HEADER_FILES})
|
||||||
|
|
||||||
|
add_library (llappearance ${llappearance_SOURCE_FILES})
|
||||||
|
|
||||||
|
target_link_libraries(llappearance
|
||||||
|
${LLCHARACTER_LIBRARIES}
|
||||||
|
${LLINVENTORY_LIBRARIES}
|
||||||
|
${LLIMAGE_LIBRARIES}
|
||||||
|
${LLRENDER_LIBRARIES}
|
||||||
|
${LLVFS_LIBRARIES}
|
||||||
|
${LLMATH_LIBRARIES}
|
||||||
|
${LLXML_LIBRARIES}
|
||||||
|
${LLCOMMON_LIBRARIES}
|
||||||
|
)
|
||||||
2020
indra/llappearance/llavatarappearance.cpp
Normal file
2020
indra/llappearance/llavatarappearance.cpp
Normal file
File diff suppressed because it is too large
Load Diff
454
indra/llappearance/llavatarappearance.h
Normal file
454
indra/llappearance/llavatarappearance.h
Normal file
@@ -0,0 +1,454 @@
|
|||||||
|
/**
|
||||||
|
* @file llavatarappearance.h
|
||||||
|
* @brief Declaration of LLAvatarAppearance class
|
||||||
|
*
|
||||||
|
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||||
|
* Second Life Viewer Source Code
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
|
* $/LicenseInfo$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LL_AVATAR_APPEARANCE_H
|
||||||
|
#define LL_AVATAR_APPEARANCE_H
|
||||||
|
|
||||||
|
#include "llcharacter.h"
|
||||||
|
#include "llavatarappearancedefines.h"
|
||||||
|
#include "llavatarjointmesh.h"
|
||||||
|
#include "lldriverparam.h"
|
||||||
|
#include "lltexlayer.h"
|
||||||
|
#include "llviewervisualparam.h"
|
||||||
|
#include "llxmltree.h"
|
||||||
|
|
||||||
|
class LLTexLayerSet;
|
||||||
|
class LLTexGlobalColor;
|
||||||
|
class LLTexGlobalColorInfo;
|
||||||
|
class LLWearableData;
|
||||||
|
class LLAvatarBoneInfo;
|
||||||
|
class LLAvatarSkeletonInfo;
|
||||||
|
|
||||||
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
// LLAvatarAppearance
|
||||||
|
//
|
||||||
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
class LLAvatarAppearance : public LLCharacter
|
||||||
|
{
|
||||||
|
LOG_CLASS(LLAvatarAppearance);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
struct LLAvatarXmlInfo;
|
||||||
|
|
||||||
|
/********************************************************************************
|
||||||
|
** **
|
||||||
|
** INITIALIZATION
|
||||||
|
**/
|
||||||
|
private:
|
||||||
|
// Hide default constructor.
|
||||||
|
LLAvatarAppearance() {}
|
||||||
|
|
||||||
|
public:
|
||||||
|
LLAvatarAppearance(LLWearableData* wearable_data);
|
||||||
|
virtual ~LLAvatarAppearance();
|
||||||
|
|
||||||
|
static void initClass(); // initializes static members
|
||||||
|
static void cleanupClass(); // Cleanup data that's only init'd once per class.
|
||||||
|
virtual void initInstance(); // Called after construction to initialize the instance.
|
||||||
|
virtual BOOL loadSkeletonNode();
|
||||||
|
BOOL loadMeshNodes();
|
||||||
|
BOOL loadLayersets();
|
||||||
|
|
||||||
|
|
||||||
|
/** Initialization
|
||||||
|
** **
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/********************************************************************************
|
||||||
|
** **
|
||||||
|
** INHERITED
|
||||||
|
**/
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// LLCharacter interface and related
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
public:
|
||||||
|
/*virtual*/ LLJoint* getCharacterJoint(U32 num);
|
||||||
|
|
||||||
|
/*virtual*/ const char* getAnimationPrefix() { return "avatar"; }
|
||||||
|
/*virtual*/ LLVector3 getVolumePos(S32 joint_index, LLVector3& volume_offset);
|
||||||
|
/*virtual*/ LLJoint* findCollisionVolume(U32 volume_id);
|
||||||
|
/*virtual*/ S32 getCollisionVolumeID(std::string &name);
|
||||||
|
/*virtual*/ LLPolyMesh* getHeadMesh();
|
||||||
|
/*virtual*/ LLPolyMesh* getUpperBodyMesh();
|
||||||
|
LLPolyMesh* getMesh( LLPolyMeshSharedData *shared_data );
|
||||||
|
|
||||||
|
typedef std::map<S32, std::string> lod_mesh_map_t;
|
||||||
|
typedef std::map<std::string, lod_mesh_map_t> mesh_info_t;
|
||||||
|
static void getMeshInfo(mesh_info_t* mesh_info);
|
||||||
|
|
||||||
|
/** Inherited
|
||||||
|
** **
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/********************************************************************************
|
||||||
|
** **
|
||||||
|
** STATE
|
||||||
|
**/
|
||||||
|
public:
|
||||||
|
virtual bool isSelf() const { return false; } // True if this avatar is for this viewer's agent
|
||||||
|
virtual BOOL isValid() const;
|
||||||
|
//virtual BOOL isUsingServerBakes() const = 0;
|
||||||
|
//virtual BOOL isUsingLocalAppearance() const = 0;
|
||||||
|
//virtual BOOL isEditingAppearance() const = 0;
|
||||||
|
BOOL isUsingLocalAppearance() const {return isEditingAppearance();}
|
||||||
|
virtual BOOL isEditingAppearance() const {return FALSE;}
|
||||||
|
|
||||||
|
bool isBuilt() const { return mIsBuilt; }
|
||||||
|
|
||||||
|
virtual std::string getFullname() const = 0;
|
||||||
|
/** State
|
||||||
|
** **
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/********************************************************************************
|
||||||
|
** **
|
||||||
|
** SKELETON
|
||||||
|
**/
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual LLAvatarJoint* createAvatarJoint() = 0;
|
||||||
|
virtual LLAvatarJoint* createAvatarJoint(S32 joint_num) = 0;
|
||||||
|
virtual LLAvatarJointMesh* createAvatarJointMesh() = 0;
|
||||||
|
public:
|
||||||
|
F32 getPelvisToFoot() const { return mPelvisToFoot; }
|
||||||
|
/*virtual*/ LLJoint* getRootJoint() { return mRoot; }
|
||||||
|
|
||||||
|
LLVector3 mHeadOffset; // current head position
|
||||||
|
LLAvatarJoint *mRoot;
|
||||||
|
|
||||||
|
typedef std::map<std::string, LLJoint*> joint_map_t;
|
||||||
|
joint_map_t mJointMap;
|
||||||
|
|
||||||
|
void computeBodySize();
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
static BOOL parseSkeletonFile(const std::string& filename);
|
||||||
|
virtual void buildCharacter();
|
||||||
|
virtual BOOL loadAvatar();
|
||||||
|
virtual void bodySizeChanged() = 0;
|
||||||
|
|
||||||
|
BOOL setupBone(const LLAvatarBoneInfo* info, LLJoint* parent, S32 ¤t_volume_num, S32 ¤t_joint_num);
|
||||||
|
BOOL allocateCharacterJoints(U32 num);
|
||||||
|
BOOL buildSkeleton(const LLAvatarSkeletonInfo *info);
|
||||||
|
protected:
|
||||||
|
void clearSkeleton();
|
||||||
|
BOOL mIsBuilt; // state of deferred character building
|
||||||
|
typedef std::vector<LLAvatarJoint*> avatar_joint_list_t;
|
||||||
|
avatar_joint_list_t mSkeleton;
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// Pelvis height adjustment members.
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
public:
|
||||||
|
LLVector3 mBodySize;
|
||||||
|
protected:
|
||||||
|
F32 mPelvisToFoot;
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// Cached pointers to well known joints
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
public:
|
||||||
|
LLJoint* mPelvisp;
|
||||||
|
LLJoint* mTorsop;
|
||||||
|
LLJoint* mChestp;
|
||||||
|
LLJoint* mNeckp;
|
||||||
|
LLJoint* mHeadp;
|
||||||
|
LLJoint* mSkullp;
|
||||||
|
LLJoint* mEyeLeftp;
|
||||||
|
LLJoint* mEyeRightp;
|
||||||
|
LLJoint* mHipLeftp;
|
||||||
|
LLJoint* mHipRightp;
|
||||||
|
LLJoint* mKneeLeftp;
|
||||||
|
LLJoint* mKneeRightp;
|
||||||
|
LLJoint* mAnkleLeftp;
|
||||||
|
LLJoint* mAnkleRightp;
|
||||||
|
LLJoint* mFootLeftp;
|
||||||
|
LLJoint* mFootRightp;
|
||||||
|
LLJoint* mWristLeftp;
|
||||||
|
LLJoint* mWristRightp;
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// XML parse tree
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
protected:
|
||||||
|
static LLXmlTree sXMLTree; // avatar config file
|
||||||
|
static LLXmlTree sSkeletonXMLTree; // avatar skeleton file
|
||||||
|
|
||||||
|
static LLAvatarSkeletonInfo* sAvatarSkeletonInfo;
|
||||||
|
static LLAvatarXmlInfo* sAvatarXmlInfo;
|
||||||
|
|
||||||
|
|
||||||
|
/** Skeleton
|
||||||
|
** **
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/********************************************************************************
|
||||||
|
** **
|
||||||
|
** RENDERING
|
||||||
|
**/
|
||||||
|
public:
|
||||||
|
BOOL mIsDummy; // for special views
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// Morph masks
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
public:
|
||||||
|
void addMaskedMorph(LLAvatarAppearanceDefines::EBakedTextureIndex index, LLVisualParam* morph_target, BOOL invert, std::string layer);
|
||||||
|
virtual void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components, LLAvatarAppearanceDefines::EBakedTextureIndex index = LLAvatarAppearanceDefines::BAKED_NUM_INDICES) = 0;
|
||||||
|
|
||||||
|
/** Rendering
|
||||||
|
** **
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// Composites
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
public:
|
||||||
|
virtual void invalidateComposite(LLTexLayerSet* layerset, BOOL upload_result) = 0;
|
||||||
|
|
||||||
|
/********************************************************************************
|
||||||
|
** **
|
||||||
|
** MESHES
|
||||||
|
**/
|
||||||
|
|
||||||
|
public:
|
||||||
|
virtual void updateMeshTextures() = 0;
|
||||||
|
virtual void dirtyMesh() = 0; // Dirty the avatar mesh
|
||||||
|
protected:
|
||||||
|
virtual void dirtyMesh(S32 priority) = 0; // Dirty the avatar mesh, with priority
|
||||||
|
|
||||||
|
protected:
|
||||||
|
typedef std::multimap<std::string, LLPolyMesh*> polymesh_map_t;
|
||||||
|
polymesh_map_t mPolyMeshes;
|
||||||
|
avatar_joint_list_t mMeshLOD;
|
||||||
|
|
||||||
|
/** Meshes
|
||||||
|
** **
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/********************************************************************************
|
||||||
|
** **
|
||||||
|
** APPEARANCE
|
||||||
|
**/
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// Clothing colors (convenience functions to access visual parameters)
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
public:
|
||||||
|
void setClothesColor(LLAvatarAppearanceDefines::ETextureIndex te, const LLColor4& new_color, BOOL upload_bake);
|
||||||
|
LLColor4 getClothesColor(LLAvatarAppearanceDefines::ETextureIndex te);
|
||||||
|
static BOOL teToColorParams(LLAvatarAppearanceDefines::ETextureIndex te, U32 *param_name);
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// Global colors
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
public:
|
||||||
|
LLColor4 getGlobalColor(const std::string& color_name ) const;
|
||||||
|
virtual void onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL upload_bake) = 0;
|
||||||
|
protected:
|
||||||
|
LLTexGlobalColor* mTexSkinColor;
|
||||||
|
LLTexGlobalColor* mTexHairColor;
|
||||||
|
LLTexGlobalColor* mTexEyeColor;
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// Visibility
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
public:
|
||||||
|
static LLColor4 getDummyColor();
|
||||||
|
/** Appearance
|
||||||
|
** **
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/********************************************************************************
|
||||||
|
** **
|
||||||
|
** WEARABLES
|
||||||
|
**/
|
||||||
|
|
||||||
|
public:
|
||||||
|
LLWearableData* getWearableData() { return mWearableData; }
|
||||||
|
const LLWearableData* getWearableData() const { return mWearableData; }
|
||||||
|
virtual BOOL isTextureDefined(LLAvatarAppearanceDefines::ETextureIndex te, U32 index = 0 ) const = 0;
|
||||||
|
virtual BOOL isWearingWearableType(LLWearableType::EType type ) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
LLWearableData* mWearableData;
|
||||||
|
|
||||||
|
/********************************************************************************
|
||||||
|
** **
|
||||||
|
** BAKED TEXTURES
|
||||||
|
**/
|
||||||
|
public:
|
||||||
|
LLTexLayerSet* getAvatarLayerSet(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual LLTexLayerSet* createTexLayerSet() = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
class LLMaskedMorph;
|
||||||
|
typedef std::deque<LLMaskedMorph *> morph_list_t;
|
||||||
|
struct BakedTextureData
|
||||||
|
{
|
||||||
|
LLUUID mLastTextureID;
|
||||||
|
LLTexLayerSet* mTexLayerSet; // Only exists for self
|
||||||
|
bool mIsLoaded;
|
||||||
|
bool mIsUsed;
|
||||||
|
LLAvatarAppearanceDefines::ETextureIndex mTextureIndex;
|
||||||
|
U32 mMaskTexName;
|
||||||
|
// Stores pointers to the joint meshes that this baked texture deals with
|
||||||
|
avatar_joint_mesh_list_t mJointMeshes;
|
||||||
|
morph_list_t mMaskedMorphs;
|
||||||
|
};
|
||||||
|
typedef std::vector<BakedTextureData> bakedtexturedata_vec_t;
|
||||||
|
bakedtexturedata_vec_t mBakedTextureDatas;
|
||||||
|
|
||||||
|
/********************************************************************************
|
||||||
|
** **
|
||||||
|
** PHYSICS
|
||||||
|
**/
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// Collision volumes
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
public:
|
||||||
|
S32 mNumCollisionVolumes;
|
||||||
|
LLAvatarJointCollisionVolume* mCollisionVolumes;
|
||||||
|
protected:
|
||||||
|
BOOL allocateCollisionVolumes(U32 num);
|
||||||
|
|
||||||
|
/** Physics
|
||||||
|
** **
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
/********************************************************************************
|
||||||
|
** **
|
||||||
|
** SUPPORT CLASSES
|
||||||
|
**/
|
||||||
|
|
||||||
|
struct LLAvatarXmlInfo
|
||||||
|
{
|
||||||
|
LLAvatarXmlInfo();
|
||||||
|
~LLAvatarXmlInfo();
|
||||||
|
|
||||||
|
BOOL parseXmlSkeletonNode(LLXmlTreeNode* root);
|
||||||
|
BOOL parseXmlMeshNodes(LLXmlTreeNode* root);
|
||||||
|
BOOL parseXmlColorNodes(LLXmlTreeNode* root);
|
||||||
|
BOOL parseXmlLayerNodes(LLXmlTreeNode* root);
|
||||||
|
BOOL parseXmlDriverNodes(LLXmlTreeNode* root);
|
||||||
|
BOOL parseXmlMorphNodes(LLXmlTreeNode* root);
|
||||||
|
|
||||||
|
struct LLAvatarMeshInfo
|
||||||
|
{
|
||||||
|
typedef std::pair<LLViewerVisualParamInfo*,BOOL> morph_info_pair_t; // LLPolyMorphTargetInfo stored here
|
||||||
|
typedef std::vector<morph_info_pair_t> morph_info_list_t;
|
||||||
|
|
||||||
|
LLAvatarMeshInfo() : mLOD(0), mMinPixelArea(.1f) {}
|
||||||
|
~LLAvatarMeshInfo()
|
||||||
|
{
|
||||||
|
morph_info_list_t::iterator iter;
|
||||||
|
for (iter = mPolyMorphTargetInfoList.begin(); iter != mPolyMorphTargetInfoList.end(); iter++)
|
||||||
|
{
|
||||||
|
delete iter->first;
|
||||||
|
}
|
||||||
|
mPolyMorphTargetInfoList.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string mType;
|
||||||
|
S32 mLOD;
|
||||||
|
std::string mMeshFileName;
|
||||||
|
std::string mReferenceMeshName;
|
||||||
|
F32 mMinPixelArea;
|
||||||
|
morph_info_list_t mPolyMorphTargetInfoList;
|
||||||
|
};
|
||||||
|
typedef std::vector<LLAvatarMeshInfo*> mesh_info_list_t;
|
||||||
|
mesh_info_list_t mMeshInfoList;
|
||||||
|
|
||||||
|
typedef std::vector<LLViewerVisualParamInfo*> skeletal_distortion_info_list_t; // LLPolySkeletalDistortionInfo stored here
|
||||||
|
skeletal_distortion_info_list_t mSkeletalDistortionInfoList;
|
||||||
|
|
||||||
|
struct LLAvatarAttachmentInfo
|
||||||
|
{
|
||||||
|
LLAvatarAttachmentInfo()
|
||||||
|
: mGroup(-1), mAttachmentID(-1), mPieMenuSlice(-1), mVisibleFirstPerson(FALSE),
|
||||||
|
mIsHUDAttachment(FALSE), mHasPosition(FALSE), mHasRotation(FALSE) {}
|
||||||
|
std::string mName;
|
||||||
|
std::string mJointName;
|
||||||
|
LLVector3 mPosition;
|
||||||
|
LLVector3 mRotationEuler;
|
||||||
|
S32 mGroup;
|
||||||
|
S32 mAttachmentID;
|
||||||
|
S32 mPieMenuSlice;
|
||||||
|
BOOL mVisibleFirstPerson;
|
||||||
|
BOOL mIsHUDAttachment;
|
||||||
|
BOOL mHasPosition;
|
||||||
|
BOOL mHasRotation;
|
||||||
|
};
|
||||||
|
typedef std::vector<LLAvatarAttachmentInfo*> attachment_info_list_t;
|
||||||
|
attachment_info_list_t mAttachmentInfoList;
|
||||||
|
|
||||||
|
LLTexGlobalColorInfo *mTexSkinColorInfo;
|
||||||
|
LLTexGlobalColorInfo *mTexHairColorInfo;
|
||||||
|
LLTexGlobalColorInfo *mTexEyeColorInfo;
|
||||||
|
|
||||||
|
typedef std::vector<LLTexLayerSetInfo*> layer_info_list_t;
|
||||||
|
layer_info_list_t mLayerInfoList;
|
||||||
|
|
||||||
|
typedef std::vector<LLDriverParamInfo*> driver_info_list_t;
|
||||||
|
driver_info_list_t mDriverInfoList;
|
||||||
|
|
||||||
|
struct LLAvatarMorphInfo
|
||||||
|
{
|
||||||
|
LLAvatarMorphInfo()
|
||||||
|
: mInvert(FALSE) {}
|
||||||
|
std::string mName;
|
||||||
|
std::string mRegion;
|
||||||
|
std::string mLayer;
|
||||||
|
BOOL mInvert;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef std::vector<LLAvatarMorphInfo*> morph_info_list_t;
|
||||||
|
morph_info_list_t mMorphMaskInfoList;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class LLMaskedMorph
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LLMaskedMorph(LLVisualParam *morph_target, BOOL invert, std::string layer);
|
||||||
|
|
||||||
|
LLVisualParam *mMorphTarget;
|
||||||
|
BOOL mInvert;
|
||||||
|
std::string mLayer;
|
||||||
|
};
|
||||||
|
/** Support Classes
|
||||||
|
** **
|
||||||
|
*******************************************************************************/
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // LL_AVATAR_APPEARANCE_H
|
||||||
@@ -1,51 +1,43 @@
|
|||||||
/**
|
/**
|
||||||
* @file llvoavatar.cpp
|
* @file llavatarappearancedefines.cpp
|
||||||
* @brief Implementation of LLVOAvatar class which is a derivation fo LLViewerObject
|
* @brief Implementation of LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary
|
||||||
*
|
|
||||||
* $LicenseInfo:firstyear=2001&license=viewergpl$
|
|
||||||
*
|
|
||||||
* Copyright (c) 2001-2009, Linden Research, Inc.
|
|
||||||
*
|
*
|
||||||
|
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||||
* Second Life Viewer Source Code
|
* Second Life Viewer Source Code
|
||||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
* Copyright (C) 2010, Linden Research, Inc.
|
||||||
* 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://secondlifegrid.net/programs/open_source/licensing/gplv2
|
|
||||||
*
|
*
|
||||||
* There are special exceptions to the terms and conditions of the GPL as
|
* This library is free software; you can redistribute it and/or
|
||||||
* it is applied to this Source Code. View the full text of the exception
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
* License as published by the Free Software Foundation;
|
||||||
* online at
|
* version 2.1 of the License only.
|
||||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
|
||||||
*
|
*
|
||||||
* By copying, modifying or distributing this software, you acknowledge
|
* This library is distributed in the hope that it will be useful,
|
||||||
* that you have read and understood your obligations described above,
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* and agree to abide by those obligations.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
* License along with this library; if not, write to the Free Software
|
||||||
* COMPLETENESS OR PERFORMANCE.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
* $/LicenseInfo$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "llviewerprecompiledheaders.h"
|
#include "linden_common.h"
|
||||||
#include "llvoavatardefines.h"
|
#include "llavatarappearancedefines.h"
|
||||||
#include "llviewercontrol.h" // gSavedSettings
|
|
||||||
|
|
||||||
const S32 LLVOAvatarDefines::SCRATCH_TEX_WIDTH = 512;
|
const S32 LLAvatarAppearanceDefines::SCRATCH_TEX_WIDTH = 512;
|
||||||
const S32 LLVOAvatarDefines::SCRATCH_TEX_HEIGHT = 512;
|
const S32 LLAvatarAppearanceDefines::SCRATCH_TEX_HEIGHT = 512;
|
||||||
const S32 LLVOAvatarDefines::IMPOSTOR_PERIOD = 2;
|
const S32 LLAvatarAppearanceDefines::IMPOSTOR_PERIOD = 2;
|
||||||
|
|
||||||
using namespace LLVOAvatarDefines;
|
using namespace LLAvatarAppearanceDefines;
|
||||||
|
|
||||||
/*********************************************************************************
|
/*********************************************************************************
|
||||||
* Edit this function to add/remove/change textures and mesh definitions for avatars.
|
* Edit this function to add/remove/change textures and mesh definitions for avatars.
|
||||||
* If these are changed, they MUST be changed in floater_avatar_textures.xml as well!
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
LLVOAvatarDictionary::Textures::Textures()
|
LLAvatarAppearanceDictionary::Textures::Textures()
|
||||||
{
|
{
|
||||||
addEntry(TEX_HEAD_BODYPAINT, new TextureEntry("head_bodypaint", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_SKIN));
|
addEntry(TEX_HEAD_BODYPAINT, new TextureEntry("head_bodypaint", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_SKIN));
|
||||||
addEntry(TEX_UPPER_SHIRT, new TextureEntry("upper_shirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultShirtUUID", LLWearableType::WT_SHIRT));
|
addEntry(TEX_UPPER_SHIRT, new TextureEntry("upper_shirt", TRUE, BAKED_NUM_INDICES, "UIImgDefaultShirtUUID", LLWearableType::WT_SHIRT));
|
||||||
@@ -73,15 +65,15 @@ LLVOAvatarDictionary::Textures::Textures()
|
|||||||
addEntry(TEX_UPPER_TATTOO, new TextureEntry("upper_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO));
|
addEntry(TEX_UPPER_TATTOO, new TextureEntry("upper_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO));
|
||||||
addEntry(TEX_LOWER_TATTOO, new TextureEntry("lower_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO));
|
addEntry(TEX_LOWER_TATTOO, new TextureEntry("lower_tattoo", TRUE, BAKED_NUM_INDICES, "", LLWearableType::WT_TATTOO));
|
||||||
|
|
||||||
addEntry(TEX_HEAD_BAKED, new TextureEntry("head-baked", FALSE, BAKED_HEAD));
|
addEntry(TEX_HEAD_BAKED, new TextureEntry("head-baked", FALSE, BAKED_HEAD, "head"));
|
||||||
addEntry(TEX_UPPER_BAKED, new TextureEntry("upper-baked", FALSE, BAKED_UPPER));
|
addEntry(TEX_UPPER_BAKED, new TextureEntry("upper-baked", FALSE, BAKED_UPPER, "upper"));
|
||||||
addEntry(TEX_LOWER_BAKED, new TextureEntry("lower-baked", FALSE, BAKED_LOWER));
|
addEntry(TEX_LOWER_BAKED, new TextureEntry("lower-baked", FALSE, BAKED_LOWER, "lower"));
|
||||||
addEntry(TEX_EYES_BAKED, new TextureEntry("eyes-baked", FALSE, BAKED_EYES));
|
addEntry(TEX_EYES_BAKED, new TextureEntry("eyes-baked", FALSE, BAKED_EYES, "eyes"));
|
||||||
addEntry(TEX_HAIR_BAKED, new TextureEntry("hair-baked", FALSE, BAKED_HAIR));
|
addEntry(TEX_HAIR_BAKED, new TextureEntry("hair-baked", FALSE, BAKED_HAIR, "hair"));
|
||||||
addEntry(TEX_SKIRT_BAKED, new TextureEntry("skirt-baked", FALSE, BAKED_SKIRT));
|
addEntry(TEX_SKIRT_BAKED, new TextureEntry("skirt-baked", FALSE, BAKED_SKIRT, "skirt"));
|
||||||
}
|
}
|
||||||
|
|
||||||
LLVOAvatarDictionary::BakedTextures::BakedTextures()
|
LLAvatarAppearanceDictionary::BakedTextures::BakedTextures()
|
||||||
{
|
{
|
||||||
// Baked textures
|
// Baked textures
|
||||||
addEntry(BAKED_HEAD, new BakedEntry(TEX_HEAD_BAKED,
|
addEntry(BAKED_HEAD, new BakedEntry(TEX_HEAD_BAKED,
|
||||||
@@ -117,36 +109,36 @@ LLVOAvatarDictionary::BakedTextures::BakedTextures()
|
|||||||
2, LLWearableType::WT_HAIR, LLWearableType::WT_ALPHA));
|
2, LLWearableType::WT_HAIR, LLWearableType::WT_ALPHA));
|
||||||
}
|
}
|
||||||
|
|
||||||
LLVOAvatarDictionary::Meshes::Meshes()
|
LLAvatarAppearanceDictionary::MeshEntries::MeshEntries()
|
||||||
{
|
{
|
||||||
// Meshes
|
// MeshEntries
|
||||||
addEntry(MESH_ID_HAIR, new MeshEntry(BAKED_HAIR, "hairMesh", 6, LLViewerJoint::PN_4));
|
addEntry(MESH_ID_HAIR, new MeshEntry(BAKED_HAIR, "hairMesh", 6, PN_4));
|
||||||
addEntry(MESH_ID_HEAD, new MeshEntry(BAKED_HEAD, "headMesh", 5, LLViewerJoint::PN_5));
|
addEntry(MESH_ID_HEAD, new MeshEntry(BAKED_HEAD, "headMesh", 5, PN_5));
|
||||||
addEntry(MESH_ID_EYELASH, new MeshEntry(BAKED_HEAD, "eyelashMesh", 1, LLViewerJoint::PN_0)); // no baked mesh associated currently
|
addEntry(MESH_ID_EYELASH, new MeshEntry(BAKED_HEAD, "eyelashMesh", 1, PN_0)); // no baked mesh associated currently
|
||||||
addEntry(MESH_ID_UPPER_BODY, new MeshEntry(BAKED_UPPER, "upperBodyMesh", 5, LLViewerJoint::PN_1));
|
addEntry(MESH_ID_UPPER_BODY, new MeshEntry(BAKED_UPPER, "upperBodyMesh", 5, PN_1));
|
||||||
addEntry(MESH_ID_LOWER_BODY, new MeshEntry(BAKED_LOWER, "lowerBodyMesh", 5, LLViewerJoint::PN_2));
|
addEntry(MESH_ID_LOWER_BODY, new MeshEntry(BAKED_LOWER, "lowerBodyMesh", 5, PN_2));
|
||||||
addEntry(MESH_ID_EYEBALL_LEFT, new MeshEntry(BAKED_EYES, "eyeBallLeftMesh", 2, LLViewerJoint::PN_3));
|
addEntry(MESH_ID_EYEBALL_LEFT, new MeshEntry(BAKED_EYES, "eyeBallLeftMesh", 2, PN_3));
|
||||||
addEntry(MESH_ID_EYEBALL_RIGHT, new MeshEntry(BAKED_EYES, "eyeBallRightMesh", 2, LLViewerJoint::PN_3));
|
addEntry(MESH_ID_EYEBALL_RIGHT, new MeshEntry(BAKED_EYES, "eyeBallRightMesh", 2, PN_3));
|
||||||
addEntry(MESH_ID_SKIRT, new MeshEntry(BAKED_SKIRT, "skirtMesh", 5, LLViewerJoint::PN_5));
|
addEntry(MESH_ID_SKIRT, new MeshEntry(BAKED_SKIRT, "skirtMesh", 5, PN_5));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*********************************************************************************/
|
*********************************************************************************/
|
||||||
|
|
||||||
LLVOAvatarDictionary::LLVOAvatarDictionary()
|
LLAvatarAppearanceDictionary::LLAvatarAppearanceDictionary()
|
||||||
{
|
{
|
||||||
createAssociations();
|
createAssociations();
|
||||||
}
|
}
|
||||||
|
|
||||||
//virtual
|
//virtual
|
||||||
LLVOAvatarDictionary::~LLVOAvatarDictionary()
|
LLAvatarAppearanceDictionary::~LLAvatarAppearanceDictionary()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// Baked textures are composites of textures; for each such composited texture,
|
// Baked textures are composites of textures; for each such composited texture,
|
||||||
// map it to the baked texture.
|
// map it to the baked texture.
|
||||||
void LLVOAvatarDictionary::createAssociations()
|
void LLAvatarAppearanceDictionary::createAssociations()
|
||||||
{
|
{
|
||||||
for (BakedTextures::const_iterator iter = mBakedTextures.begin(); iter != mBakedTextures.end(); iter++)
|
for (BakedTextures::const_iterator iter = mBakedTextures.begin(); iter != mBakedTextures.end(); iter++)
|
||||||
{
|
{
|
||||||
@@ -167,7 +159,7 @@ void LLVOAvatarDictionary::createAssociations()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LLVOAvatarDictionary::TextureEntry::TextureEntry(const std::string &name,
|
LLAvatarAppearanceDictionary::TextureEntry::TextureEntry(const std::string &name,
|
||||||
bool is_local_texture,
|
bool is_local_texture,
|
||||||
EBakedTextureIndex baked_texture_index,
|
EBakedTextureIndex baked_texture_index,
|
||||||
const std::string &default_image_name,
|
const std::string &default_image_name,
|
||||||
@@ -182,17 +174,17 @@ LLVOAvatarDictionary::TextureEntry::TextureEntry(const std::string &name,
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
LLVOAvatarDictionary::MeshEntry::MeshEntry(EBakedTextureIndex baked_index,
|
LLAvatarAppearanceDictionary::MeshEntry::MeshEntry(EBakedTextureIndex baked_index,
|
||||||
const std::string &name,
|
const std::string &name,
|
||||||
U8 level,
|
U8 level,
|
||||||
LLViewerJoint::PickName pick) :
|
LLJointPickName pick) :
|
||||||
LLDictionaryEntry(name),
|
LLDictionaryEntry(name),
|
||||||
mBakedID(baked_index),
|
mBakedID(baked_index),
|
||||||
mLOD(level),
|
mLOD(level),
|
||||||
mPickName(pick)
|
mPickName(pick)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
LLVOAvatarDictionary::BakedEntry::BakedEntry(ETextureIndex tex_index,
|
LLAvatarAppearanceDictionary::BakedEntry::BakedEntry(ETextureIndex tex_index,
|
||||||
const std::string &name,
|
const std::string &name,
|
||||||
const std::string &hash_name,
|
const std::string &hash_name,
|
||||||
U32 num_local_textures,
|
U32 num_local_textures,
|
||||||
@@ -223,18 +215,18 @@ LLVOAvatarDictionary::BakedEntry::BakedEntry(ETextureIndex tex_index,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
ETextureIndex LLVOAvatarDictionary::bakedToLocalTextureIndex(EBakedTextureIndex index)
|
ETextureIndex LLAvatarAppearanceDictionary::bakedToLocalTextureIndex(EBakedTextureIndex index)
|
||||||
{
|
{
|
||||||
return LLVOAvatarDictionary::getInstance()->getBakedTexture(index)->mTextureIndex;
|
return LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(index)->mTextureIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
EBakedTextureIndex LLVOAvatarDictionary::findBakedByRegionName(std::string name)
|
EBakedTextureIndex LLAvatarAppearanceDictionary::findBakedByRegionName(std::string name)
|
||||||
{
|
{
|
||||||
U8 index = 0;
|
U8 index = 0;
|
||||||
while (index < BAKED_NUM_INDICES)
|
while (index < BAKED_NUM_INDICES)
|
||||||
{
|
{
|
||||||
const BakedEntry *be = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex) index);
|
const BakedEntry *be = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex) index);
|
||||||
if (be && be->mName.compare(name) == 0)
|
if (be && be->mName.compare(name) == 0)
|
||||||
{
|
{
|
||||||
// baked texture found
|
// baked texture found
|
||||||
@@ -247,22 +239,30 @@ EBakedTextureIndex LLVOAvatarDictionary::findBakedByRegionName(std::string name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
const LLUUID LLVOAvatarDictionary::getDefaultTextureImageID(ETextureIndex index)
|
EBakedTextureIndex LLAvatarAppearanceDictionary::findBakedByImageName(std::string name)
|
||||||
{
|
{
|
||||||
const TextureEntry *texture_dict = getInstance()->getTexture(index);
|
U8 index = 0;
|
||||||
const std::string &default_image_name = texture_dict->mDefaultImageName;
|
while (index < BAKED_NUM_INDICES)
|
||||||
if (default_image_name == "")
|
|
||||||
{
|
{
|
||||||
return IMG_DEFAULT_AVATAR;
|
const BakedEntry *be = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture((EBakedTextureIndex) index);
|
||||||
|
if (be)
|
||||||
|
{
|
||||||
|
const TextureEntry *te = LLAvatarAppearanceDictionary::getInstance()->getTexture(be->mTextureIndex);
|
||||||
|
if (te && te->mDefaultImageName.compare(name) == 0)
|
||||||
|
{
|
||||||
|
// baked texture found
|
||||||
|
return (EBakedTextureIndex) index;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
return LLUUID(gSavedSettings.getString(default_image_name));
|
|
||||||
}
|
}
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
// baked texture could not be found
|
||||||
|
return BAKED_NUM_INDICES;
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
LLWearableType::EType LLVOAvatarDictionary::getTEWearableType(ETextureIndex index )
|
LLWearableType::EType LLAvatarAppearanceDictionary::getTEWearableType(ETextureIndex index )
|
||||||
{
|
{
|
||||||
return getInstance()->getTexture(index)->mWearableType;
|
return getInstance()->getTexture(index)->mWearableType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,45 +1,40 @@
|
|||||||
/**
|
/**
|
||||||
* @file llvoavatar.h
|
* @file llavatarappearancedefines.h
|
||||||
* @brief Declaration of LLVOAvatar class which is a derivation fo
|
* @brief Various LLAvatarAppearance related definitions
|
||||||
* LLViewerObject
|
* LLViewerObject
|
||||||
*
|
*
|
||||||
* $LicenseInfo:firstyear=2001&license=viewergpl$
|
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||||
*
|
|
||||||
* Copyright (c) 2001-2009, Linden Research, Inc.
|
|
||||||
*
|
|
||||||
* Second Life Viewer Source Code
|
* Second Life Viewer Source Code
|
||||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
* Copyright (C) 2010, Linden Research, Inc.
|
||||||
* 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://secondlifegrid.net/programs/open_source/licensing/gplv2
|
|
||||||
*
|
*
|
||||||
* There are special exceptions to the terms and conditions of the GPL as
|
* This library is free software; you can redistribute it and/or
|
||||||
* it is applied to this Source Code. View the full text of the exception
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
* License as published by the Free Software Foundation;
|
||||||
* online at
|
* version 2.1 of the License only.
|
||||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
|
||||||
*
|
*
|
||||||
* By copying, modifying or distributing this software, you acknowledge
|
* This library is distributed in the hope that it will be useful,
|
||||||
* that you have read and understood your obligations described above,
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* and agree to abide by those obligations.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
* License along with this library; if not, write to the Free Software
|
||||||
* COMPLETENESS OR PERFORMANCE.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
* $/LicenseInfo$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LLVOAVATAR_DEFINES_H
|
#ifndef LL_AVATARAPPEARANCE_DEFINES_H
|
||||||
#define LLVOAVATAR_DEFINES_H
|
#define LL_AVATARAPPEARANCE_DEFINES_H
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "llwearable.h"
|
#include "lljointpickname.h"
|
||||||
#include "llviewerjoint.h"
|
|
||||||
#include "lldictionary.h"
|
#include "lldictionary.h"
|
||||||
|
#include "llwearabletype.h"
|
||||||
|
#include "lluuid.h"
|
||||||
|
|
||||||
namespace LLVOAvatarDefines
|
namespace LLAvatarAppearanceDefines
|
||||||
{
|
{
|
||||||
|
|
||||||
extern const S32 SCRATCH_TEX_WIDTH;
|
extern const S32 SCRATCH_TEX_WIDTH;
|
||||||
@@ -47,10 +42,11 @@ extern const S32 SCRATCH_TEX_HEIGHT;
|
|||||||
extern const S32 IMPOSTOR_PERIOD;
|
extern const S32 IMPOSTOR_PERIOD;
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
// texture entry assignment
|
// Enums
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
enum ETextureIndex
|
enum ETextureIndex
|
||||||
{
|
{
|
||||||
|
TEX_INVALID = -1,
|
||||||
TEX_HEAD_BODYPAINT = 0,
|
TEX_HEAD_BODYPAINT = 0,
|
||||||
TEX_UPPER_SHIRT,
|
TEX_UPPER_SHIRT,
|
||||||
TEX_LOWER_PANTS,
|
TEX_LOWER_PANTS,
|
||||||
@@ -117,21 +113,21 @@ typedef std::vector<EMeshIndex> mesh_vec_t;
|
|||||||
typedef std::vector<LLWearableType::EType> wearables_vec_t;
|
typedef std::vector<LLWearableType::EType> wearables_vec_t;
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
// LLVOAvatarDictionary
|
// LLAvatarAppearanceDictionary
|
||||||
//
|
//
|
||||||
// Holds dictionary static entries for textures, baked textures, meshes, etc.; i.e.
|
// Holds dictionary static entries for textures, baked textures, meshes, etc.; i.e.
|
||||||
// information that is common to all avatars.
|
// information that is common to all avatars.
|
||||||
//
|
//
|
||||||
// This holds const data - it is initialized once and the contents never change after that.
|
// This holds const data - it is initialized once and the contents never change after that.
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
class LLVOAvatarDictionary : public LLSingleton<LLVOAvatarDictionary>
|
class LLAvatarAppearanceDictionary : public LLSingleton<LLAvatarAppearanceDictionary>
|
||||||
{
|
{
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
// Constructors and Destructors
|
// Constructors and Destructors
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
public:
|
public:
|
||||||
LLVOAvatarDictionary();
|
LLAvatarAppearanceDictionary();
|
||||||
virtual ~LLVOAvatarDictionary();
|
virtual ~LLAvatarAppearanceDictionary();
|
||||||
private:
|
private:
|
||||||
void createAssociations();
|
void createAssociations();
|
||||||
|
|
||||||
@@ -141,7 +137,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
struct TextureEntry : public LLDictionaryEntry
|
struct TextureEntry : public LLDictionaryEntry
|
||||||
{
|
{
|
||||||
TextureEntry(const std::string &name,
|
TextureEntry(const std::string &name, // this must match the xml name used by LLTexLayerInfo::parseXml
|
||||||
bool is_local_texture,
|
bool is_local_texture,
|
||||||
EBakedTextureIndex baked_texture_index = BAKED_NUM_INDICES,
|
EBakedTextureIndex baked_texture_index = BAKED_NUM_INDICES,
|
||||||
const std::string& default_image_name = "",
|
const std::string& default_image_name = "",
|
||||||
@@ -170,22 +166,22 @@ public:
|
|||||||
struct MeshEntry : public LLDictionaryEntry
|
struct MeshEntry : public LLDictionaryEntry
|
||||||
{
|
{
|
||||||
MeshEntry(EBakedTextureIndex baked_index,
|
MeshEntry(EBakedTextureIndex baked_index,
|
||||||
const std::string &name,
|
const std::string &name, // names of mesh types as they are used in avatar_lad.xml
|
||||||
U8 level,
|
U8 level,
|
||||||
LLViewerJoint::PickName pick);
|
LLJointPickName pick);
|
||||||
// Levels of Detail for each mesh. Must match levels of detail present in avatar_lad.xml
|
// Levels of Detail for each mesh. Must match levels of detail present in avatar_lad.xml
|
||||||
// Otherwise meshes will be unable to be found, or levels of detail will be ignored
|
// Otherwise meshes will be unable to be found, or levels of detail will be ignored
|
||||||
const U8 mLOD;
|
const U8 mLOD;
|
||||||
const EBakedTextureIndex mBakedID;
|
const EBakedTextureIndex mBakedID;
|
||||||
const LLViewerJoint::PickName mPickName;
|
const LLJointPickName mPickName;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Meshes : public LLDictionary<EMeshIndex, MeshEntry>
|
struct MeshEntries : public LLDictionary<EMeshIndex, MeshEntry>
|
||||||
{
|
{
|
||||||
Meshes();
|
MeshEntries();
|
||||||
} mMeshes;
|
} mMeshEntries;
|
||||||
const MeshEntry* getMesh(EMeshIndex index) const { return mMeshes.lookup(index); }
|
const MeshEntry* getMeshEntry(EMeshIndex index) const { return mMeshEntries.lookup(index); }
|
||||||
const Meshes& getMeshes() const { return mMeshes; }
|
const MeshEntries& getMeshEntries() const { return mMeshEntries; }
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
// Baked Textures
|
// Baked Textures
|
||||||
@@ -221,14 +217,13 @@ public:
|
|||||||
|
|
||||||
// find a baked texture index based on its name
|
// find a baked texture index based on its name
|
||||||
static EBakedTextureIndex findBakedByRegionName(std::string name);
|
static EBakedTextureIndex findBakedByRegionName(std::string name);
|
||||||
|
static EBakedTextureIndex findBakedByImageName(std::string name);
|
||||||
static const LLUUID getDefaultTextureImageID(ETextureIndex index);
|
|
||||||
|
|
||||||
// Given a texture entry, determine which wearable type owns it.
|
// Given a texture entry, determine which wearable type owns it.
|
||||||
static LLWearableType::EType getTEWearableType(ETextureIndex index);
|
static LLWearableType::EType getTEWearableType(ETextureIndex index);
|
||||||
|
|
||||||
}; // End LLVOAvatarDictionary
|
}; // End LLAvatarAppearanceDictionary
|
||||||
|
|
||||||
} // End namespace LLVOAvatarDefines
|
} // End namespace LLAvatarAppearanceDefines
|
||||||
|
|
||||||
#endif
|
#endif //LL_AVATARAPPEARANCE_DEFINES_H
|
||||||
326
indra/llappearance/llavatarjoint.cpp
Normal file
326
indra/llappearance/llavatarjoint.cpp
Normal file
@@ -0,0 +1,326 @@
|
|||||||
|
/**
|
||||||
|
* @file llavatarjoint.cpp
|
||||||
|
* @brief Implementation of LLAvatarJoint class
|
||||||
|
*
|
||||||
|
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||||
|
* Second Life Viewer Source Code
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
|
* $/LicenseInfo$
|
||||||
|
*/
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Header Files
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
#include "llavatarjoint.h"
|
||||||
|
|
||||||
|
#include "llgl.h"
|
||||||
|
#include "llrender.h"
|
||||||
|
#include "llmath.h"
|
||||||
|
#include "llglheaders.h"
|
||||||
|
#include "llavatarappearance.h"
|
||||||
|
|
||||||
|
const F32 DEFAULT_AVATAR_JOINT_LOD = 0.0f;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Static Data
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
BOOL LLAvatarJoint::sDisableLOD = FALSE;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// LLAvatarJoint()
|
||||||
|
// Class Constructors
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
LLAvatarJoint::LLAvatarJoint() :
|
||||||
|
LLJoint()
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
LLAvatarJoint::LLAvatarJoint(const std::string &name, LLJoint *parent) :
|
||||||
|
LLJoint(name, parent)
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
LLAvatarJoint::LLAvatarJoint(S32 joint_num) :
|
||||||
|
LLJoint(joint_num)
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LLAvatarJoint::init()
|
||||||
|
{
|
||||||
|
mValid = FALSE;
|
||||||
|
mComponents = SC_JOINT | SC_BONE | SC_AXES;
|
||||||
|
mMinPixelArea = DEFAULT_AVATAR_JOINT_LOD;
|
||||||
|
mPickName = PN_DEFAULT;
|
||||||
|
mVisible = TRUE;
|
||||||
|
mMeshID = 0;
|
||||||
|
mIsTransparent = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// ~LLAvatarJoint()
|
||||||
|
// Class Destructor
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
LLAvatarJoint::~LLAvatarJoint()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// setValid()
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
void LLAvatarJoint::setValid( BOOL valid, BOOL recursive )
|
||||||
|
{
|
||||||
|
//----------------------------------------------------------------
|
||||||
|
// set visibility for this joint
|
||||||
|
//----------------------------------------------------------------
|
||||||
|
mValid = valid;
|
||||||
|
|
||||||
|
//----------------------------------------------------------------
|
||||||
|
// set visibility for children
|
||||||
|
//----------------------------------------------------------------
|
||||||
|
if (recursive)
|
||||||
|
{
|
||||||
|
for (child_list_t::iterator iter = mChildren.begin();
|
||||||
|
iter != mChildren.end(); ++iter)
|
||||||
|
{
|
||||||
|
LLAvatarJoint* joint = (LLAvatarJoint*)(*iter);
|
||||||
|
joint->setValid(valid, TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// setSkeletonComponents()
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
void LLAvatarJoint::setSkeletonComponents( U32 comp, BOOL recursive )
|
||||||
|
{
|
||||||
|
mComponents = comp;
|
||||||
|
if (recursive)
|
||||||
|
{
|
||||||
|
for (child_list_t::iterator iter = mChildren.begin();
|
||||||
|
iter != mChildren.end(); ++iter)
|
||||||
|
{
|
||||||
|
LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(*iter);
|
||||||
|
joint->setSkeletonComponents(comp, recursive);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLAvatarJoint::setVisible(BOOL visible, BOOL recursive)
|
||||||
|
{
|
||||||
|
mVisible = visible;
|
||||||
|
|
||||||
|
if (recursive)
|
||||||
|
{
|
||||||
|
for (child_list_t::iterator iter = mChildren.begin();
|
||||||
|
iter != mChildren.end(); ++iter)
|
||||||
|
{
|
||||||
|
LLAvatarJoint* joint = (LLAvatarJoint*)(*iter);
|
||||||
|
joint->setVisible(visible, recursive);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLAvatarJoint::updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area)
|
||||||
|
{
|
||||||
|
for (child_list_t::iterator iter = mChildren.begin();
|
||||||
|
iter != mChildren.end(); ++iter)
|
||||||
|
{
|
||||||
|
LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(*iter);
|
||||||
|
joint->updateFaceSizes(num_vertices, num_indices, pixel_area);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLAvatarJoint::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind, bool terse_update)
|
||||||
|
{
|
||||||
|
for (child_list_t::iterator iter = mChildren.begin();
|
||||||
|
iter != mChildren.end(); ++iter)
|
||||||
|
{
|
||||||
|
LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(*iter);
|
||||||
|
joint->updateFaceData(face, pixel_area, damp_wind, terse_update);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLAvatarJoint::updateJointGeometry()
|
||||||
|
{
|
||||||
|
for (child_list_t::iterator iter = mChildren.begin();
|
||||||
|
iter != mChildren.end(); ++iter)
|
||||||
|
{
|
||||||
|
LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(*iter);
|
||||||
|
joint->updateJointGeometry();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOL LLAvatarJoint::updateLOD(F32 pixel_area, BOOL activate)
|
||||||
|
{
|
||||||
|
BOOL lod_changed = FALSE;
|
||||||
|
BOOL found_lod = FALSE;
|
||||||
|
|
||||||
|
for (child_list_t::iterator iter = mChildren.begin();
|
||||||
|
iter != mChildren.end(); ++iter)
|
||||||
|
{
|
||||||
|
LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(*iter);
|
||||||
|
F32 jointLOD = joint->getLOD();
|
||||||
|
|
||||||
|
if (found_lod || jointLOD == DEFAULT_AVATAR_JOINT_LOD)
|
||||||
|
{
|
||||||
|
// we've already found a joint to enable, so enable the rest as alternatives
|
||||||
|
lod_changed |= joint->updateLOD(pixel_area, TRUE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (pixel_area >= jointLOD || sDisableLOD)
|
||||||
|
{
|
||||||
|
lod_changed |= joint->updateLOD(pixel_area, TRUE);
|
||||||
|
found_lod = TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lod_changed |= joint->updateLOD(pixel_area, FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return lod_changed;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLAvatarJoint::dump()
|
||||||
|
{
|
||||||
|
for (child_list_t::iterator iter = mChildren.begin();
|
||||||
|
iter != mChildren.end(); ++iter)
|
||||||
|
{
|
||||||
|
LLAvatarJoint* joint = dynamic_cast<LLAvatarJoint*>(*iter);
|
||||||
|
joint->dump();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LLAvatarJoint::setMeshesToChildren()
|
||||||
|
{
|
||||||
|
removeAllChildren();
|
||||||
|
for (avatar_joint_mesh_list_t::iterator iter = mMeshParts.begin();
|
||||||
|
iter != mMeshParts.end(); iter++)
|
||||||
|
{
|
||||||
|
addChild((*iter));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// LLAvatarJointCollisionVolume()
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
LLAvatarJointCollisionVolume::LLAvatarJointCollisionVolume()
|
||||||
|
{
|
||||||
|
mUpdateXform = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*virtual*/
|
||||||
|
U32 LLAvatarJointCollisionVolume::render( F32 pixelArea, BOOL first_pass, BOOL is_dummy )
|
||||||
|
{
|
||||||
|
llerrs << "Cannot call render() on LLAvatarJointCollisionVolume" << llendl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
LLVector3 LLAvatarJointCollisionVolume::getVolumePos(LLVector3 &offset)
|
||||||
|
{
|
||||||
|
mUpdateXform = TRUE;
|
||||||
|
|
||||||
|
LLVector3 result = offset;
|
||||||
|
result.scaleVec(getScale());
|
||||||
|
result.rotVec(getWorldRotation());
|
||||||
|
result += getWorldPosition();
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLAvatarJointCollisionVolume::renderCollision()
|
||||||
|
{
|
||||||
|
updateWorldMatrix();
|
||||||
|
|
||||||
|
gGL.pushMatrix();
|
||||||
|
gGL.multMatrix( &mXform.getWorldMatrix().mMatrix[0][0] );
|
||||||
|
|
||||||
|
gGL.diffuseColor3f( 0.f, 0.f, 1.f );
|
||||||
|
|
||||||
|
gGL.begin(LLRender::LINES);
|
||||||
|
|
||||||
|
LLVector3 v[] =
|
||||||
|
{
|
||||||
|
LLVector3(1,0,0),
|
||||||
|
LLVector3(-1,0,0),
|
||||||
|
LLVector3(0,1,0),
|
||||||
|
LLVector3(0,-1,0),
|
||||||
|
|
||||||
|
LLVector3(0,0,-1),
|
||||||
|
LLVector3(0,0,1),
|
||||||
|
};
|
||||||
|
|
||||||
|
//sides
|
||||||
|
gGL.vertex3fv(v[0].mV);
|
||||||
|
gGL.vertex3fv(v[2].mV);
|
||||||
|
|
||||||
|
gGL.vertex3fv(v[0].mV);
|
||||||
|
gGL.vertex3fv(v[3].mV);
|
||||||
|
|
||||||
|
gGL.vertex3fv(v[1].mV);
|
||||||
|
gGL.vertex3fv(v[2].mV);
|
||||||
|
|
||||||
|
gGL.vertex3fv(v[1].mV);
|
||||||
|
gGL.vertex3fv(v[3].mV);
|
||||||
|
|
||||||
|
|
||||||
|
//top
|
||||||
|
gGL.vertex3fv(v[0].mV);
|
||||||
|
gGL.vertex3fv(v[4].mV);
|
||||||
|
|
||||||
|
gGL.vertex3fv(v[1].mV);
|
||||||
|
gGL.vertex3fv(v[4].mV);
|
||||||
|
|
||||||
|
gGL.vertex3fv(v[2].mV);
|
||||||
|
gGL.vertex3fv(v[4].mV);
|
||||||
|
|
||||||
|
gGL.vertex3fv(v[3].mV);
|
||||||
|
gGL.vertex3fv(v[4].mV);
|
||||||
|
|
||||||
|
|
||||||
|
//bottom
|
||||||
|
gGL.vertex3fv(v[0].mV);
|
||||||
|
gGL.vertex3fv(v[5].mV);
|
||||||
|
|
||||||
|
gGL.vertex3fv(v[1].mV);
|
||||||
|
gGL.vertex3fv(v[5].mV);
|
||||||
|
|
||||||
|
gGL.vertex3fv(v[2].mV);
|
||||||
|
gGL.vertex3fv(v[5].mV);
|
||||||
|
|
||||||
|
gGL.vertex3fv(v[3].mV);
|
||||||
|
gGL.vertex3fv(v[5].mV);
|
||||||
|
|
||||||
|
gGL.end();
|
||||||
|
|
||||||
|
gGL.popMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// End
|
||||||
140
indra/llappearance/llavatarjoint.h
Normal file
140
indra/llappearance/llavatarjoint.h
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
/**
|
||||||
|
* @file llavatarjoint.h
|
||||||
|
* @brief Implementation of LLAvatarJoint class
|
||||||
|
*
|
||||||
|
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||||
|
* Second Life Viewer Source Code
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
|
* $/LicenseInfo$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LL_LLAVATARJOINT_H
|
||||||
|
#define LL_LLAVATARJOINT_H
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Header Files
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
#include "lljoint.h"
|
||||||
|
#include "lljointpickname.h"
|
||||||
|
|
||||||
|
class LLFace;
|
||||||
|
class LLAvatarJointMesh;
|
||||||
|
|
||||||
|
extern const F32 DEFAULT_AVATAR_JOINT_LOD;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// class LLViewerJoint
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
class LLAvatarJoint :
|
||||||
|
public LLJoint
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LLAvatarJoint();
|
||||||
|
LLAvatarJoint(S32 joint_num);
|
||||||
|
// *TODO: Only used for LLVOAvatarSelf::mScreenp. *DOES NOT INITIALIZE mResetAfterRestoreOldXform*
|
||||||
|
LLAvatarJoint(const std::string &name, LLJoint *parent = NULL);
|
||||||
|
virtual ~LLAvatarJoint();
|
||||||
|
|
||||||
|
// Gets the validity of this joint
|
||||||
|
BOOL getValid() { return mValid; }
|
||||||
|
|
||||||
|
// Sets the validity of this joint
|
||||||
|
virtual void setValid( BOOL valid, BOOL recursive=FALSE );
|
||||||
|
|
||||||
|
// Returns true if this object is transparent.
|
||||||
|
// This is used to determine in which order to draw objects.
|
||||||
|
virtual BOOL isTransparent() { return mIsTransparent; }
|
||||||
|
|
||||||
|
// Returns true if this object should inherit scale modifiers from its immediate parent
|
||||||
|
virtual BOOL inheritScale() { return FALSE; }
|
||||||
|
|
||||||
|
enum Components
|
||||||
|
{
|
||||||
|
SC_BONE = 1,
|
||||||
|
SC_JOINT = 2,
|
||||||
|
SC_AXES = 4
|
||||||
|
};
|
||||||
|
|
||||||
|
// Selects which skeleton components to draw
|
||||||
|
void setSkeletonComponents( U32 comp, BOOL recursive = TRUE );
|
||||||
|
|
||||||
|
// Returns which skeleton components are enables for drawing
|
||||||
|
U32 getSkeletonComponents() { return mComponents; }
|
||||||
|
|
||||||
|
// Sets the level of detail for this node as a minimum
|
||||||
|
// pixel area threshold. If the current pixel area for this
|
||||||
|
// object is less than the specified threshold, the node is
|
||||||
|
// not traversed. In addition, if a value is specified (not
|
||||||
|
// default of 0.0), and the pixel area is larger than the
|
||||||
|
// specified minimum, the node is rendered, but no other siblings
|
||||||
|
// of this node under the same parent will be.
|
||||||
|
F32 getLOD() { return mMinPixelArea; }
|
||||||
|
void setLOD( F32 pixelArea ) { mMinPixelArea = pixelArea; }
|
||||||
|
|
||||||
|
void setPickName(LLJointPickName name) { mPickName = name; }
|
||||||
|
LLJointPickName getPickName() { return mPickName; }
|
||||||
|
|
||||||
|
void setVisible( BOOL visible, BOOL recursive );
|
||||||
|
|
||||||
|
// Takes meshes in mMeshParts and sets each one as a child joint
|
||||||
|
void setMeshesToChildren();
|
||||||
|
|
||||||
|
// LLViewerJoint interface
|
||||||
|
virtual U32 render( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE ) = 0;
|
||||||
|
virtual void updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area);
|
||||||
|
virtual void updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind = FALSE, bool terse_update = false);
|
||||||
|
virtual BOOL updateLOD(F32 pixel_area, BOOL activate);
|
||||||
|
virtual void updateJointGeometry();
|
||||||
|
virtual void dump();
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
static BOOL sDisableLOD;
|
||||||
|
avatar_joint_mesh_list_t mMeshParts; //LLViewerJointMesh*
|
||||||
|
void setMeshID( S32 id ) {mMeshID = id;}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void init();
|
||||||
|
|
||||||
|
BOOL mValid;
|
||||||
|
BOOL mIsTransparent;
|
||||||
|
U32 mComponents;
|
||||||
|
F32 mMinPixelArea;
|
||||||
|
LLJointPickName mPickName;
|
||||||
|
BOOL mVisible;
|
||||||
|
S32 mMeshID;
|
||||||
|
};
|
||||||
|
|
||||||
|
class LLAvatarJointCollisionVolume : public LLAvatarJoint
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LLAvatarJointCollisionVolume();
|
||||||
|
virtual ~LLAvatarJointCollisionVolume() {};
|
||||||
|
|
||||||
|
/*virtual*/ BOOL inheritScale() { return TRUE; }
|
||||||
|
/*virtual*/ U32 render( F32 pixelArea, BOOL first_pass = TRUE, BOOL is_dummy = FALSE );
|
||||||
|
|
||||||
|
void renderCollision();
|
||||||
|
|
||||||
|
LLVector3 getVolumePos(LLVector3 &offset);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // LL_LLAVATARJOINT_H
|
||||||
|
|
||||||
|
|
||||||
375
indra/llappearance/llavatarjointmesh.cpp
Normal file
375
indra/llappearance/llavatarjointmesh.cpp
Normal file
@@ -0,0 +1,375 @@
|
|||||||
|
/**
|
||||||
|
* @file LLAvatarJointMesh.cpp
|
||||||
|
* @brief Implementation of LLAvatarJointMesh class
|
||||||
|
*
|
||||||
|
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||||
|
* Second Life Viewer Source Code
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
|
* $/LicenseInfo$
|
||||||
|
*/
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Header Files
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
#include "linden_common.h"
|
||||||
|
#include "imageids.h"
|
||||||
|
#include "llfasttimer.h"
|
||||||
|
#include "llrender.h"
|
||||||
|
|
||||||
|
#include "llavatarjointmesh.h"
|
||||||
|
#include "llavatarappearance.h"
|
||||||
|
//#include "llapr.h"
|
||||||
|
//#include "llbox.h"
|
||||||
|
//#include "lldrawable.h"
|
||||||
|
//#include "lldrawpoolavatar.h"
|
||||||
|
//#include "lldrawpoolbump.h"
|
||||||
|
//#include "lldynamictexture.h"
|
||||||
|
//#include "llface.h"
|
||||||
|
//#include "llgldbg.h"
|
||||||
|
//#include "llglheaders.h"
|
||||||
|
#include "lltexlayer.h"
|
||||||
|
//#include "llviewercamera.h"
|
||||||
|
//#include "llviewercontrol.h"
|
||||||
|
//#include "llviewertexturelist.h"
|
||||||
|
//#include "llsky.h"
|
||||||
|
//#include "pipeline.h"
|
||||||
|
//#include "llviewershadermgr.h"
|
||||||
|
#include "llmath.h"
|
||||||
|
#include "v4math.h"
|
||||||
|
#include "m3math.h"
|
||||||
|
#include "m4math.h"
|
||||||
|
#include "llmatrix4a.h"
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// LLAvatarJointMesh::LLSkinJoint
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// LLSkinJoint
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
LLSkinJoint::LLSkinJoint()
|
||||||
|
{
|
||||||
|
mJoint = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// ~LLSkinJoint
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
LLSkinJoint::~LLSkinJoint()
|
||||||
|
{
|
||||||
|
mJoint = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// LLSkinJoint::setupSkinJoint()
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
BOOL LLSkinJoint::setupSkinJoint( LLAvatarJoint *joint)
|
||||||
|
{
|
||||||
|
// find the named joint
|
||||||
|
mJoint = joint;
|
||||||
|
if ( !mJoint )
|
||||||
|
{
|
||||||
|
llinfos << "Can't find joint" << llendl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// compute the inverse root skin matrix
|
||||||
|
mRootToJointSkinOffset.clearVec();
|
||||||
|
|
||||||
|
LLVector3 rootSkinOffset;
|
||||||
|
while (joint)
|
||||||
|
{
|
||||||
|
rootSkinOffset += joint->getSkinOffset();
|
||||||
|
joint = (LLAvatarJoint*)joint->getParent();
|
||||||
|
}
|
||||||
|
|
||||||
|
mRootToJointSkinOffset = -rootSkinOffset;
|
||||||
|
mRootToParentJointSkinOffset = mRootToJointSkinOffset;
|
||||||
|
mRootToParentJointSkinOffset += mJoint->getSkinOffset();
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// LLAvatarJointMesh
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
BOOL LLAvatarJointMesh::sPipelineRender = FALSE;
|
||||||
|
EAvatarRenderPass LLAvatarJointMesh::sRenderPass = AVATAR_RENDER_PASS_SINGLE;
|
||||||
|
U32 LLAvatarJointMesh::sClothingMaskImageName = 0;
|
||||||
|
LLColor4 LLAvatarJointMesh::sClothingInnerColor;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// LLAvatarJointMesh()
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
LLAvatarJointMesh::LLAvatarJointMesh()
|
||||||
|
:
|
||||||
|
mTexture( NULL ),
|
||||||
|
mLayerSet( NULL ),
|
||||||
|
mTestImageName( 0 ),
|
||||||
|
mFaceIndexCount(0)
|
||||||
|
{
|
||||||
|
|
||||||
|
mColor[0] = 1.0f;
|
||||||
|
mColor[1] = 1.0f;
|
||||||
|
mColor[2] = 1.0f;
|
||||||
|
mColor[3] = 1.0f;
|
||||||
|
mShiny = 0.0f;
|
||||||
|
mCullBackFaces = TRUE;
|
||||||
|
|
||||||
|
mMesh = NULL;
|
||||||
|
|
||||||
|
mNumSkinJoints = 0;
|
||||||
|
mSkinJoints = NULL;
|
||||||
|
|
||||||
|
mFace = NULL;
|
||||||
|
|
||||||
|
mMeshID = 0;
|
||||||
|
mUpdateXform = FALSE;
|
||||||
|
|
||||||
|
mValid = FALSE;
|
||||||
|
|
||||||
|
mIsTransparent = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// ~LLAvatarJointMesh()
|
||||||
|
// Class Destructor
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
LLAvatarJointMesh::~LLAvatarJointMesh()
|
||||||
|
{
|
||||||
|
mMesh = NULL;
|
||||||
|
mTexture = NULL;
|
||||||
|
freeSkinData();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// LLAvatarJointMesh::allocateSkinData()
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
BOOL LLAvatarJointMesh::allocateSkinData( U32 numSkinJoints )
|
||||||
|
{
|
||||||
|
mSkinJoints = new LLSkinJoint[ numSkinJoints ];
|
||||||
|
mNumSkinJoints = numSkinJoints;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// LLAvatarJointMesh::freeSkinData()
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
void LLAvatarJointMesh::freeSkinData()
|
||||||
|
{
|
||||||
|
mNumSkinJoints = 0;
|
||||||
|
delete [] mSkinJoints;
|
||||||
|
mSkinJoints = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// LLAvatarJointMesh::getColor()
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
void LLAvatarJointMesh::getColor( F32 *red, F32 *green, F32 *blue, F32 *alpha )
|
||||||
|
{
|
||||||
|
*red = mColor[0];
|
||||||
|
*green = mColor[1];
|
||||||
|
*blue = mColor[2];
|
||||||
|
*alpha = mColor[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// LLAvatarJointMesh::setColor()
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
void LLAvatarJointMesh::setColor( F32 red, F32 green, F32 blue, F32 alpha )
|
||||||
|
{
|
||||||
|
mColor[0] = red;
|
||||||
|
mColor[1] = green;
|
||||||
|
mColor[2] = blue;
|
||||||
|
mColor[3] = alpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLAvatarJointMesh::setColor( const LLColor4& color )
|
||||||
|
{
|
||||||
|
mColor = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// LLAvatarJointMesh::getTexture()
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
//LLViewerTexture *LLAvatarJointMesh::getTexture()
|
||||||
|
//{
|
||||||
|
// return mTexture;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// LLAvatarJointMesh::setTexture()
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
void LLAvatarJointMesh::setTexture( LLGLTexture *texture )
|
||||||
|
{
|
||||||
|
mTexture = texture;
|
||||||
|
|
||||||
|
// texture and dynamic_texture are mutually exclusive
|
||||||
|
if( texture )
|
||||||
|
{
|
||||||
|
mLayerSet = NULL;
|
||||||
|
//texture->bindTexture(0);
|
||||||
|
//texture->setClamp(TRUE, TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BOOL LLAvatarJointMesh::hasGLTexture() const
|
||||||
|
{
|
||||||
|
return mTexture.notNull() && mTexture->hasGLTexture();
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// LLAvatarJointMesh::setLayerSet()
|
||||||
|
// Sets the shape texture (takes precedence over normal texture)
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
void LLAvatarJointMesh::setLayerSet( LLTexLayerSet* layer_set )
|
||||||
|
{
|
||||||
|
mLayerSet = layer_set;
|
||||||
|
|
||||||
|
// texture and dynamic_texture are mutually exclusive
|
||||||
|
if( layer_set )
|
||||||
|
{
|
||||||
|
mTexture = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL LLAvatarJointMesh::hasComposite() const
|
||||||
|
{
|
||||||
|
return (mLayerSet && mLayerSet->hasComposite());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// LLAvatarJointMesh::getMesh()
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
LLPolyMesh *LLAvatarJointMesh::getMesh()
|
||||||
|
{
|
||||||
|
return mMesh;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// LLAvatarJointMesh::setMesh()
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
void LLAvatarJointMesh::setMesh( LLPolyMesh *mesh )
|
||||||
|
{
|
||||||
|
// set the mesh pointer
|
||||||
|
mMesh = mesh;
|
||||||
|
|
||||||
|
// release any existing skin joints
|
||||||
|
freeSkinData();
|
||||||
|
|
||||||
|
if ( mMesh == NULL )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// acquire the transform from the mesh object
|
||||||
|
setPosition( mMesh->getPosition() );
|
||||||
|
setRotation( mMesh->getRotation() );
|
||||||
|
setScale( mMesh->getScale() );
|
||||||
|
|
||||||
|
// create skin joints if necessary
|
||||||
|
if ( mMesh->hasWeights() && !mMesh->isLOD())
|
||||||
|
{
|
||||||
|
U32 numJointNames = mMesh->getNumJointNames();
|
||||||
|
|
||||||
|
allocateSkinData( numJointNames );
|
||||||
|
std::string *jointNames = mMesh->getJointNames();
|
||||||
|
|
||||||
|
U32 jn;
|
||||||
|
for (jn = 0; jn < numJointNames; jn++)
|
||||||
|
{
|
||||||
|
//llinfos << "Setting up joint " << jointNames[jn] << llendl;
|
||||||
|
LLAvatarJoint* joint = (LLAvatarJoint*)(getRoot()->findJoint(jointNames[jn]) );
|
||||||
|
mSkinJoints[jn].setupSkinJoint( joint );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// setup joint array
|
||||||
|
if (!mMesh->isLOD())
|
||||||
|
{
|
||||||
|
setupJoint((LLAvatarJoint*)getRoot());
|
||||||
|
}
|
||||||
|
|
||||||
|
// llinfos << "joint render entries: " << mMesh->mJointRenderData.count() << llendl;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// setupJoint()
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
void LLAvatarJointMesh::setupJoint(LLAvatarJoint* current_joint)
|
||||||
|
{
|
||||||
|
// llinfos << "Mesh: " << getName() << llendl;
|
||||||
|
|
||||||
|
// S32 joint_count = 0;
|
||||||
|
U32 sj;
|
||||||
|
for (sj=0; sj<mNumSkinJoints; sj++)
|
||||||
|
{
|
||||||
|
LLSkinJoint &js = mSkinJoints[sj];
|
||||||
|
|
||||||
|
if (js.mJoint != current_joint)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// we've found a skinjoint for this joint..
|
||||||
|
|
||||||
|
// is the last joint in the array our parent?
|
||||||
|
if(mMesh->mJointRenderData.count() && mMesh->mJointRenderData[mMesh->mJointRenderData.count() - 1]->mWorldMatrix == ¤t_joint->getParent()->getWorldMatrix())
|
||||||
|
{
|
||||||
|
// ...then just add ourselves
|
||||||
|
LLAvatarJoint* jointp = js.mJoint;
|
||||||
|
mMesh->mJointRenderData.put(new LLJointRenderData(&jointp->getWorldMatrix(), &js));
|
||||||
|
// llinfos << "joint " << joint_count << js.mJoint->getName() << llendl;
|
||||||
|
// joint_count++;
|
||||||
|
}
|
||||||
|
// otherwise add our parent and ourselves
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mMesh->mJointRenderData.put(new LLJointRenderData(¤t_joint->getParent()->getWorldMatrix(), NULL));
|
||||||
|
// llinfos << "joint " << joint_count << current_joint->getParent()->getName() << llendl;
|
||||||
|
// joint_count++;
|
||||||
|
mMesh->mJointRenderData.put(new LLJointRenderData(¤t_joint->getWorldMatrix(), &js));
|
||||||
|
// llinfos << "joint " << joint_count << current_joint->getName() << llendl;
|
||||||
|
// joint_count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// depth-first traversal
|
||||||
|
for (LLJoint::child_list_t::iterator iter = current_joint->mChildren.begin();
|
||||||
|
iter != current_joint->mChildren.end(); ++iter)
|
||||||
|
{
|
||||||
|
LLAvatarJoint* child_joint = (LLAvatarJoint*)(*iter);
|
||||||
|
setupJoint(child_joint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// End
|
||||||
142
indra/llappearance/llavatarjointmesh.h
Normal file
142
indra/llappearance/llavatarjointmesh.h
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
/**
|
||||||
|
* @file llavatarjointmesh.h
|
||||||
|
* @brief Declaration of LLAvatarJointMesh class
|
||||||
|
*
|
||||||
|
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||||
|
* Second Life Viewer Source Code
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
|
* $/LicenseInfo$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LL_LLAVATARJOINTMESH_H
|
||||||
|
#define LL_LLAVATARJOINTMESH_H
|
||||||
|
|
||||||
|
#include "llavatarjoint.h"
|
||||||
|
#include "llgltexture.h"
|
||||||
|
#include "llpolymesh.h"
|
||||||
|
#include "v4color.h"
|
||||||
|
|
||||||
|
class LLDrawable;
|
||||||
|
class LLFace;
|
||||||
|
class LLCharacter;
|
||||||
|
class LLTexLayerSet;
|
||||||
|
|
||||||
|
typedef enum e_avatar_render_pass
|
||||||
|
{
|
||||||
|
AVATAR_RENDER_PASS_SINGLE,
|
||||||
|
AVATAR_RENDER_PASS_CLOTHING_INNER,
|
||||||
|
AVATAR_RENDER_PASS_CLOTHING_OUTER
|
||||||
|
} EAvatarRenderPass;
|
||||||
|
|
||||||
|
class LLSkinJoint
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LLSkinJoint();
|
||||||
|
~LLSkinJoint();
|
||||||
|
BOOL setupSkinJoint( LLAvatarJoint *joint);
|
||||||
|
|
||||||
|
LLAvatarJoint *mJoint;
|
||||||
|
LLVector3 mRootToJointSkinOffset;
|
||||||
|
LLVector3 mRootToParentJointSkinOffset;
|
||||||
|
};
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// class LLViewerJointMesh
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
class LLAvatarJointMesh : public virtual LLAvatarJoint
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
LLColor4 mColor; // color value
|
||||||
|
// LLColor4 mSpecular; // specular color (always white for now)
|
||||||
|
F32 mShiny; // shiny value
|
||||||
|
LLPointer<LLGLTexture> mTexture; // ptr to a global texture
|
||||||
|
LLTexLayerSet* mLayerSet; // ptr to a layer set owned by the avatar
|
||||||
|
U32 mTestImageName; // handle to a temporary texture for previewing uploads
|
||||||
|
LLPolyMesh* mMesh; // ptr to a global polymesh
|
||||||
|
BOOL mCullBackFaces; // true by default
|
||||||
|
LLFace* mFace; // ptr to a face w/ AGP copy of mesh
|
||||||
|
|
||||||
|
U32 mFaceIndexCount;
|
||||||
|
|
||||||
|
U32 mNumSkinJoints;
|
||||||
|
LLSkinJoint* mSkinJoints;
|
||||||
|
S32 mMeshID;
|
||||||
|
|
||||||
|
public:
|
||||||
|
static BOOL sPipelineRender;
|
||||||
|
//RN: this is here for testing purposes
|
||||||
|
static U32 sClothingMaskImageName;
|
||||||
|
static EAvatarRenderPass sRenderPass;
|
||||||
|
static LLColor4 sClothingInnerColor;
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Constructor
|
||||||
|
LLAvatarJointMesh();
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
virtual ~LLAvatarJointMesh();
|
||||||
|
|
||||||
|
// Gets the shape color
|
||||||
|
void getColor( F32 *red, F32 *green, F32 *blue, F32 *alpha );
|
||||||
|
|
||||||
|
// Sets the shape color
|
||||||
|
void setColor( F32 red, F32 green, F32 blue, F32 alpha );
|
||||||
|
void setColor( const LLColor4& color );
|
||||||
|
|
||||||
|
// Sets the shininess
|
||||||
|
void setSpecular( const LLColor4& color, F32 shiny ) { /*mSpecular = color;*/ mShiny = shiny; };
|
||||||
|
|
||||||
|
// Sets the shape texture
|
||||||
|
void setTexture( LLGLTexture *texture );
|
||||||
|
|
||||||
|
BOOL hasGLTexture() const;
|
||||||
|
|
||||||
|
void setTestTexture( U32 name ) { mTestImageName = name; }
|
||||||
|
|
||||||
|
// Sets layer set responsible for a dynamic shape texture (takes precedence over normal texture)
|
||||||
|
void setLayerSet( LLTexLayerSet* layer_set );
|
||||||
|
|
||||||
|
BOOL hasComposite() const;
|
||||||
|
|
||||||
|
// Gets the poly mesh
|
||||||
|
LLPolyMesh *getMesh();
|
||||||
|
|
||||||
|
// Sets the poly mesh
|
||||||
|
void setMesh( LLPolyMesh *mesh );
|
||||||
|
|
||||||
|
// Sets up joint matrix data for rendering
|
||||||
|
void setupJoint(LLAvatarJoint* current_joint);
|
||||||
|
|
||||||
|
// Sets ID for picking
|
||||||
|
void setMeshID( S32 id ) {mMeshID = id;}
|
||||||
|
|
||||||
|
// Gets ID for picking
|
||||||
|
S32 getMeshID() { return mMeshID; }
|
||||||
|
|
||||||
|
void setIsTransparent(BOOL is_transparent) { mIsTransparent = is_transparent; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Allocate skin data
|
||||||
|
BOOL allocateSkinData( U32 numSkinJoints );
|
||||||
|
|
||||||
|
// Free skin data
|
||||||
|
void freeSkinData();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // LL_LLAVATARJOINTMESH_H
|
||||||
@@ -24,22 +24,20 @@
|
|||||||
* $/LicenseInfo$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "llviewerprecompiledheaders.h"
|
#include "linden_common.h"
|
||||||
|
|
||||||
#include "lldriverparam.h"
|
#include "lldriverparam.h"
|
||||||
|
|
||||||
#include "llfasttimer.h"
|
#include "llavatarappearance.h"
|
||||||
#include "llvoavatar.h"
|
|
||||||
#include "llvoavatarself.h"
|
|
||||||
#include "llagent.h"
|
|
||||||
#include "llwearable.h"
|
#include "llwearable.h"
|
||||||
#include "llagentwearables.h"
|
#include "llwearabledata.h"
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// LLDriverParamInfo
|
// LLDriverParamInfo
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
LLDriverParamInfo::LLDriverParamInfo()
|
LLDriverParamInfo::LLDriverParamInfo() :
|
||||||
|
mDriverParam(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,12 +110,14 @@ void LLDriverParamInfo::toStream(std::ostream &out)
|
|||||||
|
|
||||||
out << std::endl;
|
out << std::endl;
|
||||||
|
|
||||||
if(isAgentAvatarValid())
|
if(mDriverParam && mDriverParam->getAvatarAppearance()->isSelf() &&
|
||||||
|
mDriverParam->getAvatarAppearance()->isValid())
|
||||||
{
|
{
|
||||||
for (entry_info_list_t::iterator iter = mDrivenInfoList.begin(); iter != mDrivenInfoList.end(); iter++)
|
for (entry_info_list_t::iterator iter = mDrivenInfoList.begin(); iter != mDrivenInfoList.end(); iter++)
|
||||||
{
|
{
|
||||||
LLDrivenEntryInfo driven = *iter;
|
LLDrivenEntryInfo driven = *iter;
|
||||||
LLViewerVisualParam *param = (LLViewerVisualParam*)gAgentAvatarp->getVisualParam(driven.mDrivenID);
|
LLViewerVisualParam *param =
|
||||||
|
(LLViewerVisualParam*)mDriverParam->getAvatarAppearance()->getVisualParam(driven.mDrivenID);
|
||||||
if (param)
|
if (param)
|
||||||
{
|
{
|
||||||
param->getInfo()->toStream(out);
|
param->getInfo()->toStream(out);
|
||||||
@@ -139,7 +139,9 @@ void LLDriverParamInfo::toStream(std::ostream &out)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
llwarns << "could not get parameter " << driven.mDrivenID << " from avatar " << gAgentAvatarp.get() << " for driver parameter " << getID() << llendl;
|
llwarns << "could not get parameter " << driven.mDrivenID << " from avatar "
|
||||||
|
<< mDriverParam->getAvatarAppearance()
|
||||||
|
<< " for driver parameter " << getID() << llendl;
|
||||||
}
|
}
|
||||||
out << std::endl;
|
out << std::endl;
|
||||||
}
|
}
|
||||||
@@ -150,19 +152,16 @@ void LLDriverParamInfo::toStream(std::ostream &out)
|
|||||||
// LLDriverParam
|
// LLDriverParam
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
LLDriverParam::LLDriverParam(LLVOAvatar *avatarp) :
|
LLDriverParam::LLDriverParam(LLAvatarAppearance *appearance, LLWearable* wearable /* = NULL */) :
|
||||||
mCurrentDistortionParam( NULL ),
|
mCurrentDistortionParam( NULL ),
|
||||||
mAvatarp(avatarp),
|
mAvatarAppearance(appearance),
|
||||||
mWearablep(NULL)
|
mWearablep(wearable)
|
||||||
{
|
{
|
||||||
mDefaultVec.clear();
|
llassert(mAvatarAppearance);
|
||||||
|
if (mWearablep)
|
||||||
|
{
|
||||||
|
llassert(mAvatarAppearance->isSelf());
|
||||||
}
|
}
|
||||||
|
|
||||||
LLDriverParam::LLDriverParam(LLWearable *wearablep) :
|
|
||||||
mCurrentDistortionParam( NULL ),
|
|
||||||
mAvatarp(NULL),
|
|
||||||
mWearablep(wearablep)
|
|
||||||
{
|
|
||||||
mDefaultVec.clear();
|
mDefaultVec.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,49 +176,22 @@ BOOL LLDriverParam::setInfo(LLDriverParamInfo *info)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
mInfo = info;
|
mInfo = info;
|
||||||
mID = info->mID;
|
mID = info->mID;
|
||||||
|
info->mDriverParam = this;
|
||||||
|
|
||||||
setWeight(getDefaultWeight(), FALSE );
|
setWeight(getDefaultWeight(), FALSE );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLDriverParam::setWearable(LLWearable *wearablep)
|
|
||||||
{
|
|
||||||
if (wearablep)
|
|
||||||
{
|
|
||||||
mWearablep = wearablep;
|
|
||||||
mAvatarp = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void LLDriverParam::setAvatar(LLVOAvatar *avatarp)
|
|
||||||
{
|
|
||||||
if (avatarp)
|
|
||||||
{
|
|
||||||
mWearablep = NULL;
|
|
||||||
mAvatarp = avatarp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ LLViewerVisualParam* LLDriverParam::cloneParam(LLWearable* wearable) const
|
/*virtual*/ LLViewerVisualParam* LLDriverParam::cloneParam(LLWearable* wearable) const
|
||||||
{
|
{
|
||||||
LLDriverParam *new_param;
|
llassert(wearable);
|
||||||
if (wearable)
|
LLDriverParam *new_param = new LLDriverParam(mAvatarAppearance, wearable);
|
||||||
{
|
// FIXME DRANO this clobbers mWearablep, which means any code
|
||||||
new_param = new LLDriverParam(wearable);
|
// currently using mWearablep is wrong, or at least untested.
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (mWearablep)
|
|
||||||
{
|
|
||||||
new_param = new LLDriverParam(mWearablep);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
new_param = new LLDriverParam(mAvatarp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*new_param = *this;
|
*new_param = *this;
|
||||||
|
//new_param->mWearablep = wearable;
|
||||||
|
// new_param->mDriven.clear(); // clear driven list to avoid overwriting avatar driven params from wearables.
|
||||||
return new_param;
|
return new_param;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -456,6 +428,20 @@ const LLVector4a* LLDriverParam::getNextDistortion(U32 *index, LLPolyMesh **poly
|
|||||||
return v;
|
return v;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
S32 LLDriverParam::getDrivenParamsCount() const
|
||||||
|
{
|
||||||
|
return mDriven.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
const LLViewerVisualParam* LLDriverParam::getDrivenParam(S32 index) const
|
||||||
|
{
|
||||||
|
if (0 > index || index >= (S32)mDriven.size())
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return mDriven[index].mParam;
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// setAnimationTarget()
|
// setAnimationTarget()
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -511,6 +497,7 @@ BOOL LLDriverParam::linkDrivenParams(visual_param_mapper mapper, BOOL only_cross
|
|||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
LLViewerVisualParam* param = (LLViewerVisualParam*)mapper(driven_id);
|
LLViewerVisualParam* param = (LLViewerVisualParam*)mapper(driven_id);
|
||||||
|
if (param) param->setParamLocation(this->getParamLocation());
|
||||||
bool push = param && (!only_cross_params || param->getCrossWearable());
|
bool push = param && (!only_cross_params || param->getCrossWearable());
|
||||||
if (push)
|
if (push)
|
||||||
{
|
{
|
||||||
@@ -555,7 +542,7 @@ void LLDriverParam::updateCrossDrivenParams(LLWearableType::EType driven_type)
|
|||||||
// Thus this wearable needs to get updates from the driver wearable.
|
// Thus this wearable needs to get updates from the driver wearable.
|
||||||
// The call to setVisualParamWeight seems redundant, but is necessary
|
// The call to setVisualParamWeight seems redundant, but is necessary
|
||||||
// as the number of driven wearables has changed since the last update. -Nyx
|
// as the number of driven wearables has changed since the last update. -Nyx
|
||||||
LLWearable *wearable = gAgentWearables.getTopWearable(driver_type);
|
LLWearable *wearable = mAvatarAppearance->getWearableData()->getTopWearable(driver_type);
|
||||||
if (wearable)
|
if (wearable)
|
||||||
{
|
{
|
||||||
wearable->setVisualParamWeight(mID, wearable->getVisualParamWeight(mID), false);
|
wearable->setVisualParamWeight(mID, wearable->getVisualParamWeight(mID), false);
|
||||||
@@ -623,13 +610,22 @@ F32 LLDriverParam::getDrivenWeight(const LLDrivenEntry* driven, F32 input_weight
|
|||||||
|
|
||||||
void LLDriverParam::setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bool upload_bake)
|
void LLDriverParam::setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bool upload_bake)
|
||||||
{
|
{
|
||||||
if(isAgentAvatarValid() &&
|
bool use_self = false;
|
||||||
mWearablep &&
|
if(mWearablep &&
|
||||||
driven->mParam->getCrossWearable() &&
|
mAvatarAppearance->isValid() &&
|
||||||
mWearablep->isOnTop())
|
driven->mParam->getCrossWearable())
|
||||||
|
{
|
||||||
|
LLWearable* wearable = dynamic_cast<LLWearable*> (mWearablep);
|
||||||
|
if (mAvatarAppearance->getWearableData()->isOnTop(wearable))
|
||||||
|
{
|
||||||
|
use_self = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (use_self)
|
||||||
{
|
{
|
||||||
// call setWeight through LLVOAvatarSelf so other wearables can be updated with the correct values
|
// call setWeight through LLVOAvatarSelf so other wearables can be updated with the correct values
|
||||||
gAgentAvatarp->setVisualParamWeight( (LLVisualParam*)driven->mParam, driven_weight, upload_bake );
|
mAvatarAppearance->setVisualParamWeight( (LLVisualParam*)driven->mParam, driven_weight, upload_bake );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -30,8 +30,8 @@
|
|||||||
#include "llviewervisualparam.h"
|
#include "llviewervisualparam.h"
|
||||||
#include "llwearabletype.h"
|
#include "llwearabletype.h"
|
||||||
|
|
||||||
class LLPhysicsMotion;
|
class LLAvatarAppearance;
|
||||||
class LLVOAvatar;
|
class LLDriverParam;
|
||||||
class LLWearable;
|
class LLWearable;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -71,16 +71,19 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
typedef std::deque<LLDrivenEntryInfo> entry_info_list_t;
|
typedef std::deque<LLDrivenEntryInfo> entry_info_list_t;
|
||||||
entry_info_list_t mDrivenInfoList;
|
entry_info_list_t mDrivenInfoList;
|
||||||
|
LLDriverParam* mDriverParam; // backpointer
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class LLDriverParam : public LLViewerVisualParam
|
class LLDriverParam : public LLViewerVisualParam
|
||||||
{
|
{
|
||||||
friend class LLPhysicsMotion; // physics motion needs to access driven params directly.
|
friend class LLPhysicsMotion;
|
||||||
|
private:
|
||||||
|
// Hide the default constructor. Force construction with LLAvatarAppearance.
|
||||||
|
LLDriverParam() {}
|
||||||
public:
|
public:
|
||||||
LLDriverParam(LLVOAvatar *avatarp);
|
LLDriverParam(LLAvatarAppearance *appearance, LLWearable* wearable = NULL);
|
||||||
LLDriverParam(LLWearable *wearablep);
|
|
||||||
~LLDriverParam();
|
~LLDriverParam();
|
||||||
|
|
||||||
void* operator new(size_t size)
|
void* operator new(size_t size)
|
||||||
@@ -98,8 +101,9 @@ public:
|
|||||||
// This sets mInfo and calls initialization functions
|
// This sets mInfo and calls initialization functions
|
||||||
BOOL setInfo(LLDriverParamInfo *info);
|
BOOL setInfo(LLDriverParamInfo *info);
|
||||||
|
|
||||||
void setWearable(LLWearable *wearablep);
|
LLAvatarAppearance* getAvatarAppearance() { return mAvatarAppearance; }
|
||||||
void setAvatar(LLVOAvatar *avatarp);
|
const LLAvatarAppearance* getAvatarAppearance() const { return mAvatarAppearance; }
|
||||||
|
|
||||||
void updateCrossDrivenParams(LLWearableType::EType driven_type);
|
void updateCrossDrivenParams(LLWearableType::EType driven_type);
|
||||||
|
|
||||||
/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const;
|
/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const;
|
||||||
@@ -121,6 +125,9 @@ public:
|
|||||||
/*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh);
|
/*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh);
|
||||||
/*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh);
|
/*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh);
|
||||||
|
|
||||||
|
S32 getDrivenParamsCount() const;
|
||||||
|
const LLViewerVisualParam* getDrivenParam(S32 index) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
F32 getDrivenWeight(const LLDrivenEntry* driven, F32 input_weight);
|
F32 getDrivenWeight(const LLDrivenEntry* driven, F32 input_weight);
|
||||||
void setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bool upload_bake);
|
void setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bool upload_bake);
|
||||||
@@ -131,7 +138,7 @@ protected:
|
|||||||
entry_list_t mDriven;
|
entry_list_t mDriven;
|
||||||
LLViewerVisualParam* mCurrentDistortionParam;
|
LLViewerVisualParam* mCurrentDistortionParam;
|
||||||
// Backlink only; don't make this an LLPointer.
|
// Backlink only; don't make this an LLPointer.
|
||||||
LLVOAvatar* mAvatarp;
|
LLAvatarAppearance* mAvatarAppearance;
|
||||||
LLWearable* mWearablep;
|
LLWearable* mWearablep;
|
||||||
};
|
};
|
||||||
|
|
||||||
49
indra/llappearance/lljointpickname.h
Normal file
49
indra/llappearance/lljointpickname.h
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
/**
|
||||||
|
* @file lljointpickname.h
|
||||||
|
* @brief Defines OpenGL seleciton stack names
|
||||||
|
*
|
||||||
|
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||||
|
* Second Life Viewer Source Code
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
|
* $/LicenseInfo$
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef LL_LLJOINTPICKNAME_H
|
||||||
|
#define LL_LLJOINTPICKNAME_H
|
||||||
|
|
||||||
|
class LLAvatarJointMesh;
|
||||||
|
|
||||||
|
// Sets the OpenGL selection stack name that is pushed and popped
|
||||||
|
// with this joint state. The default value indicates that no name
|
||||||
|
// should be pushed/popped.
|
||||||
|
enum LLJointPickName
|
||||||
|
{
|
||||||
|
PN_DEFAULT = -1,
|
||||||
|
PN_0 = 0,
|
||||||
|
PN_1 = 1,
|
||||||
|
PN_2 = 2,
|
||||||
|
PN_3 = 3,
|
||||||
|
PN_4 = 4,
|
||||||
|
PN_5 = 5
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef std::vector<LLAvatarJointMesh*> avatar_joint_mesh_list_t;
|
||||||
|
|
||||||
|
#endif // LL_LLJOINTPICKNAME_H
|
||||||
@@ -23,13 +23,14 @@
|
|||||||
* $/LicenseInfo$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "llviewerprecompiledheaders.h"
|
#include "linden_common.h"
|
||||||
|
|
||||||
#include "lllocaltextureobject.h"
|
#include "lllocaltextureobject.h"
|
||||||
|
|
||||||
|
#include "llimage.h"
|
||||||
|
#include "llrender.h"
|
||||||
#include "lltexlayer.h"
|
#include "lltexlayer.h"
|
||||||
#include "llviewertexture.h"
|
#include "llgltexture.h"
|
||||||
#include "lltextureentry.h"
|
|
||||||
#include "lluuid.h"
|
#include "lluuid.h"
|
||||||
#include "llwearable.h"
|
#include "llwearable.h"
|
||||||
|
|
||||||
@@ -41,7 +42,7 @@ LLLocalTextureObject::LLLocalTextureObject() :
|
|||||||
mImage = NULL;
|
mImage = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
LLLocalTextureObject::LLLocalTextureObject(LLViewerFetchedTexture* image, const LLUUID& id) :
|
LLLocalTextureObject::LLLocalTextureObject(LLGLTexture* image, const LLUUID& id) :
|
||||||
mIsBakedReady(FALSE),
|
mIsBakedReady(FALSE),
|
||||||
mDiscard(MAX_DISCARD_LEVEL+1)
|
mDiscard(MAX_DISCARD_LEVEL+1)
|
||||||
{
|
{
|
||||||
@@ -77,7 +78,7 @@ LLLocalTextureObject::~LLLocalTextureObject()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
LLViewerFetchedTexture* LLLocalTextureObject::getImage() const
|
LLGLTexture* LLLocalTextureObject::getImage() const
|
||||||
{
|
{
|
||||||
return mImage;
|
return mImage;
|
||||||
}
|
}
|
||||||
@@ -126,7 +127,7 @@ BOOL LLLocalTextureObject::getBakedReady() const
|
|||||||
return mIsBakedReady;
|
return mIsBakedReady;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLLocalTextureObject::setImage(LLViewerFetchedTexture* new_image)
|
void LLLocalTextureObject::setImage(LLGLTexture* new_image)
|
||||||
{
|
{
|
||||||
mImage = new_image;
|
mImage = new_image;
|
||||||
}
|
}
|
||||||
@@ -29,11 +29,10 @@
|
|||||||
|
|
||||||
#include <boost/shared_ptr.hpp>
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
#include "llviewertexture.h"
|
#include "llpointer.h"
|
||||||
|
#include "llgltexture.h"
|
||||||
|
|
||||||
class LLUUID;
|
|
||||||
class LLTexLayer;
|
class LLTexLayer;
|
||||||
class LLTextureEntry;
|
|
||||||
class LLTexLayerTemplate;
|
class LLTexLayerTemplate;
|
||||||
class LLWearable;
|
class LLWearable;
|
||||||
|
|
||||||
@@ -44,11 +43,11 @@ class LLLocalTextureObject
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LLLocalTextureObject();
|
LLLocalTextureObject();
|
||||||
LLLocalTextureObject(LLViewerFetchedTexture* image, const LLUUID& id);
|
LLLocalTextureObject(LLGLTexture* image, const LLUUID& id);
|
||||||
LLLocalTextureObject(const LLLocalTextureObject& lto);
|
LLLocalTextureObject(const LLLocalTextureObject& lto);
|
||||||
~LLLocalTextureObject();
|
~LLLocalTextureObject();
|
||||||
|
|
||||||
LLViewerFetchedTexture* getImage() const;
|
LLGLTexture* getImage() const;
|
||||||
LLTexLayer* getTexLayer(U32 index) const;
|
LLTexLayer* getTexLayer(U32 index) const;
|
||||||
LLTexLayer* getTexLayer(const std::string &name);
|
LLTexLayer* getTexLayer(const std::string &name);
|
||||||
U32 getNumTexLayers() const;
|
U32 getNumTexLayers() const;
|
||||||
@@ -56,7 +55,7 @@ public:
|
|||||||
S32 getDiscard() const;
|
S32 getDiscard() const;
|
||||||
BOOL getBakedReady() const;
|
BOOL getBakedReady() const;
|
||||||
|
|
||||||
void setImage(LLViewerFetchedTexture* new_image);
|
void setImage(LLGLTexture* new_image);
|
||||||
BOOL setTexLayer(LLTexLayer *new_tex_layer, U32 index);
|
BOOL setTexLayer(LLTexLayer *new_tex_layer, U32 index);
|
||||||
BOOL addTexLayer(LLTexLayer *new_tex_layer, LLWearable *wearable);
|
BOOL addTexLayer(LLTexLayer *new_tex_layer, LLWearable *wearable);
|
||||||
BOOL addTexLayer(LLTexLayerTemplate *new_tex_layer, LLWearable *wearable);
|
BOOL addTexLayer(LLTexLayerTemplate *new_tex_layer, LLWearable *wearable);
|
||||||
@@ -70,7 +69,7 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
LLPointer<LLViewerFetchedTexture> mImage;
|
LLPointer<LLGLTexture> mImage;
|
||||||
// NOTE: LLLocalTextureObject should be the exclusive owner of mTexEntry and mTexLayer
|
// NOTE: LLLocalTextureObject should be the exclusive owner of mTexEntry and mTexLayer
|
||||||
// using shared pointers here only for smart assignment & cleanup
|
// using shared pointers here only for smart assignment & cleanup
|
||||||
// do NOT create new shared pointers to these objects, or keep pointers to them around
|
// do NOT create new shared pointers to these objects, or keep pointers to them around
|
||||||
@@ -27,25 +27,24 @@
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Header Files
|
// Header Files
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
#include "llviewerprecompiledheaders.h"
|
#include "linden_common.h"
|
||||||
|
#include "llpolymesh.h"
|
||||||
#include "llfasttimer.h"
|
#include "llfasttimer.h"
|
||||||
#include "llmemory.h"
|
#include "llmemory.h"
|
||||||
|
|
||||||
#include "llviewercontrol.h"
|
//#include "llviewercontrol.h"
|
||||||
#include "llxmltree.h"
|
#include "llxmltree.h"
|
||||||
#include "llvoavatar.h"
|
#include "llavatarappearance.h"
|
||||||
#include "llwearable.h"
|
//#include "llwearable.h"
|
||||||
#include "lldir.h"
|
#include "lldir.h"
|
||||||
#include "llvolume.h"
|
#include "llvolume.h"
|
||||||
#include "llendianswizzle.h"
|
#include "llendianswizzle.h"
|
||||||
|
|
||||||
#include "llpolymesh.h"
|
|
||||||
|
|
||||||
#define HEADER_ASCII "Linden Mesh 1.0"
|
#define HEADER_ASCII "Linden Mesh 1.0"
|
||||||
#define HEADER_BINARY "Linden Binary Mesh 1.0"
|
#define HEADER_BINARY "Linden Binary Mesh 1.0"
|
||||||
|
|
||||||
extern LLControlGroup gSavedSettings; // read only
|
//extern LLControlGroup gSavedSettings; // read only
|
||||||
|
|
||||||
LLPolyMorphData *clone_morph_param_duplicate(const LLPolyMorphData *src_data,
|
LLPolyMorphData *clone_morph_param_duplicate(const LLPolyMorphData *src_data,
|
||||||
const std::string &name);
|
const std::string &name);
|
||||||
@@ -1492,7 +1491,7 @@ BOOL LLPolyMesh::setSharedFromCurrent()
|
|||||||
std::vector< LLCharacter* >::iterator avatar_it;
|
std::vector< LLCharacter* >::iterator avatar_it;
|
||||||
for(avatar_it = LLCharacter::sInstances.begin(); avatar_it != LLCharacter::sInstances.end(); ++avatar_it)
|
for(avatar_it = LLCharacter::sInstances.begin(); avatar_it != LLCharacter::sInstances.end(); ++avatar_it)
|
||||||
{
|
{
|
||||||
LLVOAvatar* avatarp = (LLVOAvatar*)*avatar_it;
|
LLAvatarAppearance* avatarp = (LLAvatarAppearance*)*avatar_it;
|
||||||
LLPolyMesh* mesh = avatarp->getMesh(mSharedData);
|
LLPolyMesh* mesh = avatarp->getMesh(mSharedData);
|
||||||
if (mesh)
|
if (mesh)
|
||||||
{
|
{
|
||||||
@@ -1770,250 +1769,4 @@ F32* LLPolyMesh::getWritableWeights() const
|
|||||||
return mSharedData->mWeights;
|
return mSharedData->mWeights;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// LLPolySkeletalDistortionInfo()
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
LLPolySkeletalDistortionInfo::LLPolySkeletalDistortionInfo()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL LLPolySkeletalDistortionInfo::parseXml(LLXmlTreeNode* node)
|
|
||||||
{
|
|
||||||
llassert( node->hasName( "param" ) && node->getChildByName( "param_skeleton" ) );
|
|
||||||
|
|
||||||
if (!LLViewerVisualParamInfo::parseXml(node))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
LLXmlTreeNode* skeletalParam = node->getChildByName("param_skeleton");
|
|
||||||
|
|
||||||
if (NULL == skeletalParam)
|
|
||||||
{
|
|
||||||
llwarns << "Failed to getChildByName(\"param_skeleton\")"
|
|
||||||
<< llendl;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
for( LLXmlTreeNode* bone = skeletalParam->getFirstChild(); bone; bone = skeletalParam->getNextChild() )
|
|
||||||
{
|
|
||||||
if (bone->hasName("bone"))
|
|
||||||
{
|
|
||||||
std::string name;
|
|
||||||
LLVector3 scale;
|
|
||||||
LLVector3 pos;
|
|
||||||
BOOL haspos = FALSE;
|
|
||||||
|
|
||||||
static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
|
|
||||||
if (!bone->getFastAttributeString(name_string, name))
|
|
||||||
{
|
|
||||||
llwarns << "No bone name specified for skeletal param." << llendl;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
static LLStdStringHandle scale_string = LLXmlTree::addAttributeString("scale");
|
|
||||||
if (!bone->getFastAttributeVector3(scale_string, scale))
|
|
||||||
{
|
|
||||||
llwarns << "No scale specified for bone " << name << "." << llendl;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// optional offset deformation (translation)
|
|
||||||
static LLStdStringHandle offset_string = LLXmlTree::addAttributeString("offset");
|
|
||||||
if (bone->getFastAttributeVector3(offset_string, pos))
|
|
||||||
{
|
|
||||||
haspos = TRUE;
|
|
||||||
}
|
|
||||||
mBoneInfoList.push_back(LLPolySkeletalBoneInfo(name, scale, pos, haspos));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
llwarns << "Unrecognized element " << bone->getName() << " in skeletal distortion" << llendl;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// LLPolySkeletalDistortion()
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
LLPolySkeletalDistortion::LLPolySkeletalDistortion(LLVOAvatar *avatarp)
|
|
||||||
{
|
|
||||||
mAvatar = avatarp;
|
|
||||||
mDefaultVec.splat(0.001f);
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// ~LLPolySkeletalDistortion()
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
LLPolySkeletalDistortion::~LLPolySkeletalDistortion()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info)
|
|
||||||
{
|
|
||||||
llassert(mInfo == NULL);
|
|
||||||
if (info->mID < 0)
|
|
||||||
return FALSE;
|
|
||||||
mInfo = info;
|
|
||||||
mID = info->mID;
|
|
||||||
setWeight(getDefaultWeight(), FALSE );
|
|
||||||
|
|
||||||
LLPolySkeletalDistortionInfo::bone_info_list_t::iterator iter;
|
|
||||||
for (iter = getInfo()->mBoneInfoList.begin(); iter != getInfo()->mBoneInfoList.end(); iter++)
|
|
||||||
{
|
|
||||||
LLPolySkeletalBoneInfo *bone_info = &(*iter);
|
|
||||||
LLJoint* joint = mAvatar->getJoint(bone_info->mBoneName);
|
|
||||||
if (!joint)
|
|
||||||
{
|
|
||||||
llwarns << "Joint " << bone_info->mBoneName << " not found." << llendl;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mJointScales.find(joint) != mJointScales.end())
|
|
||||||
{
|
|
||||||
llwarns << "Scale deformation already supplied for joint " << joint->getName() << "." << llendl;
|
|
||||||
}
|
|
||||||
|
|
||||||
// store it
|
|
||||||
mJointScales[joint] = bone_info->mScaleDeformation;
|
|
||||||
|
|
||||||
// apply to children that need to inherit it
|
|
||||||
for (LLJoint::child_list_t::iterator iter = joint->mChildren.begin();
|
|
||||||
iter != joint->mChildren.end(); ++iter)
|
|
||||||
{
|
|
||||||
LLViewerJoint* child_joint = (LLViewerJoint*)(*iter);
|
|
||||||
if (child_joint->inheritScale())
|
|
||||||
{
|
|
||||||
LLVector3 childDeformation = LLVector3(child_joint->getScale());
|
|
||||||
childDeformation.scaleVec(bone_info->mScaleDeformation);
|
|
||||||
mJointScales[child_joint] = childDeformation;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bone_info->mHasPositionDeformation)
|
|
||||||
{
|
|
||||||
if (mJointOffsets.find(joint) != mJointOffsets.end())
|
|
||||||
{
|
|
||||||
llwarns << "Offset deformation already supplied for joint " << joint->getName() << "." << llendl;
|
|
||||||
}
|
|
||||||
mJointOffsets[joint] = bone_info->mPositionDeformation;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*virtual*/ LLViewerVisualParam* LLPolySkeletalDistortion::cloneParam(LLWearable* wearable) const
|
|
||||||
{
|
|
||||||
LLPolySkeletalDistortion *new_param = new LLPolySkeletalDistortion(mAvatar);
|
|
||||||
*new_param = *this;
|
|
||||||
return new_param;
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// apply()
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
static LLFastTimer::DeclareTimer FTM_POLYSKELETAL_DISTORTION_APPLY("Skeletal Distortion");
|
|
||||||
|
|
||||||
void LLPolySkeletalDistortion::apply( ESex avatar_sex )
|
|
||||||
{
|
|
||||||
LLFastTimer t(FTM_POLYSKELETAL_DISTORTION_APPLY);
|
|
||||||
|
|
||||||
F32 effective_weight = ( getSex() & avatar_sex ) ? mCurWeight : getDefaultWeight();
|
|
||||||
|
|
||||||
LLJoint* joint;
|
|
||||||
joint_vec_map_t::iterator iter;
|
|
||||||
|
|
||||||
for (iter = mJointScales.begin();
|
|
||||||
iter != mJointScales.end();
|
|
||||||
iter++)
|
|
||||||
{
|
|
||||||
joint = iter->first;
|
|
||||||
LLVector3 newScale = joint->getScale();
|
|
||||||
LLVector3 scaleDelta = iter->second;
|
|
||||||
newScale = newScale + (effective_weight * scaleDelta) - (mLastWeight * scaleDelta);
|
|
||||||
joint->setScale(newScale);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (iter = mJointOffsets.begin();
|
|
||||||
iter != mJointOffsets.end();
|
|
||||||
iter++)
|
|
||||||
{
|
|
||||||
joint = iter->first;
|
|
||||||
LLVector3 newPosition = joint->getPosition();
|
|
||||||
LLVector3 positionDelta = iter->second;
|
|
||||||
newPosition = newPosition + (effective_weight * positionDelta) - (mLastWeight * positionDelta);
|
|
||||||
joint->setPosition(newPosition);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mLastWeight != mCurWeight && !mIsAnimating)
|
|
||||||
{
|
|
||||||
mAvatar->setSkeletonSerialNum(mAvatar->getSkeletonSerialNum() + 1);
|
|
||||||
}
|
|
||||||
mLastWeight = mCurWeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
LLPolyMorphData *clone_morph_param_duplicate(const LLPolyMorphData *src_data,
|
|
||||||
const std::string &name)
|
|
||||||
{
|
|
||||||
LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*src_data);
|
|
||||||
cloned_morph_data->mName = name;
|
|
||||||
for (U32 v=0; v < cloned_morph_data->mNumIndices; v++)
|
|
||||||
{
|
|
||||||
cloned_morph_data->mCoords[v] = src_data->mCoords[v];
|
|
||||||
cloned_morph_data->mNormals[v] = src_data->mNormals[v];
|
|
||||||
cloned_morph_data->mBinormals[v] = src_data->mBinormals[v];
|
|
||||||
}
|
|
||||||
return cloned_morph_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
LLPolyMorphData *clone_morph_param_direction(const LLPolyMorphData *src_data,
|
|
||||||
const LLVector3 &direction,
|
|
||||||
const std::string &name)
|
|
||||||
{
|
|
||||||
LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*src_data);
|
|
||||||
cloned_morph_data->mName = name;
|
|
||||||
LLVector4a dir;
|
|
||||||
dir.load3(direction.mV);
|
|
||||||
|
|
||||||
for (U32 v=0; v < cloned_morph_data->mNumIndices; v++)
|
|
||||||
{
|
|
||||||
cloned_morph_data->mCoords[v] = dir;
|
|
||||||
cloned_morph_data->mNormals[v].clear();
|
|
||||||
cloned_morph_data->mBinormals[v].clear();
|
|
||||||
}
|
|
||||||
return cloned_morph_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
LLPolyMorphData *clone_morph_param_cleavage(const LLPolyMorphData *src_data,
|
|
||||||
F32 scale,
|
|
||||||
const std::string &name)
|
|
||||||
{
|
|
||||||
LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*src_data);
|
|
||||||
cloned_morph_data->mName = name;
|
|
||||||
|
|
||||||
LLVector4a sc;
|
|
||||||
sc.splat(scale);
|
|
||||||
|
|
||||||
LLVector4a nsc;
|
|
||||||
nsc.set(scale, -scale, scale, scale);
|
|
||||||
|
|
||||||
for (U32 v=0; v < cloned_morph_data->mNumIndices; v++)
|
|
||||||
{
|
|
||||||
if (cloned_morph_data->mCoords[v][1] < 0)
|
|
||||||
{
|
|
||||||
cloned_morph_data->mCoords[v].setMul(src_data->mCoords[v],nsc);
|
|
||||||
cloned_morph_data->mNormals[v].setMul(src_data->mNormals[v],nsc);
|
|
||||||
cloned_morph_data->mBinormals[v].setMul(src_data->mBinormals[v],nsc);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cloned_morph_data->mCoords[v].setMul(src_data->mCoords[v],sc);
|
|
||||||
cloned_morph_data->mNormals[v].setMul(src_data->mNormals[v], sc);
|
|
||||||
cloned_morph_data->mBinormals[v].setMul(src_data->mBinormals[v],sc);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return cloned_morph_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
// End
|
// End
|
||||||
@@ -24,8 +24,8 @@
|
|||||||
* $/LicenseInfo$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LL_LLPOLYMESH_H
|
#ifndef LL_LLPOLYMESHINTERFACE_H
|
||||||
#define LL_LLPOLYMESH_H
|
#define LL_LLPOLYMESHINTERFACE_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
//#include "lldarray.h"
|
//#include "lldarray.h"
|
||||||
|
|
||||||
class LLSkinJoint;
|
class LLSkinJoint;
|
||||||
class LLVOAvatar;
|
class LLAvatarAppearance;
|
||||||
class LLWearable;
|
class LLWearable;
|
||||||
|
|
||||||
//#define USE_STRIPS // Use tri-strips for rendering.
|
//#define USE_STRIPS // Use tri-strips for rendering.
|
||||||
@@ -340,8 +340,8 @@ public:
|
|||||||
|
|
||||||
BOOL isLOD() { return mSharedData && mSharedData->isLOD(); }
|
BOOL isLOD() { return mSharedData && mSharedData->isLOD(); }
|
||||||
|
|
||||||
void setAvatar(LLVOAvatar* avatarp) { mAvatarp = avatarp; }
|
void setAvatar(LLAvatarAppearance* avatarp) { mAvatarp = avatarp; }
|
||||||
LLVOAvatar* getAvatar() { return mAvatarp; }
|
LLAvatarAppearance* getAvatar() { return mAvatarp; }
|
||||||
|
|
||||||
LLDynamicArray<LLJointRenderData*> mJointRenderData;
|
LLDynamicArray<LLJointRenderData*> mJointRenderData;
|
||||||
|
|
||||||
@@ -384,87 +384,8 @@ protected:
|
|||||||
static LLPolyMeshSharedDataTable sGlobalSharedMeshList;
|
static LLPolyMeshSharedDataTable sGlobalSharedMeshList;
|
||||||
|
|
||||||
// Backlink only; don't make this an LLPointer.
|
// Backlink only; don't make this an LLPointer.
|
||||||
LLVOAvatar* mAvatarp;
|
LLAvatarAppearance* mAvatarp;
|
||||||
};
|
};
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
#endif // LL_LLPOLYMESHINTERFACE_H
|
||||||
// LLPolySkeletalDeformationInfo
|
|
||||||
// Shared information for LLPolySkeletalDeformations
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
struct LLPolySkeletalBoneInfo
|
|
||||||
{
|
|
||||||
LLPolySkeletalBoneInfo(std::string &name, LLVector3 &scale, LLVector3 &pos, BOOL haspos)
|
|
||||||
: mBoneName(name),
|
|
||||||
mScaleDeformation(scale),
|
|
||||||
mPositionDeformation(pos),
|
|
||||||
mHasPositionDeformation(haspos) {}
|
|
||||||
std::string mBoneName;
|
|
||||||
LLVector3 mScaleDeformation;
|
|
||||||
LLVector3 mPositionDeformation;
|
|
||||||
BOOL mHasPositionDeformation;
|
|
||||||
};
|
|
||||||
|
|
||||||
class LLPolySkeletalDistortionInfo : public LLViewerVisualParamInfo
|
|
||||||
{
|
|
||||||
friend class LLPolySkeletalDistortion;
|
|
||||||
public:
|
|
||||||
LLPolySkeletalDistortionInfo();
|
|
||||||
/*virtual*/ ~LLPolySkeletalDistortionInfo() {};
|
|
||||||
|
|
||||||
/*virtual*/ BOOL parseXml(LLXmlTreeNode* node);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
typedef std::vector<LLPolySkeletalBoneInfo> bone_info_list_t;
|
|
||||||
bone_info_list_t mBoneInfoList;
|
|
||||||
};
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// LLPolySkeletalDeformation
|
|
||||||
// A set of joint scale data for deforming the avatar mesh
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
class LLPolySkeletalDistortion : public LLViewerVisualParam
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
LLPolySkeletalDistortion(LLVOAvatar *avatarp);
|
|
||||||
~LLPolySkeletalDistortion();
|
|
||||||
|
|
||||||
void* operator new(size_t size)
|
|
||||||
{
|
|
||||||
return ll_aligned_malloc_16(size);
|
|
||||||
}
|
|
||||||
|
|
||||||
void operator delete(void* ptr)
|
|
||||||
{
|
|
||||||
ll_aligned_free_16(ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Special: These functions are overridden by child classes
|
|
||||||
LLPolySkeletalDistortionInfo* getInfo() const { return (LLPolySkeletalDistortionInfo*)mInfo; }
|
|
||||||
// This sets mInfo and calls initialization functions
|
|
||||||
BOOL setInfo(LLPolySkeletalDistortionInfo *info);
|
|
||||||
|
|
||||||
/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const;
|
|
||||||
|
|
||||||
// LLVisualParam Virtual functions
|
|
||||||
///*virtual*/ BOOL parseData(LLXmlTreeNode* node);
|
|
||||||
/*virtual*/ void apply( ESex sex );
|
|
||||||
|
|
||||||
// LLViewerVisualParam Virtual functions
|
|
||||||
/*virtual*/ F32 getTotalDistortion() { return 0.1f; }
|
|
||||||
/*virtual*/ const LLVector4a& getAvgDistortion() { return mDefaultVec; }
|
|
||||||
/*virtual*/ F32 getMaxDistortion() { return 0.1f; }
|
|
||||||
/*virtual*/ LLVector4a getVertexDistortion(S32 index, LLPolyMesh *poly_mesh){return LLVector4a(0.001f, 0.001f, 0.001f);}
|
|
||||||
/*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = NULL; return &mDefaultVec;};
|
|
||||||
/*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = NULL; return NULL;};
|
|
||||||
|
|
||||||
protected:
|
|
||||||
typedef std::map<LLJoint*, LLVector3> joint_vec_map_t;
|
|
||||||
joint_vec_map_t mJointScales;
|
|
||||||
joint_vec_map_t mJointOffsets;
|
|
||||||
LLVector4a mDefaultVec;
|
|
||||||
// Backlink only; don't make this an LLPointer.
|
|
||||||
LLVOAvatar *mAvatar;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // LL_LLPOLYMESH_H
|
|
||||||
|
|
||||||
@@ -27,13 +27,15 @@
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Header Files
|
// Header Files
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
#include "llviewerprecompiledheaders.h"
|
|
||||||
|
|
||||||
#include "llpolymorph.h"
|
#include "llpolymorph.h"
|
||||||
#include "llvoavatar.h"
|
#include "llavatarappearance.h"
|
||||||
#include "llwearable.h"
|
#include "llavatarjoint.h"
|
||||||
|
//#include "llwearable.h"
|
||||||
#include "llxmltree.h"
|
#include "llxmltree.h"
|
||||||
#include "llendianswizzle.h"
|
#include "llendianswizzle.h"
|
||||||
|
#include "llpolymesh.h"
|
||||||
|
#include "v2math.h"
|
||||||
|
|
||||||
//#include "../tools/imdebug/imdebug.h"
|
//#include "../tools/imdebug/imdebug.h"
|
||||||
|
|
||||||
@@ -462,7 +464,7 @@ BOOL LLPolyMorphData::setMorphFromMesh(LLPolyMesh *morph)
|
|||||||
std::vector< LLCharacter* >::iterator avatar_it;
|
std::vector< LLCharacter* >::iterator avatar_it;
|
||||||
for(avatar_it = LLCharacter::sInstances.begin(); avatar_it != LLCharacter::sInstances.end(); ++avatar_it)
|
for(avatar_it = LLCharacter::sInstances.begin(); avatar_it != LLCharacter::sInstances.end(); ++avatar_it)
|
||||||
{
|
{
|
||||||
LLVOAvatar* avatarp = (LLVOAvatar*)*avatar_it;
|
LLAvatarAppearance* avatarp = (LLAvatarAppearance*)*avatar_it;
|
||||||
|
|
||||||
LLPolyMorphTarget* param = (LLPolyMorphTarget*) avatarp->getVisualParam(mName.c_str());
|
LLPolyMorphTarget* param = (LLPolyMorphTarget*) avatarp->getVisualParam(mName.c_str());
|
||||||
if (!param)
|
if (!param)
|
||||||
@@ -633,7 +635,7 @@ BOOL LLPolyMorphTarget::setInfo(LLPolyMorphTargetInfo* info)
|
|||||||
mID = info->mID;
|
mID = info->mID;
|
||||||
setWeight(getDefaultWeight(), FALSE );
|
setWeight(getDefaultWeight(), FALSE );
|
||||||
|
|
||||||
LLVOAvatar* avatarp = mMesh->getAvatar();
|
LLAvatarAppearance* avatarp = mMesh->getAvatar();
|
||||||
LLPolyMorphTargetInfo::volume_info_list_t::iterator iter;
|
LLPolyMorphTargetInfo::volume_info_list_t::iterator iter;
|
||||||
for (iter = getInfo()->mVolumeInfoList.begin(); iter != getInfo()->mVolumeInfoList.end(); iter++)
|
for (iter = getInfo()->mVolumeInfoList.begin(); iter != getInfo()->mVolumeInfoList.end(); iter++)
|
||||||
{
|
{
|
||||||
@@ -2,31 +2,25 @@
|
|||||||
* @file llpolymorph.h
|
* @file llpolymorph.h
|
||||||
* @brief Implementation of LLPolyMesh class
|
* @brief Implementation of LLPolyMesh class
|
||||||
*
|
*
|
||||||
* $LicenseInfo:firstyear=2001&license=viewergpl$
|
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||||
*
|
|
||||||
* Copyright (c) 2001-2009, Linden Research, Inc.
|
|
||||||
*
|
|
||||||
* Second Life Viewer Source Code
|
* Second Life Viewer Source Code
|
||||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
* Copyright (C) 2010, Linden Research, Inc.
|
||||||
* 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://secondlifegrid.net/programs/open_source/licensing/gplv2
|
|
||||||
*
|
*
|
||||||
* There are special exceptions to the terms and conditions of the GPL as
|
* This library is free software; you can redistribute it and/or
|
||||||
* it is applied to this Source Code. View the full text of the exception
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
* License as published by the Free Software Foundation;
|
||||||
* online at
|
* version 2.1 of the License only.
|
||||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
|
||||||
*
|
*
|
||||||
* By copying, modifying or distributing this software, you acknowledge
|
* This library is distributed in the hope that it will be useful,
|
||||||
* that you have read and understood your obligations described above,
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* and agree to abide by those obligations.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
* License along with this library; if not, write to the Free Software
|
||||||
* COMPLETENESS OR PERFORMANCE.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
* $/LicenseInfo$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -38,10 +32,10 @@
|
|||||||
|
|
||||||
#include "llviewervisualparam.h"
|
#include "llviewervisualparam.h"
|
||||||
|
|
||||||
|
class LLAvatarJointCollisionVolume;
|
||||||
class LLPolyMeshSharedData;
|
class LLPolyMeshSharedData;
|
||||||
class LLVOAvatar;
|
|
||||||
class LLVector2;
|
class LLVector2;
|
||||||
class LLViewerJointCollisionVolume;
|
class LLAvatarJointCollisionVolume;
|
||||||
class LLWearable;
|
class LLWearable;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -127,10 +121,10 @@ struct LLPolyVolumeMorphInfo
|
|||||||
|
|
||||||
struct LLPolyVolumeMorph
|
struct LLPolyVolumeMorph
|
||||||
{
|
{
|
||||||
LLPolyVolumeMorph(LLViewerJointCollisionVolume* volume, LLVector3 scale, LLVector3 pos)
|
LLPolyVolumeMorph(LLAvatarJointCollisionVolume* volume, LLVector3 scale, LLVector3 pos)
|
||||||
: mVolume(volume), mScale(scale), mPos(pos) {};
|
: mVolume(volume), mScale(scale), mPos(pos) {};
|
||||||
|
|
||||||
LLViewerJointCollisionVolume* mVolume;
|
LLAvatarJointCollisionVolume* mVolume;
|
||||||
LLVector3 mScale;
|
LLVector3 mScale;
|
||||||
LLVector3 mPos;
|
LLVector3 mPos;
|
||||||
};
|
};
|
||||||
293
indra/llappearance/llpolyskeletaldistortion.cpp
Normal file
293
indra/llappearance/llpolyskeletaldistortion.cpp
Normal file
@@ -0,0 +1,293 @@
|
|||||||
|
/**
|
||||||
|
* @file llpolyskeletaldistortion.cpp
|
||||||
|
* @brief Implementation of LLPolySkeletalDistortion classes
|
||||||
|
*
|
||||||
|
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||||
|
* Second Life Viewer Source Code
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
|
* $/LicenseInfo$
|
||||||
|
*/
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// Header Files
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
#include "llpreprocessor.h"
|
||||||
|
#include "llerrorlegacy.h"
|
||||||
|
//#include "llcommon.h"
|
||||||
|
//#include "llmemory.h"
|
||||||
|
#include "llavatarappearance.h"
|
||||||
|
#include "llavatarjoint.h"
|
||||||
|
#include "llpolymorph.h"
|
||||||
|
//#include "llviewercontrol.h"
|
||||||
|
//#include "llxmltree.h"
|
||||||
|
//#include "llvoavatar.h"
|
||||||
|
//#include "llwearable.h"
|
||||||
|
//#include "lldir.h"
|
||||||
|
//#include "llvolume.h"
|
||||||
|
//#include "llendianswizzle.h"
|
||||||
|
|
||||||
|
#include "llpolyskeletaldistortion.h"
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// LLPolySkeletalDistortionInfo()
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
LLPolySkeletalDistortionInfo::LLPolySkeletalDistortionInfo()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL LLPolySkeletalDistortionInfo::parseXml(LLXmlTreeNode* node)
|
||||||
|
{
|
||||||
|
llassert( node->hasName( "param" ) && node->getChildByName( "param_skeleton" ) );
|
||||||
|
|
||||||
|
if (!LLViewerVisualParamInfo::parseXml(node))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
LLXmlTreeNode* skeletalParam = node->getChildByName("param_skeleton");
|
||||||
|
|
||||||
|
if (NULL == skeletalParam)
|
||||||
|
{
|
||||||
|
llwarns << "Failed to getChildByName(\"param_skeleton\")"
|
||||||
|
<< llendl;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
for( LLXmlTreeNode* bone = skeletalParam->getFirstChild(); bone; bone = skeletalParam->getNextChild() )
|
||||||
|
{
|
||||||
|
if (bone->hasName("bone"))
|
||||||
|
{
|
||||||
|
std::string name;
|
||||||
|
LLVector3 scale;
|
||||||
|
LLVector3 pos;
|
||||||
|
BOOL haspos = FALSE;
|
||||||
|
|
||||||
|
static LLStdStringHandle name_string = LLXmlTree::addAttributeString("name");
|
||||||
|
if (!bone->getFastAttributeString(name_string, name))
|
||||||
|
{
|
||||||
|
llwarns << "No bone name specified for skeletal param." << llendl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
static LLStdStringHandle scale_string = LLXmlTree::addAttributeString("scale");
|
||||||
|
if (!bone->getFastAttributeVector3(scale_string, scale))
|
||||||
|
{
|
||||||
|
llwarns << "No scale specified for bone " << name << "." << llendl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// optional offset deformation (translation)
|
||||||
|
static LLStdStringHandle offset_string = LLXmlTree::addAttributeString("offset");
|
||||||
|
if (bone->getFastAttributeVector3(offset_string, pos))
|
||||||
|
{
|
||||||
|
haspos = TRUE;
|
||||||
|
}
|
||||||
|
mBoneInfoList.push_back(LLPolySkeletalBoneInfo(name, scale, pos, haspos));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
llwarns << "Unrecognized element " << bone->getName() << " in skeletal distortion" << llendl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// LLPolySkeletalDistortion()
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
LLPolySkeletalDistortion::LLPolySkeletalDistortion(LLAvatarAppearance *avatarp)
|
||||||
|
{
|
||||||
|
mAvatar = avatarp;
|
||||||
|
mDefaultVec.splat(0.001f);
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// ~LLPolySkeletalDistortion()
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
LLPolySkeletalDistortion::~LLPolySkeletalDistortion()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL LLPolySkeletalDistortion::setInfo(LLPolySkeletalDistortionInfo *info)
|
||||||
|
{
|
||||||
|
llassert(mInfo == NULL);
|
||||||
|
if (info->mID < 0)
|
||||||
|
return FALSE;
|
||||||
|
mInfo = info;
|
||||||
|
mID = info->mID;
|
||||||
|
setWeight(getDefaultWeight(), FALSE );
|
||||||
|
|
||||||
|
LLPolySkeletalDistortionInfo::bone_info_list_t::iterator iter;
|
||||||
|
for (iter = getInfo()->mBoneInfoList.begin(); iter != getInfo()->mBoneInfoList.end(); iter++)
|
||||||
|
{
|
||||||
|
LLPolySkeletalBoneInfo *bone_info = &(*iter);
|
||||||
|
LLJoint* joint = mAvatar->getJoint(bone_info->mBoneName);
|
||||||
|
if (!joint)
|
||||||
|
{
|
||||||
|
llwarns << "Joint " << bone_info->mBoneName << " not found." << llendl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mJointScales.find(joint) != mJointScales.end())
|
||||||
|
{
|
||||||
|
llwarns << "Scale deformation already supplied for joint " << joint->getName() << "." << llendl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// store it
|
||||||
|
mJointScales[joint] = bone_info->mScaleDeformation;
|
||||||
|
|
||||||
|
// apply to children that need to inherit it
|
||||||
|
for (LLJoint::child_list_t::iterator iter = joint->mChildren.begin();
|
||||||
|
iter != joint->mChildren.end(); ++iter)
|
||||||
|
{
|
||||||
|
LLAvatarJoint* child_joint = (LLAvatarJoint*)(*iter);
|
||||||
|
if (child_joint->inheritScale())
|
||||||
|
{
|
||||||
|
LLVector3 childDeformation = LLVector3(child_joint->getScale());
|
||||||
|
childDeformation.scaleVec(bone_info->mScaleDeformation);
|
||||||
|
mJointScales[child_joint] = childDeformation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bone_info->mHasPositionDeformation)
|
||||||
|
{
|
||||||
|
if (mJointOffsets.find(joint) != mJointOffsets.end())
|
||||||
|
{
|
||||||
|
llwarns << "Offset deformation already supplied for joint " << joint->getName() << "." << llendl;
|
||||||
|
}
|
||||||
|
mJointOffsets[joint] = bone_info->mPositionDeformation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*virtual*/ LLViewerVisualParam* LLPolySkeletalDistortion::cloneParam(LLWearable* wearable) const
|
||||||
|
{
|
||||||
|
LLPolySkeletalDistortion *new_param = new LLPolySkeletalDistortion(mAvatar);
|
||||||
|
*new_param = *this;
|
||||||
|
return new_param;
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// apply()
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
static LLFastTimer::DeclareTimer FTM_POLYSKELETAL_DISTORTION_APPLY("Skeletal Distortion");
|
||||||
|
|
||||||
|
void LLPolySkeletalDistortion::apply( ESex avatar_sex )
|
||||||
|
{
|
||||||
|
LLFastTimer t(FTM_POLYSKELETAL_DISTORTION_APPLY);
|
||||||
|
|
||||||
|
F32 effective_weight = ( getSex() & avatar_sex ) ? mCurWeight : getDefaultWeight();
|
||||||
|
|
||||||
|
LLJoint* joint;
|
||||||
|
joint_vec_map_t::iterator iter;
|
||||||
|
|
||||||
|
for (iter = mJointScales.begin();
|
||||||
|
iter != mJointScales.end();
|
||||||
|
iter++)
|
||||||
|
{
|
||||||
|
joint = iter->first;
|
||||||
|
LLVector3 newScale = joint->getScale();
|
||||||
|
LLVector3 scaleDelta = iter->second;
|
||||||
|
newScale = newScale + (effective_weight * scaleDelta) - (mLastWeight * scaleDelta);
|
||||||
|
joint->setScale(newScale);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (iter = mJointOffsets.begin();
|
||||||
|
iter != mJointOffsets.end();
|
||||||
|
iter++)
|
||||||
|
{
|
||||||
|
joint = iter->first;
|
||||||
|
LLVector3 newPosition = joint->getPosition();
|
||||||
|
LLVector3 positionDelta = iter->second;
|
||||||
|
newPosition = newPosition + (effective_weight * positionDelta) - (mLastWeight * positionDelta);
|
||||||
|
joint->setPosition(newPosition);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mLastWeight != mCurWeight && !mIsAnimating)
|
||||||
|
{
|
||||||
|
mAvatar->setSkeletonSerialNum(mAvatar->getSkeletonSerialNum() + 1);
|
||||||
|
}
|
||||||
|
mLastWeight = mCurWeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LLPolyMorphData *clone_morph_param_duplicate(const LLPolyMorphData *src_data,
|
||||||
|
const std::string &name)
|
||||||
|
{
|
||||||
|
LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*src_data);
|
||||||
|
cloned_morph_data->mName = name;
|
||||||
|
for (U32 v=0; v < cloned_morph_data->mNumIndices; v++)
|
||||||
|
{
|
||||||
|
cloned_morph_data->mCoords[v] = src_data->mCoords[v];
|
||||||
|
cloned_morph_data->mNormals[v] = src_data->mNormals[v];
|
||||||
|
cloned_morph_data->mBinormals[v] = src_data->mBinormals[v];
|
||||||
|
}
|
||||||
|
return cloned_morph_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
LLPolyMorphData *clone_morph_param_direction(const LLPolyMorphData *src_data,
|
||||||
|
const LLVector3 &direction,
|
||||||
|
const std::string &name)
|
||||||
|
{
|
||||||
|
LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*src_data);
|
||||||
|
cloned_morph_data->mName = name;
|
||||||
|
LLVector4a dir;
|
||||||
|
dir.load3(direction.mV);
|
||||||
|
|
||||||
|
for (U32 v=0; v < cloned_morph_data->mNumIndices; v++)
|
||||||
|
{
|
||||||
|
cloned_morph_data->mCoords[v] = dir;
|
||||||
|
cloned_morph_data->mNormals[v].clear();
|
||||||
|
cloned_morph_data->mBinormals[v].clear();
|
||||||
|
}
|
||||||
|
return cloned_morph_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
LLPolyMorphData *clone_morph_param_cleavage(const LLPolyMorphData *src_data,
|
||||||
|
F32 scale,
|
||||||
|
const std::string &name)
|
||||||
|
{
|
||||||
|
LLPolyMorphData* cloned_morph_data = new LLPolyMorphData(*src_data);
|
||||||
|
cloned_morph_data->mName = name;
|
||||||
|
|
||||||
|
LLVector4a sc;
|
||||||
|
sc.splat(scale);
|
||||||
|
|
||||||
|
LLVector4a nsc;
|
||||||
|
nsc.set(scale, -scale, scale, scale);
|
||||||
|
|
||||||
|
for (U32 v=0; v < cloned_morph_data->mNumIndices; v++)
|
||||||
|
{
|
||||||
|
if (cloned_morph_data->mCoords[v][1] < 0)
|
||||||
|
{
|
||||||
|
cloned_morph_data->mCoords[v].setMul(src_data->mCoords[v],nsc);
|
||||||
|
cloned_morph_data->mNormals[v].setMul(src_data->mNormals[v],nsc);
|
||||||
|
cloned_morph_data->mBinormals[v].setMul(src_data->mBinormals[v],nsc);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cloned_morph_data->mCoords[v].setMul(src_data->mCoords[v],sc);
|
||||||
|
cloned_morph_data->mNormals[v].setMul(src_data->mNormals[v], sc);
|
||||||
|
cloned_morph_data->mBinormals[v].setMul(src_data->mBinormals[v],sc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return cloned_morph_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// End
|
||||||
130
indra/llappearance/llpolyskeletaldistortion.h
Normal file
130
indra/llappearance/llpolyskeletaldistortion.h
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
/**
|
||||||
|
* @file llpolyskeletaldistortion.h
|
||||||
|
* @brief Implementation of LLPolyMesh class
|
||||||
|
*
|
||||||
|
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||||
|
* Second Life Viewer Source Code
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
|
* $/LicenseInfo$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LL_LLPOLYSKELETALDISTORTION_H
|
||||||
|
#define LL_LLPOLYSKELETALDISTORTION_H
|
||||||
|
|
||||||
|
#include "llcommon.h"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <map>
|
||||||
|
#include "llstl.h"
|
||||||
|
|
||||||
|
#include "v3math.h"
|
||||||
|
#include "v2math.h"
|
||||||
|
#include "llquaternion.h"
|
||||||
|
//#include "llpolymorph.h"
|
||||||
|
#include "lljoint.h"
|
||||||
|
#include "llviewervisualparam.h"
|
||||||
|
//#include "lldarray.h"
|
||||||
|
|
||||||
|
//class LLSkinJoint;
|
||||||
|
class LLAvatarAppearance;
|
||||||
|
|
||||||
|
//#define USE_STRIPS // Use tri-strips for rendering.
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// LLPolySkeletalDeformationInfo
|
||||||
|
// Shared information for LLPolySkeletalDeformations
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
struct LLPolySkeletalBoneInfo
|
||||||
|
{
|
||||||
|
LLPolySkeletalBoneInfo(std::string &name, LLVector3 &scale, LLVector3 &pos, BOOL haspos)
|
||||||
|
: mBoneName(name),
|
||||||
|
mScaleDeformation(scale),
|
||||||
|
mPositionDeformation(pos),
|
||||||
|
mHasPositionDeformation(haspos) {}
|
||||||
|
std::string mBoneName;
|
||||||
|
LLVector3 mScaleDeformation;
|
||||||
|
LLVector3 mPositionDeformation;
|
||||||
|
BOOL mHasPositionDeformation;
|
||||||
|
};
|
||||||
|
|
||||||
|
class LLPolySkeletalDistortionInfo : public LLViewerVisualParamInfo
|
||||||
|
{
|
||||||
|
friend class LLPolySkeletalDistortion;
|
||||||
|
public:
|
||||||
|
|
||||||
|
LLPolySkeletalDistortionInfo();
|
||||||
|
/*virtual*/ ~LLPolySkeletalDistortionInfo() {};
|
||||||
|
|
||||||
|
/*virtual*/ BOOL parseXml(LLXmlTreeNode* node);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
typedef std::vector<LLPolySkeletalBoneInfo> bone_info_list_t;
|
||||||
|
bone_info_list_t mBoneInfoList;
|
||||||
|
};
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// LLPolySkeletalDeformation
|
||||||
|
// A set of joint scale data for deforming the avatar mesh
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
class LLPolySkeletalDistortion : public LLViewerVisualParam
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void* operator new(size_t size)
|
||||||
|
{
|
||||||
|
return ll_aligned_malloc_16(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator delete(void* ptr)
|
||||||
|
{
|
||||||
|
ll_aligned_free_16(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
LLPolySkeletalDistortion(LLAvatarAppearance *avatarp);
|
||||||
|
~LLPolySkeletalDistortion();
|
||||||
|
|
||||||
|
// Special: These functions are overridden by child classes
|
||||||
|
LLPolySkeletalDistortionInfo* getInfo() const { return (LLPolySkeletalDistortionInfo*)mInfo; }
|
||||||
|
// This sets mInfo and calls initialization functions
|
||||||
|
BOOL setInfo(LLPolySkeletalDistortionInfo *info);
|
||||||
|
|
||||||
|
/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const;
|
||||||
|
|
||||||
|
// LLVisualParam Virtual functions
|
||||||
|
///*virtual*/ BOOL parseData(LLXmlTreeNode* node);
|
||||||
|
/*virtual*/ void apply( ESex sex );
|
||||||
|
|
||||||
|
// LLViewerVisualParam Virtual functions
|
||||||
|
/*virtual*/ F32 getTotalDistortion() { return 0.1f; }
|
||||||
|
/*virtual*/ const LLVector4a& getAvgDistortion() { return mDefaultVec; }
|
||||||
|
/*virtual*/ F32 getMaxDistortion() { return 0.1f; }
|
||||||
|
/*virtual*/ LLVector4a getVertexDistortion(S32 index, LLPolyMesh *poly_mesh){return LLVector4a(0.001f, 0.001f, 0.001f);}
|
||||||
|
/*virtual*/ const LLVector4a* getFirstDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = NULL; return &mDefaultVec;};
|
||||||
|
/*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = NULL; return NULL;};
|
||||||
|
|
||||||
|
protected:
|
||||||
|
typedef std::map<LLJoint*, LLVector3> joint_vec_map_t;
|
||||||
|
joint_vec_map_t mJointScales;
|
||||||
|
joint_vec_map_t mJointOffsets;
|
||||||
|
LLVector4a mDefaultVec;
|
||||||
|
// Backlink only; don't make this an LLPointer.
|
||||||
|
LLAvatarAppearance *mAvatar;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // LL_LLPOLYSKELETALDISTORTION_H
|
||||||
|
|
||||||
@@ -24,20 +24,20 @@
|
|||||||
* $/LicenseInfo$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "llviewerprecompiledheaders.h"
|
#include "linden_common.h"
|
||||||
#include "llagent.h"
|
#include "llavatarappearance.h"
|
||||||
#include "lltexlayer.h"
|
#include "lltexlayer.h"
|
||||||
#include "llvoavatar.h"
|
|
||||||
#include "llwearable.h"
|
|
||||||
#include "lltexglobalcolor.h"
|
#include "lltexglobalcolor.h"
|
||||||
|
|
||||||
|
class LLWearable;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// LLTexGlobalColor
|
// LLTexGlobalColor
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
LLTexGlobalColor::LLTexGlobalColor(LLVOAvatar* avatar)
|
LLTexGlobalColor::LLTexGlobalColor(LLAvatarAppearance* appearance)
|
||||||
:
|
:
|
||||||
mAvatar(avatar),
|
mAvatarAppearance(appearance),
|
||||||
mInfo(NULL)
|
mInfo(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -91,7 +91,7 @@ const std::string& LLTexGlobalColor::getName() const
|
|||||||
// LLTexParamGlobalColor
|
// LLTexParamGlobalColor
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
LLTexParamGlobalColor::LLTexParamGlobalColor(LLTexGlobalColor* tex_global_color) :
|
LLTexParamGlobalColor::LLTexParamGlobalColor(LLTexGlobalColor* tex_global_color) :
|
||||||
LLTexLayerParamColor(tex_global_color->getAvatar()),
|
LLTexLayerParamColor(tex_global_color->getAvatarAppearance()),
|
||||||
mTexGlobalColor(tex_global_color)
|
mTexGlobalColor(tex_global_color)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -105,7 +105,7 @@ LLTexParamGlobalColor::LLTexParamGlobalColor(LLTexGlobalColor* tex_global_color)
|
|||||||
|
|
||||||
void LLTexParamGlobalColor::onGlobalColorChanged(bool upload_bake)
|
void LLTexParamGlobalColor::onGlobalColorChanged(bool upload_bake)
|
||||||
{
|
{
|
||||||
mAvatar->onGlobalColorChanged(mTexGlobalColor, upload_bake);
|
mAvatarAppearance->onGlobalColorChanged(mTexGlobalColor, upload_bake);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* @file lltexglobalcolor.h
|
* @file lltexglobalcolor.h
|
||||||
* @brief This is global texture color info used by llvoavatar.
|
* @brief This is global texture color info used by llavatarappearance.
|
||||||
*
|
*
|
||||||
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
|
* $LicenseInfo:firstyear=2008&license=viewerlgpl$
|
||||||
* Second Life Viewer Source Code
|
* Second Life Viewer Source Code
|
||||||
@@ -30,31 +30,31 @@
|
|||||||
#include "lltexlayer.h"
|
#include "lltexlayer.h"
|
||||||
#include "lltexlayerparams.h"
|
#include "lltexlayerparams.h"
|
||||||
|
|
||||||
class LLVOAvatar;
|
class LLAvatarAppearance;
|
||||||
class LLWearable;
|
class LLWearable;
|
||||||
class LLTexGlobalColorInfo;
|
class LLTexGlobalColorInfo;
|
||||||
|
|
||||||
class LLTexGlobalColor
|
class LLTexGlobalColor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LLTexGlobalColor( LLVOAvatar* avatar );
|
LLTexGlobalColor( LLAvatarAppearance* appearance );
|
||||||
~LLTexGlobalColor();
|
~LLTexGlobalColor();
|
||||||
|
|
||||||
LLTexGlobalColorInfo* getInfo() const { return mInfo; }
|
LLTexGlobalColorInfo* getInfo() const { return mInfo; }
|
||||||
// This sets mInfo and calls initialization functions
|
// This sets mInfo and calls initialization functions
|
||||||
BOOL setInfo(LLTexGlobalColorInfo *info);
|
BOOL setInfo(LLTexGlobalColorInfo *info);
|
||||||
|
|
||||||
LLVOAvatar* getAvatar() const { return mAvatar; }
|
LLAvatarAppearance* getAvatarAppearance() const { return mAvatarAppearance; }
|
||||||
LLColor4 getColor() const;
|
LLColor4 getColor() const;
|
||||||
const std::string& getName() const;
|
const std::string& getName() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
param_color_list_t mParamGlobalColorList;
|
param_color_list_t mParamGlobalColorList;
|
||||||
LLVOAvatar* mAvatar; // just backlink, don't LLPointer
|
LLAvatarAppearance* mAvatarAppearance; // just backlink, don't LLPointer
|
||||||
LLTexGlobalColorInfo *mInfo;
|
LLTexGlobalColorInfo *mInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Used by llvoavatar to determine skin/eye/hair color.
|
// Used by llavatarappearance to determine skin/eye/hair color.
|
||||||
class LLTexGlobalColorInfo
|
class LLTexGlobalColorInfo
|
||||||
{
|
{
|
||||||
friend class LLTexGlobalColor;
|
friend class LLTexGlobalColor;
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -28,14 +28,15 @@
|
|||||||
#define LL_LLTEXLAYER_H
|
#define LL_LLTEXLAYER_H
|
||||||
|
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include "lldynamictexture.h"
|
#include "llglslshader.h"
|
||||||
#include "llvoavatardefines.h"
|
#include "llgltexture.h"
|
||||||
|
#include "llavatarappearancedefines.h"
|
||||||
#include "lltexlayerparams.h"
|
#include "lltexlayerparams.h"
|
||||||
|
|
||||||
class LLVOAvatar;
|
class LLAvatarAppearance;
|
||||||
class LLVOAvatarSelf;
|
|
||||||
class LLImageTGA;
|
class LLImageTGA;
|
||||||
class LLImageRaw;
|
class LLImageRaw;
|
||||||
|
class LLLocalTextureObject;
|
||||||
class LLXmlTreeNode;
|
class LLXmlTreeNode;
|
||||||
class LLTexLayerSet;
|
class LLTexLayerSet;
|
||||||
class LLTexLayerSetInfo;
|
class LLTexLayerSetInfo;
|
||||||
@@ -71,6 +72,8 @@ public:
|
|||||||
|
|
||||||
const LLTexLayerInfo* getInfo() const { return mInfo; }
|
const LLTexLayerInfo* getInfo() const { return mInfo; }
|
||||||
virtual BOOL setInfo(const LLTexLayerInfo *info, LLWearable* wearable); // sets mInfo, calls initialization functions
|
virtual BOOL setInfo(const LLTexLayerInfo *info, LLWearable* wearable); // sets mInfo, calls initialization functions
|
||||||
|
LLWearableType::EType getWearableType() const;
|
||||||
|
LLAvatarAppearanceDefines::ETextureIndex getLocalTextureIndex() const;
|
||||||
|
|
||||||
const std::string& getName() const;
|
const std::string& getName() const;
|
||||||
const LLTexLayerSet* const getTexLayerSet() const { return mTexLayerSet; }
|
const LLTexLayerSet* const getTexLayerSet() const { return mTexLayerSet; }
|
||||||
@@ -88,6 +91,8 @@ public:
|
|||||||
ERenderPass getRenderPass() const;
|
ERenderPass getRenderPass() const;
|
||||||
BOOL isVisibilityMask() const;
|
BOOL isVisibilityMask() const;
|
||||||
|
|
||||||
|
virtual void asLLSD(LLSD& sd) const {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const std::string& getGlobalColor() const;
|
const std::string& getGlobalColor() const;
|
||||||
LLViewerVisualParam* getVisualParamPtr(S32 index) const;
|
LLViewerVisualParam* getVisualParamPtr(S32 index) const;
|
||||||
@@ -113,7 +118,7 @@ protected:
|
|||||||
class LLTexLayerTemplate : public LLTexLayerInterface
|
class LLTexLayerTemplate : public LLTexLayerInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LLTexLayerTemplate(LLTexLayerSet* const layer_set);
|
LLTexLayerTemplate(LLTexLayerSet* const layer_set, LLAvatarAppearance* const appearance);
|
||||||
LLTexLayerTemplate(const LLTexLayerTemplate &layer);
|
LLTexLayerTemplate(const LLTexLayerTemplate &layer);
|
||||||
/*virtual*/ ~LLTexLayerTemplate();
|
/*virtual*/ ~LLTexLayerTemplate();
|
||||||
/*virtual*/ BOOL render(S32 x, S32 y, S32 width, S32 height);
|
/*virtual*/ BOOL render(S32 x, S32 y, S32 width, S32 height);
|
||||||
@@ -126,7 +131,9 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
U32 updateWearableCache() const;
|
U32 updateWearableCache() const;
|
||||||
LLTexLayer* getLayer(U32 i) const;
|
LLTexLayer* getLayer(U32 i) const;
|
||||||
|
LLAvatarAppearance* getAvatarAppearance() const { return mAvatarAppearance; }
|
||||||
private:
|
private:
|
||||||
|
LLAvatarAppearance* const mAvatarAppearance; // note: backlink only; don't make this an LLPointer.
|
||||||
typedef std::vector<LLWearable*> wearable_cache_t;
|
typedef std::vector<LLWearable*> wearable_cache_t;
|
||||||
mutable wearable_cache_t mWearableCache; // mutable b/c most get- require updating this cache
|
mutable wearable_cache_t mWearableCache; // mutable b/c most get- require updating this cache
|
||||||
};
|
};
|
||||||
@@ -160,10 +167,11 @@ public:
|
|||||||
void setLTO(LLLocalTextureObject *lto) { mLocalTextureObject = lto; }
|
void setLTO(LLLocalTextureObject *lto) { mLocalTextureObject = lto; }
|
||||||
LLLocalTextureObject* getLTO() { return mLocalTextureObject; }
|
LLLocalTextureObject* getLTO() { return mLocalTextureObject; }
|
||||||
|
|
||||||
|
/*virtual*/ void asLLSD(LLSD& sd) const;
|
||||||
|
|
||||||
static void calculateTexLayerColor(const param_color_list_t ¶m_list, LLColor4 &net_color);
|
static void calculateTexLayerColor(const param_color_list_t ¶m_list, LLColor4 &net_color);
|
||||||
protected:
|
protected:
|
||||||
LLUUID getUUID() const;
|
LLUUID getUUID() const;
|
||||||
private:
|
|
||||||
typedef std::map<U32, U8*> alpha_cache_t;
|
typedef std::map<U32, U8*> alpha_cache_t;
|
||||||
alpha_cache_t mAlphaCache;
|
alpha_cache_t mAlphaCache;
|
||||||
LLLocalTextureObject* mLocalTextureObject;
|
LLLocalTextureObject* mLocalTextureObject;
|
||||||
@@ -179,8 +187,14 @@ class LLTexLayerSet
|
|||||||
{
|
{
|
||||||
friend class LLTexLayerSetBuffer;
|
friend class LLTexLayerSetBuffer;
|
||||||
public:
|
public:
|
||||||
LLTexLayerSet(LLVOAvatarSelf* const avatar);
|
LLTexLayerSet(LLAvatarAppearance* const appearance);
|
||||||
~LLTexLayerSet();
|
virtual ~LLTexLayerSet();
|
||||||
|
|
||||||
|
LLTexLayerSetBuffer* getComposite();
|
||||||
|
const LLTexLayerSetBuffer* getComposite() const; // Do not create one if it doesn't exist.
|
||||||
|
virtual void createComposite() = 0;
|
||||||
|
void destroyComposite();
|
||||||
|
void gatherMorphMaskAlpha(U8 *data, S32 origin_x, S32 origin_y, S32 width, S32 height);
|
||||||
|
|
||||||
const LLTexLayerSetInfo* getInfo() const { return mInfo; }
|
const LLTexLayerSetInfo* getInfo() const { return mInfo; }
|
||||||
BOOL setInfo(const LLTexLayerSetInfo *info); // This sets mInfo and calls initialization functions
|
BOOL setInfo(const LLTexLayerSetInfo *info); // This sets mInfo and calls initialization functions
|
||||||
@@ -189,45 +203,34 @@ public:
|
|||||||
void renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height, bool forceClear = false);
|
void renderAlphaMaskTextures(S32 x, S32 y, S32 width, S32 height, bool forceClear = false);
|
||||||
|
|
||||||
BOOL isBodyRegion(const std::string& region) const;
|
BOOL isBodyRegion(const std::string& region) const;
|
||||||
LLTexLayerSetBuffer* getComposite();
|
|
||||||
const LLTexLayerSetBuffer* getComposite() const; // Do not create one if it doesn't exist.
|
|
||||||
void requestUpdate();
|
|
||||||
void requestUpload();
|
|
||||||
void cancelUpload();
|
|
||||||
void updateComposite();
|
|
||||||
BOOL isLocalTextureDataAvailable() const;
|
|
||||||
BOOL isLocalTextureDataFinal() const;
|
|
||||||
void createComposite();
|
|
||||||
void destroyComposite();
|
|
||||||
void setUpdatesEnabled(BOOL b);
|
|
||||||
BOOL getUpdatesEnabled() const { return mUpdatesEnabled; }
|
|
||||||
void deleteCaches();
|
|
||||||
void gatherMorphMaskAlpha(U8 *data, S32 width, S32 height);
|
|
||||||
void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components);
|
void applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_components);
|
||||||
BOOL isMorphValid() const;
|
BOOL isMorphValid() const;
|
||||||
|
virtual void requestUpdate() = 0;
|
||||||
void invalidateMorphMasks();
|
void invalidateMorphMasks();
|
||||||
|
void deleteCaches();
|
||||||
LLTexLayerInterface* findLayerByName(const std::string& name);
|
LLTexLayerInterface* findLayerByName(const std::string& name);
|
||||||
void cloneTemplates(LLLocalTextureObject *lto, LLVOAvatarDefines::ETextureIndex tex_index, LLWearable* wearable);
|
void cloneTemplates(LLLocalTextureObject *lto, LLAvatarAppearanceDefines::ETextureIndex tex_index, LLWearable* wearable);
|
||||||
|
|
||||||
LLVOAvatarSelf* getAvatar() const { return mAvatar; }
|
LLAvatarAppearance* getAvatarAppearance() const { return mAvatarAppearance; }
|
||||||
const std::string getBodyRegionName() const;
|
const std::string getBodyRegionName() const;
|
||||||
BOOL hasComposite() const { return (mComposite.notNull()); }
|
BOOL hasComposite() const { return (mComposite.notNull()); }
|
||||||
LLVOAvatarDefines::EBakedTextureIndex getBakedTexIndex() { return mBakedTexIndex; }
|
LLAvatarAppearanceDefines::EBakedTextureIndex getBakedTexIndex() const { return mBakedTexIndex; }
|
||||||
void setBakedTexIndex(LLVOAvatarDefines::EBakedTextureIndex index) { mBakedTexIndex = index; }
|
void setBakedTexIndex(LLAvatarAppearanceDefines::EBakedTextureIndex index) { mBakedTexIndex = index; }
|
||||||
BOOL isVisible() const { return mIsVisible; }
|
BOOL isVisible() const { return mIsVisible; }
|
||||||
|
|
||||||
static BOOL sHasCaches;
|
static BOOL sHasCaches;
|
||||||
|
|
||||||
private:
|
virtual void asLLSD(LLSD& sd) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
typedef std::vector<LLTexLayerInterface *> layer_list_t;
|
typedef std::vector<LLTexLayerInterface *> layer_list_t;
|
||||||
layer_list_t mLayerList;
|
layer_list_t mLayerList;
|
||||||
layer_list_t mMaskLayerList;
|
layer_list_t mMaskLayerList;
|
||||||
LLPointer<LLTexLayerSetBuffer> mComposite;
|
LLPointer<LLTexLayerSetBuffer> mComposite;
|
||||||
LLVOAvatarSelf* const mAvatar; // note: backlink only; don't make this an LLPointer.
|
LLAvatarAppearance* const mAvatarAppearance; // note: backlink only; don't make this an LLPointer.
|
||||||
BOOL mUpdatesEnabled;
|
|
||||||
BOOL mIsVisible;
|
BOOL mIsVisible;
|
||||||
|
|
||||||
LLVOAvatarDefines::EBakedTextureIndex mBakedTexIndex;
|
LLAvatarAppearanceDefines::EBakedTextureIndex mBakedTexIndex;
|
||||||
const LLTexLayerSetInfo* mInfo;
|
const LLTexLayerSetInfo* mInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -243,8 +246,10 @@ public:
|
|||||||
LLTexLayerSetInfo();
|
LLTexLayerSetInfo();
|
||||||
~LLTexLayerSetInfo();
|
~LLTexLayerSetInfo();
|
||||||
BOOL parseXml(LLXmlTreeNode* node);
|
BOOL parseXml(LLXmlTreeNode* node);
|
||||||
void createVisualParams(LLVOAvatar *avatar);
|
void createVisualParams(LLAvatarAppearance *appearance);
|
||||||
private:
|
S32 getWidth() const { return mWidth; }
|
||||||
|
S32 getHeight() const { return mHeight; }
|
||||||
|
protected:
|
||||||
std::string mBodyRegion;
|
std::string mBodyRegion;
|
||||||
S32 mWidth;
|
S32 mWidth;
|
||||||
S32 mHeight;
|
S32 mHeight;
|
||||||
@@ -259,78 +264,27 @@ private:
|
|||||||
//
|
//
|
||||||
// The composite image that a LLTexLayerSet writes to. Each LLTexLayerSet has one.
|
// The composite image that a LLTexLayerSet writes to. Each LLTexLayerSet has one.
|
||||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
class LLTexLayerSetBuffer : public LLViewerDynamicTexture
|
class LLTexLayerSetBuffer : public virtual LLRefCount
|
||||||
{
|
{
|
||||||
LOG_CLASS(LLTexLayerSetBuffer);
|
LOG_CLASS(LLTexLayerSetBuffer);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LLTexLayerSetBuffer(LLTexLayerSet* const owner, S32 width, S32 height);
|
LLTexLayerSetBuffer(LLTexLayerSet* const owner);
|
||||||
virtual ~LLTexLayerSetBuffer();
|
virtual ~LLTexLayerSetBuffer();
|
||||||
|
|
||||||
public:
|
|
||||||
/*virtual*/ S8 getType() const;
|
|
||||||
BOOL isInitialized(void) const;
|
|
||||||
static void dumpTotalByteCount();
|
|
||||||
const std::string dumpTextureInfo() const;
|
|
||||||
virtual void restoreGLTexture();
|
|
||||||
virtual void destroyGLTexture();
|
|
||||||
protected:
|
protected:
|
||||||
void pushProjection() const;
|
void pushProjection() const;
|
||||||
void popProjection() const;
|
void popProjection() const;
|
||||||
private:
|
virtual void preRenderTexLayerSet();
|
||||||
|
virtual void midRenderTexLayerSet(BOOL success) {}
|
||||||
|
virtual void postRenderTexLayerSet(BOOL success);
|
||||||
|
virtual S32 getCompositeOriginX() const = 0;
|
||||||
|
virtual S32 getCompositeOriginY() const = 0;
|
||||||
|
virtual S32 getCompositeWidth() const = 0;
|
||||||
|
virtual S32 getCompositeHeight() const = 0;
|
||||||
|
BOOL renderTexLayerSet();
|
||||||
|
|
||||||
LLTexLayerSet* const mTexLayerSet;
|
LLTexLayerSet* const mTexLayerSet;
|
||||||
static S32 sGLByteCount;
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
|
||||||
// Render
|
|
||||||
//--------------------------------------------------------------------
|
|
||||||
public:
|
|
||||||
/*virtual*/ BOOL needsRender();
|
|
||||||
protected:
|
|
||||||
BOOL render(S32 x, S32 y, S32 width, S32 height);
|
|
||||||
virtual void preRender(BOOL clear_depth);
|
|
||||||
virtual void postRender(BOOL success);
|
|
||||||
virtual BOOL render();
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
|
||||||
// Uploads
|
|
||||||
//--------------------------------------------------------------------
|
|
||||||
public:
|
|
||||||
void requestUpload();
|
|
||||||
void cancelUpload();
|
|
||||||
BOOL uploadNeeded() const; // We need to upload a new texture
|
|
||||||
BOOL uploadInProgress() const; // We have started uploading a new texture and are awaiting the result
|
|
||||||
BOOL uploadPending() const; // We are expecting a new texture to be uploaded at some point
|
|
||||||
static void onTextureUploadComplete(const LLUUID& uuid,
|
|
||||||
void* userdata,
|
|
||||||
S32 result, LLExtStat ext_status);
|
|
||||||
protected:
|
|
||||||
BOOL isReadyToUpload() const;
|
|
||||||
void doUpload(); // Does a read back and upload.
|
|
||||||
void conditionalRestartUploadTimer();
|
|
||||||
private:
|
|
||||||
BOOL mNeedsUpload; // Whether we need to send our baked textures to the server
|
|
||||||
U32 mNumLowresUploads; // Number of times we've sent a lowres version of our baked textures to the server
|
|
||||||
BOOL mUploadPending; // Whether we have received back the new baked textures
|
|
||||||
LLUUID mUploadID; // The current upload process (null if none).
|
|
||||||
LLFrameTimer mNeedsUploadTimer; // Tracks time since upload was requested and performed.
|
|
||||||
S32 mUploadFailCount; // Number of consecutive upload failures
|
|
||||||
LLFrameTimer mUploadRetryTimer; // Tracks time since last upload failure.
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
|
||||||
// Updates
|
|
||||||
//--------------------------------------------------------------------
|
|
||||||
public:
|
|
||||||
void requestUpdate();
|
|
||||||
BOOL requestUpdateImmediate();
|
|
||||||
protected:
|
|
||||||
BOOL isReadyToUpdate() const;
|
|
||||||
void doUpdate();
|
|
||||||
void restartUpdateTimer();
|
|
||||||
private:
|
|
||||||
BOOL mNeedsUpdate; // Whether we need to locally update our baked textures
|
|
||||||
U32 mNumLowresUpdates; // Number of times we've locally updated with lowres version of our baked textures
|
|
||||||
LLFrameTimer mNeedsUpdateTimer; // Tracks time since update was requested and performed.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@@ -342,7 +296,7 @@ class LLTexLayerStaticImageList : public LLSingleton<LLTexLayerStaticImageList>
|
|||||||
public:
|
public:
|
||||||
LLTexLayerStaticImageList();
|
LLTexLayerStaticImageList();
|
||||||
~LLTexLayerStaticImageList();
|
~LLTexLayerStaticImageList();
|
||||||
LLViewerTexture* getTexture(const std::string& file_name, BOOL is_mask);
|
LLGLTexture* getTexture(const std::string& file_name, BOOL is_mask);
|
||||||
LLImageTGA* getImageTGA(const std::string& file_name);
|
LLImageTGA* getImageTGA(const std::string& file_name);
|
||||||
void deleteCachedImages();
|
void deleteCachedImages();
|
||||||
void dumpByteCount() const;
|
void dumpByteCount() const;
|
||||||
@@ -350,7 +304,7 @@ protected:
|
|||||||
BOOL loadImageRaw(const std::string& file_name, LLImageRaw* image_raw);
|
BOOL loadImageRaw(const std::string& file_name, LLImageRaw* image_raw);
|
||||||
private:
|
private:
|
||||||
LLStringTable mImageNames;
|
LLStringTable mImageNames;
|
||||||
typedef std::map<const char*, LLPointer<LLViewerTexture> > texture_map_t;
|
typedef std::map<const char*, LLPointer<LLGLTexture> > texture_map_t;
|
||||||
texture_map_t mStaticImageList;
|
texture_map_t mStaticImageList;
|
||||||
typedef std::map<const char*, LLPointer<LLImageTGA> > image_tga_map_t;
|
typedef std::map<const char*, LLPointer<LLImageTGA> > image_tga_map_t;
|
||||||
image_tga_map_t mStaticImageListTGA;
|
image_tga_map_t mStaticImageListTGA;
|
||||||
@@ -358,23 +312,4 @@ private:
|
|||||||
S32 mTGABytes;
|
S32 mTGABytes;
|
||||||
};
|
};
|
||||||
|
|
||||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
// LLBakedUploadData
|
|
||||||
//
|
|
||||||
// Used by LLTexLayerSetBuffer for a callback.
|
|
||||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
struct LLBakedUploadData
|
|
||||||
{
|
|
||||||
LLBakedUploadData(const LLVOAvatarSelf* avatar,
|
|
||||||
LLTexLayerSet* layerset,
|
|
||||||
const LLUUID& id,
|
|
||||||
bool highest_res);
|
|
||||||
~LLBakedUploadData() {}
|
|
||||||
const LLUUID mID;
|
|
||||||
const LLVOAvatarSelf* mAvatar; // note: backlink only; don't LLPointer
|
|
||||||
LLTexLayerSet* mTexLayerSet;
|
|
||||||
const U64 mStartTime; // for measuring baked texture upload time
|
|
||||||
const bool mIsHighestRes; // whether this is a "final" bake, or intermediate low res
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // LL_LLTEXLAYER_H
|
#endif // LL_LLTEXLAYER_H
|
||||||
@@ -24,27 +24,27 @@
|
|||||||
* $/LicenseInfo$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "llviewerprecompiledheaders.h"
|
#include "linden_common.h"
|
||||||
|
|
||||||
#include "lltexlayerparams.h"
|
#include "lltexlayerparams.h"
|
||||||
|
|
||||||
#include "llagentcamera.h"
|
#include "llavatarappearance.h"
|
||||||
#include "llimagetga.h"
|
#include "llimagetga.h"
|
||||||
|
#include "llquantize.h"
|
||||||
#include "lltexlayer.h"
|
#include "lltexlayer.h"
|
||||||
#include "llvoavatarself.h"
|
#include "lltexturemanagerbridge.h"
|
||||||
#include "llwearable.h"
|
#include "llwearable.h"
|
||||||
#include "llui.h"
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// LLTexLayerParam
|
// LLTexLayerParam
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
LLTexLayerParam::LLTexLayerParam(LLTexLayerInterface *layer) :
|
LLTexLayerParam::LLTexLayerParam(LLTexLayerInterface *layer) :
|
||||||
mTexLayer(layer),
|
mTexLayer(layer),
|
||||||
mAvatar(NULL)
|
mAvatarAppearance(NULL)
|
||||||
{
|
{
|
||||||
if (mTexLayer != NULL)
|
if (mTexLayer != NULL)
|
||||||
{
|
{
|
||||||
mAvatar = mTexLayer->getTexLayerSet()->getAvatar();
|
mAvatarAppearance = mTexLayer->getTexLayerSet()->getAvatarAppearance();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -52,20 +52,21 @@ LLTexLayerParam::LLTexLayerParam(LLTexLayerInterface *layer) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LLTexLayerParam::LLTexLayerParam(LLVOAvatar *avatar) :
|
LLTexLayerParam::LLTexLayerParam(LLAvatarAppearance *appearance) :
|
||||||
mTexLayer(NULL)
|
mTexLayer(NULL),
|
||||||
|
mAvatarAppearance(appearance)
|
||||||
{
|
{
|
||||||
mAvatar = avatar;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL LLTexLayerParam::setInfo(LLViewerVisualParamInfo *info, BOOL add_to_avatar )
|
BOOL LLTexLayerParam::setInfo(LLViewerVisualParamInfo *info, BOOL add_to_appearance)
|
||||||
{
|
{
|
||||||
LLViewerVisualParam::setInfo(info);
|
LLViewerVisualParam::setInfo(info);
|
||||||
|
|
||||||
if (add_to_avatar)
|
if (add_to_appearance)
|
||||||
{
|
{
|
||||||
mAvatar->addVisualParam( this);
|
mAvatarAppearance->addVisualParam( this);
|
||||||
|
this->setParamLocation(mAvatarAppearance->isSelf() ? LOC_AV_SELF : LOC_AV_OTHER);
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -96,7 +97,7 @@ void LLTexLayerParamAlpha::getCacheByteCount(S32* gl_bytes)
|
|||||||
iter != sInstances.end(); iter++)
|
iter != sInstances.end(); iter++)
|
||||||
{
|
{
|
||||||
LLTexLayerParamAlpha* instance = *iter;
|
LLTexLayerParamAlpha* instance = *iter;
|
||||||
LLViewerTexture* tex = instance->mCachedProcessedTexture;
|
LLGLTexture* tex = instance->mCachedProcessedTexture;
|
||||||
if (tex)
|
if (tex)
|
||||||
{
|
{
|
||||||
S32 bytes = (S32)tex->getWidth() * tex->getHeight() * tex->getComponents();
|
S32 bytes = (S32)tex->getWidth() * tex->getHeight() * tex->getComponents();
|
||||||
@@ -120,8 +121,8 @@ LLTexLayerParamAlpha::LLTexLayerParamAlpha(LLTexLayerInterface* layer) :
|
|||||||
sInstances.push_front(this);
|
sInstances.push_front(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
LLTexLayerParamAlpha::LLTexLayerParamAlpha(LLVOAvatar* avatar) :
|
LLTexLayerParamAlpha::LLTexLayerParamAlpha(LLAvatarAppearance* appearance) :
|
||||||
LLTexLayerParam(avatar),
|
LLTexLayerParam(appearance),
|
||||||
mCachedProcessedTexture(NULL),
|
mCachedProcessedTexture(NULL),
|
||||||
mNeedsCreateTexture(FALSE),
|
mNeedsCreateTexture(FALSE),
|
||||||
mStaticImageInvalid(FALSE),
|
mStaticImageInvalid(FALSE),
|
||||||
@@ -173,13 +174,14 @@ void LLTexLayerParamAlpha::setWeight(F32 weight, BOOL upload_bake)
|
|||||||
{
|
{
|
||||||
mCurWeight = new_weight;
|
mCurWeight = new_weight;
|
||||||
|
|
||||||
if ((mAvatar->getSex() & getSex()) && (mAvatar->isSelf() && !mIsDummy)) // only trigger a baked texture update if we're changing a wearable's visual param.
|
if ((mAvatarAppearance->getSex() & getSex()) &&
|
||||||
|
(mAvatarAppearance->isSelf() && !mIsDummy)) // only trigger a baked texture update if we're changing a wearable's visual param.
|
||||||
{
|
{
|
||||||
if (isAgentAvatarValid() && !gAgentAvatarp->isUsingBakedTextures())
|
if (mAvatarAppearance->isValid() && mAvatarAppearance->isEditingAppearance())
|
||||||
{
|
{
|
||||||
upload_bake = FALSE;
|
upload_bake = FALSE;
|
||||||
}
|
}
|
||||||
mAvatar->invalidateComposite(mTexLayer->getTexLayerSet(), upload_bake);
|
mAvatarAppearance->invalidateComposite(mTexLayer->getTexLayerSet(), upload_bake);
|
||||||
mTexLayer->invalidateMorphMasks();
|
mTexLayer->invalidateMorphMasks();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -218,11 +220,11 @@ BOOL LLTexLayerParamAlpha::getSkip() const
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
const LLVOAvatar *avatar = mTexLayer->getTexLayerSet()->getAvatar();
|
const LLAvatarAppearance *appearance = mTexLayer->getTexLayerSet()->getAvatarAppearance();
|
||||||
|
|
||||||
if (((LLTexLayerParamAlphaInfo *)getInfo())->mSkipIfZeroWeight)
|
if (((LLTexLayerParamAlphaInfo *)getInfo())->mSkipIfZeroWeight)
|
||||||
{
|
{
|
||||||
F32 effective_weight = (avatar->getSex() & getSex()) ? mCurWeight : getDefaultWeight();
|
F32 effective_weight = (appearance->getSex() & getSex()) ? mCurWeight : getDefaultWeight();
|
||||||
if (is_approx_zero(effective_weight))
|
if (is_approx_zero(effective_weight))
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -230,7 +232,7 @@ BOOL LLTexLayerParamAlpha::getSkip() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
LLWearableType::EType type = (LLWearableType::EType)getWearableType();
|
LLWearableType::EType type = (LLWearableType::EType)getWearableType();
|
||||||
if ((type != LLWearableType::WT_INVALID) && !avatar->isWearingWearableType(type))
|
if ((type != LLWearableType::WT_INVALID) && !appearance->isWearingWearableType(type))
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -239,8 +241,10 @@ BOOL LLTexLayerParamAlpha::getSkip() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static LLFastTimer::DeclareTimer FTM_TEX_LAYER_PARAM_ALPHA("alpha render");
|
||||||
BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height)
|
BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height)
|
||||||
{
|
{
|
||||||
|
LLFastTimer t(FTM_TEX_LAYER_PARAM_ALPHA);
|
||||||
BOOL success = TRUE;
|
BOOL success = TRUE;
|
||||||
|
|
||||||
if (!mTexLayer)
|
if (!mTexLayer)
|
||||||
@@ -248,7 +252,7 @@ BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height)
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
F32 effective_weight = (mTexLayer->getTexLayerSet()->getAvatar()->getSex() & getSex()) ? mCurWeight : getDefaultWeight();
|
F32 effective_weight = (mTexLayer->getTexLayerSet()->getAvatarAppearance()->getSex() & getSex()) ? mCurWeight : getDefaultWeight();
|
||||||
BOOL weight_changed = effective_weight != mCachedEffectiveWeight;
|
BOOL weight_changed = effective_weight != mCachedEffectiveWeight;
|
||||||
if (getSkip())
|
if (getSkip())
|
||||||
{
|
{
|
||||||
@@ -290,12 +294,12 @@ BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height)
|
|||||||
(mCachedProcessedTexture->getHeight() != image_tga_height) ||
|
(mCachedProcessedTexture->getHeight() != image_tga_height) ||
|
||||||
(weight_changed))
|
(weight_changed))
|
||||||
{
|
{
|
||||||
// llinfos << "Building Cached Alpha: " << mName << ": (" << mStaticImageRaw->getWidth() << ", " << mStaticImageRaw->getHeight() << ") " << effective_weight << llendl;
|
|
||||||
mCachedEffectiveWeight = effective_weight;
|
mCachedEffectiveWeight = effective_weight;
|
||||||
|
|
||||||
if (!mCachedProcessedTexture)
|
if (!mCachedProcessedTexture)
|
||||||
{
|
{
|
||||||
mCachedProcessedTexture = LLViewerTextureManager::getLocalTexture(image_tga_width, image_tga_height, 1, FALSE);
|
llassert(gTextureManagerBridgep);
|
||||||
|
mCachedProcessedTexture = gTextureManagerBridgep->getLocalTexture(image_tga_width, image_tga_height, 1, FALSE);
|
||||||
|
|
||||||
// We now have something in one of our caches
|
// We now have something in one of our caches
|
||||||
LLTexLayerSet::sHasCaches |= mCachedProcessedTexture ? TRUE : FALSE;
|
LLTexLayerSet::sHasCaches |= mCachedProcessedTexture ? TRUE : FALSE;
|
||||||
@@ -308,6 +312,7 @@ BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height)
|
|||||||
mStaticImageRaw = new LLImageRaw;
|
mStaticImageRaw = new LLImageRaw;
|
||||||
mStaticImageTGA->decodeAndProcess(mStaticImageRaw, info->mDomain, effective_weight);
|
mStaticImageTGA->decodeAndProcess(mStaticImageRaw, info->mDomain, effective_weight);
|
||||||
mNeedsCreateTexture = TRUE;
|
mNeedsCreateTexture = TRUE;
|
||||||
|
lldebugs << "Built Cached Alpha: " << info->mStaticImageFileName << ": (" << mStaticImageRaw->getWidth() << ", " << mStaticImageRaw->getHeight() << ") " << "Domain: " << info->mDomain << " Weight: " << effective_weight << llendl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mCachedProcessedTexture)
|
if (mCachedProcessedTexture)
|
||||||
@@ -332,7 +337,7 @@ BOOL LLTexLayerParamAlpha::render(S32 x, S32 y, S32 width, S32 height)
|
|||||||
|
|
||||||
// Don't keep the cache for other people's avatars
|
// Don't keep the cache for other people's avatars
|
||||||
// (It's not really a "cache" in that case, but the logic is the same)
|
// (It's not really a "cache" in that case, but the logic is the same)
|
||||||
if (!mAvatar->isSelf())
|
if (!mAvatarAppearance->isSelf())
|
||||||
{
|
{
|
||||||
mCachedProcessedTexture = NULL;
|
mCachedProcessedTexture = NULL;
|
||||||
}
|
}
|
||||||
@@ -402,8 +407,8 @@ LLTexLayerParamColor::LLTexLayerParamColor(LLTexLayerInterface* layer) :
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
LLTexLayerParamColor::LLTexLayerParamColor(LLVOAvatar *avatar) :
|
LLTexLayerParamColor::LLTexLayerParamColor(LLAvatarAppearance *appearance) :
|
||||||
LLTexLayerParam(avatar),
|
LLTexLayerParam(appearance),
|
||||||
mAvgDistortionVec(1.f, 1.f, 1.f)
|
mAvgDistortionVec(1.f, 1.f, 1.f)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -425,7 +430,7 @@ LLColor4 LLTexLayerParamColor::getNetColor() const
|
|||||||
|
|
||||||
llassert(info->mNumColors >= 1);
|
llassert(info->mNumColors >= 1);
|
||||||
|
|
||||||
F32 effective_weight = (mAvatar && (mAvatar->getSex() & getSex())) ? mCurWeight : getDefaultWeight();
|
F32 effective_weight = (mAvatarAppearance && (mAvatarAppearance->getSex() & getSex())) ? mCurWeight : getDefaultWeight();
|
||||||
|
|
||||||
S32 index_last = info->mNumColors - 1;
|
S32 index_last = info->mNumColors - 1;
|
||||||
F32 scaled_weight = effective_weight * index_last;
|
F32 scaled_weight = effective_weight * index_last;
|
||||||
@@ -470,12 +475,12 @@ void LLTexLayerParamColor::setWeight(F32 weight, BOOL upload_bake)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mAvatar->getSex() & getSex()) && (mAvatar->isSelf() && !mIsDummy)) // only trigger a baked texture update if we're changing a wearable's visual param.
|
if ((mAvatarAppearance->getSex() & getSex()) && (mAvatarAppearance->isSelf() && !mIsDummy)) // only trigger a baked texture update if we're changing a wearable's visual param.
|
||||||
{
|
{
|
||||||
onGlobalColorChanged(upload_bake);
|
onGlobalColorChanged(upload_bake);
|
||||||
if (mTexLayer)
|
if (mTexLayer)
|
||||||
{
|
{
|
||||||
mAvatar->invalidateComposite(mTexLayer->getTexLayerSet(), upload_bake);
|
mAvatarAppearance->invalidateComposite(mTexLayer->getTexLayerSet(), upload_bake);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,16 +27,22 @@
|
|||||||
#ifndef LL_LLTEXLAYERPARAMS_H
|
#ifndef LL_LLTEXLAYERPARAMS_H
|
||||||
#define LL_LLTEXLAYERPARAMS_H
|
#define LL_LLTEXLAYERPARAMS_H
|
||||||
|
|
||||||
|
#include "llpointer.h"
|
||||||
|
#include "v4color.h"
|
||||||
#include "llviewervisualparam.h"
|
#include "llviewervisualparam.h"
|
||||||
|
|
||||||
|
class LLAvatarAppearance;
|
||||||
class LLImageRaw;
|
class LLImageRaw;
|
||||||
class LLImageTGA;
|
class LLImageTGA;
|
||||||
class LLTexLayer;
|
class LLTexLayer;
|
||||||
class LLTexLayerInterface;
|
class LLTexLayerInterface;
|
||||||
class LLViewerTexture;
|
class LLGLTexture;
|
||||||
class LLVOAvatar;
|
|
||||||
class LLWearable;
|
class LLWearable;
|
||||||
|
|
||||||
|
//Temporary externs
|
||||||
|
void gl_rect_2d_simple_tex( S32 width, S32 height );
|
||||||
|
void gl_rect_2d_simple( S32 width, S32 height );
|
||||||
|
|
||||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
// LLTexLayerParam
|
// LLTexLayerParam
|
||||||
//
|
//
|
||||||
@@ -45,13 +51,13 @@ class LLTexLayerParam : public LLViewerVisualParam
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LLTexLayerParam(LLTexLayerInterface *layer);
|
LLTexLayerParam(LLTexLayerInterface *layer);
|
||||||
LLTexLayerParam(LLVOAvatar *avatar);
|
LLTexLayerParam(LLAvatarAppearance *appearance);
|
||||||
/*virtual*/ BOOL setInfo(LLViewerVisualParamInfo *info, BOOL add_to_avatar );
|
/*virtual*/ BOOL setInfo(LLViewerVisualParamInfo *info, BOOL add_to_appearance);
|
||||||
/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const = 0;
|
/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable) const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
LLTexLayerInterface* mTexLayer;
|
LLTexLayerInterface* mTexLayer;
|
||||||
LLVOAvatar* mAvatar;
|
LLAvatarAppearance* mAvatarAppearance;
|
||||||
};
|
};
|
||||||
|
|
||||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
@@ -62,7 +68,7 @@ class LLTexLayerParamAlpha : public LLTexLayerParam
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LLTexLayerParamAlpha( LLTexLayerInterface* layer );
|
LLTexLayerParamAlpha( LLTexLayerInterface* layer );
|
||||||
LLTexLayerParamAlpha( LLVOAvatar* avatar );
|
LLTexLayerParamAlpha( LLAvatarAppearance* appearance );
|
||||||
/*virtual*/ ~LLTexLayerParamAlpha();
|
/*virtual*/ ~LLTexLayerParamAlpha();
|
||||||
|
|
||||||
/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable = NULL) const;
|
/*virtual*/ LLViewerVisualParam* cloneParam(LLWearable* wearable = NULL) const;
|
||||||
@@ -99,7 +105,7 @@ public:
|
|||||||
BOOL getMultiplyBlend() const;
|
BOOL getMultiplyBlend() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LLPointer<LLViewerTexture> mCachedProcessedTexture;
|
LLPointer<LLGLTexture> mCachedProcessedTexture;
|
||||||
LLPointer<LLImageTGA> mStaticImageTGA;
|
LLPointer<LLImageTGA> mStaticImageTGA;
|
||||||
LLPointer<LLImageRaw> mStaticImageRaw;
|
LLPointer<LLImageRaw> mStaticImageRaw;
|
||||||
BOOL mNeedsCreateTexture;
|
BOOL mNeedsCreateTexture;
|
||||||
@@ -150,7 +156,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
LLTexLayerParamColor( LLTexLayerInterface* layer );
|
LLTexLayerParamColor( LLTexLayerInterface* layer );
|
||||||
LLTexLayerParamColor( LLVOAvatar* avatar );
|
LLTexLayerParamColor( LLAvatarAppearance* appearance );
|
||||||
/* virtual */ ~LLTexLayerParamColor();
|
/* virtual */ ~LLTexLayerParamColor();
|
||||||
|
|
||||||
void* operator new(size_t size)
|
void* operator new(size_t size)
|
||||||
33
indra/llappearance/lltexturemanagerbridge.cpp
Normal file
33
indra/llappearance/lltexturemanagerbridge.cpp
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
/**
|
||||||
|
* @file lltexturemanagerbridge.cpp
|
||||||
|
* @brief Defined a null texture manager bridge. Applications must provide their own bridge implementaton.
|
||||||
|
*
|
||||||
|
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||||
|
* Second Life Viewer Source Code
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
|
* $/LicenseInfo$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "linden_common.h"
|
||||||
|
#include "lltexturemanagerbridge.h"
|
||||||
|
|
||||||
|
// Define a null texture manager bridge. Applications must provide their own bridge implementaton.
|
||||||
|
LLTextureManagerBridge* gTextureManagerBridgep = NULL;
|
||||||
|
|
||||||
|
|
||||||
46
indra/llappearance/lltexturemanagerbridge.h
Normal file
46
indra/llappearance/lltexturemanagerbridge.h
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/**
|
||||||
|
* @file lltexturemanagerbridge.h
|
||||||
|
* @brief Bridge to an application-specific texture manager.
|
||||||
|
*
|
||||||
|
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||||
|
* Second Life Viewer Source Code
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
|
* $/LicenseInfo$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LL_TEXTUREMANAGERBRIDGE_H
|
||||||
|
#define LL_TEXTUREMANAGERBRIDGE_H
|
||||||
|
|
||||||
|
#include "llavatarappearancedefines.h"
|
||||||
|
#include "llpointer.h"
|
||||||
|
#include "llgltexture.h"
|
||||||
|
|
||||||
|
// Abstract bridge interface
|
||||||
|
class LLTextureManagerBridge
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual LLPointer<LLGLTexture> getLocalTexture(BOOL usemipmaps = TRUE, BOOL generate_gl_tex = TRUE) = 0;
|
||||||
|
virtual LLPointer<LLGLTexture> getLocalTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps, BOOL generate_gl_tex = TRUE) = 0;
|
||||||
|
virtual LLGLTexture* getFetchedTexture(const LLUUID &image_id) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern LLTextureManagerBridge* gTextureManagerBridgep;
|
||||||
|
|
||||||
|
#endif // LL_TEXTUREMANAGERBRIDGE_H
|
||||||
|
|
||||||
@@ -2,42 +2,35 @@
|
|||||||
* @file llviewervisualparam.cpp
|
* @file llviewervisualparam.cpp
|
||||||
* @brief Implementation of LLViewerVisualParam class
|
* @brief Implementation of LLViewerVisualParam class
|
||||||
*
|
*
|
||||||
* $LicenseInfo:firstyear=2001&license=viewergpl$
|
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||||
*
|
|
||||||
* Copyright (c) 2001-2009, Linden Research, Inc.
|
|
||||||
*
|
|
||||||
* Second Life Viewer Source Code
|
* Second Life Viewer Source Code
|
||||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
* Copyright (C) 2010, Linden Research, Inc.
|
||||||
* 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://secondlifegrid.net/programs/open_source/licensing/gplv2
|
|
||||||
*
|
*
|
||||||
* There are special exceptions to the terms and conditions of the GPL as
|
* This library is free software; you can redistribute it and/or
|
||||||
* it is applied to this Source Code. View the full text of the exception
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
* License as published by the Free Software Foundation;
|
||||||
* online at
|
* version 2.1 of the License only.
|
||||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
|
||||||
*
|
*
|
||||||
* By copying, modifying or distributing this software, you acknowledge
|
* This library is distributed in the hope that it will be useful,
|
||||||
* that you have read and understood your obligations described above,
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* and agree to abide by those obligations.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
* License along with this library; if not, write to the Free Software
|
||||||
* COMPLETENESS OR PERFORMANCE.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
* $/LicenseInfo$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Header Files
|
// Header Files
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
#include "llviewerprecompiledheaders.h"
|
#include "linden_common.h"
|
||||||
|
|
||||||
#include "llviewervisualparam.h"
|
#include "llviewervisualparam.h"
|
||||||
#include "llxmltree.h"
|
#include "llxmltree.h"
|
||||||
#include "llui.h"
|
|
||||||
#include "llwearable.h"
|
#include "llwearable.h"
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
820
indra/llappearance/llwearable.cpp
Normal file
820
indra/llappearance/llwearable.cpp
Normal file
@@ -0,0 +1,820 @@
|
|||||||
|
/**
|
||||||
|
* @file llwearable.cpp
|
||||||
|
* @brief LLWearable class implementation
|
||||||
|
*
|
||||||
|
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
|
||||||
|
* Second Life Viewer Source Code
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
|
* $/LicenseInfo$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "linden_common.h"
|
||||||
|
|
||||||
|
#include "llavatarappearance.h"
|
||||||
|
#include "lllocaltextureobject.h"
|
||||||
|
#include "lltexlayer.h"
|
||||||
|
#include "lltexturemanagerbridge.h"
|
||||||
|
#include "llvisualparam.h"
|
||||||
|
#include "llavatarappearancedefines.h"
|
||||||
|
#include "llwearable.h"
|
||||||
|
|
||||||
|
using namespace LLAvatarAppearanceDefines;
|
||||||
|
|
||||||
|
// static
|
||||||
|
S32 LLWearable::sCurrentDefinitionVersion = 1;
|
||||||
|
|
||||||
|
// Private local functions
|
||||||
|
static std::string terse_F32_to_string(F32 f);
|
||||||
|
|
||||||
|
LLWearable::LLWearable() :
|
||||||
|
mDefinitionVersion(0),
|
||||||
|
mType(LLWearableType::WT_INVALID)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// virtual
|
||||||
|
LLWearable::~LLWearable()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string& LLWearable::getTypeLabel() const
|
||||||
|
{
|
||||||
|
return LLWearableType::getTypeLabel(mType);
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string& LLWearable::getTypeName() const
|
||||||
|
{
|
||||||
|
return LLWearableType::getTypeName(mType);
|
||||||
|
}
|
||||||
|
|
||||||
|
LLAssetType::EType LLWearable::getAssetType() const
|
||||||
|
{
|
||||||
|
return LLWearableType::getAssetType(mType);
|
||||||
|
}
|
||||||
|
|
||||||
|
// reX: new function
|
||||||
|
BOOL LLWearable::FileExportParams( FILE* file ) const
|
||||||
|
{
|
||||||
|
// wearable type
|
||||||
|
S32 type = (S32)mType;
|
||||||
|
fprintf( file, "type %d\n", type );
|
||||||
|
|
||||||
|
// parameters
|
||||||
|
S32 num_parameters = mVisualParamIndexMap.size();
|
||||||
|
fprintf( file, "parameters %d\n", num_parameters );
|
||||||
|
|
||||||
|
for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin();
|
||||||
|
iter != mVisualParamIndexMap.end(); ++iter)
|
||||||
|
{
|
||||||
|
S32 param_id = iter->first;
|
||||||
|
F32 param_weight = iter->second->getWeight();
|
||||||
|
fprintf( file, "%d %s\n", param_id, terse_F32_to_string(param_weight).c_str() );
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// reX: new function
|
||||||
|
BOOL LLWearable::FileExportTextures( FILE* file ) const
|
||||||
|
{
|
||||||
|
// wearable type
|
||||||
|
S32 type = (S32)mType;
|
||||||
|
fprintf( file, "type %d\n", type );
|
||||||
|
|
||||||
|
// texture entries
|
||||||
|
S32 num_textures = mTEMap.size();
|
||||||
|
fprintf( file, "textures %d\n", num_textures );
|
||||||
|
|
||||||
|
for (te_map_t::const_iterator iter = mTEMap.begin();
|
||||||
|
iter != mTEMap.end(); ++iter)
|
||||||
|
{
|
||||||
|
S32 te = iter->first;
|
||||||
|
fprintf( file, "%d %s\n", te, iter->second->getID().asString().c_str() );
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL LLWearable::exportFile(LLFILE* fp) const
|
||||||
|
{
|
||||||
|
llofstream ofs(fp);
|
||||||
|
return exportStream(ofs);
|
||||||
|
}
|
||||||
|
|
||||||
|
// virtual
|
||||||
|
BOOL LLWearable::exportStream( std::ostream& output_stream ) const
|
||||||
|
{
|
||||||
|
if (!output_stream.good()) return FALSE;
|
||||||
|
|
||||||
|
// header and version
|
||||||
|
output_stream << "LLWearable version " << mDefinitionVersion << "\n";
|
||||||
|
// name
|
||||||
|
output_stream << mName << "\n";
|
||||||
|
// description
|
||||||
|
output_stream << mDescription << "\n";
|
||||||
|
|
||||||
|
// permissions
|
||||||
|
if( !mPermissions.exportStream( output_stream ) )
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// sale info
|
||||||
|
if( !mSaleInfo.exportStream( output_stream ) )
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// wearable type
|
||||||
|
output_stream << "type " << (S32) getType() << "\n";
|
||||||
|
|
||||||
|
// parameters
|
||||||
|
output_stream << "parameters " << mVisualParamIndexMap.size() << "\n";
|
||||||
|
|
||||||
|
for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin();
|
||||||
|
iter != mVisualParamIndexMap.end();
|
||||||
|
++iter)
|
||||||
|
{
|
||||||
|
S32 param_id = iter->first;
|
||||||
|
const LLVisualParam* param = iter->second;
|
||||||
|
F32 param_weight = param->getWeight();
|
||||||
|
output_stream << param_id << " " << terse_F32_to_string( param_weight ) << "\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// texture entries
|
||||||
|
output_stream << "textures " << mTEMap.size() << "\n";
|
||||||
|
|
||||||
|
for (te_map_t::const_iterator iter = mTEMap.begin(); iter != mTEMap.end(); ++iter)
|
||||||
|
{
|
||||||
|
S32 te = iter->first;
|
||||||
|
const LLUUID& image_id = iter->second->getID();
|
||||||
|
output_stream << te << " " << image_id << "\n";
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLWearable::createVisualParams(LLAvatarAppearance *avatarp)
|
||||||
|
{
|
||||||
|
for (LLViewerVisualParam* param = (LLViewerVisualParam*) avatarp->getFirstVisualParam();
|
||||||
|
param;
|
||||||
|
param = (LLViewerVisualParam*) avatarp->getNextVisualParam())
|
||||||
|
{
|
||||||
|
if (param->getWearableType() == mType)
|
||||||
|
{
|
||||||
|
LLVisualParam *clone_param = param->cloneParam(this);
|
||||||
|
clone_param->setParamLocation(LOC_UNKNOWN);
|
||||||
|
clone_param->setParamLocation(LOC_WEARABLE);
|
||||||
|
addVisualParam(clone_param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// resync driver parameters to point to the newly cloned driven parameters
|
||||||
|
for (visual_param_index_map_t::iterator param_iter = mVisualParamIndexMap.begin();
|
||||||
|
param_iter != mVisualParamIndexMap.end();
|
||||||
|
++param_iter)
|
||||||
|
{
|
||||||
|
LLVisualParam* param = param_iter->second;
|
||||||
|
LLVisualParam*(LLWearable::*wearable_function)(S32)const = &LLWearable::getVisualParam;
|
||||||
|
// need this line to disambiguate between versions of LLCharacter::getVisualParam()
|
||||||
|
LLVisualParam*(LLAvatarAppearance::*param_function)(S32)const = &LLAvatarAppearance::getVisualParam;
|
||||||
|
param->resetDrivenParams();
|
||||||
|
if(!param->linkDrivenParams(boost::bind(wearable_function,(LLWearable*)this, _1), false))
|
||||||
|
{
|
||||||
|
if( !param->linkDrivenParams(boost::bind(param_function,avatarp,_1 ), true))
|
||||||
|
{
|
||||||
|
llwarns << "could not link driven params for wearable " << getName() << " id: " << param->getID() << llendl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLWearable::createLayers(S32 te, LLAvatarAppearance *avatarp)
|
||||||
|
{
|
||||||
|
LLTexLayerSet *layer_set = NULL;
|
||||||
|
const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture((ETextureIndex)te);
|
||||||
|
if (texture_dict->mIsUsedByBakedTexture)
|
||||||
|
{
|
||||||
|
const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
|
||||||
|
|
||||||
|
layer_set = avatarp->getAvatarLayerSet(baked_index);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (layer_set)
|
||||||
|
{
|
||||||
|
layer_set->cloneTemplates(mTEMap[te], (ETextureIndex)te, this);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
llerrs << "could not find layerset for LTO in wearable!" << llendl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LLWearable::EImportResult LLWearable::importFile(LLFILE* fp, LLAvatarAppearance* avatarp )
|
||||||
|
{
|
||||||
|
llifstream ifs(fp);
|
||||||
|
return importStream(ifs, avatarp);
|
||||||
|
}
|
||||||
|
|
||||||
|
// virtual
|
||||||
|
LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, LLAvatarAppearance* avatarp )
|
||||||
|
{
|
||||||
|
// *NOTE: changing the type or size of this buffer will require
|
||||||
|
// changes in the fscanf() code below.
|
||||||
|
// We are using a local max buffer size here to avoid issues
|
||||||
|
// if MAX_STRING size changes.
|
||||||
|
const U32 PARSE_BUFFER_SIZE = 2048;
|
||||||
|
char buffer[2048]; /* Flawfinder: ignore */
|
||||||
|
char uuid_buffer[37]; /* Flawfinder: ignore */
|
||||||
|
|
||||||
|
// This data is being generated on the viewer.
|
||||||
|
// Impose some sane limits on parameter and texture counts.
|
||||||
|
const S32 MAX_WEARABLE_ASSET_TEXTURES = 100;
|
||||||
|
const S32 MAX_WEARABLE_ASSET_PARAMETERS = 1000;
|
||||||
|
|
||||||
|
if(!avatarp)
|
||||||
|
{
|
||||||
|
return LLWearable::FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// read header and version
|
||||||
|
if (!input_stream.good())
|
||||||
|
{
|
||||||
|
llwarns << "Failed to read wearable asset input stream." << llendl;
|
||||||
|
return LLWearable::FAILURE;
|
||||||
|
}
|
||||||
|
input_stream.getline(buffer, PARSE_BUFFER_SIZE);
|
||||||
|
if ( 1 != sscanf( /* Flawfinder: ignore */
|
||||||
|
buffer,
|
||||||
|
"LLWearable version %d\n",
|
||||||
|
&mDefinitionVersion ) )
|
||||||
|
{
|
||||||
|
return LLWearable::BAD_HEADER;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hack to allow wearables with definition version 24 to still load.
|
||||||
|
// This should only affect lindens and NDA'd testers who have saved wearables in 2.0
|
||||||
|
// the extra check for version == 24 can be removed before release, once internal testers
|
||||||
|
// have loaded these wearables again. See hack pt 2 at bottom of function to ensure that
|
||||||
|
// these wearables get re-saved with version definition 22.
|
||||||
|
if( mDefinitionVersion > LLWearable::sCurrentDefinitionVersion && mDefinitionVersion != 24 )
|
||||||
|
{
|
||||||
|
llwarns << "Wearable asset has newer version (" << mDefinitionVersion << ") than XML (" << LLWearable::sCurrentDefinitionVersion << ")" << llendl;
|
||||||
|
return LLWearable::FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// name
|
||||||
|
if (!input_stream.good())
|
||||||
|
{
|
||||||
|
llwarns << "Bad Wearable asset: early end of input stream "
|
||||||
|
<< "while reading name" << llendl;
|
||||||
|
return LLWearable::FAILURE;
|
||||||
|
}
|
||||||
|
input_stream.getline(buffer, PARSE_BUFFER_SIZE);
|
||||||
|
mName = buffer;
|
||||||
|
|
||||||
|
// description
|
||||||
|
if (!input_stream.good())
|
||||||
|
{
|
||||||
|
llwarns << "Bad Wearable asset: early end of input stream "
|
||||||
|
<< "while reading description" << llendl;
|
||||||
|
return LLWearable::FAILURE;
|
||||||
|
}
|
||||||
|
input_stream.getline(buffer, PARSE_BUFFER_SIZE);
|
||||||
|
mDescription = buffer;
|
||||||
|
|
||||||
|
// permissions
|
||||||
|
if (!input_stream.good())
|
||||||
|
{
|
||||||
|
llwarns << "Bad Wearable asset: early end of input stream "
|
||||||
|
<< "while reading permissions" << llendl;
|
||||||
|
return LLWearable::FAILURE;
|
||||||
|
}
|
||||||
|
input_stream.getline(buffer, PARSE_BUFFER_SIZE);
|
||||||
|
S32 perm_version = -1;
|
||||||
|
if ( 1 != sscanf( buffer, " permissions %d\n", &perm_version ) ||
|
||||||
|
perm_version != 0 )
|
||||||
|
{
|
||||||
|
llwarns << "Bad Wearable asset: missing valid permissions" << llendl;
|
||||||
|
return LLWearable::FAILURE;
|
||||||
|
}
|
||||||
|
if( !mPermissions.importStream( input_stream ) )
|
||||||
|
{
|
||||||
|
return LLWearable::FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// sale info
|
||||||
|
if (!input_stream.good())
|
||||||
|
{
|
||||||
|
llwarns << "Bad Wearable asset: early end of input stream "
|
||||||
|
<< "while reading sale info" << llendl;
|
||||||
|
return LLWearable::FAILURE;
|
||||||
|
}
|
||||||
|
input_stream.getline(buffer, PARSE_BUFFER_SIZE);
|
||||||
|
S32 sale_info_version = -1;
|
||||||
|
if ( 1 != sscanf( buffer, " sale_info %d\n", &sale_info_version ) ||
|
||||||
|
sale_info_version != 0 )
|
||||||
|
{
|
||||||
|
llwarns << "Bad Wearable asset: missing valid sale_info" << llendl;
|
||||||
|
return LLWearable::FAILURE;
|
||||||
|
}
|
||||||
|
// Sale info used to contain next owner perm. It is now in the
|
||||||
|
// permissions. Thus, we read that out, and fix legacy
|
||||||
|
// objects. It's possible this op would fail, but it should pick
|
||||||
|
// up the vast majority of the tasks.
|
||||||
|
BOOL has_perm_mask = FALSE;
|
||||||
|
U32 perm_mask = 0;
|
||||||
|
if( !mSaleInfo.importStream(input_stream, has_perm_mask, perm_mask) )
|
||||||
|
{
|
||||||
|
return LLWearable::FAILURE;
|
||||||
|
}
|
||||||
|
if(has_perm_mask)
|
||||||
|
{
|
||||||
|
// fair use fix.
|
||||||
|
if(!(perm_mask & PERM_COPY))
|
||||||
|
{
|
||||||
|
perm_mask |= PERM_TRANSFER;
|
||||||
|
}
|
||||||
|
mPermissions.setMaskNext(perm_mask);
|
||||||
|
}
|
||||||
|
|
||||||
|
// wearable type
|
||||||
|
if (!input_stream.good())
|
||||||
|
{
|
||||||
|
llwarns << "Bad Wearable asset: early end of input stream "
|
||||||
|
<< "while reading type" << llendl;
|
||||||
|
return LLWearable::FAILURE;
|
||||||
|
}
|
||||||
|
input_stream.getline(buffer, PARSE_BUFFER_SIZE);
|
||||||
|
S32 type = -1;
|
||||||
|
if ( 1 != sscanf( buffer, "type %d\n", &type ) )
|
||||||
|
{
|
||||||
|
llwarns << "Bad Wearable asset: bad type" << llendl;
|
||||||
|
return LLWearable::FAILURE;
|
||||||
|
}
|
||||||
|
if( 0 <= type && type < LLWearableType::WT_COUNT )
|
||||||
|
{
|
||||||
|
setType((LLWearableType::EType)type, avatarp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mType = LLWearableType::WT_COUNT;
|
||||||
|
llwarns << "Bad Wearable asset: bad type #" << type << llendl;
|
||||||
|
return LLWearable::FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// parameters header
|
||||||
|
if (!input_stream.good())
|
||||||
|
{
|
||||||
|
llwarns << "Bad Wearable asset: early end of input stream "
|
||||||
|
<< "while reading parameters header" << llendl;
|
||||||
|
return LLWearable::FAILURE;
|
||||||
|
}
|
||||||
|
input_stream.getline(buffer, PARSE_BUFFER_SIZE);
|
||||||
|
S32 num_parameters = -1;
|
||||||
|
if ( 1 != sscanf( buffer, "parameters %d\n", &num_parameters ) )
|
||||||
|
{
|
||||||
|
llwarns << "Bad Wearable asset: missing parameters block" << llendl;
|
||||||
|
return LLWearable::FAILURE;
|
||||||
|
}
|
||||||
|
if ( num_parameters > MAX_WEARABLE_ASSET_PARAMETERS )
|
||||||
|
{
|
||||||
|
llwarns << "Bad Wearable asset: too many parameters, "
|
||||||
|
<< num_parameters << llendl;
|
||||||
|
return LLWearable::FAILURE;
|
||||||
|
}
|
||||||
|
if( num_parameters != mVisualParamIndexMap.size() )
|
||||||
|
{
|
||||||
|
llwarns << "Wearable parameter mismatch. Reading in "
|
||||||
|
<< num_parameters << " from file, but created "
|
||||||
|
<< mVisualParamIndexMap.size()
|
||||||
|
<< " from avatar parameters. type: "
|
||||||
|
<< getType() << llendl;
|
||||||
|
}
|
||||||
|
|
||||||
|
// parameters
|
||||||
|
S32 i;
|
||||||
|
for( i = 0; i < num_parameters; i++ )
|
||||||
|
{
|
||||||
|
if (!input_stream.good())
|
||||||
|
{
|
||||||
|
llwarns << "Bad Wearable asset: early end of input stream "
|
||||||
|
<< "while reading parameter #" << i << llendl;
|
||||||
|
return LLWearable::FAILURE;
|
||||||
|
}
|
||||||
|
input_stream.getline(buffer, PARSE_BUFFER_SIZE);
|
||||||
|
S32 param_id = 0;
|
||||||
|
F32 param_weight = 0.f;
|
||||||
|
if ( 2 != sscanf( buffer, "%d %f\n", ¶m_id, ¶m_weight ) )
|
||||||
|
{
|
||||||
|
llwarns << "Bad Wearable asset: bad parameter, #" << i << llendl;
|
||||||
|
return LLWearable::FAILURE;
|
||||||
|
}
|
||||||
|
mSavedVisualParamMap[param_id] = param_weight;
|
||||||
|
}
|
||||||
|
|
||||||
|
// textures header
|
||||||
|
if (!input_stream.good())
|
||||||
|
{
|
||||||
|
llwarns << "Bad Wearable asset: early end of input stream "
|
||||||
|
<< "while reading textures header" << i << llendl;
|
||||||
|
return LLWearable::FAILURE;
|
||||||
|
}
|
||||||
|
input_stream.getline(buffer, PARSE_BUFFER_SIZE);
|
||||||
|
S32 num_textures = -1;
|
||||||
|
if ( 1 != sscanf( buffer, "textures %d\n", &num_textures) )
|
||||||
|
{
|
||||||
|
llwarns << "Bad Wearable asset: missing textures block" << llendl;
|
||||||
|
return LLWearable::FAILURE;
|
||||||
|
}
|
||||||
|
if ( num_textures > MAX_WEARABLE_ASSET_TEXTURES )
|
||||||
|
{
|
||||||
|
llwarns << "Bad Wearable asset: too many textures, "
|
||||||
|
<< num_textures << llendl;
|
||||||
|
return LLWearable::FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// textures
|
||||||
|
for( i = 0; i < num_textures; i++ )
|
||||||
|
{
|
||||||
|
if (!input_stream.good())
|
||||||
|
{
|
||||||
|
llwarns << "Bad Wearable asset: early end of input stream "
|
||||||
|
<< "while reading textures #" << i << llendl;
|
||||||
|
return LLWearable::FAILURE;
|
||||||
|
}
|
||||||
|
input_stream.getline(buffer, PARSE_BUFFER_SIZE);
|
||||||
|
S32 te = 0;
|
||||||
|
if ( 2 != sscanf( /* Flawfinder: ignore */
|
||||||
|
buffer,
|
||||||
|
"%d %36s\n",
|
||||||
|
&te, uuid_buffer) )
|
||||||
|
{
|
||||||
|
llwarns << "Bad Wearable asset: bad texture, #" << i << llendl;
|
||||||
|
return LLWearable::FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !LLUUID::validate( uuid_buffer ) )
|
||||||
|
{
|
||||||
|
llwarns << "Bad Wearable asset: bad texture uuid: "
|
||||||
|
<< uuid_buffer << llendl;
|
||||||
|
return LLWearable::FAILURE;
|
||||||
|
}
|
||||||
|
LLUUID id = LLUUID(uuid_buffer);
|
||||||
|
LLGLTexture* image = gTextureManagerBridgep->getFetchedTexture( id );
|
||||||
|
if( mTEMap.find(te) != mTEMap.end() )
|
||||||
|
{
|
||||||
|
delete mTEMap[te];
|
||||||
|
}
|
||||||
|
if( mSavedTEMap.find(te) != mSavedTEMap.end() )
|
||||||
|
{
|
||||||
|
delete mSavedTEMap[te];
|
||||||
|
}
|
||||||
|
|
||||||
|
LLUUID textureid(uuid_buffer);
|
||||||
|
mTEMap[te] = new LLLocalTextureObject(image, textureid);
|
||||||
|
mSavedTEMap[te] = new LLLocalTextureObject(image, textureid);
|
||||||
|
createLayers(te, avatarp);
|
||||||
|
}
|
||||||
|
|
||||||
|
// copy all saved param values to working params
|
||||||
|
revertValues();
|
||||||
|
|
||||||
|
return LLWearable::SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLWearable::setType(LLWearableType::EType type, LLAvatarAppearance *avatarp)
|
||||||
|
{
|
||||||
|
mType = type;
|
||||||
|
createVisualParams(avatarp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LLLocalTextureObject* LLWearable::getLocalTextureObject(S32 index)
|
||||||
|
{
|
||||||
|
te_map_t::iterator iter = mTEMap.find(index);
|
||||||
|
if( iter != mTEMap.end() )
|
||||||
|
{
|
||||||
|
LLLocalTextureObject* lto = iter->second;
|
||||||
|
return lto;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const LLLocalTextureObject* LLWearable::getLocalTextureObject(S32 index) const
|
||||||
|
{
|
||||||
|
te_map_t::const_iterator iter = mTEMap.find(index);
|
||||||
|
if( iter != mTEMap.end() )
|
||||||
|
{
|
||||||
|
const LLLocalTextureObject* lto = iter->second;
|
||||||
|
return lto;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<LLLocalTextureObject*> LLWearable::getLocalTextureListSeq()
|
||||||
|
{
|
||||||
|
std::vector<LLLocalTextureObject*> result;
|
||||||
|
|
||||||
|
for(te_map_t::const_iterator iter = mTEMap.begin();
|
||||||
|
iter != mTEMap.end(); iter++)
|
||||||
|
{
|
||||||
|
LLLocalTextureObject* lto = iter->second;
|
||||||
|
result.push_back(lto);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLWearable::setLocalTextureObject(S32 index, LLLocalTextureObject <o)
|
||||||
|
{
|
||||||
|
if( mTEMap.find(index) != mTEMap.end() )
|
||||||
|
{
|
||||||
|
mTEMap.erase(index);
|
||||||
|
}
|
||||||
|
mTEMap[index] = new LLLocalTextureObject(lto);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLWearable::revertValues()
|
||||||
|
{
|
||||||
|
// FIXME DRANO - this triggers changes to driven params on avatar, potentially clobbering baked appearance.
|
||||||
|
|
||||||
|
//update saved settings so wearable is no longer dirty
|
||||||
|
// non-driver params first
|
||||||
|
for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++)
|
||||||
|
{
|
||||||
|
S32 id = iter->first;
|
||||||
|
F32 value = iter->second;
|
||||||
|
LLVisualParam *param = getVisualParam(id);
|
||||||
|
if(param && !dynamic_cast<LLDriverParam*>(param) )
|
||||||
|
{
|
||||||
|
setVisualParamWeight(id, value, TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//then driver params
|
||||||
|
for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++)
|
||||||
|
{
|
||||||
|
S32 id = iter->first;
|
||||||
|
F32 value = iter->second;
|
||||||
|
LLVisualParam *param = getVisualParam(id);
|
||||||
|
if(param && dynamic_cast<LLDriverParam*>(param) )
|
||||||
|
{
|
||||||
|
setVisualParamWeight(id, value, TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// make sure that saved values are sane
|
||||||
|
for (param_map_t::const_iterator iter = mSavedVisualParamMap.begin(); iter != mSavedVisualParamMap.end(); iter++)
|
||||||
|
{
|
||||||
|
S32 id = iter->first;
|
||||||
|
LLVisualParam *param = getVisualParam(id);
|
||||||
|
if( param )
|
||||||
|
{
|
||||||
|
mSavedVisualParamMap[id] = param->getWeight();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
syncImages(mSavedTEMap, mTEMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLWearable::saveValues()
|
||||||
|
{
|
||||||
|
//update saved settings so wearable is no longer dirty
|
||||||
|
mSavedVisualParamMap.clear();
|
||||||
|
for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); iter != mVisualParamIndexMap.end(); ++iter)
|
||||||
|
{
|
||||||
|
S32 id = iter->first;
|
||||||
|
LLVisualParam *wearable_param = iter->second;
|
||||||
|
F32 value = wearable_param->getWeight();
|
||||||
|
mSavedVisualParamMap[id] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deep copy of mTEMap (copies only those tes that are current, filling in defaults where needed)
|
||||||
|
syncImages(mTEMap, mSavedTEMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLWearable::syncImages(te_map_t &src, te_map_t &dst)
|
||||||
|
{
|
||||||
|
// Deep copy of src (copies only those tes that are current, filling in defaults where needed)
|
||||||
|
for( S32 te = 0; te < TEX_NUM_INDICES; te++ )
|
||||||
|
{
|
||||||
|
if (LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex) te) == mType)
|
||||||
|
{
|
||||||
|
te_map_t::const_iterator iter = src.find(te);
|
||||||
|
LLUUID image_id;
|
||||||
|
LLGLTexture *image = NULL;
|
||||||
|
LLLocalTextureObject *lto = NULL;
|
||||||
|
if(iter != src.end())
|
||||||
|
{
|
||||||
|
// there's a Local Texture Object in the source image map. Use this to populate the values to store in the destination image map.
|
||||||
|
lto = iter->second;
|
||||||
|
image = lto->getImage();
|
||||||
|
image_id = lto->getID();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// there is no Local Texture Object in the source image map. Get defaults values for populating the destination image map.
|
||||||
|
image_id = getDefaultTextureImageID((ETextureIndex) te);
|
||||||
|
image = gTextureManagerBridgep->getFetchedTexture( image_id );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( dst.find(te) != dst.end() )
|
||||||
|
{
|
||||||
|
// there's already an entry in the destination map for the texture. Just update its values.
|
||||||
|
dst[te]->setImage(image);
|
||||||
|
dst[te]->setID(image_id);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// no entry found in the destination map, we need to create a new Local Texture Object
|
||||||
|
dst[te] = new LLLocalTextureObject(image, image_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( lto )
|
||||||
|
{
|
||||||
|
// If we pulled values from a Local Texture Object in the source map, make sure the proper flags are set in the new (or updated) entry in the destination map.
|
||||||
|
dst[te]->setBakedReady(lto->getBakedReady());
|
||||||
|
dst[te]->setDiscard(lto->getDiscard());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLWearable::destroyTextures()
|
||||||
|
{
|
||||||
|
for( te_map_t::iterator iter = mTEMap.begin(); iter != mTEMap.end(); ++iter )
|
||||||
|
{
|
||||||
|
LLLocalTextureObject *lto = iter->second;
|
||||||
|
delete lto;
|
||||||
|
}
|
||||||
|
mTEMap.clear();
|
||||||
|
for( te_map_t::iterator iter = mSavedTEMap.begin(); iter != mSavedTEMap.end(); ++iter )
|
||||||
|
{
|
||||||
|
LLLocalTextureObject *lto = iter->second;
|
||||||
|
delete lto;
|
||||||
|
}
|
||||||
|
mSavedTEMap.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLWearable::addVisualParam(LLVisualParam *param)
|
||||||
|
{
|
||||||
|
if( mVisualParamIndexMap[param->getID()] )
|
||||||
|
{
|
||||||
|
delete mVisualParamIndexMap[param->getID()];
|
||||||
|
}
|
||||||
|
param->setIsDummy(FALSE);
|
||||||
|
param->setParamLocation(LOC_WEARABLE);
|
||||||
|
mVisualParamIndexMap[param->getID()] = param;
|
||||||
|
mSavedVisualParamMap[param->getID()] = param->getDefaultWeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LLWearable::setVisualParamWeight(S32 param_index, F32 value, BOOL upload_bake)
|
||||||
|
{
|
||||||
|
if( is_in_map(mVisualParamIndexMap, param_index ) )
|
||||||
|
{
|
||||||
|
LLVisualParam *wearable_param = mVisualParamIndexMap[param_index];
|
||||||
|
wearable_param->setWeight(value, upload_bake);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
llerrs << "LLWearable::setVisualParam passed invalid parameter index: " << param_index << " for wearable type: " << this->getName() << llendl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
F32 LLWearable::getVisualParamWeight(S32 param_index) const
|
||||||
|
{
|
||||||
|
if( is_in_map(mVisualParamIndexMap, param_index ) )
|
||||||
|
{
|
||||||
|
const LLVisualParam *wearable_param = mVisualParamIndexMap.find(param_index)->second;
|
||||||
|
return wearable_param->getWeight();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
llwarns << "LLWerable::getVisualParam passed invalid parameter index: " << param_index << " for wearable type: " << this->getName() << llendl;
|
||||||
|
}
|
||||||
|
return (F32)-1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
LLVisualParam* LLWearable::getVisualParam(S32 index) const
|
||||||
|
{
|
||||||
|
visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.find(index);
|
||||||
|
return (iter == mVisualParamIndexMap.end()) ? NULL : iter->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void LLWearable::getVisualParams(visual_param_vec_t &list)
|
||||||
|
{
|
||||||
|
visual_param_index_map_t::iterator iter = mVisualParamIndexMap.begin();
|
||||||
|
visual_param_index_map_t::iterator end = mVisualParamIndexMap.end();
|
||||||
|
|
||||||
|
// add all visual params to the passed-in vector
|
||||||
|
for( ; iter != end; ++iter )
|
||||||
|
{
|
||||||
|
list.push_back(iter->second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLWearable::animateParams(F32 delta, BOOL upload_bake)
|
||||||
|
{
|
||||||
|
for(visual_param_index_map_t::iterator iter = mVisualParamIndexMap.begin();
|
||||||
|
iter != mVisualParamIndexMap.end();
|
||||||
|
++iter)
|
||||||
|
{
|
||||||
|
LLVisualParam *param = (LLVisualParam*) iter->second;
|
||||||
|
param->animate(delta, upload_bake);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LLColor4 LLWearable::getClothesColor(S32 te) const
|
||||||
|
{
|
||||||
|
LLColor4 color;
|
||||||
|
U32 param_name[3];
|
||||||
|
if( LLAvatarAppearance::teToColorParams( (LLAvatarAppearanceDefines::ETextureIndex)te, param_name ) )
|
||||||
|
{
|
||||||
|
for( U8 index = 0; index < 3; index++ )
|
||||||
|
{
|
||||||
|
color.mV[index] = getVisualParamWeight(param_name[index]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLWearable::setClothesColor( S32 te, const LLColor4& new_color, BOOL upload_bake )
|
||||||
|
{
|
||||||
|
U32 param_name[3];
|
||||||
|
if( LLAvatarAppearance::teToColorParams( (LLAvatarAppearanceDefines::ETextureIndex)te, param_name ) )
|
||||||
|
{
|
||||||
|
for( U8 index = 0; index < 3; index++ )
|
||||||
|
{
|
||||||
|
setVisualParamWeight(param_name[index], new_color.mV[index], upload_bake);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLWearable::writeToAvatar(LLAvatarAppearance* avatarp)
|
||||||
|
{
|
||||||
|
if (!avatarp) return;
|
||||||
|
|
||||||
|
// Pull params
|
||||||
|
for( LLVisualParam* param = avatarp->getFirstVisualParam(); param; param = avatarp->getNextVisualParam() )
|
||||||
|
{
|
||||||
|
// cross-wearable parameters are not authoritative, as they are driven by a different wearable. So don't copy the values to the
|
||||||
|
// avatar object if cross wearable. Cross wearable params get their values from the avatar, they shouldn't write the other way.
|
||||||
|
if( (((LLViewerVisualParam*)param)->getWearableType() == mType) && (!((LLViewerVisualParam*)param)->getCrossWearable()) )
|
||||||
|
{
|
||||||
|
S32 param_id = param->getID();
|
||||||
|
F32 weight = getVisualParamWeight(param_id);
|
||||||
|
|
||||||
|
avatarp->setVisualParamWeight( param_id, weight, FALSE );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
std::string terse_F32_to_string(F32 f)
|
||||||
|
{
|
||||||
|
std::string r = llformat("%.2f", f);
|
||||||
|
S32 len = r.length();
|
||||||
|
|
||||||
|
// "1.20" -> "1.2"
|
||||||
|
// "24.00" -> "24."
|
||||||
|
while (len > 0 && ('0' == r[len - 1]))
|
||||||
|
{
|
||||||
|
r.erase(len-1, 1);
|
||||||
|
len--;
|
||||||
|
}
|
||||||
|
if ('.' == r[len - 1])
|
||||||
|
{
|
||||||
|
// "24." -> "24"
|
||||||
|
r.erase(len-1, 1);
|
||||||
|
}
|
||||||
|
else if (('-' == r[0]) && ('0' == r[1]))
|
||||||
|
{
|
||||||
|
// "-0.59" -> "-.59"
|
||||||
|
r.erase(1, 1);
|
||||||
|
}
|
||||||
|
else if ('0' == r[0])
|
||||||
|
{
|
||||||
|
// "0.59" -> ".59"
|
||||||
|
r.erase(0, 1);
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
@@ -27,48 +27,35 @@
|
|||||||
#ifndef LL_LLWEARABLE_H
|
#ifndef LL_LLWEARABLE_H
|
||||||
#define LL_LLWEARABLE_H
|
#define LL_LLWEARABLE_H
|
||||||
|
|
||||||
#include "lluuid.h"
|
#include "llavatarappearancedefines.h"
|
||||||
#include "llstring.h"
|
#include "llextendedstatus.h"
|
||||||
#include "llpermissions.h"
|
#include "llpermissions.h"
|
||||||
#include "llsaleinfo.h"
|
#include "llsaleinfo.h"
|
||||||
#include "llassetstorage.h"
|
|
||||||
#include "llwearabletype.h"
|
#include "llwearabletype.h"
|
||||||
#include "llfile.h"
|
|
||||||
#include "lllocaltextureobject.h"
|
#include "lllocaltextureobject.h"
|
||||||
|
|
||||||
class LLViewerInventoryItem;
|
class LLMD5;
|
||||||
class LLVisualParam;
|
class LLVisualParam;
|
||||||
class LLTexGlobalColorInfo;
|
class LLTexGlobalColorInfo;
|
||||||
class LLTexGlobalColor;
|
class LLTexGlobalColor;
|
||||||
|
class LLAvatarAppearance;
|
||||||
|
|
||||||
|
// Abstract class.
|
||||||
class LLWearable
|
class LLWearable
|
||||||
{
|
{
|
||||||
friend class LLWearableList;
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
// Constructors and destructors
|
// Constructors and destructors
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
private:
|
|
||||||
// Private constructors used by LLWearableList
|
|
||||||
LLWearable(const LLTransactionID& transactionID);
|
|
||||||
LLWearable(const LLAssetID& assetID);
|
|
||||||
public:
|
public:
|
||||||
|
LLWearable();
|
||||||
virtual ~LLWearable();
|
virtual ~LLWearable();
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
// Accessors
|
// Accessors
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
public:
|
public:
|
||||||
const LLUUID& getItemID() const;
|
|
||||||
const LLAssetID& getAssetID() const { return mAssetID; }
|
|
||||||
const LLTransactionID& getTransactionID() const { return mTransactionID; }
|
|
||||||
|
|
||||||
BOOL FileExportParams(FILE* file);
|
|
||||||
BOOL FileExportTextures(FILE* file);
|
|
||||||
|
|
||||||
|
|
||||||
LLWearableType::EType getType() const { return mType; }
|
LLWearableType::EType getType() const { return mType; }
|
||||||
void setType( LLWearableType::EType type );
|
void setType(LLWearableType::EType type, LLAvatarAppearance *avatarp);
|
||||||
const std::string& getName() const { return mName; }
|
const std::string& getName() const { return mName; }
|
||||||
void setName( const std::string& name ) { mName = name; }
|
void setName( const std::string& name ) { mName = name; }
|
||||||
const std::string& getDescription() const { return mDescription; }
|
const std::string& getDescription() const { return mDescription; }
|
||||||
@@ -82,39 +69,36 @@ public:
|
|||||||
LLAssetType::EType getAssetType() const;
|
LLAssetType::EType getAssetType() const;
|
||||||
S32 getDefinitionVersion() const { return mDefinitionVersion; }
|
S32 getDefinitionVersion() const { return mDefinitionVersion; }
|
||||||
void setDefinitionVersion( S32 new_version ) { mDefinitionVersion = new_version; }
|
void setDefinitionVersion( S32 new_version ) { mDefinitionVersion = new_version; }
|
||||||
|
static S32 getCurrentDefinitionVersion() { return LLWearable::sCurrentDefinitionVersion; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef std::vector<LLVisualParam*> visual_param_vec_t;
|
typedef std::vector<LLVisualParam*> visual_param_vec_t;
|
||||||
|
|
||||||
BOOL isDirty() const;
|
virtual void writeToAvatar(LLAvatarAppearance* avatarp);
|
||||||
BOOL isOldVersion() const;
|
|
||||||
|
|
||||||
void writeToAvatar();
|
BOOL FileExportParams(FILE* file) const;
|
||||||
void removeFromAvatar( BOOL upload_bake ) { LLWearable::removeFromAvatar( mType, upload_bake ); }
|
BOOL FileExportTextures(FILE* file) const;
|
||||||
static void removeFromAvatar( LLWearableType::EType type, BOOL upload_bake );
|
|
||||||
|
|
||||||
|
enum EImportResult
|
||||||
|
{
|
||||||
|
FAILURE = 0,
|
||||||
|
SUCCESS,
|
||||||
|
BAD_HEADER
|
||||||
|
};
|
||||||
BOOL exportFile(LLFILE* file) const;
|
BOOL exportFile(LLFILE* file) const;
|
||||||
BOOL importFile(LLFILE* file);
|
EImportResult importFile(LLFILE* file, LLAvatarAppearance* avatarp );
|
||||||
|
virtual BOOL exportStream( std::ostream& output_stream ) const;
|
||||||
void setParamsToDefaults();
|
virtual EImportResult importStream( std::istream& input_stream, LLAvatarAppearance* avatarp );
|
||||||
void setTexturesToDefaults();
|
|
||||||
|
|
||||||
void saveNewAsset() const;
|
|
||||||
static void onSaveNewAssetComplete( const LLUUID& asset_uuid, void* user_data, S32 status, LLExtStat ext_status );
|
|
||||||
|
|
||||||
void copyDataFrom(const LLWearable* src);
|
|
||||||
|
|
||||||
static void setCurrentDefinitionVersion( S32 version ) { LLWearable::sCurrentDefinitionVersion = version; }
|
static void setCurrentDefinitionVersion( S32 version ) { LLWearable::sCurrentDefinitionVersion = version; }
|
||||||
|
virtual const LLUUID getDefaultTextureImageID(LLAvatarAppearanceDefines::ETextureIndex index) const = 0;
|
||||||
friend std::ostream& operator<<(std::ostream &s, const LLWearable &w);
|
|
||||||
void setItemID(const LLUUID& item_id);
|
|
||||||
|
|
||||||
LLLocalTextureObject* getLocalTextureObject(S32 index);
|
LLLocalTextureObject* getLocalTextureObject(S32 index);
|
||||||
const LLLocalTextureObject* getLocalTextureObject(S32 index) const;
|
const LLLocalTextureObject* getLocalTextureObject(S32 index) const;
|
||||||
|
std::vector<LLLocalTextureObject*> getLocalTextureListSeq();
|
||||||
|
|
||||||
void setLocalTextureObject(S32 index, LLLocalTextureObject <o);
|
void setLocalTextureObject(S32 index, LLLocalTextureObject <o);
|
||||||
void addVisualParam(LLVisualParam *param);
|
void addVisualParam(LLVisualParam *param);
|
||||||
void setVisualParams();
|
|
||||||
void setVisualParamWeight(S32 index, F32 value, BOOL upload_bake);
|
void setVisualParamWeight(S32 index, F32 value, BOOL upload_bake);
|
||||||
F32 getVisualParamWeight(S32 index) const;
|
F32 getVisualParamWeight(S32 index) const;
|
||||||
LLVisualParam* getVisualParam(S32 index) const;
|
LLVisualParam* getVisualParam(S32 index) const;
|
||||||
@@ -124,27 +108,21 @@ public:
|
|||||||
LLColor4 getClothesColor(S32 te) const;
|
LLColor4 getClothesColor(S32 te) const;
|
||||||
void setClothesColor( S32 te, const LLColor4& new_color, BOOL upload_bake );
|
void setClothesColor( S32 te, const LLColor4& new_color, BOOL upload_bake );
|
||||||
|
|
||||||
void revertValues();
|
virtual void revertValues();
|
||||||
void saveValues();
|
virtual void saveValues();
|
||||||
void pullCrossWearableValues();
|
|
||||||
|
|
||||||
BOOL isOnTop() const;
|
// Something happened that requires the wearable to be updated (e.g. worn/unworn).
|
||||||
|
virtual void setUpdated() const = 0;
|
||||||
|
|
||||||
// Something happened that requires the wearable's label to be updated (e.g. worn/unworn).
|
// Update the baked texture hash.
|
||||||
void setLabelUpdated() const;
|
virtual void addToBakedTextureHash(LLMD5& hash) const = 0;
|
||||||
|
|
||||||
// the wearable was worn. make sure the name of the wearable object matches the LLViewerInventoryItem,
|
protected:
|
||||||
// not the wearable asset itself.
|
|
||||||
void refreshName();
|
|
||||||
|
|
||||||
private:
|
|
||||||
typedef std::map<S32, LLLocalTextureObject*> te_map_t;
|
typedef std::map<S32, LLLocalTextureObject*> te_map_t;
|
||||||
typedef std::map<S32, LLVisualParam *> visual_param_index_map_t;
|
|
||||||
|
|
||||||
void createLayers(S32 te);
|
|
||||||
void createVisualParams();
|
|
||||||
void syncImages(te_map_t &src, te_map_t &dst);
|
void syncImages(te_map_t &src, te_map_t &dst);
|
||||||
void destroyTextures();
|
void destroyTextures();
|
||||||
|
void createVisualParams(LLAvatarAppearance *avatarp);
|
||||||
|
void createLayers(S32 te, LLAvatarAppearance *avatarp);
|
||||||
|
|
||||||
static S32 sCurrentDefinitionVersion; // Depends on the current state of the avatar_lad.xml.
|
static S32 sCurrentDefinitionVersion; // Depends on the current state of the avatar_lad.xml.
|
||||||
S32 mDefinitionVersion; // Depends on the state of the avatar_lad.xml when this asset was created.
|
S32 mDefinitionVersion; // Depends on the state of the avatar_lad.xml when this asset was created.
|
||||||
@@ -152,18 +130,16 @@ private:
|
|||||||
std::string mDescription;
|
std::string mDescription;
|
||||||
LLPermissions mPermissions;
|
LLPermissions mPermissions;
|
||||||
LLSaleInfo mSaleInfo;
|
LLSaleInfo mSaleInfo;
|
||||||
LLAssetID mAssetID;
|
|
||||||
LLTransactionID mTransactionID;
|
|
||||||
LLWearableType::EType mType;
|
LLWearableType::EType mType;
|
||||||
|
|
||||||
typedef std::map<S32, F32> param_map_t;
|
typedef std::map<S32, F32> param_map_t;
|
||||||
param_map_t mSavedVisualParamMap; // last saved version of visual params
|
param_map_t mSavedVisualParamMap; // last saved version of visual params
|
||||||
|
|
||||||
|
typedef std::map<S32, LLVisualParam *> visual_param_index_map_t;
|
||||||
visual_param_index_map_t mVisualParamIndexMap;
|
visual_param_index_map_t mVisualParamIndexMap;
|
||||||
|
|
||||||
te_map_t mTEMap; // maps TE to LocalTextureObject
|
te_map_t mTEMap; // maps TE to LocalTextureObject
|
||||||
te_map_t mSavedTEMap; // last saved version of TEMap
|
te_map_t mSavedTEMap; // last saved version of TEMap
|
||||||
LLUUID mItemID; // ID of the inventory item in the agent's inventory
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LL_LLWEARABLE_H
|
#endif // LL_LLWEARABLE_H
|
||||||
363
indra/llappearance/llwearabledata.cpp
Normal file
363
indra/llappearance/llwearabledata.cpp
Normal file
@@ -0,0 +1,363 @@
|
|||||||
|
/**
|
||||||
|
* @file llwearabledata.cpp
|
||||||
|
* @brief LLWearableData class implementation
|
||||||
|
*
|
||||||
|
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||||
|
* Second Life Viewer Source Code
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
|
* $/LicenseInfo$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "linden_common.h"
|
||||||
|
|
||||||
|
#include "llwearabledata.h"
|
||||||
|
|
||||||
|
#include "llavatarappearance.h"
|
||||||
|
#include "llavatarappearancedefines.h"
|
||||||
|
#include "lldriverparam.h"
|
||||||
|
#include "llmd5.h"
|
||||||
|
|
||||||
|
LLWearableData::LLWearableData() :
|
||||||
|
mAvatarAppearance(NULL)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// virtual
|
||||||
|
LLWearableData::~LLWearableData()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
using namespace LLAvatarAppearanceDefines;
|
||||||
|
|
||||||
|
LLWearable* LLWearableData::getWearable(const LLWearableType::EType type, U32 index)
|
||||||
|
{
|
||||||
|
//llassert_always(index == 0);
|
||||||
|
wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type);
|
||||||
|
if (wearable_iter == mWearableDatas.end())
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
wearableentry_vec_t& wearable_vec = wearable_iter->second;
|
||||||
|
if (index>=wearable_vec.size())
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return wearable_vec[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLWearableData::setWearable(const LLWearableType::EType type, U32 index, LLWearable *wearable)
|
||||||
|
{
|
||||||
|
//llassert_always(index == 0);
|
||||||
|
LLWearable *old_wearable = getWearable(type,index);
|
||||||
|
if (!old_wearable)
|
||||||
|
{
|
||||||
|
pushWearable(type,wearable);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type);
|
||||||
|
if (wearable_iter == mWearableDatas.end())
|
||||||
|
{
|
||||||
|
llwarns << "invalid type, type " << type << " index " << index << llendl;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
wearableentry_vec_t& wearable_vec = wearable_iter->second;
|
||||||
|
if (index>=wearable_vec.size())
|
||||||
|
{
|
||||||
|
llwarns << "invalid index, type " << type << " index " << index << llendl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wearable_vec[index] = wearable;
|
||||||
|
old_wearable->setUpdated();
|
||||||
|
const BOOL removed = FALSE;
|
||||||
|
wearableUpdated(wearable, removed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
U32 LLWearableData::pushWearable(const LLWearableType::EType type,
|
||||||
|
LLWearable *wearable)
|
||||||
|
{
|
||||||
|
if (wearable == NULL)
|
||||||
|
{
|
||||||
|
// no null wearables please!
|
||||||
|
llwarns << "Null wearable sent for type " << type << llendl;
|
||||||
|
return MAX_CLOTHING_PER_TYPE;
|
||||||
|
}
|
||||||
|
// if (type < LLWearableType::WT_COUNT || mWearableDatas[type].size() < MAX_CLOTHING_PER_TYPE)
|
||||||
|
// {
|
||||||
|
// mWearableDatas[type].push_back(wearable);
|
||||||
|
// wearableUpdated(wearable);
|
||||||
|
// checkWearableAgainstInventory(wearable);
|
||||||
|
// return mWearableDatas[type].size()-1;
|
||||||
|
// }
|
||||||
|
// [RLVa:KB] - Checked: 2010-06-08 (RLVa-1.2.0g) | Added: RLVa-1.2.0g
|
||||||
|
if ( (type < LLWearableType::WT_COUNT) && (mWearableDatas[type].size() < MAX_CLOTHING_PER_TYPE) )
|
||||||
|
{
|
||||||
|
// Don't add the same wearable twice
|
||||||
|
U32 idxWearable = getWearableIndex(wearable);
|
||||||
|
//RLV_ASSERT(MAX_CLOTHING_PER_TYPE == idxWearable); // pushWearable() on an already added wearable is a bug *somewhere*
|
||||||
|
if (MAX_CLOTHING_PER_TYPE == idxWearable)
|
||||||
|
{
|
||||||
|
mWearableDatas[type].push_back(wearable);
|
||||||
|
idxWearable = mWearableDatas[type].size() - 1;
|
||||||
|
}
|
||||||
|
const BOOL removed = FALSE;
|
||||||
|
wearableUpdated(wearable, removed);
|
||||||
|
return idxWearable;
|
||||||
|
// [/RLVa:KB]
|
||||||
|
}
|
||||||
|
return MAX_CLOTHING_PER_TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// virtual
|
||||||
|
void LLWearableData::wearableUpdated(LLWearable *wearable, BOOL removed)
|
||||||
|
{
|
||||||
|
wearable->setUpdated();
|
||||||
|
// FIXME DRANO avoid updating params via wearables when rendering server-baked appearance.
|
||||||
|
#if 0
|
||||||
|
if (mAvatarAppearance->isUsingServerBakes() && !mAvatarAppearance->isUsingLocalAppearance())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if (!removed)
|
||||||
|
{
|
||||||
|
pullCrossWearableValues(wearable->getType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLWearableData::popWearable(LLWearable *wearable)
|
||||||
|
{
|
||||||
|
if (wearable == NULL)
|
||||||
|
{
|
||||||
|
// nothing to do here. move along.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
U32 index = getWearableIndex(wearable);
|
||||||
|
const LLWearableType::EType type = wearable->getType();
|
||||||
|
|
||||||
|
if (index < MAX_CLOTHING_PER_TYPE && index < getWearableCount(type))
|
||||||
|
{
|
||||||
|
popWearable(type, index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLWearableData::popWearable(const LLWearableType::EType type, U32 index)
|
||||||
|
{
|
||||||
|
//llassert_always(index == 0);
|
||||||
|
LLWearable *wearable = getWearable(type, index);
|
||||||
|
if (wearable)
|
||||||
|
{
|
||||||
|
mWearableDatas[type].erase(mWearableDatas[type].begin() + index);
|
||||||
|
const BOOL removed = TRUE;
|
||||||
|
wearableUpdated(wearable, removed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LLWearableData::swapWearables(const LLWearableType::EType type, U32 index_a, U32 index_b)
|
||||||
|
{
|
||||||
|
wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type);
|
||||||
|
if (wearable_iter == mWearableDatas.end())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
wearableentry_vec_t& wearable_vec = wearable_iter->second;
|
||||||
|
if (0 > index_a || index_a >= wearable_vec.size()) return false;
|
||||||
|
if (0 > index_b || index_b >= wearable_vec.size()) return false;
|
||||||
|
|
||||||
|
LLWearable* wearable = wearable_vec[index_a];
|
||||||
|
wearable_vec[index_a] = wearable_vec[index_b];
|
||||||
|
wearable_vec[index_b] = wearable;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLWearableData::pullCrossWearableValues(const LLWearableType::EType type)
|
||||||
|
{
|
||||||
|
llassert(mAvatarAppearance);
|
||||||
|
// scan through all of the avatar's visual parameters
|
||||||
|
for (LLViewerVisualParam* param = (LLViewerVisualParam*) mAvatarAppearance->getFirstVisualParam();
|
||||||
|
param;
|
||||||
|
param = (LLViewerVisualParam*) mAvatarAppearance->getNextVisualParam())
|
||||||
|
{
|
||||||
|
if( param )
|
||||||
|
{
|
||||||
|
LLDriverParam *driver_param = dynamic_cast<LLDriverParam*>(param);
|
||||||
|
if(driver_param)
|
||||||
|
{
|
||||||
|
// parameter is a driver parameter, have it update its cross-driven params
|
||||||
|
driver_param->updateCrossDrivenParams(type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
U32 LLWearableData::getWearableIndex(const LLWearable *wearable) const
|
||||||
|
{
|
||||||
|
if (wearable == NULL)
|
||||||
|
{
|
||||||
|
return MAX_CLOTHING_PER_TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
const LLWearableType::EType type = wearable->getType();
|
||||||
|
wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
|
||||||
|
if (wearable_iter == mWearableDatas.end())
|
||||||
|
{
|
||||||
|
llwarns << "tried to get wearable index with an invalid type!" << llendl;
|
||||||
|
return MAX_CLOTHING_PER_TYPE;
|
||||||
|
}
|
||||||
|
const wearableentry_vec_t& wearable_vec = wearable_iter->second;
|
||||||
|
for(U32 index = 0; index < wearable_vec.size(); index++)
|
||||||
|
{
|
||||||
|
if (wearable_vec[index] == wearable)
|
||||||
|
{
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return MAX_CLOTHING_PER_TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL LLWearableData::isOnTop(LLWearable* wearable) const
|
||||||
|
{
|
||||||
|
if (!wearable) return FALSE;
|
||||||
|
const LLWearableType::EType type = wearable->getType();
|
||||||
|
return ( getTopWearable(type) == wearable );
|
||||||
|
}
|
||||||
|
|
||||||
|
const LLWearable* LLWearableData::getWearable(const LLWearableType::EType type, U32 index) const
|
||||||
|
{
|
||||||
|
//llassert_always(index == 0);
|
||||||
|
wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
|
||||||
|
if (wearable_iter == mWearableDatas.end())
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
const wearableentry_vec_t& wearable_vec = wearable_iter->second;
|
||||||
|
if (index>=wearable_vec.size())
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return wearable_vec[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LLWearable* LLWearableData::getTopWearable(const LLWearableType::EType type)
|
||||||
|
{
|
||||||
|
U32 count = getWearableCount(type);
|
||||||
|
if ( count == 0)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return getWearable(type, count-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
const LLWearable* LLWearableData::getTopWearable(const LLWearableType::EType type) const
|
||||||
|
{
|
||||||
|
U32 count = getWearableCount(type);
|
||||||
|
if ( count == 0)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return getWearable(type, count-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
LLWearable* LLWearableData::getBottomWearable(const LLWearableType::EType type)
|
||||||
|
{
|
||||||
|
if (getWearableCount(type) == 0)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return getWearable(type, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
const LLWearable* LLWearableData::getBottomWearable(const LLWearableType::EType type) const
|
||||||
|
{
|
||||||
|
if (getWearableCount(type) == 0)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return getWearable(type, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
U32 LLWearableData::getWearableCount(const LLWearableType::EType type) const
|
||||||
|
{
|
||||||
|
wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
|
||||||
|
if (wearable_iter == mWearableDatas.end())
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
const wearableentry_vec_t& wearable_vec = wearable_iter->second;
|
||||||
|
return wearable_vec.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
U32 LLWearableData::getWearableCount(const U32 tex_index) const
|
||||||
|
{
|
||||||
|
const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType((LLAvatarAppearanceDefines::ETextureIndex)tex_index);
|
||||||
|
return getWearableCount(wearable_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
LLUUID LLWearableData::computeBakedTextureHash(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index,
|
||||||
|
BOOL generate_valid_hash) // Set to false if you want to upload the baked texture w/o putting it in the cache
|
||||||
|
{
|
||||||
|
LLUUID hash_id;
|
||||||
|
bool hash_computed = false;
|
||||||
|
LLMD5 hash;
|
||||||
|
const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = LLAvatarAppearanceDictionary::getInstance()->getBakedTexture(baked_index);
|
||||||
|
|
||||||
|
for (U8 i=0; i < baked_dict->mWearables.size(); i++)
|
||||||
|
{
|
||||||
|
const LLWearableType::EType baked_type = baked_dict->mWearables[i];
|
||||||
|
const U32 num_wearables = getWearableCount(baked_type);
|
||||||
|
for (U32 index = 0; index < num_wearables; ++index)
|
||||||
|
{
|
||||||
|
const LLWearable* wearable = getWearable(baked_type,index);
|
||||||
|
if (wearable)
|
||||||
|
{
|
||||||
|
wearable->addToBakedTextureHash(hash);
|
||||||
|
hash_computed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hash_computed)
|
||||||
|
{
|
||||||
|
hash.update((const unsigned char*)baked_dict->mWearablesHashID.mData, UUID_BYTES);
|
||||||
|
|
||||||
|
if (!generate_valid_hash)
|
||||||
|
{
|
||||||
|
invalidateBakedTextureHash(hash);
|
||||||
|
}
|
||||||
|
hash.finalize();
|
||||||
|
hash.raw_digest(hash_id.mData);
|
||||||
|
}
|
||||||
|
|
||||||
|
return hash_id;
|
||||||
|
}
|
||||||
106
indra/llappearance/llwearabledata.h
Normal file
106
indra/llappearance/llwearabledata.h
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
/**
|
||||||
|
* @file llwearabledata.h
|
||||||
|
* @brief LLWearableData class header file
|
||||||
|
*
|
||||||
|
* $LicenseInfo:firstyear=20012license=viewerlgpl$
|
||||||
|
* Second Life Viewer Source Code
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
|
* $/LicenseInfo$
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LL_WEARABLEDATA_H
|
||||||
|
#define LL_WEARABLEDATA_H
|
||||||
|
|
||||||
|
#include "llavatarappearancedefines.h"
|
||||||
|
#include "llwearable.h"
|
||||||
|
#include "llerror.h"
|
||||||
|
|
||||||
|
class LLAvatarAppearance;
|
||||||
|
|
||||||
|
class LLWearableData
|
||||||
|
{
|
||||||
|
// *TODO: Figure out why this is causing compile error.
|
||||||
|
//LOG_CLASS(LLWearableData);
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// Constructors / destructors / Initializers
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
public:
|
||||||
|
LLWearableData();
|
||||||
|
virtual ~LLWearableData();
|
||||||
|
|
||||||
|
void setAvatarAppearance(LLAvatarAppearance* appearance) { mAvatarAppearance = appearance; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// Accessors
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
public:
|
||||||
|
LLWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/);
|
||||||
|
const LLWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/) const;
|
||||||
|
LLWearable* getTopWearable(const LLWearableType::EType type);
|
||||||
|
const LLWearable* getTopWearable(const LLWearableType::EType type) const;
|
||||||
|
LLWearable* getBottomWearable(const LLWearableType::EType type);
|
||||||
|
const LLWearable* getBottomWearable(const LLWearableType::EType type) const;
|
||||||
|
U32 getWearableCount(const LLWearableType::EType type) const;
|
||||||
|
U32 getWearableCount(const U32 tex_index) const;
|
||||||
|
U32 getWearableIndex(const LLWearable *wearable) const;
|
||||||
|
|
||||||
|
BOOL isOnTop(LLWearable* wearable) const;
|
||||||
|
|
||||||
|
static const U32 MAX_CLOTHING_PER_TYPE = 5;
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// Setters
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
protected:
|
||||||
|
// Low-level data structure setter - public access is via setWearableItem, etc.
|
||||||
|
void setWearable(const LLWearableType::EType type, U32 index, LLWearable *wearable);
|
||||||
|
U32 pushWearable(const LLWearableType::EType type, LLWearable *wearable);
|
||||||
|
virtual void wearableUpdated(LLWearable *wearable, BOOL removed) = 0;
|
||||||
|
void popWearable(LLWearable *wearable);
|
||||||
|
void popWearable(const LLWearableType::EType type, U32 index);
|
||||||
|
bool swapWearables(const LLWearableType::EType type, U32 index_a, U32 index_b);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void pullCrossWearableValues(const LLWearableType::EType type);
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// Server Communication
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
public:
|
||||||
|
LLUUID computeBakedTextureHash(LLAvatarAppearanceDefines::EBakedTextureIndex baked_index,
|
||||||
|
BOOL generate_valid_hash = TRUE);
|
||||||
|
protected:
|
||||||
|
virtual void invalidateBakedTextureHash(LLMD5& hash) const = 0;
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
// Member variables
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
protected:
|
||||||
|
LLAvatarAppearance* mAvatarAppearance;
|
||||||
|
typedef std::vector<LLWearable*> wearableentry_vec_t; // all wearables of a certain type (EG all shirts)
|
||||||
|
typedef std::map<LLWearableType::EType, wearableentry_vec_t> wearableentry_map_t; // wearable "categories" arranged by wearable type
|
||||||
|
wearableentry_map_t mWearableDatas;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif // LL_WEARABLEDATA_H
|
||||||
@@ -24,24 +24,36 @@
|
|||||||
* $/LicenseInfo$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "llviewerprecompiledheaders.h"
|
#include "linden_common.h"
|
||||||
#include "llwearabletype.h"
|
#include "llwearabletype.h"
|
||||||
#include "llinventoryfunctions.h"
|
#include "llinventorytype.h"
|
||||||
#include "lltrans.h"
|
|
||||||
|
static LLTranslationBridge* sTrans = NULL;
|
||||||
|
|
||||||
|
// static
|
||||||
|
void LLWearableType::initClass(LLTranslationBridge* trans)
|
||||||
|
{
|
||||||
|
sTrans = trans;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLWearableType::cleanupClass()
|
||||||
|
{
|
||||||
|
delete sTrans;
|
||||||
|
}
|
||||||
|
|
||||||
struct WearableEntry : public LLDictionaryEntry
|
struct WearableEntry : public LLDictionaryEntry
|
||||||
{
|
{
|
||||||
WearableEntry(const std::string &name,
|
WearableEntry(const std::string &name,
|
||||||
const std::string& default_new_name,
|
const std::string& default_new_name,
|
||||||
LLAssetType::EType assetType,
|
LLAssetType::EType assetType,
|
||||||
LLInventoryIcon::EIconName iconName,
|
LLInventoryType::EIconName iconName,
|
||||||
BOOL disable_camera_switch = FALSE,
|
BOOL disable_camera_switch = FALSE,
|
||||||
BOOL allow_multiwear = TRUE) :
|
BOOL allow_multiwear = TRUE) :
|
||||||
LLDictionaryEntry(name),
|
LLDictionaryEntry(name),
|
||||||
mAssetType(assetType),
|
mAssetType(assetType),
|
||||||
mDefaultNewName(default_new_name),
|
mDefaultNewName(default_new_name),
|
||||||
//*TODO:Translate
|
//*TODO:Translate
|
||||||
mLabel(/*LLTrans::getString*/(name)),
|
mLabel(/*sTrans->getString*/(name)),
|
||||||
mIconName(iconName),
|
mIconName(iconName),
|
||||||
mDisableCameraSwitch(disable_camera_switch),
|
mDisableCameraSwitch(disable_camera_switch),
|
||||||
mAllowMultiwear(allow_multiwear)
|
mAllowMultiwear(allow_multiwear)
|
||||||
@@ -51,7 +63,7 @@ struct WearableEntry : public LLDictionaryEntry
|
|||||||
const LLAssetType::EType mAssetType;
|
const LLAssetType::EType mAssetType;
|
||||||
const std::string mLabel;
|
const std::string mLabel;
|
||||||
const std::string mDefaultNewName; //keep mLabel for backward compatibility
|
const std::string mDefaultNewName; //keep mLabel for backward compatibility
|
||||||
LLInventoryIcon::EIconName mIconName;
|
LLInventoryType::EIconName mIconName;
|
||||||
BOOL mDisableCameraSwitch;
|
BOOL mDisableCameraSwitch;
|
||||||
BOOL mAllowMultiwear;
|
BOOL mAllowMultiwear;
|
||||||
};
|
};
|
||||||
@@ -71,26 +83,26 @@ protected:
|
|||||||
|
|
||||||
LLWearableDictionary::LLWearableDictionary()
|
LLWearableDictionary::LLWearableDictionary()
|
||||||
{
|
{
|
||||||
addEntry(LLWearableType::WT_SHAPE, new WearableEntry("shape", "New Shape", LLAssetType::AT_BODYPART, LLInventoryIcon::ICONNAME_BODYPART_SHAPE, FALSE, FALSE));
|
addEntry(LLWearableType::WT_SHAPE, new WearableEntry("shape", "New Shape", LLAssetType::AT_BODYPART, LLInventoryType::ICONNAME_BODYPART_SHAPE, FALSE, FALSE));
|
||||||
addEntry(LLWearableType::WT_SKIN, new WearableEntry("skin", "New Skin", LLAssetType::AT_BODYPART, LLInventoryIcon::ICONNAME_BODYPART_SKIN, FALSE, FALSE));
|
addEntry(LLWearableType::WT_SKIN, new WearableEntry("skin", "New Skin", LLAssetType::AT_BODYPART, LLInventoryType::ICONNAME_BODYPART_SKIN, FALSE, FALSE));
|
||||||
addEntry(LLWearableType::WT_HAIR, new WearableEntry("hair", "New Hair", LLAssetType::AT_BODYPART, LLInventoryIcon::ICONNAME_BODYPART_HAIR, FALSE, FALSE));
|
addEntry(LLWearableType::WT_HAIR, new WearableEntry("hair", "New Hair", LLAssetType::AT_BODYPART, LLInventoryType::ICONNAME_BODYPART_HAIR, FALSE, FALSE));
|
||||||
addEntry(LLWearableType::WT_EYES, new WearableEntry("eyes", "New Eyes", LLAssetType::AT_BODYPART, LLInventoryIcon::ICONNAME_BODYPART_EYES, FALSE, FALSE));
|
addEntry(LLWearableType::WT_EYES, new WearableEntry("eyes", "New Eyes", LLAssetType::AT_BODYPART, LLInventoryType::ICONNAME_BODYPART_EYES, FALSE, FALSE));
|
||||||
addEntry(LLWearableType::WT_SHIRT, new WearableEntry("shirt", "New Shirt", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_SHIRT, FALSE, TRUE));
|
addEntry(LLWearableType::WT_SHIRT, new WearableEntry("shirt", "New Shirt", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_SHIRT, FALSE, TRUE));
|
||||||
addEntry(LLWearableType::WT_PANTS, new WearableEntry("pants", "New Pants", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_PANTS, FALSE, TRUE));
|
addEntry(LLWearableType::WT_PANTS, new WearableEntry("pants", "New Pants", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_PANTS, FALSE, TRUE));
|
||||||
addEntry(LLWearableType::WT_SHOES, new WearableEntry("shoes", "New Shoes", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_SHOES, FALSE, TRUE));
|
addEntry(LLWearableType::WT_SHOES, new WearableEntry("shoes", "New Shoes", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_SHOES, FALSE, TRUE));
|
||||||
addEntry(LLWearableType::WT_SOCKS, new WearableEntry("socks", "New Socks", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_SOCKS, FALSE, TRUE));
|
addEntry(LLWearableType::WT_SOCKS, new WearableEntry("socks", "New Socks", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_SOCKS, FALSE, TRUE));
|
||||||
addEntry(LLWearableType::WT_JACKET, new WearableEntry("jacket", "New Jacket", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_JACKET, FALSE, TRUE));
|
addEntry(LLWearableType::WT_JACKET, new WearableEntry("jacket", "New Jacket", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_JACKET, FALSE, TRUE));
|
||||||
addEntry(LLWearableType::WT_GLOVES, new WearableEntry("gloves", "New Gloves", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_GLOVES, FALSE, TRUE));
|
addEntry(LLWearableType::WT_GLOVES, new WearableEntry("gloves", "New Gloves", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_GLOVES, FALSE, TRUE));
|
||||||
addEntry(LLWearableType::WT_UNDERSHIRT, new WearableEntry("undershirt", "New Undershirt", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_UNDERSHIRT, FALSE, TRUE));
|
addEntry(LLWearableType::WT_UNDERSHIRT, new WearableEntry("undershirt", "New Undershirt", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_UNDERSHIRT, FALSE, TRUE));
|
||||||
addEntry(LLWearableType::WT_UNDERPANTS, new WearableEntry("underpants", "New Underpants", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_UNDERPANTS, FALSE, TRUE));
|
addEntry(LLWearableType::WT_UNDERPANTS, new WearableEntry("underpants", "New Underpants", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_UNDERPANTS, FALSE, TRUE));
|
||||||
addEntry(LLWearableType::WT_SKIRT, new WearableEntry("skirt", "New Skirt", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_SKIRT, FALSE, TRUE));
|
addEntry(LLWearableType::WT_SKIRT, new WearableEntry("skirt", "New Skirt", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_SKIRT, FALSE, TRUE));
|
||||||
addEntry(LLWearableType::WT_ALPHA, new WearableEntry("alpha", "New Alpha", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_ALPHA, FALSE, TRUE));
|
addEntry(LLWearableType::WT_ALPHA, new WearableEntry("alpha", "New Alpha", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_ALPHA, FALSE, TRUE));
|
||||||
addEntry(LLWearableType::WT_TATTOO, new WearableEntry("tattoo", "New Tattoo", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_TATTOO, FALSE, TRUE));
|
addEntry(LLWearableType::WT_TATTOO, new WearableEntry("tattoo", "New Tattoo", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_TATTOO, FALSE, TRUE));
|
||||||
|
|
||||||
addEntry(LLWearableType::WT_PHYSICS, new WearableEntry("physics", "New Physics", LLAssetType::AT_CLOTHING, LLInventoryIcon::ICONNAME_CLOTHING_PHYSICS, TRUE, TRUE));
|
addEntry(LLWearableType::WT_PHYSICS, new WearableEntry("physics", "New Physics", LLAssetType::AT_CLOTHING, LLInventoryType::ICONNAME_CLOTHING_PHYSICS, TRUE, TRUE));
|
||||||
|
|
||||||
addEntry(LLWearableType::WT_INVALID, new WearableEntry("invalid", "Invalid Wearable", LLAssetType::AT_NONE, LLInventoryIcon::ICONNAME_NONE, FALSE, FALSE));
|
addEntry(LLWearableType::WT_INVALID, new WearableEntry("invalid", "Invalid Wearable", LLAssetType::AT_NONE, LLInventoryType::ICONNAME_NONE, FALSE, FALSE));
|
||||||
addEntry(LLWearableType::WT_NONE, new WearableEntry("none", "Invalid Wearable", LLAssetType::AT_NONE, LLInventoryIcon::ICONNAME_NONE, FALSE, FALSE));
|
addEntry(LLWearableType::WT_NONE, new WearableEntry("none", "Invalid Wearable", LLAssetType::AT_NONE, LLInventoryType::ICONNAME_NONE, FALSE, FALSE));
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
@@ -138,7 +150,7 @@ LLAssetType::EType LLWearableType::getAssetType(LLWearableType::EType type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
LLInventoryIcon::EIconName LLWearableType::getIconName(LLWearableType::EType type)
|
LLInventoryType::EIconName LLWearableType::getIconName(LLWearableType::EType type)
|
||||||
{
|
{
|
||||||
const LLWearableDictionary *dict = LLWearableDictionary::getInstance();
|
const LLWearableDictionary *dict = LLWearableDictionary::getInstance();
|
||||||
const WearableEntry *entry = dict->lookup(type);
|
const WearableEntry *entry = dict->lookup(type);
|
||||||
@@ -29,9 +29,16 @@
|
|||||||
|
|
||||||
#include "llassettype.h"
|
#include "llassettype.h"
|
||||||
#include "lldictionary.h"
|
#include "lldictionary.h"
|
||||||
#include "llinventoryicon.h"
|
#include "llinventorytype.h"
|
||||||
#include "llsingleton.h"
|
#include "llsingleton.h"
|
||||||
|
|
||||||
|
class LLTranslationBridge
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual std::string getString(const std::string &xml_desc) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class LLWearableType
|
class LLWearableType
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -59,12 +66,15 @@ public:
|
|||||||
WT_NONE = -1,
|
WT_NONE = -1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void initClass(LLTranslationBridge* trans); // initializes static members
|
||||||
|
static void cleanupClass(); // initializes static members
|
||||||
|
|
||||||
static const std::string& getTypeName(EType type);
|
static const std::string& getTypeName(EType type);
|
||||||
static const std::string& getTypeDefaultNewName(EType type);
|
static const std::string& getTypeDefaultNewName(EType type);
|
||||||
static const std::string& getTypeLabel(EType type);
|
static const std::string& getTypeLabel(EType type);
|
||||||
static LLAssetType::EType getAssetType(EType type);
|
static LLAssetType::EType getAssetType(EType type);
|
||||||
static EType typeNameToType(const std::string& type_name);
|
static EType typeNameToType(const std::string& type_name);
|
||||||
static LLInventoryIcon::EIconName getIconName(EType type);
|
static LLInventoryType::EIconName getIconName(EType type);
|
||||||
static BOOL getDisableCameraSwitch(EType type);
|
static BOOL getDisableCameraSwitch(EType type);
|
||||||
static BOOL getAllowMultiwear(EType type);
|
static BOOL getAllowMultiwear(EType type);
|
||||||
|
|
||||||
@@ -292,7 +292,7 @@ void LLCharacter::removeAnimationData(std::string name)
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// setVisualParamWeight()
|
// setVisualParamWeight()
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
BOOL LLCharacter::setVisualParamWeight(LLVisualParam* which_param, F32 weight, BOOL upload_bake)
|
BOOL LLCharacter::setVisualParamWeight(const LLVisualParam* which_param, F32 weight, BOOL upload_bake)
|
||||||
{
|
{
|
||||||
S32 index = which_param->getID();
|
S32 index = which_param->getID();
|
||||||
visual_param_index_map_t::iterator index_iter = mVisualParamIndexMap.find(index);
|
visual_param_index_map_t::iterator index_iter = mVisualParamIndexMap.find(index);
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ public:
|
|||||||
void addVisualParam(LLVisualParam *param);
|
void addVisualParam(LLVisualParam *param);
|
||||||
void addSharedVisualParam(LLVisualParam *param);
|
void addSharedVisualParam(LLVisualParam *param);
|
||||||
|
|
||||||
virtual BOOL setVisualParamWeight(LLVisualParam *which_param, F32 weight, BOOL upload_bake = FALSE );
|
virtual BOOL setVisualParamWeight(const 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(const char* param_name, F32 weight, BOOL upload_bake = FALSE );
|
||||||
virtual BOOL setVisualParamWeight(S32 index, F32 weight, BOOL upload_bake = FALSE );
|
virtual BOOL setVisualParamWeight(S32 index, F32 weight, BOOL upload_bake = FALSE );
|
||||||
|
|
||||||
|
|||||||
@@ -2,31 +2,25 @@
|
|||||||
* @file lljoint.cpp
|
* @file lljoint.cpp
|
||||||
* @brief Implementation of LLJoint class.
|
* @brief Implementation of LLJoint class.
|
||||||
*
|
*
|
||||||
* $LicenseInfo:firstyear=2001&license=viewergpl$
|
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||||
*
|
|
||||||
* Copyright (c) 2001-2009, Linden Research, Inc.
|
|
||||||
*
|
|
||||||
* Second Life Viewer Source Code
|
* Second Life Viewer Source Code
|
||||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
* Copyright (C) 2010, Linden Research, Inc.
|
||||||
* 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://secondlifegrid.net/programs/open_source/licensing/gplv2
|
|
||||||
*
|
*
|
||||||
* There are special exceptions to the terms and conditions of the GPL as
|
* This library is free software; you can redistribute it and/or
|
||||||
* it is applied to this Source Code. View the full text of the exception
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
* License as published by the Free Software Foundation;
|
||||||
* online at
|
* version 2.1 of the License only.
|
||||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
|
||||||
*
|
*
|
||||||
* By copying, modifying or distributing this software, you acknowledge
|
* This library is distributed in the hope that it will be useful,
|
||||||
* that you have read and understood your obligations described above,
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* and agree to abide by those obligations.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
* License along with this library; if not, write to the Free Software
|
||||||
* COMPLETENESS OR PERFORMANCE.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
* $/LicenseInfo$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -46,7 +40,9 @@ S32 LLJoint::sNumTouches = 0;
|
|||||||
// LLJoint()
|
// LLJoint()
|
||||||
// Class Constructor
|
// Class Constructor
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
LLJoint::LLJoint()
|
|
||||||
|
|
||||||
|
void LLJoint::init()
|
||||||
{
|
{
|
||||||
mName = "unnamed";
|
mName = "unnamed";
|
||||||
mParent = NULL;
|
mParent = NULL;
|
||||||
@@ -54,7 +50,20 @@ LLJoint::LLJoint()
|
|||||||
mXform.setScale(LLVector3(1.0f, 1.0f, 1.0f));
|
mXform.setScale(LLVector3(1.0f, 1.0f, 1.0f));
|
||||||
mDirtyFlags = MATRIX_DIRTY | ROTATION_DIRTY | POSITION_DIRTY;
|
mDirtyFlags = MATRIX_DIRTY | ROTATION_DIRTY | POSITION_DIRTY;
|
||||||
mUpdateXform = TRUE;
|
mUpdateXform = TRUE;
|
||||||
mJointNum = -1;
|
}
|
||||||
|
|
||||||
|
LLJoint::LLJoint() :
|
||||||
|
mJointNum(-1)
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
touch();
|
||||||
|
mResetAfterRestoreOldXform = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
LLJoint::LLJoint(S32 joint_num) :
|
||||||
|
mJointNum(joint_num)
|
||||||
|
{
|
||||||
|
init();
|
||||||
touch();
|
touch();
|
||||||
mResetAfterRestoreOldXform = false;
|
mResetAfterRestoreOldXform = false;
|
||||||
}
|
}
|
||||||
@@ -64,15 +73,12 @@ LLJoint::LLJoint()
|
|||||||
// LLJoint()
|
// LLJoint()
|
||||||
// Class Constructor
|
// Class Constructor
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
LLJoint::LLJoint(const std::string &name, LLJoint *parent)
|
LLJoint::LLJoint(const std::string &name, LLJoint *parent) :
|
||||||
|
mJointNum(0)
|
||||||
{
|
{
|
||||||
mName = "unnamed";
|
init();
|
||||||
mParent = NULL;
|
|
||||||
mXform.setScaleChildOffset(TRUE);
|
|
||||||
mXform.setScale(LLVector3(1.0f, 1.0f, 1.0f));
|
|
||||||
mDirtyFlags = MATRIX_DIRTY | ROTATION_DIRTY | POSITION_DIRTY;
|
|
||||||
mUpdateXform = FALSE;
|
mUpdateXform = FALSE;
|
||||||
mJointNum = 0;
|
// *TODO: mResetAfterRestoreOldXform is not initialized!!!
|
||||||
|
|
||||||
setName(name);
|
setName(name);
|
||||||
if (parent)
|
if (parent)
|
||||||
|
|||||||
@@ -2,31 +2,25 @@
|
|||||||
* @file lljoint.h
|
* @file lljoint.h
|
||||||
* @brief Implementation of LLJoint class.
|
* @brief Implementation of LLJoint class.
|
||||||
*
|
*
|
||||||
* $LicenseInfo:firstyear=2001&license=viewergpl$
|
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||||
*
|
|
||||||
* Copyright (c) 2001-2009, Linden Research, Inc.
|
|
||||||
*
|
|
||||||
* Second Life Viewer Source Code
|
* Second Life Viewer Source Code
|
||||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
* Copyright (C) 2010, Linden Research, Inc.
|
||||||
* 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://secondlifegrid.net/programs/open_source/licensing/gplv2
|
|
||||||
*
|
*
|
||||||
* There are special exceptions to the terms and conditions of the GPL as
|
* This library is free software; you can redistribute it and/or
|
||||||
* it is applied to this Source Code. View the full text of the exception
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
* License as published by the Free Software Foundation;
|
||||||
* online at
|
* version 2.1 of the License only.
|
||||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
|
||||||
*
|
*
|
||||||
* By copying, modifying or distributing this software, you acknowledge
|
* This library is distributed in the hope that it will be useful,
|
||||||
* that you have read and understood your obligations described above,
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* and agree to abide by those obligations.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
* License along with this library; if not, write to the Free Software
|
||||||
* COMPLETENESS OR PERFORMANCE.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
* $/LicenseInfo$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -110,10 +104,15 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
LLJoint();
|
LLJoint();
|
||||||
|
LLJoint(S32 joint_num);
|
||||||
LLJoint( const std::string &name, LLJoint *parent=NULL );
|
LLJoint( const std::string &name, LLJoint *parent=NULL );
|
||||||
|
|
||||||
virtual ~LLJoint();
|
virtual ~LLJoint();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void init();
|
||||||
|
|
||||||
|
public:
|
||||||
// set name and parent
|
// set name and parent
|
||||||
void setup( const std::string &name, LLJoint *parent=NULL );
|
void setup( const std::string &name, LLJoint *parent=NULL );
|
||||||
|
|
||||||
@@ -141,6 +140,8 @@ public:
|
|||||||
const LLVector3& getPosition();
|
const LLVector3& getPosition();
|
||||||
void setPosition( const LLVector3& pos );
|
void setPosition( const LLVector3& pos );
|
||||||
|
|
||||||
|
void setDefaultPosition( const LLVector3& pos );
|
||||||
|
|
||||||
// get/set world position
|
// get/set world position
|
||||||
LLVector3 getWorldPosition();
|
LLVector3 getWorldPosition();
|
||||||
LLVector3 getLastWorldPosition();
|
LLVector3 getLastWorldPosition();
|
||||||
@@ -181,7 +182,6 @@ public:
|
|||||||
virtual BOOL isAnimatable() const { return TRUE; }
|
virtual BOOL isAnimatable() const { return TRUE; }
|
||||||
|
|
||||||
S32 getJointNum() const { return mJointNum; }
|
S32 getJointNum() const { return mJointNum; }
|
||||||
void setJointNum(S32 joint_num) { mJointNum = joint_num; }
|
|
||||||
|
|
||||||
void restoreOldXform( void );
|
void restoreOldXform( void );
|
||||||
void restoreToDefaultXform( void );
|
void restoreToDefaultXform( void );
|
||||||
|
|||||||
@@ -168,7 +168,8 @@ LLVisualParam::LLVisualParam()
|
|||||||
mIsAnimating( FALSE ),
|
mIsAnimating( FALSE ),
|
||||||
mID( -1 ),
|
mID( -1 ),
|
||||||
mInfo( 0 ),
|
mInfo( 0 ),
|
||||||
mIsDummy(FALSE)
|
mIsDummy(FALSE),
|
||||||
|
mParamLocation(LOC_UNKNOWN)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,3 +320,32 @@ void LLVisualParam::resetDrivenParams()
|
|||||||
// nothing to do for non-driver parameters
|
// nothing to do for non-driver parameters
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string param_location_name(const EParamLocation& loc)
|
||||||
|
{
|
||||||
|
switch (loc)
|
||||||
|
{
|
||||||
|
case LOC_UNKNOWN: return "unknown";
|
||||||
|
case LOC_AV_SELF: return "self";
|
||||||
|
case LOC_AV_OTHER: return "other";
|
||||||
|
case LOC_WEARABLE: return "wearable";
|
||||||
|
default: return "error";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLVisualParam::setParamLocation(EParamLocation loc)
|
||||||
|
{
|
||||||
|
if (mParamLocation == LOC_UNKNOWN || loc == LOC_UNKNOWN)
|
||||||
|
{
|
||||||
|
mParamLocation = loc;
|
||||||
|
}
|
||||||
|
else if (mParamLocation == loc)
|
||||||
|
{
|
||||||
|
// no action
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lldebugs << "param location is already " << mParamLocation << ", not slamming to " << loc << llendl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,16 @@ enum EVisualParamGroup
|
|||||||
NUM_VISUAL_PARAM_GROUPS
|
NUM_VISUAL_PARAM_GROUPS
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum EParamLocation
|
||||||
|
{
|
||||||
|
LOC_UNKNOWN,
|
||||||
|
LOC_AV_SELF,
|
||||||
|
LOC_AV_OTHER,
|
||||||
|
LOC_WEARABLE
|
||||||
|
};
|
||||||
|
|
||||||
|
const std::string param_location_name(const EParamLocation& loc);
|
||||||
|
|
||||||
const S32 MAX_TRANSMITTED_VISUAL_PARAMS = 255;
|
const S32 MAX_TRANSMITTED_VISUAL_PARAMS = 255;
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@@ -149,6 +159,9 @@ public:
|
|||||||
|
|
||||||
void setIsDummy(BOOL is_dummy) { mIsDummy = is_dummy; }
|
void setIsDummy(BOOL is_dummy) { mIsDummy = is_dummy; }
|
||||||
|
|
||||||
|
void setParamLocation(EParamLocation loc);
|
||||||
|
EParamLocation getParamLocation() const { return mParamLocation; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
F32 mCurWeight; // current weight
|
F32 mCurWeight; // current weight
|
||||||
F32 mLastWeight; // last weight
|
F32 mLastWeight; // last weight
|
||||||
@@ -160,6 +173,7 @@ protected:
|
|||||||
|
|
||||||
S32 mID; // id for storing weight/morphtarget compares compactly
|
S32 mID; // id for storing weight/morphtarget compares compactly
|
||||||
LLVisualParamInfo *mInfo;
|
LLVisualParamInfo *mInfo;
|
||||||
|
EParamLocation mParamLocation; // where does this visual param live?
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LL_LLVisualParam_H
|
#endif // LL_LLVisualParam_H
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -5,31 +5,25 @@
|
|||||||
* @brief Declaration of cross-platform POSIX file buffer and c++
|
* @brief Declaration of cross-platform POSIX file buffer and c++
|
||||||
* stream classes.
|
* stream classes.
|
||||||
*
|
*
|
||||||
* $LicenseInfo:firstyear=2006&license=viewergpl$
|
* $LicenseInfo:firstyear=2006&license=viewerlgpl$
|
||||||
*
|
|
||||||
* Copyright (c) 2006-2009, Linden Research, Inc.
|
|
||||||
*
|
|
||||||
* Second Life Viewer Source Code
|
* Second Life Viewer Source Code
|
||||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
* Copyright (C) 2010, Linden Research, Inc.
|
||||||
* 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://secondlifegrid.net/programs/open_source/licensing/gplv2
|
|
||||||
*
|
*
|
||||||
* There are special exceptions to the terms and conditions of the GPL as
|
* This library is free software; you can redistribute it and/or
|
||||||
* it is applied to this Source Code. View the full text of the exception
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
* License as published by the Free Software Foundation;
|
||||||
* online at
|
* version 2.1 of the License only.
|
||||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
|
||||||
*
|
*
|
||||||
* By copying, modifying or distributing this software, you acknowledge
|
* This library is distributed in the hope that it will be useful,
|
||||||
* that you have read and understood your obligations described above,
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* and agree to abide by those obligations.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
* License along with this library; if not, write to the Free Software
|
||||||
* COMPLETENESS OR PERFORMANCE.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
* $/LicenseInfo$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -44,13 +38,6 @@
|
|||||||
typedef FILE LLFILE;
|
typedef FILE LLFILE;
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
#ifdef LL_WINDOWS
|
|
||||||
#define USE_LLFILESTREAMS 1
|
|
||||||
#else
|
|
||||||
#define USE_LLFILESTREAMS 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#if LL_WINDOWS
|
#if LL_WINDOWS
|
||||||
@@ -58,6 +45,8 @@ typedef FILE LLFILE;
|
|||||||
typedef struct _stat llstat;
|
typedef struct _stat llstat;
|
||||||
#else
|
#else
|
||||||
typedef struct stat llstat;
|
typedef struct stat llstat;
|
||||||
|
#include <ext/stdio_filebuf.h>
|
||||||
|
#include <bits/postypes.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef S_ISREG
|
#ifndef S_ISREG
|
||||||
@@ -89,145 +78,345 @@ public:
|
|||||||
static int stat(const std::string& filename,llstat* file_status);
|
static int stat(const std::string& filename,llstat* file_status);
|
||||||
static bool isdir(const std::string& filename);
|
static bool isdir(const std::string& filename);
|
||||||
static bool isfile(const std::string& filename);
|
static bool isfile(const std::string& filename);
|
||||||
static LLFILE * _Fiopen(const std::string& filename, std::ios::openmode mode,int); // protection currently unused
|
static LLFILE * _Fiopen(const std::string& filename,
|
||||||
|
std::ios::openmode mode);
|
||||||
|
|
||||||
static const char * tmpdir();
|
static const char * tmpdir();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
#if USE_LLFILESTREAMS
|
* @brief Provides a layer of compatibility for C/POSIX.
|
||||||
|
*
|
||||||
class LL_COMMON_API llifstream : public std::basic_istream < char , std::char_traits < char > >
|
* This is taken from both the GNU __gnu_cxx::stdio_filebuf extension and
|
||||||
|
* VC's basic_filebuf implementation.
|
||||||
|
* This file buffer provides extensions for working with standard C FILE*'s
|
||||||
|
* and POSIX file descriptors for platforms that support this.
|
||||||
|
*/
|
||||||
|
namespace
|
||||||
{
|
{
|
||||||
// input stream associated with a C stream
|
#if LL_WINDOWS
|
||||||
public:
|
typedef std::filebuf _Myfb;
|
||||||
typedef std::basic_ifstream<char,std::char_traits < char > > _Myt;
|
|
||||||
typedef std::basic_filebuf<char,std::char_traits< char > > _Myfb;
|
|
||||||
typedef std::basic_ios<char,std::char_traits< char > > _Myios;
|
|
||||||
|
|
||||||
llifstream()
|
|
||||||
: std::basic_istream<char,std::char_traits< char > >(NULL,true),_Filebuffer(NULL),_ShouldClose(false)
|
|
||||||
{ // construct unopened
|
|
||||||
}
|
|
||||||
|
|
||||||
explicit llifstream(const std::string& _Filename,
|
|
||||||
ios_base::openmode _Mode = ios_base::in,
|
|
||||||
int _Prot = (int)ios_base::_Openprot);
|
|
||||||
|
|
||||||
explicit llifstream(_Filet *_File)
|
|
||||||
: std::basic_istream<char,std::char_traits< char > >(NULL,true),
|
|
||||||
_Filebuffer(new _Myfb(_File)),
|
|
||||||
_ShouldClose(false)
|
|
||||||
{ // construct with specified C stream
|
|
||||||
}
|
|
||||||
virtual ~llifstream();
|
|
||||||
|
|
||||||
_Myfb *rdbuf() const
|
|
||||||
{ // return pointer to file buffer
|
|
||||||
return _Filebuffer;
|
|
||||||
}
|
|
||||||
bool is_open() const;
|
|
||||||
void open(const std::string& _Filename, /* Flawfinder: ignore */
|
|
||||||
ios_base::openmode _Mode = ios_base::in,
|
|
||||||
int _Prot = (int)ios_base::_Openprot);
|
|
||||||
void close();
|
|
||||||
|
|
||||||
private:
|
|
||||||
_Myfb* _Filebuffer; // the file buffer
|
|
||||||
bool _ShouldClose;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class LL_COMMON_API llofstream : public std::basic_ostream< char , std::char_traits < char > >
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
typedef std::basic_ostream< char , std::char_traits < char > > _Myt;
|
|
||||||
typedef std::basic_filebuf< char , std::char_traits < char > > _Myfb;
|
|
||||||
typedef std::basic_ios<char,std::char_traits < char > > _Myios;
|
|
||||||
|
|
||||||
llofstream()
|
|
||||||
: std::basic_ostream<char,std::char_traits < char > >(NULL,true),_Filebuffer(NULL),_ShouldClose(false)
|
|
||||||
{ // construct unopened
|
|
||||||
}
|
|
||||||
|
|
||||||
explicit llofstream(const std::string& _Filename,
|
|
||||||
std::ios_base::openmode _Mode = ios_base::out,
|
|
||||||
int _Prot = (int)std::ios_base::_Openprot);
|
|
||||||
|
|
||||||
|
|
||||||
explicit llofstream(_Filet *_File)
|
|
||||||
: std::basic_ostream<char,std::char_traits < char > >(NULL,true),
|
|
||||||
_Filebuffer(new _Myfb(_File)),//_File)
|
|
||||||
_ShouldClose(false)
|
|
||||||
{ // construct with specified C stream
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual ~llofstream();
|
|
||||||
|
|
||||||
_Myfb *rdbuf() const
|
|
||||||
{ // return pointer to file buffer
|
|
||||||
return _Filebuffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool is_open() const;
|
|
||||||
|
|
||||||
void open(const std::string& _Filename,ios_base::openmode _Mode = ios_base::out,int _Prot = (int)ios_base::_Openprot); /* Flawfinder: ignore */
|
|
||||||
|
|
||||||
void close();
|
|
||||||
|
|
||||||
private:
|
|
||||||
_Myfb *_Filebuffer; // the file buffer
|
|
||||||
bool _ShouldClose;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
//Use standard file streams on non windows platforms
|
typedef __gnu_cxx::stdio_filebuf< char > _Myfb;
|
||||||
//#define llifstream std::ifstream
|
typedef std::__c_file _Filet;
|
||||||
//#define llofstream std::ofstream
|
#endif /* LL_WINDOWS */
|
||||||
|
}
|
||||||
|
|
||||||
class LL_COMMON_API llifstream : public std::ifstream
|
class LL_COMMON_API llstdio_filebuf : public _Myfb
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
llifstream() : std::ifstream()
|
/**
|
||||||
{
|
* deferred initialization / destruction
|
||||||
}
|
*/
|
||||||
|
llstdio_filebuf() : _Myfb() {}
|
||||||
explicit llifstream(const std::string& _Filename, std::_Ios_Openmode _Mode = in)
|
virtual ~llstdio_filebuf() {}
|
||||||
: std::ifstream(_Filename.c_str(), _Mode)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
void open(const std::string& _Filename, std::_Ios_Openmode _Mode = in) /* Flawfinder: ignore */
|
|
||||||
{
|
|
||||||
std::ifstream::open(_Filename.c_str(), _Mode);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class LL_COMMON_API llofstream : public std::ofstream
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
llofstream() : std::ofstream()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
explicit llofstream(const std::string& _Filename, std::_Ios_Openmode _Mode = out)
|
|
||||||
: std::ofstream(_Filename.c_str(), _Mode)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void open(const std::string& _Filename, std::_Ios_Openmode _Mode = out) /* Flawfinder: ignore */
|
|
||||||
{
|
|
||||||
std::ofstream::open(_Filename.c_str(), _Mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param f An open @c FILE*.
|
||||||
|
* @param mode Same meaning as in a standard filebuf.
|
||||||
|
* @param size Optimal or preferred size of internal buffer, in chars.
|
||||||
|
* Defaults to system's @c BUFSIZ.
|
||||||
|
*
|
||||||
|
* This constructor associates a file stream buffer with an open
|
||||||
|
* C @c FILE*. The @c FILE* will not be automatically closed when the
|
||||||
|
* stdio_filebuf is closed/destroyed.
|
||||||
|
*/
|
||||||
|
llstdio_filebuf(_Filet* __f, std::ios_base::openmode __mode,
|
||||||
|
//size_t __size = static_cast<size_t>(BUFSIZ)) :
|
||||||
|
size_t __size = static_cast<size_t>(1)) :
|
||||||
|
#if LL_WINDOWS
|
||||||
|
_Myfb(__f) {}
|
||||||
|
#else
|
||||||
|
_Myfb(__f, __mode, __size) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief filesize helpers.
|
* @brief Opens an external file.
|
||||||
|
* @param s The name of the file.
|
||||||
|
* @param mode The open mode flags.
|
||||||
|
* @return @c this on success, NULL on failure
|
||||||
|
*
|
||||||
|
* If a file is already open, this function immediately fails.
|
||||||
|
* Otherwise it tries to open the file named @a s using the flags
|
||||||
|
* given in @a mode.
|
||||||
|
*/
|
||||||
|
//llstdio_filebuf* open(const char *_Filename,
|
||||||
|
// std::ios_base::openmode _Mode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param fd An open file descriptor.
|
||||||
|
* @param mode Same meaning as in a standard filebuf.
|
||||||
|
* @param size Optimal or preferred size of internal buffer, in chars.
|
||||||
|
*
|
||||||
|
* This constructor associates a file stream buffer with an open
|
||||||
|
* POSIX file descriptor. The file descriptor will be automatically
|
||||||
|
* closed when the stdio_filebuf is closed/destroyed.
|
||||||
|
*/
|
||||||
|
#if !LL_WINDOWS
|
||||||
|
llstdio_filebuf(int __fd, std::ios_base::openmode __mode,
|
||||||
|
//size_t __size = static_cast<size_t>(BUFSIZ)) :
|
||||||
|
size_t __size = static_cast<size_t>(1)) :
|
||||||
|
_Myfb(__fd, __mode, __size) {}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// *TODO: Seek the underlying c stream for better cross-platform compatibility?
|
||||||
|
#if !LL_WINDOWS
|
||||||
|
protected:
|
||||||
|
/** underflow() and uflow() functions are called to get the next
|
||||||
|
* character from the real input source when the buffer is empty.
|
||||||
|
* Buffered input uses underflow()
|
||||||
|
*/
|
||||||
|
/*virtual*/ int_type underflow();
|
||||||
|
|
||||||
|
/* Convert internal byte sequence to external, char-based
|
||||||
|
* sequence via codecvt.
|
||||||
|
*/
|
||||||
|
bool _convert_to_external(char_type*, std::streamsize);
|
||||||
|
|
||||||
|
/** The overflow() function is called to transfer characters to the
|
||||||
|
* real output destination when the buffer is full. A call to
|
||||||
|
* overflow(c) outputs the contents of the buffer plus the
|
||||||
|
* character c.
|
||||||
|
* Consume some sequence of the characters in the pending sequence.
|
||||||
|
*/
|
||||||
|
/*virtual*/ int_type overflow(int_type __c = traits_type::eof());
|
||||||
|
|
||||||
|
/** sync() flushes the underlying @c FILE* stream.
|
||||||
|
*/
|
||||||
|
/*virtual*/ int sync();
|
||||||
|
|
||||||
|
std::streamsize xsgetn(char_type*, std::streamsize);
|
||||||
|
std::streamsize xsputn(char_type*, std::streamsize);
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Controlling input for files.
|
||||||
|
*
|
||||||
|
* This class supports reading from named files, using the inherited
|
||||||
|
* functions from std::basic_istream. To control the associated
|
||||||
|
* sequence, an instance of std::basic_filebuf (or a platform-specific derivative)
|
||||||
|
* which allows construction using a pre-exisintg file stream buffer.
|
||||||
|
* We refer to this std::basic_filebuf (or derivative) as @c sb.
|
||||||
|
*/
|
||||||
|
class LL_COMMON_API llifstream : public std::istream
|
||||||
|
{
|
||||||
|
// input stream associated with a C stream
|
||||||
|
public:
|
||||||
|
// Constructors:
|
||||||
|
/**
|
||||||
|
* @brief Default constructor.
|
||||||
|
*
|
||||||
|
* Initializes @c sb using its default constructor, and passes
|
||||||
|
* @c &sb to the base class initializer. Does not open any files
|
||||||
|
* (you haven't given it a filename to open).
|
||||||
|
*/
|
||||||
|
llifstream();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Create an input file stream.
|
||||||
|
* @param Filename String specifying the filename.
|
||||||
|
* @param Mode Open file in specified mode (see std::ios_base).
|
||||||
|
*
|
||||||
|
* @c ios_base::in is automatically included in @a mode.
|
||||||
|
*/
|
||||||
|
explicit llifstream(const std::string& _Filename,
|
||||||
|
ios_base::openmode _Mode = ios_base::in);
|
||||||
|
explicit llifstream(const char* _Filename,
|
||||||
|
ios_base::openmode _Mode = ios_base::in);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Create a stream using an open c file stream.
|
||||||
|
* @param File An open @c FILE*.
|
||||||
|
@param Mode Same meaning as in a standard filebuf.
|
||||||
|
@param Size Optimal or preferred size of internal buffer, in chars.
|
||||||
|
Defaults to system's @c BUFSIZ.
|
||||||
|
*/
|
||||||
|
explicit llifstream(_Filet *_File,
|
||||||
|
ios_base::openmode _Mode = ios_base::in,
|
||||||
|
//size_t _Size = static_cast<size_t>(BUFSIZ));
|
||||||
|
size_t _Size = static_cast<size_t>(1));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Create a stream using an open file descriptor.
|
||||||
|
* @param fd An open file descriptor.
|
||||||
|
@param Mode Same meaning as in a standard filebuf.
|
||||||
|
@param Size Optimal or preferred size of internal buffer, in chars.
|
||||||
|
Defaults to system's @c BUFSIZ.
|
||||||
|
*/
|
||||||
|
#if !LL_WINDOWS
|
||||||
|
explicit llifstream(int __fd,
|
||||||
|
ios_base::openmode _Mode = ios_base::in,
|
||||||
|
//size_t _Size = static_cast<size_t>(BUFSIZ));
|
||||||
|
size_t _Size = static_cast<size_t>(1));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The destructor does nothing.
|
||||||
|
*
|
||||||
|
* The file is closed by the filebuf object, not the formatting
|
||||||
|
* stream.
|
||||||
|
*/
|
||||||
|
virtual ~llifstream() {}
|
||||||
|
|
||||||
|
// Members:
|
||||||
|
/**
|
||||||
|
* @brief Accessing the underlying buffer.
|
||||||
|
* @return The current basic_filebuf buffer.
|
||||||
|
*
|
||||||
|
* This hides both signatures of std::basic_ios::rdbuf().
|
||||||
|
*/
|
||||||
|
llstdio_filebuf* rdbuf() const
|
||||||
|
{ return const_cast<llstdio_filebuf*>(&_M_filebuf); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Wrapper to test for an open file.
|
||||||
|
* @return @c rdbuf()->is_open()
|
||||||
|
*/
|
||||||
|
bool is_open() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Opens an external file.
|
||||||
|
* @param Filename The name of the file.
|
||||||
|
* @param Node The open mode flags.
|
||||||
|
*
|
||||||
|
* Calls @c llstdio_filebuf::open(s,mode|in). If that function
|
||||||
|
* fails, @c failbit is set in the stream's error state.
|
||||||
|
*/
|
||||||
|
void open(const std::string& _Filename,
|
||||||
|
ios_base::openmode _Mode = ios_base::in)
|
||||||
|
{ open(_Filename.c_str(), _Mode); }
|
||||||
|
void open(const char* _Filename,
|
||||||
|
ios_base::openmode _Mode = ios_base::in);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Close the file.
|
||||||
|
*
|
||||||
|
* Calls @c llstdio_filebuf::close(). If that function
|
||||||
|
* fails, @c failbit is set in the stream's error state.
|
||||||
|
*/
|
||||||
|
void close();
|
||||||
|
|
||||||
|
private:
|
||||||
|
llstdio_filebuf _M_filebuf;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Controlling output for files.
|
||||||
|
*
|
||||||
|
* This class supports writing to named files, using the inherited
|
||||||
|
* functions from std::basic_ostream. To control the associated
|
||||||
|
* sequence, an instance of std::basic_filebuf (or a platform-specific derivative)
|
||||||
|
* which allows construction using a pre-exisintg file stream buffer.
|
||||||
|
* We refer to this std::basic_filebuf (or derivative) as @c sb.
|
||||||
|
*/
|
||||||
|
class LL_COMMON_API llofstream : public std::ostream
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// Constructors:
|
||||||
|
/**
|
||||||
|
* @brief Default constructor.
|
||||||
|
*
|
||||||
|
* Initializes @c sb using its default constructor, and passes
|
||||||
|
* @c &sb to the base class initializer. Does not open any files
|
||||||
|
* (you haven't given it a filename to open).
|
||||||
|
*/
|
||||||
|
llofstream();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Create an output file stream.
|
||||||
|
* @param Filename String specifying the filename.
|
||||||
|
* @param Mode Open file in specified mode (see std::ios_base).
|
||||||
|
*
|
||||||
|
* @c ios_base::out|ios_base::trunc is automatically included in
|
||||||
|
* @a mode.
|
||||||
|
*/
|
||||||
|
explicit llofstream(const std::string& _Filename,
|
||||||
|
ios_base::openmode _Mode = ios_base::out|ios_base::trunc);
|
||||||
|
explicit llofstream(const char* _Filename,
|
||||||
|
ios_base::openmode _Mode = ios_base::out|ios_base::trunc);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Create a stream using an open c file stream.
|
||||||
|
* @param File An open @c FILE*.
|
||||||
|
@param Mode Same meaning as in a standard filebuf.
|
||||||
|
@param Size Optimal or preferred size of internal buffer, in chars.
|
||||||
|
Defaults to system's @c BUFSIZ.
|
||||||
|
*/
|
||||||
|
explicit llofstream(_Filet *_File,
|
||||||
|
ios_base::openmode _Mode = ios_base::out,
|
||||||
|
//size_t _Size = static_cast<size_t>(BUFSIZ));
|
||||||
|
size_t _Size = static_cast<size_t>(1));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Create a stream using an open file descriptor.
|
||||||
|
* @param fd An open file descriptor.
|
||||||
|
@param Mode Same meaning as in a standard filebuf.
|
||||||
|
@param Size Optimal or preferred size of internal buffer, in chars.
|
||||||
|
Defaults to system's @c BUFSIZ.
|
||||||
|
*/
|
||||||
|
#if !LL_WINDOWS
|
||||||
|
explicit llofstream(int __fd,
|
||||||
|
ios_base::openmode _Mode = ios_base::out,
|
||||||
|
//size_t _Size = static_cast<size_t>(BUFSIZ));
|
||||||
|
size_t _Size = static_cast<size_t>(1));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief The destructor does nothing.
|
||||||
|
*
|
||||||
|
* The file is closed by the filebuf object, not the formatting
|
||||||
|
* stream.
|
||||||
|
*/
|
||||||
|
virtual ~llofstream() {}
|
||||||
|
|
||||||
|
// Members:
|
||||||
|
/**
|
||||||
|
* @brief Accessing the underlying buffer.
|
||||||
|
* @return The current basic_filebuf buffer.
|
||||||
|
*
|
||||||
|
* This hides both signatures of std::basic_ios::rdbuf().
|
||||||
|
*/
|
||||||
|
llstdio_filebuf* rdbuf() const
|
||||||
|
{ return const_cast<llstdio_filebuf*>(&_M_filebuf); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Wrapper to test for an open file.
|
||||||
|
* @return @c rdbuf()->is_open()
|
||||||
|
*/
|
||||||
|
bool is_open() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Opens an external file.
|
||||||
|
* @param Filename The name of the file.
|
||||||
|
* @param Node The open mode flags.
|
||||||
|
*
|
||||||
|
* Calls @c llstdio_filebuf::open(s,mode|out). If that function
|
||||||
|
* fails, @c failbit is set in the stream's error state.
|
||||||
|
*/
|
||||||
|
void open(const std::string& _Filename,
|
||||||
|
ios_base::openmode _Mode = ios_base::out|ios_base::trunc)
|
||||||
|
{ open(_Filename.c_str(), _Mode); }
|
||||||
|
void open(const char* _Filename,
|
||||||
|
ios_base::openmode _Mode = ios_base::out|ios_base::trunc);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Close the file.
|
||||||
|
*
|
||||||
|
* Calls @c llstdio_filebuf::close(). If that function
|
||||||
|
* fails, @c failbit is set in the stream's error state.
|
||||||
|
*/
|
||||||
|
void close();
|
||||||
|
|
||||||
|
private:
|
||||||
|
llstdio_filebuf _M_filebuf;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @breif filesize helpers.
|
||||||
*
|
*
|
||||||
* The file size helpers are not considered particularly efficient,
|
* The file size helpers are not considered particularly efficient,
|
||||||
* and should only be used for config files and the like -- not in a
|
* and should only be used for config files and the like -- not in a
|
||||||
|
|||||||
@@ -2,31 +2,25 @@
|
|||||||
* @file llinventory.cpp
|
* @file llinventory.cpp
|
||||||
* @brief Implementation of the inventory system.
|
* @brief Implementation of the inventory system.
|
||||||
*
|
*
|
||||||
* $LicenseInfo:firstyear=2001&license=viewergpl$
|
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||||
*
|
|
||||||
* Copyright (c) 2001-2009, Linden Research, Inc.
|
|
||||||
*
|
|
||||||
* Second Life Viewer Source Code
|
* Second Life Viewer Source Code
|
||||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
* Copyright (C) 2010, Linden Research, Inc.
|
||||||
* 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://secondlifegrid.net/programs/open_source/licensing/gplv2
|
|
||||||
*
|
*
|
||||||
* There are special exceptions to the terms and conditions of the GPL as
|
* This library is free software; you can redistribute it and/or
|
||||||
* it is applied to this Source Code. View the full text of the exception
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
* License as published by the Free Software Foundation;
|
||||||
* online at
|
* version 2.1 of the License only.
|
||||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
|
||||||
*
|
*
|
||||||
* By copying, modifying or distributing this software, you acknowledge
|
* This library is distributed in the hope that it will be useful,
|
||||||
* that you have read and understood your obligations described above,
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* and agree to abide by those obligations.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
* License along with this library; if not, write to the Free Software
|
||||||
* COMPLETENESS OR PERFORMANCE.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
* $/LicenseInfo$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -845,7 +839,7 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream)
|
|||||||
}
|
}
|
||||||
else if(0 == strcmp("permissions", keyword))
|
else if(0 == strcmp("permissions", keyword))
|
||||||
{
|
{
|
||||||
success = mPermissions.importLegacyStream(input_stream);
|
success = mPermissions.importStream(input_stream);
|
||||||
}
|
}
|
||||||
else if(0 == strcmp("sale_info", keyword))
|
else if(0 == strcmp("sale_info", keyword))
|
||||||
{
|
{
|
||||||
@@ -855,7 +849,7 @@ BOOL LLInventoryItem::importLegacyStream(std::istream& input_stream)
|
|||||||
// should pick up the vast majority of the tasks.
|
// should pick up the vast majority of the tasks.
|
||||||
BOOL has_perm_mask = FALSE;
|
BOOL has_perm_mask = FALSE;
|
||||||
U32 perm_mask = 0;
|
U32 perm_mask = 0;
|
||||||
success = mSaleInfo.importLegacyStream(input_stream, has_perm_mask, perm_mask);
|
success = mSaleInfo.importStream(input_stream, has_perm_mask, perm_mask);
|
||||||
if(has_perm_mask)
|
if(has_perm_mask)
|
||||||
{
|
{
|
||||||
if(perm_mask == PERM_NONE)
|
if(perm_mask == PERM_NONE)
|
||||||
@@ -971,7 +965,7 @@ BOOL LLInventoryItem::exportLegacyStream(std::ostream& output_stream, BOOL inclu
|
|||||||
output_stream << "\t\titem_id\t" << uuid_str << "\n";
|
output_stream << "\t\titem_id\t" << uuid_str << "\n";
|
||||||
mParentUUID.toString(uuid_str);
|
mParentUUID.toString(uuid_str);
|
||||||
output_stream << "\t\tparent_id\t" << uuid_str << "\n";
|
output_stream << "\t\tparent_id\t" << uuid_str << "\n";
|
||||||
mPermissions.exportLegacyStream(output_stream);
|
mPermissions.exportStream(output_stream);
|
||||||
|
|
||||||
// Check for permissions to see the asset id, and if so write it
|
// Check for permissions to see the asset id, and if so write it
|
||||||
// out as an asset id. Otherwise, apply our cheesy encryption.
|
// out as an asset id. Otherwise, apply our cheesy encryption.
|
||||||
@@ -1005,7 +999,7 @@ BOOL LLInventoryItem::exportLegacyStream(std::ostream& output_stream, BOOL inclu
|
|||||||
std::string buffer;
|
std::string buffer;
|
||||||
buffer = llformat( "\t\tflags\t%08x\n", mFlags);
|
buffer = llformat( "\t\tflags\t%08x\n", mFlags);
|
||||||
output_stream << buffer;
|
output_stream << buffer;
|
||||||
mSaleInfo.exportLegacyStream(output_stream);
|
mSaleInfo.exportStream(output_stream);
|
||||||
output_stream << "\t\tname\t" << mName.c_str() << "|\n";
|
output_stream << "\t\tname\t" << mName.c_str() << "|\n";
|
||||||
output_stream << "\t\tdesc\t" << mDescription.c_str() << "|\n";
|
output_stream << "\t\tdesc\t" << mDescription.c_str() << "|\n";
|
||||||
output_stream << "\t\tcreation_date\t" << mCreationDate << "\n";
|
output_stream << "\t\tcreation_date\t" << mCreationDate << "\n";
|
||||||
@@ -1123,7 +1117,7 @@ bool LLInventoryItem::fromLLSD(const LLSD& sd)
|
|||||||
{
|
{
|
||||||
if (sd[w].isString())
|
if (sd[w].isString())
|
||||||
{
|
{
|
||||||
mType = LLAssetType::lookup(sd[w].asString());
|
mType = LLAssetType::lookup(sd[w].asString().c_str());
|
||||||
}
|
}
|
||||||
else if (sd[w].isInteger())
|
else if (sd[w].isInteger())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,31 +2,25 @@
|
|||||||
* @file llinventory.h
|
* @file llinventory.h
|
||||||
* @brief LLInventoryItem and LLInventoryCategory class declaration.
|
* @brief LLInventoryItem and LLInventoryCategory class declaration.
|
||||||
*
|
*
|
||||||
* $LicenseInfo:firstyear=2001&license=viewergpl$
|
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||||
*
|
|
||||||
* Copyright (c) 2001-2009, Linden Research, Inc.
|
|
||||||
*
|
|
||||||
* Second Life Viewer Source Code
|
* Second Life Viewer Source Code
|
||||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
* Copyright (C) 2010, Linden Research, Inc.
|
||||||
* 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://secondlifegrid.net/programs/open_source/licensing/gplv2
|
|
||||||
*
|
*
|
||||||
* There are special exceptions to the terms and conditions of the GPL as
|
* This library is free software; you can redistribute it and/or
|
||||||
* it is applied to this Source Code. View the full text of the exception
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
* License as published by the Free Software Foundation;
|
||||||
* online at
|
* version 2.1 of the License only.
|
||||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
|
||||||
*
|
*
|
||||||
* By copying, modifying or distributing this software, you acknowledge
|
* This library is distributed in the hope that it will be useful,
|
||||||
* that you have read and understood your obligations described above,
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* and agree to abide by those obligations.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
* License along with this library; if not, write to the Free Software
|
||||||
* COMPLETENESS OR PERFORMANCE.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
* $/LicenseInfo$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -74,6 +74,53 @@ public:
|
|||||||
IT_NONE = -1
|
IT_NONE = -1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum EIconName
|
||||||
|
{
|
||||||
|
ICONNAME_TEXTURE,
|
||||||
|
ICONNAME_SOUND,
|
||||||
|
ICONNAME_CALLINGCARD_ONLINE,
|
||||||
|
ICONNAME_CALLINGCARD_OFFLINE,
|
||||||
|
ICONNAME_LANDMARK,
|
||||||
|
ICONNAME_LANDMARK_VISITED,
|
||||||
|
ICONNAME_SCRIPT,
|
||||||
|
ICONNAME_CLOTHING,
|
||||||
|
ICONNAME_OBJECT,
|
||||||
|
ICONNAME_OBJECT_MULTI,
|
||||||
|
ICONNAME_NOTECARD,
|
||||||
|
ICONNAME_BODYPART,
|
||||||
|
ICONNAME_SNAPSHOT,
|
||||||
|
|
||||||
|
ICONNAME_BODYPART_SHAPE,
|
||||||
|
ICONNAME_BODYPART_SKIN,
|
||||||
|
ICONNAME_BODYPART_HAIR,
|
||||||
|
ICONNAME_BODYPART_EYES,
|
||||||
|
ICONNAME_CLOTHING_SHIRT,
|
||||||
|
ICONNAME_CLOTHING_PANTS,
|
||||||
|
ICONNAME_CLOTHING_SHOES,
|
||||||
|
ICONNAME_CLOTHING_SOCKS,
|
||||||
|
ICONNAME_CLOTHING_JACKET,
|
||||||
|
ICONNAME_CLOTHING_GLOVES,
|
||||||
|
ICONNAME_CLOTHING_UNDERSHIRT,
|
||||||
|
ICONNAME_CLOTHING_UNDERPANTS,
|
||||||
|
ICONNAME_CLOTHING_SKIRT,
|
||||||
|
ICONNAME_CLOTHING_ALPHA,
|
||||||
|
ICONNAME_CLOTHING_TATTOO,
|
||||||
|
|
||||||
|
ICONNAME_ANIMATION,
|
||||||
|
ICONNAME_GESTURE,
|
||||||
|
|
||||||
|
ICONNAME_CLOTHING_PHYSICS,
|
||||||
|
|
||||||
|
ICONNAME_LINKITEM,
|
||||||
|
ICONNAME_LINKFOLDER,
|
||||||
|
ICONNAME_MESH,
|
||||||
|
|
||||||
|
ICONNAME_INVALID,
|
||||||
|
ICONNAME_COUNT,
|
||||||
|
ICONNAME_NONE = -1
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// machine transation between type and strings
|
// machine transation between type and strings
|
||||||
static EType lookup(const std::string& name);
|
static EType lookup(const std::string& name);
|
||||||
static const std::string &lookup(EType type);
|
static const std::string &lookup(EType type);
|
||||||
|
|||||||
@@ -3,31 +3,25 @@
|
|||||||
* @author Phoenix
|
* @author Phoenix
|
||||||
* @brief Permissions for objects and inventory.
|
* @brief Permissions for objects and inventory.
|
||||||
*
|
*
|
||||||
* $LicenseInfo:firstyear=2002&license=viewergpl$
|
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
|
||||||
*
|
|
||||||
* Copyright (c) 2002-2009, Linden Research, Inc.
|
|
||||||
*
|
|
||||||
* Second Life Viewer Source Code
|
* Second Life Viewer Source Code
|
||||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
* Copyright (C) 2010, Linden Research, Inc.
|
||||||
* 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://secondlifegrid.net/programs/open_source/licensing/gplv2
|
|
||||||
*
|
*
|
||||||
* There are special exceptions to the terms and conditions of the GPL as
|
* This library is free software; you can redistribute it and/or
|
||||||
* it is applied to this Source Code. View the full text of the exception
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
* License as published by the Free Software Foundation;
|
||||||
* online at
|
* version 2.1 of the License only.
|
||||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
|
||||||
*
|
*
|
||||||
* By copying, modifying or distributing this software, you acknowledge
|
* This library is distributed in the hope that it will be useful,
|
||||||
* that you have read and understood your obligations described above,
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* and agree to abide by those obligations.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
* License along with this library; if not, write to the Free Software
|
||||||
* COMPLETENESS OR PERFORMANCE.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
* $/LicenseInfo$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -578,143 +572,17 @@ void LLPermissions::unpackMessage(LLMessageSystem* msg, const char* block, S32 b
|
|||||||
|
|
||||||
BOOL LLPermissions::importFile(LLFILE* fp)
|
BOOL LLPermissions::importFile(LLFILE* fp)
|
||||||
{
|
{
|
||||||
init(LLUUID::null, LLUUID::null, LLUUID::null, LLUUID::null);
|
llifstream ifs(fp);
|
||||||
const S32 BUFSIZE = 16384;
|
return importStream(ifs);
|
||||||
|
|
||||||
// *NOTE: Changing the buffer size will require changing the scanf
|
|
||||||
// calls below.
|
|
||||||
char buffer[BUFSIZE]; /* Flawfinder: ignore */
|
|
||||||
char keyword[256]; /* Flawfinder: ignore */
|
|
||||||
char valuestr[256]; /* Flawfinder: ignore */
|
|
||||||
char uuid_str[256]; /* Flawfinder: ignore */
|
|
||||||
U32 mask;
|
|
||||||
|
|
||||||
keyword[0] = '\0';
|
|
||||||
valuestr[0] = '\0';
|
|
||||||
|
|
||||||
while (!feof(fp))
|
|
||||||
{
|
|
||||||
if (fgets(buffer, BUFSIZE, fp) == NULL)
|
|
||||||
{
|
|
||||||
buffer[0] = '\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sscanf( /* Flawfinder: ignore */
|
|
||||||
buffer,
|
|
||||||
" %255s %255s",
|
|
||||||
keyword, valuestr);
|
|
||||||
if (!strcmp("{", keyword))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (!strcmp("}",keyword))
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if (!strcmp("creator_mask", keyword))
|
|
||||||
{
|
|
||||||
// legacy support for "creator" masks
|
|
||||||
sscanf(valuestr, "%x", &mask);
|
|
||||||
mMaskBase = mask;
|
|
||||||
fixFairUse();
|
|
||||||
}
|
|
||||||
else if (!strcmp("base_mask", keyword))
|
|
||||||
{
|
|
||||||
sscanf(valuestr, "%x", &mask);
|
|
||||||
mMaskBase = mask;
|
|
||||||
//fixFairUse();
|
|
||||||
}
|
|
||||||
else if (!strcmp("owner_mask", keyword))
|
|
||||||
{
|
|
||||||
sscanf(valuestr, "%x", &mask);
|
|
||||||
mMaskOwner = mask;
|
|
||||||
}
|
|
||||||
else if (!strcmp("group_mask", keyword))
|
|
||||||
{
|
|
||||||
sscanf(valuestr, "%x", &mask);
|
|
||||||
mMaskGroup = mask;
|
|
||||||
}
|
|
||||||
else if (!strcmp("everyone_mask", keyword))
|
|
||||||
{
|
|
||||||
sscanf(valuestr, "%x", &mask);
|
|
||||||
mMaskEveryone = mask;
|
|
||||||
}
|
|
||||||
else if (!strcmp("next_owner_mask", keyword))
|
|
||||||
{
|
|
||||||
sscanf(valuestr, "%x", &mask);
|
|
||||||
mMaskNextOwner = mask;
|
|
||||||
}
|
|
||||||
else if (!strcmp("creator_id", keyword))
|
|
||||||
{
|
|
||||||
sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */
|
|
||||||
mCreator.set(uuid_str);
|
|
||||||
}
|
|
||||||
else if (!strcmp("owner_id", keyword))
|
|
||||||
{
|
|
||||||
sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */
|
|
||||||
mOwner.set(uuid_str);
|
|
||||||
}
|
|
||||||
else if (!strcmp("last_owner_id", keyword))
|
|
||||||
{
|
|
||||||
sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */
|
|
||||||
mLastOwner.set(uuid_str);
|
|
||||||
}
|
|
||||||
else if (!strcmp("group_id", keyword))
|
|
||||||
{
|
|
||||||
sscanf(valuestr, "%255s", uuid_str); /* Flawfinder: ignore */
|
|
||||||
mGroup.set(uuid_str);
|
|
||||||
}
|
|
||||||
else if (!strcmp("group_owned", keyword))
|
|
||||||
{
|
|
||||||
sscanf(valuestr, "%d", &mask);
|
|
||||||
if(mask) mIsGroupOwned = true;
|
|
||||||
else mIsGroupOwned = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
llinfos << "unknown keyword " << keyword << " in permissions import" << llendl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fix();
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BOOL LLPermissions::exportFile(LLFILE* fp) const
|
BOOL LLPermissions::exportFile(LLFILE* fp) const
|
||||||
{
|
{
|
||||||
std::string uuid_str;
|
llofstream ofs(fp);
|
||||||
|
return exportStream(ofs);
|
||||||
fprintf(fp, "\tpermissions 0\n");
|
|
||||||
fprintf(fp, "\t{\n");
|
|
||||||
|
|
||||||
fprintf(fp, "\t\tbase_mask\t%08x\n", mMaskBase);
|
|
||||||
fprintf(fp, "\t\towner_mask\t%08x\n", mMaskOwner);
|
|
||||||
fprintf(fp, "\t\tgroup_mask\t%08x\n", mMaskGroup);
|
|
||||||
fprintf(fp, "\t\teveryone_mask\t%08x\n", mMaskEveryone);
|
|
||||||
fprintf(fp, "\t\tnext_owner_mask\t%08x\n", mMaskNextOwner);
|
|
||||||
|
|
||||||
mCreator.toString(uuid_str);
|
|
||||||
fprintf(fp, "\t\tcreator_id\t%s\n", uuid_str.c_str());
|
|
||||||
|
|
||||||
mOwner.toString(uuid_str);
|
|
||||||
fprintf(fp, "\t\towner_id\t%s\n", uuid_str.c_str());
|
|
||||||
|
|
||||||
mLastOwner.toString(uuid_str);
|
|
||||||
fprintf(fp, "\t\tlast_owner_id\t%s\n", uuid_str.c_str());
|
|
||||||
|
|
||||||
mGroup.toString(uuid_str);
|
|
||||||
fprintf(fp, "\t\tgroup_id\t%s\n", uuid_str.c_str());
|
|
||||||
|
|
||||||
if(mIsGroupOwned)
|
|
||||||
{
|
|
||||||
fprintf(fp, "\t\tgroup_owned\t1\n");
|
|
||||||
}
|
|
||||||
fprintf(fp,"\t}\n");
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL LLPermissions::importStream(std::istream& input_stream)
|
||||||
BOOL LLPermissions::importLegacyStream(std::istream& input_stream)
|
|
||||||
{
|
{
|
||||||
init(LLUUID::null, LLUUID::null, LLUUID::null, LLUUID::null);
|
init(LLUUID::null, LLUUID::null, LLUUID::null, LLUUID::null);
|
||||||
const S32 BUFSIZE = 16384;
|
const S32 BUFSIZE = 16384;
|
||||||
@@ -733,6 +601,18 @@ BOOL LLPermissions::importLegacyStream(std::istream& input_stream)
|
|||||||
while (input_stream.good())
|
while (input_stream.good())
|
||||||
{
|
{
|
||||||
input_stream.getline(buffer, BUFSIZE);
|
input_stream.getline(buffer, BUFSIZE);
|
||||||
|
if (input_stream.eof())
|
||||||
|
{
|
||||||
|
llwarns << "Bad permissions: early end of input stream"
|
||||||
|
<< llendl;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if (input_stream.fail())
|
||||||
|
{
|
||||||
|
llwarns << "Bad permissions: failed to read from input stream"
|
||||||
|
<< llendl;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
sscanf( /* Flawfinder: ignore */
|
sscanf( /* Flawfinder: ignore */
|
||||||
buffer,
|
buffer,
|
||||||
" %255s %255s",
|
" %255s %255s",
|
||||||
@@ -806,7 +686,8 @@ BOOL LLPermissions::importLegacyStream(std::istream& input_stream)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
llinfos << "unknown keyword " << keyword << " in permissions import" << llendl;
|
llwarns << "unknown keyword " << keyword
|
||||||
|
<< " in permissions import" << llendl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fix();
|
fix();
|
||||||
@@ -814,36 +695,26 @@ BOOL LLPermissions::importLegacyStream(std::istream& input_stream)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL LLPermissions::exportLegacyStream(std::ostream& output_stream) const
|
BOOL LLPermissions::exportStream(std::ostream& output_stream) const
|
||||||
{
|
{
|
||||||
std::string uuid_str;
|
if (!output_stream.good()) return FALSE;
|
||||||
|
|
||||||
output_stream << "\tpermissions 0\n";
|
output_stream << "\tpermissions 0\n";
|
||||||
output_stream << "\t{\n";
|
output_stream << "\t{\n";
|
||||||
|
|
||||||
std::string buffer;
|
char prev_fill = output_stream.fill('0');
|
||||||
buffer = llformat( "\t\tbase_mask\t%08x\n", mMaskBase);
|
output_stream << std::hex;
|
||||||
output_stream << buffer;
|
output_stream << "\t\tbase_mask\t" << std::setw(8) << mMaskBase << "\n";
|
||||||
buffer = llformat( "\t\towner_mask\t%08x\n", mMaskOwner);
|
output_stream << "\t\towner_mask\t" << std::setw(8) << mMaskOwner << "\n";
|
||||||
output_stream << buffer;
|
output_stream << "\t\tgroup_mask\t" << std::setw(8) << mMaskGroup << "\n";
|
||||||
buffer = llformat( "\t\tgroup_mask\t%08x\n", mMaskGroup);
|
output_stream << "\t\teveryone_mask\t" << std::setw(8) << mMaskEveryone << "\n";
|
||||||
output_stream << buffer;
|
output_stream << "\t\tnext_owner_mask\t" << std::setw(8) << mMaskNextOwner << "\n";
|
||||||
buffer = llformat( "\t\teveryone_mask\t%08x\n", mMaskEveryone);
|
output_stream << std::dec;
|
||||||
output_stream << buffer;
|
output_stream.fill(prev_fill);
|
||||||
buffer = llformat( "\t\tnext_owner_mask\t%08x\n", mMaskNextOwner);
|
|
||||||
output_stream << buffer;
|
|
||||||
|
|
||||||
mCreator.toString(uuid_str);
|
output_stream << "\t\tcreator_id\t" << mCreator << "\n";
|
||||||
output_stream << "\t\tcreator_id\t" << uuid_str << "\n";
|
output_stream << "\t\towner_id\t" << mOwner << "\n";
|
||||||
|
output_stream << "\t\tlast_owner_id\t" << mLastOwner << "\n";
|
||||||
mOwner.toString(uuid_str);
|
output_stream << "\t\tgroup_id\t" << mGroup << "\n";
|
||||||
output_stream << "\t\towner_id\t" << uuid_str << "\n";
|
|
||||||
|
|
||||||
mLastOwner.toString(uuid_str);
|
|
||||||
output_stream << "\t\tlast_owner_id\t" << uuid_str << "\n";
|
|
||||||
|
|
||||||
mGroup.toString(uuid_str);
|
|
||||||
output_stream << "\t\tgroup_id\t" << uuid_str << "\n";
|
|
||||||
|
|
||||||
if(mIsGroupOwned)
|
if(mIsGroupOwned)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,31 +2,25 @@
|
|||||||
* @file llpermissions.h
|
* @file llpermissions.h
|
||||||
* @brief Permissions structures for objects.
|
* @brief Permissions structures for objects.
|
||||||
*
|
*
|
||||||
* $LicenseInfo:firstyear=2002&license=viewergpl$
|
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
|
||||||
*
|
|
||||||
* Copyright (c) 2002-2009, Linden Research, Inc.
|
|
||||||
*
|
|
||||||
* Second Life Viewer Source Code
|
* Second Life Viewer Source Code
|
||||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
* Copyright (C) 2010, Linden Research, Inc.
|
||||||
* 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://secondlifegrid.net/programs/open_source/licensing/gplv2
|
|
||||||
*
|
*
|
||||||
* There are special exceptions to the terms and conditions of the GPL as
|
* This library is free software; you can redistribute it and/or
|
||||||
* it is applied to this Source Code. View the full text of the exception
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
* License as published by the Free Software Foundation;
|
||||||
* online at
|
* version 2.1 of the License only.
|
||||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
|
||||||
*
|
*
|
||||||
* By copying, modifying or distributing this software, you acknowledge
|
* This library is distributed in the hope that it will be useful,
|
||||||
* that you have read and understood your obligations described above,
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* and agree to abide by those obligations.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
* License along with this library; if not, write to the Free Software
|
||||||
* COMPLETENESS OR PERFORMANCE.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
* $/LicenseInfo$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -322,8 +316,8 @@ public:
|
|||||||
BOOL importFile(LLFILE* fp);
|
BOOL importFile(LLFILE* fp);
|
||||||
BOOL exportFile(LLFILE* fp) const;
|
BOOL exportFile(LLFILE* fp) const;
|
||||||
|
|
||||||
BOOL importLegacyStream(std::istream& input_stream);
|
BOOL importStream(std::istream& input_stream);
|
||||||
BOOL exportLegacyStream(std::ostream& output_stream) const;
|
BOOL exportStream(std::ostream& output_stream) const;
|
||||||
|
|
||||||
bool operator==(const LLPermissions &rhs) const;
|
bool operator==(const LLPermissions &rhs) const;
|
||||||
bool operator!=(const LLPermissions &rhs) const;
|
bool operator!=(const LLPermissions &rhs) const;
|
||||||
|
|||||||
@@ -87,15 +87,13 @@ U32 LLSaleInfo::getCRC32() const
|
|||||||
|
|
||||||
BOOL LLSaleInfo::exportFile(LLFILE* fp) const
|
BOOL LLSaleInfo::exportFile(LLFILE* fp) const
|
||||||
{
|
{
|
||||||
fprintf(fp, "\tsale_info\t0\n\t{\n");
|
llofstream ofs(fp);
|
||||||
fprintf(fp, "\t\tsale_type\t%s\n", lookup(mSaleType));
|
return exportStream(ofs);
|
||||||
fprintf(fp, "\t\tsale_price\t%d\n", mSalePrice);
|
|
||||||
fprintf(fp,"\t}\n");
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL LLSaleInfo::exportLegacyStream(std::ostream& output_stream) const
|
BOOL LLSaleInfo::exportStream(std::ostream& output_stream) const
|
||||||
{
|
{
|
||||||
|
if (!output_stream.good()) return FALSE;
|
||||||
output_stream << "\tsale_info\t0\n\t{\n";
|
output_stream << "\tsale_info\t0\n\t{\n";
|
||||||
output_stream << "\t\tsale_type\t" << lookup(mSaleType) << "\n";
|
output_stream << "\t\tsale_type\t" << lookup(mSaleType) << "\n";
|
||||||
output_stream << "\t\tsale_price\t" << mSalePrice << "\n";
|
output_stream << "\t\tsale_price\t" << mSalePrice << "\n";
|
||||||
@@ -140,80 +138,39 @@ bool LLSaleInfo::fromLLSD(const LLSD& sd, BOOL& has_perm_mask, U32& perm_mask)
|
|||||||
|
|
||||||
BOOL LLSaleInfo::importFile(LLFILE* fp, BOOL& has_perm_mask, U32& perm_mask)
|
BOOL LLSaleInfo::importFile(LLFILE* fp, BOOL& has_perm_mask, U32& perm_mask)
|
||||||
{
|
{
|
||||||
has_perm_mask = FALSE;
|
llifstream ifs(fp);
|
||||||
|
return importStream(ifs, has_perm_mask, perm_mask);
|
||||||
// *NOTE: Changing the buffer size will require changing the scanf
|
|
||||||
// calls below.
|
|
||||||
char buffer[MAX_STRING]; /* Flawfinder: ignore */
|
|
||||||
char keyword[MAX_STRING]; /* Flawfinder: ignore */
|
|
||||||
char valuestr[MAX_STRING]; /* Flawfinder: ignore */
|
|
||||||
BOOL success = TRUE;
|
|
||||||
|
|
||||||
keyword[0] = '\0';
|
|
||||||
valuestr[0] = '\0';
|
|
||||||
while(success && (!feof(fp)))
|
|
||||||
{
|
|
||||||
if (fgets(buffer, MAX_STRING, fp) == NULL)
|
|
||||||
{
|
|
||||||
buffer[0] = '\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sscanf( /* Flawfinder: ignore */
|
BOOL LLSaleInfo::importStream(std::istream& input_stream, BOOL& has_perm_mask, U32& perm_mask)
|
||||||
buffer,
|
|
||||||
" %254s %254s",
|
|
||||||
keyword, valuestr);
|
|
||||||
if(!keyword[0])
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if(0 == strcmp("{",keyword))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if(0 == strcmp("}", keyword))
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if(0 == strcmp("sale_type", keyword))
|
|
||||||
{
|
|
||||||
mSaleType = lookup(valuestr);
|
|
||||||
}
|
|
||||||
else if(0 == strcmp("sale_price", keyword))
|
|
||||||
{
|
|
||||||
sscanf(valuestr, "%d", &mSalePrice);
|
|
||||||
mSalePrice = llclamp(mSalePrice, 0, S32_MAX);
|
|
||||||
}
|
|
||||||
else if (!strcmp("perm_mask", keyword))
|
|
||||||
{
|
|
||||||
//llinfos << "found deprecated keyword perm_mask" << llendl;
|
|
||||||
has_perm_mask = TRUE;
|
|
||||||
sscanf(valuestr, "%x", &perm_mask);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
llwarns << "unknown keyword '" << keyword
|
|
||||||
<< "' in sale info import" << llendl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL LLSaleInfo::importLegacyStream(std::istream& input_stream, BOOL& has_perm_mask, U32& perm_mask)
|
|
||||||
{
|
{
|
||||||
has_perm_mask = FALSE;
|
has_perm_mask = FALSE;
|
||||||
|
|
||||||
|
const S32 BUFSIZE = 16384;
|
||||||
|
|
||||||
// *NOTE: Changing the buffer size will require changing the scanf
|
// *NOTE: Changing the buffer size will require changing the scanf
|
||||||
// calls below.
|
// calls below.
|
||||||
char buffer[MAX_STRING]; /* Flawfinder: ignore */
|
char buffer[BUFSIZE]; /* Flawfinder: ignore */
|
||||||
char keyword[MAX_STRING]; /* Flawfinder: ignore */
|
char keyword[255]; /* Flawfinder: ignore */
|
||||||
char valuestr[MAX_STRING]; /* Flawfinder: ignore */
|
char valuestr[255]; /* Flawfinder: ignore */
|
||||||
BOOL success = TRUE;
|
|
||||||
|
|
||||||
keyword[0] = '\0';
|
keyword[0] = '\0';
|
||||||
valuestr[0] = '\0';
|
valuestr[0] = '\0';
|
||||||
while(success && input_stream.good())
|
while(input_stream.good())
|
||||||
{
|
{
|
||||||
input_stream.getline(buffer, MAX_STRING);
|
input_stream.getline(buffer, MAX_STRING);
|
||||||
|
if (input_stream.eof())
|
||||||
|
{
|
||||||
|
llwarns << "Bad sale info: early end of input stream"
|
||||||
|
<< llendl;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if (input_stream.fail())
|
||||||
|
{
|
||||||
|
llwarns << "Bad sale info: failed to read from input stream"
|
||||||
|
<< llendl;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
sscanf( /* Flawfinder: ignore */
|
sscanf( /* Flawfinder: ignore */
|
||||||
buffer,
|
buffer,
|
||||||
" %254s %254s",
|
" %254s %254s",
|
||||||
@@ -251,7 +208,7 @@ BOOL LLSaleInfo::importLegacyStream(std::istream& input_stream, BOOL& has_perm_m
|
|||||||
<< "' in sale info import" << llendl;
|
<< "' in sale info import" << llendl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return success;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLSaleInfo::setSalePrice(S32 price)
|
void LLSaleInfo::setSalePrice(S32 price)
|
||||||
|
|||||||
@@ -95,11 +95,11 @@ public:
|
|||||||
BOOL exportFile(LLFILE* fp) const;
|
BOOL exportFile(LLFILE* fp) const;
|
||||||
BOOL importFile(LLFILE* fp, BOOL& has_perm_mask, U32& perm_mask);
|
BOOL importFile(LLFILE* fp, BOOL& has_perm_mask, U32& perm_mask);
|
||||||
|
|
||||||
BOOL exportLegacyStream(std::ostream& output_stream) const;
|
BOOL exportStream(std::ostream& output_stream) const;
|
||||||
LLSD asLLSD() const;
|
LLSD asLLSD() const;
|
||||||
operator LLSD() const { return asLLSD(); }
|
operator LLSD() const { return asLLSD(); }
|
||||||
bool fromLLSD(const LLSD& sd, BOOL& has_perm_mask, U32& perm_mask);
|
bool fromLLSD(const LLSD& sd, BOOL& has_perm_mask, U32& perm_mask);
|
||||||
BOOL importLegacyStream(std::istream& input_stream, BOOL& has_perm_mask, U32& perm_mask);
|
BOOL importStream(std::istream& input_stream, BOOL& has_perm_mask, U32& perm_mask);
|
||||||
|
|
||||||
LLSD packMessage() const;
|
LLSD packMessage() const;
|
||||||
void unpackMessage(LLSD sales);
|
void unpackMessage(LLSD sales);
|
||||||
|
|||||||
@@ -1233,94 +1233,77 @@ BOOL LLPrimitive::packTEMessage(LLDataPacker &dp) const
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
S32 LLPrimitive::unpackTEMessage(LLMessageSystem* mesgsys, char const* block_name)
|
S32 LLPrimitive::parseTEMessage(LLMessageSystem* mesgsys, char const* block_name, const S32 block_num, LLTEContents& tec)
|
||||||
{
|
{
|
||||||
return(unpackTEMessage(mesgsys,block_name,-1));
|
|
||||||
}
|
|
||||||
|
|
||||||
S32 LLPrimitive::unpackTEMessage(LLMessageSystem* mesgsys, char const* block_name, const S32 block_num)
|
|
||||||
{
|
|
||||||
// use a negative block_num to indicate a single-block read (a non-variable block)
|
|
||||||
S32 retval = 0;
|
S32 retval = 0;
|
||||||
const U32 MAX_TES = 32;
|
|
||||||
|
|
||||||
// Avoid construction of 32 UUIDs per call. JC
|
|
||||||
|
|
||||||
U8 image_data[MAX_TES*16];
|
|
||||||
U8 colors[MAX_TES*4];
|
|
||||||
F32 scale_s[MAX_TES];
|
|
||||||
F32 scale_t[MAX_TES];
|
|
||||||
S16 offset_s[MAX_TES];
|
|
||||||
S16 offset_t[MAX_TES];
|
|
||||||
S16 image_rot[MAX_TES];
|
|
||||||
U8 bump[MAX_TES];
|
|
||||||
U8 media_flags[MAX_TES];
|
|
||||||
U8 glow[MAX_TES];
|
|
||||||
|
|
||||||
const U32 MAX_TE_BUFFER = 4096;
|
|
||||||
U8 packed_buffer[MAX_TE_BUFFER];
|
|
||||||
U8 *cur_ptr = packed_buffer;
|
|
||||||
|
|
||||||
U32 size;
|
|
||||||
U32 face_count = 0;
|
|
||||||
|
|
||||||
if (block_num < 0)
|
if (block_num < 0)
|
||||||
{
|
{
|
||||||
size = mesgsys->getSizeFast(block_name, _PREHASH_TextureEntry);
|
tec.size = mesgsys->getSizeFast(block_name, _PREHASH_TextureEntry);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size = mesgsys->getSizeFast(block_name, block_num, _PREHASH_TextureEntry);
|
tec.size = mesgsys->getSizeFast(block_name, block_num, _PREHASH_TextureEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (size == 0)
|
if (tec.size == 0)
|
||||||
{
|
{
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (block_num < 0)
|
if (block_num < 0)
|
||||||
{
|
{
|
||||||
mesgsys->getBinaryDataFast(block_name, _PREHASH_TextureEntry, packed_buffer, 0, 0, MAX_TE_BUFFER);
|
mesgsys->getBinaryDataFast(block_name, _PREHASH_TextureEntry, tec.packed_buffer, 0, 0, LLTEContents::MAX_TE_BUFFER);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mesgsys->getBinaryDataFast(block_name, _PREHASH_TextureEntry, packed_buffer, 0, block_num, MAX_TE_BUFFER);
|
mesgsys->getBinaryDataFast(block_name, _PREHASH_TextureEntry, tec.packed_buffer, 0, block_num, LLTEContents::MAX_TE_BUFFER);
|
||||||
}
|
}
|
||||||
|
|
||||||
face_count = getNumTEs();
|
tec.face_count = getNumTEs();
|
||||||
|
|
||||||
cur_ptr += unpackTEField(cur_ptr, packed_buffer+size, (U8 *)image_data, 16, face_count, MVT_LLUUID);
|
U8 *cur_ptr = tec.packed_buffer;
|
||||||
|
cur_ptr += unpackTEField(cur_ptr, tec.packed_buffer+tec.size, (U8 *)tec.image_data, 16, tec.face_count, MVT_LLUUID);
|
||||||
cur_ptr++;
|
cur_ptr++;
|
||||||
cur_ptr += unpackTEField(cur_ptr, packed_buffer+size, (U8 *)colors, 4, face_count, MVT_U8);
|
cur_ptr += unpackTEField(cur_ptr, tec.packed_buffer+tec.size, (U8 *)tec.colors, 4, tec.face_count, MVT_U8);
|
||||||
cur_ptr++;
|
cur_ptr++;
|
||||||
cur_ptr += unpackTEField(cur_ptr, packed_buffer+size, (U8 *)scale_s, 4, face_count, MVT_F32);
|
cur_ptr += unpackTEField(cur_ptr, tec.packed_buffer+tec.size, (U8 *)tec.scale_s, 4, tec.face_count, MVT_F32);
|
||||||
cur_ptr++;
|
cur_ptr++;
|
||||||
cur_ptr += unpackTEField(cur_ptr, packed_buffer+size, (U8 *)scale_t, 4, face_count, MVT_F32);
|
cur_ptr += unpackTEField(cur_ptr, tec.packed_buffer+tec.size, (U8 *)tec.scale_t, 4, tec.face_count, MVT_F32);
|
||||||
cur_ptr++;
|
cur_ptr++;
|
||||||
cur_ptr += unpackTEField(cur_ptr, packed_buffer+size, (U8 *)offset_s, 2, face_count, MVT_S16Array);
|
cur_ptr += unpackTEField(cur_ptr, tec.packed_buffer+tec.size, (U8 *)tec.offset_s, 2, tec.face_count, MVT_S16Array);
|
||||||
cur_ptr++;
|
cur_ptr++;
|
||||||
cur_ptr += unpackTEField(cur_ptr, packed_buffer+size, (U8 *)offset_t, 2, face_count, MVT_S16Array);
|
cur_ptr += unpackTEField(cur_ptr, tec.packed_buffer+tec.size, (U8 *)tec.offset_t, 2, tec.face_count, MVT_S16Array);
|
||||||
cur_ptr++;
|
cur_ptr++;
|
||||||
cur_ptr += unpackTEField(cur_ptr, packed_buffer+size, (U8 *)image_rot, 2, face_count, MVT_S16Array);
|
cur_ptr += unpackTEField(cur_ptr, tec.packed_buffer+tec.size, (U8 *)tec.image_rot, 2, tec.face_count, MVT_S16Array);
|
||||||
cur_ptr++;
|
cur_ptr++;
|
||||||
cur_ptr += unpackTEField(cur_ptr, packed_buffer+size, (U8 *)bump, 1, face_count, MVT_U8);
|
cur_ptr += unpackTEField(cur_ptr, tec.packed_buffer+tec.size, (U8 *)tec.bump, 1, tec.face_count, MVT_U8);
|
||||||
cur_ptr++;
|
cur_ptr++;
|
||||||
cur_ptr += unpackTEField(cur_ptr, packed_buffer+size, (U8 *)media_flags, 1, face_count, MVT_U8);
|
cur_ptr += unpackTEField(cur_ptr, tec.packed_buffer+tec.size, (U8 *)tec.media_flags, 1, tec.face_count, MVT_U8);
|
||||||
cur_ptr++;
|
cur_ptr++;
|
||||||
cur_ptr += unpackTEField(cur_ptr, packed_buffer+size, (U8 *)glow, 1, face_count, MVT_U8);
|
cur_ptr += unpackTEField(cur_ptr, tec.packed_buffer+tec.size, (U8 *)tec.glow, 1, tec.face_count, MVT_U8);
|
||||||
|
|
||||||
|
retval = 1;
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
|
S32 LLPrimitive::applyParsedTEMessage(LLTEContents& tec)
|
||||||
|
{
|
||||||
|
S32 retval = 0;
|
||||||
|
|
||||||
LLColor4 color;
|
LLColor4 color;
|
||||||
LLColor4U coloru;
|
LLColor4U coloru;
|
||||||
for (U32 i = 0; i < face_count; i++)
|
for (U32 i = 0; i < tec.face_count; i++)
|
||||||
{
|
{
|
||||||
retval |= setTETexture(i, ((LLUUID*)image_data)[i]);
|
LLUUID& req_id = ((LLUUID*)tec.image_data)[i];
|
||||||
retval |= setTEScale(i, scale_s[i], scale_t[i]);
|
retval |= setTETexture(i, req_id);
|
||||||
retval |= setTEOffset(i, (F32)offset_s[i] / (F32)0x7FFF, (F32) offset_t[i] / (F32) 0x7FFF);
|
retval |= setTEScale(i, tec.scale_s[i], tec.scale_t[i]);
|
||||||
retval |= setTERotation(i, ((F32)image_rot[i] / TEXTURE_ROTATION_PACK_FACTOR) * F_TWO_PI);
|
retval |= setTEOffset(i, (F32)tec.offset_s[i] / (F32)0x7FFF, (F32) tec.offset_t[i] / (F32) 0x7FFF);
|
||||||
retval |= setTEBumpShinyFullbright(i, bump[i]);
|
retval |= setTERotation(i, ((F32)tec.image_rot[i] / TEXTURE_ROTATION_PACK_FACTOR) * F_TWO_PI);
|
||||||
retval |= setTEMediaTexGen(i, media_flags[i]);
|
retval |= setTEBumpShinyFullbright(i, tec.bump[i]);
|
||||||
retval |= setTEGlow(i, (F32)glow[i] / (F32)0xFF);
|
retval |= setTEMediaTexGen(i, tec.media_flags[i]);
|
||||||
coloru = LLColor4U(colors + 4*i);
|
retval |= setTEGlow(i, (F32)tec.glow[i] / (F32)0xFF);
|
||||||
|
coloru = LLColor4U(tec.colors + 4*i);
|
||||||
|
|
||||||
// Note: This is an optimization to send common colors (1.f, 1.f, 1.f, 1.f)
|
// Note: This is an optimization to send common colors (1.f, 1.f, 1.f, 1.f)
|
||||||
// as all zeros. However, the subtraction and addition must be done in unsigned
|
// as all zeros. However, the subtraction and addition must be done in unsigned
|
||||||
@@ -1337,6 +1320,15 @@ S32 LLPrimitive::unpackTEMessage(LLMessageSystem* mesgsys, char const* block_nam
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
S32 LLPrimitive::unpackTEMessage(LLMessageSystem* mesgsys, char const* block_name, const S32 block_num)
|
||||||
|
{
|
||||||
|
LLTEContents tec;
|
||||||
|
S32 retval = parseTEMessage(mesgsys, block_name, block_num, tec);
|
||||||
|
if (!retval)
|
||||||
|
return retval;
|
||||||
|
return applyParsedTEMessage(tec);
|
||||||
|
}
|
||||||
|
|
||||||
S32 LLPrimitive::unpackTEMessage(LLDataPacker &dp)
|
S32 LLPrimitive::unpackTEMessage(LLDataPacker &dp)
|
||||||
{
|
{
|
||||||
// use a negative block_num to indicate a single-block read (a non-variable block)
|
// use a negative block_num to indicate a single-block read (a non-variable block)
|
||||||
|
|||||||
@@ -295,6 +295,34 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// This code is not naming-standards compliant. Leaving it like this for
|
||||||
|
// now to make the connection to code in
|
||||||
|
// BOOL packTEMessage(LLDataPacker &dp) const;
|
||||||
|
// more obvious. This should be refactored to remove the duplication, at which
|
||||||
|
// point we can fix the names as well.
|
||||||
|
// - Vir
|
||||||
|
struct LLTEContents
|
||||||
|
{
|
||||||
|
static const U32 MAX_TES = 32;
|
||||||
|
|
||||||
|
U8 image_data[MAX_TES*16];
|
||||||
|
U8 colors[MAX_TES*4];
|
||||||
|
F32 scale_s[MAX_TES];
|
||||||
|
F32 scale_t[MAX_TES];
|
||||||
|
S16 offset_s[MAX_TES];
|
||||||
|
S16 offset_t[MAX_TES];
|
||||||
|
S16 image_rot[MAX_TES];
|
||||||
|
U8 bump[MAX_TES];
|
||||||
|
U8 media_flags[MAX_TES];
|
||||||
|
U8 glow[MAX_TES];
|
||||||
|
|
||||||
|
static const U32 MAX_TE_BUFFER = 4096;
|
||||||
|
U8 packed_buffer[MAX_TE_BUFFER];
|
||||||
|
|
||||||
|
U32 size;
|
||||||
|
U32 face_count;
|
||||||
|
};
|
||||||
|
|
||||||
class LLPrimitive : public LLXform
|
class LLPrimitive : public LLXform
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -366,9 +394,10 @@ public:
|
|||||||
S32 unpackTEField(U8 *cur_ptr, U8 *buffer_end, U8 *data_ptr, U8 data_size, U8 face_count, EMsgVariableType type);
|
S32 unpackTEField(U8 *cur_ptr, U8 *buffer_end, U8 *data_ptr, U8 data_size, U8 face_count, EMsgVariableType type);
|
||||||
BOOL packTEMessage(LLMessageSystem *mesgsys) const;
|
BOOL packTEMessage(LLMessageSystem *mesgsys) const;
|
||||||
BOOL packTEMessage(LLDataPacker &dp) const;
|
BOOL packTEMessage(LLDataPacker &dp) const;
|
||||||
S32 unpackTEMessage(LLMessageSystem* mesgsys, char const* block_name);
|
|
||||||
S32 unpackTEMessage(LLMessageSystem* mesgsys, char const* block_name, const S32 block_num); // Variable num of blocks
|
S32 unpackTEMessage(LLMessageSystem* mesgsys, char const* block_name, const S32 block_num); // Variable num of blocks
|
||||||
BOOL unpackTEMessage(LLDataPacker &dp);
|
BOOL unpackTEMessage(LLDataPacker &dp);
|
||||||
|
S32 parseTEMessage(LLMessageSystem* mesgsys, char const* block_name, const S32 block_num, LLTEContents& tec);
|
||||||
|
S32 applyParsedTEMessage(LLTEContents& tec);
|
||||||
|
|
||||||
#ifdef CHECK_FOR_FINITE
|
#ifdef CHECK_FOR_FINITE
|
||||||
inline void setPosition(const LLVector3& pos);
|
inline void setPosition(const LLVector3& pos);
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ set(llrender_HEADER_FILES
|
|||||||
llglheaders.h
|
llglheaders.h
|
||||||
llglslshader.h
|
llglslshader.h
|
||||||
llglstates.h
|
llglstates.h
|
||||||
|
llgltexture.h
|
||||||
llgltypes.h
|
llgltypes.h
|
||||||
llimagegl.h
|
llimagegl.h
|
||||||
llpostprocess.h
|
llpostprocess.h
|
||||||
|
|||||||
@@ -166,5 +166,7 @@ public:
|
|||||||
extern LLGLSLShader gUIProgram;
|
extern LLGLSLShader gUIProgram;
|
||||||
//output vec4(color.rgb,color.a*tex0[tc0].a)
|
//output vec4(color.rgb,color.a*tex0[tc0].a)
|
||||||
extern LLGLSLShader gSolidColorProgram;
|
extern LLGLSLShader gSolidColorProgram;
|
||||||
|
//Alpha mask shader (declared here so llappearance can access properly)
|
||||||
|
extern LLGLSLShader gAlphaMaskProgram;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
182
indra/llrender/llgltexture.h
Normal file
182
indra/llrender/llgltexture.h
Normal file
@@ -0,0 +1,182 @@
|
|||||||
|
/**
|
||||||
|
* @file llglviewertexture.h
|
||||||
|
* @brief Object for managing opengl textures
|
||||||
|
*
|
||||||
|
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||||
|
* Second Life Viewer Source Code
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*
|
||||||
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
|
* $/LicenseInfo$
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef LL_GL_TEXTURE_H
|
||||||
|
#define LL_GL_TEXTURE_H
|
||||||
|
|
||||||
|
#include "lltexture.h"
|
||||||
|
#include "llgl.h"
|
||||||
|
|
||||||
|
class LLImageRaw;
|
||||||
|
|
||||||
|
//
|
||||||
|
//this the parent for the class LLViewerTexture
|
||||||
|
//through the following virtual functions, the class LLViewerTexture can be reached from /llrender.
|
||||||
|
//
|
||||||
|
class LLGLTexture : public LLTexture
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
MAX_IMAGE_SIZE_DEFAULT = 1024,
|
||||||
|
INVALID_DISCARD_LEVEL = 0x7fff
|
||||||
|
};
|
||||||
|
|
||||||
|
enum EBoostLevel
|
||||||
|
{
|
||||||
|
BOOST_NONE = 0,
|
||||||
|
BOOST_AVATAR_BAKED ,
|
||||||
|
BOOST_AVATAR ,
|
||||||
|
BOOST_CLOUDS ,
|
||||||
|
BOOST_SCULPTED ,
|
||||||
|
|
||||||
|
BOOST_HIGH = 10,
|
||||||
|
BOOST_BUMP ,
|
||||||
|
BOOST_TERRAIN , // has to be high priority for minimap / low detail
|
||||||
|
BOOST_SELECTED ,
|
||||||
|
BOOST_AVATAR_BAKED_SELF ,
|
||||||
|
BOOST_AVATAR_SELF , // needed for baking avatar
|
||||||
|
BOOST_SUPER_HIGH , //textures higher than this need to be downloaded at the required resolution without delay.
|
||||||
|
BOOST_HUD ,
|
||||||
|
BOOST_ICON ,
|
||||||
|
BOOST_UI ,
|
||||||
|
BOOST_PREVIEW ,
|
||||||
|
BOOST_MAP ,
|
||||||
|
BOOST_MAP_VISIBLE ,
|
||||||
|
BOOST_MAX_LEVEL,
|
||||||
|
|
||||||
|
//other texture Categories
|
||||||
|
LOCAL = BOOST_MAX_LEVEL,
|
||||||
|
AVATAR_SCRATCH_TEX,
|
||||||
|
DYNAMIC_TEX,
|
||||||
|
MEDIA,
|
||||||
|
//ATLAS,
|
||||||
|
OTHER,
|
||||||
|
MAX_GL_IMAGE_CATEGORY
|
||||||
|
};
|
||||||
|
|
||||||
|
//static S32 getTotalNumOfCategories() ;
|
||||||
|
//static S32 getIndexFromCategory(S32 category) ;
|
||||||
|
//static S32 getCategoryFromIndex(S32 index) ;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual ~LLGLTexture() {};
|
||||||
|
LOG_CLASS(LLGLTexture);
|
||||||
|
|
||||||
|
public:
|
||||||
|
//LLGLTexture(BOOL usemipmaps = TRUE);
|
||||||
|
//LLGLTexture(const LLImageRaw* raw, BOOL usemipmaps) ;
|
||||||
|
//LLGLTexture(const U32 width, const U32 height, const U8 components, BOOL usemipmaps) ;
|
||||||
|
|
||||||
|
virtual void dump() = 0; // debug info to llinfos
|
||||||
|
|
||||||
|
virtual const LLUUID& getID() const = 0;
|
||||||
|
|
||||||
|
virtual void setBoostLevel(S32 level) = 0;
|
||||||
|
virtual S32 getBoostLevel() = 0;
|
||||||
|
|
||||||
|
virtual S32 getFullWidth() const = 0;
|
||||||
|
virtual S32 getFullHeight() const = 0;
|
||||||
|
|
||||||
|
virtual void generateGLTexture() = 0;
|
||||||
|
virtual void destroyGLTexture() = 0;
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------
|
||||||
|
//functions to access LLImageGL
|
||||||
|
//---------------------------------------------------------------------------------------------
|
||||||
|
//*virtual*/S32 getWidth(S32 discard_level = -1) const;
|
||||||
|
//*virtual*/S32 getHeight(S32 discard_level = -1) const;
|
||||||
|
|
||||||
|
virtual BOOL hasGLTexture() const = 0;
|
||||||
|
virtual LLGLuint getTexName() const = 0;
|
||||||
|
virtual BOOL createGLTexture() = 0;
|
||||||
|
virtual BOOL createGLTexture(S32 discard_level, const LLImageRaw* imageraw, S32 usename = 0, BOOL to_create = TRUE, S32 category = LLGLTexture::OTHER) = 0;
|
||||||
|
|
||||||
|
virtual void setFilteringOption(LLTexUnit::eTextureFilterOptions option) = 0;
|
||||||
|
virtual void setExplicitFormat(LLGLint internal_format, LLGLenum primary_format, LLGLenum type_format = 0, BOOL swap_bytes = FALSE) = 0;
|
||||||
|
virtual void setAddressMode(LLTexUnit::eTextureAddressMode mode) = 0;
|
||||||
|
virtual BOOL setSubImage(const LLImageRaw* imageraw, S32 x_pos, S32 y_pos, S32 width, S32 height, bool fast_update = false) = 0;
|
||||||
|
virtual BOOL setSubImage(const U8* datap, S32 data_width, S32 data_height, S32 x_pos, S32 y_pos, S32 width, S32 height, bool fast_update = false) = 0;
|
||||||
|
virtual void setGLTextureCreated (bool initialized) = 0;
|
||||||
|
virtual void setCategory(S32 category) = 0;
|
||||||
|
|
||||||
|
virtual LLTexUnit::eTextureAddressMode getAddressMode(void) const = 0;
|
||||||
|
virtual S32 getMaxDiscardLevel() const = 0;
|
||||||
|
virtual S32 getDiscardLevel() const = 0;
|
||||||
|
virtual S8 getComponents() const = 0;
|
||||||
|
virtual BOOL getBoundRecently() const = 0;
|
||||||
|
virtual S32 getTextureMemory() const = 0;
|
||||||
|
virtual LLGLenum getPrimaryFormat() const = 0;
|
||||||
|
virtual BOOL getIsAlphaMask() const = 0;
|
||||||
|
virtual LLTexUnit::eTextureType getTarget(void) const = 0;
|
||||||
|
virtual BOOL getMask(const LLVector2 &tc) = 0;
|
||||||
|
virtual F32 getTimePassedSinceLastBound() = 0;
|
||||||
|
virtual BOOL getMissed() const = 0;
|
||||||
|
virtual BOOL isJustBound()const = 0;
|
||||||
|
virtual void forceUpdateBindStats(void) const = 0;
|
||||||
|
|
||||||
|
//virtual U32 getTexelsInAtlas() const = 0;
|
||||||
|
//virtual U32 getTexelsInGLTexture() const = 0;
|
||||||
|
//virtual BOOL isGLTextureCreated() const = 0;
|
||||||
|
//virtual S32 getDiscardLevelInAtlas() const = 0;
|
||||||
|
//---------------------------------------------------------------------------------------------
|
||||||
|
//end of functions to access LLImageGL
|
||||||
|
//---------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
//-----------------
|
||||||
|
//*virtual*/ void setActive() = 0;
|
||||||
|
virtual void forceActive() = 0;
|
||||||
|
virtual void setNoDelete() = 0;
|
||||||
|
virtual void dontDiscard() = 0;
|
||||||
|
virtual BOOL getDontDiscard() const = 0;
|
||||||
|
//-----------------
|
||||||
|
|
||||||
|
private:
|
||||||
|
virtual void cleanup() = 0;
|
||||||
|
virtual void init(bool firstinit) = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
virtual void setTexelsPerImage() = 0;
|
||||||
|
|
||||||
|
//note: do not make this function public.
|
||||||
|
//*virtual*/ LLImageGL* getGLTexture() const = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
DELETED = 0, //removed from memory
|
||||||
|
DELETION_CANDIDATE, //ready to be removed from memory
|
||||||
|
INACTIVE, //not be used for the last certain period (i.e., 30 seconds).
|
||||||
|
ACTIVE, //just being used, can become inactive if not being used for a certain time (10 seconds).
|
||||||
|
NO_DELETE = 99 //stay in memory, can not be removed.
|
||||||
|
} LLGLTextureState;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // LL_GL_TEXTURE_H
|
||||||
|
|
||||||
@@ -7,33 +7,26 @@
|
|||||||
* code, to define an interface for a multiple rendering API abstraction of the UI
|
* code, to define an interface for a multiple rendering API abstraction of the UI
|
||||||
* rendering, and to abstract out direct rendering calls in a way that is cleaner and easier to maintain.
|
* rendering, and to abstract out direct rendering calls in a way that is cleaner and easier to maintain.
|
||||||
*
|
*
|
||||||
* $LicenseInfo:firstyear=2001&license=viewergpl$
|
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||||
*
|
|
||||||
* Copyright (c) 2001-2010, Linden Research, Inc.
|
|
||||||
*
|
|
||||||
* Second Life Viewer Source Code
|
* Second Life Viewer Source Code
|
||||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
* Copyright (C) 2010, Linden Research, Inc.
|
||||||
* 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
|
|
||||||
*
|
*
|
||||||
* There are special exceptions to the terms and conditions of the GPL as
|
* This library is free software; you can redistribute it and/or
|
||||||
* it is applied to this Source Code. View the full text of the exception
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
* License as published by the Free Software Foundation;
|
||||||
* online at
|
* version 2.1 of the License only.
|
||||||
* http://secondlife.com/developers/opensource/flossexception
|
|
||||||
*
|
*
|
||||||
* By copying, modifying or distributing this software, you acknowledge
|
* This library is distributed in the hope that it will be useful,
|
||||||
* that you have read and understood your obligations described above,
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* and agree to abide by those obligations.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
* License along with this library; if not, write to the Free Software
|
||||||
* COMPLETENESS OR PERFORMANCE.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
* $/LicenseInfo$
|
* $/LicenseInfo$
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LL_TEXTURE_H
|
#ifndef LL_TEXTURE_H
|
||||||
@@ -45,10 +38,9 @@ class LLTexUnit ;
|
|||||||
class LLFontGL ;
|
class LLFontGL ;
|
||||||
|
|
||||||
//
|
//
|
||||||
//this is an abstract class as the parent for the class LLViewerTexture
|
//this is an abstract class as the parent for the class LLGLTexture
|
||||||
//through the following virtual functions, the class LLViewerTexture can be reached from /llrender.
|
|
||||||
//
|
//
|
||||||
class LLTexture : public LLRefCount
|
class LLTexture : public virtual LLRefCount
|
||||||
{
|
{
|
||||||
friend class LLTexUnit ;
|
friend class LLTexUnit ;
|
||||||
friend class LLFontGL ;
|
friend class LLFontGL ;
|
||||||
@@ -60,7 +52,7 @@ public:
|
|||||||
LLTexture(){}
|
LLTexture(){}
|
||||||
|
|
||||||
//
|
//
|
||||||
//interfaces to access LLViewerTexture
|
//interfaces to access LLGLTexture
|
||||||
//
|
//
|
||||||
virtual S8 getType() const = 0 ;
|
virtual S8 getType() const = 0 ;
|
||||||
virtual void setKnownDrawSize(S32 width, S32 height) = 0 ;
|
virtual void setKnownDrawSize(S32 width, S32 height) = 0 ;
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ include(UI)
|
|||||||
include(LLKDU)
|
include(LLKDU)
|
||||||
include(ViewerMiscLibs)
|
include(ViewerMiscLibs)
|
||||||
include(ViewerArtwork.cmake)
|
include(ViewerArtwork.cmake)
|
||||||
|
include(LLAppearance)
|
||||||
|
|
||||||
if (WINDOWS)
|
if (WINDOWS)
|
||||||
include(CopyWinLibs)
|
include(CopyWinLibs)
|
||||||
@@ -70,6 +71,7 @@ include_directories(
|
|||||||
${LLVFS_INCLUDE_DIRS}
|
${LLVFS_INCLUDE_DIRS}
|
||||||
${LLWINDOW_INCLUDE_DIRS}
|
${LLWINDOW_INCLUDE_DIRS}
|
||||||
${LLXML_INCLUDE_DIRS}
|
${LLXML_INCLUDE_DIRS}
|
||||||
|
${LLAPPEARANCE_INCLUDE_DIRS}
|
||||||
# ${LSCRIPT_INCLUDE_DIRS}
|
# ${LSCRIPT_INCLUDE_DIRS}
|
||||||
# ${LSCRIPT_INCLUDE_DIRS}/lscript_compile
|
# ${LSCRIPT_INCLUDE_DIRS}/lscript_compile
|
||||||
)
|
)
|
||||||
@@ -151,7 +153,6 @@ set(viewer_SOURCE_FILES
|
|||||||
lldrawpooltree.cpp
|
lldrawpooltree.cpp
|
||||||
lldrawpoolwater.cpp
|
lldrawpoolwater.cpp
|
||||||
lldrawpoolwlsky.cpp
|
lldrawpoolwlsky.cpp
|
||||||
lldriverparam.cpp
|
|
||||||
lldroptarget.cpp
|
lldroptarget.cpp
|
||||||
lldynamictexture.cpp
|
lldynamictexture.cpp
|
||||||
llemote.cpp
|
llemote.cpp
|
||||||
@@ -297,7 +298,6 @@ set(viewer_SOURCE_FILES
|
|||||||
lljoystickbutton.cpp
|
lljoystickbutton.cpp
|
||||||
lllandmarklist.cpp
|
lllandmarklist.cpp
|
||||||
lllocalinventory.cpp
|
lllocalinventory.cpp
|
||||||
lllocaltextureobject.cpp
|
|
||||||
lllogchat.cpp
|
lllogchat.cpp
|
||||||
llloginhandler.cpp
|
llloginhandler.cpp
|
||||||
llmainlooprepeater.cpp
|
llmainlooprepeater.cpp
|
||||||
@@ -387,8 +387,6 @@ set(viewer_SOURCE_FILES
|
|||||||
llpathfindingobjectlist.cpp
|
llpathfindingobjectlist.cpp
|
||||||
llphysicsmotion.cpp
|
llphysicsmotion.cpp
|
||||||
llphysicsshapebuilderutil.cpp
|
llphysicsshapebuilderutil.cpp
|
||||||
llpolymesh.cpp
|
|
||||||
llpolymorph.cpp
|
|
||||||
llprefschat.cpp
|
llprefschat.cpp
|
||||||
llprefsim.cpp
|
llprefsim.cpp
|
||||||
llprefsvoice.cpp
|
llprefsvoice.cpp
|
||||||
@@ -422,9 +420,6 @@ set(viewer_SOURCE_FILES
|
|||||||
llstylemap.cpp
|
llstylemap.cpp
|
||||||
llsurface.cpp
|
llsurface.cpp
|
||||||
llsurfacepatch.cpp
|
llsurfacepatch.cpp
|
||||||
lltexglobalcolor.cpp
|
|
||||||
lltexlayer.cpp
|
|
||||||
lltexlayerparams.cpp
|
|
||||||
lltexturecache.cpp
|
lltexturecache.cpp
|
||||||
lltexturectrl.cpp
|
lltexturectrl.cpp
|
||||||
lltexturefetch.cpp
|
lltexturefetch.cpp
|
||||||
@@ -505,17 +500,17 @@ set(viewer_SOURCE_FILES
|
|||||||
llviewershadermgr.cpp
|
llviewershadermgr.cpp
|
||||||
llviewerstats.cpp
|
llviewerstats.cpp
|
||||||
llviewerstatsrecorder.cpp
|
llviewerstatsrecorder.cpp
|
||||||
|
llviewertexlayer.cpp
|
||||||
llviewertexteditor.cpp
|
llviewertexteditor.cpp
|
||||||
llviewertexture.cpp
|
llviewertexture.cpp
|
||||||
llviewertextureanim.cpp
|
llviewertextureanim.cpp
|
||||||
llviewertexturelist.cpp
|
llviewertexturelist.cpp
|
||||||
llviewerthrottle.cpp
|
llviewerthrottle.cpp
|
||||||
llviewervisualparam.cpp
|
llviewerwearable.cpp
|
||||||
llviewerwindow.cpp
|
llviewerwindow.cpp
|
||||||
llvlcomposition.cpp
|
llvlcomposition.cpp
|
||||||
llvlmanager.cpp
|
llvlmanager.cpp
|
||||||
llvoavatar.cpp
|
llvoavatar.cpp
|
||||||
llvoavatardefines.cpp
|
|
||||||
llvoavatarself.cpp
|
llvoavatarself.cpp
|
||||||
llvocache.cpp
|
llvocache.cpp
|
||||||
llvoclouds.cpp
|
llvoclouds.cpp
|
||||||
@@ -535,9 +530,7 @@ set(viewer_SOURCE_FILES
|
|||||||
llwatchdog.cpp
|
llwatchdog.cpp
|
||||||
llwaterparammanager.cpp
|
llwaterparammanager.cpp
|
||||||
llwaterparamset.cpp
|
llwaterparamset.cpp
|
||||||
llwearable.cpp
|
|
||||||
llwearablelist.cpp
|
llwearablelist.cpp
|
||||||
llwearabletype.cpp
|
|
||||||
llweb.cpp
|
llweb.cpp
|
||||||
llwebprofile.cpp
|
llwebprofile.cpp
|
||||||
llwind.cpp
|
llwind.cpp
|
||||||
@@ -658,7 +651,6 @@ set(viewer_HEADER_FILES
|
|||||||
lldrawpooltree.h
|
lldrawpooltree.h
|
||||||
lldrawpoolwater.h
|
lldrawpoolwater.h
|
||||||
lldrawpoolwlsky.h
|
lldrawpoolwlsky.h
|
||||||
lldriverparam.h
|
|
||||||
lldroptarget.h
|
lldroptarget.h
|
||||||
lldynamictexture.h
|
lldynamictexture.h
|
||||||
llemote.h
|
llemote.h
|
||||||
@@ -804,7 +796,6 @@ set(viewer_HEADER_FILES
|
|||||||
lllandmarklist.h
|
lllandmarklist.h
|
||||||
lllightconstants.h
|
lllightconstants.h
|
||||||
lllocalinventory.h
|
lllocalinventory.h
|
||||||
lllocaltextureobject.h
|
|
||||||
lllogchat.h
|
lllogchat.h
|
||||||
llloginhandler.h
|
llloginhandler.h
|
||||||
llmainlooprepeater.h
|
llmainlooprepeater.h
|
||||||
@@ -894,8 +885,6 @@ set(viewer_HEADER_FILES
|
|||||||
llpathfindingobjectlist.h
|
llpathfindingobjectlist.h
|
||||||
llphysicsmotion.h
|
llphysicsmotion.h
|
||||||
llphysicsshapebuilderutil.h
|
llphysicsshapebuilderutil.h
|
||||||
llpolymesh.h
|
|
||||||
llpolymorph.h
|
|
||||||
llprefschat.h
|
llprefschat.h
|
||||||
llprefsim.h
|
llprefsim.h
|
||||||
llprefsvoice.h
|
llprefsvoice.h
|
||||||
@@ -931,9 +920,6 @@ set(viewer_HEADER_FILES
|
|||||||
llsurface.h
|
llsurface.h
|
||||||
llsurfacepatch.h
|
llsurfacepatch.h
|
||||||
lltable.h
|
lltable.h
|
||||||
lltexglobalcolor.h
|
|
||||||
lltexlayer.h
|
|
||||||
lltexlayerparams.h
|
|
||||||
lltexturecache.h
|
lltexturecache.h
|
||||||
lltexturectrl.h
|
lltexturectrl.h
|
||||||
lltexturefetch.h
|
lltexturefetch.h
|
||||||
@@ -1016,17 +1002,17 @@ set(viewer_HEADER_FILES
|
|||||||
llviewershadermgr.h
|
llviewershadermgr.h
|
||||||
llviewerstats.h
|
llviewerstats.h
|
||||||
llviewerstatsrecorder.h
|
llviewerstatsrecorder.h
|
||||||
|
llviewertexlayer.h
|
||||||
llviewertexteditor.h
|
llviewertexteditor.h
|
||||||
llviewertexture.h
|
llviewertexture.h
|
||||||
llviewertextureanim.h
|
llviewertextureanim.h
|
||||||
llviewertexturelist.h
|
llviewertexturelist.h
|
||||||
llviewerthrottle.h
|
llviewerthrottle.h
|
||||||
llviewervisualparam.h
|
llviewerwearable.h
|
||||||
llviewerwindow.h
|
llviewerwindow.h
|
||||||
llvlcomposition.h
|
llvlcomposition.h
|
||||||
llvlmanager.h
|
llvlmanager.h
|
||||||
llvoavatar.h
|
llvoavatar.h
|
||||||
llvoavatardefines.h
|
|
||||||
llvoavatarself.h
|
llvoavatarself.h
|
||||||
llvocache.h
|
llvocache.h
|
||||||
llvoclouds.h
|
llvoclouds.h
|
||||||
@@ -1047,9 +1033,7 @@ set(viewer_HEADER_FILES
|
|||||||
llwatchdog.h
|
llwatchdog.h
|
||||||
llwaterparammanager.h
|
llwaterparammanager.h
|
||||||
llwaterparamset.h
|
llwaterparamset.h
|
||||||
llwearable.h
|
|
||||||
llwearablelist.h
|
llwearablelist.h
|
||||||
llwearabletype.h
|
|
||||||
llweb.h
|
llweb.h
|
||||||
llwebprofile.h
|
llwebprofile.h
|
||||||
llwind.h
|
llwind.h
|
||||||
@@ -1582,6 +1566,7 @@ target_link_libraries(${VIEWER_BINARY_NAME}
|
|||||||
${XMLRPCEPI_LIBRARIES}
|
${XMLRPCEPI_LIBRARIES}
|
||||||
${ELFIO_LIBRARIES}
|
${ELFIO_LIBRARIES}
|
||||||
${HUNSPELL_LIBRARY}
|
${HUNSPELL_LIBRARY}
|
||||||
|
${LLAPPEARANCE_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
if (LINUX)
|
if (LINUX)
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ uniform int texture_index_in;
|
|||||||
ATTRIBUTE vec3 position;
|
ATTRIBUTE vec3 position;
|
||||||
|
|
||||||
VARYING vec3 position_out;
|
VARYING vec3 position_out;
|
||||||
VARYING int texture_index_out;
|
VARYING_FLAT int texture_index_out;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
|
|
||||||
//project includes
|
//project includes
|
||||||
#include "llcolorswatch.h"
|
#include "llcolorswatch.h"
|
||||||
|
#include "llvoavatar.h"
|
||||||
#include "llvoavatarself.h"
|
#include "llvoavatarself.h"
|
||||||
#include "llagent.h"
|
#include "llagent.h"
|
||||||
#include "llfloaterchat.h"
|
#include "llfloaterchat.h"
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ void HGFloaterTextEditor::imageCallback(BOOL success,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
src_vi->setBoostLevel(LLViewerTexture::BOOST_UI);
|
src_vi->setBoostLevel(LLGLTexture::BOOST_UI);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -642,7 +642,7 @@ void ImportTracker::send_inventory(LLSD& prim)
|
|||||||
LLFILE* fp = LLFile::fopen(data->filename, "rb");
|
LLFILE* fp = LLFile::fopen(data->filename, "rb");
|
||||||
if(fp)//HACK LOL LOL LOL
|
if(fp)//HACK LOL LOL LOL
|
||||||
{
|
{
|
||||||
LLWearable* wearable = new LLWearable(LLUUID::null);
|
LLViewerWearable* wearable = new LLWearable(LLUUID::null);
|
||||||
wearable->importFile( fp );
|
wearable->importFile( fp );
|
||||||
//if (!res)
|
//if (!res)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -105,7 +105,7 @@
|
|||||||
|
|
||||||
#include "NACLantispam.h" // for NaCl Antispam Registry
|
#include "NACLantispam.h" // for NaCl Antispam Registry
|
||||||
|
|
||||||
using namespace LLVOAvatarDefines;
|
using namespace LLAvatarAppearanceDefines;
|
||||||
|
|
||||||
const BOOL ANIMATE = TRUE;
|
const BOOL ANIMATE = TRUE;
|
||||||
const U8 AGENT_STATE_TYPING = 0x04;
|
const U8 AGENT_STATE_TYPING = 0x04;
|
||||||
@@ -3336,7 +3336,7 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void *
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isAgentAvatarValid() && !gAgentAvatarp->isUsingBakedTextures())
|
if (isAgentAvatarValid() && gAgentAvatarp->isEditingAppearance())
|
||||||
{
|
{
|
||||||
// ignore baked textures when in customize mode
|
// ignore baked textures when in customize mode
|
||||||
return;
|
return;
|
||||||
@@ -3360,7 +3360,7 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void *
|
|||||||
|
|
||||||
if ((S32)texture_index < TEX_NUM_INDICES )
|
if ((S32)texture_index < TEX_NUM_INDICES )
|
||||||
{
|
{
|
||||||
const LLVOAvatarDictionary::TextureEntry *texture_entry = LLVOAvatarDictionary::instance().getTexture((ETextureIndex)texture_index);
|
const LLAvatarAppearanceDictionary::TextureEntry *texture_entry = LLAvatarAppearanceDictionary::instance().getTexture((ETextureIndex)texture_index);
|
||||||
if (texture_entry)
|
if (texture_entry)
|
||||||
{
|
{
|
||||||
EBakedTextureIndex baked_index = texture_entry->mBakedTextureIndex;
|
EBakedTextureIndex baked_index = texture_entry->mBakedTextureIndex;
|
||||||
@@ -3912,7 +3912,7 @@ void LLAgent::sendAgentSetAppearance()
|
|||||||
{
|
{
|
||||||
if (!isAgentAvatarValid()) return;
|
if (!isAgentAvatarValid()) return;
|
||||||
|
|
||||||
if (gAgentQueryManager.mNumPendingQueries > 0 && (isAgentAvatarValid() && gAgentAvatarp->isUsingBakedTextures()))
|
if (gAgentQueryManager.mNumPendingQueries > 0 && (isAgentAvatarValid() && !gAgentAvatarp->isEditingAppearance()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -3956,7 +3956,7 @@ void LLAgent::sendAgentSetAppearance()
|
|||||||
|
|
||||||
for(U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++ )
|
for(U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++ )
|
||||||
{
|
{
|
||||||
const ETextureIndex texture_index = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index);
|
const ETextureIndex texture_index = LLAvatarAppearanceDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index);
|
||||||
|
|
||||||
// if we're not wearing a skirt, we don't need the texture to be baked
|
// if we're not wearing a skirt, we don't need the texture to be baked
|
||||||
if (texture_index == TEX_SKIRT_BAKED && !gAgentAvatarp->isWearingWearableType(LLWearableType::WT_SKIRT))
|
if (texture_index == TEX_SKIRT_BAKED && !gAgentAvatarp->isWearingWearableType(LLWearableType::WT_SKIRT))
|
||||||
@@ -3979,7 +3979,7 @@ void LLAgent::sendAgentSetAppearance()
|
|||||||
for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++)
|
for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++)
|
||||||
{
|
{
|
||||||
BOOL generate_valid_hash = TRUE;
|
BOOL generate_valid_hash = TRUE;
|
||||||
if (isAgentAvatarValid() && !gAgentAvatarp->isBakedTextureFinal((LLVOAvatarDefines::EBakedTextureIndex)baked_index))
|
if (isAgentAvatarValid() && !gAgentAvatarp->isBakedTextureFinal((LLAvatarAppearanceDefines::EBakedTextureIndex)baked_index))
|
||||||
{
|
{
|
||||||
generate_valid_hash = FALSE;
|
generate_valid_hash = FALSE;
|
||||||
LL_DEBUGS("Avatar") << gAgentAvatarp->avString() << "Not caching baked texture upload for " << (U32)baked_index << " due to being uploaded at low resolution." << LL_ENDL;
|
LL_DEBUGS("Avatar") << gAgentAvatarp->avString() << "Not caching baked texture upload for " << (U32)baked_index << " due to being uploaded at low resolution." << LL_ENDL;
|
||||||
@@ -3988,7 +3988,7 @@ void LLAgent::sendAgentSetAppearance()
|
|||||||
const LLUUID hash = gAgentWearables.computeBakedTextureHash((EBakedTextureIndex) baked_index, generate_valid_hash);
|
const LLUUID hash = gAgentWearables.computeBakedTextureHash((EBakedTextureIndex) baked_index, generate_valid_hash);
|
||||||
if (hash.notNull())
|
if (hash.notNull())
|
||||||
{
|
{
|
||||||
ETextureIndex texture_index = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex) baked_index);
|
ETextureIndex texture_index = LLAvatarAppearanceDictionary::bakedToLocalTextureIndex((EBakedTextureIndex) baked_index);
|
||||||
msg->nextBlockFast(_PREHASH_WearableData);
|
msg->nextBlockFast(_PREHASH_WearableData);
|
||||||
msg->addUUIDFast(_PREHASH_CacheID, hash);
|
msg->addUUIDFast(_PREHASH_CacheID, hash);
|
||||||
msg->addU8Fast(_PREHASH_TextureIndex, (U8)texture_index);
|
msg->addU8Fast(_PREHASH_TextureIndex, (U8)texture_index);
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
#include "llagentdata.h" // gAgentID, gAgentSessionID
|
#include "llagentdata.h" // gAgentID, gAgentSessionID
|
||||||
#include "llcharacter.h"
|
#include "llcharacter.h"
|
||||||
#include "llcoordframe.h" // for mFrameAgent
|
#include "llcoordframe.h" // for mFrameAgent
|
||||||
#include "llvoavatardefines.h"
|
#include "llavatarappearancedefines.h"
|
||||||
#include "llviewerinventory.h"
|
#include "llviewerinventory.h"
|
||||||
#include "llinventorymodel.h"
|
#include "llinventorymodel.h"
|
||||||
#include "v3dmath.h"
|
#include "v3dmath.h"
|
||||||
@@ -887,7 +887,7 @@ private:
|
|||||||
S32 mNumPendingQueries;
|
S32 mNumPendingQueries;
|
||||||
S32 mWearablesCacheQueryID; //mTextureCacheQueryID;
|
S32 mWearablesCacheQueryID; //mTextureCacheQueryID;
|
||||||
U32 mUpdateSerialNum; //mAgentWearablesUpdateSerialNum
|
U32 mUpdateSerialNum; //mAgentWearablesUpdateSerialNum
|
||||||
S32 mActiveCacheQueries[LLVOAvatarDefines::BAKED_NUM_INDICES];
|
S32 mActiveCacheQueries[LLAvatarAppearanceDefines::BAKED_NUM_INDICES];
|
||||||
};
|
};
|
||||||
|
|
||||||
extern LLAgentQueryManager gAgentQueryManager;
|
extern LLAgentQueryManager gAgentQueryManager;
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
#include "rlvhandler.h"
|
#include "rlvhandler.h"
|
||||||
// [/RLVa:KB]
|
// [/RLVa:KB]
|
||||||
|
|
||||||
using namespace LLVOAvatarDefines;
|
using namespace LLAvatarAppearanceDefines;
|
||||||
|
|
||||||
extern LLMenuBarGL* gMenuBarView;
|
extern LLMenuBarGL* gMenuBarView;
|
||||||
|
|
||||||
@@ -1114,8 +1114,8 @@ void LLAgentCamera::updateLookAt(const S32 mouse_x, const S32 mouse_y)
|
|||||||
|
|
||||||
if (!isAgentAvatarValid()) return;
|
if (!isAgentAvatarValid()) return;
|
||||||
|
|
||||||
LLQuaternion av_inv_rot = ~gAgentAvatarp->mRoot.getWorldRotation();
|
LLQuaternion av_inv_rot = ~gAgentAvatarp->mRoot->getWorldRotation();
|
||||||
LLVector3 root_at = LLVector3::x_axis * gAgentAvatarp->mRoot.getWorldRotation();
|
LLVector3 root_at = LLVector3::x_axis * gAgentAvatarp->mRoot->getWorldRotation();
|
||||||
|
|
||||||
if ((gViewerWindow->getMouseVelocityStat()->getCurrent() < 0.01f) &&
|
if ((gViewerWindow->getMouseVelocityStat()->getCurrent() < 0.01f) &&
|
||||||
(root_at * last_at_axis > 0.95f))
|
(root_at * last_at_axis > 0.95f))
|
||||||
@@ -1477,7 +1477,7 @@ void LLAgentCamera::updateCamera()
|
|||||||
LLVector3(0.08f, 0.f, 0.05f) * gAgentAvatarp->mHeadp->getWorldRotation() +
|
LLVector3(0.08f, 0.f, 0.05f) * gAgentAvatarp->mHeadp->getWorldRotation() +
|
||||||
LLVector3(0.1f, 0.f, 0.f) * gAgentAvatarp->mPelvisp->getWorldRotation();
|
LLVector3(0.1f, 0.f, 0.f) * gAgentAvatarp->mPelvisp->getWorldRotation();
|
||||||
LLVector3 diff = mCameraPositionAgent - head_pos;
|
LLVector3 diff = mCameraPositionAgent - head_pos;
|
||||||
diff = diff * ~gAgentAvatarp->mRoot.getWorldRotation();
|
diff = diff * ~gAgentAvatarp->mRoot->getWorldRotation();
|
||||||
|
|
||||||
LLJoint* torso_joint = gAgentAvatarp->mTorsop;
|
LLJoint* torso_joint = gAgentAvatarp->mTorsop;
|
||||||
LLJoint* chest_joint = gAgentAvatarp->mChestp;
|
LLJoint* chest_joint = gAgentAvatarp->mChestp;
|
||||||
@@ -1501,7 +1501,7 @@ void LLAgentCamera::updateCamera()
|
|||||||
|
|
||||||
gAgentAvatarp->mPelvisp->setPosition(gAgentAvatarp->mPelvisp->getPosition() + diff);
|
gAgentAvatarp->mPelvisp->setPosition(gAgentAvatarp->mPelvisp->getPosition() + diff);
|
||||||
|
|
||||||
gAgentAvatarp->mRoot.updateWorldMatrixChildren();
|
gAgentAvatarp->mRoot->updateWorldMatrixChildren();
|
||||||
|
|
||||||
for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
|
for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
|
||||||
iter != gAgentAvatarp->mAttachmentPoints.end(); )
|
iter != gAgentAvatarp->mAttachmentPoints.end(); )
|
||||||
@@ -1762,7 +1762,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
|
|||||||
F32 camera_land_height;
|
F32 camera_land_height;
|
||||||
LLVector3d frame_center_global = !isAgentAvatarValid() ?
|
LLVector3d frame_center_global = !isAgentAvatarValid() ?
|
||||||
gAgent.getPositionGlobal() :
|
gAgent.getPositionGlobal() :
|
||||||
gAgent.getPosGlobalFromAgent(gAgentAvatarp->mRoot.getWorldPosition());
|
gAgent.getPosGlobalFromAgent(gAgentAvatarp->mRoot->getWorldPosition());
|
||||||
|
|
||||||
BOOL isConstrained = FALSE;
|
BOOL isConstrained = FALSE;
|
||||||
LLVector3d head_offset;
|
LLVector3d head_offset;
|
||||||
@@ -2354,7 +2354,7 @@ void LLAgentCamera::changeCameraToThirdPerson(BOOL animate)
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void LLAgentCamera::changeCameraToCustomizeAvatar()
|
void LLAgentCamera::changeCameraToCustomizeAvatar()
|
||||||
{
|
{
|
||||||
if (LLViewerJoystick::getInstance()->getOverrideCamera())
|
if (LLViewerJoystick::getInstance()->getOverrideCamera() || !isAgentAvatarValid())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ BOOL LLAgentWearables::mInitialWearablesUpdateReceived = FALSE;
|
|||||||
bool LLAgentWearables::mInitialWearablesLoaded = false;
|
bool LLAgentWearables::mInitialWearablesLoaded = false;
|
||||||
// [/SL:KB]
|
// [/SL:KB]
|
||||||
|
|
||||||
using namespace LLVOAvatarDefines;
|
using namespace LLAvatarAppearanceDefines;
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ class LLWearAndEditCallback : public LLInventoryCallback
|
|||||||
// wearable type stored in asset is some other value.
|
// wearable type stored in asset is some other value.
|
||||||
// Calling this function whenever a wearable is added to increase visibility if this problem
|
// Calling this function whenever a wearable is added to increase visibility if this problem
|
||||||
// turns up in other inventories.
|
// turns up in other inventories.
|
||||||
void checkWearableAgainstInventory(LLWearable *wearable)
|
void checkWearableAgainstInventory(LLViewerWearable *wearable)
|
||||||
{
|
{
|
||||||
if (wearable->getItemID().isNull())
|
if (wearable->getItemID().isNull())
|
||||||
return;
|
return;
|
||||||
@@ -132,7 +132,7 @@ void LLAgentWearables::dump()
|
|||||||
llinfos << "Type: " << i << " count " << count << llendl;
|
llinfos << "Type: " << i << " count " << count << llendl;
|
||||||
for (U32 j=0; j<count; j++)
|
for (U32 j=0; j<count; j++)
|
||||||
{
|
{
|
||||||
LLWearable* wearable = getWearable((LLWearableType::EType)i,j);
|
LLViewerWearable* wearable = getViewerWearable((LLWearableType::EType)i,j);
|
||||||
if (wearable == NULL)
|
if (wearable == NULL)
|
||||||
{
|
{
|
||||||
llinfos << " " << j << " NULL wearable" << llendl;
|
llinfos << " " << j << " NULL wearable" << llendl;
|
||||||
@@ -172,6 +172,7 @@ struct LLAgentDumper
|
|||||||
};
|
};
|
||||||
|
|
||||||
LLAgentWearables::LLAgentWearables() :
|
LLAgentWearables::LLAgentWearables() :
|
||||||
|
LLWearableData(),
|
||||||
mWearablesLoaded(FALSE)
|
mWearablesLoaded(FALSE)
|
||||||
, mCOFChangeInProgress(false)
|
, mCOFChangeInProgress(false)
|
||||||
{
|
{
|
||||||
@@ -196,10 +197,12 @@ void LLAgentWearables::initClass()
|
|||||||
|
|
||||||
void LLAgentWearables::setAvatarObject(LLVOAvatarSelf *avatar)
|
void LLAgentWearables::setAvatarObject(LLVOAvatarSelf *avatar)
|
||||||
{
|
{
|
||||||
|
llassert(avatar);
|
||||||
if (avatar)
|
if (avatar)
|
||||||
{
|
{
|
||||||
avatar->outputRezTiming("Sending wearables request");
|
avatar->outputRezTiming("Sending wearables request");
|
||||||
sendAgentWearablesRequest();
|
sendAgentWearablesRequest();
|
||||||
|
setAvatarAppearance(avatar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,7 +229,7 @@ LLAgentWearables::sendAgentWearablesUpdateCallback::~sendAgentWearablesUpdateCal
|
|||||||
* @param todo Bitmask of actions to take on completion.
|
* @param todo Bitmask of actions to take on completion.
|
||||||
*/
|
*/
|
||||||
LLAgentWearables::addWearableToAgentInventoryCallback::addWearableToAgentInventoryCallback(
|
LLAgentWearables::addWearableToAgentInventoryCallback::addWearableToAgentInventoryCallback(
|
||||||
LLPointer<LLRefCount> cb, LLWearableType::EType type, U32 index, LLWearable* wearable, U32 todo) :
|
LLPointer<LLRefCount> cb, LLWearableType::EType type, U32 index, LLViewerWearable* wearable, U32 todo) :
|
||||||
mType(type),
|
mType(type),
|
||||||
mIndex(index),
|
mIndex(index),
|
||||||
mWearable(wearable),
|
mWearable(wearable),
|
||||||
@@ -279,7 +282,7 @@ void LLAgentWearables::addWearableToAgentInventoryCallback::fire(const LLUUID& i
|
|||||||
void LLAgentWearables::addWearabletoAgentInventoryDone(const LLWearableType::EType type,
|
void LLAgentWearables::addWearabletoAgentInventoryDone(const LLWearableType::EType type,
|
||||||
const U32 index,
|
const U32 index,
|
||||||
const LLUUID& item_id,
|
const LLUUID& item_id,
|
||||||
LLWearable* wearable)
|
LLViewerWearable* wearable)
|
||||||
{
|
{
|
||||||
llinfos << "type " << type << " index " << index << " item " << item_id.asString() << llendl;
|
llinfos << "type " << type << " index " << index << " item " << item_id.asString() << llendl;
|
||||||
|
|
||||||
@@ -326,7 +329,7 @@ void LLAgentWearables::sendAgentWearablesUpdate()
|
|||||||
{
|
{
|
||||||
for (U32 index=0; index < getWearableCount((LLWearableType::EType)type); ++index)
|
for (U32 index=0; index < getWearableCount((LLWearableType::EType)type); ++index)
|
||||||
{
|
{
|
||||||
LLWearable* wearable = getWearable((LLWearableType::EType)type,index);
|
LLViewerWearable* wearable = getViewerWearable((LLWearableType::EType)type,index);
|
||||||
if (wearable)
|
if (wearable)
|
||||||
{
|
{
|
||||||
if (wearable->getItemID().isNull())
|
if (wearable->getItemID().isNull())
|
||||||
@@ -368,7 +371,7 @@ void LLAgentWearables::sendAgentWearablesUpdate()
|
|||||||
U8 type_u8 = (U8)type;
|
U8 type_u8 = (U8)type;
|
||||||
gMessageSystem->addU8Fast(_PREHASH_WearableType, type_u8 );
|
gMessageSystem->addU8Fast(_PREHASH_WearableType, type_u8 );
|
||||||
|
|
||||||
LLWearable* wearable = getWearable((LLWearableType::EType)type, 0);
|
LLViewerWearable* wearable = getViewerWearable((LLWearableType::EType)type, 0);
|
||||||
if( wearable )
|
if( wearable )
|
||||||
{
|
{
|
||||||
//llinfos << "Sending wearable " << wearable->getName() << llendl;
|
//llinfos << "Sending wearable " << wearable->getName() << llendl;
|
||||||
@@ -397,14 +400,14 @@ void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32
|
|||||||
const std::string new_name)
|
const std::string new_name)
|
||||||
{
|
{
|
||||||
//llassert_always(index == 0);
|
//llassert_always(index == 0);
|
||||||
LLWearable* old_wearable = getWearable(type, index);
|
LLViewerWearable* old_wearable = getViewerWearable(type, index);
|
||||||
if(!old_wearable) return;
|
if(!old_wearable) return;
|
||||||
bool name_changed = !new_name.empty() && (new_name != old_wearable->getName());
|
bool name_changed = !new_name.empty() && (new_name != old_wearable->getName());
|
||||||
if (name_changed || old_wearable->isDirty() || old_wearable->isOldVersion())
|
if (name_changed || old_wearable->isDirty() || old_wearable->isOldVersion())
|
||||||
{
|
{
|
||||||
LLUUID old_item_id = old_wearable->getItemID();
|
LLUUID old_item_id = old_wearable->getItemID();
|
||||||
LLWearable* new_wearable = LLWearableList::instance().createCopy(old_wearable);
|
LLViewerWearable* new_wearable = LLWearableList::instance().createCopy(old_wearable);
|
||||||
new_wearable->setItemID(old_item_id); // should this be in LLWearable::copyDataFrom()?
|
new_wearable->setItemID(old_item_id); // should this be in LLViewerWearable::copyDataFrom()?
|
||||||
setWearable(type,index,new_wearable);
|
setWearable(type,index,new_wearable);
|
||||||
|
|
||||||
// old_wearable may still be referred to by other inventory items. Revert
|
// old_wearable may still be referred to by other inventory items. Revert
|
||||||
@@ -470,7 +473,7 @@ void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LLWearable* LLAgentWearables::saveWearableAs(const LLWearableType::EType type,
|
LLViewerWearable* LLAgentWearables::saveWearableAs(const LLWearableType::EType type,
|
||||||
const U32 index,
|
const U32 index,
|
||||||
const std::string& new_name,
|
const std::string& new_name,
|
||||||
BOOL save_in_lost_and_found)
|
BOOL save_in_lost_and_found)
|
||||||
@@ -480,7 +483,7 @@ LLWearable* LLAgentWearables::saveWearableAs(const LLWearableType::EType type,
|
|||||||
llwarns << "LLAgent::saveWearableAs() not copyable." << llendl;
|
llwarns << "LLAgent::saveWearableAs() not copyable." << llendl;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
LLWearable* old_wearable = getWearable(type, index);
|
LLViewerWearable* old_wearable = getViewerWearable(type, index);
|
||||||
if (!old_wearable)
|
if (!old_wearable)
|
||||||
{
|
{
|
||||||
llwarns << "LLAgent::saveWearableAs() no old wearable." << llendl;
|
llwarns << "LLAgent::saveWearableAs() no old wearable." << llendl;
|
||||||
@@ -495,7 +498,7 @@ LLWearable* LLAgentWearables::saveWearableAs(const LLWearableType::EType type,
|
|||||||
}
|
}
|
||||||
std::string trunc_name(new_name);
|
std::string trunc_name(new_name);
|
||||||
LLStringUtil::truncate(trunc_name, DB_INV_ITEM_NAME_STR_LEN);
|
LLStringUtil::truncate(trunc_name, DB_INV_ITEM_NAME_STR_LEN);
|
||||||
LLWearable* new_wearable = LLWearableList::instance().createCopy(
|
LLViewerWearable* new_wearable = LLWearableList::instance().createCopy(
|
||||||
old_wearable,
|
old_wearable,
|
||||||
trunc_name);
|
trunc_name);
|
||||||
LLPointer<LLInventoryCallback> cb =
|
LLPointer<LLInventoryCallback> cb =
|
||||||
@@ -534,7 +537,7 @@ LLWearable* LLAgentWearables::saveWearableAs(const LLWearableType::EType type,
|
|||||||
|
|
||||||
void LLAgentWearables::revertWearable(const LLWearableType::EType type, const U32 index)
|
void LLAgentWearables::revertWearable(const LLWearableType::EType type, const U32 index)
|
||||||
{
|
{
|
||||||
LLWearable* wearable = getWearable(type, index);
|
LLViewerWearable* wearable = getViewerWearable(type, index);
|
||||||
llassert(wearable);
|
llassert(wearable);
|
||||||
if (wearable)
|
if (wearable)
|
||||||
{
|
{
|
||||||
@@ -559,7 +562,7 @@ void LLAgentWearables::saveAllWearables()
|
|||||||
sendAgentWearablesUpdate();
|
sendAgentWearablesUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when the user changes the name of a wearable inventory item that is currenlty being worn.
|
// Called when the user changes the name of a wearable inventory item that is currently being worn.
|
||||||
void LLAgentWearables::setWearableName(const LLUUID& item_id, const std::string& new_name)
|
void LLAgentWearables::setWearableName(const LLUUID& item_id, const std::string& new_name)
|
||||||
{
|
{
|
||||||
for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
|
for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
|
||||||
@@ -569,13 +572,13 @@ void LLAgentWearables::setWearableName( const LLUUID& item_id, const std::string
|
|||||||
LLUUID curr_item_id = getWearableItemID((LLWearableType::EType)i,j);
|
LLUUID curr_item_id = getWearableItemID((LLWearableType::EType)i,j);
|
||||||
if (curr_item_id == item_id)
|
if (curr_item_id == item_id)
|
||||||
{
|
{
|
||||||
LLWearable* old_wearable = getWearable((LLWearableType::EType)i,j);
|
LLViewerWearable* old_wearable = getViewerWearable((LLWearableType::EType)i,j);
|
||||||
llassert(old_wearable);
|
llassert(old_wearable);
|
||||||
if (!old_wearable) continue;
|
if (!old_wearable) continue;
|
||||||
|
|
||||||
std::string old_name = old_wearable->getName();
|
std::string old_name = old_wearable->getName();
|
||||||
old_wearable->setName(new_name);
|
old_wearable->setName(new_name);
|
||||||
LLWearable* new_wearable = LLWearableList::instance().createCopy(old_wearable);
|
LLViewerWearable* new_wearable = LLWearableList::instance().createCopy(old_wearable);
|
||||||
new_wearable->setItemID(item_id);
|
new_wearable->setItemID(item_id);
|
||||||
LLInventoryItem* item = gInventory.getItem(item_id);
|
LLInventoryItem* item = gInventory.getItem(item_id);
|
||||||
if (item)
|
if (item)
|
||||||
@@ -659,14 +662,14 @@ LLInventoryItem* LLAgentWearables::getWearableInventoryItem(LLWearableType::ETyp
|
|||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
const LLWearable* LLAgentWearables::getWearableFromItemID( const LLUUID& item_id ) const
|
const LLViewerWearable* LLAgentWearables::getWearableFromItemID( const LLUUID& item_id ) const
|
||||||
{
|
{
|
||||||
const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
|
const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
|
||||||
for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
|
for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
|
||||||
{
|
{
|
||||||
for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
|
for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
|
||||||
{
|
{
|
||||||
const LLWearable * curr_wearable = getWearable((LLWearableType::EType)i, j);
|
const LLViewerWearable * curr_wearable = getViewerWearable((LLWearableType::EType)i, j);
|
||||||
if (curr_wearable && (curr_wearable->getItemID() == base_item_id))
|
if (curr_wearable && (curr_wearable->getItemID() == base_item_id))
|
||||||
{
|
{
|
||||||
return curr_wearable;
|
return curr_wearable;
|
||||||
@@ -676,14 +679,14 @@ const LLWearable* LLAgentWearables::getWearableFromItemID( const LLUUID& item_id
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
LLWearable* LLAgentWearables::getWearableFromItemID( const LLUUID& item_id )
|
LLViewerWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& item_id)
|
||||||
{
|
{
|
||||||
const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
|
const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
|
||||||
for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
|
for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
|
||||||
{
|
{
|
||||||
for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
|
for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
|
||||||
{
|
{
|
||||||
LLWearable * curr_wearable = getWearable((LLWearableType::EType)i, j);
|
LLViewerWearable * curr_wearable = getViewerWearable((LLWearableType::EType)i, j);
|
||||||
if (curr_wearable && (curr_wearable->getItemID() == base_item_id))
|
if (curr_wearable && (curr_wearable->getItemID() == base_item_id))
|
||||||
{
|
{
|
||||||
return curr_wearable;
|
return curr_wearable;
|
||||||
@@ -693,13 +696,13 @@ LLWearable* LLAgentWearables::getWearableFromItemID( const LLUUID& item_id )
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
LLWearable* LLAgentWearables::getWearableFromAssetID(const LLUUID& asset_id)
|
LLViewerWearable* LLAgentWearables::getWearableFromAssetID(const LLUUID& asset_id)
|
||||||
{
|
{
|
||||||
for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
|
for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
|
||||||
{
|
{
|
||||||
for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
|
for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
|
||||||
{
|
{
|
||||||
LLWearable * curr_wearable = getWearable((LLWearableType::EType)i, j);
|
LLViewerWearable * curr_wearable = getViewerWearable((LLWearableType::EType)i, j);
|
||||||
if (curr_wearable && (curr_wearable->getAssetID() == asset_id))
|
if (curr_wearable && (curr_wearable->getAssetID() == asset_id))
|
||||||
{
|
{
|
||||||
return curr_wearable;
|
return curr_wearable;
|
||||||
@@ -718,114 +721,48 @@ void LLAgentWearables::sendAgentWearablesRequest()
|
|||||||
gAgent.sendReliableMessage();
|
gAgent.sendReliableMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Used to enable/disable menu items.
|
LLViewerWearable* LLAgentWearables::getViewerWearable(const LLWearableType::EType type, U32 index /*= 0*/)
|
||||||
|
{
|
||||||
|
return dynamic_cast<LLViewerWearable*> (getWearable(type, index));
|
||||||
|
}
|
||||||
|
|
||||||
|
const LLViewerWearable* LLAgentWearables::getViewerWearable(const LLWearableType::EType type, U32 index /*= 0*/) const
|
||||||
|
{
|
||||||
|
return dynamic_cast<const LLViewerWearable*> (getWearable(type, index));
|
||||||
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
BOOL LLAgentWearables::selfHasWearable(LLWearableType::EType type)
|
BOOL LLAgentWearables::selfHasWearable(LLWearableType::EType type)
|
||||||
{
|
{
|
||||||
return (gAgentWearables.getWearableCount(type) > 0);
|
return (gAgentWearables.getWearableCount(type) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
LLWearable* LLAgentWearables::getWearable(const LLWearableType::EType type, U32 index)
|
// virtual
|
||||||
|
void LLAgentWearables::wearableUpdated(LLWearable *wearable, BOOL removed)
|
||||||
{
|
{
|
||||||
//llassert_always(index == 0);
|
if (isAgentAvatarValid())
|
||||||
wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type);
|
|
||||||
if (wearable_iter == mWearableDatas.end())
|
|
||||||
{
|
{
|
||||||
return NULL;
|
const BOOL upload_result = removed;
|
||||||
}
|
gAgentAvatarp->wearableUpdated(wearable->getType(), upload_result);
|
||||||
wearableentry_vec_t& wearable_vec = wearable_iter->second;
|
|
||||||
if (index>=wearable_vec.size())
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return wearable_vec[index];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLAgentWearables::setWearable(const LLWearableType::EType type, U32 index, LLWearable *wearable)
|
LLWearableData::wearableUpdated(wearable, removed);
|
||||||
{
|
|
||||||
//llassert_always(index == 0);
|
|
||||||
LLWearable *old_wearable = getWearable(type,index);
|
|
||||||
if (!old_wearable)
|
|
||||||
{
|
|
||||||
pushWearable(type,wearable);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(type);
|
if (!removed)
|
||||||
if (wearable_iter == mWearableDatas.end())
|
|
||||||
{
|
{
|
||||||
llwarns << "invalid type, type " << type << " index " << index << llendl;
|
LLViewerWearable* viewer_wearable = dynamic_cast<LLViewerWearable*>(wearable);
|
||||||
return;
|
viewer_wearable->refreshName();
|
||||||
}
|
|
||||||
wearableentry_vec_t& wearable_vec = wearable_iter->second;
|
|
||||||
if (index>=wearable_vec.size())
|
|
||||||
{
|
|
||||||
llwarns << "invalid index, type " << type << " index " << index << llendl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wearable_vec[index] = wearable;
|
|
||||||
old_wearable->setLabelUpdated();
|
|
||||||
wearableUpdated(wearable);
|
|
||||||
checkWearableAgainstInventory(wearable);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
U32 LLAgentWearables::pushWearable(const LLWearableType::EType type, LLWearable *wearable)
|
|
||||||
{
|
|
||||||
if (wearable == NULL)
|
|
||||||
{
|
|
||||||
// no null wearables please!
|
|
||||||
llwarns << "Null wearable sent for type " << type << llendl;
|
|
||||||
return MAX_CLOTHING_PER_TYPE;
|
|
||||||
}
|
|
||||||
// if (type < LLWearableType::WT_COUNT || mWearableDatas[type].size() < MAX_CLOTHING_PER_TYPE)
|
|
||||||
// {
|
|
||||||
// mWearableDatas[type].push_back(wearable);
|
|
||||||
// wearableUpdated(wearable);
|
|
||||||
// checkWearableAgainstInventory(wearable);
|
|
||||||
// return mWearableDatas[type].size()-1;
|
|
||||||
// }
|
|
||||||
// [RLVa:KB] - Checked: 2010-06-08 (RLVa-1.2.0g) | Added: RLVa-1.2.0g
|
|
||||||
if ( (type < LLWearableType::WT_COUNT) && (mWearableDatas[type].size() < MAX_CLOTHING_PER_TYPE) )
|
|
||||||
{
|
|
||||||
// Don't add the same wearable twice
|
|
||||||
U32 idxWearable = getWearableIndex(wearable);
|
|
||||||
RLV_ASSERT(MAX_CLOTHING_PER_TYPE == idxWearable); // pushWearable() on an already added wearable is a bug *somewhere*
|
|
||||||
if (MAX_CLOTHING_PER_TYPE == idxWearable)
|
|
||||||
{
|
|
||||||
mWearableDatas[type].push_back(wearable);
|
|
||||||
idxWearable = mWearableDatas[type].size() - 1;
|
|
||||||
}
|
|
||||||
wearableUpdated(wearable);
|
|
||||||
checkWearableAgainstInventory(wearable);
|
|
||||||
return idxWearable;
|
|
||||||
// [/RLVa:KB]
|
|
||||||
}
|
|
||||||
return MAX_CLOTHING_PER_TYPE;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LLAgentWearables::wearableUpdated(LLWearable *wearable)
|
|
||||||
{
|
|
||||||
gAgentAvatarp->wearableUpdated(wearable->getType(), FALSE);
|
|
||||||
wearable->refreshName();
|
|
||||||
wearable->setLabelUpdated();
|
|
||||||
|
|
||||||
wearable->pullCrossWearableValues();
|
|
||||||
|
|
||||||
// Hack pt 2. If the wearable we just loaded has definition version 24,
|
// Hack pt 2. If the wearable we just loaded has definition version 24,
|
||||||
// then force a re-save of this wearable after slamming the version number to 22.
|
// then force a re-save of this wearable after slamming the version number to 22.
|
||||||
// This number was incorrectly incremented for internal builds before release, and
|
// This number was incorrectly incremented for internal builds before release, and
|
||||||
// this fix will ensure that the affected wearables are re-saved with the right version number.
|
// this fix will ensure that the affected wearables are re-saved with the right version number.
|
||||||
// the versions themselves are compatible. This code can be removed before release.
|
// the versions themselves are compatible. This code can be removed before release.
|
||||||
if( wearable->getDefinitionVersion() == 24 )
|
if( viewer_wearable->getDefinitionVersion() == 24 )
|
||||||
{
|
{
|
||||||
wearable->setDefinitionVersion(22);
|
viewer_wearable->setDefinitionVersion(22);
|
||||||
U32 index = getWearableIndex(wearable);
|
U32 index = getWearableIndex(wearable);
|
||||||
llinfos << "forcing werable type " << wearable->getType() << " to version 22 from 24" << llendl;
|
llinfos << "forcing wearable type " << wearable->getType() << " to version 22 from 24" << llendl;
|
||||||
saveWearable(wearable->getType(),index,TRUE);
|
saveWearable(wearable->getType(),index,TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -836,122 +773,11 @@ void LLAgentWearables::wearableUpdated(LLWearable *wearable)
|
|||||||
if(gFloaterCustomize)
|
if(gFloaterCustomize)
|
||||||
gFloaterCustomize->wearablesChanged(wearable->getType());
|
gFloaterCustomize->wearablesChanged(wearable->getType());
|
||||||
|
|
||||||
|
checkWearableAgainstInventory(viewer_wearable);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLAgentWearables::popWearable(LLWearable *wearable)
|
|
||||||
{
|
|
||||||
if (wearable == NULL)
|
|
||||||
{
|
|
||||||
// nothing to do here. move along.
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
U32 index = getWearableIndex(wearable);
|
|
||||||
LLWearableType::EType type = wearable->getType();
|
|
||||||
|
|
||||||
if (index < MAX_CLOTHING_PER_TYPE && index < getWearableCount(type))
|
|
||||||
{
|
|
||||||
popWearable(type, index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void LLAgentWearables::popWearable(const LLWearableType::EType type, U32 index)
|
|
||||||
{
|
|
||||||
//llassert_always(index == 0);
|
|
||||||
LLWearable *wearable = getWearable(type, index);
|
|
||||||
if (wearable)
|
|
||||||
{
|
|
||||||
mWearableDatas[type].erase(mWearableDatas[type].begin() + index);
|
|
||||||
if (isAgentAvatarValid())
|
|
||||||
{
|
|
||||||
gAgentAvatarp->wearableUpdated(wearable->getType(), TRUE);
|
|
||||||
}
|
|
||||||
wearable->setLabelUpdated();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
U32 LLAgentWearables::getWearableIndex(const LLWearable *wearable) const
|
|
||||||
{
|
|
||||||
if (wearable == NULL)
|
|
||||||
{
|
|
||||||
return MAX_CLOTHING_PER_TYPE;
|
|
||||||
}
|
|
||||||
|
|
||||||
const LLWearableType::EType type = wearable->getType();
|
|
||||||
wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
|
|
||||||
if (wearable_iter == mWearableDatas.end())
|
|
||||||
{
|
|
||||||
llwarns << "tried to get wearable index with an invalid type!" << llendl;
|
|
||||||
return MAX_CLOTHING_PER_TYPE;
|
|
||||||
}
|
|
||||||
const wearableentry_vec_t& wearable_vec = wearable_iter->second;
|
|
||||||
for(U32 index = 0; index < wearable_vec.size(); index++)
|
|
||||||
{
|
|
||||||
if (wearable_vec[index] == wearable)
|
|
||||||
{
|
|
||||||
return index;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return MAX_CLOTHING_PER_TYPE;
|
|
||||||
}
|
|
||||||
|
|
||||||
const LLWearable* LLAgentWearables::getWearable(const LLWearableType::EType type, U32 index) const
|
|
||||||
{
|
|
||||||
//llassert_always(index == 0);
|
|
||||||
wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
|
|
||||||
if (wearable_iter == mWearableDatas.end())
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
const wearableentry_vec_t& wearable_vec = wearable_iter->second;
|
|
||||||
if (index>=wearable_vec.size())
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return wearable_vec[index];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LLWearable* LLAgentWearables::getTopWearable(const LLWearableType::EType type)
|
|
||||||
{
|
|
||||||
U32 count = getWearableCount(type);
|
|
||||||
if ( count == 0)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return getWearable(type, count-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
LLWearable* LLAgentWearables::getBottomWearable(const LLWearableType::EType type)
|
|
||||||
{
|
|
||||||
if (getWearableCount(type) == 0)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return getWearable(type, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
U32 LLAgentWearables::getWearableCount(const LLWearableType::EType type) const
|
|
||||||
{
|
|
||||||
wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
|
|
||||||
if (wearable_iter == mWearableDatas.end())
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
const wearableentry_vec_t& wearable_vec = wearable_iter->second;
|
|
||||||
return wearable_vec.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
U32 LLAgentWearables::getWearableCount(const U32 tex_index) const
|
|
||||||
{
|
|
||||||
const LLWearableType::EType wearable_type = LLVOAvatarDictionary::getTEWearableType((LLVOAvatarDefines::ETextureIndex)tex_index);
|
|
||||||
return getWearableCount(wearable_type);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BOOL LLAgentWearables::itemUpdatePending(const LLUUID& item_id) const
|
BOOL LLAgentWearables::itemUpdatePending(const LLUUID& item_id) const
|
||||||
@@ -966,7 +792,7 @@ U32 LLAgentWearables::itemUpdatePendingCount() const
|
|||||||
|
|
||||||
const LLUUID LLAgentWearables::getWearableItemID(LLWearableType::EType type, U32 index) const
|
const LLUUID LLAgentWearables::getWearableItemID(LLWearableType::EType type, U32 index) const
|
||||||
{
|
{
|
||||||
const LLWearable *wearable = getWearable(type,index);
|
const LLViewerWearable *wearable = getViewerWearable(type,index);
|
||||||
if (wearable)
|
if (wearable)
|
||||||
return wearable->getItemID();
|
return wearable->getItemID();
|
||||||
else
|
else
|
||||||
@@ -991,7 +817,9 @@ void LLAgentWearables::getWearableItemIDs(LLWearableType::EType eType, uuid_vec_
|
|||||||
for (wearableentry_vec_t::const_iterator itWearable = itWearableType->second.begin(), endWearable = itWearableType->second.end();
|
for (wearableentry_vec_t::const_iterator itWearable = itWearableType->second.begin(), endWearable = itWearableType->second.end();
|
||||||
itWearable != endWearable; ++itWearable)
|
itWearable != endWearable; ++itWearable)
|
||||||
{
|
{
|
||||||
idItems.push_back((*itWearable)->getItemID());
|
LLViewerWearable* wearable = dynamic_cast<LLViewerWearable*>(*itWearable);
|
||||||
|
if(wearable)
|
||||||
|
idItems.push_back(wearable->getItemID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -999,7 +827,7 @@ void LLAgentWearables::getWearableItemIDs(LLWearableType::EType eType, uuid_vec_
|
|||||||
|
|
||||||
const LLUUID LLAgentWearables::getWearableAssetID(LLWearableType::EType type, U32 index) const
|
const LLUUID LLAgentWearables::getWearableAssetID(LLWearableType::EType type, U32 index) const
|
||||||
{
|
{
|
||||||
const LLWearable *wearable = getWearable(type,index);
|
const LLViewerWearable *wearable = getViewerWearable(type,index);
|
||||||
if (wearable)
|
if (wearable)
|
||||||
return wearable->getAssetID();
|
return wearable->getAssetID();
|
||||||
else
|
else
|
||||||
@@ -1080,7 +908,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs
|
|||||||
gMessageSystem->getUUIDFast(_PREHASH_WearableData, _PREHASH_AssetID, asset_id, i );
|
gMessageSystem->getUUIDFast(_PREHASH_WearableData, _PREHASH_AssetID, asset_id, i );
|
||||||
if( asset_id.isNull() )
|
if( asset_id.isNull() )
|
||||||
{
|
{
|
||||||
LLWearable::removeFromAvatar( type, FALSE );
|
LLViewerWearable::removeFromAvatar( type, FALSE );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1127,7 +955,7 @@ void LLAgentWearables::recoverMissingWearable(const LLWearableType::EType type,
|
|||||||
// Try to recover by replacing missing wearable with a new one.
|
// Try to recover by replacing missing wearable with a new one.
|
||||||
LLNotificationsUtil::add("ReplacedMissingWearable");
|
LLNotificationsUtil::add("ReplacedMissingWearable");
|
||||||
lldebugs << "Wearable " << LLWearableType::getTypeLabel( type ) << " could not be downloaded. Replaced inventory item with default wearable." << llendl;
|
lldebugs << "Wearable " << LLWearableType::getTypeLabel( type ) << " could not be downloaded. Replaced inventory item with default wearable." << llendl;
|
||||||
LLWearable* new_wearable = LLWearableList::instance().createNewWearable(type);
|
LLViewerWearable* new_wearable = LLWearableList::instance().createNewWearable(type, gAgentAvatarp);
|
||||||
|
|
||||||
setWearable(type,index,new_wearable);
|
setWearable(type,index,new_wearable);
|
||||||
//new_wearable->writeToAvatar( TRUE );
|
//new_wearable->writeToAvatar( TRUE );
|
||||||
@@ -1162,9 +990,9 @@ void LLAgentWearables::recoverMissingWearableDone()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLAgentWearables::addLocalTextureObject(const LLWearableType::EType wearable_type, const LLVOAvatarDefines::ETextureIndex texture_type, U32 wearable_index)
|
void LLAgentWearables::addLocalTextureObject(const LLWearableType::EType wearable_type, const LLAvatarAppearanceDefines::ETextureIndex texture_type, U32 wearable_index)
|
||||||
{
|
{
|
||||||
LLWearable* wearable = getWearable((LLWearableType::EType)wearable_type, wearable_index);
|
LLViewerWearable* wearable = getViewerWearable((LLWearableType::EType)wearable_type, wearable_index);
|
||||||
if (!wearable)
|
if (!wearable)
|
||||||
{
|
{
|
||||||
llerrs << "Tried to add local texture object to invalid wearable with type " << wearable_type << " and index " << wearable_index << llendl;
|
llerrs << "Tried to add local texture object to invalid wearable with type " << wearable_type << " and index " << wearable_index << llendl;
|
||||||
@@ -1197,7 +1025,7 @@ public:
|
|||||||
mItemsToLink,
|
mItemsToLink,
|
||||||
link_waiter);
|
link_waiter);
|
||||||
}
|
}
|
||||||
void addPendingWearable(LLWearable *wearable)
|
void addPendingWearable(LLViewerWearable *wearable)
|
||||||
{
|
{
|
||||||
if (!wearable)
|
if (!wearable)
|
||||||
{
|
{
|
||||||
@@ -1232,7 +1060,7 @@ public:
|
|||||||
LLWearableType::EType type = item->getWearableType();
|
LLWearableType::EType type = item->getWearableType();
|
||||||
if (type < LLWearableType::WT_COUNT)
|
if (type < LLWearableType::WT_COUNT)
|
||||||
{
|
{
|
||||||
LLWearable *wearable = mWearablesAwaitingItems[type];
|
LLViewerWearable *wearable = mWearablesAwaitingItems[type];
|
||||||
if (wearable)
|
if (wearable)
|
||||||
wearable->setItemID(inv_item);
|
wearable->setItemID(inv_item);
|
||||||
}
|
}
|
||||||
@@ -1245,7 +1073,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
LLInventoryModel::item_array_t mItemsToLink;
|
LLInventoryModel::item_array_t mItemsToLink;
|
||||||
std::vector<LLWearable*> mWearablesAwaitingItems;
|
std::vector<LLViewerWearable*> mWearablesAwaitingItems;
|
||||||
};
|
};
|
||||||
|
|
||||||
void LLAgentWearables::createStandardWearables()
|
void LLAgentWearables::createStandardWearables()
|
||||||
@@ -1258,20 +1086,20 @@ void LLAgentWearables::createStandardWearables()
|
|||||||
{
|
{
|
||||||
TRUE, //LLWearableType::WT_SHAPE
|
TRUE, //LLWearableType::WT_SHAPE
|
||||||
TRUE, //LLWearableType::WT_SKIN
|
TRUE, //LLWearableType::WT_SKIN
|
||||||
TRUE, //WT_HAIR
|
TRUE, //LLWearableType::WT_HAIR
|
||||||
TRUE, //WT_EYES
|
TRUE, //LLWearableType::WT_EYES
|
||||||
TRUE, //WT_SHIRT
|
TRUE, //LLWearableType::WT_SHIRT
|
||||||
TRUE, //WT_PANTS
|
TRUE, //LLWearableType::WT_PANTS
|
||||||
TRUE, //WT_SHOES
|
TRUE, //LLWearableType::WT_SHOES
|
||||||
TRUE, //WT_SOCKS
|
TRUE, //LLWearableType::WT_SOCKS
|
||||||
FALSE, //WT_JACKET
|
FALSE, //LLWearableType::WT_JACKET
|
||||||
FALSE, //WT_GLOVES
|
FALSE, //LLWearableType::WT_GLOVES
|
||||||
TRUE, //WT_UNDERSHIRT
|
TRUE, //LLWearableType::WT_UNDERSHIRT
|
||||||
TRUE, //WT_UNDERPANTS
|
TRUE, //LLWearableType::WT_UNDERPANTS
|
||||||
FALSE, //WT_SKIRT
|
FALSE, //LLWearableType::WT_SKIRT
|
||||||
FALSE, //WT_ALPHA
|
FALSE, //LLWearableType::WT_ALPHA
|
||||||
FALSE, //WT_TATTOO
|
FALSE, //LLWearableType::WT_TATTOO
|
||||||
FALSE, //WT_PHYSICS
|
FALSE //LLWearableType::WT_PHYSICS
|
||||||
};
|
};
|
||||||
|
|
||||||
LLPointer<LLInventoryCallback> cb = new OnWearableItemCreatedCB;
|
LLPointer<LLInventoryCallback> cb = new OnWearableItemCreatedCB;
|
||||||
@@ -1280,7 +1108,7 @@ void LLAgentWearables::createStandardWearables()
|
|||||||
if (create[i])
|
if (create[i])
|
||||||
{
|
{
|
||||||
llassert(getWearableCount((LLWearableType::EType)i) == 0);
|
llassert(getWearableCount((LLWearableType::EType)i) == 0);
|
||||||
LLWearable* wearable = LLWearableList::instance().createNewWearable((LLWearableType::EType)i);
|
LLViewerWearable* wearable = LLWearableList::instance().createNewWearable((LLWearableType::EType)i, gAgentAvatarp);
|
||||||
((OnWearableItemCreatedCB*)(&(*cb)))->addPendingWearable(wearable);
|
((OnWearableItemCreatedCB*)(&(*cb)))->addPendingWearable(wearable);
|
||||||
// no need to update here...
|
// no need to update here...
|
||||||
LLUUID category_id = LLUUID::null;
|
LLUUID category_id = LLUUID::null;
|
||||||
@@ -1339,7 +1167,7 @@ void LLAgentWearables::makeNewOutfitDone(S32 type, U32 index)
|
|||||||
|
|
||||||
|
|
||||||
void LLAgentWearables::addWearableToAgentInventory(LLPointer<LLInventoryCallback> cb,
|
void LLAgentWearables::addWearableToAgentInventory(LLPointer<LLInventoryCallback> cb,
|
||||||
LLWearable* wearable,
|
LLViewerWearable* wearable,
|
||||||
const LLUUID& category_id,
|
const LLUUID& category_id,
|
||||||
BOOL notify)
|
BOOL notify)
|
||||||
{
|
{
|
||||||
@@ -1377,7 +1205,7 @@ void LLAgentWearables::removeWearable(const LLWearableType::EType type, bool do_
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LLWearable* old_wearable = getWearable(type,index);
|
LLViewerWearable* old_wearable = getViewerWearable(type,index);
|
||||||
|
|
||||||
// if (old_wearable)
|
// if (old_wearable)
|
||||||
// [RLVa:KB] - Checked: 2010-05-11 (RLVa-1.2.0c) | Modified: RLVa-1.2.0g
|
// [RLVa:KB] - Checked: 2010-05-11 (RLVa-1.2.0c) | Modified: RLVa-1.2.0g
|
||||||
@@ -1436,10 +1264,10 @@ void LLAgentWearables::removeWearableFinal( LLWearableType::EType type, bool do_
|
|||||||
//llassert_always(index == 0);
|
//llassert_always(index == 0);
|
||||||
if (do_remove_all)
|
if (do_remove_all)
|
||||||
{
|
{
|
||||||
S32 max_entry = mWearableDatas[type].size()-1;
|
S32 max_entry = getWearableCount(type)-1;
|
||||||
for (S32 i=max_entry; i>=0; i--)
|
for (S32 i=max_entry; i>=0; i--)
|
||||||
{
|
{
|
||||||
LLWearable* old_wearable = getWearable(type,i);
|
LLViewerWearable* old_wearable = getViewerWearable(type,i);
|
||||||
//queryWearableCache(); // moved below
|
//queryWearableCache(); // moved below
|
||||||
// if (old_wearable)
|
// if (old_wearable)
|
||||||
// [RLVa:KB] - Checked: 2010-05-14 (RLVa-1.2.0g) | Added: RLVa-1.2.0g
|
// [RLVa:KB] - Checked: 2010-05-14 (RLVa-1.2.0g) | Added: RLVa-1.2.0g
|
||||||
@@ -1458,7 +1286,7 @@ void LLAgentWearables::removeWearableFinal( LLWearableType::EType type, bool do_
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LLWearable* old_wearable = getWearable(type, index);
|
LLViewerWearable* old_wearable = getViewerWearable(type, index);
|
||||||
//queryWearableCache(); // moved below
|
//queryWearableCache(); // moved below
|
||||||
|
|
||||||
// if (old_wearable)
|
// if (old_wearable)
|
||||||
@@ -1504,7 +1332,7 @@ void LLAgentWearables::removeWearableFinal( LLWearableType::EType type, bool do_
|
|||||||
|
|
||||||
// Assumes existing wearables are not dirty.
|
// Assumes existing wearables are not dirty.
|
||||||
void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& items,
|
void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& items,
|
||||||
const LLDynamicArray< LLWearable* >& wearables,
|
const LLDynamicArray< LLViewerWearable* >& wearables,
|
||||||
BOOL remove)
|
BOOL remove)
|
||||||
{
|
{
|
||||||
llinfos << "setWearableOutfit() start" << llendl;
|
llinfos << "setWearableOutfit() start" << llendl;
|
||||||
@@ -1535,7 +1363,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
|
|||||||
S32 i;
|
S32 i;
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
LLWearable* new_wearable = wearables[i];
|
LLViewerWearable* new_wearable = wearables[i];
|
||||||
LLPointer<LLInventoryItem> new_item = items[i];
|
LLPointer<LLInventoryItem> new_item = items[i];
|
||||||
|
|
||||||
llassert(new_wearable);
|
llassert(new_wearable);
|
||||||
@@ -1601,8 +1429,8 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
|
|||||||
idxCurPerType[type]++;
|
idxCurPerType[type]++;
|
||||||
// [/RLVa:KB]
|
// [/RLVa:KB]
|
||||||
|
|
||||||
wearableUpdated(new_wearable);
|
const BOOL removed = FALSE;
|
||||||
checkWearableAgainstInventory(new_wearable);
|
wearableUpdated(new_wearable, removed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1645,7 +1473,7 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
|
|||||||
|
|
||||||
|
|
||||||
// User has picked "wear on avatar" from a menu.
|
// User has picked "wear on avatar" from a menu.
|
||||||
void LLAgentWearables::setWearableItem(LLInventoryItem* new_item, LLWearable* new_wearable, bool do_append)
|
void LLAgentWearables::setWearableItem(LLInventoryItem* new_item, LLViewerWearable* new_wearable, bool do_append)
|
||||||
{
|
{
|
||||||
//LLAgentDumper dumper("setWearableItem");
|
//LLAgentDumper dumper("setWearableItem");
|
||||||
if (isWearingItem(new_item->getUUID()))
|
if (isWearingItem(new_item->getUUID()))
|
||||||
@@ -1670,7 +1498,7 @@ void LLAgentWearables::setWearableItem(LLInventoryItem* new_item, LLWearable* ne
|
|||||||
{
|
{
|
||||||
// Remove old wearable, if any
|
// Remove old wearable, if any
|
||||||
// MULTI_WEARABLE: hardwired to 0
|
// MULTI_WEARABLE: hardwired to 0
|
||||||
LLWearable* old_wearable = getWearable(type,0);
|
LLViewerWearable* old_wearable = getViewerWearable(type,0);
|
||||||
if( old_wearable )
|
if( old_wearable )
|
||||||
{
|
{
|
||||||
const LLUUID& old_item_id = old_wearable->getItemID();
|
const LLUUID& old_item_id = old_wearable->getItemID();
|
||||||
@@ -1696,7 +1524,7 @@ void LLAgentWearables::setWearableItem(LLInventoryItem* new_item, LLWearable* ne
|
|||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
bool LLAgentWearables::onSetWearableDialog( const LLSD& notification, const LLSD& response, LLWearable* wearable )
|
bool LLAgentWearables::onSetWearableDialog(const LLSD& notification, const LLSD& response, LLViewerWearable* wearable)
|
||||||
{
|
{
|
||||||
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
|
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
|
||||||
LLInventoryItem* new_item = gInventory.getItem( notification["payload"]["item_id"].asUUID());
|
LLInventoryItem* new_item = gInventory.getItem( notification["payload"]["item_id"].asUUID());
|
||||||
@@ -1732,7 +1560,7 @@ bool LLAgentWearables::onSetWearableDialog( const LLSD& notification, const LLSD
|
|||||||
|
|
||||||
// Called from setWearableItem() and onSetWearableDialog() to actually set the wearable.
|
// Called from setWearableItem() and onSetWearableDialog() to actually set the wearable.
|
||||||
// MULTI_WEARABLE: unify code after null objects are gone.
|
// MULTI_WEARABLE: unify code after null objects are gone.
|
||||||
void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLWearable* new_wearable, bool do_append)
|
void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLViewerWearable* new_wearable, bool do_append)
|
||||||
{
|
{
|
||||||
const LLWearableType::EType type = new_wearable->getType();
|
const LLWearableType::EType type = new_wearable->getType();
|
||||||
|
|
||||||
@@ -1750,7 +1578,7 @@ void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLWearable* n
|
|||||||
// Replace the old wearable with a new one.
|
// Replace the old wearable with a new one.
|
||||||
llassert(new_item->getAssetUUID() == new_wearable->getAssetID());
|
llassert(new_item->getAssetUUID() == new_wearable->getAssetID());
|
||||||
|
|
||||||
LLWearable *old_wearable = getWearable(type,0);
|
LLViewerWearable *old_wearable = getViewerWearable(type,0);
|
||||||
LLUUID old_item_id;
|
LLUUID old_item_id;
|
||||||
if (old_wearable)
|
if (old_wearable)
|
||||||
{
|
{
|
||||||
@@ -1765,7 +1593,7 @@ void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLWearable* n
|
|||||||
gInventory.notifyObservers();
|
gInventory.notifyObservers();
|
||||||
}
|
}
|
||||||
llinfos << "Replaced current element 0 for type " << type
|
llinfos << "Replaced current element 0 for type " << type
|
||||||
<< " size is now " << mWearableDatas[type].size() << llendl;
|
<< " size is now " << getWearableCount(type) << llendl;
|
||||||
}
|
}
|
||||||
|
|
||||||
//llinfos << "LLVOAvatar::setWearableItem()" << llendl;
|
//llinfos << "LLVOAvatar::setWearableItem()" << llendl;
|
||||||
@@ -1806,7 +1634,7 @@ void LLAgentWearables::queryWearableCache()
|
|||||||
num_queries++;
|
num_queries++;
|
||||||
// *NOTE: make sure at least one request gets packed
|
// *NOTE: make sure at least one request gets packed
|
||||||
|
|
||||||
ETextureIndex te_index = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index);
|
ETextureIndex te_index = LLAvatarAppearanceDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index);
|
||||||
|
|
||||||
//llinfos << "Requesting texture for hash " << hash << " in baked texture slot " << baked_index << llendl;
|
//llinfos << "Requesting texture for hash " << hash << " in baked texture slot " << baked_index << llendl;
|
||||||
gMessageSystem->nextBlockFast(_PREHASH_WearableData);
|
gMessageSystem->nextBlockFast(_PREHASH_WearableData);
|
||||||
@@ -1831,47 +1659,15 @@ void LLAgentWearables::queryWearableCache()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LLUUID LLAgentWearables::computeBakedTextureHash(LLVOAvatarDefines::EBakedTextureIndex baked_index,
|
// virtual
|
||||||
BOOL generate_valid_hash) // Set to false if you want to upload the baked texture w/o putting it in the cache
|
void LLAgentWearables::invalidateBakedTextureHash(LLMD5& hash) const
|
||||||
{
|
{
|
||||||
LLUUID hash_id;
|
|
||||||
bool hash_computed = false;
|
|
||||||
LLMD5 hash;
|
|
||||||
const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index);
|
|
||||||
|
|
||||||
for (U8 i=0; i < baked_dict->mWearables.size(); i++)
|
|
||||||
{
|
|
||||||
const LLWearableType::EType baked_type = baked_dict->mWearables[i];
|
|
||||||
const U32 num_wearables = getWearableCount(baked_type);
|
|
||||||
for (U32 index = 0; index < num_wearables; ++index)
|
|
||||||
{
|
|
||||||
const LLWearable* wearable = getWearable(baked_type,index);
|
|
||||||
if (wearable)
|
|
||||||
{
|
|
||||||
LLUUID asset_id = wearable->getAssetID();
|
|
||||||
hash.update((const unsigned char*)asset_id.mData, UUID_BYTES);
|
|
||||||
hash_computed = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (hash_computed)
|
|
||||||
{
|
|
||||||
hash.update((const unsigned char*)baked_dict->mWearablesHashID.mData, UUID_BYTES);
|
|
||||||
|
|
||||||
// Add some garbage into the hash so that it becomes invalid.
|
// Add some garbage into the hash so that it becomes invalid.
|
||||||
if (!generate_valid_hash)
|
|
||||||
{
|
|
||||||
if (isAgentAvatarValid())
|
if (isAgentAvatarValid())
|
||||||
{
|
{
|
||||||
hash.update((const unsigned char*)gAgentAvatarp->getID().mData, UUID_BYTES);
|
hash.update((const unsigned char*)gAgentAvatarp->getID().mData, UUID_BYTES);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
hash.finalize();
|
|
||||||
hash.raw_digest(hash_id.mData);
|
|
||||||
}
|
|
||||||
|
|
||||||
return hash_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
// User has picked "remove from avatar" from a menu.
|
// User has picked "remove from avatar" from a menu.
|
||||||
// static
|
// static
|
||||||
@@ -2146,7 +1942,7 @@ void LLAgentWearables::checkWearablesLoaded() const
|
|||||||
|
|
||||||
// Returns false if the given wearable is already topmost/bottommost
|
// Returns false if the given wearable is already topmost/bottommost
|
||||||
// (depending on closer_to_body parameter).
|
// (depending on closer_to_body parameter).
|
||||||
bool LLAgentWearables::canMoveWearable(const LLUUID& item_id, bool closer_to_body)
|
bool LLAgentWearables::canMoveWearable(const LLUUID& item_id, bool closer_to_body) const
|
||||||
{
|
{
|
||||||
const LLWearable* wearable = getWearableFromItemID(item_id);
|
const LLWearable* wearable = getWearableFromItemID(item_id);
|
||||||
if (!wearable) return false;
|
if (!wearable) return false;
|
||||||
@@ -2174,7 +1970,7 @@ void LLAgentWearables::updateWearablesLoaded()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LLAgentWearables::canWearableBeRemoved(const LLWearable* wearable) const
|
bool LLAgentWearables::canWearableBeRemoved(const LLViewerWearable* wearable) const
|
||||||
{
|
{
|
||||||
if (!wearable) return false;
|
if (!wearable) return false;
|
||||||
|
|
||||||
@@ -2189,7 +1985,7 @@ void LLAgentWearables::animateAllWearableParams(F32 delta, BOOL upload_bake)
|
|||||||
{
|
{
|
||||||
for (S32 count = 0; count < (S32)getWearableCount((LLWearableType::EType)type); ++count)
|
for (S32 count = 0; count < (S32)getWearableCount((LLWearableType::EType)type); ++count)
|
||||||
{
|
{
|
||||||
LLWearable *wearable = getWearable((LLWearableType::EType)type,count);
|
LLViewerWearable *wearable = getViewerWearable((LLWearableType::EType)type,count);
|
||||||
llassert(wearable);
|
llassert(wearable);
|
||||||
if (wearable)
|
if (wearable)
|
||||||
{
|
{
|
||||||
@@ -2204,28 +2000,39 @@ bool LLAgentWearables::moveWearable(const LLViewerInventoryItem* item, bool clos
|
|||||||
if (!item) return false;
|
if (!item) return false;
|
||||||
if (!item->isWearableType()) return false;
|
if (!item->isWearableType()) return false;
|
||||||
|
|
||||||
wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(item->getWearableType());
|
LLWearableType::EType type = item->getWearableType();
|
||||||
if (wearable_iter == mWearableDatas.end()) return false;
|
U32 wearable_count = getWearableCount(type);
|
||||||
|
if (0 == wearable_count) return false;
|
||||||
wearableentry_vec_t& wearable_vec = wearable_iter->second;
|
|
||||||
if (wearable_vec.empty()) return false;
|
|
||||||
|
|
||||||
const LLUUID& asset_id = item->getAssetUUID();
|
const LLUUID& asset_id = item->getAssetUUID();
|
||||||
|
|
||||||
//nowhere to move if the wearable is already on any boundary (closest to the body/furthest from the body)
|
//nowhere to move if the wearable is already on any boundary (closest to the body/furthest from the body)
|
||||||
if (closer_to_body && asset_id == wearable_vec.front()->getAssetID()) return false;
|
if (closer_to_body)
|
||||||
if (!closer_to_body && asset_id == wearable_vec.back()->getAssetID()) return false;
|
|
||||||
|
|
||||||
for (U32 i = 0; i < wearable_vec.size(); ++i)
|
|
||||||
{
|
{
|
||||||
LLWearable* wearable = wearable_vec[i];
|
LLViewerWearable* bottom_wearable = dynamic_cast<LLViewerWearable*>( getBottomWearable(type) );
|
||||||
|
if (bottom_wearable->getAssetID() == asset_id)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // !closer_to_body
|
||||||
|
{
|
||||||
|
LLViewerWearable* top_wearable = dynamic_cast<LLViewerWearable*>( getTopWearable(type) );
|
||||||
|
if (top_wearable->getAssetID() == asset_id)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (U32 i = 0; i < wearable_count; ++i)
|
||||||
|
{
|
||||||
|
LLViewerWearable* wearable = getViewerWearable(type, i);
|
||||||
if (!wearable) continue;
|
if (!wearable) continue;
|
||||||
if (wearable->getAssetID() != asset_id) continue;
|
if (wearable->getAssetID() != asset_id) continue;
|
||||||
|
|
||||||
//swapping wearables
|
//swapping wearables
|
||||||
U32 swap_i = closer_to_body ? i-1 : i+1;
|
U32 swap_i = closer_to_body ? i-1 : i+1;
|
||||||
wearable_vec[i] = wearable_vec[swap_i];
|
swapWearables(type, i, swap_i);
|
||||||
wearable_vec[swap_i] = wearable;
|
|
||||||
|
|
||||||
if(gFloaterCustomize)
|
if(gFloaterCustomize)
|
||||||
{
|
{
|
||||||
@@ -2243,7 +2050,7 @@ void LLAgentWearables::createWearable(LLWearableType::EType type, bool wear, con
|
|||||||
{
|
{
|
||||||
if (type == LLWearableType::WT_INVALID || type == LLWearableType::WT_NONE) return;
|
if (type == LLWearableType::WT_INVALID || type == LLWearableType::WT_NONE) return;
|
||||||
|
|
||||||
LLWearable* wearable = LLWearableList::instance().createNewWearable(type);
|
LLViewerWearable* wearable = LLWearableList::instance().createNewWearable(type, gAgentAvatarp);
|
||||||
LLAssetType::EType asset_type = wearable->getAssetType();
|
LLAssetType::EType asset_type = wearable->getAssetType();
|
||||||
LLInventoryType::EType inv_type = LLInventoryType::IT_WEARABLE;
|
LLInventoryType::EType inv_type = LLInventoryType::IT_WEARABLE;
|
||||||
LLPointer<LLInventoryCallback> cb = wear ? new LLWearAndEditCallback : NULL;
|
LLPointer<LLInventoryCallback> cb = wear ? new LLWearAndEditCallback : NULL;
|
||||||
@@ -2276,7 +2083,7 @@ void LLAgentWearables::editWearable(const LLUUID& item_id)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LLWearable* wearable = gAgentWearables.getWearableFromItemID(item_id);
|
LLViewerWearable* wearable = gAgentWearables.getWearableFromItemID(item_id);
|
||||||
if (!wearable)
|
if (!wearable)
|
||||||
{
|
{
|
||||||
llwarns << "Cannot get wearable" << llendl;
|
llwarns << "Cannot get wearable" << llendl;
|
||||||
|
|||||||
@@ -36,16 +36,16 @@
|
|||||||
// newview
|
// newview
|
||||||
#include "llinventorymodel.h"
|
#include "llinventorymodel.h"
|
||||||
#include "llviewerinventory.h"
|
#include "llviewerinventory.h"
|
||||||
#include "llvoavatardefines.h"
|
#include "llavatarappearancedefines.h"
|
||||||
|
#include "llwearabledata.h"
|
||||||
|
|
||||||
class LLInventoryItem;
|
class LLInventoryItem;
|
||||||
class LLVOAvatarSelf;
|
class LLVOAvatarSelf;
|
||||||
class LLWearable;
|
class LLViewerWearable;
|
||||||
class LLInitialWearablesFetch;
|
class LLInitialWearablesFetch;
|
||||||
class LLViewerObject;
|
class LLViewerObject;
|
||||||
class LLTexLayerTemplate;
|
|
||||||
|
|
||||||
class LLAgentWearables : public LLInitClass<LLAgentWearables>
|
class LLAgentWearables : public LLInitClass<LLAgentWearables>, public LLWearableData
|
||||||
{
|
{
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
// Constructors / destructors / Initializers
|
// Constructors / destructors / Initializers
|
||||||
@@ -82,10 +82,10 @@ public:
|
|||||||
bool isCOFChangeInProgress() const { return mCOFChangeInProgress; }
|
bool isCOFChangeInProgress() const { return mCOFChangeInProgress; }
|
||||||
void updateWearablesLoaded();
|
void updateWearablesLoaded();
|
||||||
void checkWearablesLoaded() const;
|
void checkWearablesLoaded() const;
|
||||||
bool canMoveWearable(const LLUUID& item_id, bool closer_to_body);
|
bool canMoveWearable(const LLUUID& item_id, bool closer_to_body) const;
|
||||||
|
|
||||||
// Note: False for shape, skin, eyes, and hair, unless you have MORE than 1.
|
// Note: False for shape, skin, eyes, and hair, unless you have MORE than 1.
|
||||||
bool canWearableBeRemoved(const LLWearable* wearable) const;
|
bool canWearableBeRemoved(const LLViewerWearable* wearable) const;
|
||||||
|
|
||||||
void animateAllWearableParams(F32 delta, BOOL upload_bake);
|
void animateAllWearableParams(F32 delta, BOOL upload_bake);
|
||||||
|
|
||||||
@@ -99,52 +99,38 @@ public:
|
|||||||
// [/RLVa:KB]
|
// [/RLVa:KB]
|
||||||
const LLUUID getWearableItemID(LLWearableType::EType type, U32 index /*= 0*/) const;
|
const LLUUID getWearableItemID(LLWearableType::EType type, U32 index /*= 0*/) const;
|
||||||
const LLUUID getWearableAssetID(LLWearableType::EType type, U32 index /*= 0*/) const;
|
const LLUUID getWearableAssetID(LLWearableType::EType type, U32 index /*= 0*/) const;
|
||||||
const LLWearable* getWearableFromItemID(const LLUUID& item_id) const;
|
const LLViewerWearable* getWearableFromItemID(const LLUUID& item_id) const;
|
||||||
LLWearable* getWearableFromItemID(const LLUUID& item_id);
|
LLViewerWearable* getWearableFromItemID(const LLUUID& item_id);
|
||||||
LLWearable* getWearableFromAssetID(const LLUUID& asset_id);
|
LLViewerWearable* getWearableFromAssetID(const LLUUID& asset_id);
|
||||||
|
LLViewerWearable* getViewerWearable(const LLWearableType::EType type, U32 index /*= 0*/);
|
||||||
|
const LLViewerWearable* getViewerWearable(const LLWearableType::EType type, U32 index /*= 0*/) const;
|
||||||
LLInventoryItem* getWearableInventoryItem(LLWearableType::EType type, U32 index /*= 0*/);
|
LLInventoryItem* getWearableInventoryItem(LLWearableType::EType type, U32 index /*= 0*/);
|
||||||
static BOOL selfHasWearable(LLWearableType::EType type);
|
static BOOL selfHasWearable(LLWearableType::EType type);
|
||||||
LLWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/);
|
|
||||||
const LLWearable* getWearable(const LLWearableType::EType type, U32 index /*= 0*/) const;
|
|
||||||
LLWearable* getTopWearable(const LLWearableType::EType type);
|
|
||||||
LLWearable* getBottomWearable(const LLWearableType::EType type);
|
|
||||||
U32 getWearableCount(const LLWearableType::EType type) const;
|
|
||||||
U32 getWearableCount(const U32 tex_index) const;
|
|
||||||
|
|
||||||
static const U32 MAX_CLOTHING_PER_TYPE = 5;
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
// Setters
|
// Setters
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Low-level data structure setter - public access is via setWearableItem, etc.
|
/*virtual*/void wearableUpdated(LLWearable *wearable, BOOL removed);
|
||||||
void setWearable(const LLWearableType::EType type, U32 index, LLWearable *wearable);
|
|
||||||
U32 pushWearable(const LLWearableType::EType type, LLWearable *wearable);
|
|
||||||
void wearableUpdated(LLWearable *wearable);
|
|
||||||
void popWearable(LLWearable *wearable);
|
|
||||||
void popWearable(const LLWearableType::EType type, U32 index);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void setWearableItem(LLInventoryItem* new_item, LLWearable* wearable, bool do_append = false);
|
void setWearableItem(LLInventoryItem* new_item, LLViewerWearable* wearable, bool do_append = false);
|
||||||
void setWearableOutfit(const LLInventoryItem::item_array_t& items, const LLDynamicArray< LLWearable* >& wearables, BOOL remove);
|
void setWearableOutfit(const LLInventoryItem::item_array_t& items, const LLDynamicArray< LLViewerWearable* >& wearables, BOOL remove);
|
||||||
void setWearableName(const LLUUID& item_id, const std::string& new_name);
|
void setWearableName(const LLUUID& item_id, const std::string& new_name);
|
||||||
void addLocalTextureObject(const LLWearableType::EType wearable_type, const LLVOAvatarDefines::ETextureIndex texture_type, U32 wearable_index);
|
// *TODO: Move this into llappearance/LLWearableData ?
|
||||||
U32 getWearableIndex(const LLWearable *wearable) const;
|
void addLocalTextureObject(const LLWearableType::EType wearable_type, const LLAvatarAppearanceDefines::ETextureIndex texture_type, U32 wearable_index);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setWearableFinal(LLInventoryItem* new_item, LLWearable* new_wearable, bool do_append = false);
|
void setWearableFinal(LLInventoryItem* new_item, LLViewerWearable* new_wearable, bool do_append = false);
|
||||||
static bool onSetWearableDialog(const LLSD& notification, const LLSD& response, LLWearable* wearable);
|
static bool onSetWearableDialog(const LLSD& notification, const LLSD& response, LLViewerWearable* wearable);
|
||||||
|
|
||||||
void addWearableToAgentInventory(LLPointer<LLInventoryCallback> cb,
|
void addWearableToAgentInventory(LLPointer<LLInventoryCallback> cb,
|
||||||
LLWearable* wearable,
|
LLViewerWearable* wearable,
|
||||||
const LLUUID& category_id = LLUUID::null,
|
const LLUUID& category_id = LLUUID::null,
|
||||||
BOOL notify = TRUE);
|
BOOL notify = TRUE);
|
||||||
void addWearabletoAgentInventoryDone(const LLWearableType::EType type,
|
void addWearabletoAgentInventoryDone(const LLWearableType::EType type,
|
||||||
const U32 index,
|
const U32 index,
|
||||||
const LLUUID& item_id,
|
const LLUUID& item_id,
|
||||||
LLWearable* wearable);
|
LLViewerWearable* wearable);
|
||||||
void recoverMissingWearable(const LLWearableType::EType type, U32 index /*= 0*/);
|
void recoverMissingWearable(const LLWearableType::EType type, U32 index /*= 0*/);
|
||||||
void recoverMissingWearableDone();
|
void recoverMissingWearableDone();
|
||||||
|
|
||||||
@@ -179,15 +165,15 @@ protected:
|
|||||||
public:
|
public:
|
||||||
// Processes the initial wearables update message (if necessary, since the outfit folder makes it redundant)
|
// Processes the initial wearables update message (if necessary, since the outfit folder makes it redundant)
|
||||||
static void processAgentInitialWearablesUpdate(LLMessageSystem* mesgsys, void** user_data);
|
static void processAgentInitialWearablesUpdate(LLMessageSystem* mesgsys, void** user_data);
|
||||||
LLUUID computeBakedTextureHash(LLVOAvatarDefines::EBakedTextureIndex baked_index,
|
|
||||||
BOOL generate_valid_hash = TRUE);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
/*virtual*/ void invalidateBakedTextureHash(LLMD5& hash) const;
|
||||||
void sendAgentWearablesUpdate();
|
void sendAgentWearablesUpdate();
|
||||||
void sendAgentWearablesRequest();
|
void sendAgentWearablesRequest();
|
||||||
void queryWearableCache();
|
void queryWearableCache();
|
||||||
void updateServer();
|
void updateServer();
|
||||||
static void onInitialWearableAssetArrived(LLWearable* wearable, void* userdata);
|
static void onInitialWearableAssetArrived(LLViewerWearable* wearable, void* userdata);
|
||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
// Outfits
|
// Outfits
|
||||||
@@ -205,7 +191,7 @@ private:
|
|||||||
// Save Wearables
|
// Save Wearables
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
public:
|
public:
|
||||||
LLWearable* saveWearableAs(const LLWearableType::EType type, const U32 index, const std::string& new_name, BOOL save_in_lost_and_found);
|
LLViewerWearable* saveWearableAs(const LLWearableType::EType type, const U32 index, const std::string& new_name, BOOL save_in_lost_and_found);
|
||||||
void saveWearable(const LLWearableType::EType type, const U32 index, BOOL send_update = TRUE,
|
void saveWearable(const LLWearableType::EType type, const U32 index, BOOL send_update = TRUE,
|
||||||
const std::string new_name = "");
|
const std::string new_name = "");
|
||||||
void saveAllWearables();
|
void saveAllWearables();
|
||||||
@@ -262,10 +248,6 @@ private:
|
|||||||
// Member variables
|
// Member variables
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
private:
|
private:
|
||||||
typedef std::vector<LLWearable*> wearableentry_vec_t; // all wearables of a certain type (EG all shirts)
|
|
||||||
typedef std::map<LLWearableType::EType, wearableentry_vec_t> wearableentry_map_t; // wearable "categories" arranged by wearable type
|
|
||||||
wearableentry_map_t mWearableDatas;
|
|
||||||
|
|
||||||
static BOOL mInitialWearablesUpdateReceived;
|
static BOOL mInitialWearablesUpdateReceived;
|
||||||
// [SL:KB] - Patch: Appearance-InitialWearablesLoadedCallback | Checked: 2010-08-14 (Catznip-3.0.0a) | Added: Catznip-2.2.0a
|
// [SL:KB] - Patch: Appearance-InitialWearablesLoadedCallback | Checked: 2010-08-14 (Catznip-3.0.0a) | Added: Catznip-2.2.0a
|
||||||
static bool mInitialWearablesLoaded;
|
static bool mInitialWearablesLoaded;
|
||||||
@@ -309,13 +291,13 @@ private:
|
|||||||
addWearableToAgentInventoryCallback(LLPointer<LLRefCount> cb,
|
addWearableToAgentInventoryCallback(LLPointer<LLRefCount> cb,
|
||||||
LLWearableType::EType type,
|
LLWearableType::EType type,
|
||||||
U32 index,
|
U32 index,
|
||||||
LLWearable* wearable,
|
LLViewerWearable* wearable,
|
||||||
U32 todo = CALL_NONE);
|
U32 todo = CALL_NONE);
|
||||||
virtual void fire(const LLUUID& inv_item);
|
virtual void fire(const LLUUID& inv_item);
|
||||||
private:
|
private:
|
||||||
LLWearableType::EType mType;
|
LLWearableType::EType mType;
|
||||||
U32 mIndex;
|
U32 mIndex;
|
||||||
LLWearable* mWearable;
|
LLViewerWearable* mWearable;
|
||||||
U32 mTodo;
|
U32 mTodo;
|
||||||
LLPointer<LLRefCount> mCB;
|
LLPointer<LLRefCount> mCB;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,31 +2,25 @@
|
|||||||
* @file llappearance.h
|
* @file llappearance.h
|
||||||
* @brief LLAppearance class definition
|
* @brief LLAppearance class definition
|
||||||
*
|
*
|
||||||
* $LicenseInfo:firstyear=2002&license=viewergpl$
|
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
|
||||||
*
|
|
||||||
* Copyright (c) 2002-2009, Linden Research, Inc.
|
|
||||||
*
|
|
||||||
* Second Life Viewer Source Code
|
* Second Life Viewer Source Code
|
||||||
* The source code in this file ("Source Code") is provided by Linden Lab
|
* Copyright (C) 2010, Linden Research, Inc.
|
||||||
* 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://secondlifegrid.net/programs/open_source/licensing/gplv2
|
|
||||||
*
|
*
|
||||||
* There are special exceptions to the terms and conditions of the GPL as
|
* This library is free software; you can redistribute it and/or
|
||||||
* it is applied to this Source Code. View the full text of the exception
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
* in the file doc/FLOSS-exception.txt in this software distribution, or
|
* License as published by the Free Software Foundation;
|
||||||
* online at
|
* version 2.1 of the License only.
|
||||||
* http://secondlifegrid.net/programs/open_source/licensing/flossexception
|
|
||||||
*
|
*
|
||||||
* By copying, modifying or distributing this software, you acknowledge
|
* This library is distributed in the hope that it will be useful,
|
||||||
* that you have read and understood your obligations described above,
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* and agree to abide by those obligations.
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
|
* License along with this library; if not, write to the Free Software
|
||||||
* COMPLETENESS OR PERFORMANCE.
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*
|
||||||
|
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
|
||||||
* $/LicenseInfo$
|
* $/LicenseInfo$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -44,14 +38,14 @@ public:
|
|||||||
void addParam( S32 id, F32 value ) { mParamMap[id] = value; }
|
void addParam( S32 id, F32 value ) { mParamMap[id] = value; }
|
||||||
F32 getParam( S32 id, F32 defval ) { return get_if_there(mParamMap, id, defval ); }
|
F32 getParam( S32 id, F32 defval ) { return get_if_there(mParamMap, id, defval ); }
|
||||||
|
|
||||||
void addTexture( S32 te, const LLUUID& uuid ) { if( te < LLVOAvatarDefines::TEX_NUM_INDICES ) mTextures[te] = uuid; }
|
void addTexture( S32 te, const LLUUID& uuid ) { if( te < LLAvatarAppearanceDefines::TEX_NUM_INDICES ) mTextures[te] = uuid; }
|
||||||
const LLUUID& getTexture( S32 te ) { return ( te < LLVOAvatarDefines::TEX_NUM_INDICES ) ? mTextures[te] : LLUUID::null; }
|
const LLUUID& getTexture( S32 te ) { return ( te < LLAvatarAppearanceDefines::TEX_NUM_INDICES ) ? mTextures[te] : LLUUID::null; }
|
||||||
|
|
||||||
void clear() { mParamMap.clear(); for( S32 i=0; i<LLVOAvatarDefines::TEX_NUM_INDICES; i++ ) mTextures[i].setNull(); }
|
void clear() { mParamMap.clear(); for( S32 i=0; i<LLAvatarAppearanceDefines::TEX_NUM_INDICES; i++ ) mTextures[i].setNull(); }
|
||||||
|
|
||||||
typedef std::map<S32, F32> param_map_t;
|
typedef std::map<S32, F32> param_map_t;
|
||||||
param_map_t mParamMap;
|
param_map_t mParamMap;
|
||||||
LLUUID mTextures[LLVOAvatarDefines::TEX_NUM_INDICES];
|
LLUUID mTextures[LLAvatarAppearanceDefines::TEX_NUM_INDICES];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LL_LLAPPEARANCE_H
|
#endif // LL_LLAPPEARANCE_H
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ struct LLFoundData
|
|||||||
std::string mName;
|
std::string mName;
|
||||||
LLAssetType::EType mAssetType;
|
LLAssetType::EType mAssetType;
|
||||||
LLWearableType::EType mWearableType;
|
LLWearableType::EType mWearableType;
|
||||||
LLWearable* mWearable;
|
LLViewerWearable* mWearable;
|
||||||
bool mIsReplacement;
|
bool mIsReplacement;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -301,7 +301,7 @@ public:
|
|||||||
void recoverMissingWearable(LLWearableType::EType type);
|
void recoverMissingWearable(LLWearableType::EType type);
|
||||||
void clearCOFLinksForMissingWearables();
|
void clearCOFLinksForMissingWearables();
|
||||||
|
|
||||||
void onWearableAssetFetch(LLWearable *wearable);
|
void onWearableAssetFetch(LLViewerWearable *wearable);
|
||||||
void onAllComplete();
|
void onAllComplete();
|
||||||
|
|
||||||
// [SL:KB] - Patch: Appearance-COFCorruption | Checked: 2010-04-14 (Catznip-3.0.0a) | Added: Catznip-2.0.0a
|
// [SL:KB] - Patch: Appearance-COFCorruption | Checked: 2010-04-14 (Catznip-3.0.0a) | Added: Catznip-2.0.0a
|
||||||
@@ -331,7 +331,7 @@ private:
|
|||||||
typedef std::set<LLWearableHoldingPattern*> type_set_hp;
|
typedef std::set<LLWearableHoldingPattern*> type_set_hp;
|
||||||
static type_set_hp sActiveHoldingPatterns;
|
static type_set_hp sActiveHoldingPatterns;
|
||||||
bool mIsMostRecent;
|
bool mIsMostRecent;
|
||||||
std::set<LLWearable*> mLateArrivals;
|
std::set<LLViewerWearable*> mLateArrivals;
|
||||||
bool mIsAllComplete;
|
bool mIsAllComplete;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -564,7 +564,7 @@ bool LLWearableHoldingPattern::pollFetchCompletion()
|
|||||||
class RecoveredItemLinkCB: public LLInventoryCallback
|
class RecoveredItemLinkCB: public LLInventoryCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RecoveredItemLinkCB(LLWearableType::EType type, LLWearable *wearable, LLWearableHoldingPattern* holder):
|
RecoveredItemLinkCB(LLWearableType::EType type, LLViewerWearable *wearable, LLWearableHoldingPattern* holder):
|
||||||
mHolder(holder),
|
mHolder(holder),
|
||||||
mWearable(wearable),
|
mWearable(wearable),
|
||||||
mType(type)
|
mType(type)
|
||||||
@@ -611,14 +611,14 @@ public:
|
|||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
LLWearableHoldingPattern* mHolder;
|
LLWearableHoldingPattern* mHolder;
|
||||||
LLWearable *mWearable;
|
LLViewerWearable *mWearable;
|
||||||
LLWearableType::EType mType;
|
LLWearableType::EType mType;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RecoveredItemCB: public LLInventoryCallback
|
class RecoveredItemCB: public LLInventoryCallback
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RecoveredItemCB(LLWearableType::EType type, LLWearable *wearable, LLWearableHoldingPattern* holder):
|
RecoveredItemCB(LLWearableType::EType type, LLViewerWearable *wearable, LLWearableHoldingPattern* holder):
|
||||||
mHolder(holder),
|
mHolder(holder),
|
||||||
mWearable(wearable),
|
mWearable(wearable),
|
||||||
mType(type)
|
mType(type)
|
||||||
@@ -656,7 +656,7 @@ public:
|
|||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
LLWearableHoldingPattern* mHolder;
|
LLWearableHoldingPattern* mHolder;
|
||||||
LLWearable *mWearable;
|
LLViewerWearable *mWearable;
|
||||||
LLWearableType::EType mType;
|
LLWearableType::EType mType;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -672,7 +672,7 @@ void LLWearableHoldingPattern::recoverMissingWearable(LLWearableType::EType type
|
|||||||
LLNotificationsUtil::add("ReplacedMissingWearable");
|
LLNotificationsUtil::add("ReplacedMissingWearable");
|
||||||
lldebugs << "Wearable " << LLWearableType::getTypeLabel(type)
|
lldebugs << "Wearable " << LLWearableType::getTypeLabel(type)
|
||||||
<< " could not be downloaded. Replaced inventory item with default wearable." << llendl;
|
<< " could not be downloaded. Replaced inventory item with default wearable." << llendl;
|
||||||
LLWearable* wearable = LLWearableList::instance().createNewWearable(type);
|
LLViewerWearable* wearable = LLWearableList::instance().createNewWearable(type, gAgentAvatarp);
|
||||||
|
|
||||||
// Add a new one in the lost and found folder.
|
// Add a new one in the lost and found folder.
|
||||||
const LLUUID lost_and_found_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
|
const LLUUID lost_and_found_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
|
||||||
@@ -796,11 +796,11 @@ void LLWearableHoldingPattern::handleLateArrivals()
|
|||||||
iter != getFoundList().end(); ++iter)
|
iter != getFoundList().end(); ++iter)
|
||||||
{
|
{
|
||||||
LLFoundData& data = *iter;
|
LLFoundData& data = *iter;
|
||||||
for (std::set<LLWearable*>::iterator wear_it = mLateArrivals.begin();
|
for (std::set<LLViewerWearable*>::iterator wear_it = mLateArrivals.begin();
|
||||||
wear_it != mLateArrivals.end();
|
wear_it != mLateArrivals.end();
|
||||||
++wear_it)
|
++wear_it)
|
||||||
{
|
{
|
||||||
LLWearable *wearable = *wear_it;
|
LLViewerWearable *wearable = *wear_it;
|
||||||
|
|
||||||
if(wearable->getAssetID() == data.mAssetID)
|
if(wearable->getAssetID() == data.mAssetID)
|
||||||
{
|
{
|
||||||
@@ -860,7 +860,7 @@ void LLWearableHoldingPattern::resetTime(F32 timeout)
|
|||||||
mWaitTime.setTimerExpirySec(timeout);
|
mWaitTime.setTimerExpirySec(timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLWearableHoldingPattern::onWearableAssetFetch(LLWearable *wearable)
|
void LLWearableHoldingPattern::onWearableAssetFetch(LLViewerWearable *wearable)
|
||||||
{
|
{
|
||||||
if (!isMostRecent())
|
if (!isMostRecent())
|
||||||
{
|
{
|
||||||
@@ -911,7 +911,7 @@ void LLWearableHoldingPattern::onWearableAssetFetch(LLWearable *wearable)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void onWearableAssetFetch(LLWearable* wearable, void* data)
|
static void onWearableAssetFetch(LLViewerWearable* wearable, void* data)
|
||||||
{
|
{
|
||||||
LLWearableHoldingPattern* holder = (LLWearableHoldingPattern*)data;
|
LLWearableHoldingPattern* holder = (LLWearableHoldingPattern*)data;
|
||||||
holder->onWearableAssetFetch(wearable);
|
holder->onWearableAssetFetch(wearable);
|
||||||
@@ -1796,7 +1796,7 @@ void LLAppearanceMgr::updateAgentWearables(LLWearableHoldingPattern* holder, boo
|
|||||||
{
|
{
|
||||||
lldebugs << "updateAgentWearables()" << llendl;
|
lldebugs << "updateAgentWearables()" << llendl;
|
||||||
LLInventoryItem::item_array_t items;
|
LLInventoryItem::item_array_t items;
|
||||||
LLDynamicArray< LLWearable* > wearables;
|
LLDynamicArray< LLViewerWearable* > wearables;
|
||||||
// [RLVa:KB] - Checked: 2011-03-31 (RLVa-1.3.0f) | Added: RLVa-1.3.0f
|
// [RLVa:KB] - Checked: 2011-03-31 (RLVa-1.3.0f) | Added: RLVa-1.3.0f
|
||||||
uuid_vec_t idsCurrent; LLInventoryModel::item_array_t itemsNew;
|
uuid_vec_t idsCurrent; LLInventoryModel::item_array_t itemsNew;
|
||||||
if (rlv_handler_t::isEnabled())
|
if (rlv_handler_t::isEnabled())
|
||||||
@@ -1813,7 +1813,7 @@ void LLAppearanceMgr::updateAgentWearables(LLWearableHoldingPattern* holder, boo
|
|||||||
iter != holder->getFoundList().end(); ++iter)
|
iter != holder->getFoundList().end(); ++iter)
|
||||||
{
|
{
|
||||||
LLFoundData& data = *iter;
|
LLFoundData& data = *iter;
|
||||||
LLWearable* wearable = data.mWearable;
|
LLViewerWearable* wearable = data.mWearable;
|
||||||
if( wearable && ((S32)wearable->getType() == i) )
|
if( wearable && ((S32)wearable->getType() == i) )
|
||||||
{
|
{
|
||||||
LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem(data.mItemID);
|
LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem(data.mItemID);
|
||||||
@@ -1862,7 +1862,7 @@ void LLAppearanceMgr::updateAgentWearables(LLWearableHoldingPattern* holder, boo
|
|||||||
// We need to report removals before additions or scripts will get confused
|
// We need to report removals before additions or scripts will get confused
|
||||||
for (uuid_vec_t::const_iterator itItemID = idsCurrent.begin(); itItemID != idsCurrent.end(); ++itItemID)
|
for (uuid_vec_t::const_iterator itItemID = idsCurrent.begin(); itItemID != idsCurrent.end(); ++itItemID)
|
||||||
{
|
{
|
||||||
const LLWearable* pWearable = gAgentWearables.getWearableFromItemID(*itItemID);
|
const LLViewerWearable* pWearable = gAgentWearables.getWearableFromItemID(*itItemID);
|
||||||
if (pWearable)
|
if (pWearable)
|
||||||
RlvBehaviourNotifyHandler::onTakeOff(pWearable->getType(), true);
|
RlvBehaviourNotifyHandler::onTakeOff(pWearable->getType(), true);
|
||||||
}
|
}
|
||||||
@@ -2149,6 +2149,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering)
|
|||||||
// Fetch the wearables about to be worn.
|
// Fetch the wearables about to be worn.
|
||||||
LLWearableList::instance().getAsset(found.mAssetID,
|
LLWearableList::instance().getAsset(found.mAssetID,
|
||||||
found.mName,
|
found.mName,
|
||||||
|
gAgentAvatarp,
|
||||||
found.mAssetType,
|
found.mAssetType,
|
||||||
onWearableAssetFetch,
|
onWearableAssetFetch,
|
||||||
(void*)holder);
|
(void*)holder);
|
||||||
@@ -2514,7 +2515,7 @@ void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update
|
|||||||
std::string description = vitem->getIsLinkType() ? vitem->getDescription() : "";
|
std::string description = vitem->getIsLinkType() ? vitem->getDescription() : "";
|
||||||
if(description.empty())
|
if(description.empty())
|
||||||
{
|
{
|
||||||
LLWearable* wearable = gAgentWearables.getWearableFromItemID(vitem->getLinkedUUID());
|
LLViewerWearable* wearable = gAgentWearables.getWearableFromItemID(vitem->getLinkedUUID());
|
||||||
if(wearable)
|
if(wearable)
|
||||||
{
|
{
|
||||||
U32 index = gAgentWearables.getWearableIndex(wearable);
|
U32 index = gAgentWearables.getWearableIndex(wearable);
|
||||||
@@ -3355,7 +3356,7 @@ void LLAppearanceMgr::removeItemFromAvatar(const LLUUID& id_to_remove)
|
|||||||
if ( (!rlv_handler_t::isEnabled()) || (gRlvWearableLocks.canRemove(item_to_remove)) )
|
if ( (!rlv_handler_t::isEnabled()) || (gRlvWearableLocks.canRemove(item_to_remove)) )
|
||||||
// [/RLVa:KB]
|
// [/RLVa:KB]
|
||||||
{
|
{
|
||||||
const LLWearable* pWearable = gAgentWearables.getWearableFromItemID(item_to_remove->getLinkedUUID());
|
const LLViewerWearable* pWearable = gAgentWearables.getWearableFromItemID(item_to_remove->getLinkedUUID());
|
||||||
if ( (pWearable) && (LLAssetType::AT_BODYPART != pWearable->getAssetType()) )
|
if ( (pWearable) && (LLAssetType::AT_BODYPART != pWearable->getAssetType()) )
|
||||||
{
|
{
|
||||||
U32 idxWearable = gAgentWearables.getWearableIndex(pWearable);
|
U32 idxWearable = gAgentWearables.getWearableIndex(pWearable);
|
||||||
|
|||||||
@@ -584,6 +584,15 @@ LLAppViewer::~LLAppViewer()
|
|||||||
removeMarkerFile();
|
removeMarkerFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class LLUITranslationBridge : public LLTranslationBridge
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual std::string getString(const std::string &xml_desc)
|
||||||
|
{
|
||||||
|
return LLTrans::getString(xml_desc);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
bool LLAppViewer::init()
|
bool LLAppViewer::init()
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
@@ -595,6 +604,10 @@ bool LLAppViewer::init()
|
|||||||
//
|
//
|
||||||
LLFastTimer::reset();
|
LLFastTimer::reset();
|
||||||
|
|
||||||
|
// initialize LLWearableType translation bridge.
|
||||||
|
// Memory will be cleaned up in ::cleanupClass()
|
||||||
|
LLWearableType::initClass(new LLUITranslationBridge());
|
||||||
|
|
||||||
// <edit>
|
// <edit>
|
||||||
// We can call this early.
|
// We can call this early.
|
||||||
LLFrameTimer::global_initialization();
|
LLFrameTimer::global_initialization();
|
||||||
@@ -1573,6 +1586,8 @@ bool LLAppViewer::cleanup()
|
|||||||
|
|
||||||
LLViewerObject::cleanupVOClasses();
|
LLViewerObject::cleanupVOClasses();
|
||||||
|
|
||||||
|
LLAvatarAppearance::cleanupClass();
|
||||||
|
|
||||||
LLPostProcess::cleanupClass();
|
LLPostProcess::cleanupClass();
|
||||||
|
|
||||||
LLTracker::cleanupInstance();
|
LLTracker::cleanupInstance();
|
||||||
|
|||||||
@@ -54,8 +54,8 @@
|
|||||||
#include "llviewercontrol.h"
|
#include "llviewercontrol.h"
|
||||||
#include "llviewerobjectlist.h"
|
#include "llviewerobjectlist.h"
|
||||||
#include "llviewermenufile.h"
|
#include "llviewermenufile.h"
|
||||||
|
#include "llviewertexlayer.h"
|
||||||
#include "llviewerwindow.h"
|
#include "llviewerwindow.h"
|
||||||
#include "lltexlayer.h"
|
|
||||||
#include "lltrans.h"
|
#include "lltrans.h"
|
||||||
|
|
||||||
// library includes
|
// library includes
|
||||||
@@ -446,7 +446,7 @@ LLSendTexLayerResponder::LLSendTexLayerResponder(const LLSD& post_data,
|
|||||||
|
|
||||||
LLSendTexLayerResponder::~LLSendTexLayerResponder()
|
LLSendTexLayerResponder::~LLSendTexLayerResponder()
|
||||||
{
|
{
|
||||||
// mBakedUploadData is normally deleted by calls to LLTexLayerSetBuffer::onTextureUploadComplete() below
|
// mBakedUploadData is normally deleted by calls to LLViewerTexLayerSetBuffer::onTextureUploadComplete() below
|
||||||
if (mBakedUploadData)
|
if (mBakedUploadData)
|
||||||
{ // ...but delete it in the case where uploadComplete() is never called
|
{ // ...but delete it in the case where uploadComplete() is never called
|
||||||
delete mBakedUploadData;
|
delete mBakedUploadData;
|
||||||
@@ -467,12 +467,12 @@ void LLSendTexLayerResponder::uploadComplete(const LLSD& content)
|
|||||||
if (result == "complete"
|
if (result == "complete"
|
||||||
&& mBakedUploadData != NULL)
|
&& mBakedUploadData != NULL)
|
||||||
{ // Invoke
|
{ // Invoke
|
||||||
LLTexLayerSetBuffer::onTextureUploadComplete(new_id, (void*) mBakedUploadData, 0, LL_EXSTAT_NONE);
|
LLViewerTexLayerSetBuffer::onTextureUploadComplete(new_id, (void*) mBakedUploadData, 0, LL_EXSTAT_NONE);
|
||||||
mBakedUploadData = NULL; // deleted in onTextureUploadComplete()
|
mBakedUploadData = NULL; // deleted in onTextureUploadComplete()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Invoke the original callback with an error result
|
{ // Invoke the original callback with an error result
|
||||||
LLTexLayerSetBuffer::onTextureUploadComplete(new_id, (void*) mBakedUploadData, -1, LL_EXSTAT_NONE);
|
LLViewerTexLayerSetBuffer::onTextureUploadComplete(new_id, (void*) mBakedUploadData, -1, LL_EXSTAT_NONE);
|
||||||
mBakedUploadData = NULL; // deleted in onTextureUploadComplete()
|
mBakedUploadData = NULL; // deleted in onTextureUploadComplete()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -482,7 +482,7 @@ void LLSendTexLayerResponder::error(U32 statusNum, const std::string& reason)
|
|||||||
llinfos << "status: " << statusNum << " reason: " << reason << llendl;
|
llinfos << "status: " << statusNum << " reason: " << reason << llendl;
|
||||||
|
|
||||||
// Invoke the original callback with an error result
|
// Invoke the original callback with an error result
|
||||||
LLTexLayerSetBuffer::onTextureUploadComplete(LLUUID(), (void*) mBakedUploadData, -1, LL_EXSTAT_NONE);
|
LLViewerTexLayerSetBuffer::onTextureUploadComplete(LLUUID(), (void*) mBakedUploadData, -1, LL_EXSTAT_NONE);
|
||||||
mBakedUploadData = NULL; // deleted in onTextureUploadComplete()
|
mBakedUploadData = NULL; // deleted in onTextureUploadComplete()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ void LLStandardBumpmap::addstandard()
|
|||||||
gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mLabel = label;
|
gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mLabel = label;
|
||||||
gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage =
|
gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage =
|
||||||
LLViewerTextureManager::getFetchedTexture(LLUUID(bump_image_id));
|
LLViewerTextureManager::getFetchedTexture(LLUUID(bump_image_id));
|
||||||
gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setBoostLevel(LLViewerTexture::BOOST_BUMP) ;
|
gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setBoostLevel(LLGLTexture::BOOST_BUMP) ;
|
||||||
gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setLoadedCallback(LLBumpImageList::onSourceStandardLoaded, 0, TRUE, FALSE, NULL, NULL );
|
gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setLoadedCallback(LLBumpImageList::onSourceStandardLoaded, 0, TRUE, FALSE, NULL, NULL );
|
||||||
gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->forceToSaveRawImage(0) ;
|
gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->forceToSaveRawImage(0) ;
|
||||||
LLStandardBumpmap::sStandardBumpmapCount++;
|
LLStandardBumpmap::sStandardBumpmapCount++;
|
||||||
@@ -1075,7 +1075,7 @@ LLViewerTexture* LLBumpImageList::getBrightnessDarknessImage(LLViewerFetchedText
|
|||||||
src_image->getHeight() != bump->getHeight())// ||
|
src_image->getHeight() != bump->getHeight())// ||
|
||||||
//(LLPipeline::sRenderDeferred && bump->getComponents() != 4))
|
//(LLPipeline::sRenderDeferred && bump->getComponents() != 4))
|
||||||
{
|
{
|
||||||
src_image->setBoostLevel(LLViewerTexture::BOOST_BUMP) ;
|
src_image->setBoostLevel(LLGLTexture::BOOST_BUMP) ;
|
||||||
src_image->setLoadedCallback( callback_func, 0, TRUE, FALSE, new LLUUID(src_image->getID()), NULL );
|
src_image->setLoadedCallback( callback_func, 0, TRUE, FALSE, new LLUUID(src_image->getID()), NULL );
|
||||||
src_image->forceToSaveRawImage(0) ;
|
src_image->forceToSaveRawImage(0) ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerTexture *texturep) :
|
|||||||
sDetailScale = 1.f/gSavedSettings.getF32("RenderTerrainScale");
|
sDetailScale = 1.f/gSavedSettings.getF32("RenderTerrainScale");
|
||||||
sDetailMode = gSavedSettings.getS32("RenderTerrainDetail");
|
sDetailMode = gSavedSettings.getS32("RenderTerrainDetail");
|
||||||
mAlphaRampImagep = LLViewerTextureManager::getFetchedTextureFromFile("alpha_gradient.tga",
|
mAlphaRampImagep = LLViewerTextureManager::getFetchedTextureFromFile("alpha_gradient.tga",
|
||||||
TRUE, LLViewerTexture::BOOST_UI,
|
TRUE, LLGLTexture::BOOST_UI,
|
||||||
LLViewerTexture::FETCHED_TEXTURE,
|
LLViewerTexture::FETCHED_TEXTURE,
|
||||||
format, int_format,
|
format, int_format,
|
||||||
LLUUID("e97cf410-8e61-7005-ec06-629eba4cd1fb"));
|
LLUUID("e97cf410-8e61-7005-ec06-629eba4cd1fb"));
|
||||||
@@ -84,7 +84,7 @@ LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerTexture *texturep) :
|
|||||||
mAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP);
|
mAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP);
|
||||||
|
|
||||||
m2DAlphaRampImagep = LLViewerTextureManager::getFetchedTextureFromFile("alpha_gradient_2d.j2c",
|
m2DAlphaRampImagep = LLViewerTextureManager::getFetchedTextureFromFile("alpha_gradient_2d.j2c",
|
||||||
TRUE, LLViewerTexture::BOOST_UI,
|
TRUE, LLGLTexture::BOOST_UI,
|
||||||
LLViewerTexture::FETCHED_TEXTURE,
|
LLViewerTexture::FETCHED_TEXTURE,
|
||||||
format, int_format,
|
format, int_format,
|
||||||
LLUUID("38b86f85-2575-52a9-a531-23108d8da837"));
|
LLUUID("38b86f85-2575-52a9-a531-23108d8da837"));
|
||||||
@@ -92,7 +92,7 @@ LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerTexture *texturep) :
|
|||||||
//gGL.getTexUnit(0)->bind(m2DAlphaRampImagep.get());
|
//gGL.getTexUnit(0)->bind(m2DAlphaRampImagep.get());
|
||||||
m2DAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP);
|
m2DAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP);
|
||||||
|
|
||||||
mTexturep->setBoostLevel(LLViewerTexture::BOOST_TERRAIN);
|
mTexturep->setBoostLevel(LLGLTexture::BOOST_TERRAIN);
|
||||||
|
|
||||||
//gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
//gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||||
}
|
}
|
||||||
@@ -177,7 +177,7 @@ void LLDrawPoolTerrain::render(S32 pass)
|
|||||||
LLVLComposition *compp = regionp->getComposition();
|
LLVLComposition *compp = regionp->getComposition();
|
||||||
for (S32 i = 0; i < 4; i++)
|
for (S32 i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
compp->mDetailTextures[i]->setBoostLevel(LLViewerTexture::BOOST_TERRAIN);
|
compp->mDetailTextures[i]->setBoostLevel(LLGLTexture::BOOST_TERRAIN);
|
||||||
compp->mDetailTextures[i]->addTextureStats(1024.f*1024.f); // assume large pixel area
|
compp->mDetailTextures[i]->addTextureStats(1024.f*1024.f); // assume large pixel area
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,11 +74,11 @@ LLVector3 LLDrawPoolWater::sLightDir;
|
|||||||
LLDrawPoolWater::LLDrawPoolWater() :
|
LLDrawPoolWater::LLDrawPoolWater() :
|
||||||
LLFacePool(POOL_WATER)
|
LLFacePool(POOL_WATER)
|
||||||
{
|
{
|
||||||
mHBTex[0] = LLViewerTextureManager::getFetchedTexture(gSunTextureID, TRUE, LLViewerTexture::BOOST_UI);
|
mHBTex[0] = LLViewerTextureManager::getFetchedTexture(gSunTextureID, TRUE, LLGLTexture::BOOST_UI);
|
||||||
gGL.getTexUnit(0)->bind(mHBTex[0]) ;
|
gGL.getTexUnit(0)->bind(mHBTex[0]) ;
|
||||||
mHBTex[0]->setAddressMode(LLTexUnit::TAM_CLAMP);
|
mHBTex[0]->setAddressMode(LLTexUnit::TAM_CLAMP);
|
||||||
|
|
||||||
mHBTex[1] = LLViewerTextureManager::getFetchedTexture(gMoonTextureID, TRUE, LLViewerTexture::BOOST_UI);
|
mHBTex[1] = LLViewerTextureManager::getFetchedTexture(gMoonTextureID, TRUE, LLGLTexture::BOOST_UI);
|
||||||
gGL.getTexUnit(0)->bind(mHBTex[1]);
|
gGL.getTexUnit(0)->bind(mHBTex[1]);
|
||||||
mHBTex[1]->setAddressMode(LLTexUnit::TAM_CLAMP);
|
mHBTex[1]->setAddressMode(LLTexUnit::TAM_CLAMP);
|
||||||
|
|
||||||
|
|||||||
@@ -327,7 +327,7 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass)
|
|||||||
LLGLDepthTest depth(GL_TRUE, GL_FALSE);
|
LLGLDepthTest depth(GL_TRUE, GL_FALSE);
|
||||||
LLGLDisable clip(GL_CLIP_PLANE0);
|
LLGLDisable clip(GL_CLIP_PLANE0);
|
||||||
|
|
||||||
gGL.setColorMask(true, false);
|
gGL.setColorMask(true, false); //Just in case.
|
||||||
|
|
||||||
LLGLSquashToFarClip far_clip(glh_get_current_projection());
|
LLGLSquashToFarClip far_clip(glh_get_current_projection());
|
||||||
|
|
||||||
@@ -355,8 +355,6 @@ void LLDrawPoolWLSky::renderDeferred(S32 pass)
|
|||||||
|
|
||||||
renderSkyClouds(camHeightLocal);
|
renderSkyClouds(camHeightLocal);
|
||||||
|
|
||||||
gGL.setColorMask(true, true);
|
|
||||||
|
|
||||||
//gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
//gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -377,7 +375,7 @@ void LLDrawPoolWLSky::render(S32 pass)
|
|||||||
|
|
||||||
LLGLSquashToFarClip far_clip(glh_get_current_projection());
|
LLGLSquashToFarClip far_clip(glh_get_current_projection());
|
||||||
|
|
||||||
gGL.setColorMask(true, false);
|
gGL.setColorMask(true, false); //Just in case.
|
||||||
|
|
||||||
renderSkyHaze(camHeightLocal);
|
renderSkyHaze(camHeightLocal);
|
||||||
|
|
||||||
@@ -406,8 +404,6 @@ void LLDrawPoolWLSky::render(S32 pass)
|
|||||||
renderSkyClouds(camHeightLocal);
|
renderSkyClouds(camHeightLocal);
|
||||||
|
|
||||||
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
|
||||||
|
|
||||||
gGL.setColorMask(true, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLDrawPoolWLSky::prerender()
|
void LLDrawPoolWLSky::prerender()
|
||||||
|
|||||||
@@ -72,8 +72,8 @@ public:
|
|||||||
|
|
||||||
/*virtual*/ S8 getType() const ;
|
/*virtual*/ S8 getType() const ;
|
||||||
|
|
||||||
S32 getOriginX() { return mOrigin.mX; }
|
S32 getOriginX() const { return mOrigin.mX; }
|
||||||
S32 getOriginY() { return mOrigin.mY; }
|
S32 getOriginY() const { return mOrigin.mY; }
|
||||||
|
|
||||||
S32 getSize() { return mFullWidth * mFullHeight * mComponents; }
|
S32 getSize() { return mFullWidth * mFullHeight * mComponents; }
|
||||||
|
|
||||||
|
|||||||
@@ -563,8 +563,8 @@ void LLFace::renderSelected(LLViewerTexture *imagep, const LLColor4& color)
|
|||||||
/* removed in lieu of raycast uv detection
|
/* removed in lieu of raycast uv detection
|
||||||
void LLFace::renderSelectedUV()
|
void LLFace::renderSelectedUV()
|
||||||
{
|
{
|
||||||
LLViewerTexture* red_blue_imagep = LLViewerTextureManager::getFetchedTextureFromFile("uv_test1.j2c", TRUE, LLViewerTexture::BOOST_UI);
|
LLViewerTexture* red_blue_imagep = LLViewerTextureManager::getFetchedTextureFromFile("uv_test1.j2c", TRUE, LLGLTexture::BOOST_UI);
|
||||||
LLViewerTexture* green_imagep = LLViewerTextureManager::getFetchedTextureFromFile("uv_test2.tga", TRUE, LLViewerTexture::BOOST_UI);
|
LLViewerTexture* green_imagep = LLViewerTextureManager::getFetchedTextureFromFile("uv_test2.tga", TRUE, LLGLTexture::BOOST_UI);
|
||||||
|
|
||||||
LLGLSUVSelect object_select;
|
LLGLSUVSelect object_select;
|
||||||
|
|
||||||
|
|||||||
@@ -1547,12 +1547,12 @@ BOOL LLPreviewAnimation::render()
|
|||||||
|
|
||||||
gGL.flush();
|
gGL.flush();
|
||||||
|
|
||||||
LLVector3 target_pos = avatarp->mRoot.getWorldPosition();
|
LLVector3 target_pos = avatarp->mRoot->getWorldPosition();
|
||||||
|
|
||||||
LLQuaternion camera_rot = LLQuaternion(mCameraPitch, LLVector3::y_axis) *
|
LLQuaternion camera_rot = LLQuaternion(mCameraPitch, LLVector3::y_axis) *
|
||||||
LLQuaternion(mCameraYaw, LLVector3::z_axis);
|
LLQuaternion(mCameraYaw, LLVector3::z_axis);
|
||||||
|
|
||||||
LLQuaternion av_rot = avatarp->mRoot.getWorldRotation() * camera_rot;
|
LLQuaternion av_rot = avatarp->mRoot->getWorldRotation() * camera_rot;
|
||||||
LLViewerCamera::getInstance()->setOriginAndLookAt(
|
LLViewerCamera::getInstance()->setOriginAndLookAt(
|
||||||
target_pos + ((LLVector3(mCameraDistance, 0.f, 0.f) + mCameraOffset) * av_rot), // camera
|
target_pos + ((LLVector3(mCameraDistance, 0.f, 0.f) + mCameraOffset) * av_rot), // camera
|
||||||
LLVector3::z_axis, // up
|
LLVector3::z_axis, // up
|
||||||
|
|||||||
@@ -40,7 +40,7 @@
|
|||||||
#include "llviewerobjectlist.h"
|
#include "llviewerobjectlist.h"
|
||||||
#include "llvoavatar.h"
|
#include "llvoavatar.h"
|
||||||
|
|
||||||
using namespace LLVOAvatarDefines;
|
using namespace LLAvatarAppearanceDefines;
|
||||||
|
|
||||||
LLFloaterAvatarTextures::LLFloaterAvatarTextures(const LLUUID& id) :
|
LLFloaterAvatarTextures::LLFloaterAvatarTextures(const LLUUID& id) :
|
||||||
LLFloater(std::string("avatar_texture_debug")),
|
LLFloater(std::string("avatar_texture_debug")),
|
||||||
@@ -72,7 +72,7 @@ BOOL LLFloaterAvatarTextures::postBuild()
|
|||||||
{
|
{
|
||||||
for (U32 i=0; i < TEX_NUM_INDICES; i++)
|
for (U32 i=0; i < TEX_NUM_INDICES; i++)
|
||||||
{
|
{
|
||||||
const std::string tex_name = LLVOAvatarDictionary::getInstance()->getTexture(ETextureIndex(i))->mName;
|
const std::string tex_name = LLAvatarAppearanceDictionary::getInstance()->getTexture(ETextureIndex(i))->mName;
|
||||||
mTextures[i] = getChild<LLTextureCtrl>(tex_name);
|
mTextures[i] = getChild<LLTextureCtrl>(tex_name);
|
||||||
}
|
}
|
||||||
mTitle = getTitle();
|
mTitle = getTitle();
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
#include "llfloater.h"
|
#include "llfloater.h"
|
||||||
#include "lluuid.h"
|
#include "lluuid.h"
|
||||||
#include "llstring.h"
|
#include "llstring.h"
|
||||||
#include "llvoavatardefines.h"
|
#include "llavatarappearancedefines.h"
|
||||||
|
|
||||||
class LLTextureCtrl;
|
class LLTextureCtrl;
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ private:
|
|||||||
private:
|
private:
|
||||||
LLUUID mID;
|
LLUUID mID;
|
||||||
std::string mTitle;
|
std::string mTitle;
|
||||||
LLTextureCtrl* mTextures[LLVOAvatarDefines::TEX_NUM_INDICES];
|
LLTextureCtrl* mTextures[LLAvatarAppearanceDefines::TEX_NUM_INDICES];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -54,6 +54,7 @@
|
|||||||
#include "llviewerregion.h"
|
#include "llviewerregion.h"
|
||||||
#include "lluictrlfactory.h"
|
#include "lluictrlfactory.h"
|
||||||
#include "llviewerwindow.h"
|
#include "llviewerwindow.h"
|
||||||
|
#include "llinventoryicon.h"
|
||||||
|
|
||||||
#include "hippogridmanager.h"
|
#include "hippogridmanager.h"
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@
|
|||||||
#include "statemachine/aifilepicker.h"
|
#include "statemachine/aifilepicker.h"
|
||||||
#include "hippogridmanager.h"
|
#include "hippogridmanager.h"
|
||||||
|
|
||||||
using namespace LLVOAvatarDefines;
|
using namespace LLAvatarAppearanceDefines;
|
||||||
|
|
||||||
// *TODO:translate : The ui xml for this really needs to be integrated with the appearance paramaters
|
// *TODO:translate : The ui xml for this really needs to be integrated with the appearance paramaters
|
||||||
|
|
||||||
@@ -544,7 +544,7 @@ void LLFloaterCustomize::onBtnExport_continued(AIFilePicker* filepicker)
|
|||||||
for( S32 i=0; i < LLWearableType::WT_COUNT; i++ )
|
for( S32 i=0; i < LLWearableType::WT_COUNT; i++ )
|
||||||
{
|
{
|
||||||
is_modifiable = FALSE;
|
is_modifiable = FALSE;
|
||||||
LLWearable* old_wearable = gAgentWearables.getWearable((LLWearableType::EType)i, 0); // TODO: MULTI-WEARABLE
|
LLViewerWearable* old_wearable = gAgentWearables.getViewerWearable((LLWearableType::EType)i, 0); // TODO: MULTI-WEARABLE
|
||||||
if( old_wearable )
|
if( old_wearable )
|
||||||
{
|
{
|
||||||
item = gInventory.getItem(old_wearable->getItemID());
|
item = gInventory.getItem(old_wearable->getItemID());
|
||||||
@@ -568,7 +568,7 @@ void LLFloaterCustomize::onBtnExport_continued(AIFilePicker* filepicker)
|
|||||||
for( S32 i=0; i < LLWearableType::WT_COUNT; i++ )
|
for( S32 i=0; i < LLWearableType::WT_COUNT; i++ )
|
||||||
{
|
{
|
||||||
is_modifiable = FALSE;
|
is_modifiable = FALSE;
|
||||||
LLWearable* old_wearable = gAgentWearables.getWearable((LLWearableType::EType)i, 0); // TODO: MULTI-WEARABLE
|
LLViewerWearable* old_wearable = gAgentWearables.getViewerWearable((LLWearableType::EType)i, 0); // TODO: MULTI-WEARABLE
|
||||||
if( old_wearable )
|
if( old_wearable )
|
||||||
{
|
{
|
||||||
item = gInventory.getItem(old_wearable->getItemID());
|
item = gInventory.getItem(old_wearable->getItemID());
|
||||||
@@ -725,7 +725,7 @@ BOOL LLFloaterCustomize::isDirty() const
|
|||||||
LLWearableType::EType cur = getCurrentWearableType();
|
LLWearableType::EType cur = getCurrentWearableType();
|
||||||
for(U32 i = 0; i < gAgentWearables.getWearableCount(cur); ++i)
|
for(U32 i = 0; i < gAgentWearables.getWearableCount(cur); ++i)
|
||||||
{
|
{
|
||||||
LLWearable* wearable = gAgentWearables.getWearable(cur,i);
|
LLViewerWearable* wearable = gAgentWearables.getViewerWearable(cur,i);
|
||||||
if(wearable && wearable->isDirty())
|
if(wearable && wearable->isDirty())
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -859,7 +859,7 @@ bool LLFloaterCustomize::onSaveDialog(const LLSD& notification, const LLSD& resp
|
|||||||
|
|
||||||
for(U32 i = 0;i < gAgentWearables.getWearableCount(cur);++i)
|
for(U32 i = 0;i < gAgentWearables.getWearableCount(cur);++i)
|
||||||
{
|
{
|
||||||
LLWearable* wearable = gAgentWearables.getWearable(cur,i);
|
LLViewerWearable* wearable = gAgentWearables.getViewerWearable(cur,i);
|
||||||
if(wearable && wearable->isDirty())
|
if(wearable && wearable->isDirty())
|
||||||
{
|
{
|
||||||
switch( option )
|
switch( option )
|
||||||
@@ -938,7 +938,7 @@ void LLFloaterCustomize::updateInventoryUI()
|
|||||||
panel = mWearablePanelList[i];
|
panel = mWearablePanelList[i];
|
||||||
if(panel)
|
if(panel)
|
||||||
{
|
{
|
||||||
LLWearable* wearable = panel->getWearable();
|
LLViewerWearable* wearable = panel->getWearable();
|
||||||
if(wearable)
|
if(wearable)
|
||||||
item = gInventory.getItem(wearable->getItemID());
|
item = gInventory.getItem(wearable->getItemID());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,21 +82,23 @@ const S32 PREVIEW_TEXTURE_HEIGHT = 300;
|
|||||||
LLFloaterImagePreview::LLFloaterImagePreview(const std::string& filename) :
|
LLFloaterImagePreview::LLFloaterImagePreview(const std::string& filename) :
|
||||||
LLFloaterNameDesc(filename),
|
LLFloaterNameDesc(filename),
|
||||||
mAvatarPreview(NULL),
|
mAvatarPreview(NULL),
|
||||||
mSculptedPreview(NULL)
|
mSculptedPreview(NULL),
|
||||||
|
mLastMouseX(0),
|
||||||
|
mLastMouseY(0),
|
||||||
|
mImagep(NULL)
|
||||||
{
|
{
|
||||||
mLastMouseX = 0;
|
|
||||||
mLastMouseY = 0;
|
|
||||||
mImagep = NULL ;
|
|
||||||
loadImage(mFilenameAndPath);
|
loadImage(mFilenameAndPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
// <edit>
|
// <edit>
|
||||||
LLFloaterImagePreview::LLFloaterImagePreview(const std::string& filename, void* item) :
|
LLFloaterImagePreview::LLFloaterImagePreview(const std::string& filename, void* item) :
|
||||||
LLFloaterNameDesc(filename, item)
|
LLFloaterNameDesc(filename, item),
|
||||||
|
mAvatarPreview(NULL),
|
||||||
|
mSculptedPreview(NULL),
|
||||||
|
mLastMouseX(0),
|
||||||
|
mLastMouseY(0),
|
||||||
|
mImagep(NULL)
|
||||||
{
|
{
|
||||||
mLastMouseX = 0;
|
|
||||||
mLastMouseY = 0;
|
|
||||||
mImagep = NULL ;
|
|
||||||
loadImage(mFilenameAndPath);
|
loadImage(mFilenameAndPath);
|
||||||
}
|
}
|
||||||
// </edit>
|
// </edit>
|
||||||
@@ -664,7 +666,7 @@ S8 LLImagePreviewAvatar::getType() const
|
|||||||
|
|
||||||
void LLImagePreviewAvatar::setPreviewTarget(const std::string& joint_name, const std::string& mesh_name, LLImageRaw* imagep, F32 distance, BOOL male)
|
void LLImagePreviewAvatar::setPreviewTarget(const std::string& joint_name, const std::string& mesh_name, LLImageRaw* imagep, F32 distance, BOOL male)
|
||||||
{
|
{
|
||||||
mTargetJoint = mDummyAvatar->mRoot.findJoint(joint_name);
|
mTargetJoint = mDummyAvatar->mRoot->findJoint(joint_name);
|
||||||
// clear out existing test mesh
|
// clear out existing test mesh
|
||||||
if (mTargetMesh)
|
if (mTargetMesh)
|
||||||
{
|
{
|
||||||
@@ -683,9 +685,9 @@ void LLImagePreviewAvatar::setPreviewTarget(const std::string& joint_name, const
|
|||||||
mDummyAvatar->updateVisualParams();
|
mDummyAvatar->updateVisualParams();
|
||||||
mDummyAvatar->updateGeometry(mDummyAvatar->mDrawable);
|
mDummyAvatar->updateGeometry(mDummyAvatar->mDrawable);
|
||||||
}
|
}
|
||||||
mDummyAvatar->mRoot.setVisible(FALSE, TRUE);
|
mDummyAvatar->mRoot->setVisible(FALSE, TRUE);
|
||||||
|
|
||||||
mTargetMesh = (LLViewerJointMesh*)mDummyAvatar->mRoot.findJoint(mesh_name);
|
mTargetMesh = dynamic_cast<LLViewerJointMesh*>(mDummyAvatar->mRoot->findJoint(mesh_name));
|
||||||
mTargetMesh->setTestTexture(mTextureName);
|
mTargetMesh->setTestTexture(mTextureName);
|
||||||
mTargetMesh->setVisible(TRUE, FALSE);
|
mTargetMesh->setVisible(TRUE, FALSE);
|
||||||
mCameraDistance = distance;
|
mCameraDistance = distance;
|
||||||
@@ -702,7 +704,7 @@ void LLImagePreviewAvatar::clearPreviewTexture(const std::string& mesh_name)
|
|||||||
{
|
{
|
||||||
if (mDummyAvatar)
|
if (mDummyAvatar)
|
||||||
{
|
{
|
||||||
LLViewerJointMesh *mesh = (LLViewerJointMesh*)mDummyAvatar->mRoot.findJoint(mesh_name);
|
LLViewerJointMesh *mesh = dynamic_cast<LLViewerJointMesh*>(mDummyAvatar->mRoot->findJoint(mesh_name));
|
||||||
// clear out existing test mesh
|
// clear out existing test mesh
|
||||||
if (mesh)
|
if (mesh)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2487,7 +2487,7 @@ void LLModelLoader::loadTextures()
|
|||||||
if (!material.mDiffuseMapFilename.empty())
|
if (!material.mDiffuseMapFilename.empty())
|
||||||
{
|
{
|
||||||
material.mDiffuseMap =
|
material.mDiffuseMap =
|
||||||
LLViewerTextureManager::getFetchedTextureFromUrl("file://" + material.mDiffuseMapFilename, TRUE, LLViewerTexture::BOOST_PREVIEW);
|
LLViewerTextureManager::getFetchedTextureFromUrl("file://" + material.mDiffuseMapFilename, TRUE, LLGLTexture::BOOST_PREVIEW);
|
||||||
material.mDiffuseMap->setLoadedCallback(LLModelPreview::textureLoadedCallback, 0, TRUE, FALSE, mPreview, NULL, FALSE);
|
material.mDiffuseMap->setLoadedCallback(LLModelPreview::textureLoadedCallback, 0, TRUE, FALSE, mPreview, NULL, FALSE);
|
||||||
material.mDiffuseMap->forceToSaveRawImage(0, F32_MAX);
|
material.mDiffuseMap->forceToSaveRawImage(0, F32_MAX);
|
||||||
mNumOfFetchingTextures++;
|
mNumOfFetchingTextures++;
|
||||||
|
|||||||
@@ -938,7 +938,7 @@ void LLFloaterReporter::takeScreenshot()
|
|||||||
|
|
||||||
// store in the image list so it doesn't try to fetch from the server
|
// store in the image list so it doesn't try to fetch from the server
|
||||||
LLPointer<LLViewerFetchedTexture> image_in_list =
|
LLPointer<LLViewerFetchedTexture> image_in_list =
|
||||||
LLViewerTextureManager::getFetchedTexture(mResourceDatap->mAssetInfo.mUuid, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::FETCHED_TEXTURE);
|
LLViewerTextureManager::getFetchedTexture(mResourceDatap->mAssetInfo.mUuid, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::FETCHED_TEXTURE);
|
||||||
image_in_list->createGLTexture(0, raw, 0, TRUE, LLViewerTexture::OTHER);
|
image_in_list->createGLTexture(0, raw, 0, TRUE, LLViewerTexture::OTHER);
|
||||||
|
|
||||||
// the texture picker then uses that texture
|
// the texture picker then uses that texture
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ void LLFloaterScriptDebug::addScriptLine(const std::string &utf8mesg, const std:
|
|||||||
|
|
||||||
if (objectp)
|
if (objectp)
|
||||||
{
|
{
|
||||||
objectp->setIcon(LLViewerTextureManager::getFetchedTextureFromFile("script_error.j2c", TRUE, LLViewerTexture::BOOST_UI));
|
objectp->setIcon(LLViewerTextureManager::getFetchedTextureFromFile("script_error.j2c", TRUE, LLGLTexture::BOOST_UI));
|
||||||
floater_label = llformat("%s(%.2f, %.2f)", user_name.c_str(), objectp->getPositionRegion().mV[VX], objectp->getPositionRegion().mV[VY]);
|
floater_label = llformat("%s(%.2f, %.2f)", user_name.c_str(), objectp->getPositionRegion().mV[VX], objectp->getPositionRegion().mV[VY]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ void LLFloaterVFS::onClickAdd_continued(void* user_data, AIFilePicker* filepicke
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LLPointer<LLViewerFetchedTexture> imagep = new LLViewerFetchedTexture(asset_id);
|
LLPointer<LLViewerFetchedTexture> imagep = new LLViewerFetchedTexture(asset_id);
|
||||||
imagep->createGLTexture(0, image_raw, 0, TRUE, LLViewerTexture::BOOST_NONE);
|
imagep->createGLTexture(0, image_raw, 0, TRUE, LLGLTexture::BOOST_NONE);
|
||||||
gTextureList.addImage(imagep);
|
gTextureList.addImage(imagep);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -691,7 +691,7 @@ bool LLHUDEffectLookAt::calcTargetPosition()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
target_rot = target_av->mRoot.getWorldRotation();
|
target_rot = target_av->mRoot->getWorldRotation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // target obj is not an avatar
|
else // target obj is not an avatar
|
||||||
|
|||||||
@@ -305,7 +305,7 @@ void LLInventoryBackup::download(LLInventoryItem* item, LLFloater* floater, load
|
|||||||
switch(item->getType())
|
switch(item->getType())
|
||||||
{
|
{
|
||||||
case LLAssetType::AT_TEXTURE:
|
case LLAssetType::AT_TEXTURE:
|
||||||
imagep = LLViewerTextureManager::getFetchedTexture(item->getAssetUUID(), MIPMAP_TRUE, LLViewerTexture::BOOST_UI);
|
imagep = LLViewerTextureManager::getFetchedTexture(item->getAssetUUID(), MIPMAP_TRUE, LLGLTexture::BOOST_UI);
|
||||||
imagep->setLoadedCallback( onImage, 0, TRUE, FALSE, userdata, NULL ); // was setLoadedCallbackNoAuth
|
imagep->setLoadedCallback( onImage, 0, TRUE, FALSE, userdata, NULL ); // was setLoadedCallbackNoAuth
|
||||||
break;
|
break;
|
||||||
case LLAssetType::AT_NOTECARD:
|
case LLAssetType::AT_NOTECARD:
|
||||||
@@ -363,7 +363,7 @@ void LLInventoryBackup::imageCallback(BOOL success,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
src_vi->setBoostLevel(LLViewerTexture::BOOST_UI);
|
src_vi->setBoostLevel(LLGLTexture::BOOST_UI);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -738,7 +738,7 @@ void LLFloaterInventoryBackup::imageCallback(BOOL success,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
src_vi->setBoostLevel(LLViewerTexture::BOOST_UI);
|
src_vi->setBoostLevel(LLGLTexture::BOOST_UI);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1676,7 +1676,7 @@ LLUIImagePtr LLItemBridge::getIcon() const
|
|||||||
mIsLink);
|
mIsLink);
|
||||||
}
|
}
|
||||||
|
|
||||||
return LLInventoryIcon::getIcon(LLInventoryIcon::ICONNAME_OBJECT);
|
return LLInventoryIcon::getIcon(LLInventoryType::ICONNAME_OBJECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
PermissionMask LLItemBridge::getPermissionMask() const
|
PermissionMask LLItemBridge::getPermissionMask() const
|
||||||
@@ -6100,7 +6100,7 @@ void LLWearableBridge::wearAddOnAvatar()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
//void LLWearableBridge::onWearOnAvatarArrived( LLWearable* wearable, void* userdata )
|
//void LLWearableBridge::onWearOnAvatarArrived( LLViewerWearable* wearable, void* userdata )
|
||||||
//{
|
//{
|
||||||
// LLUUID* item_id = (LLUUID*) userdata;
|
// LLUUID* item_id = (LLUUID*) userdata;
|
||||||
// if(wearable)
|
// if(wearable)
|
||||||
@@ -6126,7 +6126,7 @@ void LLWearableBridge::wearAddOnAvatar()
|
|||||||
|
|
||||||
// static
|
// static
|
||||||
// BAP remove the "add" code path once everything is fully COF-ified.
|
// BAP remove the "add" code path once everything is fully COF-ified.
|
||||||
//void LLWearableBridge::onWearAddOnAvatarArrived( LLWearable* wearable, void* userdata )
|
//void LLWearableBridge::onWearAddOnAvatarArrived( LLViewerWearable* wearable, void* userdata )
|
||||||
//{
|
//{
|
||||||
// LLUUID* item_id = (LLUUID*) userdata;
|
// LLUUID* item_id = (LLUUID*) userdata;
|
||||||
// if(wearable)
|
// if(wearable)
|
||||||
@@ -6207,7 +6207,7 @@ BOOL LLWearableBridge::canRemoveFromAvatar(void* user_data)
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
//void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable,
|
//void LLWearableBridge::onRemoveFromAvatarArrived(LLViewerWearable* wearable,
|
||||||
// void* userdata)
|
// void* userdata)
|
||||||
//{
|
//{
|
||||||
// OnRemoveStruct *on_remove_struct = (OnRemoveStruct*) userdata;
|
// OnRemoveStruct *on_remove_struct = (OnRemoveStruct*) userdata;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
#include "llinventorymodel.h"
|
#include "llinventorymodel.h"
|
||||||
#include "llinventoryobserver.h"
|
#include "llinventoryobserver.h"
|
||||||
#include "llviewercontrol.h"
|
#include "llviewercontrol.h"
|
||||||
#include "llwearable.h"
|
#include "llviewerwearable.h"
|
||||||
|
|
||||||
class LLInventoryPanel;
|
class LLInventoryPanel;
|
||||||
class LLInventoryModel;
|
class LLInventoryModel;
|
||||||
@@ -503,10 +503,10 @@ public:
|
|||||||
|
|
||||||
static void onWearOnAvatar( void* userdata ); // Access to wearOnAvatar() from menu
|
static void onWearOnAvatar( void* userdata ); // Access to wearOnAvatar() from menu
|
||||||
static BOOL canWearOnAvatar( void* userdata );
|
static BOOL canWearOnAvatar( void* userdata );
|
||||||
static void onWearOnAvatarArrived( LLWearable* wearable, void* userdata );
|
static void onWearOnAvatarArrived( LLViewerWearable* wearable, void* userdata );
|
||||||
void wearOnAvatar();
|
void wearOnAvatar();
|
||||||
|
|
||||||
static void onWearAddOnAvatarArrived( LLWearable* wearable, void* userdata );
|
static void onWearAddOnAvatarArrived( LLViewerWearable* wearable, void* userdata );
|
||||||
void wearAddOnAvatar();
|
void wearAddOnAvatar();
|
||||||
|
|
||||||
static BOOL canEditOnAvatar( void* userdata ); // Access to editOnAvatar() from menu
|
static BOOL canEditOnAvatar( void* userdata ); // Access to editOnAvatar() from menu
|
||||||
@@ -515,7 +515,7 @@ public:
|
|||||||
|
|
||||||
static BOOL canRemoveFromAvatar( void* userdata );
|
static BOOL canRemoveFromAvatar( void* userdata );
|
||||||
static void onRemoveFromAvatar( void* userdata );
|
static void onRemoveFromAvatar( void* userdata );
|
||||||
static void onRemoveFromAvatarArrived( LLWearable* wearable, void* userdata );
|
static void onRemoveFromAvatarArrived( LLViewerWearable* wearable, void* userdata );
|
||||||
static void removeItemFromAvatar(LLViewerInventoryItem *item);
|
static void removeItemFromAvatar(LLViewerInventoryItem *item);
|
||||||
static void removeAllClothesFromAvatar();
|
static void removeAllClothesFromAvatar();
|
||||||
void removeFromAvatar();
|
void removeFromAvatar();
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ struct IconEntry : public LLDictionaryEntry
|
|||||||
};
|
};
|
||||||
|
|
||||||
class LLIconDictionary : public LLSingleton<LLIconDictionary>,
|
class LLIconDictionary : public LLSingleton<LLIconDictionary>,
|
||||||
public LLDictionary<LLInventoryIcon::EIconName, IconEntry>
|
public LLDictionary<LLInventoryType::EIconName, IconEntry>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LLIconDictionary();
|
LLIconDictionary();
|
||||||
@@ -49,48 +49,48 @@ public:
|
|||||||
|
|
||||||
LLIconDictionary::LLIconDictionary()
|
LLIconDictionary::LLIconDictionary()
|
||||||
{
|
{
|
||||||
addEntry(LLInventoryIcon::ICONNAME_TEXTURE, new IconEntry("inv_item_texture.tga"));
|
addEntry(LLInventoryType::ICONNAME_TEXTURE, new IconEntry("inv_item_texture.tga"));
|
||||||
addEntry(LLInventoryIcon::ICONNAME_SOUND, new IconEntry("inv_item_sound.tga"));
|
addEntry(LLInventoryType::ICONNAME_SOUND, new IconEntry("inv_item_sound.tga"));
|
||||||
addEntry(LLInventoryIcon::ICONNAME_CALLINGCARD_ONLINE, new IconEntry("inv_item_callingcard_online.tga"));
|
addEntry(LLInventoryType::ICONNAME_CALLINGCARD_ONLINE, new IconEntry("inv_item_callingcard_online.tga"));
|
||||||
addEntry(LLInventoryIcon::ICONNAME_CALLINGCARD_OFFLINE, new IconEntry("inv_item_callingcard_offline.tga"));
|
addEntry(LLInventoryType::ICONNAME_CALLINGCARD_OFFLINE, new IconEntry("inv_item_callingcard_offline.tga"));
|
||||||
addEntry(LLInventoryIcon::ICONNAME_LANDMARK, new IconEntry("inv_item_landmark.tga"));
|
addEntry(LLInventoryType::ICONNAME_LANDMARK, new IconEntry("inv_item_landmark.tga"));
|
||||||
addEntry(LLInventoryIcon::ICONNAME_LANDMARK_VISITED, new IconEntry("inv_item_landmark_visited.tga"));
|
addEntry(LLInventoryType::ICONNAME_LANDMARK_VISITED, new IconEntry("inv_item_landmark_visited.tga"));
|
||||||
addEntry(LLInventoryIcon::ICONNAME_SCRIPT, new IconEntry("inv_item_script.tga"));
|
addEntry(LLInventoryType::ICONNAME_SCRIPT, new IconEntry("inv_item_script.tga"));
|
||||||
addEntry(LLInventoryIcon::ICONNAME_CLOTHING, new IconEntry("inv_item_clothing.tga"));
|
addEntry(LLInventoryType::ICONNAME_CLOTHING, new IconEntry("inv_item_clothing.tga"));
|
||||||
addEntry(LLInventoryIcon::ICONNAME_OBJECT, new IconEntry("inv_item_object.tga"));
|
addEntry(LLInventoryType::ICONNAME_OBJECT, new IconEntry("inv_item_object.tga"));
|
||||||
addEntry(LLInventoryIcon::ICONNAME_OBJECT_MULTI, new IconEntry("inv_item_object_multi.tga"));
|
addEntry(LLInventoryType::ICONNAME_OBJECT_MULTI, new IconEntry("inv_item_object_multi.tga"));
|
||||||
addEntry(LLInventoryIcon::ICONNAME_NOTECARD, new IconEntry("inv_item_notecard.tga"));
|
addEntry(LLInventoryType::ICONNAME_NOTECARD, new IconEntry("inv_item_notecard.tga"));
|
||||||
addEntry(LLInventoryIcon::ICONNAME_BODYPART, new IconEntry("inv_item_skin.tga"));
|
addEntry(LLInventoryType::ICONNAME_BODYPART, new IconEntry("inv_item_skin.tga"));
|
||||||
addEntry(LLInventoryIcon::ICONNAME_SNAPSHOT, new IconEntry("inv_item_snapshot.tga"));
|
addEntry(LLInventoryType::ICONNAME_SNAPSHOT, new IconEntry("inv_item_snapshot.tga"));
|
||||||
|
|
||||||
addEntry(LLInventoryIcon::ICONNAME_BODYPART_SHAPE, new IconEntry("inv_item_shape.tga"));
|
addEntry(LLInventoryType::ICONNAME_BODYPART_SHAPE, new IconEntry("inv_item_shape.tga"));
|
||||||
addEntry(LLInventoryIcon::ICONNAME_BODYPART_SKIN, new IconEntry("inv_item_skin.tga"));
|
addEntry(LLInventoryType::ICONNAME_BODYPART_SKIN, new IconEntry("inv_item_skin.tga"));
|
||||||
addEntry(LLInventoryIcon::ICONNAME_BODYPART_HAIR, new IconEntry("inv_item_hair.tga"));
|
addEntry(LLInventoryType::ICONNAME_BODYPART_HAIR, new IconEntry("inv_item_hair.tga"));
|
||||||
addEntry(LLInventoryIcon::ICONNAME_BODYPART_EYES, new IconEntry("inv_item_eyes.tga"));
|
addEntry(LLInventoryType::ICONNAME_BODYPART_EYES, new IconEntry("inv_item_eyes.tga"));
|
||||||
|
|
||||||
addEntry(LLInventoryIcon::ICONNAME_CLOTHING_SHIRT, new IconEntry("inv_item_shirt.tga"));
|
addEntry(LLInventoryType::ICONNAME_CLOTHING_SHIRT, new IconEntry("inv_item_shirt.tga"));
|
||||||
addEntry(LLInventoryIcon::ICONNAME_CLOTHING_PANTS, new IconEntry("inv_item_pants.tga"));
|
addEntry(LLInventoryType::ICONNAME_CLOTHING_PANTS, new IconEntry("inv_item_pants.tga"));
|
||||||
addEntry(LLInventoryIcon::ICONNAME_CLOTHING_SHOES, new IconEntry("inv_item_shoes.tga"));
|
addEntry(LLInventoryType::ICONNAME_CLOTHING_SHOES, new IconEntry("inv_item_shoes.tga"));
|
||||||
addEntry(LLInventoryIcon::ICONNAME_CLOTHING_SOCKS, new IconEntry("inv_item_socks.tga"));
|
addEntry(LLInventoryType::ICONNAME_CLOTHING_SOCKS, new IconEntry("inv_item_socks.tga"));
|
||||||
addEntry(LLInventoryIcon::ICONNAME_CLOTHING_JACKET, new IconEntry("inv_item_jacket.tga"));
|
addEntry(LLInventoryType::ICONNAME_CLOTHING_JACKET, new IconEntry("inv_item_jacket.tga"));
|
||||||
addEntry(LLInventoryIcon::ICONNAME_CLOTHING_GLOVES, new IconEntry("inv_item_gloves.tga"));
|
addEntry(LLInventoryType::ICONNAME_CLOTHING_GLOVES, new IconEntry("inv_item_gloves.tga"));
|
||||||
addEntry(LLInventoryIcon::ICONNAME_CLOTHING_UNDERSHIRT, new IconEntry("inv_item_undershirt.tga"));
|
addEntry(LLInventoryType::ICONNAME_CLOTHING_UNDERSHIRT, new IconEntry("inv_item_undershirt.tga"));
|
||||||
addEntry(LLInventoryIcon::ICONNAME_CLOTHING_UNDERPANTS, new IconEntry("inv_item_underpants.tga"));
|
addEntry(LLInventoryType::ICONNAME_CLOTHING_UNDERPANTS, new IconEntry("inv_item_underpants.tga"));
|
||||||
addEntry(LLInventoryIcon::ICONNAME_CLOTHING_SKIRT, new IconEntry("inv_item_skirt.tga"));
|
addEntry(LLInventoryType::ICONNAME_CLOTHING_SKIRT, new IconEntry("inv_item_skirt.tga"));
|
||||||
addEntry(LLInventoryIcon::ICONNAME_CLOTHING_ALPHA, new IconEntry("inv_item_alpha.tga"));
|
addEntry(LLInventoryType::ICONNAME_CLOTHING_ALPHA, new IconEntry("inv_item_alpha.tga"));
|
||||||
addEntry(LLInventoryIcon::ICONNAME_CLOTHING_TATTOO, new IconEntry("inv_item_tattoo.tga"));
|
addEntry(LLInventoryType::ICONNAME_CLOTHING_TATTOO, new IconEntry("inv_item_tattoo.tga"));
|
||||||
addEntry(LLInventoryIcon::ICONNAME_ANIMATION, new IconEntry("inv_item_animation.tga"));
|
addEntry(LLInventoryType::ICONNAME_ANIMATION, new IconEntry("inv_item_animation.tga"));
|
||||||
addEntry(LLInventoryIcon::ICONNAME_GESTURE, new IconEntry("inv_item_gesture.tga"));
|
addEntry(LLInventoryType::ICONNAME_GESTURE, new IconEntry("inv_item_gesture.tga"));
|
||||||
|
|
||||||
addEntry(LLInventoryIcon::ICONNAME_CLOTHING_PHYSICS, new IconEntry("inv_item_physics.tga"));
|
addEntry(LLInventoryType::ICONNAME_CLOTHING_PHYSICS, new IconEntry("inv_item_physics.tga"));
|
||||||
|
|
||||||
addEntry(LLInventoryIcon::ICONNAME_LINKITEM, new IconEntry("inv_link_item.tga"));
|
addEntry(LLInventoryType::ICONNAME_LINKITEM, new IconEntry("inv_link_item.tga"));
|
||||||
addEntry(LLInventoryIcon::ICONNAME_LINKFOLDER, new IconEntry("inv_link_folder.tga"));
|
addEntry(LLInventoryType::ICONNAME_LINKFOLDER, new IconEntry("inv_link_folder.tga"));
|
||||||
addEntry(LLInventoryIcon::ICONNAME_MESH, new IconEntry("inv_item_mesh.tga"));
|
addEntry(LLInventoryType::ICONNAME_MESH, new IconEntry("inv_item_mesh.tga"));
|
||||||
|
|
||||||
addEntry(LLInventoryIcon::ICONNAME_INVALID, new IconEntry("inv_invalid.png"));
|
addEntry(LLInventoryType::ICONNAME_INVALID, new IconEntry("inv_invalid.png"));
|
||||||
|
|
||||||
addEntry(LLInventoryIcon::ICONNAME_NONE, new IconEntry("NONE"));
|
addEntry(LLInventoryType::ICONNAME_NONE, new IconEntry("NONE"));
|
||||||
}
|
}
|
||||||
|
|
||||||
LLUIImagePtr LLInventoryIcon::getIcon(LLAssetType::EType asset_type,
|
LLUIImagePtr LLInventoryIcon::getIcon(LLAssetType::EType asset_type,
|
||||||
@@ -102,7 +102,7 @@ LLUIImagePtr LLInventoryIcon::getIcon(LLAssetType::EType asset_type,
|
|||||||
return LLUI::getUIImage(icon_name);
|
return LLUI::getUIImage(icon_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
LLUIImagePtr LLInventoryIcon::getIcon(EIconName idx)
|
LLUIImagePtr LLInventoryIcon::getIcon(LLInventoryType::EIconName idx)
|
||||||
{
|
{
|
||||||
return LLUI::getUIImage(getIconName(idx));
|
return LLUI::getUIImage(getIconName(idx));
|
||||||
}
|
}
|
||||||
@@ -112,56 +112,56 @@ const std::string& LLInventoryIcon::getIconName(LLAssetType::EType asset_type,
|
|||||||
U32 misc_flag,
|
U32 misc_flag,
|
||||||
BOOL item_is_multi)
|
BOOL item_is_multi)
|
||||||
{
|
{
|
||||||
EIconName idx = ICONNAME_OBJECT;
|
LLInventoryType::EIconName idx = LLInventoryType::ICONNAME_OBJECT;
|
||||||
if (item_is_multi)
|
if (item_is_multi)
|
||||||
{
|
{
|
||||||
idx = ICONNAME_OBJECT_MULTI;
|
idx = LLInventoryType::ICONNAME_OBJECT_MULTI;
|
||||||
return getIconName(idx);
|
return getIconName(idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(asset_type)
|
switch(asset_type)
|
||||||
{
|
{
|
||||||
case LLAssetType::AT_TEXTURE:
|
case LLAssetType::AT_TEXTURE:
|
||||||
idx = (inventory_type == LLInventoryType::IT_SNAPSHOT) ? ICONNAME_SNAPSHOT : ICONNAME_TEXTURE;
|
idx = (inventory_type == LLInventoryType::IT_SNAPSHOT) ? LLInventoryType::ICONNAME_SNAPSHOT : LLInventoryType::ICONNAME_TEXTURE;
|
||||||
break;
|
break;
|
||||||
case LLAssetType::AT_SOUND:
|
case LLAssetType::AT_SOUND:
|
||||||
idx = ICONNAME_SOUND;
|
idx = LLInventoryType::ICONNAME_SOUND;
|
||||||
break;
|
break;
|
||||||
case LLAssetType::AT_CALLINGCARD:
|
case LLAssetType::AT_CALLINGCARD:
|
||||||
idx = (misc_flag != 0) ? ICONNAME_CALLINGCARD_ONLINE : ICONNAME_CALLINGCARD_OFFLINE;
|
idx = (misc_flag != 0) ? LLInventoryType::ICONNAME_CALLINGCARD_ONLINE : LLInventoryType::ICONNAME_CALLINGCARD_OFFLINE;
|
||||||
break;
|
break;
|
||||||
case LLAssetType::AT_LANDMARK:
|
case LLAssetType::AT_LANDMARK:
|
||||||
idx = (misc_flag != 0) ? ICONNAME_LANDMARK_VISITED : ICONNAME_LANDMARK;
|
idx = (misc_flag != 0) ? LLInventoryType::ICONNAME_LANDMARK_VISITED : LLInventoryType::ICONNAME_LANDMARK;
|
||||||
break;
|
break;
|
||||||
case LLAssetType::AT_SCRIPT:
|
case LLAssetType::AT_SCRIPT:
|
||||||
case LLAssetType::AT_LSL_TEXT:
|
case LLAssetType::AT_LSL_TEXT:
|
||||||
case LLAssetType::AT_LSL_BYTECODE:
|
case LLAssetType::AT_LSL_BYTECODE:
|
||||||
idx = ICONNAME_SCRIPT;
|
idx = LLInventoryType::ICONNAME_SCRIPT;
|
||||||
break;
|
break;
|
||||||
case LLAssetType::AT_CLOTHING:
|
case LLAssetType::AT_CLOTHING:
|
||||||
case LLAssetType::AT_BODYPART:
|
case LLAssetType::AT_BODYPART:
|
||||||
idx = assignWearableIcon(misc_flag);
|
idx = assignWearableIcon(misc_flag);
|
||||||
break;
|
break;
|
||||||
case LLAssetType::AT_NOTECARD:
|
case LLAssetType::AT_NOTECARD:
|
||||||
idx = ICONNAME_NOTECARD;
|
idx = LLInventoryType::ICONNAME_NOTECARD;
|
||||||
break;
|
break;
|
||||||
case LLAssetType::AT_ANIMATION:
|
case LLAssetType::AT_ANIMATION:
|
||||||
idx = ICONNAME_ANIMATION;
|
idx = LLInventoryType::ICONNAME_ANIMATION;
|
||||||
break;
|
break;
|
||||||
case LLAssetType::AT_GESTURE:
|
case LLAssetType::AT_GESTURE:
|
||||||
idx = ICONNAME_GESTURE;
|
idx = LLInventoryType::ICONNAME_GESTURE;
|
||||||
break;
|
break;
|
||||||
case LLAssetType::AT_LINK:
|
case LLAssetType::AT_LINK:
|
||||||
idx = ICONNAME_LINKITEM;
|
idx = LLInventoryType::ICONNAME_LINKITEM;
|
||||||
break;
|
break;
|
||||||
case LLAssetType::AT_LINK_FOLDER:
|
case LLAssetType::AT_LINK_FOLDER:
|
||||||
idx = ICONNAME_LINKFOLDER;
|
idx = LLInventoryType::ICONNAME_LINKFOLDER;
|
||||||
break;
|
break;
|
||||||
case LLAssetType::AT_OBJECT:
|
case LLAssetType::AT_OBJECT:
|
||||||
idx = ICONNAME_OBJECT;
|
idx = LLInventoryType::ICONNAME_OBJECT;
|
||||||
break;
|
break;
|
||||||
case LLAssetType::AT_MESH:
|
case LLAssetType::AT_MESH:
|
||||||
idx = ICONNAME_MESH;
|
idx = LLInventoryType::ICONNAME_MESH;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -170,13 +170,13 @@ const std::string& LLInventoryIcon::getIconName(LLAssetType::EType asset_type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const std::string& LLInventoryIcon::getIconName(EIconName idx)
|
const std::string& LLInventoryIcon::getIconName(LLInventoryType::EIconName idx)
|
||||||
{
|
{
|
||||||
const IconEntry *entry = LLIconDictionary::instance().lookup(idx);
|
const IconEntry *entry = LLIconDictionary::instance().lookup(idx);
|
||||||
return entry->mName;
|
return entry->mName;
|
||||||
}
|
}
|
||||||
|
|
||||||
LLInventoryIcon::EIconName LLInventoryIcon::assignWearableIcon(U32 misc_flag)
|
LLInventoryType::EIconName LLInventoryIcon::assignWearableIcon(U32 misc_flag)
|
||||||
{
|
{
|
||||||
const LLWearableType::EType wearable_type = LLWearableType::EType(LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK & misc_flag);
|
const LLWearableType::EType wearable_type = LLWearableType::EType(LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK & misc_flag);
|
||||||
return LLWearableType::getIconName(wearable_type);
|
return LLWearableType::getIconName(wearable_type);
|
||||||
|
|||||||
@@ -35,66 +35,20 @@
|
|||||||
class LLInventoryIcon
|
class LLInventoryIcon
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum EIconName
|
|
||||||
{
|
|
||||||
ICONNAME_TEXTURE,
|
|
||||||
ICONNAME_SOUND,
|
|
||||||
ICONNAME_CALLINGCARD_ONLINE,
|
|
||||||
ICONNAME_CALLINGCARD_OFFLINE,
|
|
||||||
ICONNAME_LANDMARK,
|
|
||||||
ICONNAME_LANDMARK_VISITED,
|
|
||||||
ICONNAME_SCRIPT,
|
|
||||||
ICONNAME_CLOTHING,
|
|
||||||
ICONNAME_OBJECT,
|
|
||||||
ICONNAME_OBJECT_MULTI,
|
|
||||||
ICONNAME_NOTECARD,
|
|
||||||
ICONNAME_BODYPART,
|
|
||||||
ICONNAME_SNAPSHOT,
|
|
||||||
|
|
||||||
ICONNAME_BODYPART_SHAPE,
|
|
||||||
ICONNAME_BODYPART_SKIN,
|
|
||||||
ICONNAME_BODYPART_HAIR,
|
|
||||||
ICONNAME_BODYPART_EYES,
|
|
||||||
ICONNAME_CLOTHING_SHIRT,
|
|
||||||
ICONNAME_CLOTHING_PANTS,
|
|
||||||
ICONNAME_CLOTHING_SHOES,
|
|
||||||
ICONNAME_CLOTHING_SOCKS,
|
|
||||||
ICONNAME_CLOTHING_JACKET,
|
|
||||||
ICONNAME_CLOTHING_GLOVES,
|
|
||||||
ICONNAME_CLOTHING_UNDERSHIRT,
|
|
||||||
ICONNAME_CLOTHING_UNDERPANTS,
|
|
||||||
ICONNAME_CLOTHING_SKIRT,
|
|
||||||
ICONNAME_CLOTHING_ALPHA,
|
|
||||||
ICONNAME_CLOTHING_TATTOO,
|
|
||||||
|
|
||||||
ICONNAME_ANIMATION,
|
|
||||||
ICONNAME_GESTURE,
|
|
||||||
|
|
||||||
ICONNAME_CLOTHING_PHYSICS,
|
|
||||||
|
|
||||||
ICONNAME_LINKITEM,
|
|
||||||
ICONNAME_LINKFOLDER,
|
|
||||||
ICONNAME_MESH,
|
|
||||||
|
|
||||||
ICONNAME_INVALID,
|
|
||||||
ICONNAME_COUNT,
|
|
||||||
ICONNAME_NONE = -1
|
|
||||||
};
|
|
||||||
|
|
||||||
static const std::string& getIconName(LLAssetType::EType asset_type,
|
static const std::string& getIconName(LLAssetType::EType asset_type,
|
||||||
LLInventoryType::EType inventory_type = LLInventoryType::IT_NONE,
|
LLInventoryType::EType inventory_type = LLInventoryType::IT_NONE,
|
||||||
U32 misc_flag = 0, // different meanings depending on item type
|
U32 misc_flag = 0, // different meanings depending on item type
|
||||||
BOOL item_is_multi = FALSE);
|
BOOL item_is_multi = FALSE);
|
||||||
static const std::string& getIconName(EIconName idx);
|
static const std::string& getIconName(LLInventoryType::EIconName idx);
|
||||||
|
|
||||||
static LLUIImagePtr getIcon(LLAssetType::EType asset_type,
|
static LLUIImagePtr getIcon(LLAssetType::EType asset_type,
|
||||||
LLInventoryType::EType inventory_type = LLInventoryType::IT_NONE,
|
LLInventoryType::EType inventory_type = LLInventoryType::IT_NONE,
|
||||||
U32 misc_flag = 0, // different meanings depending on item type
|
U32 misc_flag = 0, // different meanings depending on item type
|
||||||
BOOL item_is_multi = FALSE);
|
BOOL item_is_multi = FALSE);
|
||||||
static LLUIImagePtr getIcon(EIconName idx);
|
static LLUIImagePtr getIcon(LLInventoryType::EIconName idx);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static EIconName assignWearableIcon(U32 misc_flag);
|
static LLInventoryType::EIconName assignWearableIcon(U32 misc_flag);
|
||||||
};
|
};
|
||||||
#endif // LL_LLINVENTORYICON_H
|
#endif // LL_LLINVENTORYICON_H
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#include "llpaneleditwearable.h"
|
#include "llpaneleditwearable.h"
|
||||||
#include "llpanel.h"
|
#include "llpanel.h"
|
||||||
#include "llwearable.h"
|
#include "llviewerwearable.h"
|
||||||
#include "lluictrl.h"
|
#include "lluictrl.h"
|
||||||
#include "llscrollingpanellist.h"
|
#include "llscrollingpanellist.h"
|
||||||
#include "llvisualparam.h"
|
#include "llvisualparam.h"
|
||||||
@@ -60,6 +60,7 @@
|
|||||||
#include "llfloatercustomize.h"
|
#include "llfloatercustomize.h"
|
||||||
|
|
||||||
#include "llwearablelist.h"
|
#include "llwearablelist.h"
|
||||||
|
#include "llinventoryicon.h"
|
||||||
|
|
||||||
// subparts of the UI for focus, camera position, etc.
|
// subparts of the UI for focus, camera position, etc.
|
||||||
enum ESubpart {
|
enum ESubpart {
|
||||||
@@ -102,7 +103,7 @@ enum ESubpart {
|
|||||||
SUBPART_PHYSICS_ADVANCED,
|
SUBPART_PHYSICS_ADVANCED,
|
||||||
};
|
};
|
||||||
|
|
||||||
using namespace LLVOAvatarDefines;
|
using namespace LLAvatarAppearanceDefines;
|
||||||
|
|
||||||
typedef std::vector<ESubpart> subpart_vec_t;
|
typedef std::vector<ESubpart> subpart_vec_t;
|
||||||
|
|
||||||
@@ -707,11 +708,11 @@ BOOL LLPanelEditWearable::postBuild()
|
|||||||
|
|
||||||
childSetAction("Revert", &LLPanelEditWearable::onRevertButtonClicked, (void*)this );
|
childSetAction("Revert", &LLPanelEditWearable::onRevertButtonClicked, (void*)this );
|
||||||
|
|
||||||
configureAlphaCheckbox(LLVOAvatarDefines::TEX_LOWER_ALPHA, "lower alpha texture invisible");
|
configureAlphaCheckbox(LLAvatarAppearanceDefines::TEX_LOWER_ALPHA, "lower alpha texture invisible");
|
||||||
configureAlphaCheckbox(LLVOAvatarDefines::TEX_UPPER_ALPHA, "upper alpha texture invisible");
|
configureAlphaCheckbox(LLAvatarAppearanceDefines::TEX_UPPER_ALPHA, "upper alpha texture invisible");
|
||||||
configureAlphaCheckbox(LLVOAvatarDefines::TEX_HEAD_ALPHA, "head alpha texture invisible");
|
configureAlphaCheckbox(LLAvatarAppearanceDefines::TEX_HEAD_ALPHA, "head alpha texture invisible");
|
||||||
configureAlphaCheckbox(LLVOAvatarDefines::TEX_EYES_ALPHA, "eye alpha texture invisible");
|
configureAlphaCheckbox(LLAvatarAppearanceDefines::TEX_EYES_ALPHA, "eye alpha texture invisible");
|
||||||
configureAlphaCheckbox(LLVOAvatarDefines::TEX_HAIR_ALPHA, "hair alpha texture invisible");
|
configureAlphaCheckbox(LLAvatarAppearanceDefines::TEX_HAIR_ALPHA, "hair alpha texture invisible");
|
||||||
|
|
||||||
{
|
{
|
||||||
const LLEditWearableDictionary::WearableEntry *wearable_entry = LLEditWearableDictionary::getInstance()->getWearable(mType);
|
const LLEditWearableDictionary::WearableEntry *wearable_entry = LLEditWearableDictionary::getInstance()->getWearable(mType);
|
||||||
@@ -766,7 +767,7 @@ BOOL LLPanelEditWearable::postBuild()
|
|||||||
|
|
||||||
BOOL LLPanelEditWearable::isDirty() const
|
BOOL LLPanelEditWearable::isDirty() const
|
||||||
{
|
{
|
||||||
LLWearable* wearable = getWearable();
|
LLViewerWearable* wearable = getWearable();
|
||||||
return wearable && wearable->isDirty();
|
return wearable && wearable->isDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -777,7 +778,7 @@ void LLPanelEditWearable::draw()
|
|||||||
|
|
||||||
refreshWearables(false);
|
refreshWearables(false);
|
||||||
|
|
||||||
LLWearable* wearable = getWearable();
|
LLViewerWearable* wearable = getWearable();
|
||||||
BOOL has_wearable = (wearable != NULL );
|
BOOL has_wearable = (wearable != NULL );
|
||||||
BOOL has_any_wearable = has_wearable || gAgentWearables.getWearableCount(mType);
|
BOOL has_any_wearable = has_wearable || gAgentWearables.getWearableCount(mType);
|
||||||
BOOL is_dirty = isDirty();
|
BOOL is_dirty = isDirty();
|
||||||
@@ -930,7 +931,7 @@ void LLPanelEditWearable::setWearableIndex(S32 index)
|
|||||||
tab->selectTab(tab_index);
|
tab->selectTab(tab_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
LLWearable* wearable = gAgentWearables.getWearable(mType,mCurrentIndex);
|
LLViewerWearable* wearable = gAgentWearables.getViewerWearable(mType,mCurrentIndex);
|
||||||
|
|
||||||
if(wearable == getWearable())
|
if(wearable == getWearable())
|
||||||
return;
|
return;
|
||||||
@@ -1058,7 +1059,7 @@ void LLPanelEditWearable::onBtnSaveAs( void* userdata )
|
|||||||
LLPanelEditWearable* self = (LLPanelEditWearable*) userdata;
|
LLPanelEditWearable* self = (LLPanelEditWearable*) userdata;
|
||||||
if(self->mActiveModal)
|
if(self->mActiveModal)
|
||||||
return;
|
return;
|
||||||
LLWearable* wearable = self->getWearable();
|
LLViewerWearable* wearable = self->getWearable();
|
||||||
if( wearable )
|
if( wearable )
|
||||||
{
|
{
|
||||||
self->mActiveModal = new LLWearableSaveAsDialog( wearable->getName(), self, onSaveAsCommit, self );
|
self->mActiveModal = new LLWearableSaveAsDialog( wearable->getName(), self, onSaveAsCommit, self );
|
||||||
@@ -1094,7 +1095,7 @@ void LLPanelEditWearable::onCommitSexChange()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool is_new_sex_male = (gSavedSettings.getU32("AvatarSex") ? SEX_MALE : SEX_FEMALE) == SEX_MALE;
|
bool is_new_sex_male = (gSavedSettings.getU32("AvatarSex") ? SEX_MALE : SEX_FEMALE) == SEX_MALE;
|
||||||
LLWearable* wearable = gAgentWearables.getWearable(type, index);
|
LLViewerWearable* wearable = gAgentWearables.getViewerWearable(type, index);
|
||||||
if (wearable)
|
if (wearable)
|
||||||
{
|
{
|
||||||
wearable->setVisualParamWeight(param->getID(), is_new_sex_male, FALSE);
|
wearable->setVisualParamWeight(param->getID(), is_new_sex_male, FALSE);
|
||||||
@@ -1141,7 +1142,7 @@ bool LLPanelEditWearable::onSelectAutoWearOption(const LLSD& notification, const
|
|||||||
if(avatar)
|
if(avatar)
|
||||||
{
|
{
|
||||||
// Create a new wearable in the default folder for the wearable's asset type.
|
// Create a new wearable in the default folder for the wearable's asset type.
|
||||||
LLWearable* wearable = LLWearableList::instance().createNewWearable( (LLWearableType::EType)notification["payload"]["wearable_type"].asInteger() );
|
LLViewerWearable* wearable = LLWearableList::instance().createNewWearable( (LLWearableType::EType)notification["payload"]["wearable_type"].asInteger(), avatar );
|
||||||
LLAssetType::EType asset_type = wearable->getAssetType();
|
LLAssetType::EType asset_type = wearable->getAssetType();
|
||||||
|
|
||||||
LLUUID folder_id;
|
LLUUID folder_id;
|
||||||
@@ -1159,7 +1160,7 @@ bool LLPanelEditWearable::onSelectAutoWearOption(const LLSD& notification, const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
LLWearable* LLPanelEditWearable::getWearable() const
|
LLViewerWearable* LLPanelEditWearable::getWearable() const
|
||||||
{
|
{
|
||||||
return mCurrentWearable;//gAgentWearables.getWearable(mType, mCurrentIndex); // TODO: MULTI-WEARABLE
|
return mCurrentWearable;//gAgentWearables.getWearable(mType, mCurrentIndex); // TODO: MULTI-WEARABLE
|
||||||
}
|
}
|
||||||
@@ -1266,7 +1267,7 @@ void LLPanelEditWearable::saveChanges(bool force_save_as, std::string new_name)
|
|||||||
{
|
{
|
||||||
// the name of the wearable has changed, re-save wearable with new name
|
// the name of the wearable has changed, re-save wearable with new name
|
||||||
LLAppearanceMgr::instance().removeCOFItemLinks(getWearable()->getItemID(),false);
|
LLAppearanceMgr::instance().removeCOFItemLinks(getWearable()->getItemID(),false);
|
||||||
LLWearable* new_wearable = gAgentWearables.saveWearableAs(mType, index, new_name, FALSE);
|
LLViewerWearable* new_wearable = gAgentWearables.saveWearableAs(mType, index, new_name, FALSE);
|
||||||
if(new_wearable)
|
if(new_wearable)
|
||||||
{
|
{
|
||||||
mPendingWearable = new_wearable;
|
mPendingWearable = new_wearable;
|
||||||
@@ -1283,7 +1284,7 @@ void LLPanelEditWearable::saveChanges(bool force_save_as, std::string new_name)
|
|||||||
|
|
||||||
void LLPanelEditWearable::revertChanges()
|
void LLPanelEditWearable::revertChanges()
|
||||||
{
|
{
|
||||||
LLWearable* wearable = getWearable();
|
LLViewerWearable* wearable = getWearable();
|
||||||
if (!wearable || !isDirty())
|
if (!wearable || !isDirty())
|
||||||
{
|
{
|
||||||
// no unsaved changes to revert
|
// no unsaved changes to revert
|
||||||
@@ -1382,7 +1383,7 @@ void LLPanelEditWearable::changeCamera(U8 subpart)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update the thumbnails we display
|
// Update the thumbnails we display
|
||||||
LLWearable* wearable = getWearable();
|
LLViewerWearable* wearable = getWearable();
|
||||||
LLViewerInventoryItem* item = wearable ? gInventory.getItem(wearable->getItemID()) : NULL;
|
LLViewerInventoryItem* item = wearable ? gInventory.getItem(wearable->getItemID()) : NULL;
|
||||||
U32 perm_mask = 0x0;
|
U32 perm_mask = 0x0;
|
||||||
BOOL is_complete = FALSE;
|
BOOL is_complete = FALSE;
|
||||||
@@ -1434,7 +1435,7 @@ void LLPanelEditWearable::updateScrollingPanelList()
|
|||||||
|
|
||||||
void LLPanelEditWearable::updateScrollingPanelUI()
|
void LLPanelEditWearable::updateScrollingPanelUI()
|
||||||
{
|
{
|
||||||
LLWearable* wearable = getWearable();
|
LLViewerWearable* wearable = getWearable();
|
||||||
// do nothing if we don't have a valid wearable we're editing
|
// do nothing if we don't have a valid wearable we're editing
|
||||||
if(!wearable)
|
if(!wearable)
|
||||||
{
|
{
|
||||||
@@ -1459,7 +1460,7 @@ void LLPanelEditWearable::onBtnTakeOff( void* userdata )
|
|||||||
{
|
{
|
||||||
LLPanelEditWearable* self = (LLPanelEditWearable*) userdata;
|
LLPanelEditWearable* self = (LLPanelEditWearable*) userdata;
|
||||||
|
|
||||||
LLWearable* wearable = self->getWearable();
|
LLViewerWearable* wearable = self->getWearable();
|
||||||
if( !wearable )
|
if( !wearable )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -1474,12 +1475,12 @@ void LLPanelEditWearable::getSortedParams(value_map_t &sorted_params, const std:
|
|||||||
{
|
{
|
||||||
if(!getWearable())return;
|
if(!getWearable())return;
|
||||||
|
|
||||||
LLWearable::visual_param_vec_t param_list;
|
LLViewerWearable::visual_param_vec_t param_list;
|
||||||
ESex avatar_sex = gAgentAvatarp->getSex();
|
ESex avatar_sex = gAgentAvatarp->getSex();
|
||||||
|
|
||||||
getWearable()->getVisualParams(param_list);
|
getWearable()->getVisualParams(param_list);
|
||||||
|
|
||||||
for (LLWearable::visual_param_vec_t::iterator iter = param_list.begin();
|
for (LLViewerWearable::visual_param_vec_t::iterator iter = param_list.begin();
|
||||||
iter != param_list.end();
|
iter != param_list.end();
|
||||||
++iter)
|
++iter)
|
||||||
{
|
{
|
||||||
@@ -1518,7 +1519,7 @@ void LLPanelEditWearable::buildParamList(LLScrollingPanelList *panel_list, value
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLPanelEditWearable::configureAlphaCheckbox(LLVOAvatarDefines::ETextureIndex te, const std::string& name)
|
void LLPanelEditWearable::configureAlphaCheckbox(LLAvatarAppearanceDefines::ETextureIndex te, const std::string& name)
|
||||||
{
|
{
|
||||||
LLCheckBoxCtrl* checkbox = getChild<LLCheckBoxCtrl>(name, true, false);
|
LLCheckBoxCtrl* checkbox = getChild<LLCheckBoxCtrl>(name, true, false);
|
||||||
if(checkbox)
|
if(checkbox)
|
||||||
@@ -1529,7 +1530,7 @@ void LLPanelEditWearable::configureAlphaCheckbox(LLVOAvatarDefines::ETextureInde
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLPanelEditWearable::onInvisibilityCommit(LLCheckBoxCtrl* checkbox_ctrl, LLVOAvatarDefines::ETextureIndex te)
|
void LLPanelEditWearable::onInvisibilityCommit(LLCheckBoxCtrl* checkbox_ctrl, LLAvatarAppearanceDefines::ETextureIndex te)
|
||||||
{
|
{
|
||||||
if (!checkbox_ctrl) return;
|
if (!checkbox_ctrl) return;
|
||||||
if (!getWearable()) return;
|
if (!getWearable()) return;
|
||||||
@@ -1572,7 +1573,7 @@ void LLPanelEditWearable::updateAlphaCheckboxes()
|
|||||||
for(string_texture_index_map_t::iterator iter = mAlphaCheckbox2Index.begin();
|
for(string_texture_index_map_t::iterator iter = mAlphaCheckbox2Index.begin();
|
||||||
iter != mAlphaCheckbox2Index.end(); ++iter )
|
iter != mAlphaCheckbox2Index.end(); ++iter )
|
||||||
{
|
{
|
||||||
LLVOAvatarDefines::ETextureIndex te = (LLVOAvatarDefines::ETextureIndex)iter->second;
|
LLAvatarAppearanceDefines::ETextureIndex te = (LLAvatarAppearanceDefines::ETextureIndex)iter->second;
|
||||||
LLCheckBoxCtrl* ctrl = getChild<LLCheckBoxCtrl>(iter->first, true, false);
|
LLCheckBoxCtrl* ctrl = getChild<LLCheckBoxCtrl>(iter->first, true, false);
|
||||||
if (ctrl)
|
if (ctrl)
|
||||||
{
|
{
|
||||||
@@ -1590,7 +1591,7 @@ void LLPanelEditWearable::initPreviousAlphaTextures()
|
|||||||
initPreviousAlphaTextureEntry(TEX_LOWER_ALPHA);
|
initPreviousAlphaTextureEntry(TEX_LOWER_ALPHA);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLPanelEditWearable::initPreviousAlphaTextureEntry(LLVOAvatarDefines::ETextureIndex te)
|
void LLPanelEditWearable::initPreviousAlphaTextureEntry(LLAvatarAppearanceDefines::ETextureIndex te)
|
||||||
{
|
{
|
||||||
if(!getWearable())
|
if(!getWearable())
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -30,12 +30,12 @@
|
|||||||
#include "llpanel.h"
|
#include "llpanel.h"
|
||||||
#include "llscrollingpanellist.h"
|
#include "llscrollingpanellist.h"
|
||||||
#include "llmodaldialog.h"
|
#include "llmodaldialog.h"
|
||||||
#include "llvoavatardefines.h"
|
#include "llavatarappearancedefines.h"
|
||||||
#include "llwearabletype.h"
|
#include "llwearabletype.h"
|
||||||
|
|
||||||
class LLAccordionCtrl;
|
class LLAccordionCtrl;
|
||||||
class LLCheckBoxCtrl;
|
class LLCheckBoxCtrl;
|
||||||
class LLWearable;
|
class LLViewerWearable;
|
||||||
class LLTextBox;
|
class LLTextBox;
|
||||||
class LLViewerInventoryItem;
|
class LLViewerInventoryItem;
|
||||||
class LLViewerVisualParam;
|
class LLViewerVisualParam;
|
||||||
@@ -47,7 +47,7 @@ class LLLineEditor;
|
|||||||
class LLSubpart;
|
class LLSubpart;
|
||||||
class LLWearableSaveAsDialog;
|
class LLWearableSaveAsDialog;
|
||||||
|
|
||||||
using namespace LLVOAvatarDefines;
|
using namespace LLAvatarAppearanceDefines;
|
||||||
|
|
||||||
class LLPanelEditWearable : public LLPanel
|
class LLPanelEditWearable : public LLPanel
|
||||||
{
|
{
|
||||||
@@ -64,7 +64,7 @@ public:
|
|||||||
|
|
||||||
const std::string& getLabel() { return LLWearableType::getTypeLabel( mType ); }
|
const std::string& getLabel() { return LLWearableType::getTypeLabel( mType ); }
|
||||||
LLWearableType::EType getType() const{ return mType; }
|
LLWearableType::EType getType() const{ return mType; }
|
||||||
LLWearable* getWearable() const;
|
LLViewerWearable* getWearable() const;
|
||||||
|
|
||||||
void onTabChanged(LLUICtrl* ctrl);
|
void onTabChanged(LLUICtrl* ctrl);
|
||||||
bool onTabPrecommit();
|
bool onTabPrecommit();
|
||||||
@@ -112,25 +112,25 @@ public:
|
|||||||
void onTexturePickerCommit(const LLUICtrl*);
|
void onTexturePickerCommit(const LLUICtrl*);
|
||||||
|
|
||||||
//alpha mask checkboxes
|
//alpha mask checkboxes
|
||||||
void configureAlphaCheckbox(LLVOAvatarDefines::ETextureIndex te, const std::string& name);
|
void configureAlphaCheckbox(LLAvatarAppearanceDefines::ETextureIndex te, const std::string& name);
|
||||||
void onInvisibilityCommit(LLCheckBoxCtrl* checkbox_ctrl, LLVOAvatarDefines::ETextureIndex te);
|
void onInvisibilityCommit(LLCheckBoxCtrl* checkbox_ctrl, LLAvatarAppearanceDefines::ETextureIndex te);
|
||||||
void updateAlphaCheckboxes();
|
void updateAlphaCheckboxes();
|
||||||
void initPreviousAlphaTextures();
|
void initPreviousAlphaTextures();
|
||||||
void initPreviousAlphaTextureEntry(LLVOAvatarDefines::ETextureIndex te);
|
void initPreviousAlphaTextureEntry(LLAvatarAppearanceDefines::ETextureIndex te);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
LLWearableType::EType mType;
|
LLWearableType::EType mType;
|
||||||
BOOL mCanTakeOff;
|
BOOL mCanTakeOff;
|
||||||
typedef std::map<std::string, LLVOAvatarDefines::ETextureIndex> string_texture_index_map_t;
|
typedef std::map<std::string, LLAvatarAppearanceDefines::ETextureIndex> string_texture_index_map_t;
|
||||||
string_texture_index_map_t mAlphaCheckbox2Index;
|
string_texture_index_map_t mAlphaCheckbox2Index;
|
||||||
|
|
||||||
typedef std::map<LLVOAvatarDefines::ETextureIndex, LLUUID> s32_uuid_map_t;
|
typedef std::map<LLAvatarAppearanceDefines::ETextureIndex, LLUUID> s32_uuid_map_t;
|
||||||
s32_uuid_map_t mPreviousAlphaTexture;
|
s32_uuid_map_t mPreviousAlphaTexture;
|
||||||
U32 mCurrentSubpart;
|
U32 mCurrentSubpart;
|
||||||
U32 mCurrentIndex;
|
U32 mCurrentIndex;
|
||||||
LLWearable* mCurrentWearable;
|
LLViewerWearable* mCurrentWearable;
|
||||||
LLWearable* mPendingWearable; //For SaveAs. There's a period where the old wearable will be removed, but the new one will still be pending,
|
LLViewerWearable* mPendingWearable; //For SaveAs. There's a period where the old wearable will be removed, but the new one will still be pending,
|
||||||
//so this is needed to retain focus on this wearables tab over the messy transition.
|
//so this is needed to retain focus on this wearables tab over the messy transition.
|
||||||
bool mPendingRefresh; //LLAgentWearables::setWearableOutfit fires a buttload of remove/wear calls which spams wearablesChanged
|
bool mPendingRefresh; //LLAgentWearables::setWearableOutfit fires a buttload of remove/wear calls which spams wearablesChanged
|
||||||
//a bazillion pointless (and not particularly valid) times. Deferring to draw effectively sorts it all out.
|
//a bazillion pointless (and not particularly valid) times. Deferring to draw effectively sorts it all out.
|
||||||
|
|||||||
@@ -48,6 +48,7 @@
|
|||||||
#include "llinventorydefines.h"
|
#include "llinventorydefines.h"
|
||||||
#include "llinventoryfilter.h"
|
#include "llinventoryfilter.h"
|
||||||
#include "llinventoryfunctions.h"
|
#include "llinventoryfunctions.h"
|
||||||
|
#include "llinventoryicon.h"
|
||||||
#include "llpreviewanim.h"
|
#include "llpreviewanim.h"
|
||||||
#include "llpreviewgesture.h"
|
#include "llpreviewgesture.h"
|
||||||
#include "llpreviewnotecard.h"
|
#include "llpreviewnotecard.h"
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ LLPreviewTexture::LLPreviewTexture(const std::string& name,
|
|||||||
mLastWidth(0),
|
mLastWidth(0),
|
||||||
mAspectRatio(0.f),
|
mAspectRatio(0.f),
|
||||||
mImage(NULL),
|
mImage(NULL),
|
||||||
mImageOldBoostLevel(LLViewerTexture::BOOST_NONE)
|
mImageOldBoostLevel(LLGLTexture::BOOST_NONE)
|
||||||
{
|
{
|
||||||
const LLInventoryItem *item = getItem();
|
const LLInventoryItem *item = getItem();
|
||||||
if(item)
|
if(item)
|
||||||
@@ -700,9 +700,9 @@ void LLPreviewTexture::onAspectRatioCommit(LLUICtrl* ctrl, void* userdata)
|
|||||||
|
|
||||||
void LLPreviewTexture::loadAsset()
|
void LLPreviewTexture::loadAsset()
|
||||||
{
|
{
|
||||||
mImage = LLViewerTextureManager::getFetchedTexture(mImageID, MIPMAP_TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
|
mImage = LLViewerTextureManager::getFetchedTexture(mImageID, MIPMAP_TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE);
|
||||||
mImageOldBoostLevel = mImage->getBoostLevel();
|
mImageOldBoostLevel = mImage->getBoostLevel();
|
||||||
mImage->setBoostLevel(LLViewerTexture::BOOST_PREVIEW);
|
mImage->setBoostLevel(LLGLTexture::BOOST_PREVIEW);
|
||||||
mImage->forceToSaveRawImage(0) ;
|
mImage->forceToSaveRawImage(0) ;
|
||||||
mAssetStatus = PREVIEW_ASSET_LOADING;
|
mAssetStatus = PREVIEW_ASSET_LOADING;
|
||||||
mUpdateDimensions = TRUE;
|
mUpdateDimensions = TRUE;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user