Interactions with quicklook using python tools

Hi all,

I would like to add some interactions in usd using python tools. Specifically I would like some tap/click interactions in usd files that eventually will be ported to usdz.

Specially in this example:
https://openusd.org/release/tut_xforms.html

In step 3,

def AddSpin(top):
spin = top.AddRotateZOp(opSuffix=‘spin’)
spin.Set(time=1, value=0)
spin.Set(time=192, value=1440)

def Step3():
stage = MakeInitialStage(‘Step3.usda’)
stage.SetMetadata(‘comment’, ‘Step 3: Adding spin animation’)
top = AddReferenceToGeometry(stage, ‘/Top’)
AddSpin(top)
stage.Save()

Is there a way to add an interaction to start/stop the animation? e.g. if I were to open this in quicklook (after exporting to usdz).

Also any other helpful information on interactivity would be very helpful!
Thanks!

Sorry for the delayed response. Since the behaviour schemas for QuickLook are bespoke/preliminary schemas, personally I would recommend exporting an example of what you want out of Reality Composer (non-Pro) as a USDZ file.

If you convert the USDZ file to a usda, you should be able to see the exact schema names and attributes to use.

I believe @herbst has done some work for his web product for some common ones and might be of assistance too.

1 Like

No worries! thanks for the response!

Unfortunately I have a newer OS and can’t install/use non-Pro reality composer. I have read multiple times that USDZ can do this even on the Apple developer website!

But I don’t know how to put the pieces together in python or manually through editing a usda file. I placed a post on the Apple dev forums too
(USD/Z schemas and Declarations | Apple Developer Forums) but that place seems quite dead!

I would even settle for an interactive USDZ file but I can’t find one anywhere!

If you have an iPhone or iPad, you can run the non Pro Reality Composer on it and export to USDZ from there perhaps.

unfortunately no option to export usdz just .reality :frowning:

I’m a little lost on how to add a schema to a usda file

or to use this declaration with the usda file
class Preliminary_Behavior “Preliminary_Behavior” (
inherits =
)

do you know any resources that can help? that would be a big help thanks! :slight_smile:

Oh sorry, forgot to mention. Go to the settings app, look for Reality Composer there and there’s an option to Enable USDZ Export. It’s off by default.

With regards to using the schema, you can create it ad hoc.

In Python, you have stage.DefinePrim and one of the arguments is the type name. You can give it any arbitrary string. As long as it matches something known, it’ll be fine.

oh awesome, thank you for that! huge help!

I’ll have play and report back too for others! :slight_smile:

Needle indeed has the capability to generate USDZ with Preliminary_Behavior on the fly from browser applications, including an API that can emit arbitrarily compex behaviour chains (more complex than what Reality Composer allows for). It also includes higher-level logic for commonly used scenarios such as playing multiple animations, switching materials, and so on.

You can take a look at some examples here:

and in the docs:

Wow!

This is incredible stuff! I have managed to build the interactivity I needed by using Reality Composer and manually editing the usda file as a template (I am building this to be unique and defined per user) - but this looks incredible.

I will take a look - many thanks!