add loading and rename variable

This commit is contained in:
deed 2023-10-23 17:21:27 +02:00
parent 7902e1142e
commit 4512598914
58 changed files with 605 additions and 443 deletions

View file

@ -1,3 +1,3 @@
source_md5="d28fc1b4998adc3f0ef9aeebc3099059" source_md5="d28fc1b4998adc3f0ef9aeebc3099059"
dest_md5="ee6dcff528236ee9523efa19cf2df754" dest_md5="6575ae1037fcd6fd2359792c7c738d6a"

View file

@ -1,3 +1,3 @@
source_md5="ea939ff0601f7357bcf91f6ad0a168f7" source_md5="ea939ff0601f7357bcf91f6ad0a168f7"
dest_md5="5c059432a88243d67a6c108ebc279efc" dest_md5="907b0de78ca41c1e330cc7de9b32b52e"

View file

@ -1,3 +1,37 @@
[gd_resource type="ShaderMaterial" format=3 uid="uid://c4mot1fo3siox"] [gd_resource type="ShaderMaterial" load_steps=7 format=3 uid="uid://c4mot1fo3siox"]
[ext_resource type="Shader" path="res://addons/proton_scatter/demos/assets/materials/grass.gdshader" id="1_fntgl"]
[ext_resource type="Texture2D" uid="uid://d23p13yi7asw0" path="res://addons/proton_scatter/demos/assets/textures/t_grass_2.png" id="2_1odx0"]
[sub_resource type="Gradient" id="Gradient_122hb"]
offsets = PackedFloat32Array(0, 0.473451, 1)
colors = PackedColorArray(0.179688, 0.0855483, 0.00322032, 1, 0.251693, 0.390625, 0.0117187, 1, 1, 0.964706, 0.129412, 1)
[sub_resource type="GradientTexture1D" id="GradientTexture1D_i0bw2"]
gradient = SubResource("Gradient_122hb")
[sub_resource type="FastNoiseLite" id="FastNoiseLite_eeqpx"]
seed = 1
frequency = 0.002
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_7l0n1"]
in_3d_space = true
seamless = true
seamless_blend_skirt = 0.65
noise = SubResource("FastNoiseLite_eeqpx")
[resource] [resource]
render_priority = 0
shader = ExtResource("1_fntgl")
shader_parameter/alpha_scissor_threshold = 0.3
shader_parameter/transmission = Color(0.737255, 0.72549, 0, 1)
shader_parameter/secondary_color = Color(0, 0, 0, 1)
shader_parameter/secondary_attenuation = 0.2
shader_parameter/grass_height = 0.6
shader_parameter/wind_direction = Vector2(1, -0.5)
shader_parameter/wind_speed = 0.5
shader_parameter/wind_strength = 0.15
shader_parameter/noise_scale = 6.0
shader_parameter/texture_albedo = ExtResource("2_1odx0")
shader_parameter/texture_gradient = SubResource("GradientTexture1D_i0bw2")
shader_parameter/texture_noise = SubResource("NoiseTexture2D_7l0n1")

View file

@ -26,7 +26,5 @@ skins/use_named_skins=true
animation/import=true animation/import=true
animation/fps=30 animation/fps=30
animation/trimming=false animation/trimming=false
animation/remove_immutable_tracks=true
import_script/path="" import_script/path=""
_subresources={} _subresources={}
gltf/embedded_image_handling=1

View file

@ -26,7 +26,5 @@ skins/use_named_skins=true
animation/import=true animation/import=true
animation/fps=30 animation/fps=30
animation/trimming=false animation/trimming=false
animation/remove_immutable_tracks=true
import_script/path="" import_script/path=""
_subresources={} _subresources={}
gltf/embedded_image_handling=1

View file

@ -26,7 +26,5 @@ skins/use_named_skins=true
animation/import=true animation/import=true
animation/fps=30 animation/fps=30
animation/trimming=false animation/trimming=false
animation/remove_immutable_tracks=true
import_script/path="" import_script/path=""
_subresources={} _subresources={}
gltf/embedded_image_handling=1

View file

@ -26,7 +26,5 @@ skins/use_named_skins=true
animation/import=true animation/import=true
animation/fps=30 animation/fps=30
animation/trimming=false animation/trimming=false
animation/remove_immutable_tracks=true
import_script/path="" import_script/path=""
_subresources={} _subresources={}
gltf/embedded_image_handling=1

View file

@ -26,7 +26,5 @@ skins/use_named_skins=true
animation/import=true animation/import=true
animation/fps=30 animation/fps=30
animation/trimming=false animation/trimming=false
animation/remove_immutable_tracks=true
import_script/path="" import_script/path=""
_subresources={} _subresources={}
gltf/embedded_image_handling=1

View file

@ -26,7 +26,5 @@ skins/use_named_skins=true
animation/import=true animation/import=true
animation/fps=30 animation/fps=30
animation/trimming=false animation/trimming=false
animation/remove_immutable_tracks=true
import_script/path="" import_script/path=""
_subresources={} _subresources={}
gltf/embedded_image_handling=1

View file

@ -26,7 +26,5 @@ skins/use_named_skins=true
animation/import=true animation/import=true
animation/fps=30 animation/fps=30
animation/trimming=false animation/trimming=false
animation/remove_immutable_tracks=true
import_script/path="" import_script/path=""
_subresources={} _subresources={}
gltf/embedded_image_handling=1

View file

@ -26,7 +26,5 @@ skins/use_named_skins=true
animation/import=true animation/import=true
animation/fps=30 animation/fps=30
animation/trimming=false animation/trimming=false
animation/remove_immutable_tracks=true
import_script/path="" import_script/path=""
_subresources={} _subresources={}
gltf/embedded_image_handling=1

View file

@ -26,7 +26,5 @@ skins/use_named_skins=true
animation/import=true animation/import=true
animation/fps=30 animation/fps=30
animation/trimming=false animation/trimming=false
animation/remove_immutable_tracks=true
import_script/path="" import_script/path=""
_subresources={} _subresources={}
gltf/embedded_image_handling=1

View file

@ -26,7 +26,5 @@ skins/use_named_skins=true
animation/import=true animation/import=true
animation/fps=30 animation/fps=30
animation/trimming=false animation/trimming=false
animation/remove_immutable_tracks=true
import_script/path="" import_script/path=""
_subresources={} _subresources={}
gltf/embedded_image_handling=1

View file

@ -26,7 +26,5 @@ skins/use_named_skins=true
animation/import=true animation/import=true
animation/fps=30 animation/fps=30
animation/trimming=false animation/trimming=false
animation/remove_immutable_tracks=true
import_script/path="" import_script/path=""
_subresources={} _subresources={}
gltf/embedded_image_handling=1

View file

@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/t_grass.png-2144df75763a0a189eba3035fc0b94aa.
[params] [params]
compress/mode=0 compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7 compress/lossy_quality=0.7
compress/hdr_compression=1 compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0 compress/normal_map=0
compress/channel_pack=0 compress/channel_pack=0
mipmaps/generate=false mipmaps/generate=false

View file

@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/add.svg-c8c46053442728f2bca87eb859e046e7.ctex
[params] [params]
compress/mode=0 compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7 compress/lossy_quality=0.7
compress/hdr_compression=1 compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0 compress/normal_map=0
compress/channel_pack=0 compress/channel_pack=0
mipmaps/generate=false mipmaps/generate=false

View file

@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/arrow_down.svg-94d8c386a02d5ab5968e7f312ec473
[params] [params]
compress/mode=0 compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7 compress/lossy_quality=0.7
compress/hdr_compression=1 compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0 compress/normal_map=0
compress/channel_pack=0 compress/channel_pack=0
mipmaps/generate=false mipmaps/generate=false

View file

@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/arrow_exp.svg-fd5b1563541a12b14d65e57fc0f3659
[params] [params]
compress/mode=0 compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7 compress/lossy_quality=0.7
compress/hdr_compression=1 compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0 compress/normal_map=0
compress/channel_pack=0 compress/channel_pack=0
mipmaps/generate=false mipmaps/generate=false

View file

@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/arrow_linear.svg-70f906a141e572f767722ba1a068
[params] [params]
compress/mode=0 compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7 compress/lossy_quality=0.7
compress/hdr_compression=1 compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0 compress/normal_map=0
compress/channel_pack=0 compress/channel_pack=0
mipmaps/generate=false mipmaps/generate=false

View file

@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/arrow_log.svg-96f79bb83be8195a3bfdf4d6bc1ab50
[params] [params]
compress/mode=0 compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7 compress/lossy_quality=0.7
compress/hdr_compression=1 compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0 compress/normal_map=0
compress/channel_pack=0 compress/channel_pack=0
mipmaps/generate=false mipmaps/generate=false

View file

@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/arrow_right.svg-6771a48f7c1fe79d13059447d2bf9
[params] [params]
compress/mode=0 compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7 compress/lossy_quality=0.7
compress/hdr_compression=1 compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0 compress/normal_map=0
compress/channel_pack=0 compress/channel_pack=0
mipmaps/generate=false mipmaps/generate=false

View file

@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/checker.png-9f555d2536e1ecfbf8f3b94004e5deef.
[params] [params]
compress/mode=0 compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7 compress/lossy_quality=0.7
compress/hdr_compression=1 compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0 compress/normal_map=0
compress/channel_pack=0 compress/channel_pack=0
mipmaps/generate=false mipmaps/generate=false

View file

@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/bars.png-61d34dbd5bccdfb29fbe178f6a4791cb.cte
[params] [params]
compress/mode=0 compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7 compress/lossy_quality=0.7
compress/hdr_compression=1 compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0 compress/normal_map=0
compress/channel_pack=0 compress/channel_pack=0
mipmaps/generate=false mipmaps/generate=false

View file

@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/blinds.png-3f857c707ea5be395a4531d6d60eac1e.c
[params] [params]
compress/mode=0 compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7 compress/lossy_quality=0.7
compress/hdr_compression=1 compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0 compress/normal_map=0
compress/channel_pack=0 compress/channel_pack=0
mipmaps/generate=false mipmaps/generate=false

View file

@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/checker.png-ec978f1465e3b09756cb5cb959e11209.
[params] [params]
compress/mode=0 compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7 compress/lossy_quality=0.7
compress/hdr_compression=1 compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0 compress/normal_map=0
compress/channel_pack=0 compress/channel_pack=0
mipmaps/generate=false mipmaps/generate=false

View file

@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/wave.png-d387544eba14013e763fdb82094dc9c6.cte
[params] [params]
compress/mode=0 compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7 compress/lossy_quality=0.7
compress/hdr_compression=1 compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0 compress/normal_map=0
compress/channel_pack=0 compress/channel_pack=0
mipmaps/generate=false mipmaps/generate=false

View file

@ -0,0 +1,65 @@
[gd_scene load_steps=14 format=3 uid="uid://2e6nvcbuqhao"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/scatter.gd" id="1_hwvsa"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/stack/modifier_stack.gd" id="2_84xri"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/modifiers/create_inside_grid.gd" id="3_t5gts"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/modifiers/randomize_transforms.gd" id="4_v7woi"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/modifiers/project_on_geometry.gd" id="5_tgf12"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/scatter_item.gd" id="6_11eqr"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/scatter_shape.gd" id="7_vk3gk"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/shapes/sphere_shape.gd" id="9_w0igc"]
[sub_resource type="Resource" id="Resource_mu1a8"]
script = ExtResource("3_t5gts")
spacing = Vector3(0.2, 1, 0.2)
enabled = true
override_global_seed = false
custom_seed = 0
restrict_height = true
reference_frame = 0
[sub_resource type="Resource" id="Resource_8361b"]
script = ExtResource("4_v7woi")
position = Vector3(0, 0, 0)
rotation = Vector3(20, 360, 20)
scale = Vector3(4, 2, 4)
enabled = true
override_global_seed = false
custom_seed = 0
restrict_height = false
reference_frame = 2
[sub_resource type="Resource" id="Resource_14cyx"]
script = ExtResource("5_tgf12")
ray_direction = Vector3(0, -1, 0)
ray_length = 10.0
ray_offset = 10.0
remove_points_on_miss = false
align_with_collision_normal = false
max_slope = 90.0
collision_mask = 1
enabled = true
override_global_seed = false
custom_seed = 0
restrict_height = false
reference_frame = 0
[sub_resource type="Resource" id="Resource_mv17r"]
script = ExtResource("2_84xri")
stack = Array[Resource]([SubResource("Resource_mu1a8"), SubResource("Resource_8361b"), SubResource("Resource_14cyx")])
[sub_resource type="Resource" id="Resource_gaw40"]
script = ExtResource("9_w0igc")
radius = 5.0
[node name="ProtonScatter" type="Node3D"]
script = ExtResource("1_hwvsa")
modifier_stack = SubResource("Resource_mv17r")
[node name="Grass" type="Node3D" parent="."]
script = ExtResource("6_11eqr")
path = "res://addons/proton_scatter/demos/assets/grass_2.tscn"
[node name="ScatterShape" type="Node3D" parent="."]
script = ExtResource("7_vk3gk")
shape = SubResource("Resource_gaw40")

View file

@ -0,0 +1,78 @@
[gd_scene load_steps=16 format=3 uid="uid://yxn1ih6qrc01"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/scatter.gd" id="1_e0kty"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/stack/modifier_stack.gd" id="2_lt5xy"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/modifiers/create_inside_random.gd" id="3_0051t"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/modifiers/randomize_transforms.gd" id="4_5a045"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/modifiers/project_on_geometry.gd" id="5_gkw57"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/modifiers/relax.gd" id="5_n2in0"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/scatter_item.gd" id="6_3iwkw"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/scatter_shape.gd" id="7_jofmq"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/shapes/sphere_shape.gd" id="8_gnbkw"]
[sub_resource type="Resource" id="Resource_jbxru"]
script = ExtResource("3_0051t")
amount = 75
enabled = true
override_global_seed = false
custom_seed = 0
restrict_height = true
reference_frame = 1
[sub_resource type="Resource" id="Resource_0oyil"]
script = ExtResource("4_5a045")
position = Vector3(0.15, 0.15, 0.15)
rotation = Vector3(20, 360, 20)
scale = Vector3(0.1, 0.1, 0.1)
enabled = true
override_global_seed = false
custom_seed = 0
restrict_height = false
reference_frame = 2
[sub_resource type="Resource" id="Resource_ogw66"]
script = ExtResource("5_n2in0")
iterations = 3
offset_step = 0.2
consecutive_step_multiplier = 0.75
enabled = true
override_global_seed = false
custom_seed = 0
restrict_height = true
reference_frame = 0
[sub_resource type="Resource" id="Resource_awufl"]
script = ExtResource("5_gkw57")
ray_direction = Vector3(0, -1, 0)
ray_length = 5.0
ray_offset = 5.0
remove_points_on_miss = false
align_with_collision_normal = false
max_slope = 90.0
collision_mask = 1
enabled = true
override_global_seed = false
custom_seed = 0
restrict_height = false
reference_frame = 0
[sub_resource type="Resource" id="Resource_xqhqc"]
script = ExtResource("2_lt5xy")
stack = Array[Resource]([SubResource("Resource_jbxru"), SubResource("Resource_0oyil"), SubResource("Resource_ogw66"), SubResource("Resource_awufl")])
[sub_resource type="Resource" id="Resource_g8bsm"]
script = ExtResource("8_gnbkw")
radius = 2.0
[node name="ProtonScatter" type="Node3D"]
script = ExtResource("1_e0kty")
modifier_stack = SubResource("Resource_xqhqc")
[node name="ScatterItem" type="Node3D" parent="."]
script = ExtResource("6_3iwkw")
path = "res://addons/proton_scatter/demos/assets/brick.tscn"
[node name="ScatterShape" type="Node3D" parent="."]
transform = Transform3D(1, 0, -2.98023e-08, 0, 1, 0, 2.98023e-08, 0, 1, 0, 0, 0)
script = ExtResource("7_jofmq")
shape = SubResource("Resource_g8bsm")

View file

@ -1,119 +0,0 @@
[gd_scene load_steps=18 format=3 uid="uid://n328aot8v1l4"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/scatter.gd" id="1_se21p"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/stack/modifier_stack.gd" id="2_eb4vu"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/modifiers/create_inside_random.gd" id="3_gvk1d"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/modifiers/relax.gd" id="4_7ewmv"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/modifiers/project_on_geometry.gd" id="5_qj538"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/modifiers/randomize_transforms.gd" id="6_x4res"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/scatter_item.gd" id="7_tg3yo"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/scatter_shape.gd" id="8_ivng4"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/shapes/path_shape.gd" id="9_wuej0"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/common/physics_helper.gd" id="10_5223i"]
[sub_resource type="Resource" id="Resource_fx2k6"]
script = ExtResource("3_gvk1d")
enabled = true
override_global_seed = true
custom_seed = 40
restrict_height = false
reference_frame = 1
amount = 1000
enabled = true
override_global_seed = true
custom_seed = 40
restrict_height = false
reference_frame = 1
[sub_resource type="Resource" id="Resource_46xs3"]
script = ExtResource("4_7ewmv")
enabled = true
override_global_seed = false
custom_seed = 0
restrict_height = true
reference_frame = 0
iterations = 5
offset_step = 0.1
consecutive_step_multiplier = 0.5
use_computeshader = false
enabled = true
override_global_seed = false
custom_seed = 0
restrict_height = true
reference_frame = 0
[sub_resource type="Resource" id="Resource_oih0b"]
script = ExtResource("5_qj538")
enabled = true
override_global_seed = false
custom_seed = 0
restrict_height = false
reference_frame = 0
ray_direction = Vector3(0, 4, 0)
ray_length = 10.0
ray_offset = 1.0
remove_points_on_miss = true
align_with_collision_normal = false
max_slope = 90.0
collision_mask = 1
exclude_mask = 0
enabled = true
override_global_seed = false
custom_seed = 0
restrict_height = false
reference_frame = 0
[sub_resource type="Resource" id="Resource_peyuv"]
script = ExtResource("6_x4res")
enabled = true
override_global_seed = true
custom_seed = 30
restrict_height = false
reference_frame = 2
position = Vector3(0, 3, 0)
rotation = Vector3(0, 0, 0)
scale = Vector3(2, 2, 2)
enabled = true
override_global_seed = true
custom_seed = 30
restrict_height = false
reference_frame = 2
[sub_resource type="Resource" id="Resource_u3hqp"]
script = ExtResource("2_eb4vu")
stack = Array[Resource("res://addons/proton_scatter/src/modifiers/base_modifier.gd")]([SubResource("Resource_fx2k6"), SubResource("Resource_46xs3"), SubResource("Resource_oih0b"), SubResource("Resource_peyuv")])
[sub_resource type="Curve3D" id="Curve3D_2pfp1"]
_data = {
"points": PackedVector3Array(0, 0, 0, 0, 0, 0, 6.2179, 0, 506.704, 0, 0, 0, 0, 0, 0, 5.683, 0, 5.40503, 0, 0, 0, 0, 0, 0, 180.156, 0, 6.21912, 0, 0, 0, 0, 0, 0, 180.021, 0, 16.5296, 0, 0, 0, 0, 0, 0, 157.522, 9.53674e-07, 21.1341, 0, 0, 0, 0, 0, 0, 127.882, 0, 38.711, 0, 0, 0, 0, 0, 0, 111.213, 0, 57.6023, 0, 0, 0, 0, 0, 0, 80.6636, 0, 73.2192, 0, 0, 0, 0, 0, 0, 68.5232, 0, 111.469, 0, 0, 0, 0, 0, 0, 103.594, 0, 136.025, 0, 0, 0, 0, 0, 0, 123.645, 3.8147e-06, 174.356, 0, 0, 0, 0, 0, 0, 89.171, 0, 242.972, 0, 0, 0, 0, 0, 0, 76.1596, 0, 317.236, 0, 0, 0, 0, 0, 0, 83.2551, 0, 392.675, 0, 0, 0, 0, 0, 0, 99.6951, 0, 414.861, 0, 0, 0, 0, 0, 0, 140.407, 0, 419.875, 0, 0, 0, 0, 0, 0, 161.013, 0, 439.369, 0, 0, 0, 0, 0, 0, 193.999, 0, 459.633, 0, 0, 0, 0, 0, 0, 216.067, 0, 457.851, 0, 0, 0, 0, 0, 0, 233.859, 0, 441.929, 0, 0, 0, 0, 0, 0, 255.033, 0, 459.207, 0, 0, 0, 0, 0, 0, 301.184, -3.8147e-06, 490.883, 0, 0, 0, 0, 0, 0, 299.163, 0, 504.649),
"tilts": PackedFloat32Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
}
point_count = 23
[sub_resource type="Resource" id="Resource_6mug8"]
script = ExtResource("9_wuej0")
closed = true
thickness = 0.0
curve = SubResource("Curve3D_2pfp1")
[node name="TreesAfterRiver" type="Node3D"]
process_mode = 3
script = ExtResource("1_se21p")
render_mode = 1
modifier_stack = SubResource("Resource_u3hqp")
Performance/use_chunks = true
Performance/chunk_dimensions = Vector3(15, 15, 15)
[node name="ScatterItem" type="Node3D" parent="."]
script = ExtResource("7_tg3yo")
source_scale_multiplier = 0.4
path = "res://maps/objects/tree_aa.tscn"
[node name="PathShape" type="Node3D" parent="."]
script = ExtResource("8_ivng4")
shape = SubResource("Resource_6mug8")
[node name="PhysicsHelper" type="Node" parent="."]
script = ExtResource("10_5223i")
[node name="ScatterOutput" type="Marker3D" parent="."]

View file

@ -1,120 +0,0 @@
[gd_scene load_steps=18 format=3 uid="uid://v1ewlg2ehuea"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/scatter.gd" id="1_hmmad"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/stack/modifier_stack.gd" id="2_e5fog"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/modifiers/create_inside_random.gd" id="3_wyvg0"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/modifiers/relax.gd" id="4_pb8pp"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/modifiers/project_on_geometry.gd" id="5_dol3b"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/modifiers/randomize_transforms.gd" id="6_7wo6r"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/scatter_item.gd" id="7_nxc8c"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/scatter_shape.gd" id="8_aug6h"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/shapes/path_shape.gd" id="9_ekojf"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/common/physics_helper.gd" id="10_k5xty"]
[sub_resource type="Resource" id="Resource_jqndb"]
script = ExtResource("3_wyvg0")
enabled = true
override_global_seed = true
custom_seed = 40
restrict_height = false
reference_frame = 1
amount = 350
enabled = true
override_global_seed = true
custom_seed = 40
restrict_height = false
reference_frame = 1
[sub_resource type="Resource" id="Resource_nhwoh"]
script = ExtResource("4_pb8pp")
enabled = true
override_global_seed = false
custom_seed = 0
restrict_height = true
reference_frame = 0
iterations = 5
offset_step = 0.1
consecutive_step_multiplier = 0.5
use_computeshader = false
enabled = true
override_global_seed = false
custom_seed = 0
restrict_height = true
reference_frame = 0
[sub_resource type="Resource" id="Resource_dtquh"]
script = ExtResource("5_dol3b")
enabled = true
override_global_seed = false
custom_seed = 0
restrict_height = false
reference_frame = 0
ray_direction = Vector3(0, 8, 0)
ray_length = 10.0
ray_offset = 1.0
remove_points_on_miss = true
align_with_collision_normal = false
max_slope = 90.0
collision_mask = 1
exclude_mask = 0
enabled = true
override_global_seed = false
custom_seed = 0
restrict_height = false
reference_frame = 0
[sub_resource type="Resource" id="Resource_jro2a"]
script = ExtResource("6_7wo6r")
enabled = true
override_global_seed = true
custom_seed = 30
restrict_height = false
reference_frame = 2
position = Vector3(0, 0, 0)
rotation = Vector3(0, 0, 0)
scale = Vector3(2, 2, 2)
enabled = true
override_global_seed = true
custom_seed = 30
restrict_height = false
reference_frame = 2
[sub_resource type="Resource" id="Resource_p5dxo"]
script = ExtResource("2_e5fog")
stack = Array[Resource("res://addons/proton_scatter/src/modifiers/base_modifier.gd")]([SubResource("Resource_jqndb"), SubResource("Resource_nhwoh"), SubResource("Resource_dtquh"), SubResource("Resource_jro2a")])
[sub_resource type="Curve3D" id="Curve3D_jg2wd"]
_data = {
"points": PackedVector3Array(0, 0, 0, 0, 0, 0, 97.8042, 0, 85.9188, 0, 0, 0, 0, 0, 0, 62.8134, 0, 74.6496, 0, 0, 0, 0, 0, 0, 48.0769, 0, 6.80692, 0, 0, 0, 0, 0, 0, 5.16007, 0, 27.1901, 0, 0, 0, 0, 0, 0, -35.8524, 0, 51.9436, 0, 0, 0, 0, 0, 0, -42.1987, 0, 66.3859, 0, 0, 0, 0, 0, 0, -5.21225, 0, 95.748, 0, 0, 0, 0, 0, 0, 8.23603, 0, 140.807, 0, 0, 0, 0, 0, 0, -20.4451, 0, 197.037, 0, 0, 0, 0, 0, 0, 123.018, 0, 202.196, 0, 0, 0, 0, 0, 0, 118.245, 0, 157.887),
"tilts": PackedFloat32Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
}
point_count = 11
[sub_resource type="Resource" id="Resource_8fm0w"]
script = ExtResource("9_ekojf")
closed = true
thickness = 0.0
curve = SubResource("Curve3D_jg2wd")
[node name="TreesBeforeRiver" type="Node3D"]
process_mode = 3
script = ExtResource("1_hmmad")
render_mode = 1
modifier_stack = SubResource("Resource_p5dxo")
Performance/use_chunks = true
Performance/chunk_dimensions = Vector3(15, 15, 15)
[node name="ScatterItem" type="Node3D" parent="."]
script = ExtResource("7_nxc8c")
source_scale_multiplier = 0.4
path = "res://maps/objects/tree_aa.tscn"
[node name="PathShape" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.17125, 0, -215.142)
script = ExtResource("8_aug6h")
shape = SubResource("Resource_8fm0w")
[node name="PhysicsHelper" type="Node" parent="."]
script = ExtResource("10_k5xty")
[node name="ScatterOutput" type="Marker3D" parent="."]

View file

@ -7,6 +7,8 @@ const ScatterCache := preload("res://addons/proton_scatter/src/cache/scatter_cac
@onready var _rebuild_button: Button = %RebuildButton @onready var _rebuild_button: Button = %RebuildButton
@onready var _restore_button: Button = %RestoreButton @onready var _restore_button: Button = %RestoreButton
@onready var _clear_button: Button = %ClearButton
@onready var _enable_for_all_button: Button = %EnableForAllButton
var _cache: ScatterCache var _cache: ScatterCache
@ -14,6 +16,8 @@ var _cache: ScatterCache
func _ready() -> void: func _ready() -> void:
_rebuild_button.pressed.connect(_on_rebuild_pressed) _rebuild_button.pressed.connect(_on_rebuild_pressed)
_restore_button.pressed.connect(_on_restore_pressed) _restore_button.pressed.connect(_on_restore_pressed)
_clear_button.pressed.connect(_on_clear_pressed)
_enable_for_all_button.pressed.connect(_on_enable_for_all_pressed)
custom_minimum_size.y = size.y * 1.25 custom_minimum_size.y = size.y * 1.25
@ -22,10 +26,20 @@ func set_object(cache: ScatterCache) -> void:
func _on_rebuild_pressed() -> void: func _on_rebuild_pressed() -> void:
if _cache: if is_instance_valid(_cache):
_cache.rebuild_cache() _cache.update_cache()
func _on_restore_pressed() -> void: func _on_restore_pressed() -> void:
if _cache: if is_instance_valid(_cache):
_cache.restore_cache() _cache.restore_cache()
func _on_clear_pressed() -> void:
if is_instance_valid(_cache):
_cache.clear_cache()
func _on_enable_for_all_pressed() -> void:
if is_instance_valid(_cache):
_cache.enable_for_all_nodes()

View file

@ -1,10 +1,12 @@
[gd_scene load_steps=4 format=3 uid="uid://dilbceex72g24"] [gd_scene load_steps=5 format=3 uid="uid://dilbceex72g24"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/cache/inspector_plugin/cache_panel.gd" id="1_h1g4a"] [ext_resource type="Script" path="res://addons/proton_scatter/src/cache/inspector_plugin/cache_panel.gd" id="1_h1g4a"]
[ext_resource type="Texture2D" uid="uid://yqlpvcmb7mfi" path="res://addons/proton_scatter/icons/rebuild.svg" id="2_0ml76"] [ext_resource type="Texture2D" uid="uid://yqlpvcmb7mfi" path="res://addons/proton_scatter/icons/rebuild.svg" id="2_0ml76"]
[ext_resource type="Texture2D" uid="uid://ddjrq1h4mkn6a" path="res://addons/proton_scatter/icons/load.svg" id="3_i6mdl"] [ext_resource type="Texture2D" uid="uid://ddjrq1h4mkn6a" path="res://addons/proton_scatter/icons/load.svg" id="3_i6mdl"]
[ext_resource type="Texture2D" uid="uid://btb6rqhhi27mx" path="res://addons/proton_scatter/icons/remove.svg" id="4_bfbdy"]
[node name="CachePanel" type="PanelContainer"] [node name="CachePanel" type="PanelContainer"]
custom_minimum_size = Vector2(0, 82.5)
offset_right = 161.0 offset_right = 161.0
offset_bottom = 66.0 offset_bottom = 66.0
size_flags_horizontal = 3 size_flags_horizontal = 3
@ -21,7 +23,7 @@ alignment = 1
unique_name_in_owner = true unique_name_in_owner = true
layout_mode = 2 layout_mode = 2
size_flags_vertical = 3 size_flags_vertical = 3
text = "Rebuild cache" text = "Update Cache"
icon = ExtResource("2_0ml76") icon = ExtResource("2_0ml76")
[node name="RestoreButton" type="Button" parent="MarginContainer/VBoxContainer"] [node name="RestoreButton" type="Button" parent="MarginContainer/VBoxContainer"]
@ -30,3 +32,18 @@ layout_mode = 2
size_flags_vertical = 3 size_flags_vertical = 3
text = "Restore Transforms" text = "Restore Transforms"
icon = ExtResource("3_i6mdl") icon = ExtResource("3_i6mdl")
[node name="HSeparator" type="HSeparator" parent="MarginContainer/VBoxContainer"]
layout_mode = 2
[node name="ClearButton" type="Button" parent="MarginContainer/VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 3
text = "Clear Cache"
icon = ExtResource("4_bfbdy")
[node name="EnableForAllButton" type="Button" parent="MarginContainer/VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Enable Cache For All"

View file

@ -17,15 +17,23 @@ const ProtonScatter := preload("res://addons/proton_scatter/src/scatter.gd")
const ProtonScatterTransformList := preload("../common/transform_list.gd") const ProtonScatterTransformList := preload("../common/transform_list.gd")
signal cache_restored
@export_file("*.res", "*.tres") var cache_file := "": @export_file("*.res", "*.tres") var cache_file := "":
set(val): set(val):
cache_file = val cache_file = val
update_configuration_warnings() update_configuration_warnings()
@export var auto_rebuild_cache_when_saving := true
@export_group("Debug", "dbg_")
@export var dbg_disable_thread := false
# The resource where transforms are actually stored # The resource where transforms are actually stored
var _local_cache: ProtonScatterCacheResource var _local_cache: ProtonScatterCacheResource
var _scene_root: Node var _scene_root: Node
var _scatter_nodes: Array[ProtonScatter] var _scatter_nodes: Dictionary #Key: ProtonScatter, Value: cached version
var _local_cache_changed := false
func _ready() -> void: func _ready() -> void:
@ -48,13 +56,12 @@ func _ready() -> void:
scene_name = scene_path.get_file().get_basename() scene_name = scene_path.get_file().get_basename()
scene_name += "_" + str(scene_path.hash()) # Prevents name collisions scene_name += "_" + str(scene_path.hash()) # Prevents name collisions
cache_file = DEFAULT_CACHE_FOLDER.get_basename().path_join(scene_name + "_scatter_cache.tres") cache_file = DEFAULT_CACHE_FOLDER.get_basename().path_join(scene_name + "_scatter_cache.res")
return return
restore_cache.call_deferred() restore_cache.call_deferred()
func _get_configuration_warnings() -> PackedStringArray: func _get_configuration_warnings() -> PackedStringArray:
var warnings = PackedStringArray() var warnings = PackedStringArray()
if cache_file.is_empty(): if cache_file.is_empty():
@ -64,24 +71,31 @@ func _get_configuration_warnings() -> PackedStringArray:
func _notification(what): func _notification(what):
if what == NOTIFICATION_EDITOR_PRE_SAVE: if what == NOTIFICATION_EDITOR_PRE_SAVE and auto_rebuild_cache_when_saving:
rebuild_cache() update_cache()
func rebuild_cache() -> void: func clear_cache() -> void:
_scatter_nodes.clear()
_local_cache = null
func update_cache() -> void:
if cache_file.is_empty(): if cache_file.is_empty():
printerr("Cache file path is empty.") printerr("Cache file path is empty.")
return return
_scatter_nodes.clear() _purge_outdated_nodes()
_discover_scatter_nodes(_scene_root) _discover_scatter_nodes(_scene_root)
if not _local_cache: if not _local_cache:
_local_cache = ProtonScatterCacheResource.new() _local_cache = ProtonScatterCacheResource.new()
_local_cache.clear()
for s in _scatter_nodes: for s in _scatter_nodes:
# Ignore this node if its cache is already up to date
var cached_version: int = _scatter_nodes[s]
if s.build_version == cached_version:
continue
# If transforms are not available, try to rebuild once. # If transforms are not available, try to rebuild once.
if not s.transforms: if not s.transforms:
s.rebuild.call_deferred() s.rebuild.call_deferred()
@ -92,16 +106,41 @@ func rebuild_cache() -> void:
# Store the transforms in the cache. # Store the transforms in the cache.
_local_cache.store(_scene_root.get_path_to(s), s.transforms.list) _local_cache.store(_scene_root.get_path_to(s), s.transforms.list)
_scatter_nodes[s] = s.build_version
_local_cache_changed = true
# Only save the cache on disk if there's something new to save
if not _local_cache_changed:
return
# TODO: Save large files on a thread
var err = ResourceSaver.save(_local_cache, cache_file) var err = ResourceSaver.save(_local_cache, cache_file)
_local_cache_changed = false
if err != OK: if err != OK:
printerr("ProtonScatter error: Failed to save the cache file. Code: ", err) printerr("ProtonScatter error: Failed to save the cache file. Code: ", err)
func restore_cache(force_restore := false) -> void: func restore_cache() -> void:
# Load the cache file if it exists # Load the cache file if it exists
_local_cache = load(cache_file) if not FileAccess.file_exists(cache_file):
printerr("Could not find cache file ", cache_file)
return
# Cache files are large, load on a separate thread
ResourceLoader.load_threaded_request(cache_file)
while true:
match ResourceLoader.load_threaded_get_status(cache_file):
ResourceLoader.ThreadLoadStatus.THREAD_LOAD_INVALID_RESOURCE:
return
ResourceLoader.ThreadLoadStatus.THREAD_LOAD_IN_PROGRESS:
await get_tree().process_frame
ResourceLoader.ThreadLoadStatus.THREAD_LOAD_FAILED:
return
ResourceLoader.ThreadLoadStatus.THREAD_LOAD_LOADED:
break
_local_cache = ResourceLoader.load_threaded_get(cache_file)
if not _local_cache: if not _local_cache:
printerr("Could not load cache: ", cache_file) printerr("Could not load cache: ", cache_file)
return return
@ -110,7 +149,7 @@ func restore_cache(force_restore := false) -> void:
_discover_scatter_nodes(_scene_root) _discover_scatter_nodes(_scene_root)
for s in _scatter_nodes: for s in _scatter_nodes:
if s.force_rebuild_on_load and not force_restore: if s.force_rebuild_on_load:
continue # Ignore the cache if the scatter node is about to rebuild anyway. continue # Ignore the cache if the scatter node is about to rebuild anyway.
# Send the cached transforms to the scatter node. # Send the cached transforms to the scatter node.
@ -118,6 +157,17 @@ func restore_cache(force_restore := false) -> void:
transforms.list = _local_cache.get_transforms(_scene_root.get_path_to(s)) transforms.list = _local_cache.get_transforms(_scene_root.get_path_to(s))
s._perform_sanity_check() s._perform_sanity_check()
s._on_transforms_ready(transforms) s._on_transforms_ready(transforms)
s.build_version = 0
_scatter_nodes[s] = 0
cache_restored.emit()
func enable_for_all_nodes() -> void:
_purge_outdated_nodes()
_discover_scatter_nodes(_scene_root)
for s in _scatter_nodes:
s.force_rebuild_on_load = false
# If the node comes from an instantiated scene, returns the root of that # If the node comes from an instantiated scene, returns the root of that
@ -133,14 +183,26 @@ func _get_local_scene_root(node: Node) -> Node:
return _get_local_scene_root(parent) return _get_local_scene_root(parent)
func _discover_scatter_nodes(root: Node) -> void: func _discover_scatter_nodes(node: Node) -> void:
if root is ProtonScatter: if node is ProtonScatter and not _scatter_nodes.has(node):
_scatter_nodes.push_back(root) _scatter_nodes[node] = node.build_version
for c in root.get_children(): for c in node.get_children():
_discover_scatter_nodes(c) _discover_scatter_nodes(c)
func _purge_outdated_nodes() -> void:
var nodes_to_remove: Array[ProtonScatter] = []
for node in _scatter_nodes:
if not is_instance_valid(node):
nodes_to_remove.push_back(node)
_local_cache.erase(_scene_root.get_path_to(node))
_local_cache_changed = true
for node in nodes_to_remove:
_scatter_nodes.erase(node)
func _ensure_cache_folder_exists() -> void: func _ensure_cache_folder_exists() -> void:
if not DirAccess.dir_exists_absolute(DEFAULT_CACHE_FOLDER): if not DirAccess.dir_exists_absolute(DEFAULT_CACHE_FOLDER):
DirAccess.make_dir_recursive_absolute(DEFAULT_CACHE_FOLDER) DirAccess.make_dir_recursive_absolute(DEFAULT_CACHE_FOLDER)

View file

@ -14,6 +14,10 @@ func store(node_path: String, transforms: Array[Transform3D]) -> void:
data[node_path] = transforms data[node_path] = transforms
func erase(node_path: String) -> void:
data.erase(node_path)
func get_transforms(node_path: String) -> Array[Transform3D]: func get_transforms(node_path: String) -> Array[Transform3D]:
var res: Array[Transform3D] var res: Array[Transform3D]

View file

@ -79,18 +79,17 @@ static func get_or_create_multimesh(item: ProtonScatterItem, count: int) -> Mult
item_root.add_child(mmi, true) item_root.add_child(mmi, true)
mmi.set_owner(item_root.owner) mmi.set_owner(item_root.owner)
if not mmi.multimesh: if not mmi.multimesh:
mmi.multimesh = MultiMesh.new() mmi.multimesh = MultiMesh.new()
mmi.position = Vector3.ZERO
mmi.set_cast_shadows_setting(item.override_cast_shadow)
mmi.set_material_override(item.override_material)
var mesh_instance: MeshInstance3D = get_merged_meshes_from(item) var mesh_instance: MeshInstance3D = get_merged_meshes_from(item)
if not mesh_instance: if not mesh_instance:
return return
mmi.position = Vector3.ZERO
mmi.material_override = get_final_material(item, mesh_instance)
mmi.set_cast_shadows_setting(item.override_cast_shadow)
mmi.multimesh.instance_count = 0 # Set this to zero or you can't change the other values mmi.multimesh.instance_count = 0 # Set this to zero or you can't change the other values
mmi.multimesh.mesh = mesh_instance.mesh mmi.multimesh.mesh = mesh_instance.mesh
mmi.multimesh.transform_format = MultiMesh.TRANSFORM_3D mmi.multimesh.transform_format = MultiMesh.TRANSFORM_3D
@ -108,10 +107,16 @@ static func get_or_create_multimesh(item: ProtonScatterItem, count: int) -> Mult
return mmi return mmi
static func get_or_create_multimesh_chunk(item: ProtonScatterItem, index: Vector3i, count) -> MultiMeshInstance3D: static func get_or_create_multimesh_chunk(item: ProtonScatterItem,
mesh_instance: MeshInstance3D,
index: Vector3i,
count: int)\
-> MultiMeshInstance3D:
var item_root := get_or_create_item_root(item) var item_root := get_or_create_item_root(item)
var chunk_name = "MultiMeshInstance3D" + "_%s_%s_%s"%[index.x, index.y, index.z] var chunk_name = "MultiMeshInstance3D" + "_%s_%s_%s"%[index.x, index.y, index.z]
var mmi: MultiMeshInstance3D = item_root.get_node_or_null(chunk_name) var mmi: MultiMeshInstance3D = item_root.get_node_or_null(chunk_name)
if not mesh_instance:
return
if not mmi: if not mmi:
mmi = MultiMeshInstance3D.new() mmi = MultiMeshInstance3D.new()
@ -119,20 +124,14 @@ static func get_or_create_multimesh_chunk(item: ProtonScatterItem, index: Vector
# if set_name is used after add_child it is crazy slow # if set_name is used after add_child it is crazy slow
# This doesn't make much sense but it is definitely the case. # This doesn't make much sense but it is definitely the case.
# About a 100x slowdown was observed in this case # About a 100x slowdown was observed in this case
item_root.add_child(mmi, true) item_root.add_child.bind(mmi, true).call_deferred()
mmi.set_owner(item_root.owner)
if not mmi.multimesh: if not mmi.multimesh:
mmi.multimesh = MultiMesh.new() mmi.multimesh = MultiMesh.new()
mmi.position = Vector3.ZERO mmi.position = Vector3.ZERO
mmi.material_override = get_final_material(item, mesh_instance)
mmi.set_cast_shadows_setting(item.override_cast_shadow) mmi.set_cast_shadows_setting(item.override_cast_shadow)
mmi.set_material_override(item.override_material)
var mesh_instance: MeshInstance3D = get_merged_meshes_from(item)
if not mesh_instance:
return
mmi.multimesh.instance_count = 0 # Set this to zero or you can't change the other values mmi.multimesh.instance_count = 0 # Set this to zero or you can't change the other values
mmi.multimesh.mesh = mesh_instance.mesh mmi.multimesh.mesh = mesh_instance.mesh
@ -146,8 +145,6 @@ static func get_or_create_multimesh_chunk(item: ProtonScatterItem, index: Vector
mmi.multimesh.instance_count = count mmi.multimesh.instance_count = count
mesh_instance.queue_free()
return mmi return mmi
@ -165,7 +162,8 @@ static func get_or_create_particles(item: ProtonScatterItem) -> GPUParticles3D:
var mesh_instance: MeshInstance3D = get_merged_meshes_from(item) var mesh_instance: MeshInstance3D = get_merged_meshes_from(item)
if not mesh_instance: if not mesh_instance:
return return
particles.material_override = get_final_material(item, mesh_instance)
particles.set_draw_pass_mesh(0, mesh_instance.mesh) particles.set_draw_pass_mesh(0, mesh_instance.mesh)
particles.position = Vector3.ZERO particles.position = Vector3.ZERO
particles.local_coords = true particles.local_coords = true
@ -235,6 +233,19 @@ static func get_all_mesh_instances_from(node: Node3D) -> Array[MeshInstance3D]:
return res return res
static func get_final_material(item: ProtonScatterItem, mi: MeshInstance3D) -> Material:
if item.override_material:
return item.override_material
if mi.material_override:
return mi.material_override
if mi.get_surface_override_material(0):
return mi.get_surface_override_material(0)
return null
# Merge all the MeshInstances from the local node tree into a single MeshInstance. # Merge all the MeshInstances from the local node tree into a single MeshInstance.
# /!\ This is a best effort algorithm and will not work in some specific cases. /!\ # /!\ This is a best effort algorithm and will not work in some specific cases. /!\
# #
@ -264,13 +275,25 @@ static func get_merged_meshes_from(item: ProtonScatterItem) -> MeshInstance3D:
if mesh_instances.is_empty(): if mesh_instances.is_empty():
return null return null
# If there's only one mesh instance we can reuse it directly if the materials allow it.
if mesh_instances.size() == 1:
# Duplicate the meshinstance, not the mesh resource
var mi: MeshInstance3D = mesh_instances[0].duplicate()
# MI uses a material override, all surface materials will be ignored
if mi.material_override:
return mi
var surface_overrides_count := 0
for i in mi.get_surface_override_material_count():
if mi.get_surface_override_material(i):
surface_overrides_count += 1
# If there's one material override or less, no duplicate mesh is required.
if surface_overrides_count <= 1:
return mi
# Only one mesh instance found, no merge required.
# TODO: Uncomment these two lines once we find a way to make surface material
# overrides play nicely with a single mesh and instancing.
# For now, this means meshes will always be duplicated in each scenes, which is bad.
# if mesh_instances.size() == 1:
# return mesh_instances[0]
# Helper lambdas # Helper lambdas
var get_material_for_surface = func (mi: MeshInstance3D, idx: int) -> Material: var get_material_for_surface = func (mi: MeshInstance3D, idx: int) -> Material:

View file

@ -2,7 +2,7 @@
importer="glsl" importer="glsl"
type="RDShaderFile" type="RDShaderFile"
uid="uid://bsqni6f2qm48i" uid="uid://cufp1r02aur6w"
path="res://.godot/imported/compute_relax.glsl-b06f9e60cda7719b78bde9673f2501b7.res" path="res://.godot/imported/compute_relax.glsl-b06f9e60cda7719b78bde9673f2501b7.res"
[deps] [deps]

View file

@ -123,6 +123,7 @@ var output_root: Marker3D
var transforms: ProtonScatterTransformList var transforms: ProtonScatterTransformList
var editor_plugin # Holds a reference to the EditorPlugin. Used by other parts. var editor_plugin # Holds a reference to the EditorPlugin. Used by other parts.
var is_ready := false var is_ready := false
var build_version := 0
# Internal variables # Internal variables
var _thread: Thread var _thread: Thread
@ -453,6 +454,8 @@ func _update_split_multimeshes() -> void:
static_body.queue_free() static_body.queue_free()
# Cache the mesh instance to be used for the chunks
var mesh_instance: MeshInstance3D = ProtonScatterUtil.get_merged_meshes_from(item)
# The relevant transforms are now ordered in chunks # The relevant transforms are now ordered in chunks
for xi in splits.x: for xi in splits.x:
for yi in splits.y: for yi in splits.y:
@ -460,7 +463,11 @@ func _update_split_multimeshes() -> void:
var chunk_elements = transform_chunks[xi][yi][zi].size() var chunk_elements = transform_chunks[xi][yi][zi].size()
if chunk_elements == 0: if chunk_elements == 0:
continue continue
var mmi = ProtonScatterUtil.get_or_create_multimesh_chunk(item, Vector3i(xi, yi, zi), chunk_elements) var mmi = ProtonScatterUtil.get_or_create_multimesh_chunk(
item,
mesh_instance,
Vector3i(xi, yi, zi),
chunk_elements)
if not mmi: if not mmi:
continue continue
@ -475,7 +482,7 @@ func _update_split_multimeshes() -> void:
t = transform_chunks[xi][yi][zi][i] t = transform_chunks[xi][yi][zi][i]
t.origin -= center t.origin -= center
mmi.multimesh.set_instance_transform(i, t) mmi.multimesh.set_instance_transform(i, t)
mesh_instance.queue_free()
offset += count offset += count
@ -713,5 +720,6 @@ func _on_transforms_ready(new_transforms: ProtonScatterTransformList) -> void:
_update_particles_system() _update_particles_system()
update_gizmos() update_gizmos()
build_version += 1
await get_tree().process_frame await get_tree().process_frame
build_completed.emit() build_completed.emit()

View file

@ -22,11 +22,23 @@ var curve: Curve
var gt: Transform2D var gt: Transform2D
var _hover_point := -1: var _hover_point := -1:
set(val): set_hover(val) set(val):
if val != _hover_point:
_hover_point = val
queue_redraw()
var _selected_point := -1: var _selected_point := -1:
set(val): set_selected_point(val) set(val):
if val != _selected_point:
_selected_point = val
queue_redraw()
var _selected_tangent := -1: var _selected_tangent := -1:
set(val): set_selected_tangent(val) set(val):
if val != _selected_tangent:
_selected_tangent = val
queue_redraw()
var _dragging := false var _dragging := false
var _hover_radius := 50.0 # Squared var _hover_radius := 50.0 # Squared
var _tangents_length := 30.0 var _tangents_length := 30.0
@ -36,8 +48,11 @@ var _font: Font
func _ready() -> void: func _ready() -> void:
#rect_min_size.y *= EditorUtil.get_editor_scale() #rect_min_size.y *= EditorUtil.get_editor_scale()
var plugin := EditorPlugin.new() var plugin := EditorPlugin.new()
var theme := plugin.get_editor_interface().get_base_control().get_theme() var editor_theme := plugin.get_editor_interface().get_base_control().get_theme()
_font = theme.get_font("Main", "EditorFonts") if editor_theme:
_font = editor_theme.get_font("Main", "EditorFonts")
else:
_font = ThemeDB.fallback_font
plugin.queue_free() plugin.queue_free()
queue_redraw() queue_redraw()
@ -59,7 +74,7 @@ func _gui_input(event) -> void:
remove_point(_selected_point) remove_point(_selected_point)
elif event is InputEventMouseButton: elif event is InputEventMouseButton:
if event.doubleclick: if event.double_click:
add_point(_to_curve_space(event.position)) add_point(_to_curve_space(event.position))
elif event.pressed and event.button_index == MOUSE_BUTTON_MIDDLE: elif event.pressed and event.button_index == MOUSE_BUTTON_MIDDLE:
@ -86,7 +101,7 @@ func _gui_input(event) -> void:
# Snap to "round" coordinates when holding Ctrl. # Snap to "round" coordinates when holding Ctrl.
# Be more precise when holding Shift as well. # Be more precise when holding Shift as well.
var snap_threshold: float var snap_threshold: float
if event.control: if event.ctrl_pressed:
snap_threshold = 0.025 if event.shift else 0.1 snap_threshold = 0.025 if event.shift else 0.1
else: else:
snap_threshold = 0.0 snap_threshold = 0.0

View file

@ -13,13 +13,12 @@ func set_parameter_name(text: String) -> void:
_label.text = text _label.text = text
#func get_value() -> String: func get_value() -> Curve:
# return Util.curve_to_string(_panel.get_curve()) return _panel.get_curve()
#func _set_value(val: String) -> void: func _set_value(val: Curve) -> void:
# var curve = Util.string_to_curve(val) _panel.set_curve(val)
# _panel.set_curve(curve)
func _on_curve_updated() -> void: func _on_curve_updated() -> void:

View file

@ -1,32 +1,26 @@
[gd_scene load_steps=3 format=3] [gd_scene load_steps=3 format=3 uid="uid://dqjwibwhdmgsb"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/stack/inspector_plugin/ui/modifier/components/parameter_curve.gd" id="1"] [ext_resource type="Script" path="res://addons/proton_scatter/src/stack/inspector_plugin/ui/modifier/components/parameter_curve.gd" id="1"]
[ext_resource type="Script" path="res://addons/proton_scatter/src/stack/inspector_plugin/ui/modifier/components/curve_panel.gd" id="2"] [ext_resource type="Script" path="res://addons/proton_scatter/src/stack/inspector_plugin/ui/modifier/components/curve_panel.gd" id="2"]
[node name="ParameterCurve" type="VBoxContainer"] [node name="ParameterCurve" type="VBoxContainer"]
anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
script = ExtResource( 1 ) script = ExtResource("1")
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label" type="Label" parent="."] [node name="Label" type="Label" parent="."]
margin_right = 1280.0 layout_mode = 2
margin_bottom = 14.0
text = "Curve name" text = "Curve name"
[node name="MarginContainer" type="MarginContainer" parent="."] [node name="MarginContainer" type="MarginContainer" parent="."]
margin_top = 18.0 layout_mode = 2
margin_right = 1280.0
margin_bottom = 168.0
[node name="CurvePanel" type="PanelContainer" parent="MarginContainer"] [node name="CurvePanel" type="PanelContainer" parent="MarginContainer"]
margin_right = 1280.0 custom_minimum_size = Vector2(0, 100)
margin_bottom = 150.0 layout_mode = 2
rect_min_size = Vector2( 0, 150 ) script = ExtResource("2")
rect_clip_content = true selected_point_color = Color(0.878431, 0.47451, 0, 1)
script = ExtResource( 2 ) rows = 4
selected_point_color = Color( 0.878431, 0.47451, 0, 1 )
[connection signal="curve_updated" from="MarginContainer/CurvePanel" to="." method="_on_curve_updated"] [connection signal="curve_updated" from="MarginContainer/CurvePanel" to="." method="_on_curve_updated"]

View file

@ -122,8 +122,6 @@ func create_ui_for(modifier) -> void:
TYPE_STRING: TYPE_STRING:
if property.hint_string == "File" or property.hint_string == "Texture": if property.hint_string == "File" or property.hint_string == "Texture":
parameter_ui = ParameterFile.instantiate() parameter_ui = ParameterFile.instantiate()
elif property.hint_string == "Curve":
parameter_ui = ParameterCurve.instantiate()
else: else:
parameter_ui = ParameterString.instantiate() parameter_ui = ParameterString.instantiate()
TYPE_VECTOR3: TYPE_VECTOR3:
@ -133,6 +131,9 @@ func create_ui_for(modifier) -> void:
TYPE_NODE_PATH: TYPE_NODE_PATH:
parameter_ui = ParameterNodeSelector.instantiate() parameter_ui = ParameterNodeSelector.instantiate()
parameter_ui.set_root(_scatter) parameter_ui.set_root(_scatter)
TYPE_OBJECT:
if property.class_name == &"Curve":
parameter_ui = ParameterCurve.instantiate()
if parameter_ui: if parameter_ui:
_parameters.add_child(parameter_ui) _parameters.add_child(parameter_ui)

View file

@ -22,6 +22,7 @@ meshes/generate_lods=true
meshes/create_shadow_meshes=true meshes/create_shadow_meshes=true
meshes/light_baking=1 meshes/light_baking=1
meshes/lightmap_texel_size=0.1 meshes/lightmap_texel_size=0.1
meshes/force_disable_compression=false
skins/use_named_skins=true skins/use_named_skins=true
animation/import=true animation/import=true
animation/fps=30 animation/fps=30

View file

@ -15,6 +15,10 @@ run/main_scene="res://scenes/interface/page_login.tscn"
config/features=PackedStringArray("4.2", "Forward Plus") config/features=PackedStringArray("4.2", "Forward Plus")
config/icon="res://icon.png" config/icon="res://icon.png"
[autoload]
Global="*res://script/global.gd"
[editor_plugins] [editor_plugins]
enabled=PackedStringArray("res://addons/proton_scatter/plugin.cfg", "res://addons/waterways/plugin.cfg", "res://addons/zylann.hterrain/plugin.cfg") enabled=PackedStringArray("res://addons/proton_scatter/plugin.cfg", "res://addons/waterways/plugin.cfg", "res://addons/zylann.hterrain/plugin.cfg")

File diff suppressed because one or more lines are too long

View file

@ -1,17 +1,54 @@
[gd_scene load_steps=2 format=3 uid="uid://bcgyiblimtc1f"] [gd_scene load_steps=5 format=3 uid="uid://bcgyiblimtc1f"]
[ext_resource type="Script" path="res://script/interface/loading_screen.gd" id="1_hs5ji"]
[ext_resource type="Texture2D" uid="uid://dp4wmmkbfc6fk" path="res://assets/background/khanat_sound_cover_bg.png" id="1_wv5f3"] [ext_resource type="Texture2D" uid="uid://dp4wmmkbfc6fk" path="res://assets/background/khanat_sound_cover_bg.png" id="1_wv5f3"]
[node name="loading_screen" type="Control"] [sub_resource type="Animation" id="Animation_je5hb"]
layout_mode = 3 resource_name = "fade_out"
anchors_preset = 15 tracks/0/type = "method"
anchor_right = 1.0 tracks/0/imported = false
anchor_bottom = 1.0 tracks/0/enabled = true
grow_horizontal = 2 tracks/0/path = NodePath(".")
grow_vertical = 2 tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(1),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [&"safe_to_load"],
"method": &"emit_signal"
}]
}
[node name="TextureRect" type="TextureRect" parent="."] [sub_resource type="AnimationLibrary" id="AnimationLibrary_sp1ii"]
layout_mode = 0 _data = {
"fade_out": SubResource("Animation_je5hb")
}
[node name="loading_screen" type="CanvasGroup"]
script = ExtResource("1_hs5ji")
[node name="animation_progressBar" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_sp1ii")
}
autoplay = "fade_out"
[node name="control_background" type="Control" parent="."]
layout_mode = 3
anchors_preset = 0
offset_right = 40.0 offset_right = 40.0
offset_bottom = 40.0 offset_bottom = 40.0
[node name="texture_background" type="TextureRect" parent="control_background"]
layout_mode = 0
offset_right = 1280.0
offset_bottom = 720.0
texture = ExtResource("1_wv5f3") texture = ExtResource("1_wv5f3")
[node name="progressBar" type="ProgressBar" parent="control_background"]
layout_mode = 0
offset_left = 143.0
offset_top = 465.0
offset_right = 493.0
offset_bottom = 492.0

View file

@ -29,52 +29,58 @@ grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
script = ExtResource("1_dotvb") script = ExtResource("1_dotvb")
[node name="Background" type="TextureRect" parent="."] [node name="background" type="TextureRect" parent="."]
layout_mode = 0 layout_mode = 0
offset_right = 1280.0 offset_right = 1280.0
offset_bottom = 720.0 offset_bottom = 720.0
texture = ExtResource("1_den6m") texture = ExtResource("1_den6m")
[node name="BoxContainer" type="BoxContainer" parent="."] [node name="boxContainer_login" type="BoxContainer" parent="."]
layout_mode = 1 layout_mode = 1
anchors_preset = -1 anchors_preset = -1
anchor_left = 0.5 anchor_left = 0.5
anchor_right = 0.5 anchor_right = 0.5
offset_left = 88.5 offset_left = 88.5
offset_top = 208.0 offset_top = 208.0
offset_right = 310.5 offset_right = 292.5
offset_bottom = 350.0 offset_bottom = 350.0
grow_horizontal = 2 grow_horizontal = 2
[node name="VBoxContainer" type="VBoxContainer" parent="BoxContainer"] [node name="vBoxContainer_login" type="VBoxContainer" parent="boxContainer_login"]
layout_direction = 1 layout_direction = 1
layout_mode = 2 layout_mode = 2
[node name="login" type="Button" parent="BoxContainer/VBoxContainer"] [node name="login" type="Button" parent="boxContainer_login/vBoxContainer_login"]
custom_minimum_size = Vector2(200, 40) custom_minimum_size = Vector2(200, 40)
layout_mode = 2 layout_mode = 2
theme_override_styles/normal = SubResource("StyleBoxFlat_3pj1o") theme_override_styles/normal = SubResource("StyleBoxFlat_3pj1o")
text = "Login" text = "Login"
[node name="TextEdit" type="TextEdit" parent="BoxContainer/VBoxContainer"] [node name="text_username" type="TextEdit" parent="boxContainer_login/vBoxContainer_login"]
custom_minimum_size = Vector2(0, 30) custom_minimum_size = Vector2(0, 30)
layout_mode = 2 layout_mode = 2
theme_override_styles/normal = SubResource("StyleBoxFlat_mci7p") theme_override_styles/normal = SubResource("StyleBoxFlat_mci7p")
placeholder_text = "usermane" placeholder_text = "Usermane"
[node name="TextEdit2" type="TextEdit" parent="BoxContainer/VBoxContainer"] [node name="text_password" type="TextEdit" parent="boxContainer_login/vBoxContainer_login"]
custom_minimum_size = Vector2(0, 30) custom_minimum_size = Vector2(0, 30)
layout_mode = 2 layout_mode = 2
theme_override_styles/normal = SubResource("StyleBoxFlat_14t2b") theme_override_styles/normal = SubResource("StyleBoxFlat_14t2b")
placeholder_text = "password" placeholder_text = "Password"
[node name="quit" type="Button" parent="BoxContainer/VBoxContainer"] [node name="button_settings" type="Button" parent="boxContainer_login/vBoxContainer_login"]
custom_minimum_size = Vector2(200, 30)
layout_mode = 2
theme_override_styles/normal = SubResource("StyleBoxFlat_wkhpl")
text = "Settings"
[node name="button_quit" type="Button" parent="boxContainer_login/vBoxContainer_login"]
custom_minimum_size = Vector2(200, 30) custom_minimum_size = Vector2(200, 30)
layout_mode = 2 layout_mode = 2
theme_override_styles/normal = SubResource("StyleBoxFlat_wkhpl") theme_override_styles/normal = SubResource("StyleBoxFlat_wkhpl")
text = "Quit" text = "Quit"
[node name="Button" type="Button" parent="."] [node name="button_patch" type="Button" parent="."]
layout_mode = 0 layout_mode = 0
offset_left = 600.0 offset_left = 600.0
offset_top = 550.0 offset_top = 550.0
@ -83,5 +89,6 @@ offset_bottom = 581.0
theme_override_styles/normal = SubResource("StyleBoxFlat_2nlmp") theme_override_styles/normal = SubResource("StyleBoxFlat_2nlmp")
text = "PATCH" text = "PATCH"
[connection signal="pressed" from="BoxContainer/VBoxContainer/login" to="." method="_on_login_pressed"] [connection signal="pressed" from="boxContainer_login/vBoxContainer_login/login" to="." method="_on_login_pressed"]
[connection signal="button_down" from="BoxContainer/VBoxContainer/quit" to="." method="_on_quit_button_down"] [connection signal="pressed" from="boxContainer_login/vBoxContainer_login/button_settings" to="." method="_on_settings_pressed"]
[connection signal="button_down" from="boxContainer_login/vBoxContainer_login/button_quit" to="." method="_on_quit_button_down"]

View file

@ -1,9 +1,9 @@
[gd_scene load_steps=8 format=3 uid="uid://iupkschafyjy"] [gd_scene load_steps=8 format=3 uid="uid://iupkschafyjy"]
[ext_resource type="Script" path="res://script/interface/page_perso.gd" id="1_5g4xk"] [ext_resource type="Script" path="res://script/interface/page_perso.gd" id="1_ev8xv"]
[ext_resource type="Texture2D" uid="uid://ckukbjjvm54c5" path="res://assets/background/settings-Khanat-background.png" id="2_2uy4g"] [ext_resource type="Texture2D" uid="uid://ckukbjjvm54c5" path="res://assets/background/settings-Khanat-background.png" id="2_6q3rv"]
[ext_resource type="PackedScene" uid="uid://x2deg4hgjdm3" path="res://assets/creatures/raference/raference.tscn" id="3_2scnp"] [ext_resource type="PackedScene" uid="uid://x2deg4hgjdm3" path="res://assets/creatures/raference/raference.tscn" id="3_nnmsb"]
[ext_resource type="Script" path="res://assets/creatures/CameraControllerMain.gd" id="4_sgxte"] [ext_resource type="Script" path="res://assets/creatures/CameraControllerMain.gd" id="4_5c5wm"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_jdln7"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_jdln7"]
bg_color = Color(0.388235, 0.34902, 0.858824, 1) bg_color = Color(0.388235, 0.34902, 0.858824, 1)
@ -14,7 +14,7 @@ bg_color = Color(0.0627451, 0.0313726, 0.45098, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_uyprx"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_uyprx"]
bg_color = Color(0.0627451, 0.0313726, 0.45098, 1) bg_color = Color(0.0627451, 0.0313726, 0.45098, 1)
[node name="PageChoisirServer" type="Control"] [node name="page_choice_player" type="Control"]
layout_mode = 3 layout_mode = 3
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
@ -23,15 +23,15 @@ offset_right = 127.0
offset_bottom = 74.0 offset_bottom = 74.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
script = ExtResource("1_5g4xk") script = ExtResource("1_ev8xv")
[node name="Background" type="TextureRect" parent="."] [node name="background" type="TextureRect" parent="."]
layout_mode = 0 layout_mode = 0
offset_right = 40.0 offset_right = 40.0
offset_bottom = 40.0 offset_bottom = 40.0
texture = ExtResource("2_2uy4g") texture = ExtResource("2_6q3rv")
[node name="SubViewportContainer" type="SubViewportContainer" parent="."] [node name="create_player1" type="SubViewportContainer" parent="."]
layout_mode = 0 layout_mode = 0
offset_left = 188.0 offset_left = 188.0
offset_top = 75.0 offset_top = 75.0
@ -39,25 +39,25 @@ offset_right = 368.0
offset_bottom = 455.0 offset_bottom = 455.0
tooltip_text = "Le click droit de la souris permets de tourner le perso " tooltip_text = "Le click droit de la souris permets de tourner le perso "
[node name="creer_perso" type="SubViewport" parent="SubViewportContainer"] [node name="create_player" type="SubViewport" parent="create_player1"]
handle_input_locally = false handle_input_locally = false
size = Vector2i(180, 380) size = Vector2i(180, 380)
render_target_update_mode = 4 render_target_update_mode = 4
[node name="model" type="Node3D" parent="SubViewportContainer/creer_perso"] [node name="model" type="Node3D" parent="create_player1/create_player"]
[node name="raference" parent="SubViewportContainer/creer_perso/model" instance=ExtResource("3_2scnp")] [node name="raference" parent="create_player1/create_player/model" instance=ExtResource("3_nnmsb")]
[node name="cameraroot" type="Node3D" parent="SubViewportContainer/creer_perso"] [node name="cameraroot" type="Node3D" parent="create_player1/create_player"]
script = ExtResource("4_sgxte") script = ExtResource("4_5c5wm")
[node name="Camera3D" type="Camera3D" parent="SubViewportContainer/creer_perso/cameraroot"] [node name="camera3D" type="Camera3D" parent="create_player1/create_player/cameraroot"]
transform = Transform3D(1, 0, 0, 0, 0.994295, 0.106663, 0, -0.106663, 0.994295, 0, 0.973339, 1.38456) transform = Transform3D(1, 0, 0, 0, 0.994295, 0.106663, 0, -0.106663, 0.994295, 0, 0.973339, 1.38456)
[node name="OmniLight3D" type="OmniLight3D" parent="SubViewportContainer/creer_perso"] [node name="omniLight3D" type="OmniLight3D" parent="create_player1/create_player"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.67263, 1.60367) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.67263, 1.60367)
[node name="creer_perso2" type="TextEdit" parent="."] [node name="create_player2" type="TextEdit" parent="."]
layout_mode = 1 layout_mode = 1
anchors_preset = -1 anchors_preset = -1
anchor_right = 0.135 anchor_right = 0.135
@ -71,7 +71,7 @@ text = "creer un personnage
Ne fonctionne pas" Ne fonctionne pas"
editable = false editable = false
[node name="creer_perso3" type="TextEdit" parent="."] [node name="create_player3" type="TextEdit" parent="."]
layout_mode = 1 layout_mode = 1
anchors_preset = -1 anchors_preset = -1
anchor_right = 0.135 anchor_right = 0.135
@ -85,7 +85,7 @@ text = "creer un personnage
Ne fonctionne pas" Ne fonctionne pas"
editable = false editable = false
[node name="creer_perso4" type="TextEdit" parent="."] [node name="create_player4" type="TextEdit" parent="."]
layout_mode = 1 layout_mode = 1
anchors_preset = -1 anchors_preset = -1
anchor_right = 0.135 anchor_right = 0.135
@ -99,7 +99,7 @@ text = "creer un personnage
Ne fonctionne pas" Ne fonctionne pas"
editable = false editable = false
[node name="choisir_perso" type="Button" parent="."] [node name="button_select_player" type="Button" parent="."]
layout_mode = 1 layout_mode = 1
anchors_preset = -1 anchors_preset = -1
anchor_right = 0.135 anchor_right = 0.135
@ -109,9 +109,9 @@ offset_top = 534.0
offset_right = 858.335 offset_right = 858.335
offset_bottom = 461.094 offset_bottom = 461.094
theme_override_styles/normal = SubResource("StyleBoxFlat_jvgma") theme_override_styles/normal = SubResource("StyleBoxFlat_jvgma")
text = "choisir un personnage" text = "Select player"
[node name="return" type="Button" parent="."] [node name="button_return" type="Button" parent="."]
layout_mode = 0 layout_mode = 0
offset_left = 290.0 offset_left = 290.0
offset_top = 549.0 offset_top = 549.0
@ -120,5 +120,5 @@ offset_bottom = 580.0
theme_override_styles/normal = SubResource("StyleBoxFlat_uyprx") theme_override_styles/normal = SubResource("StyleBoxFlat_uyprx")
text = "Return" text = "Return"
[connection signal="pressed" from="choisir_perso" to="." method="_on_perso_pressed"] [connection signal="pressed" from="button_select_player" to="." method="_on_perso_pressed"]
[connection signal="button_down" from="return" to="." method="_on_return_button_down"] [connection signal="button_down" from="button_return" to="." method="_on_return_button_down"]

View file

@ -12,7 +12,7 @@ bg_color = Color(0.0627451, 0.0313726, 0.45098, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_83bu0"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_83bu0"]
bg_color = Color(0.388235, 0.34902, 0.858824, 1) bg_color = Color(0.388235, 0.34902, 0.858824, 1)
[node name="PageChoisirServer" type="Control"] [node name="page_choice_server" type="Control"]
layout_mode = 3 layout_mode = 3
anchor_right = 1.111 anchor_right = 1.111
anchor_bottom = 1.11 anchor_bottom = 1.11
@ -28,7 +28,7 @@ offset_right = 1280.0
offset_bottom = 720.0 offset_bottom = 720.0
texture = ExtResource("2_u10e3") texture = ExtResource("2_u10e3")
[node name="server" type="Button" parent="."] [node name="button_server" type="Button" parent="."]
custom_minimum_size = Vector2(200, 40) custom_minimum_size = Vector2(200, 40)
layout_mode = 1 layout_mode = 1
anchors_preset = 2 anchors_preset = 2
@ -40,9 +40,9 @@ offset_right = 1005.0
offset_bottom = 584.0 offset_bottom = 584.0
grow_vertical = 0 grow_vertical = 0
theme_override_styles/normal = SubResource("StyleBoxFlat_qa8np") theme_override_styles/normal = SubResource("StyleBoxFlat_qa8np")
text = "Suivant" text = "Next"
[node name="return" type="Button" parent="."] [node name="button_return" type="Button" parent="."]
layout_mode = 0 layout_mode = 0
offset_left = 321.0 offset_left = 321.0
offset_top = 538.0 offset_top = 538.0
@ -51,7 +51,7 @@ offset_bottom = 569.0
theme_override_styles/normal = SubResource("StyleBoxFlat_v7kka") theme_override_styles/normal = SubResource("StyleBoxFlat_v7kka")
text = "return" text = "return"
[node name="Text_server" type="ItemList" parent="."] [node name="text_server" type="ItemList" parent="."]
layout_mode = 0 layout_mode = 0
offset_left = 436.0 offset_left = 436.0
offset_top = 195.0 offset_top = 195.0
@ -63,6 +63,7 @@ select_mode = 1
allow_reselect = true allow_reselect = true
item_count = 6 item_count = 6
max_columns = 2 max_columns = 2
same_column_width = true
item_0/text = "SERVEUR LIVE RP:" item_0/text = "SERVEUR LIVE RP:"
item_0/selectable = false item_0/selectable = false
item_0/disabled = true item_0/disabled = true
@ -80,5 +81,5 @@ item_4/selectable = false
item_4/disabled = true item_4/disabled = true
item_5/text = "SPOFU" item_5/text = "SPOFU"
[connection signal="pressed" from="server" to="." method="_on_button_pressed"] [connection signal="pressed" from="button_server" to="." method="_on_button_pressed"]
[connection signal="pressed" from="return" to="." method="_on_return_pressed"] [connection signal="pressed" from="button_return" to="." method="_on_return_pressed"]

View file

@ -8,8 +8,8 @@ func _ready():
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta): #func _process(delta):
pass # pass
#func update_progress(): func _on_login_pressed():
#var progress = float(Globals.ressource_queue.get_progress( self.current_scene_path )) Global.load_scene(self, "game_world")

View file

@ -1,6 +1,6 @@
[gd_scene load_steps=4 format=3 uid="uid://4mkv26qkaqrg"] [gd_scene load_steps=4 format=3 uid="uid://4mkv26qkaqrg"]
[ext_resource type="Script" path="res://script/main.gd" id="1_71q6d"] [ext_resource type="Script" path="res://scenes/main.gd" id="1_71q6d"]
[ext_resource type="PackedScene" uid="uid://kkwgk2l7gu4n" path="res://scenes/interface/page_login.tscn" id="2_ui8jv"] [ext_resource type="PackedScene" uid="uid://kkwgk2l7gu4n" path="res://scenes/interface/page_login.tscn" id="2_ui8jv"]
[ext_resource type="PackedScene" uid="uid://bcgyiblimtc1f" path="res://scenes/interface/loading_screen.tscn" id="3_gg42t"] [ext_resource type="PackedScene" uid="uid://bcgyiblimtc1f" path="res://scenes/interface/loading_screen.tscn" id="3_gg42t"]
@ -12,4 +12,3 @@ script = ExtResource("1_71q6d")
[node name="main_menu" parent="." instance=ExtResource("2_ui8jv")] [node name="main_menu" parent="." instance=ExtResource("2_ui8jv")]
[node name="loading_screen" parent="." instance=ExtResource("3_gg42t")] [node name="loading_screen" parent="." instance=ExtResource("3_gg42t")]
visible = false

File diff suppressed because one or more lines are too long

47
script/global.gd Normal file
View file

@ -0,0 +1,47 @@
extends Node
const game_scenes = {
"scene_ile1_path": "res://scenes/iledetest.tscn"
}
var load_screen = preload("res://scenes/interface/loading_screen.tscn")
func load_scene(current_scene, next_scene):
var load_scene_instance = load_screen.instantiate()
get_tree().get_root().call_deferred("add_child", load_scene_instance)
var load_path: String
if game_scenes.has(next_scene):
load_path = game_scenes[next_scene]
else:
load_path = next_scene
var load_next_scene
if ResourceLoader.exists(load_path):
load_next_scene = ResourceLoader.load_threaded_request(load_path)
if load_next_scene == null:
print("error no loading screen existe !")
return
await load_scene_instance.safe_to_load
current_scene.queue_free()
while true:
var load_progress = []
var load_status = ResourceLoader.load_threaded_get_status(load_path, load_progress)
match load_status:
0:
print("error 0")
return
1:
load_scene_instance.get_node("control_background/progressBar").value = load_progress[0]
2:
print("error 2")
return
3:
var next_scene_instance = ResourceLoader.load_threaded_get(load_path).instantiate()
get_tree().get_root().call_deferred("add_child", next_scene_instance)
load_scene_instance.progress_bar()
return

View file

@ -0,0 +1,10 @@
extends CanvasGroup
signal safe_to_load
@onready var animprogress = $animation_progressBar
func progress_bar():
animprogress.play("fade_out")
await animprogress.animation_finished
queue_free()

View file

@ -7,6 +7,9 @@ func _ready():
func _on_login_pressed(): func _on_login_pressed():
get_tree().change_scene_to_file(scene_server_path) get_tree().change_scene_to_file(scene_server_path)
func _on_settings_pressed():
pass # Replace with function body.
func _on_quit_button_down(): func _on_quit_button_down():
get_tree().quit() get_tree().quit()

View file

@ -1,6 +1,6 @@
extends Control extends Control
const scene_ile1_path : String = "res://scenes/iledetest.tscn" #const scene_ile1_path : String = "res://scenes/iledetest.tscn"
const scene_return_path : String = "res://scenes/interface/page_server.tscn" const scene_return_path : String = "res://scenes/interface/page_server.tscn"
func _ready(): func _ready():
@ -8,11 +8,11 @@ func _ready():
func _on_perso_pressed(): func _on_perso_pressed():
get_tree().change_scene_to_file(scene_ile1_path) #get_tree().change_scene_to_file(scene_ile1_path)
Global.load_scene(self, "scene_ile1_path")
func _on_return_button_down(): func _on_return_button_down():
get_tree().change_scene_to_file(scene_return_path) get_tree().change_scene_to_file(scene_return_path)

View file

@ -1,6 +1,6 @@
extends Control extends Control
const scene_perso_path : String = "res://scenes/interface/page_perso.tscn" const scene_perso_path : String = "res://scenes/interface/page_player.tscn"
const scene_return_path : String = "res://scenes/interface/page_login.tscn" const scene_return_path : String = "res://scenes/interface/page_login.tscn"
func _ready(): func _ready():