Blender V5.3
trace.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2024 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include "BKE_attribute.hh"
6#include "BKE_context.hh"
7#include "BKE_curves.hh"
8#include "BKE_global.hh"
10#include "BKE_image.hh"
11#include "BKE_layer.hh"
12#include "BKE_lib_id.hh"
13#include "BKE_material.hh"
14#include "BKE_object.hh"
15#include "BKE_report.hh"
16
17#include "BLI_math_matrix.hh"
18#include "BLI_math_vector.hh"
19#include "BLI_math_vector_c.hh"
20
21#include "BLI_task.hh"
22#include "BLT_translation.hh"
23
24#include "DEG_depsgraph.hh"
26
27#include "DNA_curves_types.h"
29#include "DNA_material_types.h"
30#include "DNA_object_types.h"
31
32#include "IMB_imbuf_types.hh"
33
34#include "ED_grease_pencil.hh"
35#include "ED_numinput.hh"
36#include "ED_object.hh"
37#include "ED_screen.hh"
38
39#include "MEM_guardedalloc.h"
40
41#include "RNA_access.hh"
42#include "RNA_define.hh"
43
44#include "trace_util.hh"
45
46namespace blender {
47
48#ifdef WITH_POTRACE
49# include "potracelib.h"
50#endif
51
53
54/* -------------------------------------------------------------------- */
57
59
60/* Target object modes. */
62 New = 0,
64};
65
66enum class TraceMode : int8_t {
67 Single = 0,
69};
70
71#ifdef WITH_POTRACE
72
73struct TraceJob {
74 /* from wmJob */
75 Object *owner;
76 bool *stop, *do_update;
77 float *progress;
78
79 bContext *C;
81 Main *bmain;
82 Scene *scene;
83 View3D *v3d;
84 Base *base_active;
85 Object *ob_active;
86 Image *image;
87 Object *ob_grease_pencil;
89
90 Array<bke::CurvesGeometry> traced_curves;
91
92 bool was_ob_created;
93 bool use_current_frame;
94
95 /* Frame number where the output frame is generated. */
96 int frame_target;
97 float threshold;
98 TurnPolicy turnpolicy;
99 TraceMode mode;
100 /* Custom source frame, allows overriding the default scene frame. */
101 int frame_number;
102 int material_index;
103
104 bool success;
105 bool was_canceled;
106
107 void ensure_output_object();
108};
109
110void TraceJob::ensure_output_object()
111{
112 using namespace blender::bke::greasepencil;
113
114 /* Create a new grease pencil object. */
115 if (this->ob_grease_pencil == nullptr) {
116 const ushort local_view_bits = (this->v3d && this->v3d->localvd) ? this->v3d->local_view_uid :
117 0;
118
119 /* Copy transform from the active object. */
120 this->ob_grease_pencil = ed::object::add_type(this->C,
122 nullptr,
123 this->ob_active->loc,
124 this->ob_active->rot,
125 false,
126 local_view_bits);
127 copy_v3_v3(this->ob_grease_pencil->scale, this->ob_active->scale);
128 this->was_ob_created = true;
129 }
130
131 /* Create Layer. */
132 GreasePencil &grease_pencil = *id_cast<GreasePencil *>(this->ob_grease_pencil->data);
133 this->layer = grease_pencil.get_active_layer();
134 if (this->layer == nullptr) {
135 Layer &new_layer = grease_pencil.add_layer(DATA_("Trace"));
136 grease_pencil.set_active_layer(&new_layer);
137 this->layer = &new_layer;
138 }
139}
140
141static float4x4 pixel_to_object_transform(const Object &image_object,
142 const ImBuf &ibuf,
143 const float2 pixel_center = float2(0.5f))
144{
145 const float3 pixel_center_3d = float3(pixel_center.x, pixel_center.y, 0);
146 const float3 pixel_size_3d = math::safe_rcp(float3(ibuf.x, ibuf.y, 0));
147 const float3 image_offset_3d = float3(image_object.ima_ofs[0], image_object.ima_ofs[1], 0);
148 const float max_image_scale = image_object.empty_drawsize;
149 const float3 image_aspect_3d = (ibuf.x > ibuf.y ? float3(1, float(ibuf.y) / float(ibuf.x), 1) :
150 float3(float(ibuf.x) / float(ibuf.y), 1, 1));
151
152 const float4x4 to_object = math::translate(
153 math::from_scale<float4x4>(image_aspect_3d * max_image_scale), image_offset_3d);
154 const float4x4 to_normalized = math::translate(math::scale(to_object, pixel_size_3d),
155 pixel_center_3d);
156 return to_normalized;
157}
158
159static int ensure_material(Main *bmain, Object *ob, const StringRefNull name)
160{
162 if (index == -1) {
163 Material &ma = *BKE_grease_pencil_object_material_new(bmain, ob, name.c_str(), &index);
164 copy_v4_v4(ma.gp_style->stroke_rgba, float4(0, 0, 0, 1));
165 copy_v4_v4(ma.gp_style->fill_rgba, float4(0, 0, 0, 1));
166 }
167 return index;
168}
169
170static bke::CurvesGeometry grease_pencil_trace_image(TraceJob &trace_job, const ImBuf &ibuf)
171{
172 /* Trace the image.
173 * Note: Colors above threshold are interpreted as "background". This works well for images with
174 * black-on-white drawings, but is quite arbitrary. */
175 potrace_bitmap_t *bm = image_trace::image_to_bitmap(ibuf, [&](const ColorGeometry4f &color) {
176 return math::average(float3(color.r, color.g, color.b)) * color.a <= trace_job.threshold;
177 });
178
179 image_trace::TraceParams params;
180 params.size_threshold = 0;
181 params.turn_policy = trace_job.turnpolicy;
182 image_trace::Trace *trace = image_trace::trace_bitmap(params, *bm);
184
185 /* Transform from bitmap index space to local image object space. */
186 const float4x4 transform = pixel_to_object_transform(*trace_job.ob_active, ibuf);
187 bke::CurvesGeometry trace_curves = image_trace::trace_to_curves(*trace, transform);
189
190 /* Assign different materials to foreground curves and hole curves. */
191 bke::MutableAttributeAccessor attributes = trace_curves.attributes_for_write();
192 BLI_assert_msg(trace_job.material_index >= 0,
193 "ensure_material must be called on the main thread");
194 bke::SpanAttributeWriter<int> material_indices = attributes.lookup_or_add_for_write_span<int>(
195 "material_index", bke::AttrDomain::Curve);
196 material_indices.span.fill(trace_job.material_index);
197 material_indices.finish();
198
199 /* Combine strokes into a single fill with the same fill ID. */
200 attributes.add<int>("fill_id", bke::AttrDomain::Curve, bke::AttributeInitValue(1));
201
202 /* Only create fills since that is what the trace algorithm is also doing. Users can change the
203 * appearance however they please afterwards. */
204 attributes.add<bool>("hide_stroke", bke::AttrDomain::Curve, bke::AttributeInitValue(true));
205
206 return trace_curves;
207}
208
209static void trace_start_job(void *customdata, wmJobWorkerStatus *worker_status)
210{
211 TraceJob &trace_job = *static_cast<TraceJob *>(customdata);
212
213 trace_job.stop = &worker_status->stop;
214 trace_job.do_update = &worker_status->do_update;
215 trace_job.progress = &worker_status->progress;
216 trace_job.was_canceled = false;
217 const int init_frame = std::max((trace_job.use_current_frame) ? trace_job.frame_target : 0, 0);
218
219 G.is_break = false;
220
221 /* Single Image. */
222 if (trace_job.image->source == IMA_SRC_FILE || trace_job.mode == TraceMode::Single) {
223 ImageUser &iuser = *trace_job.ob_active->iuser;
224 trace_job.traced_curves.reinitialize(1);
225
226 iuser.framenr = ((trace_job.frame_number == 0) || (trace_job.frame_number > iuser.frames)) ?
227 init_frame :
228 trace_job.frame_number;
229 void *lock;
230 ImBuf *ibuf = BKE_image_acquire_ibuf(trace_job.image, &iuser, &lock);
231 if (ibuf) {
232 trace_job.traced_curves.first() = grease_pencil_trace_image(trace_job, *ibuf);
233 BKE_image_release_ibuf(trace_job.image, ibuf, lock);
234 *(trace_job.progress) = 1.0f;
235 }
236 /* If source type is not sequence, override `trace_job.mode` to single because we need the
237 * correct mode for finalization. */
238 trace_job.mode = TraceMode::Single;
239 }
240 /* Image sequence. */
241 else if (trace_job.image->type == IMA_TYPE_IMAGE) {
242 ImageUser &iuser = *trace_job.ob_active->iuser;
243 const int num_frames = iuser.frames - init_frame + 1;
244 trace_job.traced_curves.reinitialize(num_frames);
245 for (const int i : IndexRange(num_frames)) {
246 if (G.is_break) {
247 trace_job.was_canceled = true;
248 break;
249 }
250
251 const int frame_number = init_frame + i;
252 *(trace_job.progress) = float(frame_number) / float(iuser.frames);
253 worker_status->do_update = true;
254
255 iuser.framenr = frame_number;
256
257 void *lock;
258 ImBuf *ibuf = BKE_image_acquire_ibuf(trace_job.image, &iuser, &lock);
259 if (ibuf) {
260 trace_job.traced_curves[i] = grease_pencil_trace_image(trace_job, *ibuf);
261 BKE_image_release_ibuf(trace_job.image, ibuf, lock);
262 }
263 }
264 }
265
266 trace_job.success = !trace_job.was_canceled;
267 worker_status->do_update = true;
268 worker_status->stop = false;
269}
270
271static void trace_end_job(void *customdata)
272{
273 TraceJob &trace_job = *static_cast<TraceJob *>(customdata);
274 GreasePencil &grease_pencil = *id_cast<GreasePencil *>(trace_job.ob_grease_pencil->data);
275
276 auto ensure_drawing_at_frame = [&](const int frame_number) {
277 const std::optional<int> start_frame = trace_job.layer->start_frame_at(frame_number);
278 if (start_frame && *start_frame == frame_number) {
279 return grease_pencil.get_editable_drawing_at(*trace_job.layer, frame_number);
280 }
281 return grease_pencil.insert_frame(*trace_job.layer, frame_number);
282 };
283
284 /* Update all the drawings once the job is done and we're executing in the main thread again.
285 * Changing drawing array or updating the drawing geometry is not thread-safe. */
286 switch (trace_job.mode) {
287 case TraceMode::Single: {
288 BLI_assert(trace_job.traced_curves.size() == 1);
289 bke::greasepencil::Drawing *drawing = ensure_drawing_at_frame(trace_job.frame_target);
290 BLI_assert(drawing != nullptr);
291 drawing->strokes_for_write() = trace_job.traced_curves.first();
292 drawing->tag_topology_changed();
293 break;
294 }
295 case TraceMode::Sequence: {
296 const ImageUser &iuser = *trace_job.ob_active->iuser;
297 const int init_frame = std::max((trace_job.use_current_frame) ? trace_job.frame_target : 0,
298 0);
299 const int num_frames = iuser.frames - init_frame + 1;
300 BLI_assert(trace_job.traced_curves.size() == num_frames);
301 for (const int i : IndexRange(num_frames)) {
302 const int frame_number = init_frame + i;
303 bke::greasepencil::Drawing *drawing = ensure_drawing_at_frame(frame_number);
304 BLI_assert(drawing != nullptr);
305 drawing->strokes_for_write() = trace_job.traced_curves[i];
306 drawing->tag_topology_changed();
307 }
308 break;
309 }
310 }
311
312 /* If canceled, delete all previously created object and data-block. */
313 if ((trace_job.was_canceled) && (trace_job.was_ob_created) && (trace_job.ob_grease_pencil)) {
314 BKE_id_delete(trace_job.bmain, &trace_job.ob_grease_pencil->id);
315 BKE_id_delete(trace_job.bmain, &grease_pencil.id);
316 }
317
318 if (trace_job.success) {
319 DEG_relations_tag_update(trace_job.bmain);
320
321 DEG_id_tag_update(&trace_job.scene->id, ID_RECALC_SELECT);
323
325 WM_main_add_notifier(NC_SCENE | ND_OB_ACTIVE, trace_job.scene);
326 }
327}
328
329static void trace_free_job(void *customdata)
330{
331 TraceJob *tj = static_cast<TraceJob *>(customdata);
332 MEM_delete(tj);
333}
334
335/* Trace Image to Grease Pencil. */
336static bool grease_pencil_trace_image_poll(bContext *C)
337{
339 if ((ob == nullptr) || (ob->type != OB_EMPTY) || (ob->data == nullptr)) {
340 CTX_wm_operator_poll_msg_set(C, "No image empty selected");
341 return false;
342 }
343
344 Image *image = id_cast<Image *>(ob->data);
346 CTX_wm_operator_poll_msg_set(C, "No valid image format selected");
347 return false;
348 }
349
350 return true;
351}
352
353static wmOperatorStatus grease_pencil_trace_image_exec(bContext *C, wmOperator *op)
354{
355 TraceJob *job = MEM_new<TraceJob>("TraceJob");
356 job->C = C;
357 job->owner = CTX_data_active_object(C);
358 job->wm = CTX_wm_manager(C);
359 job->bmain = CTX_data_main(C);
360 Scene *scene = CTX_data_scene(C);
361 job->scene = scene;
362 job->v3d = CTX_wm_view3d(C);
363 job->base_active = CTX_data_active_base(C);
364 job->ob_active = job->base_active->object;
365 job->image = id_cast<Image *>(job->ob_active->data);
366 job->frame_target = scene->r.cfra;
367 job->use_current_frame = RNA_boolean_get(op->ptr, "use_current_frame");
368
369 /* Create a new grease pencil object or reuse selected. */
370 const TargetObjectMode target = TargetObjectMode(RNA_enum_get(op->ptr, "target"));
371 job->ob_grease_pencil = (target == TargetObjectMode::Selected) ?
373 *job->bmain, scene, CTX_data_view_layer(C), job->v3d) :
374 nullptr;
375
376 if (job->ob_grease_pencil != nullptr) {
377 if (job->ob_grease_pencil->type != OB_GREASE_PENCIL) {
378 BKE_report(op->reports, RPT_WARNING, "Target object not a Grease Pencil, ignoring!");
379 job->ob_grease_pencil = nullptr;
380 }
381 else if (BKE_object_obdata_is_libdata(job->ob_grease_pencil)) {
382 BKE_report(op->reports, RPT_WARNING, "Target object library-data, ignoring!");
383 job->ob_grease_pencil = nullptr;
384 }
385 }
386
387 job->was_ob_created = false;
388
389 job->threshold = RNA_float_get(op->ptr, "threshold");
390 job->turnpolicy = TurnPolicy(RNA_enum_get(op->ptr, "turnpolicy"));
391 job->mode = TraceMode(RNA_enum_get(op->ptr, "mode"));
392 job->frame_number = RNA_int_get(op->ptr, "frame_number");
393
394 job->ensure_output_object();
395
396 /* Back to active base. */
397 ed::object::base_activate(job->C, job->base_active);
398
399 /* Create material on the main thread before starting the job. */
400 job->material_index = ensure_material(job->bmain, job->ob_grease_pencil, "Material");
401
402 if ((job->image->source == IMA_SRC_FILE) || (job->frame_number > 0)) {
403 wmJobWorkerStatus worker_status = {};
404 trace_start_job(job, &worker_status);
405 trace_end_job(job);
406 trace_free_job(job);
407 }
408 else {
409 wmJob *wm_job = WM_jobs_get(job->wm,
411 job->scene,
412 "Tracing image...",
415
416 WM_jobs_customdata_set(wm_job, job, trace_free_job);
417 WM_jobs_timer(wm_job, 0.1, NC_GEOM | ND_DATA, NC_GEOM | ND_DATA);
418 WM_jobs_callbacks(wm_job, trace_start_job, nullptr, nullptr, trace_end_job);
419
421 }
422
423 return OPERATOR_FINISHED;
424}
425
426static wmOperatorStatus grease_pencil_trace_image_invoke(bContext *C,
427 wmOperator *op,
428 const wmEvent * /*event*/)
429{
430 /* Show popup dialog to allow editing. */
431 /* FIXME: hard-coded dimensions here are just arbitrary. */
432 return WM_operator_props_dialog_popup(C, op, 250);
433}
434
435static void GREASE_PENCIL_OT_trace_image(wmOperatorType *ot)
436{
437 PropertyRNA *prop;
438
439 static const EnumPropertyItem turnpolicy_type[] = {
440 {int(TurnPolicy::Foreground),
441 "FOREGROUND",
442 0,
443 "Foreground",
444 "Prefers to connect foreground components"},
445 {int(TurnPolicy::Background),
446 "BACKGROUND",
447 0,
448 "Background",
449 "Prefers to connect background components"},
450 {int(TurnPolicy::Left), "LEFT", 0, "Left", "Always take a left turn"},
451 {int(TurnPolicy::Right), "RIGHT", 0, "Right", "Always take a right turn"},
452 {int(TurnPolicy::Minority),
453 "MINORITY",
454 0,
455 "Minority",
456 "Prefers to connect the color that occurs least frequently in the local "
457 "neighborhood of the current position"},
458 {int(TurnPolicy::Majority),
459 "MAJORITY",
460 0,
461 "Majority",
462 "Prefers to connect the color that occurs most frequently in the local "
463 "neighborhood of the current position"},
464 {int(TurnPolicy::Random), "RANDOM", 0, "Random", "Choose pseudo-randomly"},
465 {0, nullptr, 0, nullptr, nullptr},
466 };
467
468 static const EnumPropertyItem trace_modes[] = {
469 {int(TraceMode::Single), "SINGLE", 0, "Single", "Trace the current frame of the image"},
470 {int(TraceMode::Sequence), "SEQUENCE", 0, "Sequence", "Trace full sequence"},
471 {0, nullptr, 0, nullptr, nullptr},
472 };
473
474 static const EnumPropertyItem target_object_modes[] = {
475 {int(TargetObjectMode::New), "NEW", 0, "New Object", ""},
476 {int(TargetObjectMode::Selected), "SELECTED", 0, "Selected Object", ""},
477 {0, nullptr, 0, nullptr, nullptr},
478 };
479
480 /* identifiers */
481 ot->name = "Trace Image to Grease Pencil";
482 ot->idname = "GREASE_PENCIL_OT_trace_image";
483 ot->description = "Extract Grease Pencil strokes from image";
484
485 /* callbacks */
486 ot->invoke = grease_pencil_trace_image_invoke;
487 ot->exec = grease_pencil_trace_image_exec;
488 ot->poll = grease_pencil_trace_image_poll;
489
490 /* flags */
492
493 /* properties */
494 ot->prop = RNA_def_enum(ot->srna,
495 "target",
496 target_object_modes,
498 "Target Object",
499 "Target Grease Pencil");
501
503 "threshold",
504 0.5f,
505 0.0f,
506 1.0f,
507 "Color Threshold",
508 "Determine the lightness threshold above which strokes are generated",
509 0.0f,
510 1.0f);
511 RNA_def_enum(ot->srna,
512 "turnpolicy",
513 turnpolicy_type,
514 int(TurnPolicy::Minority),
515 "Turn Policy",
516 "Determines how to resolve ambiguities during decomposition of bitmaps into paths");
517 RNA_def_enum(ot->srna,
518 "mode",
519 trace_modes,
521 "Mode",
522 "Determines if trace simple image or full sequence");
524 "use_current_frame",
525 true,
526 "Start At Current Frame",
527 "Trace Image starting in current image frame");
528 prop = RNA_def_int(
529 ot->srna,
530 "frame_number",
531 0,
532 0,
533 9999,
534 "Trace Frame",
535 "Used to trace only one frame of the image sequence, set to zero to trace all",
536 0,
537 9999);
539}
540
541#endif
542
544
545} // namespace ed::sculpt_paint::greasepencil
546
547/* -------------------------------------------------------------------- */
550
552{
554
555#ifdef WITH_POTRACE
556 WM_operatortype_append(GREASE_PENCIL_OT_trace_image);
557#endif
558}
559
561
562} // namespace blender
Low-level operations for curves.
Low-level operations for grease pencil.
General operations, lookup, etc. for materials.
General operations, lookup, etc. for blender objects.
#define DATA_(msgid)
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
#define C
Definition RandGen.cpp:29
#define NC_GEOM
Definition WM_types.hh:406
#define ND_OB_ACTIVE
Definition WM_types.hh:459
#define ND_DATA
Definition WM_types.hh:552
#define NC_SCENE
Definition WM_types.hh:391
#define NA_ADDED
Definition WM_types.hh:636
#define NC_OBJECT
Definition WM_types.hh:392
volatile int lock
#define BLI_assert(a)
#define ELEM(...)
#define BLI_assert_msg(a, msg)
ChannelStorageType r
ChannelStorageType g
ChannelStorageType b
ChannelStorageType a
constexpr IndexRange()=default
constexpr const char * c_str() const
MutableAttributeAccessor attributes_for_write()
bool add(const StringRef name, const AttrDomain domain, const AttrType data_type, const AttributeInit &initializer)
GSpanAttributeWriter lookup_or_add_for_write_span(StringRef name, AttrDomain domain, AttrType data_type, const AttributeInit &initializer=AttributeInitDefaultValue())
bke::CurvesGeometry & strokes_for_write()
#define image(slot, qualifiers, format)
#define index(i)
#define layer
void free_bitmap(Bitmap *bm)
bke::CurvesGeometry trace_to_curves(const Trace &trace, const float4x4 &transform)
Bitmap * image_to_bitmap(const ImBuf &ibuf, ThresholdFn fn)
void free_trace(Trace *trace)
Trace * trace_bitmap(const TraceParams &params, Bitmap &bm)
Object * add_type(bContext *C, int type, const char *name, const float loc[3], const float rot[3], bool enter_editmode, unsigned short local_view_bits) ATTR_NONNULL(1) ATTR_RETURNS_NONNULL
void base_activate(bContext *C, Base *base)
T safe_rcp(const T &a)
MatBase< T, NumCol, NumRow > scale(const MatBase< T, NumCol, NumRow > &mat, const VectorT &scale)
T average(const VecBase< T, Size > &a)
MatT from_scale(const VecBase< typename MatT::base_type, ScaleDim > &scale)
MatBase< T, NumCol, NumRow > translate(const MatBase< T, NumCol, NumRow > &mat, const VectorT &translation)
BMesh Iterators.
void WM_main_add_notifier(uint type, void *reference)
void WM_operatortype_append(void(*opfunc)(wmOperatorType *))
int RNA_enum_get(PointerRNA *ptr, const char *name)
@ RPT_WARNING
Definition BKE_report.hh:40
void BKE_id_delete(Main *bmain, void *idv, const BKEIDDeleteOptions &options={}) ATTR_NONNULL()
void WM_jobs_callbacks(wmJob *wm_job, wm_jobs_start_callback startjob, void(*initjob)(void *), void(*update)(void *), void(*endjob)(void *))
Definition wm_jobs.cc:407
MINLINE void copy_v3_v3(float r[3], const float a[3])
Object * BKE_view_layer_non_active_selected_object(const Main &bmain, const Scene *scene, ViewLayer *view_layer, const View3D *v3d)
@ WM_JOB_TYPE_TRACE_IMAGE
Definition WM_api.hh:2045
unsigned short ushort
Definition BKE_text.h:56
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
int RNA_int_get(PointerRNA *ptr, const char *name)
wmWindow * CTX_wm_window(const bContext *C)
void WM_jobs_customdata_set(wmJob *wm_job, void *customdata, void(*free)(void *customdata))
Definition wm_jobs.cc:377
MatBase< float, 4, 4 > float4x4
@ WM_JOB_PROGRESS
Definition WM_api.hh:1997
Base * CTX_data_active_base(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
void WM_jobs_start(wmWindowManager *wm, wmJob *wm_job)
Definition wm_jobs.cc:498
Global G
Definition blender.cc:57
VecBase< float, 4 > float4
PropertyRNA * RNA_def_float_factor(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
Material * BKE_grease_pencil_object_material_new(Main *bmain, Object *ob, const char *name, int *r_index)
void CTX_wm_operator_poll_msg_set(bContext *C, const char *msg)
VecBase< float, 2 > float2
int BKE_grease_pencil_object_material_index_get_by_name(Object *ob, const char *name)
void DEG_id_tag_update(ID *id, unsigned int flags)
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:162
wmWindowManager * CTX_wm_manager(const bContext *C)
wmOperatorStatus WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width, std::optional< std::string > title, std::optional< std::string > confirm_text, const bool cancel_default, std::optional< std::string > message, const bool show_icon)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
ImBuf * BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
Main * CTX_data_main(const bContext *C)
wmJob * WM_jobs_get(wmWindowManager *wm, wmWindow *win, const void *owner, const char *name, const eWM_JobFlag flag, const eWM_JobType job_type)
Definition wm_jobs.cc:228
@ ID_RECALC_SELECT
Definition DNA_ID.h:1101
@ ID_RECALC_SYNC_TO_EVAL
Definition DNA_ID.h:1118
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1074
@ PROP_SKIP_SAVE
Definition RNA_types.hh:414
void DEG_relations_tag_update(Main *bmain)
Scene * CTX_data_scene(const bContext *C)
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
MINLINE void copy_v4_v4(float r[4], const float a[4])
@ OPTYPE_REGISTER
Definition WM_types.hh:188
@ OPTYPE_UNDO
Definition WM_types.hh:190
VecBase< float, 3 > float3
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
Object * CTX_data_active_object(const bContext *C)
void WM_jobs_timer(wmJob *wm_job, double time_step, uint note, uint endnote, void(*timer_step)(void *))
Definition wm_jobs.cc:393
float RNA_float_get(PointerRNA *ptr, const char *name)
View3D * CTX_wm_view3d(const bContext *C)
signed char int8_t
Definition BKE_text.h:76
bool BKE_object_obdata_is_libdata(const Object *ob)
Definition object.cc:2845
void ED_operatortypes_grease_pencil_trace()
Definition trace.cc:551
void BKE_image_release_ibuf(Image *ima, ImBuf *ibuf, void *lock)
void trace(Resources &srt, const LightprobeRenderData &lightprobes, const Uniform &uni, const draw::View &views, const Sampling &sampling, const gbuffer::Reader &reader, const uint3 group_id, const uint3 local_id)
float4 transform(float4 hs_position)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
const NodeType * type
Definition graph/node.h:179
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1125
const char * description
Definition WM_types.hh:1115
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1165
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1141
struct ReportList * reports