Updated func_godot

This commit is contained in:
MaddoScientisto 2025-12-28 22:53:18 +01:00
commit 01a852de9b
170 changed files with 1705 additions and 2296 deletions

View file

@ -23,28 +23,25 @@ func export_button() -> void:
do_export_file(target_map_editor)
func do_export_file(target_editor: FuncGodotTargetMapEditors = FuncGodotTargetMapEditors.TRENCHBROOM, fgd_output_folder: String = "") -> void:
if not Engine.is_editor_hint():
return
if fgd_output_folder.is_empty():
fgd_output_folder = FuncGodotLocalConfig.get_setting(FuncGodotLocalConfig.PROPERTY.FGD_OUTPUT_FOLDER) as String
if fgd_output_folder.is_empty():
print("Skipping export: No game config folder")
printerr("Skipping export: No game config folder")
return
if fgd_name == "":
print("Skipping export: Empty FGD name")
printerr("Skipping export: Empty FGD name")
if not DirAccess.dir_exists_absolute(fgd_output_folder):
if DirAccess.make_dir_recursive_absolute(fgd_output_folder) != OK:
print("Skipping export: Failed to create directory")
printerr("Skipping export: Failed to create directory")
return
var fgd_file = fgd_output_folder.path_join(fgd_name + ".fgd")
var file_obj := FileAccess.open(fgd_file, FileAccess.WRITE)
if not file_obj:
print("Failed to open file for writing: ", fgd_file)
printerr("Failed to open file for writing: ", fgd_file)
return
print("Exporting FGD to ", fgd_file)
@ -76,6 +73,9 @@ func do_export_file(target_editor: FuncGodotTargetMapEditors = FuncGodotTargetMa
## Array of resources that inherit from [FuncGodotFGDEntityClass]. This array defines the entities that will be added to the exported FGD file and the nodes that will be generated in a [FuncGodotMap].
@export var entity_definitions: Array[Resource] = []
## Toggles whether [FuncGodotFGDModelPointClass] resources will generate models from their [PackedScene] files.
@export var generate_model_point_class_models: bool = true
func build_class_text(target_editor: FuncGodotTargetMapEditors = FuncGodotTargetMapEditors.TRENCHBROOM) -> String:
var res : String = ""
@ -91,6 +91,8 @@ func build_class_text(target_editor: FuncGodotTargetMapEditors = FuncGodotTarget
continue
if ent.func_godot_internal:
continue
if ent is FuncGodotFGDModelPointClass:
ent._model_generation_enabled = generate_model_point_class_models
var ent_text = ent.build_def_text(target_editor)
res += ent_text
@ -127,9 +129,9 @@ func get_entity_definitions() -> Dictionary[String, FuncGodotFGDEntityClass]:
if ent is FuncGodotFGDPointClass or ent is FuncGodotFGDSolidClass:
var entity_def = ent.duplicate()
var meta_properties := {}
var class_properties := {}
var class_property_descriptions := {}
var meta_properties: Dictionary[String, Variant] = {}
var class_properties: Dictionary[String, Variant] = {}
var class_property_descriptions: Dictionary[String, Variant] = {}
for base_class in _generate_base_class_list(entity_def):
for meta_property in base_class.meta_properties: