Prevent adding objects to be added to a group which is used as dupli-group for this object
when using "Add Selected to Active Group" operator,
This commit is contained in:
@@ -65,7 +65,7 @@ static int objects_add_active_exec(bContext *C, wmOperator *op)
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
Object *ob= OBACT;
|
||||
Group *group;
|
||||
int ok = 0;
|
||||
int ok = 0, cycle = 0;
|
||||
|
||||
if (!ob) return OPERATOR_CANCELLED;
|
||||
|
||||
@@ -76,7 +76,10 @@ static int objects_add_active_exec(bContext *C, wmOperator *op)
|
||||
if (object_in_group(ob, group)) {
|
||||
/* Assign groups to selected objects */
|
||||
CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
|
||||
add_to_group(group, base->object, scene, base);
|
||||
if (base->object->dup_group != group)
|
||||
add_to_group(group, base->object, scene, base);
|
||||
else
|
||||
cycle = 1;
|
||||
ok = 1;
|
||||
}
|
||||
CTX_DATA_END;
|
||||
@@ -84,6 +87,8 @@ static int objects_add_active_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
if (!ok) BKE_report(op->reports, RPT_ERROR, "Active Object contains no groups");
|
||||
if (cycle)
|
||||
BKE_report(op->reports, RPT_WARNING, "Skipped some groups because of cycle detected");
|
||||
|
||||
DAG_scene_sort(bmain, scene);
|
||||
WM_event_add_notifier(C, NC_GROUP|NA_EDITED, NULL);
|
||||
|
||||
Reference in New Issue
Block a user