quentin king
quentinsking
About Me
tech artist at torn banner studios
EXPERTISE
Gamedev
Houdini Skills
Availability
Not Specified
Recent Forum Posts
Changing StrokeCursor geometry in python viewer states March 5, 2024, 7:30 p.m.
Thanks for the reply!
Unfortunately even in that case I don't see the wireframe changing. (In fact I can't find any event / scenario where self.cursor.brush.setWireframeColor() works)
I set up a simple example that doesn't seem to work:
I can see that my menu actions get triggered, but the wireframe or brush geometry never updates. From my experience it seems like after the brushlist is initialized, there's no way to change the underlying geometry it's using. I've had some success by clearing out the brushlist, and calling init_brushlist with new attributes and then calling self.cursor.select(0), but I don't really want to be recreating everything all the time, and even then I still have some issues where the viewport won't update until the next mouse event even after calling draw() in the scene viewer.
I'm leaning more to just ditching this idea and using default cursors since I've already spent more effort than I care for on this lol. Just wanted to raise it in case there's an underlying bug here or that I'm just getting something wrong with viewer states (which is also totally possible LOL)
Unfortunately even in that case I don't see the wireframe changing. (In fact I can't find any event / scenario where self.cursor.brush.setWireframeColor() works)
I set up a simple example that doesn't seem to work:
class State(StrokeState): def __init__(self, **kwargs): super(State, self).__init__(**kwargs) self.cursor.brushes = [] self.cursor.init_brushlist([('sphere', {}), ('tube', {})]) def onMenuAction(self, kwargs): super().onMenuAction(kwargs) self.log("onMenuAction") self.cursor.brush.setWireframeColor(hou.Color(0.0, 0.0, 1.0)) self.cursor.show() self.cursor.brush.show(True)
I can see that my menu actions get triggered, but the wireframe or brush geometry never updates. From my experience it seems like after the brushlist is initialized, there's no way to change the underlying geometry it's using. I've had some success by clearing out the brushlist, and calling init_brushlist with new attributes and then calling self.cursor.select(0), but I don't really want to be recreating everything all the time, and even then I still have some issues where the viewport won't update until the next mouse event even after calling draw() in the scene viewer.
I'm leaning more to just ditching this idea and using default cursors since I've already spent more effort than I care for on this lol. Just wanted to raise it in case there's an underlying bug here or that I'm just getting something wrong with viewer states (which is also totally possible LOL)
Changing StrokeCursor geometry in python viewer states March 5, 2024, 12:23 a.m.
Hello! I've just started dabbling in Python viewer states for some custom tools but I've run into a roadblock with a feature I want to get in although I'm unable to do so, which makes me feel like I am missing something?
I writing a custom StrokeState viewer state however I want to change the color of the cursor geometry to the current value the user is painting, instead of the default red. I'm able to change the StrokeCursor.COLOR value in the __init__ of my viewer state before I call self.cursor.init_brushlist which sets the color correctly however I can't seem to change it dynamically?
I've set up a callback to be notified when my stroke parameter changes with
but I can't seem to change anything in the cursor's brush list and have it reflected in the viewport? I get that the brush list is an array of SimpleDrawables with read only geometry. So I've tried reconstructing new geometry the same way StrokeCursor::init_brushlist does, however calling setGeometry() on the brush doesn't seem to do anything. I've also tried enabling / disabling the brush and telling the viewport to draw although those didn't seem to have an effect either.
Is there something I am missing after setting the new geometry? Do I need to tell something to cook somewhere? I'm a little confused on where these SimpleDrawable geometries actually "live" since there is no sop node associated with them.
I writing a custom StrokeState viewer state however I want to change the color of the cursor geometry to the current value the user is painting, instead of the default red. I'm able to change the StrokeCursor.COLOR value in the __init__ of my viewer state before I call self.cursor.init_brushlist which sets the color correctly however I can't seem to change it dynamically?
I've set up a callback to be notified when my stroke parameter changes with
node.addEventCallback([hou.nodeEventType.ParmTupleChanged], self.onParmChanged)
but I can't seem to change anything in the cursor's brush list and have it reflected in the viewport? I get that the brush list is an array of SimpleDrawables with read only geometry. So I've tried reconstructing new geometry the same way StrokeCursor::init_brushlist does, however calling setGeometry() on the brush doesn't seem to do anything. I've also tried enabling / disabling the brush and telling the viewport to draw although those didn't seem to have an effect either.
Is there something I am missing after setting the new geometry? Do I need to tell something to cook somewhere? I'm a little confused on where these SimpleDrawable geometries actually "live" since there is no sop node associated with them.
Vertex Colour Oct. 16, 2023, 4:39 p.m.
I don't even know what's up with the disc generator tool in the labs toolset right now, there's two versions of it on the github page:
https://github.com/sideeffects/SideFXLabs/tree/Development/otls/disc_generator.1.0.hda [github.com]
https://github.com/sideeffects/SideFXLabs/tree/Development/otls/disc_generator.hda [github.com]
But the one that loads by default seems to have fewer features since the vertex color is missing.
I dunno if there is an easier way to switch between them but you can just get rid of the current definition. Go to wherever the SideFxLabs is installed on your machine and in the SideFXLabs-Development\otls folder, delete / move the disc_generator.1.0.hda folder. Assuming you have the previous version in there (the disc_generator.hda folder), close and relaunch houdini and it should use that version of the tool which includes the vertex color and whatnot, I assume that's the one your course is using.
PS: Best of luck in your vfx course! : )
https://github.com/sideeffects/SideFXLabs/tree/Development/otls/disc_generator.1.0.hda [github.com]
https://github.com/sideeffects/SideFXLabs/tree/Development/otls/disc_generator.hda [github.com]
But the one that loads by default seems to have fewer features since the vertex color is missing.
I dunno if there is an easier way to switch between them but you can just get rid of the current definition. Go to wherever the SideFxLabs is installed on your machine and in the SideFXLabs-Development\otls folder, delete / move the disc_generator.1.0.hda folder. Assuming you have the previous version in there (the disc_generator.hda folder), close and relaunch houdini and it should use that version of the tool which includes the vertex color and whatnot, I assume that's the one your course is using.
PS: Best of luck in your vfx course! : )