diff options
author | Joseph Eagar <joeedh@gmail.com> | 2022-04-04 18:58:52 +0300 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2022-04-04 18:58:52 +0300 |
commit | 952821474044edb6658c636c5012d7949e7de0c7 (patch) | |
tree | 298346a7719109489916835e36420949633480aa /source/blender/makesrna | |
parent | d321d34a501c09234b123345badd8a7bdf2aba8a (diff) | |
parent | 9eb4cb956b7037e9737c2f15cde3d1bdcfff7d5f (diff) |
Merge remote-tracking branch 'origin/master' into temp-sculpt-colors
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_mesh_api.c | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object.c | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object_force.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sequencer.c | 106 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 5 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_wm.c | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_wm_api.c | 23 |
8 files changed, 139 insertions, 7 deletions
diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c index 8447074a3ef..b1ebe583afc 100644 --- a/source/blender/makesrna/intern/rna_mesh_api.c +++ b/source/blender/makesrna/intern/rna_mesh_api.c @@ -159,6 +159,7 @@ static void rna_Mesh_normals_split_custom_set_from_vertices(Mesh *mesh, static void rna_Mesh_transform(Mesh *mesh, float mat[16], bool shape_keys) { BKE_mesh_transform(mesh, (float(*)[4])mat, shape_keys); + BKE_mesh_normals_tag_dirty(mesh); DEG_id_tag_update(&mesh->id, 0); } diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index f995ee3383e..358f88c8f4d 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -3696,7 +3696,10 @@ static void rna_def_object(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "poselib"); RNA_def_property_struct_type(prop, "Action"); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT); - RNA_def_property_ui_text(prop, "Pose Library", "Action used as a pose library for armatures"); + RNA_def_property_ui_text(prop, + "Pose Library", + "Deprecated, will be removed in Blender 3.3. " + "Action used as a pose library for armatures"); prop = RNA_def_property(srna, "pose", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "pose"); diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index ce4b1a193a3..f92ea8df459 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -264,7 +264,7 @@ bool rna_Cache_use_disk_cache_override_apply(Main *UNUSED(bmain), /* DO NOT call `RNA_property_update_main(bmain, NULL, ptr_dst, prop_dst);`, that would trigger * the whole 'update from mem point cache' process, ending up in the complete deletion of an - * existing diskcache if any. */ + * existing disk-cache if any. */ return true; } diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 0013131e622..a27e699ef3d 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -15,7 +15,9 @@ #include "DNA_vfont_types.h" #include "BLI_iterator.h" +#include "BLI_listbase.h" #include "BLI_math.h" +#include "BLI_string_utils.h" #include "BLT_translation.h" @@ -34,6 +36,7 @@ #include "rna_internal.h" #include "SEQ_add.h" +#include "SEQ_channels.h" #include "SEQ_effects.h" #include "SEQ_iterator.h" #include "SEQ_modifier.h" @@ -1374,6 +1377,71 @@ static void rna_Sequence_separate(ID *id, Sequence *seqm, Main *bmain) WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene); } +/* Find channel owner. If NULL, owner is `Editing`, otherwise it's `Sequence`. */ +static Sequence *rna_SeqTimelineChannel_owner_get(Editing *ed, SeqTimelineChannel *channel) +{ + SeqCollection *strips = SEQ_query_all_strips_recursive(&ed->seqbase); + + Sequence *channel_owner = NULL; + Sequence *seq; + SEQ_ITERATOR_FOREACH (seq, strips) { + if (seq->type != SEQ_TYPE_META) { + continue; + } + if (BLI_findindex(&seq->channels, channel) >= 0) { + channel_owner = seq; + } + } + + SEQ_collection_free(strips); + return channel_owner; +} + +static void rna_SequenceTimelineChannel_name_set(PointerRNA *ptr, const char *value) +{ + SeqTimelineChannel *channel = (SeqTimelineChannel *)ptr->data; + Scene *scene = (Scene *)ptr->owner_id; + Editing *ed = SEQ_editing_get(scene); + + Sequence *channel_owner = rna_SeqTimelineChannel_owner_get(ed, channel); + ListBase *channels_base = &ed->channels; + + if (channel_owner != NULL) { + channels_base = &channel_owner->channels; + } + + BLI_strncpy_utf8(channel->name, value, sizeof(channel->name)); + BLI_uniquename(channels_base, + channel, + "Channel", + '.', + offsetof(SeqTimelineChannel, name), + sizeof(channel->name)); +} + +static char *rna_SeqTimelineChannel_path(PointerRNA *ptr) +{ + Scene *scene = (Scene *)ptr->owner_id; + Editing *ed = SEQ_editing_get(scene); + SeqTimelineChannel *channel = (SeqTimelineChannel *)ptr->data; + + Sequence *channel_owner = rna_SeqTimelineChannel_owner_get(ed, channel); + + char channel_name_esc[(sizeof(channel->name)) * 2]; + BLI_str_escape(channel_name_esc, channel->name, sizeof(channel_name_esc)); + + if (channel_owner == NULL) { + return BLI_sprintfN("sequence_editor.channels[\"%s\"]", channel_name_esc); + } + else { + char owner_name_esc[(sizeof(channel_owner->name) - 2) * 2]; + BLI_str_escape(owner_name_esc, channel_owner->name + 2, sizeof(owner_name_esc)); + return BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].channels[\"%s\"]", + owner_name_esc, + channel_name_esc); + } +} + #else static void rna_def_strip_element(BlenderRNA *brna) @@ -2081,6 +2149,33 @@ static void rna_def_sequence(BlenderRNA *brna) RNA_api_sequence_strip(srna); } +static void rna_def_channel(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "SequenceTimelineChannel", NULL); + RNA_def_struct_sdna(srna, "SeqTimelineChannel"); + RNA_def_struct_path_func(srna, "rna_SeqTimelineChannel_path"); + RNA_def_struct_ui_text(srna, "Channel", ""); + + prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); + RNA_def_property_string_maxlength(prop, sizeof(((SeqTimelineChannel *)NULL)->name)); + RNA_def_property_ui_text(prop, "Name", ""); + RNA_def_struct_name_property(srna, prop); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SequenceTimelineChannel_name_set"); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL); + + prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_CHANNEL_LOCK); + RNA_def_property_ui_text(prop, "Lock channel", ""); + + prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_CHANNEL_MUTE); + RNA_def_property_ui_text(prop, "Mute channel", ""); + RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL); +} + static void rna_def_editor(BlenderRNA *brna) { StructRNA *srna; @@ -2129,6 +2224,11 @@ static void rna_def_editor(BlenderRNA *brna) RNA_def_property_collection_funcs( prop, NULL, NULL, NULL, "rna_SequenceEditor_meta_stack_get", NULL, NULL, NULL, NULL); + prop = RNA_def_property(srna, "channels", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "channels", NULL); + RNA_def_property_struct_type(prop, "SequenceTimelineChannel"); + RNA_def_property_ui_text(prop, "Channels", ""); + prop = RNA_def_property(srna, "active_strip", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "act_seq"); RNA_def_property_flag(prop, PROP_EDITABLE); @@ -2475,6 +2575,11 @@ static void rna_def_meta(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Sequences", "Sequences nested in meta strip"); RNA_api_sequences(brna, prop, true); + prop = RNA_def_property(srna, "channels", PROP_COLLECTION, PROP_NONE); + RNA_def_property_collection_sdna(prop, NULL, "channels", NULL); + RNA_def_property_struct_type(prop, "SequenceTimelineChannel"); + RNA_def_property_ui_text(prop, "Channels", ""); + func = RNA_def_function(srna, "separate", "rna_Sequence_separate"); RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN); RNA_def_function_ui_description(func, "Separate meta"); @@ -3472,6 +3577,7 @@ void RNA_def_sequencer(BlenderRNA *brna) rna_def_sequence(brna); rna_def_editor(brna); + rna_def_channel(brna); rna_def_image(brna); rna_def_meta(brna); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 5f1eece5abf..a74019f9569 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -5613,7 +5613,8 @@ static void rna_def_space_sequencer(BlenderRNA *brna) rna_def_space_generic_show_region_toggles(srna, (1 << RGN_TYPE_TOOL_HEADER) | (1 << RGN_TYPE_UI) | - (1 << RGN_TYPE_TOOLS) | (1 << RGN_TYPE_HUD)); + (1 << RGN_TYPE_TOOLS) | (1 << RGN_TYPE_HUD) | + (1 << RGN_TYPE_CHANNELS)); /* view type, fairly important */ prop = RNA_def_property(srna, "view_type", PROP_ENUM, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 7943960734b..cf622818a3d 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -3149,6 +3149,7 @@ static void rna_def_userdef_theme_space_seq(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Theme Sequence Editor", "Theme settings for the Sequence Editor"); rna_def_userdef_theme_spaces_main(srna); + rna_def_userdef_theme_spaces_list_main(srna); prop = RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_array(prop, 3); @@ -6403,6 +6404,10 @@ static void rna_def_userdef_experimental(BlenderRNA *brna) RNA_def_property_ui_text( prop, "Sculpt Mode Tilt Support", "Support for pen tablet tilt events in Sculpt Mode"); + prop = RNA_def_property(srna, "use_sculpt_texture_paint", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "use_sculpt_texture_paint", 1); + RNA_def_property_ui_text(prop, "Sculpt Texture Paint", "Use texture painting in Sculpt Mode"); + prop = RNA_def_property(srna, "use_extended_asset_browser", PROP_BOOLEAN, PROP_NONE); RNA_def_property_ui_text(prop, "Extended Asset Browser", diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index a850f8862bc..b09a9ab0733 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -1412,6 +1412,7 @@ static char *rna_operator_description_cb(bContext *C, wmOperatorType *ot, Pointe static void rna_Operator_unregister(struct Main *bmain, StructRNA *type); /* bpy_operator_wrap.c */ + extern void BPY_RNA_operator_wrapper(wmOperatorType *ot, void *userdata); extern void BPY_RNA_operator_macro_wrapper(wmOperatorType *ot, void *userdata); diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index 0589fa7a96e..5da65510399 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -276,7 +276,15 @@ static wmKeyMapItem *rna_KeyMap_item_new(wmKeyMap *km, WM_operator_bl_idname(idname_bl, idname); /* create keymap item */ - kmi = WM_keymap_add_item(km, idname_bl, type, value, modifier, keymodifier, direction); + kmi = WM_keymap_add_item(km, + idname_bl, + &(const KeyMapItem_Params){ + .type = type, + .value = value, + .modifier = modifier, + .keymodifier = keymodifier, + .direction = direction, + }); if (!repeat) { kmi->flag |= KMI_REPEAT_IGNORE; @@ -338,16 +346,23 @@ static wmKeyMapItem *rna_KeyMap_item_new_modal(wmKeyMap *km, const int modifier = keymap_item_modifier_flag_from_args(any, shift, ctrl, alt, oskey); int propvalue = 0; + KeyMapItem_Params params = { + .type = type, + .value = value, + .modifier = modifier, + .keymodifier = keymodifier, + .direction = direction, + }; + /* not initialized yet, do delayed lookup */ if (!km->modal_items) { - kmi = WM_modalkeymap_add_item_str( - km, type, value, modifier, keymodifier, direction, propvalue_str); + kmi = WM_modalkeymap_add_item_str(km, ¶ms, propvalue_str); } else { if (RNA_enum_value_from_id(km->modal_items, propvalue_str, &propvalue) == 0) { BKE_report(reports, RPT_WARNING, "Property value not in enumeration"); } - kmi = WM_modalkeymap_add_item(km, type, value, modifier, keymodifier, direction, propvalue); + kmi = WM_modalkeymap_add_item(km, ¶ms, propvalue); } if (!repeat) { |