Jump to content

Scripting Challenge: Using "dot" For Layout


Jason

Recommended Posts

Hi there,

I had a thought this morning (yes, in the shower) that Houdini has only one way of auto-arranging nodes. It's not very configurable, and in the case of VOPs, quite amazingly laughable (sorry SESI).

So, how about trying to find some fun ways of improving it? Enter the first Scripting Challenge on odforce.

There is freely available a package named "GraphViz" which will layout (and render) DAGs. This package is often installed on default Linux distro's and you can download it for Windows too. The executable is called "dot" and can output many formats, textual or image data.

The challenge is to create a script that sends the nodes defined for a network (all or only selected nodes) to dot to get it to create a node layout and then you parse the results and relocate the node positions in Houdini (using oplocate).

Points go to:

*/ is the code defensively written

*/ well commented

*/ cross-platform

*/ as simple as possible

*/ but supporting as many features of GraphViz as possible.

If you can use HScript to perform the entire thing then all the better, but you may use PERL, Java or Python.

Cheers!

Jason

LINKS: http://www.graphviz.org/

...

PS. Some other ideas were to somehow use the springs constraints with RBD Solver, the Wire Solver or the Cloth Solver to relax a solution to a node network. Also fun!

Link to comment
Share on other sites

heh heh heh...nice challenge!

PS. Some other ideas were to somehow use the springs constraints with RBD Solver, the Wire Solver or the Cloth Solver to relax a solution to a node network. Also fun!

maybe the Pelt tool would work here also....might be faster...

Link to comment
Share on other sites

Just a point on thinking in the shower.... Think fast your waisting water, but to do that I suggest using the mirror as a white board. It is good for nutting out the bigger ideas that need a little diagram.

That is if you can see it at the same time as having the shower, same goes for shaving i guess.

Link to comment
Share on other sites

Hi there,

I had a thought this morning (yes, in the shower) that Houdini has only one way of auto-arranging nodes. It's not very configurable, and in the case of VOPs, quite amazingly laughable (sorry SESI).

So, how about trying to find some fun ways of improving it? Enter the first Scripting Challenge on odforce.

I'll be the first to say that this is no easy task...I got so fed up with VOPs one day that I pulled the L key off my keyboard.

Before you jump into scripting take some time laying out the networks on how you want them to look. Then make rules for yourself as you do so.

Sounds like tons of fun....I'm game :)

Link to comment
Share on other sites

Sounds like a good idea Jason.  I'll poke around with it some as well.  I've only really used GraphViz with doxygen before, so I'm not very familiar with it.  Should be fun though! :)

Is using the HDK out of the question?...please say no. :P

~megalith

22318[/snapback]

I'm pretty sure anything is allowed...as long as you can get better results than what is in there now. :P

Link to comment
Share on other sites

I'm pretty sure anything is allowed...as long as you can get better results than what is in there now.  :P

22321[/snapback]

Hehe....yeah, I'm not going to the HDK yet as I want to do a few tests first to see how fast it's going to be. In this case, I don't see scripting being limiting at all, and you can probably do the whole thing in HScript...but I'm not positive about that yet.

Link to comment
Share on other sites

I'm pretty sure anything is allowed...as long as you can get better results than what is in there now.  :P

22321[/snapback]

Oh, sure - HDK is allowed indeed. If you use HDK then you may have opportunities to use other opensource 3rd party DAG libraries, if you can find them. "dot" is just one scriptable route that I know can work.

Just for anyone who thinks that this is too tricky, we've used dot before to layout production assets (with dependancies) here at DD for webpage perusal and its not as hard to do as you may think :P

Link to comment
Share on other sites

Oh, sure - HDK is allowed indeed. If you use HDK then you may have opportunities to use other opensource 3rd party DAG libraries, if you can find them. "dot" is just one scriptable route that I know can work.

Just for anyone who thinks that this is too tricky, we've used dot before to layout production assets (with dependancies) here at DD for webpage perusal and its not as hard to do as you may think :P

22325[/snapback]

At the moment, I'm just concerned about the speed of using hscript or some scripting language. If anyone finds another 3rd party library for this type of thing please let us know (I'd be interested anyway), but GraphViz will definitely do everything we need.

Doing a few tests right now, so I should know really soon if it's fast enough.

Link to comment
Share on other sites

At the moment, I'm just concerned about the speed of using hscript or some scripting language.  If anyone finds another 3rd party library for this type of thing please let us know (I'd be interested anyway), but GraphViz will definitely do everything we need.

Speed is not really one of the goals of this Challenge because I seriously doubt any of the speed bottleneck will be the scripting portion. GraphViz does slowdown a bit when you have many dependancies but you do have controls over how thoroughly it searches for a solution. GraphViz itself would definitely be the slowest part of the process by a long way.

Link to comment
Share on other sites

Speed is not really one of the goals of this Challenge because I seriously doubt any of the speed bottleneck will be the scripting portion. GraphViz does slowdown a bit when you have many dependancies but you do have controls over how thoroughly it searches for a solution. GraphViz itself would definitely be the slowest part of the process by a long way.

22328[/snapback]

Yeah, you're right. I just made a simple script that parses the operators, passes it to dot, reads in the new data and sends it back to Houdini...not really that slow at all. I do need some more involved networks, though. Anyone have anything insanely complex that I can test it with? :P

I know it may not be necessary to make a plugin, but it still might be worth considering. Something really integrated into the Houdini workflow so that organizing your networks isn't such a pain.

Link to comment
Share on other sites

Yay! It's working! :D It's a Python script at the moment, so the next step is to add error handling, documentation, and then consider moving it to pure HScript (which would kindof suck) or to HDK. Would be cool if there were some sort of interface that gave the user access to some of the power of GraphViz...hm...

Link to comment
Share on other sites

Yay!  It's working! :D

Excellent work! Binding it to an F-key is one option and hopefully the process would be totally invisible to the end user.

It should be as easy to use as "source graphVizLayout.cmd /obj" where it'll layout selected or all nodes in that network.

Feel free to port it to hscript or HDK if you wish.

:ph34r::ph34r:

Link to comment
Share on other sites

Good luck in porting to Hscript.. not a fun process. A nice thing to do would come up with some basic hscript expressions that are missing (mostly missing a lot of string parsing), write them in the HDK and make them available. I think extending hscript just a little will go a long way in simplifying scripts in the future

d

Link to comment
Share on other sites

Good luck in porting to Hscript.. not a fun process.  A nice thing to do would come up with some basic hscript expressions that are missing (mostly missing a lot of string parsing), write them in the HDK and make them available.  I think extending hscript just a little will go a long way in simplifying scripts in the future

d

22348[/snapback]

Totally agree with that. Don't want to diverge too far from the original challenge, but if this is something more people are interested in, I think we should make another challenge or something to promote that effort.

Using just HScript does indeed suck for this as there is a lot of string parsing, so I'm going to implement it with the HDK next. In the meantime, if anyone wants, I'll post the Python script.

~megalith

Link to comment
Share on other sites

Good luck in porting to Hscript.. not a fun process.

All I can say is thank goodness SESI introduced a strreplace() function. This and arg() are the only functions that make this a little more pleasant than eating fibreglass. Although I'd love a more complex regex (grep) and regsub myself. Oh, and file access that's not a set poo=`system("cat thatfile.txt")` methodology ;)

Link to comment
Share on other sites

All I can say is thank goodness SESI introduced a strreplace() function. This and arg() are the only functions that make this a little more pleasant than eating fibreglass. Although I'd love a more complex regex (grep) and regsub myself. Oh, and file access that's not a set poo=`system("cat thatfile.txt")` methodology  ;)

22359[/snapback]

Alright, the HDK version is working!! It's at where the script was, but since now I have access to the width and height of each node, I have a few more tweaks to make. GraphViz defaults to having a huge separation between nodes, since it works with much larger node sizes by default, so there's quite a bit to change it seems. Almost there! :)

~megalith

Link to comment
Share on other sites

Alright, the HDK version is working!!  It's at where the script was, but since now I have access to the width and height of each node, I have a few more tweaks to make.  GraphViz defaults to having a huge separation between nodes, since it works with much larger node sizes by default, so there's quite a bit to change it seems.  Almost there! :)

~megalith

22365[/snapback]

Way to go! :) Keen to see it!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...