diff options
Diffstat (limited to 'modules/gltf/structures/gltf_node.cpp')
-rw-r--r-- | modules/gltf/structures/gltf_node.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/modules/gltf/structures/gltf_node.cpp b/modules/gltf/structures/gltf_node.cpp index 30895034a9..2934e4b5ee 100644 --- a/modules/gltf/structures/gltf_node.cpp +++ b/modules/gltf/structures/gltf_node.cpp @@ -31,6 +31,8 @@ #include "gltf_node.h" void GLTFNode::_bind_methods() { + ClassDB::bind_method(D_METHOD("get_original_name"), &GLTFNode::get_original_name); + ClassDB::bind_method(D_METHOD("set_original_name", "original_name"), &GLTFNode::set_original_name); ClassDB::bind_method(D_METHOD("get_parent"), &GLTFNode::get_parent); ClassDB::bind_method(D_METHOD("set_parent", "parent"), &GLTFNode::set_parent); ClassDB::bind_method(D_METHOD("get_height"), &GLTFNode::get_height); @@ -58,6 +60,7 @@ void GLTFNode::_bind_methods() { ClassDB::bind_method(D_METHOD("get_additional_data", "extension_name"), &GLTFNode::get_additional_data); ClassDB::bind_method(D_METHOD("set_additional_data", "extension_name", "additional_data"), &GLTFNode::set_additional_data); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "original_name"), "set_original_name", "get_original_name"); // String ADD_PROPERTY(PropertyInfo(Variant::INT, "parent"), "set_parent", "get_parent"); // GLTFNodeIndex ADD_PROPERTY(PropertyInfo(Variant::INT, "height"), "set_height", "get_height"); // int ADD_PROPERTY(PropertyInfo(Variant::TRANSFORM3D, "xform"), "set_xform", "get_xform"); // Transform3D @@ -72,6 +75,13 @@ void GLTFNode::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::INT, "light"), "set_light", "get_light"); // GLTFLightIndex } +String GLTFNode::get_original_name() { + return original_name; +} +void GLTFNode::set_original_name(String p_name) { + original_name = p_name; +} + GLTFNodeIndex GLTFNode::get_parent() { return parent; } @@ -89,11 +99,11 @@ void GLTFNode::set_height(int p_height) { } Transform3D GLTFNode::get_xform() { - return xform; + return transform; } void GLTFNode::set_xform(Transform3D p_xform) { - xform = p_xform; + transform = p_xform; } GLTFMeshIndex GLTFNode::get_mesh() { @@ -129,27 +139,27 @@ void GLTFNode::set_skeleton(GLTFSkeletonIndex p_skeleton) { } Vector3 GLTFNode::get_position() { - return position; + return transform.origin; } void GLTFNode::set_position(Vector3 p_position) { - position = p_position; + transform.origin = p_position; } Quaternion GLTFNode::get_rotation() { - return rotation; + return transform.basis.get_rotation_quaternion(); } void GLTFNode::set_rotation(Quaternion p_rotation) { - rotation = p_rotation; + transform.basis.set_quaternion_scale(p_rotation, transform.basis.get_scale()); } Vector3 GLTFNode::get_scale() { - return scale; + return transform.basis.get_scale(); } void GLTFNode::set_scale(Vector3 p_scale) { - scale = p_scale; + transform.basis = transform.basis.orthonormalized() * Basis::from_scale(p_scale); } Vector<int> GLTFNode::get_children() { |