Merge branch 'blender-v2.83-release'

This commit is contained in:
Nathan Craddock 2020-04-24 20:53:34 -06:00
commit 2b95f2439e
Notes: blender-bot 2023-02-14 06:45:14 +01:00
Referenced by issue #75632, Subsurf modifier and multirres modifier give different results when subdivide
9 changed files with 55 additions and 27 deletions

View File

@ -44,6 +44,7 @@
#include "BKE_displist.h"
#include "BKE_mball_tessellate.h" /* own include */
#include "BKE_object.h"
#include "BKE_scene.h"
#include "DEG_depsgraph.h"
@ -1191,6 +1192,8 @@ static void init_meta(Depsgraph *depsgraph, PROCESS *process, Scene *scene, Obje
int obnr, zero_size = 0;
char obname[MAX_ID_NAME];
SceneBaseIter iter;
const eEvaluationMode deg_eval_mode = DEG_get_mode(depsgraph);
const short parenting_dupli_transflag = (OB_DUPLIFACES | OB_DUPLIVERTS);
copy_m4_m4(obmat, ob->obmat); /* to cope with duplicators from BKE_scene_base_iter_next */
invert_m4_m4(obinv, ob->obmat);
@ -1204,6 +1207,14 @@ static void init_meta(Depsgraph *depsgraph, PROCESS *process, Scene *scene, Obje
zero_size = 0;
ml = NULL;
/* If this metaball is the original that's used for duplication, only have it it visible when
* the instancer is visible too. */
if ((base->flag_legacy & OB_FROMDUPLI) == 0 && ob->parent != NULL &&
(ob->parent->transflag & parenting_dupli_transflag) != 0 &&
(BKE_object_visibility(ob->parent, deg_eval_mode) & OB_VISIBLE_SELF) == 0) {
continue;
}
if (bob == ob && (base->flag_legacy & OB_FROMDUPLI) == 0) {
mb = ob->data;

View File

@ -103,7 +103,10 @@ static bool deg_object_hide_original(eEvaluationMode eval_mode, Object *ob, Dupl
* by its parent. Ideally this should not be needed, but due to the wrong
* dependency direction in the data design there is no way to keep the object
* visible otherwise. The better solution eventually would be for objects
* to specify which object they instance, instead of through parenting. */
* to specify which object they instance, instead of through parenting.
*
* This function should not be used for metaballs. They have custom visibility rules, as hiding
* the base metaball will also hide all the other balls in the group. */
if (eval_mode == DAG_EVAL_RENDER || dob) {
const int hide_original_types = OB_DUPLIVERTS | OB_DUPLIFACES;
@ -215,7 +218,7 @@ void deg_iterator_objects_step(BLI_Iterator *iter, DEG::IDNode *id_node)
if (data->flag & DEG_ITER_OBJECT_FLAG_VISIBLE) {
ob_visibility = BKE_object_visibility(object, data->eval_mode);
if (deg_object_hide_original(data->eval_mode, object, nullptr)) {
if (object->type != OB_MBALL && deg_object_hide_original(data->eval_mode, object, nullptr)) {
return;
}
}

View File

@ -377,6 +377,8 @@ static int collection_delete_exec(bContext *C, wmOperator *op)
WM_msg_publish_rna_prop(mbus, &scene->id, view_layer, LayerObjects, active);
}
ED_outliner_select_sync_from_object_tag(C);
return OPERATOR_FINISHED;
}
@ -458,6 +460,7 @@ static int collection_objects_select_exec(bContext *C, wmOperator *op)
Scene *scene = CTX_data_scene(C);
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
WM_main_add_notifier(NC_SCENE | ND_OB_SELECT, scene);
ED_outliner_select_sync_from_object_tag(C);
return OPERATOR_FINISHED;
}
@ -580,6 +583,7 @@ static int collection_duplicate_exec(bContext *C, wmOperator *op)
DEG_relations_tag_update(bmain);
WM_main_add_notifier(NC_SCENE | ND_LAYER, CTX_data_scene(C));
ED_outliner_select_sync_from_object_tag(C);
return OPERATOR_FINISHED;
}

View File

@ -982,6 +982,8 @@ static int outliner_item_drag_drop_invoke(bContext *C,
WM_drag_add_ID(drag, data.drag_id, data.drag_parent);
}
ED_outliner_select_sync_from_all_tag(C);
return (OPERATOR_FINISHED | OPERATOR_PASS_THROUGH);
}

View File

@ -817,6 +817,7 @@ static int outliner_id_paste_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_WINDOW, NULL);
BKE_reportf(op->reports, RPT_INFO, "%d data-block(s) pasted", num_pasted);
return OPERATOR_FINISHED;
}
@ -1175,9 +1176,7 @@ static int outliner_select_all_exec(bContext *C, wmOperator *op)
break;
}
if (soops->flag & SO_SYNC_SELECT) {
ED_outliner_select_sync_from_outliner(C, soops);
}
ED_outliner_select_sync_from_outliner(C, soops);
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);

View File

@ -1417,9 +1417,7 @@ static int outliner_item_do_activate_from_cursor(bContext *C,
ED_region_tag_redraw_no_rebuild(region);
}
if (soops->flag & SO_SYNC_SELECT) {
ED_outliner_select_sync_from_outliner(C, soops);
}
ED_outliner_select_sync_from_outliner(C, soops);
}
return OPERATOR_FINISHED;
@ -1509,9 +1507,7 @@ static int outliner_box_select_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
ED_region_tag_redraw(region);
if (soops->flag & SO_SYNC_SELECT) {
ED_outliner_select_sync_from_outliner(C, soops);
}
ED_outliner_select_sync_from_outliner(C, soops);
return OPERATOR_FINISHED;
}
@ -1749,9 +1745,7 @@ static int outliner_walk_select_invoke(bContext *C, wmOperator *op, const wmEven
/* Scroll outliner to focus on walk element */
outliner_walk_scroll(region, walk_element);
if (soops->flag & SO_SYNC_SELECT) {
ED_outliner_select_sync_from_outliner(C, soops);
}
ED_outliner_select_sync_from_outliner(C, soops);
ED_region_tag_redraw(region);
return OPERATOR_FINISHED;

View File

@ -351,8 +351,9 @@ static void outliner_sync_selection_from_outliner(Scene *scene,
/* Set clean outliner and mark other outliners for syncing */
void ED_outliner_select_sync_from_outliner(bContext *C, SpaceOutliner *soops)
{
/* Don't sync in certain outliner display modes */
if (ELEM(soops->outlinevis, SO_LIBRARIES, SO_DATA_API, SO_ID_ORPHANS)) {
/* Don't sync if not checked or in certain outliner display modes */
if (!(soops->flag & SO_SYNC_SELECT) ||
ELEM(soops->outlinevis, SO_LIBRARIES, SO_DATA_API, SO_ID_ORPHANS)) {
return;
}

View File

@ -566,9 +566,7 @@ static void merged_element_search_call_cb(struct bContext *C, void *UNUSED(arg1)
outliner_item_select(soops, te, false, false);
outliner_item_do_activate_from_tree_element(C, te, te->store_elem, false, false);
if (soops->flag & SO_SYNC_SELECT) {
ED_outliner_select_sync_from_outliner(C, soops);
}
ED_outliner_select_sync_from_outliner(C, soops);
}
/**
@ -1356,6 +1354,7 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
SpaceOutliner *soops = CTX_wm_space_outliner(C);
int event;
const char *str = NULL;
bool selection_changed = false;
/* check for invalid states */
if (soops == NULL) {
@ -1372,8 +1371,7 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
}
str = "Select Objects";
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
selection_changed = true;
}
else if (event == OL_OP_SELECT_HIERARCHY) {
Scene *sce = scene; // to be able to delete, scenes are set...
@ -1383,16 +1381,12 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
WM_window_set_active_scene(bmain, C, win, sce);
}
str = "Select Object Hierarchy";
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
ED_outliner_select_sync_from_object_tag(C);
selection_changed = true;
}
else if (event == OL_OP_DESELECT) {
outliner_do_object_operation(C, op->reports, scene, soops, &soops->tree, object_deselect_cb);
str = "Deselect Objects";
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
ED_outliner_select_sync_from_object_tag(C);
selection_changed = true;
}
else if (event == OL_OP_DELETE) {
ViewLayer *view_layer = CTX_data_view_layer(C);
@ -1415,6 +1409,7 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
WM_msg_publish_rna_prop(mbus, &scene->id, view_layer, LayerObjects, active);
}
selection_changed = true;
}
else if (event == OL_OP_DELETE_HIERARCHY) {
ViewLayer *view_layer = CTX_data_view_layer(C);
@ -1451,6 +1446,7 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene);
WM_msg_publish_rna_prop(mbus, &scene->id, view_layer, LayerObjects, active);
}
selection_changed = true;
}
else if (event == OL_OP_REMAP) {
outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, id_remap_cb, NULL);
@ -1479,6 +1475,12 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
if (selection_changed) {
DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
ED_outliner_select_sync_from_object_tag(C);
}
ED_undo_push(C, str);
return OPERATOR_FINISHED;

View File

@ -349,6 +349,14 @@ static void rna_Object_hide_update(Main *bmain, Scene *UNUSED(scene), PointerRNA
WM_main_add_notifier(NC_OBJECT | ND_DRAW, &ob->id);
}
static void rna_Object_duplicator_visibility_flag_update(Main *UNUSED(bmain),
Scene *UNUSED(scene),
PointerRNA *ptr)
{
Object *ob = (Object *)ptr->owner_id;
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
}
static void rna_MaterialIndex_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
Object *ob = (Object *)ptr->owner_id;
@ -3097,10 +3105,14 @@ static void rna_def_object(BlenderRNA *brna)
prop = RNA_def_property(srna, "show_instancer_for_render", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "duplicator_visibility_flag", OB_DUPLI_FLAG_RENDER);
RNA_def_property_ui_text(prop, "Render Instancer", "Make instancer visible when rendering");
RNA_def_property_update(
prop, NC_OBJECT | ND_DRAW, "rna_Object_duplicator_visibility_flag_update");
prop = RNA_def_property(srna, "show_instancer_for_viewport", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "duplicator_visibility_flag", OB_DUPLI_FLAG_VIEWPORT);
RNA_def_property_ui_text(prop, "Display Instancer", "Make instancer visible in the viewport");
RNA_def_property_update(
prop, NC_OBJECT | ND_DRAW, "rna_Object_duplicator_visibility_flag_update");
/* anim */
rna_def_animdata_common(srna);