]> git.xonotic.org Git - xonotic/netradiant.git/blob - radiant/entity.cpp
Merge commit '804c20949d43175179489ecbb1305752cfa17217' into garux-merge
[xonotic/netradiant.git] / radiant / entity.cpp
1 /*
2    Copyright (C) 1999-2006 Id Software, Inc. and contributors.
3    For a list of contributors, see the accompanying CONTRIBUTORS file.
4
5    This file is part of GtkRadiant.
6
7    GtkRadiant is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11
12    GtkRadiant is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with GtkRadiant; if not, write to the Free Software
19    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20  */
21
22 #include "entity.h"
23
24 #include "ientity.h"
25 #include "iselection.h"
26 #include "imodel.h"
27 #include "ifilesystem.h"
28 #include "iundo.h"
29 #include "editable.h"
30
31 #include "eclasslib.h"
32 #include "scenelib.h"
33 #include "os/path.h"
34 #include "os/file.h"
35 #include "stream/stringstream.h"
36 #include "stringio.h"
37
38 #include "gtkutil/filechooser.h"
39 #include "gtkmisc.h"
40 #include "select.h"
41 #include "map.h"
42 #include "preferences.h"
43 #include "preferencesystem.h"
44 #include "stringio.h"
45 #include "gtkdlgs.h"
46 #include "mainframe.h"
47 #include "qe3.h"
48 #include "commands.h"
49
50 #include "brushmanip.h"
51 #include "patchmanip.h"
52
53 #include "uilib/uilib.h"
54
55 struct entity_globals_t
56 {
57         Vector3 color_entity;
58
59         entity_globals_t() :
60                 color_entity( 0.0f, 0.0f, 0.0f ){
61         }
62 };
63
64 entity_globals_t g_entity_globals;
65
66 class EntitySetKeyValueSelected : public scene::Graph::Walker
67 {
68 const char* m_key;
69 const char* m_value;
70 public:
71 EntitySetKeyValueSelected( const char* key, const char* value )
72         : m_key( key ), m_value( value ){
73 }
74
75 bool pre( const scene::Path& path, scene::Instance& instance ) const {
76         return true;
77 }
78
79 void post( const scene::Path& path, scene::Instance& instance ) const {
80         Entity* entity = Node_getEntity( path.top() );
81         if ( entity != 0
82                  && ( instance.childSelected() || Instance_getSelectable( instance )->isSelected() ) ) {
83                 entity->setKeyValue( m_key, m_value );
84         }
85 }
86 };
87
88 class EntitySetClassnameSelected : public scene::Graph::Walker
89 {
90 const char* m_classname;
91 public:
92 EntitySetClassnameSelected( const char* classname )
93         : m_classname( classname ){
94 }
95 bool pre( const scene::Path& path, scene::Instance& instance ) const {
96         return true;
97 }
98 void post( const scene::Path& path, scene::Instance& instance ) const {
99         Entity* entity = Node_getEntity( path.top() );
100         if ( entity != 0
101                  && ( instance.childSelected() || Instance_getSelectable( instance )->isSelected() ) ) {
102                 NodeSmartReference node( GlobalEntityCreator().createEntity( GlobalEntityClassManager().findOrInsert( m_classname, node_is_group( path.top() ) ) ) );
103
104                 EntityCopyingVisitor visitor( *Node_getEntity( node ) );
105
106                 entity->forEachKeyValue( visitor );
107
108                 NodeSmartReference child( path.top().get() );
109                 NodeSmartReference parent( path.parent().get() );
110                 Node_getTraversable( parent )->erase( child );
111                 if ( Node_getTraversable( child ) != 0
112                          && Node_getTraversable( node ) != 0
113                          && node_is_group( node ) ) {
114                         parentBrushes( child, node );
115                 }
116                 Node_getTraversable( parent )->insert( node );
117         }
118 }
119 };
120
121 void Scene_EntitySetKeyValue_Selected( const char* key, const char* value ){
122         GlobalSceneGraph().traverse( EntitySetKeyValueSelected( key, value ) );
123 }
124
125 void Scene_EntitySetClassname_Selected( const char* classname ){
126         GlobalSceneGraph().traverse( EntitySetClassnameSelected( classname ) );
127 }
128
129
130 void Entity_ungroupSelected(){
131         if ( GlobalSelectionSystem().countSelected() < 1 ) {
132                 return;
133         }
134
135         UndoableCommand undo( "ungroupSelectedEntities" );
136
137         scene::Path world_path( makeReference( GlobalSceneGraph().root() ) );
138         world_path.push( makeReference( Map_FindOrInsertWorldspawn( g_map ) ) );
139
140         scene::Instance &instance = GlobalSelectionSystem().ultimateSelected();
141         scene::Path path = instance.path();
142
143         if ( !Node_isEntity( path.top() ) ) {
144                 path.pop();
145         }
146
147         if ( Node_getEntity( path.top() ) != 0
148                  && node_is_group( path.top() ) ) {
149                 if ( world_path.top().get_pointer() != path.top().get_pointer() ) {
150                         parentBrushes( path.top(), world_path.top() );
151                         Path_deleteTop( path );
152                 }
153         }
154 }
155
156
157 class EntityFindSelected : public scene::Graph::Walker
158 {
159 public:
160 mutable const scene::Path *groupPath;
161 mutable scene::Instance *groupInstance;
162
163 EntityFindSelected() : groupPath( 0 ), groupInstance( 0 ){
164 }
165
166 bool pre( const scene::Path& path, scene::Instance& instance ) const {
167         return true;
168 }
169
170 void post( const scene::Path& path, scene::Instance& instance ) const {
171         Entity* entity = Node_getEntity( path.top() );
172         if ( entity != 0
173                  && Instance_getSelectable( instance )->isSelected()
174                  && node_is_group( path.top() )
175                  && !groupPath ) {
176                 groupPath = &path;
177                 groupInstance = &instance;
178         }
179 }
180 };
181
182 class EntityGroupSelected : public scene::Graph::Walker
183 {
184 NodeSmartReference group, worldspawn;
185 //typedef std::pair<NodeSmartReference, NodeSmartReference> DeletionPair;
186 //Stack<DeletionPair> deleteme;
187 public:
188 EntityGroupSelected( const scene::Path &p ) : group( p.top().get() ), worldspawn( Map_FindOrInsertWorldspawn( g_map ) ){
189 }
190
191 bool pre( const scene::Path& path, scene::Instance& instance ) const {
192         return true;
193 }
194
195 void post( const scene::Path& path, scene::Instance& instance ) const {
196         Selectable *selectable = Instance_getSelectable( instance );
197         if ( selectable && selectable->isSelected() ) {
198                 Entity* entity = Node_getEntity( path.top() );
199                 if ( entity == 0 && Node_isPrimitive( path.top() ) ) {
200                         NodeSmartReference child( path.top().get() );
201                         NodeSmartReference parent( path.parent().get() );
202
203                         if ( path.size() >= 3 && parent != worldspawn ) {
204                                 NodeSmartReference parentparent( path[path.size() - 3].get() );
205
206                                 Node_getTraversable( parent )->erase( child );
207                                 Node_getTraversable( group )->insert( child );
208
209                                 if ( Node_getTraversable( parent )->empty() ) {
210                                         //deleteme.push(DeletionPair(parentparent, parent));
211                                         Node_getTraversable( parentparent )->erase( parent );
212                                 }
213                         }
214                         else
215                         {
216                                 Node_getTraversable( parent )->erase( child );
217                                 Node_getTraversable( group )->insert( child );
218                         }
219                 }
220         }
221 }
222 };
223
224 void Entity_groupSelected(){
225         if ( GlobalSelectionSystem().countSelected() < 1 ) {
226                 return;
227         }
228
229         UndoableCommand undo( "groupSelectedEntities" );
230
231         scene::Path world_path( makeReference( GlobalSceneGraph().root() ) );
232         world_path.push( makeReference( Map_FindOrInsertWorldspawn( g_map ) ) );
233
234         EntityFindSelected fse;
235         GlobalSceneGraph().traverse( fse );
236         if ( fse.groupPath ) {
237                 GlobalSceneGraph().traverse( EntityGroupSelected( *fse.groupPath ) );
238         }
239         else
240         {
241                 GlobalSceneGraph().traverse( EntityGroupSelected( world_path ) );
242         }
243 }
244
245
246 void Entity_connectSelected(){
247         if ( GlobalSelectionSystem().countSelected() == 2 ) {
248                 GlobalEntityCreator().connectEntities(
249                         GlobalSelectionSystem().penultimateSelected().path(),
250                         GlobalSelectionSystem().ultimateSelected().path(),
251                         0
252                         );
253         }
254         else
255         {
256                 globalErrorStream() << "entityConnectSelected: exactly two instances must be selected\n";
257         }
258 }
259
260 void Entity_killconnectSelected(){
261         if ( GlobalSelectionSystem().countSelected() == 2 ) {
262                 GlobalEntityCreator().connectEntities(
263                         GlobalSelectionSystem().penultimateSelected().path(),
264                         GlobalSelectionSystem().ultimateSelected().path(),
265                         1
266                         );
267         }
268         else
269         {
270                 globalErrorStream() << "entityKillConnectSelected: exactly two instances must be selected\n";
271         }
272 }
273
274 AABB Doom3Light_getBounds( const AABB& workzone ){
275         AABB aabb( workzone );
276
277         Vector3 defaultRadius( 300, 300, 300 );
278         if ( !string_parse_vector3( EntityClass_valueForKey( *GlobalEntityClassManager().findOrInsert( "light", false ), "light_radius" ), defaultRadius ) ) {
279                 globalErrorStream() << "Doom3Light_getBounds: failed to parse default light radius\n";
280         }
281
282         if ( aabb.extents[0] == 0 ) {
283                 aabb.extents[0] = defaultRadius[0];
284         }
285         if ( aabb.extents[1] == 0 ) {
286                 aabb.extents[1] = defaultRadius[1];
287         }
288         if ( aabb.extents[2] == 0 ) {
289                 aabb.extents[2] = defaultRadius[2];
290         }
291
292         if ( aabb_valid( aabb ) ) {
293                 return aabb;
294         }
295         return AABB( Vector3( 0, 0, 0 ), Vector3( 64, 64, 64 ) );
296 }
297
298 int g_iLastLightIntensity;
299
300 void Entity_createFromSelection( const char* name, const Vector3& origin ){
301 #if 0
302         if ( string_equal_nocase( name, "worldspawn" ) ) {
303                 ui::alert( MainFrame_getWindow( ), "Can't create an entity with worldspawn.", "info" );
304                 return;
305         }
306 #endif
307
308         EntityClass* entityClass = GlobalEntityClassManager().findOrInsert( name, true );
309
310         bool isModel = ( string_compare_nocase_n( name, "misc_", 5 ) == 0 && string_equal_nocase( name + string_length( name ) - 5, "model" ) ) // misc_*model (also misc_model)
311                                    || string_equal_nocase( name, "model_static" )
312                                    || ( GlobalSelectionSystem().countSelected() == 0 && string_equal_nocase( name, "func_static" ) && g_pGameDescription->mGameType == "doom3" );
313
314         bool brushesSelected = Scene_countSelectedBrushes( GlobalSceneGraph() ) != 0;
315
316         if ( !( entityClass->fixedsize || isModel ) && !brushesSelected ) {
317                 globalErrorStream() << "failed to create a group entity - no brushes are selected\n";
318                 return;
319         }
320
321         AABB workzone( aabb_for_minmax( Select_getWorkZone().d_work_min, Select_getWorkZone().d_work_max ) );
322
323
324         NodeSmartReference node( GlobalEntityCreator().createEntity( entityClass ) );
325
326         Node_getTraversable( GlobalSceneGraph().root() )->insert( node );
327
328         scene::Path entitypath( makeReference( GlobalSceneGraph().root() ) );
329         entitypath.push( makeReference( node.get() ) );
330         scene::Instance& instance = findInstance( entitypath );
331
332         if ( entityClass->fixedsize || ( isModel && !brushesSelected ) ) {
333                 Select_Delete();
334
335                 Transformable* transform = Instance_getTransformable( instance );
336                 if ( transform != 0 ) {
337                         transform->setType( TRANSFORM_PRIMITIVE );
338                         transform->setTranslation( origin );
339                         transform->freezeTransform();
340                 }
341
342                 GlobalSelectionSystem().setSelectedAll( false );
343
344                 Instance_setSelected( instance, true );
345         }
346         else
347         {
348                 if ( g_pGameDescription->mGameType == "doom3" ) {
349                         Node_getEntity( node )->setKeyValue( "model", Node_getEntity( node )->getKeyValue( "name" ) );
350                 }
351
352                 Scene_parentSelectedBrushesToEntity( GlobalSceneGraph(), node );
353                 Scene_forEachChildSelectable( SelectableSetSelected( true ), instance.path() );
354         }
355
356         // tweaking: when right clic dropping a light entity, ask for light value in a custom dialog box
357         // see SF bug 105383
358
359         if ( g_pGameDescription->mGameType == "hl" ) {
360                 // FIXME - Hydra: really we need a combined light AND color dialog for halflife.
361                 if ( string_equal_nocase( name, "light" )
362                          || string_equal_nocase( name, "light_environment" )
363                          || string_equal_nocase( name, "light_spot" ) ) {
364                         int intensity = g_iLastLightIntensity;
365
366                         if ( DoLightIntensityDlg( &intensity ) == eIDOK ) {
367                                 g_iLastLightIntensity = intensity;
368                                 char buf[30];
369                                 sprintf( buf, "255 255 255 %d", intensity );
370                                 Node_getEntity( node )->setKeyValue( "_light", buf );
371                         }
372                 }
373         }
374         else if ( string_equal_nocase( name, "light" ) ) {
375                 if ( g_pGameDescription->mGameType != "doom3" ) {
376                         int intensity = g_iLastLightIntensity;
377
378                         if ( DoLightIntensityDlg( &intensity ) == eIDOK ) {
379                                 g_iLastLightIntensity = intensity;
380                                 char buf[10];
381                                 sprintf( buf, "%d", intensity );
382                                 Node_getEntity( node )->setKeyValue( "light", buf );
383                         }
384                 }
385                 else if ( brushesSelected ) { // use workzone to set light position/size for doom3 lights, if there are brushes selected
386                         AABB bounds( Doom3Light_getBounds( workzone ) );
387                         StringOutputStream key( 64 );
388                         key << bounds.origin[0] << " " << bounds.origin[1] << " " << bounds.origin[2];
389                         Node_getEntity( node )->setKeyValue( "origin", key.c_str() );
390                         key.clear();
391                         key << bounds.extents[0] << " " << bounds.extents[1] << " " << bounds.extents[2];
392                         Node_getEntity( node )->setKeyValue( "light_radius", key.c_str() );
393                 }
394         }
395
396         if ( isModel ) {
397                 const char* model = misc_model_dialog(MainFrame_getWindow());
398                 if ( model != 0 ) {
399                         Node_getEntity( node )->setKeyValue( "model", model );
400                 }
401         }
402
403         if ( string_compare_nocase_n( name, "trigger_", 8 ) == 0 && brushesSelected ){
404                 const char* shader = g_pGameDescription->getKeyValue( "shader_trigger" );
405                 if ( shader && *shader ){
406                         Scene_PatchSetShader_Selected( GlobalSceneGraph(), shader );
407                         Scene_BrushSetShader_Selected( GlobalSceneGraph(), shader );
408                 }
409                 else{
410                         Scene_PatchSetShader_Selected( GlobalSceneGraph(), "textures/common/trigger" );
411                         Scene_BrushSetShader_Selected( GlobalSceneGraph(), "textures/common/trigger" );
412                 }
413         }
414 }
415
416 #if 0
417 bool DoNormalisedColor( Vector3& color ){
418         if ( !color_dialog( MainFrame_getWindow( ), color ) ) {
419                 return false;
420         }
421         /*
422         ** scale colors so that at least one component is at 1.0F
423         */
424
425         float largest = 0.0F;
426
427         if ( color[0] > largest ) {
428                 largest = color[0];
429         }
430         if ( color[1] > largest ) {
431                 largest = color[1];
432         }
433         if ( color[2] > largest ) {
434                 largest = color[2];
435         }
436
437         if ( largest == 0.0F ) {
438                 color[0] = 1.0F;
439                 color[1] = 1.0F;
440                 color[2] = 1.0F;
441         }
442         else
443         {
444                 float scaler = 1.0F / largest;
445
446                 color[0] *= scaler;
447                 color[1] *= scaler;
448                 color[2] *= scaler;
449         }
450
451         return true;
452 }
453 #endif
454
455 void NormalizeColor( Vector3& color ){
456         // scale colors so that at least one component is at 1.0F
457
458         float largest = 0.0F;
459
460         if ( color[0] > largest ) {
461                 largest = color[0];
462         }
463         if ( color[1] > largest ) {
464                 largest = color[1];
465         }
466         if ( color[2] > largest ) {
467                 largest = color[2];
468         }
469
470         if ( largest == 0.0F ) {
471                 color[0] = 1.0F;
472                 color[1] = 1.0F;
473                 color[2] = 1.0F;
474         }
475         else
476         {
477                 float scaler = 1.0F / largest;
478
479                 color[0] *= scaler;
480                 color[1] *= scaler;
481                 color[2] *= scaler;
482         }
483 }
484
485 void Entity_normalizeColor(){
486         if ( GlobalSelectionSystem().countSelected() != 0 ) {
487                 const scene::Path& path = GlobalSelectionSystem().ultimateSelected().path();
488                 Entity* entity = Node_getEntity( path.top() );
489
490                 if ( entity != 0 ) {
491                         const char* strColor = entity->getKeyValue( "_color" );
492                         if ( !string_empty( strColor ) ) {
493                                 Vector3 rgb;
494                                 if ( string_parse_vector3( strColor, rgb ) ) {
495                                         g_entity_globals.color_entity = rgb;
496                                         NormalizeColor( g_entity_globals.color_entity );
497
498                                         char buffer[128];
499                                         sprintf( buffer, "%g %g %g", g_entity_globals.color_entity[0],
500                                                          g_entity_globals.color_entity[1],
501                                                          g_entity_globals.color_entity[2] );
502
503                                         StringOutputStream command( 256 );
504                                         command << "entityNormalizeColour " << buffer;
505                                         UndoableCommand undo( command.c_str() );
506                                         Scene_EntitySetKeyValue_Selected( "_color", buffer );
507                                 }
508                         }
509                 }
510         }
511 }
512
513 void Entity_setColour(){
514         if ( GlobalSelectionSystem().countSelected() != 0 ) {
515                 const scene::Path& path = GlobalSelectionSystem().ultimateSelected().path();
516                 Entity* entity = Node_getEntity( path.top() );
517                 if ( entity != 0 ) {
518                         const char* strColor = entity->getKeyValue( "_color" );
519                         if ( !string_empty( strColor ) ) {
520                                 Vector3 rgb;
521                                 if ( string_parse_vector3( strColor, rgb ) ) {
522                                         g_entity_globals.color_entity = rgb;
523                                 }
524                         }
525                         if ( color_dialog( MainFrame_getWindow(), g_entity_globals.color_entity ) ) {
526                                 char buffer[128];
527                                 sprintf( buffer, "%g %g %g", g_entity_globals.color_entity[0],
528                                                  g_entity_globals.color_entity[1],
529                                                  g_entity_globals.color_entity[2] );
530
531                                 StringOutputStream command( 256 );
532                                 command << "entitySetColour " << buffer;
533                                 UndoableCommand undo( command.c_str() );
534                                 Scene_EntitySetKeyValue_Selected( "_color", buffer );
535                         }
536                 }
537         }
538 }
539
540 CopiedString g_strLastModelFolder = "";
541
542 const char *getLastModelFolderPath(){
543         if ( g_strLastModelFolder.empty() ) {
544                 GlobalPreferenceSystem().registerPreference( "LastModelFolder", make_property_string( g_strLastModelFolder ) );
545                 if ( g_strLastModelFolder.empty() ) {
546                         StringOutputStream buffer( 1024 );
547                         buffer << g_qeglobals.m_userGamePath.c_str() << "models/";
548                         if ( !file_readable( buffer.c_str() ) ) {
549                                 // just go to fsmain
550                                 buffer.clear();
551                                 buffer << g_qeglobals.m_userGamePath.c_str() << "/";
552                         }
553                         g_strLastModelFolder = buffer.c_str();
554                 }
555         }
556         return g_strLastModelFolder.c_str();
557 }
558
559 const char *misc_model_dialog( ui::Widget parent ){
560         const char *filename = parent.file_dialog( TRUE, "Choose Model", getLastModelFolderPath(), ModelLoader::Name() );
561
562         if ( filename != NULL ) {
563                 g_strLastModelFolder = g_path_get_dirname( filename );
564                 // use VFS to get the correct relative path
565                 const char *relative = path_make_relative( filename, GlobalFileSystem().findRoot( filename ) );
566                 if ( relative == filename ) {
567                         globalOutputStream() << "WARNING: could not extract the relative path, using full path instead\n";
568                 }
569                 return relative;
570         }
571         return 0;
572 }
573 /*
574 struct LightRadii {
575         static void Export(const EntityCreator &self, const Callback<void(bool)> &returnz) {
576                 returnz(self.getLightRadii());
577         }
578
579         static void Import(EntityCreator &self, bool value) {
580                 self.setLightRadii(value);
581         }
582 };
583
584 void Entity_constructPreferences( PreferencesPage& page ){
585         page.appendCheckBox(
586                         "Show", "Light Radii",
587                         make_property<LightRadii>(GlobalEntityCreator())
588         );
589 }
590 void Entity_constructPage( PreferenceGroup& group ){
591         PreferencesPage page( group.createPage( "Entities", "Entity Display Preferences" ) );
592         Entity_constructPreferences( page );
593 }
594
595 void Entity_registerPreferencesPage(){
596         PreferencesDialog_addDisplayPage( makeCallbackF(Entity_constructPage) );
597 }
598 */
599
600 void ShowLightRadiiToggle(){
601         GlobalEntityCreator().setLightRadii( !GlobalEntityCreator().getLightRadii() );
602         UpdateAllWindows();
603 }
604 typedef FreeCaller<void(), ShowLightRadiiToggle> ShowLightRadiiToggleCaller;
605 void ShowLightRadiiExport( const Callback<void(bool)> & importer ){
606         GlobalEntityCreator().getLightRadii();
607 }
608 typedef FreeCaller<void(const Callback<void(bool)> &), ShowLightRadiiExport> ShowLightRadiiExportCaller;
609
610 ShowLightRadiiExportCaller g_show_lightradii_caller;
611 Callback<void(const Callback<void(bool)> &)> g_show_lightradii_callback( g_show_lightradii_caller );
612 ToggleItem g_show_lightradii( g_show_lightradii_callback );
613
614 void Entity_constructMenu( ui::Menu menu ){
615         create_menu_item_with_mnemonic( menu, "_Regroup", "GroupSelection" );
616         create_menu_item_with_mnemonic( menu, "_Ungroup", "UngroupSelection" );
617         create_menu_item_with_mnemonic( menu, "_Connect", "ConnectSelection" );
618         if ( g_pGameDescription->mGameType == "nexuiz" ) {
619                 create_menu_item_with_mnemonic( menu, "_KillConnect", "KillConnectSelection" );
620         }
621         create_menu_item_with_mnemonic( menu, "_Select Color...", "EntityColor" );
622         create_menu_item_with_mnemonic( menu, "_Normalize Color", "NormalizeColor" );
623 }
624
625
626 void Entity_Construct(){
627         GlobalCommands_insert( "EntityColor", makeCallbackF(Entity_setColour), Accelerator( 'K' ) );
628         GlobalCommands_insert( "NormalizeColor", makeCallbackF(Entity_normalizeColor) );
629         GlobalCommands_insert( "ConnectSelection", makeCallbackF(Entity_connectSelected), Accelerator( 'K', (GdkModifierType)GDK_CONTROL_MASK ) );
630         GlobalCommands_insert( "KillConnectSelection", makeCallbackF(Entity_killconnectSelected), Accelerator( 'K', (GdkModifierType)( GDK_SHIFT_MASK ) ) );
631         GlobalCommands_insert( "GroupSelection", makeCallbackF(Entity_groupSelected) );
632         GlobalCommands_insert( "UngroupSelection", makeCallbackF(Entity_ungroupSelected) );
633
634         GlobalToggles_insert( "ShowLightRadiuses", makeCallbackF( ShowLightRadiiToggle ), ToggleItem::AddCallbackCaller( g_show_lightradii ) );
635
636         GlobalPreferenceSystem().registerPreference( "SI_Colors5", make_property_string( g_entity_globals.color_entity ) );
637         GlobalPreferenceSystem().registerPreference( "LastLightIntensity", make_property_string( g_iLastLightIntensity ) );
638
639 //      Entity_registerPreferencesPage();
640 }
641
642 void Entity_Destroy(){
643 }