New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to Get the custom Data of a Prim Material #147
Comments
|
Hi Tushar, I'm not sure if your issue is related to a bug in the API or that you didn't find the API to read the data from the VtDictionary. VtDictionary is a direct wrap of the pxr::base::vt::VtDictionary and you can find the CS interface here: https://github.com/Unity-Technologies/usd-unity-sdk/blob/master/src/USD.NET/generated/pxr/base/vt/VtDictionary.cs Use GetValueAtPath("your_key") to get the data stored at key "your_key", find("your_key") to get an iterator to the pair matching the key, but you can also iterate the dict using begin and end. We are using it here usd-unity-sdk/package/com.unity.formats.usd/Runtime/Scripts/IO/Scene/HierarchyBuilder.cs Lines 595 to 617 in a3fec00
Note that the values you'll get will be of type VtValue and you will have to convert them to a usable C# type with the corresponding VtValueTo*** function. If that doesn't help can you provide us the usd file and the code sample you're using. Thanks |
|
@judubu I have attached the usd file which we are using. I have stripped down the content to very basic data with relevant information. But the structure would be the same for the rest of our full data. |
|
All right I see, you have nested VtDictionaries. They don't automatically convert like they do in python, there are no VtValueToVtDict available and VtDictionaryGet is not implemented ... |
|
Nested types should also work fine, here's an example with three different ways of reading the data: |
|
Here's an example using a nested object, which is probably nice when you have so many attributes to read: |
|
@jcowles Thanks for your input which temporary worked out for us. But as I mentioned previously, I had stripped out lot of data to send it to you people and I feel that adding all the custom key & data parameters coming out of Katana material files (>2500 custom key & data) into the class/schema will not be ideal. And as our company have certain policy which restrict us from give out details on open forum, any possibility that I can contact you over the e-mail for future communication? Thanks, |
|
I believe we've already followed up offline, but yes, feel free to reach out directly jcowles@unity3d |
|
Given that this issue has been dormant for quite a while, I'm going to close this out -- but please reopen if you'd like to pursue it! |

Hi,
we are trying to get the custom data to the material using prim.GetCustomData()
It gives a VtDictionary but we are not able to get the data inside it since it doesn't provide anyways to access it or i am just not able to find it.
We tried we the same way in python and it worked.
Can anyone point in correct direction?
Thanks in advance.
The text was updated successfully, but these errors were encountered: