few_a_fx Posted April 1, 2011 Share Posted April 1, 2011 Adding some new features to my fx tool. I'm using a trail and cache node now, and I want to be able to clear the cache SOP without going to the cache node and clicking clear. I've create a button for the "clear cache" parameter on my wxPython GUI, now I'm stuck on this. If anyone knows how to clear the cache sop through python that would be very helpful. Quote Link to comment Share on other sites More sharing options...
Emanuele Berti Posted April 1, 2011 Share Posted April 1, 2011 Hi, you could do this: node = hou.node( '/obj/geo1/cache1' ) #point at your cache node node.parm('clear').pressButton() #and call its onPressedButton function if you put these lines in a function, you can do a callback to this function from the button you have created in your UI Cheers, Emanuele Quote Link to comment Share on other sites More sharing options...
few_a_fx Posted April 1, 2011 Author Share Posted April 1, 2011 Hi, you could do this: node = hou.node( '/obj/geo1/cache1' ) #point at your cache node node.parm('clear').pressButton() #and call its onPressedButton function if you put these lines in a function, you can do a callback to this function from the button you have created in your UI Cheers, Emanuele For the onPressButton function, do I have to write a callback script for this to work? Quote Link to comment Share on other sites More sharing options...
graham Posted April 1, 2011 Share Posted April 1, 2011 No. The function call will execute any internally defined events, as well as callbacks you have added. Quote Link to comment Share on other sites More sharing options...
few_a_fx Posted April 1, 2011 Author Share Posted April 1, 2011 No. The function call will execute any internally defined events, as well as callbacks you have added. Then do I have to put anything in the .pressButton() parentheses? I just put those to strings in my code and nothing is happening when I click the button. Quote Link to comment Share on other sites More sharing options...
graham Posted April 1, 2011 Share Posted April 1, 2011 Nope. It should just execute the button and be happy. I just tested it out on a Cache SOP, as well as the Reset button on the Edit SOP and both worked as expected. Quote Link to comment Share on other sites More sharing options...
few_a_fx Posted April 1, 2011 Author Share Posted April 1, 2011 Nope. It should just execute the button and be happy. I just tested it out on a Cache SOP, as well as the Reset button on the Edit SOP and both worked as expected. I must be putting it in wrong then, because its only clear the cache when I press the button on the cache SOP and not on my python GUI. Here's the code I have. def clearCache(self, event): try: node = hou.node('/obj/Rain_System/TRAILING') #point at your cache node node.parm("clear").pressButton() #and call its onPressedButton function except: exc_log Here's the wxPython scripts for the GUI: def _add_trails(self): trails_sizer= wx.BoxSizer(wx.HORIZONTAL) self.flex_grid_sizer.Add(trails_sizer, flag= wx.ALIGN_CENTER_VERTICAL) self.trail_on= wx.CheckBox(self, label= "On/Off") trails_sizer.Add(self.trail_on, 0, flag= wx.ALIGN_CENTER_VERTICAL) self.trail_on.Bind(wx.EVT_CHECKBOX, self.TrailOn) self.clear_button= wx.Button(self, label= "Clear Cache") trails_sizer.Add(self.clear_button, 0, border= 10, flag= wx.LEFT|wx.ALIGN_CENTER_VERTICAL) self.clear_button.Bind(wx.EVT_BUTTON, self.clearCache) Quote Link to comment Share on other sites More sharing options...
few_a_fx Posted April 1, 2011 Author Share Posted April 1, 2011 Problem solved. Thanks guys for you help. Quote Link to comment Share on other sites More sharing options...
graham Posted April 1, 2011 Share Posted April 1, 2011 What was the problem? Quote Link to comment Share on other sites More sharing options...
few_a_fx Posted April 4, 2011 Author Share Posted April 4, 2011 Posting new thread in Artist section. It will be a link to my blog and vimeo page to demo the effects tool. 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.