Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFalk David <falkdavid@gmx.de>2021-10-04 09:14:06 +0300
committerFalk David <falkdavid@gmx.de>2021-10-04 09:15:03 +0300
commitfc6228bd8528629da63cd9b5d012b36e0e5e9fee (patch)
treec78f395a8d1593dac999104691b9d5a00f07316c
parent93e92ac1263505ea3a3bc5a42c1b2f55607ccc45 (diff)
Fix T91873: Crash when opening properties panel
This patch fixes a crash that was recently introduced by rB5cebcb415e76. The reason were missing poll functions in the UI and operator. Reviewed By: ISS Maniphest Tasks: T91873 Differential Revision: https://developer.blender.org/D12736
-rw-r--r--release/scripts/startup/bl_ui/space_sequencer.py23
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c18
2 files changed, 30 insertions, 11 deletions
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py
index 197e3efebda..6430d6bab9b 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -1048,16 +1048,23 @@ class SequencerButtonsPanel_Output:
return cls.has_preview(context)
-class SEQUENCER_PT_color_tag_picker(Panel):
- bl_label = "Color Tag"
+class SequencerColorTagPicker:
bl_space_type = 'SEQUENCE_EDITOR'
bl_region_type = 'UI'
- bl_category = "Strip"
- bl_options = {'HIDE_HEADER', 'INSTANCED'}
+
+ @staticmethod
+ def has_sequencer(context):
+ return (context.space_data.view_type in {'SEQUENCER', 'SEQUENCER_PREVIEW'})
@classmethod
def poll(cls, context):
- return context.active_sequence_strip is not None
+ return cls.has_sequencer(context) and context.active_sequence_strip is not None
+
+
+class SEQUENCER_PT_color_tag_picker(SequencerColorTagPicker, Panel):
+ bl_label = "Color Tag"
+ bl_category = "Strip"
+ bl_options = {'HIDE_HEADER', 'INSTANCED'}
def draw(self, context):
layout = self.layout
@@ -1069,13 +1076,9 @@ class SEQUENCER_PT_color_tag_picker(Panel):
row.operator("sequencer.strip_color_tag_set", icon=icon).color = 'COLOR_%02d' % i
-class SEQUENCER_MT_color_tag_picker(Menu):
+class SEQUENCER_MT_color_tag_picker(SequencerColorTagPicker, Menu):
bl_label = "Set Color Tag"
- @classmethod
- def poll(cls, context):
- return context.active_sequence_strip is not None
-
def draw(self, context):
layout = self.layout
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 9be947b9112..d55356eddec 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -3339,6 +3339,22 @@ static int sequencer_strip_color_tag_set_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
+static bool sequencer_strip_color_tag_set_poll(bContext *C)
+{
+ Scene *scene = CTX_data_scene(C);
+ if (scene == NULL) {
+ return false;
+ }
+
+ Editing *ed = SEQ_editing_get(scene);
+ if (ed == NULL) {
+ return false;
+ }
+
+ Sequence *act_seq = ed->act_seq;
+ return act_seq != NULL;
+}
+
void SEQUENCER_OT_strip_color_tag_set(struct wmOperatorType *ot)
{
/* Identifiers. */
@@ -3348,7 +3364,7 @@ void SEQUENCER_OT_strip_color_tag_set(struct wmOperatorType *ot)
/* Api callbacks. */
ot->exec = sequencer_strip_color_tag_set_exec;
- ot->poll = sequencer_edit_poll;
+ ot->poll = sequencer_strip_color_tag_set_poll;
/* Flags. */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;