void Entity_setColour() { if(GlobalSelectionSystem().countSelected() != 0) { const scene::Path& path = GlobalSelectionSystem().ultimateSelected().path(); Entity* entity = Node_getEntity(path.top()); if(entity != 0) { const char* strColor = entity->getKeyValue("_color"); if(!string_empty(strColor)) { Vector3 rgb; if (string_parse_vector3(strColor, rgb)) { g_entity_globals.color_entity = rgb; } } if(g_pGameDescription->mGameType == "doom3" ? color_dialog(GTK_WIDGET(MainFrame_getWindow()), g_entity_globals.color_entity) : DoNormalisedColor(g_entity_globals.color_entity)) { char buffer[128]; sprintf(buffer, "%g %g %g", g_entity_globals.color_entity[0], g_entity_globals.color_entity[1], g_entity_globals.color_entity[2]); Scene_EntitySetKeyValue_Selected("_color", buffer); } } } }
void Entity_setColour(){ if ( GlobalSelectionSystem().countSelected() != 0 ) { const scene::Path& path = GlobalSelectionSystem().ultimateSelected().path(); Entity* entity = Node_getEntity( path.top() ); if( entity == 0 && path.size() == 3 ){ entity = Node_getEntity( path.parent() ); } if ( entity != 0 ) { const char* strColor = entity->getKeyValue( "_color" ); if ( !string_empty( strColor ) ) { Vector3 rgb; if ( string_parse_vector3( strColor, rgb ) ) { g_entity_globals.color_entity = rgb; } } if ( color_dialog( GTK_WIDGET( MainFrame_getWindow() ), g_entity_globals.color_entity ) ) { char buffer[128]; sprintf( buffer, "%g %g %g", g_entity_globals.color_entity[0], g_entity_globals.color_entity[1], g_entity_globals.color_entity[2] ); StringOutputStream command( 256 ); command << "entitySetColour " << buffer; UndoableCommand undo( command.c_str() ); Scene_EntitySetKeyValue_Selected( "_color", buffer ); } } } }
void Entity_normalizeColor(){ if ( GlobalSelectionSystem().countSelected() != 0 ) { const scene::Path& path = GlobalSelectionSystem().ultimateSelected().path(); Entity* entity = Node_getEntity( path.top() ); if ( entity != 0 ) { const char* strColor = entity->getKeyValue( "_color" ); if ( !string_empty( strColor ) ) { Vector3 rgb; if ( string_parse_vector3( strColor, rgb ) ) { g_entity_globals.color_entity = rgb; NormalizeColor( g_entity_globals.color_entity ); char buffer[128]; sprintf( buffer, "%g %g %g", g_entity_globals.color_entity[0], g_entity_globals.color_entity[1], g_entity_globals.color_entity[2] ); Scene_EntitySetKeyValue_Selected( "_color", buffer ); } } } } }