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
diff options
context:
space:
mode:
authorLukas Tönne <lukas.toenne@gmail.com>2014-07-07 12:50:43 +0400
committerLukas Tönne <lukas.toenne@gmail.com>2014-07-07 12:54:14 +0400
commit2fe0cf54a5827cac5a8d67dc6786bf7a7dc45950 (patch)
tree7380b3047efd49edf932bbcfc575cc3e996f2a0b /source/blender/makesrna/intern/rna_object_api.c
parent7481d2aad1fb1355b91f2759d59546872fb1b9ad (diff)
Fix T40712: Duplicators don't generate orco and UV coordinates in Cycles viewport preview.
Fix T39286: Display percentage ignored in Cycles viewport. The threaded depsgraph update changes included a cleanup of the global is_rendering flag, which was replaced by a general EvalContext being passed to dupli functions. Problem is that the global flag was true for viewport duplis before (ugly hack), which was used as a check for generating dupli orco/UV from mesh data layers. The new flag is stricter and only true for actual renders, which disables these attributes and breaks the Cycles Texture Coordinates and UVMap nodes. The solution is to extend the simple for_render boolean to an enum: * VIEWPORT: OpenGL viewport drawing (dupli tex coords omitted) * PREVIEW: Viewport preview render (simplified modifiers) * RENDER: Full render with all details and attributes There are still some areas that need to be examined, in particular modifiers seem to totally ignore the EvaluationContext! Instead they generally execute without render params from the depsgraph (BKE_object_handle_update_ex) and are built with render settings explicitly. Differential Revision: https://developer.blender.org/D613
Diffstat (limited to 'source/blender/makesrna/intern/rna_object_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_object_api.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index 4c5fa03a361..831e5486236 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -42,6 +42,8 @@
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
+#include "BKE_depsgraph.h"
+
#include "rna_internal.h" /* own include */
static EnumPropertyItem space_items[] = {
@@ -66,7 +68,6 @@ static EnumPropertyItem space_items[] = {
#include "BKE_constraint.h"
#include "BKE_context.h"
#include "BKE_customdata.h"
-#include "BKE_depsgraph.h"
#include "BKE_font.h"
#include "BKE_global.h"
#include "BKE_main.h"
@@ -167,9 +168,9 @@ static void dupli_render_particle_set(Scene *scene, Object *ob, int level, int e
/* When no longer needed, duplilist should be freed with Object.free_duplilist */
static void rna_Object_create_duplilist(Object *ob, ReportList *reports, Scene *sce, int settings)
{
- int for_render = settings == eModifierMode_Render;
+ bool for_render = (settings == DAG_EVAL_RENDER);
EvaluationContext eval_ctx = {0};
- eval_ctx.for_render = for_render;
+ eval_ctx.mode = settings;
if (!(ob->transflag & OB_DUPLI)) {
BKE_report(reports, RPT_ERROR, "Object does not have duplis");
@@ -432,6 +433,13 @@ void RNA_api_object(StructRNA *srna)
{0, NULL, 0, NULL, NULL}
};
+ static EnumPropertyItem dupli_eval_mode_items[] = {
+ {DAG_EVAL_VIEWPORT, "VIEWPORT", 0, "Viewport", "Generate duplis using viewport settings"},
+ {DAG_EVAL_PREVIEW, "PREVIEW", 0, "Preview", "Generate duplis using preview settings"},
+ {DAG_EVAL_RENDER, "RENDER", 0, "Render", "Generate duplis using render settings"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
#ifndef NDEBUG
static EnumPropertyItem mesh_dm_info_items[] = {
{0, "SOURCE", 0, "Source", "Source mesh"},
@@ -483,7 +491,7 @@ void RNA_api_object(StructRNA *srna)
"objects real matrix and layers");
parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene within which to evaluate duplis");
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_NEVER_NULL);
- RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Generate texture coordinates for rendering");
+ RNA_def_enum(func, "settings", dupli_eval_mode_items, 0, "", "Generate texture coordinates for rendering");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
func = RNA_def_function(srna, "dupli_list_clear", "rna_Object_free_duplilist");