Page MenuHome

Fix for "Convert Text to Gpencil"-operator
ClosedPublic

Authored by Erik Abrahamsson (erik85) on Apr 29 2021, 4:24 PM.

Details

Summary

Currently when you try to convert a Text-object to Grease pencil from the Object-menu or via the operator in some other way, the Text-object is only converted to a Curve.
This patch converts that curve to a Grease pencil-object and deletes the curve.

Diff Detail

Repository
rB Blender

Event Timeline

Erik Abrahamsson (erik85) requested review of this revision.Apr 29 2021, 4:24 PM
Erik Abrahamsson (erik85) created this revision.

I have tested and crash... to make it works, it is required to delete the line ED_object_base_free_and_unlink(bmain, scene, newob); (2917 & 2918)

Could you update the patch?

source/blender/editors/object/object_add.c
2918

You must not delete the object here.

I have tested and crash... to make it works, it is required to delete the line ED_object_base_free_and_unlink(bmain, scene, newob); (2917 & 2918)

Could you update the patch?

Ok, I suspected that but had no crash so I thought it was ok. No sorry I don't think I can update it. I have absolutely no idea how to get rid of that curve if it's not deletable in there (when keep_original is enabled).

The curve is deleted below automatically...try without that line and you will see in the outliner (Data API mode) that curve has gone after conversion.

these lines do the job:

/* Remove curves and meshes converted to Grease Pencil object. */
    if (gpencilConverted) {
      FOREACH_SCENE_OBJECT_BEGIN (scene, ob_delete) {
        if (ELEM(ob_delete->type, OB_CURVE, OB_MESH)) {
          if (ob_delete->flag & OB_DONE) {
            ED_object_base_free_and_unlink(bmain, scene, ob_delete);
          }
        }
      }
      FOREACH_SCENE_OBJECT_END;
    }

The curve is deleted below automatically...try without that line and you will see in the outliner (Data API mode) that curve has gone after conversion.

You need to enable keep_original to see the problem.

Maybe if (keep_original) before the delete line fixes it. (edit: no it doesn't)

Antonio Vazquez (antoniov) updated this revision to Diff 36658.

Fix crash and avoid duplicated curve objects

This revision is now accepted and ready to land.Apr 29 2021, 5:50 PM

I have tested and modified the patch, so LGTM for commit.

This revision now requires review to proceed.Apr 29 2021, 5:58 PM
This revision is now accepted and ready to land.Apr 29 2021, 5:58 PM
This revision was automatically updated to reflect the committed changes.