Cleanup: de-duplicate engine-id's
This commit is contained in:
parent
cefe137e91
commit
25b7455eea
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 ********************* */
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue