changed doom3 entity-create to add model key for brush-entities
authorspog <spog>
Sat, 3 Jun 2006 12:41:12 +0000 (12:41 +0000)
committerspog <spog>
Sat, 3 Jun 2006 12:41:12 +0000 (12:41 +0000)
git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/trunk@75 8a3a26a2-13c4-0310-b231-cf6edde360e5

TODO
libs/traverselib.h
radiant/entity.cpp

diff --git a/TODO b/TODO
index 48f39ef..43a22d7 100644 (file)
--- a/TODO
+++ b/TODO
@@ -12,12 +12,7 @@ Entity: creating a new entity with all the brushes of another entity selected re
 SConscript: build fails if SETUP=1
 GUI: can't use arrow keys to navigate in camera view when capslock is enabled
 GUI: screensaver causes: gdkgc-win32.c: line 905 (gdk_win32_hdc_get): assertion failed: (win32_gc->hdc == NULL)
-GUI: error! In camera window:
-  - press and release RightMouse
-  - press and hold LeftMouse
-  - press and release RightMouse
-  - press and release RightMouse
-  - release LeftMouse
+
 
 FEATURES
 
index 0f513a0..99d5c33 100644 (file)
@@ -355,5 +355,42 @@ public:
   }
 };
 
+template<typename Type>
+class ReferenceSet
+{
+  typedef UniqueSet<Type*> Values;
+  Values m_values;
+public:
+  void attach(Type& t)
+  {
+    m_values.insert(&t);
+  }
+  void detach(Type& t)
+  {
+    m_values.erase(&t);
+  }
+  template<typename Functor>
+  void forEach(const Functor& functor)
+  {
+    for(Values::iterator i = m_values.begin(); i != m_values.end(); ++i)
+    {
+      functor(*(*i));
+    }
+  }
+};
+
+class TraversableObserverRelay : public ReferenceSet<scene::Traversable::Observer>, public scene::Traversable::Observer
+{
+public:
+  void insert(scene::Node& node)
+  {
+    forEach(TraversableObserverInsert(node));
+  }
+  void erase(scene::Node& node)
+  {
+    forEach(TraversableObserverErase(node));
+  }
+};
+
 
 #endif
index a68827e..eb4dea5 100644 (file)
@@ -266,6 +266,11 @@ void Entity_createFromSelection(const char* name, const Vector3& origin)
   {
     Scene_parentSelectedBrushesToEntity(GlobalSceneGraph(), node);
     Scene_forEachChildSelectable(SelectableSetSelected(true), instance.path());
+
+    if (g_pGameDescription->mGameType == "doom3")
+    {
+      Node_getEntity(node)->setKeyValue("model", Node_getEntity(node)->getKeyValue("name"));
+    }
   }
 
   // tweaking: when right clic dropping a light entity, ask for light value in a custom dialog box