Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Fusion: Implement backwards compatibility (+/- Fusion 17.2) #3958

Merged
merged 1 commit into from
Oct 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions openpype/hosts/fusion/api/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,26 @@

class FusionLogHandler(logging.Handler):
# Keep a reference to fusion's Print function (Remote Object)
_print = getattr(sys.modules["__main__"], "fusion").Print
_print = None

@property
def print(self):
if self._print is not None:
# Use cached
return self._print

_print = getattr(sys.modules["__main__"], "fusion").Print
if _print is None:
# Backwards compatibility: Print method on Fusion instance was
# added around Fusion 17.4 and wasn't available on PyRemote Object
# before
_print = get_current_comp().Print
self._print = _print
return _print

def emit(self, record):
entry = self.format(record)
self._print(entry)
self.print(entry)


def install():
Expand Down