summaryrefslogtreecommitdiff
path: root/indra/newview/llselectmgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llselectmgr.cpp')
-rw-r--r--indra/newview/llselectmgr.cpp78
1 files changed, 62 insertions, 16 deletions
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 03cf79c28c..8286054787 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -1995,7 +1995,7 @@ bool LLSelectMgr::selectionSetGLTFMaterial(const LLUUID& mat_id)
asset_id = BLANK_MATERIAL_ASSET_ID;
}
}
-
+ objectp->clearTEWaterExclusion(te);
// Blank out most override data on the object and send to server
objectp->setRenderMaterialID(te, asset_id);
@@ -2477,6 +2477,7 @@ void LLSelectMgr::selectionSetMedia(U8 media_type, const LLSD &media_data)
}
else {
// Add/update media
+ object->clearTEWaterExclusion(te);
object->setTEMediaFlags(te, mMediaFlags);
LLVOVolume *vo = dynamic_cast<LLVOVolume*>(object);
llassert(NULL != vo);
@@ -3138,22 +3139,46 @@ void LLSelectMgr::adjustTexturesByScale(bool send_to_sim, bool stretch)
F32 scale_x = 1;
F32 scale_y = 1;
+ F32 offset_x = 0;
+ F32 offset_y = 0;
- for (U32 i = 0; i < LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; ++i)
+ if (te_num < selectNode->mGLTFScaleRatios.size())
{
- LLVector3 scale_ratio = selectNode->mGLTFScaleRatios[te_num][i];
-
- if (planar)
+ for (U32 i = 0; i < LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; ++i)
{
- scale_x = scale_ratio.mV[s_axis] / object_scale.mV[s_axis];
- scale_y = scale_ratio.mV[t_axis] / object_scale.mV[t_axis];
+ LLVector3 scale_ratio = selectNode->mGLTFScaleRatios[te_num][i];
+
+ if (planar)
+ {
+ scale_x = scale_ratio.mV[s_axis] / object_scale.mV[s_axis];
+ scale_y = scale_ratio.mV[t_axis] / object_scale.mV[t_axis];
+ }
+ else
+ {
+ scale_x = scale_ratio.mV[s_axis] * object_scale.mV[s_axis];
+ scale_y = scale_ratio.mV[t_axis] * object_scale.mV[t_axis];
+ }
+ material->mTextureTransform[i].mScale.set(scale_x, scale_y);
+
+ LLVector2 scales = selectNode->mGLTFScales[te_num][i];
+ LLVector2 offsets = selectNode->mGLTFOffsets[te_num][i];
+ F64 int_part = 0;
+ offset_x = (F32)modf((offsets[VX] + (scales[VX] - scale_x)) / 2, &int_part);
+ if (offset_x < 0)
+ {
+ offset_x++;
+ }
+ offset_y = (F32)modf((offsets[VY] + (scales[VY] - scale_y)) / 2, &int_part);
+ if (offset_y < 0)
+ {
+ offset_y++;
+ }
+ material->mTextureTransform[i].mOffset.set(offset_x, offset_y);
}
- else
- {
- scale_x = scale_ratio.mV[s_axis] * object_scale.mV[s_axis];
- scale_y = scale_ratio.mV[t_axis] * object_scale.mV[t_axis];
- }
- material->mTextureTransform[i].mScale.set(scale_x, scale_y);
+ }
+ else
+ {
+ llassert(false); // make sure mGLTFScaleRatios is filled
}
const LLGLTFMaterial* base_material = tep->getGLTFMaterial();
@@ -6908,10 +6933,11 @@ void LLSelectNode::saveTextureScaleRatios(LLRender::eTexIndex index_to_query)
{
mTextureScaleRatios.clear();
mGLTFScaleRatios.clear();
+ mGLTFScales.clear();
+ mGLTFOffsets.clear();
if (mObject.notNull())
{
-
LLVector3 scale = mObject->getScale();
for (U8 i = 0; i < mObject->getNumTEs(); i++)
@@ -6948,6 +6974,8 @@ void LLSelectNode::saveTextureScaleRatios(LLRender::eTexIndex index_to_query)
F32 scale_x = 1;
F32 scale_y = 1;
std::vector<LLVector3> material_v_vec;
+ std::vector<LLVector2> material_scales_vec;
+ std::vector<LLVector2> material_offset_vec;
for (U32 i = 0; i < LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT; ++i)
{
if (material)
@@ -6955,12 +6983,16 @@ void LLSelectNode::saveTextureScaleRatios(LLRender::eTexIndex index_to_query)
LLGLTFMaterial::TextureTransform& transform = material->mTextureTransform[i];
scale_x = transform.mScale[VX];
scale_y = transform.mScale[VY];
+ material_scales_vec.push_back(transform.mScale);
+ material_offset_vec.push_back(transform.mOffset);
}
else
{
// Not having an override doesn't mean that there is no material
scale_x = 1;
scale_y = 1;
+ material_scales_vec.emplace_back(scale_x, scale_y);
+ material_offset_vec.emplace_back(0.f, 0.f);
}
if (tep->getTexGen() == LLTextureEntry::TEX_GEN_PLANAR)
@@ -6976,6 +7008,8 @@ void LLSelectNode::saveTextureScaleRatios(LLRender::eTexIndex index_to_query)
material_v_vec.push_back(material_v);
}
mGLTFScaleRatios.push_back(material_v_vec);
+ mGLTFScales.push_back(material_scales_vec);
+ mGLTFOffsets.push_back(material_offset_vec);
}
}
}
@@ -7257,7 +7291,10 @@ void dialog_refresh_all()
// *TODO: Eliminate all calls into outside classes below, make those
// objects register with the update signal.
- gFloaterTools->dirty();
+ if (gFloaterTools)
+ {
+ gFloaterTools->dirty();
+ }
gMenuObject->needsArrange();
@@ -7486,7 +7523,8 @@ void LLSelectMgr::updatePointAt()
LLVector3 select_offset;
const LLPickInfo& pick = gViewerWindow->getLastPick();
LLViewerObject *click_object = pick.getObject();
- if (click_object && click_object->isSelected())
+ bool was_hud = pick.mPickHUD && click_object && !click_object->isHUDAttachment();
+ if (click_object && click_object->isSelected() && !was_hud)
{
// clicked on another object in our selection group, use that as target
select_offset.setVec(pick.mObjectOffset);
@@ -7724,6 +7762,14 @@ void LLSelectMgr::setAgentHUDZoom(F32 target_zoom, F32 current_zoom)
gAgentCamera.mHUDCurZoom = current_zoom;
}
+void LLSelectMgr::clearWaterExclusion()
+{
+ // reset texture to default plywood
+ LLSelectMgr::getInstance()->selectionSetImage(DEFAULT_OBJECT_TEXTURE);
+ // reset texture repeats, that might be altered by invisiprim script from wiki
+ LLSelectMgr::getInstance()->selectionTexScaleAutofit(2.f);
+}
+
/////////////////////////////////////////////////////////////////////////////
// Object selection iterator helpers
/////////////////////////////////////////////////////////////////////////////