Jump to content

simple if statement not working


logix1390

Recommended Posts

Hello,

I am trying to do a very simple if statement where I delete a point after a certain frame. I have a point, i put down a timeshift to get the frame I want to delete after, and then put a wrangle like this:

 if(@Frame<chi("FrameNumber")){
    removepoint(0,@ptnum);
}

 

What I thought this was  saying was "if the current frame number is greater than this value then delete the points coming from the first input ??

But this does not work . Can I anyone explain whats going on here?

I will attach my scene file for anyone that wants to take a look.

Thank you.

simple_if_statement_deleting.hip

Link to comment
Share on other sites

Not sure what you need the Timeshift node for, but if you dont reference it and instead type 21 in the FrameNumber parm on the wrangle, then all you have to do is reverse the comparison for it to work:

if(@Frame>chi("FrameNumber")){
    removepoint(0,@ptnum);
}

-b

Link to comment
Share on other sites

Hi Mike,

Change chi("FrameNumber") to chi("Frame_Number") or chi("frame_number") or chi("framenumber"). I presume that Houdini don't like when capital letter is in the middle of an attribute's name.

P.S.

Don't forget press button "Create spare parameter" when change the name of attribute

Edited by vicvvsh
Link to comment
Share on other sites

Camel case works...ie. FrameNumber is fine.

But your logic is screwed.

First, you have  

if(@Frame<chi("FrameNumber")){
    removepoint(0,@ptnum);
}

and you said "if the current frame number is greater than this value then delete the points coming from the first input ?? Well, no...if LESS than, then remove...so are you sure whatever logic is right here ?

Second, the timeshift is a moving target...ie. $F+20....so it's ALWAYS moving...you'll never hit it....(ie. whether you use greater than or less than, it'll always be true or false....but never hit a tipping point where it CHANGES true to false or false to true)

If you explicitly set in timeshift frame to say 20, then the tipping point will be at frame 20.

Link to comment
Share on other sites

Yes, may mistake. I have overlooked that in parameter "FrameNumber" there is an expression that refer to frameshift. In my case I just typed number manually when I examined your scene.  I'm sorry if I misled you.

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