Jump to content

Automatically creating controls with a multiparm block


Recommended Posts

Hi,

I have been trying to use a multiparm block to automatically create controls for a number of elements. I use the expression npoints("../") to get the amount of elements that I need controls for. When reopening the scene afterwards the attributecreate node that reads values from the multiparm block gives a warning that there is a bad parameter reference even though the parameter does exist.

A temporary solution that seems to work is to toggle the cache input box of the null node that the multiparm block is in. Unfortunately this breaks copy nodes all over the place. The node will still copy but the stamp functions are broken so any stamp expression defaults to the 0 value.

How can I solve this or how should I go about making an interface that creates controls for a changing amount of elements?

Thanks.

Link to comment
Share on other sites

what do you expect npoints("../") to do?

I don't know where you are using it but I can imagine that it's pretty recursive, because it seems like calling this function from inside of some SOP (sopnet?, foreach?, ...?) and trying to get it's number of points but because you are inside you are probably changing geometry of that sop and therefore creating an infinite loop, or not?

use npoints(opinputpath(".", 0)) to get npoints of the first input of current node

or npoints (opinputpath("..", 0)) to get npoints of the first input of parent node

maybe better post a scene with the problem or simplified version of it, otherwise it would be just guessing

Edited by anim
Link to comment
Share on other sites

Sorry, I was unclear about the expression, it's a npoints() expressions that references a null node in an earlier network. I wasn't giving the actual expression. It could be an infinite loop but I dont understand how this only happens after reopening the scene. The operation that determines how many elements exist should always happen first. No information that is created in the multiparm block is being used before it. This simplified scene gives a startup error that my main scene doesn't but it is related to the issue I'm having. The null1 node contains the multiparm block.

simplifiedVersion.hipnc

Edited by Robert
Link to comment
Share on other sites

I'm not sure what it hates about npoints() since plain ch("../line4/points") works even after reopening without errors

but if you need to sample number of points python seems to work as well

len(hou.node("../line4").geometry().points())[/CODE]

Link to comment
Share on other sites

It seems to hate any expression at all. Ch("../line4/points") probably works because its a reference and not an expression. The python code works to get the amount of points and it doesn't give an error on startup but now the recursive nature of the setup comes into play. Updating the amount of points updates the multiparm block interface but the values aren't used. To make any new elements that were copied on the new points visible the cache input of the null node has to be toggled again (I still don't know what this does but it seems to work).

Am I approaching this type of control in a completely wrong way?

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...