Blender V5.0
usd_armature_utils.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include "BLI_function_ref.hh"
6#include "BLI_map.hh"
7#include "BLI_string_ref.hh"
8#include "BLI_vector.hh"
9
10#include "DNA_modifier_types.h"
11
12#include <pxr/base/tf/token.h>
13#include <pxr/usd/usdSkel/animation.h>
14
15#include <string>
16
17struct Bone;
18struct Depsgraph;
19struct FCurve;
20struct ModifierData;
21struct Object;
22
23namespace blender::animrig {
24class Channelbag;
25struct FCurveDescriptor;
26} // namespace blender::animrig
27
28namespace blender::io::usd {
29
30/* Custom Blender Primvar name used for storing armature bone lengths. */
31inline const pxr::TfToken BlenderBoneLengths("blender:bone_lengths", pxr::TfToken::Immortal);
32
33/* Utility: create new fcurve and add it as a channel to a group. */
35 const blender::animrig::FCurveDescriptor &fcurve_descriptor,
36 const int sample_count);
37
38/* Utility: fill in a single fcurve sample at the provided index. */
39void set_fcurve_sample(FCurve *fcu, int64_t sample_index, const float frame, const float value);
40
48void visit_bones(const Object *ob_arm, FunctionRef<void(const Bone *)> visitor);
49
58void get_armature_bone_names(const Object *ob_arm, bool use_deform, Vector<StringRef> &r_names);
59
69pxr::TfToken build_usd_joint_path(const Bone *bone, bool allow_unicode);
70
84void create_pose_joints(pxr::UsdSkelAnimation &skel_anim,
85 const Object &obj,
86 const Map<StringRef, const Bone *> *deform_map,
87 bool allow_unicode);
88
98 ModifierType type,
99 const Depsgraph *depsgraph);
100
109const Object *get_armature_modifier_obj(const Object &obj, const Depsgraph *depsgraph);
110
123 const Depsgraph *depsgraph);
124
134bool can_export_skinned_mesh(const Object &obj, const Depsgraph *depsgraph);
135
146
147} // namespace blender::io::usd
BPy_StructRNA * depsgraph
long long int int64_t
void init_deform_bones_map(const Object *obj, Map< StringRef, const Bone * > *deform_map)
void set_fcurve_sample(FCurve *fcu, int64_t sample_index, const float frame, const float value)
void get_armature_bone_names(const Object *ob_arm, const bool use_deform, Vector< StringRef > &r_names)
FCurve * create_fcurve(blender::animrig::Channelbag &channelbag, const blender::animrig::FCurveDescriptor &fcurve_descriptor, const int sample_count)
bool is_armature_modifier_bone_name(const Object &obj, const StringRefNull name, const Depsgraph *depsgraph)
void create_pose_joints(pxr::UsdSkelAnimation &skel_anim, const Object &obj, const Map< StringRef, const Bone * > *deform_map, bool allow_unicode)
const pxr::TfToken BlenderBoneLengths("blender:bone_lengths", pxr::TfToken::Immortal)
pxr::TfToken build_usd_joint_path(const Bone *bone, bool allow_unicode)
const ModifierData * get_enabled_modifier(const Object &obj, ModifierType type, const Depsgraph *depsgraph)
const Object * get_armature_modifier_obj(const Object &obj, const Depsgraph *depsgraph)
static void visit_bones(const Bone *bone, FunctionRef< void(const Bone *)> visitor)
bool can_export_skinned_mesh(const Object &obj, const Depsgraph *depsgraph)
const char * name