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:
@@ -20,8 +20,6 @@
|
|||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
from bpy.types import Operator
|
from bpy.types import Operator
|
||||||
from mathutils import Vector
|
|
||||||
from math import floor
|
|
||||||
|
|
||||||
from bpy.props import IntProperty
|
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
|
return context.scene and context.scene.sequence_editor and context.scene.sequence_editor.active_strip
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
|
from math import floor
|
||||||
|
|
||||||
# We must create a scene action first if there's none
|
# We must create a scene action first if there's none
|
||||||
scene = context.scene
|
scene = context.scene
|
||||||
if not scene.animation_data:
|
if not scene.animation_data:
|
||||||
@@ -305,16 +305,18 @@ class SequencerFadesAdd(Operator):
|
|||||||
|
|
||||||
|
|
||||||
class Fade:
|
class Fade:
|
||||||
"""
|
# Data structure to represent fades.
|
||||||
Data structure to represent fades
|
__slots__ = (
|
||||||
"""
|
"type",
|
||||||
type = ''
|
"animated_property",
|
||||||
animated_property = ''
|
"duration",
|
||||||
duration = -1
|
"max_value",
|
||||||
max_value = 1.0
|
"start",
|
||||||
start, end = Vector((0, 0)), Vector((0, 0))
|
"end",
|
||||||
|
)
|
||||||
|
|
||||||
def __init__(self, sequence, fade_fcurve, type, animated_property, duration):
|
def __init__(self, sequence, fade_fcurve, type, animated_property, duration):
|
||||||
|
from mathutils import Vector
|
||||||
self.type = type
|
self.type = type
|
||||||
self.animated_property = animated_property
|
self.animated_property = animated_property
|
||||||
self.duration = duration
|
self.duration = duration
|
||||||
|
@@ -761,7 +761,7 @@ class SEQUENCER_MT_context_menu(Menu):
|
|||||||
strip_type = strip.type
|
strip_type = strip.type
|
||||||
selected_sequences_count = selected_sequences_len(context)
|
selected_sequences_count = selected_sequences_len(context)
|
||||||
|
|
||||||
if strip_type != "SOUND":
|
if strip_type != 'SOUND':
|
||||||
layout.separator()
|
layout.separator()
|
||||||
layout.operator_menu_enum("sequencer.strip_modifier_add", "type", text="Add Modifier")
|
layout.operator_menu_enum("sequencer.strip_modifier_add", "type", text="Add Modifier")
|
||||||
layout.operator("sequencer.strip_modifier_copy", text="Copy Modifiers to Selection")
|
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:
|
if selected_sequences_count >= 1:
|
||||||
col = layout.column()
|
col = layout.column()
|
||||||
col.operator_menu_enum("sequencer.fades_add", "type", text="Fade")
|
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")
|
layout.operator("sequencer.fades_clear", text="Clear Fade")
|
||||||
|
|
||||||
if strip_type in {
|
if strip_type in {
|
||||||
|
Reference in New Issue
Block a user