Gerardo Castellanos

Gerardo Castellanos

About Me

専門知識
Generalist
業界:
Film/TV

Connect

LOCATION
Spain

Houdini Engine

Availability

Not Specified

Recent Forum Posts

python states and setAttribValue 2024年9月23日3:32

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 2024年9月22日13:29

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) 2024年9月16日16:32

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