Isotropix Forums

Checking if a USD file reference is loaded

Clarisse Scripting related topics

Checking if a USD file reference is loaded

Unread postby jboissinot » Fri Feb 03, 2023 12:20 am

Hi,

I'm looking for a way to check if a USD file reference is loaded but here is what I noticed.
I was trying to do this with the following code:
Code: Select all
ctx = ix.get_item("path/to/context")
ctx.get_engine().is_loaded()

This works fine when I do it on an Alembic file reference as get_engine() returns a OfFileReferenceContextEngine, while it returns a OfOverridesContextEngine when I do it on a USD file reference and so it can't find the is_loaded() method from it.

I was wondering if this could possibly be due to some changes that have been implemented in Clarisse 5 which might have introduced this bug.
Also I could not create an instance of OfFileReferenceContextEngine from the context, like ix.api.OfFileReferenceContextEngine(ctx), so I'm not quite sure how I could do it and therefore was hoping to get more info on this.

Thanks,
Jeremy
jboissinot
 
Posts: 108
Joined: Tue Jan 29, 2019 10:36 pm

Re: Checking if a USD file reference is loaded

Unread postby dcourtois » Fri Feb 03, 2023 10:03 am

Hi,
This is not a bug, and it changed when we added support to USD variants. I'm not sure why it was done like this though.
As for knowing when the USD file reference is loaded, can you try `ctx.get_engine().is_content_dirty()`? I think it might do the trick.
User avatar
dcourtois
 
Posts: 130
Joined: Tue Jul 25, 2017 3:15 pm

Re: Checking if a USD file reference is loaded

Unread postby jboissinot » Fri Feb 03, 2023 11:34 pm

Hi Damien,

Indeed I assumed that it was related to the USD references actually so thank you for confirming this. I did try ctx.get_engine().is_content_dirty() but didn't really help as the USD reference was not loaded yet, so there was no such content to check in the context then. I also tried different things and realized that the USD reference is loading after the execution of the script is done anyway, and I found about ix.application.check_for_events() to force load it, which I ended up using to get what I was trying to achieve with this, so it's all good and does work fine after all.

Thanks,
Jeremy
jboissinot
 
Posts: 108
Joined: Tue Jan 29, 2019 10:36 pm


Return to Scripting
cron