Kino Posted February 13, 2016 Share Posted February 13, 2016 Hey everyone,This is my first post here in the forums so a noob warning beforehand. As the topic of my post says I'd like to delete point attributes programmatically. As far as I understand I may have three methods for this:1- VEX : unfortunately there doesn't seem to be a removeattrib (or something similar) . This would be my preferred way because I'm doing other stuff in Vex and I'd like to stay there.2- AttribDelete SOP: This does the job of deleting attribs but doesn't seem to accept expressions (or I'm totally doing something wrong!) 3- Python SOP : If I find the point attrib first and then use the destroy() method but it looks like with Python there is no access to array attribs (or was this limitation with H14? or maybe without knowing the right type it still can delete the attribs?)For making stuff easy, in my vex code I'm generating a detail attribute called "mTagsToDelete" which is a string but I can not understand how can I use this? The string attribute is in the format of "mAttribute* mOtherAttrib*" (I put the "*" since AttribDelete SOP accepts wildcards).Thanks a lot Quote Link to comment Share on other sites More sharing options...
Atom Posted February 13, 2016 Share Posted February 13, 2016 (edited) What expression are you trying to use? As you have discovered, "*" will delete all but you can exclude specific items using the caret character. * ^keep_this_attribute Typically just copy the geometry up stream of the attribute creates and then add in only the ones you need. You can also use a python node outside the network you are trying to affect to programmatically set parameters on a node, such as the delete point attributes parameter of an attribute delete. n = hou.node('/obj/geo1/attribdelete1') p = n.parm("ptdel") #I discovered this parm name from tooltip. p.set("* ^exclude_this_one") Edited February 13, 2016 by Atom Quote Link to comment Share on other sites More sharing options...
Kino Posted February 13, 2016 Author Share Posted February 13, 2016 Brilliant! Cheers Atom for your helpful answer!Didn't know about the caret character. Still this is something manual, right? Can I write an expression in that param field of attribdelete (maybe the python code you mentioned)? something like (backticks cause it's text) ?: 'detail("myself", "mTagsToDelete", 0)' // mTagsToDelete is a string attribute on detail If not then the second option you suggested is the way to go. Is there a specific reason you said that the node should be outside of the network, can't I do?: n = hou.node('../attribdelete1') A bit irrelevant question but now that I have your attention: Is there support for array attribs in python in H15?I appreciate your help mate, this has been a welcoming first post for me Quote Link to comment Share on other sites More sharing options...
Atom Posted February 13, 2016 Share Posted February 13, 2016 (edited) The expression language defaults to Hscript, thus that H symbol in the upper right corner of the properties panel. Click the H to switch that to Python, then use a single line of python code as an expression. Back ticks are not the same as single quote make sure to use them instead of single quote. (SHIFT~). Is there a specific reason you said that the node should be outside of the network, can't I do? Python cannot reliably change the parameters on other nodes in the network it resides within, a limitation at this time. But you can place a Python node outside of a geo node and reliably make changes to the interior of that node as long as your node pathing correctly targets the nodes inside. I don't think arrays of attributes on a single point are supported but there is no reason why you can't just create 10 points and think of them as an array. Edited February 13, 2016 by Atom Quote Link to comment Share on other sites More sharing options...
Kino Posted February 13, 2016 Author Share Posted February 13, 2016 (edited) Thanks to you I managed to get the parameter expression work, so no need for the python SOP for now but will remember what you said about python and networks.EDIT : in both cased of HScript and Python, I had to refer to the previous node to get the detail attrib. Couldn't use "." for either Edited February 13, 2016 by Kino 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.