diff --git a/python3.9libs/nodegraphtitle.py b/python3.9libs/nodegraphtitle.py
new file mode 100644
index 0000000..94aeccb
--- /dev/null
+++ b/python3.9libs/nodegraphtitle.py
@@ -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
+
diff --git a/scripts/python/bee/focus_null.py b/scripts/python/bee/focus_null.py
index 38eb4fb..4218250 100644
--- a/scripts/python/bee/focus_null.py
+++ b/scripts/python/bee/focus_null.py
@@ -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))
\ No newline at end of file
+ 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
\ No newline at end of file
diff --git a/scripts/python/bee/labelled_netbox.py b/scripts/python/bee/labelled_netbox.py
index 00e82f1..9be49cb 100644
--- a/scripts/python/bee/labelled_netbox.py
+++ b/scripts/python/bee/labelled_netbox.py
@@ -3,16 +3,21 @@
def main():
# find parent node of current node.
- selected_nodes = hou.selectedNodes() # type: tuple[hou.Node]
- current_nodes = [x for x in selected_nodes if x.isCurrent] # type: List[hou.Node]
+ selected_nodes = hou.selectedNodes()
+ current_nodes = [x for x in selected_nodes if x.isCurrent]
+
if len(current_nodes) == 0:
- print("there are no selected node. please select some nodes")
+ message = "There are no selected nodes, please select some nodes first"
+ hou.ui.setStatusMessage(message=message, severity=hou.severityType.ImportantMessage)
return
- parent = current_nodes[0].parent() # type: hou.Node
+
+ # Ask user for label, first looks tidier in network viewer
+ label = hou.ui.readInput('Label')
+
+ parent = current_nodes[0].parent()
# create network boxes
- # parent_network_box = parent.createNetworkBox() # type: hou.NetworkBox
- child_network_box = parent.createNetworkBox() # type: hou.NetworkBox
+ child_network_box = parent.createNetworkBox()
# find good position of boxes, which is center of selected nodes.
list_x_of_selected_nodes = [node.position().x() for node in selected_nodes]
@@ -27,7 +32,7 @@ def main():
child_network_box.fitAroundContents()
# set color of network boxes
- network_box_color = hou.Color(0.5,0.1,0.1)
+ network_box_color = hou.Color(0.5, 0.1, 0.1)
child_network_box.setColor(network_box_color)
# create sticky_note
@@ -38,25 +43,18 @@ def main():
sticky_note_position = hou.Vector2(sticky_note_position_x, sticky_note_position_y)
sticky_note.setPosition(sticky_note_position)
- if hou.isUIAvailable:
- label = hou.ui.readInput('Label')
- else:
- label = 'default'
-
sticky_note.setText(label[1])
sticky_note_height = 2
sticky_note.setTextSize(sticky_note_height * .5)
+
# min width to fit sticky note text
sticky_note_width = max(child_network_box.size().x(), 4)
-
sticky_note.setSize(hou.Vector2(sticky_note_width, sticky_note_height))
# add after setting position
child_network_box.addItem(sticky_note)
- sticky_note_text_color = hou.Color(214.0 / 255.0, 214.0 / 255.0, 214.0 / 255.0)
sticky_note.setDrawBackground(False)
- sticky_note.setTextColor(sticky_note_text_color)
return
diff --git a/toolbar/bee.shelf b/toolbar/bee.shelf
index 8ea09dc..fb54e26 100644
--- a/toolbar/bee.shelf
+++ b/toolbar/bee.shelf
@@ -14,7 +14,7 @@
-
+
Bee
-
+
OBJ
SOP
@@ -77,7 +77,7 @@ bee.object_merge_selected.sibling_sop(kwargs)]]>
- bee network box label note sticky
+ bee network box label note sticky group frame backdrop
@@ -93,10 +93,11 @@ bee.object_merge_selected.sibling_obj(kwargs)]]>
-
+
SOP
+ Bee
@@ -104,12 +105,13 @@ bee.list_materials.main()]]>
-
+
OBJ
+ Bee
+bee.focus_null.main(kwargs)]]>
camera add focus null bee