89 potrace_bitmap_t *
bm =
NULL;
90 potrace_param_t *param =
NULL;
91 potrace_state_t *
st =
NULL;
100 param = potrace_param_default();
111 st = potrace_trace(param,
bm);
112 if (!
st ||
st->status != POTRACE_STATUS_OK) {
115 potrace_state_free(
st);
117 potrace_param_free(param);
132 float scale_potrace = trace_job->
scale * (640.0f / (
float)ibuf->
x) *
133 ((
float)ibuf->
x / (
float)ibuf->
y);
134 if (ibuf->
x > ibuf->
y) {
135 scale_potrace *= (
float)ibuf->
y / (
float)ibuf->
x;
149 potrace_state_free(
st);
150 potrace_param_free(param);
201 static void trace_start_job(
void *customdata,
short *stop,
short *do_update,
float *progress)
205 trace_job->
stop = stop;
235 for (
int i = init_frame; i <=
iuser->
frames; i++) {
341 short stop = 0, do_update =
true;
377 {POTRACE_TURNPOLICY_BLACK,
381 "Prefers to connect black (foreground) components"},
382 {POTRACE_TURNPOLICY_WHITE,
386 "Prefers to connect white (background) components"},
387 {POTRACE_TURNPOLICY_LEFT,
"LEFT", 0,
"Left",
"Always take a left turn"},
388 {POTRACE_TURNPOLICY_RIGHT,
"RIGHT", 0,
"Right",
"Always take a right turn"},
389 {POTRACE_TURNPOLICY_MINORITY,
393 "Prefers to connect the color (black or white) that occurs least frequently in the local "
394 "neighborhood of the current position"},
395 {POTRACE_TURNPOLICY_MAJORITY,
399 "Prefers to connect the color (black or white) that occurs most frequently in the local "
400 "neighborhood of the current position"},
401 {POTRACE_TURNPOLICY_RANDOM,
"RANDOM", 0,
"Random",
"Choose pseudo-randomly"},
418 ot->
name =
"Trace Image to Grease Pencil";
419 ot->
idname =
"GPENCIL_OT_trace_image";
420 ot->
description =
"Extract Grease Pencil strokes from image";
436 "Target grease pencil");
441 ot->
srna,
"resolution", 5, 1, 20,
"Resolution",
"Resolution of the generated curves", 1, 20);
449 "Scale of the final stroke",
458 "Distance to sample points, zero to disable",
467 "Determine the lightness threshold above which strokes are generated",
473 POTRACE_TURNPOLICY_MINORITY,
475 "Determines how to resolve ambiguities during decomposition of bitmaps into paths");
481 "Determines if trace simple image or full sequence");
485 "Start At Current Frame",
486 "Trace Image starting in current image frame");
494 "Used to trace only one frame of the image sequence, set to zero to trace all",
typedef float(TangentPoint)[2]
struct Scene * CTX_data_scene(const bContext *C)
struct Base * CTX_data_active_base(const bContext *C)
struct wmWindowManager * CTX_wm_manager(const bContext *C)
struct ViewLayer * CTX_data_view_layer(const bContext *C)
struct Object * CTX_data_active_object(const bContext *C)
struct View3D * CTX_wm_view3d(const bContext *C)
void CTX_wm_operator_poll_msg_set(struct bContext *C, const char *msg)
struct Main * CTX_data_main(const bContext *C)
struct wmWindow * CTX_wm_window(const bContext *C)
struct bGPDlayer * BKE_gpencil_layer_active_get(struct bGPdata *gpd)
struct bGPDlayer * BKE_gpencil_layer_addnew(struct bGPdata *gpd, const char *name, bool setactive, bool add_to_header)
struct bGPDframe * BKE_gpencil_layer_frame_get(struct bGPDlayer *gpl, int cframe, eGP_GetFrame_Mode addnew)
void BKE_image_release_ibuf(struct Image *ima, struct ImBuf *ibuf, void *lock)
struct ImBuf * BKE_image_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, void **r_lock)
struct Object * BKE_view_layer_non_active_selected_object(struct ViewLayer *view_layer, const struct View3D *v3d)
void BKE_id_delete(struct Main *bmain, void *idv) ATTR_NONNULL()
General operations, lookup, etc. for blender objects.
bool BKE_object_obdata_is_libdata(const struct Object *ob)
void BKE_report(ReportList *reports, eReportType type, const char *message)
MINLINE int max_ii(int a, int b)
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void DEG_id_tag_update(struct ID *id, int flag)
void DEG_relations_tag_update(struct Main *bmain)
@ ID_RECALC_COPY_ON_WRITE
void ED_object_base_activate(struct bContext *C, struct Base *base)
Contains defines and structs used throughout the imbuf module.
Read Guarded memory(de)allocation.
@ WM_JOB_TYPE_TRACE_IMAGE
ATTR_WARN_UNUSED_RESULT BMesh * bm
depth_tx normal_tx diffuse_light_tx specular_light_tx volume_light_tx environment_tx ambient_occlusion_tx aov_value_tx in_weight_img image(1, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_weight_img") .image(3
void ED_gpencil_trace_data_to_strokes(struct Main *bmain, potrace_state_t *st, struct Object *ob, struct bGPDframe *gpf, int32_t offset[2], float scale, float sample, int32_t resolution, int32_t thickness)
#define GPENCIL_TRACE_MODE_SINGLE
void ED_gpencil_trace_bitmap_free(const potrace_bitmap_t *bm)
#define GPENCIL_TRACE_MODE_SEQUENCE
void ED_gpencil_trace_image_to_bitmap(struct ImBuf *ibuf, const potrace_bitmap_t *bm, float threshold)
potrace_bitmap_t * ED_gpencil_trace_bitmap_new(int32_t w, int32_t h)
static bool gpencil_trace_image_poll(bContext *C)
static bool gpencil_trace_image(TraceJob *trace_job, ImBuf *ibuf, bGPDframe *gpf)
static void trace_free_job(void *customdata)
static int gpencil_trace_image_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
static void trace_start_job(void *customdata, short *stop, short *do_update, float *progress)
static int gpencil_trace_image_exec(bContext *C, wmOperator *op)
static void trace_end_job(void *customdata)
void GPENCIL_OT_trace_image(wmOperatorType *ot)
static void trace_initialize_job_data(TraceJob *trace_job)
Object * ED_gpencil_add_object(bContext *C, const float loc[3], ushort local_view_bits)
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
void(* MEM_freeN)(void *vmemh)
void *(* MEM_mallocN)(size_t len, const char *str)
static const pxr::TfToken st("st", pxr::TfToken::Immortal)
int RNA_int_get(PointerRNA *ptr, const char *name)
float RNA_float_get(PointerRNA *ptr, const char *name)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_float_factor(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
unsigned short local_view_uuid
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
void WM_main_add_notifier(unsigned int type, void *reference)
void WM_jobs_start(wmWindowManager *wm, wmJob *wm_job)
void WM_jobs_callbacks(wmJob *wm_job, wm_jobs_start_callback startjob, void(*initjob)(void *), void(*update)(void *), void(*endjob)(void *))
void WM_jobs_customdata_set(wmJob *wm_job, void *customdata, void(*free)(void *))
void WM_jobs_timer(wmJob *wm_job, double timestep, unsigned int note, unsigned int endnote)
wmJob * WM_jobs_get(wmWindowManager *wm, wmWindow *win, const void *owner, const char *name, int flag, int job_type)
int WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width)