Attract: draw strip metadata as its own panel
The panel is a subpanel in Blender 2.80, and a top-level panel in 2.79.
This commit is contained in:
parent
a45bf3cd5c
commit
985b3f6a7d
@ -63,6 +63,7 @@ from pillarsdk.projects import Project
|
|||||||
from pillarsdk import exceptions as sdk_exceptions
|
from pillarsdk import exceptions as sdk_exceptions
|
||||||
|
|
||||||
from bpy.types import Operator, Panel, AddonPreferences
|
from bpy.types import Operator, Panel, AddonPreferences
|
||||||
|
import bl_ui.space_sequencer
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -946,25 +947,31 @@ class ATTRACT_OT_project_open_in_browser(Operator):
|
|||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
def draw_strip_movie_meta(self, context):
|
class ATTRACT_PT_strip_metadata(bl_ui.space_sequencer.SequencerButtonsPanel, Panel):
|
||||||
strip = active_strip(context)
|
bl_label = "Metadata"
|
||||||
if not strip:
|
bl_parent_id = "SEQUENCER_PT_data"
|
||||||
return
|
bl_category = "Strip"
|
||||||
|
bl_options = {'DEFAULT_CLOSED'}
|
||||||
|
|
||||||
meta = strip.get('metadata', None)
|
def draw(self, context):
|
||||||
if not meta:
|
strip = active_strip(context)
|
||||||
return None
|
if not strip:
|
||||||
|
return
|
||||||
|
|
||||||
box = self.layout.column(align=True)
|
meta = strip.get('metadata', None)
|
||||||
row = box.row(align=True)
|
if not meta:
|
||||||
fname = meta.get('BLEND_FILE', None) or None
|
return None
|
||||||
if fname:
|
|
||||||
row.label(text='Original Blendfile: %s' % fname)
|
box = self.layout.column(align=True)
|
||||||
row.operator(ATTRACT_OT_open_meta_blendfile.bl_idname,
|
row = box.row(align=True)
|
||||||
text='', icon='FILE_BLEND')
|
fname = meta.get('BLEND_FILE', None) or None
|
||||||
sfra = meta.get('START_FRAME', '?')
|
if fname:
|
||||||
efra = meta.get('END_FRAME', '?')
|
row.label(text='Original Blendfile: %s' % fname)
|
||||||
box.label(text='Original Frame Range: %s-%s' % (sfra, efra))
|
row.operator(ATTRACT_OT_open_meta_blendfile.bl_idname,
|
||||||
|
text='', icon='FILE_BLEND')
|
||||||
|
sfra = meta.get('START_FRAME', '?')
|
||||||
|
efra = meta.get('END_FRAME', '?')
|
||||||
|
box.label(text='Original Frame Range: %s-%s' % (sfra, efra))
|
||||||
|
|
||||||
|
|
||||||
def activate():
|
def activate():
|
||||||
@ -1023,13 +1030,6 @@ def register():
|
|||||||
name="Status")
|
name="Status")
|
||||||
bpy.types.Sequence.atc_order = bpy.props.IntProperty(name="Order")
|
bpy.types.Sequence.atc_order = bpy.props.IntProperty(name="Order")
|
||||||
|
|
||||||
try:
|
|
||||||
panel = bpy.types.SEQUENCER_PT_info_input
|
|
||||||
except AttributeError:
|
|
||||||
# Blender 2.79 and older:
|
|
||||||
panel = bpy.types.SEQUENCER_PT_edit
|
|
||||||
panel.append(draw_strip_movie_meta)
|
|
||||||
|
|
||||||
for cls in _rna_classes:
|
for cls in _rna_classes:
|
||||||
bpy.utils.register_class(cls)
|
bpy.utils.register_class(cls)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user