Skip to content

Commit 46e6285

Browse files
committed
Patch/v2.2.7 (#77)
* VMFNode: Remove editor_interface * Bump 2.2.7
1 parent 02871e2 commit 46e6285

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

addons/godotvmf/plugin.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
name="GodotVMF"
44
description="Allows use VMF files in Godot"
55
author="H2xDev"
6-
version="2.2.6"
6+
version="2.2.7"
77
script="godotvmf.gd"

addons/godotvmf/src/vmf_node.gd

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ var _owner:
5656

5757
return o;
5858

59-
var editor_interface:
60-
get: return Engine.get_singleton("EditorInterface");
61-
6259
var geometry: Node3D:
6360
get:
6461
var node = get_node_or_null("Geometry");

addons/godotvmf/src/vmf_resource_manager.gd

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,16 @@ const MATERIAL_KEYS_TO_IMPORT = [
1111

1212
static var has_imported_resources: bool = false;
1313

14-
static func for_resource_import() -> void:
15-
var editor_interface = Engine.get_singleton("EditorInterface") if Engine.is_editor_hint() else null;
16-
if not editor_interface: return;
14+
static func get_editor_interface():
15+
return Engine.get_singleton("EditorInterface") if Engine.has_singleton("EditorInterface") else null;
1716

18-
var fs = editor_interface.get_resource_filesystem() if Engine.is_editor_hint() else null;
17+
static func for_resource_import() -> void:
1918
if not has_imported_resources: return;
2019

20+
var editor_interface = get_editor_interface();
21+
if not editor_interface: return;
22+
23+
var fs = editor_interface.get_resource_filesystem();
2124
if not fs: return;
2225

2326
fs.scan();
@@ -84,7 +87,7 @@ static func import_material(material: String) -> bool:
8487
return true;
8588

8689
static func import_materials(vmf_structure: VMFStructure, is_runtime := false) -> void:
87-
var editor_interface = Engine.get_singleton("EditorInterface") if Engine.is_editor_hint() else null;
90+
var editor_interface = get_editor_interface();
8891

8992
if VMFConfig.materials.import_mode == VMFConfig.MaterialsConfig.ImportMode.USE_EXISTING:
9093
return;
@@ -114,8 +117,6 @@ static func import_materials(vmf_structure: VMFStructure, is_runtime := false) -
114117
list.append(side.material);
115118

116119
if not is_runtime and editor_interface:
117-
var fs = editor_interface.get_resource_filesystem() if Engine.is_editor_hint() else null;
118-
119120
for material in list:
120121
import_textures(material);
121122

0 commit comments

Comments
 (0)