Skip to content

Commit

Permalink
#6037: MaterialEditor should operate on decl names, not the visible p…
Browse files Browse the repository at this point in the history
…aths used in the MaterialTreeView.
  • Loading branch information
codereader committed Aug 5, 2022
1 parent a6f2dd6 commit 0e164c4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions radiant/ui/materials/editor/MaterialEditor.cpp
Expand Up @@ -209,7 +209,7 @@ int MaterialEditor::ShowModal()

if (!_materialToPreselect.empty())
{
_treeView->SetSelectedFullname(_materialToPreselect);
_treeView->SetSelectedDeclName(_materialToPreselect);
}

int returnCode = DialogBase::ShowModal();
Expand Down Expand Up @@ -1500,7 +1500,7 @@ void MaterialEditor::handleMaterialSelectionChange()
// Update the preview if a texture is selected
if (_selectedMaterialItem.IsOk() && !_treeView->IsDirectorySelected())
{
_material = GlobalMaterialManager().getMaterial(_treeView->GetSelectedFullname());
_material = GlobalMaterialManager().getMaterial(_treeView->GetSelectedDeclName());

_materialChanged = _material->sig_materialChanged().connect([this]()
{
Expand All @@ -1523,7 +1523,7 @@ void MaterialEditor::_onMaterialNameChanged(wxCommandEvent& ev)
auto nameEntry = static_cast<wxTextCtrl*>(ev.GetEventObject());

GlobalMaterialManager().renameMaterial(_material->getName(), nameEntry->GetValue().ToStdString());
auto item = _treeView->GetTreeModel()->FindString(_material->getName(), _treeView->Columns().fullName);
auto item = _treeView->GetTreeModel()->FindString(_material->getName(), _treeView->Columns().declName);
_treeView->EnsureVisible(item);

updateMaterialPropertiesFromMaterial();
Expand Down Expand Up @@ -1559,7 +1559,7 @@ void MaterialEditor::selectMaterial(const MaterialPtr& material)
return;
}

auto newItem = _treeView->GetTreeModel()->FindString(material->getName(), _treeView->Columns().fullName);
auto newItem = _treeView->GetTreeModel()->FindString(material->getName(), _treeView->Columns().declName);

if (newItem.IsOk())
{
Expand Down Expand Up @@ -2707,7 +2707,7 @@ void MaterialEditor::updateMaterialTreeItem()
if (!_material) return;

const auto& columns = _treeView->Columns();
auto item = _treeView->GetTreeModel()->FindString(_material->getName(), columns.fullName);
auto item = _treeView->GetTreeModel()->FindString(_material->getName(), columns.declName);

if (!item.IsOk())
{
Expand Down

0 comments on commit 0e164c4

Please sign in to comment.