From 70da7cd260952fcb8ddcff616de8cf248de978c9 Mon Sep 17 00:00:00 2001 From: spog Date: Sat, 3 Jun 2006 12:41:12 +0000 Subject: [PATCH] changed doom3 entity-create to add model key for brush-entities git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/trunk@75 8a3a26a2-13c4-0310-b231-cf6edde360e5 --- TODO | 7 +------ libs/traverselib.h | 37 +++++++++++++++++++++++++++++++++++++ radiant/entity.cpp | 5 +++++ 3 files changed, 43 insertions(+), 6 deletions(-) diff --git a/TODO b/TODO index 48f39efa..43a22d7e 100644 --- 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 diff --git a/libs/traverselib.h b/libs/traverselib.h index 0f513a0c..99d5c33d 100644 --- a/libs/traverselib.h +++ b/libs/traverselib.h @@ -355,5 +355,42 @@ public: } }; +template +class ReferenceSet +{ + typedef UniqueSet Values; + Values m_values; +public: + void attach(Type& t) + { + m_values.insert(&t); + } + void detach(Type& t) + { + m_values.erase(&t); + } + template + void forEach(const Functor& functor) + { + for(Values::iterator i = m_values.begin(); i != m_values.end(); ++i) + { + functor(*(*i)); + } + } +}; + +class TraversableObserverRelay : public ReferenceSet, public scene::Traversable::Observer +{ +public: + void insert(scene::Node& node) + { + forEach(TraversableObserverInsert(node)); + } + void erase(scene::Node& node) + { + forEach(TraversableObserverErase(node)); + } +}; + #endif diff --git a/radiant/entity.cpp b/radiant/entity.cpp index a68827e6..eb4dea50 100644 --- a/radiant/entity.cpp +++ b/radiant/entity.cpp @@ -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 -- 2.39.2