Cleanup: USD: Remove some redundant property type checks
For cases where we've already checked that the property is holding a particular type, use UncheckedGet to ensure the type isn't checked a second time. This matches all the other call sites doing similar. Pull Request: https://projects.blender.org/blender/blender/pulls/144084
This commit is contained in:
committed by
Jesse Yurkovich
parent
363873b821
commit
cb9ae01c69
@@ -250,7 +250,7 @@ static pxr::TfToken get_source_color_space(const pxr::UsdShadeShader &usd_shader
|
||||
|
||||
pxr::VtValue color_space_val;
|
||||
if (color_space_input.Get(&color_space_val) && color_space_val.IsHolding<pxr::TfToken>()) {
|
||||
return color_space_val.Get<pxr::TfToken>();
|
||||
return color_space_val.UncheckedGet<pxr::TfToken>();
|
||||
}
|
||||
|
||||
return pxr::TfToken();
|
||||
@@ -273,7 +273,7 @@ static int get_image_extension(const pxr::UsdShadeShader &usd_shader, const int
|
||||
return default_value;
|
||||
}
|
||||
|
||||
pxr::TfToken wrap_val = wrap_input_val.Get<pxr::TfToken>();
|
||||
pxr::TfToken wrap_val = wrap_input_val.UncheckedGet<pxr::TfToken>();
|
||||
|
||||
if (wrap_val == usdtokens::repeat) {
|
||||
return SHD_IMAGE_EXTENSION_REPEAT;
|
||||
@@ -341,7 +341,7 @@ static void set_viewport_material_props(Material *mtl, const pxr::UsdShadeShader
|
||||
if (metallic_input.GetAttr().HasAuthoredValue() && metallic_input.GetAttr().Get(&val) &&
|
||||
val.IsHolding<float>())
|
||||
{
|
||||
mtl->metallic = val.Get<float>();
|
||||
mtl->metallic = val.UncheckedGet<float>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -350,7 +350,7 @@ static void set_viewport_material_props(Material *mtl, const pxr::UsdShadeShader
|
||||
if (roughness_input.GetAttr().HasAuthoredValue() && roughness_input.GetAttr().Get(&val) &&
|
||||
val.IsHolding<float>())
|
||||
{
|
||||
mtl->roughness = val.Get<float>();
|
||||
mtl->roughness = val.UncheckedGet<float>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1292,7 +1292,7 @@ void USDMaterialReader::load_tex_image(const pxr::UsdShadeShader &usd_shader,
|
||||
return;
|
||||
}
|
||||
|
||||
const pxr::SdfAssetPath &asset_path = file_val.Get<pxr::SdfAssetPath>();
|
||||
const pxr::SdfAssetPath &asset_path = file_val.UncheckedGet<pxr::SdfAssetPath>();
|
||||
std::string file_path = asset_path.GetResolvedPath();
|
||||
|
||||
if (file_path.empty()) {
|
||||
|
||||
@@ -74,13 +74,13 @@ void USDShapeReader::read_values(const pxr::UsdTimeCode time,
|
||||
pxr::VtValue points_val = adapter.GetPoints(prim_, time);
|
||||
|
||||
if (points_val.IsHolding<pxr::VtVec3fArray>()) {
|
||||
positions = points_val.Get<pxr::VtVec3fArray>();
|
||||
positions = points_val.UncheckedGet<pxr::VtVec3fArray>();
|
||||
}
|
||||
|
||||
pxr::VtValue topology_val = adapter.GetTopology(prim_, pxr::SdfPath(), time);
|
||||
|
||||
if (topology_val.IsHolding<pxr::HdMeshTopology>()) {
|
||||
const pxr::HdMeshTopology &topology = topology_val.Get<pxr::HdMeshTopology>();
|
||||
const pxr::HdMeshTopology &topology = topology_val.UncheckedGet<pxr::HdMeshTopology>();
|
||||
face_counts = topology.GetFaceVertexCounts();
|
||||
face_indices = topology.GetFaceVertexIndices();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user