fix: Incompatible xformOpOrder

fix usd helper: [omni.usd._impl.utils] Incompatible xformOpOrder, translation applied before rotation or too many rotation ops.
This commit is contained in:
yida
2024-08-13 19:44:51 +08:00
parent a027cbcf38
commit e08f404953

View File

@@ -63,6 +63,9 @@ def set_prim_translate(prim, translation):
def set_prim_transform(
prim, pose: List[float], scale: List[float] = [1, 1, 1], use_float: bool = False
):
if not prim.GetAttribute("xformOp:translate").IsValid():
UsdGeom.Xformable(prim).AddTranslateOp(UsdGeom.XformOp.PrecisionFloat)
if prim.GetAttribute("xformOp:orient").IsValid():
if isinstance(prim.GetAttribute("xformOp:orient").Get(), Gf.Quatf):
use_float = True
@@ -70,8 +73,6 @@ def set_prim_transform(
UsdGeom.Xformable(prim).AddOrientOp(UsdGeom.XformOp.PrecisionFloat)
use_float = True
if not prim.GetAttribute("xformOp:translate").IsValid():
UsdGeom.Xformable(prim).AddTranslateOp(UsdGeom.XformOp.PrecisionFloat)
if not prim.GetAttribute("xformOp:scale").IsValid():
UsdGeom.Xformable(prim).AddScaleOp(UsdGeom.XformOp.PrecisionFloat)
quat = pose[3:]