Krion Posted July 5, 2021 Share Posted July 5, 2021 Hi, I am copying attributes by looping over the attributes. Unfortunetely this doesn't work: string detailattribs[] = detailintrinsic(1,"detailattributes"); foreach(string detailattrib; detailattribs){ setdetailattrib(0, detailattrib, detail(1, detailattrib, 0), "set"); } So I have to specify the type like this: string detailattribs[] = detailintrinsic(1,"detailattributes"); foreach(string detailattrib; detailattribs){ int type = detailattribtype(1, detailattrib); if(type==1){ float val = detail(1, detailattrib, 0); setdetailattrib(0, detailattrib, val, "set"); } if(type==0){ int val = detail(1, detailattrib, 0); setdetailattrib(0, detailattrib, val, "set"); } } The weird thing about the attribtype() function is that it uses one value for "Float or vector". I do only have floats and ints right now, but I'm still wondering: what if you want to do this for a vector? Another sidequestion would be, is there a better way to do this? Thanks, kind regards, Quote Link to comment Share on other sites More sharing options...
animatrix Posted July 6, 2021 Share Posted July 6, 2021 Hi, To filter it further you have to use attribsize(): https://www.sidefx.com/docs/houdini/vex/functions/attribsize.html Returns The size of an attribute’s type. For a vector type, this is the number of components. For an integer, float, or string, this returns 1. For an array attribute, this returns the size of the tuples in the array. The tuple size is controlled by the Size parameter on the Attribute Create node. The best way to copy attributes is by using the Attribute Copy SOP, it's much faster also. 1 Quote Link to comment Share on other sites More sharing options...
Krion Posted July 6, 2021 Author Share Posted July 6, 2021 (edited) Thanks Yunus, I somehow didn't expect the Attribute Copy SOP to be able to handle wildcards... but it does handle them. I wonder how my brain works sometimes. Anyway good to know about the attribsize() function. Thanks! Edited July 6, 2021 by Krion Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.