mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Added menu entries to set resolution and frame range
This commit is contained in:
parent
27d3edb89a
commit
99099b81e0
2 changed files with 33 additions and 8 deletions
|
|
@ -20,6 +20,7 @@ from openpype.pipeline import get_current_asset_name, get_current_task_name
|
|||
from openpype.tools.utils import host_tools
|
||||
|
||||
from .workio import OpenFileCacher
|
||||
from . import pipeline
|
||||
|
||||
PREVIEW_COLLECTIONS: Dict = dict()
|
||||
|
||||
|
|
@ -344,6 +345,26 @@ class LaunchWorkFiles(LaunchQtApp):
|
|||
self._window.refresh()
|
||||
|
||||
|
||||
class SetFrameRange(bpy.types.Operator):
|
||||
bl_idname = "wm.ayon_set_frame_range"
|
||||
bl_label = "Set Frame Range"
|
||||
|
||||
def execute(self, context):
|
||||
data = pipeline.get_asset_data()
|
||||
pipeline.set_frame_range(data)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class SetResolution(bpy.types.Operator):
|
||||
bl_idname = "wm.ayon_set_resolution"
|
||||
bl_label = "Set Resolution"
|
||||
|
||||
def execute(self, context):
|
||||
data = pipeline.get_asset_data()
|
||||
pipeline.set_resolution(data)
|
||||
return {"FINISHED"}
|
||||
|
||||
|
||||
class TOPBAR_MT_avalon(bpy.types.Menu):
|
||||
"""Avalon menu."""
|
||||
|
||||
|
|
@ -381,9 +402,11 @@ class TOPBAR_MT_avalon(bpy.types.Menu):
|
|||
layout.operator(LaunchManager.bl_idname, text="Manage...")
|
||||
layout.operator(LaunchLibrary.bl_idname, text="Library...")
|
||||
layout.separator()
|
||||
layout.operator(SetFrameRange.bl_idname, text="Set Frame Range")
|
||||
layout.operator(SetResolution.bl_idname, text="Set Resolution")
|
||||
layout.separator()
|
||||
layout.operator(LaunchWorkFiles.bl_idname, text="Work Files...")
|
||||
# TODO (jasper): maybe add 'Reload Pipeline', 'Set Frame Range' and
|
||||
# 'Set Resolution'?
|
||||
# TODO (jasper): maybe add 'Reload Pipeline'
|
||||
|
||||
|
||||
def draw_avalon_menu(self, context):
|
||||
|
|
@ -399,6 +422,8 @@ classes = [
|
|||
LaunchManager,
|
||||
LaunchLibrary,
|
||||
LaunchWorkFiles,
|
||||
SetFrameRange,
|
||||
SetResolution,
|
||||
TOPBAR_MT_avalon,
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ def message_window(title, message):
|
|||
_process_app_events()
|
||||
|
||||
|
||||
def _get_asset_data():
|
||||
def get_asset_data():
|
||||
project_name = get_current_project_name()
|
||||
asset_name = get_current_asset_name()
|
||||
asset_doc = get_asset_by_name(project_name, asset_name)
|
||||
|
|
@ -121,7 +121,7 @@ def _get_asset_data():
|
|||
return asset_doc.get("data")
|
||||
|
||||
|
||||
def set_start_end_frames(data):
|
||||
def set_frame_range(data):
|
||||
scene = bpy.context.scene
|
||||
|
||||
# Default scene settings
|
||||
|
|
@ -171,12 +171,12 @@ def on_new():
|
|||
set_resolution_startup = settings.get("set_resolution_startup")
|
||||
set_frames_startup = settings.get("set_frames_startup")
|
||||
|
||||
data = _get_asset_data()
|
||||
data = get_asset_data()
|
||||
|
||||
if set_resolution_startup:
|
||||
set_resolution(data)
|
||||
if set_frames_startup:
|
||||
set_start_end_frames(data)
|
||||
set_frame_range(data)
|
||||
|
||||
unit_scale_settings = settings.get("unit_scale_settings")
|
||||
unit_scale_enabled = unit_scale_settings.get("enabled")
|
||||
|
|
@ -192,12 +192,12 @@ def on_open():
|
|||
set_resolution_startup = settings.get("set_resolution_startup")
|
||||
set_frames_startup = settings.get("set_frames_startup")
|
||||
|
||||
data = _get_asset_data()
|
||||
data = get_asset_data()
|
||||
|
||||
if set_resolution_startup:
|
||||
set_resolution(data)
|
||||
if set_frames_startup:
|
||||
set_start_end_frames(data)
|
||||
set_frame_range(data)
|
||||
|
||||
unit_scale_settings = settings.get("unit_scale_settings")
|
||||
unit_scale_enabled = unit_scale_settings.get("enabled")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue