From 91bbb27f8c1fe65ebbd3d73db2d14a0268320862 Mon Sep 17 00:00:00 2001 From: Pratik Borhade Date: Fri, 28 Jun 2024 12:59:32 +0200 Subject: [PATCH] Fix: GPv3: Object line art not working Adding object line art does not work because the wrong source object (lineart itself is set). `add_type/BKE_object_add_for_data` function deselects all bases and sets new line art object as active. Get active object before calling this function to fix this. Pull Request: https://projects.blender.org/blender/blender/pulls/123836 --- source/blender/editors/object/object_add.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/blender/editors/object/object_add.cc b/source/blender/editors/object/object_add.cc index ac57fb5853f..3f23dfb304e 100644 --- a/source/blender/editors/object/object_add.cc +++ b/source/blender/editors/object/object_add.cc @@ -1622,6 +1622,7 @@ static int object_grease_pencil_add_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); + Object *original_active_object = CTX_data_active_object(C); /* TODO: For now, only support adding the 'Stroke' type. */ const int type = RNA_enum_get(op->ptr, "type"); @@ -1687,8 +1688,6 @@ static int object_grease_pencil_add_exec(bContext *C, wmOperator *op) case GREASE_PENCIL_LINEART_OBJECT: case GREASE_PENCIL_LINEART_SCENE: case GREASE_PENCIL_LINEART_COLLECTION: { - Object *original_active_object = CTX_data_active_object(C); - const int type = RNA_enum_get(op->ptr, "type"); const bool use_in_front = RNA_boolean_get(op->ptr, "use_in_front"); const bool use_lights = RNA_boolean_get(op->ptr, "use_lights");