MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / selectArea

Method selectArea

radiantcore/selection/RadiantSelectionSystem.cpp:731–791  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

729}
730
731void RadiantSelectionSystem::selectArea(SelectionTest& test, SelectionSystem::EModifier modifier, bool face)
732{
733 // If we are in replace mode, deselect all the components or previous selections
734 if (modifier == SelectionSystem::eReplace)
735 {
736 if (face)
737 {
738 setSelectedAllComponents(false);
739 }
740 else
741 {
742 deselectAll();
743 }
744 }
745
746 // The posssible candidates go here
747 SelectionPool pool;
748
749 SelectablesList candidates;
750
751 if (face)
752 {
753 ComponentSelector tester(pool, test, ComponentSelectionMode::Face);
754 GlobalSceneGraph().foreachVisibleNodeInVolume(test.getVolume(), [&](const scene::INodePtr& node)
755 {
756 if (nodeCanBeSelectionTested(node))
757 {
758 tester.testNode(node);
759 }
760 return true;
761 });
762
763 // Load them all into the vector
764 for (auto i = pool.begin(); i != pool.end(); ++i)
765 {
766 candidates.push_back(i->second);
767 }
768 }
769 else
770 {
771 testSelectScene(candidates, test, test.getVolume(), getSelectionMode());
772 }
773
774 // Since toggling a selectable might trigger a group-selection
775 // we need to keep track of the desired state of each selectable
776 typedef std::map<ISelectable*, bool> SelectablesMap;
777 SelectablesMap selectableStates;
778
779 for (ISelectable* selectable : candidates)
780 {
781 bool desiredState = !(modifier == SelectionSystem::eToggle && selectable->isSelected());
782 selectableStates.insert(SelectablesMap::value_type(selectable, desiredState));
783 }
784
785 for (const auto& state : selectableStates)
786 {
787 setSelectionStatus(state.first, state.second);
788 }

Callers 3

performSelectionTestMethod · 0.45
performSelectionTestMethod · 0.45
TEST_FFunction · 0.45

Calls 8

value_typeClass · 0.85
testNodeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45
isSelectedMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected