is this really a stupid question? display flag problem

   8611   15   1
User Avatar
Member
512 posts
Joined: July 2009
Offline
hey guys,

i searched for this quite a lot but without results -
is it possible to automatically set the display flag to the latest created node?

regards,

Manuel
http://vimeo.com/user2522760 [vimeo.com]
http://stormbornvfx.com/ [stormbornvfx.com]
Manuel Tausch
User Avatar
Member
1908 posts
Joined: Nov. 2006
Offline
When you perform operations using the viewport/shelf it pretty much always sets the display flag on the latest node. However, if you want it to ALWAYS happen I'd probably just add a global OnCreated script that always sets the display flag when a node is created. This of course has the downside of if you just put down a random Sop for example and don't want to connect it to anything, or you are trying to insert one into a chain, or branch off of one you probably don't want to be changing the flag but I guess it's up to how you want to run things.

Something like this would work
OnCreated.py in $HOME/houdiniX.Y/scripts/

node = kwargs
if hasattr(node, “setDisplayFlag”):
node.setDisplayFlag(True)
if hasattr(node, “setRenderFlag”):
node.setRenderFlag(True)
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
512 posts
Joined: July 2009
Offline
thing is, i hardly create the nodes via viewport or the shelf, mostly directly in my networkview with the tab key. that's a very fast way to work, the only thing that bothers me is to permanently have to switch the display flag >.<

Doing it with a script brings exactly the problems you mentioned so i'd rather leave it as it is … ?!
http://vimeo.com/user2522760 [vimeo.com]
http://stormbornvfx.com/ [stormbornvfx.com]
Manuel Tausch
User Avatar
Member
1908 posts
Joined: Nov. 2006
Offline
After thinking about it further and knowing exactly what it is you are going for I'd do it with an OnInputChanged script that basically looks at the first input node, if it exists, and if that node has the display and/or render flags set then it sets them on the node.

OnInputChanged.py

node = kwargs
idx = int(kwargs)

# Only care about the first input.
if idx is 0:
# Get the node connector for input 1.
connector = node.inputConnectors()
# If there is a connection.
if len(connector) > 0:
connection = connector
# Get the connected node.
input_node = connection.inputNode()

# Guard against node types that don't use these flags.
if hasattr(node, “setDisplayFlag”):
if input_node.isDisplayFlagSet():
node.setDisplayFlag(True)
if hasattr(node, “setRenderFlag”):
if input_node.isRenderFlagSet():
node.setRenderFlag(True)
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
512 posts
Joined: July 2009
Offline
thanks a lot, i'll give it a try tomorrow!
i believe it'll be a little rough since i've never done VEX scripting before, but let's see if i can get a little introduction somewhere …

i'll give you an update on my efforts,

have a good time
http://vimeo.com/user2522760 [vimeo.com]
http://stormbornvfx.com/ [stormbornvfx.com]
Manuel Tausch
User Avatar
Member
512 posts
Joined: July 2009
Offline
actually i'm a bit lost. I have no idea where to implement this script to get it working. A friend of mine told me this is python, right?
http://vimeo.com/user2522760 [vimeo.com]
http://stormbornvfx.com/ [stormbornvfx.com]
Manuel Tausch
User Avatar
Member
1908 posts
Joined: Nov. 2006
Offline
Yeah it's Python. Put the code in a file called OnInputChanged.py and place that file in your $HOME/houdiniX.X/scripts directory.
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
512 posts
Joined: July 2009
Offline
this is very strange!
There is neither a folder called “scipts” in my houdini directory nor is there a file called OnInputChanged.py to be found on my computer :?

is it because i have installed the apprentice version?

Attachments:
houdini folder.jpg (107.4 KB)

http://vimeo.com/user2522760 [vimeo.com]
http://stormbornvfx.com/ [stormbornvfx.com]
Manuel Tausch
User Avatar
Member
1908 posts
Joined: Nov. 2006
Offline
While you can put the file in your Houdini install directory, $HFS/houdini/scripts/, you should put it in your Houdini config directory, which on Windows will be something like My Documents/houdini10.0/scripts/. By default the OnInputChanged.py file doesn't exist already, and you probably won't have a scripts directory either so you'll have to create them both.
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
512 posts
Joined: July 2009
Offline
okay, i make progress

now the scipt gets called, but the console gives me a syntax error:

File “CDOCUME~1/ADMINI~1/MYDOCU~1/houdini10.0/scripts/OnInputChanged.py”, line 1
node = kwargs

^
SyntaxError: invalid syntax
http://vimeo.com/user2522760 [vimeo.com]
http://stormbornvfx.com/ [stormbornvfx.com]
Manuel Tausch
User Avatar
Member
1908 posts
Joined: Nov. 2006
Offline
I'm not sure what the problem is now. Most likely some weird extra hidden characters or something I'm guessing. I've attached my script which hopefully works.

Attachments:
OnInputChanged.zip (568 bytes)

Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
512 posts
Joined: July 2009
Offline
okay at least i got the script running now, unfortunately it's not 100% working,
it has problems with some nodes (i.e. the pointsfromvolume SOP).

Gives me the following error:

Traceback (most recent call last):
File “CDOCUME~1/ADMINI~1/MYDOCU~1/houdini10.0/scripts/OnInputChanged.py”, line 27, in <module>
node.setDisplayFlag(True)
File “Ehoudini/HOUDIN~1.430/houdini/scripts/python\hou.py”, line 21090, in setDisplayFlag
return _hou.SopNode_setDisplayFlag(*args)
PermissionError: Failed to modify node or parameter because of a permission error. Possible causes include locked assets, takes, product permissions or user specified permissions

Traceback (most recent call last):
File “CDOCUME~1/ADMINI~1/MYDOCU~1/houdini10.0/scripts/OnInputChanged.py”, line 27, in <module>
node.setDisplayFlag(True)
File “Ehoudini/HOUDIN~1.430/houdini/scripts/python\hou.py”, line 21090, in setDisplayFlag
return _hou.SopNode_setDisplayFlag(*args)
PermissionError: Failed to modify node or parameter because of a permission error. Possible causes include locked assets, takes, product permissions or user specified permissions

http://vimeo.com/user2522760 [vimeo.com]
http://stormbornvfx.com/ [stormbornvfx.com]
Manuel Tausch
User Avatar
Member
1908 posts
Joined: Nov. 2006
Offline
Sorry about that. I didn't test it with a digital asset.

In the case of assets and their indirect inputs, when the parent nodes input changes, it propagates down to the nodes inside that asset that look to that parent input for their input. In this case Houdini is attempting to change the flag on the first node in the asset but it is locked. I've updated the script to make sure the node isn't inside a locked digital asset.

Attachments:
OnInputChanged.zip (688 bytes)

Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
512 posts
Joined: July 2009
Offline
great, many thanks!
Now it workes flawlessly and makes creating nodes inside the network view a lot more easier for me! Maybe one day i'll dare to have a look at scripting stuff, too! for the moment i'm quite happy that i got comfortable with expressions
I'm excited about your website, when are you going to relaunch it?
http://vimeo.com/user2522760 [vimeo.com]
http://stormbornvfx.com/ [stormbornvfx.com]
Manuel Tausch
User Avatar
Member
130 posts
Joined: April 2009
Offline
Hmmm… and I'd suggest yet another approach, if you use network pane to add nodes:
Add a NULL to the end of your network, and move it a way down, to leave plenty of space above it. Set the display/render to the above NULL.

Set selection to any earlier node (the point where you are working). From now on, you should be able to add new nodes, the selection should move on automatically, while the display should stay at the ending NULL.

One other thing you might want to configure with this approach is the display settings in the 3d viewer (“d” key") - you can e.g. set current/selected to wireframe, so that the selected node generates only a wireframe view, while the shaded/flat/your preferred view stays on the final NULL. This is, as far as I've learned, the only way to work efficiently with subdivided polygons - viewing the subdivided, smooth result, while being able to manipulate the undivided polys/edges/verts.

Cheers,
Greg
User Avatar
Member
512 posts
Joined: July 2009
Offline
thanks for that tip, but i already had a similar workflow and i find grahams script method more convenient.

regards,

Manuel
http://vimeo.com/user2522760 [vimeo.com]
http://stormbornvfx.com/ [stormbornvfx.com]
Manuel Tausch
  • Quick Links