void Skeleton::localize_rests() { for(int i=bones.size()-1;i>=0;i--) { if (bones[i].parent>=0) set_bone_rest(i,bones[bones[i].parent].rest.affine_inverse() * bones[i].rest); } }
void Skeleton::localize_rests() { _update_process_order(); for (int i = bones.size() - 1; i >= 0; i--) { int idx = process_order[i]; if (bones[idx].parent >= 0) { set_bone_rest(idx, bones[bones[idx].parent].rest.affine_inverse() * bones[idx].rest); } } }
bool Skeleton::_set(const StringName& p_path, const Variant& p_value) { String path = p_path; if (!path.begins_with("bones/")) return false; int which=path.get_slicec('/',1).to_int(); String what=path.get_slicec('/',2); if (which==bones.size() && what=="name") { add_bone(p_value); return true; } ERR_FAIL_INDEX_V( which, bones.size(), false ); if (what=="parent") set_bone_parent(which, p_value ); else if (what=="rest") set_bone_rest(which, p_value); else if (what=="enabled") set_bone_enabled(which, p_value); else if (what=="pose") set_bone_pose(which, p_value); else if (what=="bound_childs") { Array children=p_value; if (is_inside_tree()) { bones[which].nodes_bound.clear(); for (int i=0;i<children.size();i++) { NodePath path=children[i]; ERR_CONTINUE( path.operator String()=="" ); Node *node = get_node(path); ERR_CONTINUE(!node); bind_child_node_to_bone(which,node); } } } else { return false; } return true; }