Cycles: fix missing update when removing or hiding objects.
This commit is contained in:
@@ -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;
|
||||
|
@@ -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 */
|
||||
|
@@ -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]];
|
||||
|
@@ -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;
|
||||
|
@@ -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));
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user