Skip to content

Commit

Permalink
LDT Menu Node Annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
ezequielmastrasso committed Sep 5, 2020
1 parent 36b2c28 commit 3a5a769
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ My gaffer toolset, presets, and configs.
### Miscelaneous
* Custom Variables LDT resources
* Bookmarks LDT folders
* LDT Menu: Export Extension
* LDT Menu: Export Extension, Node Annotations
* Gaffer Cache MemoryLimit
* Arnold Outputs: Custom lightgroup_[a-g], and lightgroup[a-g]_denoise
* Arnold Outputs: Custom lightgroup_[a-g], and lightgroup_denoise[a-g] using optix filter.

### NameSwitch and Spreadsheet Presets
```
Expand All @@ -25,6 +25,14 @@ Same as Gaffer Defaults (except lights, and filters), but easier on the eye.
<img src="docs/nodeGadget_color.png" alt="EZSurfacing Tools" style="" />

## Python

### LDT Menu
##### Export Extension
Default Gaffer export extension example. Might not work with Spreadsheets, etc.

##### Annotation
Set selected nodes Metadata `annotation:greeting:text`

### ShaderView:Shader Ball
Based on an editable Box inside the resources folder.
<img width="100%" src="docs/gafferShaderView2.png" alt="EZSurfacing Tools" style="" />
Expand Down
17 changes: 17 additions & 0 deletions python/LDTGafferUtils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,23 @@

import os

def registerAnnotation( menu):
scriptWindow = menu.ancestor( GafferUI.ScriptWindow )
script = scriptWindow.scriptNode()
mainWindow = GafferUI.ScriptWindow.acquire( script )

selected = script.selection()
if selected.size():
current_annotation = Gaffer.Metadata.value(selected[0], "annotation:greeting:text")
initial_text = current_annotation if current_annotation else ""
d = GafferUI.TextInputDialogue( initialText=initial_text, title="Annotation", confirmLabel="Set" )
text = d.waitForText( parentWindow = mainWindow )
for node in selected:
if text:
Gaffer.Metadata.registerValue(node, "annotation:greeting:text", text)



def export_extension( menu ) :
scriptWindow = menu.ancestor( GafferUI.ScriptWindow )
script = scriptWindow.scriptNode()
Expand Down
9 changes: 9 additions & 0 deletions startup/gui/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,12 @@
"label" : "Export Extension"
}
)

GafferUI.ScriptWindow.menuDefinition(application).append(
"/LDT/tools/" + "registerAnnotation",
{
"command" : functools.partial( LDTGafferUtils.registerAnnotation), #stream data during loop
"label" : "registerAnnotation"
}
)

0 comments on commit 3a5a769

Please sign in to comment.