-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/1.5.0' into main
- Loading branch information
Showing
4 changed files
with
101 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from __future__ import print_function | ||
import hou | ||
import nodegraphprefs as prefs | ||
|
||
def networkEditorTitleLeft(editor): | ||
try: | ||
title = '' | ||
pwd = editor.pwd() | ||
playerparm = pwd.parm('isplayer') | ||
if playerparm is not None and playerparm.evalAsInt() != 0: | ||
title += 'Network in Playback Mode\n' | ||
if prefs.showPerfStats(editor): | ||
profile = hou.perfMon.activeProfile() | ||
if profile is not None: | ||
profiletitle = profile.title() | ||
if not profiletitle: | ||
profiletitle = 'Profile ' + str(profile.id()) | ||
title += profiletitle + ': ' + prefs.perfStatName(editor) | ||
|
||
except: | ||
title = '' | ||
|
||
# Bee edit, append $JOB | ||
# Add a newline if title is in use | ||
if title: | ||
title += '\n' | ||
|
||
title += hou.getenv('JOB').split('/')[-1] | ||
|
||
return title | ||
|
||
def networkEditorTitleRight(editor): | ||
try: | ||
title = '' | ||
pwd = editor.pwd() | ||
title += pwd.childTypeCategory().label() | ||
|
||
except: | ||
title = '' | ||
|
||
return title | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,51 @@ | ||
import hou | ||
import stateutils | ||
import toolutils | ||
|
||
def main(): | ||
nodes = hou.selectedNodes() | ||
def main(kwargs): | ||
""" | ||
Creates a null to use as a focus gizmo for the selected camera(s) | ||
""" | ||
|
||
for node in nodes: | ||
# store reference to selected node | ||
selected_nodes = hou.selectedNodes() | ||
|
||
# Init to record if a camera was selected at all | ||
any_camera_selected = False | ||
|
||
# get network editor pane | ||
pane = stateutils.activePane(kwargs) | ||
|
||
if not isinstance(pane, hou.NetworkEditor): | ||
hou.ui.setStatusMessage('Only works in network editor', severity=hou.severityType.Error) | ||
return False | ||
|
||
for node in selected_nodes: | ||
if node.type().name() != 'cam': | ||
continue | ||
|
||
# A camera was found! | ||
any_camera_selected = True | ||
|
||
# create null | ||
focus_null = node.parent().createNode('null', node.name() + '_focus') | ||
# create null | ||
# toolutils not soptoolutils, because it's not a SOP | ||
focus_null = toolutils.genericTool(kwargs, 'null') | ||
focus_null.setName(node.name() + '_focus', True) | ||
|
||
# add focus distance expression | ||
expression = "vlength(vtorigin('.', '{}'))".format(node.relativePathTo(focus_null)) | ||
node.parm('focus').setExpression(expression) | ||
|
||
# Lock rotation | ||
focus_null.parmTuple('r').lock(True) | ||
|
||
# set focus null visual properties | ||
focus_null.parm('shadedmode').set(1) | ||
focus_null.parm('controltype').set(2) | ||
focus_null.parm('geoscale').set(0.1) | ||
focus_null.parmTuple('dcolor').set((0,0.1,1)) | ||
focus_null.parmTuple('dcolor').set((0, 0.1 ,1)) | ||
|
||
if not any_camera_selected: | ||
message = "There were no cameras found in selection! Please select camera(s)" | ||
hou.ui.setStatusMessage(message=message, severity=hou.severityType.ImportantMessage) | ||
return |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters