└── addons
└── func_godot
├── src
├── core
│ ├── data.gd.uid
│ ├── parser.gd.uid
│ ├── entity_assembler.gd.uid
│ ├── geometry_generator.gd.uid
│ └── data.gd
├── func_godot_plugin.gd.uid
├── import
│ ├── quake_wad_file.gd.uid
│ ├── quake_map_file.gd.uid
│ ├── quake_palette_file.gd.uid
│ ├── quake_map_import_plugin.gd.uid
│ ├── quake_wad_import_plugin.gd.uid
│ ├── quake_palette_import_plugin.gd.uid
│ ├── quake_palette_file.gd
│ ├── quake_map_file.gd
│ ├── quake_wad_file.gd
│ ├── quake_map_import_plugin.gd
│ ├── quake_palette_import_plugin.gd
│ └── quake_wad_import_plugin.gd
├── map
│ ├── func_godot_map.gd.uid
│ ├── func_godot_map_settings.gd.uid
│ ├── func_godot_map.gd
│ └── func_godot_map_settings.gd
├── util
│ ├── func_godot_util.gd.uid
│ ├── func_godot_local_config.gd.uid
│ └── func_godot_local_config.gd
├── fgd
│ ├── func_godot_fgd_file.gd.uid
│ ├── func_godot_fgd_base_class.gd.uid
│ ├── func_godot_fgd_point_class.gd.uid
│ ├── func_godot_fgd_solid_class.gd.uid
│ ├── func_godot_fgd_entity_class.gd.uid
│ ├── func_godot_fgd_model_point_class.gd.uid
│ ├── func_godot_fgd_point_class_display_descriptor.gd.uid
│ ├── func_godot_fgd_base_class.gd
│ ├── func_godot_fgd_point_class_display_descriptor.gd
│ ├── func_godot_fgd_point_class.gd
│ ├── func_godot_fgd_file.gd
│ ├── func_godot_fgd_solid_class.gd
│ ├── func_godot_fgd_model_point_class.gd
│ └── func_godot_fgd_entity_class.gd
├── trenchbroom
│ ├── trenchbroom_tag.gd.uid
│ ├── trenchbroom_game_config.gd.uid
│ ├── trenchbroom_tag.gd
│ └── trenchbroom_game_config.gd
├── netradiant_custom
│ ├── netradiant_custom_shader.gd.uid
│ ├── netradiant_custom_gamepack_config.gd.uid
│ ├── netradiant_custom_shader.gd
│ └── netradiant_custom_gamepack_config.gd
└── func_godot_plugin.gd
├── icon.png
├── icon32.png
├── palette.lmp
├── textures
├── clip.png
├── origin.png
├── skip.png
├── default_texture.png
├── default_material.tres
├── clip.png.import
├── skip.png.import
├── origin.png.import
└── default_texture.png.import
├── plugin.cfg
├── func_godot_local_config.tres
├── game_config
├── trenchbroom
│ ├── tb_face_tag_clip.tres
│ ├── tb_face_tag_skip.tres
│ ├── tb_face_tag_origin.tres
│ ├── tb_brush_tag_func.tres
│ ├── tb_brush_tag_trigger.tres
│ └── func_godot_tb_game_config.tres
└── netradiant_custom
│ ├── netradiant_custom_shader_clip.tres
│ ├── netradiant_custom_shader_skip.tres
│ ├── netradiant_custom_shader_origin.tres
│ └── func_godot_netradiant_custom_gamepack_config.tres
├── palette.lmp.import
├── fgd
├── phong_base.tres
├── vertex_merge_distance_base.tres
├── cull_interior_faces.tres
├── worldspawn.tres
├── func_detail_illusionary.tres
├── func_geo.tres
├── func_illusionary.tres
├── func_detail.tres
└── func_godot_fgd.tres
├── func_godot_default_map_settings.tres
├── icon.png.import
├── icon32.png.import
├── LICENSE
├── icon.svg.import
├── icons
├── icon_slipgate.svg.import
├── icon_godambler.svg.import
├── icon_quake_file.svg.import
├── icon_slipgate3d.svg.import
├── icon_godambler3d.svg.import
├── icon_godot_ranger.svg.import
├── icon_godot_ranger3d.svg.import
├── icon_slipgate.svg
├── icon_slipgate3d.svg
├── icon_quake_file.svg
├── icon_godambler.svg
└── icon_godambler3d.svg
└── icon.svg
/addons/func_godot/src/core/data.gd.uid:
--------------------------------------------------------------------------------
1 | uid://cqye8dehq4c7q
2 |
--------------------------------------------------------------------------------
/addons/func_godot/src/core/parser.gd.uid:
--------------------------------------------------------------------------------
1 | uid://dflet6p5hbqts
2 |
--------------------------------------------------------------------------------
/addons/func_godot/src/func_godot_plugin.gd.uid:
--------------------------------------------------------------------------------
1 | uid://bqy3tr83l7di
2 |
--------------------------------------------------------------------------------
/addons/func_godot/src/import/quake_wad_file.gd.uid:
--------------------------------------------------------------------------------
1 | uid://cij36hpqc46c
2 |
--------------------------------------------------------------------------------
/addons/func_godot/src/map/func_godot_map.gd.uid:
--------------------------------------------------------------------------------
1 | uid://cwu5cf7a0awcd
2 |
--------------------------------------------------------------------------------
/addons/func_godot/src/util/func_godot_util.gd.uid:
--------------------------------------------------------------------------------
1 | uid://bursmx2g1betd
2 |
--------------------------------------------------------------------------------
/addons/func_godot/src/core/entity_assembler.gd.uid:
--------------------------------------------------------------------------------
1 | uid://dh73tfvwp7kr6
2 |
--------------------------------------------------------------------------------
/addons/func_godot/src/core/geometry_generator.gd.uid:
--------------------------------------------------------------------------------
1 | uid://b1yg28xbyno7v
2 |
--------------------------------------------------------------------------------
/addons/func_godot/src/fgd/func_godot_fgd_file.gd.uid:
--------------------------------------------------------------------------------
1 | uid://drlmgulwbjwqu
2 |
--------------------------------------------------------------------------------
/addons/func_godot/src/import/quake_map_file.gd.uid:
--------------------------------------------------------------------------------
1 | uid://cxvwf50mehesf
2 |
--------------------------------------------------------------------------------
/addons/func_godot/src/import/quake_palette_file.gd.uid:
--------------------------------------------------------------------------------
1 | uid://dqhjx7jjbif5d
2 |
--------------------------------------------------------------------------------
/addons/func_godot/src/fgd/func_godot_fgd_base_class.gd.uid:
--------------------------------------------------------------------------------
1 | uid://ck575aqs1sbrb
2 |
--------------------------------------------------------------------------------
/addons/func_godot/src/fgd/func_godot_fgd_point_class.gd.uid:
--------------------------------------------------------------------------------
1 | uid://cxsqwtsqd8w33
2 |
--------------------------------------------------------------------------------
/addons/func_godot/src/fgd/func_godot_fgd_solid_class.gd.uid:
--------------------------------------------------------------------------------
1 | uid://5cow84q03m6a
2 |
--------------------------------------------------------------------------------
/addons/func_godot/src/import/quake_map_import_plugin.gd.uid:
--------------------------------------------------------------------------------
1 | uid://dnsj08ot32vpc
2 |
--------------------------------------------------------------------------------
/addons/func_godot/src/import/quake_wad_import_plugin.gd.uid:
--------------------------------------------------------------------------------
1 | uid://ridgf32rxg6s
2 |
--------------------------------------------------------------------------------
/addons/func_godot/src/map/func_godot_map_settings.gd.uid:
--------------------------------------------------------------------------------
1 | uid://38q6k0ctahjn
2 |
--------------------------------------------------------------------------------
/addons/func_godot/src/trenchbroom/trenchbroom_tag.gd.uid:
--------------------------------------------------------------------------------
1 | uid://b66qdknwqpfup
2 |
--------------------------------------------------------------------------------
/addons/func_godot/src/util/func_godot_local_config.gd.uid:
--------------------------------------------------------------------------------
1 | uid://xsjnhahhyein
2 |
--------------------------------------------------------------------------------
/addons/func_godot/src/fgd/func_godot_fgd_entity_class.gd.uid:
--------------------------------------------------------------------------------
1 | uid://cgkrrgcimlr8y
2 |
--------------------------------------------------------------------------------
/addons/func_godot/src/fgd/func_godot_fgd_model_point_class.gd.uid:
--------------------------------------------------------------------------------
1 | uid://ldfqjtq0br35
2 |
--------------------------------------------------------------------------------
/addons/func_godot/src/import/quake_palette_import_plugin.gd.uid:
--------------------------------------------------------------------------------
1 | uid://c6k7hftart3u3
2 |
--------------------------------------------------------------------------------
/addons/func_godot/src/trenchbroom/trenchbroom_game_config.gd.uid:
--------------------------------------------------------------------------------
1 | uid://cx44c4vnq8bt5
2 |
--------------------------------------------------------------------------------
/addons/func_godot/src/netradiant_custom/netradiant_custom_shader.gd.uid:
--------------------------------------------------------------------------------
1 | uid://dn86acprv4e86
2 |
--------------------------------------------------------------------------------
/addons/func_godot/src/fgd/func_godot_fgd_point_class_display_descriptor.gd.uid:
--------------------------------------------------------------------------------
1 | uid://d1nwwgcrner8b
2 |
--------------------------------------------------------------------------------
/addons/func_godot/src/netradiant_custom/netradiant_custom_gamepack_config.gd.uid:
--------------------------------------------------------------------------------
1 | uid://dfhj3me2g5j0l
2 |
--------------------------------------------------------------------------------
/addons/func_godot/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/func-godot/func_godot_plugin/HEAD/addons/func_godot/icon.png
--------------------------------------------------------------------------------
/addons/func_godot/icon32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/func-godot/func_godot_plugin/HEAD/addons/func_godot/icon32.png
--------------------------------------------------------------------------------
/addons/func_godot/palette.lmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/func-godot/func_godot_plugin/HEAD/addons/func_godot/palette.lmp
--------------------------------------------------------------------------------
/addons/func_godot/textures/clip.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/func-godot/func_godot_plugin/HEAD/addons/func_godot/textures/clip.png
--------------------------------------------------------------------------------
/addons/func_godot/textures/origin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/func-godot/func_godot_plugin/HEAD/addons/func_godot/textures/origin.png
--------------------------------------------------------------------------------
/addons/func_godot/textures/skip.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/func-godot/func_godot_plugin/HEAD/addons/func_godot/textures/skip.png
--------------------------------------------------------------------------------
/addons/func_godot/textures/default_texture.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/func-godot/func_godot_plugin/HEAD/addons/func_godot/textures/default_texture.png
--------------------------------------------------------------------------------
/addons/func_godot/plugin.cfg:
--------------------------------------------------------------------------------
1 | [plugin]
2 |
3 | name="FuncGodot"
4 | description="Quake .map and Half-Life .vmf file support for Godot."
5 | author="Josh Palmer, Hannah Crawford, Emberlynn Bland, Tim Maccabe, Vera Lux, func_godot Community"
6 | version="2025.11"
7 | script="src/func_godot_plugin.gd"
8 |
--------------------------------------------------------------------------------
/addons/func_godot/func_godot_local_config.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Resource" script_class="FuncGodotLocalConfig" load_steps=2 format=3 uid="uid://bqjt7nyekxgog"]
2 |
3 | [ext_resource type="Script" uid="uid://xsjnhahhyein" path="res://addons/func_godot/src/util/func_godot_local_config.gd" id="1_g8kqj"]
4 |
5 | [resource]
6 | script = ExtResource("1_g8kqj")
7 |
--------------------------------------------------------------------------------
/addons/func_godot/textures/default_material.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="StandardMaterial3D" load_steps=2 format=3 uid="uid://cvex6toty8yn7"]
2 |
3 | [ext_resource type="Texture2D" uid="uid://cyg2snr1w5xw5" path="res://addons/func_godot/textures/default_texture.png" id="1_ncj77"]
4 |
5 | [resource]
6 | albedo_texture = ExtResource("1_ncj77")
7 | metallic_specular = 0.0
8 | texture_filter = 2
9 |
--------------------------------------------------------------------------------
/addons/func_godot/game_config/trenchbroom/tb_face_tag_clip.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Resource" script_class="TrenchBroomTag" load_steps=2 format=3 uid="uid://b4xhdj0e16lop"]
2 |
3 | [ext_resource type="Script" uid="uid://b66qdknwqpfup" path="res://addons/func_godot/src/trenchbroom/trenchbroom_tag.gd" id="1_7td58"]
4 |
5 | [resource]
6 | script = ExtResource("1_7td58")
7 | tag_name = "Clip"
8 | tag_pattern = "clip"
9 |
--------------------------------------------------------------------------------
/addons/func_godot/game_config/trenchbroom/tb_face_tag_skip.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Resource" script_class="TrenchBroomTag" load_steps=2 format=3 uid="uid://ca7377sfgj074"]
2 |
3 | [ext_resource type="Script" uid="uid://b66qdknwqpfup" path="res://addons/func_godot/src/trenchbroom/trenchbroom_tag.gd" id="1_2teqe"]
4 |
5 | [resource]
6 | script = ExtResource("1_2teqe")
7 | tag_name = "Skip"
8 | tag_pattern = "skip"
9 |
--------------------------------------------------------------------------------
/addons/func_godot/palette.lmp.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="func_godot.palette"
4 | type="Resource"
5 | uid="uid://drgnc41yfybr"
6 | path="res://.godot/imported/palette.lmp-138c33f2ac0cab3ad6373e7c0425cf00.tres"
7 |
8 | [deps]
9 |
10 | source_file="res://addons/func_godot/palette.lmp"
11 | dest_files=["res://.godot/imported/palette.lmp-138c33f2ac0cab3ad6373e7c0425cf00.tres"]
12 |
13 | [params]
14 |
15 |
--------------------------------------------------------------------------------
/addons/func_godot/game_config/trenchbroom/tb_face_tag_origin.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Resource" script_class="TrenchBroomTag" load_steps=2 format=3 uid="uid://bkjxc54mmdhbo"]
2 |
3 | [ext_resource type="Script" uid="uid://b66qdknwqpfup" path="res://addons/func_godot/src/trenchbroom/trenchbroom_tag.gd" id="1_enkfc"]
4 |
5 | [resource]
6 | script = ExtResource("1_enkfc")
7 | tag_name = "Origin"
8 | tag_pattern = "origin"
9 |
--------------------------------------------------------------------------------
/addons/func_godot/game_config/netradiant_custom/netradiant_custom_shader_clip.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Resource" script_class="NetRadiantCustomShader" load_steps=2 format=3 uid="uid://f5erfnvbg6b7"]
2 |
3 | [ext_resource type="Script" uid="uid://dn86acprv4e86" path="res://addons/func_godot/src/netradiant_custom/netradiant_custom_shader.gd" id="1_cuylw"]
4 |
5 | [resource]
6 | script = ExtResource("1_cuylw")
7 | texture_path = "textures/clip"
8 |
--------------------------------------------------------------------------------
/addons/func_godot/game_config/netradiant_custom/netradiant_custom_shader_skip.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Resource" script_class="NetRadiantCustomShader" load_steps=2 format=3 uid="uid://cfhg30jclb4lw"]
2 |
3 | [ext_resource type="Script" uid="uid://dn86acprv4e86" path="res://addons/func_godot/src/netradiant_custom/netradiant_custom_shader.gd" id="1_4ja6h"]
4 |
5 | [resource]
6 | script = ExtResource("1_4ja6h")
7 | texture_path = "textures/skip"
8 |
--------------------------------------------------------------------------------
/addons/func_godot/game_config/netradiant_custom/netradiant_custom_shader_origin.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Resource" script_class="NetRadiantCustomShader" load_steps=2 format=3 uid="uid://bpnj14oaufdpt"]
2 |
3 | [ext_resource type="Script" uid="uid://dn86acprv4e86" path="res://addons/func_godot/src/netradiant_custom/netradiant_custom_shader.gd" id="1_ah2cp"]
4 |
5 | [resource]
6 | script = ExtResource("1_ah2cp")
7 | texture_path = "textures/origin"
8 |
--------------------------------------------------------------------------------
/addons/func_godot/game_config/trenchbroom/tb_brush_tag_func.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Resource" script_class="TrenchBroomTag" load_steps=2 format=3 uid="uid://37iduqf7tpxq"]
2 |
3 | [ext_resource type="Script" uid="uid://b66qdknwqpfup" path="res://addons/func_godot/src/trenchbroom/trenchbroom_tag.gd" id="1_rn13a"]
4 |
5 | [resource]
6 | script = ExtResource("1_rn13a")
7 | tag_name = "Func"
8 | tag_attributes = Array[String]([])
9 | tag_match_type = 1
10 | tag_pattern = "func*"
11 |
--------------------------------------------------------------------------------
/addons/func_godot/game_config/trenchbroom/tb_brush_tag_trigger.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Resource" script_class="TrenchBroomTag" load_steps=2 format=3 uid="uid://co2sb1ng7cw4i"]
2 |
3 | [ext_resource type="Script" uid="uid://b66qdknwqpfup" path="res://addons/func_godot/src/trenchbroom/trenchbroom_tag.gd" id="1_msqpk"]
4 |
5 | [resource]
6 | script = ExtResource("1_msqpk")
7 | tag_name = "Trigger"
8 | tag_match_type = 1
9 | tag_pattern = "trigger*"
10 | texture_name = "trigger"
11 |
--------------------------------------------------------------------------------
/addons/func_godot/src/import/quake_palette_file.gd:
--------------------------------------------------------------------------------
1 | @icon("res://addons/func_godot/icons/icon_quake_file.svg")
2 | class_name QuakePaletteFile extends Resource
3 | ## Quake LMP palette format file used with [QuakeWadFile].
4 | ##
5 | ## Quake LMP palette format file used in conjunction with a Quake WAD2 format [QuakeWadFile].
6 | ## Not required for the Valve WAD3 format.
7 | ##
8 | ## @tutorial(Quake Wiki Palette Article): https://quakewiki.org/wiki/Quake_palette#palette.lmp
9 |
10 | ## Collection of [Color]s retrieved from the LMP palette file.
11 | @export var colors: PackedColorArray
12 |
13 | func _init(colors):
14 | self.colors = colors
15 |
--------------------------------------------------------------------------------
/addons/func_godot/src/netradiant_custom/netradiant_custom_shader.gd:
--------------------------------------------------------------------------------
1 | @icon("res://addons/func_godot/icons/icon_godot_ranger.svg")
2 | class_name NetRadiantCustomShader
3 | extends Resource
4 | ## Shader resource for NetRadiant Custom configurations.
5 | ##
6 | ## Resource that gets built into a shader file that applies a special effect to a specified texture in NetRadiant Custom.
7 |
8 | ## Path to texture without extension, eg: [i]"textures/special/clip"[/i].
9 | @export var texture_path: String
10 |
11 | ## Array of shader properties to apply to faces using [member texture_path].
12 | @export var shader_attributes : Array[String] = ["qer_trans 0.4"]
13 |
--------------------------------------------------------------------------------
/addons/func_godot/src/import/quake_map_file.gd:
--------------------------------------------------------------------------------
1 | @icon("res://addons/func_godot/icons/icon_quake_file.svg")
2 | class_name QuakeMapFile extends Resource
3 | ## Map file that can be built by [FuncGodotMap].
4 | ##
5 | ## Map file that can be built by a [FuncGodotMap]. Supports the Quake and Valve map formats.
6 | ##
7 | ## @tutorial(Quake Wiki Map Format Article): https://quakewiki.org/wiki/Quake_Map_Format
8 | ## @tutorial(Valve Developer Wiki VMF Article): https://developer.valvesoftware.com/wiki/VMF_(Valve_Map_Format)
9 |
10 | ## Number of times this map file has been imported.
11 | @export var revision: int = 0
12 |
13 | ## Raw map data.
14 | @export_multiline var map_data: String = ""
15 |
--------------------------------------------------------------------------------
/addons/func_godot/src/import/quake_wad_file.gd:
--------------------------------------------------------------------------------
1 | @icon("res://addons/func_godot/icons/icon_quake_file.svg")
2 | class_name QuakeWadFile extends Resource
3 | ## Texture container in the WAD2 or WAD3 format.
4 | ##
5 | ## Texture container in the Quake WAD2 or Valve WAD3 format.
6 | ##
7 | ## @tutorial(Quake Wiki WAD Article): https://quakewiki.org/wiki/Texture_Wad
8 | ## @tutorial(Valve Developer Wiki WAD3 Article): https://developer.valvesoftware.com/wiki/WAD
9 |
10 | ## Collection of [ImageTexture] imported from the WAD file.
11 | @export var textures: Dictionary[String, ImageTexture]
12 |
13 | func _init(textures: Dictionary[String, ImageTexture] = {}):
14 | self.textures = textures
15 |
--------------------------------------------------------------------------------
/addons/func_godot/fgd/phong_base.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Resource" script_class="FuncGodotFGDBaseClass" load_steps=2 format=3 uid="uid://nayxb8n7see2"]
2 |
3 | [ext_resource type="Script" uid="uid://ck575aqs1sbrb" path="res://addons/func_godot/src/fgd/func_godot_fgd_base_class.gd" id="1_04y3n"]
4 |
5 | [resource]
6 | script = ExtResource("1_04y3n")
7 | classname = "Phong"
8 | description = "Phong shading options for SolidClass geometry."
9 | class_properties = Dictionary[String, Variant]({
10 | "_phong": {
11 | "Disabled": 0,
12 | "Smooth shading": 1
13 | },
14 | "_phong_angle": 89.0
15 | })
16 | class_property_descriptions = Dictionary[String, Variant]({
17 | "_phong": ["Phong shading", 0],
18 | "_phong_angle": "Phong smoothing angle"
19 | })
20 |
--------------------------------------------------------------------------------
/addons/func_godot/func_godot_default_map_settings.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Resource" script_class="FuncGodotMapSettings" load_steps=5 format=3 uid="uid://bkhxcqsquw1yg"]
2 |
3 | [ext_resource type="Material" uid="uid://cvex6toty8yn7" path="res://addons/func_godot/textures/default_material.tres" id="1_8l5wm"]
4 | [ext_resource type="Script" uid="uid://38q6k0ctahjn" path="res://addons/func_godot/src/map/func_godot_map_settings.gd" id="1_dlf23"]
5 | [ext_resource type="Resource" uid="uid://crgpdahjaj" path="res://addons/func_godot/fgd/func_godot_fgd.tres" id="2_hf4oi"]
6 | [ext_resource type="Script" uid="uid://cij36hpqc46c" path="res://addons/func_godot/src/import/quake_wad_file.gd" id="4_576s4"]
7 |
8 | [resource]
9 | script = ExtResource("1_dlf23")
10 |
--------------------------------------------------------------------------------
/addons/func_godot/fgd/vertex_merge_distance_base.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Resource" script_class="FuncGodotFGDBaseClass" load_steps=2 format=3 uid="uid://doo4ly322b4jc"]
2 |
3 | [ext_resource type="Script" uid="uid://ck575aqs1sbrb" path="res://addons/func_godot/src/fgd/func_godot_fgd_base_class.gd" id="1_h3atm"]
4 |
5 | [resource]
6 | script = ExtResource("1_h3atm")
7 | classname = "VertexMergeDistance"
8 | description = "Adjustable value to snap vertices to on map build. This can reduce instances of seams between polygons."
9 | class_properties = Dictionary[String, Variant]({
10 | "_vertex_merge_distance": 0.03125
11 | })
12 | class_property_descriptions = Dictionary[String, Variant]({
13 | "_vertex_merge_distance": "Adjustable value to snap vertices to on map build. This can reduce instances of seams between polygons."
14 | })
15 | metadata/_custom_type_script = "uid://ck575aqs1sbrb"
16 |
--------------------------------------------------------------------------------
/addons/func_godot/fgd/cull_interior_faces.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Resource" script_class="FuncGodotFGDBaseClass" load_steps=2 format=3 uid="uid://bcdsueg5pysfq"]
2 |
3 | [ext_resource type="Script" uid="uid://ck575aqs1sbrb" path="res://addons/func_godot/src/fgd/func_godot_fgd_base_class.gd" id="1_21jph"]
4 |
5 | [resource]
6 | script = ExtResource("1_21jph")
7 | classname = "CullInteriorFaces"
8 | description = "Cull interior faces option for SolidClass Geometry"
9 | class_properties = Dictionary[String, Variant]({
10 | "_cull_interior_faces": false
11 | })
12 | class_property_descriptions = Dictionary[String, Variant]({
13 | "_cull_interior_faces": "If true, cull interior faces with matching vertices or faces that are flush within a larger face. Note: This has a performance impact that scales with how many brushes are in the brush entity."
14 | })
15 | metadata/_custom_type_script = "uid://cgkrrgcimlr8y"
16 |
--------------------------------------------------------------------------------
/addons/func_godot/src/fgd/func_godot_fgd_base_class.gd:
--------------------------------------------------------------------------------
1 | @tool
2 | @icon("res://addons/func_godot/icons/icon_godot_ranger.svg")
3 | class_name FuncGodotFGDBaseClass extends FuncGodotFGDEntityClass
4 | ## Special inheritance class for [FuncGodotFGDSolidClass] and [FuncGodotFGDPointClass] entity definitions.
5 | ##
6 | ## Inheritance class for [FuncGodotFGDSolidClass] and [FuncGodotFGDPointClass] entities,
7 | ## used to shared or common properties and descriptions across different definitions.
8 | ##
9 | ## @tutorial(Quake Wiki Entity Article): https://quakewiki.org/wiki/Entity
10 | ## @tutorial(Level Design Book: Entity Types and Settings): https://book.leveldesignbook.com/appendix/resources/formats/fgd#entity-types-and-settings-basic
11 | ## @tutorial(Valve Developer Wiki FGD Article): https://developer.valvesoftware.com/wiki/FGD#Class_Types_and_Properties
12 |
13 | func _init() -> void:
14 | prefix = "@BaseClass"
15 |
--------------------------------------------------------------------------------
/addons/func_godot/fgd/worldspawn.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Resource" script_class="FuncGodotFGDSolidClass" load_steps=4 format=3 uid="uid://bdji3873bg32h"]
2 |
3 | [ext_resource type="Script" uid="uid://5cow84q03m6a" path="res://addons/func_godot/src/fgd/func_godot_fgd_solid_class.gd" id="1_62t8m"]
4 | [ext_resource type="Resource" uid="uid://doo4ly322b4jc" path="res://addons/func_godot/fgd/vertex_merge_distance_base.tres" id="1_h1046"]
5 | [ext_resource type="Resource" uid="uid://bcdsueg5pysfq" path="res://addons/func_godot/fgd/cull_interior_faces.tres" id="2_ky6lr"]
6 |
7 | [resource]
8 | script = ExtResource("1_62t8m")
9 | spawn_type = 0
10 | origin_type = 1
11 | collision_mask = 0
12 | classname = "worldspawn"
13 | description = "Default static world geometry. Builds a StaticBody3D with a single MeshInstance3D and a single convex CollisionShape3D shape."
14 | base_classes = Array[Resource]([ExtResource("1_h1046"), ExtResource("2_ky6lr")])
15 | meta_properties = Dictionary[String, Variant]({
16 | "color": Color(0.8, 0.8, 0.8, 1)
17 | })
18 | node_class = "StaticBody3D"
19 |
--------------------------------------------------------------------------------
/addons/func_godot/game_config/trenchbroom/func_godot_tb_game_config.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Resource" script_class="TrenchBroomGameConfig" load_steps=7 format=3 uid="uid://b44ah5b2000wa"]
2 |
3 | [ext_resource type="Resource" uid="uid://crgpdahjaj" path="res://addons/func_godot/fgd/func_godot_fgd.tres" id="1_8u1vq"]
4 | [ext_resource type="Resource" uid="uid://b4xhdj0e16lop" path="res://addons/func_godot/game_config/trenchbroom/tb_face_tag_clip.tres" id="1_rsp20"]
5 | [ext_resource type="Resource" uid="uid://ca7377sfgj074" path="res://addons/func_godot/game_config/trenchbroom/tb_face_tag_skip.tres" id="2_166i2"]
6 | [ext_resource type="Script" uid="uid://cx44c4vnq8bt5" path="res://addons/func_godot/src/trenchbroom/trenchbroom_game_config.gd" id="2_ns6ah"]
7 | [ext_resource type="Resource" uid="uid://bkjxc54mmdhbo" path="res://addons/func_godot/game_config/trenchbroom/tb_face_tag_origin.tres" id="3_stisi"]
8 | [ext_resource type="Texture2D" uid="uid://decwujsyhj0qy" path="res://addons/func_godot/icon32.png" id="6_tex5j"]
9 |
10 | [resource]
11 | script = ExtResource("2_ns6ah")
12 |
--------------------------------------------------------------------------------
/addons/func_godot/icon.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://cp2as6ujvknyu"
6 | path="res://.godot/imported/icon.png-6db43b6a52df1ce3744a82f15cbdbbea.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/func_godot/icon.png"
14 | dest_files=["res://.godot/imported/icon.png-6db43b6a52df1ce3744a82f15cbdbbea.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/uastc_level=0
22 | compress/rdo_quality_loss=0.0
23 | compress/hdr_compression=1
24 | compress/normal_map=0
25 | compress/channel_pack=0
26 | mipmaps/generate=false
27 | mipmaps/limit=-1
28 | roughness/mode=0
29 | roughness/src_normal=""
30 | process/channel_remap/red=0
31 | process/channel_remap/green=1
32 | process/channel_remap/blue=2
33 | process/channel_remap/alpha=3
34 | process/fix_alpha_border=true
35 | process/premult_alpha=false
36 | process/normal_map_invert_y=false
37 | process/hdr_as_srgb=false
38 | process/hdr_clamp_exposure=false
39 | process/size_limit=0
40 | detect_3d/compress_to=1
41 |
--------------------------------------------------------------------------------
/addons/func_godot/icon32.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://decwujsyhj0qy"
6 | path="res://.godot/imported/icon32.png-7025e2d95a64a3066b7947e1900b4daf.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/func_godot/icon32.png"
14 | dest_files=["res://.godot/imported/icon32.png-7025e2d95a64a3066b7947e1900b4daf.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/uastc_level=0
22 | compress/rdo_quality_loss=0.0
23 | compress/hdr_compression=1
24 | compress/normal_map=0
25 | compress/channel_pack=0
26 | mipmaps/generate=false
27 | mipmaps/limit=-1
28 | roughness/mode=0
29 | roughness/src_normal=""
30 | process/channel_remap/red=0
31 | process/channel_remap/green=1
32 | process/channel_remap/blue=2
33 | process/channel_remap/alpha=3
34 | process/fix_alpha_border=true
35 | process/premult_alpha=false
36 | process/normal_map_invert_y=false
37 | process/hdr_as_srgb=false
38 | process/hdr_clamp_exposure=false
39 | process/size_limit=0
40 | detect_3d/compress_to=1
41 |
--------------------------------------------------------------------------------
/addons/func_godot/textures/clip.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://dhmu0toe1itnr"
6 | path="res://.godot/imported/clip.png-747f19bfc6fe499e254d63eeccc3bbe4.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/func_godot/textures/clip.png"
14 | dest_files=["res://.godot/imported/clip.png-747f19bfc6fe499e254d63eeccc3bbe4.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=3
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/uastc_level=0
22 | compress/rdo_quality_loss=0.0
23 | compress/hdr_compression=1
24 | compress/normal_map=0
25 | compress/channel_pack=0
26 | mipmaps/generate=false
27 | mipmaps/limit=-1
28 | roughness/mode=0
29 | roughness/src_normal=""
30 | process/channel_remap/red=0
31 | process/channel_remap/green=1
32 | process/channel_remap/blue=2
33 | process/channel_remap/alpha=3
34 | process/fix_alpha_border=true
35 | process/premult_alpha=false
36 | process/normal_map_invert_y=false
37 | process/hdr_as_srgb=false
38 | process/hdr_clamp_exposure=false
39 | process/size_limit=0
40 | detect_3d/compress_to=1
41 |
--------------------------------------------------------------------------------
/addons/func_godot/textures/skip.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://bk5oo263y3u7w"
6 | path="res://.godot/imported/skip.png-b8ce29eeb9f4be76c300a81fd41322fa.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/func_godot/textures/skip.png"
14 | dest_files=["res://.godot/imported/skip.png-b8ce29eeb9f4be76c300a81fd41322fa.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=3
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/uastc_level=0
22 | compress/rdo_quality_loss=0.0
23 | compress/hdr_compression=1
24 | compress/normal_map=0
25 | compress/channel_pack=0
26 | mipmaps/generate=false
27 | mipmaps/limit=-1
28 | roughness/mode=0
29 | roughness/src_normal=""
30 | process/channel_remap/red=0
31 | process/channel_remap/green=1
32 | process/channel_remap/blue=2
33 | process/channel_remap/alpha=3
34 | process/fix_alpha_border=true
35 | process/premult_alpha=false
36 | process/normal_map_invert_y=false
37 | process/hdr_as_srgb=false
38 | process/hdr_clamp_exposure=false
39 | process/size_limit=0
40 | detect_3d/compress_to=1
41 |
--------------------------------------------------------------------------------
/addons/func_godot/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 func-godot
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/addons/func_godot/textures/origin.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://dutip72dl002r"
6 | path="res://.godot/imported/origin.png-501c9242087fbbeb03d876a682f0832c.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/func_godot/textures/origin.png"
14 | dest_files=["res://.godot/imported/origin.png-501c9242087fbbeb03d876a682f0832c.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/uastc_level=0
22 | compress/rdo_quality_loss=0.0
23 | compress/hdr_compression=1
24 | compress/normal_map=0
25 | compress/channel_pack=0
26 | mipmaps/generate=false
27 | mipmaps/limit=-1
28 | roughness/mode=0
29 | roughness/src_normal=""
30 | process/channel_remap/red=0
31 | process/channel_remap/green=1
32 | process/channel_remap/blue=2
33 | process/channel_remap/alpha=3
34 | process/fix_alpha_border=true
35 | process/premult_alpha=false
36 | process/normal_map_invert_y=false
37 | process/hdr_as_srgb=false
38 | process/hdr_clamp_exposure=false
39 | process/size_limit=0
40 | detect_3d/compress_to=1
41 |
--------------------------------------------------------------------------------
/addons/func_godot/fgd/func_detail_illusionary.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Resource" script_class="FuncGodotFGDSolidClass" load_steps=5 format=3 uid="uid://ch3e0dix85uhb"]
2 |
3 | [ext_resource type="Resource" uid="uid://nayxb8n7see2" path="res://addons/func_godot/fgd/phong_base.tres" id="1_ar63x"]
4 | [ext_resource type="Resource" uid="uid://doo4ly322b4jc" path="res://addons/func_godot/fgd/vertex_merge_distance_base.tres" id="2_j7vgq"]
5 | [ext_resource type="Script" uid="uid://5cow84q03m6a" path="res://addons/func_godot/src/fgd/func_godot_fgd_solid_class.gd" id="2_lhb87"]
6 | [ext_resource type="Resource" uid="uid://bcdsueg5pysfq" path="res://addons/func_godot/fgd/cull_interior_faces.tres" id="3_1mhrv"]
7 |
8 | [resource]
9 | script = ExtResource("2_lhb87")
10 | collision_shape_type = 0
11 | classname = "func_detail_illusionary"
12 | description = "Static geometry with no collision. Builds a Node3D with a MeshInstance3D. Does not occlude other VisualInstance3D nodes."
13 | base_classes = Array[Resource]([ExtResource("1_ar63x"), ExtResource("2_j7vgq"), ExtResource("3_1mhrv")])
14 | meta_properties = Dictionary[String, Variant]({
15 | "color": Color(0.8, 0.8, 0.8, 1)
16 | })
17 | node_class = "Node3D"
18 |
--------------------------------------------------------------------------------
/addons/func_godot/textures/default_texture.png.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://cyg2snr1w5xw5"
6 | path="res://.godot/imported/default_texture.png-145fbd5fef7f63ace60797fecb133a19.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/func_godot/textures/default_texture.png"
14 | dest_files=["res://.godot/imported/default_texture.png-145fbd5fef7f63ace60797fecb133a19.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=3
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/uastc_level=0
22 | compress/rdo_quality_loss=0.0
23 | compress/hdr_compression=1
24 | compress/normal_map=0
25 | compress/channel_pack=0
26 | mipmaps/generate=true
27 | mipmaps/limit=-1
28 | roughness/mode=0
29 | roughness/src_normal=""
30 | process/channel_remap/red=0
31 | process/channel_remap/green=1
32 | process/channel_remap/blue=2
33 | process/channel_remap/alpha=3
34 | process/fix_alpha_border=true
35 | process/premult_alpha=false
36 | process/normal_map_invert_y=false
37 | process/hdr_as_srgb=false
38 | process/hdr_clamp_exposure=false
39 | process/size_limit=0
40 | detect_3d/compress_to=0
41 |
--------------------------------------------------------------------------------
/addons/func_godot/fgd/func_geo.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Resource" script_class="FuncGodotFGDSolidClass" load_steps=5 format=3 uid="uid://b70vf4t5dc70t"]
2 |
3 | [ext_resource type="Resource" uid="uid://nayxb8n7see2" path="res://addons/func_godot/fgd/phong_base.tres" id="1_5mwee"]
4 | [ext_resource type="Script" uid="uid://5cow84q03m6a" path="res://addons/func_godot/src/fgd/func_godot_fgd_solid_class.gd" id="2_8o081"]
5 | [ext_resource type="Resource" uid="uid://doo4ly322b4jc" path="res://addons/func_godot/fgd/vertex_merge_distance_base.tres" id="2_bp8pb"]
6 | [ext_resource type="Resource" uid="uid://bcdsueg5pysfq" path="res://addons/func_godot/fgd/cull_interior_faces.tres" id="3_xnsya"]
7 |
8 | [resource]
9 | script = ExtResource("2_8o081")
10 | build_occlusion = true
11 | collision_shape_type = 2
12 | collision_mask = 0
13 | classname = "func_geo"
14 | description = "Static collidable geometry. Builds a StaticBody3D with a MeshInstance3D, a single concave CollisionShape3D, and an OccluderInstance3D."
15 | base_classes = Array[Resource]([ExtResource("1_5mwee"), ExtResource("2_bp8pb"), ExtResource("3_xnsya")])
16 | meta_properties = Dictionary[String, Variant]({
17 | "color": Color(0.8, 0.8, 0.8, 1)
18 | })
19 | node_class = "StaticBody3D"
20 |
--------------------------------------------------------------------------------
/addons/func_godot/fgd/func_illusionary.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Resource" script_class="FuncGodotFGDSolidClass" load_steps=5 format=3 uid="uid://dg5x44cc7flew"]
2 |
3 | [ext_resource type="Resource" uid="uid://nayxb8n7see2" path="res://addons/func_godot/fgd/phong_base.tres" id="1_kv0mq"]
4 | [ext_resource type="Resource" uid="uid://doo4ly322b4jc" path="res://addons/func_godot/fgd/vertex_merge_distance_base.tres" id="2_hovr4"]
5 | [ext_resource type="Script" uid="uid://5cow84q03m6a" path="res://addons/func_godot/src/fgd/func_godot_fgd_solid_class.gd" id="2_uffhi"]
6 | [ext_resource type="Resource" uid="uid://bcdsueg5pysfq" path="res://addons/func_godot/fgd/cull_interior_faces.tres" id="3_woywv"]
7 |
8 | [resource]
9 | script = ExtResource("2_uffhi")
10 | build_occlusion = true
11 | collision_shape_type = 0
12 | classname = "func_illusionary"
13 | description = "Static geometry with no collision. Builds a Node3D with a MeshInstance3D and an Occluder3D to aid in render culling of other VisualInstance3D nodes."
14 | base_classes = Array[Resource]([ExtResource("1_kv0mq"), ExtResource("2_hovr4"), ExtResource("3_woywv")])
15 | meta_properties = Dictionary[String, Variant]({
16 | "color": Color(0.8, 0.8, 0.8, 1)
17 | })
18 | node_class = "Node3D"
19 |
--------------------------------------------------------------------------------
/addons/func_godot/fgd/func_detail.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Resource" script_class="FuncGodotFGDSolidClass" load_steps=5 format=3 uid="uid://cxy7jnh6d7msn"]
2 |
3 | [ext_resource type="Script" uid="uid://5cow84q03m6a" path="res://addons/func_godot/src/fgd/func_godot_fgd_solid_class.gd" id="1_0fsmp"]
4 | [ext_resource type="Resource" uid="uid://nayxb8n7see2" path="res://addons/func_godot/fgd/phong_base.tres" id="1_c3bns"]
5 | [ext_resource type="Resource" uid="uid://doo4ly322b4jc" path="res://addons/func_godot/fgd/vertex_merge_distance_base.tres" id="2_c03gr"]
6 | [ext_resource type="Resource" uid="uid://bcdsueg5pysfq" path="res://addons/func_godot/fgd/cull_interior_faces.tres" id="3_wuxhx"]
7 |
8 | [resource]
9 | script = ExtResource("1_0fsmp")
10 | collision_shape_type = 2
11 | collision_mask = 0
12 | classname = "func_detail"
13 | description = "Static collidable geometry. Builds a StaticBody3D with a MeshInstance3D and a single concave CollisionShape3D. Does not occlude other VisualInstance3D nodes."
14 | base_classes = Array[Resource]([ExtResource("1_c3bns"), ExtResource("2_c03gr"), ExtResource("3_wuxhx")])
15 | meta_properties = Dictionary[String, Variant]({
16 | "color": Color(0.8, 0.8, 0.8, 1)
17 | })
18 | node_class = "StaticBody3D"
19 |
--------------------------------------------------------------------------------
/addons/func_godot/game_config/netradiant_custom/func_godot_netradiant_custom_gamepack_config.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Resource" script_class="NetRadiantCustomGamePackConfig" load_steps=6 format=3 uid="uid://cv1k2e85fo2ax"]
2 |
3 | [ext_resource type="Resource" uid="uid://crgpdahjaj" path="res://addons/func_godot/fgd/func_godot_fgd.tres" id="1_gct4v"]
4 | [ext_resource type="Script" uid="uid://dfhj3me2g5j0l" path="res://addons/func_godot/src/netradiant_custom/netradiant_custom_gamepack_config.gd" id="2_en8ro"]
5 | [ext_resource type="Resource" uid="uid://f5erfnvbg6b7" path="res://addons/func_godot/game_config/netradiant_custom/netradiant_custom_shader_clip.tres" id="2_w7psh"]
6 | [ext_resource type="Resource" uid="uid://cfhg30jclb4lw" path="res://addons/func_godot/game_config/netradiant_custom/netradiant_custom_shader_skip.tres" id="3_6gpk8"]
7 | [ext_resource type="Resource" uid="uid://bpnj14oaufdpt" path="res://addons/func_godot/game_config/netradiant_custom/netradiant_custom_shader_origin.tres" id="4_8rl60"]
8 |
9 | [resource]
10 | script = ExtResource("2_en8ro")
11 | model_types = PackedStringArray("glb", "gltf", "obj")
12 | sound_types = PackedStringArray("wav", "ogg")
13 | texture_types = PackedStringArray("png", "jpg", "jpeg", "bmp", "tga")
14 |
--------------------------------------------------------------------------------
/addons/func_godot/icon.svg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://bx5buvf1ydm7q"
6 | path="res://.godot/imported/icon.svg-99f2c56e0c1ce867c819715c68d9c120.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/func_godot/icon.svg"
14 | dest_files=["res://.godot/imported/icon.svg-99f2c56e0c1ce867c819715c68d9c120.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/uastc_level=0
22 | compress/rdo_quality_loss=0.0
23 | compress/hdr_compression=1
24 | compress/normal_map=0
25 | compress/channel_pack=0
26 | mipmaps/generate=false
27 | mipmaps/limit=-1
28 | roughness/mode=0
29 | roughness/src_normal=""
30 | process/channel_remap/red=0
31 | process/channel_remap/green=1
32 | process/channel_remap/blue=2
33 | process/channel_remap/alpha=3
34 | process/fix_alpha_border=true
35 | process/premult_alpha=false
36 | process/normal_map_invert_y=false
37 | process/hdr_as_srgb=false
38 | process/hdr_clamp_exposure=false
39 | process/size_limit=0
40 | detect_3d/compress_to=1
41 | svg/scale=1.0
42 | editor/scale_with_editor_scale=false
43 | editor/convert_colors_with_editor_theme=false
44 |
--------------------------------------------------------------------------------
/addons/func_godot/icons/icon_slipgate.svg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://bw74kacajcaxb"
6 | path="res://.godot/imported/icon_slipgate.svg-f42668b28b92f93c031f56d95dfcf5a6.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/func_godot/icons/icon_slipgate.svg"
14 | dest_files=["res://.godot/imported/icon_slipgate.svg-f42668b28b92f93c031f56d95dfcf5a6.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/uastc_level=0
22 | compress/rdo_quality_loss=0.0
23 | compress/hdr_compression=1
24 | compress/normal_map=0
25 | compress/channel_pack=0
26 | mipmaps/generate=false
27 | mipmaps/limit=-1
28 | roughness/mode=0
29 | roughness/src_normal=""
30 | process/channel_remap/red=0
31 | process/channel_remap/green=1
32 | process/channel_remap/blue=2
33 | process/channel_remap/alpha=3
34 | process/fix_alpha_border=true
35 | process/premult_alpha=false
36 | process/normal_map_invert_y=false
37 | process/hdr_as_srgb=false
38 | process/hdr_clamp_exposure=false
39 | process/size_limit=0
40 | detect_3d/compress_to=1
41 | svg/scale=1.0
42 | editor/scale_with_editor_scale=false
43 | editor/convert_colors_with_editor_theme=false
44 |
--------------------------------------------------------------------------------
/addons/func_godot/icons/icon_godambler.svg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://bm2kwpq18quv0"
6 | path="res://.godot/imported/icon_godambler.svg-a6dbba375ab2a45be046a1875b8d41e6.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/func_godot/icons/icon_godambler.svg"
14 | dest_files=["res://.godot/imported/icon_godambler.svg-a6dbba375ab2a45be046a1875b8d41e6.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/uastc_level=0
22 | compress/rdo_quality_loss=0.0
23 | compress/hdr_compression=1
24 | compress/normal_map=0
25 | compress/channel_pack=0
26 | mipmaps/generate=false
27 | mipmaps/limit=-1
28 | roughness/mode=0
29 | roughness/src_normal=""
30 | process/channel_remap/red=0
31 | process/channel_remap/green=1
32 | process/channel_remap/blue=2
33 | process/channel_remap/alpha=3
34 | process/fix_alpha_border=true
35 | process/premult_alpha=false
36 | process/normal_map_invert_y=false
37 | process/hdr_as_srgb=false
38 | process/hdr_clamp_exposure=false
39 | process/size_limit=0
40 | detect_3d/compress_to=1
41 | svg/scale=1.0
42 | editor/scale_with_editor_scale=false
43 | editor/convert_colors_with_editor_theme=false
44 |
--------------------------------------------------------------------------------
/addons/func_godot/icons/icon_quake_file.svg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://c0464gp8lby0w"
6 | path="res://.godot/imported/icon_quake_file.svg-1718b9a2b5e0b124f6d72bb4c72d2ee6.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/func_godot/icons/icon_quake_file.svg"
14 | dest_files=["res://.godot/imported/icon_quake_file.svg-1718b9a2b5e0b124f6d72bb4c72d2ee6.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/uastc_level=0
22 | compress/rdo_quality_loss=0.0
23 | compress/hdr_compression=1
24 | compress/normal_map=0
25 | compress/channel_pack=0
26 | mipmaps/generate=false
27 | mipmaps/limit=-1
28 | roughness/mode=0
29 | roughness/src_normal=""
30 | process/channel_remap/red=0
31 | process/channel_remap/green=1
32 | process/channel_remap/blue=2
33 | process/channel_remap/alpha=3
34 | process/fix_alpha_border=true
35 | process/premult_alpha=false
36 | process/normal_map_invert_y=false
37 | process/hdr_as_srgb=false
38 | process/hdr_clamp_exposure=false
39 | process/size_limit=0
40 | detect_3d/compress_to=1
41 | svg/scale=1.0
42 | editor/scale_with_editor_scale=false
43 | editor/convert_colors_with_editor_theme=false
44 |
--------------------------------------------------------------------------------
/addons/func_godot/icons/icon_slipgate3d.svg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://cfvririkaa4tv"
6 | path="res://.godot/imported/icon_slipgate3d.svg-f125bef6ff5aa79b5fe3f232a083425e.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/func_godot/icons/icon_slipgate3d.svg"
14 | dest_files=["res://.godot/imported/icon_slipgate3d.svg-f125bef6ff5aa79b5fe3f232a083425e.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/uastc_level=0
22 | compress/rdo_quality_loss=0.0
23 | compress/hdr_compression=1
24 | compress/normal_map=0
25 | compress/channel_pack=0
26 | mipmaps/generate=false
27 | mipmaps/limit=-1
28 | roughness/mode=0
29 | roughness/src_normal=""
30 | process/channel_remap/red=0
31 | process/channel_remap/green=1
32 | process/channel_remap/blue=2
33 | process/channel_remap/alpha=3
34 | process/fix_alpha_border=true
35 | process/premult_alpha=false
36 | process/normal_map_invert_y=false
37 | process/hdr_as_srgb=false
38 | process/hdr_clamp_exposure=false
39 | process/size_limit=0
40 | detect_3d/compress_to=1
41 | svg/scale=1.0
42 | editor/scale_with_editor_scale=false
43 | editor/convert_colors_with_editor_theme=false
44 |
--------------------------------------------------------------------------------
/addons/func_godot/icons/icon_godambler3d.svg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://dieefivfbkovw"
6 | path="res://.godot/imported/icon_godambler3d.svg-f7df9bfe58320474198644aa06a8f3f6.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/func_godot/icons/icon_godambler3d.svg"
14 | dest_files=["res://.godot/imported/icon_godambler3d.svg-f7df9bfe58320474198644aa06a8f3f6.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/uastc_level=0
22 | compress/rdo_quality_loss=0.0
23 | compress/hdr_compression=1
24 | compress/normal_map=0
25 | compress/channel_pack=0
26 | mipmaps/generate=false
27 | mipmaps/limit=-1
28 | roughness/mode=0
29 | roughness/src_normal=""
30 | process/channel_remap/red=0
31 | process/channel_remap/green=1
32 | process/channel_remap/blue=2
33 | process/channel_remap/alpha=3
34 | process/fix_alpha_border=true
35 | process/premult_alpha=false
36 | process/normal_map_invert_y=false
37 | process/hdr_as_srgb=false
38 | process/hdr_clamp_exposure=false
39 | process/size_limit=0
40 | detect_3d/compress_to=1
41 | svg/scale=1.0
42 | editor/scale_with_editor_scale=false
43 | editor/convert_colors_with_editor_theme=false
44 |
--------------------------------------------------------------------------------
/addons/func_godot/src/import/quake_map_import_plugin.gd:
--------------------------------------------------------------------------------
1 | @tool
2 | class_name QuakeMapImportPlugin extends EditorImportPlugin
3 |
4 | func _get_importer_name() -> String:
5 | return 'func_godot.map'
6 |
7 | func _get_visible_name() -> String:
8 | return 'Quake Map'
9 |
10 | func _get_resource_type() -> String:
11 | return 'Resource'
12 |
13 | func _get_recognized_extensions() -> PackedStringArray:
14 | return PackedStringArray(['map','vmf'])
15 |
16 | func _get_priority():
17 | return 1.0
18 |
19 | func _get_save_extension() -> String:
20 | return 'tres'
21 |
22 | func _get_import_options(path, preset):
23 | return []
24 |
25 | func _get_preset_count() -> int:
26 | return 0
27 |
28 | func _get_import_order():
29 | return 0
30 |
31 | func _import(source_file, save_path, options, r_platform_variants, r_gen_files) -> Error:
32 | var save_path_str = '%s.%s' % [save_path, _get_save_extension()]
33 |
34 | var map_resource : QuakeMapFile = null
35 |
36 | if ResourceLoader.exists(save_path_str):
37 | map_resource = load(save_path_str) as QuakeMapFile
38 | map_resource.revision += 1
39 | else:
40 | map_resource = QuakeMapFile.new()
41 | map_resource.map_data = FileAccess.open(source_file, FileAccess.READ).get_as_text()
42 |
43 | return ResourceSaver.save(map_resource, save_path_str)
44 |
--------------------------------------------------------------------------------
/addons/func_godot/icons/icon_godot_ranger.svg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://cfxlhjsefleff"
6 | path="res://.godot/imported/icon_godot_ranger.svg-8572582518f54de6403b767a923b5a92.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/func_godot/icons/icon_godot_ranger.svg"
14 | dest_files=["res://.godot/imported/icon_godot_ranger.svg-8572582518f54de6403b767a923b5a92.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/uastc_level=0
22 | compress/rdo_quality_loss=0.0
23 | compress/hdr_compression=1
24 | compress/normal_map=0
25 | compress/channel_pack=0
26 | mipmaps/generate=false
27 | mipmaps/limit=-1
28 | roughness/mode=0
29 | roughness/src_normal=""
30 | process/channel_remap/red=0
31 | process/channel_remap/green=1
32 | process/channel_remap/blue=2
33 | process/channel_remap/alpha=3
34 | process/fix_alpha_border=true
35 | process/premult_alpha=false
36 | process/normal_map_invert_y=false
37 | process/hdr_as_srgb=false
38 | process/hdr_clamp_exposure=false
39 | process/size_limit=0
40 | detect_3d/compress_to=1
41 | svg/scale=1.0
42 | editor/scale_with_editor_scale=false
43 | editor/convert_colors_with_editor_theme=false
44 |
--------------------------------------------------------------------------------
/addons/func_godot/icons/icon_godot_ranger3d.svg.import:
--------------------------------------------------------------------------------
1 | [remap]
2 |
3 | importer="texture"
4 | type="CompressedTexture2D"
5 | uid="uid://brm515f5ivx8m"
6 | path="res://.godot/imported/icon_godot_ranger3d.svg-a9a2c9bcf2e8b1e07a0a941a16264e98.ctex"
7 | metadata={
8 | "vram_texture": false
9 | }
10 |
11 | [deps]
12 |
13 | source_file="res://addons/func_godot/icons/icon_godot_ranger3d.svg"
14 | dest_files=["res://.godot/imported/icon_godot_ranger3d.svg-a9a2c9bcf2e8b1e07a0a941a16264e98.ctex"]
15 |
16 | [params]
17 |
18 | compress/mode=0
19 | compress/high_quality=false
20 | compress/lossy_quality=0.7
21 | compress/uastc_level=0
22 | compress/rdo_quality_loss=0.0
23 | compress/hdr_compression=1
24 | compress/normal_map=0
25 | compress/channel_pack=0
26 | mipmaps/generate=false
27 | mipmaps/limit=-1
28 | roughness/mode=0
29 | roughness/src_normal=""
30 | process/channel_remap/red=0
31 | process/channel_remap/green=1
32 | process/channel_remap/blue=2
33 | process/channel_remap/alpha=3
34 | process/fix_alpha_border=true
35 | process/premult_alpha=false
36 | process/normal_map_invert_y=false
37 | process/hdr_as_srgb=false
38 | process/hdr_clamp_exposure=false
39 | process/size_limit=0
40 | detect_3d/compress_to=1
41 | svg/scale=1.0
42 | editor/scale_with_editor_scale=false
43 | editor/convert_colors_with_editor_theme=false
44 |
--------------------------------------------------------------------------------
/addons/func_godot/fgd/func_godot_fgd.tres:
--------------------------------------------------------------------------------
1 | [gd_resource type="Resource" script_class="FuncGodotFGDFile" load_steps=10 format=3 uid="uid://crgpdahjaj"]
2 |
3 | [ext_resource type="Script" uid="uid://drlmgulwbjwqu" path="res://addons/func_godot/src/fgd/func_godot_fgd_file.gd" id="1_axt3h"]
4 | [ext_resource type="Resource" uid="uid://nayxb8n7see2" path="res://addons/func_godot/fgd/phong_base.tres" id="1_ehab8"]
5 | [ext_resource type="Resource" uid="uid://doo4ly322b4jc" path="res://addons/func_godot/fgd/vertex_merge_distance_base.tres" id="2_7jebp"]
6 | [ext_resource type="Resource" uid="uid://bdji3873bg32h" path="res://addons/func_godot/fgd/worldspawn.tres" id="2_ri2rx"]
7 | [ext_resource type="Resource" uid="uid://b70vf4t5dc70t" path="res://addons/func_godot/fgd/func_geo.tres" id="3_7jigp"]
8 | [ext_resource type="Resource" uid="uid://cxy7jnh6d7msn" path="res://addons/func_godot/fgd/func_detail.tres" id="3_fqfww"]
9 | [ext_resource type="Resource" uid="uid://bcdsueg5pysfq" path="res://addons/func_godot/fgd/cull_interior_faces.tres" id="3_h5cmk"]
10 | [ext_resource type="Resource" uid="uid://dg5x44cc7flew" path="res://addons/func_godot/fgd/func_illusionary.tres" id="4_c4ucw"]
11 | [ext_resource type="Resource" uid="uid://ch3e0dix85uhb" path="res://addons/func_godot/fgd/func_detail_illusionary.tres" id="5_b2q3p"]
12 |
13 | [resource]
14 | script = ExtResource("1_axt3h")
15 | entity_definitions = Array[Resource]([ExtResource("1_ehab8"), ExtResource("2_7jebp"), ExtResource("2_ri2rx"), ExtResource("3_7jigp"), ExtResource("3_fqfww"), ExtResource("5_b2q3p"), ExtResource("4_c4ucw"), ExtResource("3_h5cmk")])
16 |
--------------------------------------------------------------------------------
/addons/func_godot/src/import/quake_palette_import_plugin.gd:
--------------------------------------------------------------------------------
1 | @tool
2 | class_name QuakePaletteImportPlugin extends EditorImportPlugin
3 |
4 | func _get_importer_name() -> String:
5 | return 'func_godot.palette'
6 |
7 | func _get_visible_name() -> String:
8 | return 'Quake Palette'
9 |
10 | func _get_resource_type() -> String:
11 | return 'Resource'
12 |
13 | func _get_recognized_extensions() -> PackedStringArray:
14 | return PackedStringArray(['lmp'])
15 |
16 | func _get_save_extension() -> String:
17 | return 'tres'
18 |
19 | func _get_import_options(path, preset):
20 | return []
21 |
22 | func _get_preset_count() -> int:
23 | return 0
24 |
25 | func _get_priority():
26 | return 1.0
27 |
28 | func _get_import_order():
29 | return 0
30 |
31 | func _import(source_file, save_path, options, r_platform_variants, r_gen_files) -> Error:
32 | var save_path_str : String = '%s.%s' % [save_path, _get_save_extension()]
33 |
34 | var file = FileAccess.open(source_file, FileAccess.READ)
35 | if file == null:
36 | var err = FileAccess.get_open_error()
37 | printerr(['Error opening super.lmp file: ', err])
38 | return err
39 |
40 | var colors := PackedColorArray()
41 |
42 | while true:
43 | var red : int = file.get_8()
44 | var green : int = file.get_8()
45 | var blue : int = file.get_8()
46 | var color := Color(red / 255.0, green / 255.0, blue / 255.0)
47 |
48 | colors.append(color)
49 |
50 | if file.eof_reached():
51 | break
52 |
53 | if colors.size() == 256:
54 | break
55 |
56 | var palette_resource := QuakePaletteFile.new(colors)
57 |
58 | return ResourceSaver.save(palette_resource, save_path_str)
59 |
--------------------------------------------------------------------------------
/addons/func_godot/src/trenchbroom/trenchbroom_tag.gd:
--------------------------------------------------------------------------------
1 | @icon("res://addons/func_godot/icons/icon_godot_ranger.svg")
2 | class_name TrenchBroomTag extends Resource
3 | ## Pattern matching tag added to [TrenchbroomGameConfig] for appearance and menu filtering purposes.
4 | ##
5 | ## Pattern matching tags to enable a number of features in TrenchBroom, including display appearance and menu filtering options.
6 | ## This resource gets added to the [TrenchBroomGameConfig] resource. Does not affect appearance or functionality in Godot.
7 | ##
8 | ## @tutorial(TrenchBroom Manual Game Configuration): https://trenchbroom.github.io/manual/latest/#game_configuration_files
9 | ## @tutorial(TrenchBroom Manual Special Brush Face Types): https://trenchbroom.github.io/manual/latest/#special_brush_face_types
10 |
11 | enum TagMatchType {
12 | TEXTURE, ## Tag applies to any brush face with a texture matching the texture name.
13 | CLASSNAME ## Tag applies to any brush entity with a class name matching the tag pattern.
14 | }
15 |
16 | ## Name to define this tag. Not used as the matching pattern.
17 | @export var tag_name: String
18 |
19 | ## The attributes applied to matching faces or brush entities. Only "_transparent" is supported in TrenchBroom, which makes matching faces or brush entities transparent.
20 | @export var tag_attributes : Array[String] = ["transparent"]
21 |
22 | ## Determines how the tag is matched. See [constant TagMatchType].
23 | @export var tag_match_type: TagMatchType
24 |
25 | ## A string that filters which flag, param, or classname to use. [code]*[/code] can be used as a wildcard to include multiple options.
26 | ## [b]Example:[/b] [code]trigger*[/code] with [constant TagMatchType] [i]Classname[/i] will apply this tag to all brush entities with the [code]trigger[/code] prefix.
27 | @export var tag_pattern: String
28 |
29 | ## A string that filters which textures recieve these attributes. Only used with a [constant TagMatchType] of [i]Texture[/i].
30 | @export var texture_name: String
31 |
--------------------------------------------------------------------------------
/addons/func_godot/icons/icon_slipgate.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
14 |
--------------------------------------------------------------------------------
/addons/func_godot/icons/icon_slipgate3d.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
14 |
--------------------------------------------------------------------------------
/addons/func_godot/src/fgd/func_godot_fgd_point_class_display_descriptor.gd:
--------------------------------------------------------------------------------
1 | @tool
2 | @icon("res://addons/func_godot/icons/icon_godambler3d.svg")
3 | class_name FuncGodotFGDPointClassDisplayDescriptor extends Resource
4 | ## Resource that describes how to display an FGD Point Class entity.
5 | ##
6 | ## A resource for [FuncGodotFGDPointClass] that describes how to display a point entity in a map editor.
7 | ## Values entered into the different options are taken literally: paths should be enclosed within quotation marks,
8 | ## while class property keys and integer values should omit them.[br][br]
9 | ##
10 | ## Most editors only support the [member display_asset] option. Exporting an FGD compatible with these editors will
11 | ## automatically omit the unsupported options introduced by TrenchBroom when exporting from their respective game configuration resources
12 | ## or setting [member FuncGodotFGDFile.target_map_editor] away from [enum FuncGodotFGDFile.FuncGodotTargetMapEditors.TRENCHBROOM].
13 | ##
14 | ## The extra options are considered advanced features and are unable to be evaluated by FuncGodot to ensure they were input correctly.
15 | ## Exercise caution, care, and patience when attempting to use these, especially the [member conditional] option.
16 | ##
17 | ## @tutorial(Level Design Book: Display Models for Entities): https://book.leveldesignbook.com/appendix/resources/formats/fgd#display-models-for-entities
18 | ## @tutorial(Valve Developer Wiki FGD Article: Entity Description Section): https://developer.valvesoftware.com/wiki/FGD#Entity_Description
19 | ## @tutorial(TrenchBroom Manual: Display Models for Entities): https://trenchbroom.github.io/manual/latest/#display-models-for-entities
20 | ## @tutorial(TrenchBroom Manual: Expression Language): https://trenchbroom.github.io/manual/latest/#expression_language
21 |
22 | ## Either a file path to the asset that will be displayed for this point entity, relative to the map editor's game path,
23 | ## or a class property key that can contain the path.[br][br]
24 | ## For paths, you must surround the path with quotes, e.g: [code]"models/marsfrog.glb"[/code].
25 | ## For properties, you must omit the quotes, e.g: [code]display_model_path[/code].[br][br]
26 | ## Different editors support different file types: common ones include MDL, GLB, SPR, and PNG.
27 | @export var display_asset_path: String = ""
28 |
29 | @export_group("TrenchBroom Options")
30 | ## Optional string that determines the scale of the display asset. This can be a number, a class property key, or
31 | ## a scale expression in accordance with TrenchBroom's Expression Language. Leave blank to use the game configuration's default scale expression.[br][br]
32 | ## [color=orange]WARNING:[/color] Only utilized by TrenchBroom!
33 | @export var scale: String = ""
34 |
35 | ## Optional string that determines which skin the display asset should use. This can be either a number or a class property key.[br][br]
36 | ## [color=orange]WARNING:[/color] Only utilized by TrenchBroom!
37 | @export var skin: String = ""
38 |
39 | ## Optional string that determines the appearance of a display asset based on its file type. This can be either a number or a class property key.[br][br]
40 | ## Traditional Quake MDL files will set the display to that frame of its animations (all animations in a Quake MDL are compiled into a single animation).
41 | ## GLBs meanwhile seem to set themselves to the animation assigned to an index that matches the [code]frame[/code] value.[br][br]
42 | ## [color=orange]WARNING:[/color] Only utilized by TrenchBroom!
43 | @export var frame: String = ""
44 |
45 | ## Optional evaluation string that, when true, will force the Point Class to display the asset defined by [member display_asset_path].
46 | ## Format should be [code]property == value[/code] or some other valid expression in accordance with TrenchBroom's Expression Language.[br][br]
47 | ## [color=orange]WARNING:[/color] Only utilized by TrenchBroom!
48 | @export var conditional: String = ""
49 |
--------------------------------------------------------------------------------
/addons/func_godot/src/func_godot_plugin.gd:
--------------------------------------------------------------------------------
1 | @tool
2 | @icon("res://addons/func_godot/icons/icon_godot_ranger.svg")
3 | class_name FuncGodotPlugin extends EditorPlugin
4 |
5 | var map_import_plugin : QuakeMapImportPlugin = null
6 | var palette_import_plugin : QuakePaletteImportPlugin = null
7 | var wad_import_plugin: QuakeWadImportPlugin = null
8 |
9 | #var func_godot_map_progress_bar: Control = null
10 | var edited_object_ref: WeakRef = weakref(null)
11 |
12 | func _get_plugin_name() -> String:
13 | return "FuncGodot"
14 |
15 | func _handles(object: Object) -> bool:
16 | return object is FuncGodotMap
17 |
18 | func _edit(object: Object) -> void:
19 | edited_object_ref = weakref(object)
20 |
21 | #func _make_visible(visible: bool) -> void:
22 | #if func_godot_map_progress_bar:
23 | #func_godot_map_progress_bar.set_visible(visible)
24 |
25 | func _enter_tree() -> void:
26 | # Import plugins
27 | map_import_plugin = QuakeMapImportPlugin.new()
28 | palette_import_plugin = QuakePaletteImportPlugin.new()
29 | wad_import_plugin = QuakeWadImportPlugin.new()
30 |
31 | add_import_plugin(map_import_plugin)
32 | add_import_plugin(palette_import_plugin)
33 | add_import_plugin(wad_import_plugin)
34 |
35 | #func_godot_map_progress_bar = create_func_godot_map_progress_bar()
36 | #func_godot_map_progress_bar.set_visible(false)
37 | #add_control_to_container(EditorPlugin.CONTAINER_INSPECTOR_BOTTOM, func_godot_map_progress_bar)
38 |
39 | add_custom_type("FuncGodotMap", "Node3D", preload("res://addons/func_godot/src/map/func_godot_map.gd"), null)
40 |
41 | # Default Map Settings
42 | if not ProjectSettings.has_setting("func_godot/default_map_settings"):
43 | ProjectSettings.set_setting("func_godot/default_map_settings", "res://addons/func_godot/func_godot_default_map_settings.tres")
44 | var property_info = {
45 | "name": "func_godot/default_map_settings",
46 | "type": TYPE_STRING,
47 | "hint": PROPERTY_HINT_FILE,
48 | "hint_string": "*.tres"
49 | }
50 | ProjectSettings.add_property_info(property_info)
51 | ProjectSettings.set_as_basic("func_godot/default_map_settings", true)
52 | ProjectSettings.set_initial_value("func_godot/default_map_settings", "res://addons/func_godot/func_godot_default_map_settings.tres")
53 |
54 | # Default Inverse Scale Factor
55 | if not ProjectSettings.has_setting("func_godot/default_inverse_scale_factor"):
56 | ProjectSettings.set_setting("func_godot/default_inverse_scale_factor", 32.0)
57 | var property_info = {
58 | "name": "func_godot/default_inverse_scale_factor",
59 | "type": TYPE_FLOAT
60 | }
61 | ProjectSettings.add_property_info(property_info)
62 | ProjectSettings.set_as_basic("func_godot/default_inverse_scale_factor", true)
63 | ProjectSettings.set_initial_value("func_godot/default_inverse_scale_factor", 32.0)
64 |
65 | # Model Point Class Default Path
66 | if not ProjectSettings.has_setting("func_godot/model_point_class_save_path"):
67 | ProjectSettings.set_setting("func_godot/model_point_class_save_path", "")
68 | var property_info = {
69 | "name": "func_godot/model_point_class_save_path",
70 | "type": TYPE_STRING
71 | }
72 | ProjectSettings.add_property_info(property_info)
73 | ProjectSettings.set_as_basic("func_godot/model_point_class_save_path", true)
74 | ProjectSettings.set_initial_value("func_godot/model_point_class_save_path", "")
75 |
76 | func _exit_tree() -> void:
77 | remove_custom_type("FuncGodotMap")
78 | remove_import_plugin(map_import_plugin)
79 | remove_import_plugin(palette_import_plugin)
80 | if wad_import_plugin:
81 | remove_import_plugin(wad_import_plugin)
82 |
83 | map_import_plugin = null
84 | palette_import_plugin = null
85 | wad_import_plugin = null
86 |
87 | #if func_godot_map_progress_bar:
88 | #remove_control_from_container(EditorPlugin.CONTAINER_INSPECTOR_BOTTOM, func_godot_map_progress_bar)
89 | #func_godot_map_progress_bar.queue_free()
90 | #func_godot_map_progress_bar = null
91 |
92 | # Create a progress bar for building a [FuncGodotMap]
93 | #func create_func_godot_map_progress_bar() -> Control:
94 | #var progress_label = Label.new()
95 | #progress_label.name = "ProgressLabel"
96 | #progress_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
97 | #progress_label.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
98 | #
99 | #var progress_bar := ProgressBar.new()
100 | #progress_bar.name = "ProgressBar"
101 | #progress_bar.show_percentage = false
102 | #progress_bar.min_value = 0.0
103 | #progress_bar.max_value = 1.0
104 | #progress_bar.custom_minimum_size.y = 30
105 | #progress_bar.set_anchors_and_offsets_preset(Control.PRESET_LEFT_WIDE)
106 | #progress_bar.add_child(progress_label)
107 | #progress_label.set_anchors_and_offsets_preset(Control.PRESET_LEFT_WIDE)
108 | #progress_label.offset_top = -9
109 | #progress_label.offset_left = 3
110 | #
111 | #return progress_bar
112 |
113 | # Update the build progress bar (see: [method create_func_godot_map_progress_bar]) to display the current step and progress (0-1)
114 | #func func_godot_map_build_progress(step: String, progress: float) -> void:
115 | #var progress_label = func_godot_map_progress_bar.get_node("ProgressLabel")
116 | #func_godot_map_progress_bar.value = progress
117 | #progress_label.text = step.capitalize()
118 |
119 | ## Callback for when the build process for a [FuncGodotMap] is finished.
120 | func func_godot_map_build_complete(func_godot_map: FuncGodotMap) -> void:
121 | #var progress_label = func_godot_map_progress_bar.get_node("ProgressLabel")
122 | #progress_label.text = "Build Complete"
123 |
124 | #if func_godot_map.is_connected("build_progress",Callable(self,"func_godot_map_build_progress")):
125 | #func_godot_map.disconnect("build_progress",Callable(self,"func_godot_map_build_progress"))
126 |
127 | if func_godot_map.is_connected("build_complete",Callable(self,"func_godot_map_build_complete")):
128 | func_godot_map.disconnect("build_complete",Callable(self,"func_godot_map_build_complete"))
129 |
130 | if func_godot_map.is_connected("build_failed",Callable(self,"func_godot_map_build_complete")):
131 | func_godot_map.disconnect("build_failed",Callable(self,"func_godot_map_build_complete"))
132 |
--------------------------------------------------------------------------------
/addons/func_godot/src/fgd/func_godot_fgd_point_class.gd:
--------------------------------------------------------------------------------
1 | @tool
2 | @icon("res://addons/func_godot/icons/icon_godambler3d.svg")
3 | class_name FuncGodotFGDPointClass extends FuncGodotFGDEntityClass
4 | ## FGD PointClass entity definition.
5 | ##
6 | ## A resource used to define an FGD Point Class entity. PointClass entities can use either the [member FuncGodotFGDEntityClass.node_class]
7 | ## or the [member scene_file] property to tell [FuncGodotMap] what to generate on map build.
8 | ##
9 | ## @tutorial(Quake Wiki Entity Article): https://quakewiki.org/wiki/Entity
10 | ## @tutorial(Level Design Book: Entity Types and Settings): https://book.leveldesignbook.com/appendix/resources/formats/fgd#entity-types-and-settings-basic
11 | ## @tutorial(Valve Developer Wiki FGD Article): https://developer.valvesoftware.com/wiki/FGD#Class_Types_and_Properties
12 | ## @tutorial(dumptruck_ds' Quake Mapping Entities Tutorial): https://www.youtube.com/watch?v=gtL9f6_N2WM
13 | ## @tutorial(Level Design Book: Display Models for Entities): https://book.leveldesignbook.com/appendix/resources/formats/fgd#display-models-for-entities
14 | ## @tutorial(Valve Developer Wiki FGD Article: Entity Description Section): https://developer.valvesoftware.com/wiki/FGD#Entity_Description
15 | ## @tutorial(TrenchBroom Manual: Display Models for Entities): https://trenchbroom.github.io/manual/latest/#display-models-for-entities
16 |
17 | func _init() -> void:
18 | prefix = "@PointClass"
19 |
20 | ## An optional [PackedScene] file to instantiate on map build. Overrides [member FuncGodotFGDEntityClass.node_class] and [member script_class].
21 | @export var scene_file: PackedScene
22 |
23 | ## An optional [Script] resource to attach to the node generated on map build. Ignored if [member scene_file] is specified.
24 | @export var script_class: Script
25 |
26 | ## Toggles whether entity will use `angles`, `mangle`, or `angle` to determine rotations on [FuncGodotMap] build, prioritizing the key value pairs in that order.
27 | ## Set to [code]false[/code] if you would like to define how the generated node is rotated yourself.
28 | @export var apply_rotation_on_map_build : bool = true
29 |
30 | ## Toggles whether entity will use `scale` to determine the generated node or scene's scale. This is performed on the top level node.
31 | ## The property can be a [float], [Vector3], or [Vector2]. Set to [code]false[/code] if you would like to define how the generated node is scaled yourself.
32 | @export var apply_scale_on_map_build: bool = true
33 |
34 | ## An optional [Array] of [FuncGodotFGDPointClassDisplayDescriptor] that describes how this Point Entity should appear in the map editor.
35 | ## When using multiple display descriptors, only the first element found without [member FuncGodotFGDPointClassDisplayDescriptor.conditional]
36 | ## will be used as the default display asset. If no descriptor is found without a condition, the last descriptor will become the default.[br][br]
37 | ## Conditional display descriptors will be written to the FGD in the order set in the array.[br][br]
38 | ## [color=orange]WARNING:[/color] Multiple descriptors are only supported by TrenchBroom! They will be omitted on export when
39 | ## [member FuncGodotFGDFile.target_map_editor] is not set to [enum FuncGodotFGDFile.FuncGodotTargetMapEditors.TRENCHBROOM].
40 | @export var display_descriptors: Array[FuncGodotFGDPointClassDisplayDescriptor] = []
41 |
42 | func _build_model_branch_text(descriptor: FuncGodotFGDPointClassDisplayDescriptor) -> String:
43 | if not descriptor:
44 | return ''
45 |
46 | var model_string: String = ''
47 | var uses_options: bool = false
48 |
49 | if not descriptor.scale.is_empty() or not descriptor.skin.is_empty() or not descriptor.frame.is_empty():
50 | uses_options = true
51 |
52 | if not uses_options:
53 | return descriptor.display_asset_path
54 |
55 | model_string = '{ \"path\": %s' % descriptor.display_asset_path
56 |
57 | if not descriptor.skin.is_empty():
58 | model_string += ', \"skin\": %s' % descriptor.skin
59 | if not descriptor.frame.is_empty():
60 | model_string += ', \"frame\": %s' % descriptor.frame
61 | if not descriptor.scale.is_empty():
62 | model_string += ', \"scale\": %s' % descriptor.scale
63 |
64 | model_string += " }"
65 |
66 | return model_string
67 |
68 | func _build_model_text() -> String:
69 | var model_string: String = ''
70 |
71 | if display_descriptors.is_empty():
72 | return model_string
73 |
74 | if display_descriptors.size() == 1:
75 | return _build_model_branch_text(display_descriptors[0])
76 |
77 | model_string = '{{'
78 | var default_display: FuncGodotFGDPointClassDisplayDescriptor
79 | for i in display_descriptors.size():
80 | var d: FuncGodotFGDPointClassDisplayDescriptor = display_descriptors[i]
81 |
82 | # Only set the first discovered descriptor without a condition to the default, which must be the last option in a list.
83 | # If a conditional is not set, skip it.
84 | if d.conditional.is_empty():
85 | if not default_display:
86 | default_display = d
87 | else:
88 | printerr(classname + " has a Point Class Display Descriptor without required conditionals set. Must have only 1 conditionless Display Descriptor!")
89 | continue
90 |
91 | model_string += '%s -> %s, ' % [d.conditional, _build_model_branch_text(d)]
92 |
93 | if default_display:
94 | model_string += '%s }}' % _build_model_branch_text(default_display)
95 | else:
96 | model_string = model_string.trim_suffix(', ')
97 | model_string += ' }}'
98 |
99 | return model_string
100 |
101 | func _build_studio_text() -> String:
102 | var display_string = ""
103 | for d in display_descriptors:
104 | if d.display_asset_path.find('\"') != -1:
105 | display_string = d.display_asset_path
106 | else:
107 | printerr(classname + " attempting to set an invalid value to @studio format during FGD export. Only relative file paths encapsulated by quotations are valid.")
108 | return display_string
109 |
110 | func build_def_text(target_editor: FuncGodotFGDFile.FuncGodotTargetMapEditors = FuncGodotFGDFile.FuncGodotTargetMapEditors.TRENCHBROOM) -> String:
111 | if not display_descriptors.is_empty():
112 | if target_editor == FuncGodotFGDFile.FuncGodotTargetMapEditors.TRENCHBROOM:
113 | var display_string: String = _build_model_text()
114 | if not display_string.is_empty():
115 | meta_properties["model"] = display_string
116 | else:
117 | var display_string: String = _build_studio_text()
118 | if not display_string.is_empty():
119 | meta_properties["studio"] = display_string
120 | return super(target_editor)
121 |
--------------------------------------------------------------------------------
/addons/func_godot/src/util/func_godot_local_config.gd:
--------------------------------------------------------------------------------
1 | @tool
2 | @icon("res://addons/func_godot/icons/icon_godot_ranger.svg")
3 | class_name FuncGodotLocalConfig extends Resource
4 | ## Local machine project wide settings. [color=red]WARNING![/color] Do not create your own! Use the resource in [i]addons/func_godot[/i].
5 | ##
6 | ## Local machine project wide settings. Can define global defaults for some FuncGodot properties.
7 | ## [color=red][b]DO NOT CREATE A NEW RESOURCE![/b][/color] This resource works by saving a configuration file to your game's [b][i]user://[/i][/b] folder
8 | ## and pulling the properties from that config file rather than this resource. Use the premade [b][i]addons/func_godot/func_godot_local_config.tres[/i][/b] instead.
9 | ## [br][br]
10 | ## [b]Fgd Output Folder :[/b] Global directory path that [FuncGodotFGDFile] saves to when exported. Overridden when exported from a game configuration resource like [TrenchBroomGameConfig].[br][br]
11 | ## [b]Trenchbroom Game Config Folder :[/b] Global directory path where your TrenchBroom game configuration should be saved to. Consult the [url="https://trenchbroom.github.io/manual/latest/#game_configuration_files"]TrenchBroom Manual's Game Configuration documentation[/url] for more information.[br][br]
12 | ## [b]Netradiant Custom Gamepacks Folder :[/b] Global directory path where your NetRadiant Custom gamepacks are saved. On Windows this is the [i]gamepacks[/i] folder in your NetRadiant Custom installation.[br][br]
13 | ## [b]Map Editor Game Path :[/b] Global directory path to your mapping folder where all of your mapping assets exist. This is usually either your project folder or a subfolder within it.[br][br]
14 | ## [b]Game Path Models Folder :[/b] Relative directory path from your Map Editor Game Path to a subfolder containing any display models you might use for your map editor. Currently only used by [FuncGodotFGDModelPointClass].[br][br]
15 | ## [b]Default Inverse Scale Factor :[/b] Scale factor that affects how [FuncGodotFGDModelPointClass] entities scale their map editor display models. Not used with TrenchBroom, use [member TrenchBroomGameConfig.entity_scale] expression instead.[br][br]
16 |
17 | enum PROPERTY {
18 | FGD_OUTPUT_FOLDER,
19 | TRENCHBROOM_GAME_CONFIG_FOLDER,
20 | NETRADIANT_CUSTOM_GAMEPACKS_FOLDER,
21 | MAP_EDITOR_GAME_PATH,
22 | #GAME_PATH_MODELS_FOLDER,
23 | #DEFAULT_INVERSE_SCALE
24 | }
25 |
26 | @export_tool_button("Export func_godot settings", "Save") var _save_settings = export_func_godot_settings
27 | @export_tool_button("Reload func_godot settings", "Reload") var _load_settings = reload_func_godot_settings
28 |
29 | const _CONFIG_PROPERTIES: Array[Dictionary] = [
30 | {
31 | "name": "fgd_output_folder",
32 | "usage": PROPERTY_USAGE_EDITOR,
33 | "type": TYPE_STRING,
34 | "hint": PROPERTY_HINT_GLOBAL_DIR,
35 | "func_godot_type": PROPERTY.FGD_OUTPUT_FOLDER
36 | },
37 | {
38 | "name": "trenchbroom_game_config_folder",
39 | "usage": PROPERTY_USAGE_EDITOR,
40 | "type": TYPE_STRING,
41 | "hint": PROPERTY_HINT_GLOBAL_DIR,
42 | "func_godot_type": PROPERTY.TRENCHBROOM_GAME_CONFIG_FOLDER
43 | },
44 | {
45 | "name": "netradiant_custom_gamepacks_folder",
46 | "usage": PROPERTY_USAGE_EDITOR,
47 | "type": TYPE_STRING,
48 | "hint": PROPERTY_HINT_GLOBAL_DIR,
49 | "func_godot_type": PROPERTY.NETRADIANT_CUSTOM_GAMEPACKS_FOLDER
50 | },
51 | {
52 | "name": "map_editor_game_path",
53 | "usage": PROPERTY_USAGE_EDITOR,
54 | "type": TYPE_STRING,
55 | "hint": PROPERTY_HINT_GLOBAL_DIR,
56 | "func_godot_type": PROPERTY.MAP_EDITOR_GAME_PATH
57 | },
58 | ]
59 |
60 | var _settings_dict: Dictionary
61 | var _loaded := false
62 |
63 | ## Retrieve a setting from the local configuration.
64 | static func get_setting(name: PROPERTY) -> Variant:
65 | var settings: FuncGodotLocalConfig = load("res://addons/func_godot/func_godot_local_config.tres")
66 | settings.reload_func_godot_settings()
67 | return settings._settings_dict.get(PROPERTY.keys()[name], '') as Variant
68 |
69 | func _get_property_list() -> Array:
70 | return _CONFIG_PROPERTIES.duplicate()
71 |
72 | func _get(property: StringName) -> Variant:
73 | var config = _get_config_property(property)
74 | if config == null and not config is Dictionary:
75 | return null
76 | _try_loading()
77 | return _settings_dict.get(PROPERTY.keys()[config['func_godot_type']], _get_default_value(config['type']))
78 |
79 | func _set(property: StringName, value: Variant) -> bool:
80 | var config = _get_config_property(property)
81 | if config == null and not config is Dictionary:
82 | return false
83 | _settings_dict[PROPERTY.keys()[config['func_godot_type']]] = value
84 | return true
85 |
86 | func _get_default_value(type) -> Variant:
87 | match type:
88 | TYPE_STRING: return ''
89 | TYPE_INT: return 0
90 | TYPE_FLOAT: return 0.0
91 | TYPE_BOOL: return false
92 | TYPE_VECTOR2: return Vector2.ZERO
93 | TYPE_VECTOR3: return Vector3.ZERO
94 | TYPE_ARRAY: return []
95 | TYPE_DICTIONARY: return {}
96 | push_error("Invalid setting type. Returning null")
97 | return null
98 |
99 | func _get_config_property(name: StringName) -> Variant:
100 | for config in _CONFIG_PROPERTIES:
101 | if config['name'] == name:
102 | return config
103 | return null
104 |
105 | ## Reload this system's configuration settings into the Local Config resource.
106 | func reload_func_godot_settings() -> void:
107 | _loaded = true
108 | var path = "user://func_godot_config.json"
109 | if not FileAccess.file_exists(path):
110 | var application_name: String = ProjectSettings.get('application/config/name')
111 | application_name = application_name.replace(" ", "_")
112 | path = "user://" + application_name + "_FuncGodotConfig.json"
113 | if not FileAccess.file_exists(path):
114 | return
115 | var settings = FileAccess.get_file_as_string(path)
116 | _settings_dict = {}
117 | if not settings or settings.is_empty():
118 | return
119 | settings = JSON.parse_string(settings)
120 | for key in settings.keys():
121 | _settings_dict[key] = settings[key]
122 | notify_property_list_changed()
123 |
124 | func _try_loading() -> void:
125 | if not _loaded:
126 | reload_func_godot_settings()
127 |
128 | ## Export the current resource settings to a configuration file in this game's [i]user://[/i] folder.
129 | func export_func_godot_settings() -> void:
130 | if _settings_dict.size() == 0:
131 | return
132 | var path = "user://func_godot_config.json"
133 | var file = FileAccess.open(path, FileAccess.WRITE)
134 | var json = JSON.stringify(_settings_dict)
135 | file.store_line(json)
136 | _loaded = false
137 | print("Saved settings to ", file.get_path_absolute())
138 |
--------------------------------------------------------------------------------
/addons/func_godot/src/import/quake_wad_import_plugin.gd:
--------------------------------------------------------------------------------
1 | @tool
2 | class_name QuakeWadImportPlugin extends EditorImportPlugin
3 |
4 | enum WadFormat {
5 | Quake,
6 | HalfLife
7 | }
8 |
9 | enum QuakeWadEntryType {
10 | Palette = 0x40,
11 | SBarPic = 0x42,
12 | MipsTexture = 0x44,
13 | ConsolePic = 0x45
14 | }
15 |
16 | enum HalfLifeWadEntryType {
17 | QPic = 0x42,
18 | MipsTexture = 0x43,
19 | FixedFont = 0x45
20 | }
21 |
22 | const TEXTURE_NAME_LENGTH := 16
23 | const MAX_MIP_LEVELS := 4
24 |
25 | func _get_importer_name() -> String:
26 | return 'func_godot.wad'
27 |
28 | func _get_visible_name() -> String:
29 | return 'Quake WAD'
30 |
31 | func _get_resource_type() -> String:
32 | return 'Resource'
33 |
34 | func _get_recognized_extensions() -> PackedStringArray:
35 | return PackedStringArray(['wad'])
36 |
37 | func _get_save_extension() -> String:
38 | return 'res'
39 |
40 | func _get_option_visibility(path: String, option_name: StringName, options: Dictionary) -> bool:
41 | return true
42 |
43 | func _get_import_options(path, preset) -> Array[Dictionary]:
44 | return [
45 | {
46 | 'name': 'palette_file',
47 | 'default_value': 'res://addons/func_godot/palette.lmp',
48 | 'property_hint': PROPERTY_HINT_FILE,
49 | 'hint_string': '*.lmp'
50 | },
51 | {
52 | 'name': 'generate_mipmaps',
53 | 'default_value': true,
54 | 'property_hint': PROPERTY_HINT_NONE
55 | }
56 | ]
57 |
58 | func _get_preset_count() -> int:
59 | return 0
60 |
61 | func _get_import_order() -> int:
62 | return 0
63 |
64 | func _get_priority() -> float:
65 | return 1.0
66 |
67 | func _import(source_file, save_path, options, r_platform_variants, r_gen_files) -> Error:
68 | var save_path_str : String = '%s.%s' % [save_path, _get_save_extension()]
69 |
70 | var file = FileAccess.open(source_file, FileAccess.READ)
71 | if file == null:
72 | var err = FileAccess.get_open_error()
73 | printerr(['Error opening super.wad file: ', err])
74 | return err
75 |
76 | # Read WAD header
77 | var magic : PackedByteArray = file.get_buffer(4)
78 | var magic_string : String = magic.get_string_from_ascii()
79 | var wad_format: int = WadFormat.Quake
80 |
81 | if magic_string == 'WAD3':
82 | wad_format = WadFormat.HalfLife
83 | elif magic_string != 'WAD2':
84 | printerr('Error: Invalid WAD magic')
85 | return ERR_INVALID_DATA
86 |
87 | var palette_path : String = options['palette_file']
88 | var palette_file : QuakePaletteFile = load(palette_path) as QuakePaletteFile
89 | if wad_format == WadFormat.Quake and not palette_file:
90 | printerr('Error: Invalid Quake palette file')
91 | file.close()
92 | return ERR_CANT_ACQUIRE_RESOURCE
93 |
94 | var num_entries : int = file.get_32()
95 | var dir_offset : int = file.get_32()
96 |
97 | # Read entry list
98 | file.seek(0)
99 | file.seek(dir_offset)
100 |
101 | var entries : Array = []
102 |
103 | for entry_idx in range(0, num_entries):
104 | var offset : int = file.get_32()
105 | var in_wad_size : int = file.get_32()
106 | var size : int = file.get_32()
107 | var type : int = file.get_8()
108 | var compression : int = file.get_8()
109 | var unknown : int = file.get_16()
110 | var name : PackedByteArray = file.get_buffer(TEXTURE_NAME_LENGTH)
111 | var name_string : String = name.get_string_from_ascii()
112 |
113 | if (wad_format == WadFormat.Quake and type == int(QuakeWadEntryType.MipsTexture)) or (
114 | wad_format == WadFormat.HalfLife and type == int(HalfLifeWadEntryType.MipsTexture)):
115 | entries.append([
116 | offset,
117 | in_wad_size,
118 | size,
119 | type,
120 | compression,
121 | name_string
122 | ])
123 |
124 | # Read mip textures
125 | var texture_data_array: Array = []
126 | for entry in entries:
127 | var offset : int = entry[0]
128 | file.seek(offset)
129 |
130 | var name : PackedByteArray = file.get_buffer(TEXTURE_NAME_LENGTH)
131 | var name_string : String = name.get_string_from_ascii()
132 |
133 | var width : int = file.get_32()
134 | var height : int = file.get_32()
135 |
136 | var mip_offsets : Array = []
137 | for idx in range(0, MAX_MIP_LEVELS):
138 | mip_offsets.append(file.get_32())
139 |
140 | var num_pixels : int = width * height
141 | var pixels : PackedByteArray = file.get_buffer(num_pixels)
142 |
143 | if wad_format == WadFormat.Quake:
144 | texture_data_array.append([name_string, width, height, pixels])
145 | continue
146 | # Half-Life WADs have a 256 color palette embedded in each texture
147 | elif wad_format == WadFormat.HalfLife:
148 | # Find the end of the mipmap data
149 | file.seek(offset + mip_offsets[-1] + (width / 8) * (height / 8))
150 | file.get_16()
151 |
152 | var palette_colors := PackedColorArray()
153 | for idx in 256:
154 | var red : int = file.get_8()
155 | var green : int = file.get_8()
156 | var blue : int = file.get_8()
157 | var color := Color(red / 255.0, green / 255.0, blue / 255.0)
158 | palette_colors.append(color)
159 |
160 | texture_data_array.append([name_string, width, height, pixels, palette_colors])
161 |
162 | # Create texture resources
163 | var textures : Dictionary[String, ImageTexture] = {}
164 |
165 | for texture_data in texture_data_array:
166 | var name : String = texture_data[0]
167 | var width : int = texture_data[1]
168 | var height : int = texture_data[2]
169 | var pixels : PackedByteArray = texture_data[3]
170 |
171 | var texture_image : Image
172 | var pixels_rgb := PackedByteArray()
173 |
174 | if wad_format == WadFormat.HalfLife:
175 | var colors : PackedColorArray = texture_data[4]
176 | for palette_color in pixels:
177 | var rgb_color : Color = colors[palette_color]
178 | pixels_rgb.append(rgb_color.r8)
179 | pixels_rgb.append(rgb_color.g8)
180 | pixels_rgb.append(rgb_color.b8)
181 | # Color(0, 0, 255) is used for transparency in Half-Life
182 | if rgb_color.b == 1 and rgb_color.r == 0 and rgb_color.b == 0:
183 | pixels_rgb.append(0)
184 | else:
185 | pixels_rgb.append(255)
186 | texture_image = Image.create_from_data(width, height, false, Image.FORMAT_RGBA8, pixels_rgb)
187 |
188 | else: # WadFormat.Quake
189 | for palette_color in pixels:
190 | var rgb_color : Color = palette_file.colors[palette_color]
191 | pixels_rgb.append(rgb_color.r8)
192 | pixels_rgb.append(rgb_color.g8)
193 | pixels_rgb.append(rgb_color.b8)
194 | # Palette index 255 is used for transparency
195 | if palette_color != 255:
196 | pixels_rgb.append(255)
197 | else:
198 | pixels_rgb.append(0)
199 | texture_image = Image.create_from_data(width, height, false, Image.FORMAT_RGBA8, pixels_rgb)
200 |
201 | if options["generate_mipmaps"] == true:
202 | texture_image.generate_mipmaps()
203 |
204 | var texture := ImageTexture.create_from_image(texture_image) #,Texture2D.FLAG_MIPMAPS | Texture2D.FLAG_REPEAT | Texture2D.FLAG_ANISOTROPIC_FILTER
205 | textures[name.to_lower()] = texture
206 |
207 | # Save WAD resource
208 | var wad_resource := QuakeWadFile.new(textures)
209 | return ResourceSaver.save(wad_resource, save_path_str)
210 |
--------------------------------------------------------------------------------
/addons/func_godot/src/map/func_godot_map.gd:
--------------------------------------------------------------------------------
1 | @tool
2 | @icon("res://addons/func_godot/icons/icon_slipgate3d.svg")
3 | class_name FuncGodotMap extends Node3D
4 | ## Scene generator node that parses a [QuakeMapFile] according to its [FuncGodotMapSettings].
5 | ##
6 | ## A scene generator node that parses a [QuakeMapFile]. It uses a [FuncGodotMapSettings]
7 | ## and the [FuncGodotFGDFile] contained within in order to determine what is built and how it is built.[br][br]
8 | ## If your map is not building correctly, double check your [member map_settings] to make sure you're using
9 | ## the correct [FuncGodotMapSettings].
10 |
11 | const _SIGNATURE: String = "[MAP]"
12 |
13 | ## Bitflag settings that control various aspects of the build process.
14 | enum BuildFlags {
15 | UNWRAP_UV2 = 1 << 0, ## Unwrap UV2s during geometry generation for lightmap baking.
16 | SHOW_PROFILE_INFO = 1 << 1, ## Print build step information during build process.
17 | DISABLE_SMOOTHING = 1 << 2 ## Force disable processing of vertex normal smooth shading.
18 | }
19 |
20 | ## Emitted when the build process fails.
21 | signal build_failed
22 |
23 | ## Emitted when the build process succesfully completes.
24 | signal build_complete
25 |
26 | @export_tool_button("Build Map","CollisionShape3D") var _build_func: Callable = build
27 | @export_tool_button("Clear Map","Skeleton3D") var _clear_func: Callable = clear_children
28 |
29 | @export_category("Map")
30 | ## Local path to MAP or VMF file to build a scene from.
31 | @export_file("*.map","*.vmf") var local_map_file: String = ""
32 |
33 | ## Global path to MAP or VMF file to build a scene from. Overrides [member FuncGodotMap.local_map_file].
34 | @export_global_file("*.map","*.vmf") var global_map_file: String = ""
35 |
36 | # Map path used by code. Do it this way to support both global and local paths.
37 | var _map_file_internal: String = ""
38 |
39 | ## Map settings resource that defines map build scale, textures location, entity definitions, and more.
40 | @export var map_settings: FuncGodotMapSettings = load(ProjectSettings.get_setting("func_godot/default_map_settings", "res://addons/func_godot/func_godot_default_map_settings.tres"))
41 |
42 | @export_category("Build")
43 | ## [enum BuildFlags] that can affect certain aspects of the build process.
44 | @export_flags("Unwrap UV2:1", "Show Profiling Info:2", "Disable Smooth Shading:4") var build_flags: int = 0
45 |
46 | ## The hyperplane is an initial plane that all geometry faces are cut from, like a large sheet of marble before a sculptor begins chiseling.
47 | ## The hyperplane size would need to be able to cover your map's potential total area.
48 | ## Smaller values can minimize floating point errors, reducing the effect of gaps between polygon seams.
49 | ## Measured in Godot units, not Quake units.
50 | @export_range(256.0, 2048.0, 128.0) var hyperplane_size: float = 512.0
51 |
52 | ## Map build failure handler. Displays error message and emits [signal build_failed] signal.
53 | func fail_build(reason: String, notify: bool = false) -> void:
54 | push_error(_SIGNATURE, " ", reason)
55 | if notify:
56 | build_failed.emit()
57 |
58 | ## Frees all children of the map node.[br]
59 | ## [b][color=yellow]Warning:[/color][/b] This does not distinguish between nodes generated in the FuncGodot build process and other user created nodes.
60 | func clear_children() -> void:
61 | for child in get_children():
62 | remove_child(child)
63 | child.queue_free()
64 |
65 | ## Checks if a [QuakeMapFile] for the build process is provided and can be found.
66 | func verify() -> Error:
67 | # Prioritize global map file path for building at runtime
68 | _map_file_internal = global_map_file if global_map_file != "" else local_map_file
69 |
70 | if _map_file_internal.is_empty():
71 | fail_build("Cannot build empty map file.")
72 | return ERR_INVALID_PARAMETER
73 |
74 | # Retrieve real path if needed
75 | if _map_file_internal.begins_with("uid://"):
76 | var uid := ResourceUID.text_to_id(_map_file_internal)
77 | if not ResourceUID.has_id(uid):
78 | fail_build("Error: failed to retrieve path for UID (%s)" % _map_file_internal)
79 | return ERR_DOES_NOT_EXIST
80 | _map_file_internal = ResourceUID.get_id_path(uid)
81 |
82 | if not FileAccess.file_exists(_map_file_internal):
83 | if not FileAccess.file_exists(_map_file_internal + ".import"):
84 | fail_build("Map file %s does not exist." % _map_file_internal)
85 | return ERR_DOES_NOT_EXIST
86 |
87 | return OK
88 |
89 | ## Builds the [member global_map_file]. If not set, builds the [member local_map_file].
90 | ## First cleans the map node of any children, then creates a [FuncGodotParser], [FuncGodotGeometryGenerator]
91 | ## and [FuncGodotEntityAssembler] to parse and generate the map.
92 | func build() -> void:
93 | var time_elapsed: float = Time.get_ticks_msec()
94 |
95 | if build_flags & BuildFlags.SHOW_PROFILE_INFO:
96 | FuncGodotUtil.print_profile_info("Building...", _SIGNATURE)
97 |
98 | clear_children()
99 |
100 | var verify_err: Error = verify()
101 | if verify_err != OK:
102 | fail_build("Verification failed: %s. Aborting map build" % error_string(verify_err), true)
103 | return
104 |
105 | if not map_settings:
106 | push_warning("Map assembler does not have a map settings provided and will use default map settings.")
107 | load(ProjectSettings.get_setting("func_godot/default_map_settings", "res://addons/func_godot/func_godot_default_map_settings.tres"))
108 |
109 | # Parse and collect map data
110 | var parser := FuncGodotParser.new()
111 | if build_flags & BuildFlags.SHOW_PROFILE_INFO:
112 | print("\nPARSER")
113 | parser.declare_step.connect(FuncGodotUtil.print_profile_info.bind(parser._SIGNATURE))
114 | var parse_data: FuncGodotData.ParseData = parser.parse_map_data(_map_file_internal, map_settings)
115 |
116 | if parse_data.entities.is_empty():
117 | return # Already printed failure message in parser, just return here
118 |
119 | var entities: Array[FuncGodotData.EntityData] = parse_data.entities
120 | var groups: Array[FuncGodotData.GroupData] = parse_data.groups
121 |
122 | # Free up some memory now that we have the data
123 | parser = null
124 |
125 | # Retrieve geometry
126 | var generator := FuncGodotGeometryGenerator.new(map_settings, hyperplane_size)
127 | if build_flags & BuildFlags.SHOW_PROFILE_INFO:
128 | print("\nGEOMETRY GENERATOR")
129 | generator.declare_step.connect(FuncGodotUtil.print_profile_info.bind(generator._SIGNATURE))
130 |
131 | # Generate surface and shape data
132 | var generate_error := generator.build(build_flags, entities)
133 | if generate_error != OK:
134 | fail_build("Geometry generation failed: %s" % error_string(generate_error))
135 | return
136 |
137 | # Assemble entities and groups
138 | var assembler := FuncGodotEntityAssembler.new(map_settings)
139 | if build_flags & BuildFlags.SHOW_PROFILE_INFO:
140 | print("\nENTITY ASSEMBLER")
141 | assembler.declare_step.connect(FuncGodotUtil.print_profile_info.bind(assembler._SIGNATURE))
142 | assembler.build(self, entities, groups)
143 |
144 | time_elapsed = Time.get_ticks_msec() - time_elapsed
145 |
146 | if build_flags & BuildFlags.SHOW_PROFILE_INFO:
147 | print("\nCompleted in %s seconds" % (time_elapsed / 1000.0))
148 |
149 | if build_flags & BuildFlags.SHOW_PROFILE_INFO:
150 | print("")
151 | FuncGodotUtil.print_profile_info("Build complete", _SIGNATURE)
152 | build_complete.emit()
153 |
--------------------------------------------------------------------------------
/addons/func_godot/icons/icon_quake_file.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
86 |
--------------------------------------------------------------------------------
/addons/func_godot/src/fgd/func_godot_fgd_file.gd:
--------------------------------------------------------------------------------
1 | @tool
2 | @icon("res://addons/func_godot/icons/icon_godot_ranger.svg")
3 | class_name FuncGodotFGDFile extends Resource
4 | ## [Resource] file used to express a set of [FuncGodotFGDEntity] definitions.
5 | ##
6 | ## Can be exported as an FGD file for use with a Quake or Hammer-based map editor. Used in conjunction with [FuncGodotMapSetting] to generate nodes in a [FuncGodotMap] node.
7 | ##
8 | ## @tutorial(Level Design Book FGD Chapter): https://book.leveldesignbook.com/appendix/resources/formats/fgd
9 | ## @tutorial(Valve Developer Wiki FGD Article): https://developer.valvesoftware.com/wiki/FGD
10 |
11 | ## Supported map editors enum, used in conjunction with [member target_map_editor].
12 | enum FuncGodotTargetMapEditors {
13 | OTHER,
14 | TRENCHBROOM,
15 | JACK,
16 | NET_RADIANT_CUSTOM,
17 | }
18 |
19 | ## Builds and exports the FGD file.
20 | @export_tool_button("Export FGD") var export_file := export_button
21 |
22 | func export_button() -> void:
23 | do_export_file(target_map_editor)
24 |
25 | func do_export_file(target_editor: FuncGodotTargetMapEditors = FuncGodotTargetMapEditors.TRENCHBROOM, fgd_output_folder: String = "") -> void:
26 | if fgd_output_folder.is_empty():
27 | fgd_output_folder = FuncGodotLocalConfig.get_setting(FuncGodotLocalConfig.PROPERTY.FGD_OUTPUT_FOLDER) as String
28 | if fgd_output_folder.is_empty():
29 | printerr("Skipping export: No game config folder")
30 | return
31 |
32 | if fgd_name == "":
33 | printerr("Skipping export: Empty FGD name")
34 |
35 | if not DirAccess.dir_exists_absolute(fgd_output_folder):
36 | if DirAccess.make_dir_recursive_absolute(fgd_output_folder) != OK:
37 | printerr("Skipping export: Failed to create directory")
38 | return
39 |
40 | var fgd_file = fgd_output_folder.path_join(fgd_name + ".fgd")
41 |
42 | var file_obj := FileAccess.open(fgd_file, FileAccess.WRITE)
43 | if not file_obj:
44 | printerr("Failed to open file for writing: ", fgd_file)
45 | return
46 |
47 | print("Exporting FGD to ", fgd_file)
48 | file_obj.store_string(build_class_text(target_editor))
49 | file_obj.close()
50 |
51 | @export_group("Map Editor")
52 |
53 | ## Some map editors do not support the features found in others
54 | ## (ex: TrenchBroom supports the "model" key word while others require "studio",
55 | ## J.A.C.K. uses the "shader" key word while others use "material", etc...).
56 | ## If you get errors in your map editor, try changing this setting and re-exporting.
57 | ## This setting is overridden when the FGD is built via the Game Config resource.
58 | @export var target_map_editor: FuncGodotTargetMapEditors = FuncGodotTargetMapEditors.TRENCHBROOM
59 |
60 | # Some map editors do not support the "model" key word and require the "studio" key word instead.
61 | # If you get errors in your map editor, try changing this setting.
62 | # This setting is overridden when the FGD is built via the Game Config resource.
63 | #@export var model_key_word_supported: bool = true
64 |
65 | @export_group("FGD")
66 |
67 | ## FGD output filename without the extension.
68 | @export var fgd_name: String = "FuncGodot"
69 |
70 | ## Array of [FuncGodotFGDFile] resources to include in FGD file output. All of the entities included with these FuncGodotFGDFile resources will be prepended to the outputted FGD file.
71 | @export var base_fgd_files: Array[Resource] = []
72 |
73 | ## 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].
74 | @export var entity_definitions: Array[Resource] = []
75 |
76 | ## Toggles whether [FuncGodotFGDModelPointClass] resources will generate models from their [PackedScene] files.
77 | @export var generate_model_point_class_models: bool = true
78 |
79 | func build_class_text(target_editor: FuncGodotTargetMapEditors = FuncGodotTargetMapEditors.TRENCHBROOM) -> String:
80 | var res : String = ""
81 |
82 | for base_fgd in base_fgd_files:
83 | if base_fgd is FuncGodotFGDFile:
84 | res += base_fgd.build_class_text(target_editor)
85 | else:
86 | printerr("Base Fgd Files contains incorrect resource type! Should only be type FuncGodotFGDFile.")
87 |
88 | var entities = get_fgd_classes()
89 | for ent in entities:
90 | if not ent is FuncGodotFGDEntityClass:
91 | continue
92 | if ent.func_godot_internal:
93 | continue
94 | if ent is FuncGodotFGDModelPointClass:
95 | ent._model_generation_enabled = generate_model_point_class_models
96 |
97 | var ent_text = ent.build_def_text(target_editor)
98 | res += ent_text
99 | if ent != entities[-1]:
100 | res += "\n"
101 | return res
102 |
103 | ## This getter does a little bit of validation. Providing only an array of non-null uniquely-named entity definitions
104 | func get_fgd_classes() -> Array:
105 | var res : Array = []
106 | for cur_ent_def_ind in range(entity_definitions.size()):
107 | var cur_ent_def = entity_definitions[cur_ent_def_ind]
108 | if cur_ent_def == null:
109 | continue
110 | elif not (cur_ent_def is FuncGodotFGDEntityClass):
111 | printerr("Bad value in entity definition set at position %s! Not an entity defintion." % cur_ent_def_ind)
112 | continue
113 | res.append(cur_ent_def)
114 | return res
115 |
116 | func get_entity_definitions() -> Dictionary[String, FuncGodotFGDEntityClass]:
117 | var res: Dictionary[String, FuncGodotFGDEntityClass] = {}
118 |
119 | for base_fgd in base_fgd_files:
120 | var fgd_res = base_fgd.get_entity_definitions()
121 | for key in fgd_res:
122 | res[key] = fgd_res[key]
123 |
124 | for ent in get_fgd_classes():
125 | # Skip entities without classnames
126 | if ent.classname.replace(" ","") == "":
127 | printerr("Skipping " + ent.get_path() + ": Empty classname")
128 | continue
129 |
130 | if ent is FuncGodotFGDPointClass or ent is FuncGodotFGDSolidClass:
131 | var entity_def = ent.duplicate()
132 | var meta_properties: Dictionary[String, Variant] = {}
133 | var class_properties: Dictionary[String, Variant] = {}
134 | var class_property_descriptions: Dictionary[String, Variant] = {}
135 |
136 | for base_class in _generate_base_class_list(entity_def):
137 | for meta_property in base_class.meta_properties:
138 | meta_properties[meta_property] = base_class.meta_properties[meta_property]
139 |
140 | for class_property in base_class.class_properties:
141 | class_properties[class_property] = base_class.class_properties[class_property]
142 |
143 | for class_property_desc in base_class.class_property_descriptions:
144 | class_property_descriptions[class_property_desc] = base_class.class_property_descriptions[class_property_desc]
145 |
146 | for meta_property in entity_def.meta_properties:
147 | meta_properties[meta_property] = entity_def.meta_properties[meta_property]
148 |
149 | for class_property in entity_def.class_properties:
150 | class_properties[class_property] = entity_def.class_properties[class_property]
151 |
152 | for class_property_desc in entity_def.class_property_descriptions:
153 | class_property_descriptions[class_property_desc] = entity_def.class_property_descriptions[class_property_desc]
154 |
155 | entity_def.meta_properties = meta_properties
156 | entity_def.class_properties = class_properties
157 | entity_def.class_property_descriptions = class_property_descriptions
158 |
159 | res[ent.classname] = entity_def
160 | return res
161 |
162 | func _generate_base_class_list(entity_def : Resource, visited_base_classes = []) -> Array:
163 | var base_classes : Array = []
164 |
165 | visited_base_classes.append(entity_def.classname)
166 |
167 | # End recursive search if no more base_classes
168 | if len(entity_def.base_classes) == 0:
169 | return base_classes
170 |
171 | # Traverse up to the next level of hierarchy, if not already visited
172 | for base_class in entity_def.base_classes:
173 | if not base_class.classname in visited_base_classes:
174 | base_classes.append(base_class)
175 | base_classes += _generate_base_class_list(base_class, visited_base_classes)
176 | else:
177 | printerr(str("Entity '", entity_def.classname,"' contains cycle/duplicate to Entity '", base_class.classname, "'"))
178 |
179 | return base_classes
180 |
--------------------------------------------------------------------------------
/addons/func_godot/src/map/func_godot_map_settings.gd:
--------------------------------------------------------------------------------
1 | @tool
2 | @icon("res://addons/func_godot/icons/icon_godot_ranger.svg")
3 | class_name FuncGodotMapSettings extends Resource
4 | ## Reusable map settings configuration for [FuncGodotMap] nodes.
5 |
6 | #region BUILD
7 | @export_group("Build Settings")
8 |
9 | ## Set automatically when [member inverse_scale_factor] is changed. Used primarily during the build process.
10 | var scale_factor: float = 0.03125
11 |
12 | ## Ratio between map editor units and Godot units. FuncGodot will divide brush coordinates by this number and save the results to [member scale_factor].
13 | ## This does not affect entity properties unless scripted to do so.
14 | @export var inverse_scale_factor: float = 32.0 :
15 | set(value):
16 | if value == 0.0:
17 | printerr("Error: Cannot set Inverse Scale Factor to Zero")
18 | return
19 | inverse_scale_factor = value
20 | scale_factor = 1.0 / value
21 |
22 | ## [FuncGodotFGDFile] that translates map file classnames into Godot nodes and packed scenes.
23 | @export var entity_fgd: FuncGodotFGDFile = preload("res://addons/func_godot/fgd/func_godot_fgd.tres")
24 |
25 | ## If true, will organize [SceneTree] using TrenchBroom Layers and Groups or Hammer Visgroups. Groups will be generated as [Node3D] nodes.
26 | ## All non-entity structural brushes will be moved out of their groups and merged into the `Worldspawn` entity.
27 | ## Any Layers toggled to be omitted from export in TrenchBroom and their child entities and groups will not be built.
28 | @export var use_groups_hierarchy: bool = false
29 |
30 | ## Texel size for UV2 unwrapping.
31 | ## Actual texel size is uv_unwrap_texel_size / [member inverse_scale_factor]. A ratio of 1/16 is usually a good place to start with
32 | ## (if inverse_scale_factor is 32, start with a uv_unwrap_texel_size of 2).
33 | ## Larger values will produce less detailed lightmaps. To conserve memory and filesize, use the largest value that still looks good.
34 | @export var uv_unwrap_texel_size: float = 2.0
35 |
36 | #endregion
37 |
38 | #region ENTITY
39 | @export_group("Entity Settings")
40 |
41 | ## Optional array of node groups to add all generated nodes to.
42 | @export var entity_node_groups: Array[String] = []
43 |
44 | @export_subgroup("Entity Property Names")
45 | ## Default class property to use in naming generated nodes. This setting is overridden by [member FuncGodotFGDEntityClass.name_property].
46 | ## Naming occurs before adding to the [SceneTree] and applying properties.
47 | ## Nodes will be named `"entity_" + name_property`. An entity's name should be unique, otherwise you may run into unexpected behavior.
48 | @export var entity_name_property: String = ""
49 |
50 | ## Class property that determines whether the [FuncGodotFGDSolidClass] entity performs mesh smoothing operations.
51 | @export var entity_smoothing_property: String = "_phong"
52 |
53 | ## Class property that contains the angular threshold that determines when a [FuncGodotFGDSolidClass] entity's mesh vertices are smoothed.
54 | @export var entity_smoothing_angle_property: String = "_phong_angle"
55 |
56 | ## Class property that contains the snapping epsilon for generated vertices of [FuncGodotFGDSolidClass] entities.
57 | ## Utilizing this property can help reduce instances of seams between polygons.
58 | @export var vertex_merge_distance_property: String = "_vertex_merge_distance"
59 |
60 | ## Class property that tells whether interior faces should be culled for that brush entity
61 | ## Interior faces are faces that are not visible from any angle
62 | @export var cull_interior_faces_property: String = "_cull_interior_faces"
63 |
64 | @export_subgroup("")
65 | #endregion
66 |
67 | #region TEXTURES
68 | @export_group("Textures")
69 |
70 | ## Base directory for textures. When building materials, FuncGodot will search this directory for texture files with matching names to the textures assigned to map brush faces.
71 | @export_dir var base_texture_dir: String = "res://textures"
72 |
73 | ## File extensions to search for texture data.
74 | @export var texture_file_extensions: Array[String] = ["png", "jpg", "jpeg", "bmp", "tga", "webp"]
75 |
76 | @export_subgroup("Hint Textures")
77 | ## Optional path for the clip texture, relative to [member base_texture_dir].
78 | ## Brush faces textured with the clip texture will have those faces removed from the generated [Mesh] but not the generated [Shape3D].
79 | @export var clip_texture: String = "clip":
80 | set(tex):
81 | clip_texture = tex.to_lower()
82 |
83 | ## Optional path for the skip texture, relative to [member base_texture_dir].
84 | ## Brush faces textured with the skip texture will have those faces removed from the generated [Mesh].
85 | ## If [member FuncGodotFGDSolidClass.collision_shape_type] is set to concave then it will also remove collision from those faces in the generated [Shape3D].
86 | @export var skip_texture: String = "skip":
87 | set(tex):
88 | skip_texture = tex.to_lower()
89 |
90 | ## Optional path for the origin texture, relative to [member base_texture_dir].
91 | ## Brush faces textured with the origin texture will have those faces removed from the generated [Mesh] and [Shape3D].
92 | ## The bounds of these faces will be used to calculate the origin point of the entity.
93 | @export var origin_texture: String = "origin":
94 | set(tex):
95 | origin_texture = tex.to_lower()
96 | @export_subgroup("")
97 |
98 | ## Optional [QuakeWadFile] resources to apply textures from. See the [Quake Wiki](https://quakewiki.org/wiki/Texture_Wad) for more information on Quake Texture WADs.
99 | @export var texture_wads: Array[QuakeWadFile] = []
100 |
101 | #endregion
102 |
103 | #region MATERIALS
104 | @export_group("Materials")
105 |
106 | ## Base directory for loading and saving materials. When building materials, FuncGodot will search this directory for material resources
107 | ## with matching names to the textures assigned to map brush faces. If not found, will fall back to [member base_texture_dir].
108 | @export_dir var base_material_dir: String = ""
109 |
110 | ## File extension to search for [Material] definitions
111 | @export var material_file_extension: String = "tres"
112 |
113 | ## [Material] used as template when generating missing materials.
114 | @export var default_material: Material = preload("res://addons/func_godot/textures/default_material.tres")
115 |
116 | ## Sampler2D uniform that supplies the Albedo in a custom shader when [member default_material] is a [ShaderMaterial].
117 | @export var default_material_albedo_uniform: String = ""
118 |
119 | ## Automatic [ShaderMaterial] generation mapping patterns. Only used when [member default_material] is a ShaderMaterial.
120 | ## Keys should be the names of the shader uniforms while the values should be the suffixes for the texture maps.
121 | ## Patterns only use one replacement String: the texture name, ex: [code]"%s_normal"[/code].
122 | @export var shader_material_uniform_map_patterns: Dictionary[String, String] = {}
123 |
124 | @export_subgroup("BaseMaterial3D Map Patterns")
125 | ## Automatic PBR material generation albedo map pattern.
126 | @export var albedo_map_pattern: String = "%s_albedo"
127 | ## Automatic PBR material generation normal map pattern.
128 | @export var normal_map_pattern: String = "%s_normal"
129 | ## Automatic PBR material generation metallic map pattern
130 | @export var metallic_map_pattern: String = "%s_metallic"
131 | ## Automatic PBR material generation roughness map pattern
132 | @export var roughness_map_pattern: String = "%s_roughness"
133 | ## Automatic PBR material generation emission map pattern
134 | @export var emission_map_pattern: String = "%s_emission"
135 | ## Automatic PBR material generation ambient occlusion map pattern
136 | @export var ao_map_pattern: String = "%s_ao"
137 | ## Automatic PBR material generation height map pattern
138 | @export var height_map_pattern: String = "%s_height"
139 | ## Automatic PBR material generation ORM map pattern
140 | @export var orm_map_pattern: String = "%s_orm"
141 | @export_subgroup("")
142 |
143 | ## Save automatically generated materials to disk, allowing reuse across [FuncGodotMap] nodes.
144 | ## [i]NOTE: Materials do not use the [member default_material] settings after saving.[/i]
145 | @export var save_generated_materials: bool = true
146 | @export_group("")
147 |
148 | #endregion
149 |
--------------------------------------------------------------------------------
/addons/func_godot/src/fgd/func_godot_fgd_solid_class.gd:
--------------------------------------------------------------------------------
1 | @tool
2 | @icon("res://addons/func_godot/icons/icon_slipgate3d.svg")
3 | class_name FuncGodotFGDSolidClass extends FuncGodotFGDEntityClass
4 | ## FGD SolidClass entity definition that generates a mesh from [FuncGodotData.BrushData].
5 | ##
6 | ## A [MeshInstance3D] will be generated by [FuncGodotMap] according to this definition's Visual Build settings.
7 | ## If [member FuncGodotFGDEntityClass.node_class] inherits [CollisionObject3D]
8 | ## then one or more [CollisionShape3D] nodes will be generated according to Collision Build settings.
9 | ##
10 | ## @tutorial(Quake Wiki Entity Article): https://quakewiki.org/wiki/Entity
11 | ## @tutorial(Level Design Book: Entity Types and Settings): https://book.leveldesignbook.com/appendix/resources/formats/fgd#entity-types-and-settings-basic
12 | ## @tutorial(Valve Developer Wiki FGD Article): https://developer.valvesoftware.com/wiki/FGD#Class_Types_and_Properties
13 | ## @tutorial(dumptruck_ds' Quake Mapping Entities Tutorial): https://www.youtube.com/watch?v=gtL9f6_N2WM
14 |
15 | enum SpawnType {
16 | WORLDSPAWN = 0, ## Builds the geometry of this entity relative to the FuncGodotMap position.
17 | MERGE_WORLDSPAWN = 1, ## This entity's geometry is merged with the [b]worldspawn[/b] entity and this entity is removed. Behavior mimics [b]func_group[/b] in modern Quake compilers.
18 | ENTITY = 2, ## This entity is built as its own object. It finds the origin of the entity based on [member origin_type].
19 | }
20 |
21 | enum OriginType {
22 | AVERAGED = 0, ## Use averaged brush vertices for center position. This is the old Qodot behavior.
23 | ABSOLUTE = 1, ## Use [code]origin[/code] class property in global coordinates as the center position.
24 | RELATIVE = 2, ## Calculate center position using [code]origin[/code] class property as an offset to the entity's bounding box center.
25 | BRUSH = 3, ## Calculate center position based on the bounding box center of all brushes using the 'origin' texture specified in the [FuncGodotMapSettings]. If no Origin Brush is found, fall back to BOUNDS_CENTER. This is the default option and recommended for most entities.
26 | BOUNDS_CENTER = 4, ## Use the center of the entity's bounding box for center position.
27 | BOUNDS_MINS = 5, ## Use the lowest bounding box coordinates for center position. This is standard Quake and Half-Life brush entity behavior.
28 | BOUNDS_MAXS = 6, ## Use the highest bounding box coordinates for center position.
29 | }
30 |
31 | enum CollisionShapeType {
32 | NONE, ## No collision shape is built. Useful for decorative geometry like vines, hanging wires, grass, etc...
33 | CONVEX, ## Will build a Convex CollisionShape3D for each brush used to make this Solid Class. Required for non-[StaticBody3D] nodes like [Area3D].
34 | CONCAVE ## Should have a concave collision shape
35 | }
36 |
37 | ## Controls whether this Solid Class is the worldspawn, is combined with the worldspawn, or is spawned as its own free-standing entity.
38 | @export var spawn_type: SpawnType = SpawnType.ENTITY
39 | ## Controls how this Solid Class determines its center position. Only valid if [member spawn_type] is set to ENTITY.
40 | @export var origin_type: OriginType = OriginType.BRUSH
41 |
42 | @export_group("Visual Build")
43 | ## Controls whether a [MeshInstance3D] is built for this Solid Class.
44 | @export var build_visuals : bool = true
45 | ## Global illumination mode for the generated [MeshInstance3D]. Setting to [b]GI_MODE_STATIC[/b] will unwrap the mesh's UV2 during build.
46 | @export var global_illumination_mode : GeometryInstance3D.GIMode = GeometryInstance3D.GI_MODE_STATIC
47 | ## @deprecated: Use [member global_illumination_mode] instead. [br]Sets generated [MeshInstance3D] to be available for UV2 unwrapping after [FuncGodotMap] build. Utilized in baked lightmapping.
48 | @export var use_in_baked_light : bool = true
49 | ## Shadow casting setting allows for further lightmapping customization.
50 | @export var shadow_casting_setting : GeometryInstance3D.ShadowCastingSetting = GeometryInstance3D.SHADOW_CASTING_SETTING_ON
51 | ## Automatically build [OccluderInstance3D] for this entity.
52 | @export var build_occlusion : bool = false
53 | ## This Solid Class' [MeshInstance3D] will only be visible for [Camera3D]s whose cull mask includes any of these render layers.
54 | @export_flags_3d_render var render_layers: int = 1
55 |
56 | @export_group("Collision Build")
57 | ## Controls how collisions are built for this Solid Class.
58 | @export var collision_shape_type: CollisionShapeType = CollisionShapeType.CONVEX
59 | ## The physics layers this Solid Class can be detected in.
60 | @export_flags_3d_physics var collision_layer: int = 1
61 | ## The physics layers this Solid Class scans.
62 | @export_flags_3d_physics var collision_mask: int = 1
63 | ## The priority used to solve colliding when penetration occurs. The higher the priority is, the lower the penetration into the Solid Class will be. This can for example be used to prevent the player from breaking through the boundaries of a level.
64 | @export var collision_priority: float = 1.0
65 | ## The collision margin for the Solid Class' collision shapes. Not used in Godot Physics. See [Shape3D] for details.
66 | @export var collision_shape_margin: float = 0.04
67 |
68 | ## The following properties tell FuncGodot to add a [i]"func_godot_mesh_data"[/i] Dictionary to the metadata of the generated node upon build.
69 | ## This data is parallelized, so that each element of the array is ordered to reference the same face in the mesh.
70 | @export_group("Mesh Metadata")
71 | ## Add a texture lookup table to the generated node's metadata on build.[br][br]
72 | ## The data is split between an [Array] of [StringName] called [i]"texture_names"[/i] containing all currently used texture materials
73 | ## and a [PackedInt32Array] called [i]"textures"[/i] where each element is an index corresponding to the [i]"texture_names"[/i] entries.
74 | @export var add_textures_metadata: bool = false
75 | ## Add a [PackedVector3Array] called [i]"vertices"[/i] to the generated node's metadata on build.[br][br]
76 | ## This is a list of every vertex in the generated node's [MeshInstance3D]. Every 3 vertices represent a single face.
77 | @export var add_vertex_metadata: bool = false
78 | ## Add a [PackedVector3Array] called [i]"positions"[/i] to the generated node's metadata on build.[br][br]
79 | ## This is a list of positions for each face, local to the generated node, calculated by averaging the vertices to find the face's center.
80 | @export var add_face_position_metadata: bool = false
81 | ## Add a [PackedVector3Array] called [i]"normals"[/i] to the generated node's metadata on build.[br][br]
82 | ## Contains a list of each face's normal.
83 | @export var add_face_normal_metadata: bool = false
84 | ## Add a [Dictionary] called [i]"collision_shape_to_face_indices_map"[/i] in the generated node's metadata on build.[br][br]
85 | ## Contains keys of strings, which are the names of child [CollisionShape3D] nodes, and values of
86 | ## [PackedInt32Array], containing indices of that child's faces.[br][br]
87 | ## For example, an element of [br][br][code]{ "entity_1_brush_0_collision_shape" : [0, 1, 3] }[/code][br][br]
88 | ## shows that this solid class has been generated with one child collision shape named
89 | ## [i]entity_1_brush_0_collision_shape[/i] which handles 3 faces of the mesh with collision, at indices 0, 1, and 3.
90 | @export var add_collision_shape_to_face_indices_metadata : bool = false
91 | ## [s]Add a [Dictionary] called [i]"collision_shape_to_face_range_map"[/i] in the generated node's metadata on build.[br][br]
92 | ## Contains keys of strings, which are the names of child [CollisionShape3D] nodes, and values of
93 | ## [Vector2i], where [i]X[/i] represents the starting index of that child's faces and [i]Y[/i] represents the
94 | ## ending index.[br][br]
95 | ## For example, an element of [br][br][code]{ "entity_1_brush_0_collision_shape" : Vector2i(0, 15) }[/code][br][br]
96 | ## shows that this solid class has been generated with one child collision shape named
97 | ## [i]entity_1_brush_0_collision_shape[/i] which handles the first 15 faces of the parts of the mesh with collision.[/s]
98 | ## @deprecated: No longer supported or planned as of 2025.7, but retained in case a contributor provides an appropriate solution in the future.
99 | @export var add_collision_shape_face_range_metadata: bool = false
100 |
101 | @export_group("Scripting")
102 | ## An optional [Script] file to attach to the node generated on map build.
103 | @export var script_class: Script
104 |
105 | func _init():
106 | prefix = "@SolidClass"
107 |
--------------------------------------------------------------------------------
/addons/func_godot/icons/icon_godambler.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
14 |
--------------------------------------------------------------------------------
/addons/func_godot/src/fgd/func_godot_fgd_model_point_class.gd:
--------------------------------------------------------------------------------
1 | @tool
2 | @icon("res://addons/func_godot/icons/icon_godambler3d.svg")
3 | class_name FuncGodotFGDModelPointClass extends FuncGodotFGDPointClass
4 | ## A special type of [FuncGodotFGDPointClass] entity that automatically generates a special simplified GLB model file for the map editor display.
5 | ## Only supported in map editors that support GLTF or GLB.
6 | ##
7 | ## @tutorial(Quake Wiki Entity Article): https://quakewiki.org/wiki/Entity
8 | ## @tutorial(Level Design Book: Entity Types and Settings): https://book.leveldesignbook.com/appendix/resources/formats/fgd#entity-types-and-settings-basic
9 | ## @tutorial(Valve Developer Wiki FGD Article): https://developer.valvesoftware.com/wiki/FGD#Class_Types_and_Properties
10 | ## @tutorial(dumptruck_ds' Quake Mapping Entities Tutorial): https://www.youtube.com/watch?v=gtL9f6_N2WM
11 | ## @tutorial(Level Design Book: Display Models for Entities): https://book.leveldesignbook.com/appendix/resources/formats/fgd#display-models-for-entities
12 | ## @tutorial(Valve Developer Wiki FGD Article: Entity Description Section): https://developer.valvesoftware.com/wiki/FGD#Entity_Description
13 | ## @tutorial(TrenchBroom Manual: Display Models for Entities): https://trenchbroom.github.io/manual/latest/#display-models-for-entities
14 |
15 | enum TargetMapEditor {
16 | GENERIC, ## Entity definition uses the [b]@studio[/b] key word. [member scale_expression] is ignored. Supported by all map editors.
17 | TRENCHBROOM ## Entity definition uses the [b]@model[/b] key word. [member scale_expression] is applied if set.
18 | }
19 |
20 | @export var target_map_editor: TargetMapEditor = TargetMapEditor.GENERIC
21 | ## Display model export folder relative to [member ProjectSettings.func_godot/model_point_class_save_path].
22 | @export var models_sub_folder : String = ""
23 | ## Scale expression applied to model. Only used by TrenchBroom. If left empty, uses [member ProjectSettings.func_godot/default_inverse_scale_factor]. [br][br]Read the TrenchBroom Manual for more information on the "scale expression" feature.
24 | @export var scale_expression : String = ""
25 | ## Model Point Class can override the 'size' meta property by auto-generating a value from the meshes' [AABB]. Proper generation requires [member scale_expression] set to a float or vector. [br][br][color=orange]WARNING:[/color] Generated size property unlikely to align cleanly to grid!
26 | @export var generate_size_property : bool = false
27 | ## Degrees to rotate model prior to export. Different editors may handle GLTF transformations differently. If your model isn't oriented correctly, try modifying this property.
28 | @export var rotation_offset: Vector3 = Vector3(0.0, 0.0, 0.0)
29 | ## Creates a .gdignore file in the model export folder to prevent Godot importing the display models. Only needs to be generated once.
30 | @export_tool_button("Generate GD Ignore File", "FileAccess") var generate_gd_ignore_file : Callable = _generate_gd_ignore_file
31 |
32 | var _model_generation_enabled: bool = false
33 |
34 | func _generate_gd_ignore_file() -> void:
35 | if Engine.is_editor_hint():
36 | var path: String = _get_game_path().path_join(_get_model_folder())
37 | var error: Error = DirAccess.make_dir_recursive_absolute(path)
38 | if error != Error.OK:
39 | printerr("Failed creating dir for GDIgnore file", error)
40 | return
41 | path = path.path_join('.gdignore')
42 | if FileAccess.file_exists(path):
43 | return
44 | var file: FileAccess = FileAccess.open(path, FileAccess.WRITE)
45 | file.store_string('')
46 | file.close()
47 |
48 | ## Builds and saves the display model into the specified destination, then parses the definition and outputs it into the FGD format.
49 | func build_def_text(target_editor: FuncGodotFGDFile.FuncGodotTargetMapEditors = FuncGodotFGDFile.FuncGodotTargetMapEditors.TRENCHBROOM) -> String:
50 | if _model_generation_enabled:
51 | _generate_model()
52 | _model_generation_enabled = false
53 | return super()
54 |
55 | func _generate_model() -> void:
56 | if not scene_file:
57 | return
58 |
59 | var gltf_state := GLTFState.new()
60 | var path: String = _get_export_dir()
61 | var node: Node3D = _get_node()
62 | if not node:
63 | return
64 | if not _create_gltf_file(gltf_state, path, node):
65 | printerr("could not create gltf file")
66 | return
67 | node.queue_free()
68 |
69 | if target_map_editor == TargetMapEditor.TRENCHBROOM:
70 | const model_key: String = "model"
71 | if scale_expression.is_empty():
72 | meta_properties[model_key] = '{"path": "%s", "scale": %s }' % [
73 | _get_local_path(),
74 | ProjectSettings.get_setting("func_godot/default_inverse_scale_factor", 32.0) as float
75 | ]
76 | else:
77 | meta_properties[model_key] = '{"path": "%s", "scale": %s }' % [
78 | _get_local_path(),
79 | scale_expression
80 | ]
81 | else:
82 | meta_properties["studio"] = '"%s"' % _get_local_path()
83 |
84 | if generate_size_property:
85 | meta_properties["size"] = _generate_size_from_aabb(gltf_state.meshes, gltf_state.get_nodes())
86 |
87 | func _get_node() -> Node3D:
88 | var node := scene_file.instantiate()
89 | if node is Node3D:
90 | return node as Node3D
91 | node.queue_free()
92 | printerr("Scene is not of type 'Node3D'")
93 | return null
94 |
95 | func _get_export_dir() -> String:
96 | var work_dir: String = _get_game_path()
97 | var model_dir: String = _get_model_folder()
98 | return work_dir.path_join(model_dir).path_join('%s.glb' % classname)
99 |
100 | func _get_local_path() -> String:
101 | return _get_model_folder().path_join('%s.glb' % classname)
102 |
103 | func _get_model_folder() -> String:
104 | var model_dir: String = ProjectSettings.get_setting("func_godot/model_point_class_save_path", "") as String
105 | if not models_sub_folder.is_empty():
106 | model_dir = model_dir.path_join(models_sub_folder)
107 | return model_dir
108 |
109 | func _get_game_path() -> String:
110 | return FuncGodotLocalConfig.get_setting(FuncGodotLocalConfig.PROPERTY.MAP_EDITOR_GAME_PATH) as String
111 |
112 | func _create_gltf_file(gltf_state: GLTFState, path: String, node: Node3D) -> bool:
113 | var global_export_path = path
114 | var gltf_document := GLTFDocument.new()
115 | gltf_state.create_animations = false
116 |
117 | node.rotate_x(deg_to_rad(rotation_offset.x))
118 | node.rotate_y(deg_to_rad(rotation_offset.y))
119 | node.rotate_z(deg_to_rad(rotation_offset.z))
120 |
121 | # With TrenchBroom we can specify a scale expression, but for other editors we need to scale our models manually.
122 | if target_map_editor != TargetMapEditor.TRENCHBROOM:
123 | var scale_factor: Vector3 = Vector3.ONE
124 | if scale_expression.is_empty():
125 | scale_factor *= ProjectSettings.get_setting("func_godot/default_inverse_scale_factor", 32.0) as float
126 | else:
127 | if scale_expression.begins_with('\''):
128 | var scale_arr := scale_expression.split_floats(' ', false)
129 | if scale_arr.size() == 3:
130 | scale_factor *= Vector3(scale_arr[0], scale_arr[1], scale_arr[2])
131 | elif scale_expression.to_float() > 0:
132 | scale_factor *= scale_expression.to_float()
133 | if scale_factor.length() == 0:
134 | scale_factor = Vector3.ONE # Don't let the node scale into oblivion!
135 | node.scale *= scale_factor
136 |
137 | var error: Error = gltf_document.append_from_scene(node, gltf_state)
138 | if error != Error.OK:
139 | printerr("Failed appending to gltf document", error)
140 | return false
141 |
142 | call_deferred("_save_to_file_system", gltf_document, gltf_state, global_export_path)
143 | return true
144 |
145 | func _save_to_file_system(gltf_document: GLTFDocument, gltf_state: GLTFState, path: String) -> void:
146 | var error: Error = DirAccess.make_dir_recursive_absolute(path.get_base_dir())
147 | if error != Error.OK:
148 | printerr("Failed creating dir", error)
149 | return
150 |
151 | error = gltf_document.write_to_filesystem(gltf_state, path)
152 | if error != Error.OK:
153 | printerr("Failed writing to file system", error)
154 | return
155 | print('Exported model to ', path)
156 |
157 | func _generate_size_from_aabb(meshes: Array[GLTFMesh], nodes: Array[GLTFNode]) -> AABB:
158 | var aabb := AABB()
159 | for mesh in meshes:
160 | aabb = aabb.merge(mesh.mesh.get_mesh().get_aabb())
161 | var pos_ofs := Vector3.ZERO
162 | if not nodes.is_empty():
163 | var ct: int = 0
164 | for node in nodes:
165 | if node.parent == 0:
166 | pos_ofs += node.position
167 | ct += 1
168 | pos_ofs /= maxi(ct, 1)
169 | aabb.position += pos_ofs
170 |
171 | # Reorient the AABB so it matches TrenchBroom's coordinate system
172 | var size_prop := AABB()
173 | size_prop.position = Vector3(aabb.position.z, aabb.position.x, aabb.position.y)
174 | size_prop.size = Vector3(aabb.size.z, aabb.size.x, aabb.size.y)
175 |
176 | # Scale the size bounds to our scale factor
177 | # Scale factor will need to be set if we decide to auto-generate our bounds
178 | var scale_factor: Vector3 = Vector3.ONE
179 | if target_map_editor == TargetMapEditor.TRENCHBROOM:
180 | if scale_expression.is_empty():
181 | scale_factor *= ProjectSettings.get_setting("func_godot/default_inverse_scale_factor", 32.0) as float
182 | else:
183 | if scale_expression.begins_with('\''):
184 | var scale_arr := scale_expression.split_floats(' ', false)
185 | if scale_arr.size() == 3:
186 | scale_factor *= Vector3(scale_arr[0], scale_arr[1], scale_arr[2])
187 | elif scale_expression.to_float() > 0:
188 | scale_factor *= scale_expression.to_float()
189 |
190 | size_prop.position *= scale_factor
191 | size_prop.size *= scale_factor
192 | size_prop.size += size_prop.position
193 | # Round the size so it can stay on grid level 1 at least
194 | for i in 3:
195 | size_prop.position[i] = round(size_prop.position[i])
196 | size_prop.size[i] = round(size_prop.size[i])
197 | return size_prop
198 |
--------------------------------------------------------------------------------
/addons/func_godot/icon.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
14 |
--------------------------------------------------------------------------------
/addons/func_godot/src/fgd/func_godot_fgd_entity_class.gd:
--------------------------------------------------------------------------------
1 | @icon("res://addons/func_godot/icons/icon_godot_ranger.svg")
2 | class_name FuncGodotFGDEntityClass extends Resource
3 | ## Entity definition template. WARNING! Not to be used directly! Use [FuncGodotFGDBaseClass], [FuncGodotFGDSolidClass], or [FuncGodotFGDPointClass] instead.
4 | ##
5 | ## Entity definition template. It holds all of the common entity class properties shared between [FuncGodotFGDBaseClass], [FuncGodotFGDSolidClass], or [FuncGodotFGDPointClass].
6 | ## Not to be used directly, use one of the aforementioned FGD class types instead.
7 | ##
8 | ## @tutorial(Quake Wiki Entity Article): https://quakewiki.org/wiki/Entity
9 | ## @tutorial(Level Design Book: Entity Types and Settings): https://book.leveldesignbook.com/appendix/resources/formats/fgd#entity-types-and-settings-basic
10 | ## @tutorial(Valve Developer Wiki FGD Article): https://developer.valvesoftware.com/wiki/FGD#Class_Types_and_Properties
11 | ## @tutorial(Valve Developer Wiki Entity Descriptions): https://developer.valvesoftware.com/wiki/FGD#Entity_Description
12 |
13 | var prefix: String = ""
14 |
15 | @export_group("Entity Definition")
16 |
17 | ## Entity classname. [b][i]This is a required field in all entity types[/i][/b] as it is parsed by both the map editor and by FuncGodot on map build.
18 | @export var classname : String = ""
19 |
20 | ## Entity description that appears in the map editor. Not required.
21 | @export_multiline var description : String = ""
22 |
23 | ## Entity does not get written to the exported FGD. Entity is only used for [FuncGodotMap] build process.
24 | @export var func_godot_internal : bool = false
25 |
26 | ## [FuncGodotFGDBaseClass] resources to inherit [member class_properties] and [member class_descriptions] from.
27 | @export var base_classes: Array[Resource] = []
28 |
29 | ## Key value pair properties that will appear in the map editor. After building the [FuncGodotMap] in Godot, these properties will be added to a [Dictionary]
30 | ## that gets applied to the generated node, as long as that node is a tool script with an exported `func_godot_properties` Dictionary.
31 | @export var class_properties : Dictionary[String, Variant] = {}
32 |
33 | ## Map editor descriptions for previously defined key value pair properties. Optional but recommended.
34 | @export var class_property_descriptions : Dictionary[String, Variant] = {}
35 |
36 | ## Automatically applies entity class properties to matching properties in the generated node.
37 | ## When using this feature, class properties need to be the correct type or you may run into errors on map build.
38 | @export var auto_apply_to_matching_node_properties : bool = false
39 |
40 | ## Appearance properties for the map editor. See the Valve Developer Wiki and TrenchBroom documentation for more information.
41 | @export var meta_properties : Dictionary[String, Variant] = {
42 | "size": AABB(Vector3(-8, -8, -8), Vector3(8, 8, 8)),
43 | "color": Color(0.8, 0.8, 0.8)
44 | }
45 |
46 | @export_group("Node Generation")
47 |
48 | ## Node to generate on map build. This can be a built-in Godot class, a Script class, or a GDExtension class.
49 | ## For Point Class entities that use Scene File instantiation leave this blank.
50 | @export var node_class := ""
51 |
52 | ## Optional class property to use in naming the generated node. Overrides [member FuncGodotMapSettings.name_property].
53 | ## Naming occurs before adding to the [SceneTree] and applying properties.
54 | ## Nodes will be named `"entity_" + name_property`. An entity's name should be unique, otherwise you may run into unexpected behavior.
55 | @export var name_property := ""
56 |
57 | ## Optional array of node groups to add the generated node to.
58 | @export var node_groups : Array[String] = []
59 |
60 | ## Parses the definition and outputs it into the FGD format.
61 | func build_def_text(target_editor: FuncGodotFGDFile.FuncGodotTargetMapEditors = FuncGodotFGDFile.FuncGodotTargetMapEditors.TRENCHBROOM) -> String:
62 | # Class prefix
63 | var res : String = prefix
64 |
65 | # Meta properties
66 | var base_str = ""
67 | var meta_props = meta_properties.duplicate()
68 |
69 | for base_class in base_classes:
70 | if not 'classname' in base_class:
71 | continue
72 |
73 | base_str += base_class.classname
74 |
75 | if base_class != base_classes.back():
76 | base_str += ", "
77 |
78 | if base_str != "":
79 | meta_props['base'] = base_str
80 |
81 | for prop in meta_props:
82 | if prefix == '@SolidClass':
83 | if prop == "size" or prop == "model":
84 | continue
85 |
86 | if prop == 'model' and target_editor != FuncGodotFGDFile.FuncGodotTargetMapEditors.TRENCHBROOM:
87 | continue
88 |
89 | var value = meta_props[prop]
90 | res += " " + prop + "("
91 |
92 | if value is AABB:
93 | res += "%s %s %s, %s %s %s" % [
94 | value.position.x,
95 | value.position.y,
96 | value.position.z,
97 | value.size.x,
98 | value.size.y,
99 | value.size.z
100 | ]
101 | elif value is Color:
102 | res += "%s %s %s" % [
103 | value.r8,
104 | value.g8,
105 | value.b8
106 | ]
107 | elif value is String:
108 | res += value
109 | elif value is Dictionary and target_editor == FuncGodotFGDFile.FuncGodotTargetMapEditors.TRENCHBROOM:
110 | res += JSON.stringify(value)
111 |
112 | res += ")"
113 |
114 | res += " = " + classname
115 |
116 | if prefix != "@BaseClass": # having a description in BaseClasses crashes some editors
117 | var normalized_description = description.replace("\"", "\'")
118 | if normalized_description != "":
119 | res += " : \"%s\" " % [normalized_description]
120 | else: # Having no description crashes some editors
121 | res += " : \"" + classname + "\" "
122 |
123 | if class_properties.size() > 0:
124 | res += FuncGodotUtil.newline() + "[" + FuncGodotUtil.newline()
125 | else:
126 | res += "["
127 |
128 | # Class properties
129 | for prop in class_properties:
130 | var value = class_properties[prop]
131 | var prop_val = null
132 | var prop_type := ""
133 | var prop_description: String
134 | if prop in class_property_descriptions:
135 | # Optional default value for Choices can be set up as [String, int]
136 | if value is Dictionary and class_property_descriptions[prop] is Array:
137 | var prop_arr: Array = class_property_descriptions[prop]
138 | if prop_arr.size() > 1 and (prop_arr[1] is int or prop_arr[1] is String):
139 | var value_str : String = str(prop_arr[1]) if prop_arr[1] is int else "\"" + prop_arr[1] + "\""
140 | prop_description = "\"" + prop_arr[0] + "\" : " + value_str
141 | else:
142 | prop_description = "\"\" : 0"
143 | printerr(str(prop) + " has incorrect description format. Should be [String description, int / String default value].")
144 | else:
145 | prop_description = "\"" + class_property_descriptions[prop] + "\""
146 | else:
147 | prop_description = "\"\""
148 |
149 | match typeof(value):
150 | TYPE_INT:
151 | prop_type = "integer"
152 | prop_val = str(value)
153 | TYPE_FLOAT:
154 | prop_type = "float"
155 | prop_val = "\"" + str(value) + "\""
156 | TYPE_STRING:
157 | prop_type = "string"
158 | prop_val = "\"" + value + "\""
159 | TYPE_BOOL:
160 | prop_type = "choices"
161 | prop_val = FuncGodotUtil.newline() + "\t[" + FuncGodotUtil.newline()
162 | prop_val += "\t\t" + str(0) + " : \"No\"" + FuncGodotUtil.newline()
163 | prop_val += "\t\t" + str(1) + " : \"Yes\"" + FuncGodotUtil.newline()
164 | prop_val += "\t]"
165 | TYPE_VECTOR2, TYPE_VECTOR2I:
166 | prop_type = "string"
167 | prop_val = "\"%s %s\"" % [value.x, value.y]
168 | TYPE_VECTOR3, TYPE_VECTOR3I:
169 | prop_type = "string"
170 | prop_val = "\"%s %s %s\"" % [value.x, value.y, value.z]
171 | TYPE_VECTOR4, TYPE_VECTOR4I:
172 | prop_type = "string"
173 | prop_val = "\"%s %s %s %s\"" % [value[0], value[1], value[2], value[3]]
174 | TYPE_COLOR:
175 | prop_type = "color255"
176 | prop_val = "\"%s %s %s\"" % [value.r8, value.g8, value.b8]
177 | TYPE_DICTIONARY:
178 | prop_type = "choices"
179 | prop_val = FuncGodotUtil.newline() + "\t[" + FuncGodotUtil.newline()
180 | for choice in value:
181 | var choice_val = value[choice]
182 | if typeof(choice_val) == TYPE_STRING:
183 | if not (choice_val as String).begins_with("\""):
184 | choice_val = "\"" + choice_val + "\""
185 | prop_val += "\t\t" + str(choice_val) + " : \"" + choice + "\"" + FuncGodotUtil.newline()
186 | prop_val += "\t]"
187 | TYPE_ARRAY:
188 | prop_type = "flags"
189 | prop_val = FuncGodotUtil.newline() + "\t[" + FuncGodotUtil.newline()
190 | for arr_val in value:
191 | prop_val += "\t\t" + str(arr_val[1]) + " : \"" + str(arr_val[0]) + "\" : " + ("1" if arr_val[2] else "0") + FuncGodotUtil.newline()
192 | prop_val += "\t]"
193 | TYPE_NODE_PATH:
194 | prop_type = "target_destination"
195 | prop_val = "\"\""
196 | TYPE_OBJECT:
197 | if value is Resource:
198 | prop_val = "\"" + value.resource_path + "\""
199 | if value is Material:
200 | if target_editor != FuncGodotFGDFile.FuncGodotTargetMapEditors.JACK:
201 | prop_type = "material"
202 | else:
203 | prop_type = "shader"
204 | elif value is Texture2D:
205 | prop_type = "decal"
206 | elif value is AudioStream:
207 | prop_type = "sound"
208 | else:
209 | prop_type = "target_source"
210 | prop_val = "\"\""
211 |
212 | if prop_val:
213 | res += "\t"
214 | res += prop
215 | res += "("
216 | res += prop_type
217 | res += ")"
218 |
219 | if not value is Array:
220 | if not value is Dictionary or prop_description != "":
221 | res += " : "
222 | res += prop_description
223 |
224 | if value is bool:
225 | res += " : 1 = " if value else " : 0 = "
226 | elif value is Dictionary or value is Array:
227 | res += " = "
228 | else:
229 | res += " : "
230 |
231 | res += prop_val
232 | res += FuncGodotUtil.newline()
233 |
234 | res += "]" + FuncGodotUtil.newline()
235 |
236 | return res
237 |
238 | func retrieve_all_class_properties(properties: Dictionary[String, Variant] = {}) -> Dictionary[String, Variant]:
239 | for key in class_properties.keys():
240 | properties[key] = class_properties[key]
241 | for b in base_classes:
242 | properties = b.retrieve_all_class_properties(properties)
243 | return properties
244 |
245 | func retrieve_all_class_property_descriptions(descriptions: Dictionary[String, Variant] = {}) -> Dictionary[String, Variant]:
246 | for key in class_property_descriptions.keys():
247 | descriptions[key] = class_property_descriptions[key]
248 | for b in base_classes:
249 | descriptions = b.retrieve_all_class_property_descriptions(descriptions)
250 | return descriptions
251 |
--------------------------------------------------------------------------------
/addons/func_godot/src/core/data.gd:
--------------------------------------------------------------------------------
1 | @icon("res://addons/func_godot/icons/icon_godot_ranger.svg")
2 | class_name FuncGodotData
3 | ## Container that holds various data structs to be used in the [FuncGodotMap] build process.
4 | ##
5 | ## FuncGodot utilizes multiple custom data structs to hold information parsed from the map file
6 | ## and read and modified by the other core build classes.
7 | ## All data structs extend from [RefCounted], therefore all data is passed by reference.
8 | ## [br][br]
9 | ## [FuncGodotData.FaceData][br]
10 | ## [FuncGodotData.BrushData][br]
11 | ## [FuncGodotData.PatchData][br]
12 | ## [FuncGodotData.GroupData][br]
13 | ## [FuncGodotData.EntityData][br]
14 |
15 | ## Data struct representing both a single map plane and a mesh face. Generated during parsing by plane definitions in the map file,
16 | ## it is further modified and utilized during the geo generation stage to create the final entity meshes.
17 | class FaceData extends RefCounted:
18 | ## Vertex array for the face. Only populated in combination with other faces, as a result of planar intersections.
19 | var vertices: PackedVector3Array = []
20 | ## Index array for the face. Used in ArrayMesh creation.
21 | var indices: PackedInt32Array = []
22 | ## Vertex normal array for the face.
23 | ## By default, set to the planar normal, which results in flat shading. May be modified to adjust shading.
24 | var normals: PackedVector3Array = []
25 | ## Tangent data for the face.
26 | var tangents: PackedFloat32Array = []
27 | ## Local path to the texture without the extension, relative to the FuncGodotMap node's settings' base texture directory.
28 | var texture: String
29 | ## UV transform data generated during the parsing stage. Used for both Standard and Valve 220 UV formats,
30 | ## though rotation is not applied to the transform when using Valve 220.
31 | var uv: Transform2D
32 | ## Raw vector data provided by the Valve 220 format during parsing. It is used to calculate rotations.
33 | ## The presence of this data determines how face UVs and tangents are calculated.
34 | var uv_axes: PackedVector3Array = []
35 | ## Raw plane data parsed from the map file using the id Tech coordinate system.
36 | var plane: Plane
37 |
38 | ## Returns the average position of all vertices in the face. Only valid when the face has at least one vertex.
39 | func get_centroid() -> Vector3:
40 | return FuncGodotUtil.op_vec3_avg(vertices)
41 |
42 | ## Returns an arbitrary coplanar direction to use for winding the face.
43 | ## Only valid when the face has at least two vertices.
44 | func get_basis() -> Vector3:
45 | if vertices.size() < 2:
46 | push_error("Cannot get winding basis without at least 2 vertices!")
47 | return Vector3.ZERO
48 | return (vertices[1] - vertices[0]).normalized()
49 |
50 | ## Prepares the face for OpenGL triangle winding order.
51 | ## Sorts the vertex array in-place by angle from the centroid.
52 | func wind() -> void:
53 | var centroid: Vector3 = get_centroid()
54 | var u_axis: Vector3 = get_basis()
55 | var v_axis: Vector3 = u_axis.cross(plane.normal).normalized()
56 | var cmp_winding_angle: Callable = (
57 | func(a: Vector3, b: Vector3) -> bool:
58 | var dir_a: Vector3 = a - centroid
59 | var dir_b: Vector3 = b - centroid
60 | var angle_a: float = atan2(dir_a.dot(v_axis), dir_a.dot(u_axis))
61 | var angle_b: float = atan2(dir_b.dot(v_axis), dir_b.dot(u_axis))
62 | return angle_a < angle_b
63 | )
64 |
65 | var _vertices: Array[Vector3]
66 | _vertices.assign(vertices)
67 | _vertices.sort_custom(cmp_winding_angle)
68 | vertices = _vertices
69 |
70 | ## Repopulate the [member indices] array to create a triangle fan.
71 | ## The face must be properly wound for the resulting indices to be valid.
72 | func index_vertices() -> void:
73 | var tri_count: int = vertices.size() - 2
74 | indices.resize(tri_count * 3)
75 | var index: int = 0
76 | for i in tri_count:
77 | indices[index] = 0
78 | indices[index + 1] = i + 1
79 | indices[index + 2] = i + 2
80 | index += 3
81 |
82 | ## Data struct representing a single map format brush. It is largely meant as a container for [FuncGodotData.FaceData] data.
83 | class BrushData extends RefCounted:
84 | ## Raw plane data parsed from the map file using the id Tech coordinate system.
85 | var planes: Array[Plane]
86 | ## Collection of [FuncGodotData.FaceData].
87 | var faces: Array[FaceData]
88 | ## [code]true[/code] if this brush is completely covered in the [i]Origin[/i] texture defined in [FuncGodotMapSettings].
89 | ## Determined during [FuncGodotParser] and utilized during [FuncGodotGeometryGenerator].
90 | var origin: bool = false
91 |
92 | ## Data struct representing a patch def entity.
93 | class PatchData extends RefCounted:
94 | ## Local path to the texture without the extension, relative to the FuncGodotMap node's settings' base texture directory.
95 | var texture: String
96 | var size: PackedInt32Array
97 | var points: PackedVector3Array
98 | var uvs: PackedVector2Array
99 |
100 | ## Data struct representing a TrenchBroom Group, TrenchBroom Layer, or Valve VisGroup.
101 | ## Generated during the parsing stage and utilized during both parsing and entity assembly stages.
102 | class GroupData extends RefCounted:
103 | enum GroupType { GROUP, LAYER, }
104 | ## Defines whether the group is a Group or a Layer. Currently only determines the name of the group.
105 | var type: GroupType = GroupType.GROUP
106 | ## Group ID retrieved from the map file. Utilized during the parsing and entity assembly stages to determine
107 | ## which entities belong to which groups as well as which groups are children of other groups.
108 | var id: int
109 | ## Generated during the parsing stage using the format of type_id_name, eg: group_2_Arkham.
110 | var name: String
111 | ## ID of the parent group data, used to determine which group data is this group's parent.
112 | var parent_id: int = -1
113 | ## Pointer to another group data that this group is a child of.
114 | var parent: GroupData = null
115 | ## Pointer to generated Node3D representing this group in the SceneTree.
116 | var node: Node3D = null
117 | ## If true, erases all entities assigned to this group and then the group itself at the end of the parsing stage, preventing those entities from being generated into nodes.
118 | ## Can be set in TrenchBroom on layers using the "omit layer" option.
119 | var omit: bool = false
120 |
121 | ## Data struct representing a map format entity.
122 | class EntityData extends RefCounted:
123 | ## All of the entity's key value pairs from the map file, retrieved during parsing.
124 | ## The func_godot_properties dictionary generated at the end of entity assembly is derived from this.
125 | var properties: Dictionary[String, Variant] = {}
126 | ## The entity's brush data collected during the parsing stage. If the entity's FGD resource cannot be found,
127 | ## the presence of a single brush determines this entity to be a Solid Entity.
128 | var brushes: Array[BrushData] = []
129 | ## The entity's patch def data collected during the parsing stage. If the entity's FGD resource cannot be found,
130 | ## the presence of a single patch def determines this entity to be a Solid Entity.
131 | var patches: Array[PatchData] = []
132 | ## Pointer to the group data this entity belongs to.
133 | var group: GroupData = null
134 | ## The entity's FGD resource, determined by matching the classname properties of each.
135 | ## This can only be a [FuncGodotFGDSolidClass], [FuncGodotFGDPointClass], or [FuncGodotFGDModelPointClass].
136 | var definition: FuncGodotFGDEntityClass = null
137 | ## Mesh resource generated during the geometry generation stage and applied during the entity assembly stage.
138 | var mesh: ArrayMesh = null
139 | ## MeshInstance3D node generated during the entity assembly stage.
140 | var mesh_instance: MeshInstance3D = null
141 | ## Optional mesh metadata compiled during the geometry generation stage, used to determine face information from collision.
142 | var mesh_metadata: Dictionary = {}
143 | ## A collection of collision shape resources generated during the geometry generation stage and applied during the entity assembly stage.
144 | var shapes: Array[Shape3D] = []
145 | ## A collection of [CollisionShape3D] nodes generated during the entity assembly stage. Each node corresponds to a shape in the [member shapes] array.
146 | var collision_shapes: Array[CollisionShape3D] = []
147 | ## [OccluderInstance3D] node generated during the entity assembly stage using the [member mesh] resource.
148 | var occluder_instance: OccluderInstance3D = null
149 | ## True global position of the entity's generated node that the mesh's vertices are offset by during the geometry generation stage.
150 | var origin: Vector3 = Vector3.ZERO
151 |
152 | ## Checks the entity's FGD resource definition, returning whether the Solid Class has a [MeshInstance3D] built for it.
153 | func is_visual() -> bool:
154 | return (definition
155 | and definition is FuncGodotFGDSolidClass
156 | and definition.build_visuals)
157 |
158 | func is_gi_enabled() -> bool:
159 | return (definition
160 | and definition is FuncGodotFGDSolidClass
161 | and definition.global_illumination_mode
162 | )
163 |
164 | ## Checks the entity's FGD resource definition, returning whether the Solid Class CollisionShapeType is set to Convex.
165 | func is_collision_convex() -> bool:
166 | return (definition
167 | and definition is FuncGodotFGDSolidClass
168 | and definition.collision_shape_type == FuncGodotFGDSolidClass.CollisionShapeType.CONVEX
169 | )
170 |
171 | ## Checks the entity's FGD resource definition, returning whether the Solid Class CollisionShapeType is set to Concave.
172 | func is_collision_concave() -> bool:
173 | return (definition
174 | and definition is FuncGodotFGDSolidClass
175 | and definition.collision_shape_type == FuncGodotFGDSolidClass.CollisionShapeType.CONCAVE
176 | )
177 |
178 | ## Determines if the entity's mesh should be processed for normal smoothing.
179 | ## The smoothing property can be retrieved from [member FuncGodotMapSettings.entity_smoothing_property].
180 | func is_smooth_shaded(smoothing_property: String = "_phong") -> bool:
181 | return properties.get(smoothing_property, 0)
182 |
183 | ## Retrieves the entity's smoothing angle to determine if the face should be smoothed.
184 | ## The smoothing angle property can be retrieved from [member FuncGodotMapSettings.entity_smoothing_angle_property].
185 | func get_smoothing_angle(smoothing_angle_property: String = "_phong_angle") -> float:
186 | return properties.get(smoothing_angle_property, 89.0)
187 |
188 | class VertexGroupData:
189 | ## Faces this vertex appears in.
190 | var faces: Array[FaceData]
191 | ## Index within the associated face for this vertex.
192 | var face_indices: PackedInt32Array
193 |
194 | class ParseData:
195 | var entities: Array[EntityData] = []
196 | var groups: Array[GroupData] = []
197 |
--------------------------------------------------------------------------------
/addons/func_godot/icons/icon_godambler3d.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
35 |
--------------------------------------------------------------------------------
/addons/func_godot/src/trenchbroom/trenchbroom_game_config.gd:
--------------------------------------------------------------------------------
1 | @tool
2 | @icon("res://addons/func_godot/icons/icon_godot_ranger.svg")
3 | class_name TrenchBroomGameConfig extends Resource
4 | ## Game configuration definition for TrenchBroom.
5 | ##
6 | ## Defines a game for TrenchBroom to express a set of entity definitions and editor behaviors.
7 | ##
8 | ## @tutorial(TrenchBroom Manual Game Configuration Information): https://trenchbroom.github.io/manual/latest/#game_configuration
9 |
10 | enum GameConfigVersion {
11 | Latest,
12 | Version4,
13 | Version8,
14 | Version9
15 | }
16 |
17 | @export_tool_button("Export GameConfig") var _export_file: Callable = export_file
18 |
19 | ## Name of the game in TrenchBroom's game list.
20 | @export var game_name : String = "FuncGodot"
21 |
22 | ## Icon for TrenchBroom's game list.
23 | @export var icon : Texture2D = preload("res://addons/func_godot/icon32.png")
24 |
25 | ## Available map formats when creating a new map in TrenchBroom. The order of elements in the array is the order TrenchBroom will list the available formats.
26 | ## The [i]"initialmap"[/i] key value is optional.
27 | @export var map_formats: Array[Dictionary] = [
28 | { "format": "Valve", "initialmap": "initial_valve.map" },
29 | { "format": "Standard", "initialmap": "initial_standard.map" },
30 | { "format": "Quake2", "initialmap": "initial_quake2.map" },
31 | { "format": "Quake3" }
32 | ]
33 |
34 | @export_group("Textures")
35 |
36 | ## Path to top level textures folder relative to the game path. Also referred to as materials in the latest versions of TrenchBroom.
37 | @export var textures_root_folder: String = "textures"
38 |
39 | ## Textures matching these patterns will be hidden from TrenchBroom.
40 | @export var texture_exclusion_patterns: Array[String] = ["*_albedo", "*_ao", "*_emission", "*_height", "*_metallic", "*_normal", "*_orm", "*_roughness", "*_sss"]
41 |
42 | ## Palette path relative to your Game Path. Only needed for Quake WAD2 files. Half-Life WAD3 files contain the palettes within the texture information.
43 | @export var palette_path: String = "textures/palette.lmp"
44 |
45 | @export_group("Entities")
46 |
47 | ## [FuncGodotFGDFile] resource to include with this game. If using multiple FGD File resources,
48 | ## this should be the master FGD File that contains them in [member FuncGodotFGDFile.base_fgd_files].
49 | @export var fgd_file : FuncGodotFGDFile = preload("res://addons/func_godot/fgd/func_godot_fgd.tres")
50 |
51 | ## Scale expression that modifies the default display scale of entities in TrenchBroom.
52 | ## See [url="https://trenchbroom.github.io/manual/latest/#game_configuration_files_entities"]TrenchBroom Manual Entity Configuration Information[/url] for more information.
53 | @export var entity_scale: String = "32"
54 |
55 | ## Toggles whether [FuncGodotFGDModelPointClass] resources will generate models from their [PackedScene] files.
56 | @export var generate_model_point_class_models: bool = true
57 |
58 | ## Arrays containing the [TrenchbroomTag] resource type.
59 | @export_group("Tags")
60 |
61 | ## [TrenchbroomTag] resources that apply to brush entities.
62 | @export var brush_tags : Array[Resource] = []
63 |
64 | ## [TrenchbroomTag] resources that apply to brush faces.
65 | @export var brushface_tags : Array[Resource] = [
66 | preload("res://addons/func_godot/game_config/trenchbroom/tb_face_tag_clip.tres"),
67 | preload("res://addons/func_godot/game_config/trenchbroom/tb_face_tag_skip.tres"),
68 | preload("res://addons/func_godot/game_config/trenchbroom/tb_face_tag_origin.tres")
69 | ]
70 |
71 | @export_group("Face Attributes")
72 |
73 | ## Default scale of textures on new brushes and when UV scale is reset.
74 | @export var default_uv_scale : Vector2 = Vector2(1, 1)
75 |
76 | @export_group("Compatibility")
77 |
78 | ## Game configuration format compatible with the version of TrenchBroom being used.
79 | @export var game_config_version: GameConfigVersion = GameConfigVersion.Latest
80 |
81 | # Matches tag key enum to the [String] name used in .cfg
82 | static func _get_match_key(tag_match_type: int) -> String:
83 | match tag_match_type:
84 | TrenchBroomTag.TagMatchType.TEXTURE:
85 | return "material"
86 | TrenchBroomTag.TagMatchType.CLASSNAME:
87 | return "classname"
88 | _:
89 | push_error("Tag match type %s is not valid" % [tag_match_type])
90 | return "ERROR"
91 |
92 | # Generates completed text for a .cfg file.
93 | func _build_class_text() -> String:
94 | var map_formats_str : String = ""
95 | for map_format in map_formats:
96 | map_formats_str += "{ \"format\": \"" + map_format.format + "\""
97 | if map_format.has("initialmap"):
98 | map_formats_str += ", \"initialmap\": \"" + map_format.initialmap + "\""
99 | if map_format != map_formats[-1]:
100 | map_formats_str += " },\n\t\t"
101 | else:
102 | map_formats_str += " }"
103 |
104 | var texture_exclusion_patterns_str := ""
105 | for tex_pattern in texture_exclusion_patterns:
106 | texture_exclusion_patterns_str += "\"" + tex_pattern + "\""
107 | if tex_pattern != texture_exclusion_patterns[-1]:
108 | texture_exclusion_patterns_str += ", "
109 |
110 | var fgd_filename_str : String = "\"" + fgd_file.fgd_name + ".fgd\""
111 |
112 | var brush_tags_str = _parse_tags(brush_tags)
113 | var brushface_tags_str = _parse_tags(brushface_tags)
114 | var uv_scale_str = _parse_default_uv_scale(default_uv_scale)
115 |
116 | var config_text : String = ""
117 | match game_config_version:
118 | GameConfigVersion.Latest, GameConfigVersion.Version8, GameConfigVersion.Version9:
119 | config_text = _get_game_config_v9v8_text() % [
120 | game_name,
121 | map_formats_str,
122 | textures_root_folder,
123 | texture_exclusion_patterns_str,
124 | palette_path,
125 | fgd_filename_str,
126 | entity_scale,
127 | brush_tags_str,
128 | brushface_tags_str,
129 | uv_scale_str
130 | ]
131 |
132 | GameConfigVersion.Version4:
133 | config_text = _get_game_config_v4_text() % [
134 | game_name,
135 | map_formats_str,
136 | textures_root_folder,
137 | texture_exclusion_patterns_str,
138 | palette_path,
139 | fgd_filename_str,
140 | entity_scale,
141 | brush_tags_str,
142 | brushface_tags_str,
143 | uv_scale_str
144 | ]
145 |
146 | _:
147 | push_error("Unsupported Game Config Version!")
148 |
149 | return config_text
150 |
151 | # Converts brush, face, and attribute tags into a .cfg-usable String.
152 | func _parse_tags(tags: Array) -> String:
153 | var tags_str := ""
154 | for brush_tag in tags:
155 | if brush_tag.tag_match_type >= TrenchBroomTag.TagMatchType.size():
156 | continue
157 | tags_str += "{\n"
158 | tags_str += "\t\t\t\t\"name\": \"%s\",\n" % brush_tag.tag_name
159 | var attribs_str := ""
160 | for brush_tag_attrib in brush_tag.tag_attributes:
161 | attribs_str += "\"%s\"" % brush_tag_attrib
162 | if brush_tag_attrib != brush_tag.tag_attributes[-1]:
163 | attribs_str += ", "
164 | tags_str += "\t\t\t\t\"attribs\": [ %s ],\n" % attribs_str
165 | tags_str += "\t\t\t\t\"match\": \"%s\",\n" % _get_match_key(brush_tag.tag_match_type)
166 | tags_str += "\t\t\t\t\"pattern\": \"%s\"" % brush_tag.tag_pattern
167 | if brush_tag.texture_name != "":
168 | tags_str += ",\n"
169 | tags_str += "\t\t\t\t\"material\": \"%s\"" % brush_tag.texture_name
170 | tags_str += "\n"
171 | tags_str += "\t\t\t}"
172 | if brush_tag != tags[-1]:
173 | tags_str += ","
174 | if game_config_version > GameConfigVersion.Latest and game_config_version < GameConfigVersion.Version9:
175 | tags_str = tags_str.replace("material", "texture")
176 | return tags_str
177 |
178 | # Converts array of flags to .cfg String.
179 | func _parse_flags(flags: Array) -> String:
180 | var flags_str := ""
181 | for attrib_flag in flags:
182 | flags_str += "{\n"
183 | flags_str += "\t\t\t\t\"name\": \"%s\",\n" % attrib_flag.attrib_name
184 | flags_str += "\t\t\t\t\"description\": \"%s\"\n" % attrib_flag.attrib_description
185 | flags_str += "\t\t\t}"
186 | if attrib_flag != flags[-1]:
187 | flags_str += ","
188 | return flags_str
189 |
190 | # Converts default uv scale vector to .cfg String.
191 | func _parse_default_uv_scale(texture_scale : Vector2) -> String:
192 | var entry_str = "\"scale\": [{x}, {y}]"
193 | return entry_str.format({
194 | "x": texture_scale.x,
195 | "y": texture_scale.y
196 | })
197 |
198 | ## Exports this game's configuration with an icon, .cfg, and all accompanying FGD files in the [FuncGodotLocalConfig] [b]Trenchbroom Game Config Folder[/b].
199 | func export_file() -> void:
200 | var config_folder: String = FuncGodotLocalConfig.get_setting(FuncGodotLocalConfig.PROPERTY.TRENCHBROOM_GAME_CONFIG_FOLDER) as String
201 | if config_folder.is_empty():
202 | printerr("Skipping export: No TrenchBroom Game folder")
203 | return
204 |
205 | # Make sure FGD file is set
206 | if not fgd_file:
207 | printerr("Skipping export: No FGD file")
208 | return
209 |
210 | var config_dir := DirAccess.open(config_folder)
211 | # Create config folder in case it does not exist
212 | if config_dir == null:
213 | print("Couldn't open directory, creating...")
214 | var err := DirAccess.make_dir_recursive_absolute(config_folder)
215 | if err != OK:
216 | printerr("Skipping export: Failed to create directory")
217 | return
218 |
219 | # Icon
220 | var icon_path : String = config_folder + "/icon.png"
221 | print("Exporting icon to ", icon_path)
222 | var export_icon : Image = icon.get_image()
223 | export_icon.resize(32, 32, Image.INTERPOLATE_LANCZOS)
224 | export_icon.save_png(icon_path)
225 |
226 | # .cfg
227 | var target_file_path: String = config_folder + "/GameConfig.cfg"
228 | print("Exporting TrenchBroom Game Config to ", target_file_path)
229 | var file = FileAccess.open(target_file_path, FileAccess.WRITE)
230 | file.store_string(_build_class_text())
231 | file.close()
232 |
233 | # FGD
234 | var export_fgd : FuncGodotFGDFile = fgd_file.duplicate()
235 | export_fgd.generate_model_point_class_models = generate_model_point_class_models
236 | export_fgd.do_export_file(FuncGodotFGDFile.FuncGodotTargetMapEditors.TRENCHBROOM, config_folder)
237 | print("TrenchBroom Game Config export complete\n")
238 |
239 | #region GameConfigDeclarations
240 | func _get_game_config_v4_text() -> String:
241 | return """\
242 | {
243 | "version": 4,
244 | "name": "%s",
245 | "icon": "icon.png",
246 | "fileformats": [
247 | %s
248 | ],
249 | "filesystem": {
250 | "searchpath": ".",
251 | "packageformat": { "extension": ".zip", "format": "zip" }
252 | },
253 | "textures": {
254 | "package": { "type": "directory", "root": "%s" },
255 | "format": { "extensions": ["jpg", "jpeg", "tga", "png", "D", "C"], "format": "image" },
256 | "excludes": [ %s ],
257 | "palette": "%s",
258 | "attribute": ["_tb_textures", "wad"]
259 | },
260 | "entities": {
261 | "definitions": [ %s ],
262 | "defaultcolor": "0.6 0.6 0.6 1.0",
263 | "modelformats": [ "bsp, mdl, md2" ],
264 | "scale": %s
265 | },
266 | "tags": {
267 | "brush": [
268 | %s
269 | ],
270 | "brushface": [
271 | %s
272 | ]
273 | },
274 | "faceattribs": {
275 | "defaults": {
276 | %s
277 | },
278 | "contentflags": [],
279 | "surfaceflags": []
280 | }
281 | }
282 | """
283 |
284 | func _get_game_config_v9v8_text() -> String:
285 | var config_text: String = """\
286 | {
287 | "version": 9,
288 | "name": "%s",
289 | "icon": "icon.png",
290 | "fileformats": [
291 | %s
292 | ],
293 | "filesystem": {
294 | "searchpath": ".",
295 | "packageformat": { "extension": ".zip", "format": "zip" }
296 | },
297 | "materials": {
298 | "root": "%s",
299 | "extensions": [".bmp", ".exr", ".hdr", ".jpeg", ".jpg", ".png", ".tga", ".webp", ".D", ".C"],
300 | "excludes": [ %s ],
301 | "palette": "%s",
302 | "attribute": "wad"
303 | },
304 | "entities": {
305 | "definitions": [ %s ],
306 | "defaultcolor": "0.6 0.6 0.6 1.0",
307 | "scale": %s
308 | },
309 | "tags": {
310 | "brush": [
311 | %s
312 | ],
313 | "brushface": [
314 | %s
315 | ]
316 | },
317 | "faceattribs": {
318 | "defaults": {
319 | %s
320 | },
321 | "contentflags": [],
322 | "surfaceflags": []
323 | }
324 | }
325 | """
326 |
327 | if game_config_version == GameConfigVersion.Version8:
328 | config_text = config_text.replace(": 9,", ": 8,")
329 | config_text = config_text.replace("material", "texture")
330 |
331 | return config_text
332 |
333 | #endregion
334 |
--------------------------------------------------------------------------------
/addons/func_godot/src/netradiant_custom/netradiant_custom_gamepack_config.gd:
--------------------------------------------------------------------------------
1 | @tool
2 | @icon("res://addons/func_godot/icons/icon_godot_ranger.svg")
3 | class_name NetRadiantCustomGamePackConfig extends Resource
4 | ## Builds a gamepack for NetRadiant Custom.
5 | ##
6 | ## Resource that builds a gamepack configuration for NetRadiant Custom.
7 |
8 | enum NetRadiantCustomMapType {
9 | QUAKE_1, ## Removes PatchDef entries from the map file.
10 | QUAKE_3 ## Allows the saving of PatchDef entries in the map file.
11 | }
12 |
13 | @export_tool_button("Export Gamepack") var _export_file: Callable = export_file
14 |
15 | ## Gamepack folder and file name. Must be lower case and must not contain special characters.
16 | @export var gamepack_name : String = "func_godot":
17 | set(new_name):
18 | gamepack_name = new_name.to_lower()
19 |
20 | ## Name of the game in NetRadiant Custom's gamepack list.
21 | @export var game_name : String = "FuncGodot"
22 |
23 | ## Directory path containing your maps, textures, shaders, etc... relative to your project directory.
24 | @export var base_game_path : String = ""
25 |
26 | ## [FuncGodotFGDFile] to include with this gamepack. If using multiple FGD file resources,
27 | ## this should be the master FGD that contains them in [member FuncGodotFGDFile.base_fgd_files].
28 | @export var fgd_file : FuncGodotFGDFile = preload("res://addons/func_godot/fgd/func_godot_fgd.tres")
29 |
30 | ## Toggles whether [FuncGodotFGDModelPointClass] resources will generate models from their [PackedScene] files.
31 | @export var generate_model_point_class_models: bool = true
32 |
33 | ## Collection of [NetRadiantCustomShader] resources for shader file generation.
34 | @export var netradiant_custom_shaders : Array[Resource] = [
35 | preload("res://addons/func_godot/game_config/netradiant_custom/netradiant_custom_shader_clip.tres"),
36 | preload("res://addons/func_godot/game_config/netradiant_custom/netradiant_custom_shader_skip.tres"),
37 | preload("res://addons/func_godot/game_config/netradiant_custom/netradiant_custom_shader_origin.tres")
38 | ]
39 |
40 | ## Supported model file types.
41 | @export var model_types : PackedStringArray = ["glb", "gltf", "obj"]
42 |
43 | ## Supported audio file types.
44 | @export var sound_types : PackedStringArray = ["wav", "ogg"]
45 |
46 | ## Quake map type NetRadiant will filter the map for, determining whether PatchDef entries are saved.
47 | ## [color=red][b]WARNING![/b][/color] Toggling this option may be destructive!
48 | @export var map_type: NetRadiantCustomMapType = NetRadiantCustomMapType.QUAKE_3
49 |
50 | @export_group("Textures")
51 | ## Supported texture file types.
52 | @export var texture_types : PackedStringArray = ["png", "jpg", "jpeg", "bmp", "tga"]
53 |
54 | ## Default scale of textures in NetRadiant Custom.
55 | @export var default_scale : String = "1.0"
56 |
57 | ## Clip texture path that gets applied to [i]weapclip[/i] and [i]nodraw[/i] shaders.
58 | @export var clip_texture: String = "textures/clip"
59 |
60 | ## Skip texture path that gets applied to [i]caulk[/i] and [i]nodrawnonsolid[/i] shaders.
61 | @export var skip_texture: String = "textures/skip"
62 |
63 | @export_group("Build Menu")
64 | ## Variables to include in the exported gamepack's [code]default_build_menu.xml[/code].[br][br]
65 | ## Each [String] key defines a variable name, and its corresponding [String] value as the literal command-line string
66 | ## to execute in place of this variable identifier[br][br]
67 | ## Entries may be referred to by key in [member default_build_menu_commands] values.
68 | @export var default_build_menu_variables: Dictionary
69 |
70 | ## Commands to include in the exported gamepack's [code]default_build_menu.xml[/code].[br][br]
71 | ## Keys, specified as a [String], define the build option name as you want it to appear in NetRadiant Custom.[br][br]
72 | ## Values represent commands taken within each option.[br][br]They may be either a [String] or an [Array] of [String] elements
73 | ## that will be used as the full command-line text issued by each command [i]within[/i] its associated build option key.[br][br]
74 | ## They may reference entries in [member default_build_menu_variables] by using brackets: [code][variable key name][/code]
75 | @export var default_build_menu_commands: Dictionary
76 |
77 | # Generates completed text for a .shader file.
78 | func _build_shader_text() -> String:
79 | var shader_text: String = ""
80 | for shader_res in netradiant_custom_shaders:
81 | shader_text += (shader_res as NetRadiantCustomShader).texture_path + "\n{\n"
82 | for shader_attrib in (shader_res as NetRadiantCustomShader).shader_attributes:
83 | shader_text += "\t" + shader_attrib + "\n"
84 | shader_text += "}\n"
85 | return shader_text
86 |
87 | # Generates completed text for a .gamepack file.
88 | func _build_gamepack_text() -> String:
89 | var texturetypes_str: String = ""
90 | for texture_type in texture_types:
91 | texturetypes_str += texture_type
92 | if texture_type != texture_types[-1]:
93 | texturetypes_str += " "
94 |
95 | var modeltypes_str: String = ""
96 | for model_type in model_types:
97 | modeltypes_str += model_type
98 | if model_type != model_types[-1]:
99 | modeltypes_str += " "
100 |
101 | var soundtypes_str: String = ""
102 | for sound_type in sound_types:
103 | soundtypes_str += sound_type
104 | if sound_type != sound_types[-1]:
105 | soundtypes_str += " "
106 |
107 | var maptype_str: String
108 |
109 | if map_type == NetRadiantCustomMapType.QUAKE_3:
110 | maptype_str = "mapq3"
111 | else:
112 | maptype_str = "mapq1"
113 |
114 | var gamepack_text: String = """
115 |
147 | """
148 |
149 | return gamepack_text % [
150 | game_name,
151 | game_name,
152 | gamepack_name,
153 | game_name,
154 | gamepack_name,
155 | base_game_path,
156 | game_name,
157 | game_name,
158 | texturetypes_str,
159 | modeltypes_str,
160 | soundtypes_str,
161 | maptype_str,
162 | default_scale,
163 | clip_texture,
164 | skip_texture,
165 | clip_texture,
166 | skip_texture
167 | ]
168 |
169 | ## Exports this game's configuration with an icon, .cfg, and all accompanying FGD files in the [FuncGodotLocalConfig] [b]NetRadiant Custom Gamepacks Folder[/b].
170 | func export_file() -> void:
171 | var game_path: String = FuncGodotLocalConfig.get_setting(FuncGodotLocalConfig.PROPERTY.MAP_EDITOR_GAME_PATH) as String
172 | if game_path.is_empty():
173 | printerr("Skipping export: Map Editor Game Path not set in Project Configuration")
174 | return
175 |
176 | var gamepacks_folder: String = FuncGodotLocalConfig.get_setting(FuncGodotLocalConfig.PROPERTY.NETRADIANT_CUSTOM_GAMEPACKS_FOLDER) as String
177 | if gamepacks_folder.is_empty():
178 | printerr("Skipping export: No NetRadiant Custom gamepacks folder")
179 | return
180 |
181 | # Make sure FGD file is set
182 | if !fgd_file:
183 | printerr("Skipping export: No FGD file")
184 | return
185 |
186 | # Make sure we're actually in the NetRadiant Custom gamepacks folder
187 | if DirAccess.open(gamepacks_folder + "/games") == null:
188 | printerr("Skipping export: No \'games\' folder. Is this the NetRadiant Custom gamepacks folder?")
189 | return
190 |
191 | # Create gamepack folders in case they do not exist
192 | var gamepack_dir_paths: Array = [
193 | gamepacks_folder + "/" + gamepack_name + ".game",
194 | gamepacks_folder + "/" + gamepack_name + ".game/" + base_game_path,
195 | gamepacks_folder + "/" + gamepack_name + ".game/scripts",
196 | game_path + "/scripts"
197 | ]
198 | var err: Error
199 |
200 | for path in gamepack_dir_paths:
201 | if DirAccess.open(path) == null:
202 | print("Couldn't open " + path + ", creating...")
203 | err = DirAccess.make_dir_recursive_absolute(path)
204 | if err != OK:
205 | printerr("Skipping export: Failed to create directory")
206 | return
207 |
208 | var target_file_path: String
209 | var file: FileAccess
210 |
211 | # .gamepack
212 | target_file_path = gamepacks_folder + "/games/" + gamepack_name + ".game"
213 | print("Exporting NetRadiant Custom Gamepack to ", target_file_path)
214 | file = FileAccess.open(target_file_path, FileAccess.WRITE)
215 | if file != null:
216 | file.store_string(_build_gamepack_text())
217 | file.close()
218 | else:
219 | printerr("Error: Could not modify " + target_file_path)
220 |
221 | # .shader
222 | # NOTE: To work properly, this should go in the game path. For now, I'm leaving the export to NRC as well, so it can easily
223 | # be repackaged for distribution. However, I believe in the end, it shouldn't exist there.
224 | # We'll need to make a decision for this. - Vera
225 | var shader_text: String = _build_shader_text()
226 |
227 | # build to /scripts/
228 | target_file_path = gamepacks_folder + "/" + gamepack_name + ".game/scripts/" + gamepack_name + ".shader"
229 | print("Exporting NetRadiant Custom shader definitions to ", target_file_path)
230 | file = FileAccess.open(target_file_path, FileAccess.WRITE)
231 | if file != null:
232 | file.store_string(shader_text)
233 | file.close()
234 | else:
235 | printerr("Error: Could not modify " + target_file_path)
236 |
237 | # build to /scripts/
238 | target_file_path = game_path.path_join("scripts/%s.shader" % gamepack_name)
239 | print("Exporting NetRadiant Custom shader definitions to ", target_file_path)
240 | file = FileAccess.open(target_file_path, FileAccess.WRITE)
241 | if file != null:
242 | file.store_string(shader_text)
243 | file.close()
244 | else:
245 | printerr("Error: could not modify " + target_file_path)
246 |
247 | # shaderlist.txt - see above NOTE regarding duplication
248 | target_file_path = gamepacks_folder + "/" + gamepack_name + ".game/scripts/shaderlist.txt"
249 | print("Exporting NetRadiant Custom shader list to ", target_file_path)
250 | file = FileAccess.open(target_file_path, FileAccess.WRITE)
251 | if file != null:
252 | file.store_string(gamepack_name)
253 | file.close()
254 | else:
255 | printerr("Error: Could not modify " + target_file_path)
256 |
257 | # game path/scripts/shaderlist.txt
258 | target_file_path = game_path.path_join("scripts/shaderlist.txt")
259 | print("Exporting NetRadiant Custom shader list to ", target_file_path)
260 | file = FileAccess.open(target_file_path, FileAccess.WRITE)
261 | if file != null:
262 | file.store_string(gamepack_name)
263 | file.close()
264 | else:
265 | printerr("Error: Could not modify " + target_file_path)
266 |
267 | # default_build_menu.xml
268 | target_file_path = gamepacks_folder + "/" + gamepack_name + ".game/default_build_menu.xml"
269 | print("Exporting NetRadiant Custom default build menu to ", target_file_path)
270 | file = FileAccess.open(target_file_path, FileAccess.WRITE)
271 |
272 | if file != null:
273 | file.store_string("\n\n")
274 |
275 | for key in default_build_menu_variables.keys():
276 | if key is String:
277 | if default_build_menu_variables[key] is String:
278 | file.store_string('\t%s\n' % [key, default_build_menu_variables[key]])
279 |
280 | else:
281 | push_error(
282 | "Variable key '%s' value '%s' is invalid type: %s; should be: String" % [
283 | key, default_build_menu_variables[key],
284 | type_string(typeof(default_build_menu_variables[key]))
285 | ])
286 | else:
287 | push_error(
288 | "Variable '%s' is an invalid key type: %s; should be: String" % [
289 | key, type_string(typeof(key))
290 | ])
291 |
292 |
293 | for key in default_build_menu_commands.keys():
294 | if key is String:
295 | file.store_string('\t\n' % key)
296 |
297 | if default_build_menu_commands[key] is String:
298 | file.store_string('\t\t%s\n\t\n' % default_build_menu_commands[key])
299 |
300 | elif default_build_menu_commands[key] is Array:
301 | for command in default_build_menu_commands[key]:
302 | if command is String:
303 | file.store_string('\t\t%s\n' % command)
304 | else:
305 | push_error("Build option '%s' has invalid command: %s with type: %s; should be: String" % [
306 | key, command, type_string(typeof(command))
307 | ])
308 |
309 | file.store_string('\t\n')
310 |
311 | else:
312 | push_error("Build option '%s' is an invalid type: %s; should be: String" % [
313 | key, type_string(typeof(key))
314 | ])
315 |
316 | file.store_string("")
317 |
318 | # FGD
319 | var export_fgd : FuncGodotFGDFile = fgd_file.duplicate()
320 | export_fgd.generate_model_point_class_models = generate_model_point_class_models
321 | export_fgd.do_export_file(FuncGodotFGDFile.FuncGodotTargetMapEditors.NET_RADIANT_CUSTOM, gamepacks_folder + "/" + gamepack_name + ".game/" + base_game_path)
322 | print("NetRadiant Custom Gamepack export complete\n")
323 |
--------------------------------------------------------------------------------