Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/ui/iusercontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ struct UserControl
constexpr static const char* AasVisualisationPanel = "AasVisualisationPanel";
constexpr static const char* OrthoBackgroundPanel = "OrthoBackgroundPanel";
constexpr static const char* DecalShooter = "DecalShooter";
constexpr static const char* SelectionGroupPanel = "SelectionGroupPanel";
};

}
35 changes: 35 additions & 0 deletions libs/scene/Group.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,39 @@ inline void ungroupSelected()
SceneChangeNotify();
}

/**
* Dissolve all group memberships of the currently selected nodes,
* removing every nested group level at once.
* Will throw cmd::ExecutionNotPossible if it cannot execute.
*/
inline void ungroupSelectedRecursively()
{
checkUngroupSelectedAvailable();

UndoableCommand cmd("UngroupSelectedRecursively");

std::set<std::size_t> ids;

GlobalSelectionSystem().foreachSelected([&](const scene::INodePtr& node)
{
std::shared_ptr<IGroupSelectable> selectable = std::dynamic_pointer_cast<IGroupSelectable>(node);

if (!selectable) return;

for (std::size_t id : selectable->getGroupIds())
{
ids.insert(id);
}
});

auto& selGroupMgr = detail::getMapSelectionGroupManager();

std::for_each(ids.begin(), ids.end(), [&](std::size_t id)
{
selGroupMgr.deleteSelectionGroup(id);
});

SceneChangeNotify();
}

}
1 change: 1 addition & 0 deletions radiant/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ add_executable(darkradiant
ui/terrain/TerrainGeneratorDialog.cpp
ui/script/ScriptMenu.cpp
ui/script/ScriptWindow.cpp
ui/selectiongroup/SelectionGroupPanel.cpp
ui/selectionset/SelectionSetToolmenu.cpp
ui/skin/SkinEditor.cpp
ui/skin/SkinEditorTreeView.cpp
Expand Down
11 changes: 11 additions & 0 deletions radiant/ui/UserInterfaceModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
#include "lightinspector/LightInspectorControl.h"
#include "decalshooter/DecalShooterControl.h"
#include "overlay/OrthoBackgroundControl.h"
#include "selectiongroup/SelectionGroupControl.h"
#include "patch/PatchInspectorControl.h"
#include "surfaceinspector/SurfaceInspectorControl.h"
#include "textool/TextureToolControl.h"
Expand Down Expand Up @@ -206,6 +207,12 @@ void UserInterfaceModule::initialiseModule(const IApplicationContext& ctx)
[]() { return cmd::ExecutionNotPossible::ToBool(selection::checkUngroupSelectedAvailable); }),
IOrthoContextMenu::SECTION_SELECTION_GROUPS);

GlobalOrthoContextMenu().addItem(std::make_shared<wxutil::MenuItem>(
new wxutil::IconTextMenuItem(_("Ungroup Selection Recursively"), "ungroup_selection.png"),
[]() { selection::ungroupSelectedRecursively(); },
[]() { return cmd::ExecutionNotPossible::ToBool(selection::checkUngroupSelectedAvailable); }),
IOrthoContextMenu::SECTION_SELECTION_GROUPS);

_longOperationHandler.reset(new LongRunningOperationHandler);
_mapFileProgressHandler.reset(new MapFileProgressHandler);
_autoSaveRequestHandler.reset(new AutoSaveRequestHandler);
Expand Down Expand Up @@ -270,6 +277,7 @@ void UserInterfaceModule::initialiseModule(const IApplicationContext& ctx)
registerControl(std::make_shared<FindShaderControl>());
registerControl(std::make_shared<OrthoBackgroundControl>());
registerControl(std::make_shared<DecalShooterControl>());
registerControl(std::make_shared<SelectionGroupControl>());

GlobalMainFrame().signal_MainFrameConstructed().connect([&]()
{
Expand Down Expand Up @@ -311,6 +319,9 @@ void UserInterfaceModule::initialiseModule(const IApplicationContext& ctx)
GlobalMainFrame().addControl(
UserControl::DecalShooter, ControlSettings::floating(300, 200)
);
GlobalMainFrame().addControl(
UserControl::SelectionGroupPanel, ControlSettings::floating(300, 400)
);

_viewMenu = std::make_unique<ViewMenu>();
});
Expand Down
35 changes: 35 additions & 0 deletions radiant/ui/selectiongroup/SelectionGroupControl.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#pragma once

#include "i18n.h"
#include "ui/iusercontrol.h"
#include "SelectionGroupPanel.h"

namespace ui
{

class SelectionGroupControl :
public IUserControlCreator
{
public:
std::string getControlName() override
{
return UserControl::SelectionGroupPanel;
}

std::string getDisplayName() override
{
return _("Selection Groups");
}

std::string getIcon() override
{
return "group_selection.png";
}

wxWindow* createWidget(wxWindow* parent) override
{
return new SelectionGroupPanel(parent);
}
};

}
Loading