- Brushplugin Version 2.0, supports multiple collapse modes and a materialignore...
authornamespace <namespace>
Mon, 25 Dec 2006 22:22:04 +0000 (22:22 +0000)
committernamespace <namespace>
Mon, 25 Dec 2006 22:22:04 +0000 (22:22 +0000)
 - Camera movement speed changes. Increase speed = SHIFT+KP_PLUS, decrease speed = SHIFT+KP_MINUS.
   New option to link the strafe speed to camera movement speed (default: linked). (Shaderman)
 - Fixed bug in sample plugin (Shaderman)
 - Merry Christmas

git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/trunk@128 8a3a26a2-13c4-0310-b231-cf6edde360e5

13 files changed:
CHANGES
SConscript
contrib/brushexport/brushexport.vcproj
contrib/brushexport/callbacks.cpp [new file with mode: 0644]
contrib/brushexport/callbacks.h [new file with mode: 0644]
contrib/brushexport/export.cpp [new file with mode: 0644]
contrib/brushexport/export.h [new file with mode: 0644]
contrib/brushexport/interface.cpp [new file with mode: 0644]
contrib/brushexport/plugin.cpp
contrib/brushexport/support.cpp [new file with mode: 0644]
contrib/brushexport/support.h [new file with mode: 0644]
plugins/sample/sample.cpp
radiant/camwindow.cpp

diff --git a/CHANGES b/CHANGES
index 191eb7a..9afc4b2 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,14 @@
 This is the changelog for developers, != changelog for the end user 
 that we distribute with the binaries. (see changelog)
 
+25/12/2006
+namespace
+ - Brushplugin Version 2.0, supports multiple collapse modes and a materialignore list (namespace)
+ - Camera movement speed changes. Increase speed = SHIFT+KP_PLUS, decrease speed = SHIFT+KP_MINUS.
+   New option to link the strafe speed to camera movement speed (default: linked). (Shaderman)
+ - Fixed bug in sample plugin (Shaderman)
+ - Merry Christmas
+
 17/12/2006
 namespace
  - Radiant warzow-support (Topsun + Warzow-Mappers)
index 68a875e..f4738ed 100644 (file)
@@ -479,13 +479,12 @@ prtview_lib = prtview_env.SharedLibrarySafe(target='prtview', source=prtview_lst
 prtview_env.Depends(prtview_lib, profile_lib)
 prtview_env.Install(INSTALL + '/plugins', prtview_lib)
 
-
-brushexport_env = module_env.Copy()
-brushexport_lst = build_list('contrib/brushexport', 'plugin.cpp')
-brushexport_env.useGlib2()
-brushexport_env.useGtk2()
-brushexport_lib = brushexport_env.SharedLibrarySafe(target='brushexport', source=brushexport_lst, LIBPATH='libs')
-brushexport_env.Install(INSTALL + '/plugins', brushexport_lib)
+brushexport2_env = module_env.Copy()
+brushexport2_lst = build_list('contrib/brushexport', ['plugin.cpp','interface.cpp','callbacks.cpp', 'support.cpp', 'export.cpp'])
+brushexport2_env.useGlib2()
+brushexport2_env.useGtk2()
+brushexport2_lib = brushexport2_env.SharedLibrarySafe(target='brushexport', source=brushexport2_lst, LIBPATH='libs')
+brushexport2_env.Install(INSTALL + '/plugins', brushexport2_lib)
 
 sunplug_env = module_env.Copy()
 sunplug_lst = build_list('contrib/sunplug', 'sunplug.cpp')
index 709aa27..5c7f1f8 100644 (file)
@@ -55,7 +55,8 @@
                        <Tool\r
                                Name="VCPostBuildEventTool"\r
                                CommandLine="copy &quot;$(TargetPath)&quot; &quot;$(SolutionDir)install\plugins&quot;\r
-                               copy &quot;$(TargetDir)$(TargetName).pdb&quot; &quot;$(SolutionDir)install\plugins&quot;"/>\r
+copy &quot;$(TargetDir)$(TargetName).pdb&quot; &quot;$(SolutionDir)install\plugins&quot;\r
+"/>\r
                        <Tool\r
                                Name="VCPreBuildEventTool"/>\r
                        <Tool\r
                        <Tool\r
                                Name="VCPostBuildEventTool"\r
                                CommandLine="copy &quot;$(TargetPath)&quot; &quot;$(SolutionDir)install\plugins&quot;\r
-                               copy &quot;$(TargetDir)$(TargetName).pdb&quot; &quot;$(SolutionDir)install\plugins&quot;"/>\r
+copy &quot;$(TargetDir)$(TargetName).pdb&quot; &quot;$(SolutionDir)install\plugins&quot;\r
+"/>\r
                        <Tool\r
                                Name="VCPreBuildEventTool"/>\r
                        <Tool\r
                        Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"\r
                        UniqueIdentifier="{22F2852C-8177-45D5-94D0-C5255C199F7F}">\r
                        <File\r
+                               RelativePath=".\callbacks.cpp">\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\callbacks.h">\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\export.cpp">\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\export.h">\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\interface.cpp">\r
+                       </File>\r
+                       <File\r
                                RelativePath=".\plugin.cpp">\r
                        </File>\r
                        <File\r
                                RelativePath=".\plugin.h">\r
                        </File>\r
+                       <File\r
+                               RelativePath=".\support.cpp">\r
+                       </File>\r
+                       <File\r
+                               RelativePath=".\support.h">\r
+                       </File>\r
                </Filter>\r
                <File\r
                        RelativePath=".\brushexport.def">\r
diff --git a/contrib/brushexport/callbacks.cpp b/contrib/brushexport/callbacks.cpp
new file mode 100644 (file)
index 0000000..1225d00
--- /dev/null
@@ -0,0 +1,104 @@
+#include <glib.h>\r
+#include <gtk/gtk.h>\r
+#include <set>\r
+\r
+#include "qerplugin.h"\r
+#include "debugging/debugging.h"\r
+#include "support.h"\r
+#include "export.h"\r
+\r
+// stuff from interface.cpp\r
+void DestroyWindow();\r
+\r
+\r
+namespace callbacks {\r
+\r
+void OnDestroy(GtkWidget* w, gpointer data)\r
+{\r
+       DestroyWindow();\r
+}\r
+\r
+void OnExportClicked(GtkButton* button, gpointer user_data)\r
+{\r
+       GtkWidget* window = lookup_widget(GTK_WIDGET(button), "w_plugplug2");\r
+       ASSERT_NOTNULL(window);\r
+       const char* path = GlobalRadiant().m_pfnFileDialog(window, false, "Save as Obj", 0, 0);\r
+       if(!path)\r
+               return;\r
+  \r
+  // get ignore list from ui\r
+  std::set<std::string> ignore;\r
+  \r
+  GtkTreeView* view = GTK_TREE_VIEW(lookup_widget(GTK_WIDGET(button), "t_materialist"));\r
+  GtkListStore* list = GTK_LIST_STORE(gtk_tree_view_get_model(view));\r
+\r
+  GtkTreeIter iter;\r
+  bool valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(list), &iter);\r
+  while(valid)\r
+  {\r
+    gchar* data;\r
+       gtk_tree_model_get(GTK_TREE_MODEL(list), &iter, 0, &data, -1);\r
+       globalOutputStream() << data << "\n";\r
+       ignore.insert(std::string(data));\r
+       g_free(data);\r
+       valid = gtk_tree_model_iter_next (GTK_TREE_MODEL(list), &iter);\r
+  }\r
+  \r
+  for(std::set<std::string>::iterator it(ignore.begin()); it != ignore.end(); ++it)\r
+    globalOutputStream() << it->c_str() << "\n";\r
+  \r
+  // collapse mode\r
+  collapsemode mode = COLLAPSE_NONE;\r
+  \r
+  GtkWidget* radio = lookup_widget(GTK_WIDGET(button), "r_collapse");\r
+  ASSERT_NOTNULL(radio);\r
+  \r
+  if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio)))\r
+    mode = COLLAPSE_ALL;\r
+  else\r
+  {\r
+    radio = lookup_widget(GTK_WIDGET(button), "r_collapsebymaterial");\r
+    ASSERT_NOTNULL(radio);\r
+    if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio)))\r
+      mode = COLLAPSE_BY_MATERIAL;\r
+       else\r
+       {\r
+         radio = lookup_widget(GTK_WIDGET(button), "r_nocollapse");\r
+         ASSERT_NOTNULL(radio);\r
+         ASSERT_NOTNULL(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(radio)));\r
+         mode = COLLAPSE_NONE;\r
+       }\r
+  }\r
+  \r
+  // export\r
+  ExportSelection(ignore, mode, path);\r
+}\r
+\r
+void OnAddMaterial(GtkButton* button, gpointer user_data)\r
+{\r
+  GtkEntry* edit = GTK_ENTRY(lookup_widget(GTK_WIDGET(button), "ed_materialname"));\r
+  ASSERT_NOTNULL(edit);\r
+  \r
+  const gchar* name = gtk_entry_get_text(edit);\r
+  if(g_utf8_strlen(name, -1) > 0)\r
+  {\r
+       GtkListStore* list = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(lookup_widget(GTK_WIDGET(button), "t_materialist"))));\r
+       GtkTreeIter iter;\r
+       gtk_list_store_append(list, &iter);\r
+       gtk_list_store_set(list, &iter, 0, name, -1);\r
+       gtk_entry_set_text(edit, "");\r
+  }\r
+}\r
+\r
+void OnRemoveMaterial(GtkButton* button, gpointer user_data)\r
+{\r
+       GtkTreeView* view = GTK_TREE_VIEW(lookup_widget(GTK_WIDGET(button), "t_materialist"));\r
+       GtkListStore* list = GTK_LIST_STORE(gtk_tree_view_get_model(view));\r
+       GtkTreeSelection* sel = gtk_tree_view_get_selection(view);\r
+       \r
+       GtkTreeIter iter;\r
+       if(gtk_tree_selection_get_selected(sel, 0, &iter))\r
+         gtk_list_store_remove(list, &iter);\r
+}\r
+\r
+}// callbacks\r
diff --git a/contrib/brushexport/callbacks.h b/contrib/brushexport/callbacks.h
new file mode 100644 (file)
index 0000000..afad96c
--- /dev/null
@@ -0,0 +1,11 @@
+typedef struct _GtkWidget GtkWidget;\r
+typedef struct _GtkButton GtkButton;\r
+\r
+namespace callbacks {\r
+\r
+void OnDestroy(GtkWidget*, gpointer);\r
+void OnExportClicked(GtkButton*, gpointer);\r
+void OnAddMaterial(GtkButton*, gpointer);\r
+void OnRemoveMaterial(GtkButton*, gpointer);\r
+\r
+}// callbacks\r
diff --git a/contrib/brushexport/export.cpp b/contrib/brushexport/export.cpp
new file mode 100644 (file)
index 0000000..ac42111
--- /dev/null
@@ -0,0 +1,274 @@
+#include "export.h"\r
+#include "debugging/debugging.h"\r
+#include "ibrush.h"\r
+#include "iscenegraph.h"\r
+#include "iselection.h"\r
+#include "stream/stringstream.h"\r
+#include "stream/textfilestream.h"\r
+\r
+// this is very evil, but right now there is no better way\r
+#include "../../radiant/brush.h"\r
+\r
+/*\r
+       Abstract baseclass for modelexporters\r
+       the class collects all the data which then gets\r
+       exported through the WriteToFile method.\r
+*/\r
+class ExportData\r
+{\r
+public:\r
+       ExportData(const std::set<std::string>& ignorelist, collapsemode mode);\r
+       virtual ~ExportData(void);\r
+       \r
+       virtual void BeginBrush(Brush& b);\r
+       virtual void AddBrushFace(Face& f);\r
+       virtual void EndBrush(void);\r
+       \r
+       virtual bool WriteToFile(const std::string& path) const = 0;\r
+       \r
+protected:\r
+\r
+       // a group of faces\r
+       class group\r
+       {\r
+       public:\r
+               std::string name;\r
+               std::list<const Face*> faces;\r
+       };\r
+       \r
+       std::list<group> groups;\r
+       \r
+private:\r
+\r
+       // "textures/common/caulk" -> "caulk"\r
+       void GetShaderNameFromShaderPath(const char* path, std::string& name);\r
+\r
+       group* current; \r
+       collapsemode mode;\r
+       const std::set<std::string>& ignorelist;\r
+};\r
+\r
+ExportData::ExportData(const std::set<std::string>& _ignorelist, collapsemode _mode)\r
+       :       mode(_mode),\r
+               ignorelist(_ignorelist)\r
+{\r
+       current = 0;\r
+       \r
+       // in this mode, we need just one group\r
+       if(mode == COLLAPSE_ALL)\r
+       {\r
+               groups.push_back(group());\r
+               current = &groups.back();\r
+               current->name = "all";\r
+       }\r
+}\r
+\r
+ExportData::~ExportData(void)\r
+{\r
+       \r
+}\r
+\r
+void ExportData::BeginBrush(Brush& b)\r
+{\r
+       // create a new group for each brush\r
+       if(mode == COLLAPSE_NONE)\r
+       {\r
+               groups.push_back(group());\r
+               current = &groups.back();\r
+               \r
+               StringOutputStream str(256);\r
+               str << "Brush" << (const unsigned int)groups.size();\r
+               current->name = str.c_str();\r
+       }\r
+}\r
+\r
+void ExportData::EndBrush(void)\r
+{\r
+       // all faces of this brush were on the ignorelist, discard the emptygroup\r
+       if(mode == COLLAPSE_NONE)\r
+       {\r
+               ASSERT_NOTNULL(current);\r
+               if(current->faces.empty())\r
+               {\r
+                       groups.pop_back();\r
+                       current = 0;\r
+               }\r
+       }\r
+}\r
+\r
+void ExportData::AddBrushFace(Face& f)\r
+{\r
+       std::string shadername;\r
+       GetShaderNameFromShaderPath(f.GetShader(), shadername);\r
+       \r
+       // faces mit materials auf der ignoreliste ignorieren\r
+       if(ignorelist.find(shadername) != ignorelist.end())\r
+               return;\r
+               \r
+       if(mode == COLLAPSE_BY_MATERIAL)\r
+       {\r
+               // find a group for this material\r
+               current = 0;\r
+               const std::list<group>::iterator end(groups.end());\r
+               for(std::list<group>::iterator it(groups.begin()); it != end; ++it)\r
+               {\r
+                       if(it->name == shadername)\r
+                               current = &(*it);\r
+               }\r
+               \r
+               // no group found, create one\r
+               if(!current)\r
+               {\r
+                       groups.push_back(group());\r
+                       current = &groups.back();\r
+                       current->name = shadername;\r
+               }\r
+       }\r
+       \r
+       ASSERT_NOTNULL(current);\r
+       \r
+       // add face to current group\r
+       current->faces.push_back(&f);\r
+       \r
+#ifdef _DEBUG\r
+       globalOutputStream() << "Added Face to group " << current->name.c_str() << "\n";\r
+#endif\r
+}\r
+\r
+void ExportData::GetShaderNameFromShaderPath(const char* path, std::string& name)\r
+{\r
+       std::string tmp(path);\r
+\r
+       size_t last_slash = tmp.find_last_of("/");\r
+       \r
+       if(last_slash != std::string::npos && last_slash == (tmp.length() - 1))\r
+               name = path;\r
+       else\r
+               name = tmp.substr(last_slash + 1, tmp.length() - last_slash);\r
+               \r
+       globalOutputStream() << "Last: " << last_slash << " " << "lenght: " << (const unsigned int)tmp.length() << "Name: " << name.c_str() << "\n";\r
+}\r
+\r
+/*\r
+       Exporter writing facedata as wavefront object\r
+*/\r
+class ExportDataAsWavefront : public ExportData\r
+{\r
+public:\r
+       ExportDataAsWavefront(const std::set<std::string>& _ignorelist, collapsemode _mode)\r
+               : ExportData(_ignorelist, _mode)\r
+       {\r
+       }\r
+       \r
+       bool WriteToFile(const std::string& path) const;\r
+};\r
+\r
+bool ExportDataAsWavefront::WriteToFile(const std::string& path) const\r
+{\r
+       TextFileOutputStream out(path.c_str());\r
+       \r
+       if(out.failed())\r
+       {\r
+               globalErrorStream() << "Unable to open file\n";\r
+               return false;\r
+       }\r
+               \r
+       out << "# Wavefront Objectfile exported with radiants brushexport plugin 2.0 by Thomas 'namespace' Nitschke, spam@codecreator.net\n\n";\r
+       \r
+       unsigned int vertex_count = 0;\r
+\r
+       const std::list<ExportData::group>::const_iterator gend(groups.end());\r
+       for(std::list<ExportData::group>::const_iterator git(groups.begin()); git != gend; ++git)\r
+       {\r
+               const std::list<const Face*>::const_iterator end(git->faces.end());\r
+               \r
+               // submesh starts here\r
+               out << "\ng " << git->name.c_str() << "\n";\r
+               \r
+               for(std::list<const Face*>::const_iterator it(git->faces.begin()); it != end; ++it)\r
+               {\r
+                       const Winding& w((*it)->getWinding());\r
+                       \r
+                       // vertices\r
+                       for(size_t i = 0; i < w.numpoints; ++i)\r
+                       out << "v " << w[i].vertex.x() << " " << w[i].vertex.y() << " " << w[i].vertex.z() << "\n";\r
+               }\r
+               out << "\n";    \r
+               \r
+               for(std::list<const Face*>::const_iterator it(git->faces.begin()); it != end; ++it)\r
+               {\r
+                       const Winding& w((*it)->getWinding());\r
+                       \r
+                       // texcoords\r
+                       for(size_t i = 0; i < w.numpoints; ++i)\r
+                       out << "vt " << w[i].texcoord.x() << " " << w[i].texcoord.y() << "\n";\r
+               }\r
+               \r
+               for(std::list<const Face*>::const_iterator it(git->faces.begin()); it != end; ++it)\r
+               {\r
+                       const Winding& w((*it)->getWinding());\r
+                       \r
+                       // faces\r
+                       out << "\nf";\r
+                       for(size_t i = 0; i < w.numpoints; ++i, ++vertex_count)\r
+                       {\r
+                               out << " " << vertex_count+1 << "/" << vertex_count+1;\r
+                       }\r
+               }\r
+               out << "\n";\r
+       }\r
+       \r
+       return true;\r
+}\r
+\r
+\r
+class ForEachFace : public BrushVisitor\r
+{\r
+public:\r
+       ForEachFace(ExportData& _exporter)\r
+               : exporter(_exporter)\r
+       {}\r
+       \r
+       void visit(Face& face) const\r
+       {\r
+               exporter.AddBrushFace(face);\r
+       }\r
+       \r
+private:\r
+       ExportData& exporter;\r
+};\r
+\r
+class ForEachSelected : public SelectionSystem::Visitor\r
+{\r
+public:\r
+       ForEachSelected(ExportData& _exporter)\r
+               : exporter(_exporter)\r
+       {}\r
+       \r
+       void visit(scene::Instance& instance) const\r
+    {\r
+               BrushInstance* bptr = InstanceTypeCast<BrushInstance>::cast(instance);\r
+               if(bptr)\r
+               {\r
+                       Brush& brush(bptr->getBrush());\r
+                       \r
+                       exporter.BeginBrush(brush);\r
+                               ForEachFace face_vis(exporter);\r
+                               brush.forEachFace(face_vis);\r
+                       exporter.EndBrush();\r
+               }\r
+    }\r
+    \r
+private:\r
+       ExportData& exporter;\r
+};\r
\r
+bool ExportSelection(const std::set<std::string>& ignorelist, collapsemode m, const std::string& path)\r
+{\r
+       ExportDataAsWavefront exporter(ignorelist, m);\r
+       \r
+       ForEachSelected vis(exporter);\r
+       GlobalSelectionSystem().foreachSelected(vis);\r
+       \r
+       return exporter.WriteToFile(path);\r
+}\r
diff --git a/contrib/brushexport/export.h b/contrib/brushexport/export.h
new file mode 100644 (file)
index 0000000..76f937b
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef EXPORT_H\r
+#define EXPORT_H\r
+#include <set>\r
+#include <string>\r
+\r
+enum collapsemode\r
+{\r
+       COLLAPSE_ALL,\r
+       COLLAPSE_BY_MATERIAL,\r
+       COLLAPSE_NONE\r
+};\r
+\r
+bool ExportSelection(const std::set<std::string>& ignorelist, collapsemode m, const std::string& path);\r
+\r
+#endif \r
diff --git a/contrib/brushexport/interface.cpp b/contrib/brushexport/interface.cpp
new file mode 100644 (file)
index 0000000..dd40f3b
--- /dev/null
@@ -0,0 +1,212 @@
+#include <gdk/gdkkeysyms.h>\r
+#include <gtk/gtk.h>\r
+\r
+#include "debugging/debugging.h"\r
+#include "callbacks.h"\r
+#include "support.h"\r
+\r
+#define GLADE_HOOKUP_OBJECT(component,widget,name) \\r
+  g_object_set_data_full (G_OBJECT (component), name, \\r
+    gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)\r
+\r
+#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \\r
+  g_object_set_data (G_OBJECT (component), name, widget)\r
+\r
+// created by glade\r
+GtkWidget*\r
+create_w_plugplug2 (void)\r
+{\r
+  GtkWidget *w_plugplug2;\r
+  GtkWidget *vbox1;\r
+  GtkWidget *hbox2;\r
+  GtkWidget *vbox4;\r
+  GtkWidget *r_collapse;\r
+  GSList *r_collapse_group = NULL;\r
+  GtkWidget *r_collapsebymaterial;\r
+  GtkWidget *r_nocollapse;\r
+  GtkWidget *vbox3;\r
+  GtkWidget *b_export;\r
+  GtkWidget *b_close;\r
+  GtkWidget *vbox2;\r
+  GtkWidget *label1;\r
+  GtkWidget *scrolledwindow1;\r
+  GtkWidget *t_materialist;\r
+  GtkWidget *ed_materialname;\r
+  GtkWidget *hbox1;\r
+  GtkWidget *b_addmaterial;\r
+  GtkWidget *b_removematerial;\r
+\r
+  w_plugplug2 = gtk_window_new (GTK_WINDOW_TOPLEVEL);\r
+  gtk_widget_set_name (w_plugplug2, "w_plugplug2");\r
+  gtk_window_set_title (GTK_WINDOW (w_plugplug2), "BrushExport-Plugin 2.0 by namespace");\r
+  gtk_window_set_position (GTK_WINDOW (w_plugplug2), GTK_WIN_POS_CENTER);\r
+  gtk_window_set_destroy_with_parent (GTK_WINDOW (w_plugplug2), TRUE);\r
+\r
+  vbox1 = gtk_vbox_new (FALSE, 0);\r
+  gtk_widget_set_name (vbox1, "vbox1");\r
+  gtk_widget_show (vbox1);\r
+  gtk_container_add (GTK_CONTAINER (w_plugplug2), vbox1);\r
+  gtk_container_set_border_width (GTK_CONTAINER (vbox1), 5);\r
+\r
+  hbox2 = gtk_hbox_new (TRUE, 5);\r
+  gtk_widget_set_name (hbox2, "hbox2");\r
+  gtk_widget_show (hbox2);\r
+  gtk_box_pack_start (GTK_BOX (vbox1), hbox2, FALSE, FALSE, 0);\r
+  gtk_container_set_border_width (GTK_CONTAINER (hbox2), 5);\r
+\r
+  vbox4 = gtk_vbox_new (TRUE, 0);\r
+  gtk_widget_set_name (vbox4, "vbox4");\r
+  gtk_widget_show (vbox4);\r
+  gtk_box_pack_start (GTK_BOX (hbox2), vbox4, TRUE, FALSE, 0);\r
+\r
+  r_collapse = gtk_radio_button_new_with_mnemonic (NULL, "Collapse mesh");\r
+  gtk_widget_set_name (r_collapse, "r_collapse");\r
+  gtk_widget_show (r_collapse);\r
+  gtk_box_pack_start (GTK_BOX (vbox4), r_collapse, FALSE, FALSE, 0);\r
+  gtk_radio_button_set_group (GTK_RADIO_BUTTON (r_collapse), r_collapse_group);\r
+  r_collapse_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (r_collapse));\r
+\r
+  r_collapsebymaterial = gtk_radio_button_new_with_mnemonic (NULL, "Collapse by material");\r
+  gtk_widget_set_name (r_collapsebymaterial, "r_collapsebymaterial");\r
+  gtk_widget_show (r_collapsebymaterial);\r
+  gtk_box_pack_start (GTK_BOX (vbox4), r_collapsebymaterial, FALSE, FALSE, 0);\r
+  gtk_radio_button_set_group (GTK_RADIO_BUTTON (r_collapsebymaterial), r_collapse_group);\r
+  r_collapse_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (r_collapsebymaterial));\r
+\r
+  r_nocollapse = gtk_radio_button_new_with_mnemonic (NULL, "Don't collapse");\r
+  gtk_widget_set_name (r_nocollapse, "r_nocollapse");\r
+  gtk_widget_show (r_nocollapse);\r
+  gtk_box_pack_start (GTK_BOX (vbox4), r_nocollapse, FALSE, FALSE, 0);\r
+  gtk_radio_button_set_group (GTK_RADIO_BUTTON (r_nocollapse), r_collapse_group);\r
+  r_collapse_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (r_nocollapse));\r
+\r
+  vbox3 = gtk_vbox_new (FALSE, 0);\r
+  gtk_widget_set_name (vbox3, "vbox3");\r
+  gtk_widget_show (vbox3);\r
+  gtk_box_pack_start (GTK_BOX (hbox2), vbox3, FALSE, FALSE, 0);\r
+\r
+  b_export = gtk_button_new_from_stock ("gtk-save");\r
+  gtk_widget_set_name (b_export, "b_export");\r
+  gtk_widget_show (b_export);\r
+  gtk_box_pack_start (GTK_BOX (vbox3), b_export, TRUE, FALSE, 0);\r
+  gtk_container_set_border_width (GTK_CONTAINER (b_export), 5);\r
+\r
+  b_close = gtk_button_new_from_stock ("gtk-cancel");\r
+  gtk_widget_set_name (b_close, "b_close");\r
+  gtk_widget_show (b_close);\r
+  gtk_box_pack_start (GTK_BOX (vbox3), b_close, TRUE, FALSE, 0);\r
+  gtk_container_set_border_width (GTK_CONTAINER (b_close), 5);\r
+\r
+  vbox2 = gtk_vbox_new (FALSE, 5);\r
+  gtk_widget_set_name (vbox2, "vbox2");\r
+  gtk_widget_show (vbox2);\r
+  gtk_box_pack_start (GTK_BOX (vbox1), vbox2, TRUE, TRUE, 0);\r
+  gtk_container_set_border_width (GTK_CONTAINER (vbox2), 2);\r
+\r
+  label1 = gtk_label_new ("Ignored materials:");\r
+  gtk_widget_set_name (label1, "label1");\r
+  gtk_widget_show (label1);\r
+  gtk_box_pack_start (GTK_BOX (vbox2), label1, FALSE, FALSE, 0);\r
+\r
+  scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);\r
+  gtk_widget_set_name (scrolledwindow1, "scrolledwindow1");\r
+  gtk_widget_show (scrolledwindow1);\r
+  gtk_box_pack_start (GTK_BOX (vbox2), scrolledwindow1, TRUE, TRUE, 0);\r
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);\r
+  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_SHADOW_IN);\r
+\r
+  t_materialist = gtk_tree_view_new ();\r
+  gtk_widget_set_name (t_materialist, "t_materialist");\r
+  gtk_widget_show (t_materialist);\r
+  gtk_container_add (GTK_CONTAINER (scrolledwindow1), t_materialist);\r
+  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (t_materialist), FALSE);\r
+  gtk_tree_view_set_enable_search (GTK_TREE_VIEW (t_materialist), FALSE);\r
+\r
+  ed_materialname = gtk_entry_new ();\r
+  gtk_widget_set_name (ed_materialname, "ed_materialname");\r
+  gtk_widget_show (ed_materialname);\r
+  gtk_box_pack_start (GTK_BOX (vbox2), ed_materialname, FALSE, FALSE, 0);\r
+\r
+  hbox1 = gtk_hbox_new (TRUE, 0);\r
+  gtk_widget_set_name (hbox1, "hbox1");\r
+  gtk_widget_show (hbox1);\r
+  gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0);\r
+\r
+  b_addmaterial = gtk_button_new_from_stock ("gtk-add");\r
+  gtk_widget_set_name (b_addmaterial, "b_addmaterial");\r
+  gtk_widget_show (b_addmaterial);\r
+  gtk_box_pack_start (GTK_BOX (hbox1), b_addmaterial, FALSE, FALSE, 0);\r
+\r
+  b_removematerial = gtk_button_new_from_stock ("gtk-remove");\r
+  gtk_widget_set_name (b_removematerial, "b_removematerial");\r
+  gtk_widget_show (b_removematerial);\r
+  gtk_box_pack_start (GTK_BOX (hbox1), b_removematerial, FALSE, FALSE, 0);\r
+\r
+  using namespace callbacks;\r
+  g_signal_connect(G_OBJECT(w_plugplug2), "destroy", G_CALLBACK(OnDestroy), NULL);\r
+  g_signal_connect_swapped(G_OBJECT(b_close), "clicked", G_CALLBACK (OnDestroy), NULL);\r
+  \r
+  g_signal_connect ((gpointer) b_export, "clicked", G_CALLBACK (OnExportClicked), NULL);\r
+  g_signal_connect ((gpointer) b_addmaterial, "clicked", G_CALLBACK (OnAddMaterial), NULL);\r
+  g_signal_connect ((gpointer) b_removematerial, "clicked", G_CALLBACK (OnRemoveMaterial), NULL);\r
+\r
+  /* Store pointers to all widgets, for use by lookup_widget(). */\r
+  GLADE_HOOKUP_OBJECT_NO_REF (w_plugplug2, w_plugplug2, "w_plugplug2");\r
+  GLADE_HOOKUP_OBJECT (w_plugplug2, vbox1, "vbox1");\r
+  GLADE_HOOKUP_OBJECT (w_plugplug2, hbox2, "hbox2");\r
+  GLADE_HOOKUP_OBJECT (w_plugplug2, vbox4, "vbox4");\r
+  GLADE_HOOKUP_OBJECT (w_plugplug2, r_collapse, "r_collapse");\r
+  GLADE_HOOKUP_OBJECT (w_plugplug2, r_collapsebymaterial, "r_collapsebymaterial");\r
+  GLADE_HOOKUP_OBJECT (w_plugplug2, r_nocollapse, "r_nocollapse");\r
+  GLADE_HOOKUP_OBJECT (w_plugplug2, vbox3, "vbox3");\r
+  GLADE_HOOKUP_OBJECT (w_plugplug2, b_export, "b_export");\r
+  GLADE_HOOKUP_OBJECT (w_plugplug2, b_close, "b_close");\r
+  GLADE_HOOKUP_OBJECT (w_plugplug2, vbox2, "vbox2");\r
+  GLADE_HOOKUP_OBJECT (w_plugplug2, label1, "label1");\r
+  GLADE_HOOKUP_OBJECT (w_plugplug2, scrolledwindow1, "scrolledwindow1");\r
+  GLADE_HOOKUP_OBJECT (w_plugplug2, t_materialist, "t_materialist");\r
+  GLADE_HOOKUP_OBJECT (w_plugplug2, ed_materialname, "ed_materialname");\r
+  GLADE_HOOKUP_OBJECT (w_plugplug2, hbox1, "hbox1");\r
+  GLADE_HOOKUP_OBJECT (w_plugplug2, b_addmaterial, "b_addmaterial");\r
+  GLADE_HOOKUP_OBJECT (w_plugplug2, b_removematerial, "b_removematerial");\r
+\r
+  return w_plugplug2;\r
+}\r
+\r
+// global main window, is 0 when not created\r
+GtkWidget* g_brushexp_window = 0;\r
+\r
+// spawn plugin window (and make sure it got destroyed first or never created)\r
+void CreateWindow(void)\r
+{\r
+       ASSERT_NOTNULL(!g_brushexp_window);\r
+\r
+    GtkWidget* wnd = create_w_plugplug2();\r
+\r
+       // column & renderer\r
+       GtkTreeViewColumn* col = gtk_tree_view_column_new();\r
+       gtk_tree_view_column_set_title(col, "materials");\r
+       gtk_tree_view_append_column(GTK_TREE_VIEW(lookup_widget(wnd, "t_materialist")), col);\r
+       GtkCellRenderer* renderer = gtk_cell_renderer_text_new();\r
+       gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(lookup_widget(wnd, "t_materialist")), -1, "", renderer, "text", 0, NULL);\r
+       \r
+       // list store\r
+       GtkListStore* ignorelist = gtk_list_store_new(1, G_TYPE_STRING);\r
+       gtk_tree_view_set_model(GTK_TREE_VIEW(lookup_widget(wnd, "t_materialist")), GTK_TREE_MODEL(ignorelist));\r
+       g_object_unref(ignorelist);\r
+       \r
+       gtk_widget_show_all(wnd);\r
+       g_brushexp_window = wnd;\r
+}\r
+\r
+void DestroyWindow(void)\r
+{\r
+       ASSERT_NOTNULL(g_brushexp_window);\r
+       gtk_widget_destroy(g_brushexp_window);\r
+       g_brushexp_window = 0;\r
+}\r
+\r
+bool IsWindowOpen(void)\r
+{\r
+       return g_brushexp_window != 0;\r
+}\r
index 8954473..1b5e7c1 100644 (file)
@@ -24,6 +24,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include "qerplugin.h"\r
 \r
 #include <gtk/gtk.h>\r
+#include <gtk/gtktreeview.h>\r
 \r
 #include "debugging/debugging.h"\r
 #include "string/string.h"\r
@@ -39,109 +40,18 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 #include "ifilesystem.h"\r
 #include "ifiletypes.h"\r
 \r
-#include "../../radiant/brush.h"\r
+#include "support.h"\r
+\r
+#include "typesystem.h"\r
+\r
+void CreateWindow (void);\r
+void DestroyWindow(void);\r
+bool IsWindowOpen(void);\r
 \r
 namespace BrushExport\r
-{ \r
+{\r
   GtkWindow* g_mainwnd;\r
   \r
-  class CExportFormatWavefront : public BrushVisitor\r
-  {\r
-    TextFileOutputStream& m_file;\r
-\r
-    StringOutputStream vertexbuffer;\r
-    StringOutputStream texcoordbuffer;\r
-    StringOutputStream facebuffer;\r
-    \r
-    size_t vertices;\r
-    size_t exported;\r
-    \r
-  public:\r
-    \r
-    CExportFormatWavefront(TextFileOutputStream& file)\r
-        : m_file(file)\r
-    {\r
-      exported = 0;\r
-      vertices = 0;\r
-    }\r
-    \r
-    virtual ~CExportFormatWavefront(void) {}\r
-    \r
-    void visit(scene::Instance& instance)\r
-    {\r
-      BrushInstance* bptr = InstanceTypeCast<BrushInstance>::cast(instance);\r
-      if(bptr)\r
-      {\r
-        Brush& brush(bptr->getBrush());\r
-        \r
-        m_file << "\ng " << brush.name() << exported << "\n";\r
-        \r
-        brush.forEachFace(*this);\r
-    \r
-        m_file << vertexbuffer.c_str() << "\n";\r
-        m_file << texcoordbuffer.c_str();\r
-        m_file << facebuffer.c_str() << "\n";\r
-        \r
-        vertexbuffer.clear();\r
-        texcoordbuffer.clear();\r
-        facebuffer.clear();\r
-        ++exported;\r
-      }\r
-    }\r
-   \r
-    void visit(Face& face) const\r
-    {\r
-      // cast the stupid const away\r
-      const_cast<CExportFormatWavefront*>(this)->visit(face);\r
-    }\r
-    \r
-    void visit(Face& face)\r
-    {\r
-      size_t v_start = vertices;\r
-      const Winding& w(face.getWinding());\r
-      for(size_t i = 0; i < w.numpoints; ++i)\r
-      {\r
-        vertexbuffer << "v " << w[i].vertex.x() << " " << w[i].vertex.y() << " " << w[i].vertex.z() << "\n";\r
-        texcoordbuffer << "vt " << w[i].texcoord.x() << " " << w[i].texcoord.y() << "\n";\r
-        ++vertices;\r
-      }\r
-      \r
-      facebuffer << "\nf";\r
-      for(size_t i = v_start; i < vertices; ++i)\r
-        facebuffer << " " << i+1 << "/" << i+1;\r
-    }\r
-  };\r
-  \r
-  /**\r
-    Exporterclass which will pass every visit-call\r
-    to a special formatexporter.\r
-  */\r
-  template<class TExporterFormat>\r
-  class CExporter : public SelectionSystem::Visitor\r
-  {\r
-  public:\r
-    CExporter(TextFileOutputStream& file)\r
-      : m_exporter(file)\r
-    {}\r
-    \r
-    virtual ~CExporter(void) {}\r
-    \r
-    void visit(scene::Instance& instance) const\r
-    {\r
-      m_exporter.visit(instance);\r
-    }\r
-    \r
-  private:\r
-    mutable TExporterFormat m_exporter;\r
-  };\r
-  \r
-  template<class T>\r
-  void export_selected(TextFileOutputStream& file)\r
-  {\r
-    CExporter<T> exporter(file);\r
-    GlobalSelectionSystem().foreachSelected(exporter);\r
-  }\r
-\r
   const char* init(void* hApp, void* pMainWidget)\r
   {\r
     g_mainwnd = (GtkWindow*)pMainWidget;\r
@@ -165,31 +75,19 @@ namespace BrushExport
   {\r
     if(string_equal(command, "About"))\r
     {\r
-      GlobalRadiant().m_pfnMessageBox(GTK_WIDGET(g_mainwnd), "Brushexport plugin v 1.0 by namespace (www.codecreator.net)\n"\r
+      GlobalRadiant().m_pfnMessageBox(GTK_WIDGET(g_mainwnd), "Brushexport plugin v 2.0 by namespace (www.codecreator.net)\n"\r
                                         "Enjoy!\n\nSend feedback to spam@codecreator.net", "About me...",\r
                                         eMB_OK,\r
                                         eMB_ICONDEFAULT);\r
     }\r
     else if(string_equal(command, "Export selected as Wavefront Object"))\r
     {\r
-      if(const char* path = GlobalRadiant().m_pfnFileDialog(GTK_WIDGET(g_mainwnd), false, "Save as Obj", 0, 0))\r
-      {\r
-        TextFileOutputStream file(path); \r
-        if(file.failed())\r
-        {\r
-          GlobalRadiant().m_pfnMessageBox(GTK_WIDGET(g_mainwnd), "Unable to write to file", "Error",\r
-                                        eMB_OK,\r
-                                        eMB_ICONERROR);\r
-        }\r
-        else\r
-        {\r
-          export_selected<CExportFormatWavefront>(file);\r
-        }\r
-      }\r
+      if(IsWindowOpen())\r
+           DestroyWindow();\r
+      CreateWindow();\r
     }\r
   }\r
-  \r
-} // namespace\r
+}\r
 \r
 class BrushExportDependencies :\r
   public GlobalRadiantModuleRef,\r
@@ -210,7 +108,7 @@ class BrushExportModule : public TypeSystemRef
   _QERPluginTable m_plugin;\r
 public:\r
   typedef _QERPluginTable Type;\r
-  STRING_CONSTANT(Name, "brushexport");\r
+  STRING_CONSTANT(Name, "brushexport2");\r
 \r
   BrushExportModule()\r
   {\r
diff --git a/contrib/brushexport/support.cpp b/contrib/brushexport/support.cpp
new file mode 100644 (file)
index 0000000..736c6b2
--- /dev/null
@@ -0,0 +1,31 @@
+#include <gtk/gtk.h>\r
+\r
+#include "support.h"\r
+\r
+GtkWidget*\r
+lookup_widget                          (GtkWidget       *widget,\r
+                                        const gchar     *widget_name)\r
+{\r
+  GtkWidget *parent, *found_widget;\r
+\r
+  for (;;)\r
+    {\r
+      if (GTK_IS_MENU (widget))\r
+        parent = gtk_menu_get_attach_widget (GTK_MENU (widget));\r
+      else\r
+        parent = widget->parent;\r
+      if (!parent)\r
+        parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "GladeParentKey");\r
+      if (parent == NULL)\r
+        break;\r
+      widget = parent;\r
+    }\r
+\r
+  found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget),\r
+                                                 widget_name);\r
+  if (!found_widget)\r
+    g_warning ("Widget not found: %s", widget_name);\r
+  return found_widget;\r
+}\r
+\r
+\r
diff --git a/contrib/brushexport/support.h b/contrib/brushexport/support.h
new file mode 100644 (file)
index 0000000..d1cce97
--- /dev/null
@@ -0,0 +1,24 @@
+/*\r
+ * DO NOT EDIT THIS FILE - it is generated by Glade.\r
+ */\r
+\r
+#ifdef HAVE_CONFIG_H\r
+#  include <config.h>\r
+#endif\r
+\r
+#include <gtk/gtk.h>\r
+\r
+/*\r
+ * Public Functions.\r
+ */\r
+\r
+/*\r
+ * This function returns a widget in a component created by Glade.\r
+ * Call it with the toplevel widget in the component (i.e. a window/dialog),\r
+ * or alternatively any widget in the component, and the name of the widget\r
+ * you want returned.\r
+ */\r
+GtkWidget*  lookup_widget              (GtkWidget       *widget,\r
+                                        const gchar     *widget_name);\r
+\r
+\r
index 80900b1..41aa9bf 100644 (file)
@@ -27,7 +27,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #include "string/string.h"
 #include "modulesystem/singletonmodule.h"
-
+#include "typesystem.h"
 
 namespace Sample
 {
@@ -61,7 +61,7 @@ namespace Sample
 
 } // namespace
 
-class SamplePluginModule
+class SamplePluginModule : public TypeSystemRef
 {
   _QERPluginTable m_plugin;
 public:
index 9e882b1..0c054b4 100644 (file)
@@ -76,6 +76,7 @@ void CameraMovedNotify()
 struct camwindow_globals_private_t
 {
   int m_nMoveSpeed;
+  bool m_bCamLinkSpeed;
   int m_nAngleSpeed;
   bool m_bCamInverseMouse;
   bool m_bCamDiscrete;
@@ -84,6 +85,7 @@ struct camwindow_globals_private_t
 
   camwindow_globals_private_t() :
     m_nMoveSpeed(100),
+    m_bCamLinkSpeed(true),
     m_nAngleSpeed(3),
     m_bCamInverseMouse(false),
     m_bCamDiscrete(true),
@@ -286,7 +288,12 @@ void Camera_FreeMove(camera_t& camera, int dx, int dy)
   // free strafe mode, toggled by the ctrl key with optional shift for forward movement
   if(camera.m_strafe)
   {
-         const float strafespeed = 0.65f;
+    float strafespeed = 0.65f;
+
+    if(g_camwindow_globals_private.m_bCamLinkSpeed)
+    {
+      strafespeed = (float)g_camwindow_globals_private.m_nMoveSpeed / 100;
+    }
 
          camera.origin -= camera.vright * strafespeed * dx;
          if(camera.m_strafe_forward)
@@ -558,6 +565,9 @@ typedef ReferenceCaller<camera_t, &Camera_MoveDown_KeyUp> FreeMoveCameraMoveDown
 
 #define SPEED_MOVE 32
 #define SPEED_TURN 22.5
+#define MIN_CAM_SPEED 10
+#define MAX_CAM_SPEED 610
+#define CAM_SPEED_STEP 50
 
 void Camera_MoveForward_Discrete(camera_t& camera)
 {
@@ -1803,6 +1813,9 @@ void CamWnd_registerShortcuts()
   {
     command_connect_accelerator("TogglePreview");
   }
+
+  command_connect_accelerator("CameraSpeedInc");
+  command_connect_accelerator("CameraSpeedDec");
 }
 
 
@@ -1939,7 +1952,8 @@ typedef FreeCaller1<const IntImportCallback&, RenderModeExport> RenderModeExport
 
 void Camera_constructPreferences(PreferencesPage& page)
 {
-  page.appendSlider("Movement Speed", g_camwindow_globals_private.m_nMoveSpeed, TRUE, 0, 0, 100, 50, 300, 1, 10, 10);
+  page.appendSlider("Movement Speed", g_camwindow_globals_private.m_nMoveSpeed, TRUE, 0, 0, 100, MIN_CAM_SPEED, MAX_CAM_SPEED, 1, 10, 10);
+  page.appendCheckBox("", "Link strafe speed to movement speed", g_camwindow_globals_private.m_bCamLinkSpeed);
   page.appendSlider("Rotation Speed", g_camwindow_globals_private.m_nAngleSpeed, TRUE, 0, 0, 3, 1, 180, 1, 10, 10);
   page.appendCheckBox("", "Invert mouse vertical axis", g_camwindow_globals_private.m_bCamInverseMouse);
   page.appendCheckBox(
@@ -1992,6 +2006,26 @@ void Camera_registerPreferencesPage()
 
 typedef FreeCaller1<bool, CamWnd_Move_Discrete_Import> CamWndMoveDiscreteImportCaller;
 
+void CameraSpeed_increase()
+{
+  if(g_camwindow_globals_private.m_nMoveSpeed <= (MAX_CAM_SPEED - CAM_SPEED_STEP - 10))
+  {
+    g_camwindow_globals_private.m_nMoveSpeed += CAM_SPEED_STEP;
+  } else {
+    g_camwindow_globals_private.m_nMoveSpeed = MAX_CAM_SPEED - 10;
+  }
+}
+
+void CameraSpeed_decrease()
+{
+  if(g_camwindow_globals_private.m_nMoveSpeed >= (MIN_CAM_SPEED + CAM_SPEED_STEP))
+  {
+    g_camwindow_globals_private.m_nMoveSpeed -= CAM_SPEED_STEP;
+  } else {
+    g_camwindow_globals_private.m_nMoveSpeed = MIN_CAM_SPEED;
+  }
+}
+
 /// \brief Initialisation for things that have the same lifespan as this module.
 void CamWnd_Construct()
 {
@@ -2013,6 +2047,9 @@ void CamWnd_Construct()
     GlobalCommands_insert("TogglePreview", FreeCaller<CamWnd_TogglePreview>(), Accelerator(GDK_F3));
   }
 
+  GlobalCommands_insert("CameraSpeedInc", FreeCaller<CameraSpeed_increase>(), Accelerator(GDK_KP_Add, (GdkModifierType)GDK_SHIFT_MASK));
+  GlobalCommands_insert("CameraSpeedDec", FreeCaller<CameraSpeed_decrease>(), Accelerator(GDK_KP_Subtract, (GdkModifierType)GDK_SHIFT_MASK));
+
   GlobalShortcuts_insert("CameraForward", Accelerator(GDK_Up));
   GlobalShortcuts_insert("CameraBack", Accelerator(GDK_Down));
   GlobalShortcuts_insert("CameraLeft", Accelerator(GDK_Left));
@@ -2034,6 +2071,7 @@ void CamWnd_Construct()
 
   GlobalPreferenceSystem().registerPreference("ShowStats", BoolImportStringCaller(g_camwindow_globals_private.m_showStats), BoolExportStringCaller(g_camwindow_globals_private.m_showStats));
   GlobalPreferenceSystem().registerPreference("MoveSpeed", IntImportStringCaller(g_camwindow_globals_private.m_nMoveSpeed), IntExportStringCaller(g_camwindow_globals_private.m_nMoveSpeed));
+  GlobalPreferenceSystem().registerPreference("CamLinkSpeed", BoolImportStringCaller(g_camwindow_globals_private.m_bCamLinkSpeed), BoolExportStringCaller(g_camwindow_globals_private.m_bCamLinkSpeed));
   GlobalPreferenceSystem().registerPreference("AngleSpeed", IntImportStringCaller(g_camwindow_globals_private.m_nAngleSpeed), IntExportStringCaller(g_camwindow_globals_private.m_nAngleSpeed));
   GlobalPreferenceSystem().registerPreference("CamInverseMouse", BoolImportStringCaller(g_camwindow_globals_private.m_bCamInverseMouse), BoolExportStringCaller(g_camwindow_globals_private.m_bCamInverseMouse));
   GlobalPreferenceSystem().registerPreference("CamDiscrete", makeBoolStringImportCallback(CamWndMoveDiscreteImportCaller()), BoolExportStringCaller(g_camwindow_globals_private.m_bCamDiscrete));