Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
3e743ac
openrv integration
Apr 13, 2023
4ec6643
Code cosmetics
BigRoy Apr 13, 2023
25669f8
Code cosmetics + cleanup
BigRoy Apr 13, 2023
7bae5de
Re-use method from host
BigRoy Apr 13, 2023
ee5944d
Remove unused function which likely came from Fusion or Clarisse inte…
BigRoy Apr 13, 2023
a37ddad
Cleanup comments
BigRoy Apr 13, 2023
751005d
Cosmetics
BigRoy Apr 13, 2023
8250f5e
Fix missing import, not sure if there was a reason it had no top import
BigRoy Apr 13, 2023
18be311
Fix typo
BigRoy Apr 13, 2023
26d6f60
Shush hound
BigRoy Apr 13, 2023
8d563b0
Remove unused `show_env`
BigRoy Apr 13, 2023
289fea4
Cleanup code
BigRoy Apr 13, 2023
b376efb
Remove debug files
BigRoy Apr 13, 2023
d10b2de
More cleanup
BigRoy Apr 13, 2023
fed5549
Return if there's no current workfile
BigRoy Apr 13, 2023
aa9766c
Cosmetics
BigRoy Apr 13, 2023
3c636d6
Cosmetics + Shush hound
BigRoy Apr 13, 2023
8d0d2bf
Remove unused function
BigRoy Apr 13, 2023
6092fa5
Merge remote-tracking branch 'upstream/develop' into openrv-integration
BigRoy Apr 13, 2023
de715e7
Cosmetics
BigRoy Apr 13, 2023
97b9c99
added missing schema
Apr 13, 2023
7a69fa5
added missing schema
Apr 13, 2023
6f50488
Cosmetics
BigRoy Apr 13, 2023
3e79ff1
Add `openrv` to hosts enum since it registers a host
BigRoy Apr 13, 2023
2310252
Use FusionPreLaunchOCIO hook as global hook for re-use with `openrv`
BigRoy Apr 13, 2023
4523416
Remove pre config hook in favor of global OCIO hook
BigRoy Apr 13, 2023
f4d69f8
Cleanup code
BigRoy Apr 13, 2023
dbec91d
Don't add to sys.path, don't clear PYTHONPATH
BigRoy Apr 13, 2023
028e85f
More specific imports
BigRoy Apr 13, 2023
d716d04
Clean up imports
BigRoy Apr 13, 2023
df7ee57
Merge branch 'develop' into openrv-integration
BigRoy Apr 13, 2023
86cc3b6
proper menu file
Apr 13, 2023
12c21e1
Cleanup file again.
BigRoy Apr 13, 2023
265d12c
Hound
BigRoy Apr 13, 2023
552c2f6
Match menu labels of other integrations + clarify arguments to `init`
BigRoy Apr 13, 2023
8303faa
Shush hound
BigRoy Apr 13, 2023
a336e1b
Remove unused variable
BigRoy Apr 13, 2023
c8df2ee
Hound
BigRoy Apr 13, 2023
bf2188f
Update menu name
BigRoy Apr 13, 2023
850cb21
Fix workfile saving with correct extension
BigRoy Apr 13, 2023
aa303b9
Hack: For now "auto-deploy" and load packages
BigRoy Apr 13, 2023
f3e357b
Update python files on deployment
BigRoy Apr 13, 2023
492ed6a
Avoid errors when no currently loaded content
BigRoy Apr 13, 2023
97a83f1
No need for default environment overrides
BigRoy Apr 13, 2023
cd34df7
Shush hound
BigRoy Apr 13, 2023
9bf9667
Fix line length
BigRoy Apr 13, 2023
f1ba2be
Shush hound
BigRoy Apr 13, 2023
0ec4afa
Shush hound
BigRoy Apr 13, 2023
a85ffd3
Shush hound
BigRoy Apr 13, 2023
48bf981
Shush hound
BigRoy Apr 13, 2023
763d4f7
Cleanup
BigRoy Apr 13, 2023
3377f32
Fix line length
BigRoy Apr 13, 2023
6503152
Hound
BigRoy Apr 13, 2023
0e1e23a
Cleanup
BigRoy Apr 13, 2023
fbea68a
Comment out unused lines which end up doing nothing
BigRoy Apr 13, 2023
759152b
Returned value was unused
BigRoy Apr 13, 2023
69a9436
Comment import + add todo
BigRoy Apr 13, 2023
ab3568d
Hound
BigRoy Apr 13, 2023
c2d156f
Cleanup cycle annotate frames logic
BigRoy Apr 13, 2023
1134aa2
Comment import + add todo
BigRoy Apr 13, 2023
189bf5e
Comment to explain we require the sorting
BigRoy Apr 13, 2023
54ea549
Don't pass emtpy list as parent
BigRoy Apr 13, 2023
fa8a964
Create dock widget only on first 'review' click and toggle view other…
BigRoy Apr 13, 2023
d734b90
Parent the OpenPype tools to RV window
BigRoy Apr 13, 2023
b079095
Cosmetics
BigRoy Apr 13, 2023
09fdae3
Cleanup imports
BigRoy Apr 13, 2023
4092069
Merge branch 'develop' into openrv-integration
BigRoy Apr 13, 2023
eb74f7e
Do nothing if there are no annotations
BigRoy Apr 13, 2023
dbcc9cc
Remove debugging method
BigRoy Apr 13, 2023
ee86ab6
Always return the session window live because there can be multiple s…
BigRoy Apr 13, 2023
dff3997
Add todo
BigRoy Apr 13, 2023
abbcca4
Only install once, not per session window
BigRoy Apr 13, 2023
ab8b0a1
Remove unused import
BigRoy Apr 13, 2023
28d352d
Works fine for multiple session windows since it initializes a class …
BigRoy Apr 13, 2023
12b17b2
Do not force show the RV console
BigRoy Apr 13, 2023
5c69925
Support loading image sequences
BigRoy Apr 13, 2023
b312019
Allow any mov or mp4 extension
BigRoy Apr 13, 2023
95aedf9
Allow loading more image extensions
BigRoy Apr 13, 2023
9887404
Add temporary hack to avoid clash with `PyOpenColorIO` in OpenPype
BigRoy Apr 13, 2023
3766241
Add todo
BigRoy Apr 13, 2023
de683b3
Do not force show review tool on launch
BigRoy Apr 13, 2023
cead75f
Simplify lib clash workaround
BigRoy Apr 13, 2023
bdde431
Add init sorted order to make "Review" the last entry in the menu.
BigRoy Apr 14, 2023
da2d988
Add OpenPype script editor (python interpreter widget) package to hel…
BigRoy Apr 14, 2023
bb8932c
Tweak organization
BigRoy Apr 14, 2023
0fd51b2
Remove forcing of asset fps/frames + support removal of containers
BigRoy Apr 14, 2023
28e27fd
Fix RV Project Settings + remove unused redundant settings
BigRoy Apr 14, 2023
267f5d5
Use OCIO schemas like other hosts
BigRoy Apr 14, 2023
e3cf566
Allow import even when OpenPype hasn't initialized/installed
BigRoy Apr 17, 2023
f38e24e
Fix typo
BigRoy Apr 17, 2023
859217f
Add checkbox active state to "review" menu entry
BigRoy Apr 17, 2023
86ee0de
Add separators to menu
BigRoy Apr 17, 2023
41c72e8
Ignore namespace attribute if it does not exist
BigRoy Apr 17, 2023
371ec04
Cleanup, move import to top + improve docstring
BigRoy Apr 17, 2023
fe1e776
Implement draft functionality to set OCIO colorspace on file load and…
BigRoy Apr 17, 2023
d1ceeff
Add active state to the menu
BigRoy Apr 17, 2023
b097044
Remove redundant check, it's already checked in other if statement
BigRoy Apr 17, 2023
1b26835
Hound
BigRoy Apr 17, 2023
262147d
Add support for open last workfile
BigRoy Apr 18, 2023
85483c5
Refactor to using new publisher
BigRoy Apr 18, 2023
367884e
Expose library loader
BigRoy Apr 18, 2023
db24d5b
Add todo
BigRoy Apr 18, 2023
8dec68b
Merge remote-tracking branch 'upstream/develop' into openrv-integration
BigRoy Apr 18, 2023
d7c4630
Define subset name correctly using templates
BigRoy Apr 18, 2023
dd664c8
Nicer label + docstring
BigRoy Apr 18, 2023
81d5d16
Add comment about a workaround
BigRoy Apr 18, 2023
fce4e7d
Cleanup `reset_frame_range` logic. Remove old `edit_in` and `edit_out`
BigRoy Apr 18, 2023
1da142c
Remove redundant adding of vendor/python
BigRoy Apr 18, 2023
26c8f29
Merge branch 'develop' into openrv-integration
BigRoy Apr 24, 2023
74779ce
Merge branch 'develop' into openrv-integration
BigRoy Apr 25, 2023
a2b37e9
Preserve predefined RV_SUPPORT_PATH paths
BigRoy Apr 25, 2023
aa74663
Install OpenPype packages to temp folder on launch + preserve predefi…
BigRoy Apr 25, 2023
4e41b48
Remove unused import
BigRoy Apr 25, 2023
0dda77b
Force `rvpkg` just to be sure it's not trying to be used interactively
BigRoy Apr 25, 2023
3493817
Merge branch 'develop' into openrv-integration
antirotor Nov 23, 2023
305efbb
:recycle: update color management settings
antirotor Dec 13, 2023
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
1 change: 1 addition & 0 deletions openpype/hooks/pre_add_last_workfile_arg.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class AddLastWorkfileToLaunchArgs(PreLaunchHook):
"tvpaint",
"substancepainter",
"aftereffects",
"openrv",
}
launch_types = {LaunchTypes.local}

Expand Down
1 change: 1 addition & 0 deletions openpype/hooks/pre_ocio_hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class OCIOEnvHook(PreLaunchHook):
"nuke",
"hiero",
"resolve",
"openrv",
}
launch_types = set()

Expand Down
10 changes: 10 additions & 0 deletions openpype/hosts/openrv/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from .addon import (
OpenRVAddon,
OPENRV_ROOT_DIR
)


__all__ = (
"OpenRVAddon",
"OPENRV_ROOT_DIR"
)
33 changes: 33 additions & 0 deletions openpype/hosts/openrv/addon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import os
from openpype.modules import OpenPypeModule
from openpype.modules.interfaces import IHostAddon

OPENRV_ROOT_DIR = os.path.dirname(os.path.abspath(__file__))


class OpenRVAddon(OpenPypeModule, IHostAddon):
name = "openrv"
host_name = "openrv"

def initialize(self, module_settings):
self.enabled = True

def add_implementation_envs(self, env, app):
"""Modify environments to contain all required for implementation."""
# Set default environments if are not set via settings
defaults = {
"OPENPYPE_LOG_NO_COLORS": "True"
}
for key, value in defaults.items():
if not env.get(key):
env[key] = value

def get_launch_hook_paths(self, app):
if app.host_name != self.host_name:
return []
return [
os.path.join(OPENRV_ROOT_DIR, "hooks")
]

def get_workfile_extensions(self):
return [".rv"]
10 changes: 10 additions & 0 deletions openpype/hosts/openrv/api/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
"""OpenRV OpenPype host API."""

from .pipeline import (
OpenRVHost
)

__all__ = [
"OpenRVHost"
]
34 changes: 34 additions & 0 deletions openpype/hosts/openrv/api/commands.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import logging

import rv
from openpype.pipeline.context_tools import get_current_project_asset

log = logging.getLogger(__name__)


def reset_frame_range():
""" Set timeline frame range.
"""
asset_doc = get_current_project_asset()
asset_name = asset_doc["name"]
asset_data = asset_doc["data"]

frame_start = asset_data.get("frameStart")
frame_end = asset_data.get("frameEnd")

if frame_start is None or frame_end is None:
log.warning("No edit information found for {}".format(asset_name))
return

rv.commands.setFrameStart(frame_start)
rv.commands.setFrameEnd(frame_end)
rv.commands.setFrame(frame_start)


def set_session_fps():
""" Set session fps.
"""
asset_doc = get_current_project_asset()
asset_data = asset_doc["data"]
fps = float(asset_data.get("fps", 25))
rv.commands.setFPS(fps)
39 changes: 39 additions & 0 deletions openpype/hosts/openrv/api/lib.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import contextlib

import rv


@contextlib.contextmanager
def maintained_view():
"""Reset to original view node after context"""
original = rv.commands.viewNode()
try:
yield
finally:
rv.commands.setViewNode(original)


@contextlib.contextmanager
def active_view(node):
"""Set active view during context"""
with maintained_view():
rv.commands.setViewNode(node)
yield


def group_member_of_type(group_node, member_type):
"""Return first member of group that is of the given node type.

This is similar to `rv.extra_commands.nodesInGroupOfType` but only
returns the first entry directly if it has any match.

Args:
group_node (str): The group node to search in.
member_type (str): The node type to search for.

Returns:
str or None: The first member found of given type or None
"""
for node in rv.commands.nodesInGroup(group_node):
if rv.commands.nodeType(node) == member_type:
return node
115 changes: 115 additions & 0 deletions openpype/hosts/openrv/api/ocio.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
"""Helper functions to apply OCIO colorspace settings on groups.

This tries to set the relevant OCIO settings on the group's look and render
pipeline similar to what the OpenColorIO Basic Color Management package does in
OpenRV through its `ocio_source_setup` python file.
Comment on lines +3 to +5
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be great if we could also autoload this package - but I know too little of RV to say what the best approach is to do so.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've asked more information about this on the Shotgrid Software community about Autoload OpenColorIO Basic Color Management RV package.


This assumes that the OpenColorIO Basic Color Management package of RV is both
installed and loaded.

"""
import rv.commands
import rv.qtutils

from .lib import (
group_member_of_type,
active_view
)


class OCIONotActiveForGroup(RuntimeError):
"""Error raised when OCIO is not enabled on the group node."""


def get_group_ocio_look_node(group):
"""Return OCIOLook node from source group"""
pipeline = group_member_of_type(group, "RVLookPipelineGroup")
if pipeline:
return group_member_of_type(pipeline, "OCIOLook")


def get_group_ocio_file_node(group):
"""Return OCIOFile node from source group"""
pipeline = group_member_of_type(group, "RVLinearizePipelineGroup")
if pipeline:
return group_member_of_type(pipeline, "OCIOFile")


def set_group_ocio_colorspace(group, colorspace):
"""Set the group's OCIOFile node ocio.inColorSpace property.

This only works if OCIO is already 'active' for the group. T

"""
import ocio_source_setup # noqa, RV OCIO package
node = get_group_ocio_file_node(group)

if not node:
raise OCIONotActiveForGroup(
"Unable to find OCIOFile node for {}".format(group)
)

rv.commands.setStringProperty(
f"{node}.ocio.inColorSpace", [colorspace], True
)


def set_current_ocio_active_state(state):
"""Set the OCIO state for the currently active source.

This is a hacky workaround to enable/disable the OCIO active state for
a source since it appears to be that there's no way to explicitly trigger
this callback from the `ocio_source_setup.OCIOSourceSetupMode` instance
which does these changes.

"""
# TODO: Make this logic less hacky
# See: https://community.shotgridsoftware.com/t/how-to-enable-disable-ocio-and-set-ocio-colorspace-for-group-using-python/17178 # noqa

group = rv.commands.viewNode()
ocio_node = get_group_ocio_file_node(group)
if state == bool(ocio_node):
# Already in correct state
return

window = rv.qtutils.sessionWindow()
menu_bar = window.menuBar()
for action in menu_bar.actions():
if action.text() != "OCIO" or action.toolTip() != "OCIO":
continue

ocio_menu = action.menu()

for ocio_action in ocio_menu.actions():
if ocio_action.toolTip() == "File Color Space":
# The first entry is for "current source" instead
# of all sources so we need to break the for loop
# The first action of the file color space menu
# is the "Active" action. So lets take that one
active_action = ocio_action.menu().actions()[0]

active_action.trigger()
return

raise RuntimeError(
"Unable to set active state for current source. Make "
"sure the OCIO package is installed and loaded."
)


def set_group_ocio_active_state(group, state):
"""Set the OCIO state for the 'currently active source'.

This is a hacky workaround to enable/disable the OCIO active state for
a source since it appears to be that there's no way to explicitly trigger
this callback from the `ocio_source_setup.OCIOSourceSetupMode` instance
which does these changes.

"""
ocio_node = get_group_ocio_file_node(group)
if state == bool(ocio_node):
# Already in correct state
return

with active_view(group):
set_current_ocio_active_state(state)
Loading