Allow render engine to declare whether it's capable of the texture rendering or not

If render engine has bl_use_texture_preview set to truth blender wouldn't fallback to
the blender internal rendering for previews.
This commit is contained in:
Sergey Sharybin
2014-10-07 14:21:10 +02:00
parent 2d83108f93
commit 1a7b7bb74e
3 changed files with 13 additions and 1 deletions

View File

@@ -88,6 +88,7 @@
#include "PIL_time.h" #include "PIL_time.h"
#include "RE_pipeline.h" #include "RE_pipeline.h"
#include "RE_engine.h"
#include "WM_api.h" #include "WM_api.h"
#include "WM_types.h" #include "WM_types.h"
@@ -213,6 +214,12 @@ void ED_preview_init_dbase(void)
#endif #endif
} }
static bool check_engine_supports_textures(Scene *scene)
{
RenderEngineType *type = RE_engines_find(scene->r.engine);
return type->flag & RE_USE_TEXTURE_PREVIEW;
}
void ED_preview_free_dbase(void) void ED_preview_free_dbase(void)
{ {
if (G_pr_main) if (G_pr_main)
@@ -299,7 +306,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
sce->r.cfra = scene->r.cfra; sce->r.cfra = scene->r.cfra;
if (id_type == ID_TE) { if (id_type == ID_TE && !check_engine_supports_textures(scene)) {
/* Force blender internal for texture icons and nodes render, /* Force blender internal for texture icons and nodes render,
* seems commonly used render engines does not support * seems commonly used render engines does not support
* such kind of rendering. * such kind of rendering.

View File

@@ -587,6 +587,10 @@ static void rna_def_render_engine(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_PREVIEW); RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_PREVIEW);
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
prop = RNA_def_property(srna, "bl_use_texture_preview", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_TEXTURE_PREVIEW);
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
prop = RNA_def_property(srna, "bl_use_postprocess", PROP_BOOLEAN, PROP_NONE); prop = RNA_def_property(srna, "bl_use_postprocess", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "type->flag", RE_USE_POSTPROCESS); RNA_def_property_boolean_negative_sdna(prop, NULL, "type->flag", RE_USE_POSTPROCESS);
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);

View File

@@ -60,6 +60,7 @@ struct BakePixel;
#define RE_USE_SHADING_NODES 16 #define RE_USE_SHADING_NODES 16
#define RE_USE_EXCLUDE_LAYERS 32 #define RE_USE_EXCLUDE_LAYERS 32
#define RE_USE_SAVE_BUFFERS 64 #define RE_USE_SAVE_BUFFERS 64
#define RE_USE_TEXTURE_PREVIEW 128
/* RenderEngine.flag */ /* RenderEngine.flag */
#define RE_ENGINE_ANIMATION 1 #define RE_ENGINE_ANIMATION 1