Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion modules/gltf/gltf_document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6890,6 +6890,14 @@ Ref<GLTFObjectModelProperty> GLTFDocument::import_object_model_property(Ref<GLTF
}
// Else, Godot's MeshInstance3D does not expose the blend shape weights as one property.
// But that's fine, we handle this case in _parse_animation_pointer instead.
} else if (node_prop == "extensions") {
ERR_FAIL_COND_V(split.size() < 5, ret);
const String &ext_name = split[3];
const String &ext_prop = split[4];
if (ext_name == "KHR_node_visibility" && ext_prop == "visible") {
ret->append_path_to_property(node_path, "visible");
ret->set_types(Variant::BOOL, GLTFObjectModelProperty::GLTF_OBJECT_MODEL_TYPE_BOOL);
}
}
} else if (split[0] == "cameras") {
const String &camera_prop = split[2];
Expand Down Expand Up @@ -7196,7 +7204,7 @@ Ref<GLTFObjectModelProperty> GLTFDocument::export_object_model_property(Ref<GLTF
split_json_pointer.append("weights");
split_json_pointer.append(weight_index_string);
}
// Transform properties. Check for all 3D nodes if we haven't resolved the JSON pointer yet.
// Transform and visibility properties. Check for all 3D nodes if we haven't resolved the JSON pointer yet.
// Note: Do not put this in an `else`, because otherwise this will not be reached.
if (split_json_pointer.is_empty() && Object::cast_to<Node3D>(target_object)) {
split_json_pointer.append("nodes");
Expand All @@ -7218,6 +7226,11 @@ Ref<GLTFObjectModelProperty> GLTFDocument::export_object_model_property(Ref<GLTF
} else if (target_prop == "global_transform") {
split_json_pointer.append("globalMatrix");
ret->set_types(Variant::TRANSFORM3D, GLTFObjectModelProperty::GLTF_OBJECT_MODEL_TYPE_FLOAT4X4);
} else if (target_prop == "visible") {
split_json_pointer.append("extensions");
split_json_pointer.append("KHR_node_visibility");
split_json_pointer.append("visible");
ret->set_types(Variant::BOOL, GLTFObjectModelProperty::GLTF_OBJECT_MODEL_TYPE_BOOL);
} else {
split_json_pointer.clear();
}
Expand Down