Hi,
Clarisse currently doesn't natively read such properties. I don't know if USD has a native property for "cast shadows" so you might need to export it as a custom property.
If you know what property holds the "cast shadows" value (be it a Houdini native one, or a custom one created by you), you can use the following script to read the specified attribute from all Geometries in a specified Context and apply the read value into Clarisse's "cast_shadows" attribute.
This Python code is not specific to USD. It could be run on any context containing geometries and said property.
You can either run the function directly on a Geometry Object, or on a Context containing Geometries.
python code
def apply_cast_shadows_on_object(geometry, prop_name):
if not geometry or not geometry.is_kindof("Geometry"):
return
# search the property
collection = geometry.get_module().get_properties()
property = None
for i in range(collection.get_property_count()):
if collection.get_property(i).get_name() == prop_name:
property = collection.get_property(i)
break
if property:
# read the property value and apply it if different than the attribute value
resource = property.get_values_property(0)
cast_shadow_prop = bool(resource.get_int(0))
cast_shadow_attr = geometry.attribut_exists("cast_shadows")
if cast_shadow_attr and cast_shadow_prop != cast_shadow_attr.get_bool():
cast_shadow_attr.set_bool(cast_shadow_prop)
else:
ix.log_info("Property '{}' not found in '{}'".format(prop_name, geometry.get_full_name()))
def apply_cast_shadows_on_context(context_path, prop_name):
"""
Searches for all Geometry objects in the specified context, loads and applies the specified
property into the attribute 'cast_shadows'.
"""
context = ix.get_item(context_path)
assert context
geoms = ix.api.OfObjectArray()
context.get_all_objects("Geometry", geoms)
for geom in geoms:
apply_cast_shadows_on_object(geom, prop_name)
# Usage example
apply_cast_shadows_on_context("project://path/to/context", "property_name")
About adding USD properties using Houdini. Maybe you need to prefix the property name with "primvars:" or "userProperties:", preferably "userProperties:" if it's a custom property (i.e. not native to USD).
To check that, open the USD file in USD View, and check the displayed property name. If it doesn't start with the above prefixes, Clarisse will not load them.
Hope this helps.