diff options
author | Hans Goudey <h.goudey@me.com> | 2022-08-08 23:19:58 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-08-08 23:20:03 +0300 |
commit | d48c7a0419e248464102391f0b776df7e7c41b25 (patch) | |
tree | 6a76f93ee6ed74c15b1497d076c24c260c38f79e /source/blender/makesrna/intern | |
parent | 529f5e95d7d989d1e53e283dbccd13e52709a1ce (diff) | |
parent | 1e57ddf6eadcb4327f2689fb34f07fc5bf72331c (diff) |
Merge branch 'master' into refactor-mesh-hide-generic
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_ID.c | 7 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_constraint.c | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_gpencil_modifier.c | 31 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_image.c | 143 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_modifier.c | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_path.cc | 7 |
6 files changed, 174 insertions, 16 deletions
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index b4fa7088d38..4b8f8ca7b4b 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -650,7 +650,7 @@ static ID *rna_ID_evaluated_get(ID *id, struct Depsgraph *depsgraph) static ID *rna_ID_copy(ID *id, Main *bmain) { - ID *newid = BKE_id_copy(bmain, id); + ID *newid = BKE_id_copy_for_use_in_bmain(bmain, id); if (newid != NULL) { id_us_min(newid); @@ -2045,7 +2045,10 @@ static void rna_def_ID(BlenderRNA *brna) func = RNA_def_function(srna, "copy", "rna_ID_copy"); RNA_def_function_ui_description( - func, "Create a copy of this data-block (not supported for all data-blocks)"); + func, + "Create a copy of this data-block (not supported for all data-blocks). " + "The result is added to the Blend-File Data (Main database), with all references to other " + "data-blocks ensured to be from within the same Blend-File Data"); RNA_def_function_flag(func, FUNC_USE_MAIN); parm = RNA_def_pointer(func, "id", "ID", "", "New copy of the ID"); RNA_def_function_return(func, parm); diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 986de0930ed..719c7441174 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -3450,6 +3450,7 @@ void RNA_def_constraint(BlenderRNA *brna) RNA_def_struct_refine_func(srna, "rna_ConstraintType_refine"); RNA_def_struct_path_func(srna, "rna_Constraint_path"); RNA_def_struct_sdna(srna, "bConstraint"); + RNA_def_struct_ui_icon(srna, ICON_CONSTRAINT); /* strings */ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c index 0647bc62081..2dfd9d46665 100644 --- a/source/blender/makesrna/intern/rna_gpencil_modifier.c +++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c @@ -3197,9 +3197,27 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna) }; static const EnumPropertyItem modifier_lineart_shadow_region_filtering[] = { - {LRT_SHADOW_FILTER_NONE, "NONE", 0, "None", ""}, - {LRT_SHADOW_FILTER_LIT, "LIT", 0, "Lit", ""}, - {LRT_SHADOW_FILTER_SHADED, "SHADED", 0, "Shaded", ""}, + {LRT_SHADOW_FILTER_NONE, + "NONE", + 0, + "None", + "Not filtering any lines based on illumination region"}, + {LRT_SHADOW_FILTER_ILLUMINATED, + "ILLUMINATED", + 0, + "Illuminated", + "Only selecting lines from illuminated regions"}, + {LRT_SHADOW_FILTER_SHADED, + "SHADED", + 0, + "Shaded", + "Only selecting lines from shaded regions"}, + {LRT_SHADOW_FILTER_ILLUMINATED_ENCLOSED_SHAPES, + "ILLUMINATED_ENCLOSED", + 0, + "Illuminated (Enclosed Shapes)", + "Selecting lines from lit regions, and make the combination of contour, light contour and " + "shadow lines into enclosed shapes"}, {0, NULL, 0, NULL, NULL}, }; @@ -3464,13 +3482,6 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna) "affect cast shadow and light contour since they are at the border"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update"); - prop = RNA_def_property(srna, "use_shadow_enclosed_shapes", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_SHADOW_ENCLOSED_SHAPES); - RNA_def_property_ui_text(prop, - "Shadow Enclosed Shapes", - "Reproject visible lines again to get enclosed shadow shapes"); - RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); - prop = RNA_def_property(srna, "silhouette_filtering", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "silhouette_selection"); RNA_def_property_enum_items(prop, modifier_lineart_silhouette_filtering); diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index 7f134c5055f..b7ab7689dd7 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -52,6 +52,7 @@ static const EnumPropertyItem image_source_items[] = { #ifdef RNA_RUNTIME # include "BLI_math_base.h" +# include "BLI_math_vector.h" # include "BKE_global.h" @@ -85,6 +86,10 @@ static void rna_Image_source_set(PointerRNA *ptr, int value) ima->source = value; BLI_assert(BKE_id_is_in_global_main(&ima->id)); BKE_image_signal(G_MAIN, ima, NULL, IMA_SIGNAL_SRC_CHANGE); + if (ima->source == IMA_SRC_TILED) { + BKE_image_signal(G_MAIN, ima, NULL, IMA_SIGNAL_RELOAD); + } + DEG_id_tag_update(&ima->id, 0); DEG_id_tag_update(&ima->id, ID_RECALC_EDITORS); DEG_relations_tag_update(G_MAIN); @@ -100,6 +105,83 @@ static void rna_Image_reload_update(Main *bmain, Scene *UNUSED(scene), PointerRN DEG_id_tag_update(&ima->id, ID_RECALC_EDITORS); } +static int rna_Image_generated_type_get(PointerRNA *ptr) +{ + Image *ima = (Image *)ptr->data; + ImageTile *base_tile = BKE_image_get_tile(ima, 0); + return base_tile->gen_type; +} + +static void rna_Image_generated_type_set(PointerRNA *ptr, int value) +{ + Image *ima = (Image *)ptr->data; + ImageTile *base_tile = BKE_image_get_tile(ima, 0); + base_tile->gen_type = value; +} + +static int rna_Image_generated_width_get(PointerRNA *ptr) +{ + Image *ima = (Image *)ptr->data; + ImageTile *base_tile = BKE_image_get_tile(ima, 0); + return base_tile->gen_x; +} + +static void rna_Image_generated_width_set(PointerRNA *ptr, int value) +{ + Image *ima = (Image *)ptr->data; + ImageTile *base_tile = BKE_image_get_tile(ima, 0); + base_tile->gen_x = CLAMPIS(value, 1, 65536); +} + +static int rna_Image_generated_height_get(PointerRNA *ptr) +{ + Image *ima = (Image *)ptr->data; + ImageTile *base_tile = BKE_image_get_tile(ima, 0); + return base_tile->gen_y; +} + +static void rna_Image_generated_height_set(PointerRNA *ptr, int value) +{ + Image *ima = (Image *)ptr->data; + ImageTile *base_tile = BKE_image_get_tile(ima, 0); + base_tile->gen_y = CLAMPIS(value, 1, 65536); +} + +static bool rna_Image_generated_float_get(PointerRNA *ptr) +{ + Image *ima = (Image *)ptr->data; + ImageTile *base_tile = BKE_image_get_tile(ima, 0); + return (base_tile->gen_flag & IMA_GEN_FLOAT) != 0; +} + +static void rna_Image_generated_float_set(PointerRNA *ptr, bool value) +{ + Image *ima = (Image *)ptr->data; + ImageTile *base_tile = BKE_image_get_tile(ima, 0); + if (value) { + base_tile->gen_flag |= IMA_GEN_FLOAT; + } + else { + base_tile->gen_flag &= ~IMA_GEN_FLOAT; + } +} + +void rna_Image_generated_color_get(PointerRNA *ptr, float values[4]) +{ + Image *ima = (Image *)(ptr->data); + ImageTile *base_tile = BKE_image_get_tile(ima, 0); + copy_v4_v4(values, base_tile->gen_color); +} + +void rna_Image_generated_color_set(PointerRNA *ptr, const float values[4]) +{ + Image *ima = (Image *)(ptr->data); + ImageTile *base_tile = BKE_image_get_tile(ima, 0); + for (unsigned int i = 0; i < 4; i++) { + base_tile->gen_color[i] = CLAMPIS(values[i], 0.0f, FLT_MAX); + } +} + static void rna_Image_generated_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) { Image *ima = (Image *)ptr->owner_id; @@ -335,6 +417,20 @@ static void rna_UDIMTile_tile_number_set(PointerRNA *ptr, int value) } } +static void rna_UDIMTile_generated_update(Main *UNUSED(bmain), + Scene *UNUSED(scene), + PointerRNA *ptr) +{ + Image *ima = (Image *)ptr->owner_id; + ImageTile *tile = (ImageTile *)ptr->data; + + /* If the tile is still marked as generated, then update the tile as requested. */ + if ((tile->gen_flag & IMA_GEN_TILE) != 0) { + BKE_image_fill_tile(ima, tile); + BKE_image_partial_update_mark_full_update(ima); + } +} + static int rna_Image_active_tile_index_get(PointerRNA *ptr) { Image *image = (Image *)ptr->data; @@ -896,6 +992,43 @@ static void rna_def_udim_tile(BlenderRNA *brna) RNA_def_property_int_funcs(prop, "rna_UDIMTile_channels_get", NULL, NULL); RNA_def_property_ui_text(prop, "Channels", "Number of channels in the tile pixels buffer"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); + + /* Generated tile information. */ + prop = RNA_def_property(srna, "generated_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "gen_type"); + RNA_def_property_enum_items(prop, rna_enum_image_generated_type_items); + RNA_def_property_ui_text(prop, "Generated Type", "Generated image type"); + RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_UDIMTile_generated_update"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + + prop = RNA_def_property(srna, "generated_width", PROP_INT, PROP_PIXEL); + RNA_def_property_int_sdna(prop, NULL, "gen_x"); + RNA_def_property_flag(prop, PROP_PROPORTIONAL); + RNA_def_property_range(prop, 1, 65536); + RNA_def_property_ui_text(prop, "Generated Width", "Generated image width"); + RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_UDIMTile_generated_update"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + + prop = RNA_def_property(srna, "generated_height", PROP_INT, PROP_PIXEL); + RNA_def_property_int_sdna(prop, NULL, "gen_y"); + RNA_def_property_flag(prop, PROP_PROPORTIONAL); + RNA_def_property_range(prop, 1, 65536); + RNA_def_property_ui_text(prop, "Generated Height", "Generated image height"); + RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_UDIMTile_generated_update"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + + prop = RNA_def_property(srna, "use_generated_float", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "gen_flag", IMA_GEN_FLOAT); + RNA_def_property_ui_text(prop, "Float Buffer", "Generate floating-point buffer"); + RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_UDIMTile_generated_update"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + + prop = RNA_def_property(srna, "generated_color", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_float_sdna(prop, NULL, "gen_color"); + RNA_def_property_array(prop, 4); + RNA_def_property_ui_text(prop, "Color", "Fill color for the generated image"); + RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_UDIMTile_generated_update"); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); } static void rna_def_udim_tiles(BlenderRNA *brna, PropertyRNA *cprop) @@ -1079,6 +1212,8 @@ static void rna_def_image(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "gen_type"); RNA_def_property_enum_items(prop, rna_enum_image_generated_type_items); RNA_def_property_ui_text(prop, "Generated Type", "Generated image type"); + RNA_def_property_enum_funcs( + prop, "rna_Image_generated_type_get", "rna_Image_generated_type_set", NULL); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); @@ -1087,6 +1222,8 @@ static void rna_def_image(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_PROPORTIONAL); RNA_def_property_range(prop, 1, 65536); RNA_def_property_ui_text(prop, "Generated Width", "Generated image width"); + RNA_def_property_int_funcs( + prop, "rna_Image_generated_width_get", "rna_Image_generated_width_set", NULL); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); @@ -1095,12 +1232,16 @@ static void rna_def_image(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_PROPORTIONAL); RNA_def_property_range(prop, 1, 65536); RNA_def_property_ui_text(prop, "Generated Height", "Generated image height"); + RNA_def_property_int_funcs( + prop, "rna_Image_generated_height_get", "rna_Image_generated_height_set", NULL); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); prop = RNA_def_property(srna, "use_generated_float", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "gen_flag", IMA_GEN_FLOAT); RNA_def_property_ui_text(prop, "Float Buffer", "Generate floating-point buffer"); + RNA_def_property_boolean_funcs( + prop, "rna_Image_generated_float_get", "rna_Image_generated_float_set"); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); @@ -1108,6 +1249,8 @@ static void rna_def_image(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "gen_color"); RNA_def_property_array(prop, 4); RNA_def_property_ui_text(prop, "Color", "Fill color for the generated image"); + RNA_def_property_float_funcs( + prop, "rna_Image_generated_color_get", "rna_Image_generated_color_set", NULL); RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 4810784b3f7..0e420f7556f 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -7243,6 +7243,7 @@ void RNA_def_modifier(BlenderRNA *brna) RNA_def_struct_refine_func(srna, "rna_Modifier_refine"); RNA_def_struct_path_func(srna, "rna_Modifier_path"); RNA_def_struct_sdna(srna, "ModifierData"); + RNA_def_struct_ui_icon(srna, ICON_MODIFIER); /* strings */ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_path.cc b/source/blender/makesrna/intern/rna_path.cc index fe1f4c0101f..5d570657b53 100644 --- a/source/blender/makesrna/intern/rna_path.cc +++ b/source/blender/makesrna/intern/rna_path.cc @@ -380,9 +380,7 @@ static bool rna_path_parse(const PointerRNA *ptr, } const bool use_id_prop = (*path == '['); - /* custom property lookup ? - * C.object["someprop"] - */ + /* Custom property lookup: e.g. `C.object["someprop"]`. */ if (!curptr.data) { return false; @@ -604,7 +602,8 @@ char *RNA_path_append(const char *path, BLI_dynstr_append(dynstr, RNA_property_identifier(prop)); - if (RNA_property_type(prop) == PROP_COLLECTION) { + const bool has_key = (intkey > -1) || (strkey != nullptr); + if (has_key && (RNA_property_type(prop) == PROP_COLLECTION)) { /* add ["strkey"] or [intkey] */ BLI_dynstr_append(dynstr, "["); |