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:
Diffstat (limited to 'source/blender/editors/object/object_add.c')
-rw-r--r--source/blender/editors/object/object_add.c36
1 files changed, 22 insertions, 14 deletions
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index d6816ddbe73..bdb23c5ce6f 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -1030,7 +1030,7 @@ static int empty_drop_named_image_invoke(bContext *C, wmOperator *op, const wmEv
return OPERATOR_CANCELLED;
}
/* handled below */
- id_us_min((ID *)ima);
+ id_us_min(&ima->id);
Object *ob = NULL;
Object *ob_cursor = ED_view3d_give_object_under_cursor(C, event->mval);
@@ -1581,11 +1581,7 @@ static int object_delete_exec(bContext *C, wmOperator *op)
}
CTX_DATA_END;
- BKE_reportf(op->reports,
- RPT_INFO,
- changed_count == 1 ? "Deleted %u object" :
- "Deleted %u objects",
- changed_count);
+ BKE_reportf(op->reports, RPT_INFO, "Deleted %u object(s)", changed_count);
if (changed_count == 0) {
return OPERATOR_CANCELLED;
@@ -2149,6 +2145,7 @@ static int convert_exec(bContext *C, wmOperator *op)
const short target = RNA_enum_get(op->ptr, "target");
bool keep_original = RNA_boolean_get(op->ptr, "keep_original");
int a, mballConverted = 0;
+ bool gpencilConverted = false;
/* don't forget multiple users! */
@@ -2389,20 +2386,20 @@ static int convert_exec(bContext *C, wmOperator *op)
}
else if (target == OB_GPENCIL) {
if (ob->type != OB_CURVE) {
+ ob->flag &= ~OB_DONE;
BKE_report(
op->reports, RPT_ERROR, "Convert Surfaces to Grease Pencil is not supported.");
}
else {
- /* Create a new grease pencil object only if it was not created before.
- * All curves selected are converted as strokes of the same grease pencil object.
+ /* Create a new grease pencil object and copy transformations.
* Nurbs Surface are not supported.
*/
- if (gpencil_ob == NULL) {
- const float *cur = scene->cursor.location;
- ushort local_view_bits = (v3d && v3d->localvd) ? v3d->local_view_uuid : 0;
- gpencil_ob = ED_gpencil_add_object(C, scene, cur, local_view_bits);
- }
+ ushort local_view_bits = (v3d && v3d->localvd) ? v3d->local_view_uuid : 0;
+ gpencil_ob = ED_gpencil_add_object(C, scene, ob->loc, local_view_bits);
+ copy_v3_v3(gpencil_ob->rot, ob->rot);
+ copy_v3_v3(gpencil_ob->scale, ob->scale);
BKE_gpencil_convert_curve(bmain, scene, gpencil_ob, ob, false, false, true);
+ gpencilConverted = true;
}
}
}
@@ -2502,6 +2499,17 @@ static int convert_exec(bContext *C, wmOperator *op)
}
FOREACH_SCENE_OBJECT_END;
}
+ /* Remove curves converted to Grease Pencil object. */
+ if (gpencilConverted) {
+ FOREACH_SCENE_OBJECT_BEGIN (scene, ob_curve) {
+ if (ob_curve->type == OB_CURVE) {
+ if (ob_curve->flag & OB_DONE) {
+ ED_object_base_free_and_unlink(bmain, scene, ob_curve);
+ }
+ }
+ }
+ FOREACH_SCENE_OBJECT_END;
+ }
}
// XXX ED_object_editmode_enter(C, 0);
@@ -2580,7 +2588,7 @@ static Base *object_add_duplicate_internal(
DEG_id_tag_update(&obn->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
base = BKE_view_layer_base_find(view_layer, ob);
- if ((base != NULL) && (base->flag & BASE_VISIBLE)) {
+ if ((base != NULL) && (base->flag & BASE_VISIBLE_DEPSGRAPH)) {
BKE_collection_object_add_from(bmain, scene, ob, obn);
}
else {