Skip to content

Commit

Permalink
#4791: Implement resource path selection for the ModelTreeView.
Browse files Browse the repository at this point in the history
Since it is storing the skin paths and model paths in separate columns we need to override the base logic.
  • Loading branch information
codereader committed Jan 30, 2021
1 parent f48acb9 commit c96c140
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions radiant/ui/modelselector/ModelTreeView.cpp
Expand Up @@ -27,6 +27,11 @@ const ModelTreeView::TreeColumns& ModelTreeView::Columns() const
return _treeColumns;
}

std::string ModelTreeView::GetResourcePath(const wxutil::TreeModel::Row& row)
{
return row[Columns().isSkin].getBool() ? row[Columns().skin] : row[Columns().modelPath];
}

void ModelTreeView::Populate()
{
ResourceTreeView::Populate(std::make_shared<ModelPopulator>(Columns()));
Expand Down
6 changes: 5 additions & 1 deletion radiant/ui/modelselector/ModelTreeView.h
Expand Up @@ -5,7 +5,7 @@
namespace ui
{

class ModelTreeView :
class ModelTreeView final :
public wxutil::ResourceTreeView
{
public:
Expand Down Expand Up @@ -52,6 +52,10 @@ class ModelTreeView :

const TreeColumns& Columns() const;

// Override the resource path locator of the base class since we store
// skin paths and model paths in different columns
std::string GetResourcePath(const wxutil::TreeModel::Row& row) override;

private:
std::string GetColumnValue(const wxutil::TreeModel::Column& column);
};
Expand Down

0 comments on commit c96c140

Please sign in to comment.