Skip to content

Commit

Permalink
#5613: Disable the tree view if we're in merge mode and have more tha…
Browse files Browse the repository at this point in the history
…n one entity selected
  • Loading branch information
codereader committed Oct 20, 2021
1 parent 56190d4 commit e8c2bb7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
35 changes: 30 additions & 5 deletions radiant/ui/einspector/EntityInspector.cpp
Expand Up @@ -734,7 +734,7 @@ void EntityInspector::updateGUIElements()
if (!_entitySelection->empty())
{
_editorFrame->Enable(entityCanBeUpdated);
_keyValueTreeView->Enable(true);
//_keyValueTreeView->Enable(true);
//_showInheritedCheckbox->Enable(true);
_showHelpColumnCheckbox->Enable(true);
_keyEntry->Enable(entityCanBeUpdated);
Expand Down Expand Up @@ -769,18 +769,45 @@ void EntityInspector::updateGUIElements()

// Disable the dialog and clear the TreeView
_editorFrame->Enable(false);
_keyValueTreeView->Enable(true); // leave the treeview enabled
//_keyValueTreeView->Enable(true); // leave the treeview enabled
_showInheritedCheckbox->Enable(false);
_showHelpColumnCheckbox->Enable(false);
}
}

void EntityInspector::updatePrimitiveNumber()
{
if (GlobalMapModule().getEditMode() == IMap::EditMode::Merge && _entitySelection->size() > 1)
{
_primitiveNumLabel->SetLabelText(_("No multi-selection in merge mode"));
return;
}

_primitiveNumLabel->SetLabelText("");
}

void EntityInspector::onIdle()
{
if (_selectionNeedsUpdate)
{
_selectionNeedsUpdate = false;
_entitySelection->update();

// Clear the merge info
_mergeActions.clear();
_conflictActions.clear();

bool mergeMode = GlobalMapModule().getEditMode() == IMap::EditMode::Merge;

// Disable the tree view if we're in merge mode and multiple entities are selected
_keyValueTreeView->Enable(!mergeMode || _entitySelection->size() == 1);

if (mergeMode && _entitySelection->size() == 1)
{
handleMergeActions(_entitySelection->getSingleSelectedEntity());
}

updatePrimitiveNumber();
}

if (_inheritedPropertiesNeedUpdate)
Expand Down Expand Up @@ -1739,9 +1766,7 @@ void EntityInspector::handleKeyValueMergeAction(const scene::merge::IEntityKeyVa

void EntityInspector::handleMergeActions(const scene::INodePtr& selectedNode)
{
// Any possible merge actions go in first
if (GlobalMapModule().getEditMode() != IMap::EditMode::Merge || !selectedNode ||
selectedNode->getNodeType() != scene::INode::Type::MergeAction)
if (!selectedNode || selectedNode->getNodeType() != scene::INode::Type::MergeAction)
{
return;
}
Expand Down
1 change: 1 addition & 0 deletions radiant/ui/einspector/EntityInspector.h
Expand Up @@ -222,6 +222,7 @@ class EntityInspector final :
void updateHelpTextPanel();
void updateHelpText(const wxutil::TreeModel::Row& row);
void setHelpText(const std::string& newText);
void updatePrimitiveNumber();
static std::string cleanInputString( const std::string& );

// Add and remove inherited properties from the entity class
Expand Down

0 comments on commit e8c2bb7

Please sign in to comment.