diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-07-24 01:50:40 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2009-07-24 01:50:40 +0400 |
commit | 366a64959c5950c2fd29f3b1fe74adbd9f420988 (patch) | |
tree | a3ca649622cea57340b639e69b6195072ec936c5 /source/blender/makesrna/intern | |
parent | 1ee8038e41f2daf3aaac40e58d7cdc416d2af35d (diff) |
2.5: Render/Game Engine
An engine to use for output can now be selected an influences what
shows in the buttons window, only showing relevant data. The idea
behind this is to make it more clear what is supported where, make
the system more pluggable for external render/game engines, and save
space hiding stuff that is not relevant anyway.
* Top header now has an engine menu, to choose between the blender
render engine, game engine, and other future external engines.
* If the game engine is enabled, the buttons window should show
only properties that work in the game engine, and similarly for
the render engine.
* Moved panels from the logic space and game tabs to the physics,
scene and world tabs instead, and removed the game tab.
* Materials and textures tabs should eventually become game
specific too, to better show what is supported.
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/SConscript | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_render.c | 35 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 20 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 28 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_world.c | 2 |
5 files changed, 79 insertions, 9 deletions
diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript index a4f184a3f67..6c8038bd509 100644 --- a/source/blender/makesrna/intern/SConscript +++ b/source/blender/makesrna/intern/SConscript @@ -56,6 +56,9 @@ if env['WITH_BF_QUICKTIME']: if env['WITH_BF_LCMS']: defs.append('WITH_LCMS') +if env['WITH_BF_GAMEENGINE']: + defs.append('GAMEBLENDER=1') + makesrna_tool.Append(CPPDEFINES=defs) makesrna_tool.Append (CPPPATH = Split(incs)) diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index 774eecba0f1..89c48230357 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -48,6 +48,41 @@ /* RenderEngine */ +static RenderEngineType internal_render_type = { + NULL, NULL, "BLENDER_RENDER", "Blender Render", RE_INTERNAL, NULL, {NULL, NULL, NULL, NULL}}; +#if GAMEBLENDER == 1 +static RenderEngineType internal_game_type = { + NULL, NULL, "BLENDER_GAME", "Blender Game", RE_INTERNAL|RE_GAME, NULL, {NULL, NULL, NULL, NULL}}; +#endif + +ListBase R_engines = {NULL, NULL}; + +void RE_engines_init() +{ + BLI_addtail(&R_engines, &internal_render_type); +#if GAMEBLENDER == 1 + BLI_addtail(&R_engines, &internal_game_type); +#endif +} + +void RE_engines_exit() +{ + RenderEngineType *type, *next; + + for(type=R_engines.first; type; type=next) { + next= type->next; + + BLI_remlink(&R_engines, type); + + if(!(type->flag & RE_INTERNAL)) { + if(type->ext.free) + type->ext.free(type->ext.data); + + MEM_freeN(type); + } + } +} + static void engine_render(RenderEngine *engine, struct Scene *scene) { PointerRNA ptr; diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index bd23fc9e1f6..aa4c410bc73 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -232,6 +232,18 @@ static int rna_SceneRenderData_multiple_engines_get(PointerRNA *ptr) return (BLI_countlist(&R_engines) > 1); } +static int rna_SceneRenderData_use_game_engine_get(PointerRNA *ptr) +{ + RenderData *rd= (RenderData*)ptr->data; + RenderEngineType *type; + + for(type=R_engines.first; type; type=type->next) + if(strcmp(type->idname, rd->engine) == 0) + return (type->flag & RE_GAME); + + return 0; +} + static void rna_SceneRenderLayer_layer_set(PointerRNA *ptr, const int *values) { SceneRenderLayer *rl= (SceneRenderLayer*)ptr->data; @@ -1579,11 +1591,17 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_enum_items(prop, engine_items); RNA_def_property_enum_funcs(prop, "rna_SceneRenderData_engine_get", "rna_SceneRenderData_engine_set", "rna_SceneRenderData_engine_itemf"); RNA_def_property_ui_text(prop, "Engine", "Engine to use for rendering."); + RNA_def_property_update(prop, NC_WINDOW, NULL); prop= RNA_def_property(srna, "multiple_engines", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_funcs(prop, "rna_SceneRenderData_multiple_engines_get", NULL); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_ui_text(prop, "Multiple Engine", "More than one rendering engine is available."); + RNA_def_property_ui_text(prop, "Multiple Engines", "More than one rendering engine is available."); + + prop= RNA_def_property(srna, "use_game_engine", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_funcs(prop, "rna_SceneRenderData_use_game_engine_get", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Use Game Engine", "Current rendering engine is a game engine."); } void RNA_def_scene(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 461c46e09bf..2231a59e770 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -239,6 +239,20 @@ StructRNA *rna_SpaceButtonsWindow_pin_id_typef(PointerRNA *ptr) return &RNA_ID; } +void rna_SpaceButtonsWindow_align_set(PointerRNA *ptr, int value) +{ + SpaceButs *sbuts= (SpaceButs*)(ptr->data); + bScreen *sc= (bScreen*)(ptr->id.data); + ScrArea *sa; + + sbuts->align= value; + sbuts->re_align= 1; + + for(sa=sc->areabase.first; sa; sa=sa->next) + if(BLI_findindex(&sa->spacedata, sbuts) != -1) + ED_area_tag_redraw(sa); +} + /* Space Console */ static void rna_ConsoleLine_line_get(PointerRNA *ptr, char *value) { @@ -658,12 +672,11 @@ static void rna_def_space_buttons(BlenderRNA *brna) {BCONTEXT_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture"}, {BCONTEXT_PARTICLE, "PARTICLE", ICON_PARTICLES, "Particle", "Particle"}, {BCONTEXT_PHYSICS, "PHYSICS", ICON_PHYSICS, "Physics", "Physics"}, - {BCONTEXT_GAME, "GAME", ICON_GAME, "Game", "Game"}, {0, NULL, 0, NULL, NULL}}; - static EnumPropertyItem panel_alignment_items[] = { - {1, "HORIZONTAL", 0, "Horizontal", ""}, - {2, "VERTICAL", 0, "Vertical", ""}, + static EnumPropertyItem align_items[] = { + {BUT_HORIZONTAL, "HORIZONTAL", 0, "Horizontal", ""}, + {BUT_VERTICAL, "VERTICAL", 0, "Vertical", ""}, {0, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "SpaceButtonsWindow", "Space"); @@ -676,10 +689,11 @@ static void rna_def_space_buttons(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Buttons Context", "The type of active data to display and edit in the buttons window"); RNA_def_property_update(prop, NC_WINDOW, NULL); - prop= RNA_def_property(srna, "panel_alignment", PROP_ENUM, PROP_NONE); + prop= RNA_def_property(srna, "align", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "align"); - RNA_def_property_enum_items(prop, panel_alignment_items); - RNA_def_property_ui_text(prop, "Panel Alignment", "Arrangement of the panels within the buttons window"); + RNA_def_property_enum_items(prop, align_items); + RNA_def_property_enum_funcs(prop, NULL, "rna_SpaceButtonsWindow_align_set", NULL); + RNA_def_property_ui_text(prop, "Align", "Arrangement of the panels within the buttons window"); RNA_def_property_update(prop, NC_WINDOW, NULL); /* pinned data */ diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index c41c0a0fcef..8beaa855201 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -218,7 +218,7 @@ static void rna_def_ambient_occlusion(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "aodist"); RNA_def_property_ui_text(prop, "Distance", "Length of rays, defines how far away other faces give occlusion effect."); - prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE); + prop= RNA_def_property(srna, "falloff_strength", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "aodistfac"); RNA_def_property_ui_text(prop, "Strength", "Distance attenuation factor, the higher, the 'shorter' the shadows."); |