Skip to content

Commit

Permalink
#5231: Remove EventManager dependency from EntityModule
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed May 18, 2020
1 parent e27015b commit 49796a5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 22 deletions.
8 changes: 8 additions & 0 deletions include/ientity.h
Expand Up @@ -327,6 +327,14 @@ enum class LightEditVertexType : std::size_t
NumberOfVertexTypes,
};

const char* const RKEY_SHOW_ENTITY_NAMES("user/ui/xyview/showEntityNames");
const char* const RKEY_SHOW_ALL_SPEAKER_RADII = "user/ui/showAllSpeakerRadii";
const char* const RKEY_SHOW_ALL_LIGHT_RADII = "user/ui/showAllLightRadii";
const char* const RKEY_DRAG_RESIZE_SYMMETRICALLY = "user/ui/dragResizeEntitiesSymmetrically";
const char* const RKEY_ALWAYS_SHOW_LIGHT_VERTICES = "user/ui/alwaysShowLightVertices";
const char* const RKEY_FREE_OBJECT_ROTATION = "user/ui/rotateObjectsIndependently";
const char* const RKEY_SHOW_ENTITY_ANGLES = "user/ui/xyview/showEntityAngles";

/**
* Global entity settings affecting appearance, render options, etc.
*/
Expand Down
12 changes: 1 addition & 11 deletions radiant/entity/EntityModule.cpp
@@ -1,20 +1,14 @@
#include "EntityModule.h"
#include "EntitySettings.h"

#include "itextstream.h"
#include "iundo.h"
#include "imap.h"
#include "iscenegraph.h"
#include "ieventmanager.h"
#include "inamespace.h"
#include "i18n.h"

#include "entitylib.h"
#include "gamelib.h"

#include "string/replace.h"
#include <iostream>

#include "i18n.h"
#include "Doom3Entity.h"

#include "light/LightNode.h"
Expand Down Expand Up @@ -139,10 +133,6 @@ void Doom3EntityModule::initialiseModule(const ApplicationContext& ctx)
rMessage() << getName() << "::initialiseModule called." << std::endl;

LightShader::m_defaultShader = game::current::getValue<std::string>("/defaults/lightShader");

GlobalEventManager().addRegistryToggle("ToggleShowAllLightRadii", RKEY_SHOW_ALL_LIGHT_RADII);
GlobalEventManager().addRegistryToggle("ToggleShowAllSpeakerRadii", RKEY_SHOW_ALL_SPEAKER_RADII);
GlobalEventManager().addRegistryToggle("ToggleDragResizeEntitiesSymmetrically", RKEY_DRAG_RESIZE_SYMMETRICALLY);
}

void Doom3EntityModule::shutdownModule()
Expand Down
11 changes: 0 additions & 11 deletions radiant/entity/EntitySettings.h
Expand Up @@ -8,17 +8,6 @@

namespace entity {

namespace
{
const char* const RKEY_SHOW_ENTITY_NAMES("user/ui/xyview/showEntityNames");
const char* const RKEY_SHOW_ALL_SPEAKER_RADII = "user/ui/showAllSpeakerRadii";
const char* const RKEY_SHOW_ALL_LIGHT_RADII = "user/ui/showAllLightRadii";
const char* const RKEY_DRAG_RESIZE_SYMMETRICALLY = "user/ui/dragResizeEntitiesSymmetrically";
const char* const RKEY_ALWAYS_SHOW_LIGHT_VERTICES = "user/ui/alwaysShowLightVertices";
const char* const RKEY_FREE_OBJECT_ROTATION = "user/ui/rotateObjectsIndependently";
const char* const RKEY_SHOW_ENTITY_ANGLES = "user/ui/xyview/showEntityAngles";
}

class EntitySettings;
typedef std::shared_ptr<EntitySettings> EntitySettingsPtr;

Expand Down
5 changes: 5 additions & 0 deletions radiant/ui/UserInterfaceModule.cpp
Expand Up @@ -71,6 +71,7 @@ const StringSet& UserInterfaceModule::getDependencies() const
_dependencies.insert(MODULE_UIMANAGER);
_dependencies.insert(MODULE_FILTERSYSTEM);
_dependencies.insert(MODULE_ENTITY);
_dependencies.insert(MODULE_EVENTMANAGER);
}

return _dependencies;
Expand Down Expand Up @@ -156,6 +157,10 @@ void UserInterfaceModule::initialiseEntitySettings()
_coloursUpdatedConn = ColourSchemeEditor::signal_ColoursChanged().connect(
sigc::mem_fun(this, &UserInterfaceModule::applyEntityVertexColours)
);

GlobalEventManager().addRegistryToggle("ToggleShowAllLightRadii", RKEY_SHOW_ALL_LIGHT_RADII);
GlobalEventManager().addRegistryToggle("ToggleShowAllSpeakerRadii", RKEY_SHOW_ALL_SPEAKER_RADII);
GlobalEventManager().addRegistryToggle("ToggleDragResizeEntitiesSymmetrically", RKEY_DRAG_RESIZE_SYMMETRICALLY);
}

void UserInterfaceModule::applyEntityVertexColours()
Expand Down

0 comments on commit 49796a5

Please sign in to comment.