A Minecraft style clone in Godot
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

28 lines
724 B

## Used with the SaveDataComponent for defining node and scene_file_path
class_name SceneDataResource
extends Node3DDataResource
@export var node_name: String
@export var scene_file_path: String
func _save_data(node: Node3D) -> void:
super._save_data(node)
node_name = node.name
scene_file_path = node.scene_file_path
func _load_data(window: Window) -> void:
var parent_node: Node3D
if parent_node_path != null:
parent_node = window.get_node_or_null(parent_node_path)
var scene_node: Node3D
if node_path != null:
var scene_file_resource: Resource = load(scene_file_path)
scene_node = scene_file_resource.instantiate()
if parent_node != null and scene_node != null:
parent_node.add_child(scene_node)