Rodrigo Martin

RodrigoMartin

About Me

INDUSTRY
Film/TV

Connect

LOCATION
Not Specified
WEBSITE

Houdini Skills

Availability

Not Specified

Recent Forum Posts

How to set a button strip menu tokens with python. Sept. 4, 2023, 6:52 a.m.

Hi! I am trying to make a button that updates the tokens in a button strip when pressed, right now I have made this code in the action button of the parameter, but it gives me the error "Invalid size"

the menuItems consist of a list of strings, for example:
["cluster1","cluster1","cluster2","cluster1"]
so it contains labels and tokens.
import hou
pos = 1
menuItems = kwargs['node'].node("VALUES").geometry().attribValue("clusterList" + str(pos))
kwargs['parmtuple'].set((menuItems))

Timeshift compilable alternative? July 5, 2023, 4:43 a.m.

I've been working on a time dependant tool, and wanted to speed all up using compile blocks, but the problem is that a big part of the system is timedependant, I know timeshift is not compilable, so I solved this by running a loop over all frames with a timeshift and storing all the values on an array using the frame as an index.

But this is not what I wanted, I searched for alternatives, but all I found was cache or retime, and they are also no compilable.

Is there a way to substitute a timeshift in a compiled loop with something compilable?

Read how much primitives are in a solaris node. May 5, 2023, 7:59 a.m.

Soothsayer
There are docs but I'm afraid it's not necessarily easier:

https://openusd.org/release/api/class_usd_stage.html#a6ceb556070804b712c01a7968f925735 [openusd.org]

Somebody correct me if I'm wrong but as far as I can work out it's a c++ api and the python bindings are generated from this, meaning that you can adapt them 'in a simple and straightforward way'.

Now, you could try this in python to see what's in the pxr usd module and then dig around in the docs for it.

from pxr import Usd
print(dir(Usd))

or if you are feeling more adventerous:

node = hou.pwd()
stage = node.editableStage()


def list_module_contents(module, prefix="", visited=None):
    contents = []

    # Initialize the visited set if it's not provided
    if visited is None:
        visited = set()

    # Prevent infinite recursion by checking if the module was already visited
    if id(module) in visited:
        return contents

    visited.add(id(module))

    for name in dir(module):
        # Check if the attribute is readable
        if not hasattr(module, name):
            continue

        attr = getattr(module, name)
        full_name = f"{prefix}{name}"

        if isinstance(attr, type):
            # If the attribute is a class, recursively list its contents
            contents.extend(list_module_contents(attr, f"{full_name}.", visited))
        else:
            contents.append(full_name)

    return contents




from pxr import Usd

# List everything in the Usd module recursively
contents = [i for i in list_module_contents(Usd) if '__' not in i]

print(contents)


There are also examples here: https://openusd.org/release/tut_traversing_stage.html [openusd.org]

Wow, I think this weekend I will have some fun diving into this, I'm sure I will hit some walls in the path but progress is progress at the end!

Thank you so much! This is great!