/indra/newview/llpaneleditwearable.h

https://bitbucket.org/lindenlab/viewer-beta/ · C++ Header · 175 lines · 100 code · 34 blank · 41 comment · 0 complexity · ac881ed8f81975b2937e58e0d18c4641 MD5 · raw file

  1. /**
  2. * @file llpaneleditwearable.h
  3. * @brief A LLPanel dedicated to the editing of wearables.
  4. *
  5. * $LicenseInfo:firstyear=2009&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_LLPANELEDITWEARABLE_H
  27. #define LL_LLPANELEDITWEARABLE_H
  28. #include "llpanel.h"
  29. #include "llscrollingpanellist.h"
  30. #include "llmodaldialog.h"
  31. #include "llvoavatardefines.h"
  32. #include "llwearabletype.h"
  33. class LLAccordionCtrl;
  34. class LLCheckBoxCtrl;
  35. class LLWearable;
  36. class LLTextBox;
  37. class LLViewerInventoryItem;
  38. class LLViewerVisualParam;
  39. class LLVisualParamHint;
  40. class LLViewerJointMesh;
  41. class LLAccordionCtrlTab;
  42. class LLJoint;
  43. class LLLineEditor;
  44. class LLPanelEditWearable : public LLPanel
  45. {
  46. public:
  47. LLPanelEditWearable( );
  48. virtual ~LLPanelEditWearable();
  49. /*virtual*/ BOOL postBuild();
  50. /*virtual*/ BOOL isDirty() const; // LLUICtrl
  51. /*virtual*/ void draw();
  52. // changes camera angle to default for selected subpart
  53. void changeCamera(U8 subpart);
  54. LLWearable* getWearable() { return mWearablePtr; }
  55. void setWearable(LLWearable *wearable, BOOL disable_camera_switch = FALSE);
  56. void saveChanges(bool force_save_as = false);
  57. void revertChanges();
  58. void showDefaultSubpart();
  59. void onTabExpandedCollapsed(const LLSD& param, U8 index);
  60. void updateScrollingPanelList();
  61. static void onRevertButtonClicked(void* userdata);
  62. void onCommitSexChange();
  63. void onSaveAsButtonClicked();
  64. void saveAsCallback(const LLSD& notification, const LLSD& response);
  65. virtual void setVisible(BOOL visible);
  66. private:
  67. typedef std::map<F32, LLViewerVisualParam*> value_map_t;
  68. void showWearable(LLWearable* wearable, BOOL show, BOOL disable_camera_switch = FALSE);
  69. void updateScrollingPanelUI();
  70. LLPanel* getPanel(LLWearableType::EType type);
  71. void getSortedParams(value_map_t &sorted_params, const std::string &edit_group);
  72. void buildParamList(LLScrollingPanelList *panel_list, value_map_t &sorted_params, LLAccordionCtrlTab *tab, LLJoint* jointp);
  73. // update bottom bar buttons ("Save", "Revert", etc)
  74. void updateVerbs();
  75. void onColorSwatchCommit(const LLUICtrl*);
  76. void onTexturePickerCommit(const LLUICtrl*);
  77. void updatePanelPickerControls(LLWearableType::EType type);
  78. void toggleTypeSpecificControls(LLWearableType::EType type);
  79. void updateTypeSpecificControls(LLWearableType::EType type);
  80. //alpha mask checkboxes
  81. void configureAlphaCheckbox(LLVOAvatarDefines::ETextureIndex te, const std::string& name);
  82. void onInvisibilityCommit(LLCheckBoxCtrl* checkbox_ctrl, LLVOAvatarDefines::ETextureIndex te);
  83. void updateAlphaCheckboxes();
  84. void initPreviousAlphaTextures();
  85. void initPreviousAlphaTextureEntry(LLVOAvatarDefines::ETextureIndex te);
  86. // callback for HeightUnits parameter.
  87. bool changeHeightUnits(const LLSD& new_value);
  88. // updates current metric and replacemet metric label text
  89. void updateMetricLayout(BOOL new_value);
  90. // updates avatar height label
  91. void updateAvatarHeightLabel();
  92. void onWearablePanelVisibilityChange(const LLSD &in_visible_chain, LLAccordionCtrl* accordion_ctrl);
  93. void setWearablePanelVisibilityChangeCallback(LLPanel* bodypart_panel);
  94. // the pointer to the wearable we're editing. NULL means we're not editing a wearable.
  95. LLWearable *mWearablePtr;
  96. LLViewerInventoryItem* mWearableItem;
  97. // these are constant no matter what wearable we're editing
  98. LLButton *mBtnRevert;
  99. LLButton *mBtnBack;
  100. std::string mBackBtnLabel;
  101. LLTextBox *mPanelTitle;
  102. LLTextBox *mDescTitle;
  103. LLTextBox *mTxtAvatarHeight;
  104. // localized and parametrized strings that used to build avatar_height_label
  105. std::string mMeters;
  106. std::string mFeet;
  107. std::string mHeigth;
  108. LLUIString mHeigthValue;
  109. LLUIString mReplacementMetricUrl;
  110. // color for mHeigth string
  111. LLUIColor mAvatarHeigthLabelColor;
  112. // color for mHeigthValue string
  113. LLUIColor mAvatarHeigthValueLabelColor;
  114. // This text editor reference will change each time we edit a new wearable -
  115. // it will be grabbed from the currently visible panel
  116. LLLineEditor *mNameEditor;
  117. // The following panels will be shown/hidden based on what wearable we're editing
  118. // body parts
  119. LLPanel *mPanelShape;
  120. LLPanel *mPanelSkin;
  121. LLPanel *mPanelEyes;
  122. LLPanel *mPanelHair;
  123. //clothes
  124. LLPanel *mPanelShirt;
  125. LLPanel *mPanelPants;
  126. LLPanel *mPanelShoes;
  127. LLPanel *mPanelSocks;
  128. LLPanel *mPanelJacket;
  129. LLPanel *mPanelGloves;
  130. LLPanel *mPanelUndershirt;
  131. LLPanel *mPanelUnderpants;
  132. LLPanel *mPanelSkirt;
  133. LLPanel *mPanelAlpha;
  134. LLPanel *mPanelTattoo;
  135. LLPanel *mPanelPhysics;
  136. typedef std::map<std::string, LLVOAvatarDefines::ETextureIndex> string_texture_index_map_t;
  137. string_texture_index_map_t mAlphaCheckbox2Index;
  138. typedef std::map<LLVOAvatarDefines::ETextureIndex, LLUUID> s32_uuid_map_t;
  139. s32_uuid_map_t mPreviousAlphaTexture;
  140. };
  141. #endif