Created branch for the new texture edit panel
parent
cfcbd6fc54
commit
8e4136292e
|
|
@ -151,6 +151,7 @@ set(viewer_SOURCE_FILES
|
|||
fsnearbychatvoicemonitor.cpp
|
||||
fspanelblocklist.cpp
|
||||
fspanelcontactsets.cpp
|
||||
fspanelface.cpp
|
||||
fspanelimcontrolpanel.cpp
|
||||
fspanellogin.cpp
|
||||
fspanelprefs.cpp
|
||||
|
|
@ -940,6 +941,7 @@ set(viewer_HEADER_FILES
|
|||
fsnearbychatvoicemonitor.h
|
||||
fspanelblocklist.h
|
||||
fspanelcontactsets.h
|
||||
fspanelface.h
|
||||
fspanelimcontrolpanel.h
|
||||
fspanellogin.h
|
||||
fspanelprefs.h
|
||||
|
|
|
|||
|
|
@ -26737,5 +26737,44 @@ Change of this parameter will affect the layout of buttons in notification toast
|
|||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
</map>
|
||||
<key>FSInternalCanEditObjectFaces</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Internal control to show/hide object texture/material edit controls</string>
|
||||
<key>HideFromEditor</key>
|
||||
<integer>1</integer>
|
||||
<key>Persist</key>
|
||||
<integer>0</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>FSInternalFaceHasBPNormalMap</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Internal control to store a flag about the edited face having a Blinn-Phong normal map or not</string>
|
||||
<key>HideFromEditor</key>
|
||||
<integer>1</integer>
|
||||
<key>Persist</key>
|
||||
<integer>0</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
<key>FSInternalFaceHasBPSpecularMap</key>
|
||||
<map>
|
||||
<key>Comment</key>
|
||||
<string>Internal control to store a flag about the edited face having a Blinn-Phong specular map or not</string>
|
||||
<key>HideFromEditor</key>
|
||||
<integer>1</integer>
|
||||
<key>Persist</key>
|
||||
<integer>0</integer>
|
||||
<key>Type</key>
|
||||
<string>Boolean</string>
|
||||
<key>Value</key>
|
||||
<integer>1</integer>
|
||||
</map>
|
||||
</map>
|
||||
</llsd>
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,799 @@
|
|||
/**
|
||||
* @file fspanelface.h
|
||||
* @brief Consolidated materials/texture panel in the tools floater
|
||||
*
|
||||
* $LicenseInfo:firstyear=2001&license=viewerlgpl$
|
||||
* Second Life Viewer Source Code
|
||||
* Copyright (C) 2010, Linden Research, Inc.
|
||||
* Copyright (C) 2024, Zi Ree@Second Life
|
||||
*
|
||||
* 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 FS_FSPANELFACE_H
|
||||
#define FS_FSPANELFACE_H
|
||||
|
||||
#include "v4color.h"
|
||||
#include "llpanel.h"
|
||||
#include "llgltfmaterial.h"
|
||||
#include "llmaterial.h"
|
||||
#include "llmaterialmgr.h"
|
||||
#include "lltextureentry.h"
|
||||
#include "llselectmgr.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
class LLButton;
|
||||
class LLCheckBoxCtrl;
|
||||
class LLColorSwatchCtrl;
|
||||
class LLComboBox;
|
||||
class LLInventoryItem;
|
||||
class LLLineEditor;
|
||||
class LLRadioGroup;
|
||||
class LLSpinCtrl;
|
||||
class LLTextBox;
|
||||
class LLTextureCtrl;
|
||||
class LLUICtrl;
|
||||
class LLViewerObject;
|
||||
class LLFloater;
|
||||
class LLMaterialID;
|
||||
class LLMediaCtrl;
|
||||
class LLMenuButton;
|
||||
|
||||
class PBRPickerItemListener;
|
||||
|
||||
class LLTabContainer;
|
||||
|
||||
// Represents an edit for use in replicating the op across one or more materials in the selection set.
|
||||
//
|
||||
// The apply function optionally performs the edit which it implements
|
||||
// as a functor taking Data that calls member func MaterialFunc taking SetValueType
|
||||
// on an instance of the LLMaterial class.
|
||||
//
|
||||
// boost who?
|
||||
//
|
||||
template<
|
||||
typename DataType,
|
||||
typename SetValueType,
|
||||
void (LLMaterial::*MaterialEditFunc)(SetValueType data) >
|
||||
class FSMaterialEditFunctor
|
||||
{
|
||||
public:
|
||||
FSMaterialEditFunctor(const DataType& data) : _data(data) {}
|
||||
virtual ~FSMaterialEditFunctor() {}
|
||||
virtual void apply(LLMaterialPtr& material) { (material->*(MaterialEditFunc))(_data); }
|
||||
DataType _data;
|
||||
};
|
||||
|
||||
template<
|
||||
typename DataType,
|
||||
DataType (LLMaterial::*MaterialGetFunc)() >
|
||||
class FSMaterialGetFunctor
|
||||
{
|
||||
public:
|
||||
FSMaterialGetFunctor() {}
|
||||
virtual DataType get(LLMaterialPtr& material) { return (material->*(MaterialGetFunc)); }
|
||||
};
|
||||
|
||||
template<
|
||||
typename DataType,
|
||||
DataType (LLTextureEntry::*TEGetFunc)() >
|
||||
class FSTEGetFunctor
|
||||
{
|
||||
public:
|
||||
FSTEGetFunctor() {}
|
||||
virtual DataType get(LLTextureEntry* entry) { return (entry*(TEGetFunc)); }
|
||||
};
|
||||
|
||||
//
|
||||
// main class
|
||||
//
|
||||
|
||||
class FSPanelFace : public LLPanel
|
||||
{
|
||||
public:
|
||||
FSPanelFace();
|
||||
virtual ~FSPanelFace();
|
||||
|
||||
virtual BOOL postBuild();
|
||||
|
||||
void refresh();
|
||||
void refreshMedia();
|
||||
void unloadMedia();
|
||||
void changePrecision(S32 decimal_precision); // <FS:CR> Adjustable decimal precision
|
||||
|
||||
static void onMaterialOverrideReceived(const LLUUID& object_id, S32 side);
|
||||
|
||||
/*virtual*/ void onVisibilityChange(BOOL new_visibility);
|
||||
/*virtual*/ void draw();
|
||||
|
||||
LLMaterialPtr createDefaultMaterial(LLMaterialPtr current_material);
|
||||
|
||||
LLRender::eTexIndex getTextureChannelToEdit();
|
||||
LLRender::eTexIndex getTextureDropChannel();
|
||||
|
||||
protected:
|
||||
void navigateToTitleMedia(const std::string url);
|
||||
bool selectedMediaEditable();
|
||||
void clearMediaSettings();
|
||||
void updateMediaSettings();
|
||||
void updateMediaTitle();
|
||||
|
||||
void getState();
|
||||
|
||||
void sendTexture(); // applies and sends texture
|
||||
void sendTextureInfo(); // applies and sends texture scale, offset, etc.
|
||||
void sendColor(); // applies and sends color
|
||||
void sendAlpha(); // applies and sends transparency
|
||||
void sendBump(U32 bumpiness); // applies and sends bump map
|
||||
void sendTexGen(); // applies and sends bump map
|
||||
void sendShiny(U32 shininess); // applies and sends shininess
|
||||
void sendFullbright(); // applies and sends full bright
|
||||
void sendGlow();
|
||||
void alignTextureLayer();
|
||||
|
||||
void updateCopyTexButton();
|
||||
|
||||
//
|
||||
// UI Callbacks
|
||||
//
|
||||
|
||||
// common controls and parameters for Blinn-Phong and PBR
|
||||
void onCopyFaces(); // <FS> Extended copy & paste buttons
|
||||
void onPasteFaces();
|
||||
void onCommitGlow();
|
||||
void onCommitRepeatsPerMeter();
|
||||
|
||||
// Blinn-Phong alpha parameters
|
||||
void onCommitAlpha();
|
||||
void onCommitAlphaMode();
|
||||
void onCommitMaterialMaskCutoff();
|
||||
void onCommitFullbright();
|
||||
|
||||
// Blinn-Phong texture transforms and controls
|
||||
void onCommitTexGen();
|
||||
void onCommitPlanarAlign();
|
||||
void onCommitBump();
|
||||
void onCommitShiny();
|
||||
void onCommitTextureScaleX();
|
||||
void onCommitTextureScaleY();
|
||||
void onCommitTextureOffsetX();
|
||||
void onCommitTextureOffsetY();
|
||||
void onCommitTextureRot();
|
||||
void onCommitMaterialBumpyScaleX();
|
||||
void onCommitMaterialBumpyScaleY();
|
||||
void onCommitMaterialBumpyOffsetX();
|
||||
void onCommitMaterialBumpyOffsetY();
|
||||
void onCommitMaterialBumpyRot();
|
||||
void onCommitMaterialShinyScaleX();
|
||||
void onCommitMaterialShinyScaleY();
|
||||
void onCommitMaterialShinyOffsetX();
|
||||
void onCommitMaterialShinyOffsetY();
|
||||
void onCommitMaterialShinyRot();
|
||||
void onCommitMaterialGloss();
|
||||
void onCommitMaterialEnv();
|
||||
|
||||
// Blinn-Phong Diffuse tint color swatch
|
||||
void onCommitColor();
|
||||
void onCancelColor();
|
||||
void onSelectColor();
|
||||
|
||||
// Blinn-Phong Diffuse texture swatch
|
||||
void onCommitTexture(const LLUICtrl* ctrl, const LLSD& data);
|
||||
void onCancelTexture();
|
||||
BOOL onDragTexture(LLInventoryItem* item); // this function is to return TRUE if the drag should succeed.
|
||||
void onCloseTexturePicker(const LLSD& data);
|
||||
|
||||
// Blinn-Phong Normal texture swatch
|
||||
void onCommitNormalTexture(const LLUICtrl* ctrl, const LLSD& data);
|
||||
void onCancelNormalTexture();
|
||||
|
||||
// Blinn-Phong Specular texture swatch
|
||||
void onCommitSpecularTexture(const LLUICtrl* ctrl, const LLSD& data);
|
||||
void onCancelSpecularTexture();
|
||||
|
||||
// Blinn-Phong Specular tint color swatch
|
||||
void onCommitShinyColor();
|
||||
void onCancelShinyColor();
|
||||
void onSelectShinyColor();
|
||||
|
||||
// Texture alignment and maps synchronization
|
||||
void onClickAutoFix();
|
||||
void onAlignTexture();
|
||||
void onClickMapsSync();
|
||||
|
||||
/*
|
||||
* Checks whether the selected texture from the LLFloaterTexturePicker can be applied to the currently selected object.
|
||||
* If agent selects texture which is not allowed to be applied for the currently selected object,
|
||||
* all controls of the floater texture picker which allow to apply the texture will be disabled.
|
||||
*/
|
||||
void onTextureSelectionChanged(const std::string& which_control);
|
||||
|
||||
// Media
|
||||
void onClickBtnEditMedia();
|
||||
void onClickBtnDeleteMedia();
|
||||
void onClickBtnAddMedia();
|
||||
|
||||
void alignMaterialsProperties();
|
||||
|
||||
//
|
||||
// PBR
|
||||
//
|
||||
|
||||
// PBR Material
|
||||
void onCommitPbr();
|
||||
void onCancelPbr();
|
||||
void onSelectPbr();
|
||||
BOOL onDragPbr(LLInventoryItem* item); // this function is to return TRUE if the drag should succeed.
|
||||
|
||||
void onPbrSelectionChanged(LLInventoryItem* itemp);
|
||||
void onClickBtnSavePBR();
|
||||
|
||||
void updatePBROverrideDisplay();
|
||||
|
||||
// PBR texture maps
|
||||
void onCommitPbr(const LLUICtrl* pbr_ctrl);
|
||||
void onCancelPbr(const LLUICtrl* pbr_ctrl);
|
||||
void onSelectPbr(const LLUICtrl* pbr_ctrl);
|
||||
|
||||
void getGLTFMaterial(LLGLTFMaterial* mat);
|
||||
|
||||
//
|
||||
// other
|
||||
//
|
||||
|
||||
bool deleteMediaConfirm(const LLSD& notification, const LLSD& response);
|
||||
bool multipleFacesSelectedConfirm(const LLSD& notification, const LLSD& response);
|
||||
|
||||
// Make UI reflect state of currently selected material (refresh)
|
||||
// and UI mode (e.g. editing normal map v diffuse map)
|
||||
//
|
||||
// @param force_set_values forces spinners to set value even if they are focused
|
||||
void updateUI(bool force_set_values = false);
|
||||
|
||||
// Convenience func to determine if all faces in selection have
|
||||
// identical planar texgen settings during edits
|
||||
//
|
||||
bool isIdenticalPlanarTexgen();
|
||||
|
||||
// Callback funcs for individual controls
|
||||
//
|
||||
static void syncRepeatX(FSPanelFace* self, F32 scaleU);
|
||||
static void syncRepeatY(FSPanelFace* self, F32 scaleV);
|
||||
static void syncOffsetX(FSPanelFace* self, F32 offsetU);
|
||||
static void syncOffsetY(FSPanelFace* self, F32 offsetV);
|
||||
static void syncMaterialRot(FSPanelFace* self, F32 rot, int te = -1);
|
||||
|
||||
// unify all GLTF spinners with no switching around required -Zi
|
||||
void onCommitGLTFUVSpinner(const LLUICtrl* ctrl, const LLSD& user_data);
|
||||
|
||||
void onClickBtnSelectSameTexture(const LLUICtrl* ctrl, const LLSD& user_data); // Find all faces with same texture
|
||||
|
||||
public: // needs to be accessible to selection manager
|
||||
void onCopyColor(); // records all selected faces
|
||||
void onPasteColor(); // to specific face
|
||||
void onPasteColor(LLViewerObject* objectp, S32 te); // to specific face
|
||||
void onCopyTexture();
|
||||
void onPasteTexture();
|
||||
void onPasteTexture(LLViewerObject* objectp, S32 te);
|
||||
|
||||
protected:
|
||||
//
|
||||
// Constant definitions for tabs and combo boxes
|
||||
// Must match the commbobox definitions in panel_tools_texture.xml // Not anymore -Zi
|
||||
//
|
||||
static constexpr S32 MATMEDIA_MATERIAL = 0; // Material
|
||||
static constexpr S32 MATMEDIA_PBR = 1; // PBR
|
||||
static constexpr S32 MATMEDIA_MEDIA = 2; // Media
|
||||
|
||||
static constexpr S32 MATTYPE_DIFFUSE = 0; // Diffuse material texture
|
||||
static constexpr S32 MATTYPE_NORMAL = 1; // Normal map
|
||||
static constexpr S32 MATTYPE_SPECULAR = 2; // Specular map
|
||||
|
||||
static constexpr S32 BUMPY_TEXTURE = 18; // use supplied normal map (index of "Use Texture" in combo box)
|
||||
static constexpr S32 SHINY_TEXTURE = 4; // use supplied specular map (index of "Use Texture" in combo box)
|
||||
|
||||
static constexpr S32 PBRTYPE_RENDER_MATERIAL_ID = 0; // Render Material ID
|
||||
static constexpr S32 PBRTYPE_BASE_COLOR = 1; // PBR Base Color
|
||||
static constexpr S32 PBRTYPE_METALLIC_ROUGHNESS = 2; // PBR Metallic
|
||||
static constexpr S32 PBRTYPE_EMISSIVE = 3; // PBR Emissive
|
||||
static constexpr S32 PBRTYPE_NORMAL = 4; // PBR Normal
|
||||
static constexpr S32 PBRTYPE_COUNT = 5; // number of PBR map types
|
||||
|
||||
public:
|
||||
// public because ... functors? -Zi
|
||||
void onCommitFlip(const LLSD& user_data);
|
||||
|
||||
// Blinn-Phong texture transforms and controls
|
||||
// public because ... functors? -Zi
|
||||
LLSpinCtrl* mCtrlTexScaleU;
|
||||
LLSpinCtrl* mCtrlTexScaleV;
|
||||
LLSpinCtrl* mCtrlBumpyScaleU;
|
||||
LLSpinCtrl* mCtrlBumpyScaleV;
|
||||
LLSpinCtrl* mCtrlShinyScaleU;
|
||||
LLSpinCtrl* mCtrlShinyScaleV;
|
||||
LLSpinCtrl* mCtrlTexOffsetU;
|
||||
LLSpinCtrl* mCtrlTexOffsetV;
|
||||
LLSpinCtrl* mCtrlBumpyOffsetU;
|
||||
LLSpinCtrl* mCtrlBumpyOffsetV;
|
||||
LLSpinCtrl* mCtrlShinyOffsetU;
|
||||
LLSpinCtrl* mCtrlShinyOffsetV;
|
||||
LLSpinCtrl* mCtrlTexRot;
|
||||
LLSpinCtrl* mCtrlBumpyRot;
|
||||
LLSpinCtrl* mCtrlShinyRot;
|
||||
|
||||
// Blinn-Phong texture transforms and controls
|
||||
// public to give functors access -Zi
|
||||
LLComboBox* mComboTexGen;
|
||||
LLCheckBoxCtrl* mCheckPlanarAlign;
|
||||
|
||||
// Tab controls
|
||||
// public to give functors access -Zi
|
||||
LLTabContainer* mTabsMatChannel;
|
||||
|
||||
private:
|
||||
bool isAlpha() { return mIsAlpha; }
|
||||
|
||||
// Update visibility of controls to match current UI mode
|
||||
// (e.g. materials vs media editing)
|
||||
//
|
||||
// Do NOT call updateUI from within this function.
|
||||
//
|
||||
void updateVisibility(LLViewerObject* objectp = nullptr);
|
||||
|
||||
// Convenience funcs to keep the visual flack to a minimum
|
||||
//
|
||||
LLUUID getCurrentNormalMap();
|
||||
LLUUID getCurrentSpecularMap();
|
||||
U32 getCurrentShininess();
|
||||
U32 getCurrentBumpiness();
|
||||
U8 getCurrentDiffuseAlphaMode();
|
||||
U8 getCurrentAlphaMaskCutoff();
|
||||
U8 getCurrentEnvIntensity();
|
||||
U8 getCurrentGlossiness();
|
||||
F32 getCurrentBumpyRot();
|
||||
F32 getCurrentBumpyScaleU();
|
||||
F32 getCurrentBumpyScaleV();
|
||||
F32 getCurrentBumpyOffsetU();
|
||||
F32 getCurrentBumpyOffsetV();
|
||||
F32 getCurrentShinyRot();
|
||||
F32 getCurrentShinyScaleU();
|
||||
F32 getCurrentShinyScaleV();
|
||||
F32 getCurrentShinyOffsetU();
|
||||
F32 getCurrentShinyOffsetV();
|
||||
|
||||
// <FS:Zi> map tab states to various values
|
||||
// TODO: should be done with tab-change signals and flags, really
|
||||
S32 getCurrentMaterialType() const;
|
||||
S32 getCurrentMatChannel() const;
|
||||
S32 getCurrentPBRChannel() const;
|
||||
void selectMaterialType(S32 material_type);
|
||||
void selectMatChannel(S32 mat_channel);
|
||||
void selectPBRChannel(S32 pbr_channel);
|
||||
|
||||
F32 getCurrentTextureRot();
|
||||
F32 getCurrentTextureScaleU();
|
||||
F32 getCurrentTextureScaleV();
|
||||
F32 getCurrentTextureOffsetU();
|
||||
F32 getCurrentTextureOffsetV();
|
||||
|
||||
//
|
||||
// Build tool controls
|
||||
//
|
||||
|
||||
// private Tab controls
|
||||
LLTabContainer* mTabsPBRMatMedia;
|
||||
LLTabContainer* mTabsPBRChannel;
|
||||
|
||||
// common controls and parameters for Blinn-Phong and PBR
|
||||
LLButton* mBtnCopyFaces;
|
||||
LLButton* mBtnPasteFaces;
|
||||
LLSpinCtrl* mCtrlGlow;
|
||||
LLSpinCtrl* mCtrlRpt;
|
||||
|
||||
// Blinn-Phong alpha parameters
|
||||
LLSpinCtrl* mCtrlColorTransp; // transparency = 1 - alpha
|
||||
LLView* mColorTransPercent;
|
||||
LLTextBox* mLabelAlphaMode;
|
||||
LLComboBox* mComboAlphaMode;
|
||||
LLSpinCtrl* mCtrlMaskCutoff;
|
||||
LLCheckBoxCtrl* mCheckFullbright;
|
||||
|
||||
// private Blinn-Phong texture transforms and controls
|
||||
LLView* mLabelTexGen;
|
||||
LLView* mLabelBumpiness;
|
||||
LLComboBox* mComboBumpiness;
|
||||
LLView* mLabelShininess;
|
||||
LLComboBox* mComboShininess;
|
||||
// others are above in the public section
|
||||
LLSpinCtrl* mCtrlGlossiness;
|
||||
LLSpinCtrl* mCtrlEnvironment;
|
||||
|
||||
// Blinn-Phong Diffuse tint color swatch
|
||||
LLColorSwatchCtrl* mColorSwatch;
|
||||
|
||||
// Blinn-Phong Diffuse texture swatch
|
||||
LLTextureCtrl* mTextureCtrl;
|
||||
|
||||
// Blinn-Phong Normal texture swatch
|
||||
LLTextureCtrl* mBumpyTextureCtrl;
|
||||
|
||||
// Blinn-Phong Specular texture swatch
|
||||
LLTextureCtrl* mShinyTextureCtrl;
|
||||
|
||||
// Blinn-Phong Specular tint color swatch
|
||||
LLColorSwatchCtrl* mShinyColorSwatch;
|
||||
|
||||
// Texture alignment and maps synchronization
|
||||
LLButton* mBtnAlignMedia;
|
||||
LLButton* mBtnAlignTextures;
|
||||
LLCheckBoxCtrl* mCheckSyncMaterials;
|
||||
|
||||
// Media
|
||||
LLButton* mBtnDeleteMedia;
|
||||
LLButton* mBtnAddMedia;
|
||||
LLMediaCtrl* mTitleMedia;
|
||||
LLTextBox* mTitleMediaText;
|
||||
|
||||
// PBR
|
||||
LLTextureCtrl* mMaterialCtrlPBR;
|
||||
LLColorSwatchCtrl* mBaseTintPBR;
|
||||
LLTextureCtrl* mBaseTexturePBR;
|
||||
LLTextureCtrl* mNormalTexturePBR;
|
||||
LLTextureCtrl* mORMTexturePBR;
|
||||
LLTextureCtrl* mEmissiveTexturePBR;
|
||||
LLColorSwatchCtrl* mEmissiveTintPBR;
|
||||
LLCheckBoxCtrl* mCheckDoubleSidedPBR;
|
||||
LLSpinCtrl* mAlphaPBR;
|
||||
LLTextBox* mLabelAlphaModePBR;
|
||||
LLComboBox* mAlphaModePBR;
|
||||
LLSpinCtrl* mMaskCutoffPBR;
|
||||
LLSpinCtrl* mMetallicFactorPBR;
|
||||
LLSpinCtrl* mRoughnessFactorPBR;
|
||||
LLButton* mBtnSavePBR;
|
||||
|
||||
struct
|
||||
{
|
||||
std::array<LLUUID, LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT> mMap;
|
||||
LLColor4 mBaseColorTint;
|
||||
F32 mMetallic;
|
||||
F32 mRoughness;
|
||||
LLColor4 mEmissiveTint;
|
||||
LLGLTFMaterial::AlphaMode mAlphaMode;
|
||||
F32 mAlphaCutoff;
|
||||
bool mDoubleSided;
|
||||
} mPBRBaseMaterialParams;
|
||||
|
||||
// map PBR material map types to glTF material types
|
||||
LLGLTFMaterial::TextureInfo mPBRChannelToTextureInfo[PBRTYPE_COUNT] =
|
||||
{
|
||||
LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT, // PBRTYPE_RENDER_MATERIAL_ID
|
||||
LLGLTFMaterial::GLTF_TEXTURE_INFO_BASE_COLOR, // PBRTYPE_BASE_COLOR
|
||||
LLGLTFMaterial::GLTF_TEXTURE_INFO_METALLIC_ROUGHNESS, // PBRTYPE_METALLIC_ROUGHNESS
|
||||
LLGLTFMaterial::GLTF_TEXTURE_INFO_EMISSIVE, // PBRTYPE_EMISSIVE
|
||||
LLGLTFMaterial::GLTF_TEXTURE_INFO_NORMAL // PBRTYPE_NORMAL
|
||||
};
|
||||
|
||||
// Dirty flags - taken from llmaterialeditor.cpp ... LL please put this in a .h! -Zi
|
||||
U32 mUnsavedChanges; // flags to indicate individual changed parameters
|
||||
|
||||
// Hey look everyone, a type-safe alternative to copy and paste! :)
|
||||
//
|
||||
|
||||
// Update material parameters by applying 'edit_func' to selected TEs
|
||||
//
|
||||
template<
|
||||
typename DataType,
|
||||
typename SetValueType,
|
||||
void (LLMaterial::*MaterialEditFunc)(SetValueType data) >
|
||||
static void edit(FSPanelFace* p, DataType data, int te = -1, const LLUUID &only_for_object_id = LLUUID())
|
||||
{
|
||||
FSMaterialEditFunctor< DataType, SetValueType, MaterialEditFunc > edit(data);
|
||||
struct LLSelectedTEEditMaterial : public LLSelectedTEMaterialFunctor
|
||||
{
|
||||
LLSelectedTEEditMaterial(FSPanelFace* panel, FSMaterialEditFunctor< DataType, SetValueType, MaterialEditFunc >* editp, const LLUUID &only_for_object_id) : _panel(panel), _edit(editp), _only_for_object_id(only_for_object_id) {}
|
||||
virtual ~LLSelectedTEEditMaterial() {};
|
||||
virtual LLMaterialPtr apply(LLViewerObject* object, S32 face, LLTextureEntry* tep, LLMaterialPtr& current_material)
|
||||
{
|
||||
if (_edit && (_only_for_object_id.isNull() || _only_for_object_id == object->getID()))
|
||||
{
|
||||
LLMaterialPtr new_material = _panel->createDefaultMaterial(current_material);
|
||||
llassert_always(new_material);
|
||||
|
||||
// Determine correct alpha mode for current diffuse texture
|
||||
// (i.e. does it have an alpha channel that makes alpha mode useful)
|
||||
//
|
||||
// _panel->isAlpha() "lies" when one face has alpha and the rest do not (NORSPEC-329)
|
||||
// need to get per-face answer to this question for sane alpha mode retention on updates.
|
||||
//
|
||||
bool is_alpha_face = object->isImageAlphaBlended(face);
|
||||
|
||||
// need to keep this original answer for valid comparisons in logic below
|
||||
//
|
||||
U8 original_default_alpha_mode = is_alpha_face ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
|
||||
|
||||
U8 default_alpha_mode = original_default_alpha_mode;
|
||||
|
||||
if (!current_material.isNull())
|
||||
{
|
||||
default_alpha_mode = current_material->getDiffuseAlphaMode();
|
||||
}
|
||||
|
||||
// Insure we don't inherit the default of blend by accident...
|
||||
// this will be stomped by a legit request to change the alpha mode by the apply() below
|
||||
//
|
||||
new_material->setDiffuseAlphaMode(default_alpha_mode);
|
||||
|
||||
// Do "It"!
|
||||
//
|
||||
_edit->apply(new_material);
|
||||
|
||||
U32 new_alpha_mode = new_material->getDiffuseAlphaMode();
|
||||
LLUUID new_normal_map_id = new_material->getNormalID();
|
||||
LLUUID new_spec_map_id = new_material->getSpecularID();
|
||||
|
||||
if ((new_alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND) && !is_alpha_face)
|
||||
{
|
||||
new_alpha_mode = LLMaterial::DIFFUSE_ALPHA_MODE_NONE;
|
||||
new_material->setDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_NONE);
|
||||
}
|
||||
|
||||
bool is_default_blend_mode = (new_alpha_mode == original_default_alpha_mode);
|
||||
bool is_need_material = !is_default_blend_mode || !new_normal_map_id.isNull() || !new_spec_map_id.isNull();
|
||||
|
||||
if (!is_need_material)
|
||||
{
|
||||
LL_DEBUGS("Materials") << "Removing material from object " << object->getID() << " face " << face << LL_ENDL;
|
||||
LLMaterialMgr::getInstance()->remove(object->getID(),face);
|
||||
new_material = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
LL_DEBUGS("Materials") << "Putting material on object " << object->getID() << " face " << face << ", material: " << new_material->asLLSD() << LL_ENDL;
|
||||
LLMaterialMgr::getInstance()->put(object->getID(),face,*new_material);
|
||||
}
|
||||
|
||||
object->setTEMaterialParams(face, new_material);
|
||||
return new_material;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
FSMaterialEditFunctor< DataType, SetValueType, MaterialEditFunc >* _edit;
|
||||
FSPanelFace *_panel;
|
||||
const LLUUID & _only_for_object_id;
|
||||
} editor(p, &edit, only_for_object_id);
|
||||
LLSelectMgr::getInstance()->selectionSetMaterialParams(&editor, te);
|
||||
}
|
||||
|
||||
template<
|
||||
typename DataType,
|
||||
typename ReturnType,
|
||||
ReturnType (LLMaterial::* const MaterialGetFunc)() const >
|
||||
static void getTEMaterialValue(DataType& data_to_return, bool& identical,DataType default_value, bool has_tolerance = false, DataType tolerance = DataType())
|
||||
{
|
||||
DataType data_value = default_value;
|
||||
struct GetTEMaterialVal : public LLSelectedTEGetFunctor<DataType>
|
||||
{
|
||||
GetTEMaterialVal(DataType default_value) : _default(default_value) {}
|
||||
virtual ~GetTEMaterialVal() {}
|
||||
|
||||
DataType get(LLViewerObject* object, S32 face)
|
||||
{
|
||||
DataType ret = _default;
|
||||
LLMaterialPtr material_ptr;
|
||||
LLTextureEntry* tep = object ? object->getTE(face) : NULL;
|
||||
if (tep)
|
||||
{
|
||||
material_ptr = tep->getMaterialParams();
|
||||
if (!material_ptr.isNull())
|
||||
{
|
||||
ret = (material_ptr->*(MaterialGetFunc))();
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
DataType _default;
|
||||
} GetFunc(default_value);
|
||||
identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &GetFunc, data_value, has_tolerance, tolerance);
|
||||
data_to_return = data_value;
|
||||
}
|
||||
|
||||
template<
|
||||
typename DataType,
|
||||
typename ReturnType, // some kids just have to different...
|
||||
ReturnType (LLTextureEntry::* const TEGetFunc)() const >
|
||||
static void getTEValue(DataType& data_to_return, bool& identical, DataType default_value, bool has_tolerance = false, DataType tolerance = DataType())
|
||||
{
|
||||
DataType data_value = default_value;
|
||||
struct GetTEVal : public LLSelectedTEGetFunctor<DataType>
|
||||
{
|
||||
GetTEVal(DataType default_value) : _default(default_value) {}
|
||||
virtual ~GetTEVal() {}
|
||||
|
||||
DataType get(LLViewerObject* object, S32 face) {
|
||||
LLTextureEntry* tep = object ? object->getTE(face) : NULL;
|
||||
return tep ? ((tep->*(TEGetFunc))()) : _default;
|
||||
}
|
||||
DataType _default;
|
||||
} GetTEValFunc(default_value);
|
||||
identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &GetTEValFunc, data_value, has_tolerance, tolerance );
|
||||
data_to_return = data_value;
|
||||
}
|
||||
|
||||
// Update vis and enabling of specific subsets of controls based on material params
|
||||
// (e.g. hide the spec controls if no spec texture is applied)
|
||||
//
|
||||
void updateShinyControls(bool is_setting_texture = false, bool mess_with_combobox = false);
|
||||
void updateBumpyControls(bool is_setting_texture = false, bool mess_with_combobox = false);
|
||||
void updateAlphaControls();
|
||||
void updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material, bool& has_faces_without_pbr, bool force_set_values);
|
||||
|
||||
void updateSelectedGLTFMaterials(std::function<void(LLGLTFMaterial*)> func);
|
||||
void updateGLTFTextureTransform(float value, U32 pbr_type, std::function<void(LLGLTFMaterial::TextureTransform*)> edit);
|
||||
|
||||
void setMaterialOverridesFromSelection();
|
||||
|
||||
bool mIsAlpha;
|
||||
|
||||
LLSD mClipboardParams;
|
||||
|
||||
LLSD mMediaSettings;
|
||||
bool mNeedMediaTitle;
|
||||
|
||||
class Selection
|
||||
{
|
||||
public:
|
||||
void connect();
|
||||
|
||||
// Returns true if the selected objects or sides have changed since
|
||||
// this was last called, and no object update is pending
|
||||
bool update();
|
||||
|
||||
// Prevents update() returning true until the provided object is
|
||||
// updated. Necessary to prevent controls updating when the mouse is
|
||||
// held down.
|
||||
void setDirty() { mChanged = true; };
|
||||
|
||||
// Callbacks
|
||||
void onSelectionChanged() { mNeedsSelectionCheck = true; }
|
||||
void onSelectedObjectUpdated(const LLUUID &object_id, S32 side);
|
||||
|
||||
protected:
|
||||
bool compareSelection();
|
||||
|
||||
bool mChanged = false;
|
||||
|
||||
boost::signals2::scoped_connection mSelectConnection;
|
||||
bool mNeedsSelectionCheck = true;
|
||||
S32 mSelectedObjectCount = 0;
|
||||
S32 mSelectedTECount = 0;
|
||||
LLUUID mSelectedObjectID;
|
||||
S32 mLastSelectedSide = -1;
|
||||
};
|
||||
|
||||
static Selection sMaterialOverrideSelection;
|
||||
|
||||
std::unique_ptr<PBRPickerItemListener> mInventoryListener;
|
||||
|
||||
public:
|
||||
#if defined(FS_DEF_GET_MAT_STATE)
|
||||
#undef FS_DEF_GET_MAT_STATE
|
||||
#endif
|
||||
|
||||
#if defined(FS_DEF_GET_TE_STATE)
|
||||
#undef FS_DEF_GET_TE_STATE
|
||||
#endif
|
||||
|
||||
#if defined(FS_DEF_EDIT_MAT_STATE)
|
||||
FS_DEF_EDIT_MAT_STATE
|
||||
#endif
|
||||
|
||||
// Accessors for selected TE material state
|
||||
//
|
||||
#define FS_DEF_GET_MAT_STATE(DataType,ReturnType,MaterialMemberFunc,DefaultValue,HasTolerance,Tolerance) \
|
||||
static void MaterialMemberFunc(DataType& data, bool& identical, bool has_tolerance = HasTolerance, DataType tolerance = Tolerance) \
|
||||
{ \
|
||||
getTEMaterialValue< DataType, ReturnType, &LLMaterial::MaterialMemberFunc >(data, identical, DefaultValue, has_tolerance, tolerance); \
|
||||
}
|
||||
|
||||
// Mutators for selected TE material
|
||||
//
|
||||
#define FS_DEF_EDIT_MAT_STATE(DataType,ReturnType,MaterialMemberFunc) \
|
||||
static void MaterialMemberFunc(FSPanelFace* p, DataType data, int te = -1, const LLUUID &only_for_object_id = LLUUID()) \
|
||||
{ \
|
||||
edit< DataType, ReturnType, &LLMaterial::MaterialMemberFunc >(p, data, te, only_for_object_id); \
|
||||
}
|
||||
|
||||
// Accessors for selected TE state proper (legacy settings etc)
|
||||
//
|
||||
#define FS_DEF_GET_TE_STATE(DataType,ReturnType,TexEntryMemberFunc,DefaultValue,HasTolerance,Tolerance) \
|
||||
static void TexEntryMemberFunc(DataType& data, bool& identical, bool has_tolerance = HasTolerance, DataType tolerance = Tolerance) \
|
||||
{ \
|
||||
getTEValue< DataType, ReturnType, &LLTextureEntry::TexEntryMemberFunc >(data, identical, DefaultValue, has_tolerance, tolerance); \
|
||||
}
|
||||
|
||||
class LLSelectedTEMaterial
|
||||
{
|
||||
public:
|
||||
static void getCurrent(LLMaterialPtr& material_ptr, bool& identical_material);
|
||||
static void getMaxSpecularRepeats(F32& repeats, bool& identical);
|
||||
static void getMaxNormalRepeats(F32& repeats, bool& identical);
|
||||
static void getCurrentDiffuseAlphaMode(U8& diffuse_alpha_mode, bool& identical, bool diffuse_texture_has_alpha);
|
||||
|
||||
FS_DEF_GET_MAT_STATE(LLUUID,const LLUUID&,getNormalID,LLUUID::null, false, LLUUID::null)
|
||||
FS_DEF_GET_MAT_STATE(LLUUID,const LLUUID&,getSpecularID,LLUUID::null, false, LLUUID::null)
|
||||
FS_DEF_GET_MAT_STATE(F32,F32,getSpecularRepeatX,1.0f, true, 0.001f)
|
||||
FS_DEF_GET_MAT_STATE(F32,F32,getSpecularRepeatY,1.0f, true, 0.001f)
|
||||
FS_DEF_GET_MAT_STATE(F32,F32,getSpecularOffsetX,0.0f, true, 0.001f)
|
||||
FS_DEF_GET_MAT_STATE(F32,F32,getSpecularOffsetY,0.0f, true, 0.001f)
|
||||
FS_DEF_GET_MAT_STATE(F32,F32,getSpecularRotation,0.0f, true, 0.001f)
|
||||
|
||||
FS_DEF_GET_MAT_STATE(F32,F32,getNormalRepeatX,1.0f, true, 0.001f)
|
||||
FS_DEF_GET_MAT_STATE(F32,F32,getNormalRepeatY,1.0f, true, 0.001f)
|
||||
FS_DEF_GET_MAT_STATE(F32,F32,getNormalOffsetX,0.0f, true, 0.001f)
|
||||
FS_DEF_GET_MAT_STATE(F32,F32,getNormalOffsetY,0.0f, true, 0.001f)
|
||||
FS_DEF_GET_MAT_STATE(F32,F32,getNormalRotation,0.0f, true, 0.001f)
|
||||
|
||||
FS_DEF_EDIT_MAT_STATE(U8,U8,setDiffuseAlphaMode);
|
||||
FS_DEF_EDIT_MAT_STATE(U8,U8,setAlphaMaskCutoff);
|
||||
|
||||
FS_DEF_EDIT_MAT_STATE(F32,F32,setNormalOffsetX);
|
||||
FS_DEF_EDIT_MAT_STATE(F32,F32,setNormalOffsetY);
|
||||
FS_DEF_EDIT_MAT_STATE(F32,F32,setNormalRepeatX);
|
||||
FS_DEF_EDIT_MAT_STATE(F32,F32,setNormalRepeatY);
|
||||
FS_DEF_EDIT_MAT_STATE(F32,F32,setNormalRotation);
|
||||
|
||||
FS_DEF_EDIT_MAT_STATE(F32,F32,setSpecularOffsetX);
|
||||
FS_DEF_EDIT_MAT_STATE(F32,F32,setSpecularOffsetY);
|
||||
FS_DEF_EDIT_MAT_STATE(F32,F32,setSpecularRepeatX);
|
||||
FS_DEF_EDIT_MAT_STATE(F32,F32,setSpecularRepeatY);
|
||||
FS_DEF_EDIT_MAT_STATE(F32,F32,setSpecularRotation);
|
||||
|
||||
FS_DEF_EDIT_MAT_STATE(U8,U8,setEnvironmentIntensity);
|
||||
FS_DEF_EDIT_MAT_STATE(U8,U8,setSpecularLightExponent);
|
||||
|
||||
FS_DEF_EDIT_MAT_STATE(LLUUID,const LLUUID&,setNormalID);
|
||||
FS_DEF_EDIT_MAT_STATE(LLUUID,const LLUUID&,setSpecularID);
|
||||
FS_DEF_EDIT_MAT_STATE(LLColor4U, const LLColor4U&,setSpecularLightColor);
|
||||
};
|
||||
|
||||
class LLSelectedTE
|
||||
{
|
||||
public:
|
||||
static void getFace(class LLFace*& face_to_return, bool& identical_face);
|
||||
static void getImageFormat(LLGLenum& image_format_to_return, bool& identical_face);
|
||||
static void getTexId(LLUUID& id, bool& identical);
|
||||
static void getObjectScaleS(F32& scale_s, bool& identical);
|
||||
static void getObjectScaleT(F32& scale_t, bool& identical);
|
||||
static void getMaxDiffuseRepeats(F32& repeats, bool& identical);
|
||||
|
||||
FS_DEF_GET_TE_STATE(U8,U8,getBumpmap,0, false, 0)
|
||||
FS_DEF_GET_TE_STATE(U8,U8,getShiny,0, false, 0)
|
||||
FS_DEF_GET_TE_STATE(U8,U8,getFullbright,0, false, 0)
|
||||
FS_DEF_GET_TE_STATE(F32,F32,getRotation,0.0f, true, 0.001f)
|
||||
FS_DEF_GET_TE_STATE(F32,F32,getOffsetS,0.0f, true, 0.001f)
|
||||
FS_DEF_GET_TE_STATE(F32,F32,getOffsetT,0.0f, true, 0.001f)
|
||||
FS_DEF_GET_TE_STATE(F32,F32,getScaleS,1.0f, true, 0.001f)
|
||||
FS_DEF_GET_TE_STATE(F32,F32,getScaleT,1.0f, true, 0.001f)
|
||||
FS_DEF_GET_TE_STATE(F32,F32,getGlow,0.0f, true, 0.001f)
|
||||
FS_DEF_GET_TE_STATE(LLTextureEntry::e_texgen,LLTextureEntry::e_texgen,getTexGen,LLTextureEntry::TEX_GEN_DEFAULT, false, LLTextureEntry::TEX_GEN_DEFAULT)
|
||||
FS_DEF_GET_TE_STATE(LLColor4,const LLColor4&,getColor,LLColor4::white, false, LLColor4::black);
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -94,6 +94,8 @@
|
|||
#include "llvograss.h"
|
||||
#include "llvotree.h"
|
||||
|
||||
#include "fspanelface.h" // <FS:Zi> switchable edit texture/materials panel
|
||||
|
||||
// Globals
|
||||
LLFloaterTools *gFloaterTools = NULL;
|
||||
bool LLFloaterTools::sShowObjectCost = true;
|
||||
|
|
@ -174,8 +176,14 @@ void* LLFloaterTools::createPanelVolume(void* data)
|
|||
void* LLFloaterTools::createPanelFace(void* data)
|
||||
{
|
||||
LLFloaterTools* floater = (LLFloaterTools*)data;
|
||||
floater->mPanelFace = new LLPanelFace();
|
||||
return floater->mPanelFace;
|
||||
|
||||
// <FS:Zi> switchable edit texture/materials panel
|
||||
// we should not need this here at all, we are adding the texture/materials
|
||||
// panel in postBuild()
|
||||
// floater->mPanelFace = new LLPanelFace();
|
||||
// return floater->mPanelFace;
|
||||
return floater->findChild<LLPanel>("Texture");
|
||||
// </FS:Zi>
|
||||
}
|
||||
|
||||
//static
|
||||
|
|
@ -229,6 +237,27 @@ LLPCode toolData[]={
|
|||
|
||||
BOOL LLFloaterTools::postBuild()
|
||||
{
|
||||
// <FS:Zi> switchable edit texture/materials panel
|
||||
LLPanel* panel;
|
||||
if (gSavedSettings.getBOOL("UseNewTexturePanel"))
|
||||
{
|
||||
mFSPanelFace = new FSPanelFace;
|
||||
panel = mFSPanelFace;
|
||||
}
|
||||
else
|
||||
{
|
||||
mPanelFace = new LLPanelFace;
|
||||
panel = mPanelFace;
|
||||
}
|
||||
|
||||
LLTabContainer::TabPanelParams params;
|
||||
params.panel = panel;
|
||||
params.insert_at = (LLTabContainer::eInsertionPoint) PANEL_FACE;
|
||||
|
||||
mTab = getChild<LLTabContainer>("Object Info Tabs");
|
||||
mTab->addTabPanel(params);
|
||||
// </FS:Zi>
|
||||
|
||||
// Hide until tool selected
|
||||
setVisible(FALSE);
|
||||
|
||||
|
|
@ -367,7 +396,11 @@ void LLFloaterTools::changePrecision(S32 decimal_precision)
|
|||
else if (decimal_precision > 7) decimal_precision = 7;
|
||||
|
||||
mPanelObject->changePrecision(decimal_precision);
|
||||
mPanelFace->changePrecision(decimal_precision);
|
||||
// <FS:Zi> switchable edit texture/materials panel
|
||||
// mPanelFace->changePrecision(decimal_precision);
|
||||
if (mPanelFace) mPanelFace->changePrecision(decimal_precision);
|
||||
if (mFSPanelFace) mFSPanelFace->changePrecision(decimal_precision);
|
||||
// </FS:Zi>
|
||||
}
|
||||
|
||||
// Create the popupview with a dummy center. It will be moved into place
|
||||
|
|
@ -431,6 +464,7 @@ LLFloaterTools::LLFloaterTools(const LLSD& key)
|
|||
mPanelVolume(NULL),
|
||||
mPanelContents(NULL),
|
||||
mPanelFace(NULL),
|
||||
mFSPanelFace(nullptr), // <FS:Zi> switchable edit texture/materials panel
|
||||
mPanelLandInfo(NULL),
|
||||
|
||||
mCostTextBorder(NULL),
|
||||
|
|
@ -470,7 +504,6 @@ LLFloaterTools::LLFloaterTools(const LLSD& key)
|
|||
// <FS>
|
||||
mCommitCallbackRegistrar.add("BuildTool.CopyKeys", boost::bind(&LLFloaterTools::onClickBtnCopyKeys,this));
|
||||
mCommitCallbackRegistrar.add("BuildTool.Expand", boost::bind(&LLFloaterTools::onClickExpand,this));
|
||||
mCommitCallbackRegistrar.add("BuildTool.Flip", boost::bind(&LLPanelFace::onCommitFlip, _1, _2));
|
||||
// </FS>
|
||||
|
||||
// <FS:Ansariel> FIRE-7802: Grass and tree selection in build tool
|
||||
|
|
@ -744,8 +777,20 @@ void LLFloaterTools::refresh()
|
|||
mPanelPermissions->refresh();
|
||||
mPanelObject->refresh();
|
||||
mPanelVolume->refresh();
|
||||
mPanelFace->refresh();
|
||||
mPanelFace->refreshMedia();
|
||||
// <FS:Zi> switchable edit texture/materials panel
|
||||
// mPanelFace->refresh();
|
||||
// mPanelFace->refreshMedia();
|
||||
if (mPanelFace)
|
||||
{
|
||||
mPanelFace->refresh();
|
||||
mPanelFace->refreshMedia();
|
||||
}
|
||||
if (mFSPanelFace)
|
||||
{
|
||||
mFSPanelFace->refresh();
|
||||
mFSPanelFace->refreshMedia();
|
||||
}
|
||||
// <FS:Zi>
|
||||
mPanelContents->refresh();
|
||||
mPanelLandInfo->refresh();
|
||||
|
||||
|
|
@ -1142,7 +1187,11 @@ void LLFloaterTools::onClose(bool app_quitting)
|
|||
LLViewerJoystick::getInstance()->moveAvatar(false);
|
||||
|
||||
// destroy media source used to grab media title
|
||||
mPanelFace->unloadMedia();
|
||||
// <FS:Zi> switchable edit texture/materials panel
|
||||
// mPanelFace->unloadMedia();
|
||||
if (mPanelFace) mPanelFace->unloadMedia();
|
||||
if (mFSPanelFace) mFSPanelFace->unloadMedia();
|
||||
// </FS:Zi>
|
||||
|
||||
// Different from handle_reset_view in that it doesn't actually
|
||||
// move the camera if EditCameraMovement is not set.
|
||||
|
|
@ -1626,3 +1675,32 @@ void LLFloaterTools::onSelectTreeGrassCombo()
|
|||
}
|
||||
}
|
||||
// </FS:Ansariel>
|
||||
|
||||
// <FS:Zi> switchable edit texture/materials panel
|
||||
void LLFloaterTools::refreshPanelFace()
|
||||
{
|
||||
if (mPanelFace) mPanelFace->refresh();
|
||||
if (mFSPanelFace) mFSPanelFace->refresh();
|
||||
}
|
||||
|
||||
LLRender::eTexIndex LLFloaterTools::getTextureDropChannel()
|
||||
{
|
||||
if (mPanelFace) return mPanelFace->getTextureDropChannel();
|
||||
if (mFSPanelFace) return mFSPanelFace->getTextureDropChannel();
|
||||
return LLRender::NUM_TEXTURE_CHANNELS; // invalid
|
||||
}
|
||||
|
||||
LLRender::eTexIndex LLFloaterTools::getTextureChannelToEdit()
|
||||
{
|
||||
if (mPanelFace) return mPanelFace->getTextureChannelToEdit();
|
||||
if (mFSPanelFace) return mFSPanelFace->getTextureChannelToEdit();
|
||||
return LLRender::NUM_TEXTURE_CHANNELS; // invalid
|
||||
}
|
||||
|
||||
LLMaterialPtr LLFloaterTools::createDefaultMaterial(LLMaterialPtr old_mat)
|
||||
{
|
||||
if (mPanelFace) return mPanelFace->createDefaultMaterial(old_mat);
|
||||
if (mFSPanelFace) return mFSPanelFace->createDefaultMaterial(old_mat);
|
||||
return nullptr; // invalid
|
||||
}
|
||||
// </FS:Zi>
|
||||
|
|
|
|||
|
|
@ -50,6 +50,13 @@ class LLParcelSelection;
|
|||
class LLObjectSelection;
|
||||
class LLLandImpactsObserver;
|
||||
|
||||
// <FS:Zi> switchable edit texture/materials panel
|
||||
#include "llrender.h"
|
||||
#include "llmaterial.h"
|
||||
|
||||
class FSPanelFace;
|
||||
// </FS:Zi>
|
||||
|
||||
typedef LLSafeHandle<LLObjectSelection> LLObjectSelectionHandle;
|
||||
|
||||
class LLFloaterTools
|
||||
|
|
@ -107,7 +114,13 @@ public:
|
|||
|
||||
static void setGridMode(S32 mode);
|
||||
|
||||
LLPanelFace* getPanelFace() { return mPanelFace; }
|
||||
// <FS:Zi> switchable edit texture/materials panel
|
||||
// LLPanelFace* getPanelFace() { return mPanelFace; }
|
||||
LLRender::eTexIndex getTextureDropChannel();
|
||||
LLRender::eTexIndex getTextureChannelToEdit();
|
||||
LLMaterialPtr createDefaultMaterial(LLMaterialPtr old_mat);
|
||||
void refreshPanelFace();
|
||||
// </FS:Zi>
|
||||
|
||||
void onClickBtnCopyKeys();
|
||||
void onClickExpand();
|
||||
|
|
@ -193,7 +206,7 @@ public:
|
|||
LLPanelObject *mPanelObject;
|
||||
LLPanelVolume *mPanelVolume;
|
||||
LLPanelContents *mPanelContents;
|
||||
LLPanelFace *mPanelFace;
|
||||
// LLPanelFace *mPanelFace; // <FS:Zi> switchable edit texture/materials panel
|
||||
LLPanelLandInfo *mPanelLandInfo;
|
||||
|
||||
LLViewBorder* mCostTextBorder;
|
||||
|
|
@ -215,6 +228,9 @@ private:
|
|||
S32 mExpandedHeight;
|
||||
std::map<std::string, std::string> mStatusText;
|
||||
|
||||
LLPanelFace* mPanelFace; // <FS:Zi> switchable edit texture/materials panel
|
||||
FSPanelFace* mFSPanelFace; // <FS:Zi> switchable edit texture/materials panel
|
||||
|
||||
public:
|
||||
static bool sShowObjectCost;
|
||||
static bool sPreviousFocusOnAvatar;
|
||||
|
|
|
|||
|
|
@ -592,6 +592,8 @@ LLPanelFace::LLPanelFace()
|
|||
mTitleMediaText(NULL),
|
||||
mNeedMediaTitle(true)
|
||||
{
|
||||
buildFromFile("panel_tools_texture.xml"); // <FS:Zi> switchable edit texture/materials
|
||||
|
||||
USE_TEXTURE = LLTrans::getString("use_texture");
|
||||
// <FS> Extended copy & paste buttons
|
||||
//mCommitCallbackRegistrar.add("PanelFace.menuDoToSelected", boost::bind(&LLPanelFace::menuDoToSelected, this, _2));
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@
|
|||
#include "llvovolume.h"
|
||||
#include "pipeline.h"
|
||||
#include "llviewershadermgr.h"
|
||||
#include "llpanelface.h"
|
||||
// #include "llpanelface.h" // <FS:Zi> switchable edit texture/materials panel - include not needed
|
||||
// [RLVa:KB] - Checked: 2011-05-22 (RLVa-1.3.1a)
|
||||
#include "rlvactions.h"
|
||||
#include "rlvhandler.h"
|
||||
|
|
@ -2251,7 +2251,9 @@ void LLSelectMgr::selectionRevertShinyColors()
|
|||
LLMaterialPtr old_mat = object->getTEref(te).getMaterialParams();
|
||||
if (!old_mat.isNull())
|
||||
{
|
||||
LLMaterialPtr new_mat = gFloaterTools->getPanelFace()->createDefaultMaterial(old_mat);
|
||||
// <FS:Zi> switchable edit texture/materials panel
|
||||
// LLMaterialPtr new_mat = gFloaterTools->getPanelFace()->createDefaultMaterial(old_mat);
|
||||
LLMaterialPtr new_mat = gFloaterTools->createDefaultMaterial(old_mat);
|
||||
new_mat->setSpecularLightColor(color);
|
||||
object->getTEref(te).setMaterialParams(new_mat);
|
||||
LLMaterialMgr::getInstance()->put(object->getID(), te, *new_mat);
|
||||
|
|
@ -3167,7 +3169,9 @@ void LLSelectMgr::adjustTexturesByScale(BOOL send_to_sim, BOOL stretch)
|
|||
if (tep && !tep->getMaterialParams().isNull())
|
||||
{
|
||||
LLMaterialPtr orig = tep->getMaterialParams();
|
||||
LLMaterialPtr p = gFloaterTools->getPanelFace()->createDefaultMaterial(orig);
|
||||
// <FS:Zi> switchable edit texture/materials panel
|
||||
// LLMaterialPtr p = gFloaterTools->getPanelFace()->createDefaultMaterial(orig);
|
||||
LLMaterialPtr p = gFloaterTools->createDefaultMaterial(orig);
|
||||
p->setNormalRepeat(normal_scale_s, normal_scale_t);
|
||||
p->setSpecularRepeat(specular_scale_s, specular_scale_t);
|
||||
|
||||
|
|
@ -3193,7 +3197,9 @@ void LLSelectMgr::adjustTexturesByScale(BOOL send_to_sim, BOOL stretch)
|
|||
if (tep && !tep->getMaterialParams().isNull())
|
||||
{
|
||||
LLMaterialPtr orig = tep->getMaterialParams();
|
||||
LLMaterialPtr p = gFloaterTools->getPanelFace()->createDefaultMaterial(orig);
|
||||
// <FS:Zi> switchable edit texture/materials panel
|
||||
// LLMaterialPtr p = gFloaterTools->getPanelFace()->createDefaultMaterial(orig);
|
||||
LLMaterialPtr p = gFloaterTools->createDefaultMaterial(orig);
|
||||
|
||||
p->setNormalRepeat(normal_scale_s, normal_scale_t);
|
||||
p->setSpecularRepeat(specular_scale_s, specular_scale_t);
|
||||
|
|
|
|||
|
|
@ -60,7 +60,12 @@
|
|||
#include "llviewerwindow.h"
|
||||
#include "llvoavatarself.h"
|
||||
#include "llworld.h"
|
||||
#include "llpanelface.h"
|
||||
// <FS:Zi> switchable edit texture/materials panel
|
||||
// #include "llpanelface.h"
|
||||
#include "llmaterial.h"
|
||||
#include "llmaterialmgr.h"
|
||||
// </FS:Zi>
|
||||
|
||||
#include "lluiusage.h"
|
||||
// [RLVa:KB] - Checked: 2011-05-22 (RLVa-1.3.1)
|
||||
#include "rlvactions.h"
|
||||
|
|
@ -1324,11 +1329,14 @@ void LLToolDragAndDrop::dropTexture(LLViewerObject* hit_obj,
|
|||
|
||||
// If user dropped a texture onto face it implies
|
||||
// applying texture now without cancel, save to selection
|
||||
LLPanelFace* panel_face = gFloaterTools->getPanelFace();
|
||||
// LLPanelFace* panel_face = gFloaterTools->getPanelFace(); // <FS:Zi> switchable edit texture/materials panel
|
||||
if (nodep
|
||||
&& gFloaterTools->getVisible()
|
||||
&& panel_face
|
||||
&& panel_face->getTextureDropChannel() == 0 /*texture*/
|
||||
// <FS:Zi> switchable edit texture/materials panel
|
||||
// && panel_face
|
||||
// && panel_face->getTextureDropChannel() == 0 /*texture*/
|
||||
&& gFloaterTools->getTextureDropChannel() == 0 /*texture*/
|
||||
// <FS:Zi>
|
||||
&& nodep->mSavedTextures.size() > hit_face)
|
||||
{
|
||||
LLViewerTexture* tex = hit_obj->getTEImage(hit_face);
|
||||
|
|
@ -1373,11 +1381,16 @@ void LLToolDragAndDrop::dropTextureOneFace(LLViewerObject* hit_obj,
|
|||
|
||||
LLTextureEntry* tep = hit_obj ? (hit_obj->getTE(hit_face)) : NULL;
|
||||
|
||||
LLPanelFace* panel_face = gFloaterTools->getPanelFace();
|
||||
// <FS:Zi> switchable edit texture/materials panel
|
||||
// LLPanelFace* panel_face = gFloaterTools->getPanelFace();
|
||||
|
||||
if (gFloaterTools->getVisible() && panel_face)
|
||||
// if (gFloaterTools->getVisible() && panel_face)
|
||||
if (gFloaterTools->getVisible())
|
||||
// </FS:Zi>
|
||||
{
|
||||
tex_channel = (tex_channel > -1) ? tex_channel : panel_face->getTextureDropChannel();
|
||||
// <FS:Zi> switchable edit texture/materials panel
|
||||
// tex_channel = (tex_channel > -1) ? tex_channel : panel_face->getTextureDropChannel();
|
||||
tex_channel = (tex_channel > -1) ? tex_channel : gFloaterTools->getTextureDropChannel();
|
||||
switch (tex_channel)
|
||||
{
|
||||
|
||||
|
|
@ -1391,7 +1404,9 @@ void LLToolDragAndDrop::dropTextureOneFace(LLViewerObject* hit_obj,
|
|||
case 1:
|
||||
{
|
||||
LLMaterialPtr old_mat = tep->getMaterialParams();
|
||||
LLMaterialPtr new_mat = panel_face->createDefaultMaterial(old_mat);
|
||||
// <FS:Zi> switchable edit texture/materials panel
|
||||
// LLMaterialPtr new_mat = panel_face->createDefaultMaterial(old_mat);
|
||||
LLMaterialPtr new_mat = gFloaterTools->createDefaultMaterial(old_mat);
|
||||
new_mat->setNormalID(asset_id);
|
||||
tep->setMaterialParams(new_mat);
|
||||
hit_obj->setTENormalMap(hit_face, asset_id);
|
||||
|
|
@ -1402,7 +1417,9 @@ void LLToolDragAndDrop::dropTextureOneFace(LLViewerObject* hit_obj,
|
|||
case 2:
|
||||
{
|
||||
LLMaterialPtr old_mat = tep->getMaterialParams();
|
||||
LLMaterialPtr new_mat = panel_face->createDefaultMaterial(old_mat);
|
||||
// <FS:Zi> switchable edit texture/materials panel
|
||||
// LLMaterialPtr new_mat = panel_face->createDefaultMaterial(old_mat);
|
||||
LLMaterialPtr new_mat = gFloaterTools->createDefaultMaterial(old_mat);
|
||||
new_mat->setSpecularID(asset_id);
|
||||
tep->setMaterialParams(new_mat);
|
||||
hit_obj->setTESpecularMap(hit_face, asset_id);
|
||||
|
|
|
|||
|
|
@ -43,8 +43,8 @@
|
|||
#include "rlvactions.h"
|
||||
// [/RLVa:KB]
|
||||
|
||||
// #include "llpanelface.h" // <FS:Zi> switchable edit texture/materials panel - include not needed
|
||||
// <FS:Zi> Add control to drag texture faces around
|
||||
#include "llpanelface.h"
|
||||
#include "llspinctrl.h"
|
||||
#include "llkeyboard.h"
|
||||
#include "llwindow.h"
|
||||
|
|
@ -290,11 +290,14 @@ void LLToolFace::render()
|
|||
LLFloaterTools* toolsFloater=(LLFloaterTools*) LLFloaterReg::findInstance("build");
|
||||
if(toolsFloater)
|
||||
{
|
||||
LLPanelFace* panelFace=toolsFloater->mPanelFace;
|
||||
if(panelFace)
|
||||
{
|
||||
panelFace->refresh();
|
||||
}
|
||||
// <FS:Zi> switchable edit texture/materials panel
|
||||
// LLPanelFace* panelFace=toolsFloater->mPanelFace;
|
||||
// if(panelFace)
|
||||
// {
|
||||
// panelFace->refresh();
|
||||
// }
|
||||
toolsFloater->refreshPanelFace();
|
||||
// </FS:Zi>
|
||||
}
|
||||
|
||||
#ifdef TEXTURE_GRAB_UPDATE_REGULARLY
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@
|
|||
#include "llfloaterpathfindingconsole.h"
|
||||
#include "llfloaterpathfindingcharacters.h"
|
||||
#include "llfloatertools.h"
|
||||
#include "llpanelface.h"
|
||||
// #include "llpanelface.h" // <FS:Zi> switchable edit texture/materials panel - include not needed
|
||||
#include "llpathfindingpathtool.h"
|
||||
#include "llscenemonitor.h"
|
||||
#include "llprogressview.h"
|
||||
|
|
@ -3662,7 +3662,9 @@ void LLPipeline::postSort(LLCamera &camera)
|
|||
|
||||
if (!gNonInteractive)
|
||||
{
|
||||
LLPipeline::setRenderHighlightTextureChannel(gFloaterTools->getPanelFace()->getTextureChannelToEdit());
|
||||
// <FS:Zi> switchable edit texture/materials panel
|
||||
// LLPipeline::setRenderHighlightTextureChannel(gFloaterTools->getPanelFace()->getTextureChannelToEdit());
|
||||
LLPipeline::setRenderHighlightTextureChannel(gFloaterTools->getTextureChannelToEdit());
|
||||
}
|
||||
|
||||
// Draw face highlights for selected faces.
|
||||
|
|
|
|||
|
|
@ -3238,8 +3238,10 @@ Low ↔ Lwst
|
|||
<panel
|
||||
label="Texture"
|
||||
help_topic="toolbox_texture_tab"
|
||||
name="Texture"
|
||||
name="Texture">
|
||||
<!-- <FS:Zi> switchable edit texture/materials panel
|
||||
filename="panel_tools_texture.xml">
|
||||
-->
|
||||
</panel>
|
||||
<panel
|
||||
border="false"
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -3236,8 +3236,10 @@ Low ↔ Lwst
|
|||
<panel
|
||||
label="Texture"
|
||||
help_topic="toolbox_texture_tab"
|
||||
name="Texture"
|
||||
name="Texture">
|
||||
<!-- <FS:Zi> switchable edit texture/materials panel
|
||||
filename="panel_tools_texture.xml">
|
||||
-->
|
||||
</panel>
|
||||
<panel
|
||||
border="false"
|
||||
|
|
|
|||
|
|
@ -3236,8 +3236,10 @@ Low ↔ Lwst
|
|||
<panel
|
||||
label="Texture"
|
||||
help_topic="toolbox_texture_tab"
|
||||
name="Texture"
|
||||
name="Texture">
|
||||
<!-- <FS:Zi> switchable edit texture/materials panel
|
||||
filename="panel_tools_texture.xml">
|
||||
-->
|
||||
</panel>
|
||||
<panel
|
||||
border="false"
|
||||
|
|
|
|||
|
|
@ -3238,8 +3238,10 @@ Low ↔ Lwst
|
|||
<panel
|
||||
label="Texture"
|
||||
help_topic="toolbox_texture_tab"
|
||||
name="Texture"
|
||||
name="Texture">
|
||||
<!-- <FS:Zi> switchable edit texture/materials panel
|
||||
filename="panel_tools_texture.xml">
|
||||
-->
|
||||
</panel>
|
||||
<panel
|
||||
border="false"
|
||||
|
|
|
|||
Loading…
Reference in New Issue