GithubHelp home page GithubHelp logo

dbr / tabtabtab-nuke Goto Github PK

View Code? Open in Web Editor NEW
36.0 13.0 14.0 112 KB

A replacement for Nuke's "tab" node creator

Home Page: http://www.nukepedia.com/python/ui/tabtabtab

License: The Unlicense

Python 100.00%
python vfx nuke ui

tabtabtab-nuke's Introduction

"tabtabtab", an alternative "tab node creator thingy" for The Foundry's Nuke

It does substring matching (so "blr" matches "blur"), and weights your most used nodes first (so if I make the useful "Add [math]" node often, it appears higher in the list than "Add 3:2 pulldown")

Installation

Put tabtabtab on PYTHONPATH or NUKE_PATH somewhere (maybe in ~/.nuke/)

mkdir -p ~/.nuke
cd ~/.nuke
curl -O https://raw.github.com/dbr/tabtabtab-nuke/master/tabtabtab.py

Then to your ~/.nuke/menu.py add:

def ttt():
    import tabtabtab
    m_graph = nuke.menu("Node Graph")
    m_graph.addCommand("Tabtabtab", tabtabtab.main, "Tab")

try:
    ttt()
except Exception:
    import traceback
    traceback.print_exc()

The original menu will still be available via "Ctrl+Tab". You can change the last "Tab" argument to another shortcut if you wish.

Notes

This requires Nuke 6.3v5 or higher (for the integrated PySide module)

For older versions of 6.3, you must have a custom PyQt installation. For 6.2, see Dylan Palmboom's tabtabtabLegacy fork, which may also work in even more ancient version.

Relevant Foundry bug-id's:

  • [Fixed in Nuke 6.3v8] Bug #23576, "Segmentation Fault on Nuke exit after using a custom PySide window" (causes a mostly harmless "Segmentation fault" message on exiting Nuke)

  • Feature #11662 to get this functionality integrated into Nuke

In order to support Nuke 9, you need to use a different snippet in your menu.py, adding the tabtabtab call to the Node Graph instead of the Edit menu (see the updated installation instructions). The same snippet works in older verisons of Nuke.

More elabourate description

With the default "tab thing", you press tab, start typing a node name (like "Blu") and you get a list of nodes that start with "Blu" (like "Blur"):

Nuke's builtin tab thing

"tabtabtab" works very similarly, but does substring matching:

tabtabtab

In this example, "tra" finds "Transform" as you'd hope, but also other nodes, such as "Trilinear"... This is appearing because the letters "tra" can be found in order, "TRilineAr".

While this seems like it might cause lots of useless results, you quickly memorise shortcuts like "trear" which matches "TRilinEAR" and very little else. More usefully, "trage" will uniquely match "TRAnsformGEo" in an easy to type way, "rdg" matches "ReaDGeo"

The first letter must match, so "geo" will match "GeoSelect", but not "ReadGeo". However "rgeo" will match "ReadGeo"

Weighting

Each time you create a node, it's "weight" is increase - the higher the weight, the higher the node appears in the list.

This means if you create lots of "Add [math]" nodes, it will be weighted highly, so all you might need to type is tab then "a", and it will be at the top of the list.

The nodes weight is shown by the block to the right of the node - the more green, the higher the weighting

Matching menu location

If you start typing a shortcut, it will only match the part before the "[Filter/SubMenu]" (e.g "blf" will not match "Blur [Filter]")

However if you type either "[" or two spaces, you can match against the menu location (the part in "[...]")

For example, "ax" matches "AddMix [Merge]" and "Axis [3D]". If you type "ax[3" or "ax 3" (ax-space-space-3) it will only match "Axis [3D]"

Change log

  • v1.0

    • Basically working
  • v1.1

    • Node weights are saved
  • v1.2

    • Window appears under cursor
  • v1.3

    • Created node remains selected between tab's, meaning "tabtab" creates the previously node
    • Clicking a node in the list creates it
    • Window doesn't go offscreen if cursor is near edge
  • v1.4

    • Blocks Nuke UI when active. This greatly improves usability when the weights are slow to load (e.g in heavy Nuke script, or slow home-dir access), as it prevents key-presses intended for tabtabtab from being handled by Nuke (possibly creating new/modifying nodes etc)
    • Up/down arrow keys cycle correctly
    • Indicator blocks now actually indicate node weights, instead of always being green. The blocks are also now narrower, which looks nicer
    • Prevent vertical scrollbar (reduced number of shown items to 15)
    • Node weights are loaded on every invokation, preventing overwriting of values with multiple Nuke instances
  • v1.5

    • Fixes crash-on-exit for Nuke 6.3v8 (as Nuke bug #23576 is closed)
    • Window now closes properly
  • v1.6

    • Code to add to menu.py more robust, so tabtabtab errors will never prevent Nuke from starting

    • Search string starting with space will disable the non-consecutive searching, so [tab][space]scen will create a Scene instead of a highly weight ScanlineRender

    • Exposes menu items in nuke.menu("Nuke") along with the nodes. Meaning items in the "File" menu etc are exposed, for example [tab]exit will be the same as "File > Exit"

  • v1.7

    • ToolSets/Delete submenu is excluded from tabtabtab. Github issue #6

    • Document that Ctrl+Tab opens the original tab menu

    • Fixed bug which caused the node list to stop updating

      Github issue #10

    • Fixed bug where "last used node" might have matched a different node (contrived example: the restored Blur [Filter] search text might have matched the more highly weighted Blur2 [Filter])

  • v1.8

    • Installation instructions updated to support Nuke 9

    • Weights file no longer overwritten if it fails to load for some reason. Github issue #13

    • Support PySide2

tabtabtab-nuke's People

Contributors

dbr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tabtabtab-nuke's Issues

Don't write weights file if existing file failed to load

If there is an error while loading tabtabtab_weights.json, currently the file will be reset to default {} when next used.

This means a temporary file-access glitch or hand-editing typo results in all weights being lost, which is annoying

Instead the weights should only be written if a) loading the file was successful, or b) the file did not exist previously

Arrow key looping

The up/down arrow keys don't cycle properly, should loop back to top/bottom

Mention ctrl+tab shortcut

Ctrl+tab can be used to access the original tab menu, even if tab is bound to tabtabtab

Should mention this in the readme

Nuke 6.3v8 crashes on exit

Nuke 6.3v8 (Windows 7) crashes on exit if the tabtabtab window is opened during the session (opening and immediately closing does not crash).

It appears to hang initially on closing, with mouse-over events still occurring, then trying to click on anything causes it to stop responding.

After some playing with the code, it appears to have to do with _tabtabtab_instance saving an instance of the widget. Commenting out line 518 (no longer keeping an instance of TabTabTabWidget) prevents it from crashing, and does not seem to degrade performance significantly.

tabtabtab should be added to "Node Graph" instead of "Nuke" menu

In Nuke 9, the "tab" shortcut overrides works as it probably should have always.. and appears even if you tab between parameters in a node's properties. This works better:

    import tabtabtab
    m_edit = nuke.menu("Node Graph")
    m_edit.addCommand("Tabtabtab", tabtabtab.main, "Tab")

Does not write weights

Line 181 currently says

        if self._successful_load:

I believe it should say

        if not self._successful_load:

Crash at certain strings?

Hi.
On Nuke7.0v8, I installed tabtabtab facility wide.
Works fine on Windows, but on the linux boxes, typing "cam" crashes nuke.
Any idea why that might be?
I'm looking into it but haven't found anything so far.

Remove Entries for Delete Options in ToolSets

For those of us using ToolSets as a ghetto way to access custom gizmos, it is a pain having the "Delete" commands for each toolset item listed in tabtabtab's command list. This often results in accidentally executing the delete command and having to cancel.

I dug into the source a little, and figured out a solution to remove these Delete commands from the list of commands that tabtabtab builds. If you insert this code on line 47 and tabtabtab will skip everything under the ToolSets/Delete/ path:

if "ToolSets/Delete" in subpath:
    # Remove all ToolSets delete commands
    continue

Can tabtabtabLeagacy be incorporated cleanly?

Dylan has made tabtabtab work in 6.2... I wonder if the compatibility layer be refactored into a separate tabtabtab_legacy module, which doesn't duplicate the contents - then people could do something like:

curl -O http://.../tabtabtab.py
curl -O http://.../tabtabtab_legacy.py

Then:

if nuke_version < 6.3:
    import tabtabtab_legacy as ttt
else:
    import tabtabtab as ttt
# ...

Weight-editing UI

It would be useful to easily reset or manually-set the weight for a specific node

Currently the only way is to edit ~/.nuke/tabtabtab_weights.json in a text-editor, which is fiddly.

Unable to find command for custom menu

Unable to find command for custom menu

menubar=nuke.toolbar("custom_tool")
m=menubar.addMenu("custom_tool", "nuke1.png")
tf = m.addMenu('Tran sform', icon='Transform.png')
tf.addCommand( "ConvertCornerP in", "convertCornerP in()", icon = "CornerPin.png" )

StopsMatching

My TabTabTab has stopped finding matches.

Hitting tab brings up a list of nodes sorted by weight with a text box, as usual, but typing in the text box does nothing.

Deleting the weight file does not resolve the issue.

Matching substrings, and window disappearing

Hey Ben,

Someone (Jon, maybe? Possibly Sean) mentioned TabTabTab to me at the Nuke 8 launch event last night, and I thought I'd check it out today.

I love the idea of sorting by the most added nodes - that's definitely useful.

One thing that may have been deliberate, but isn't quite intuitive to me, is that it will only slow matches that start with the same letter.

I reckon that you should be able to type "expr" and have it give you options of Expression, MergeExpression, ParticleExpression and DeepExpression

The other thing is (again, probably deliberate) is that I knocked the mouse and the pop-up disappeared. I would prefer it to act the same way as Nuke's built-in one and not disappear until something else is clicked, or a node is selected to be added.

What do you think of these?

unicode errors when creating a node

I started getting the below errors every time I create a node with tabtabtab.
Any ideas what might be causing this?

Traceback (most recent call last):
  File "/ohufx/pipeline/tools/nuke/python/tabtabtab.py", line 479, in update
    self.things_model.set_filter(text)
  File "/ohufx/pipeline/tools/nuke/python/tabtabtab.py", line 245, in set_filter
    self.update()
  File "/ohufx/pipeline/tools/nuke/python/tabtabtab.py", line 259, in update
    if nonconsec_find(filtertext, uiname.lower(), anchored=True):
  File "/ohufx/pipeline/tools/nuke/python/tabtabtab.py", line 126, in nonconsec_find
    if "".join(haystack).startswith(needle.lstrip(" ")):
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 38: ordinal not in range(128)

Improve weight saving/loading

Loading should be async, so the dialogue appears instantly even if the weight file takes some noticeable amount of time to appear

Also the weights should be loaded each time the dialogue is shown, so multiple Nuke instances don't overwrite

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.