载入中...
搜索中...
未找到
SkeletonOverlayRuntime.cpp
浏览该文件的文档.
2
5
7
10 Revision revision, const std::string& selectedBone,
11 const std::map<std::string, std::string>& retarget,
12 const std::map<std::string, double>& mask, const SkeletonOverlayOptions& options) const {
13 if (!skeleton || !pose || skeleton->getBoneCount() != pose->getBoneCount()) {
15 result.target = std::move(target);
16 result.targetRevision = revision;
18 eve::DiagnosticCode::PreconditionViolation, RuleId("editor.skeleton.runtime-input"),
19 DiagnosticSeverity::Error, "Animation skeleton and matching pose are required"));
20 return result;
21 }
22 pose->computeWorld(skeleton);
23 std::vector<SkeletonOverlayBone> bones;
24 bones.reserve(static_cast<size_t>(skeleton->getBoneCount()));
25 for (int index = 0; index < skeleton->getBoneCount(); ++index) {
27 bone.name = skeleton->getBoneName(index);
28 bone.id = StableId(bone.name);
29 const int parent = skeleton->getParent(index);
30 if (parent >= 0) bone.parent = StableId(skeleton->getBoneName(parent));
31 bone.position = {pose->getWorldPositionX(index), pose->getWorldPositionY(index),
32 pose->getWorldPositionZ(index)};
33 bone.rotation = {pose->getWorldRotationX(index), pose->getWorldRotationY(index),
34 pose->getWorldRotationZ(index), pose->getWorldRotationW(index)};
35 bone.selected = bone.name == selectedBone;
36 const auto mapped = retarget.find(bone.name);
37 if (mapped != retarget.end())
38 bone.retarget = mapped->second.empty() ? SkeletonRetargetState::Unmatched
40 const auto weight = mask.find(bone.name);
41 if (weight != mask.end()) bone.maskWeight = weight->second;
42 bones.push_back(std::move(bone));
43 }
45}
46
47} // namespace eve::animation_editing
LogicalId target
eve::EntitySpatialPose pose
int mask
std::vector< Bone > bones
std::uint32_t bone
std::int32_t parent
std::uint64_t revision
const SquirrelValueOptions & options
uint32_t index
Evaluated local (and optional world) pose for an AnimSkeleton. Script type: AnimPose.
Definition AnimPose.h:17
3D bone hierarchy + bind-pose local TRS for skeletal animation. Independent of ik::Skeleton3D (FABRIK...
int getBoneCount() const
Returns the bone count.
int getParent(int boneIndex) const
Returns the parent.
std::string getBoneName(int boneIndex) const
Returns the bone name.
editing::GizmoSnapshot build(animation::AnimSkeleton *skeleton, animation::AnimPose *pose, std::string target, Revision revision, const std::string &selectedBone={}, const std::map< std::string, std::string > &retarget={}, const std::map< std::string, double > &mask={}, const SkeletonOverlayOptions &options={}) const
Compute pose world cache and build an immutable overlay.
Builds bone lines, joints, local axes and constraint arcs without a renderer dependency.
editing::GizmoSnapshot build(std::string target, Revision revision, const std::vector< SkeletonOverlayBone > &bones, const SkeletonOverlayOptions &options={}) const
Build a deterministic overlay or structured hierarchy/value diagnostics.
editing::StableId StableId
editing::Revision Revision
Diagnostic ruleDiagnostic(eve::DiagnosticCode code, RuleId rule, DiagnosticSeverity severity, std::string message)
Build a common diagnostic carrying an open editing rule identity.
Immutable renderer-neutral world-space bone snapshot.
Overlay density, feature toggles and hard safety budgets.
Immutable revision-tagged overlay snapshot consumed by any viewport renderer.
std::vector< Diagnostic > diagnostics