Skip to content

Commit

Permalink
#5621: EntityInspector will show the editor_usage string when the "cl…
Browse files Browse the repository at this point in the history
…assname" key is selected
  • Loading branch information
codereader committed Jun 8, 2021
1 parent 89324b3 commit 7948dad
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions radiant/ui/einspector/EntityInspector.cpp
Expand Up @@ -18,6 +18,7 @@
#include "selectionlib.h"
#include "scene/SelectionIndex.h"
#include "scenelib.h"
#include "eclass.h"
#include "wxutil/dialog/MessageBox.h"
#include "wxutil/menu/IconTextMenuItem.h"
#include "wxutil/dataview/TreeModel.h"
Expand Down Expand Up @@ -294,7 +295,7 @@ void EntityInspector::onKeyChange(const std::string& key,
row[_columns.booleanValue] = style;

row[_columns.isInherited] = false;
row[_columns.hasHelpText] = hasDescription;
row[_columns.hasHelpText] = key == "classname" || hasDescription; // classname always has a description

if (added)
{
Expand Down Expand Up @@ -1102,16 +1103,23 @@ void EntityInspector::updateHelpText(const wxutil::TreeModel::Row& row)
// Get the key pointed at
bool hasHelp = row[_columns.hasHelpText].getBool();

if (hasHelp)
{
std::string key = getSelectedKey();
if (!hasHelp) return;

std::string key = getSelectedKey();

assert(!_selectedEntity.expired());
Entity* selectedEntity = Node_getEntity(_selectedEntity.lock());
assert(!_selectedEntity.expired());
auto* selectedEntity = Node_getEntity(_selectedEntity.lock());

IEntityClassConstPtr eclass = selectedEntity->getEntityClass();
assert(eclass != NULL);
auto eclass = selectedEntity->getEntityClass();
assert(eclass);

if (key == "classname")
{
// #5621: Show the editor_usage string when the classname is selected
_helpText->SetValue(eclass::getUsage(*eclass));
}
else
{
// Find the attribute on the eclass, that's where the descriptions are defined
const EntityClassAttribute& attr = eclass->getAttribute(key);

Expand Down

0 comments on commit 7948dad

Please sign in to comment.