Fix Freestyle not copying Cycles properties to stroke rendering scene.

This commit is contained in:
Brecht Van Lommel 2018-02-05 16:16:09 +01:00
parent a8a77609d3
commit 354f92a494
Notes: blender-bot 2023-02-14 09:43:37 +01:00
Referenced by commit 78c6684ee9, Freestyle: Unnecessary repeats of Cycles property copying.
Referenced by issue #54005, Copy to selected not working for Python defined properties
1 changed files with 9 additions and 16 deletions

View File

@ -45,6 +45,7 @@ extern "C" {
#include "BKE_collection.h"
#include "BKE_customdata.h"
#include "BKE_idprop.h"
#include "BKE_global.h"
#include "BKE_library.h" /* free_libblock */
#include "BKE_material.h"
@ -120,6 +121,11 @@ BlenderStrokeRenderer::BlenderStrokeRenderer(Render *re, int render_count) : Str
freestyle_scene->r.im_format.planes = R_IMF_PLANES_RGBA;
freestyle_scene->r.im_format.imtype = R_IMF_IMTYPE_PNG;
// Copy ID properties, including Cycles render properties
if (old_scene->id.properties) {
freestyle_scene->id.properties = IDP_CopyProperty_ex(old_scene->id.properties, 0);
}
if (G.debug & G_DEBUG_FREESTYLE) {
printf("%s: %d thread(s)\n", __func__, BKE_render_num_threads(&freestyle_scene->r));
}
@ -480,23 +486,10 @@ void BlenderStrokeRenderer::RenderStrokeRepBasic(StrokeRep *iStrokeRep) const
}
if (STREQ(freestyle_scene->view_render.engine_id, 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);
PointerRNA cycles_ptr = RNA_pointer_get(&scene_ptr, "cycles");
/* Render with transparent background. */
PointerRNA freestyle_scene_ptr;
RNA_id_pointer_create(&freestyle_scene->id, &freestyle_scene_ptr);
PointerRNA freestyle_cycles_ptr = RNA_pointer_get(&freestyle_scene_ptr, "cycles");
int flag;
RNA_STRUCT_BEGIN(&freestyle_cycles_ptr, prop)
{
flag = RNA_property_flag(prop);
if (flag & PROP_HIDDEN)
continue;
RNA_property_copy(&freestyle_cycles_ptr, &cycles_ptr, prop, -1);
}
RNA_STRUCT_END;
RNA_boolean_set(&freestyle_cycles_ptr, "film_transparent", 1);
}