diff options
Diffstat (limited to 'source')
9 files changed, 28 insertions, 15 deletions
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 9e6e49998ae..d9575079f73 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -98,6 +98,10 @@ # include <sys/time.h> #endif +const char *RE_engine_id_BLENDER_RENDER = "BLENDER_RENDER"; +const char *RE_engine_id_BLENDER_GAME = "BLENDER_GAME"; +const char *RE_engine_id_CYCLES = "CYCLES"; + void free_avicodecdata(AviCodecData *acd) { if (acd) { @@ -595,7 +599,7 @@ Scene *BKE_scene_add(Main *bmain, const char *name) sce->r.ffcodecdata.audio_bitrate = 192; sce->r.ffcodecdata.audio_channels = 2; - BLI_strncpy(sce->r.engine, "BLENDER_RENDER", sizeof(sce->r.engine)); + BLI_strncpy(sce->r.engine, RE_engine_id_BLENDER_RENDER, sizeof(sce->r.engine)); sce->audio.distance_model = 2.0f; sce->audio.doppler_factor = 1.0f; @@ -1902,12 +1906,12 @@ bool BKE_scene_use_new_shading_nodes(Scene *scene) bool BKE_scene_uses_blender_internal(struct Scene *scene) { - return strcmp("BLENDER_RENDER", scene->r.engine) == 0; + return STREQ(scene->r.engine, RE_engine_id_BLENDER_RENDER); } bool BKE_scene_uses_blender_game(struct Scene *scene) { - return strcmp("BLENDER_GAME", scene->r.engine) == 0; + return STREQ(scene->r.engine, RE_engine_id_BLENDER_GAME); } void BKE_scene_base_flag_to_objects(struct Scene *scene) diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 6e67fecf915..25e30d4cd75 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -921,12 +921,18 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, uiBlockSetEmboss(block, UI_EMBOSSN); /* When Modifier is a simulation, show button to switch to context rather than the delete button. */ - if (modifier_can_delete(md) && (!modifier_is_simulation(md) || STREQ(scene->r.engine, "BLENDER_GAME"))) + if (modifier_can_delete(md) && + (!modifier_is_simulation(md) || + STREQ(scene->r.engine, RE_engine_id_BLENDER_GAME))) + { uiItemO(row, "", ICON_X, "OBJECT_OT_modifier_remove"); - else if (modifier_is_simulation(md) == 1) + } + else if (modifier_is_simulation(md) == 1) { uiItemStringO(row, "", ICON_BUTS, "WM_OT_properties_context_change", "context", "PHYSICS"); - else if (modifier_is_simulation(md) == 2) + } + else if (modifier_is_simulation(md) == 2) { uiItemStringO(row, "", ICON_BUTS, "WM_OT_properties_context_change", "context", "PARTICLES"); + } uiBlockSetEmboss(block, UI_EMBOSS); } diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 450a3b19889..fb7653282b8 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -311,7 +311,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre * seems commonly used render engines does not support * such kind of rendering. */ - BLI_strncpy(sce->r.engine, "BLENDER_RENDER", sizeof(sce->r.engine)); + BLI_strncpy(sce->r.engine, RE_engine_id_BLENDER_RENDER, sizeof(sce->r.engine)); } else { BLI_strncpy(sce->r.engine, scene->r.engine, sizeof(sce->r.engine)); diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c index df7ca9f11b2..6118db703b4 100644 --- a/source/blender/editors/render/render_update.c +++ b/source/blender/editors/render/render_update.c @@ -538,7 +538,7 @@ void ED_render_id_flush_update(Main *bmain, ID *id) void ED_render_internal_init(void) { - RenderEngineType *ret = RE_engines_find("BLENDER_RENDER"); + RenderEngineType *ret = RE_engines_find(RE_engine_id_BLENDER_RENDER); ret->view_update = render_view3d_update; ret->view_draw = render_view3d_draw; diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index 5801dd126e3..f8a90c942bc 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -434,7 +434,7 @@ static void outliner_add_scene_contents(SpaceOops *soops, ListBase *lb, Scene *s outliner_add_element(soops, lb, sce->world, te, 0, 0); #ifdef WITH_FREESTYLE - if (STREQ(sce->r.engine, "BLENDER_RENDER") && (sce->r.mode & R_EDGE_FRS)) + if (STREQ(sce->r.engine, RE_engine_id_BLENDER_RENDER) && (sce->r.mode & R_EDGE_FRS)) outliner_add_line_styles(soops, lb, sce, te); #endif } diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 61bfb0176ef..32b4e4d1809 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -3413,7 +3413,7 @@ static void view3d_main_area_draw_objects(const bContext *C, Scene *scene, View3 rv3d->rflag &= ~RV3D_IS_GAME_ENGINE; #ifdef WITH_GAMEENGINE - if (STREQ(scene->r.engine, "BLENDER_GAME")) { + if (STREQ(scene->r.engine, RE_engine_id_BLENDER_GAME)) { rv3d->rflag |= RV3D_IS_GAME_ENGINE; /* Make sure LoDs are up to date */ diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp index 456118d4d2f..09701ab6acd 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp @@ -448,7 +448,7 @@ void BlenderStrokeRenderer::RenderStrokeRep(StrokeRep *iStrokeRep) const BLI_ghash_insert(_nodetree_hash, nt, ma); } - if (strcmp(freestyle_scene->r.engine, "CYCLES") == 0) { + if (STREQ(freestyle_scene->r.engine, RE_engine_id_CYCLES)) { PointerRNA scene_ptr, freestyle_scene_ptr; RNA_pointer_create(NULL, &RNA_Scene, old_scene, &scene_ptr); RNA_pointer_create(NULL, &RNA_Scene, freestyle_scene, &freestyle_scene_ptr); diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index f8f962107f6..745b21618ca 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1484,7 +1484,10 @@ enum { /* sequencer seq_prev_type seq_rend_type */ - +/* scene->r.engine (scene.c) */ +extern const char *RE_engine_id_BLENDER_RENDER; +extern const char *RE_engine_id_BLENDER_GAME; +extern const char *RE_engine_id_CYCLES; /* **************** SCENE ********************* */ diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c index 299172ae4cc..bea1d0532e8 100644 --- a/source/blender/nodes/shader/node_shader_tree.c +++ b/source/blender/nodes/shader/node_shader_tree.c @@ -70,9 +70,9 @@ static int shader_tree_poll(const bContext *C, bNodeTreeType *UNUSED(treetype)) Scene *scene = CTX_data_scene(C); /* allow empty engine string too, this is from older versions that didn't have registerable engines yet */ return (scene->r.engine[0] == '\0' || - STREQ(scene->r.engine, "BLENDER_RENDER") || - STREQ(scene->r.engine, "BLENDER_GAME") || - STREQ(scene->r.engine, "CYCLES")); + STREQ(scene->r.engine, RE_engine_id_BLENDER_RENDER) || + STREQ(scene->r.engine, RE_engine_id_BLENDER_GAME) || + STREQ(scene->r.engine, RE_engine_id_CYCLES)); } static void shader_get_from_context(const bContext *C, bNodeTreeType *UNUSED(treetype), bNodeTree **r_ntree, ID **r_id, ID **r_from) |