This patch adds a new operator to convert a black and white image into
grease pencil strokes.
If the image is not B/W, an internal conversion is done.
For more details see T79877
Differential D8951
GPencil: New Trace images using Potrace Authored by Antonio Vazquez (antoniov) on Sep 18 2020, 7:46 PM.
Details This patch adds a new operator to convert a black and white image into If the image is not B/W, an internal conversion is done. For more details see T79877
Diff Detail
Event TimelineComment Actions @Ray Molenkamp (LazyDodo) When this patch will be accepted, the option WITH-POTRACEwould be enabled by default, no? Comment Actions That is correct, looking at T80818 all platforms have updated, so we can turn it on by default Comment Actions @Hans Goudey (HooglyBoogly) I set you as reviewer to recheck the code to verify I didn't write something totally wrong. The main part of the code is the connection with Potrace lib and what I did was adapt the code of some functions to Blender.
Comment Actions Here are some warnings I got before properly setting up potrace: /home/hans/Documents/Blender-Git/blender/source/blender/editors/gpencil/gpencil_trace_ops.c:222:6: warning: no previous prototype for ‘GPENCIL_OT_trace_image’ [-Wmissing-prototypes]
222 | void GPENCIL_OT_trace_image(wmOperatorType *ot)
| ^~~~~~~~~~~~~~~~~~~~~~
/home/hans/Documents/Blender-Git/blender/source/blender/editors/gpencil/gpencil_trace_utils.c:191:61: error: pointer parameter 'offset' can be pointer to const [readability-non-const-parameter,-warnings-as-errors]
static void add_point(bGPDstroke *gps, float scale, int32_t offset[2], float x, float y)
^
constFor testing it, I think I must be missing something about how to use it, because it was always grayed out in the object menu. I tried adding an empty object, a blank and stroke grease pencil object. I had an image open in the image editor to the left of the 3D viewport Other than that confusion just a few smaller comments, nothing totally wrong that I could see : )
Comment Actions Found an easy crash too: If you add the object that the operator adds as a target, instant crash. Comment Actions Looks great! On second thought, I think the operator poll message should be phrased to say why the item is grayed out rather than as instructions for the user, so "No image empty selected" might be better. | ||||||||||||||||||||||||||||||||||