SL-19183 PBR mapping scale values start on zero

master
Andrey Kleshchev 2023-02-14 00:12:09 +02:00
parent 3561e9b5d5
commit a549140fd0
2 changed files with 11 additions and 28 deletions

View File

@ -1829,6 +1829,7 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material,
const U32 pbr_type = findChild<LLRadioGroup>("radio_pbr_type")->getSelectedIndex();
const LLGLTFMaterial::TextureInfo texture_info = texture_info_from_pbrtype(pbr_type);
const bool show_texture_info = texture_info != LLGLTFMaterial::GLTF_TEXTURE_INFO_COUNT;
const bool new_state = show_texture_info && has_pbr_capabilities && has_pbr_material;
LLUICtrl* gltfCtrlTextureScaleU = getChild<LLUICtrl>("gltfTextureScaleU");
LLUICtrl* gltfCtrlTextureScaleV = getChild<LLUICtrl>("gltfTextureScaleV");
@ -1836,13 +1837,15 @@ void LLPanelFace::updateUIGLTF(LLViewerObject* objectp, bool& has_pbr_material,
LLUICtrl* gltfCtrlTextureOffsetU = getChild<LLUICtrl>("gltfTextureOffsetU");
LLUICtrl* gltfCtrlTextureOffsetV = getChild<LLUICtrl>("gltfTextureOffsetV");
gltfCtrlTextureScaleU->setEnabled(show_texture_info && has_pbr_capabilities && has_pbr_material);
gltfCtrlTextureScaleV->setEnabled(show_texture_info && has_pbr_capabilities && has_pbr_material);
gltfCtrlTextureRotation->setEnabled(show_texture_info && has_pbr_capabilities && has_pbr_material);
gltfCtrlTextureOffsetU->setEnabled(show_texture_info && has_pbr_capabilities && has_pbr_material);
gltfCtrlTextureOffsetV->setEnabled(show_texture_info && has_pbr_capabilities && has_pbr_material);
gltfCtrlTextureScaleU->setEnabled(new_state);
gltfCtrlTextureScaleV->setEnabled(new_state);
gltfCtrlTextureRotation->setEnabled(new_state);
gltfCtrlTextureOffsetU->setEnabled(new_state);
gltfCtrlTextureOffsetV->setEnabled(new_state);
// Control values are set in setMaterialOverridesFromSelection
// Control values will be set once per frame in
// setMaterialOverridesFromSelection
sMaterialOverrideSelection.setDirty();
}
}
@ -2821,7 +2824,6 @@ void LLPanelFace::onCommitPbrType(LLUICtrl* ctrl, void* userdata)
// and generally reflecting old state when switching tabs or objects
//
self->updateUI();
self->setMaterialOverridesFromSelection();
}
// static
@ -4768,17 +4770,7 @@ void LLPanelFace::Selection::connect()
bool LLPanelFace::Selection::update()
{
const bool selection_changed = compareSelection();
if (selection_changed)
{
clearObjectUpdatePending();
}
else if (isObjectUpdatePending())
{
return false;
}
const bool changed = mChanged;
const bool changed = mChanged || compareSelection();
mChanged = false;
return changed;
}
@ -4794,16 +4786,9 @@ void LLPanelFace::Selection::onSelectedObjectUpdated(const LLUUID& object_id, S3
if (object_id == mSelectedObjectID && side == mSelectedSide)
{
mChanged = true;
clearObjectUpdatePending();
}
}
void LLPanelFace::Selection::clearObjectUpdatePending()
{
mPendingObjectID = LLUUID::null;
mPendingSide = -1;
}
bool LLPanelFace::Selection::compareSelection()
{
if (!mNeedsSelectionCheck)

View File

@ -484,15 +484,13 @@ private:
// updated. Necessary to prevent controls updating when the mouse is
// held down.
void setObjectUpdatePending(const LLUUID &object_id, S32 side);
void setDirty() { mChanged = true; };
// Callbacks
void onSelectionChanged() { mNeedsSelectionCheck = true; }
void onSelectedObjectUpdated(const LLUUID &object_id, S32 side);
protected:
void clearObjectUpdatePending();
bool isObjectUpdatePending() { return mPendingSide != -1; }
bool compareSelection();
bool mChanged = false;