Skip to content

Commit

Permalink
#6199: ModelSelector actively connects the MaterialsList toggle event…
Browse files Browse the repository at this point in the history
… to the scene::INode in the ModelPreview to trigger a refresh of its renderable geometry
  • Loading branch information
codereader committed Dec 26, 2022
1 parent 87b521f commit ca2c5e1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion radiant/ui/modelselector/ModelSelector.cpp
Expand Up @@ -126,7 +126,7 @@ void ModelSelector::setupAdvancedPanel(wxWindow* parent)

// Refresh preview when material visibility changed
_materialsList->signal_visibilityChanged().connect(
sigc::mem_fun(*_modelPreview, &wxutil::ModelPreview::queueDraw)
sigc::mem_fun(*this, &ModelSelector::onMaterialVisibilityStatusChanged)
);

auto entityPage = findNamedPanel(parent, "ModelRelatedEntitiesPanel");
Expand Down Expand Up @@ -173,6 +173,17 @@ void ModelSelector::onShowClassDefinition()
view->Destroy();
}

void ModelSelector::onMaterialVisibilityStatusChanged()
{
// Tell the model to refresh its surfaces
if (_modelPreview->getModelNode())
{
_modelPreview->getModelNode()->onFiltersChanged();
}

_modelPreview->queueDraw();
}

void ModelSelector::onRelatedEntitySelectionChange(wxDataViewEvent& ev)
{
// Adjust the model preview to use the same skin
Expand Down
2 changes: 1 addition & 1 deletion radiant/ui/modelselector/ModelSelector.h
Expand Up @@ -153,7 +153,7 @@ class ModelSelector: public wxutil::DialogBase, private wxutil::XmlResourceBased
void onSkinsOrModelsReloaded();

void onModelLoaded(const model::ModelNodePtr& modelNode);

void onMaterialVisibilityStatusChanged();
void onMainFrameShuttingDown();

protected:
Expand Down

0 comments on commit ca2c5e1

Please sign in to comment.