@@ -6339,6 +6339,7 @@ void GLTFDocument::_generate_scene_node(Ref<GLTFState> p_state, const GLTFNodeIn
63396339 // Note: p_scene_parent and p_scene_root must either both be null or both be valid.
63406340 _set_node_tree_owner (current_node, p_scene_root);
63416341 current_node->set_transform (gltf_node->transform );
6342+ current_node->set_visible (gltf_node->visible );
63426343 current_node->merge_meta_from (*gltf_node);
63436344 p_state->scene_nodes .insert (p_node_index, current_node);
63446345 for (int i = 0 ; i < gltf_node->children .size (); ++i) {
@@ -6809,6 +6810,14 @@ Ref<GLTFObjectModelProperty> GLTFDocument::import_object_model_property(Ref<GLTF
68096810 }
68106811 // Else, Godot's MeshInstance3D does not expose the blend shape weights as one property.
68116812 // But that's fine, we handle this case in _parse_animation_pointer instead.
6813+ } else if (node_prop == " extensions" ) {
6814+ ERR_FAIL_COND_V (split.size () < 5 , ret);
6815+ const String &ext_name = split[3 ];
6816+ const String &ext_prop = split[4 ];
6817+ if (ext_name == " KHR_node_visibility" && ext_prop == " visible" ) {
6818+ ret->append_path_to_property (node_path, " visible" );
6819+ ret->set_types (Variant::BOOL, GLTFObjectModelProperty::GLTF_OBJECT_MODEL_TYPE_BOOL);
6820+ }
68126821 }
68136822 } else if (split[0 ] == " cameras" ) {
68146823 const String &camera_prop = split[2 ];
@@ -7116,7 +7125,7 @@ Ref<GLTFObjectModelProperty> GLTFDocument::export_object_model_property(Ref<GLTF
71167125 split_json_pointer.append (" weights" );
71177126 split_json_pointer.append (weight_index_string);
71187127 }
7119- // Transform properties. Check for all 3D nodes if we haven't resolved the JSON pointer yet.
7128+ // Transform and visibility properties. Check for all 3D nodes if we haven't resolved the JSON pointer yet.
71207129 // Note: Do not put this in an `else`, because otherwise this will not be reached.
71217130 if (split_json_pointer.is_empty () && Object::cast_to<Node3D>(target_object)) {
71227131 split_json_pointer.append (" nodes" );
@@ -7138,6 +7147,11 @@ Ref<GLTFObjectModelProperty> GLTFDocument::export_object_model_property(Ref<GLTF
71387147 } else if (target_prop == " global_transform" ) {
71397148 split_json_pointer.append (" globalMatrix" );
71407149 ret->set_types (Variant::TRANSFORM3D, GLTFObjectModelProperty::GLTF_OBJECT_MODEL_TYPE_FLOAT4X4);
7150+ } else if (target_prop == " visible" ) {
7151+ split_json_pointer.append (" extensions" );
7152+ split_json_pointer.append (" KHR_node_visibility" );
7153+ split_json_pointer.append (" visible" );
7154+ ret->set_types (Variant::BOOL, GLTFObjectModelProperty::GLTF_OBJECT_MODEL_TYPE_BOOL);
71417155 } else {
71427156 split_json_pointer.clear ();
71437157 }
0 commit comments