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
This commit is contained in:
Pratik Borhade
2024-06-28 12:59:32 +02:00
committed by Pratik Borhade
parent 43c3ab9acb
commit 91bbb27f8c

View File

@@ -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");