llpanelface.h 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. /**
  2. * @file llpanelface.h
  3. * @brief Panel in the tools floater for editing face textures, colors, etc.
  4. *
  5. * $LicenseInfo:firstyear=2001&license=viewergpl$
  6. *
  7. * Copyright (c) 2001-2009, Linden Research, Inc, (c) 2009-2024 Henri Beauchamp
  8. *
  9. * Second Life Viewer Source Code
  10. * The source code in this file ("Source Code") is provided by Linden Lab
  11. * to you under the terms of the GNU General Public License, version 2.0
  12. * ("GPL"), unless you have obtained a separate licensing agreement
  13. * ("Other License"), formally executed by you and Linden Lab. Terms of
  14. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  15. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  16. *
  17. * There are special exceptions to the terms and conditions of the GPL as
  18. * it is applied to this Source Code. View the full text of the exception
  19. * in the file doc/FLOSS-exception.txt in this software distribution, or
  20. * online at
  21. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  22. *
  23. * By copying, modifying or distributing this software, you acknowledge
  24. * that you have read and understood your obligations described above,
  25. * and agree to abide by those obligations.
  26. *
  27. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  28. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  29. * COMPLETENESS OR PERFORMANCE.
  30. * $/LicenseInfo$
  31. */
  32. #ifndef LL_LLPANELFACE_H
  33. #define LL_LLPANELFACE_H
  34. #include "llmaterial.h"
  35. #include "llpanel.h"
  36. #include "llcolor4.h"
  37. class LLButton;
  38. class LLCheckBoxCtrl;
  39. class LLColorSwatchCtrl;
  40. class LLComboBox;
  41. class LLFace;
  42. class LLFetchedGLTFMaterial;
  43. class LLInventoryItem;
  44. class LLRadioGroup;
  45. class LLSpinCtrl;
  46. class LLTextBox;
  47. class LLTextureCtrl;
  48. class LLViewerObject;
  49. class LLView;
  50. class LLViewerTexture;
  51. class LLPanelFace final : public LLPanel
  52. {
  53. public:
  54. LLPanelFace(const std::string& name);
  55. ~LLPanelFace() override;
  56. bool postBuild() override;
  57. void refresh() override;
  58. void draw() override;
  59. // *TODO: not yet implemented in LL's viewer v3...
  60. void setMediaURL(const std::string& url) {}
  61. void setMediaType(const std::string& mime_type) {}
  62. LLMaterialPtr createDefaultMaterial(LLMaterialPtr curmat);
  63. LL_INLINE LLComboBox* getComboTexGen() { return mComboTexGen; }
  64. LL_INLINE LLSpinCtrl* getTexScaleU() { return mTexScaleU; }
  65. LL_INLINE LLSpinCtrl* getTexScaleV() { return mTexScaleV; }
  66. LL_INLINE LLSpinCtrl* getTexOffsetU() { return mTexOffsetU; }
  67. LL_INLINE LLSpinCtrl* getTexOffsetV() { return mTexOffsetV; }
  68. LL_INLINE LLSpinCtrl* getTexRot() { return mTexRot; }
  69. LL_INLINE LLCheckBoxCtrl* getTexFlipS() { return mCheckTexFlipS; }
  70. LL_INLINE LLCheckBoxCtrl* getTexFlipT() { return mCheckTexFlipT; }
  71. LL_INLINE LLCheckBoxCtrl* getPlanarAlign() { return mCheckPlanarAlign; }
  72. static LLRender::eTexIndex getTextureChannelToEdit();
  73. private:
  74. LLFace* getLastSelectedFace();
  75. void getState();
  76. void sendTexture(); // Applies and sends texture
  77. void sendTextureInfo(); // Applies and sends texture scale, offset, etc.
  78. void sendColor(); // Applies and sends color
  79. void sendAlpha(); // Applies and sends transparency
  80. void sendBump(); // Applies and sends bump map
  81. void sendTexGen(); // Applies and sends texture mapping
  82. void sendShiny(); // Applies and sends shininess
  83. void sendFullbright(); // Applies and sends full bright
  84. void sendGlow(); // Applies and sends glow
  85. void updateMaterial(); // Applies and sends materials
  86. void removeMaterial(); // Remove materials from selection
  87. bool canEditSelection();
  88. void updateAlphaControls();
  89. void updateBumpyControls();
  90. void updateShinyControls();
  91. // This method returns true if the drag should succeed.
  92. static bool onDragTexture(LLUICtrl* ctrl, LLInventoryItem* item, void* ud);
  93. static void onSelectMapType(LLUICtrl* ctrl, void* userdata);
  94. static void onCommitNormalMap(LLUICtrl* ctrl, void* userdata);
  95. static void onCommitSpecularMap(LLUICtrl* ctrl, void* userdata);
  96. static void onCommitAlphaMaterial(LLUICtrl* ctrl, void* userdata);
  97. static void onCommitBumpyMaterial(LLUICtrl* ctrl, void* userdata);
  98. static void onCommitShinyMaterial(LLUICtrl* ctrl, void* userdata);
  99. static void onCommitShinyColor(LLUICtrl* ctrl, void* userdata);
  100. static void onCommitAlphaMode(LLUICtrl* ctrl, void* userdata);
  101. static void onCommitTexture(LLUICtrl* ctrl, void* userdata);
  102. static void onCancelTexture(LLUICtrl* ctrl, void* userdata);
  103. static void onSelectTexture(LLUICtrl* ctrl, void* userdata);
  104. static void onCommitTextureInfo(LLUICtrl* ctrl, void* userdata);
  105. static void onCommitRepeatsPerMeter(LLUICtrl* ctrl, void* userdata);
  106. static void onCommitColor(LLUICtrl* ctrl, void* userdata);
  107. static void onCommitAlpha(LLUICtrl* ctrl, void* userdata);
  108. static void onCancelColor(LLUICtrl* ctrl, void* userdata);
  109. static void onSelectColor(LLUICtrl* ctrl, void* userdata);
  110. static void onCommitBump(LLUICtrl* ctrl, void* userdata);
  111. static void onCommitTexGen(LLUICtrl* ctrl, void* userdata);
  112. static void onCommitShiny(LLUICtrl* ctrl, void* userdata);
  113. static void onCommitFullbright(LLUICtrl* ctrl, void* userdata);
  114. static void onCommitGlow(LLUICtrl* ctrl, void *userdata);
  115. static void onCommitPlanarAlign(LLUICtrl* ctrl, void* userdata);
  116. static void onCommitPbrMaterial(LLUICtrl* ctrl, void* userdata);
  117. static void onClickEditPBR(void*);
  118. static void onClickLocalPBR(void* userdata);
  119. static void onClickLoadPBR(void* userdata);
  120. static void onClickSavePBR(void*);
  121. static void onClickRemoveMaterial(void* userdata);
  122. static void onClickAutoFix(void*);
  123. #if 0
  124. static void onAlignTextureLayers(void* userdata);
  125. #endif
  126. static F32 valueGlow(LLViewerObject* object, S32 face);
  127. static void onSelectLocalPBR(const LLUUID& id, void*);
  128. static void onSelectInventoryPBR(const std::vector<std::string>&,
  129. const uuid_vec_t& ids, void*, bool);
  130. private:
  131. LLPointer<LLFetchedGLTFMaterial> mGLTFMaterial;
  132. LLPointer<LLViewerTexture> mMatTexture;
  133. LLColorSwatchCtrl* mColorSwatch;
  134. LLColorSwatchCtrl* mShinyColorSwatch;
  135. LLRadioGroup* mMapsRadio;
  136. LLTextureCtrl* mTextureCtrl;
  137. LLTextureCtrl* mNormalCtrl;
  138. LLTextureCtrl* mSpecularCtrl;
  139. LLView* mPbrThumbBorder;
  140. LLComboBox* mComboAlphaMode;
  141. LLComboBox* mComboBumpiness;
  142. LLComboBox* mComboShininess;
  143. LLComboBox* mComboTexGen;
  144. LLCheckBoxCtrl* mCheckFullbright;
  145. LLCheckBoxCtrl* mCheckPlanarAlign;
  146. LLCheckBoxCtrl* mCheckTexFlipS;
  147. LLCheckBoxCtrl* mCheckTexFlipT;
  148. LLCheckBoxCtrl* mCheckBumpyFlipS;
  149. LLCheckBoxCtrl* mCheckBumpyFlipT;
  150. LLCheckBoxCtrl* mCheckShinyFlipS;
  151. LLCheckBoxCtrl* mCheckShinyFlipT;
  152. LLTextBox* mLabelDiffuseColor;
  153. LLTextBox* mLabelMaps;
  154. LLTextBox* mLabelPbrPreview;
  155. LLTextBox* mLabelAlphaMode;
  156. LLTextBox* mLabelMaskCutoff;
  157. LLTextBox* mLabelShinyColor;
  158. LLTextBox* mLabelGlossiness;
  159. LLTextBox* mLabelEnvironment;
  160. LLTextBox* mLabelShininess;
  161. LLTextBox* mLabelBumpiness;
  162. LLTextBox* mLabelColorTransp;
  163. LLTextBox* mLabelRepeats;
  164. LLTextBox* mLabelTexScale;
  165. LLTextBox* mLabelTexScaleUnit;
  166. LLTextBox* mLabelTexScaleHoriz;
  167. LLTextBox* mLabelTexScaleVert;
  168. LLTextBox* mLabelTexOffset;
  169. LLTextBox* mLabelTexOffsetHoriz;
  170. LLTextBox* mLabelTexOffsetVert;
  171. LLTextBox* mLabelTexRotate;
  172. LLTextBox* mLabelTexGen;
  173. LLTextBox* mLabelMedia;
  174. LLSpinCtrl* mTransparency; // Transparency = 1 - alpha
  175. LLSpinCtrl* mGlow;
  176. LLSpinCtrl* mTexScaleU;
  177. LLSpinCtrl* mTexScaleV;
  178. LLSpinCtrl* mTexOffsetU;
  179. LLSpinCtrl* mTexOffsetV;
  180. LLSpinCtrl* mTexRot;
  181. LLSpinCtrl* mGlossiness;
  182. LLSpinCtrl* mEnvironment;
  183. LLSpinCtrl* mMaskCutoff;
  184. LLSpinCtrl* mBumpyScaleU;
  185. LLSpinCtrl* mBumpyScaleV;
  186. LLSpinCtrl* mBumpyOffsetU;
  187. LLSpinCtrl* mBumpyOffsetV;
  188. LLSpinCtrl* mBumpyRot;
  189. LLSpinCtrl* mShinyScaleU;
  190. LLSpinCtrl* mShinyScaleV;
  191. LLSpinCtrl* mShinyOffsetU;
  192. LLSpinCtrl* mShinyOffsetV;
  193. LLSpinCtrl* mShinyRot;
  194. LLSpinCtrl* mPbrScaleU;
  195. LLSpinCtrl* mPbrScaleV;
  196. LLSpinCtrl* mPbrOffsetU;
  197. LLSpinCtrl* mPbrOffsetV;
  198. LLSpinCtrl* mPbrRot;
  199. LLSpinCtrl* mRepeats;
  200. LLButton* mButtonResetMaterial;
  201. LLButton* mButtonEditPBR;
  202. LLButton* mButtonLocalPBR;
  203. LLButton* mButtonLoadPBR;
  204. LLButton* mButtonSavePBR;
  205. #if 0
  206. LLButton* mButtonAlignMap;
  207. #endif
  208. LLButton* mButtonAlignMedia;
  209. std::string mRepeatsPerMeterText;
  210. std::string mRepeatsPerFaceText;
  211. std::string mUseTextureText;
  212. LLRect mThumbnailRect;
  213. bool mHasMultiplePbrSelection;
  214. bool mIsAlpha;
  215. static LLPanelFace* sInstance;
  216. };
  217. #endif