Skip to content

Commit

Permalink
#5231: Remove idle callback from SelectionSystem for the moment being
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Aug 21, 2020
1 parent 542c262 commit bead95c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 36 deletions.
35 changes: 6 additions & 29 deletions radiantcore/selection/RadiantSelectionSystem.cpp
Expand Up @@ -33,7 +33,6 @@ namespace selection
// --------- RadiantSelectionSystem Implementation ------------------------------------------

RadiantSelectionSystem::RadiantSelectionSystem() :
_requestSceneGraphChange(false),
_requestWorkZoneRecalculation(true),
_defaultManipulatorType(Manipulator::Drag),
_mode(ePrimitive),
Expand Down Expand Up @@ -349,12 +348,8 @@ void RadiantSelectionSystem::onSelectedChanged(const scene::INodePtr& node, cons
// Check if the number of selected primitives in the list matches the value of the selection counter
ASSERT_MESSAGE(_selection.size() == _countPrimitive, "selection-tracking error");

// Schedule an idle callback
requestIdleCallback();

_requestWorkZoneRecalculation = true;
_requestSceneGraphChange = true;


// When everything is deselected, release the pivot user lock
if (_selection.empty())
{
Expand Down Expand Up @@ -390,11 +385,7 @@ void RadiantSelectionSystem::onComponentSelection(const scene::INodePtr& node, c
// Check if the number of selected components in the list matches the value of the selection counter
ASSERT_MESSAGE(_componentSelection.size() == _countComponent, "component selection-tracking error");

// Schedule an idle callback
requestIdleCallback();

_requestWorkZoneRecalculation = true;
_requestSceneGraphChange = true;

if (_componentSelection.empty())
{
Expand Down Expand Up @@ -873,7 +864,6 @@ void RadiantSelectionSystem::onManipulationStart()
void RadiantSelectionSystem::onManipulationChanged()
{
_requestWorkZoneRecalculation = true;
_requestSceneGraphChange = false;

GlobalSceneGraph().sceneChanged();
}
Expand All @@ -884,9 +874,8 @@ void RadiantSelectionSystem::onManipulationEnd()

_pivot.endOperation();

// The selection bounds have possibly changed, request an idle callback
// The selection bounds have possibly changed
_requestWorkZoneRecalculation = true;
_requestSceneGraphChange = true;

const selection::ManipulatorPtr& activeManipulator = getActiveManipulator();
assert(activeManipulator);
Expand All @@ -905,7 +894,7 @@ void RadiantSelectionSystem::onManipulationEnd()
pivotChanged();
activeManipulator->setSelected(false);

requestIdleCallback();
GlobalSceneGraph().sceneChanged();
}

void RadiantSelectionSystem::onManipulationCancelled()
Expand Down Expand Up @@ -1081,9 +1070,9 @@ void RadiantSelectionSystem::initialiseModule(const ApplicationContext& ctx)
// Add manipulators
registerManipulator(std::make_shared<DragManipulator>(_pivot));
registerManipulator(std::make_shared<ClipManipulator>());
registerManipulator(std::make_shared<TranslateManipulator>(_pivot, 2, 64));
registerManipulator(std::make_shared<ScaleManipulator>(_pivot, 0, 64));
registerManipulator(std::make_shared<RotateManipulator>(_pivot, 8, 64));
registerManipulator(std::make_shared<TranslateManipulator>(_pivot, 2, 64.0f));
registerManipulator(std::make_shared<ScaleManipulator>(_pivot, 0, 64.0f));
registerManipulator(std::make_shared<RotateManipulator>(_pivot, 8, 64.0f));
registerManipulator(std::make_shared<ModelScaleManipulator>(_pivot));

_defaultManipulatorType = Manipulator::Drag;
Expand Down Expand Up @@ -1174,18 +1163,6 @@ void RadiantSelectionSystem::checkComponentModeSelectionMode(const ISelectable&
}
}

void RadiantSelectionSystem::onIdle()
{
// System is idle
// Check if we should notify the scenegraph
if (_requestSceneGraphChange)
{
_requestSceneGraphChange = false;

GlobalSceneGraph().sceneChanged();
}
}

std::size_t RadiantSelectionSystem::getManipulatorIdForType(Manipulator::Type type)
{
for (const Manipulators::value_type& pair : _manipulators)
Expand Down
8 changes: 1 addition & 7 deletions radiantcore/selection/RadiantSelectionSystem.h
Expand Up @@ -10,7 +10,6 @@

#include "selectionlib.h"
#include "math/Matrix4.h"
#include "wxutil/event/SingleIdleCallback.h"
#include "SelectedNodeList.h"

#include "ManipulationPivot.h"
Expand All @@ -20,8 +19,7 @@ namespace selection

class RadiantSelectionSystem :
public SelectionSystem,
public Renderable,
protected wxutil::SingleIdleCallback
public Renderable
{
ManipulationPivot _pivot;

Expand All @@ -34,7 +32,6 @@ class RadiantSelectionSystem :
// When this is set to TRUE, the idle callback will emit a scenegraph change call
// This is to avoid massive calls to GlobalSceneGraph().sceneChanged() on each
// and every selection change.
mutable bool _requestSceneGraphChange;
mutable bool _requestWorkZoneRecalculation;

// A simple set that gets filled after the SelectableSortedSet is populated.
Expand Down Expand Up @@ -171,9 +168,6 @@ class RadiantSelectionSystem :
virtual void shutdownModule() override;

protected:
// Called when the app is idle to recalculate the workzone (if necessary)
virtual void onIdle() override;

// Traverses the scene and adds any selectable nodes matching the given SelectionTest to the "targetList".
void testSelectScene(SelectablesList& targetList, SelectionTest& test,
const VolumeTest& view, SelectionSystem::EMode mode,
Expand Down

0 comments on commit bead95c

Please sign in to comment.