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

Commit

Permalink
Merge pull request #3958 from BigRoy/fusion_backwards_compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
mkolar authored Oct 20, 2022
2 parents 6ead88e + 65c2638 commit d283dce
Showing 1 changed file with 17 additions and 2 deletions.
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

0 comments on commit d283dce

Please sign in to comment.