From 7977b0f05d197c3eddbbebfc57510f18dff7076b Mon Sep 17 00:00:00 2001 From: wijnand Date: Thu, 8 Mar 2018 15:01:15 +0100 Subject: [PATCH] Create lib module, added update_frame_range function --- colorbleed/fusion/lib.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 colorbleed/fusion/lib.py diff --git a/colorbleed/fusion/lib.py b/colorbleed/fusion/lib.py new file mode 100644 index 0000000000..7186cd2cac --- /dev/null +++ b/colorbleed/fusion/lib.py @@ -0,0 +1,40 @@ +import sys + +import avalon.fusion + + +self = sys.modules[__name__] +self._project = None + + +def update_frame_range(start, end, comp=None, set_render_range=True): + """Set Fusion comp's start and end frame range + + Args: + start (float, int): start frame + end (float, int): end frame + comp (object, Optional): comp object from fusion + set_render_range (bool, Optional): When True this will also set the + composition's render start and end frame. + + Returns: + None + + """ + + if not comp: + comp = avalon.fusion.get_current_comp() + + attrs = { + "COMPN_GlobalStart": start, + "COMPN_GlobalEnd": end + } + + if set_render_range: + attrs.update({ + "COMPN_RenderStart": start, + "COMPN_RenderEnd": end + }) + + with avalon.fusion.comp_lock_and_undo_chunk(comp): + comp.SetAttrs(attrs)