void Doom3MapCompiler::initialiseModule(const ApplicationContext& ctx)
{
	rMessage() << getName() << ": initialiseModule called." << std::endl;

	GlobalCommandSystem().addCommand("dmap", boost::bind(&Doom3MapCompiler::dmapCmd, this, _1), cmd::ARGTYPE_STRING);
	GlobalCommandSystem().addCommand("setDmapRenderOption", boost::bind(&Doom3MapCompiler::setDmapRenderOption, this, _1), cmd::ARGTYPE_INT);
}
Пример #2
0
void Brush_registerCommands()
{
	GlobalEventManager().addRegistryToggle("TogTexLock", RKEY_ENABLE_TEXTURE_LOCK);

	GlobalCommandSystem().addCommand("BrushMakePrefab", brushMakePrefab, cmd::ARGTYPE_INT);

	GlobalEventManager().addCommand("BrushCuboid", "BrushCuboid");
	GlobalEventManager().addCommand("BrushPrism", "BrushPrism");
	GlobalEventManager().addCommand("BrushCone", "BrushCone");
	GlobalEventManager().addCommand("BrushSphere", "BrushSphere");

	GlobalCommandSystem().addCommand("BrushMakeSided", brushMakeSided, cmd::ARGTYPE_INT);

	// Link the Events to the corresponding statements
	GlobalEventManager().addCommand("Brush3Sided", "Brush3Sided");
	GlobalEventManager().addCommand("Brush4Sided", "Brush4Sided");
	GlobalEventManager().addCommand("Brush5Sided", "Brush5Sided");
	GlobalEventManager().addCommand("Brush6Sided", "Brush6Sided");
	GlobalEventManager().addCommand("Brush7Sided", "Brush7Sided");
	GlobalEventManager().addCommand("Brush8Sided", "Brush8Sided");
	GlobalEventManager().addCommand("Brush9Sided", "Brush9Sided");

	GlobalCommandSystem().addCommand("TextureNatural", selection::algorithm::naturalTexture);
	GlobalCommandSystem().addCommand("MakeVisportal", selection::algorithm::makeVisportal);
	GlobalCommandSystem().addCommand("SurroundWithMonsterclip", selection::algorithm::surroundWithMonsterclip);
	GlobalEventManager().addCommand("TextureNatural", "TextureNatural");
	GlobalEventManager().addCommand("MakeVisportal", "MakeVisportal");
	GlobalEventManager().addCommand("SurroundWithMonsterclip", "SurroundWithMonsterclip");
}
Пример #3
0
void Clipper::initialiseModule(const ApplicationContext& ctx)
{
	rMessage() << "Clipper::initialiseModule called\n";

	_useCaulk = registry::getValue<bool>(RKEY_CLIPPER_USE_CAULK);
	_caulkShader = GlobalRegistry().get(RKEY_CLIPPER_CAULK_SHADER);

	GlobalRegistry().signalForKey(RKEY_CLIPPER_USE_CAULK).connect(
        sigc::mem_fun(this, &Clipper::keyChanged)
    );
	GlobalRegistry().signalForKey(RKEY_CLIPPER_CAULK_SHADER).connect(
        sigc::mem_fun(this, &Clipper::keyChanged)
    );

	constructPreferences();

	// Register the clip commands
	GlobalCommandSystem().addCommand("ClipSelected", boost::bind(&Clipper::clipSelectionCmd, this, _1));
	GlobalCommandSystem().addCommand("SplitSelected", boost::bind(&Clipper::splitSelectedCmd, this, _1));
	GlobalCommandSystem().addCommand("FlipClip", boost::bind(&Clipper::flipClipperCmd, this, _1));

	// Connect some events to these commands
	GlobalEventManager().addCommand("ClipSelected", "ClipSelected");
	GlobalEventManager().addCommand("SplitSelected", "SplitSelected");
	GlobalEventManager().addCommand("FlipClip", "FlipClip");
}
Пример #4
0
void registerCommands()
{
	GlobalCommandSystem().addCommand("CSGSubtract", subtractBrushesFromUnselected);
	GlobalCommandSystem().addCommand("CSGMerge", mergeSelectedBrushes);
	GlobalCommandSystem().addCommand("CSGHollow", hollowSelectedBrushes);
	GlobalCommandSystem().addCommand("CSGRoom", makeRoomForSelectedBrushes);

	GlobalEventManager().addCommand("CSGSubtract", "CSGSubtract");
	GlobalEventManager().addCommand("CSGMerge", "CSGMerge");
	GlobalEventManager().addCommand("CSGHollow", "CSGHollow");
	GlobalEventManager().addCommand("CSGRoom", "CSGRoom");
}
Пример #5
0
void registerCommands()
{
    GlobalCommandSystem().addCommand("ConnectSelection", selection::algorithm::connectSelectedEntities);
    GlobalCommandSystem().addCommand("BindSelection", selection::algorithm::bindEntities);
    GlobalCommandSystem().addCommand("CreateCurveNURBS", entity::createCurveNURBS);
    GlobalCommandSystem().addCommand("CreateCurveCatmullRom", entity::createCurveCatmullRom);

    GlobalEventManager().addCommand("ConnectSelection", "ConnectSelection");
    GlobalEventManager().addCommand("BindSelection", "BindSelection");
    GlobalEventManager().addRegistryToggle("ToggleFreeModelRotation", RKEY_FREE_MODEL_ROTATION);
    GlobalEventManager().addCommand("CreateCurveNURBS", "CreateCurveNURBS");
    GlobalEventManager().addCommand("CreateCurveCatmullRom", "CreateCurveCatmullRom");
}
Пример #6
0
void ModelCache::initialiseModule(const ApplicationContext& ctx) {
	rMessage() << "ModelCache::initialiseModule called.\n";

	GlobalCommandSystem().addCommand(
		"RefreshModels",
		boost::bind(&ModelCache::refreshModels, this, _1)
	);
	GlobalCommandSystem().addCommand(
		"RefreshSelectedModels",
		boost::bind(&ModelCache::refreshSelectedModels, this, _1)
	);
	GlobalEventManager().addCommand("RefreshModels", "RefreshModels");
	GlobalEventManager().addCommand("RefreshSelectedModels", "RefreshSelectedModels");
}
Пример #7
0
Console::~Console()
{
	// TODO - there might be more than one console instance handle this
	GlobalCommandSystem().removeCommand("clear");

	applog::LogWriter::Instance().detach(this);
}
Пример #8
0
	virtual void initialiseModule(const ApplicationContext& ctx)
	{
		rMessage() << getName() << "::initialiseModule called." << std::endl;

		// Associated "def_head" with an empty property editor instance
		GlobalEntityInspector().registerPropertyEditor(
			ui::DEF_HEAD_KEY, ui::IPropertyEditorPtr(new ui::AIHeadPropertyEditor())
		);

		GlobalEntityInspector().registerPropertyEditor(
			ui::DEF_VOCAL_SET_KEY, ui::IPropertyEditorPtr(new ui::AIVocalSetPropertyEditor())
		);

		GlobalCommandSystem().addCommand("FixupMapDialog", ui::FixupMapDialog::RunDialog);
		GlobalEventManager().addCommand("FixupMapDialog", "FixupMapDialog");

		GlobalUIManager().getMenuManager().add("main/map",
			"FixupMapDialog", ui::menuItem,
			_("Fixup Map..."), // caption
			"", // icon
			"FixupMapDialog"
		);

		GlobalRadiant().signal_radiantStarted().connect(
			sigc::ptr_fun(ui::AIEditingPanel::onRadiantStartup)
		);	
	}
Пример #9
0
void UIManager::initialiseModule(const ApplicationContext& ctx)
{
	rMessage() << "UIManager::initialiseModule called" << std::endl;

	_dialogManager = DialogManagerPtr(new DialogManager);

	_menuManager.loadFromRegistry();
	_toolbarManager.initialise();
	ColourSchemeManager::Instance().loadColourSchemes();

	GlobalCommandSystem().addCommand("EditColourScheme", ColourSchemeEditor::editColourSchemes);
	GlobalEventManager().addCommand("EditColourScheme", "EditColourScheme");

	GlobalRadiant().signal_radiantShutdown().connect(
        sigc::mem_fun(this, &UIManager::clear)
    );

	// Add the statusbar command text item
	_statusBarManager.addTextElement(
		STATUSBAR_COMMAND,
		"",  // no icon
		IStatusBarManager::POS_COMMAND
	);

    addLocalBitmapsAsIconFactory();
}
Пример #10
0
MRU::MRU() :
	_numMaxFiles(registry::getValue<int>(RKEY_MRU_LENGTH)),
	_loadLastMap(registry::getValue<bool>(RKEY_LOAD_LAST_MAP)),
	_list(_numMaxFiles),
	_emptyMenuItem(_(RECENT_FILES_CAPTION), *this, 0)
{
	GlobalRegistry().signalForKey(RKEY_MRU_LENGTH).connect(
        sigc::mem_fun(this, &MRU::keyChanged)
    );

	// Add the preference settings
	constructPreferences();

	// Create _numMaxFiles menu items
	for (std::size_t i = 0; i < _numMaxFiles; i++) {

		_menuItems.push_back(MRUMenuItem(string::to_string(i), *this, i+1));

		MRUMenuItem& item = (*_menuItems.rbegin());

		const std::string commandName = std::string("MRUOpen") + string::to_string(i+1);

		// Connect the command to the last inserted menuItem
		GlobalCommandSystem().addCommand(
			commandName,
			std::bind(&MRUMenuItem::activate, &item, std::placeholders::_1)
		);
		GlobalEventManager().addCommand(commandName, commandName);
	}
}
Пример #11
0
void MediaBrowser::registerCommandsAndPreferences()
{
	// Add a page to the given group
	PreferencesPagePtr page = GlobalPreferenceSystem().getPage(_("Settings/Media Browser"));
	page->appendCheckBox("", _("Load media tree at startup"), RKEY_MEDIA_BROWSER_PRELOAD);

	GlobalCommandSystem().addCommand("ToggleMediaBrowser", toggle);
	GlobalEventManager().addCommand("ToggleMediaBrowser", "ToggleMediaBrowser");
}
Пример #12
0
void EClassManager::initialiseModule(const ApplicationContext& ctx)
{
	rMessage() << "EntityClassDoom3::initialiseModule called." << std::endl;

	GlobalFileSystem().addObserver(*this);
	realise();

	GlobalCommandSystem().addCommand("ReloadDefs", boost::bind(&EClassManager::reloadDefsCmd, this, _1));
	GlobalEventManager().addCommand("ReloadDefs", "ReloadDefs");
}
Пример #13
0
void ParticlesManager::initialiseModule(const ApplicationContext& ctx)
{
	rMessage() << "ParticlesManager::initialiseModule called" << std::endl;

	// Load the .prt files
	reloadParticleDefs();

	// Register the "ReloadParticles" commands
	GlobalCommandSystem().addCommand("ReloadParticles", boost::bind(&ParticlesManager::reloadParticleDefs, this));
	GlobalEventManager().addCommand("ReloadParticles", "ReloadParticles");
}
Пример #14
0
LayerCommandTarget::LayerCommandTarget(int layerID) :
	_layerID(layerID)
{
	GlobalCommandSystem().addCommand(
		COMMAND_PREFIX_ADDTOLAYER + string::to_string(_layerID),
		std::bind(&LayerCommandTarget::addSelectionToLayer, this, std::placeholders::_1)
	);
	GlobalEventManager().addCommand(
		COMMAND_PREFIX_ADDTOLAYER + string::to_string(_layerID),
		COMMAND_PREFIX_ADDTOLAYER + string::to_string(_layerID)
	);

	GlobalCommandSystem().addCommand(
		COMMAND_PREFIX_MOVETOLAYER + string::to_string(_layerID),
		std::bind(&LayerCommandTarget::moveSelectionToLayer, this, std::placeholders::_1)
	);
	GlobalEventManager().addCommand(
		COMMAND_PREFIX_MOVETOLAYER + string::to_string(_layerID),
		COMMAND_PREFIX_MOVETOLAYER + string::to_string(_layerID)
	);

	GlobalCommandSystem().addCommand(
		COMMAND_PREFIX_SHOWLAYER + string::to_string(_layerID),
		std::bind(&LayerCommandTarget::showLayer, this, std::placeholders::_1)
	);
	GlobalEventManager().addCommand(
		COMMAND_PREFIX_SHOWLAYER + string::to_string(_layerID),
		COMMAND_PREFIX_SHOWLAYER + string::to_string(_layerID)
	);

	GlobalCommandSystem().addCommand(
		COMMAND_PREFIX_HIDELAYER + string::to_string(_layerID),
		std::bind(&LayerCommandTarget::hideLayer, this, std::placeholders::_1)
	);
	GlobalEventManager().addCommand(
		COMMAND_PREFIX_HIDELAYER + string::to_string(_layerID),
		COMMAND_PREFIX_HIDELAYER + string::to_string(_layerID)
	);
}
Пример #15
0
    virtual void initialiseModule(const ApplicationContext& ctx)
    {
        rMessage() << "UndoSystem::initialiseModule called" << std::endl;

        // Add commands for console input
        GlobalCommandSystem().addCommand("Undo", boost::bind(&RadiantUndoSystem::undoCmd, this, _1));
        GlobalCommandSystem().addCommand("Redo", boost::bind(&RadiantUndoSystem::redoCmd, this, _1));

        // Bind events to commands
        GlobalEventManager().addCommand("Undo", "Undo");
        GlobalEventManager().addCommand("Redo", "Redo");

        _undoLevels = registry::getValue<int>(RKEY_UNDO_QUEUE_SIZE);

        // Add self to the key observers to get notified on change
        GlobalRegistry().signalForKey(RKEY_UNDO_QUEUE_SIZE).connect(
            sigc::mem_fun(this, &RadiantUndoSystem::keyChanged)
        );

        // add the preference settings
        constructPreferences();
    }
Пример #16
0
void Doom3ShaderSystem::initialiseModule(const ApplicationContext& ctx)
{
	rMessage() << getName() << "::initialiseModule called" << std::endl;

	GlobalCommandSystem().addCommand("RefreshShaders", boost::bind(&Doom3ShaderSystem::refreshShadersCmd, this, _1));
	GlobalEventManager().addCommand("RefreshShaders", "RefreshShaders");

	construct();
	realise();

#ifdef _DEBUG
	testShaderExpressionParsing();
#endif
}
Пример #17
0
void SelectionSetManager::initialiseModule(const ApplicationContext& ctx)
{
	rMessage() << getName() << "::initialiseModule called." << std::endl;

	// Register for the startup event
	GlobalRadiant().signal_radiantStarted().connect(
        sigc::mem_fun(this, &SelectionSetManager::onRadiantStartup)
    );

	GlobalCommandSystem().addCommand("DeleteAllSelectionSets",
		boost::bind(&SelectionSetManager::deleteAllSelectionSets, this, _1));

	GlobalEventManager().addCommand("DeleteAllSelectionSets", "DeleteAllSelectionSets");
}
void SpacePartitionRenderer::initialiseModule(const ApplicationContext& ctx)
{
    registry::observeBooleanKey(
        RKEY_RENDER_SPACE_PARTITION,
        sigc::mem_fun(this, &SpacePartitionRenderer::installRenderer),
        sigc::mem_fun(this, &SpacePartitionRenderer::uninstallRenderer)
    );

	if (registry::getValue<bool>(RKEY_RENDER_SPACE_PARTITION))
	{
		installRenderer();
	}

	// Add the icon to the toolbar
	GlobalCommandSystem().addCommand("ToggleSpacePartitionRendering", boost::bind(&SpacePartitionRenderer::toggle, this, _1));
}
Пример #19
0
	virtual void initialiseModule(const ApplicationContext& ctx) {
		rMessage() << getName() << "::initialiseModule called.\n";

		// Add the callback event
		GlobalCommandSystem().addCommand("ConversationEditor", ui::ConversationDialog::showDialog);
		GlobalEventManager().addCommand("ConversationEditor", "ConversationEditor");

		// Add the menu item
		IMenuManager& mm = GlobalUIManager().getMenuManager();
		mm.add("main/map", 	// menu location path
				"ConversationEditor", // name
				ui::menuItem,	// type
				_("Conversations..."),	// caption
				"stimresponse.png",	// icon
				"ConversationEditor"); // event name
	}
Пример #20
0
	virtual void initialiseModule(const ApplicationContext& ctx) {
		rMessage() << "StimResponseModule::initialiseModule called.\n";

		// Add the callback event
		GlobalCommandSystem().addCommand("StimResponseEditor", ui::StimResponseEditor::ShowDialog);
		GlobalEventManager().addCommand("StimResponseEditor", "StimResponseEditor");

		// Add the menu item
		IMenuManager& mm = GlobalUIManager().getMenuManager();
		mm.add("main/entity", 	// menu location path
				"StimResponse", // name
				ui::menuItem,	// type
				_("Stim/Response..."),	// caption
				"stimresponse.png",	// icon
				"StimResponseEditor"); // event name
	}
Пример #21
0
	virtual void initialiseModule(const ApplicationContext& ctx) {
		rMessage() << getName() << "::initialiseModule called.\n";

		// Add the callback event
		GlobalCommandSystem().addCommand("EntityClassTree", ui::EClassTree::showWindow);
		GlobalEventManager().addCommand("EntityClassTree", "EntityClassTree");

		// Add the menu item
		IMenuManager& mm = GlobalUIManager().getMenuManager();
		mm.add("main/entity", 	// menu location path
				"EntityClassTree", // name
				ui::menuItem,	// type
				_("Entity Class Tree..."),	// caption
				"icon_classname.png",	// icon
				"EntityClassTree"); // event name
	}
Пример #22
0
void Map::registerCommands()
{
    GlobalCommandSystem().addCommand("NewMap", Map::newMap);
    GlobalCommandSystem().addCommand("OpenMap", Map::openMap);
    GlobalCommandSystem().addCommand("ImportMap", Map::importMap);
    GlobalCommandSystem().addCommand("LoadPrefab", Map::loadPrefab);
    GlobalCommandSystem().addCommand("SaveSelectedAsPrefab", Map::saveSelectedAsPrefab);
    GlobalCommandSystem().addCommand("SaveMap", Map::saveMap);
    GlobalCommandSystem().addCommand("SaveMapAs", Map::saveMapAs);
    GlobalCommandSystem().addCommand("SaveMapCopyAs", Map::saveMapCopyAs);
    GlobalCommandSystem().addCommand("SaveSelected", Map::exportMap);

    GlobalEventManager().addCommand("NewMap", "NewMap");
    GlobalEventManager().addCommand("OpenMap", "OpenMap");
    GlobalEventManager().addCommand("ImportMap", "ImportMap");
    GlobalEventManager().addCommand("LoadPrefab", "LoadPrefab");
    GlobalEventManager().addCommand("SaveSelectedAsPrefab", "SaveSelectedAsPrefab");
    GlobalEventManager().addCommand("SaveMap", "SaveMap");
    GlobalEventManager().addCommand("SaveMapAs", "SaveMapAs");
    GlobalEventManager().addCommand("SaveMapCopyAs", "SaveMapCopyAs");
    GlobalEventManager().addCommand("SaveSelected", "SaveSelected");
}
Пример #23
0
	virtual void initialiseModule(const ApplicationContext& ctx) {
		rMessage() << "ObjectivesEditorModule::initialiseModule called.\n";

		// Add the callback event
		GlobalCommandSystem().addCommand(
			"ObjectivesEditor",
			objectives::ObjectivesEditor::displayDialog
		);
		GlobalEventManager().addCommand("ObjectivesEditor", "ObjectivesEditor");

		// Add the menu item
		IMenuManager& mm = GlobalUIManager().getMenuManager();
		mm.add("main/map",
				"ObjectivesEditor",
				ui::menuItem,
				_("Objectives..."),
				"objectives16.png",
				"ObjectivesEditor");
	}
Пример #24
0
void WaveFrontModule::initialiseModule(const ApplicationContext& ctx)
{
	globalOutputStream() << "WaveFrontModule::initialiseModule called" << std::endl;

	// Register the command
	GlobalCommandSystem().addCommand(
		"ExportSelectedAsOBJ", 
		boost::bind(&WaveFrontModule::exportSelectionAsOBJ, this, _1)
	);

	// Bind the reloadscripts command to the menu
	GlobalEventManager().addCommand("ExportSelectedAsOBJ", "ExportSelectedAsOBJ");

	// Add the menu item
	IMenuManager& mm = GlobalUIManager().getMenuManager();
	mm.insert("main/file/createCM", 	// menu location path
			"ExportSelectedAsOBJ", // name
			ui::menuItem,	// type
			_("Export Selection as OBJ..."),	// caption
			"",	// icon
			"ExportSelectedAsOBJ"); // event name
}
Пример #25
0
Console::Console(wxWindow* parent) :
	wxPanel(parent, wxID_ANY),
	_view(new wxutil::ConsoleView(this)),
	_commandEntry(new CommandEntry(this))
{
	SetSizer(new wxBoxSizer(wxVERTICAL));

	GetSizer()->Add(_view, 1, wxEXPAND);
	GetSizer()->Add(_commandEntry, 0, wxEXPAND);

    GlobalCommandSystem().addCommand("clear",
        std::bind(&Console::clearCmd, this, std::placeholders::_1));

    // Get a lock on the logging system before doing these changes
    std::lock_guard<std::mutex> lock(module::GlobalModuleRegistry().getApplicationContext().getStreamLock());

	// We're ready to catch log output, register ourselves
	applog::LogWriter::Instance().attach(this);

	// Copy the temporary buffers over
	if (applog::StringLogDevice::InstancePtr() != NULL)
	{
		applog::StringLogDevice& logger = *applog::StringLogDevice::InstancePtr();

		for (int level = applog::SYS_VERBOSE;
			 level < applog::SYS_NUM_LOGLEVELS;
			 level++)
		{
            std::string bufferedText = logger.getString(static_cast<applog::ELogLevel>(level));

            if (bufferedText.empty()) continue;

            writeLog(bufferedText + "\n", static_cast<applog::ELogLevel>(level));
		}
	}

	// Destruct the temporary buffer
	applog::StringLogDevice::destroy();
}
Пример #26
0
void UIManager::initialiseModule(const ApplicationContext& ctx)
{
	globalOutputStream() << "UIManager::initialiseModule called" << std::endl;

	_dialogManager = DialogManagerPtr(new DialogManager);

	_menuManager.loadFromRegistry();
	_toolbarManager.initialise();
	ColourSchemeManager::Instance().loadColourSchemes();
	
	GlobalCommandSystem().addCommand("EditColourScheme", ColourSchemeEditor::editColourSchemes);
	GlobalEventManager().addCommand("EditColourScheme", "EditColourScheme");

	_shutdownListener = UIManagerShutdownListenerPtr(new UIManagerShutdownListener(*this));
	GlobalRadiant().addEventListener(_shutdownListener);

	// Add the statusbar command text item
	_statusBarManager.addTextElement(
		STATUSBAR_COMMAND, 
		"",  // no icon
		IStatusBarManager::POS_COMMAND
	);
}
Пример #27
0
void GlobalCameraManager::registerCommands()
{
	GlobalCommandSystem().addCommand("CenterView", boost::bind(&GlobalCameraManager::resetCameraAngles, this, _1));
	GlobalCommandSystem().addCommand("CubicClipZoomIn", boost::bind(&GlobalCameraManager::cubicScaleIn, this, _1));
	GlobalCommandSystem().addCommand("CubicClipZoomOut", boost::bind(&GlobalCameraManager::cubicScaleOut, this, _1));

	GlobalCommandSystem().addCommand("UpFloor", boost::bind(&GlobalCameraManager::changeFloorUp, this, _1));
	GlobalCommandSystem().addCommand("DownFloor", boost::bind(&GlobalCameraManager::changeFloorDown, this, _1));

	// angua: increases and decreases the movement speed of the camera
	GlobalCommandSystem().addCommand("CamIncreaseMoveSpeed", boost::bind(&GlobalCameraManager::increaseCameraSpeed, this, _1));
	GlobalCommandSystem().addCommand("CamDecreaseMoveSpeed", boost::bind(&GlobalCameraManager::decreaseCameraSpeed, this, _1));
	
	GlobalCommandSystem().addCommand("TogglePreview", boost::bind(&GlobalCameraManager::toggleLightingMode, this, _1));
	
	// Insert movement commands
	GlobalCommandSystem().addCommand("CameraForward", boost::bind(&GlobalCameraManager::moveForwardDiscrete, this, _1));
	GlobalCommandSystem().addCommand("CameraBack", boost::bind(&GlobalCameraManager::moveBackDiscrete, this, _1));
	GlobalCommandSystem().addCommand("CameraLeft", boost::bind(&GlobalCameraManager::rotateLeftDiscrete, this, _1));
	GlobalCommandSystem().addCommand("CameraRight", boost::bind(&GlobalCameraManager::rotateRightDiscrete, this, _1));
	GlobalCommandSystem().addCommand("CameraStrafeRight", boost::bind(&GlobalCameraManager::moveRightDiscrete, this, _1));
	GlobalCommandSystem().addCommand("CameraStrafeLeft", boost::bind(&GlobalCameraManager::moveLeftDiscrete, this, _1));

	GlobalCommandSystem().addCommand("CameraUp", boost::bind(&GlobalCameraManager::moveUpDiscrete, this, _1));
	GlobalCommandSystem().addCommand("CameraDown", boost::bind(&GlobalCameraManager::moveDownDiscrete, this, _1));
	GlobalCommandSystem().addCommand("CameraAngleUp", boost::bind(&GlobalCameraManager::pitchUpDiscrete, this, _1));
	GlobalCommandSystem().addCommand("CameraAngleDown", boost::bind(&GlobalCameraManager::pitchDownDiscrete, this, _1));

	// Bind the events to the commands
	GlobalEventManager().addCommand("CenterView", "CenterView");

	GlobalEventManager().addToggle("ToggleCubicClip", boost::bind(&CameraSettings::toggleFarClip, getCameraSettings(), _1));
	// Set the default status of the cubic clip
	GlobalEventManager().setToggled("ToggleCubicClip", getCameraSettings()->farClipEnabled());

	GlobalEventManager().addCommand("CubicClipZoomIn", "CubicClipZoomIn");
	GlobalEventManager().addCommand("CubicClipZoomOut", "CubicClipZoomOut");

	GlobalEventManager().addCommand("UpFloor", "UpFloor");
	GlobalEventManager().addCommand("DownFloor", "DownFloor");

	GlobalEventManager().addWidgetToggle("ToggleCamera");
	GlobalEventManager().setToggled("ToggleCamera", true);

	// angua: increases and decreases the movement speed of the camera
	GlobalEventManager().addCommand("CamIncreaseMoveSpeed", "CamIncreaseMoveSpeed");
	GlobalEventManager().addCommand("CamDecreaseMoveSpeed", "CamDecreaseMoveSpeed");
	
	GlobalEventManager().addCommand("TogglePreview", "TogglePreview");
	
	// Insert movement commands
	GlobalEventManager().addCommand("CameraForward", "CameraForward");
	GlobalEventManager().addCommand("CameraBack", "CameraBack");
	GlobalEventManager().addCommand("CameraLeft", "CameraLeft");
	GlobalEventManager().addCommand("CameraRight", "CameraRight");
	GlobalEventManager().addCommand("CameraStrafeRight", "CameraStrafeRight");
	GlobalEventManager().addCommand("CameraStrafeLeft", "CameraStrafeLeft");

	GlobalEventManager().addCommand("CameraUp", "CameraUp");
	GlobalEventManager().addCommand("CameraDown", "CameraDown");
	GlobalEventManager().addCommand("CameraAngleUp", "CameraAngleUp");
	GlobalEventManager().addCommand("CameraAngleDown", "CameraAngleDown");
	
	GlobalEventManager().addKeyEvent("CameraFreeMoveForward", boost::bind(&GlobalCameraManager::onFreelookMoveForwardKey, this, _1));
	GlobalEventManager().addKeyEvent("CameraFreeMoveBack", boost::bind(&GlobalCameraManager::onFreelookMoveBackKey, this, _1));
	GlobalEventManager().addKeyEvent("CameraFreeMoveLeft", boost::bind(&GlobalCameraManager::onFreelookMoveLeftKey, this, _1));
	GlobalEventManager().addKeyEvent("CameraFreeMoveRight", boost::bind(&GlobalCameraManager::onFreelookMoveRightKey, this, _1));
	GlobalEventManager().addKeyEvent("CameraFreeMoveUp", boost::bind(&GlobalCameraManager::onFreelookMoveUpKey, this, _1));
	GlobalEventManager().addKeyEvent("CameraFreeMoveDown", boost::bind(&GlobalCameraManager::onFreelookMoveDownKey, this, _1));
}
Пример #28
0
// Invoke the registered callback
void Statement::execute() {
	if (_enabled) {
		GlobalCommandSystem().execute(_statement);
	}
}
Пример #29
0
// Loads the default shortcuts from the registry
void EventManager::loadAccelerators()
{
	if (_debugMode) {
		std::cout << "EventManager: Loading accelerators...\n";
	}

	// Register all custom statements as events too to make them shortcut-bindable
	// before going ahead
	GlobalCommandSystem().foreachStatement([&] (const std::string& statementName)
	{
		addCommand(statementName, statementName, false);
	}, true); // custom statements only

	xml::NodeList shortcutSets = GlobalRegistry().findXPath("user/ui/input//shortcuts");

	if (_debugMode) {
		std::cout << "Found " << shortcutSets.size() << " sets.\n";
	}

	// If we have two sets of shortcuts, delete the default ones
	if (shortcutSets.size() > 1) {
		GlobalRegistry().deleteXPath("user/ui/input//shortcuts[@name='default']");
	}

	// Find all accelerators
	xml::NodeList shortcutList = GlobalRegistry().findXPath("user/ui/input/shortcuts//shortcut");

	if (shortcutList.size() > 0) {
		rMessage() << "EventManager: Shortcuts found in Registry: " <<
			static_cast<int>(shortcutList.size()) << std::endl;
		for (unsigned int i = 0; i < shortcutList.size(); i++) {
			const std::string key = shortcutList[i].getAttributeValue("key");
			const std::string cmd = shortcutList[i].getAttributeValue("command");

			if (_debugMode) {
				std::cout << "Looking up command: " << cmd << "\n";
				std::cout << "Key is: >> " << key << " << \n";
			}

			// Try to lookup the command
			IEventPtr event = findEvent(cmd);

			// Check for a non-empty key string
			if (key != "") {
				 // Check for valid command definitions were found
				if (!event->empty()) {
					// Get the modifier string (e.g. "SHIFT+ALT")
					const std::string modifierStr = shortcutList[i].getAttributeValue("modifiers");

					if (!duplicateAccelerator(key, modifierStr, event)) {
						// Create the accelerator object
						IAccelerator& accelerator = addAccelerator(key, modifierStr);

						// Connect the newly created accelerator to the command
						accelerator.connectEvent(event);
					}
				}
				else {
					rWarning() << "EventManager: Cannot load shortcut definition (command invalid): " 
						<< cmd << std::endl;
				}
			}
		}
	}
	else {
		// No accelerator definitions found!
		rWarning() << "EventManager: No shortcut definitions found..." << std::endl;
	}
}
Пример #30
0
void Doom3PatchCreator::registerPatchCommands()
{
	// First connect the commands to the code
	GlobalCommandSystem().addCommand("CreatePatchPrefab", patch::algorithm::createPrefab, cmd::ARGTYPE_STRING);

	// Two optional integer arguments
	GlobalCommandSystem().addCommand("SimplePatchMesh", patch::algorithm::createSimplePatch,
		cmd::Signature(cmd::ARGTYPE_INT|cmd::ARGTYPE_OPTIONAL, cmd::ARGTYPE_INT|cmd::ARGTYPE_OPTIONAL));

	GlobalCommandSystem().addCommand("PatchInsertColumnEnd", selection::algorithm::insertPatchColumnsAtEnd);
	GlobalCommandSystem().addCommand("PatchInsertColumnBeginning", selection::algorithm::insertPatchColumnsAtBeginning);
	GlobalCommandSystem().addCommand("PatchInsertRowEnd", selection::algorithm::insertPatchRowsAtEnd);
	GlobalCommandSystem().addCommand("PatchInsertRowBeginning", selection::algorithm::insertPatchRowsAtBeginning);

	GlobalCommandSystem().addCommand("PatchDeleteColumnBeginning", selection::algorithm::deletePatchColumnsFromBeginning);
	GlobalCommandSystem().addCommand("PatchDeleteColumnEnd", selection::algorithm::deletePatchColumnsFromEnd);
	GlobalCommandSystem().addCommand("PatchDeleteRowBeginning", selection::algorithm::deletePatchRowsFromBeginning);
	GlobalCommandSystem().addCommand("PatchDeleteRowEnd", selection::algorithm::deletePatchRowsFromEnd);

	GlobalCommandSystem().addCommand("PatchAppendColumnBeginning", selection::algorithm::appendPatchColumnsAtBeginning);
	GlobalCommandSystem().addCommand("PatchAppendColumnEnd", selection::algorithm::appendPatchColumnsAtEnd);
	GlobalCommandSystem().addCommand("PatchAppendRowBeginning", selection::algorithm::appendPatchRowsAtBeginning);
	GlobalCommandSystem().addCommand("PatchAppendRowEnd", selection::algorithm::appendPatchRowsAtEnd);

	GlobalCommandSystem().addCommand("InvertCurve", selection::algorithm::invertPatch);
	GlobalCommandSystem().addCommand("RedisperseRows", selection::algorithm::redispersePatchRows);
	GlobalCommandSystem().addCommand("RedisperseCols", selection::algorithm::redispersePatchCols);
	GlobalCommandSystem().addCommand("MatrixTranspose", selection::algorithm::transposePatch);
	GlobalCommandSystem().addCommand("CapCurrentCurve", selection::algorithm::capPatch);
	GlobalCommandSystem().addCommand("CycleCapTexturePatch", selection::algorithm::cyclePatchProjection);
	GlobalCommandSystem().addCommand("ThickenPatch", selection::algorithm::thickenPatches);
	GlobalCommandSystem().addCommand("StitchPatchTexture", patch::algorithm::stitchTextures);
	GlobalCommandSystem().addCommand("BulgePatch", patch::algorithm::bulge);

	// Then, connect the Events to the commands
	GlobalEventManager().addCommand("PatchCylinder", "PatchCylinder");
	GlobalEventManager().addCommand("PatchDenseCylinder", "PatchDenseCylinder");
	GlobalEventManager().addCommand("PatchVeryDenseCylinder", "PatchVeryDenseCylinder");
	GlobalEventManager().addCommand("PatchSquareCylinder", "PatchSquareCylinder");
	GlobalEventManager().addCommand("PatchEndCap", "PatchEndCap");
	GlobalEventManager().addCommand("PatchBevel", "PatchBevel");
	GlobalEventManager().addCommand("PatchCone", "PatchCone");
	GlobalEventManager().addCommand("PatchSphere", "PatchSphere");
	GlobalEventManager().addCommand("SimplePatchMesh", "SimplePatchMesh");

	GlobalEventManager().addCommand("PatchInsertColumnEnd", "PatchInsertColumnEnd");
	GlobalEventManager().addCommand("PatchInsertColumnBeginning", "PatchInsertColumnBeginning");
	GlobalEventManager().addCommand("PatchInsertRowEnd", "PatchInsertRowEnd");
	GlobalEventManager().addCommand("PatchInsertRowBeginning", "PatchInsertRowBeginning");

	GlobalEventManager().addCommand("PatchDeleteColumnBeginning", "PatchDeleteColumnBeginning");
	GlobalEventManager().addCommand("PatchDeleteColumnEnd", "PatchDeleteColumnEnd");
	GlobalEventManager().addCommand("PatchDeleteRowBeginning", "PatchDeleteRowBeginning");
	GlobalEventManager().addCommand("PatchDeleteRowEnd", "PatchDeleteRowEnd");

	GlobalEventManager().addCommand("PatchAppendColumnBeginning", "PatchAppendColumnBeginning");
	GlobalEventManager().addCommand("PatchAppendColumnEnd", "PatchAppendColumnEnd");
	GlobalEventManager().addCommand("PatchAppendRowBeginning", "PatchAppendRowBeginning");
	GlobalEventManager().addCommand("PatchAppendRowEnd", "PatchAppendRowEnd");

	GlobalEventManager().addCommand("InvertCurve", "InvertCurve");
	GlobalEventManager().addCommand("RedisperseRows", "RedisperseRows");
	GlobalEventManager().addCommand("RedisperseCols", "RedisperseCols");
	GlobalEventManager().addCommand("MatrixTranspose", "MatrixTranspose");
	GlobalEventManager().addCommand("CapCurrentCurve", "CapCurrentCurve");
	GlobalEventManager().addCommand("CycleCapTexturePatch", "CycleCapTexturePatch");
	GlobalEventManager().addCommand("ThickenPatch", "ThickenPatch");
	GlobalEventManager().addCommand("StitchPatchTexture", "StitchPatchTexture");
	GlobalEventManager().addCommand("BulgePatch", "BulgePatch");
}