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:
authorCampbell Barton <ideasman42@gmail.com>2019-09-14 22:56:19 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-09-14 22:57:59 +0300
commite9c18ea9829f9d8bf29db4d44a133c53619c1cfe (patch)
tree2cbf68efe2d662a41b0f404ad2f325fb29dc2b5a /release
parent14c160334de15c6898fd20127bcaa262d66cfe77 (diff)
Cleanup: redundant code from recent sequence fade operator
No need to define class variables which are all overwritten, also use __slots__ to avoid mistakes. Remove redundant length check too.
Diffstat (limited to 'release')
-rw-r--r--release/scripts/startup/bl_operators/sequencer.py22
-rw-r--r--release/scripts/startup/bl_ui/space_sequencer.py3
2 files changed, 13 insertions, 12 deletions
diff --git a/release/scripts/startup/bl_operators/sequencer.py b/release/scripts/startup/bl_operators/sequencer.py
index 32a94349b4b..8772e6597ff 100644
--- a/release/scripts/startup/bl_operators/sequencer.py
+++ b/release/scripts/startup/bl_operators/sequencer.py
@@ -20,8 +20,6 @@
import bpy
from bpy.types import Operator
-from mathutils import Vector
-from math import floor
from bpy.props import IntProperty
@@ -192,6 +190,8 @@ class SequencerFadesAdd(Operator):
return context.scene and context.scene.sequence_editor and context.scene.sequence_editor.active_strip
def execute(self, context):
+ from math import floor
+
# We must create a scene action first if there's none
scene = context.scene
if not scene.animation_data:
@@ -305,16 +305,18 @@ class SequencerFadesAdd(Operator):
class Fade:
- """
- Data structure to represent fades
- """
- type = ''
- animated_property = ''
- duration = -1
- max_value = 1.0
- start, end = Vector((0, 0)), Vector((0, 0))
+ # Data structure to represent fades.
+ __slots__ = (
+ "type",
+ "animated_property",
+ "duration",
+ "max_value",
+ "start",
+ "end",
+ )
def __init__(self, sequence, fade_fcurve, type, animated_property, duration):
+ from mathutils import Vector
self.type = type
self.animated_property = animated_property
self.duration = duration
diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py
index 381808e8479..397355f1f23 100644
--- a/release/scripts/startup/bl_ui/space_sequencer.py
+++ b/release/scripts/startup/bl_ui/space_sequencer.py
@@ -761,7 +761,7 @@ class SEQUENCER_MT_context_menu(Menu):
strip_type = strip.type
selected_sequences_count = selected_sequences_len(context)
- if strip_type != "SOUND":
+ if strip_type != 'SOUND':
layout.separator()
layout.operator_menu_enum("sequencer.strip_modifier_add", "type", text="Add Modifier")
layout.operator("sequencer.strip_modifier_copy", text="Copy Modifiers to Selection")
@@ -778,7 +778,6 @@ class SEQUENCER_MT_context_menu(Menu):
if selected_sequences_count >= 1:
col = layout.column()
col.operator_menu_enum("sequencer.fades_add", "type", text="Fade")
- col.enabled = selected_sequences_len(context) >= 1
layout.operator("sequencer.fades_clear", text="Clear Fade")
if strip_type in {