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
This commit is contained in:
spog 2006-06-03 12:41:12 +00:00
parent ecd25e066c
commit 70da7cd260
3 changed files with 43 additions and 6 deletions

7
TODO
View file

@ -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

View 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

View 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