Skip to content
Open
Show file tree
Hide file tree
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
51 changes: 50 additions & 1 deletion openpype/hosts/nuke/api/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
)
from openpype.pipeline.workfile import BuildWorkfile
from openpype.tools.utils import host_tools

from openpype.lib.applications import ApplicationManager
from .command import viewer_update_and_undo_stop
from .lib import (
Context,
Expand Down Expand Up @@ -319,6 +319,8 @@ def _install_menu():
# adding shortcuts
add_shortcuts_from_presets()

# adding rv
add_rv_from_presets()

def change_context_label():
menubar = nuke.menu("Nuke")
Expand All @@ -345,6 +347,53 @@ def change_context_label():
Context.context_label, label))


def add_rv_from_presets():
rv_settings = get_current_project_settings()["openrv"]['openrv_nuke_integration']

if not rv_settings['rvnuke_enabled']:
return

if 'rvnuke_content_paths' not in rv_settings:
return

for rv_nuke_path in rv_settings['rvnuke_content_paths']:
if os.path.exists(rv_nuke_path):
nuke.pluginAddPath(rv_nuke_path)
log.info("RV Nuke path added: {}".format(rv_nuke_path))
else:
log.warning("RV Nuke path not found: {}".format(rv_nuke_path))

app_manager = ApplicationManager()
openrv_app = app_manager.find_latest_available_variant_for_group("openrv")
rv_exec_path = str(openrv_app.find_executable())

if not rv_exec_path:
return
try:
import rvNuke
rv_pref_panel = rvNuke.RvPreferencesPanel()
rv_pref_panel.rvPrefs.prefs["rvExecPath"] = rv_exec_path
rv_pref_panel.rvPrefs.saveToDisk()
except ImportError:
log.warning("rvNuke not found")

nuke.addOnCreate(add_rv_shortcut, nodeClass="Root")
return


def add_rv_shortcut():
rv_global_settings = get_current_project_settings()["openrv"]
rv_settings = rv_global_settings['openrv_nuke_integration']
if rv_settings['rvnuke_open_in_rv_shortcut']:
menubar = nuke.menu("Nuke")
menu_item = menubar.findItem("RV/View in RV")
menu_item.setShortcut("Alt+v")
menu_item.setShortcut(rv_settings['rvnuke_open_in_rv_shortcut'])
log.info("Adding Shortcut `{}` to `{}`".format(
'Open in RV',
rv_settings['rvnuke_open_in_rv_shortcut']))


def add_shortcuts_from_presets():
menubar = nuke.menu("Nuke")
nuke_presets = get_current_project_settings()["nuke"]["general"]
Expand Down
5 changes: 5 additions & 0 deletions openpype/settings/defaults/project_settings/openrv.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,10 @@
"enabled": true,
"rules": {}
}
},
"openrv_nuke_integration": {
"rvnuke_enabled": false,
"rvnuke_content_paths" : [],
"rvnuke_open_in_rv_shortcut" : "Alt+v"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,33 @@
"name": "schema_imageio_file_rules"
}
]
},
{
"key": "openrv_nuke_integration",
"type": "dict",
"label": "Nuke integration",
"collapsible": true,
"is_group": true,
"children": [
{
"type": "boolean",
"key": "rvnuke_enabled",
"label": "Enable RV Nuke integration"
},

{
"type": "text",
"key": "rvnuke_open_in_rv_shortcut",
"label": "Open In Rv Shortcut"
},
{
"type": "path",
"key": "rvnuke_content_paths",
"label": "RV Nuke Content Paths",
"multiplatform": false,
"multipath": true
}
]
}
]
}
}