Includes Chalice Yao's pause agent on attachment selection in LLSelectMgr::updateSelectionCenter()
Includes some of Cinder Roxley's enhancements to the build floater for materials (flip buttons, sync materials, consistent control hiding)
Includes Ansariel Hiller's fix for FIRE-8298 [BUG-869] [MAINT-1961], since this updates lltexturectrl.* to have related behaviors.
Switches from using MIN_MANHATTAN_DIST for threshold in LLToolDragAndDrop to using the existing DragAndDropDistanceThreshold debug, like upstream.

Translators:
panel_tools_texture.xml should now be translated, floater_tools.xml should have the old panel removed.
strings.xml now has "use_texture" string.
notifications.xml Now has "LivePreviewUnavailable" alert. (don't forget to translate the ignoretext)
This commit is contained in:
Inusaito Sayori
2013-11-06 17:39:04 -05:00
parent 06186e6c7e
commit cb0cc571ee
18 changed files with 3348 additions and 884 deletions

View File

@@ -545,7 +545,7 @@ S32 LLTextureEntry::setMaterialID(const LLMaterialID& pMaterialID)
{
mMaterialUpdatePending = true;
mMaterialID = pMaterialID;
return TEM_CHANGE_NONE;
return TEM_CHANGE_TEXTURE;
}
mMaterialUpdatePending = false;

View File

@@ -38,7 +38,7 @@
const S32 TEM_CHANGE_NONE = 0x0;
const S32 TEM_CHANGE_COLOR = 0x1;
const S32 TEM_CHANGE_TEXTURE = 0x2;
const S32 TEM_CHANGE_MEDIA = 0x4; //Currently doesn't do anything, (not that TEM_CHANGE_TEXTURE either)
const S32 TEM_CHANGE_MEDIA = 0x4;
const S32 TEM_INVALID = 0x8;
const S32 TEM_BUMPMAP_COUNT = 32;
@@ -133,7 +133,13 @@ public:
virtual const LLUUID &getID() const { return mID; }
const LLColor4 &getColor() const { return mColor; }
void getScale(F32 *s, F32 *t) const { *s = mScaleS; *t = mScaleT; }
F32 getScaleS() const { return mScaleS; }
F32 getScaleT() const { return mScaleT; }
void getOffset(F32 *s, F32 *t) const { *s = mOffsetS; *t = mOffsetT; }
F32 getOffsetS() const { return mOffsetS; }
F32 getOffsetT() const { return mOffsetT; }
F32 getRotation() const { return mRotation; }
void getRotation(F32 *theta) const { *theta = mRotation; }
@@ -144,7 +150,7 @@ public:
U8 getBumpShinyFullbright() const { return mBump; }
U8 getMediaFlags() const { return mMediaFlags & TEM_MEDIA_MASK; }
U8 getTexGen() const { return mMediaFlags & TEM_TEX_GEN_MASK; }
LLTextureEntry::e_texgen getTexGen() const { return LLTextureEntry::e_texgen(mMediaFlags & TEM_TEX_GEN_MASK); }
U8 getMediaTexGen() const { return mMediaFlags; }
F32 getGlow() const { return mGlow; }
const LLMaterialID& getMaterialID() const { return mMaterialID; };

View File

@@ -914,6 +914,17 @@ Found in Advanced->Rendering->Info Displays</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>FSSynchronizeTextureMaps</key>
<map>
<key>Comment</key>
<string>Align texture maps (texture, bumpy, shiny) across the faces of a prim</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<boolean>1</boolean>
</map>
<key>InstantMessageLogPathAnyAccount</key>
<map>
<key>Comment</key>
@@ -5681,6 +5692,39 @@ This should be as low as possible, but too low may break functionality</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>DefaultBlankNormalTexture</key>
<map>
<key>Comment</key>
<string>Texture used as 'Blank' in texture picker for normal map. (UUID texture reference)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>5b53359e-59dd-d8a2-04c3-9e65134da47a</string>
</map>
<key>DefaultObjectNormalTexture</key>
<map>
<key>Comment</key>
<string>Texture used as 'Default' in texture picker for normal map. (UUID texture reference)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>85f28839-7a1c-b4e3-d71d-967792970a7b</string>
</map>
<key>DefaultObjectSpecularTexture</key>
<map>
<key>Comment</key>
<string>Texture used as 'Default' in texture picker for specular map. (UUID texture reference)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>87e0e8f7-8729-1ea8-cfc9-8915773009db</string>
</map>
<key>DefaultObjectTexture</key>
<map>
<key>Comment</key>

View File

@@ -111,6 +111,8 @@ public:
void navigateToTitleMedia( const std::string url );
bool selectedMediaEditable();
LLPanelFace* getPanelFace() { return mPanelFace; }
private:
void refresh();
void refreshMedia();

File diff suppressed because it is too large Load Diff

View File

@@ -35,6 +35,10 @@
#include "v4color.h"
#include "llpanel.h"
#include "llmaterial.h"
#include "llmaterialmgr.h"
#include "lltextureentry.h"
#include "llselectmgr.h"
class LLButton;
class LLCheckBoxCtrl;
@@ -47,6 +51,49 @@ class LLTextBox;
class LLTextureCtrl;
class LLUICtrl;
class LLViewerObject;
class LLFloater;
class LLMaterialID;
// 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 LLMaterialEditFunctor
{
public:
LLMaterialEditFunctor(const DataType& data) : _data(data) {}
virtual ~LLMaterialEditFunctor() {}
virtual void apply(LLMaterialPtr& material) { (material->*(MaterialEditFunc))(_data); }
DataType _data;
};
template<
typename DataType,
DataType (LLMaterial::*MaterialGetFunc)() >
class LLMaterialGetFunctor
{
public:
LLMaterialGetFunctor() {}
virtual DataType get(LLMaterialPtr& material) { return (material->*(MaterialGetFunc)); }
};
template<
typename DataType,
DataType (LLTextureEntry::*TEGetFunc)() >
class LLTEGetFunctor
{
public:
LLTEGetFunctor() {}
virtual DataType get(LLTextureEntry* entry) { return (entry*(TEGetFunc)); }
};
class LLPanelFace : public LLPanel
{
@@ -59,6 +106,19 @@ public:
void setMediaURL(const std::string& url);
void setMediaType(const std::string& mime_type);
LLMaterialPtr createDefaultMaterial(LLMaterialPtr current_material)
{
LLMaterialPtr new_material(!current_material.isNull() ? new LLMaterial(current_material->asLLSD()) : new LLMaterial());
llassert_always(new_material);
// Preserve old diffuse alpha mode or assert correct default blend mode as appropriate for the alpha channel content of the diffuse texture
//
new_material->setDiffuseAlphaMode(current_material.isNull() ? (isAlpha() ? LLMaterial::DIFFUSE_ALPHA_MODE_BLEND : LLMaterial::DIFFUSE_ALPHA_MODE_NONE) : current_material->getDiffuseAlphaMode());
return new_material;
}
LLRender::eTexIndex getTextureChannelToEdit();
protected:
void getState();
@@ -66,11 +126,11 @@ protected:
void sendTextureInfo(); // applies and sends texture scale, offset, etc.
void sendColor(); // applies and sends color
void sendAlpha(); // applies and sends transparency
void sendBump(); // applies and sends bump map
void sendBump(U32 bumpiness); // applies and sends bump map
void sendTexGen(); // applies and sends bump map
void sendShiny(); // applies and sends shininess
void sendShiny(U32 shininess); // applies and sends shininess
void sendFullbright(); // applies and sends full bright
void sendGlow();
void sendGlow();
void sendMedia();
// this function is to return TRUE if the drag should succeed.
@@ -79,23 +139,370 @@ protected:
void onCommitTexture(const LLSD& data);
void onCancelTexture(const LLSD& data);
void onSelectTexture(const LLSD& data);
void onCommitSpecularTexture(const LLSD& data);
void onCancelSpecularTexture(const LLSD& data);
void onSelectSpecularTexture(const LLSD& data);
void onCommitNormalTexture(const LLSD& data);
void onCancelNormalTexture(const LLSD& data);
void onSelectNormalTexture(const LLSD& data);
void onCommitColor(const LLSD& data);
void onCommitShinyColor(const LLSD& data);
void onCommitAlpha(const LLSD& data);
void onCancelColor(const LLSD& data);
void onSelectColor(const LLSD& data);
void onCloseTexturePicker(const LLSD& data);
// Make UI reflect state of currently selected material (refresh)
// and UI mode (e.g. editing normal map v diffuse map)
//
void updateUI();
// 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 onCommitTextureInfo( LLUICtrl* ctrl, void* userdata);
static void onCommitMaterialBumpyScaleX( LLUICtrl* ctrl, void* userdata);
static void onCommitMaterialBumpyScaleY( LLUICtrl* ctrl, void* userdata);
static void onCommitMaterialBumpyRot( LLUICtrl* ctrl, void* userdata);
static void onCommitMaterialBumpyOffsetX( LLUICtrl* ctrl, void* userdata);
static void onCommitMaterialBumpyOffsetY( LLUICtrl* ctrl, void* userdata);
static void onCommitMaterialShinyScaleX( LLUICtrl* ctrl, void* userdata);
static void onCommitMaterialShinyScaleY( LLUICtrl* ctrl, void* userdata);
static void onCommitMaterialShinyRot( LLUICtrl* ctrl, void* userdata);
static void onCommitMaterialShinyOffsetX( LLUICtrl* ctrl, void* userdata);
static void onCommitMaterialShinyOffsetY( LLUICtrl* ctrl, void* userdata);
static void onCommitMaterialGloss( LLUICtrl* ctrl, void* userdata);
static void onCommitMaterialEnv( LLUICtrl* ctrl, void* userdata);
static void onCommitMaterialMaskCutoff( LLUICtrl* ctrl, void* userdata);
static void onCommitMaterialsMedia( LLUICtrl* ctrl, void* userdata);
void onCommitMaterialType();
static void onCommitBump( LLUICtrl* ctrl, void* userdata);
static void onCommitTexGen( LLUICtrl* ctrl, void* userdata);
static void onCommitShiny( LLUICtrl* ctrl, void* userdata);
static void onCommitAlphaMode( LLUICtrl* ctrl, void* userdata);
static void onCommitFullbright( LLUICtrl* ctrl, void* userdata);
static void onCommitGlow( LLUICtrl* ctrl, void *userdata);
static void onCommitPlanarAlign( LLUICtrl* ctrl, void* userdata);
static void onClickApply(void*);
static void onCommitRepeatsPerMeter( LLUICtrl* ctrl, void* userinfo);
static void onClickAutoFix(void*);
static void onClickCopy(void*);
static void onClickPaste(void*);
static F32 valueGlow(LLViewerObject* object, S32 face);
static void onClickCopy(void*);
static void onClickPaste(void*);
// <FS:CR> Build tool enhancements
void onClickMapsSync();
void alignMaterialsProperties();
void onCommitFlip(bool flip_x);
// </FS>
private:
bool isAlpha() { return mIsAlpha; }
// 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();
// 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();
// Make material(s) reflect current state of UI (apply edit)
//
void updateMaterial();
// 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(LLPanelFace* p, DataType data)
{
LLMaterialEditFunctor< DataType, SetValueType, MaterialEditFunc > edit(data);
struct LLSelectedTEEditMaterial : public LLSelectedTEMaterialFunctor
{
LLSelectedTEEditMaterial(LLPanelFace* panel, LLMaterialEditFunctor< DataType, SetValueType, MaterialEditFunc >* editp) : _panel(panel), _edit(editp) {}
virtual ~LLSelectedTEEditMaterial() {};
virtual LLMaterialPtr apply(LLViewerObject* object, S32 face, LLTextureEntry* tep, LLMaterialPtr& current_material)
{
if (_edit)
{
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();
}
// Ensure 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;
}
LLMaterialEditFunctor< DataType, SetValueType, MaterialEditFunc >* _edit;
LLPanelFace* _panel;
} editor(p, &edit);
LLSelectMgr::getInstance()->selectionSetMaterialParams(&editor);
}
template<
typename DataType,
typename ReturnType,
ReturnType (LLMaterial::* const MaterialGetFunc)() const >
static void getTEMaterialValue(DataType& data_to_return, bool& identical,DataType default_value)
{
DataType data_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);
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)
{
DataType data_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 );
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();
/*
* 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(LLInventoryItem* itemp);
bool mIsAlpha;
#if defined(DEF_GET_MAT_STATE)
#undef DEF_GET_MAT_STATE
#endif
#if defined(DEF_GET_TE_STATE)
#undef DEF_GET_TE_STATE
#endif
#if defined(DEF_EDIT_MAT_STATE)
DEF_EDIT_MAT_STATE
#endif
// Accessors for selected TE material state
//
#define DEF_GET_MAT_STATE(DataType,ReturnType,MaterialMemberFunc,DefaultValue) \
static void MaterialMemberFunc(DataType& data, bool& identical) \
{ \
getTEMaterialValue< DataType, ReturnType, &LLMaterial::MaterialMemberFunc >(data, identical,DefaultValue); \
}
// Mutators for selected TE material
//
#define DEF_EDIT_MAT_STATE(DataType,ReturnType,MaterialMemberFunc) \
static void MaterialMemberFunc(LLPanelFace* p,DataType data) \
{ \
edit< DataType, ReturnType, &LLMaterial::MaterialMemberFunc >(p,data); \
}
// Accessors for selected TE state proper (legacy settings etc)
//
#define DEF_GET_TE_STATE(DataType,ReturnType,TexEntryMemberFunc,DefaultValue) \
static void TexEntryMemberFunc(DataType& data, bool& identical) \
{ \
getTEValue< DataType, ReturnType, &LLTextureEntry::TexEntryMemberFunc >(data, identical,DefaultValue); \
}
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);
DEF_GET_MAT_STATE(LLUUID,const LLUUID&,getNormalID,LLUUID::null)
DEF_GET_MAT_STATE(LLUUID,const LLUUID&,getSpecularID,LLUUID::null)
DEF_GET_MAT_STATE(F32,F32,getSpecularRepeatX,1.0f)
DEF_GET_MAT_STATE(F32,F32,getSpecularRepeatY,1.0f)
DEF_GET_MAT_STATE(F32,F32,getSpecularOffsetX,0.0f)
DEF_GET_MAT_STATE(F32,F32,getSpecularOffsetY,0.0f)
DEF_GET_MAT_STATE(F32,F32,getSpecularRotation,0.0f)
DEF_GET_MAT_STATE(F32,F32,getNormalRepeatX,1.0f)
DEF_GET_MAT_STATE(F32,F32,getNormalRepeatY,1.0f)
DEF_GET_MAT_STATE(F32,F32,getNormalOffsetX,0.0f)
DEF_GET_MAT_STATE(F32,F32,getNormalOffsetY,0.0f)
DEF_GET_MAT_STATE(F32,F32,getNormalRotation,0.0f)
DEF_EDIT_MAT_STATE(U8,U8,setDiffuseAlphaMode);
DEF_EDIT_MAT_STATE(U8,U8,setAlphaMaskCutoff);
DEF_EDIT_MAT_STATE(F32,F32,setNormalOffsetX);
DEF_EDIT_MAT_STATE(F32,F32,setNormalOffsetY);
DEF_EDIT_MAT_STATE(F32,F32,setNormalRepeatX);
DEF_EDIT_MAT_STATE(F32,F32,setNormalRepeatY);
DEF_EDIT_MAT_STATE(F32,F32,setNormalRotation);
DEF_EDIT_MAT_STATE(F32,F32,setSpecularOffsetX);
DEF_EDIT_MAT_STATE(F32,F32,setSpecularOffsetY);
DEF_EDIT_MAT_STATE(F32,F32,setSpecularRepeatX);
DEF_EDIT_MAT_STATE(F32,F32,setSpecularRepeatY);
DEF_EDIT_MAT_STATE(F32,F32,setSpecularRotation);
DEF_EDIT_MAT_STATE(U8,U8,setEnvironmentIntensity);
DEF_EDIT_MAT_STATE(U8,U8,setSpecularLightExponent);
DEF_EDIT_MAT_STATE(LLUUID,const LLUUID&,setNormalID);
DEF_EDIT_MAT_STATE(LLUUID,const LLUUID&,setSpecularID);
DEF_EDIT_MAT_STATE(LLColor4U, const LLColor4U&,setSpecularLightColor);
};
class LLSelectedTE
{
public:
static void getFace(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);
DEF_GET_TE_STATE(U8,U8,getBumpmap,0)
DEF_GET_TE_STATE(U8,U8,getShiny,0)
DEF_GET_TE_STATE(U8,U8,getFullbright,0)
DEF_GET_TE_STATE(F32,F32,getRotation,0.0f)
DEF_GET_TE_STATE(F32,F32,getOffsetS,0.0f)
DEF_GET_TE_STATE(F32,F32,getOffsetT,0.0f)
DEF_GET_TE_STATE(F32,F32,getScaleS,1.0f)
DEF_GET_TE_STATE(F32,F32,getScaleT,1.0f)
DEF_GET_TE_STATE(F32,F32,getGlow,0.0f)
DEF_GET_TE_STATE(LLTextureEntry::e_texgen,LLTextureEntry::e_texgen,getTexGen,LLTextureEntry::TEX_GEN_DEFAULT)
DEF_GET_TE_STATE(LLColor4,const LLColor4&,getColor,LLColor4::white)
};
};
#endif

View File

@@ -29,6 +29,7 @@
// file include
#define LLSELECTMGR_CPP
#include "llselectmgr.h"
#include "llmaterialmgr.h"
// library includes
#include "llcachename.h"
@@ -64,6 +65,7 @@
#include "llmenugl.h"
#include "llmeshrepository.h"
#include "llmutelist.h"
#include "llparcel.h"
#include "llnotificationsutil.h"
#include "llstatusbar.h"
#include "llsurface.h"
@@ -80,20 +82,18 @@
#include "llviewermenu.h"
#include "llviewerobject.h"
#include "llviewerobjectlist.h"
#include "llviewerparcelmgr.h"
#include "llviewerregion.h"
#include "llviewerstats.h"
#include "llvoavatarself.h"
#include "llvovolume.h"
#include "pipeline.h"
#include "llviewershadermgr.h"
#include "llparcel.h"
#include "llviewerparcelmgr.h"
#include "llpanelface.h"
#include "llglheaders.h"
#include "hippogridmanager.h"
// [RLVa:KB]
// [RLVa:KB] - Checked: 2011-05-22 (RLVa-1.3.1a)
#include "rlvhandler.h"
// [/RLVa:KB]
@@ -191,6 +191,7 @@ LLSelectMgr::LLSelectMgr()
mDebugSelectMgr(LLCachedControl<bool>( "DebugSelectMgr", false))
{
mTEMode = FALSE;
mTextureChannel = LLRender::DIFFUSE_MAP;
mLastCameraPos.clearVec();
sHighlightThickness = gSavedSettings.getF32("SelectionHighlightThickness");
@@ -239,6 +240,8 @@ void LLSelectMgr::clearSelections()
mHighlightedObjects->deleteAllNodes();
mRectSelectedObjects.clear();
mGridObjects.deleteAllNodes();
LLPipeline::setRenderHighlightTextureChannel(LLRender::DIFFUSE_MAP);
}
void LLSelectMgr::update()
@@ -868,6 +871,10 @@ void LLSelectMgr::addAsIndividual(LLViewerObject *objectp, S32 face, BOOL undoab
// check to see if object is already in list
LLSelectNode *nodep = mSelectedObjects->findNode(objectp);
// Reset (in anticipation of being set to an appropriate value by panel refresh, if they're up)
//
setTextureChannel(LLRender::DIFFUSE_MAP);
// if not in list, add it
if (!nodep)
{
@@ -2005,6 +2012,76 @@ void LLSelectMgr::selectionSetGlow(F32 glow)
mSelectedObjects->applyToObjects( &func2 );
}
void LLSelectMgr::selectionSetMaterialParams(LLSelectedTEMaterialFunctor* material_func)
{
struct f1 : public LLSelectedTEFunctor
{
LLMaterialPtr mMaterial;
f1(LLSelectedTEMaterialFunctor* material_func) : _material_func(material_func) {}
bool apply(LLViewerObject* object, S32 face)
{
if (object && object->permModify() && _material_func)
{
LLTextureEntry* tep = object->getTE(face);
if (tep)
{
LLMaterialPtr current_material = tep->getMaterialParams();
_material_func->apply(object, face, tep, current_material);
}
}
return true;
}
LLSelectedTEMaterialFunctor* _material_func;
} func1(material_func);
mSelectedObjects->applyToTEs( &func1 );
struct f2 : public LLSelectedObjectFunctor
{
virtual bool apply(LLViewerObject* object)
{
if (object->permModify())
{
object->sendTEUpdate();
}
return true;
}
} func2;
mSelectedObjects->applyToObjects( &func2 );
}
void LLSelectMgr::selectionRemoveMaterial()
{
struct f1 : public LLSelectedTEFunctor
{
bool apply(LLViewerObject* object, S32 face)
{
if (object->permModify())
{
LL_DEBUGS("Materials") << "Removing material from object " << object->getID() << " face " << face << LL_ENDL;
LLMaterialMgr::getInstance()->remove(object->getID(),face);
object->setTEMaterialParams(face, NULL);
}
return true;
}
} func1;
mSelectedObjects->applyToTEs( &func1 );
struct f2 : public LLSelectedObjectFunctor
{
virtual bool apply(LLViewerObject* object)
{
if (object->permModify())
{
object->sendTEUpdate();
}
return true;
}
} func2;
mSelectedObjects->applyToObjects( &func2 );
}
//-----------------------------------------------------------------------------
// findObjectPermissions()
@@ -2045,6 +2122,7 @@ BOOL LLSelectMgr::selectionGetGlow(F32 *glow)
return identical;
}
void LLSelectMgr::selectionSetPhysicsType(U8 type)
{
struct f : public LLSelectedObjectFunctor
@@ -2140,6 +2218,7 @@ void LLSelectMgr::selectionSetRestitution(F32 restitution)
getSelection()->applyToObjects(&sendfunc);
}
//-----------------------------------------------------------------------------
// selectionSetMaterial()
//-----------------------------------------------------------------------------
@@ -2424,19 +2503,66 @@ void LLSelectMgr::adjustTexturesByScale(BOOL send_to_sim, BOOL stretch)
continue;
}
LLVector3 scale_ratio = selectNode->mTextureScaleRatios[te_num];
LLVector3 object_scale = object->getScale();
LLVector3 diffuse_scale_ratio = selectNode->mTextureScaleRatios[te_num];
// We like these to track together. NORSPEC-96
//
LLVector3 normal_scale_ratio = diffuse_scale_ratio;
LLVector3 specular_scale_ratio = diffuse_scale_ratio;
// Apply new scale to face
if (planar)
{
object->setTEScale(te_num, 1.f/object_scale.mV[s_axis]*scale_ratio.mV[s_axis],
1.f/object_scale.mV[t_axis]*scale_ratio.mV[t_axis]);
F32 diffuse_scale_s = diffuse_scale_ratio.mV[s_axis]/object_scale.mV[s_axis];
F32 diffuse_scale_t = diffuse_scale_ratio.mV[t_axis]/object_scale.mV[t_axis];
F32 normal_scale_s = normal_scale_ratio.mV[s_axis]/object_scale.mV[s_axis];
F32 normal_scale_t = normal_scale_ratio.mV[t_axis]/object_scale.mV[t_axis];
F32 specular_scale_s = specular_scale_ratio.mV[s_axis]/object_scale.mV[s_axis];
F32 specular_scale_t = specular_scale_ratio.mV[t_axis]/object_scale.mV[t_axis];
object->setTEScale(te_num, diffuse_scale_s, diffuse_scale_t);
LLTextureEntry* tep = object->getTE(te_num);
if (tep && !tep->getMaterialParams().isNull())
{
LLMaterialPtr orig = tep->getMaterialParams();
LLMaterialPtr p = gFloaterTools->getPanelFace()->createDefaultMaterial(orig);
p->setNormalRepeat(normal_scale_s, normal_scale_t);
p->setSpecularRepeat(specular_scale_s, specular_scale_t);
LLMaterialMgr::getInstance()->put(object->getID(), te_num, *p);
}
}
else
{
object->setTEScale(te_num, scale_ratio.mV[s_axis]*object_scale.mV[s_axis],
scale_ratio.mV[t_axis]*object_scale.mV[t_axis]);
F32 diffuse_scale_s = diffuse_scale_ratio.mV[s_axis]*object_scale.mV[s_axis];
F32 diffuse_scale_t = diffuse_scale_ratio.mV[t_axis]*object_scale.mV[t_axis];
F32 normal_scale_s = normal_scale_ratio.mV[s_axis]*object_scale.mV[s_axis];
F32 normal_scale_t = normal_scale_ratio.mV[t_axis]*object_scale.mV[t_axis];
F32 specular_scale_s = specular_scale_ratio.mV[s_axis]*object_scale.mV[s_axis];
F32 specular_scale_t = specular_scale_ratio.mV[t_axis]*object_scale.mV[t_axis];
object->setTEScale(te_num, diffuse_scale_s,diffuse_scale_t);
LLTextureEntry* tep = object->getTE(te_num);
if (tep && !tep->getMaterialParams().isNull())
{
LLMaterialPtr orig = tep->getMaterialParams();
LLMaterialPtr p = gFloaterTools->getPanelFace()->createDefaultMaterial(orig);
p->setNormalRepeat(normal_scale_s, normal_scale_t);
p->setSpecularRepeat(specular_scale_s, specular_scale_t);
LLMaterialMgr::getInstance()->put(object->getID(), te_num, *p);
}
}
send = send_to_sim;
}
@@ -2889,7 +3015,6 @@ BOOL LLSelectMgr::selectGetViewableCharacters()
return TRUE;
}
//-----------------------------------------------------------------------------
// selectGetRootsTransfer() - return TRUE if current agent can transfer all
// selected root objects.
@@ -4473,7 +4598,8 @@ void LLSelectMgr::saveSelectedObjectTransform(EActionType action_type)
struct f : public LLSelectedNodeFunctor
{
EActionType mActionType;
f(EActionType a) : mActionType(a) {}
LLSelectMgr* mManager;
f(EActionType a, LLSelectMgr* p) : mActionType(a), mManager(p) {}
virtual bool apply(LLSelectNode* selectNode)
{
LLViewerObject* object = selectNode->getObject();
@@ -4520,10 +4646,10 @@ void LLSelectMgr::saveSelectedObjectTransform(EActionType action_type)
}
selectNode->mSavedScale = object->getScale();
selectNode->saveTextureScaleRatios();
selectNode->saveTextureScaleRatios(mManager->mTextureChannel);
return true;
}
} func(action_type);
} func(action_type, this);
getSelection()->applyToNodes(&func);
mSavedSelectionBBox = getBBoxOfSelection();
@@ -5850,36 +5976,42 @@ void LLSelectNode::saveTextures(const uuid_vec_t& textures)
}
}
void LLSelectNode::saveTextureScaleRatios()
void LLSelectNode::saveTextureScaleRatios(LLRender::eTexIndex index_to_query)
{
mTextureScaleRatios.clear();
if (mObject.notNull())
{
LLVector3 scale = mObject->getScale();
for (U8 i = 0; i < mObject->getNumTEs(); i++)
{
F32 s,t;
const LLTextureEntry* tep = mObject->getTE(i);
tep->getScale(&s,&t);
U32 s_axis = 0;
U32 t_axis = 0;
LLPrimitive::getTESTAxes(i, &s_axis, &t_axis);
F32 diffuse_s = 1.0f;
F32 diffuse_t = 1.0f;
LLVector3 v;
LLVector3 scale = mObject->getScale();
const LLTextureEntry* tep = mObject->getTE(i);
if (!tep)
continue;
U32 s_axis = VX;
U32 t_axis = VY;
LLPrimitive::getTESTAxes(i, &s_axis, &t_axis);
tep->getScale(&diffuse_s,&diffuse_t);
if (tep->getTexGen() == LLTextureEntry::TEX_GEN_PLANAR)
{
v.mV[s_axis] = s*scale.mV[s_axis];
v.mV[t_axis] = t*scale.mV[t_axis];
v.mV[s_axis] = diffuse_s*scale.mV[s_axis];
v.mV[t_axis] = diffuse_t*scale.mV[t_axis];
mTextureScaleRatios.push_back(v);
}
else
{
v.mV[s_axis] = s/scale.mV[s_axis];
v.mV[t_axis] = t/scale.mV[t_axis];
v.mV[s_axis] = diffuse_s/scale.mV[s_axis];
v.mV[t_axis] = diffuse_t/scale.mV[t_axis];
mTextureScaleRatios.push_back(v);
}
mTextureScaleRatios.push_back(v);
}
}
}
@@ -6383,7 +6515,23 @@ void LLSelectMgr::updateSelectionCenter()
if (mSelectedObjects->mSelectType == SELECT_TYPE_ATTACHMENT && isAgentAvatarValid())
{
mPauseRequest = gAgentAvatarp->requestPause();
// Singu Note: Chalice Yao's pause agent on attachment selection
if (object->permYouOwner())
{
mPauseRequest = gAgentAvatarp->requestPause();
}
else if (LLViewerObject* objectp = mSelectedObjects->getPrimaryObject())
{
while (objectp && !objectp->isAvatar())
{
objectp = (LLViewerObject*)objectp->getParent();
}
if (objectp)
{
mPauseRequest = objectp->asAvatar()->requestPause();
}
}
}
else
{
@@ -6430,6 +6578,7 @@ void LLSelectMgr::updateSelectionCenter()
LLVector3 bbox_center_agent = bbox.getCenterAgent();
mSelectionCenterGlobal = gAgent.getPosGlobalFromAgent(bbox_center_agent);
mSelectionBBox = bbox;
}
if ( !(gAgentID == LLUUID::null))

View File

@@ -49,6 +49,7 @@
#include "llpermissions.h"
#include "llcontrol.h"
#include "llviewerobject.h" // LLObjectSelection::getSelectedTEValue template
#include "llmaterial.h"
#include <deque>
#include <boost/iterator/filter_iterator.hpp>
@@ -89,6 +90,12 @@ struct LLSelectedTEFunctor
virtual bool apply(LLViewerObject* object, S32 face) = 0;
};
struct LLSelectedTEMaterialFunctor
{
virtual ~LLSelectedTEMaterialFunctor() {};
virtual LLMaterialPtr apply(LLViewerObject* object, S32 face, LLTextureEntry* tep, LLMaterialPtr& current_material) = 0;
};
template <typename T> struct LLSelectedTEGetFunctor
{
virtual ~LLSelectedTEGetFunctor() {};
@@ -149,7 +156,7 @@ public:
// *NOTE: invalidate stored textures and colors when # faces change
void saveColors();
void saveTextures(const uuid_vec_t& textures);
void saveTextureScaleRatios();
void saveTextureScaleRatios(LLRender::eTexIndex index_to_query);
BOOL allowOperationOnNode(PermissionBit op, U64 group_proxy_power) const;
@@ -272,6 +279,8 @@ public:
LLViewerObject* getFirstCopyableObject(BOOL get_parent = FALSE);
LLViewerObject* getFirstDeleteableObject();
LLViewerObject* getFirstMoveableObject(BOOL get_parent = FALSE);
/// Return the object that lead to this selection, possible a child
LLViewerObject* getPrimaryObject() { return mPrimaryObject; }
// iterate through texture entries
@@ -344,6 +353,7 @@ public:
static BOOL sRectSelectInclusive; // do we need to surround an object to pick it?
static BOOL sRenderHiddenSelections; // do we show selection silhouettes that are occluded?
static BOOL sRenderLightRadius; // do we show the radius of selected lights?
static F32 sHighlightThickness;
static F32 sHighlightUScale;
static F32 sHighlightVScale;
@@ -465,11 +475,11 @@ public:
////////////////////////////////////////////////////////////////
// Selection accessors
////////////////////////////////////////////////////////////////
LLObjectSelectionHandle getHoverObjects() { return mHoverObjects; }
LLObjectSelectionHandle getSelection() { return mSelectedObjects; }
// right now this just renders the selection with root/child colors instead of a single color
LLObjectSelectionHandle getEditSelection() { convertTransient(); return mSelectedObjects; }
LLObjectSelectionHandle getHighlightedObjects() { return mHighlightedObjects; }
LLObjectSelectionHandle getHoverObjects() { return mHoverObjects; }
////////////////////////////////////////////////////////////////
// Grid manipulation
@@ -502,6 +512,11 @@ public:
void saveSelectedObjectColors();
void saveSelectedObjectTextures();
// Sets which texture channel to query for scale and rot of display
// and depends on UI state of LLPanelFace when editing
void setTextureChannel(LLRender::eTexIndex texIndex) { mTextureChannel = texIndex; }
LLRender::eTexIndex getTextureChannel() { return mTextureChannel; }
void selectionUpdatePhysics(BOOL use_physics);
void selectionUpdateTemporary(BOOL is_temporary);
void selectionUpdatePhantom(BOOL is_ghost);
@@ -532,6 +547,8 @@ public:
void selectionSetClickAction(U8 action);
void selectionSetIncludeInSearch(bool include_in_search);
void selectionSetGlow(const F32 glow);
void selectionSetMaterialParams(LLSelectedTEMaterialFunctor* material_func);
void selectionRemoveMaterial();
void selectionSetObjectPermissions(U8 perm_field, BOOL set, U32 perm_mask, BOOL override = FALSE);
void selectionSetObjectName(const std::string& name);
@@ -759,8 +776,8 @@ private:
LLVector3 mGridScale;
EGridMode mGridMode;
BOOL mTEMode; // render te
LLRender::eTexIndex mTextureChannel; // diff, norm, or spec, depending on UI editing mode
LLVector3d mSelectionCenterGlobal;
LLBBox mSelectionBBox;

View File

@@ -141,6 +141,8 @@ public:
// New functions
void setImageID( const LLUUID& image_asset_id);
const LLUUID& getWhiteImageAssetID() const { return mWhiteImageAssetID; }
void setWhiteImageAssetID(const LLUUID& id) { mWhiteImageAssetID = id; }
void updateImageStats();
const LLUUID& getAssetID() { return mImageAssetID; }
const LLUUID& findItemID(const LLUUID& asset_id, BOOL copyable_only);
@@ -158,6 +160,9 @@ public:
void updateFilterPermMask();
void commitIfImmediateSet();
void setCanApply(bool can_preview, bool can_apply);
void setTextureSelectedCallback(texture_selected_callback cb) {mTextureSelectedCallback = cb;}
static void onBtnSetToDefault( void* userdata );
static void onBtnSelect( void* userdata );
static void onBtnCancel( void* userdata );
@@ -220,6 +225,11 @@ protected:
LLSaveFolderState mSavedFolderState;
BOOL mSelectedItemPinned;
LLScrollListCtrl* mLocalScrollCtrl; // tag: vaa emerald local_asset_browser
private:
bool mCanApply;
bool mCanPreview;
texture_selected_callback mTextureSelectedCallback;
};
LLFloaterTexturePicker::LLFloaterTexturePicker(
@@ -254,7 +264,9 @@ LLFloaterTexturePicker::LLFloaterTexturePicker(
mDnDFilterPermMask(dnd_filter_perm_mask),
mNonImmediateFilterPermMask(non_immediate_filter_perm_mask),
mContextConeOpacity(0.f),
mSelectedItemPinned(FALSE)
mSelectedItemPinned(FALSE),
mCanApply(true),
mCanPreview(true)
{
mCanApplyImmediately = can_apply_immediately;
LLUICtrlFactory::getInstance()->buildFloater(this,"floater_texture_ctrl.xml");
@@ -353,7 +365,9 @@ BOOL LLFloaterTexturePicker::handleDragAndDrop(
{
BOOL handled = FALSE;
if (cargo_type == DAD_TEXTURE)
bool is_mesh = cargo_type == DAD_MESH;
if ((cargo_type == DAD_TEXTURE) || is_mesh)
{
LLInventoryItem *item = (LLInventoryItem *)cargo_data;
@@ -373,6 +387,9 @@ BOOL LLFloaterTexturePicker::handleDragAndDrop(
{
if (drop)
{
// <FS:Ansariel> FIRE-8298: Apply now checkbox has no effect
setCanApply(true, true);
// </FS:Ansariel>
setImageID( item->getAssetUUID() );
commitIfImmediateSet();
}
@@ -607,7 +624,7 @@ void LLFloaterTexturePicker::draw()
// if we're inactive, gray out "apply immediate" checkbox
getChildView("show_folders_check")->setEnabled(mActive && mCanApplyImmediately && !mNoCopyTextureSelected);
getChildView("Select")->setEnabled(mActive);
getChildView("Select")->setEnabled(mActive && mCanApply);
getChildView("Pipette")->setEnabled(mActive);
getChild<LLUICtrl>("Pipette")->setValue(LLToolMgr::getInstance()->getCurrentTool() == LLToolPipette::getInstance());
@@ -768,8 +785,10 @@ PermissionMask LLFloaterTexturePicker::getFilterPermMask()
void LLFloaterTexturePicker::commitIfImmediateSet()
{
bool apply_immediate = getChild<LLUICtrl>("apply_immediate_check")->getValue().asBoolean();
if (!mNoCopyTextureSelected && mOwner && apply_immediate)
// <FS:Ansariel> FIRE-8298: Apply now checkbox has no effect
//if (!mNoCopyTextureSelected && mOwner && mCanApply)
if (!mNoCopyTextureSelected && mOwner && mCanApply && mCanPreview)
// </FS:Ansariel>
{
mOwner->onFloaterCommit(LLTextureCtrl::TEXTURE_CHANGE);
}
@@ -779,6 +798,7 @@ void LLFloaterTexturePicker::commitIfImmediateSet()
void LLFloaterTexturePicker::onBtnSetToDefault(void* userdata)
{
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
self->setCanApply(true, true);
if (self->mOwner)
{
self->setImageID( self->mOwner->getDefaultImageAssetID() );
@@ -790,6 +810,7 @@ void LLFloaterTexturePicker::onBtnSetToDefault(void* userdata)
void LLFloaterTexturePicker::onBtnWhite(void* userdata)
{
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
self->setCanApply(true, true);
self->setImageID( self->mWhiteImageAssetID );
self->commitIfImmediateSet();
}
@@ -798,6 +819,7 @@ void LLFloaterTexturePicker::onBtnWhite(void* userdata)
void LLFloaterTexturePicker::onBtnNone(void* userdata)
{
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
self->setCanApply(true, true);
self->setImageID( LLUUID::null );
self->commitIfImmediateSet();
}
@@ -806,6 +828,7 @@ void LLFloaterTexturePicker::onBtnNone(void* userdata)
void LLFloaterTexturePicker::onBtnInvisible(void* userdata)
{
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
self->setCanApply(true, true);
self->setImageID(self->mInvisibleImageAssetID);
self->commitIfImmediateSet();
}
@@ -815,6 +838,7 @@ void LLFloaterTexturePicker::onBtnInvisible(void* userdata)
void LLFloaterTexturePicker::onBtnAlpha(void* userdata)
{
LLFloaterTexturePicker* self = (LLFloaterTexturePicker*) userdata;
self->setCanApply(true, true);
self->setImageID(self->mAlphaImageAssetID);
self->commitIfImmediateSet();
}
@@ -959,6 +983,10 @@ void LLFloaterTexturePicker::onSelectionChange(const std::deque<LLFolderViewItem
mNoCopyTextureSelected = FALSE;
if (itemp)
{
if (!mTextureSelectedCallback.empty())
{
mTextureSelectedCallback(itemp);
}
// <dogmode>
if (itemp->getPermissions().getMaskOwner() & PERM_ALL)
childSetValue("texture_uuid", mImageAssetID);
@@ -970,9 +998,12 @@ void LLFloaterTexturePicker::onSelectionChange(const std::deque<LLFolderViewItem
{
mNoCopyTextureSelected = TRUE;
}
// <FS:Ansariel> FIRE-8298: Apply now checkbox has no effect
setCanApply(true, true);
// </FS:Ansariel>
mImageAssetID = itemp->getAssetUUID();
mIsDirty = TRUE;
if (user_action)
if (user_action && mCanPreview)
{
// only commit intentional selections, not implicit ones
commitIfImmediateSet();
@@ -1004,7 +1035,9 @@ void LLFloaterTexturePicker::onApplyImmediateCheck(LLUICtrl* ctrl, void *user_da
LLCheckBoxCtrl* check_box = (LLCheckBoxCtrl*)ctrl;
gSavedSettings.setBOOL("ApplyTextureImmediately", check_box->get());
// <FS:Ansariel> FIRE-8298: Apply now checkbox has no effect
picker->setCanApply(true, true);
// </FS:Ansariel>
picker->updateFilterPermMask();
picker->commitIfImmediateSet();
}
@@ -1014,6 +1047,16 @@ void LLFloaterTexturePicker::updateFilterPermMask()
//mInventoryPanel->setFilterPermMask( getFilterPermMask() ); Commented out due to no-copy texture loss.
}
void LLFloaterTexturePicker::setCanApply(bool can_preview, bool can_apply)
{
getChildRef<LLUICtrl>("Select").setEnabled(can_apply);
getChildRef<LLUICtrl>("preview_disabled").setVisible(!can_preview);
getChildRef<LLUICtrl>("apply_immediate_check").setVisible(can_preview);
mCanApply = can_apply;
mCanPreview = can_preview ? gSavedSettings.getBOOL("ApplyTextureImmediately") : false;
}
void LLFloaterTexturePicker::onFilterEdit(const std::string& search_string )
{
std::string upper_case_search_string = search_string;
@@ -1054,6 +1097,9 @@ void LLFloaterTexturePicker::onTextureSelect( const LLTextureEntry& te )
if (inventory_item_id.notNull())
{
LLToolPipette::getInstance()->setResult(TRUE, "");
// <FS:Ansariel> FIRE-8298: Apply now checkbox has no effect
setCanApply(true, true);
// </FS:Ansariel>
setImageID(te.getID());
mNoCopyTextureSelected = FALSE;
@@ -1094,6 +1140,7 @@ LLTextureCtrl::LLTextureCtrl(
mDragCallback(NULL),
mDropCallback(NULL),
mOnCancelCallback(NULL),
mOnCloseCallback(NULL),
mOnSelectCallback(NULL),
mBorderColor( gColors.getColor("DefaultHighlightLight") ),
mImageAssetID( image_id ),
@@ -1221,6 +1268,19 @@ void LLTextureCtrl::setShowLoadingPlaceholder(BOOL showLoadingPlaceholder)
mShowLoadingPlaceholder = showLoadingPlaceholder;
}
// Singu Note: These two functions exist to work like their upstream counterparts
void LLTextureCtrl::setBlankImageAssetID(const LLUUID& id)
{
if (LLFloaterTexturePicker* floater = dynamic_cast<LLFloaterTexturePicker*>(mFloaterHandle.get()))
floater->setWhiteImageAssetID(id);
}
const LLUUID& LLTextureCtrl::getBlankImageAssetID() const
{
if (LLFloaterTexturePicker* floater = dynamic_cast<LLFloaterTexturePicker*>(mFloaterHandle.get()))
return floater->getWhiteImageAssetID();
return LLUUID::null;
}
void LLTextureCtrl::setCaption(const std::string& caption)
{
mCaption->setText( caption );
@@ -1236,6 +1296,15 @@ void LLTextureCtrl::setCanApplyImmediately(BOOL b)
}
}
void LLTextureCtrl::setCanApply(bool can_preview, bool can_apply)
{
LLFloaterTexturePicker* floaterp = dynamic_cast<LLFloaterTexturePicker*>(mFloaterHandle.get());
if( floaterp )
{
floaterp->setCanApply(can_preview, can_apply);
}
}
void LLTextureCtrl::setVisible( BOOL visible )
{
if( !visible )
@@ -1341,6 +1410,12 @@ void LLTextureCtrl::showPicker(BOOL take_focus)
mFloaterHandle = floaterp->getHandle();
LLFloaterTexturePicker* texture_floaterp = dynamic_cast<LLFloaterTexturePicker*>(floaterp);
if (texture_floaterp && mOnTextureSelectedCallback)
{
texture_floaterp->setTextureSelectedCallback(mOnTextureSelectedCallback);
}
gFloaterView->getParentFloater(this)->addDependentFloater(floaterp);
floaterp->open(); /* Flawfinder: ignore */
}
@@ -1395,6 +1470,10 @@ void LLTextureCtrl::onFloaterClose()
if (floaterp)
{
if (mOnCloseCallback)
{
mOnCloseCallback(this,LLSD());
}
floaterp->setOwner(NULL);
mLastFloaterLeftTop.set( floaterp->getRect().mLeft, floaterp->getRect().mTop );
}
@@ -1466,6 +1545,16 @@ void LLTextureCtrl::onFloaterCommit(ETexturePickOp op, LLUUID id)
// tag: vaa emerald local_asset_browser [end]
void LLTextureCtrl::setOnTextureSelectedCallback(texture_selected_callback cb)
{
mOnTextureSelectedCallback = cb;
LLFloaterTexturePicker* floaterp = dynamic_cast<LLFloaterTexturePicker*>(mFloaterHandle.get());
if (floaterp)
{
floaterp->setTextureSelectedCallback(cb);
}
}
void LLTextureCtrl::setImageAssetID( const LLUUID& asset_id )
{
if( mImageAssetID != asset_id )

View File

@@ -48,6 +48,7 @@ class LLViewerFetchedTexture;
// used for setting drag & drop callbacks.
typedef boost::function<BOOL (LLUICtrl*, LLInventoryItem*)> drag_n_drop_callback;
typedef boost::function<void (LLInventoryItem*)> texture_selected_callback;
//////////////////////////////////////////////////////////////////////////////////////////
@@ -79,7 +80,6 @@ public:
static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
BOOL drop, EDragAndDropType cargo_type, void *cargo_data,
EAcceptance *accept,
@@ -124,12 +124,17 @@ public:
const std::string& getDefaultImageName() const { return mDefaultImageName; }
void setBlankImageAssetID(const LLUUID& id);
const LLUUID& getBlankImageAssetID() const;
void setFallbackImageName( const std::string& name ) { mFallbackImageName = name; }
const std::string& getFallbackImageName() const { return mFallbackImageName; }
void setCaption(const std::string& caption);
void setCanApplyImmediately(BOOL b);
void setCanApply(bool can_preview, bool can_apply);
void setImmediateFilterPermMask(PermissionMask mask)
{ mImmediateFilterPermMask = mask; }
void setDnDFilterPermMask(PermissionMask mask)
@@ -155,11 +160,18 @@ public:
void setDropCallback(drag_n_drop_callback cb) { mDropCallback = cb; }
void setOnCancelCallback(commit_callback_t cb) { mOnCancelCallback = cb; }
void setOnCloseCallback(commit_callback_t cb) { mOnCloseCallback = cb; }
void setOnSelectCallback(commit_callback_t cb) { mOnSelectCallback = cb; }
/*
* callback for changing texture selection in inventory list of texture floater
*/
void setOnTextureSelectedCallback(texture_selected_callback cb);
void setShowLoadingPlaceholder(BOOL showLoadingPlaceholder);
LLViewerFetchedTexture* getTexture() { return mTexturep; }
static void handleClickOpenTexture(void* userdata);
static void handleClickCopyAssetID(void* userdata);
@@ -172,6 +184,8 @@ private:
drag_n_drop_callback mDropCallback;
commit_callback_t mOnCancelCallback;
commit_callback_t mOnSelectCallback;
commit_callback_t mOnCloseCallback;
texture_selected_callback mOnTextureSelectedCallback;
LLPointer<LLViewerFetchedTexture> mTexturep;
LLColor4 mBorderColor;
LLUUID mImageItemID;

View File

@@ -31,26 +31,19 @@
*/
#include "llviewerprecompiledheaders.h"
#include "message.h"
#include "lltooldraganddrop.h"
// library headers
#include "llnotificationsutil.h"
#include "llinstantmessage.h"
#include "lldir.h"
// project headers
#include "llagent.h"
#include "llagentcamera.h"
#include "llagentwearables.h"
#include "llappearancemgr.h"
#include "lldictionary.h"
#include "llviewercontrol.h"
#include "llfirstuse.h"
#include "llfloater.h"
#include "llfloaterinventory.h"
#include "llfloatertools.h"
#include "llfocusmgr.h"
#include "llgesturemgr.h"
#include "llgiveinventory.h"
#include "llhudmanager.h"
@@ -66,7 +59,6 @@
#include "llselectmgr.h"
#include "lltoolmgr.h"
#include "lltrans.h"
#include "llui.h"
#include "llviewertexturelist.h"
#include "llviewerinventory.h"
#include "llviewerobject.h"
@@ -77,14 +69,14 @@
#include "llvoavatarself.h"
#include "llvolume.h"
#include "llworld.h"
#include "object_flags.h"
#include "llpanelface.h"
// <edit>
#include "llappviewer.h" // System Folders
#include "llparcel.h" // always rez
#include "llviewerparcelmgr.h" // always rez
// </edit>
// [RLVa:KB] - Checked: 2010-03-04 (RLVa-1.2.0a)
// [RLVa:KB] - Checked: 2011-05-22 (RLVa-1.3.1)
#include "rlvhandler.h"
#include "rlvlocks.h"
// [/RLVa:KB]
@@ -388,9 +380,12 @@ void LLToolDragAndDrop::setDragStart(S32 x, S32 y)
BOOL LLToolDragAndDrop::isOverThreshold(S32 x,S32 y)
{
const S32 MIN_MANHATTAN_DIST = 3;
S32 manhattan_dist = llabs( x - mDragStartX ) + llabs( y - mDragStartY );
return manhattan_dist >= MIN_MANHATTAN_DIST;
static LLCachedControl<S32> drag_and_drop_threshold(gSavedSettings,"DragAndDropDistanceThreshold");
S32 mouse_delta_x = x - mDragStartX;
S32 mouse_delta_y = y - mDragStartY;
return (mouse_delta_x * mouse_delta_x) + (mouse_delta_y * mouse_delta_y) > drag_and_drop_threshold * drag_and_drop_threshold;
}
void LLToolDragAndDrop::beginDrag(EDragAndDropType type,
@@ -1162,10 +1157,56 @@ void LLToolDragAndDrop::dropTextureOneFace(LLViewerObject* hit_obj,
// update viewer side image in anticipation of update from simulator
//LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture(asset_id);
LLViewerStats::getInstance()->incStat(LLViewerStats::ST_EDIT_TEXTURE_COUNT );
//hit_obj->setTEImage(hit_face, image);
hit_obj->setTETexture(hit_face, asset_id); //Singu note: setTETexture will allow the real id to be passed to LLPrimitive::setTETexture,
// even if it's null. setTEImage would actually pass down IMG_DEFAULT under such a case,
// which we don't want.
LLTextureEntry* tep = hit_obj ? (hit_obj->getTE(hit_face)) : NULL;
LLPanelFace* panel_face = gFloaterTools->getPanelFace();
if (gFloaterTools->getVisible() && panel_face)
{
switch (LLSelectMgr::getInstance()->getTextureChannel())
{
case 0:
default:
{
//hit_obj->setTEImage(hit_face, image);
hit_obj->setTETexture(hit_face, asset_id); //Singu note: setTETexture will allow the real id to be passed to LLPrimitive::setTETexture,
// even if it's null. setTEImage would actually pass down IMG_DEFAULT under such a case,
// which we don't want.
}
break;
case 1:
{
LLMaterialPtr old_mat = tep->getMaterialParams();
LLMaterialPtr new_mat = panel_face->createDefaultMaterial(old_mat);
new_mat->setNormalID(asset_id);
tep->setMaterialParams(new_mat);
hit_obj->setTENormalMap(hit_face, asset_id);
LLMaterialMgr::getInstance()->put(hit_obj->getID(), hit_face, *new_mat);
}
break;
case 2:
{
LLMaterialPtr old_mat = tep->getMaterialParams();
LLMaterialPtr new_mat = panel_face->createDefaultMaterial(old_mat);
new_mat->setSpecularID(asset_id);
tep->setMaterialParams(new_mat);
hit_obj->setTESpecularMap(hit_face, asset_id);
LLMaterialMgr::getInstance()->put(hit_obj->getID(), hit_face, *new_mat);
}
break;
}
}
else
{
//hit_obj->setTEImage(hit_face, image);
hit_obj->setTETexture(hit_face, asset_id); //Singu note: setTETexture will allow the real id to be passed to LLPrimitive::setTETexture,
// even if it's null. setTEImage would actually pass down IMG_DEFAULT under such a case,
// which we don't want.
}
dialog_refresh_all();
// send the update to the simulator
@@ -1619,6 +1660,7 @@ bool LLToolDragAndDrop::handleGiveDragAndDrop(LLUUID dest_agent, LLUUID session_
case DAD_ANIMATION:
case DAD_GESTURE:
case DAD_CALLINGCARD:
case DAD_MESH:
{
LLViewerInventoryItem* inv_item = (LLViewerInventoryItem*)cargo_data;
if(gInventory.getItem(inv_item->getUUID())
@@ -2353,7 +2395,7 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventoryCategory(
}
}
// if every item is accepted, go ahead and send it on.
// If every item is accepted, send it on
if(drop && (ACCEPT_YES_COPY_SINGLE <= rv))
{
uuid_vec_t ids;
@@ -2595,7 +2637,12 @@ LLInventoryObject* LLToolDragAndDrop::locateInventory(
{
item = NULL;
cat = NULL;
if(mCargoIDs.empty()) return NULL;
if (mCargoIDs.empty())
{
return NULL;
}
if((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY))
{
// The object should be in user inventory.

View File

@@ -109,6 +109,8 @@
#include "llwaterparammanager.h"
#include "llspatialpartition.h"
#include "llmutelist.h"
#include "llfloatertools.h"
#include "llpanelface.h"
// [RLVa:KB] - Checked: 2011-05-22 (RLVa-1.3.1a)
#include "rlvhandler.h"
@@ -319,6 +321,7 @@ BOOL LLPipeline::sRenderParticleBeacons = FALSE;
BOOL LLPipeline::sRenderSoundBeacons = FALSE;
BOOL LLPipeline::sRenderBeacons = FALSE;
BOOL LLPipeline::sRenderHighlight = TRUE;
LLRender::eTexIndex LLPipeline::sRenderHighlightTextureChannel = LLRender::DIFFUSE_MAP;
BOOL LLPipeline::sForceOldBakedUpload = FALSE;
S32 LLPipeline::sUseOcclusion = 0;
BOOL LLPipeline::sDelayVBUpdate = FALSE;
@@ -3839,6 +3842,8 @@ void LLPipeline::postSort(LLCamera& camera)
{
mSelectedFaces.clear();
LLPipeline::setRenderHighlightTextureChannel(gFloaterTools->getPanelFace()->getTextureChannelToEdit());
// Draw face highlights for selected faces.
if (LLSelectMgr::getInstance()->getTEMode())
{
@@ -3938,13 +3943,14 @@ void LLPipeline::renderHighlights()
gGL.diffuseColor4f(1,1,1,0.5f);
}
if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED))
if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED) && !mFaceSelectImagep)
{
mFaceSelectImagep = LLViewerTextureManager::getFetchedTexture(IMG_FACE_SELECT);
}
if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED) && (sRenderHighlightTextureChannel == LLRender::DIFFUSE_MAP))
{
// Make sure the selection image gets downloaded and decoded
if (!mFaceSelectImagep)
{
mFaceSelectImagep = LLViewerTextureManager::getFetchedTexture(IMG_FACE_SELECT);
}
mFaceSelectImagep->addTextureStats((F32)MAX_IMAGE_AREA);
U32 count = mSelectedFaces.size();
@@ -3982,6 +3988,67 @@ void LLPipeline::renderHighlights()
{
gHighlightProgram.unbind();
}
if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED) && (sRenderHighlightTextureChannel == LLRender::NORMAL_MAP))
{
color.setVec(1.0f, 0.5f, 0.5f, 0.5f);
if ((LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0))
{
gHighlightNormalProgram.bind();
gGL.diffuseColor4f(1,1,1,0.5f);
}
mFaceSelectImagep->addTextureStats((F32)MAX_IMAGE_AREA);
U32 count = mSelectedFaces.size();
for (U32 i = 0; i < count; i++)
{
LLFace *facep = mSelectedFaces[i];
if (!facep || facep->getDrawable()->isDead())
{
llerrs << "Bad face on selection" << llendl;
return;
}
facep->renderSelected(mFaceSelectImagep, color);
}
if ((LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0))
{
gHighlightNormalProgram.unbind();
}
}
if (hasRenderDebugFeatureMask(RENDER_DEBUG_FEATURE_SELECTED) && (sRenderHighlightTextureChannel == LLRender::SPECULAR_MAP))
{
color.setVec(0.0f, 0.3f, 1.0f, 0.8f);
if ((LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0))
{
gHighlightSpecularProgram.bind();
gGL.diffuseColor4f(1,1,1,0.5f);
}
mFaceSelectImagep->addTextureStats((F32)MAX_IMAGE_AREA);
U32 count = mSelectedFaces.size();
for (U32 i = 0; i < count; i++)
{
LLFace *facep = mSelectedFaces[i];
if (!facep || facep->getDrawable()->isDead())
{
llerrs << "Bad face on selection" << llendl;
return;
}
facep->renderSelected(mFaceSelectImagep, color);
}
if ((LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_INTERFACE) > 0))
{
gHighlightSpecularProgram.unbind();
}
}
}
//debug use
@@ -6399,6 +6466,12 @@ BOOL LLPipeline::getRenderHighlights(void*)
return sRenderHighlight;
}
// static
void LLPipeline::setRenderHighlightTextureChannel(LLRender::eTexIndex channel)
{
sRenderHighlightTextureChannel = channel;
}
LLVOPartGroup* LLPipeline::lineSegmentIntersectParticle(const LLVector4a& start, const LLVector4a& end, LLVector4a* intersection,
S32* face_hit)
{

View File

@@ -413,6 +413,7 @@ public:
static void setRenderHighlights(BOOL val);
static void toggleRenderHighlights(void* data);
static BOOL getRenderHighlights(void* data);
static void setRenderHighlightTextureChannel(LLRender::eTexIndex channel); // sets which UV setup to display in highlight overlay
static void updateRenderDeferred();
static void refreshCachedSettings();
@@ -837,6 +838,10 @@ public:
static BOOL sRenderBeacons;
static BOOL sRenderHighlight;
// Determines which set of UVs to use in highlight display
//
static LLRender::eTexIndex sRenderHighlightTextureChannel;
//debug use
static U32 sCurRenderPoolType ;
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 602 B

View File

@@ -7752,6 +7752,18 @@ You uploaded a [RESOLUTION] baked texture for '[BODYREGION]' after [TIME] second
You locally updated a [RESOLUTION] baked texture for '[BODYREGION]' after [TIME] seconds.
</notification>
<notification
icon="alertmodal.tga"
name="LivePreviewUnavailable"
type="alert">
We cannot apply this texture immediately because it is no-copy and/or no-transfer.
<usetemplate
ignoretext="Warn me that Apply Texture Immediately mode is not available for no-copy and/or no-transfer textures"
name="okignore"
yestext="OK"/>
</notification>
<notification
icon="notify.tga"
name="FirstAO"

File diff suppressed because it is too large Load Diff

View File

@@ -305,6 +305,7 @@
<!-- build floater -->
<string name="multiple_textures">Multiple</string>
<string name="use_texture">Use texture</string>
<!-- world map -->
<string name="texture_loading">Loading...</string>