Exemple #1
0
 MapDoom3Dependencies() :
   GlobalEntityClassManagerModuleRef(GlobalRadiant().getRequiredGameDescriptionKeyValue("entityclass")),
   GlobalBrushModuleRef(GlobalRadiant().getRequiredGameDescriptionKeyValue("brushtypes")),
   m_patchDef2Doom3Module("def2doom3"),
   m_patchDoom3Module("doom3")
 {
 }
		~EclassManagerAPI ()
		{
			GlobalRadiant().detachGameModeObserver(*_eclassmanager);
			GlobalRadiant().detachGameToolsPathObserver(*_eclassmanager);

			delete _eclassmanager;
		}
Exemple #3
0
	ModelSelector::ModelSelector () :
		_widget(gtk_window_new(GTK_WINDOW_TOPLEVEL)), _treeStore(gtk_tree_store_new(N_COLUMNS, G_TYPE_STRING,
				G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT, GDK_TYPE_PIXBUF)), _infoStore(gtk_list_store_new(2,
				G_TYPE_STRING, G_TYPE_STRING)), _lastModel(""), _lastSkin(-1)
	{
		// Window properties
		gtk_window_set_transient_for(GTK_WINDOW(_widget), GlobalRadiant().getMainWindow());
		gtk_window_set_modal(GTK_WINDOW(_widget), TRUE);
		gtk_window_set_title(GTK_WINDOW(_widget), MODELSELECTOR_TITLE);
		gtk_window_set_position(GTK_WINDOW(_widget), GTK_WIN_POS_CENTER_ON_PARENT);

		// Set the default size of the window
		GtkWindow* mainWindow = GlobalRadiant().getMainWindow();
		gint w;
		gint h;
		gtk_window_get_size(mainWindow,&w,&h);

		gtk_window_set_default_size(GTK_WINDOW(_widget), gint(w * 0.75), gint(h * 0.8));

		// Create the model preview widget
		float previewHeightFactor = GlobalRegistry().getFloat("user/ui/ModelSelector/previewSizeFactor");
		gint glSize = gint(h * previewHeightFactor);
		_modelPreview.setSize(glSize);

		// Signals
		g_signal_connect(G_OBJECT(_widget), "delete_event", G_CALLBACK(callbackHide), this);

		// Main window contains a VBox
		GtkWidget* vbx = gtk_vbox_new(FALSE, 3);
		gtk_box_pack_start(GTK_BOX(vbx), createTreeView(), TRUE, TRUE, 0);
		gtk_box_pack_start(GTK_BOX(vbx), createPreviewAndInfoPanel(), FALSE, FALSE, 0);
		gtk_box_pack_end(GTK_BOX(vbx), createButtons(), FALSE, FALSE, 0);
		gtk_container_add(GTK_CONTAINER(_widget), vbx);
	}
Exemple #4
0
  void operator()(const char* name) const
  {
    EntityClassFilterMode filterMode;

    if(filterMode.filter_mp_sp)
    {
      if(string_empty(GlobalRadiant().getGameMode()) || string_equal(GlobalRadiant().getGameMode(), "sp"))
      {
        if(string_equal_n(name, filterMode.sp_ignore_prefix, strlen(filterMode.sp_ignore_prefix)))
        {
          globalOutputStream() << "Ignoring '" << name << "'\n";
          return;
        }
      }
      else
      {
        if(string_equal_n(name, filterMode.mp_ignore_prefix, strlen(filterMode.mp_ignore_prefix)))
        {
          globalOutputStream() << "Ignoring '" << name << "'\n";
          return;
        }
      }
    }
  
    // for a given name, we grab the first .def in the vfs
    // this allows to override baseq3/scripts/entities.def for instance
    StringOutputStream relPath(256);
    relPath << m_directory << name;

    scanner.scanFile(g_collector, relPath.c_str());
  }
		EclassManagerAPI ()
		{
			_eclassmanager = new EntityClassManager();

			GlobalRadiant().attachGameToolsPathObserver(*_eclassmanager);
			GlobalRadiant().attachGameModeObserver(*_eclassmanager);
		}
Exemple #6
0
  ~EclassManagerAPI()
  {
    GlobalRadiant().detachGameNameObserver(g_EntityClassQuake3);
    GlobalRadiant().detachGameModeObserver(g_EntityClassQuake3);
    GlobalRadiant().detachGameToolsPathObserver(g_EntityClassQuake3);

    EntityClassQuake3_destroy();
  }
Exemple #7
0
void BuildMiniPrt(std::list<Str>* exclusionList)
{
	// yes, we could just use -fulldetail option, but, as SPOG said
	// it'd be faster without all the hint, donotenter etc textures and
	// doors, etc

	
	
	char buffer[128];
  const char *pn = GlobalRadiant().getMapsPath();

	strcpy( buffer, pn );
	strcat( buffer, "/ac_prt.map" );
	FILE* pFile = fopen(buffer, "w");

	// ahem, thx rr2
	if(!pFile)
		return;

  Scene_forEachEntity(EntityWriteMiniPrt(pFile, exclusionList));

	fclose(pFile);

	StartBSP();
}
	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)
		);	
	}
	// Constructor. Creates GTK widgets.
	EntityClassChooser::EntityClassChooser () :
		_widget(gtk_window_new(GTK_WINDOW_TOPLEVEL)), _treeStore(NULL), _selection(NULL), _addButton(NULL)
	{
		gtk_window_set_transient_for(GTK_WINDOW(_widget), GlobalRadiant().getMainWindow());
		gtk_window_set_modal(GTK_WINDOW(_widget), TRUE);
		gtk_window_set_position(GTK_WINDOW(_widget), GTK_WIN_POS_CENTER_ON_PARENT);
		gtk_window_set_title(GTK_WINDOW(_widget), ECLASS_CHOOSER_TITLE);

		// Set the default size of the window

		GdkScreen* scr = gtk_window_get_screen(GTK_WINDOW(_widget));
		gint w = gdk_screen_get_width(scr);
		gint h = gdk_screen_get_height(scr);

		gtk_window_set_default_size(GTK_WINDOW(_widget), w / 3, h / 2);

		// Create GUI elements and pack into main VBox

		GtkWidget* vbx = gtk_vbox_new(FALSE, 3);
		gtk_box_pack_start(GTK_BOX(vbx), createTreeView(), TRUE, TRUE, 0);
		gtk_box_pack_start(GTK_BOX(vbx), createUsagePanel(), FALSE, FALSE, 0);
		gtk_box_pack_start(GTK_BOX(vbx), createButtonPanel(), FALSE, FALSE, 0);
		gtk_container_set_border_width(GTK_CONTAINER(_widget), 12);
		gtk_container_add(GTK_CONTAINER(_widget), vbx);

		// Signals
		g_signal_connect(_widget, "delete_event", G_CALLBACK(callbackHide), this);

	}
Exemple #10
0
void MouseEventManager::updateStatusText(GdkEventKey* event) {
	_activeFlags = _modifiers.getKeyboardFlags(event->state);

	std::string statusText("");

	if (_activeFlags != 0) {
		for (ButtonIdMap::iterator it = _buttonId.begin(); it != _buttonId.end(); ++it) {
			// Look up an event with this button ID and the given modifier
			ui::XYViewEvent xyEvent = findXYViewEvent(it->second, _activeFlags);

			if (xyEvent != ui::xyNothing) {
				statusText += _modifiers.getModifierStr(_activeFlags, true) + "-";
				statusText += getShortButtonName(it->first) + ": ";
				statusText += printXYViewEvent(xyEvent);
				statusText += " ";
			}

			// Look up an event with this button ID and the given modifier
			ui::ObserverEvent obsEvent = findObserverEvent(it->second, _activeFlags);

			if (obsEvent != ui::obsNothing) {
				statusText += _modifiers.getModifierStr(_activeFlags, true) + "-";
				statusText += getShortButtonName(it->first) + ": ";
				statusText += printObserverEvent(obsEvent);
				statusText += " ";
			}
		}
	}

	GlobalRadiant().setStatusText(statusText);
}
// This takes care of relading the entityDefs and refreshing the scenegraph
void EClassManager::reloadDefsCmd(const cmd::ArgumentList& args)
{
	GlobalRadiant().performLongRunningOperation([&] (ILongRunningOperation& operation)
	{
		reloadDefs();
	}, _("Reloading Defs"));
}
Exemple #12
0
  EclassManagerAPI()
  {
    EntityClassQuake3_construct();

    m_eclassmanager.findOrInsert = &Eclass_ForName;
    m_eclassmanager.findListType = &EntityClass_findListType;
    m_eclassmanager.forEach = &Eclass_forEach;
    m_eclassmanager.attach = &EntityClass_attach;
    m_eclassmanager.detach = &EntityClass_detach;
    m_eclassmanager.realise = &EntityClass_realise;
    m_eclassmanager.unrealise = &EntityClass_unrealise;

    GlobalRadiant().attachGameToolsPathObserver(g_EntityClassQuake3);
    GlobalRadiant().attachGameModeObserver(g_EntityClassQuake3);
    GlobalRadiant().attachGameNameObserver(g_EntityClassQuake3);
  }
Exemple #13
0
	LightDialog::LightDialog () :
		_widget(gtk_window_new(GTK_WINDOW_TOPLEVEL)), _aborted(false)
	{
		// Set up the window
		gtk_window_set_transient_for(GTK_WINDOW(_widget), GlobalRadiant().getMainWindow());
		gtk_window_set_modal(GTK_WINDOW(_widget), TRUE);
		gtk_window_set_title(GTK_WINDOW(_widget), _("Create light entity"));
		gtk_window_set_position(GTK_WINDOW(_widget), GTK_WIN_POS_CENTER_ON_PARENT);
		gtk_window_set_type_hint(GTK_WINDOW(_widget), GDK_WINDOW_TYPE_HINT_DIALOG);

		// Set the default size of the window
		gtk_window_set_default_size(GTK_WINDOW(_widget), 300, 300);

		// Delete event
		g_signal_connect(
				G_OBJECT(_widget), "delete-event", G_CALLBACK(_onDelete), this
		);

		// Main vbox
		GtkWidget* vbx = gtk_vbox_new(FALSE, 12);
		gtk_box_pack_start(GTK_BOX(vbx), gtkutil::FramedWidget(createColorSelector(), _("Light Color")), TRUE, TRUE, 0);
		gtk_box_pack_start(GTK_BOX(vbx), gtkutil::FramedWidget(createIntensity(), _("Light Intensity")), FALSE, FALSE, 0);
		gtk_box_pack_start(GTK_BOX(vbx), createButtons(), FALSE, FALSE, 0);

		gtk_container_set_border_width(GTK_CONTAINER(_widget), 12);
		gtk_container_add(GTK_CONTAINER(_widget), vbx);

		_intensityEntry.setValue(_defaultIntensity);
	}
Exemple #14
0
	UMPEditor::UMPEditor (const std::string& umpName)
	{
		_view.setUMPFile(umpName);
		_dialog = gtk_dialog_new_with_buttons(_("UMP Definition"), GlobalRadiant().getMainWindow(),
				GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, GTK_STOCK_OK,
				GTK_RESPONSE_ACCEPT, NULL);

		gtk_dialog_set_default_response(GTK_DIALOG(_dialog), GTK_RESPONSE_ACCEPT);

		gtk_container_set_border_width(GTK_CONTAINER(_dialog), 12);

		gtk_container_add(GTK_CONTAINER(GTK_DIALOG(_dialog)->vbox), _view.getWidget());

		GdkRectangle rect = gtkutil::MultiMonitor::getMonitorForWindow(GlobalRadiant().getMainWindow());
		gtk_window_set_default_size(GTK_WINDOW(_dialog), gint(rect.width / 2), gint(2 * rect.height / 3));
	}
Exemple #15
0
void Map_Read (scene::Node& root, Tokeniser& tokeniser, EntityCreator& entityTable, const PrimitiveParser& parser)
{
	// Create an info display panel to track load progress
	gtkutil::ModalProgressDialog dialog(GlobalRadiant().getMainWindow(), _("Loading map"));

	// Read each entity in the map, until EOF is reached
	for (int entCount = 0; ; entCount++) {
		// Update the dialog text
		dialog.setText("Loading entity " + string::toString(entCount));

		// Check for end of file
		if (tokeniser.getToken().empty())
			break;

		// Create an entity node by parsing from the stream
		NodeSmartReference entity(Entity_parseTokens(tokeniser, entityTable, parser, entCount));

		if (entity == g_nullNode) {
			globalErrorStream() << "entity " << entCount << ": parse error\n";
			return;
		}

		// Insert the new entity into the scene graph
		Node_getTraversable(root)->insert(entity);
	}
}
Exemple #16
0
	ParticleEditor::ParticleEditor () :
		_widget(gtk_window_new(GTK_WINDOW_TOPLEVEL))
	{
		// Window properties
		gtk_window_set_transient_for(GTK_WINDOW(_widget), GlobalRadiant().getMainWindow());
		gtk_window_set_modal(GTK_WINDOW(_widget), TRUE);
		gtk_window_set_title(GTK_WINDOW(_widget), PARTICLEEDITOR_TITLE);
		gtk_window_set_position(GTK_WINDOW(_widget), GTK_WIN_POS_CENTER_ON_PARENT);

		// Set the default size of the window
		GdkScreen* scr = gtk_window_get_screen(GTK_WINDOW(_widget));
		gint w = gdk_screen_get_width(scr);
		gint h = gdk_screen_get_height(scr);

		gtk_window_set_default_size(GTK_WINDOW(_widget), gint(w * 0.75), gint(h * 0.8));

		// Create the model preview widget
		gint glSize = gint(h * 0.4);
		_particlePreview.setSize(glSize);

		// Signals
		//g_signal_connect(G_OBJECT(_widget), "delete_event", G_CALLBACK(callbackHide), this);

		// Main window contains a VBox
		GtkWidget* vbx = gtk_vbox_new(FALSE, 3);
		gtk_box_pack_start(GTK_BOX(vbx), createPreviewPanel(), FALSE, FALSE, 0);
		gtk_box_pack_end(GTK_BOX(vbx), createButtons(), FALSE, FALSE, 0);
		gtk_container_add(GTK_CONTAINER(_widget), vbx);
	}
Exemple #17
0
// This is called from main() to start up the Radiant stuff.
void Radiant_Initialise (void)
{
	// Load the ColourSchemes from the registry
	ColourSchemes().loadColourSchemes();

	// Load the other modules
	Radiant_Construct(GlobalRadiantModuleServer());

	g_VFSModuleObserver.realise();
	GlobalTextureBrowser().createWidget();

	// Rebuild the map path basing on the userGamePath
	std::string newMapPath = GlobalRadiant().getFullGamePath() + "maps/";
	g_mkdir_with_parents(newMapPath.c_str(), 0755);
	Environment::Instance().setMapsPath(newMapPath);

	g_gameToolsPathObservers.realise();
	g_gameModeObservers.realise();

	GlobalUMPSystem().init();

	// Construct the MRU commands and menu structure
	GlobalMRU().constructMenu();

	// Initialise the most recently used files list
	GlobalMRU().loadRecentFiles();

	gtkutil::MultiMonitor::printMonitorInfo();
}
Exemple #18
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();
}
Exemple #19
0
		void realise (void)
		{
			if (--m_unrealised == 0) {
				GlobalFileSystem().initDirectory(GlobalRadiant().getFullGamePath());
				GlobalFileSystem().initialise();
			}
		}
void CallBrushExportOBJ ()
{
	if (GlobalSelectionSystem().countSelected() != 0) {
		export_selected(GlobalRadiant().getMainWindow());
	} else {
		gtkutil::errorDialog(_("No Brushes Selected!"));
	}
}
Exemple #21
0
BrushInstance::BrushInstance (const scene::Path& path, scene::Instance* parent, Brush& brush) :
	Instance(path, parent), TransformModifier(Brush::TransformChangedCaller(
			brush), ApplyTransformCaller(*this)), m_brush(brush), m_selectable(SelectedChangedCaller(*this)),
			m_render_selected(GL_POINTS), m_render_faces_wireframe(m_faceCentroidPointsCulled, GL_POINTS),
			m_viewChanged(false)
{
	m_brush.instanceAttach(Instance::path());
	m_brush.attach(*this);
	GlobalRadiant().getCounter(counterBrushes).increment();
}
Exemple #22
0
void Build_StairStep(vec3_t min, vec3_t max, const char* mainTexture, const char* riserTexture, int direction)
{
  NodeSmartReference newBrush(GlobalBrushCreator().createBrush());

	//----- Build Outer Bounds ---------

	vec3_t v1, v2, v3, v5, v6, v7;
	VectorCopy(min, v1);
	VectorCopy(min, v2);
	VectorCopy(min, v3);
	VectorCopy(max, v5);
	VectorCopy(max, v6);
	VectorCopy(max, v7);

	v2[0] = max[0];
	v3[1] = max[1];

	v6[0] = min[0];
	v7[1] = min[1];

	//----------------------------------

	AddFaceWithTexture(newBrush, v6, v5, v7, mainTexture, false);
	// top gets current texture


	if(direction == MOVE_EAST)
		AddFaceWithTexture(newBrush, v1, v3, v6, riserTexture, false);
	else
		AddFaceWithTexture(newBrush, v1, v3, v6, "textures/common/caulk", false);
	// west facing side, etc...

	
	if(direction == MOVE_NORTH)
		AddFaceWithTexture(newBrush, v1, v7, v2, riserTexture, false);
	else
		AddFaceWithTexture(newBrush, v1, v7, v2, "textures/common/caulk", false);

	if(direction == MOVE_SOUTH)
		AddFaceWithTexture(newBrush, v3, v5, v6, riserTexture, false);
	else
		AddFaceWithTexture(newBrush, v3, v5, v6, "textures/common/caulk", false);
	
	if(direction == MOVE_WEST)
		AddFaceWithTexture(newBrush, v7, v5, v2, riserTexture, false);
	else
		AddFaceWithTexture(newBrush, v7, v5, v2, "textures/common/caulk", false);


	AddFaceWithTexture(newBrush, v1, v2, v3, "textures/common/caulk", false);
	// base is caulked

	Node_getTraversable(GlobalRadiant().getMapWorldEntity())->insert(newBrush);
	// finish brush
}
Exemple #23
0
	void UMPDefinitionView::save ()
	{
		const std::string& content = _view.getContents();
		TextFileOutputStream out(GlobalRadiant().getGamePath() + _umpFile);
		if (out.failed()) {
			g_message("Error saving file to '%s'.", _umpFile.c_str());
			gtkutil::errorDialog(_("Error saving ump file"));
			return;
		}
		out << content.c_str();
	}
Exemple #24
0
EntityList& EntityList::Instance() {
	if (InstancePtr() == NULL) {
		// Not yet instantiated, do it now
		InstancePtr() = EntityListPtr(new EntityList);
		
		// Register this instance with GlobalRadiant() at once
		GlobalRadiant().addEventListener(InstancePtr());
	}
	
	return *InstancePtr();
}
	void MaterialDefinitionView::save ()
	{
		const std::string& content = _view.getContents();
		const std::string& gamePath = GlobalRadiant().getFullGamePath();
		std::string fullpath = gamePath + "/" + _material;
		TextFileOutputStream out(fullpath);
		if (out.failed()) {
			g_message("Error saving file to '%s'.", fullpath.c_str());
			gtkutil::errorDialog(_("Error saving material file"));
			return;
		}
		out << content;
	}
Exemple #26
0
void Map::initialiseModule(const ApplicationContext& ctx)
{
    rMessage() << getName() << "::initialiseModule called." << std::endl;

    // Register for the startup event
    _startupMapLoader = StartupMapLoaderPtr(new StartupMapLoader);
    GlobalRadiant().signal_radiantStarted().connect(
        sigc::mem_fun(*_startupMapLoader, &StartupMapLoader::onRadiantStartup)
    );
    GlobalRadiant().signal_radiantShutdown().connect(
        sigc::mem_fun(*_startupMapLoader, &StartupMapLoader::onRadiantShutdown)
    );

    // Add the Map-related commands to the EventManager
    registerCommands();

    // Add the region-related commands to the EventManager
    RegionManager::initialiseCommands();

    // Add the map position commands to the EventManager
    GlobalMapPosition().initialise();
}
void ToolsCheckErrors ()
{
	if (!GlobalMap().askForSave(_("Check Map")))
		return;

	/* empty map? */
	if (!GlobalRadiant().getCounter(counterBrushes).get()) {
		gtkutil::errorDialog(_("Nothing to fix in this map\n"));
		return;
	}

	ui::ErrorCheckDialog::showDialog();
}
Exemple #28
0
void MainFrame_Construct (void)
{
	// Tell the FilterSystem to register its commands
	GlobalFilterSystem().init();

	Commands_Register();

	GLWidget_sharedContextCreated = GlobalGL_sharedContextCreated;
	GLWidget_sharedContextDestroyed = GlobalGL_sharedContextDestroyed;

	// Broadcast the startup event
	GlobalRadiant().broadcastStartupEvent();
}
Exemple #29
0
	void ModelSelector::loadDirectory(const std::string& path) {
		if (path.empty())
			return;

		// Modal dialog window to display progress
		gtkutil::ModalProgressDialog dialog(GlobalRadiant().getMainWindow(), string::format(_("Loading models %s"), path.c_str()));

		// Populate the treestore using the VFS callback functor
		ModelFileFunctor functor(_treeStore, dialog, DirectoryCleaned(path), _dirIterMap);
		functor.setDirectory(true);
		GlobalFileSystem().forEachDirectory(path, makeCallback1(functor), 1);
		functor.setDirectory(false);
		GlobalFileSystem().forEachFile(path, "*", makeCallback1(functor), 1);
	}
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");
}