Fix rotate issue
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include <pxr/usd/usdGeom/metrics.h>
|
||||
#include <pxr/usd/usdGeom/tokens.h>
|
||||
#include <pxr/usd/usdGeom/xform.h>
|
||||
#include <pxr/usd/usdGeom/xformCommonAPI.h>
|
||||
#include <pxr/usd/sdf/layer.h>
|
||||
#include <pxr/usd/sdf/reference.h>
|
||||
#include <pxr/usd/sdf/primSpec.h>
|
||||
@@ -202,6 +203,17 @@ void SceneHierarchyPanel::Render() {
|
||||
try {
|
||||
UsdPrim newPrim = m_stage->DefinePrim(primPath, TfToken(typeName));
|
||||
if (newPrim.IsValid()) {
|
||||
// Set correct camera orientation for the current up-axis
|
||||
if (std::string(typeName) == "Camera") {
|
||||
bool isZUp = (UsdGeomGetStageUpAxis(m_stage) == UsdGeomTokens->z);
|
||||
if (isZUp) {
|
||||
pxr::UsdGeomXformCommonAPI xformAPI(newPrim);
|
||||
xformAPI.SetRotate(
|
||||
pxr::GfVec3f(90.f, 0.f, 0.f),
|
||||
pxr::UsdGeomXformCommonAPI::RotationOrderXYZ,
|
||||
pxr::UsdTimeCode::Default());
|
||||
}
|
||||
}
|
||||
LOG_INFO("Created prim '" + primPath.GetString() + "' of type " + baseName);
|
||||
SetSelectedPathFromClick(primPath.GetString());
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user