Viewer-Node Control Script

by - 2012/10/09 15 Comments Production

Here’s a short demo of one of the scripts that you can find on the DVD in the Mango SVN scripts folder. It’s called space_node_viewer_bookmark.py.


It’s a small utility to make navigating huge node-trees a bit easier, and we had a lot of those.
All the time while I was working with these huge node setups I thought that I would love to be able to define certain checkpoints in the node-tree to be able to quickly connect the viewer node to them to check out the result without having to zoom and scroll like crazy. Also jumping to the last node or comparing the result before and after some nodes was something that I always wanted to have.

But I always thought it would be super hard and complicated to do, involving some advanced C coding etc. But one day I asked Campbell what he thought about that and he said “No, that wouldn’t be hard at all! In fact, it’s probably just a few lines of python”.
Well, that was quite some motivation for me to seriously try to learn python.

So Campbell gave me a few hints and showed me how to approach the problem. It took me quite a few days and a lot more hints from the awesome and always helpful Campbell, but eventually I had it working. Yay!

So what it does is to define a list of bookmarks (or slots/tags whatever you want to call it), that get assigned with a hotkey (e.g. Shift+O) as a property to a node. You can then “call” that bookmark with a second hotkey (e.g. “O”) and that will connect the viewer node and center the view there. I made 3 different keys, U, I and O for 3 different “checkpoint nodes”. They also have different colors so that you can tell them apart. The colors are also used to re-assign the tags on load, because the “tag-property” does not get saved. So Blender uses the colors to determine and re-assign the tags to the node, so that when you open up a blendfile that had these tags they will still work.
You can also clear the bookmarks with alt+b.

 

There are 4 more hotkeys, 2 quite useful, 2 maybe not so much. With the keys J and K you can go to the leftest or lowest node in the tree. Might be helpful to quickly center the view to different areas. The other 2 keys are L and P. These do not center the view to that node, only connect the viewer node to the last node before viewer and composite (L-Key) or the previous node (P-Key), and I found that quite handy.
It’s one of my first own scripts that I wrote, so it’s probably not perfect. So if you know python and want to change all this, just do it!
But that’s the cool thing, because Blender is open source you can really hack in your own stuff into Blender. That’s so awesome, and a great motiviation for me to try to learn more python.

And for those of you who are (like me)  intimidated of python or code: Personally, I am really an idiot when it comes to math and code etc, so if I can manage to write at least do a few lines of code, then you can do too!

:)

And most importantly, if anyone of you who are better in code than me thinks he can do this better or improve the script, by all means, go ahead! I think there is a lot more stuff that can be improved!

There are many more scripts and addons like this on the Tears of Steel DVD that you can check out and use.
So! –> http://www.blender3d.org/e-shop/product_info_n.php?products_id=143

  1. Greg Zaal says:

    I wonder what quick_sanity.py does :D

  2. As a 30+ years SW developer I have to say: writing coding is not hard.

    What is always the hard part is to get the knowledge/documentation against what you have to code.

    And that is always the time consuming part :)

  3. FZ says:

    Hey when will the soundtrack been released?
    Really waiting to hear the hole tracks :D

    Thanks!

  4. n-pigeon says:

    Why those addons are not in official release of Blender?

    • LswaN says:

      Could be a few reasons, first off the addons have only been used for this one project and may have unknown bugs, also some of them may just be quick-fix scripts that wouldn’t be useful for most people. They might also be planned as full features coded into Blender, to be released later. Or maybe they will be added into official Blender releases after people have had time to test the scripts out.
      Just my thoughts, I could be completely wrong about this too.

  5. blendercomp says:

    Wicked cool! :)

  6. LswaN says:

    “Just a few lines of python,” huh? Looks like over four hundred lines to me :)
    Obviously there was quite a bit of thought and work put into this, looking forward to trying it when the DVD ships!

  7. Rob Fisher says:

    It looks the problem (that this script goes some way to solving) is that you have a large number of GUI elements spread over an area much wider than will fit on the screen. I’m wondering if it might be more productive to work with a textual representation of the same information, in some sort of declarative language. This is how programmers work most of the time and text editors have evolved to make navigating large amounts of code very efficient. Is there an underlying textual representation of the nodes in Blender that is human readable? Do people edit it directly?

    On the other hand I can see the benefit of being able to visualise curves and see colours and connections. Maybe some kind of text/GUI hybrid could be developed.

    • Psy-Fi says:

      Believe me you don’t want to go where the coders are, it’s not as efficient as you make it out to be.

  8. 3pointedit says:

    Yeah, just a few lines. A few HUNDRED. Great work though, terrific to see an artist be able to implement the tool they require.

  9. Carsten says:

    Nobody typed it in so far from the video? ;-)

    Great work guys!

  10. NFP Digital says:

    you have some interesting names for scripts

  11. jan the freeze says:

    When will you send out the DVD’s?

  12. can’t wait the DVD

  13. Tae says:

    When will you avoid the spam comments? Apart from the 15 other Python scripts . . . there is a smart quotes filter.