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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2011-08-11 20:48:13 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2011-08-11 20:48:13 +0400
commitb4343da77fb32c370e087ed71dd14d73178e0dba (patch)
treedaab25170b1881d140027d69c7217d55a8dbd794
parent6686f189480c4de3e91f49a76811bf006ed9f9b2 (diff)
Cycles: fix missing update when removing or hiding objects.
-rw-r--r--intern/cycles/blender/blender_sync.cpp4
-rw-r--r--source/blender/blenkernel/BKE_depsgraph.h1
-rw-r--r--source/blender/blenkernel/intern/depsgraph.c7
-rw-r--r--source/blender/editors/object/object_add.c1
-rw-r--r--source/blender/editors/object/object_edit.c2
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c8
6 files changed, 22 insertions, 1 deletions
diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp
index 1bf85f13fca..1897ff13a64 100644
--- a/intern/cycles/blender/blender_sync.cpp
+++ b/intern/cycles/blender/blender_sync.cpp
@@ -60,6 +60,9 @@ BlenderSync::~BlenderSync()
bool BlenderSync::sync_recalc()
{
+ /* sync recalc flags from blender to cycles. actual update is done separate,
+ so we can do it later on if doing it immediate is not suitable */
+
BL::BlendData::materials_iterator b_mat;
for(b_mat = b_data.materials.begin(); b_mat != b_data.materials.end(); ++b_mat)
@@ -104,6 +107,7 @@ bool BlenderSync::sync_recalc()
object_map.has_recalc() ||
light_map.has_recalc() ||
mesh_map.has_recalc() ||
+ BlendDataObjects_recalc_get(&b_data.ptr) ||
world_recalc;
return recalc;
diff --git a/source/blender/blenkernel/BKE_depsgraph.h b/source/blender/blenkernel/BKE_depsgraph.h
index f3a9e874152..9cbbcd8104a 100644
--- a/source/blender/blenkernel/BKE_depsgraph.h
+++ b/source/blender/blenkernel/BKE_depsgraph.h
@@ -126,6 +126,7 @@ void DAG_ids_flush_tagged(struct Main *bmain);
void DAG_ids_check_recalc(struct Main *bmain);
void DAG_ids_clear_recalc(struct Main *bmain);
/* test if any of this id type is tagged for update */
+void DAG_id_type_tag(struct Main *bmain, short idtype);
int DAG_id_type_tagged(struct Main *bmain, short idtype);
/* (re)-create dependency graph for armature pose */
diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c
index 096307f1df9..13a84e0452f 100644
--- a/source/blender/blenkernel/intern/depsgraph.c
+++ b/source/blender/blenkernel/intern/depsgraph.c
@@ -2366,7 +2366,7 @@ void DAG_on_visible_update(Main *bmain, const short do_time)
}
/* hack to get objects updating on layer changes */
- bmain->id_tag_update['O'] = 1;
+ DAG_id_type_tag(bmain, ID_OB);
}
static void dag_id_flush_update__isDependentTexture(void *userData, Object *UNUSED(ob), ID **idpoin)
@@ -2614,6 +2614,11 @@ void DAG_id_tag_update(ID *id, short flag)
}
}
+void DAG_id_type_tag(struct Main *bmain, short idtype)
+{
+ bmain->id_tag_update[((char*)&idtype)[0]] = 1;
+}
+
int DAG_id_type_tagged(Main *bmain, short idtype)
{
return bmain->id_tag_update[((char*)&idtype)[0]];
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index 5f398361734..fdb1b9dc549 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -803,6 +803,7 @@ void OBJECT_OT_group_instance_add(wmOperatorType *ot)
/* note: now unlinks constraints as well */
void ED_base_object_free_and_unlink(Main *bmain, Scene *scene, Base *base)
{
+ DAG_id_type_tag(bmain, ID_OB);
BLI_remlink(&scene->base, base);
free_libblock_us(&bmain->object, base->object);
if(scene->basact==base) scene->basact= NULL;
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index c8d38218533..142c849eb7b 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -147,6 +147,7 @@ static int object_hide_view_clear_exec(bContext *C, wmOperator *UNUSED(op))
}
}
if (changed) {
+ DAG_id_type_tag(bmain, ID_OB);
DAG_scene_sort(bmain, scene);
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene);
}
@@ -199,6 +200,7 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op)
CTX_DATA_END;
if (changed) {
+ DAG_id_type_tag(bmain, ID_OB);
DAG_scene_sort(bmain, scene);
WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C));
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index d9bb1619ca5..7d6e1dd0567 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -63,6 +63,7 @@
#include "BKE_particle.h"
#include "BKE_font.h"
#include "BKE_node.h"
+#include "BKE_depsgraph.h"
#include "DNA_armature_types.h"
#include "DNA_camera_types.h"
@@ -508,6 +509,8 @@ void rna_Main_actions_tag(Main *bmain, int value) { tag_main_lb(&bmain->action,
void rna_Main_particles_tag(Main *bmain, int value) { tag_main_lb(&bmain->particle, value); }
void rna_Main_gpencil_tag(Main *bmain, int value) { tag_main_lb(&bmain->gpencil, value); }
+static int rna_Main_objects_recalc_get(PointerRNA *ptr) { return DAG_id_type_tagged(ptr->data, ID_OB); }
+
#else
void RNA_api_main(StructRNA *srna)
@@ -590,6 +593,7 @@ void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop)
StructRNA *srna;
FunctionRNA *func;
PropertyRNA *parm;
+ PropertyRNA *prop;
RNA_def_property_srna(cprop, "BlendDataObjects");
srna= RNA_def_struct(brna, "BlendDataObjects", NULL);
@@ -617,6 +621,10 @@ void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop)
func= RNA_def_function(srna, "tag", "rna_Main_objects_tag");
parm= RNA_def_boolean(func, "value", 0, "Value", "");
RNA_def_property_flag(parm, PROP_REQUIRED);
+
+ prop= RNA_def_property(srna, "recalc", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Main_objects_recalc_get", NULL);
}
void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop)