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:
authorDalai Felinto <dfelinto@gmail.com>2018-12-07 15:41:57 +0300
committerDalai Felinto <dfelinto@gmail.com>2018-12-07 15:44:19 +0300
commitcc61b21dff5e58031a165faf9f7c26a9e6032316 (patch)
treec33f604f876695e90abb36effc084ea93fb53e2d
parentad47b0236e32dc9a583a0d7209d8030bbb7c358e (diff)
Partial fix to T58917 - No valid cage
The fix itself simply is to store the cage object as a pointer instead of a string/name. That said baking with or without cage is yielding very different results than in 2.7.
-rw-r--r--intern/cycles/blender/addon/ui.py2
-rw-r--r--source/blender/blenkernel/intern/library_query.c1
-rw-r--r--source/blender/blenloader/intern/readfile.c8
-rw-r--r--source/blender/editors/object/object_bake_api.c4
-rw-r--r--source/blender/makesdna/DNA_scene_types.h3
-rw-r--r--source/blender/makesrna/intern/rna_scene.c4
6 files changed, 17 insertions, 5 deletions
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index b276d0bee10..19d3a0fcf54 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -1815,7 +1815,7 @@ class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel):
sub.prop(cbk, "use_cage", text="Cage")
if cbk.use_cage:
sub.prop(cbk, "cage_extrusion", text="Extrusion")
- sub.prop_search(cbk, "cage_object", scene, "objects", text="Cage Object")
+ sub.prop(cbk, "cage_object", text="Cage Object")
else:
sub.prop(cbk, "cage_extrusion", text="Ray Distance")
diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c
index 6a9c1c82ab1..a06be37f41d 100644
--- a/source/blender/blenkernel/intern/library_query.c
+++ b/source/blender/blenkernel/intern/library_query.c
@@ -407,6 +407,7 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
CALLBACK_INVOKE(scene->world, IDWALK_CB_USER);
CALLBACK_INVOKE(scene->set, IDWALK_CB_NOP);
CALLBACK_INVOKE(scene->clip, IDWALK_CB_USER);
+ CALLBACK_INVOKE(scene->r.bake.cage_object, IDWALK_CB_NOP);
if (scene->nodetree) {
/* nodetree **are owned by IDs**, treat them as mere sub-data and not real ID! */
library_foreach_ID_as_subdata_link((ID **)&scene->nodetree, callback, user_data, flag, &data);
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 360f836d18e..e88f75205c7 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -6174,6 +6174,10 @@ static void lib_link_scene(FileData *fd, Main *main)
lib_link_view_layer(fd, sce->id.lib, view_layer);
}
+ if (sce->r.bake.cage_object) {
+ sce->r.bake.cage_object = newlibadr(fd, sce->id.lib, sce->r.bake.cage_object);
+ }
+
#ifdef USE_SETSCENE_CHECK
if (sce->set != NULL) {
/* link flag for scenes with set would be reset later,
@@ -10021,6 +10025,10 @@ static void expand_scene(FileData *fd, Main *mainvar, Scene *sce)
if (sce->master_collection) {
expand_collection(fd, mainvar, sce->master_collection);
}
+
+ if (sce->r.bake.cage_object) {
+ expand_doit(fd, mainvar, sce->r.bake.cage_object);
+ }
}
static void expand_camera(FileData *fd, Main *mainvar, Camera *ca)
diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c
index 2f879937f7a..b9cc13cda34 100644
--- a/source/blender/editors/object/object_bake_api.c
+++ b/source/blender/editors/object/object_bake_api.c
@@ -1358,7 +1358,9 @@ static void bake_set_props(wmOperator *op, Scene *scene)
prop = RNA_struct_find_property(op->ptr, "cage_object");
if (!RNA_property_is_set(op->ptr, prop)) {
- RNA_property_string_set(op->ptr, prop, bake->cage);
+ if (bake->cage_object) {
+ RNA_property_string_set(op->ptr, prop, bake->cage_object->id.name + 2);
+ }
}
prop = RNA_struct_find_property(op->ptr, "normal_space");
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index c34bf32d0cb..b191c4c5a7c 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -521,7 +521,7 @@ typedef struct BakeData {
char save_mode;
char pad[3];
- char cage[64]; /* MAX_NAME */
+ struct Object *cage_object;
} BakeData;
/* BakeData.normal_swizzle (char) */
@@ -1585,6 +1585,7 @@ typedef struct Scene {
/* Physics simulation settings */
struct PhysicsSettings physics_settings;
+ void *pad8;
uint64_t customdata_mask; /* XXX. runtime flag for drawing, actually belongs in the window, only used by BKE_object_handle_update() */
uint64_t customdata_mask_modal; /* XXX. same as above but for temp operator use (gl renders) */
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index b44bdfc2201..fe4d69b910f 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -3753,10 +3753,10 @@ static void rna_def_bake_data(BlenderRNA *brna)
RNA_def_struct_ui_text(srna, "Bake Data", "Bake data for a Scene data-block");
RNA_def_struct_path_func(srna, "rna_BakeSettings_path");
- prop = RNA_def_property(srna, "cage_object", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "cage");
+ prop = RNA_def_property(srna, "cage_object", PROP_POINTER, PROP_NONE);
RNA_def_property_ui_text(prop, "Cage Object", "Object to use as cage "
"instead of calculating the cage from the active object with cage extrusion");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);