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: