set up the shelf creation in the _set_context_settings function

This commit is contained in:
Thomas Fricard 2022-08-09 15:43:47 +02:00
parent 5b559fd28d
commit a006b5df63
2 changed files with 34 additions and 0 deletions

View file

@ -460,3 +460,35 @@ def reset_framerange():
hou.playbar.setFrameRange(frame_start, frame_end)
hou.playbar.setPlaybackRange(frame_start, frame_end)
hou.setFrame(frame_start)
def create_shelf():
hou.shelves.beginChangeBlock()
custom_shelf = hou.shelves.newShelf(
file_path='',
name="custom_shelf",
label="Custom Shelf"
)
new_tool = hou.shelves.newTool(
file_path='',
name='new_tool',
label='New Tool',
script='',
language=hou.scriptLanguage.Python,
icon='',
help='This is a new tool'
)
if new_tool not in custom_shelf.tools():
custom_shelf.setTools(list(custom_shelf.tools()) + [new_tool])
shelf_set = [
shelf for shelf in hou.shelves.shelfSets().values()
if shelf.label() == "Create and Refine"
][0]
shelf_set.setShelves(shelf_set.shelves() + (custom_shelf,))
hou.shelves.endChangeBlock()

View file

@ -309,6 +309,7 @@ def _set_context_settings():
fps
resolution
renderer
shelves
Returns:
None
@ -320,6 +321,7 @@ def _set_context_settings():
lib.set_scene_fps(fps)
lib.reset_framerange()
lib.create_shelf()
def on_pyblish_instance_toggled(instance, new_value, old_value):