Changeset View
Changeset View
Standalone View
Standalone View
source/blender/makesrna/intern/rna_sequencer.c
| Show First 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | const EnumPropertyItem rna_enum_sequence_modifier_type_items[] = { | ||||
| {seqModifierType_Tonemap, "TONEMAP", ICON_NONE, "Tone Map", ""}, | {seqModifierType_Tonemap, "TONEMAP", ICON_NONE, "Tone Map", ""}, | ||||
| {0, NULL, 0, NULL, NULL} | {0, NULL, 0, NULL, NULL} | ||||
| }; | }; | ||||
| #ifdef RNA_RUNTIME | #ifdef RNA_RUNTIME | ||||
| #include "BKE_report.h" | #include "BKE_report.h" | ||||
| #include "BKE_idprop.h" | #include "BKE_idprop.h" | ||||
| #include "BKE_scene.h" | |||||
| #include "DEG_depsgraph.h" | |||||
| #include "RE_engine.h" | |||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| #include "IMB_imbuf.h" | #include "IMB_imbuf.h" | ||||
| typedef struct SequenceSearchData { | typedef struct SequenceSearchData { | ||||
| Sequence *seq; | Sequence *seq; | ||||
| void *data; | void *data; | ||||
| ▲ Show 20 Lines • Show All 620 Lines • ▼ Show 20 Lines | if (RNA_struct_is_a(ptr->type, &RNA_SoundSequence)) | ||||
| BKE_sequencer_update_sound_bounds(scene, ptr->data); | BKE_sequencer_update_sound_bounds(scene, ptr->data); | ||||
| } | } | ||||
| static void rna_Sequence_mute_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) | static void rna_Sequence_mute_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) | ||||
| { | { | ||||
| Scene *scene = (Scene *) ptr->id.data; | Scene *scene = (Scene *) ptr->id.data; | ||||
| Editing *ed = BKE_sequencer_editing_get(scene, false); | Editing *ed = BKE_sequencer_editing_get(scene, false); | ||||
| BKE_sequencer_update_muting(ed); | BKE_sequencer_update_muting(ed); | ||||
campbellbarton: No need for case insensitive comparison, `STREQ` macro can be used instead. | |||||
| rna_Sequence_update(bmain, scene, ptr); | rna_Sequence_update(bmain, scene, ptr); | ||||
| } | } | ||||
| const EnumPropertyItem *rna_Sequence_engine_itemf( | |||||
campbellbartonUnsubmitted Done Inline ActionsWhy not expose sequence.view_render using the ViewRenderSettings type? Then there is no need to duplicate it's logic. This way instead of accessing seq.engine, seq.view_render.engine would be used (from Python). campbellbarton: Why not expose `sequence.view_render` using the `ViewRenderSettings` type?
Then there is no… | |||||
| bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) | |||||
| { | |||||
| RenderEngineType *type; | |||||
| EnumPropertyItem *item = NULL; | |||||
| EnumPropertyItem tmp = { 0, "", 0, "", "" }; | |||||
| int a = 0, totitem = 0; | |||||
| for (type = R_engines.first; type; type = type->next, a++) { | |||||
| tmp.value = a; | |||||
| tmp.identifier = type->idname; | |||||
| tmp.name = type->name; | |||||
| RNA_enum_item_add(&item, &totitem, &tmp); | |||||
| } | |||||
| RNA_enum_item_end(&item, &totitem); | |||||
| *r_free = true; | |||||
| return item; | |||||
| } | |||||
| static int rna_Sequence_engine_get(PointerRNA *ptr) | |||||
| { | |||||
| Sequence *sequence = (Sequence*)ptr->data; | |||||
| ViewRender *view_render = &(sequence->view_render); | |||||
| return BKE_viewrender_get_engine_by_index(view_render); | |||||
| } | |||||
| static void rna_Sequence_engine_set(PointerRNA *ptr, int value) | |||||
| { | |||||
| Sequence *sequence = (Sequence*)ptr->data; | |||||
| ViewRender *view_render = &(sequence->view_render); | |||||
| BKE_viewrender_set_engine_by_index(view_render, value); | |||||
| DEG_id_tag_update(ptr->id.data, DEG_TAG_COPY_ON_WRITE); | |||||
| } | |||||
campbellbartonUnsubmitted Done Inline ActionsThis is too much duplication, logic should be shared with rna_ViewRenderSettings_engine_* functions, Check on how enum functions are shared already. campbellbarton: This is too much duplication, logic should be shared with `rna_ViewRenderSettings_engine_*`… | |||||
spockTheGrayAuthorUnsubmitted Not Done Inline ActionsPer our talk in IRC, I just removed this for now and left as a TODO to clear strip cache on ViewRender.engine updates. spockTheGray: Per our talk in IRC, I just removed this for now and left as a TODO to clear strip cache on… | |||||
| static void rna_Sequence_engine_update(bContext *C, PointerRNA *ptr) | |||||
| { | |||||
| Sequence *sequence = (Sequence*)ptr->data; | |||||
| Scene *current_scene = CTX_data_scene(C); | |||||
| BKE_sequence_invalidate_cache(current_scene, sequence); | |||||
| WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, current_scene); | |||||
| } | |||||
| static int rna_Sequence_override_preview_engine_get(PointerRNA *ptr) | |||||
| { | |||||
| Sequence *sequence = (Sequence*)ptr->data; | |||||
| return !(sequence->use_scene_render_engine); | |||||
| } | |||||
| static void rna_Sequence_override_preview_engine_set(PointerRNA *ptr, int value) | |||||
| { | |||||
| Sequence *sequence = (Sequence*)ptr->data; | |||||
| sequence->use_scene_render_engine = !value; | |||||
| } | |||||
| static void rna_Sequence_override_preview_engine_update(bContext *C, PointerRNA *ptr) | |||||
| { | |||||
| Sequence *sequence = (Sequence*)ptr->data; | |||||
| Scene *current_scene = CTX_data_scene(C); | |||||
| BLI_strncpy(sequence->view_render.engine_id, current_scene->view_render.engine_id, 32); | |||||
| BKE_sequence_invalidate_cache(current_scene, sequence); | |||||
| WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, current_scene); | |||||
| } | |||||
| static void rna_Sequence_filepath_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) | static void rna_Sequence_filepath_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) | ||||
| { | { | ||||
| Scene *scene = (Scene *) ptr->id.data; | Scene *scene = (Scene *) ptr->id.data; | ||||
| Sequence *seq = (Sequence *)(ptr->data); | Sequence *seq = (Sequence *)(ptr->data); | ||||
| BKE_sequence_reload_new_file(scene, seq, true); | BKE_sequence_reload_new_file(scene, seq, true); | ||||
| BKE_sequence_calc(scene, seq); | BKE_sequence_calc(scene, seq); | ||||
| rna_Sequence_update(bmain, scene, ptr); | rna_Sequence_update(bmain, scene, ptr); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 704 Lines • ▼ Show 20 Lines | static const EnumPropertyItem seq_type_items[] = { | ||||
| {SEQ_TYPE_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""}, | {SEQ_TYPE_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""}, | ||||
| {SEQ_TYPE_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""}, | {SEQ_TYPE_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""}, | ||||
| {SEQ_TYPE_GAUSSIAN_BLUR, "GAUSSIAN_BLUR", 0, "Gaussian Blur", ""}, | {SEQ_TYPE_GAUSSIAN_BLUR, "GAUSSIAN_BLUR", 0, "Gaussian Blur", ""}, | ||||
| {SEQ_TYPE_TEXT, "TEXT", 0, "Text", ""}, | {SEQ_TYPE_TEXT, "TEXT", 0, "Text", ""}, | ||||
| {SEQ_TYPE_COLORMIX, "COLORMIX", 0, "Color Mix", ""}, | {SEQ_TYPE_COLORMIX, "COLORMIX", 0, "Color Mix", ""}, | ||||
| {0, NULL, 0, NULL, NULL} | {0, NULL, 0, NULL, NULL} | ||||
| }; | }; | ||||
| static const EnumPropertyItem sequence_viewrender_engine_items[] = { | |||||
| { 0, "BLENDER_RENDER", 0, "Blender Render", "Use the Blender internal rendering engine for rendering" }, | |||||
| { 0, NULL, 0, NULL, NULL } | |||||
| }; | |||||
| srna = RNA_def_struct(brna, "Sequence", NULL); | srna = RNA_def_struct(brna, "Sequence", NULL); | ||||
| RNA_def_struct_ui_text(srna, "Sequence", "Sequence strip in the sequence editor"); | RNA_def_struct_ui_text(srna, "Sequence", "Sequence strip in the sequence editor"); | ||||
| RNA_def_struct_refine_func(srna, "rna_Sequence_refine"); | RNA_def_struct_refine_func(srna, "rna_Sequence_refine"); | ||||
| RNA_def_struct_path_func(srna, "rna_Sequence_path"); | RNA_def_struct_path_func(srna, "rna_Sequence_path"); | ||||
| RNA_def_struct_idprops_func(srna, "rna_Sequence_idprops"); | RNA_def_struct_idprops_func(srna, "rna_Sequence_idprops"); | ||||
| prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); | prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); | ||||
| RNA_def_property_string_funcs(prop, "rna_Sequence_name_get", "rna_Sequence_name_length", "rna_Sequence_name_set"); | RNA_def_property_string_funcs(prop, "rna_Sequence_name_get", "rna_Sequence_name_length", "rna_Sequence_name_set"); | ||||
| RNA_def_property_string_maxlength(prop, sizeof(((Sequence *)NULL)->name) - 2); | RNA_def_property_string_maxlength(prop, sizeof(((Sequence *)NULL)->name) - 2); | ||||
| RNA_def_property_ui_text(prop, "Name", ""); | RNA_def_property_ui_text(prop, "Name", ""); | ||||
| RNA_def_struct_name_property(srna, prop); | RNA_def_struct_name_property(srna, prop); | ||||
| RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL); | RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL); | ||||
| prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); | prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); | ||||
| RNA_def_property_clear_flag(prop, PROP_EDITABLE); | RNA_def_property_clear_flag(prop, PROP_EDITABLE); | ||||
| RNA_def_property_enum_items(prop, seq_type_items); | RNA_def_property_enum_items(prop, seq_type_items); | ||||
| RNA_def_property_ui_text(prop, "Type", ""); | RNA_def_property_ui_text(prop, "Type", ""); | ||||
| RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SEQUENCE); | RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SEQUENCE); | ||||
| RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update"); | RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update"); | ||||
| prop = RNA_def_property(srna, "engine", PROP_ENUM, PROP_NONE); | |||||
| RNA_def_property_enum_items(prop, sequence_viewrender_engine_items); | |||||
| RNA_def_property_enum_funcs(prop, "rna_Sequence_engine_get", "rna_Sequence_engine_set", | |||||
| "rna_Sequence_engine_itemf"); | |||||
| RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); | |||||
| RNA_def_property_ui_text(prop, "Engine", "Engine to use for rendering"); | |||||
| RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); | |||||
| RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_engine_update"); | |||||
| /* flags */ | /* flags */ | ||||
| prop = RNA_def_property(srna, "override_preview_engine_type", PROP_BOOLEAN, PROP_NONE); | |||||
Done Inline Actionssince this is a boolean, should use use_ prefix. eg: use_view_render_override - since view render may contain other settings in the future. campbellbarton: since this is a boolean, should use `use_` prefix. eg: `use_view_render_override` - since view… | |||||
| RNA_def_property_boolean_sdna(prop, NULL, "use_scene_render_engine", 0); | |||||
| RNA_def_property_ui_text(prop, "Override Preview Engine", "Override the preview engine used for scene strip"); | |||||
| RNA_def_property_boolean_funcs(prop, "rna_Sequence_override_preview_engine_get", "rna_Sequence_override_preview_engine_set"); | |||||
| RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE); | |||||
| RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_override_preview_engine_update"); | |||||
| prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT); | RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT); | ||||
| RNA_def_property_ui_text(prop, "Select", ""); | RNA_def_property_ui_text(prop, "Select", ""); | ||||
| RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER | NA_SELECTED, NULL); | RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER | NA_SELECTED, NULL); | ||||
| prop = RNA_def_property(srna, "select_left_handle", PROP_BOOLEAN, PROP_NONE); | prop = RNA_def_property(srna, "select_left_handle", PROP_BOOLEAN, PROP_NONE); | ||||
| RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_LEFTSEL); | RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_LEFTSEL); | ||||
| RNA_def_property_ui_text(prop, "Left Handle Selected", ""); | RNA_def_property_ui_text(prop, "Left Handle Selected", ""); | ||||
| ▲ Show 20 Lines • Show All 1,283 Lines • Show Last 20 Lines | |||||
No need for case insensitive comparison, STREQ macro can be used instead.