From 1949320e8826f1f2d74f5f5b70eedeb386f937ac Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sun, 21 Sep 2025 19:41:05 +0200 Subject: Add screenshot and sceneshot --- client/system/gltf_apply_visibility.gd | 35 ++++++++++++++++++++++++++++++ client/system/gltf_apply_visibility.gd.uid | 1 + client/system/settings.gd | 1 + 3 files changed, 37 insertions(+) create mode 100644 client/system/gltf_apply_visibility.gd create mode 100644 client/system/gltf_apply_visibility.gd.uid (limited to 'client/system') diff --git a/client/system/gltf_apply_visibility.gd b/client/system/gltf_apply_visibility.gd new file mode 100644 index 00000000..5635bf6e --- /dev/null +++ b/client/system/gltf_apply_visibility.gd @@ -0,0 +1,35 @@ +# Hurry Curry! - a game about cooking +# Copyright (C) 2025 Hurry Curry! contributors +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, version 3 of the License only. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +extends GLTFDocumentExtension +class_name GLTFApplyNodeVisibility + +# Since Godot 4.5 the KHR_node_visibility extension is +# required which is not yet supported in Blender, so we +# pre-apply them by removing meshes from hidden nodes. +func _export_post(state: GLTFState) -> Error: + state.json["extensionsRequired"].erase("KHR_node_visibility") + var nodes = state.json["nodes"] + for node in nodes: + var visible = node.get("extensions", {}).get("KHR_node_visibility", {}).get("visible", true) + if not visible: hide_node(nodes, node) + return Error.OK + +func hide_node(nodes: Array, node: Dictionary): + if node.has("mesh"): print("clear mesh") + node.erase("mesh") + for child_index in node.get("children", []): + print("clear child child_index") + hide_node(nodes, nodes[child_index]) diff --git a/client/system/gltf_apply_visibility.gd.uid b/client/system/gltf_apply_visibility.gd.uid new file mode 100644 index 00000000..2dfa14e4 --- /dev/null +++ b/client/system/gltf_apply_visibility.gd.uid @@ -0,0 +1 @@ +uid://xi0tf4wav1ky diff --git a/client/system/settings.gd b/client/system/settings.gd index 43613de0..a3aece89 100644 --- a/client/system/settings.gd +++ b/client/system/settings.gd @@ -30,6 +30,7 @@ static func get_root(): ToggleSetting.new("accessible_movement", false), ToggleSetting.new("first_person", false), DropdownSetting.new("interact_target", "dirsnap", ["dir", "dirsnap"]), + PathSetting.new("screenshot_path", "", FileDialog.FileMode.FILE_MODE_OPEN_DIR), ]), SettingsCategory.new("graphics", [ PresetRow.new("preset", { -- cgit v1.2.3-70-g09d2