Skip to content

migrate project to godot 4.4 with godotvmf 2.0 #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions addons/godot-jolt/godot-jolt.gdextension
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[configuration]

entry_symbol = "godot_jolt_main"
compatibility_minimum = "4.3"
compatibility_maximum = "4.3"
compatibility_minimum = "4.4"
compatibility_maximum = "4.4"

[libraries]

Expand Down
1 change: 1 addition & 0 deletions addons/godot-jolt/godot-jolt.gdextension.uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://nbrxufm2gcbd
Binary file not shown.
285 changes: 0 additions & 285 deletions addons/godotvmf/3rdparty/objParse.gd

This file was deleted.

1 change: 0 additions & 1 deletion addons/godotvmf/entities/func_instance.gd
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@ func assign_instance(instance_scene):
if child.name.begins_with(node.name):
i += 1;
node.name = "%s_%s" % [node.name, i]
node.ignore_global_import = true;
add_child(node);
node.set_owner(get_owner());
1 change: 1 addition & 0 deletions addons/godotvmf/entities/func_instance.gd.uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://drdnst3jcffrb
49 changes: 49 additions & 0 deletions addons/godotvmf/entities/prop_static.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
@tool
extends ValveIONode

static var cached_models = {};
static var last_cache_changed = 0;

func _apply_entity(e):
super._apply_entity(e);
cached_models = cached_models if cached_models else {};

if last_cache_changed == null:
last_cache_changed = 0;

var cache_key = e.get('model');
var model_path = (VMFConfig.models.target_folder + "/" + e.get('model')).replace("\\", "/").replace("//", "/").replace("res:/", "res://");

if Time.get_ticks_msec() - last_cache_changed > 10000:
cached_models = {};

if cache_key not in cached_models:
if not ResourceLoader.exists(model_path):
push_warning("[prop_static]: Model not found: {0}".format([model_path]));
queue_free();
return

cached_models[cache_key] = ResourceLoader.load(model_path);
last_cache_changed = Time.get_ticks_msec();

var model: MeshInstance3D = cached_models[cache_key].instantiate();

add_child(model);
model.set_owner(get_owner());
model.scale *= e.get('modelscale', 1.0);
model.reparent(get_vmfnode().geometry);
model.name = e.get('model', 'prop_static').get_file().get_basename() + str(model.get_instance_id());

var fade_min = entity.get('fademindist', 0.0) * VMFConfig.import.scale;
var fade_max = entity.get('fademaxdist', 0.0) * VMFConfig.import.scale;
var fade_margin = fade_max - fade_min;

model.visibility_range_end = max(0.0, fade_max);
model.visibility_range_fade_mode = GeometryInstance3D.VISIBILITY_RANGE_FADE_SELF \
if e.get('screenspacefade', 0) == 1 \
else GeometryInstance3D.VISIBILITY_RANGE_FADE_DISABLED;

if model.visibility_range_fade_mode != GeometryInstance3D.VISIBILITY_RANGE_FADE_DISABLED:
model.visibility_range_end_margin = fade_margin;

queue_free();
1 change: 1 addition & 0 deletions addons/godotvmf/entities/prop_static.gd.uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://dcdky71vc854j
6 changes: 6 additions & 0 deletions addons/godotvmf/entities/prop_static.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://cb0240swycsj5"]

[ext_resource type="Script" path="res://addons/godotvmf/entities/prop_static.gd" id="1_xdb2b"]

[node name="PropStatic" type="Node3D"]
script = ExtResource("1_xdb2b")
Loading