Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-07-24 01:50:40 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-07-24 01:50:40 +0400
commit366a64959c5950c2fd29f3b1fe74adbd9f420988 (patch)
treea3ca649622cea57340b639e69b6195072ec936c5 /source
parent1ee8038e41f2daf3aaac40e58d7cdc416d2af35d (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')
-rw-r--r--source/blender/editors/screen/screen_ops.c7
-rw-r--r--source/blender/editors/space_buttons/buttons_context.c30
-rw-r--r--source/blender/editors/space_buttons/buttons_header.c2
-rw-r--r--source/blender/editors/space_buttons/space_buttons.c2
-rw-r--r--source/blender/makesdna/DNA_space_types.h1
-rw-r--r--source/blender/makesrna/SConscript3
-rw-r--r--source/blender/makesrna/intern/SConscript3
-rw-r--r--source/blender/makesrna/intern/rna_render.c35
-rw-r--r--source/blender/makesrna/intern/rna_scene.c20
-rw-r--r--source/blender/makesrna/intern/rna_space.c28
-rw-r--r--source/blender/makesrna/intern/rna_world.c2
-rw-r--r--source/blender/render/extern/include/RE_pipeline.h6
-rw-r--r--source/blender/render/intern/source/pipeline.c22
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c2
-rw-r--r--source/creator/creator.c1
15 files changed, 94 insertions, 70 deletions
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index 3032bff18df..dc46940a733 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -2437,7 +2437,7 @@ static int screen_render_exec(bContext *C, wmOperator *op)
}
RE_test_break_cb(re, NULL, (int (*)(void *)) blender_test_break);
- if(RNA_boolean_get(op->ptr, "anim"))
+ if(RNA_boolean_get(op->ptr, "animation"))
RE_BlenderAnim(re, scene, scene->r.sfra, scene->r.efra, scene->frame_step);
else
RE_BlenderFrame(re, scene, scene->r.cfra);
@@ -2716,7 +2716,7 @@ static int screen_render_invoke(bContext *C, wmOperator *op, wmEvent *event)
rj= MEM_callocN(sizeof(RenderJob), "render job");
rj->scene= scene;
rj->win= CTX_wm_window(C);
- rj->anim= RNA_boolean_get(op->ptr, "anim");
+ rj->anim= RNA_boolean_get(op->ptr, "animation");
rj->iuser.scene= scene;
rj->iuser.ok= 1;
@@ -2772,7 +2772,7 @@ void SCREEN_OT_render(wmOperatorType *ot)
ot->poll= ED_operator_screenactive;
RNA_def_int(ot->srna, "layers", 0, 0, INT_MAX, "Layers", "", 0, INT_MAX);
- RNA_def_boolean(ot->srna, "anim", 0, "Animation", "");
+ RNA_def_boolean(ot->srna, "animation", 0, "Animation", "");
}
/* *********************** cancel render viewer *************** */
@@ -2977,6 +2977,7 @@ void ED_keymap_screen(wmWindowManager *wm)
/* render */
WM_keymap_add_item(keymap, "SCREEN_OT_render", F12KEY, KM_PRESS, 0, 0);
+ RNA_boolean_set(WM_keymap_add_item(keymap, "SCREEN_OT_render", F12KEY, KM_PRESS, KM_CTRL, 0)->ptr, "animation", 1);
WM_keymap_add_item(keymap, "SCREEN_OT_render_view_cancel", ESCKEY, KM_PRESS, 0, 0);
WM_keymap_add_item(keymap, "SCREEN_OT_render_view_show", F11KEY, KM_PRESS, 0, 0);
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
index 9048565b01f..1ebab105086 100644
--- a/source/blender/editors/space_buttons/buttons_context.c
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -360,32 +360,7 @@ static int buttons_context_path_texture(ButsContextPath *path)
return 0;
}
-static int buttons_context_path_game(ButsContextPath *path)
-{
- /* XXX temporary context. Using material slot instead of ob->game_data */
- Object *ob;
- PointerRNA *ptr= &path->ptr[path->len-1];
- Material *ma;
-
- /* if we already have a (pinned) material, we're done */
- if(RNA_struct_is_a(ptr->type, &RNA_Material)) {
- return 1;
- }
- /* if we have an object, use the object material slot */
- else if(buttons_context_path_object(path)) {
- ob= path->ptr[path->len-1].data;
- if(ob && ob->type && (ob->type<OB_LAMP)) {
- ma= give_current_material(ob, ob->actcol);
- RNA_id_pointer_create(&ma->id, &path->ptr[path->len]);
- path->len++;
- return 1;
- }
- }
-
- /* no path to a material possible */
- return 0;
-}
static int buttons_context_path(const bContext *C, ButsContextPath *path, int mainb, int worldtex)
{
SpaceButs *sbuts= (SpaceButs*)CTX_wm_space_data(C);
@@ -430,9 +405,6 @@ static int buttons_context_path(const bContext *C, ButsContextPath *path, int ma
case BCONTEXT_DATA:
found= buttons_context_path_data(path, -1);
break;
- case BCONTEXT_GAME:
- found= buttons_context_path_game(path);
- break;
case BCONTEXT_PARTICLE:
found= buttons_context_path_particle(path);
break;
@@ -526,7 +498,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
if(CTX_data_dir(member)) {
static const char *dir[] = {
"world", "object", "mesh", "armature", "lattice", "curve",
- "meta_ball", "lamp", "camera", "material", "material_slot", "game",
+ "meta_ball", "lamp", "camera", "material", "material_slot",
"texture", "texture_slot", "bone", "edit_bone", "particle_system",
"cloth", "soft_body", "fluid", "collision", NULL};
diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c
index 0fb00b2780b..0f6ef6fe570 100644
--- a/source/blender/editors/space_buttons/buttons_header.c
+++ b/source/blender/editors/space_buttons/buttons_header.c
@@ -124,8 +124,6 @@ void buttons_header_buttons(const bContext *C, ARegion *ar)
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_PARTICLES, xco+=BUTS_UI_UNIT, yco, BUTS_UI_UNIT, BUTS_UI_UNIT, &(sbuts->mainb), 0.0, (float)BCONTEXT_PARTICLE, 0, 0, "Particles");
if(sbuts->pathflag & (1<<BCONTEXT_PHYSICS))
uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_PHYSICS, xco+=BUTS_UI_UNIT, yco, BUTS_UI_UNIT, BUTS_UI_UNIT, &(sbuts->mainb), 0.0, (float)BCONTEXT_PHYSICS, 0, 0, "Physics");
- if(sbuts->pathflag & (1<<BCONTEXT_GAME))
- uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_GAME, xco+=BUTS_UI_UNIT, yco, BUTS_UI_UNIT, BUTS_UI_UNIT, &(sbuts->mainb), 0.0, (float)BCONTEXT_GAME, 0, 0, "Game");
xco+= BUTS_UI_UNIT;
uiBlockEndAlign(block);
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index 05d181ba330..8284744d519 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -177,8 +177,6 @@ static void buttons_main_area_draw(const bContext *C, ARegion *ar)
ED_region_panels(C, ar, vertical, "modifier");
else if (sbuts->mainb == BCONTEXT_CONSTRAINT)
ED_region_panels(C, ar, vertical, "constraint");
- else if (sbuts->mainb == BCONTEXT_GAME)
- ED_region_panels(C, ar, vertical, "game");
sbuts->re_align= 0;
sbuts->mainbo= sbuts->mainb;
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index 61931085707..34a5efbdf5f 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -580,7 +580,6 @@ typedef struct SpaceConsole {
#define BCONTEXT_TEXTURE 5
#define BCONTEXT_PARTICLE 6
#define BCONTEXT_PHYSICS 7
-#define BCONTEXT_GAME 8
#define BCONTEXT_BONE 9
#define BCONTEXT_MODIFIER 10
#define BCONTEXT_CONSTRAINT 12
diff --git a/source/blender/makesrna/SConscript b/source/blender/makesrna/SConscript
index 3b47eeca59d..80abd4fda61 100644
--- a/source/blender/makesrna/SConscript
+++ b/source/blender/makesrna/SConscript
@@ -34,4 +34,7 @@ if env['WITH_BF_QUICKTIME']:
if env['WITH_BF_LCMS']:
defs.append('WITH_LCMS')
+if env['WITH_BF_GAMEENGINE']:
+ defs.append('GAMEBLENDER=1')
+
env.BlenderLib ( 'bf_rna', objs, Split(incs), defines=defs, libtype=['core'], priority = [195] )
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.");
diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h
index 643a381c54f..d96054f5a76 100644
--- a/source/blender/render/extern/include/RE_pipeline.h
+++ b/source/blender/render/extern/include/RE_pipeline.h
@@ -240,6 +240,8 @@ struct Scene *RE_GetScene(struct Render *re);
/* External Engine */
+#define RE_INTERNAL 1
+#define RE_GAME 2
extern ListBase R_engines;
@@ -249,6 +251,7 @@ typedef struct RenderEngineType {
/* type info */
char idname[32];
char name[32];
+ int flag;
void (*render)(struct RenderEngine *engine, struct Scene *scene);
@@ -269,7 +272,8 @@ void RE_engine_end_result(RenderEngine *engine, struct RenderResult *result);
int RE_engine_test_break(RenderEngine *engine);
void RE_engine_update_stats(RenderEngine *engine, char *stats, char *info);
-void RE_engines_free(void);
+void RE_engines_init(void);
+void RE_engines_exit(void);
#endif /* RE_PIPELINE_H */
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 801a9729277..3e50ea92846 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -2783,12 +2783,6 @@ void RE_init_threadcount(Render *re)
/************************** External Engines ***************************/
-static RenderEngineType internal_engine_type = {
- NULL, NULL, "BlenderRenderEngine", "Blender", NULL,
- NULL, NULL, NULL, NULL};
-
-ListBase R_engines = {&internal_engine_type, &internal_engine_type};
-
RenderResult *RE_engine_begin_result(RenderEngine *engine, int x, int y, int w, int h)
{
Render *re= engine->re;
@@ -2924,19 +2918,3 @@ static void external_render_3d(Render *re, RenderEngineType *type)
}
}
-void RE_engines_free()
-{
- RenderEngineType *type, *next;
-
- for(type=R_engines.first; type; type=next) {
- next= type->next;
-
- if(type != &internal_engine_type) {
- if(type->ext.free)
- type->ext.free(type->ext.data);
-
- MEM_freeN(type);
- }
- }
-}
-
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 3d8efc018c4..fd102b663d0 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -239,7 +239,7 @@ void WM_exit(bContext *C)
BLF_exit();
RE_FreeAllRender();
- RE_engines_free();
+ RE_engines_exit();
// free_txt_data();
diff --git a/source/creator/creator.c b/source/creator/creator.c
index a3e5ca16a13..9034833563b 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -313,6 +313,7 @@ int main(int argc, char **argv)
BLI_where_am_i(bprogname, argv[0]);
RNA_init();
+ RE_engines_init();
/* Hack - force inclusion of the plugin api functions,
* see blenpluginapi:pluginapi.c