I'm trying to simply display a hou.SimpleDrawable in an otherwise empty asset on SOP level, basicly following the documentation example here [www.sidefx.com].
So all I have is this code in the Viewer State of an asset with a Null inside labeled "GET_INPUT" connected to the first input and nothing connected to the output.
class State(object): def __init__(self, state_name, scene_viewer): self.state_name = state_name self.scene_viewer = scene_viewer def onDraw(self, kwargs): """ Called for rendering a state e.g. required for hou.AdvancedDrawable objects """ draw_handle = kwargs["draw_handle"] geo = kwargs["node"].node("GET_INPUT").geometry() drawable = hou.SimpleDrawable(self.scene_viewer, geo, "drawable") drawable.setDisplayMode(hou.drawableDisplayMode.WireframeMode) drawable.setWireframeColor(hou.Color(1.0,0.0,0.0)) drawable.enable(True) drawable.show(True) def createViewerStateTemplate(): """ Mandatory entry point to create and return the viewer state template to register. """ state_typename = kwargs["type"].definition().sections()["DefaultState"].contents() state_label = "SimpleDrawable test" state_cat = hou.sopNodeTypeCategory() template = hou.ViewerStateTemplate(state_typename, state_label, state_cat) template.bindFactory(State) template.bindIcon(kwargs["type"].icon()) return template
I would expect to see the geometry connected to the first input of the asset to be displayed as a wireframe when I select the node and press enter in the viewport, but nothing shows up.
Could someone shed some light on what else I need to be doing with the SimpleDrawable to display correctly?