Init Repo

This commit is contained in:
2026-06-03 09:00:11 +08:00
commit 9be48d8b9e
155 changed files with 14827 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
#include "CreatePrimCommand.h"
#include "../../utils/Logger.h"
#include <pxr/usd/usd/prim.h>
namespace UsdLayerManager {
CreatePrimCommand::CreatePrimCommand(pxr::UsdStageRefPtr stage,
const pxr::SdfPath& primPath,
const pxr::TfToken& typeName)
: m_stage(stage)
, m_primPath(primPath)
, m_typeName(typeName)
, m_description("Create " + typeName.GetString() + " " + primPath.GetString())
{
}
void CreatePrimCommand::Execute() {
if (!m_stage) return;
try {
pxr::UsdPrim prim = m_stage->DefinePrim(m_primPath, m_typeName);
if (!prim.IsValid())
LOG_ERROR("CreatePrimCommand: failed to define prim " + m_primPath.GetString());
} catch (const std::exception& e) {
LOG_ERROR(std::string("CreatePrimCommand::Execute error: ") + e.what());
}
}
void CreatePrimCommand::Undo() {
if (!m_stage) return;
try {
if (!m_stage->RemovePrim(m_primPath))
LOG_ERROR("CreatePrimCommand: failed to remove prim " + m_primPath.GetString());
} catch (const std::exception& e) {
LOG_ERROR(std::string("CreatePrimCommand::Undo error: ") + e.what());
}
}
} // namespace UsdLayerManager