统一缩进为制表符

master
chendian 9 months ago
parent 71119f326e
commit e885c52f20

@ -1,9 +1,2 @@
# Editor configuration, see https://editorconfig.org # Editor configuration, see https://editorconfig.org
root = true root = true
[*.gd]
charset = utf-8
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

@ -1,14 +1,17 @@
const Faces = preload("./Faces.gd"); const Faces = preload("./Faces.gd");
const vox_to_godot = Basis(Vector3.RIGHT, Vector3.FORWARD, Vector3.UP); const vox_to_godot = Basis(Vector3.RIGHT, Vector3.FORWARD, Vector3.UP);
func generate(vox, voxel_data, scale, snaptoground): func generate(vox, voxel_data, scale, snaptoground):
var generator = VoxelMeshGenerator.new(vox, voxel_data, scale, snaptoground); var generator = VoxelMeshGenerator.new(vox, voxel_data, scale, snaptoground);
return generator.generate_mesh(); return generator.generate_mesh();
class MeshGenerator: class MeshGenerator:
var surfaces = {}; var surfaces = {};
func ensure_surface_exists(surface_index: int, color: Color, material: Material): func ensure_surface_exists(surface_index: int, color: Color, material: Material):
if (surfaces.has(surface_index)): return; if (surfaces.has(surface_index)): return;
@ -18,10 +21,12 @@ class MeshGenerator:
st.set_material(material); st.set_material(material);
surfaces[surface_index] = st; surfaces[surface_index] = st;
func add_vertex(surface_index: int, vertex: Vector3): func add_vertex(surface_index: int, vertex: Vector3):
var st = surfaces[surface_index] as SurfaceTool; var st = surfaces[surface_index] as SurfaceTool;
st.add_vertex(vertex); st.add_vertex(vertex);
func combine_surfaces(): func combine_surfaces():
var mesh = null; var mesh = null;
for surface_index in surfaces: for surface_index in surfaces:
@ -35,22 +40,26 @@ class MeshGenerator:
mesh.surface_set_name(new_surface_index, name); mesh.surface_set_name(new_surface_index, name);
return mesh; return mesh;
class VoxelMeshGenerator: class VoxelMeshGenerator:
var vox; var vox;
var voxel_data = {}; var voxel_data = {};
var scale: float; var scale: float;
var snaptoground: bool; var snaptoground: bool;
func _init(vox, voxel_data, scale, snaptoground): func _init(vox, voxel_data, scale, snaptoground):
self.vox = vox; self.vox = vox;
self.voxel_data = voxel_data; self.voxel_data = voxel_data;
self.scale = scale; self.scale = scale;
self.snaptoground = snaptoground; self.snaptoground = snaptoground;
func get_material(voxel): func get_material(voxel):
var surface_index = voxel_data[voxel]; var surface_index = voxel_data[voxel];
return vox.materials[surface_index] return vox.materials[surface_index]
func face_is_visible(voxel, face): func face_is_visible(voxel, face):
if (not voxel_data.has(voxel + face)): if (not voxel_data.has(voxel + face)):
return true; return true;
@ -58,6 +67,7 @@ class VoxelMeshGenerator:
var adj_material = get_material(voxel + face); var adj_material = get_material(voxel + face);
return adj_material.is_glass() && !local_material.is_glass(); return adj_material.is_glass() && !local_material.is_glass();
func generate_mesh(): func generate_mesh():
# Minimum extends of the volume # Minimum extends of the volume

@ -7,7 +7,6 @@ const Top = [
Vector3( 1.0000, 1.0000, 0.0000), Vector3( 1.0000, 1.0000, 0.0000),
Vector3( 1.0000, 1.0000, 1.0000), Vector3( 1.0000, 1.0000, 1.0000),
]; ];
const Bottom = [ const Bottom = [
Vector3( 0.0000, 0.0000, 0.0000), Vector3( 0.0000, 0.0000, 0.0000),
Vector3( 0.0000, 0.0000, 1.0000), Vector3( 0.0000, 0.0000, 1.0000),
@ -17,7 +16,6 @@ const Bottom = [
Vector3( 1.0000, 0.0000, 0.0000), Vector3( 1.0000, 0.0000, 0.0000),
Vector3( 0.0000, 0.0000, 0.0000), Vector3( 0.0000, 0.0000, 0.0000),
]; ];
const Front = [ const Front = [
Vector3( 0.0000, 1.0000, 1.0000), Vector3( 0.0000, 1.0000, 1.0000),
Vector3( 1.0000, 1.0000, 1.0000), Vector3( 1.0000, 1.0000, 1.0000),
@ -27,7 +25,6 @@ const Front = [
Vector3( 0.0000, 0.0000, 1.0000), Vector3( 0.0000, 0.0000, 1.0000),
Vector3( 0.0000, 1.0000, 1.0000), Vector3( 0.0000, 1.0000, 1.0000),
]; ];
const Back = [ const Back = [
Vector3( 1.0000, 0.0000, 0.0000), Vector3( 1.0000, 0.0000, 0.0000),
Vector3( 1.0000, 1.0000, 0.0000), Vector3( 1.0000, 1.0000, 0.0000),
@ -37,7 +34,6 @@ const Back = [
Vector3( 0.0000, 0.0000, 0.0000), Vector3( 0.0000, 0.0000, 0.0000),
Vector3( 1.0000, 0.0000, 0.0000) Vector3( 1.0000, 0.0000, 0.0000)
]; ];
const Left = [ const Left = [
Vector3( 0.0000, 1.0000, 1.0000), Vector3( 0.0000, 1.0000, 1.0000),
Vector3( 0.0000, 0.0000, 1.0000), Vector3( 0.0000, 0.0000, 1.0000),
@ -47,7 +43,6 @@ const Left = [
Vector3( 0.0000, 1.0000, 0.0000), Vector3( 0.0000, 1.0000, 0.0000),
Vector3( 0.0000, 1.0000, 1.0000), Vector3( 0.0000, 1.0000, 1.0000),
]; ];
const Right = [ const Right = [
Vector3( 1.0000, 1.0000, 1.0000), Vector3( 1.0000, 1.0000, 1.0000),
Vector3( 1.0000, 1.0000, 0.0000), Vector3( 1.0000, 1.0000, 0.0000),

@ -1,7 +1,6 @@
const Faces = preload("./Faces.gd") const Faces = preload("./Faces.gd")
const VoxData = preload("./VoxFormat/VoxData.gd") const VoxData = preload("./VoxFormat/VoxData.gd")
const vox_to_godot = Basis(Vector3.RIGHT, Vector3.FORWARD, Vector3.UP) const vox_to_godot = Basis(Vector3.RIGHT, Vector3.FORWARD, Vector3.UP)
# Names for the faces by orientation # Names for the faces by orientation
enum FaceOrientation { enum FaceOrientation {
Top = 0, Top = 0,
@ -11,7 +10,6 @@ enum FaceOrientation {
Front = 4, Front = 4,
Back = 5, Back = 5,
} }
# An Array(FaceOrientation) of all possible face orientations # An Array(FaceOrientation) of all possible face orientations
const face_orientations: Array = [ const face_orientations: Array = [
FaceOrientation.Top, FaceOrientation.Top,
@ -21,7 +19,6 @@ const face_orientations :Array = [
FaceOrientation.Front, FaceOrientation.Front,
FaceOrientation.Back FaceOrientation.Back
] ]
# An Array(int) of the depth axis by orientation # An Array(int) of the depth axis by orientation
const depth_axis: Array = [ const depth_axis: Array = [
Vector3.AXIS_Z, Vector3.AXIS_Z,
@ -31,7 +28,6 @@ const depth_axis :Array = [
Vector3.AXIS_Y, Vector3.AXIS_Y,
Vector3.AXIS_Y, Vector3.AXIS_Y,
] ]
# An Array(int) of the width axis by orientation # An Array(int) of the width axis by orientation
const width_axis: Array = [ const width_axis: Array = [
Vector3.AXIS_Y, Vector3.AXIS_Y,
@ -41,7 +37,6 @@ const width_axis :Array = [
Vector3.AXIS_X, Vector3.AXIS_X,
Vector3.AXIS_X, Vector3.AXIS_X,
] ]
# An Array(int) of height axis by orientation # An Array(int) of height axis by orientation
const height_axis: Array = [ const height_axis: Array = [
Vector3.AXIS_X, Vector3.AXIS_X,
@ -51,7 +46,6 @@ const height_axis :Array = [
Vector3.AXIS_Z, Vector3.AXIS_Z,
Vector3.AXIS_Z, Vector3.AXIS_Z,
] ]
# An Array(Vector3) describing what vectors to use to check for face occlusion # An Array(Vector3) describing what vectors to use to check for face occlusion
# by orientation # by orientation
const face_checks: Array = [ const face_checks: Array = [
@ -62,7 +56,6 @@ const face_checks :Array = [
Vector3(0, -1, 0), Vector3(0, -1, 0),
Vector3(0, 1, 0), Vector3(0, 1, 0),
] ]
# An array of the face meshes by orientation # An array of the face meshes by orientation
const face_meshes: Array = [ const face_meshes: Array = [
Faces.Front, Faces.Front,
@ -72,7 +65,6 @@ const face_meshes :Array = [
Faces.Bottom, Faces.Bottom,
Faces.Top, Faces.Top,
] ]
# An Array(Vector3) describing what normals to use by orientation # An Array(Vector3) describing what normals to use by orientation
const normals: Array = [ const normals: Array = [
Vector3(0, 1, 0), Vector3(0, 1, 0),
@ -82,20 +74,17 @@ const normals :Array = [
Vector3(0, 0, 1), Vector3(0, 0, 1),
Vector3(0, 0, -1), Vector3(0, 0, -1),
] ]
# The SurfaceTool the object will use to generate the mesh # The SurfaceTool the object will use to generate the mesh
var st: SurfaceTool = SurfaceTool.new() var st: SurfaceTool = SurfaceTool.new()
# A Dictonary[Vector3]int of the voxel data for the visible faces of the # A Dictonary[Vector3]int of the voxel data for the visible faces of the
# current slice # current slice
var faces: Dictionary var faces: Dictionary
# Minimum extends of the volume # Minimum extends of the volume
var mins: Vector3 = Vector3(1000000, 1000000, 1000000) var mins: Vector3 = Vector3(1000000, 1000000, 1000000)
# Maximum extends of the volume # Maximum extends of the volume
var maxs: Vector3 = Vector3(-1000000, -1000000, -1000000) var maxs: Vector3 = Vector3(-1000000, -1000000, -1000000)
# Generate a mesh for the given voxel_data with single-pass greedy face merging # Generate a mesh for the given voxel_data with single-pass greedy face merging
# Primary RefCounted: https://0fps.net/2012/06/30/meshing-in-a-minecraft-game/ # Primary RefCounted: https://0fps.net/2012/06/30/meshing-in-a-minecraft-game/
# Secondary RefCounted: https://www.gedge.ca/dev/2014/08/17/greedy-voxel-meshing # Secondary RefCounted: https://www.gedge.ca/dev/2014/08/17/greedy-voxel-meshing
@ -134,6 +123,7 @@ func generate(vox :VoxData, voxel_data :Dictionary, scale :float, snaptoground :
st.set_material(material) st.set_material(material)
return st.commit() return st.commit()
# Generates all of the geometry for a given face orientation # Generates all of the geometry for a given face orientation
func generate_geometry_for_orientation(voxel_data: Dictionary, o: int, scale: float, snaptoground: bool) -> void: func generate_geometry_for_orientation(voxel_data: Dictionary, o: int, scale: float, snaptoground: bool) -> void:
# Sweep through the volume along the depth reducing the problem to 2 dimensional # Sweep through the volume along the depth reducing the problem to 2 dimensional
@ -143,6 +133,7 @@ func generate_geometry_for_orientation(voxel_data :Dictionary, o :int, scale :fl
if faces.size() > 0: if faces.size() > 0:
generate_geometry(faces, o, slice, scale, snaptoground) generate_geometry(faces, o, slice, scale, snaptoground)
# Returns the voxels in the set voxel_data with a visible face along the slice # Returns the voxels in the set voxel_data with a visible face along the slice
# for the given orientation # for the given orientation
func query_slice_faces(voxel_data: Dictionary, o: int, slice: float) -> Dictionary: func query_slice_faces(voxel_data: Dictionary, o: int, slice: float) -> Dictionary:
@ -153,6 +144,7 @@ func query_slice_faces(voxel_data :Dictionary, o :int, slice :float) -> Dictiona
ret[v] = voxel_data[v] ret[v] = voxel_data[v]
return ret return ret
# Generates geometry for the given orientation for the set of faces # Generates geometry for the given orientation for the set of faces
func generate_geometry(faces: Dictionary, o: int, slice: float, scale: float, snaptoground: bool) -> void: func generate_geometry(faces: Dictionary, o: int, slice: float, scale: float, snaptoground: bool) -> void:
var da: int = depth_axis[o] var da: int = depth_axis[o]
@ -172,6 +164,7 @@ func generate_geometry(faces :Dictionary, o :int, slice :float, scale :float, sn
v[wa] += 1.0 v[wa] += 1.0
v[ha] += 1.0 v[ha] += 1.0
# Generates the geometry for the given face and orientation and scale and returns # Generates the geometry for the given face and orientation and scale and returns
# the set of remaining faces # the set of remaining faces
func generate_geometry_for_face(faces: Dictionary, face: Vector3, o: int, scale: float, snaptoground: bool) -> Dictionary: func generate_geometry_for_face(faces: Dictionary, face: Vector3, o: int, scale: float, snaptoground: bool) -> Dictionary:
@ -206,6 +199,7 @@ func generate_geometry_for_face(faces :Dictionary, face :Vector3, o :int, scale
return faces return faces
# Returns the number of voxels wide the run starting at face is with respect to # Returns the number of voxels wide the run starting at face is with respect to
# the set of faces and orientation # the set of faces and orientation
func width_query(faces: Dictionary, face: Vector3, o: int) -> int: func width_query(faces: Dictionary, face: Vector3, o: int) -> int:
@ -215,6 +209,7 @@ func width_query(faces :Dictionary, face :Vector3, o :int) -> int:
v[wd] += 1.0 v[wd] += 1.0
return int(v[wd] - face[wd]) return int(v[wd] - face[wd])
# Returns the number of voxels high the run starting at face is with respect to # Returns the number of voxels high the run starting at face is with respect to
# the set of faces and orientation, with the given width # the set of faces and orientation, with the given width
func height_query(faces: Dictionary, face: Vector3, o: int, width: int) -> int: func height_query(faces: Dictionary, face: Vector3, o: int, width: int) -> int:

@ -1,5 +1,7 @@
# MagicaVoxel Importer with Extensions # MagicaVoxel Importer with Extensions
Imports MagicaVoxel .vox files as meshes. Supports most node extensions, allowing multiple models and complex scene graphs.
Imports MagicaVoxel .vox files as meshes. Supports most node extensions, allowing multiple models and complex scene
graphs.
This is an adaptation of vox-importer by JohnCWakley (https://github.com/JohnCWakley/vox-importer) This is an adaptation of vox-importer by JohnCWakley (https://github.com/JohnCWakley/vox-importer)
This is an adaptation of MagicaVoxelImporter by Scayze (https://github.com/scayze/MagicaVoxel-Importer) This is an adaptation of MagicaVoxelImporter by Scayze (https://github.com/scayze/MagicaVoxel-Importer)

@ -1,36 +1,48 @@
var file: FileAccess; var file: FileAccess;
var chunk_size = 0; var chunk_size = 0;
func _init(file: FileAccess): func _init(file: FileAccess):
self.file = file; self.file = file;
self.chunk_size = 0; self.chunk_size = 0;
func has_data_to_read(): return file.get_position() < file.get_length() func has_data_to_read(): return file.get_position() < file.get_length()
func set_chunk_size(size): func set_chunk_size(size):
chunk_size = size; chunk_size = size;
func get_8(): func get_8():
chunk_size -= 1; chunk_size -= 1;
return file.get_8(); return file.get_8();
func get_32(): func get_32():
chunk_size -= 4; chunk_size -= 4;
return file.get_32(); return file.get_32();
func get_buffer(length): func get_buffer(length):
chunk_size -= length; chunk_size -= length;
return file.get_buffer(length); return file.get_buffer(length);
func read_remaining(): func read_remaining():
get_buffer(chunk_size); get_buffer(chunk_size);
chunk_size = 0; chunk_size = 0;
func get_string(length): func get_string(length):
return get_buffer(length).get_string_from_ascii() return get_buffer(length).get_string_from_ascii()
func get_vox_string(): func get_vox_string():
var length = get_32(); var length = get_32();
return get_string(length); return get_string(length);
func get_vox_dict(): func get_vox_dict():
var result = {}; var result = {};
var pairs = get_32(); var pairs = get_32();

@ -1,5 +1,4 @@
const Model = preload("./Model.gd"); const Model = preload("./Model.gd");
var models = {0: Model.new()}; var models = {0: Model.new()};
var current_index = -1; var current_index = -1;
var colors: Array; var colors: Array;
@ -7,6 +6,7 @@ var nodes = {};
var materials = {}; var materials = {};
var layers = {}; var layers = {};
func get_model(): func get_model():
if (!models.has(current_index)): if (!models.has(current_index)):
models[current_index] = Model.new(); models[current_index] = Model.new();

@ -1,6 +1,7 @@
var id: int; var id: int;
var isVisible: bool; var isVisible: bool;
func _init(id, isVisible): func _init(id, isVisible):
self.id = id; self.id = id;
self.isVisible = isVisible; self.isVisible = isVisible;

@ -25,12 +25,15 @@ var refraction:
get: get:
return float(properties.get("ior")); return float(properties.get("ior"));
func _init(properties): func _init(properties):
self.properties = properties; self.properties = properties;
func is_glass(): func is_glass():
return self.type == "_glass"; return self.type == "_glass";
func get_material(color: Color): func get_material(color: Color):
if (material != null): return material; if (material != null): return material;

@ -5,6 +5,7 @@ var child_nodes = [];
var models = {}; var models = {};
var transforms = { 0: { "position": Vector3(), "rotation": Basis() } }; var transforms = { 0: { "position": Vector3(), "rotation": Basis() } };
func _init(id, attributes): func _init(id, attributes):
self.id = id; self.id = id;
self.attributes = attributes; self.attributes = attributes;

@ -2,11 +2,11 @@
extends MeshInstance3D extends MeshInstance3D
@export var frames: MeshLibrary = null: set = set_frames @export var frames: MeshLibrary = null: set = set_frames
@export var current_frame: int = 0: set = set_current_frame @export var current_frame: int = 0: set = set_current_frame
var mesh_count = 0; var mesh_count = 0;
func set_frames(v): func set_frames(v):
frames = v; frames = v;
current_frame = 0 current_frame = 0
@ -17,6 +17,7 @@ func set_frames(v):
mesh_count = v.get_item_list().size() mesh_count = v.get_item_list().size()
self.mesh = v.get_item_mesh(0) self.mesh = v.get_item_mesh(0)
func set_current_frame(v): func set_current_frame(v):
if v >= 0 and v < mesh_count: if v >= 0 and v < mesh_count:
current_frame = v current_frame = v

@ -4,6 +4,7 @@ extends EditorPlugin
var pluginToMesh var pluginToMesh
var pluginToMeshLibrary var pluginToMeshLibrary
func _enter_tree(): func _enter_tree():
pluginToMesh = preload('vox-importer-mesh.gd').new() pluginToMesh = preload('vox-importer-mesh.gd').new()
pluginToMeshLibrary = preload('vox-importer-meshLibrary.gd').new() pluginToMeshLibrary = preload('vox-importer-meshLibrary.gd').new()
@ -12,6 +13,7 @@ func _enter_tree():
add_custom_type("FramedMeshInstance", "MeshInstance3D", add_custom_type("FramedMeshInstance", "MeshInstance3D",
preload("framed_mesh_instance.gd"), preload("framed_mesh_instance.png")) preload("framed_mesh_instance.gd"), preload("framed_mesh_instance.png"))
func _exit_tree(): func _exit_tree():
remove_import_plugin(pluginToMesh) remove_import_plugin(pluginToMesh)
remove_import_plugin(pluginToMeshLibrary) remove_import_plugin(pluginToMeshLibrary)
@ -19,5 +21,6 @@ func _exit_tree():
pluginToMeshLibrary = null pluginToMeshLibrary = null
remove_custom_type("FramedMeshInstance") remove_custom_type("FramedMeshInstance")
func _get_priority() -> float: func _get_priority() -> float:
return 1.0 return 1.0

@ -1,4 +1,3 @@
const VoxFile = preload("./VoxFile.gd"); const VoxFile = preload("./VoxFile.gd");
const VoxData = preload("./VoxFormat/VoxData.gd"); const VoxData = preload("./VoxFormat/VoxData.gd");
const VoxNode = preload("./VoxFormat/VoxNode.gd"); const VoxNode = preload("./VoxFormat/VoxNode.gd");
@ -6,12 +5,11 @@ const VoxMaterial = preload("./VoxFormat/VoxMaterial.gd");
const VoxLayer = preload("./VoxFormat/VoxLayer.gd"); const VoxLayer = preload("./VoxFormat/VoxLayer.gd");
const CulledMeshGenerator = preload("./CulledMeshGenerator.gd"); const CulledMeshGenerator = preload("./CulledMeshGenerator.gd");
const GreedyMeshGenerator = preload("./GreedyMeshGenerator.gd"); const GreedyMeshGenerator = preload("./GreedyMeshGenerator.gd");
const debug_file = false; const debug_file = false;
const debug_models = false; const debug_models = false;
var fileKeyframeIds = []; var fileKeyframeIds = [];
func import(source_path, destination_path, options, _platforms, _gen_files): func import(source_path, destination_path, options, _platforms, _gen_files):
var scale = 0.1 var scale = 0.1
if options.Scale: if options.Scale:
@ -26,7 +24,6 @@ func import(source_path, destination_path, options, _platforms, _gen_files):
if options.has("FirstKeyframeOnly"): if options.has("FirstKeyframeOnly"):
mergeKeyframes = not bool(options.FirstKeyframeOnly) mergeKeyframes = not bool(options.FirstKeyframeOnly)
var file = FileAccess.open(source_path, FileAccess.READ) var file = FileAccess.open(source_path, FileAccess.READ)
if file == null: if file == null:
@ -54,10 +51,12 @@ func import(source_path, destination_path, options, _platforms, _gen_files):
meshes.append(CulledMeshGenerator.new().generate(vox, voxel_data[keyframeVoxels], scale, snaptoground)) meshes.append(CulledMeshGenerator.new().generate(vox, voxel_data[keyframeVoxels], scale, snaptoground))
return meshes return meshes
func string_to_vector3(input: String) -> Vector3: func string_to_vector3(input: String) -> Vector3:
var data = input.split_floats(' '); var data = input.split_floats(' ');
return Vector3(data[0], data[1], data[2]); return Vector3(data[0], data[1], data[2]);
func byte_to_basis(data: int): func byte_to_basis(data: int):
var x_ind = ((data >> 0) & 0x03); var x_ind = ((data >> 0) & 0x03);
var y_ind = ((data >> 2) & 0x03); var y_ind = ((data >> 2) & 0x03);
@ -82,6 +81,7 @@ func byte_to_basis(data: int):
result.z[2] = z_sign if z_ind == 2 else 0; result.z[2] = z_sign if z_ind == 2 else 0;
return result; return result;
func read_chunk(vox: VoxData, file: VoxFile): func read_chunk(vox: VoxData, file: VoxFile):
var chunk_id = file.get_string(4); var chunk_id = file.get_string(4);
var chunk_size = file.get_32(); var chunk_size = file.get_32();
@ -201,14 +201,17 @@ func read_chunk(vox: VoxData, file: VoxFile):
if debug_file: print(chunk_id); if debug_file: print(chunk_id);
file.read_remaining(); file.read_remaining();
func unify_voxels(vox: VoxData, mergeKeyframes: bool): func unify_voxels(vox: VoxData, mergeKeyframes: bool):
var node = vox.nodes[0]; var node = vox.nodes[0];
var layeredVoxelData = get_layeredVoxels(node, vox, -1, mergeKeyframes) var layeredVoxelData = get_layeredVoxels(node, vox, -1, mergeKeyframes)
return layeredVoxelData.getDataMergedFromLayers(); return layeredVoxelData.getDataMergedFromLayers();
class LayeredVoxelData: class LayeredVoxelData:
var data_keyframed_layered = {}; var data_keyframed_layered = {};
func combine(keyframeId, layerId, model): func combine(keyframeId, layerId, model):
# Make sure there's space # Make sure there's space
if not keyframeId in data_keyframed_layered: if not keyframeId in data_keyframed_layered:
@ -220,6 +223,7 @@ class LayeredVoxelData:
for voxel in model.voxels: for voxel in model.voxels:
data_keyframed_layered[keyframeId][layerId][voxel - offset] = model.voxels[voxel]; data_keyframed_layered[keyframeId][layerId][voxel - offset] = model.voxels[voxel];
func combine_data(other): func combine_data(other):
for keyframeId in other.data_keyframed_layered: for keyframeId in other.data_keyframed_layered:
if not keyframeId in data_keyframed_layered: if not keyframeId in data_keyframed_layered:
@ -231,6 +235,7 @@ class LayeredVoxelData:
data_keyframed_layered[keyframeId][layerId][voxel] = ( data_keyframed_layered[keyframeId][layerId][voxel] = (
other.data_keyframed_layered[keyframeId][layerId][voxel]); other.data_keyframed_layered[keyframeId][layerId][voxel]);
func transform(transforms): func transform(transforms):
var new_data = {}; var new_data = {};
for keyframeId in data_keyframed_layered: for keyframeId in data_keyframed_layered:
@ -247,6 +252,7 @@ class LayeredVoxelData:
data_keyframed_layered[keyframeId][layerId][voxel]); data_keyframed_layered[keyframeId][layerId][voxel]);
data_keyframed_layered = new_data; data_keyframed_layered = new_data;
func getDataMergedFromLayers(): func getDataMergedFromLayers():
# The result of this function # The result of this function
var result = {}; var result = {};
@ -261,6 +267,7 @@ class LayeredVoxelData:
# Return the merged data # Return the merged data
return result; return result;
static func get_input_for_keyframe(focusKeyframeId, inputCollection): static func get_input_for_keyframe(focusKeyframeId, inputCollection):
var inputKeyframeIds = inputCollection.keys(); var inputKeyframeIds = inputCollection.keys();
inputKeyframeIds.sort(); inputKeyframeIds.sort();

@ -3,36 +3,47 @@ extends EditorImportPlugin
const VoxImporterCommon = preload("./vox-importer-common.gd"); const VoxImporterCommon = preload("./vox-importer-common.gd");
func _init(): func _init():
print('MagicaVoxel Mesh Importer: Ready') print('MagicaVoxel Mesh Importer: Ready')
func _get_importer_name(): func _get_importer_name():
return 'MagicaVoxel.With.Extensions.To.Mesh' return 'MagicaVoxel.With.Extensions.To.Mesh'
func _get_visible_name(): func _get_visible_name():
return 'MagicaVoxel Mesh' return 'MagicaVoxel Mesh'
func _get_recognized_extensions(): func _get_recognized_extensions():
return [ 'vox' ] return [ 'vox' ]
func _get_resource_type(): func _get_resource_type():
return 'Mesh' return 'Mesh'
func _get_save_extension(): func _get_save_extension():
return 'mesh' return 'mesh'
func _get_preset_count(): func _get_preset_count():
return 0 return 0
func _get_preset_name(_preset): func _get_preset_name(_preset):
return 'Default' return 'Default'
func _get_import_order(): func _get_import_order():
return 0 return 0
func _get_priority() -> float: func _get_priority() -> float:
return 1.0 return 1.0
func _get_import_options(path, preset): func _get_import_options(path, preset):
return [ return [
{ {
@ -53,9 +64,11 @@ func _get_import_options(path, preset):
} }
] ]
func _get_option_visibility(path, option, options): func _get_option_visibility(path, option, options):
return true return true
func _import(source_path, destination_path, options, _platforms, _gen_files): func _import(source_path, destination_path, options, _platforms, _gen_files):
var meshes = VoxImporterCommon.new().import(source_path, destination_path, options, _platforms, _gen_files); var meshes = VoxImporterCommon.new().import(source_path, destination_path, options, _platforms, _gen_files);
var full_path = "%s.%s" % [ destination_path, _get_save_extension() ] var full_path = "%s.%s" % [ destination_path, _get_save_extension() ]

@ -3,36 +3,47 @@ extends EditorImportPlugin
const VoxImporterCommon = preload("./vox-importer-common.gd"); const VoxImporterCommon = preload("./vox-importer-common.gd");
func _init(): func _init():
print('MagicaVoxel MeshLibrary Importer: Ready') print('MagicaVoxel MeshLibrary Importer: Ready')
func _get_importer_name(): func _get_importer_name():
return 'MagicaVoxel.With.Extensions.To.MeshLibrary' return 'MagicaVoxel.With.Extensions.To.MeshLibrary'
func _get_visible_name(): func _get_visible_name():
return 'MagicaVoxel MeshLibrary' return 'MagicaVoxel MeshLibrary'
func _get_recognized_extensions(): func _get_recognized_extensions():
return [ 'vox' ] return [ 'vox' ]
func _get_resource_type(): func _get_resource_type():
return 'MeshLibrary' return 'MeshLibrary'
func _get_save_extension(): func _get_save_extension():
return 'meshlib' return 'meshlib'
func _get_preset_count(): func _get_preset_count():
return 0 return 0
func _get_preset_name(_preset): func _get_preset_name(_preset):
return 'Default' return 'Default'
func _get_import_order(): func _get_import_order():
return 0 return 0
func _get_priority() -> float: func _get_priority() -> float:
return 1.0 return 1.0
func _get_import_options(path, preset_index): func _get_import_options(path, preset_index):
return [ return [
{ {
@ -49,9 +60,11 @@ func _get_import_options(path, preset_index):
} }
] ]
func _get_option_visibility(path, option, options): func _get_option_visibility(path, option, options):
return true return true
func _import(source_path, destination_path, options, _platforms, _gen_files): func _import(source_path, destination_path, options, _platforms, _gen_files):
var meshes = VoxImporterCommon.new().import(source_path, destination_path, options, _platforms, _gen_files); var meshes = VoxImporterCommon.new().import(source_path, destination_path, options, _platforms, _gen_files);
var meshLib = MeshLibrary.new() var meshLib = MeshLibrary.new()

@ -1,10 +1,12 @@
## The blackboard is an object that can be used to store and access data between ## The blackboard is an object that can be used to store and access data between
## multiple nodes of the behavior tree. ## multiple nodes of the behavior tree.
@icon("icons/blackboard.svg") @icon("icons/blackboard.svg")
class_name Blackboard extends Node class_name Blackboard
extends Node
var blackboard: Dictionary = {} var blackboard: Dictionary = {}
func keys() -> Array[String]: func keys() -> Array[String]:
var keys: Array[String] var keys: Array[String]
keys.assign(blackboard.keys().duplicate()) keys.assign(blackboard.keys().duplicate())

@ -1,6 +1,5 @@
class_name BeehaveDebuggerMessages class_name BeehaveDebuggerMessages
static func can_send_message() -> bool: static func can_send_message() -> bool:
return not Engine.is_editor_hint() and OS.has_feature("editor") return not Engine.is_editor_hint() and OS.has_feature("editor")

@ -2,15 +2,12 @@
extends PanelContainer extends PanelContainer
signal make_floating() signal make_floating()
const BeehaveGraphEdit := preload("graph_edit.gd") const BeehaveGraphEdit := preload("graph_edit.gd")
const TREE_ICON := preload("../icons/tree.svg") const TREE_ICON := preload("../icons/tree.svg")
var container: HSplitContainer var container: HSplitContainer
var item_list: ItemList var item_list: ItemList
var graph: BeehaveGraphEdit var graph: BeehaveGraphEdit
var message: Label var message: Label
var active_trees: Dictionary var active_trees: Dictionary
var active_tree_id: int = -1 var active_tree_id: int = -1
var session: EditorDebuggerSession var session: EditorDebuggerSession

@ -5,7 +5,6 @@ const SUCCESS_COLOR := Color("#009944c8")
const NORMAL_COLOR := Color("#15181e") const NORMAL_COLOR := Color("#15181e")
const FAILURE_COLOR := Color("#cf000f80") const FAILURE_COLOR := Color("#cf000f80")
const RUNNING_COLOR := Color("#ffcc00c8") const RUNNING_COLOR := Color("#ffcc00c8")
var empty: StyleBoxEmpty var empty: StyleBoxEmpty
var normal: StyleBoxFlat var normal: StyleBoxFlat
var success: StyleBoxFlat var success: StyleBoxFlat

@ -2,18 +2,15 @@
extends GraphEdit extends GraphEdit
const BeehaveGraphNode := preload("graph_node.gd") const BeehaveGraphNode := preload("graph_node.gd")
const HORIZONTAL_LAYOUT_ICON := preload("icons/horizontal_layout.svg") const HORIZONTAL_LAYOUT_ICON := preload("icons/horizontal_layout.svg")
const VERTICAL_LAYOUT_ICON := preload("icons/vertical_layout.svg") const VERTICAL_LAYOUT_ICON := preload("icons/vertical_layout.svg")
const PROGRESS_SHIFT: int = 50 const PROGRESS_SHIFT: int = 50
const INACTIVE_COLOR: Color = Color("#898989aa") const INACTIVE_COLOR: Color = Color("#898989aa")
const ACTIVE_COLOR: Color = Color("#ffcc00c8") const ACTIVE_COLOR: Color = Color("#ffcc00c8")
const SUCCESS_COLOR: Color = Color("#009944c8") const SUCCESS_COLOR: Color = Color("#009944c8")
var updating_graph: bool = false var updating_graph: bool = false
var arraging_nodes: bool = false var arraging_nodes: bool = false
var beehave_tree: Dictionary: var beehave_tree: Dictionary:
set(value): set(value):
if beehave_tree == value: if beehave_tree == value:
@ -32,7 +29,6 @@ var horizontal_layout: bool = false:
_update_layout_button() _update_layout_button()
_update_graph() _update_graph()
var active_nodes: Array[String] var active_nodes: Array[String]
var progress: int = 0 var progress: int = 0
var layout_button: Button var layout_button: Button

@ -2,13 +2,11 @@
extends GraphNode extends GraphNode
const DEFAULT_COLOR := Color("#dad4cb") const DEFAULT_COLOR := Color("#dad4cb")
const PORT_TOP_ICON := preload("icons/port_top.svg") const PORT_TOP_ICON := preload("icons/port_top.svg")
const PORT_BOTTOM_ICON := preload("icons/port_bottom.svg") const PORT_BOTTOM_ICON := preload("icons/port_bottom.svg")
const PORT_LEFT_ICON := preload("icons/port_left.svg") const PORT_LEFT_ICON := preload("icons/port_left.svg")
const PORT_RIGHT_ICON := preload("icons/port_right.svg") const PORT_RIGHT_ICON := preload("icons/port_right.svg")
@export var title_text: String: @export var title_text: String:
set(value): set(value):
title_text = value title_text = value
@ -31,13 +29,11 @@ var layout_size: float:
get: get:
return size.y if horizontal else size.x return size.y if horizontal else size.x
var panel: PanelContainer var panel: PanelContainer
var icon_rect: TextureRect var icon_rect: TextureRect
var title_label: Label var title_label: Label
var container: VBoxContainer var container: VBoxContainer
var label: Label var label: Label
var frames: RefCounted = BeehaveUtils.get_frames() var frames: RefCounted = BeehaveUtils.get_frames()
var horizontal: bool = false var horizontal: bool = false

@ -1 +1,11 @@
<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg"><g fill="#e0e0e0" transform="matrix(0 -1 1 0 0 16)"><rect height="6" rx="1" stroke-width=".6" width="6" y="10"/><rect height="6" rx="1" stroke-width=".780723" width="6" x="5"/><rect height="6" rx="1" stroke-width=".780723" width="6" x="10" y="10"/><path d="m7 5h2v4h-2z" stroke-width=".768491"/><rect height="4" rx="1" ry="0" stroke-width=".768491" width="2" x="12" y="7"/><rect height="5" rx="1" stroke-width=".859" width="2" x="2" y="7"/><path d="m3 7h10v2h-10z" stroke-width="1.09113"/></g></svg> <svg height="16" width="16" xmlns="http://www.w3.org/2000/svg">
<g fill="#e0e0e0" transform="matrix(0 -1 1 0 0 16)">
<rect height="6" rx="1" stroke-width=".6" width="6" y="10"/>
<rect height="6" rx="1" stroke-width=".780723" width="6" x="5"/>
<rect height="6" rx="1" stroke-width=".780723" width="6" x="10" y="10"/>
<path d="m7 5h2v4h-2z" stroke-width=".768491"/>
<rect height="4" rx="1" ry="0" stroke-width=".768491" width="2" x="12" y="7"/>
<rect height="5" rx="1" stroke-width=".859" width="2" x="2" y="7"/>
<path d="m3 7h10v2h-10z" stroke-width="1.09113"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 562 B

After

Width:  |  Height:  |  Size: 636 B

@ -1 +1,4 @@
<svg height="10" viewBox="0 0 10 10" width="10" xmlns="http://www.w3.org/2000/svg"><path d="m10 4a5 5 0 0 1 -2.5000001 4.3301271 5 5 0 0 1 -5-.0000002 5 5 0 0 1 -2.4999999-4.3301269" fill="#fff" fill-rule="evenodd"/></svg> <svg height="10" viewBox="0 0 10 10" width="10" xmlns="http://www.w3.org/2000/svg">
<path d="m10 4a5 5 0 0 1 -2.5000001 4.3301271 5 5 0 0 1 -5-.0000002 5 5 0 0 1 -2.4999999-4.3301269" fill="#fff"
fill-rule="evenodd"/>
</svg>

Before

Width:  |  Height:  |  Size: 222 B

After

Width:  |  Height:  |  Size: 238 B

@ -1 +1,4 @@
<svg height="10" viewBox="0 0 10 10" width="10" xmlns="http://www.w3.org/2000/svg"><path d="m5 0a5 5 0 0 0 -4.33012712 2.5000001 5 5 0 0 0 .0000002 5 5 5 0 0 0 4.33012692 2.4999999" fill="#fff" fill-rule="evenodd"/></svg> <svg height="10" viewBox="0 0 10 10" width="10" xmlns="http://www.w3.org/2000/svg">
<path d="m5 0a5 5 0 0 0 -4.33012712 2.5000001 5 5 0 0 0 .0000002 5 5 5 0 0 0 4.33012692 2.4999999" fill="#fff"
fill-rule="evenodd"/>
</svg>

Before

Width:  |  Height:  |  Size: 221 B

After

Width:  |  Height:  |  Size: 237 B

@ -1 +1,4 @@
<svg height="10" viewBox="0 0 10 10" width="10" xmlns="http://www.w3.org/2000/svg"><path d="m4.5 10a5 5 0 0 0 4.3301271-2.5000002 5 5 0 0 0 -.0000002-4.9999999 5 5 0 0 0 -4.3301269-2.4999999" fill="#fff" fill-rule="evenodd"/></svg> <svg height="10" viewBox="0 0 10 10" width="10" xmlns="http://www.w3.org/2000/svg">
<path d="m4.5 10a5 5 0 0 0 4.3301271-2.5000002 5 5 0 0 0 -.0000002-4.9999999 5 5 0 0 0 -4.3301269-2.4999999"
fill="#fff" fill-rule="evenodd"/>
</svg>

Before

Width:  |  Height:  |  Size: 231 B

After

Width:  |  Height:  |  Size: 247 B

@ -1 +1,4 @@
<svg height="10" viewBox="0 0 10 10" width="10" xmlns="http://www.w3.org/2000/svg"><path d="m10-6a5 5 0 0 1 -2.5000001 4.3301271 5 5 0 0 1 -5-.0000002 5 5 0 0 1 -2.4999999-4.3301269" fill="#fff" fill-rule="evenodd" transform="scale(1 -1)"/></svg> <svg height="10" viewBox="0 0 10 10" width="10" xmlns="http://www.w3.org/2000/svg">
<path d="m10-6a5 5 0 0 1 -2.5000001 4.3301271 5 5 0 0 1 -5-.0000002 5 5 0 0 1 -2.4999999-4.3301269" fill="#fff"
fill-rule="evenodd" transform="scale(1 -1)"/>
</svg>

Before

Width:  |  Height:  |  Size: 246 B

After

Width:  |  Height:  |  Size: 262 B

@ -1 +1,11 @@
<svg height="16" width="16" xmlns="http://www.w3.org/2000/svg"><g fill="#e0e0e0"><rect height="6" rx="1" stroke-width=".6" width="6" y="10"/><rect height="6" rx="1" stroke-width=".780723" width="6" x="5"/><rect height="6" rx="1" stroke-width=".780723" width="6" x="10" y="10"/><path d="m7 5h2v4h-2z" stroke-width=".768491"/><rect height="4" rx="1" ry="0" stroke-width=".768491" width="2" x="12" y="7"/><rect height="5" rx="1" stroke-width=".859" width="2" x="2" y="7"/><path d="m3 7h10v2h-10z" stroke-width="1.09113"/></g></svg> <svg height="16" width="16" xmlns="http://www.w3.org/2000/svg">
<g fill="#e0e0e0">
<rect height="6" rx="1" stroke-width=".6" width="6" y="10"/>
<rect height="6" rx="1" stroke-width=".780723" width="6" x="5"/>
<rect height="6" rx="1" stroke-width=".780723" width="6" x="10" y="10"/>
<path d="m7 5h2v4h-2z" stroke-width=".768491"/>
<rect height="4" rx="1" ry="0" stroke-width=".768491" width="2" x="12" y="7"/>
<rect height="5" rx="1" stroke-width=".859" width="2" x="2" y="7"/>
<path d="m3 7h10v2h-10z" stroke-width="1.09113"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 528 B

After

Width:  |  Height:  |  Size: 602 B

@ -5,13 +5,11 @@ extends RefCounted
const SIBLING_DISTANCE: float = 20.0 const SIBLING_DISTANCE: float = 20.0
const LEVEL_DISTANCE: float = 40.0 const LEVEL_DISTANCE: float = 40.0
var x: float var x: float
var y: float var y: float
var mod: float var mod: float
var parent: TreeNode var parent: TreeNode
var children: Array[TreeNode] var children: Array[TreeNode]
var item: GraphNode var item: GraphNode

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.5 KiB

@ -11,7 +11,8 @@
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"><defs xmlns:svg="http://www.w3.org/2000/svg"><defs
id="defs5041" /><sodipodi:namedview id="defs5041" />
<sodipodi:namedview
id="namedview5039" id="namedview5039"
pagecolor="#ffffff" pagecolor="#ffffff"
bordercolor="#000000" bordercolor="#000000"
@ -29,16 +30,19 @@
inkscape:window-x="-9" inkscape:window-x="-9"
inkscape:window-y="-9" inkscape:window-y="-9"
inkscape:window-maximized="1" inkscape:window-maximized="1"
inkscape:current-layer="svg5037" /><path inkscape:current-layer="svg5037"/>
<path
style="fill:#40d29f;fill-opacity:1;color:#000000;stroke-width:1.7354;-inkscape-stroke:none;paint-order:markers stroke fill" style="fill:#40d29f;fill-opacity:1;color:#000000;stroke-width:1.7354;-inkscape-stroke:none;paint-order:markers stroke fill"
d="m 15.63424,18.518399 q -0.218955,0 -0.373746,-0.150649 -0.155154,-0.150651 -0.155154,-0.363746 v -1.161448 l -0.860595,0.49993 q -0.196481,0.103026 -0.400572,0.05152 -0.20373,-0.05152 -0.309582,-0.227915 l -0.181253,-0.308712 q -0.105496,-0.183813 -0.05655,-0.385972 0.04894,-0.202159 0.237805,-0.312236 l 0.868569,-0.492527 -0.883432,-0.485112 q -0.188867,-0.110433 -0.241793,-0.312236 -0.05292,-0.202161 0.05292,-0.385974 l 0.196116,-0.301299 q 0.113465,-0.183814 0.321183,-0.238852 0.207716,-0.05539 0.388971,0.05504 l 0.868208,0.492523 v -1.161448 q 0,-0.213096 0.155154,-0.363747 0.154791,-0.150648 0.373746,-0.150648 h 0.347283 q 0.218955,0 0.373747,0.150648 0.155152,0.150651 0.155152,0.363747 v 1.161448 l 0.868209,-0.499931 q 0.188867,-0.103026 0.388973,-0.04763 0.200104,0.05504 0.313568,0.224034 l 0.211343,0.323526 q 0.113466,0.183813 0.05655,0.38562 -0.05655,0.20216 -0.253031,0.312589 l -0.87582,0.477704 0.86857,0.492521 q 0.181255,0.09561 0.245418,0.304826 0.06416,0.209569 -0.0493,0.385974 l -0.196119,0.316117 q -0.113464,0.176404 -0.313569,0.235323 -0.200105,0.05857 -0.388972,-0.05151 l -0.875822,-0.50734 v 1.161449 q 0,0.213096 -0.155152,0.363745 -0.154792,0.15065 -0.373747,0.15065 z" d="m 15.63424,18.518399 q -0.218955,0 -0.373746,-0.150649 -0.155154,-0.150651 -0.155154,-0.363746 v -1.161448 l -0.860595,0.49993 q -0.196481,0.103026 -0.400572,0.05152 -0.20373,-0.05152 -0.309582,-0.227915 l -0.181253,-0.308712 q -0.105496,-0.183813 -0.05655,-0.385972 0.04894,-0.202159 0.237805,-0.312236 l 0.868569,-0.492527 -0.883432,-0.485112 q -0.188867,-0.110433 -0.241793,-0.312236 -0.05292,-0.202161 0.05292,-0.385974 l 0.196116,-0.301299 q 0.113465,-0.183814 0.321183,-0.238852 0.207716,-0.05539 0.388971,0.05504 l 0.868208,0.492523 v -1.161448 q 0,-0.213096 0.155154,-0.363747 0.154791,-0.150648 0.373746,-0.150648 h 0.347283 q 0.218955,0 0.373747,0.150648 0.155152,0.150651 0.155152,0.363747 v 1.161448 l 0.868209,-0.499931 q 0.188867,-0.103026 0.388973,-0.04763 0.200104,0.05504 0.313568,0.224034 l 0.211343,0.323526 q 0.113466,0.183813 0.05655,0.38562 -0.05655,0.20216 -0.253031,0.312589 l -0.87582,0.477704 0.86857,0.492521 q 0.181255,0.09561 0.245418,0.304826 0.06416,0.209569 -0.0493,0.385974 l -0.196119,0.316117 q -0.113464,0.176404 -0.313569,0.235323 -0.200105,0.05857 -0.388972,-0.05151 l -0.875822,-0.50734 v 1.161449 q 0,0.213096 -0.155152,0.363745 -0.154792,0.15065 -0.373747,0.15065 z"
id="path5291" id="path5291"
transform="matrix(1.2719165,0,0,1.2110461,-6.1455464,-7.8832739)" transform="matrix(1.2719165,0,0,1.2110461,-6.1455464,-7.8832739)"
inkscape:label="asterisk" /><path inkscape:label="asterisk"/>
<path
style="fill:#40d29f;fill-opacity:1" style="fill:#40d29f;fill-opacity:1"
d="M 12.041,5.958 Q 11.25,5.958 10.708,5.416 10.166,4.874 10.166,4.083 V 1.874 q 0,-0.77 0.542,-1.322 Q 11.25,0 12.041,0 h 3.875 q 0.771,0 1.323,0.552 0.552,0.552 0.552,1.322 v 2.209 q 0,0.791 -0.552,1.333 -0.552,0.542 -1.323,0.542 z m 0,-1.875 h 3.875 V 1.874 h -3.875 z" d="M 12.041,5.958 Q 11.25,5.958 10.708,5.416 10.166,4.874 10.166,4.083 V 1.874 q 0,-0.77 0.542,-1.322 Q 11.25,0 12.041,0 h 3.875 q 0.771,0 1.323,0.552 0.552,0.552 0.552,1.322 v 2.209 q 0,0.791 -0.552,1.333 -0.552,0.542 -1.323,0.542 z m 0,-1.875 h 3.875 V 1.874 h -3.875 z"
id="path923" id="path923"
inkscape:label="square" /><path inkscape:label="square"/>
<path
style="fill:#40d29f;fill-opacity:1" style="fill:#40d29f;fill-opacity:1"
d="M 4.52,13.645 Q 4.25,13.374 4.25,13 4.25,12.624 4.5,12.354 L 5.208,11.666 Q 2.979,11.395 1.489,9.802 0,8.208 0,5.895 0,3.437 1.718,1.718 3.437,0 5.895,0 H 7.562 Q 7.916,0 8.187,0.27 8.458,0.541 8.458,0.895 8.458,1.27 8.187,1.541 7.916,1.812 7.562,1.812 H 5.895 Q 4.187,1.812 3,3 1.812,4.187 1.812,5.895 1.812,7.437 2.76,8.52 3.708,9.604 5.187,9.916 L 4.5,9.229 Q 4.229,8.937 4.239,8.583 4.25,8.229 4.52,7.958 4.77,7.687 5.145,7.687 q 0.375,0 0.646,0.271 l 2.167,2.187 q 0.125,0.125 0.208,0.302 0.084,0.177 0.084,0.365 0,0.167 -0.084,0.344 -0.083,0.177 -0.208,0.323 L 5.75,13.645 Q 5.479,13.916 5.124,13.906 4.77,13.895 4.52,13.645 Z" d="M 4.52,13.645 Q 4.25,13.374 4.25,13 4.25,12.624 4.5,12.354 L 5.208,11.666 Q 2.979,11.395 1.489,9.802 0,8.208 0,5.895 0,3.437 1.718,1.718 3.437,0 5.895,0 H 7.562 Q 7.916,0 8.187,0.27 8.458,0.541 8.458,0.895 8.458,1.27 8.187,1.541 7.916,1.812 7.562,1.812 H 5.895 Q 4.187,1.812 3,3 1.812,4.187 1.812,5.895 1.812,7.437 2.76,8.52 3.708,9.604 5.187,9.916 L 4.5,9.229 Q 4.229,8.937 4.239,8.583 4.25,8.229 4.52,7.958 4.77,7.687 5.145,7.687 q 0.375,0 0.646,0.271 l 2.167,2.187 q 0.125,0.125 0.208,0.302 0.084,0.177 0.084,0.365 0,0.167 -0.084,0.344 -0.083,0.177 -0.208,0.323 L 5.75,13.645 Q 5.479,13.916 5.124,13.906 4.77,13.895 4.52,13.645 Z"
id="path5035" id="path5035"

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

@ -25,7 +25,8 @@
lpeversion="0" lpeversion="0"
join="true" join="true"
close="true" close="true"
autoreverse="true" /></defs><sodipodi:namedview autoreverse="true"/></defs>
<sodipodi:namedview
id="namedview5896" id="namedview5896"
pagecolor="#ffffff" pagecolor="#ffffff"
bordercolor="#000000" bordercolor="#000000"
@ -43,18 +44,21 @@
inkscape:window-x="-9" inkscape:window-x="-9"
inkscape:window-y="-9" inkscape:window-y="-9"
inkscape:window-maximized="1" inkscape:window-maximized="1"
inkscape:current-layer="svg5894" /><path inkscape:current-layer="svg5894"/>
<path
d="M 0,0" d="M 0,0"
id="path3722" id="path3722"
class="UnoptimicedTransforms" class="UnoptimicedTransforms"
inkscape:original-d="M 0,0" inkscape:original-d="M 0,0"
inkscape:path-effect="#path-effect3720" inkscape:path-effect="#path-effect3720"
transform="translate(-1.7285156,-3.375)" /><path transform="translate(-1.7285156,-3.375)"/>
<path
id="path5892" id="path5892"
style="fill:#40d29f;fill-opacity:1" style="fill:#40d29f;fill-opacity:1"
class="UnoptimicedTransforms" class="UnoptimicedTransforms"
d="m 3.4375,3.375 c -0.4726662,0 -0.8756514,0.166667 -1.2089844,0.5 -0.333333,0.333333 -0.5,0.7350317 -0.5,1.2070312 0,0.4859996 0.166667,0.8940368 0.5,1.2207032 0.333333,0.3266663 0.7363182,0.4902344 1.2089844,0.4902344 0.4719995,-10e-8 0.8756514,-0.1635681 1.2089844,-0.4902344 0.333333,-0.3266664 0.5,-0.7272192 0.5,-1.1992188 0,-0.4859995 -0.166667,-0.8951826 -0.5,-1.2285156 C 4.3131514,3.541667 3.9094995,3.375 3.4375,3.375 Z M 8.0429688,3.7929688 C 7.7096358,3.7929687 7.4104841,3.9235003 7.1464844,4.1875 6.8824846,4.4508331 6.75,4.7486983 6.75,5.0820312 6.75,5.4293642 6.8824846,5.7360003 7.1464844,6 7.4104841,6.2639997 7.7096358,6.3964844 8.0429688,6.3964844 H 17.021484 C 17.354817,6.3964844 17.653969,6.2639997 17.917969,6 18.181302,5.7360003 18.3125,5.4293642 18.3125,5.0820312 18.3125,4.7486983 18.181302,4.4508331 17.917969,4.1875 17.653969,3.9235003 17.354817,3.7929688 17.021484,3.7929688 Z M 3.4375,8.2714844 c -0.4726662,0 -0.8756514,0.166667 -1.2089844,0.5 -0.333333,0.333333 -0.5,0.7350317 -0.5,1.2070312 0,0.4859994 0.166667,0.8920834 0.5,1.2187504 0.333333,0.326666 0.7363182,0.490234 1.2089844,0.490234 0.4719995,0 0.8756514,-0.163568 1.2089844,-0.490234 0.333333,-0.326667 0.5,-0.725266 0.5,-1.197266 0,-0.4859995 -0.166667,-0.8951826 -0.5,-1.2285156 -0.333333,-0.333333 -0.7369849,-0.5 -1.2089844,-0.5 z M 8.0429688,8.6875 c -0.333333,0 -0.6324847,0.1311982 -0.8964844,0.3945312 C 6.8824846,9.346031 6.75,9.6451826 6.75,9.9785156 c 0,0.3473334 0.1324846,0.6539694 0.3964844,0.9179684 0.2639997,0.264 0.5631514,0.396485 0.8964844,0.396485 H 12.582031 C 12.667811,11.029759 12.810428,10.78417 13,10.615234 c 0.314158,-0.280616 0.764135,-0.439453 1.171875,-0.439453 h 0.46875 c 0.407741,0 0.855765,0.158985 1.169922,0.439453 0.189414,0.168797 0.331535,0.414214 0.416015,0.677735 h 0.794922 c 0.333333,0 0.632485,-0.132485 0.896485,-0.396485 0.263333,-0.263999 0.394531,-0.570635 0.394531,-0.9179684 0,-0.333333 -0.131198,-0.6324846 -0.394531,-0.8964844 C 17.653969,8.8186982 17.354817,8.6875 17.021484,8.6875 Z M 3.4375,13.146484 c -0.4726662,0 -0.8756514,0.166667 -1.2089844,0.5 -0.333333,0.333333 -0.5,0.735032 -0.5,1.207032 0,0.485999 0.166667,0.892083 0.5,1.21875 0.333333,0.325999 0.7363182,0.490234 1.2089844,0.490234 0.4719995,0 0.8756514,-0.164235 1.2089844,-0.490234 0.333333,-0.326667 0.5,-0.725266 0.5,-1.197266 0,-0.486 -0.166667,-0.895183 -0.5,-1.228516 -0.333333,-0.333333 -0.7369849,-0.5 -1.2089844,-0.5 z M 8.0429688,13.5625 c -0.333333,0 -0.6324847,0.130532 -0.8964844,0.394531 C 6.8824846,14.221031 6.75,14.520183 6.75,14.853516 c 0,0.347333 0.1324846,0.653969 0.3964844,0.917968 0.2639997,0.264 0.5631514,0.396485 0.8964844,0.396485 H 10.03125 C 9.985538,15.92966 9.986027,15.678358 10.04492,15.455078 10.12589,15.148084 10.389523,14.941651 10.626951,14.732422 10.380403,14.52554 10.114609,14.310259 10.025389,13.998047 9.986266,13.860916 9.972079,13.712745 9.974607,13.5625 Z m 10.2500002,1.083984 c -0.03323,0.02743 -0.06681,0.05476 -0.09961,0.08203 0.03855,0.03356 0.07792,0.06815 0.117188,0.101562 -0.0012,-0.06277 -0.007,-0.123307 -0.01758,-0.183594 z" d="m 3.4375,3.375 c -0.4726662,0 -0.8756514,0.166667 -1.2089844,0.5 -0.333333,0.333333 -0.5,0.7350317 -0.5,1.2070312 0,0.4859996 0.166667,0.8940368 0.5,1.2207032 0.333333,0.3266663 0.7363182,0.4902344 1.2089844,0.4902344 0.4719995,-10e-8 0.8756514,-0.1635681 1.2089844,-0.4902344 0.333333,-0.3266664 0.5,-0.7272192 0.5,-1.1992188 0,-0.4859995 -0.166667,-0.8951826 -0.5,-1.2285156 C 4.3131514,3.541667 3.9094995,3.375 3.4375,3.375 Z M 8.0429688,3.7929688 C 7.7096358,3.7929687 7.4104841,3.9235003 7.1464844,4.1875 6.8824846,4.4508331 6.75,4.7486983 6.75,5.0820312 6.75,5.4293642 6.8824846,5.7360003 7.1464844,6 7.4104841,6.2639997 7.7096358,6.3964844 8.0429688,6.3964844 H 17.021484 C 17.354817,6.3964844 17.653969,6.2639997 17.917969,6 18.181302,5.7360003 18.3125,5.4293642 18.3125,5.0820312 18.3125,4.7486983 18.181302,4.4508331 17.917969,4.1875 17.653969,3.9235003 17.354817,3.7929688 17.021484,3.7929688 Z M 3.4375,8.2714844 c -0.4726662,0 -0.8756514,0.166667 -1.2089844,0.5 -0.333333,0.333333 -0.5,0.7350317 -0.5,1.2070312 0,0.4859994 0.166667,0.8920834 0.5,1.2187504 0.333333,0.326666 0.7363182,0.490234 1.2089844,0.490234 0.4719995,0 0.8756514,-0.163568 1.2089844,-0.490234 0.333333,-0.326667 0.5,-0.725266 0.5,-1.197266 0,-0.4859995 -0.166667,-0.8951826 -0.5,-1.2285156 -0.333333,-0.333333 -0.7369849,-0.5 -1.2089844,-0.5 z M 8.0429688,8.6875 c -0.333333,0 -0.6324847,0.1311982 -0.8964844,0.3945312 C 6.8824846,9.346031 6.75,9.6451826 6.75,9.9785156 c 0,0.3473334 0.1324846,0.6539694 0.3964844,0.9179684 0.2639997,0.264 0.5631514,0.396485 0.8964844,0.396485 H 12.582031 C 12.667811,11.029759 12.810428,10.78417 13,10.615234 c 0.314158,-0.280616 0.764135,-0.439453 1.171875,-0.439453 h 0.46875 c 0.407741,0 0.855765,0.158985 1.169922,0.439453 0.189414,0.168797 0.331535,0.414214 0.416015,0.677735 h 0.794922 c 0.333333,0 0.632485,-0.132485 0.896485,-0.396485 0.263333,-0.263999 0.394531,-0.570635 0.394531,-0.9179684 0,-0.333333 -0.131198,-0.6324846 -0.394531,-0.8964844 C 17.653969,8.8186982 17.354817,8.6875 17.021484,8.6875 Z M 3.4375,13.146484 c -0.4726662,0 -0.8756514,0.166667 -1.2089844,0.5 -0.333333,0.333333 -0.5,0.735032 -0.5,1.207032 0,0.485999 0.166667,0.892083 0.5,1.21875 0.333333,0.325999 0.7363182,0.490234 1.2089844,0.490234 0.4719995,0 0.8756514,-0.164235 1.2089844,-0.490234 0.333333,-0.326667 0.5,-0.725266 0.5,-1.197266 0,-0.486 -0.166667,-0.895183 -0.5,-1.228516 -0.333333,-0.333333 -0.7369849,-0.5 -1.2089844,-0.5 z M 8.0429688,13.5625 c -0.333333,0 -0.6324847,0.130532 -0.8964844,0.394531 C 6.8824846,14.221031 6.75,14.520183 6.75,14.853516 c 0,0.347333 0.1324846,0.653969 0.3964844,0.917968 0.2639997,0.264 0.5631514,0.396485 0.8964844,0.396485 H 10.03125 C 9.985538,15.92966 9.986027,15.678358 10.04492,15.455078 10.12589,15.148084 10.389523,14.941651 10.626951,14.732422 10.380403,14.52554 10.114609,14.310259 10.025389,13.998047 9.986266,13.860916 9.972079,13.712745 9.974607,13.5625 Z m 10.2500002,1.083984 c -0.03323,0.02743 -0.06681,0.05476 -0.09961,0.08203 0.03855,0.03356 0.07792,0.06815 0.117188,0.101562 -0.0012,-0.06277 -0.007,-0.123307 -0.01758,-0.183594 z"
transform="translate(-1.7285156,-3.375)" /><path transform="translate(-1.7285156,-3.375)"/>
<path
style="color:#000000;fill:#40d29f;stroke-width:2;paint-order:stroke markers fill;fill-opacity:1" style="color:#000000;fill:#40d29f;stroke-width:2;paint-order:stroke markers fill;fill-opacity:1"
d="m 12.442996,14.874619 q -0.295876,0 -0.505045,-0.186837 -0.209662,-0.186838 -0.209662,-0.451125 v -1.440446 l -1.16293,0.620023 q -0.265504,0.127774 -0.541296,0.06389 -0.2753016,-0.06389 -0.4183406,-0.282664 l -0.244932,-0.382867 q -0.142553,-0.227969 -0.07642,-0.47869 0.06613,-0.250722 0.321348,-0.387241 L 10.779424,11.33783 9.5856344,10.736185 q -0.255217,-0.136961 -0.326737,-0.38724 -0.07153,-0.250722 0.07153,-0.478691 l 0.265013,-0.373676 q 0.153328,-0.227967 0.4340186,-0.296228 0.28069,-0.0687 0.52562,0.06827 l 1.173216,0.610833 V 8.439007 q 0,-0.264287 0.209662,-0.451125 0.209169,-0.186837 0.505047,-0.186837 h 0.469287 q 0.295874,0 0.505047,0.186837 0.209659,0.186838 0.209659,0.451125 v 1.440446 l 1.173216,-0.620024 q 0.255218,-0.127774 0.525622,-0.05908 0.270404,0.06827 0.423731,0.277851 l 0.285589,0.401242 q 0.153327,0.227969 0.07642,0.478254 -0.07642,0.25072 -0.341923,0.387677 l -1.183505,0.592455 1.173707,0.610833 q 0.24493,0.118573 0.331635,0.378052 0.08671,0.259911 -0.06662,0.478692 l -0.265012,0.392052 q -0.153326,0.21878 -0.423729,0.291853 -0.270405,0.07263 -0.525621,-0.06389 l -1.183504,-0.629204 v 1.440446 q 0,0.264286 -0.20966,0.451125 -0.209172,0.186837 -0.505048,0.186837 z" d="m 12.442996,14.874619 q -0.295876,0 -0.505045,-0.186837 -0.209662,-0.186838 -0.209662,-0.451125 v -1.440446 l -1.16293,0.620023 q -0.265504,0.127774 -0.541296,0.06389 -0.2753016,-0.06389 -0.4183406,-0.282664 l -0.244932,-0.382867 q -0.142553,-0.227969 -0.07642,-0.47869 0.06613,-0.250722 0.321348,-0.387241 L 10.779424,11.33783 9.5856344,10.736185 q -0.255217,-0.136961 -0.326737,-0.38724 -0.07153,-0.250722 0.07153,-0.478691 l 0.265013,-0.373676 q 0.153328,-0.227967 0.4340186,-0.296228 0.28069,-0.0687 0.52562,0.06827 l 1.173216,0.610833 V 8.439007 q 0,-0.264287 0.209662,-0.451125 0.209169,-0.186837 0.505047,-0.186837 h 0.469287 q 0.295874,0 0.505047,0.186837 0.209659,0.186838 0.209659,0.451125 v 1.440446 l 1.173216,-0.620024 q 0.255218,-0.127774 0.525622,-0.05908 0.270404,0.06827 0.423731,0.277851 l 0.285589,0.401242 q 0.153327,0.227969 0.07642,0.478254 -0.07642,0.25072 -0.341923,0.387677 l -1.183505,0.592455 1.173707,0.610833 q 0.24493,0.118573 0.331635,0.378052 0.08671,0.259911 -0.06662,0.478692 l -0.265012,0.392052 q -0.153326,0.21878 -0.423729,0.291853 -0.270405,0.07263 -0.525621,-0.06389 l -1.183504,-0.629204 v 1.440446 q 0,0.264286 -0.20966,0.451125 -0.209172,0.186837 -0.505048,0.186837 z"
id="path6912"/></svg> id="path6912"/></svg>

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

@ -1,7 +1,8 @@
## A node in the behavior tree. Every node must return `SUCCESS`, `FAILURE` or ## A node in the behavior tree. Every node must return `SUCCESS`, `FAILURE` or
## `RUNNING` when ticked. ## `RUNNING` when ticked.
@tool @tool
class_name BeehaveNode extends Node class_name BeehaveNode
extends Node
enum { enum {
SUCCESS, SUCCESS,

@ -1,14 +1,14 @@
## Controls the flow of execution of the entire behavior tree. ## Controls the flow of execution of the entire behavior tree.
@tool @tool
@icon("../icons/tree.svg") @icon("../icons/tree.svg")
class_name BeehaveTree extends Node class_name BeehaveTree
extends Node
enum { enum {
SUCCESS, SUCCESS,
FAILURE, FAILURE,
RUNNING RUNNING
} }
signal tree_enabled signal tree_enabled
signal tree_disabled signal tree_disabled
@ -63,12 +63,12 @@ signal tree_disabled
var actor: Node var actor: Node
var status: int = -1 var status: int = -1
var _internal_blackboard: Blackboard var _internal_blackboard: Blackboard
var _process_time_metric_name: String var _process_time_metric_name: String
var _process_time_metric_value: float = 0.0 var _process_time_metric_value: float = 0.0
var _can_send_message: bool = false var _can_send_message: bool = false
func init() -> void: func init() -> void:
if Engine.is_editor_hint(): if Engine.is_editor_hint():
return return
@ -174,6 +174,7 @@ func get_last_condition_status() -> String:
return "RUNNING" return "RUNNING"
return "" return ""
## interrupts this tree if anything was running ## interrupts this tree if anything was running
func interrupt() -> void: func interrupt() -> void:
if self.get_child_count() != 0: if self.get_child_count() != 0:

@ -1,8 +1,8 @@
## A Composite node controls the flow of execution of its children in a specific manner. ## A Composite node controls the flow of execution of its children in a specific manner.
@tool @tool
@icon("../../icons/category_composite.svg") @icon("../../icons/category_composite.svg")
class_name Composite extends BeehaveNode class_name Composite
extends BeehaveNode
var running_child: BeehaveNode = null var running_child: BeehaveNode = null

@ -1,5 +1,6 @@
@tool @tool
class_name RandomizedComposite extends Composite class_name RandomizedComposite
extends Composite
const WEIGHTS_PREFIX = "Weights/" const WEIGHTS_PREFIX = "Weights/"

@ -4,8 +4,8 @@
## If a child returns `RUNNING` it will tick again. ## If a child returns `RUNNING` it will tick again.
@tool @tool
@icon("../../icons/selector.svg") @icon("../../icons/selector.svg")
class_name SelectorComposite extends Composite class_name SelectorComposite
extends Composite
var last_execution_index: int = 0 var last_execution_index: int = 0

@ -3,12 +3,14 @@
## will be executed in a random order. ## will be executed in a random order.
@tool @tool
@icon("../../icons/selector_random.svg") @icon("../../icons/selector_random.svg")
class_name SelectorRandomComposite extends RandomizedComposite class_name SelectorRandomComposite
extends RandomizedComposite
## A shuffled list of the children that will be executed in reverse order. ## A shuffled list of the children that will be executed in reverse order.
var _children_bag: Array[Node] = [] var _children_bag: Array[Node] = []
var c: Node var c: Node
func _ready() -> void: func _ready() -> void:
super() super()
if random_seed == 0: if random_seed == 0:

@ -4,7 +4,8 @@
## If a child returns `RUNNING` it will restart. ## If a child returns `RUNNING` it will restart.
@tool @tool
@icon("../../icons/selector_reactive.svg") @icon("../../icons/selector_reactive.svg")
class_name SelectorReactiveComposite extends Composite class_name SelectorReactiveComposite
extends Composite
func tick(actor: Node, blackboard: Blackboard) -> int: func tick(actor: Node, blackboard: Blackboard) -> int:
for c in get_children(): for c in get_children():

@ -5,8 +5,8 @@
## In case a child returns `RUNNING` this node will tick again. ## In case a child returns `RUNNING` this node will tick again.
@tool @tool
@icon("../../icons/sequence.svg") @icon("../../icons/sequence.svg")
class_name SequenceComposite extends Composite class_name SequenceComposite
extends Composite
var successful_index: int = 0 var successful_index: int = 0

@ -3,11 +3,11 @@
## will be executed in a random order. ## will be executed in a random order.
@tool @tool
@icon("../../icons/sequence_random.svg") @icon("../../icons/sequence_random.svg")
class_name SequenceRandomComposite extends RandomizedComposite class_name SequenceRandomComposite
extends RandomizedComposite
# Emitted whenever the children are shuffled. # Emitted whenever the children are shuffled.
signal reset(new_order: Array[Node]) signal reset(new_order: Array[Node])
## Whether the sequence should start where it left off after a previous failure. ## Whether the sequence should start where it left off after a previous failure.
@export var resume_on_failure: bool = false @export var resume_on_failure: bool = false
## Whether the sequence should start where it left off after a previous interruption. ## Whether the sequence should start where it left off after a previous interruption.

@ -5,8 +5,8 @@
## In case a child returns `RUNNING` this node will restart. ## In case a child returns `RUNNING` this node will restart.
@tool @tool
@icon("../../icons/sequence_reactive.svg") @icon("../../icons/sequence_reactive.svg")
class_name SequenceReactiveComposite extends Composite class_name SequenceReactiveComposite
extends Composite
var successful_index: int = 0 var successful_index: int = 0
@ -52,6 +52,7 @@ func interrupt(actor: Node, blackboard: Blackboard) -> void:
_reset() _reset()
super(actor, blackboard) super(actor, blackboard)
func _reset() -> void: func _reset() -> void:
successful_index = 0 successful_index = 0

@ -5,8 +5,8 @@
## In case a child returns `RUNNING` this node will restart. ## In case a child returns `RUNNING` this node will restart.
@tool @tool
@icon("../../icons/sequence_reactive.svg") @icon("../../icons/sequence_reactive.svg")
class_name SequenceStarComposite extends Composite class_name SequenceStarComposite
extends Composite
var successful_index: int = 0 var successful_index: int = 0

@ -2,8 +2,8 @@
## Must only have one child. ## Must only have one child.
@tool @tool
@icon("../../icons/category_decorator.svg") @icon("../../icons/category_decorator.svg")
class_name Decorator extends BeehaveNode class_name Decorator
extends BeehaveNode
var running_child: BeehaveNode = null var running_child: BeehaveNode = null

@ -1,8 +1,8 @@
## A Failer node will always return a `FAILURE` status code. ## A Failer node will always return a `FAILURE` status code.
@tool @tool
@icon("../../icons/failer.svg") @icon("../../icons/failer.svg")
class_name AlwaysFailDecorator extends Decorator class_name AlwaysFailDecorator
extends Decorator
func tick(actor: Node, blackboard: Blackboard) -> int: func tick(actor: Node, blackboard: Blackboard) -> int:
var c = get_child(0) var c = get_child(0)

@ -2,8 +2,8 @@
## code or `SUCCESS` in case its child returns a `FAILURE` status code. ## code or `SUCCESS` in case its child returns a `FAILURE` status code.
@tool @tool
@icon("../../icons/inverter.svg") @icon("../../icons/inverter.svg")
class_name InverterDecorator extends Decorator class_name InverterDecorator
extends Decorator
func tick(actor: Node, blackboard: Blackboard) -> int: func tick(actor: Node, blackboard: Blackboard) -> int:
var c = get_child(0) var c = get_child(0)

@ -2,12 +2,14 @@
## maximum ticks is reached, it will return a `FAILURE` status code. ## maximum ticks is reached, it will return a `FAILURE` status code.
@tool @tool
@icon("../../icons/limiter.svg") @icon("../../icons/limiter.svg")
class_name LimiterDecorator extends Decorator class_name LimiterDecorator
extends Decorator
@onready var cache_key = 'limiter_%s' % self.get_instance_id() @onready var cache_key = 'limiter_%s' % self.get_instance_id()
@export var max_count: float = 0 @export var max_count: float = 0
func tick(actor: Node, blackboard: Blackboard) -> int: func tick(actor: Node, blackboard: Blackboard) -> int:
var child = self.get_child(0) var child = self.get_child(0)
var current_count = blackboard.get_value(cache_key, 0, str(actor.get_instance_id())) var current_count = blackboard.get_value(cache_key, 0, str(actor.get_instance_id()))

@ -1,8 +1,8 @@
## A succeeder node will always return a `SUCCESS` status code. ## A succeeder node will always return a `SUCCESS` status code.
@tool @tool
@icon("../../icons/succeeder.svg") @icon("../../icons/succeeder.svg")
class_name AlwaysSucceedDecorator extends Decorator class_name AlwaysSucceedDecorator
extends Decorator
func tick(actor: Node, blackboard: Blackboard) -> int: func tick(actor: Node, blackboard: Blackboard) -> int:
var c = get_child(0) var c = get_child(0)

@ -3,7 +3,8 @@
## every time before the node runs. ## every time before the node runs.
@tool @tool
@icon("../../icons/limiter.svg") @icon("../../icons/limiter.svg")
class_name TimeLimiterDecorator extends Decorator class_name TimeLimiterDecorator
extends Decorator
@export var wait_time: = 0.0 @export var wait_time: = 0.0

@ -4,8 +4,8 @@
## action is completed. ## action is completed.
@tool @tool
@icon("../../icons/action.svg") @icon("../../icons/action.svg")
class_name ActionLeaf extends Leaf class_name ActionLeaf
extends Leaf
func get_class_name() -> Array[StringName]: func get_class_name() -> Array[StringName]:
var classes := super() var classes := super()

@ -2,8 +2,8 @@
## Returns [code]FAILURE[/code] if any of the expression fails or the ## Returns [code]FAILURE[/code] if any of the expression fails or the
## comparison operation returns [code]false[/code], otherwise it returns [code]SUCCESS[/code]. ## comparison operation returns [code]false[/code], otherwise it returns [code]SUCCESS[/code].
@tool @tool
class_name BlackboardCompareCondition extends ConditionLeaf class_name BlackboardCompareCondition
extends ConditionLeaf
enum Operators { enum Operators {
EQUAL, EQUAL,
@ -13,22 +13,21 @@ enum Operators {
GREATER_EQUAL, GREATER_EQUAL,
LESS_EQUAL, LESS_EQUAL,
} }
## Expression represetning left operand. ## Expression represetning left operand.
## This value can be any valid GDScript expression. ## This value can be any valid GDScript expression.
## In order to use the existing blackboard keys for comparison, ## In order to use the existing blackboard keys for comparison,
## use get_value("key_name") e.g. get_value("direction").length() ## use get_value("key_name") e.g. get_value("direction").length()
@export_placeholder(EXPRESSION_PLACEHOLDER) var left_operand: String = "" @export_placeholder(EXPRESSION_PLACEHOLDER) var left_operand: String = ""
## Comparison operator. ## Comparison operator.
@export_enum("==", "!=", ">", "<", ">=", "<=") var operator: int = 0 @export_enum("==", "!=", ">", "<", ">=", "<=") var operator: int = 0
## Expression represetning right operand. ## Expression represetning right operand.
## This value can be any valid GDScript expression. ## This value can be any valid GDScript expression.
## In order to use the existing blackboard keys for comparison, ## In order to use the existing blackboard keys for comparison,
## use get_value("key_name") e.g. get_value("direction").length() ## use get_value("key_name") e.g. get_value("direction").length()
@export_placeholder(EXPRESSION_PLACEHOLDER) var right_operand: String = "" @export_placeholder(EXPRESSION_PLACEHOLDER) var right_operand: String = ""
@onready var _left_expression: Expression = _parse_expression(left_operand) @onready var _left_expression: Expression = _parse_expression(left_operand)
@onready var _right_expression: Expression = _parse_expression(right_operand) @onready var _right_expression: Expression = _parse_expression(right_operand)

@ -1,8 +1,8 @@
## Erases the specified key from the blackboard. ## Erases the specified key from the blackboard.
## Returns [code]FAILURE[/code] if expression execution fails, otherwise [code]SUCCESS[/code]. ## Returns [code]FAILURE[/code] if expression execution fails, otherwise [code]SUCCESS[/code].
@tool @tool
class_name BlackboardEraseAction extends ActionLeaf class_name BlackboardEraseAction
extends ActionLeaf
## Expression representing a blackboard key. ## Expression representing a blackboard key.
@export_placeholder(EXPRESSION_PLACEHOLDER) var key: String = "" @export_placeholder(EXPRESSION_PLACEHOLDER) var key: String = ""

@ -1,8 +1,8 @@
## Returns [code]FAILURE[/code] if expression execution fails or the specified key doesn't exist. ## Returns [code]FAILURE[/code] if expression execution fails or the specified key doesn't exist.
## Returns [code]SUCCESS[/code] if blackboard has the specified key. ## Returns [code]SUCCESS[/code] if blackboard has the specified key.
@tool @tool
class_name BlackboardHasCondition extends ConditionLeaf class_name BlackboardHasCondition
extends ConditionLeaf
## Expression representing a blackboard key. ## Expression representing a blackboard key.
@export_placeholder(EXPRESSION_PLACEHOLDER) var key: String = "" @export_placeholder(EXPRESSION_PLACEHOLDER) var key: String = ""

@ -1,15 +1,15 @@
## Sets the specified key to the specified value. ## Sets the specified key to the specified value.
## Returns [code]FAILURE[/code] if expression execution fails, otherwise [code]SUCCESS[/code]. ## Returns [code]FAILURE[/code] if expression execution fails, otherwise [code]SUCCESS[/code].
@tool @tool
class_name BlackboardSetAction extends ActionLeaf class_name BlackboardSetAction
extends ActionLeaf
## Expression representing a blackboard key. ## Expression representing a blackboard key.
@export_placeholder(EXPRESSION_PLACEHOLDER) var key: String = "" @export_placeholder(EXPRESSION_PLACEHOLDER) var key: String = ""
## Expression representing a blackboard value to assign to the specified key. ## Expression representing a blackboard value to assign to the specified key.
@export_placeholder(EXPRESSION_PLACEHOLDER) var value: String = "" @export_placeholder(EXPRESSION_PLACEHOLDER) var value: String = ""
@onready var _key_expression: Expression = _parse_expression(key) @onready var _key_expression: Expression = _parse_expression(key)
@onready var _value_expression: Expression = _parse_expression(value) @onready var _value_expression: Expression = _parse_expression(value)

@ -2,8 +2,8 @@
## a single simple condition. They should never return `RUNNING`. ## a single simple condition. They should never return `RUNNING`.
@tool @tool
@icon("../../icons/condition.svg") @icon("../../icons/condition.svg")
class_name ConditionLeaf extends Leaf class_name ConditionLeaf
extends Leaf
func get_class_name() -> Array[StringName]: func get_class_name() -> Array[StringName]:
var classes := super() var classes := super()

@ -1,8 +1,8 @@
## Base class for all leaf nodes of the tree. ## Base class for all leaf nodes of the tree.
@tool @tool
@icon("../../icons/category_leaf.svg") @icon("../../icons/category_leaf.svg")
class_name Leaf extends BeehaveNode class_name Leaf
extends BeehaveNode
const EXPRESSION_PLACEHOLDER: String = "Insert an expression..." const EXPRESSION_PLACEHOLDER: String = "Insert an expression..."

@ -5,6 +5,7 @@ const BeehaveEditorDebugger := preload("debug/debugger.gd")
var editor_debugger: BeehaveEditorDebugger var editor_debugger: BeehaveEditorDebugger
var frames: RefCounted var frames: RefCounted
func _init(): func _init():
name = "BeehavePlugin" name = "BeehavePlugin"
add_autoload_singleton("BeehaveGlobalMetrics", "res://addons/beehave/metrics/beehave_global_metrics.gd") add_autoload_singleton("BeehaveGlobalMetrics", "res://addons/beehave/metrics/beehave_global_metrics.gd")

@ -1,7 +1,6 @@
@tool @tool
class_name BeehaveUtils class_name BeehaveUtils
static func get_plugin() -> EditorPlugin: static func get_plugin() -> EditorPlugin:
var tree: SceneTree = Engine.get_main_loop() var tree: SceneTree = Engine.get_main_loop()
return tree.get_root().get_child(0).get_node_or_null("BeehavePlugin") return tree.get_root().get_child(0).get_node_or_null("BeehavePlugin")

@ -2,7 +2,6 @@ extends Object
const PLUGIN_BUNDLE_NAME: StringName = "aseprite_importers" const PLUGIN_BUNDLE_NAME: StringName = "aseprite_importers"
const ASEPRITE_EXECUTABLE_PATH_SETTING_NAME: StringName = PLUGIN_BUNDLE_NAME + "/aseprite_executable_path" const ASEPRITE_EXECUTABLE_PATH_SETTING_NAME: StringName = PLUGIN_BUNDLE_NAME + "/aseprite_executable_path"
enum CompressMode { enum CompressMode {
LOSSLESS = 0, LOSSLESS = 0,
LOSSY = 1, LOSSY = 1,
@ -17,7 +16,6 @@ const COMPRESS_MODES_NAMES: PackedStringArray = [
"VRAM Uncompressed", "VRAM Uncompressed",
"Basis Universal", "Basis Universal",
] ]
# ONLY FOR VRAM_COMPRESSED # ONLY FOR VRAM_COMPRESSED
enum HdrCompression { enum HdrCompression {
DISABLED = 0, DISABLED = 0,
@ -29,7 +27,6 @@ const HDR_COMPRESSION_NAMES: PackedStringArray = [
"Opaque Only", "Opaque Only",
"Always", "Always",
] ]
# EXCEPT LOSSLESS # EXCEPT LOSSLESS
enum NormalMap { enum NormalMap {
DETECT = 0, DETECT = 0,
@ -41,7 +38,6 @@ const NORMAL_MAP_NAMES: PackedStringArray = [
"Enable", "Enable",
"Disabled", "Disabled",
] ]
enum ChannelPack { enum ChannelPack {
SRGB_FRIENDLY = 0, SRGB_FRIENDLY = 0,
OPTIMIZED = 1, OPTIMIZED = 1,
@ -50,7 +46,6 @@ const CHANNEL_PACK_NAMES: PackedStringArray = [
"sRGB Friendly", "sRGB Friendly",
"Optimized", "Optimized",
] ]
enum Roughness { enum Roughness {
DETECT = 0, DETECT = 0,
DISABLED = 1, DISABLED = 1,
@ -69,7 +64,6 @@ const ROUGHNESS_NAMES: PackedStringArray = [
"Alpha", "Alpha",
"Gray", "Gray",
] ]
enum CompressMode3D { enum CompressMode3D {
DISABLED = 0, DISABLED = 0,
VRAM_COMPRESSED = 1, VRAM_COMPRESSED = 1,
@ -80,9 +74,9 @@ const COMPRESS_MODE_3D_NAMES: PackedStringArray = [
"VRAM Compressed", "VRAM Compressed",
"Basis Universal", "Basis Universal",
] ]
const EMPTY_CALLABLE: Callable = Callable() const EMPTY_CALLABLE: Callable = Callable()
static func create_option( static func create_option(
name: String, name: String,
default_value: Variant, default_value: Variant,
@ -111,7 +105,6 @@ const SPRITESHEET_BORDER_TYPES: PackedStringArray = [
"Transparent", "Transparent",
"Extruded", "Extruded",
] ]
enum AnimationDirection { enum AnimationDirection {
FORWARD = 0, FORWARD = 0,
REVERSE = 1, REVERSE = 1,
@ -122,14 +115,12 @@ const ASEPRITE_OUTPUT_ANIMATION_DIRECTIONS: PackedStringArray = [
"forward", "reverse", "pingpong", "pingpong_reverse" ] "forward", "reverse", "pingpong", "pingpong_reverse" ]
const PRESET_OPTIONS_ANIMATION_DIRECTIONS: PackedStringArray = [ const PRESET_OPTIONS_ANIMATION_DIRECTIONS: PackedStringArray = [
"Forward", "Reverse", "Ping-pong", "Ping-pong reverse" ] "Forward", "Reverse", "Ping-pong", "Ping-pong reverse" ]
enum SpritesheetLayout { enum SpritesheetLayout {
PACKED = 0, PACKED = 0,
BY_ROWS = 1, BY_ROWS = 1,
BY_COLUMNS = 2, BY_COLUMNS = 2,
} }
const SPRITESHEET_LAYOUTS: PackedStringArray = ["Packed", "By rows", "By columns"] const SPRITESHEET_LAYOUTS: PackedStringArray = ["Packed", "By rows", "By columns"]
const OPTION_SPRITESHEET_BORDER_TYPE: String = "spritesheet/border_type" const OPTION_SPRITESHEET_BORDER_TYPE: String = "spritesheet/border_type"
const OPTION_SPRITESHEET_TRIM: String = "spritesheet/trim" const OPTION_SPRITESHEET_TRIM: String = "spritesheet/trim"
const OPTION_SPRITESHEET_IGNORE_EMPTY: String = "spritesheet/ignore_empty" const OPTION_SPRITESHEET_IGNORE_EMPTY: String = "spritesheet/ignore_empty"
@ -148,7 +139,6 @@ const SPRITESHEET_FIXED_ROWS_COUNT: String = "spritesheet/fixed_rows_count"
const SPRITESHEET_FIXED_COLUMNS_COUNT: String = "spritesheet/fixed_columns_count" const SPRITESHEET_FIXED_COLUMNS_COUNT: String = "spritesheet/fixed_columns_count"
class ParsedAnimationOptions: class ParsedAnimationOptions:
var border_type: BorderType var border_type: BorderType
var trim: bool var trim: bool
@ -161,6 +151,8 @@ class ParsedAnimationOptions:
var default_animation_direction: AnimationDirection var default_animation_direction: AnimationDirection
var default_animation_repeat_count: int var default_animation_repeat_count: int
var animation_autoplay_name: String var animation_autoplay_name: String
func _init(options: Dictionary) -> void: func _init(options: Dictionary) -> void:
border_type = options[OPTION_SPRITESHEET_BORDER_TYPE] border_type = options[OPTION_SPRITESHEET_BORDER_TYPE]
trim = options[OPTION_SPRITESHEET_TRIM] trim = options[OPTION_SPRITESHEET_TRIM]
@ -175,6 +167,7 @@ class ParsedAnimationOptions:
default_animation_repeat_count = options[OPTION_ANIMATION_DEFAULT_REPEAT_COUNT] default_animation_repeat_count = options[OPTION_ANIMATION_DEFAULT_REPEAT_COUNT]
animation_autoplay_name = options[OPTION_ANIMATION_AUTOPLAY_NAME].strip_edges().strip_escapes() animation_autoplay_name = options[OPTION_ANIMATION_AUTOPLAY_NAME].strip_edges().strip_escapes()
static func create_common_animation_options() -> Array[Dictionary]: static func create_common_animation_options() -> Array[Dictionary]:
return [ return [
create_option(OPTION_SPRITESHEET_LAYOUT, SpritesheetLayout.PACKED, PROPERTY_HINT_ENUM, ",".join(SPRITESHEET_LAYOUTS), PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED ), create_option(OPTION_SPRITESHEET_LAYOUT, SpritesheetLayout.PACKED, PROPERTY_HINT_ENUM, ",".join(SPRITESHEET_LAYOUTS), PROPERTY_USAGE_EDITOR | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED ),
@ -184,6 +177,9 @@ static func create_common_animation_options() -> Array[Dictionary]:
func(options): return options[OPTION_SPRITESHEET_LAYOUT] == SpritesheetLayout.BY_ROWS), func(options): return options[OPTION_SPRITESHEET_LAYOUT] == SpritesheetLayout.BY_ROWS),
create_option(OPTION_SPRITESHEET_BORDER_TYPE, BorderType.None, PROPERTY_HINT_ENUM, ",".join(SPRITESHEET_BORDER_TYPES), PROPERTY_USAGE_EDITOR), create_option(OPTION_SPRITESHEET_BORDER_TYPE, BorderType.None, PROPERTY_HINT_ENUM, ",".join(SPRITESHEET_BORDER_TYPES), PROPERTY_USAGE_EDITOR),
create_option(OPTION_SPRITESHEET_TRIM, false, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR, create_option(OPTION_SPRITESHEET_TRIM, false, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR,
func(options): return options[OPTION_SPRITESHEET_LAYOUT] != SpritesheetLayout.PACKED), func(options): return options[OPTION_SPRITESHEET_LAYOUT] != SpritesheetLayout.PACKED),
create_option(OPTION_SPRITESHEET_IGNORE_EMPTY, false, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), create_option(OPTION_SPRITESHEET_IGNORE_EMPTY, false, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR),
create_option(OPTION_SPRITESHEET_MERGE_DUPLICATES, false, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR), create_option(OPTION_SPRITESHEET_MERGE_DUPLICATES, false, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_EDITOR),

@ -13,9 +13,11 @@ func set_preset(name: StringName, options: Array[Dictionary]) -> void:
__option_visibility_checkers[option.name] = option_visibility_checker __option_visibility_checkers[option.name] = option_visibility_checker
_presets[name] = preset _presets[name] = preset
func _init(parent_plugin: EditorPlugin) -> void: func _init(parent_plugin: EditorPlugin) -> void:
super(parent_plugin) super(parent_plugin)
class ExportResult: class ExportResult:
var error: Error var error: Error
var error_message: String var error_message: String
@ -24,25 +26,31 @@ class ExportResult:
var texture: Texture2D var texture: Texture2D
var spritesheet_metadata: SpritesheetMetadata var spritesheet_metadata: SpritesheetMetadata
class FrameData: class FrameData:
var region_rect: Rect2i var region_rect: Rect2i
var region_rect_offset: Vector2i var region_rect_offset: Vector2i
var duration_ms: int var duration_ms: int
class AnimationTag: class AnimationTag:
var name: String var name: String
var frames: Array[FrameData] var frames: Array[FrameData]
var duration_ms: int var duration_ms: int
var looped: bool var looped: bool
class SpritesheetMetadata: class SpritesheetMetadata:
var source_size: Vector2i var source_size: Vector2i
var spritesheet_size: Vector2i var spritesheet_size: Vector2i
var animation_tags: Array[AnimationTag] var animation_tags: Array[AnimationTag]
class TrackFrame: class TrackFrame:
var duration_ms: int var duration_ms: int
var value: Variant var value: Variant
func _init(duration_ms: int, value: Variant) -> void: func _init(duration_ms: int, value: Variant) -> void:
self.duration_ms = duration_ms self.duration_ms = duration_ms
self.value = value self.value = value
@ -53,6 +61,7 @@ const __sheet_types_by_spritesheet_layout: Dictionary = {
Common.SpritesheetLayout.BY_COLUMNS: "columns", Common.SpritesheetLayout.BY_COLUMNS: "columns",
} }
func _export_texture(source_file: String, options: Common.ParsedAnimationOptions, image_options: Dictionary, gen_files: Array[String]) -> ExportResult: func _export_texture(source_file: String, options: Common.ParsedAnimationOptions, image_options: Dictionary, gen_files: Array[String]) -> ExportResult:
var export_result = ExportResult.new() var export_result = ExportResult.new()
var spritesheet_metadata = SpritesheetMetadata.new() var spritesheet_metadata = SpritesheetMetadata.new()
@ -171,13 +180,13 @@ func _export_texture(source_file: String, options: Common.ParsedAnimationOptions
# This is a working way to reuse a previously imported resource. Don't change it! # This is a working way to reuse a previously imported resource. Don't change it!
var texture: Texture2D = ResourceLoader.load(png_path, "Texture2D", ResourceLoader.CACHE_MODE_REPLACE) as Texture2D var texture: Texture2D = ResourceLoader.load(png_path, "Texture2D", ResourceLoader.CACHE_MODE_REPLACE) as Texture2D
export_result.texture = texture export_result.texture = texture
export_result.raw_output = data export_result.raw_output = data
export_result.parsed_json = json export_result.parsed_json = json
export_result.spritesheet_metadata = spritesheet_metadata export_result.spritesheet_metadata = spritesheet_metadata
return export_result return export_result
static func _create_animation_player( static func _create_animation_player(
spritesheet_metadata: SpritesheetMetadata, spritesheet_metadata: SpritesheetMetadata,
track_value_getters_by_property_path: Dictionary, track_value_getters_by_property_path: Dictionary,
@ -210,6 +219,9 @@ static func _create_animation_player(
return animation_player return animation_player
static func __create_track( static func __create_track(
animation: Animation, animation: Animation,
property_path: NodePath, property_path: NodePath,
@ -221,16 +233,22 @@ static func __create_track(
animation.value_track_set_update_mode(track_index, Animation.UPDATE_DISCRETE) animation.value_track_set_update_mode(track_index, Animation.UPDATE_DISCRETE)
animation.track_set_interpolation_loop_wrap(track_index, false) animation.track_set_interpolation_loop_wrap(track_index, false)
animation.track_set_interpolation_type(track_index, Animation.INTERPOLATION_NEAREST) animation.track_set_interpolation_type(track_index, Animation.INTERPOLATION_NEAREST)
var track_frames = animation_tag.frames.map( var track_frames = animation_tag.frames.map(
func (frame_data: FrameData): func (frame_data: FrameData):
return TrackFrame.new( return TrackFrame.new(
frame_data.duration_ms, frame_data.duration_ms,
track_value_getter.call(frame_data))) track_value_getter.call(frame_data)
))
var transition: float = 1 var transition: float = 1
var track_length_ms: int = 0 var track_length_ms: int = 0
var previous_track_frame: TrackFrame = null var previous_track_frame: TrackFrame = null
for track_frame in track_frames: for
track_frame in track_frames:
if previous_track_frame == null or track_frame.value != previous_track_frame.value: if previous_track_frame == null or track_frame.value != previous_track_frame.value:
animation.track_insert_key(track_index, animation.track_insert_key(track_index,
track_length_ms * 0.001, track_frame.value, transition) track_length_ms * 0.001, track_frame.value, transition)

@ -4,9 +4,7 @@ extends EditorImportPlugin
# Base class for all nested import plugins # Base class for all nested import plugins
const Common = preload("../common.gd") const Common = preload("../common.gd")
var _parent_plugin: EditorPlugin var _parent_plugin: EditorPlugin
var _import_order: int = 0 var _import_order: int = 0
var _importer_name: String = "" var _importer_name: String = ""
var _priority: float = 1 var _priority: float = 1
@ -17,12 +15,15 @@ var _visible_name: String
var _presets: Dictionary var _presets: Dictionary
var __option_visibility_checkers: Dictionary var __option_visibility_checkers: Dictionary
func _init(parent_plugin: EditorPlugin) -> void: func _init(parent_plugin: EditorPlugin) -> void:
_parent_plugin = parent_plugin _parent_plugin = parent_plugin
func _get_import_options(path: String, preset_index: int) -> Array[Dictionary]: func _get_import_options(path: String, preset_index: int) -> Array[Dictionary]:
return _presets.values()[preset_index] as Array[Dictionary] return _presets.values()[preset_index] as Array[Dictionary]
func _get_option_visibility(path: String, option_name: StringName, options: Dictionary) -> bool: func _get_option_visibility(path: String, option_name: StringName, options: Dictionary) -> bool:
var option_visibility_checker: Callable = __option_visibility_checkers.get(option_name, Common.EMPTY_CALLABLE) var option_visibility_checker: Callable = __option_visibility_checkers.get(option_name, Common.EMPTY_CALLABLE)
if option_visibility_checker: if option_visibility_checker:
@ -33,33 +34,43 @@ func _get_option_visibility(path: String, option_name: StringName, options: Dict
else: else:
return true return true
func _get_import_order() -> int: func _get_import_order() -> int:
return _import_order return _import_order
func _get_importer_name() -> String: func _get_importer_name() -> String:
return _importer_name return _importer_name
func _get_preset_count() -> int: func _get_preset_count() -> int:
return _presets.size() return _presets.size()
func _get_preset_name(preset_index: int) -> String: func _get_preset_name(preset_index: int) -> String:
return _presets.keys()[preset_index] return _presets.keys()[preset_index]
func _get_priority() -> float: func _get_priority() -> float:
return _priority return _priority
func _get_recognized_extensions() -> PackedStringArray: func _get_recognized_extensions() -> PackedStringArray:
return _recognized_extensions return _recognized_extensions
func _get_resource_type() -> String: func _get_resource_type() -> String:
return _resource_type return _resource_type
func _get_save_extension() -> String: func _get_save_extension() -> String:
return _save_extension return _save_extension
func _get_visible_name() -> String: func _get_visible_name() -> String:
return _visible_name return _visible_name
func _import(source_file: String, save_path: String, options: Dictionary, func _import(source_file: String, save_path: String, options: Dictionary,
platform_variants: Array[String], gen_files: Array[String]) -> Error: platform_variants: Array[String], gen_files: Array[String]) -> Error:
return ERR_UNCONFIGURED return ERR_UNCONFIGURED

@ -12,6 +12,7 @@ func _init(parent_plugin: EditorPlugin) -> void:
set_preset("Animation", []) set_preset("Animation", [])
func _import(source_file: String, save_path: String, options: Dictionary, func _import(source_file: String, save_path: String, options: Dictionary,
platform_variants: Array[String], gen_files: Array[String]) -> Error: platform_variants: Array[String], gen_files: Array[String]) -> Error:
print("importing:", source_file) print("importing:", source_file)
@ -46,6 +47,7 @@ func _import(source_file: String, save_path: String, options: Dictionary,
Util.refresh_all_animation_by_sprite_frames(sprite_frames_res) Util.refresh_all_animation_by_sprite_frames(sprite_frames_res)
return status return status
static func update_sprite_frames(export_result: ExportResult, sprite_frames: SpriteFrames, animation_autoplay_name: String = "") -> Error: static func update_sprite_frames(export_result: ExportResult, sprite_frames: SpriteFrames, animation_autoplay_name: String = "") -> Error:
var spritesheet_metadata: SpritesheetMetadata = export_result.spritesheet_metadata var spritesheet_metadata: SpritesheetMetadata = export_result.spritesheet_metadata
var exported_animation_names: Array = export_result.spritesheet_metadata.animation_tags.map( var exported_animation_names: Array = export_result.spritesheet_metadata.animation_tags.map(

@ -4,14 +4,12 @@ extends EditorPlugin
const PLUGIN_SCRIPTS: Array[GDScript] = [ const PLUGIN_SCRIPTS: Array[GDScript] = [
preload("editor_import_plugins/sprite_frames.gd"), preload("editor_import_plugins/sprite_frames.gd"),
] ]
const Common = preload("common.gd") const Common = preload("common.gd")
const ImportPlugin = preload("editor_import_plugins/_animation_importer_base.gd") const ImportPlugin = preload("editor_import_plugins/_animation_importer_base.gd")
var __import_plugins: Array[ImportPlugin] var __import_plugins: Array[ImportPlugin]
var common_options: Array[Dictionary] = Common.create_common_animation_options() var common_options: Array[Dictionary] = Common.create_common_animation_options()
func _enter_tree() -> void: func _enter_tree() -> void:
__register_project_setting( __register_project_setting(
Common.ASEPRITE_EXECUTABLE_PATH_SETTING_NAME, "", Common.ASEPRITE_EXECUTABLE_PATH_SETTING_NAME, "",
@ -22,11 +20,13 @@ func _enter_tree() -> void:
add_import_plugin(import_plugin) add_import_plugin(import_plugin)
__import_plugins.append(import_plugin) __import_plugins.append(import_plugin)
func _exit_tree() -> void: func _exit_tree() -> void:
for import_plugin in __import_plugins: for import_plugin in __import_plugins:
remove_import_plugin(import_plugin) remove_import_plugin(import_plugin)
__import_plugins.clear() __import_plugins.clear()
func __register_project_setting(name: StringName, initial_value, type: int, hint: int, hint_string: String = "") -> void: func __register_project_setting(name: StringName, initial_value, type: int, hint: int, hint_string: String = "") -> void:
if not ProjectSettings.has_setting(name): if not ProjectSettings.has_setting(name):
ProjectSettings.set_setting(name, initial_value) ProjectSettings.set_setting(name, initial_value)

@ -2,8 +2,15 @@
Copyright 2022 Gennady "Don Tnowe" Krupenyov Copyright 2022 Gennady "Don Tnowe" Krupenyov
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

@ -1,6 +1,5 @@
@tool @tool
extends Control extends Control
func _ready(): func _ready():
modulate = get_theme_color("accent_color", "Editor") modulate = get_theme_color("accent_color", "Editor")

@ -2,9 +2,7 @@
extends Control extends Control
signal grid_updated() signal grid_updated()
const TablesPluginSettingsClass := preload("res://addons/resources_spreadsheet_view/settings_grid.gd") const TablesPluginSettingsClass := preload("res://addons/resources_spreadsheet_view/settings_grid.gd")
@export @onready var node_folder_path: LineEdit = $"HeaderContentSplit/VBoxContainer/HBoxContainer/HBoxContainer/Path" @export @onready var node_folder_path: LineEdit = $"HeaderContentSplit/VBoxContainer/HBoxContainer/HBoxContainer/Path"
@export @onready var node_recent_paths: OptionButton = $"HeaderContentSplit/VBoxContainer/HBoxContainer/HBoxContainer2/RecentPaths" @export @onready var node_recent_paths: OptionButton = $"HeaderContentSplit/VBoxContainer/HBoxContainer/HBoxContainer2/RecentPaths"
@export @onready var node_table_root: GridContainer = $"HeaderContentSplit/MarginContainer/FooterContentSplit/Panel/Scroll/MarginContainer/TableGrid" @export @onready var node_table_root: GridContainer = $"HeaderContentSplit/MarginContainer/FooterContentSplit/Panel/Scroll/MarginContainer/TableGrid"
@ -16,12 +14,10 @@ const TablesPluginSettingsClass := preload("res://addons/resources_spreadsheet_v
var editor_interface: Object var editor_interface: Object
var editor_plugin: EditorPlugin var editor_plugin: EditorPlugin
var current_path := "" var current_path := ""
var save_data_path: String = get_script().resource_path.get_base_dir() + "/saved_state.json" var save_data_path: String = get_script().resource_path.get_base_dir() + "/saved_state.json"
var sorting_by := "" var sorting_by := ""
var sorting_reverse := false var sorting_reverse := false
var columns := [] var columns := []
var column_types := [] var column_types := []
var column_hints := [] var column_hints := []
@ -30,10 +26,8 @@ var rows := []
var remembered_paths := {} var remembered_paths := {}
var remembered_paths_total_count := 0 var remembered_paths_total_count := 0
var table_functions_dict := {} var table_functions_dict := {}
var search_cond: RefCounted var search_cond: RefCounted
var io: RefCounted var io: RefCounted
var first_row := 0 var first_row := 0
var last_row := 0 var last_row := 0
@ -317,6 +311,8 @@ func set_edited_cells_values(new_cell_values : Array):
new_cell_values.duplicate() new_cell_values.duplicate()
) )
editor_plugin.undo_redo.commit_action(true) editor_plugin.undo_redo.commit_action(true)
# editor_interface.get_resource_filesystem().scan() # editor_interface.get_resource_filesystem().scan()

@ -3,34 +3,42 @@ extends RefCounted
var editor_view: Control var editor_view: Control
## Override to define reading behaviour. ## Override to define reading behaviour.
func get_value(entry, key: String): func get_value(entry, key: String):
pass pass
## Override to define writing behaviour. This is NOT supposed to save - use `save_entries`. ## Override to define writing behaviour. This is NOT supposed to save - use `save_entries`.
func set_value(entry, key: String, value, index: int): func set_value(entry, key: String, value, index: int):
pass pass
## Override to define how the data gets saved. ## Override to define how the data gets saved.
func save_entries(all_entries: Array, indices: Array): func save_entries(all_entries: Array, indices: Array):
pass pass
## Override to allow editing rows from the Inspector. ## Override to allow editing rows from the Inspector.
func create_resource(entry) -> Resource: func create_resource(entry) -> Resource:
return Resource.new() return Resource.new()
## Override to define duplication behaviour. `name_input` should be a suffix if multiple entries, and full name if one. ## Override to define duplication behaviour. `name_input` should be a suffix if multiple entries, and full name if one.
func duplicate_rows(rows: Array, name_input: String): func duplicate_rows(rows: Array, name_input: String):
pass pass
## Override to define removal behaviour. ## Override to define removal behaviour.
func delete_rows(rows: Array): func delete_rows(rows: Array):
pass pass
## Override with `return true` if `resource_path` is defined and the Rename butoon should show. ## Override with `return true` if `resource_path` is defined and the Rename butoon should show.
func has_row_names(): func has_row_names():
return false return false
## Override to define import behaviour. Must return the `rows` value for the editor view. ## Override to define import behaviour. Must return the `rows` value for the editor view.
func import_from_path(folderpath: String, insert_func: Callable, sort_by: String, sort_reverse: bool = false) -> Array: func import_from_path(folderpath: String, insert_func: Callable, sort_by: String, sort_reverse: bool = false) -> Array:
return [] return []

@ -1,7 +1,6 @@
class_name ResourceTablesExportFormatCsv class_name ResourceTablesExportFormatCsv
extends RefCounted extends RefCounted
static func can_edit_path(path: String): static func can_edit_path(path: String):
return path.ends_with(".csv") return path.ends_with(".csv")

@ -1,7 +1,6 @@
class_name ResourceTablesImportFormatCsv class_name ResourceTablesImportFormatCsv
extends RefCounted extends RefCounted
static func can_edit_path(path: String): static func can_edit_path(path: String):
return path.ends_with(".csv") return path.ends_with(".csv")

@ -13,7 +13,6 @@ extends Control
var format_extension := ".csv" var format_extension := ".csv"
var entries := [] var entries := []
var property_used_as_filename := 0 var property_used_as_filename := 0
var import_data: ResourceTablesImport var import_data: ResourceTablesImport

@ -1,7 +1,6 @@
@tool @tool
extends HBoxContainer extends HBoxContainer
func display(name: String, type: int): func display(name: String, type: int):
$"LineEdit".text = name $"LineEdit".text = name
$"OptionButton".selected = type $"OptionButton".selected = type

@ -12,14 +12,12 @@ enum PropType {
ENUM, ENUM,
MAX, MAX,
} }
enum NameCasing { enum NameCasing {
ALL_LOWER, ALL_LOWER,
CAPS_WORD_EXCEPT_FIRST, CAPS_WORD_EXCEPT_FIRST,
CAPS_WORD, CAPS_WORD,
ALL_CAPS, ALL_CAPS,
} }
const SUFFIX := "_spreadsheet_import.tres" const SUFFIX := "_spreadsheet_import.tres"
const TYPE_MAP := { const TYPE_MAP := {
TYPE_STRING: PropType.STRING, TYPE_STRING: PropType.STRING,
@ -29,20 +27,16 @@ const TYPE_MAP := {
TYPE_OBJECT: PropType.OBJECT, TYPE_OBJECT: PropType.OBJECT,
TYPE_COLOR: PropType.COLOR, TYPE_COLOR: PropType.COLOR,
} }
@export var prop_types: Array @export var prop_types: Array
@export var prop_names: Array @export var prop_names: Array
@export var edited_path := "res://" @export var edited_path := "res://"
@export var prop_used_as_filename := "" @export var prop_used_as_filename := ""
@export var script_classname := "" @export var script_classname := ""
@export var remove_first_row := true @export var remove_first_row := true
@export var new_script: GDScript @export var new_script: GDScript
@export var view_script: Script = ResourceTablesEditFormatCsv @export var view_script: Script = ResourceTablesEditFormatCsv
@export var delimeter := ";" @export var delimeter := ";"
@export var enum_format: Array = [NameCasing.CAPS_WORD, " ", "Yes", "No"] @export var enum_format: Array = [NameCasing.CAPS_WORD, " ", "Yes", "No"]
@export var uniques: Dictionary @export var uniques: Dictionary

@ -2,15 +2,14 @@
extends Control extends Control
const TablesPluginSettingsClass := preload("res://addons/resources_spreadsheet_view/settings_grid.gd") const TablesPluginSettingsClass := preload("res://addons/resources_spreadsheet_view/settings_grid.gd")
@export var table_header_scene: PackedScene @export var table_header_scene: PackedScene
@export @onready var editor_view: Control = $"../../../.." @export @onready var editor_view: Control = $"../../../.."
@export @onready var hide_columns_button: BaseButton = $"../../MenuStrip/VisibleCols" @export @onready var hide_columns_button: BaseButton = $"../../MenuStrip/VisibleCols"
@export @onready var grid: GridContainer = $"../../../MarginContainer/FooterContentSplit/Panel/Scroll/MarginContainer/TableGrid" @export @onready var grid: GridContainer = $"../../../MarginContainer/FooterContentSplit/Panel/Scroll/MarginContainer/TableGrid"
var hidden_columns := {} var hidden_columns := {}
var columns := []: var columns := []:
set(v): set(v):
columns = v columns = v
@ -109,8 +108,12 @@ func _update_hidden_columns():
} }
editor_view.save_data() editor_view.save_data()
var visible_column_count = 0 var visible_column_count = 0
for i in columns.size(): for
i in columns.size():
var column_visible = !hidden_columns[current_path].has(columns[i]) var column_visible = !hidden_columns[current_path].has(columns[i])
get_child(i).visible = column_visible get_child(i).visible = column_visible
@ -123,6 +126,9 @@ func _update_hidden_columns():
grid.columns = visible_column_count grid.columns = visible_column_count
func _on_h_scroll_changed(value): func _on_h_scroll_changed(value):
position.x = -value position.x = -value

@ -5,6 +5,7 @@ extends Control
@export_enum("Filter", "Process", "Sort") var mode := 0 @export_enum("Filter", "Process", "Sort") var mode := 0
@export var title := "" @export var title := ""
@export var default_text := "": @export var default_text := "":
set(v): set(v):
default_text = v default_text = v
@ -12,6 +13,7 @@ extends Control
await ready await ready
_textfield.text = v _textfield.text = v
@export_multiline var default_text_ml := "": @export_multiline var default_text_ml := "":
set(v): set(v):
default_text_ml = v default_text_ml = v
@ -19,13 +21,13 @@ extends Control
await ready await ready
_textfield_ml.text = v _textfield_ml.text = v
@export var function_save_key := "" @export var function_save_key := ""
var _textfield: LineEdit var _textfield: LineEdit
var _textfield_ml: TextEdit var _textfield_ml: TextEdit
var _togglable_popup: PopupPanel var _togglable_popup: PopupPanel
var _saved_function_index_label: Label var _saved_function_index_label: Label
var _saved_functions: Array = [] var _saved_functions: Array = []
var _saved_function_selected := -1 var _saved_function_selected := -1
@ -88,7 +90,6 @@ func _ready():
move_button_r.pressed.connect(_on_saved_function_bumped.bind(+1)) move_button_r.pressed.connect(_on_saved_function_bumped.bind(+1))
func _on_expand_pressed(): func _on_expand_pressed():
_togglable_popup.popup(Rect2i(_textfield.get_screen_position(), Vector2(size.x, 256.0))) _togglable_popup.popup(Rect2i(_textfield.get_screen_position(), Vector2(size.x, 256.0)))

@ -4,7 +4,6 @@ extends Node
const TablesPluginEditorViewClass = preload("res://addons/resources_spreadsheet_view/editor_view.gd") const TablesPluginEditorViewClass = preload("res://addons/resources_spreadsheet_view/editor_view.gd")
const TablesPluginSelectionManagerClass = preload("res://addons/resources_spreadsheet_view/main_screen/selection_manager.gd") const TablesPluginSelectionManagerClass = preload("res://addons/resources_spreadsheet_view/main_screen/selection_manager.gd")
const TextEditingUtilsClass := preload("res://addons/resources_spreadsheet_view/text_editing_utils.gd") const TextEditingUtilsClass := preload("res://addons/resources_spreadsheet_view/text_editing_utils.gd")
@onready var editor_view: TablesPluginEditorViewClass = get_parent() @onready var editor_view: TablesPluginEditorViewClass = get_parent()
@onready var selection: TablesPluginSelectionManagerClass = get_node("../SelectionManager") @onready var selection: TablesPluginSelectionManagerClass = get_node("../SelectionManager")

@ -6,10 +6,8 @@ enum {
EDITBOX_RENAME, EDITBOX_RENAME,
EDITBOX_DELETE, EDITBOX_DELETE,
} }
const TextEditingUtilsClass := preload("res://addons/resources_spreadsheet_view/text_editing_utils.gd") const TextEditingUtilsClass := preload("res://addons/resources_spreadsheet_view/text_editing_utils.gd")
const TablesPluginSettingsClass := preload("res://addons/resources_spreadsheet_view/settings_grid.gd") const TablesPluginSettingsClass := preload("res://addons/resources_spreadsheet_view/settings_grid.gd")
@export @onready var editor_view := $"../.." @export @onready var editor_view := $"../.."
@export @onready var selection := $"../../SelectionManager" @export @onready var selection := $"../../SelectionManager"
@ -95,7 +93,6 @@ func _input(event : InputEvent):
return return
func _on_Duplicate_pressed(): func _on_Duplicate_pressed():
_show_editbox(EDITBOX_DUPLICATE) _show_editbox(EDITBOX_DUPLICATE)

@ -3,9 +3,7 @@ extends Control
signal cells_selected(cells) signal cells_selected(cells)
signal cells_rightclicked(cells) signal cells_rightclicked(cells)
const EditorViewClass = preload("res://addons/resources_spreadsheet_view/editor_view.gd") const EditorViewClass = preload("res://addons/resources_spreadsheet_view/editor_view.gd")
@export var cell_editor_classes: Array[Script] = [] @export var cell_editor_classes: Array[Script] = []
@export @onready var node_property_editors: VBoxContainer = $"../HeaderContentSplit/MarginContainer/FooterContentSplit/Footer/PropertyEditors" @export @onready var node_property_editors: VBoxContainer = $"../HeaderContentSplit/MarginContainer/FooterContentSplit/Footer/PropertyEditors"
@ -16,7 +14,6 @@ const EditorViewClass = preload("res://addons/resources_spreadsheet_view/editor_
var edited_cells: Array = [] var edited_cells: Array = []
var edited_cells_text: Array = [] var edited_cells_text: Array = []
var edit_cursor_positions: Array[int] = [] var edit_cursor_positions: Array[int] = []
var all_cell_editors: Array = [] var all_cell_editors: Array = []
var column_editors: Array[Object] = [] var column_editors: Array[Object] = []
var inspector_resource: Resource var inspector_resource: Resource

@ -2,9 +2,7 @@ class_name ResourceTablesCellEditor
extends RefCounted extends RefCounted
const TextEditingUtilsClass := preload("res://addons/resources_spreadsheet_view/text_editing_utils.gd") const TextEditingUtilsClass := preload("res://addons/resources_spreadsheet_view/text_editing_utils.gd")
const CELL_SCENE_DIR = "res://addons/resources_spreadsheet_view/typed_cells/" const CELL_SCENE_DIR = "res://addons/resources_spreadsheet_view/typed_cells/"
var hint_strings_array := [] var hint_strings_array := []
@ -12,23 +10,28 @@ var hint_strings_array := []
func can_edit_value(value, type, property_hint, column_index) -> bool: func can_edit_value(value, type, property_hint, column_index) -> bool:
return value != null return value != null
## Override to change how the cell is created; preload a scene or create nodes from code. ## Override to change how the cell is created; preload a scene or create nodes from code.
## Caller is an instance of [code]editor_view.tscn[/code]. ## Caller is an instance of [code]editor_view.tscn[/code].
func create_cell(caller: Control) -> Control: func create_cell(caller: Control) -> Control:
return load(CELL_SCENE_DIR + "basic.tscn").instantiate() return load(CELL_SCENE_DIR + "basic.tscn").instantiate()
## Override to change behaviour when the cell is clicked to be selected. ## Override to change behaviour when the cell is clicked to be selected.
func set_selected(node: Control, selected: bool): func set_selected(node: Control, selected: bool):
node.get_node("Selected").visible = selected node.get_node("Selected").visible = selected
## Override to change how the value is displayed. ## Override to change how the value is displayed.
func set_value(node: Control, value): func set_value(node: Control, value):
node.text = TextEditingUtilsClass.show_non_typing(str(value)) node.text = TextEditingUtilsClass.show_non_typing(str(value))
## Override to prevent the cell from being edited as text. ## Override to prevent the cell from being edited as text.
func is_text(): func is_text():
return true return true
## Override to change behaviour when there are color cells to the left of this cell. ## Override to change behaviour when there are color cells to the left of this cell.
func set_color(node: Control, color: Color): func set_color(node: Control, color: Color):
node.get_node("Back").modulate = color * 1.0 node.get_node("Back").modulate = color * 1.0

@ -1,6 +1,5 @@
extends ResourceTablesCellEditor extends ResourceTablesCellEditor
func can_edit_value(value, type, property_hint, column_index) -> bool: func can_edit_value(value, type, property_hint, column_index) -> bool:
return type == TYPE_BOOL return type == TYPE_BOOL

@ -1,6 +1,5 @@
extends "res://addons/resources_spreadsheet_view/typed_cells/cell_editor_array.gd" extends "res://addons/resources_spreadsheet_view/typed_cells/cell_editor_array.gd"
func can_edit_value(value, type, property_hint, column_index) -> bool: func can_edit_value(value, type, property_hint, column_index) -> bool:
return type == TYPE_DICTIONARY return type == TYPE_DICTIONARY

@ -1,6 +1,5 @@
extends ResourceTablesCellEditor extends ResourceTablesCellEditor
func can_edit_value(value, type, property_hint, column_index) -> bool: func can_edit_value(value, type, property_hint, column_index) -> bool:
return type == TYPE_INT and property_hint == PROPERTY_HINT_ENUM return type == TYPE_INT and property_hint == PROPERTY_HINT_ENUM

@ -1,6 +1,5 @@
extends "res://addons/resources_spreadsheet_view/typed_cells/cell_editor_array.gd" extends "res://addons/resources_spreadsheet_view/typed_cells/cell_editor_array.gd"
func can_edit_value(value, type, property_hint, column_index) -> bool: func can_edit_value(value, type, property_hint, column_index) -> bool:
if ( if (
type != TYPE_PACKED_INT32_ARRAY type != TYPE_PACKED_INT32_ARRAY

@ -1,7 +1,6 @@
extends ResourceTablesCellEditor extends ResourceTablesCellEditor
const TablesPluginSettingsClass := preload("res://addons/resources_spreadsheet_view/settings_grid.gd") const TablesPluginSettingsClass := preload("res://addons/resources_spreadsheet_view/settings_grid.gd")
var previewer: EditorResourcePreview var previewer: EditorResourcePreview

@ -1,5 +1,4 @@
extends ResourceTablesCellEditor extends ResourceTablesCellEditor
func set_color(node: Control, color: Color): func set_color(node: Control, color: Color):
node.get_node("Back").modulate = color * 0.6 if !node.text.is_valid_float() else color node.get_node("Back").modulate = color * 0.6 if !node.text.is_valid_float() else color

@ -3,12 +3,10 @@ class_name ResourceTablesDockEditor
extends Control extends Control
const TablesPluginSettingsClass := preload("res://addons/resources_spreadsheet_view/settings_grid.gd") const TablesPluginSettingsClass := preload("res://addons/resources_spreadsheet_view/settings_grid.gd")
@export var path_property_name := NodePath("Header/Label") @export var path_property_name := NodePath("Header/Label")
var sheet: Control var sheet: Control
var selection: Array var selection: Array
var _resize_target_height := 0.0 var _resize_target_height := 0.0
@ -24,10 +22,12 @@ func _ready():
$"Header".mouse_filter = MOUSE_FILTER_STOP $"Header".mouse_filter = MOUSE_FILTER_STOP
$"Header".mouse_default_cursor_shape = CURSOR_VSIZE $"Header".mouse_default_cursor_shape = CURSOR_VSIZE
## Override to define when to show the dock and, if it can edit the value, how to handle it. ## Override to define when to show the dock and, if it can edit the value, how to handle it.
func try_edit_value(value, type: int, property_hint: String) -> bool: func try_edit_value(value, type: int, property_hint: String) -> bool:
return true return true
## Override to define behaviour when stretching the header to change size. ## Override to define behaviour when stretching the header to change size.
func resize_drag(to_height: float): func resize_drag(to_height: float):
return return

@ -8,7 +8,6 @@ enum {
KEY_TYPE_OBJECT, KEY_TYPE_OBJECT,
KEY_TYPE_VARIANT, KEY_TYPE_VARIANT,
} }
@onready var key_input := $"HBoxContainer/HBoxContainer/Control/VBoxContainer/KeyEdit/KeyEdit" @onready var key_input := $"HBoxContainer/HBoxContainer/Control/VBoxContainer/KeyEdit/KeyEdit"
@onready var key_type := $"HBoxContainer/HBoxContainer/Control/VBoxContainer/KeyEdit/KeyType" @onready var key_type := $"HBoxContainer/HBoxContainer/Control/VBoxContainer/KeyEdit/KeyType"

@ -3,7 +3,6 @@ extends ResourceTablesDockEditor
@onready var options_container := $"HBoxContainer/Control2/HBoxContainer/HFlowContainer" @onready var options_container := $"HBoxContainer/Control2/HBoxContainer/HFlowContainer"
@onready var contents_label := $"HBoxContainer/HBoxContainer/Panel/Label" @onready var contents_label := $"HBoxContainer/HBoxContainer/Panel/Label"
@onready var _init_nodes_in_options_container := options_container.get_child_count() @onready var _init_nodes_in_options_container := options_container.get_child_count()
var _stored_value var _stored_value

@ -9,10 +9,8 @@ extends ResourceTablesDockEditor
var _stored_value = 0 var _stored_value = 0
var _stored_value_is_int := false var _stored_value_is_int := false
var _mouse_drag_increment := 0.0 var _mouse_drag_increment := 0.0
var _mouse_down := false var _mouse_down := false
var _resize_height_small := 0.0 var _resize_height_small := 0.0
var _resize_expanded := true var _resize_expanded := true
@ -172,7 +170,6 @@ func _fill_sequence(arr : Array, add : bool = false) -> Array:
if end != INF and end != -INF: if end != INF and end != -INF:
end = int(end) end = int(end)
var cur = start var cur = start
if !add: if !add:
for i in arr.size(): for i in arr.size():

@ -0,0 +1,309 @@
####
#
# OBJ File Generated by Meshlab
#
####
# Object stab1.obj
#
# Vertices: 96
# Faces: 32
#
####
mtllib ./stab1.obj.mtl
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn -0.435169 -1.953374 0.086547
v 0.237817 -1.982817 -0.047305 0.749020 0.749020 0.749020
vn -0.443695 -1.953347 -0.000000
v 0.242476 -1.982817 0.000000 0.749020 0.749020 0.749020
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn 0.368922 -1.953340 -0.246502
v -0.201612 -1.982817 0.134713 0.749020 0.749020 0.749020
vn 0.409923 -1.953363 -0.169784
v -0.224019 -1.982817 0.092791 0.749020 0.749020 0.749020
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn -0.443695 -1.953347 -0.000000
v 0.242476 -1.982817 0.000000 0.749020 0.749020 0.749020
vn -0.435169 -1.953374 -0.086547
v 0.237817 -1.982817 0.047304 0.749020 0.749020 0.749020
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn 0.409923 -1.953363 -0.169784
v -0.224019 -1.982817 0.092791 0.749020 0.749020 0.749020
vn 0.435169 -1.953374 -0.086547
v -0.237817 -1.982817 0.047304 0.749020 0.749020 0.749020
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn -0.435169 -1.953374 -0.086547
v 0.237817 -1.982817 0.047304 0.749020 0.749020 0.749020
vn -0.409923 -1.953363 -0.169784
v 0.224019 -1.982817 0.092791 0.749020 0.749020 0.749020
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn 0.435169 -1.953374 -0.086547
v -0.237817 -1.982817 0.047304 0.749020 0.749020 0.749020
vn 0.443695 -1.953347 0.000000
v -0.242476 -1.982817 -0.000000 0.749020 0.749020 0.749020
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn -0.409923 -1.953363 -0.169784
v 0.224019 -1.982817 0.092791 0.749020 0.749020 0.749020
vn -0.368922 -1.953340 -0.246502
v 0.201612 -1.982817 0.134713 0.749020 0.749020 0.749020
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn 0.443695 -1.953347 0.000000
v -0.242476 -1.982817 -0.000000 0.749020 0.749020 0.749020
vn 0.435167 -1.953365 0.086563
v -0.237817 -1.982817 -0.047305 0.749020 0.749020 0.749020
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn -0.368922 -1.953340 -0.246502
v 0.201612 -1.982817 0.134713 0.749020 0.749020 0.749020
vn -0.313738 -1.953371 -0.313738
v 0.171457 -1.982817 0.171457 0.749020 0.749020 0.749020
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn 0.435167 -1.953365 0.086563
v -0.237817 -1.982817 -0.047305 0.749020 0.749020 0.749020
vn 0.409923 -1.953363 0.169784
v -0.224019 -1.982817 -0.092792 0.749020 0.749020 0.749020
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn -0.313738 -1.953371 -0.313738
v 0.171457 -1.982817 0.171457 0.749020 0.749020 0.749020
vn -0.246502 -1.953340 -0.368922
v 0.134713 -1.982817 0.201612 0.749020 0.749020 0.749020
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn 0.409923 -1.953363 0.169784
v -0.224019 -1.982817 -0.092792 0.749020 0.749020 0.749020
vn 0.368922 -1.953340 0.246502
v -0.201612 -1.982817 -0.134713 0.749020 0.749020 0.749020
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn -0.246502 -1.953340 -0.368922
v 0.134713 -1.982817 0.201612 0.749020 0.749020 0.749020
vn -0.169784 -1.953363 -0.409924
v 0.092791 -1.982817 0.224018 0.749020 0.749020 0.749020
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn 0.000000 -1.953347 0.443695
v 0.000000 -1.982817 -0.242476 0.749020 0.749020 0.749020
vn -0.086547 -1.953374 0.435169
v 0.047304 -1.982817 -0.237817 0.749020 0.749020 0.749020
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn 0.368922 -1.953340 0.246502
v -0.201612 -1.982817 -0.134713 0.749020 0.749020 0.749020
vn 0.313738 -1.953371 0.313738
v -0.171457 -1.982817 -0.171457 0.749020 0.749020 0.749020
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn -0.169784 -1.953363 -0.409924
v 0.092791 -1.982817 0.224018 0.749020 0.749020 0.749020
vn -0.086547 -1.953374 -0.435169
v 0.047304 -1.982817 0.237817 0.749020 0.749020 0.749020
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn -0.086547 -1.953374 0.435169
v 0.047304 -1.982817 -0.237817 0.749020 0.749020 0.749020
vn -0.169784 -1.953363 0.409923
v 0.092791 -1.982817 -0.224019 0.749020 0.749020 0.749020
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn 0.313738 -1.953371 0.313738
v -0.171457 -1.982817 -0.171457 0.749020 0.749020 0.749020
vn 0.246502 -1.953340 0.368921
v -0.134713 -1.982817 -0.201612 0.749020 0.749020 0.749020
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn -0.086547 -1.953374 -0.435169
v 0.047304 -1.982817 0.237817 0.749020 0.749020 0.749020
vn 0.000000 -1.953347 -0.443695
v 0.000000 -1.982817 0.242476 0.749020 0.749020 0.749020
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn -0.169784 -1.953363 0.409923
v 0.092791 -1.982817 -0.224019 0.749020 0.749020 0.749020
vn -0.246502 -1.953340 0.368921
v 0.134713 -1.982817 -0.201612 0.749020 0.749020 0.749020
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn 0.246502 -1.953340 0.368921
v -0.134713 -1.982817 -0.201612 0.749020 0.749020 0.749020
vn 0.169784 -1.953363 0.409923
v -0.092791 -1.982817 -0.224019 0.749020 0.749020 0.749020
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn 0.000000 -1.953347 -0.443695
v 0.000000 -1.982817 0.242476 0.749020 0.749020 0.749020
vn 0.086547 -1.953374 -0.435169
v -0.047305 -1.982817 0.237817 0.749020 0.749020 0.749020
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn -0.246502 -1.953340 0.368921
v 0.134713 -1.982817 -0.201612 0.749020 0.749020 0.749020
vn -0.313738 -1.953371 0.313738
v 0.171457 -1.982817 -0.171457 0.749020 0.749020 0.749020
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn 0.169784 -1.953363 0.409923
v -0.092791 -1.982817 -0.224019 0.749020 0.749020 0.749020
vn 0.086547 -1.953374 0.435169
v -0.047304 -1.982817 -0.237817 0.749020 0.749020 0.749020
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn 0.086547 -1.953374 -0.435169
v -0.047305 -1.982817 0.237817 0.749020 0.749020 0.749020
vn 0.169784 -1.953363 -0.409924
v -0.092792 -1.982817 0.224018 0.749020 0.749020 0.749020
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn -0.313738 -1.953371 0.313738
v 0.171457 -1.982817 -0.171457 0.749020 0.749020 0.749020
vn -0.368922 -1.953340 0.246502
v 0.201612 -1.982817 -0.134713 0.749020 0.749020 0.749020
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn 0.086547 -1.953374 0.435169
v -0.047304 -1.982817 -0.237817 0.749020 0.749020 0.749020
vn 0.000000 -1.953347 0.443695
v 0.000000 -1.982817 -0.242476 0.749020 0.749020 0.749020
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn 0.169784 -1.953363 -0.409924
v -0.092792 -1.982817 0.224018 0.749020 0.749020 0.749020
vn 0.246502 -1.953340 -0.368922
v -0.134713 -1.982817 0.201612 0.749020 0.749020 0.749020
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn -0.368922 -1.953340 0.246502
v 0.201612 -1.982817 -0.134713 0.749020 0.749020 0.749020
vn -0.409923 -1.953363 0.169784
v 0.224019 -1.982817 -0.092792 0.749020 0.749020 0.749020
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn 0.246502 -1.953340 -0.368922
v -0.134713 -1.982817 0.201612 0.749020 0.749020 0.749020
vn 0.313738 -1.953371 -0.313738
v -0.171457 -1.982817 0.171457 0.749020 0.749020 0.749020
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn -0.409923 -1.953363 0.169784
v 0.224019 -1.982817 -0.092792 0.749020 0.749020 0.749020
vn -0.435169 -1.953374 0.086547
v 0.237817 -1.982817 -0.047305 0.749020 0.749020 0.749020
vn 0.000000 -3.301927 0.000000
v 0.000000 0.000000 0.000000 0.749020 0.749020 0.749020
vn 0.313738 -1.953371 -0.313738
v -0.171457 -1.982817 0.171457 0.749020 0.749020 0.749020
vn 0.368922 -1.953340 -0.246502
v -0.201612 -1.982817 0.134713 0.749020 0.749020 0.749020
# 96 vertices, 0 vertices normals
usemtl material_0
vt 0.500371 1.000000
vt 0.469238 0.000018
vt 0.500371 0.000018
f 1/1/1 2/2/2 3/3/3
vt 0.937716 1.000000
vt 0.906583 0.000018
vt 0.937716 0.000018
f 4/4/4 5/5/5 6/6/6
vt 0.531504 1.000000
vt 0.531504 0.000018
f 7/7/7 8/3/8 9/8/9
vt 0.968849 1.000000
vt 0.968849 0.000018
f 10/9/10 11/6/11 12/10/12
vt 0.562637 1.000000
vt 0.562637 0.000018
f 13/11/13 14/8/14 15/12/15
vt 0.999982 1.000000
vt 0.999982 0.000018
f 16/13/16 17/10/17 18/14/18
vt 0.593770 1.000000
vt 0.593770 0.000018
f 19/15/19 20/12/20 21/16/21
vt 0.031151 1.000000
vt 0.000018 0.000018
vt 0.031151 0.000018
f 22/17/22 23/18/23 24/19/24
vt 0.624903 1.000000
vt 0.624903 0.000018
f 25/20/25 26/16/26 27/21/27
vt 0.063025 1.000000
vt 0.063025 0.000018
f 28/22/28 29/19/29 30/23/30
vt 0.656777 1.000000
vt 0.656777 0.000018
f 31/24/31 32/21/32 33/25/33
vt 0.094158 1.000000
vt 0.094158 0.000018
f 34/26/34 35/23/35 36/27/36
vt 0.687910 1.000000
vt 0.687910 0.000018
f 37/28/37 38/25/38 39/29/39
vt 0.281698 1.000000
vt 0.250565 0.000018
vt 0.281698 0.000018
f 40/30/40 41/31/41 42/32/42
vt 0.125291 1.000000
vt 0.125291 0.000018
f 43/33/43 44/27/44 45/34/45
vt 0.719043 1.000000
vt 0.719043 0.000018
f 46/35/46 47/29/47 48/36/48
vt 0.312831 1.000000
vt 0.312831 0.000018
f 49/37/49 50/32/50 51/38/51
vt 0.156424 1.000000
vt 0.156424 0.000018
f 52/39/52 53/34/53 54/40/54
vt 0.750176 1.000000
vt 0.750176 0.000018
f 55/41/55 56/36/56 57/42/57
vt 0.343964 1.000000
vt 0.343964 0.000018
f 58/43/58 59/38/59 60/44/60
vt 0.187557 1.000000
vt 0.187557 0.000018
f 61/45/61 62/40/62 63/46/63
vt 0.781309 1.000000
vt 0.781309 0.000018
f 64/47/64 65/42/65 66/48/66
vt 0.375097 1.000000
vt 0.375097 0.000018
f 67/49/67 68/44/68 69/50/69
vt 0.218690 1.000000
vt 0.218690 0.000018
f 70/51/70 71/46/71 72/52/72
vt 0.812443 1.000000
vt 0.812443 0.000018
f 73/53/73 74/48/74 75/54/75
vt 0.406230 1.000000
vt 0.406230 0.000018
f 76/55/76 77/50/77 78/56/78
vt 0.250565 1.000000
f 79/57/79 80/52/80 81/31/81
vt 0.843576 1.000000
vt 0.843576 0.000018
f 82/58/82 83/54/83 84/59/84
vt 0.437363 1.000000
vt 0.437363 0.000018
f 85/60/85 86/56/86 87/61/87
vt 0.875450 1.000000
vt 0.875450 0.000018
f 88/62/88 89/59/89 90/63/90
vt 0.469238 1.000000
f 91/64/91 92/61/92 93/2/93
vt 0.906583 1.000000
f 94/65/94 95/63/95 96/5/96
# 32 faces, 65 coords texture
# End of File

@ -0,0 +1,25 @@
[remap]
importer="wavefront_obj"
importer_version=1
type="Mesh"
uid="uid://be4fjaakq0lbl"
path="res://.godot/imported/stab1.obj-14f1bb25ccc237ff4421de455a8c9b54.mesh"
[deps]
files=["res://.godot/imported/stab1.obj-14f1bb25ccc237ff4421de455a8c9b54.mesh"]
source_file="res://render/mesh/stab1.obj"
dest_files=["res://.godot/imported/stab1.obj-14f1bb25ccc237ff4421de455a8c9b54.mesh", "res://.godot/imported/stab1.obj-14f1bb25ccc237ff4421de455a8c9b54.mesh"]
[params]
generate_tangents=true
generate_lods=true
generate_shadow_mesh=true
generate_lightmap_uv2=false
generate_lightmap_uv2_texel_size=0.2
scale_mesh=Vector3(1, 1, 1)
offset_mesh=Vector3(0, 0, 0)
force_disable_mesh_compression=false

@ -0,0 +1,13 @@
#
# Wavefront material file
# Converted by Meshlab Group
#
newmtl material_0
Ka 0.200000 0.200000 0.200000
Kd 0.752941 0.752941 0.752941
Ks 1.000000 1.000000 1.000000
Tr 1.000000
illum 2
Ns 0.000000

@ -1,22 +1,22 @@
[gd_scene load_steps=27 format=3 uid="uid://8rcvw1vnjcf7"] [gd_scene load_steps=27 format=3 uid="uid://8rcvw1vnjcf7"]
[ext_resource type="Script" path="res://script/character/character.gd" id="1_tonbs"] [ext_resource type="Script" uid="uid://cdvtgxvof33j3" path="res://script/character/character.gd" id="1_tonbs"]
[ext_resource type="Script" path="res://script/character/hitbox.gd" id="2_6xf87"] [ext_resource type="Script" uid="uid://cms637d0jt6sk" path="res://script/character/hitbox.gd" id="2_6xf87"]
[ext_resource type="Script" path="res://script/character/status.gd" id="2_txdip"] [ext_resource type="Script" uid="uid://bfi4gneebe3oq" path="res://script/character/status.gd" id="2_txdip"]
[ext_resource type="Shader" path="res://render/shader/character.gdshader" id="3_ed424"] [ext_resource type="Shader" uid="uid://0p40c2iw15lw" path="res://render/shader/character.gdshader" id="3_ed424"]
[ext_resource type="Script" path="res://script/character/move.gd" id="4_66r53"] [ext_resource type="Script" uid="uid://cnaqs44siwa45" path="res://script/character/move.gd" id="4_66r53"]
[ext_resource type="Texture2D" uid="uid://daqn6aqfp1hva" path="res://resource/animation/character/hero01_long_attack.png" id="4_fcd8a"] [ext_resource type="Texture2D" uid="uid://daqn6aqfp1hva" path="res://resource/animation/character/hero01_long_attack.png" id="4_fcd8a"]
[ext_resource type="Script" path="res://script/character/view.gd" id="4_vijjv"] [ext_resource type="Script" uid="uid://c247mf44qb3uf" path="res://script/character/view.gd" id="4_vijjv"]
[ext_resource type="Script" path="res://script/character/skill.gd" id="6_h4xqy"] [ext_resource type="Script" uid="uid://c24is3uqqcmcn" path="res://script/character/skill.gd" id="6_h4xqy"]
[ext_resource type="AnimationLibrary" uid="uid://croik07a1qko5" path="res://resource/skill_animation_library/animation_library.tres" id="6_pakq5"] [ext_resource type="AnimationLibrary" uid="uid://croik07a1qko5" path="res://resource/skill_animation_library/animation_library.tres" id="6_pakq5"]
[ext_resource type="SpriteFrames" uid="uid://jpxh0jr8wp8g" path="res://resource/animation/character/hero01_basic.aseprite" id="6_whjpk"] [ext_resource type="SpriteFrames" uid="uid://jpxh0jr8wp8g" path="res://resource/animation/character/hero01_basic.aseprite" id="6_whjpk"]
[ext_resource type="Script" path="res://script/character/battle.gd" id="8_w84sf"] [ext_resource type="Script" uid="uid://cxklw5xp85wuw" path="res://script/character/battle.gd" id="8_w84sf"]
[ext_resource type="Script" path="res://script/character/buff.gd" id="9_jlnhy"] [ext_resource type="Script" uid="uid://bys2rd62nmj2v" path="res://script/character/buff.gd" id="9_jlnhy"]
[ext_resource type="Script" path="res://script/character/effect.gd" id="12_eyfcd"] [ext_resource type="Script" uid="uid://d3lbbulqdp1nu" path="res://script/character/effect.gd" id="12_eyfcd"]
[ext_resource type="Script" path="res://script/character/core.gd" id="14_gua01"] [ext_resource type="Script" uid="uid://b2ap8nlbb2717" path="res://script/character/core.gd" id="14_gua01"]
[ext_resource type="PackedScene" uid="uid://cq03usrdvv43o" path="res://scene/effect/readiness/readiness_lock.tscn" id="14_gw1pa"] [ext_resource type="PackedScene" uid="uid://cq03usrdvv43o" path="res://scene/effect/readiness/readiness_lock.tscn" id="14_gw1pa"]
[ext_resource type="SpriteFrames" uid="uid://2cb8lknel0ih" path="res://resource/animation/character/basic_move.aseprite" id="15_70jx1"] [ext_resource type="SpriteFrames" uid="uid://2cb8lknel0ih" path="res://resource/animation/character/basic_move.aseprite" id="15_70jx1"]
[ext_resource type="Script" path="res://script/character/throw.gd" id="16_ot265"] [ext_resource type="Script" uid="uid://b573l3rqq52j7" path="res://script/character/throw.gd" id="16_ot265"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_l0gkv"] [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_l0gkv"]
height = 1.0 height = 1.0
@ -32,10 +32,10 @@ radius = 1.0
[sub_resource type="ShaderMaterial" id="ShaderMaterial_3u7mw"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_3u7mw"]
render_priority = 0 render_priority = 0
shader = ExtResource("3_ed424") shader = ExtResource("3_ed424")
shader_parameter/tex = ExtResource("4_fcd8a")
shader_parameter/flash_white = null shader_parameter/flash_white = null
shader_parameter/deformation_dir = Vector2(0, 0) shader_parameter/deformation_dir = Vector2(0, 0)
shader_parameter/deformation_rate = 0.0 shader_parameter/deformation_rate = 0.0
shader_parameter/tex = ExtResource("4_fcd8a")
[sub_resource type="Curve" id="Curve_1lu0a"] [sub_resource type="Curve" id="Curve_1lu0a"]
_data = [Vector2(0, 0), 0.0, 0.0, 0, 1, Vector2(0.62982, 0), 0.0, 0.0, 0, 0, Vector2(1, 0.762586), 2.06004, 0.0, 1, 0] _data = [Vector2(0, 0), 0.0, 0.0, 0, 1, Vector2(0.62982, 0), 0.0, 0.0, 0, 0, Vector2(1, 0.762586), 2.06004, 0.0, 1, 0]
@ -70,17 +70,17 @@ tracks/1/keys = {
[sub_resource type="AnimationLibrary" id="AnimationLibrary_avnjy"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_avnjy"]
_data = { _data = {
"RESET": SubResource("Animation_dbjx6") &"RESET": SubResource("Animation_dbjx6")
} }
[sub_resource type="Curve" id="Curve_e7j3f"] [sub_resource type="Curve" id="Curve_e7j3f"]
max_value = 4.0 _limits = [0.0, 4.0, 0.0, 1.0]
_data = [Vector2(0, 4), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] _data = [Vector2(0, 4), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 2 point_count = 2
metadata/_snap_enabled = true metadata/_snap_enabled = true
[sub_resource type="Curve" id="Curve_55xfs"] [sub_resource type="Curve" id="Curve_55xfs"]
max_value = 0.3 _limits = [0.0, 0.3, 0.0, 1.0]
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.5, 0.09), 0.555563, 0.555563, 0, 0, Vector2(1, 0.3), 2.8841e-07, 0.0, 0, 0] _data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.5, 0.09), 0.555563, 0.555563, 0, 0, Vector2(1, 0.3), 2.8841e-07, 0.0, 0, 0]
point_count = 3 point_count = 3
metadata/_snap_enabled = true metadata/_snap_enabled = true
@ -132,8 +132,8 @@ after_image_speed_curve = SubResource("Curve_1lu0a")
[node name="Skill" type="AnimationPlayer" parent="."] [node name="Skill" type="AnimationPlayer" parent="."]
unique_name_in_owner = true unique_name_in_owner = true
libraries = { libraries = {
"": SubResource("AnimationLibrary_avnjy"), &"": SubResource("AnimationLibrary_avnjy"),
"animation_library": ExtResource("6_pakq5") &"animation_library": ExtResource("6_pakq5")
} }
script = ExtResource("6_h4xqy") script = ExtResource("6_h4xqy")

@ -1,7 +1,6 @@
[gd_scene load_steps=22 format=3 uid="uid://8p41jmg6p44w"] [gd_scene load_steps=21 format=3 uid="uid://8p41jmg6p44w"]
[ext_resource type="Script" uid="uid://dxoik7jm7xm2q" path="res://script/effect/particle.gd" id="1_wucb0"] [ext_resource type="Script" uid="uid://dxoik7jm7xm2q" path="res://script/effect/particle.gd" id="1_wucb0"]
[ext_resource type="Shader" uid="uid://b4x52xwsln0sq" path="res://render/shader/effect_slash.gdshader" id="2_5fvil"]
[ext_resource type="Texture2D" uid="uid://4cxxxxdbbugc" path="res://render/texture/particle/gradient/gradient1.png" id="3_midet"] [ext_resource type="Texture2D" uid="uid://4cxxxxdbbugc" path="res://render/texture/particle/gradient/gradient1.png" id="3_midet"]
[ext_resource type="Texture2D" uid="uid://c4byf37he3mjt" path="res://render/texture/particle/noise/noise1.png" id="4_oxgm6"] [ext_resource type="Texture2D" uid="uid://c4byf37he3mjt" path="res://render/texture/particle/noise/noise1.png" id="4_oxgm6"]
[ext_resource type="Texture2D" uid="uid://vy3c8opc6uju" path="res://render/texture/particle/mask/mask17.png" id="5_nqhd2"] [ext_resource type="Texture2D" uid="uid://vy3c8opc6uju" path="res://render/texture/particle/mask/mask17.png" id="5_nqhd2"]
@ -10,43 +9,43 @@
[ext_resource type="Shader" uid="uid://yl3qwpecny54" path="res://render/shader/effect_slash_dark.gdshader" id="8_cbrtr"] [ext_resource type="Shader" uid="uid://yl3qwpecny54" path="res://render/shader/effect_slash_dark.gdshader" id="8_cbrtr"]
[ext_resource type="Texture2D" uid="uid://ciusodtprwghg" path="res://render/texture/particle/gradient/gradient4.png" id="9_2gobu"] [ext_resource type="Texture2D" uid="uid://ciusodtprwghg" path="res://render/texture/particle/gradient/gradient4.png" id="9_2gobu"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_mb7bs"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_nog7n"]
render_priority = 0 render_priority = 0
shader = ExtResource("2_5fvil") shader = ExtResource("8_cbrtr")
shader_parameter/tex_main = ExtResource("4_oxgm6") shader_parameter/tex_main = ExtResource("4_oxgm6")
shader_parameter/tex_noise = ExtResource("6_iyu4g") shader_parameter/tex_noise = ExtResource("6_iyu4g")
shader_parameter/tex_mask = ExtResource("5_nqhd2") shader_parameter/tex_mask = ExtResource("5_nqhd2")
shader_parameter/tex_gradient = ExtResource("3_midet") shader_parameter/tex_gradient = ExtResource("3_midet")
[sub_resource type="Curve" id="Curve_efoj6"] [sub_resource type="Curve" id="Curve_nog7n"]
_data = [Vector2(0, 0.4), 0.0, 0.0, 0, 0, Vector2(0.7, 0.4), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] _data = [Vector2(0, 0.5), 0.0, 0.0, 0, 0, Vector2(0.5, 0.5), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 3 point_count = 3
metadata/_snap_enabled = true metadata/_snap_enabled = true
[sub_resource type="CurveTexture" id="CurveTexture_85q43"] [sub_resource type="CurveTexture" id="CurveTexture_cbrtr"]
curve = SubResource("Curve_efoj6") curve = SubResource("Curve_nog7n")
[sub_resource type="Curve" id="Curve_yhd08"] [sub_resource type="Curve" id="Curve_2gobu"]
_data = [Vector2(0, 1), 0.0, 0.0, 0, 1, Vector2(0.8, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), -5.0, 0.0, 1, 0] _data = [Vector2(0, 1), 0.0, 0.0, 0, 1, Vector2(0.8, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), -5.0, 0.0, 1, 0]
point_count = 3 point_count = 3
metadata/_snap_enabled = true metadata/_snap_enabled = true
[sub_resource type="CurveTexture" id="CurveTexture_kj04t"] [sub_resource type="CurveTexture" id="CurveTexture_efoj6"]
curve = SubResource("Curve_yhd08") curve = SubResource("Curve_2gobu")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_kdmyn"] [sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_85q43"]
particle_flag_rotate_y = true particle_flag_rotate_y = true
emission_shape = 3 emission_shape = 3
emission_box_extents = Vector3(3, 0.2, 1) emission_box_extents = Vector3(3, 0.2, 1)
direction = Vector3(0, -1, 0) direction = Vector3(0, -1, 0)
spread = 0.0 spread = 0.0
initial_velocity_min = 2.0 initial_velocity_min = 3.0
initial_velocity_max = 2.0 initial_velocity_max = 3.0
angular_velocity_min = -720.0 angular_velocity_min = -720.0
angular_velocity_max = -720.0 angular_velocity_max = -720.0
gravity = Vector3(0, 0, 0) gravity = Vector3(0, 0, 0)
alpha_curve = SubResource("CurveTexture_85q43") alpha_curve = SubResource("CurveTexture_cbrtr")
emission_curve = SubResource("CurveTexture_kj04t") emission_curve = SubResource("CurveTexture_efoj6")
sub_emitter_mode = 2 sub_emitter_mode = 2
sub_emitter_amount_at_end = 8 sub_emitter_amount_at_end = 8
@ -96,17 +95,17 @@ script = ExtResource("1_wucb0")
[node name="Slash" type="GPUParticles3D" parent="."] [node name="Slash" type="GPUParticles3D" parent="."]
transform = Transform3D(-1.09278e-08, -1.5, 0, 0.25, -6.55671e-08, 0, 0, 0, 0.25, 0, 0, 0) transform = Transform3D(-1.09278e-08, -1.5, 0, 0.25, -6.55671e-08, 0, 0, 0, 0.25, 0, 0, 0)
layers = 512 layers = 512
material_override = SubResource("ShaderMaterial_mb7bs") material_override = SubResource("ShaderMaterial_nog7n")
cast_shadow = 0 cast_shadow = 0
gi_mode = 0 gi_mode = 0
emitting = false emitting = false
amount = 5 amount = 5
lifetime = 0.2 lifetime = 0.25
one_shot = true one_shot = true
speed_scale = 2.5 speed_scale = 2.5
fixed_fps = 60 fixed_fps = 60
local_coords = true local_coords = true
process_material = SubResource("ParticleProcessMaterial_kdmyn") process_material = SubResource("ParticleProcessMaterial_85q43")
draw_pass_1 = ExtResource("7_paqqf") draw_pass_1 = ExtResource("7_paqqf")
[node name="Slash2" type="GPUParticles3D" parent="."] [node name="Slash2" type="GPUParticles3D" parent="."]

@ -1,4 +1,4 @@
[gd_scene load_steps=17 format=3 uid="uid://b4xgh5irnsipt"] [gd_scene load_steps=16 format=3 uid="uid://b4xgh5irnsipt"]
[ext_resource type="MeshLibrary" uid="uid://bmyo1828sbetg" path="res://resource/mesh_library/mesh_library_ground.tres" id="1_am8tr"] [ext_resource type="MeshLibrary" uid="uid://bmyo1828sbetg" path="res://resource/mesh_library/mesh_library_ground.tres" id="1_am8tr"]
[ext_resource type="Script" uid="uid://cssi506sw4vbc" path="res://script/level/level.gd" id="1_h6f14"] [ext_resource type="Script" uid="uid://cssi506sw4vbc" path="res://script/level/level.gd" id="1_h6f14"]
@ -9,7 +9,6 @@
[ext_resource type="Script" uid="uid://le6as2xegdxh" path="res://script/level/level_enemy.gd" id="7_a77rj"] [ext_resource type="Script" uid="uid://le6as2xegdxh" path="res://script/level/level_enemy.gd" id="7_a77rj"]
[ext_resource type="Resource" uid="uid://b1gf2jimihmc7" path="res://config/character/monster01.tres" id="8_7xdrj"] [ext_resource type="Resource" uid="uid://b1gf2jimihmc7" path="res://config/character/monster01.tres" id="8_7xdrj"]
[ext_resource type="Resource" uid="uid://dmfh54jffhx28" path="res://config/character/monster02.tres" id="9_l88vs"] [ext_resource type="Resource" uid="uid://dmfh54jffhx28" path="res://config/character/monster02.tres" id="9_l88vs"]
[ext_resource type="PackedScene" uid="uid://8p41jmg6p44w" path="res://scene/effect/particle/_particle_stab2.tscn" id="10_cqsgc"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_gdk30"] [sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_gdk30"]
sky_horizon_color = Color(0.64625, 0.65575, 0.67075, 1) sky_horizon_color = Color(0.64625, 0.65575, 0.67075, 1)
@ -330,7 +329,3 @@ enemy_nums = Array[ExtResource("7_a77rj")]([SubResource("Resource_utlwp"), SubRe
[node name="Level03" parent="Levels/竞技场" instance=ExtResource("2_clf01")] [node name="Level03" parent="Levels/竞技场" instance=ExtResource("2_clf01")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 38.4, 0, 7.68) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 38.4, 0, 7.68)
is_force_battle = true is_force_battle = true
[node name="Particle" parent="." instance=ExtResource("10_cqsgc")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8.42566, 2.83329, 81.1704)
lifetime = 100.0

@ -145,6 +145,7 @@ func cast_skill(cfg: SkillCfg, cast_dir: Vector2, action_key: String = ""):
_: pass _: pass
var animation_name: String = "animation_library/%s" % cfg.get_res_name() var animation_name: String = "animation_library/%s" % cfg.get_res_name()
print("play ",animation_name)
play(animation_name, -1, Setting.animation_speed_scale) play(animation_name, -1, Setting.animation_speed_scale)
seek(0, true, true) seek(0, true, true)

Loading…
Cancel
Save