Gerardo Castellanos

Gerardo Castellanos

About Me

EXPERTISE
Generalist
INDUSTRY
Film/TV

Connect

LOCATION
Spain

Houdini Skills

Availability

Not Specified

Recent Forum Posts

python states and setAttribValue Sept. 23, 2024, 3:32 a.m.

ohh yep.. my bad, sorry... but even with the setAttribVale()... it says:

hou.GeometryPermissionError: Geometry is read-only.

as I said, I am running this script from a a Python HDA states... how can I modify it if it is read-pnly?

python states and setAttribValue Sept. 22, 2024, 1:29 p.m.

Hello

I am working in a HDA, and using Python Viewer States... I would like to modify (write) a primitive attribute (primnum 0 for example) with the mouse wheel.
so my code is:

    def onMouseWheelEvent(self, kwargs):
        ui_event = kwargs["ui_event"]
        state_parms = kwargs["state_parms"]
        dev = ui_event.device()
        self.myValue += dev.mouseWheel()/100
        myPrim = self.node.node("myNode").geometry().prim(0)
        myPrim.setAttributeValue("myAttr", self.myValue)

but it gives me an error:
... AttributeError: 'Polygon' object has no attribute 'setAttributeValue'

but the polygon class has that method, why it does not work?

how can I do write values on primitives using python viewer states?.. any advice?

Thanks you


I

onKeyEvent issue (python) Sept. 16, 2024, 4:32 p.m.

hi

I am writing a HDA python viewer state.
I would like to do something when the "r" key is pressed.
I wrote this python line to do that:

self.key_pressed = ui_event.device().keyString()
if self.key_pressed == "r":
    self.node.parm("color").set(0)

but when I test the HDA and press "r", it active the "rotate" tool instead of staying in my view state.

how can I avoid it?

Thanks