Blender V5.3
rna_color.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <cstdlib>
10
11#include "DNA_color_types.h"
12#include "DNA_texture_types.h"
13
14#include "BLT_translation.hh"
15
16#include "RNA_define.hh"
17#include "RNA_enum_types.hh"
18#include "rna_internal.hh"
19
20#include "WM_api.hh"
21#include "WM_types.hh"
22
23namespace blender {
24
26 {0,
27 "NONE",
28 0,
29 "None",
30 "Do not perform any color transform on load, treat colors as in scene linear space "
31 "already"},
32 {0, nullptr, 0, nullptr, nullptr},
33};
34
36 {-1, "NONE", 0, "None", "The color space has no interop ID"},
37 {0, nullptr, 0, nullptr, nullptr},
38};
39
40} // namespace blender
41
42#ifdef RNA_RUNTIME
43
44# include <fmt/format.h>
45
46# include "RNA_access.hh"
47# include "RNA_path.hh"
48
49# include "DNA_image_types.h"
50# include "DNA_material_types.h"
51# include "DNA_movieclip_types.h"
52# include "DNA_node_types.h"
53# include "DNA_object_types.h"
54# include "DNA_particle_types.h"
55# include "DNA_sequence_types.h"
56
57# include "MEM_guardedalloc.h"
58
59# include "BLI_listbase.hh"
60# include "BLI_string_utf8.hh"
61
62# include "BKE_colorband.hh"
63# include "BKE_colortools.hh"
64# include "BKE_context.hh"
65# include "BKE_image.hh"
66# include "BKE_linestyle.h"
67# include "BKE_main.hh"
68# include "BKE_main_invariants.hh"
71
72# include "DEG_depsgraph.hh"
73
74# include "IMB_colormanagement.hh"
75
76# include "MOV_read.hh"
77
78# include "SEQ_iterator.hh"
79# include "SEQ_relations.hh"
80
81namespace blender {
82
83struct SeqCurveMappingUpdateData {
84 Scene *scene;
85 CurveMapping *curve;
86};
87
88static bool seq_update_modifier_curve(Strip *strip, void *user_data)
89{
90 /* Invalidate cache of any strips that have modifiers using this
91 * curve mapping. */
92 SeqCurveMappingUpdateData *data = static_cast<SeqCurveMappingUpdateData *>(user_data);
93 for (StripModifierData &smd : strip->modifiers) {
94 if (smd.type == eSeqModifierType_Curves) {
95 CurvesModifierData *cmd = reinterpret_cast<CurvesModifierData *>(&smd);
96 if (&cmd->curve_mapping == data->curve) {
98 }
99 }
100 }
101 return true;
102}
103
104static void seq_notify_curve_update(CurveMapping *curve, ID *id)
105{
106 if (id && GS(id->name) == ID_SCE) {
107 Scene *scene = id_cast<Scene *>(id);
108 if (scene->ed) {
109 SeqCurveMappingUpdateData data{scene, curve};
110 seq::foreach_strip(&scene->ed->seqbase, seq_update_modifier_curve, &data);
111 }
112 }
113}
114
115static int rna_CurveMapping_curves_length(PointerRNA *ptr)
116{
117 CurveMapping *cumap = static_cast<CurveMapping *>(ptr->data);
118 int len;
119
120 for (len = 0; len < CM_TOT; len++) {
121 if (!cumap->cm[len].curve) {
122 break;
123 }
124 }
125
126 return len;
127}
128
129static void rna_CurveMapping_curves_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
130{
131 CurveMapping *cumap = static_cast<CurveMapping *>(ptr->data);
132
134 iter, ptr, cumap->cm, sizeof(CurveMap), rna_CurveMapping_curves_length(ptr), 0, nullptr);
135}
136
137static void rna_CurveMapping_clip_set(PointerRNA *ptr, bool value)
138{
139 CurveMapping *cumap = static_cast<CurveMapping *>(ptr->data);
140
141 /* Clipping is always done for wrapped curves, so don't allow user to change it. */
142 if (cumap->flag & CUMA_USE_WRAPPING) {
143 return;
144 }
145
146 if (value) {
147 cumap->flag |= CUMA_DO_CLIP;
148 }
149 else {
150 cumap->flag &= ~CUMA_DO_CLIP;
151 }
152
153 BKE_curvemapping_changed(cumap, false);
154}
155
156static void rna_CurveMapping_black_level_set(PointerRNA *ptr, const float *values)
157{
158 CurveMapping *cumap = static_cast<CurveMapping *>(ptr->data);
159 cumap->black[0] = values[0];
160 cumap->black[1] = values[1];
161 cumap->black[2] = values[2];
162 BKE_curvemapping_set_black_white(cumap, nullptr, nullptr);
163}
164
165static void rna_CurveMapping_white_level_set(PointerRNA *ptr, const float *values)
166{
167 CurveMapping *cumap = static_cast<CurveMapping *>(ptr->data);
168 cumap->white[0] = values[0];
169 cumap->white[1] = values[1];
170 cumap->white[2] = values[2];
171 BKE_curvemapping_set_black_white(cumap, nullptr, nullptr);
172}
173
174static void rna_CurveMapping_tone_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
175{
176 /* Film-like tone only works with the combined curve, which is the fourth curve, so if the user
177 * changed to film-like make the combined curve current, as we now hide the rest of the curves
178 * since they no longer have an effect. */
179 CurveMapping *curve_mapping = static_cast<CurveMapping *>(ptr->data);
180 if (curve_mapping->tone == CURVE_TONE_FILMLIKE) {
181 curve_mapping->cur = 3;
182 }
183
184 seq_notify_curve_update(curve_mapping, ptr->owner_id);
187}
188
189static void rna_CurveMapping_extend_update(Main * /*bmain*/,
190 Scene * /*scene*/,
191 PointerRNA * /*ptr*/)
192{
195}
196
197static void rna_CurveMapping_clipminx_range(
198 PointerRNA *ptr, float *min, float *max, float * /*softmin*/, float * /*softmax*/)
199{
200 CurveMapping *cumap = static_cast<CurveMapping *>(ptr->data);
201
202 *min = -100.0f;
203 *max = cumap->clipr.xmax;
204}
205
206static void rna_CurveMapping_clipminy_range(
207 PointerRNA *ptr, float *min, float *max, float * /*softmin*/, float * /*softmax*/)
208{
209 CurveMapping *cumap = static_cast<CurveMapping *>(ptr->data);
210
211 *min = -100.0f;
212 *max = cumap->clipr.ymax;
213}
214
215static void rna_CurveMapping_clipmaxx_range(
216 PointerRNA *ptr, float *min, float *max, float * /*softmin*/, float * /*softmax*/)
217{
218 CurveMapping *cumap = static_cast<CurveMapping *>(ptr->data);
219
220 *min = cumap->clipr.xmin;
221 *max = 100.0f;
222}
223
224static void rna_CurveMapping_clipmaxy_range(
225 PointerRNA *ptr, float *min, float *max, float * /*softmin*/, float * /*softmax*/)
226{
227 CurveMapping *cumap = static_cast<CurveMapping *>(ptr->data);
228
229 *min = cumap->clipr.ymin;
230 *max = 100.0f;
231}
232
233static std::optional<std::string> rna_ColorRamp_path(const PointerRNA *ptr)
234{
235 /* handle the cases where a single data-block may have 2 ramp types */
236 if (ptr->owner_id) {
237 ID *id = ptr->owner_id;
238
239 switch (GS(id->name)) {
240 case ID_NT: {
241 bNodeTree *ntree = id_cast<bNodeTree *>(id);
242 bNode *node;
243
244 for (node = ntree->nodes.first(); node; node = node->next) {
245 if (ELEM(node->type_legacy, SH_NODE_VALTORGB, TEX_NODE_VALTORGB)) {
246 if (node->storage == ptr->data) {
247 /* all node color ramp properties called 'color_ramp'
248 * prepend path from ID to the node
249 */
250 PointerRNA node_ptr = RNA_pointer_create_discrete(id, RNA_Node, node);
251 std::string node_path = RNA_path_from_ID_to_struct(&node_ptr).value_or("");
252 return fmt::format("{}.color_ramp", node_path);
253 }
254 }
255 }
256 break;
257 }
258
259 case ID_LS: {
260 /* may be nullptr */
261 return BKE_linestyle_path_to_color_ramp(id_cast<FreestyleLineStyle *>(id),
262 static_cast<ColorBand *>(ptr->data));
263 }
264
265 /* Grease Pencil gradients are stored under the #MaterialGPencilStyle the material. */
266 case ID_MA: {
267 return "grease_pencil.gradient";
268 }
269
270 default:
271 /* everything else just uses 'color_ramp' */
272 return "color_ramp";
273 }
274 }
275 else {
276 /* everything else just uses 'color_ramp' */
277 return "color_ramp";
278 }
279
280 return std::nullopt;
281}
282
283static std::optional<std::string> rna_ColorRampElement_path(const PointerRNA *ptr)
284{
285 PointerRNA ramp_ptr;
286 PropertyRNA *prop;
287 std::optional<std::string> path;
288 int index;
289
290 /* helper macro for use here to try and get the path
291 * - this calls the standard code for getting a path to a texture...
292 */
293
294# define COLRAMP_GETPATH \
295 { \
296 prop = RNA_struct_find_property(&ramp_ptr, "elements"); \
297 if (prop) { \
298 index = RNA_property_collection_lookup_index(&ramp_ptr, prop, ptr); \
299 if (index != -1) { \
300 std::string texture_path = rna_ColorRamp_path(&ramp_ptr).value_or(""); \
301 path = fmt::format("{}.elements[{}]", texture_path, index); \
302 } \
303 } \
304 } \
305 (void)0
306
307 /* determine the path from the ID-block to the ramp */
308 /* FIXME: this is a very slow way to do it, but it will have to suffice... */
309 if (ptr->owner_id) {
310 ID *id = ptr->owner_id;
311
312 switch (GS(id->name)) {
313 case ID_NT: {
314 bNodeTree *ntree = id_cast<bNodeTree *>(id);
315 bNode *node;
316
317 for (node = ntree->nodes.first(); node; node = node->next) {
318 if (ELEM(node->type_legacy, SH_NODE_VALTORGB, TEX_NODE_VALTORGB)) {
319 ramp_ptr = RNA_pointer_create_discrete(id, RNA_ColorRamp, node->storage);
320 COLRAMP_GETPATH;
321 }
322 }
323 break;
324 }
325 case ID_LS: {
326 ListBaseT<LinkData> listbase;
327 LinkData *link;
328
329 BKE_linestyle_modifier_list_color_ramps(id_cast<FreestyleLineStyle *>(id), &listbase);
330 for (link = listbase.first(); link; link = link->next) {
331 ramp_ptr = RNA_pointer_create_discrete(id, RNA_ColorRamp, link->data);
332 COLRAMP_GETPATH;
333 }
334 listbase.free_no_destruct();
335 break;
336 }
337 case ID_MA: {
338
341 ramp_ptr = RNA_id_pointer_create(id);
342 if (RNA_path_resolve(&ramp_ptr, "grease_pencil.gradient", &ramp_ptr, &prop)) {
343 COLRAMP_GETPATH;
344 }
345 break;
346 }
347
348 default: /* everything else should have a "color_ramp" property */
349 {
350 /* create pointer to the ID block, and try to resolve "color_ramp" pointer */
351 ramp_ptr = RNA_id_pointer_create(id);
352 if (RNA_path_resolve(&ramp_ptr, "color_ramp", &ramp_ptr, &prop)) {
353 COLRAMP_GETPATH;
354 }
355 break;
356 }
357 }
358 }
359
360 /* cleanup the macro we defined */
361# undef COLRAMP_GETPATH
362
363 return path;
364}
365
366static void rna_ColorRamp_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
367{
368 if (ptr->owner_id) {
369 ID *id = ptr->owner_id;
370
371 switch (GS(id->name)) {
372 case ID_MA: {
373 Material *ma = id_cast<Material *>(ptr->owner_id);
374
375 DEG_id_tag_update(&ma->id, 0);
377 break;
378 }
379 case ID_NT: {
380 bNodeTree *ntree = id_cast<bNodeTree *>(id);
381 bNode *node;
382
383 for (node = ntree->nodes.first(); node; node = node->next) {
384 if (ELEM(node->type_legacy, SH_NODE_VALTORGB, TEX_NODE_VALTORGB)) {
386 BKE_main_ensure_invariants(*bmain, ntree->id);
387 }
388 }
389 break;
390 }
391 case ID_TE: {
392 Tex *tex = id_cast<Tex *>(ptr->owner_id);
393
394 DEG_id_tag_update(&tex->id, 0);
396 break;
397 }
398 case ID_LS: {
399 FreestyleLineStyle *linestyle = id_cast<FreestyleLineStyle *>(ptr->owner_id);
400
402 break;
403 }
404 /* Color Ramp for particle display is owned by the object (see #54422) */
405 case ID_OB:
406 case ID_PA: {
407 ParticleSettings *part = id_cast<ParticleSettings *>(ptr->owner_id);
408
410 }
411 default:
412 break;
413 }
414 }
415}
416
417static void rna_ColorRamp_eval(ColorBand *coba, float position, float color[4])
418{
420}
421
422static CBData *rna_ColorRampElement_new(ColorBand *coba, ReportList *reports, float position)
423{
425
426 if (element == nullptr) {
427 BKE_reportf(reports, RPT_ERROR, "Unable to add element to colorband (limit %d)", MAXCOLORBAND);
428 }
429
430 return element;
431}
432
433static void rna_ColorRampElement_remove(ColorBand *coba,
434 ReportList *reports,
435 PointerRNA *element_ptr)
436{
437 CBData *element = static_cast<CBData *>(element_ptr->data);
438 int index = int(element - coba->data);
440 BKE_report(reports, RPT_ERROR, "Element not found in element collection or last element");
441 return;
442 }
443
444 element_ptr->invalidate();
445}
446
447static void rna_CurveMap_remove_point(CurveMap *cuma, ReportList *reports, PointerRNA *point_ptr)
448{
449 CurveMapPoint *point = static_cast<CurveMapPoint *>(point_ptr->data);
450 if (BKE_curvemap_remove_point(cuma, point) == false) {
451 BKE_report(reports, RPT_ERROR, "Unable to remove curve point");
452 return;
453 }
454
455 point_ptr->invalidate();
456}
457
458static void rna_Scopes_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA *ptr)
459{
460 Scopes *s = static_cast<Scopes *>(ptr->data);
461 s->ok = 0;
462}
463
464static const ColorManagedDisplaySettings *rna_display_settings_from_view_settings(
465 const PointerRNA *ptr, const Scene *scene = nullptr)
466{
467 /* Assumes view_settings and display_settings are stored next to each other. */
468 PointerRNA parent_ptr = ptr->parent();
469 if (parent_ptr) {
470 PointerRNA display_ptr = RNA_pointer_get(&parent_ptr, "display_settings");
471 if (display_ptr.type == RNA_ColorManagedDisplaySettings) {
472 return display_ptr.data_as<const ColorManagedDisplaySettings>();
473 }
474 }
475
476 if (ptr->owner_id && GS(ptr->owner_id->name) == ID_SCE) {
477 return &reinterpret_cast<const Scene *>(ptr->owner_id)->display_settings;
478 }
479
480 if (scene) {
481 /* Shouldn't be necessary and is not correct in general, but just in case. */
482 return &scene->display_settings;
483 }
484
485 return nullptr;
486}
487
488static ColorManagedViewSettings *rna_view_settings_from_display_settings(PointerRNA *ptr)
489{
490 /* Assumes view_settings and display_settings are stored next to each other. */
491 PointerRNA parent_ptr = ptr->parent();
492 if (parent_ptr) {
493 PointerRNA view_ptr = RNA_pointer_get(&parent_ptr, "view_settings");
494 if (view_ptr.type == RNA_ColorManagedViewSettings) {
495 return view_ptr.data_as<ColorManagedViewSettings>();
496 }
497 }
498
499 return nullptr;
500}
501
502static int rna_ColorManagedDisplaySettings_display_device_get(PointerRNA *ptr)
503{
504 ColorManagedDisplaySettings *display = static_cast<ColorManagedDisplaySettings *>(ptr->data);
505
506 return IMB_colormanagement_display_get_named_index(display->display_device);
507}
508
509static void rna_ColorManagedDisplaySettings_display_device_set(PointerRNA *ptr, int value)
510{
511 ColorManagedDisplaySettings *display = static_cast<ColorManagedDisplaySettings *>(ptr->data);
512 const char *name = IMB_colormanagement_display_get_indexed_name(value);
513
514 /* Keep the current display for invalid indices, that may come from animation. */
515 if (name && name[0]) {
516 STRNCPY_UTF8(display->display_device, name);
517 }
518}
519
520static const EnumPropertyItem *rna_ColorManagedDisplaySettings_display_device_itemf(
521 bContext * /*C*/, PointerRNA * /*ptr*/, PropertyRNA * /*prop*/, bool *r_free)
522{
523 EnumPropertyItem *items = nullptr;
524 int totitem = 0;
525
527 RNA_enum_item_end(&items, &totitem);
528
529 *r_free = true;
530
531 return items;
532}
533
534static void rna_display_and_view_settings_node_update(Main *bmain, PointerRNA *ptr)
535{
536 ID *id = ptr->owner_id;
537
538 if (id && GS(id->name) == ID_NT) {
539 /* Find a node ancestor and tag it. */
540 PointerRNA node_ptr = ptr->parent();
541 while (node_ptr && !RNA_struct_is_a(node_ptr.type, RNA_Node)) {
542 node_ptr = node_ptr.parent();
543 }
544
545 if (node_ptr) {
546 bNodeTree *ntree = reinterpret_cast<bNodeTree *>(id);
547 bNode *node = node_ptr.data_as<bNode>();
549 BKE_main_ensure_invariants(*bmain, ntree->id);
550 }
551 }
552}
553
554static void rna_ColorManagedDisplaySettings_display_device_update(Main *bmain,
555 Scene * /*scene*/,
556 PointerRNA *ptr)
557{
558 ID *id = ptr->owner_id;
559
560 if (id && GS(id->name) == ID_SCE) {
561 Scene *scene = id_cast<Scene *>(id);
562
563 IMB_colormanagement_validate_settings(&scene->display_settings, &scene->view_settings);
564
565 DEG_id_tag_update(id, 0);
567
568 /* Color management can be baked into shaders, need to refresh. */
569 for (Material *ma = bmain->materials.first(); ma; ma = static_cast<Material *>(ma->id.next)) {
571 }
572 }
573 else {
574 ColorManagedViewSettings *view_settings = rna_view_settings_from_display_settings(ptr);
575 if (view_settings) {
577 view_settings);
578 if (ptr->owner_id) {
579 DEG_id_tag_update(ptr->owner_id, 0);
580 }
581 }
582
583 rna_display_and_view_settings_node_update(bmain, ptr);
584 }
585}
586
587static int rna_ColorManagedViewSettings_view_transform_get(PointerRNA *ptr)
588{
589 ColorManagedViewSettings *view = static_cast<ColorManagedViewSettings *>(ptr->data);
590 return IMB_colormanagement_view_get_id_by_name(view->view_transform);
591}
592
593static void rna_ColorManagedViewSettings_view_transform_set(PointerRNA *ptr, int value)
594{
595 ColorManagedViewSettings *view = static_cast<ColorManagedViewSettings *>(ptr->data);
596
597 const char *view_name = IMB_colormanagement_view_get_name_by_id(value);
598 if (!view_name) {
599 return;
600 }
601
602 STRNCPY_UTF8(view->view_transform, view_name);
603
604 const char *look_name = IMB_colormanagement_look_validate_for_view(view_name, view->look);
605 if (look_name) {
606 STRNCPY_UTF8(view->look, look_name);
607 }
608}
609
610static const EnumPropertyItem *rna_ColorManagedViewSettings_view_transform_itemf(
611 bContext *C, PointerRNA *ptr, PropertyRNA * /*prop*/, bool *r_free)
612{
613 const ColorManagedDisplaySettings *display_settings = rna_display_settings_from_view_settings(
614 ptr, CTX_data_scene(C));
615
616 EnumPropertyItem *items = nullptr;
617 int totitem = 0;
618
619 IMB_colormanagement_view_items_add(&items, &totitem, display_settings->display_device);
620 RNA_enum_item_end(&items, &totitem);
621
622 *r_free = true;
623 return items;
624}
625
626static int rna_ColorManagedViewSettings_look_get(PointerRNA *ptr)
627{
628 ColorManagedViewSettings *view = static_cast<ColorManagedViewSettings *>(ptr->data);
629
631}
632
633static void rna_ColorManagedViewSettings_look_set(PointerRNA *ptr, int value)
634{
635 ColorManagedViewSettings *view = static_cast<ColorManagedViewSettings *>(ptr->data);
636
637 const char *name = IMB_colormanagement_look_get_indexed_name(value);
638
639 if (name) {
640 STRNCPY_UTF8(view->look, name);
641 }
642}
643
644static const EnumPropertyItem *rna_ColorManagedViewSettings_look_itemf(bContext * /*C*/,
645 PointerRNA *ptr,
646 PropertyRNA * /*prop*/,
647 bool *r_free)
648{
649 ColorManagedViewSettings *view = static_cast<ColorManagedViewSettings *>(ptr->data);
650 EnumPropertyItem *items = nullptr;
651 int totitem = 0;
652
653 IMB_colormanagement_look_items_add(&items, &totitem, view->view_transform);
654 RNA_enum_item_end(&items, &totitem);
655
656 *r_free = true;
657 return items;
658}
659
660static void rna_ColorManagedViewSettings_use_curves_set(PointerRNA *ptr, bool value)
661{
662 ColorManagedViewSettings *view_settings = static_cast<ColorManagedViewSettings *>(ptr->data);
663
664 if (value) {
665 view_settings->flag |= COLORMANAGE_VIEW_USE_CURVES;
666
667 if (view_settings->curve_mapping == nullptr) {
668 view_settings->curve_mapping = BKE_curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
669 }
670 }
671 else {
672 view_settings->flag &= ~COLORMANAGE_VIEW_USE_CURVES;
673 }
674}
675
676static void rna_ColorManagedViewSettings_whitepoint_get(PointerRNA *ptr, float value[3])
677{
678 const ColorManagedViewSettings *view_settings = static_cast<ColorManagedViewSettings *>(
679 ptr->data);
680 IMB_colormanagement_get_whitepoint(view_settings->temperature, view_settings->tint, value);
681}
682
683static void rna_ColorManagedViewSettings_whitepoint_set(PointerRNA *ptr, const float value[3])
684{
685 ColorManagedViewSettings *view_settings = static_cast<ColorManagedViewSettings *>(ptr->data);
686 IMB_colormanagement_set_whitepoint(value, view_settings->temperature, view_settings->tint);
687}
688
689static bool rna_ColorManagedViewSettings_is_hdr_get(PointerRNA *ptr)
690{
691 ColorManagedViewSettings *view_settings = static_cast<ColorManagedViewSettings *>(ptr->data);
692 if (GS(ptr->owner_id->name) != ID_SCE) {
693 return false;
694 }
695 const Scene *scene = reinterpret_cast<const Scene *>(ptr->owner_id);
696 if (&scene->view_settings != view_settings) {
697 return false;
698 }
699 return IMB_colormanagement_display_is_hdr(&scene->display_settings,
700 view_settings->view_transform);
701}
702
703static bool rna_ColorManagedViewSettings_support_emulation_get(PointerRNA *ptr)
704{
705 ColorManagedViewSettings *view_settings = static_cast<ColorManagedViewSettings *>(ptr->data);
706 if (GS(ptr->owner_id->name) != ID_SCE) {
707 return false;
708 }
709 const Scene *scene = reinterpret_cast<const Scene *>(ptr->owner_id);
710 if (&scene->view_settings != view_settings) {
711 return false;
712 }
713 return IMB_colormanagement_display_support_emulation(&scene->display_settings,
714 view_settings->view_transform);
715}
716
717static int rna_ViewSettings_only_view_look_editable(const PointerRNA *ptr, const char **r_info)
718{
719 ColorManagedViewSettings *view_settings = static_cast<ColorManagedViewSettings *>(ptr->data);
720
721 if (view_settings->flag & COLORMANAGE_VIEW_ONLY_VIEW_LOOK) {
722 if (r_info) {
723 *r_info = N_("Only view transform and look can be edited for these settings");
724 }
725 return 0;
726 }
727
728 return PROP_EDITABLE;
729}
730
731static bool rna_ColorManagedColorspaceSettings_is_data_get(PointerRNA *ptr)
732{
734 ptr->data);
736 return STREQ(colorspace->name, data_name);
737}
738
739static void rna_ColorManagedColorspaceSettings_is_data_set(PointerRNA *ptr, bool value)
740{
742 ptr->data);
743 if (value) {
746 }
747}
748
749static int rna_ColorManagedColorspaceSettings_colorspace_get(PointerRNA *ptr)
750{
752 ptr->data);
753
755}
756
757static void rna_ColorManagedColorspaceSettings_colorspace_set(PointerRNA *ptr, int value)
758{
760 ptr->data);
761 const char *name = IMB_colormanagement_colorspace_get_indexed_name(value);
762
763 if (name && name[0]) {
765 }
766}
767
768static int rna_ColorManagedColorspaceSettings_interop_id_get(PointerRNA *ptr)
769{
771 ptr->data);
773 colorspace->interop_id);
774}
775
776static void rna_ColorManagedColorspaceSettings_interop_id_set(PointerRNA *ptr, int value)
777{
779 ptr->data);
781}
782
783static const EnumPropertyItem *rna_ColorManagedColorspaceSettings_interop_id_itemf(
784 bContext * /*C*/, PointerRNA * /*ptr*/, PropertyRNA * /*prop*/, bool *r_free)
785{
786 EnumPropertyItem *items = nullptr;
787 int totitem = 0;
788
791 RNA_enum_item_end(&items, &totitem);
792
793 *r_free = true;
794
795 return items;
796}
797
798static const EnumPropertyItem *rna_ColorManagedColorspaceSettings_colorspace_itemf(
799 bContext * /*C*/, PointerRNA * /*ptr*/, PropertyRNA * /*prop*/, bool *r_free)
800{
801 EnumPropertyItem *items = nullptr;
802 int totitem = 0;
803
805 RNA_enum_item_end(&items, &totitem);
806
807 *r_free = true;
808
809 return items;
810}
811
812static void rna_ColorManagedColorspaceSettings_reload_update(Main *bmain,
813 Scene * /*scene*/,
814 PointerRNA *ptr)
815{
816 ID *id = ptr->owner_id;
817
818 if (!id) {
819 /* Happens for color space settings on operators. */
820 return;
821 }
822
823 if (GS(id->name) == ID_IM) {
824 Image *ima = id_cast<Image *>(id);
825
826 DEG_id_tag_update(&ima->id, 0);
828
829 BKE_image_signal(bmain, ima, nullptr, IMA_SIGNAL_COLORMANAGE);
830
833 }
834 else if (GS(id->name) == ID_MC) {
835 MovieClip *clip = id_cast<MovieClip *>(id);
836
839
842 }
843 else if (GS(id->name) == ID_SCE) {
844 Scene *scene = id_cast<Scene *>(id);
846
847 if (scene->ed) {
848 ColorManagedColorspaceSettings *colorspace_settings =
849 static_cast<ColorManagedColorspaceSettings *>(ptr->data);
850
851 if (&scene->sequencer_colorspace_settings == colorspace_settings) {
852 /* Scene colorspace was changed. */
854 }
855 else {
856 /* Strip colorspace was likely changed. */
857 Strip *strip = rna_strip_find_by_colorspace_settings(scene->ed, colorspace_settings);
858
859 if (strip) {
860 if (strip->data->proxy && strip->data->proxy->anim) {
861 MOV_close(strip->data->proxy->anim);
862 strip->data->proxy->anim = nullptr;
863 }
864
866 }
867 }
868
870 }
871 }
872}
873
874static std::optional<std::string> rna_ColorManagedSequencerColorspaceSettings_path(
875 const PointerRNA * /*ptr*/)
876{
877 return "sequencer_colorspace_settings";
878}
879
880static void rna_ColorManagement_update(Main *bmain, Scene * /*scene*/, PointerRNA *ptr)
881{
882 ID *id = ptr->owner_id;
883
884 if (!id) {
885 return;
886 }
887
888 if (GS(id->name) == ID_SCE) {
890 }
891 else {
892 rna_display_and_view_settings_node_update(bmain, ptr);
893 }
894}
895
896/* this function only exists because #BKE_curvemap_evaluateF uses a 'const' qualifier */
897static float rna_CurveMapping_evaluateF(CurveMapping *cumap,
898 ReportList *reports,
899 CurveMap *cuma,
900 float value)
901{
902 if (&cumap->cm[0] != cuma && &cumap->cm[1] != cuma && &cumap->cm[2] != cuma &&
903 &cumap->cm[3] != cuma)
904 {
905 BKE_report(reports, RPT_ERROR, "CurveMapping does not own CurveMap");
906 return 0.0f;
907 }
908
909 if (!cuma->table) {
911 }
912 return BKE_curvemap_evaluateF(cumap, cuma, value);
913}
914
915static void rna_CurveMap_initialize(CurveMapping *cumap)
916{
918}
919
920} // namespace blender
921
922#else
923
924namespace blender {
925
927{
928 StructRNA *srna;
929 PropertyRNA *prop;
930 static const EnumPropertyItem prop_handle_type_items[] = {
931 {0, "AUTO", 0, "Auto Handle", ""},
932 {CUMA_HANDLE_AUTO_ANIM, "AUTO_CLAMPED", 0, "Auto-Clamped Handle", ""},
933 {CUMA_HANDLE_VECTOR, "VECTOR", 0, "Vector Handle", ""},
934 {0, nullptr, 0, nullptr, nullptr},
935 };
936
937 srna = RNA_def_struct(brna, "CurveMapPoint", nullptr);
938 RNA_def_struct_ui_text(srna, "CurveMapPoint", "Point of a curve used for a curve mapping");
939
940 prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ);
941 RNA_def_property_float_sdna(prop, nullptr, "x");
942 RNA_def_property_array(prop, 2);
943 RNA_def_property_ui_text(prop, "Location", "X/Y coordinates of the curve point");
944
945 prop = RNA_def_property(srna, "handle_type", PROP_ENUM, PROP_NONE);
946 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "flag");
947 RNA_def_property_enum_items(prop, prop_handle_type_items);
949 prop, "Handle Type", "Curve interpolation at this point: Bézier or vector");
950
951 prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
952 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CUMA_SELECT);
953 RNA_def_property_ui_text(prop, "Select", "Selection state of the curve point");
954}
955
957{
958 StructRNA *srna;
959 PropertyRNA *parm;
960 FunctionRNA *func;
961
962 RNA_def_property_srna(cprop, "CurveMapPoints");
963 srna = RNA_def_struct(brna, "CurveMapPoints", nullptr);
964 RNA_def_struct_sdna(srna, "CurveMap");
965 RNA_def_struct_ui_text(srna, "Curve Map Point", "Collection of Curve Map Points");
966
967 func = RNA_def_function(srna, "new", "BKE_curvemap_insert");
968 RNA_def_function_ui_description(func, "Add point to CurveMap");
969 parm = RNA_def_float(func,
970 "position",
971 0.0f,
972 -FLT_MAX,
973 FLT_MAX,
974 "Position",
975 "Position to add point",
976 -FLT_MAX,
977 FLT_MAX);
979 parm = RNA_def_float(
980 func, "value", 0.0f, -FLT_MAX, FLT_MAX, "Value", "Value of point", -FLT_MAX, FLT_MAX);
982 parm = RNA_def_pointer(func, "point", "CurveMapPoint", "", "New point");
984 RNA_def_function_return(func, parm);
985
986 func = RNA_def_function(srna, "remove", "rna_CurveMap_remove_point");
988 RNA_def_function_ui_description(func, "Delete point from CurveMap");
989 parm = RNA_def_pointer(func, "point", "CurveMapPoint", "", "PointElement to remove");
992}
993
994static void rna_def_curvemap(BlenderRNA *brna)
995{
996 StructRNA *srna;
997 PropertyRNA *prop;
998
999 srna = RNA_def_struct(brna, "CurveMap", nullptr);
1000 RNA_def_struct_ui_text(srna, "CurveMap", "Curve in a curve mapping");
1001
1002 prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
1003 RNA_def_property_collection_sdna(prop, nullptr, "curve", "totpoint");
1004 RNA_def_property_struct_type(prop, "CurveMapPoint");
1005 RNA_def_property_ui_text(prop, "Points", "");
1006 rna_def_curvemap_points_api(brna, prop);
1007}
1008
1010{
1011 StructRNA *srna;
1012 PropertyRNA *prop, *parm;
1013 FunctionRNA *func;
1014
1015 static const EnumPropertyItem tone_items[] = {
1017 "STANDARD",
1018 0,
1019 "Standard",
1020 "Combined curve is applied to each channel individually, which may result in a change of "
1021 "hue"},
1022 {CURVE_TONE_FILMLIKE, "FILMLIKE", 0, "Filmlike", "Keeps the hue constant"},
1023 {0, nullptr, 0, nullptr, nullptr},
1024 };
1025
1026 static const EnumPropertyItem prop_extend_items[] = {
1027 {0, "HORIZONTAL", 0, "Horizontal", ""},
1028 {CUMA_EXTEND_EXTRAPOLATE, "EXTRAPOLATED", 0, "Extrapolated", ""},
1029 {0, nullptr, 0, nullptr, nullptr},
1030 };
1031
1032 srna = RNA_def_struct(brna, "CurveMapping", nullptr);
1034 srna,
1035 "CurveMapping",
1036 "Curve mapping to map color, vector and scalar values to other values using "
1037 "a user defined curve");
1038
1039 prop = RNA_def_property(srna, "tone", PROP_ENUM, PROP_NONE);
1040 RNA_def_property_enum_sdna(prop, nullptr, "tone");
1041 RNA_def_property_enum_items(prop, tone_items);
1042 RNA_def_property_ui_text(prop, "Tone", "Tone of the curve");
1043 RNA_def_property_update(prop, 0, "rna_CurveMapping_tone_update");
1044
1045 prop = RNA_def_property(srna, "use_clip", PROP_BOOLEAN, PROP_NONE);
1046 RNA_def_property_boolean_sdna(prop, nullptr, "flag", CUMA_DO_CLIP);
1047 RNA_def_property_ui_text(prop, "Clip", "Force the curve view to fit a defined boundary");
1048 RNA_def_property_boolean_funcs(prop, nullptr, "rna_CurveMapping_clip_set");
1049
1050 prop = RNA_def_property(srna, "clip_min_x", PROP_FLOAT, PROP_NONE);
1051 RNA_def_property_float_sdna(prop, nullptr, "clipr.xmin");
1052 RNA_def_property_range(prop, -100.0f, 100.0f);
1053 RNA_def_property_ui_text(prop, "Clip Min X", "");
1054 RNA_def_property_float_funcs(prop, nullptr, nullptr, "rna_CurveMapping_clipminx_range");
1055
1056 prop = RNA_def_property(srna, "clip_min_y", PROP_FLOAT, PROP_NONE);
1057 RNA_def_property_float_sdna(prop, nullptr, "clipr.ymin");
1058 RNA_def_property_range(prop, -100.0f, 100.0f);
1059 RNA_def_property_ui_text(prop, "Clip Min Y", "");
1060 RNA_def_property_float_funcs(prop, nullptr, nullptr, "rna_CurveMapping_clipminy_range");
1061
1062 prop = RNA_def_property(srna, "clip_max_x", PROP_FLOAT, PROP_NONE);
1063 RNA_def_property_float_sdna(prop, nullptr, "clipr.xmax");
1064 RNA_def_property_range(prop, -100.0f, 100.0f);
1065 RNA_def_property_ui_text(prop, "Clip Max X", "");
1066 RNA_def_property_float_funcs(prop, nullptr, nullptr, "rna_CurveMapping_clipmaxx_range");
1067
1068 prop = RNA_def_property(srna, "clip_max_y", PROP_FLOAT, PROP_NONE);
1069 RNA_def_property_float_sdna(prop, nullptr, "clipr.ymax");
1070 RNA_def_property_range(prop, -100.0f, 100.0f);
1071 RNA_def_property_ui_text(prop, "Clip Max Y", "");
1072 RNA_def_property_float_funcs(prop, nullptr, nullptr, "rna_CurveMapping_clipmaxy_range");
1073
1074 prop = RNA_def_property(srna, "extend", PROP_ENUM, PROP_NONE);
1075 RNA_def_property_enum_bitflag_sdna(prop, nullptr, "flag");
1076 RNA_def_property_enum_items(prop, prop_extend_items);
1077 RNA_def_property_ui_text(prop, "Extend", "Extrapolate the curve or extend it horizontally");
1079 RNA_def_property_update(prop, 0, "rna_CurveMapping_extend_update");
1080
1081 prop = RNA_def_property(srna, "curves", PROP_COLLECTION, PROP_NONE);
1083 "rna_CurveMapping_curves_begin",
1084 "rna_iterator_array_next",
1085 "rna_iterator_array_end",
1086 "rna_iterator_array_get",
1087 "rna_CurveMapping_curves_length",
1088 nullptr,
1089 nullptr,
1090 nullptr);
1091 RNA_def_property_struct_type(prop, "CurveMap");
1092 RNA_def_property_ui_text(prop, "Curves", "");
1093
1094 prop = RNA_def_property(srna, "black_level", PROP_FLOAT, PROP_COLOR);
1095 RNA_def_property_float_sdna(prop, nullptr, "black");
1097 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 1, 3);
1099 prop, "Black Level", "For RGB curves, the color that black is mapped to");
1100 RNA_def_property_float_funcs(prop, nullptr, "rna_CurveMapping_black_level_set", nullptr);
1101
1102 prop = RNA_def_property(srna, "white_level", PROP_FLOAT, PROP_COLOR);
1103 RNA_def_property_float_sdna(prop, nullptr, "white");
1105 RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 1, 3);
1107 prop, "White Level", "For RGB curves, the color that white is mapped to");
1108 RNA_def_property_float_funcs(prop, nullptr, "rna_CurveMapping_white_level_set", nullptr);
1109
1110 func = RNA_def_function(srna, "update", "BKE_curvemapping_changed_all");
1111 RNA_def_function_ui_description(func, "Update curve mapping after making changes");
1112
1113 func = RNA_def_function(srna, "reset_view", "BKE_curvemapping_reset_view");
1114 RNA_def_function_ui_description(func, "Reset the curve mapping grid to its clipping size");
1115
1116 func = RNA_def_function(srna, "initialize", "rna_CurveMap_initialize");
1117 RNA_def_function_ui_description(func, "Initialize curve");
1118
1119 func = RNA_def_function(srna, "evaluate", "rna_CurveMapping_evaluateF");
1121 RNA_def_function_ui_description(func, "Evaluate curve at given location");
1122 parm = RNA_def_pointer(func, "curve", "CurveMap", "curve", "Curve to evaluate");
1124 parm = RNA_def_float(func,
1125 "position",
1126 0.0f,
1127 -FLT_MAX,
1128 FLT_MAX,
1129 "Position",
1130 "Position to evaluate curve at",
1131 -FLT_MAX,
1132 FLT_MAX);
1134 parm = RNA_def_float(func,
1135 "value",
1136 0.0f,
1137 -FLT_MAX,
1138 FLT_MAX,
1139 "Value",
1140 "Value of curve at given location",
1141 -FLT_MAX,
1142 FLT_MAX);
1143 RNA_def_function_return(func, parm);
1144}
1145
1147{
1148 StructRNA *srna;
1149 PropertyRNA *prop;
1150
1151 srna = RNA_def_struct(brna, "ColorRampElement", nullptr);
1152 RNA_def_struct_sdna(srna, "CBData");
1153 RNA_def_struct_path_func(srna, "rna_ColorRampElement_path");
1155 srna, "Color Ramp Element", "Element defining a color at a position in the color ramp");
1156
1157 prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
1158 RNA_def_property_float_sdna(prop, nullptr, "r");
1159 RNA_def_property_array(prop, 4);
1160 RNA_def_property_ui_text(prop, "Color", "Set color of selected color stop");
1161 RNA_def_property_update(prop, 0, "rna_ColorRamp_update");
1162
1163 prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_COLOR);
1164 RNA_def_property_float_sdna(prop, nullptr, "a");
1165 RNA_def_property_ui_text(prop, "Alpha", "Set alpha of selected color stop");
1166 RNA_def_property_update(prop, 0, "rna_ColorRamp_update");
1167
1168 prop = RNA_def_property(srna, "position", PROP_FLOAT, PROP_NONE);
1169 RNA_def_property_float_sdna(prop, nullptr, "pos");
1170 RNA_def_property_range(prop, 0, 1);
1171 RNA_def_property_ui_range(prop, 0, 1, 1, 3);
1172 RNA_def_property_ui_text(prop, "Position", "Set position of selected color stop");
1173 RNA_def_property_update(prop, 0, "rna_ColorRamp_update");
1174}
1175
1177{
1178 StructRNA *srna;
1179 PropertyRNA *parm;
1180 FunctionRNA *func;
1181
1182 RNA_def_property_srna(cprop, "ColorRampElements");
1183 srna = RNA_def_struct(brna, "ColorRampElements", nullptr);
1184 RNA_def_struct_sdna(srna, "ColorBand");
1185 RNA_def_struct_path_func(srna, "rna_ColorRampElement_path");
1186 RNA_def_struct_ui_text(srna, "Color Ramp Elements", "Collection of Color Ramp Elements");
1187
1188 /* TODO: make these functions generic in `texture.cc`. */
1189 func = RNA_def_function(srna, "new", "rna_ColorRampElement_new");
1190 RNA_def_function_ui_description(func, "Add element to Color Ramp");
1192 parm = RNA_def_float(
1193 func, "position", 0.0f, 0.0f, 1.0f, "Position", "Position to add element", 0.0f, 1.0f);
1195 /* return type */
1196 parm = RNA_def_pointer(func, "element", "ColorRampElement", "", "New element");
1198 RNA_def_function_return(func, parm);
1199
1200 func = RNA_def_function(srna, "remove", "rna_ColorRampElement_remove");
1201 RNA_def_function_ui_description(func, "Delete element from Color Ramp");
1203 parm = RNA_def_pointer(func, "element", "ColorRampElement", "", "Element to remove");
1206}
1207
1209{
1210 StructRNA *srna;
1211 PropertyRNA *prop;
1212
1213 FunctionRNA *func;
1214 PropertyRNA *parm;
1215
1217 {COLBAND_INTERP_EASE, "EASE", 0, "Ease", ""},
1218 {COLBAND_INTERP_CARDINAL, "CARDINAL", 0, "Cardinal", ""},
1219 {COLBAND_INTERP_LINEAR, "LINEAR", 0, "Linear", ""},
1220 {COLBAND_INTERP_B_SPLINE, "B_SPLINE", 0, "B-Spline", ""},
1221 {COLBAND_INTERP_CONSTANT, "CONSTANT", 0, "Constant", ""},
1222 {0, nullptr, 0, nullptr, nullptr},
1223 };
1224
1225 static const EnumPropertyItem prop_mode_items[] = {
1226 {COLBAND_BLEND_RGB, "RGB", 0, "RGB", ""},
1227 {COLBAND_BLEND_HSV, "HSV", 0, "HSV", ""},
1228 {COLBAND_BLEND_HSL, "HSL", 0, "HSL", ""},
1229 {0, nullptr, 0, nullptr, nullptr},
1230 };
1231
1232 static const EnumPropertyItem prop_hsv_items[] = {
1233 {COLBAND_HUE_NEAR, "NEAR", 0, "Near", ""},
1234 {COLBAND_HUE_FAR, "FAR", 0, "Far", ""},
1235 {COLBAND_HUE_CW, "CW", 0, "Clockwise", ""},
1236 {COLBAND_HUE_CCW, "CCW", 0, "Counter-Clockwise", ""},
1237 {0, nullptr, 0, nullptr, nullptr},
1238 };
1239
1240 srna = RNA_def_struct(brna, "ColorRamp", nullptr);
1241 RNA_def_struct_sdna(srna, "ColorBand");
1242 RNA_def_struct_path_func(srna, "rna_ColorRamp_path");
1243 RNA_def_struct_ui_text(srna, "Color Ramp", "Color ramp mapping a scalar value to a color");
1244
1245 prop = RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_COLOR);
1246 RNA_def_property_collection_sdna(prop, nullptr, "data", "tot");
1247 RNA_def_property_struct_type(prop, "ColorRampElement");
1248 RNA_def_property_ui_text(prop, "Elements", "");
1249 RNA_def_property_update(prop, 0, "rna_ColorRamp_update");
1251
1252 prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
1253 RNA_def_property_enum_sdna(prop, nullptr, "ipotype");
1255 RNA_def_property_ui_text(prop, "Interpolation", "Set interpolation between color stops");
1256 RNA_def_property_update(prop, 0, "rna_ColorRamp_update");
1257
1258 prop = RNA_def_property(srna, "hue_interpolation", PROP_ENUM, PROP_NONE);
1259 RNA_def_property_enum_sdna(prop, nullptr, "ipotype_hue");
1260 RNA_def_property_enum_items(prop, prop_hsv_items);
1261 RNA_def_property_ui_text(prop, "Color Interpolation", "Set color interpolation");
1262 RNA_def_property_update(prop, 0, "rna_ColorRamp_update");
1263
1264 prop = RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE);
1265 RNA_def_property_enum_sdna(prop, nullptr, "color_mode");
1266 RNA_def_property_enum_items(prop, prop_mode_items);
1267 RNA_def_property_ui_text(prop, "Color Mode", "Set color mode to use for interpolation");
1268 RNA_def_property_update(prop, 0, "rna_ColorRamp_update");
1269
1270# if 0 /* use len(elements) */
1271 prop = RNA_def_property(srna, "total", PROP_INT, PROP_NONE);
1272 RNA_def_property_int_sdna(prop, nullptr, "tot");
1273 /* needs a function to do the right thing when adding elements like colorband_add_cb() */
1275 RNA_def_property_range(prop, 0, 31); /* MAXCOLORBAND = 32 */
1276 RNA_def_property_ui_text(prop, "Total", "Total number of elements");
1277 RNA_def_property_update(prop, 0, "rna_ColorRamp_update");
1278# endif
1279
1280 func = RNA_def_function(srna, "evaluate", "rna_ColorRamp_eval");
1281 RNA_def_function_ui_description(func, "Evaluate Color Ramp");
1282 parm = RNA_def_float(func,
1283 "position",
1284 1.0f,
1285 0.0f,
1286 1.0f,
1287 "Position",
1288 "Evaluate Color Ramp at position",
1289 0.0f,
1290 1.0f);
1292 /* return */
1293 parm = RNA_def_float_color(func,
1294 "color",
1295 4,
1296 nullptr,
1297 -FLT_MAX,
1298 FLT_MAX,
1299 "Color",
1300 "Color at given position",
1301 -FLT_MAX,
1302 FLT_MAX);
1304 RNA_def_function_output(func, parm);
1305}
1306
1308{
1309 StructRNA *srna;
1310 PropertyRNA *prop;
1311
1312 static const EnumPropertyItem prop_mode_items[] = {
1313 {HISTO_MODE_LUMA, "LUMA", 0, "Luma", "Luma"},
1314 {HISTO_MODE_RGB, "RGB", 0, "RGB", "Red Green Blue"},
1315 {HISTO_MODE_R, "R", 0, "R", "Red"},
1316 {HISTO_MODE_G, "G", 0, "G", "Green"},
1317 {HISTO_MODE_B, "B", 0, "B", "Blue"},
1318 {HISTO_MODE_ALPHA, "A", 0, "A", "Alpha"},
1319 {0, nullptr, 0, nullptr, nullptr},
1320 };
1321
1322 srna = RNA_def_struct(brna, "Histogram", nullptr);
1323 RNA_def_struct_ui_text(srna, "Histogram", "Statistical view of the levels of color in an image");
1324
1325 prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
1326 RNA_def_property_enum_sdna(prop, nullptr, "mode");
1327 RNA_def_property_enum_items(prop, prop_mode_items);
1328 RNA_def_property_ui_text(prop, "Mode", "Channels to display in the histogram");
1330
1331 prop = RNA_def_property(srna, "show_line", PROP_BOOLEAN, PROP_NONE);
1332 RNA_def_property_boolean_sdna(prop, nullptr, "flag", HISTO_FLAG_LINE);
1333 RNA_def_property_ui_text(prop, "Show Line", "Display lines rather than filled shapes");
1334 RNA_def_property_ui_icon(prop, ICON_GRAPH, 0);
1335}
1336
1337static void rna_def_scopes(BlenderRNA *brna)
1338{
1339 StructRNA *srna;
1340 PropertyRNA *prop;
1341
1342 static const EnumPropertyItem prop_wavefrm_mode_items[] = {
1343 {SCOPES_WAVEFRM_LUMA, "LUMA", ICON_COLOR, "Luma", ""},
1344 {SCOPES_WAVEFRM_RGB_PARADE, "PARADE", ICON_COLOR, "Parade", ""},
1345 {SCOPES_WAVEFRM_YCC_601, "YCBCR601", ICON_COLOR, "YCbCr (ITU 601)", ""},
1346 {SCOPES_WAVEFRM_YCC_709, "YCBCR709", ICON_COLOR, "YCbCr (ITU 709)", ""},
1347 {SCOPES_WAVEFRM_YCC_JPEG, "YCBCRJPG", ICON_COLOR, "YCbCr (JPEG)", ""},
1348 {SCOPES_WAVEFRM_RGB, "RGB", ICON_COLOR, "Red Green Blue", ""},
1349 {0, nullptr, 0, nullptr, nullptr},
1350 };
1351
1352 static const EnumPropertyItem prop_vecscope_mode_items[] = {
1353 {SCOPES_VECSCOPE_LUMA, "LUMA", ICON_COLOR, "Luma", ""},
1354 {SCOPES_VECSCOPE_RGB, "RGB", ICON_COLOR, "Red Green Blue", ""},
1355 {0, nullptr, 0, nullptr, nullptr},
1356 };
1357
1358 srna = RNA_def_struct(brna, "Scopes", nullptr);
1359 RNA_def_struct_ui_text(srna, "Scopes", "Scopes for statistical view of an image");
1360
1361 prop = RNA_def_property(srna, "use_full_resolution", PROP_BOOLEAN, PROP_NONE);
1362 RNA_def_property_boolean_sdna(prop, "Scopes", "sample_full", 1);
1363 RNA_def_property_ui_text(prop, "Full Sample", "Sample every pixel of the image");
1364 RNA_def_property_update(prop, 0, "rna_Scopes_update");
1365
1366 prop = RNA_def_property(srna, "accuracy", PROP_FLOAT, PROP_PERCENTAGE);
1367 RNA_def_property_float_sdna(prop, "Scopes", "accuracy");
1368 RNA_def_property_range(prop, 0.0, 100.0);
1369 RNA_def_property_ui_range(prop, 0.0, 100.0, 10, 1);
1371 prop, "Accuracy", "Proportion of original image source pixel lines to sample");
1372 RNA_def_property_update(prop, 0, "rna_Scopes_update");
1373
1374 prop = RNA_def_property(srna, "histogram", PROP_POINTER, PROP_NONE);
1375 RNA_def_property_pointer_sdna(prop, "Scopes", "hist");
1376 RNA_def_property_struct_type(prop, "Histogram");
1377 RNA_def_property_ui_text(prop, "Histogram", "Histogram for viewing image statistics");
1378
1379 prop = RNA_def_property(srna, "waveform_mode", PROP_ENUM, PROP_NONE);
1380 RNA_def_property_enum_sdna(prop, "Scopes", "wavefrm_mode");
1381 RNA_def_property_enum_items(prop, prop_wavefrm_mode_items);
1382 RNA_def_property_ui_text(prop, "Waveform Mode", "");
1383 RNA_def_property_update(prop, 0, "rna_Scopes_update");
1384
1385 prop = RNA_def_property(srna, "waveform_alpha", PROP_FLOAT, PROP_FACTOR);
1386 RNA_def_property_float_sdna(prop, "Scopes", "wavefrm_alpha");
1387 RNA_def_property_range(prop, 0, 1);
1388 RNA_def_property_ui_text(prop, "Waveform Opacity", "Opacity of the points");
1389
1390 prop = RNA_def_property(srna, "vectorscope_mode", PROP_ENUM, PROP_NONE);
1391 RNA_def_property_enum_sdna(prop, "Scopes", "vecscope_mode");
1392 RNA_def_property_enum_items(prop, prop_vecscope_mode_items);
1393 RNA_def_property_ui_text(prop, "Vectorscope Mode", "");
1394 RNA_def_property_update(prop, 0, "rna_Scopes_update");
1395
1396 prop = RNA_def_property(srna, "vectorscope_alpha", PROP_FLOAT, PROP_FACTOR);
1397 RNA_def_property_float_sdna(prop, "Scopes", "vecscope_alpha");
1398 RNA_def_property_range(prop, 0, 1);
1399 RNA_def_property_ui_text(prop, "Vectorscope Opacity", "Opacity of the points");
1400}
1401
1403{
1404 StructRNA *srna;
1405 PropertyRNA *prop;
1406
1407 static const EnumPropertyItem display_device_items[] = {
1408 {0, "NONE", 0, "None", ""},
1409 {0, nullptr, 0, nullptr, nullptr},
1410 };
1411
1412 static const EnumPropertyItem emulation_items[] = {
1414 "OFF",
1415 0,
1416 "Off",
1417 "Directly output image as produced by OpenColorIO. This is not correct in general, but "
1418 "may be used when the system configuration and actual display device is known to match "
1419 "the chosen display"},
1421 "AUTO",
1422 0,
1423 "Automatic",
1424 "Display images consistent with most other applications, to preview images and video for "
1425 "export. A best effort is made to emulate the chosen display on the actual display "
1426 "device."},
1427 {0, nullptr, 0, nullptr, nullptr},
1428 };
1429
1430 static const EnumPropertyItem look_items[] = {
1431 {0, "NONE", 0, "None", "Do not modify image in an artistic manner"},
1432 {0, nullptr, 0, nullptr, nullptr},
1433 };
1434
1435 static const EnumPropertyItem view_transform_items[] = {
1436 {0,
1437 "NONE",
1438 0,
1439 "None",
1440 "Do not perform any color transform on display, use old non-color managed technique for "
1441 "display"},
1442 {0, nullptr, 0, nullptr, nullptr},
1443 };
1444
1445 /* ** Display Settings ** */
1446 srna = RNA_def_struct(brna, "ColorManagedDisplaySettings", nullptr);
1447 RNA_def_struct_path_func(srna, "rna_ColorManagedDisplaySettings_path");
1449 srna, "ColorManagedDisplaySettings", "Color management specific to display device");
1450
1451 prop = RNA_def_property(srna, "display_device", PROP_ENUM, PROP_NONE);
1452 RNA_def_property_enum_items(prop, display_device_items);
1454 "rna_ColorManagedDisplaySettings_display_device_get",
1455 "rna_ColorManagedDisplaySettings_display_device_set",
1456 "rna_ColorManagedDisplaySettings_display_device_itemf");
1458 prop,
1459 "Display",
1460 "Display name. For viewing, this is the display device that will be emulated by limiting "
1461 "the gamut and HDR colors. For image and video output, this is the display space used for "
1462 "writing.");
1465 prop, NC_WINDOW, "rna_ColorManagedDisplaySettings_display_device_update");
1466
1467 prop = RNA_def_property(srna, "emulation", PROP_ENUM, PROP_NONE);
1468 RNA_def_property_enum_items(prop, emulation_items);
1470 prop,
1471 "Display Emulation",
1472 "Control how images in the chosen display are mapped to the physical display");
1474 prop, NC_WINDOW, "rna_ColorManagedDisplaySettings_display_device_update");
1475
1476 /* ** View Settings ** */
1477 srna = RNA_def_struct(brna, "ColorManagedViewSettings", nullptr);
1478 RNA_def_struct_path_func(srna, "rna_ColorManagedViewSettings_path");
1480 "ColorManagedViewSettings",
1481 "Color management settings used for displaying images on the display");
1482
1483 prop = RNA_def_property(srna, "look", PROP_ENUM, PROP_NONE);
1484 RNA_def_property_enum_items(prop, look_items);
1486 "rna_ColorManagedViewSettings_look_get",
1487 "rna_ColorManagedViewSettings_look_set",
1488 "rna_ColorManagedViewSettings_look_itemf");
1490 prop, "Look", "Additional transform applied before view transform for artistic needs");
1492 RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");
1493
1494 prop = RNA_def_property(srna, "view_transform", PROP_ENUM, PROP_NONE);
1495 RNA_def_property_enum_items(prop, view_transform_items);
1497 "rna_ColorManagedViewSettings_view_transform_get",
1498 "rna_ColorManagedViewSettings_view_transform_set",
1499 "rna_ColorManagedViewSettings_view_transform_itemf");
1500 RNA_def_property_ui_text(prop, "View", "View used when converting image to a display space");
1502 RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");
1503
1504 prop = RNA_def_property(srna, "exposure", PROP_FLOAT, PROP_FACTOR);
1505 RNA_def_property_float_sdna(prop, nullptr, "exposure");
1507 RNA_def_property_range(prop, -32.0f, 32.0f);
1508 RNA_def_property_ui_range(prop, -10.0f, 10.0f, 1, 3);
1510 prop,
1511 "Exposure",
1512 "Exposure (stops) applied before display transform, multiplying by 2^exposure");
1513 RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");
1514 RNA_def_property_editable_func(prop, "rna_ViewSettings_only_view_look_editable");
1515
1516 prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_FACTOR);
1517 RNA_def_property_float_sdna(prop, nullptr, "gamma");
1519 RNA_def_property_range(prop, 0.0f, 5.0f);
1521 prop,
1522 "Gamma",
1523 "Additional gamma encoding after display transform, for output with custom gamma");
1524 RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");
1525 RNA_def_property_editable_func(prop, "rna_ViewSettings_only_view_look_editable");
1526
1527 prop = RNA_def_property(srna, "curve_mapping", PROP_POINTER, PROP_NONE);
1528 RNA_def_property_pointer_sdna(prop, nullptr, "curve_mapping");
1529 RNA_def_property_ui_text(prop, "Curve", "Color curve mapping applied before display transform");
1530 RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");
1531
1532 prop = RNA_def_property(srna, "use_curve_mapping", PROP_BOOLEAN, PROP_NONE);
1534 RNA_def_property_boolean_funcs(prop, nullptr, "rna_ColorManagedViewSettings_use_curves_set");
1535 RNA_def_property_ui_text(prop, "Use Curves", "Use RGB curved for pre-display transformation");
1536 RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");
1537 RNA_def_property_editable_func(prop, "rna_ViewSettings_only_view_look_editable");
1538
1539 prop = RNA_def_property(srna, "use_white_balance", PROP_BOOLEAN, PROP_NONE);
1542 prop, "Use White Balance", "Perform chromatic adaption from a different white point");
1543 RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");
1544 RNA_def_property_editable_func(prop, "rna_ViewSettings_only_view_look_editable");
1545
1546 prop = RNA_def_property(srna, "white_balance_temperature", PROP_FLOAT, PROP_COLOR_TEMPERATURE);
1547 RNA_def_property_float_sdna(prop, nullptr, "temperature");
1548 RNA_def_property_float_default(prop, 6500.0f);
1549 RNA_def_property_range(prop, 1800.0f, 100000.0f);
1550 RNA_def_property_ui_range(prop, 2000.0f, 11000.0f, 100, 0);
1551 RNA_def_property_ui_text(prop, "Temperature", "Color temperature of the scene's white point");
1552 RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");
1553 RNA_def_property_editable_func(prop, "rna_ViewSettings_only_view_look_editable");
1554
1555 prop = RNA_def_property(srna, "white_balance_tint", PROP_FLOAT, PROP_FACTOR);
1556 RNA_def_property_float_sdna(prop, nullptr, "tint");
1557 RNA_def_property_float_default(prop, 10.0f);
1558 RNA_def_property_range(prop, -500.0f, 500.0f);
1559 RNA_def_property_ui_range(prop, -150.0f, 150.0f, 1, 1);
1561 prop, "Tint", "Color tint of the scene's white point (the default of 10 matches daylight)");
1562 RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");
1563 RNA_def_property_editable_func(prop, "rna_ViewSettings_only_view_look_editable");
1564
1565 prop = RNA_def_property(srna, "white_balance_whitepoint", PROP_FLOAT, PROP_COLOR);
1566 RNA_def_property_array(prop, 3);
1568 "rna_ColorManagedViewSettings_whitepoint_get",
1569 "rna_ColorManagedViewSettings_whitepoint_set",
1570 nullptr);
1572 "White Point",
1573 "The color which gets mapped to white "
1574 "(automatically converted to/from temperature and tint)");
1575 RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");
1576 RNA_def_property_editable_func(prop, "rna_ViewSettings_only_view_look_editable");
1577
1578 prop = RNA_def_property(srna, "is_hdr", PROP_BOOLEAN, PROP_NONE);
1581 prop, "Is HDR", "The display and view transform supports high dynamic range colors");
1582 RNA_def_property_boolean_funcs(prop, "rna_ColorManagedViewSettings_is_hdr_get", nullptr);
1583
1584 prop = RNA_def_property(srna, "support_emulation", PROP_BOOLEAN, PROP_NONE);
1587 prop,
1588 "Support Emulation",
1589 "The display and view transform supports automatic emulation for another display device, "
1590 "using the display color spaces mechanism in OpenColorIO v2 configurations");
1592 prop, "rna_ColorManagedViewSettings_support_emulation_get", nullptr);
1593
1594 /* ** Color-space ** */
1595 srna = RNA_def_struct(brna, "ColorManagedInputColorspaceSettings", nullptr);
1596 RNA_def_struct_path_func(srna, "rna_ColorManagedInputColorspaceSettings_path");
1598 srna, "ColorManagedInputColorspaceSettings", "Input color space settings");
1599
1600 prop = RNA_def_property(srna, "name", PROP_ENUM, PROP_NONE);
1605 "rna_ColorManagedColorspaceSettings_colorspace_get",
1606 "rna_ColorManagedColorspaceSettings_colorspace_set",
1607 "rna_ColorManagedColorspaceSettings_colorspace_itemf");
1609 prop,
1610 "Input Color Space",
1611 "Color space in the image file, to convert to and from when saving and loading the image");
1613 RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagedColorspaceSettings_reload_update");
1614
1615 prop = RNA_def_property(srna, "interop_id", PROP_ENUM, PROP_NONE);
1620 "rna_ColorManagedColorspaceSettings_interop_id_get",
1621 "rna_ColorManagedColorspaceSettings_interop_id_set",
1622 "rna_ColorManagedColorspaceSettings_interop_id_itemf");
1624 "Interop ID",
1625 "Identifier of the color space that works across OpenColorIO "
1626 "configurations, as defined by the ASWF Color Interop Forum");
1627 RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagedColorspaceSettings_reload_update");
1628
1629 prop = RNA_def_property(srna, "is_data", PROP_BOOLEAN, PROP_NONE);
1632 "rna_ColorManagedColorspaceSettings_is_data_get",
1633 "rna_ColorManagedColorspaceSettings_is_data_set");
1635 prop,
1636 "Is Data",
1637 "Treat image as non-color data without color management, like normal or displacement maps");
1638 RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagedColorspaceSettings_reload_update");
1639
1640 //
1641 srna = RNA_def_struct(brna, "ColorManagedSequencerColorspaceSettings", nullptr);
1642 RNA_def_struct_path_func(srna, "rna_ColorManagedSequencerColorspaceSettings_path");
1644 srna, "ColorManagedSequencerColorspaceSettings", "Input color space settings");
1645
1646 prop = RNA_def_property(srna, "name", PROP_ENUM, PROP_NONE);
1650 "rna_ColorManagedColorspaceSettings_colorspace_get",
1651 "rna_ColorManagedColorspaceSettings_colorspace_set",
1652 "rna_ColorManagedColorspaceSettings_colorspace_itemf");
1653 RNA_def_property_ui_text(prop, "Color Space", "Color space that the sequencer operates in");
1655 RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagedColorspaceSettings_reload_update");
1656
1657 prop = RNA_def_property(srna, "interop_id", PROP_ENUM, PROP_NONE);
1662 "rna_ColorManagedColorspaceSettings_interop_id_get",
1663 "rna_ColorManagedColorspaceSettings_interop_id_set",
1664 "rna_ColorManagedColorspaceSettings_interop_id_itemf");
1666 "Interop ID",
1667 "Identifier of the color space that works across OpenColorIO "
1668 "configurations, as defined by the ASWF Color Interop Forum");
1669 RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagedColorspaceSettings_reload_update");
1670}
1671
1673{
1675 rna_def_curvemap(brna);
1678 rna_def_color_ramp(brna);
1679 rna_def_histogram(brna);
1680 rna_def_scopes(brna);
1681 rna_def_colormanage(brna);
1682}
1683
1684} // namespace blender
1685
1686#endif
#define MAXCOLORBAND
#define IMA_SIGNAL_COLORMANAGE
Definition BKE_image.hh:184
Blender kernel freestyle line style functionality.
#define SH_NODE_VALTORGB
#define TEX_NODE_VALTORGB
#define STRNCPY_UTF8(dst, src)
#define BLT_I18NCONTEXT_COLOR_MANAGEMENT
#define BLT_I18NCONTEXT_ID_CURVE_LEGACY
#define BLT_I18NCONTEXT_COLOR
#define CM_TOT
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
#define C
Definition RandGen.cpp:29
#define ND_SEQUENCER
Definition WM_types.hh:456
#define NC_WINDOW
Definition WM_types.hh:388
#define NC_NODE
Definition WM_types.hh:407
#define NC_LINESTYLE
Definition WM_types.hh:413
#define ND_DISPLAY
Definition WM_types.hh:534
#define NC_MOVIECLIP
Definition WM_types.hh:410
#define NC_SCENE
Definition WM_types.hh:391
#define NA_EDITED
Definition WM_types.hh:634
#define ND_PARTICLE
Definition WM_types.hh:506
#define NC_MATERIAL
Definition WM_types.hh:393
#define NC_IMAGE
Definition WM_types.hh:397
#define NC_TEXTURE
Definition WM_types.hh:394
#define NC_OBJECT
Definition WM_types.hh:392
#define ND_SHADING_DRAW
Definition WM_types.hh:521
#define ELEM(...)
#define STREQ(a, b)
btScalar max
#define FLT_MAX
#define position
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
Definition math_dual.h:263
void relations_invalidate_cache(Scene *scene, Strip *strip)
void foreach_strip(ListBaseT< Strip > *seqbase, ForEachFunc callback, void *user_data)
Definition iterator.cc:60
void relations_invalidate_scene_strips(const Main *bmain, const Scene *scene_target)
void relations_invalidate_cache_raw(Scene *scene, Strip *strip)
void relations_invalidate_movieclip_strips(Main *bmain, MovieClip *clip_target)
void cache_cleanup(Scene *scene, CacheCleanup mode)
BMesh Iterators.
void WM_main_add_notifier(uint type, void *reference)
CurveMapping * BKE_curvemapping_add(int tot, float minx, float miny, float maxx, float maxy)
Definition colortools.cc:99
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
void IMB_colormanagement_view_items_add(EnumPropertyItem **items, int *totitem, const char *display_name)
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
static const EnumPropertyItem prop_interpolation_items[]
@ COLORMANAGE_VIEW_USE_WHITE_BALANCE
@ COLORMANAGE_VIEW_USE_CURVES
@ COLORMANAGE_VIEW_ONLY_VIEW_LOOK
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void IMB_colormanagement_colorspace_items_add(EnumPropertyItem **items, int *totitem)
void BKE_linestyle_modifier_list_color_ramps(FreestyleLineStyle *linestyle, ListBaseT< LinkData > *listbase)
void RNA_def_function_output(FunctionRNA *, PropertyRNA *ret)
const EnumPropertyItem rna_enum_color_space_interop_id_default_items[]
Definition rna_color.cc:35
bool IMB_colormanagement_display_is_hdr(const ColorManagedDisplaySettings *display_settings, const char *view_name)
int IMB_colormanagement_colorspace_get_named_index(const char *name)
bool RNA_struct_is_a(const StructRNA *type, const StructRNA *srna)
bool RNA_path_resolve(const PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop)
Definition rna_path.cc:529
static void rna_def_color_ramp(BlenderRNA *brna)
void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
bool BKE_curvemap_remove_point(CurveMap *cuma, CurveMapPoint *point)
void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname, const char *lengthpropname)
void BKE_image_signal(Main *bmain, Image *ima, ImageUser *iuser, int signal)
PointerRNA RNA_id_pointer_create(ID *id)
void IMB_colormanagement_look_items_add(EnumPropertyItem **items, int *totitem, const char *view_name)
int IMB_colormanagement_look_get_named_index(const char *name)
PropertyRNA * RNA_def_float_color(StructOrFunctionRNA *cont_, const char *identifier, const int len, const float *default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
const char * IMB_colormanagement_colorspace_get_indexed_name(int index)
void MOV_close(MovieReader *anim)
Definition movie_read.cc:70
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
static void rna_def_color_ramp_element_api(BlenderRNA *brna, PropertyRNA *cprop)
std::optional< std::string > BKE_linestyle_path_to_color_ramp(FreestyleLineStyle *linestyle, const struct ColorBand *color_ramp)
@ CURVE_TONE_STANDARD
@ CURVE_TONE_FILMLIKE
const char * IMB_colormanagement_look_validate_for_view(const char *view_name, const char *look_name)
std::optional< std::string > RNA_path_from_ID_to_struct(const PointerRNA *ptr)
Definition rna_path.cc:1078
@ FUNC_USE_REPORTS
float BKE_curvemap_evaluateF(const CurveMapping *cumap, const CurveMap *cuma, float value)
PropertyRNA * RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type, const char *ui_name, const char *ui_description)
static void rna_def_histogram(BlenderRNA *brna)
@ SCOPES_WAVEFRM_LUMA
@ SCOPES_WAVEFRM_YCC_601
@ SCOPES_WAVEFRM_YCC_709
@ SCOPES_WAVEFRM_RGB_PARADE
@ SCOPES_WAVEFRM_YCC_JPEG
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
bool BKE_colorband_evaluate(const ColorBand *coba, float in, float out[4])
Definition colorband.cc:399
const char * IMB_colormanagement_display_get_indexed_name(int index)
static void rna_def_curvemap_points_api(BlenderRNA *brna, PropertyRNA *cprop)
Definition rna_color.cc:956
Strip * rna_strip_find_by_colorspace_settings(Editing *ed, const ColorManagedColorspaceSettings *colorspace_settings)
static void rna_def_curvemapping(BlenderRNA *brna)
void IMB_colormanagement_colorspace_interop_id_set(char *name, char *interop_id, int index)
void RNA_def_property_enum_bitflag_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void RNA_def_property_float_default(PropertyRNA *prop, float value)
void IMB_colormanagement_interop_id_items_add(EnumPropertyItem **items, int *totitem)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier_c_str, int type, int subtype)
void BKE_curvemapping_init(CurveMapping *cumap)
int IMB_colormanagement_view_get_id_by_name(const char *name)
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
const char * IMB_colormanagement_view_get_name_by_id(int index)
@ CUMA_HANDLE_AUTO_ANIM
bool IMB_colormanagement_display_support_emulation(const ColorManagedDisplaySettings *display_settings, const char *view_name)
@ PROP_BOOLEAN
Definition RNA_types.hh:210
@ PROP_POINTER
Definition RNA_types.hh:215
@ PROP_COLLECTION
Definition RNA_types.hh:216
void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
void RNA_enum_items_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end, const char *get, const char *length, const char *lookupint, const char *lookupstring, const char *assignint)
void DEG_id_tag_update(ID *id, unsigned int flags)
const char * IMB_colormanagement_role_colorspace_name_get(int role)
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:162
BMesh const char void * data
int IMB_colormanagement_colorspace_get_interop_id_index(const char *name, const char *interop_id)
void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int64_t booleanbit)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
void IMB_colormanagement_validate_settings(const ColorManagedDisplaySettings *display_settings, ColorManagedViewSettings *view_settings)
void BKE_main_ensure_invariants(Main &bmain, std::optional< Span< ID * > > modified_ids=std::nullopt)
void IMB_colormanagement_colorspace_settings_set(ColorManagedColorspaceSettings *settings, const char *name)
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
void BKE_curvemapping_changed(CurveMapping *cumap, bool rem_doubles)
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
static void rna_def_color_ramp_element(BlenderRNA *brna)
const EnumPropertyItem rna_enum_color_space_convert_default_items[]
Definition rna_color.cc:25
static void rna_def_curvemappoint(BlenderRNA *brna)
Definition rna_color.cc:926
FunctionRNA * RNA_def_function(StructRNA *srna, const char *identifier_c_str, const char *call)
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
void BKE_curvemapping_set_black_white(CurveMapping *cumap, const float black[3], const float white[3])
PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
bool IMB_colormanagement_set_whitepoint(const float whitepoint[3], float &temperature, float &tint)
static void rna_def_curvemap(BlenderRNA *brna)
Definition rna_color.cc:994
CBData * BKE_colorband_element_add(ColorBand *coba, float position)
Definition colorband.cc:609
void RNA_def_function_flag(FunctionRNA *func, FunctionFlag flag)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
Definition report.cc:191
void BKE_ntree_update_tag_node_property(bNodeTree *ntree, bNode *node)
StructRNA * RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
@ ID_RECALC_SOURCE
Definition DNA_ID.h:1143
@ ID_RECALC_SYNC_TO_EVAL
Definition DNA_ID.h:1118
ID_Type GS(const char *name)
Definition DNA_ID.h:410
@ PROP_EDITABLE
Definition RNA_types.hh:376
@ PROP_ENUM_NO_CONTEXT
Definition RNA_types.hh:500
@ PROP_THICK_WRAP
Definition RNA_types.hh:493
@ PROP_NEVER_NULL
Definition RNA_types.hh:447
@ PROP_ANIMATABLE
Definition RNA_types.hh:389
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
bool BKE_colorband_element_remove(ColorBand *coba, int index)
Definition colorband.cc:635
const char * IMB_colormanagement_look_get_indexed_name(int index)
static void rna_def_colormanage(BlenderRNA *brna)
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
@ COLORMANAGE_DISPLAY_EMULATION_OFF
@ COLORMANAGE_DISPLAY_EMULATION_AUTO
Scene * CTX_data_scene(const bContext *C)
void IMB_colormanagement_get_whitepoint(float temperature, float tint, float whitepoint[3])
void RNA_def_color(BlenderRNA *brna)
void IMB_colormanagement_display_items_add(EnumPropertyItem **items, int *totitem)
ATTR_WARN_UNUSED_RESULT const void * element
@ PROP_PERCENTAGE
Definition RNA_types.hh:307
@ PROP_FACTOR
Definition RNA_types.hh:308
@ PROP_COLOR_TEMPERATURE
Definition RNA_types.hh:347
@ PARM_REQUIRED
Definition RNA_types.hh:631
@ PARM_RNAPTR
Definition RNA_types.hh:633
PropertyRNA * RNA_def_float(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)
void RNA_def_property_array(PropertyRNA *prop, int length)
void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
void rna_iterator_array_begin(CollectionPropertyIterator *iter, PointerRNA *ptr, void *data, size_t itemsize, int64_t length, bool free_ptr, IteratorSkipFunc skip)
int IMB_colormanagement_display_get_named_index(const char *name)
static void rna_def_scopes(BlenderRNA *brna)
@ CUMA_EXTEND_EXTRAPOLATE
#define min(a, b)
Definition sort.cc:38
PointerRNA parent() const
Definition RNA_types.hh:147
#define N_(msgid)