fs_reddog
June 25, 2025 18:32:36
I have a primitive attribute which is created by promoting a point attribute to primitive. It's an integer, and contains a bunch of values. I want to add 500 to every one of them, but whatever wrangle I use the attribute values do not change. I get no error, the values just do not change.
I've tried a detail wrangle with an iteration through each primitive, I've tried a primitive wrangle with setprimattrib as well as just directly referencing it as i@abc123=+500. Obviously the wrangles are below the promote node, and are wired up to it.
Nothing works. I am really stumped by this, what should be ridiculously simple thing to do has already swallowed multiple hours of trial and error and chatgpt.
What am I missing?
ifree
June 25, 2025 20:11:43
Why don't you just attach the hip file?
Meanwhile, you should use expression i@abc123 += 500 instead of i@abc123=+500.
raincole
June 25, 2025 22:43:11
multiple hours of trial and error and chatgpt.
You've spent multiple hours on this and didn't bother taking 2 more minutes to make an example .hip or at least screenshot...
eikonoklastes
June 26, 2025 03:09:19
I'd recommend (for now, at least) save the time you spend on ChatGPT (or any AI assistant) and put that time into learning Houdini fundamentals. The AI assistants are extremely error-prone right now and will confidently spit out outright wrong answers.
For your issue, you can use an Attribute Adjust Integer node, which makes your task very easy, and you do not have to deal with VEX syntax if you're not comfortable with that.
fs_reddog
June 26, 2025 07:10:55
Turns out that this was all caused by the attribute being a string, not an integer. I would have thought Houdini could have signalled this issue to me in a clearer way, but I now know better and have learned to look at the info tab even when an error is NOT being thrown, as it would have been much quicker to resolve.
While I've solved the issue, is there a way to change an attribute type permanently, my method at the moment is a bit clunky (create another attribute of integer type, convert the value using atoi and then delete the original attribute.)
Tanto
June 26, 2025 16:34:38
fs_reddog
While I've solved the issue, is there a way to change an attribute type permanently, my method at the moment is a bit clunky (create another attribute of integer type, convert the value using atoi and then delete the original attribute.)
I believe this is the only way. You can do all of this in your primitive wrangle, though, but only if you change the attribute's name:
i@xyz321 = atoi(s@abc123) + 500;
removeattrib(0, 'prim', 'abc123');
tamte
June 26, 2025 16:56:37
still a bit hacky, but if you use addpointattrib() it will replace the attribnute with new type so you technically dont have to change the name
addpointattrib( 0, "abc123", 0 );
setpointattrib( 0, "abc123", @ptnum, atoi( s@abc123 ) );
ifree
June 26, 2025 21:31:56
I wonder why an integer-like attribute is created as a string attribute.
You'd better examine the process of creating the attribute.
You may have erroneously used chs() function.