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.
This commit is contained in:
parent
14c160334d
commit
e9c18ea982
@ -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
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user