24 return name.length > 0 ?
name.data : def;
48 const ufbx_node &node,
49 const ufbx_matrix &local_bind_inv_matrix)
51 ufbx_transform xform = local_xform;
56 if (node.adjust_post_scale != 1.0) {
57 xform.scale.x /= node.adjust_post_scale;
58 xform.scale.y /= node.adjust_post_scale;
59 xform.scale.z /= node.adjust_post_scale;
63 ufbx_matrix matrix = ufbx_transform_to_matrix(&xform);
64 matrix = ufbx_matrix_mul(&local_bind_inv_matrix, &matrix);
71 fprintf(g_debug_file,
"init NODE %s self.matrix:\n",
obj->id.name + 2);
83 ufbx_matrix mtx = ufbx_matrix_mul(node->node_depth < 2 ? &node->node_to_world :
84 &node->node_to_parent,
85 &node->geometry_to_node);
89 const ufbx_node *parbone = node->parent;
93 ufbx_matrix offset_mtx = ufbx_identity_matrix;
102 mtx = ufbx_matrix_mul(&offset_mtx, &mtx);
109#ifdef FBX_DEBUG_PRINT
110 fprintf(g_debug_file,
111 "parent CHILD %s to ARM %s BONE %s bone_child_mtx:\n",
115 print_matrix(offset_mtx);
116 fprintf(g_debug_file,
"- child matrix:\n");
130 const char *
name = prop.name.data;
133 case UFBX_PROP_BOOLEAN:
134 val.
i = prop.value_int;
137 case UFBX_PROP_INTEGER: {
138 bool parsed_as_enum =
false;
139 if (enums_as_strings && (prop.flags & UFBX_PROP_FLAG_VALUE_STR) &&
140 (prop.value_str.length > 0))
143 const char *tilde = prop.value_str.data;
146 const char *tilde_start = tilde;
148 if (tilde == tilde_start) {
153 if (enum_index == prop.value_int) {
155 parsed_as_enum =
true;
170 if (!parsed_as_enum) {
171 val.
i = prop.value_int;
176 case UFBX_PROP_NUMBER:
177 val.
d = prop.value_real;
180 case UFBX_PROP_STRING:
184 const char *line = prop.value_str.data;
186 const char *line_start = line;
188 if (line == line_start) {
193 const char *eq_pos = line_start;
194 while (eq_pos != line && eq_pos[0] !=
'=') {
197 if (eq_pos[0] ==
'=') {
216 val.
string.
len = prop.value_str.length + 1;
221 case UFBX_PROP_VECTOR:
222 case UFBX_PROP_COLOR:
227 double *dst =
static_cast<double *
>(idprop->
data.
pointer);
228 dst[0] = prop.value_vec3.x;
229 dst[1] = prop.value_vec3.y;
230 dst[2] = prop.value_vec3.z;
233 case UFBX_PROP_COLOR_WITH_ALPHA:
238 double *dst =
static_cast<double *
>(idprop->
data.
pointer);
239 dst[0] = prop.value_vec4.x;
240 dst[1] = prop.value_vec4.y;
241 dst[2] = prop.value_vec4.z;
242 dst[3] = prop.value_vec4.z;
249 if (idprop !=
nullptr) {
256 for (
const ufbx_prop &prop : props.props) {
257 if ((prop.flags & UFBX_PROP_FLAG_USER_DEFINED) == 0) {
267 if (pchan.
prop ==
nullptr) {
275 for (
const ufbx_prop &prop : props.props) {
276 if ((prop.flags & UFBX_PROP_FLAG_USER_DEFINED) == 0) {
284#ifdef FBX_DEBUG_PRINT
286void print_matrix(
const ufbx_matrix &m)
288 fprintf(g_debug_file,
289 " (%.3f %.3f %.3f %.3f)\n",
294 fprintf(g_debug_file,
295 " (%.3f %.3f %.3f %.3f)\n",
300 fprintf(g_debug_file,
301 " (%.3f %.3f %.3f %.3f)\n",
IDProperty * IDP_New(char type, const IDPropertyTemplate *val, blender::StringRef name, eIDPropertyFlag flags={}) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
bool IDP_AddToGroup(IDProperty *group, IDProperty *prop) ATTR_NONNULL()
IDProperty * IDP_EnsureProperties(ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
General operations, lookup, etc. for blender objects.
void BKE_object_apply_mat4(Object *ob, const float mat[4][4], bool use_compat, bool use_parent)
void BKE_object_to_mat4(const Object *ob, float r_mat[4][4])
char char size_t char const char * BLI_strchr_or_end(const char *str, char ch) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(1)
#define STRNCPY_UTF8(dst, src)
Object is a sort of wrapper for general info.
Value lookup_default(const Key &key, const Value &default_value) const
bool contains(const Key &key) const
constexpr StringRef trim() const
std::unique_ptr< IDProperty, IDPropertyDeleter > create_group(StringRef prop_name, eIDPropertyFlag flags={})
Allocate a new IDProperty of type IDP_GROUP.
void ufbx_matrix_to_obj(const ufbx_matrix &mtx, Object *obj)
const char * get_fbx_name(const ufbx_string &name, const char *def)
void read_custom_properties(const ufbx_props &props, ID &id, bool enums_as_strings)
void node_matrix_to_obj(const ufbx_node *node, Object *obj, const FbxElementMapping &mapping)
void matrix_to_m44(const ufbx_matrix &src, float dst[4][4])
static IDProperty * pchan_EnsureProperties(bPoseChannel &pchan)
ufbx_matrix calc_bone_pose_matrix(const ufbx_transform &local_xform, const ufbx_node &node, const ufbx_matrix &local_bind_inv_matrix)
static void read_ufbx_property(const ufbx_prop &prop, IDProperty *idgroup, bool enums_as_strings)
Map< const ufbx_node *, ufbx_real > bone_to_length
Map< const ufbx_node *, Object * > bone_to_armature
Map< const ufbx_node *, std::string > node_to_name
Set< const ufbx_node * > node_is_blender_bone
struct IDPropertyTemplate::@032057005265002020267344110225167212360002125060 array
struct IDPropertyTemplate::@306303166102371126056157213146124155011254157272 string