From 440366b41829ce5785e7ef8b2f29a069c69f1ff4 Mon Sep 17 00:00:00 2001 From: Relintai Date: Thu, 16 Jun 2022 14:12:44 +0200 Subject: [PATCH] Udpated the engine to the latest. Also dpated mat_maker_gd, and MMMaterials to work with it. --- HEADS | 2 +- game/addons/mat_maker_gd/new_resource.tres | 74 ++++++------- .../mat_maker_gd/nodes/filter/colorize.gd | 2 +- .../mat_maker_gd/nodes/filter/tonality.gd | 4 +- .../nodes/gradient/circular_gradient.gd | 4 +- .../mat_maker_gd/nodes/gradient/gradient.gd | 4 +- .../nodes/gradient/radial_gradient.gd | 4 +- .../mat_maker_gd/nodes/sdf2d/sd_shape_line.gd | 4 +- .../nodes/sdf2d/sd_shape_polygon.gd | 2 +- .../nodes/sdf3d/sdf3d_shape_capsule.gd | 8 +- game/addons/mat_maker_gd/plugin.gd | 103 ++++++++++++------ .../widgets/curve_edit/curve_editor.tscn | 1 + .../gradient_editor/gradient_editor.tscn | 1 + .../windows/file_dialog/file_dialog.tscn | 1 + game/textures/world/bricks/test_brick.tres | 4 +- game/textures/world/dirt/dirt.tres | 10 +- game/textures/world/grass/grass.tres | 4 +- game/textures/world/grass/grass_mossy.tres | 4 +- game/textures/world/liquid/water.tres | 2 +- game/textures/world/stone/stone_1.tres | 4 +- .../textures/world/stone/stone_dungeon_1.tres | 4 +- 21 files changed, 140 insertions(+), 106 deletions(-) diff --git a/HEADS b/HEADS index 7bc446ed..4ae91c8e 100644 --- a/HEADS +++ b/HEADS @@ -1 +1 @@ -{"engine": {"3.2": "94a0fc47f7b4e90f8973f9adbfd3312579ed2825", "master": "8c73e813134001e575b6f59e3b0100471c007410", "3.x": "c4864a0e5f73a375259503ea1485794a6aad6df7"}, "world_generator": {"master": "260c430f11b0b591eaf4714516419aa327d2842c"}, "entity_spell_system": {"master": "3536f01bacf5f54cefb32b768cd020a1f94d0ade"}, "ui_extensions": {"master": "80a3b96fc56991a0f88a1d441ed1e3cebaf3307a"}, "voxelman": {"master": "65485930a20f65844d496b4ba47dec5b6ed70b91"}, "texture_packer": {"master": "ae4d222fbaade063ed6f0bc9f3aaa53df68a7fed"}, "fastnoise": {"master": "46bb1f610bfb7171613b5c708d312bcf94e89356"}, "mesh_data_resource": {"master": "a062d871d49d954c5466b9de54b4075cb61cbef4"}, "procedural_animations": {"master": "f8aae42bf06b3936cc6bd24cb18e1c3ec9f78f4f"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "props": {"master": "983090d21a08ebed30a5ce06681269819ab12e48"}, "mesh_utils": {"master": "b52a261c31f04fad624e5cfbcdcc4a45d61136da"}, "broken_seals_module": {"master": "52c5a81350db1c29d375c63d95010260911ec034"}, "thread_pool": {"master": "0917511d04bb1aa308385b63ec88d3c182990628"}, "terraman": {"master": "c72d8fc03295588fc18c5168ce351bd0c321ec5f"}, "pandemonium_engine": {"master": "67f3aba99455f4fce5100ec1a41c807a8db00581"}} \ No newline at end of file +{"engine": {"3.2": "94a0fc47f7b4e90f8973f9adbfd3312579ed2825", "master": "8c73e813134001e575b6f59e3b0100471c007410", "3.x": "c4864a0e5f73a375259503ea1485794a6aad6df7"}, "world_generator": {"master": "260c430f11b0b591eaf4714516419aa327d2842c"}, "entity_spell_system": {"master": "3536f01bacf5f54cefb32b768cd020a1f94d0ade"}, "ui_extensions": {"master": "80a3b96fc56991a0f88a1d441ed1e3cebaf3307a"}, "voxelman": {"master": "65485930a20f65844d496b4ba47dec5b6ed70b91"}, "texture_packer": {"master": "ae4d222fbaade063ed6f0bc9f3aaa53df68a7fed"}, "fastnoise": {"master": "46bb1f610bfb7171613b5c708d312bcf94e89356"}, "mesh_data_resource": {"master": "a062d871d49d954c5466b9de54b4075cb61cbef4"}, "procedural_animations": {"master": "f8aae42bf06b3936cc6bd24cb18e1c3ec9f78f4f"}, "ess_data": {"master": "3bd637fdd3304b64a18287a49a6b7387acf2f5de"}, "props": {"master": "983090d21a08ebed30a5ce06681269819ab12e48"}, "mesh_utils": {"master": "b52a261c31f04fad624e5cfbcdcc4a45d61136da"}, "broken_seals_module": {"master": "52c5a81350db1c29d375c63d95010260911ec034"}, "thread_pool": {"master": "0917511d04bb1aa308385b63ec88d3c182990628"}, "terraman": {"master": "c72d8fc03295588fc18c5168ce351bd0c321ec5f"}, "pandemonium_engine": {"master": "034aed2b7387595c88170eb41b050807e9788e9c"}} \ No newline at end of file diff --git a/game/addons/mat_maker_gd/new_resource.tres b/game/addons/mat_maker_gd/new_resource.tres index 3d322f68..80dc2269 100644 --- a/game/addons/mat_maker_gd/new_resource.tres +++ b/game/addons/mat_maker_gd/new_resource.tres @@ -37,7 +37,7 @@ output_slot_type = 0 [sub_resource type="MMNode" id=8] graph_position = Vector2( -160, 40 ) -output_properties = [ SubResource( 7 ), SubResource( 5 ), SubResource( 2 ), SubResource( 6 ) ] +output_properties = [ null, null, null, null, SubResource( 7 ), SubResource( 5 ), SubResource( 2 ), SubResource( 6 ) ] script = ExtResource( 3 ) out_nodes = SubResource( 7 ) out_borders = SubResource( 5 ) @@ -59,8 +59,8 @@ slot_name = ">>> Input1 " [sub_resource type="MMNode" id=11] graph_position = Vector2( 380, 80 ) -input_properties = [ SubResource( 10 ) ] -output_properties = [ SubResource( 9 ) ] +input_properties = [ null, SubResource( 10 ) ] +output_properties = [ null, SubResource( 9 ) ] script = ExtResource( 4 ) image = SubResource( 9 ) input = SubResource( 10 ) @@ -95,8 +95,8 @@ input_property = SubResource( 5 ) [sub_resource type="MMNode" id=17] graph_position = Vector2( 380, 380 ) -input_properties = [ SubResource( 16 ), SubResource( 15 ), SubResource( 14 ), SubResource( 13 ) ] -output_properties = [ SubResource( 12 ) ] +input_properties = [ null, null, null, null, SubResource( 16 ), SubResource( 15 ), SubResource( 14 ), SubResource( 13 ) ] +output_properties = [ null, SubResource( 12 ) ] script = ExtResource( 6 ) image = SubResource( 12 ) input_r = SubResource( 16 ) @@ -116,8 +116,8 @@ input_property = SubResource( 12 ) [sub_resource type="MMNode" id=20] graph_position = Vector2( 1080, 180 ) -input_properties = [ SubResource( 19 ) ] -output_properties = [ SubResource( 18 ) ] +input_properties = [ null, SubResource( 19 ) ] +output_properties = [ null, SubResource( 18 ) ] script = ExtResource( 7 ) image = SubResource( 18 ) input = SubResource( 19 ) @@ -134,8 +134,8 @@ input_property = SubResource( 12 ) [sub_resource type="MMNode" id=22] graph_position = Vector2( 560, 300 ) -input_properties = [ SubResource( 21 ) ] -output_properties = [ SubResource( 21 ) ] +input_properties = [ null, SubResource( 21 ) ] +output_properties = [ null, SubResource( 21 ) ] script = ExtResource( 8 ) input = SubResource( 21 ) @@ -151,8 +151,8 @@ input_property = SubResource( 21 ) [sub_resource type="MMNode" id=25] graph_position = Vector2( 860, 200 ) -input_properties = [ SubResource( 24 ) ] -output_properties = [ SubResource( 23 ) ] +input_properties = [ null, SubResource( 24 ) ] +output_properties = [ null, SubResource( 23 ) ] script = ExtResource( 9 ) image = SubResource( 23 ) input = SubResource( 24 ) @@ -172,8 +172,8 @@ input_property = SubResource( 21 ) [sub_resource type="MMNode" id=28] graph_position = Vector2( 620, 460 ) -input_properties = [ SubResource( 27 ) ] -output_properties = [ SubResource( 26 ) ] +input_properties = [ null, SubResource( 27 ) ] +output_properties = [ null, SubResource( 26 ) ] script = ExtResource( 10 ) image = SubResource( 26 ) input = SubResource( 27 ) @@ -192,8 +192,8 @@ input_property = SubResource( 21 ) [sub_resource type="MMNode" id=34] graph_position = Vector2( 820, 580 ) -input_properties = [ SubResource( 33 ) ] -output_properties = [ SubResource( 32 ) ] +input_properties = [ null, SubResource( 33 ) ] +output_properties = [ null, SubResource( 32 ) ] script = ExtResource( 12 ) image = SubResource( 32 ) input = SubResource( 33 ) @@ -211,8 +211,8 @@ slot_name = ">>> Input1 " [sub_resource type="MMNode" id=37] graph_position = Vector2( 1040, 560 ) -input_properties = [ SubResource( 36 ) ] -output_properties = [ SubResource( 35 ) ] +input_properties = [ null, SubResource( 36 ) ] +output_properties = [ null, SubResource( 35 ) ] script = ExtResource( 13 ) image = SubResource( 35 ) input = SubResource( 36 ) @@ -262,8 +262,8 @@ slot_name = "Scale Y" [sub_resource type="MMNode" id=45] graph_position = Vector2( 1280, 560 ) -input_properties = [ SubResource( 39 ), SubResource( 43 ), SubResource( 44 ), SubResource( 40 ), SubResource( 41 ), SubResource( 42 ) ] -output_properties = [ SubResource( 38 ) ] +input_properties = [ null, null, null, null, null, null, SubResource( 39 ), SubResource( 43 ), SubResource( 44 ), SubResource( 40 ), SubResource( 41 ), SubResource( 42 ) ] +output_properties = [ null, SubResource( 38 ) ] script = ExtResource( 11 ) image = SubResource( 38 ) input = SubResource( 39 ) @@ -286,8 +286,8 @@ input_property = SubResource( 23 ) [sub_resource type="MMNode" id=48] graph_position = Vector2( 620, 0 ) -input_properties = [ SubResource( 47 ) ] -output_properties = [ SubResource( 46 ) ] +input_properties = [ null, SubResource( 47 ) ] +output_properties = [ null, SubResource( 46 ) ] script = ExtResource( 14 ) points = [ 0.0, 0.0, 0.0, 1.0, 0.284455, 0.780757, 0.0, 0.0, 0.735577, 0.159306, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0 ] image = SubResource( 46 ) @@ -304,8 +304,8 @@ slot_name = ">>> Input " [sub_resource type="MMNode" id=51] graph_position = Vector2( 120, 440 ) -input_properties = [ SubResource( 50 ) ] -output_properties = [ SubResource( 49 ) ] +input_properties = [ null, SubResource( 50 ) ] +output_properties = [ null, SubResource( 49 ) ] script = ExtResource( 15 ) image = SubResource( 49 ) input = SubResource( 50 ) @@ -332,8 +332,8 @@ input_property = SubResource( 2 ) [sub_resource type="MMNode" id=55] graph_position = Vector2( -440, 200 ) -input_properties = [ SubResource( 54 ), SubResource( 52 ) ] -output_properties = [ SubResource( 53 ) ] +input_properties = [ null, null, SubResource( 54 ), SubResource( 52 ) ] +output_properties = [ null, SubResource( 53 ) ] script = ExtResource( 16 ) image = SubResource( 53 ) shape_type = 2 @@ -357,8 +357,8 @@ input_property = SubResource( 59 ) [sub_resource type="MMNode" id=58] graph_position = Vector2( 580, 800 ) -input_properties = [ SubResource( 57 ) ] -output_properties = [ SubResource( 56 ) ] +input_properties = [ null, SubResource( 57 ) ] +output_properties = [ null, SubResource( 56 ) ] script = ExtResource( 17 ) image = SubResource( 56 ) input = SubResource( 57 ) @@ -372,8 +372,8 @@ input_property = SubResource( 12 ) [sub_resource type="MMNode" id=61] graph_position = Vector2( 320, 700 ) -input_properties = [ SubResource( 60 ) ] -output_properties = [ SubResource( 59 ) ] +input_properties = [ null, SubResource( 60 ) ] +output_properties = [ null, SubResource( 59 ) ] script = ExtResource( 18 ) image = SubResource( 59 ) input = SubResource( 60 ) @@ -407,8 +407,8 @@ slot_name = " Output >>>" [sub_resource type="MMNode" id=66] graph_position = Vector2( -720, 280 ) -input_properties = [ SubResource( 63 ), SubResource( 64 ) ] -output_properties = [ SubResource( 62 ), SubResource( 65 ) ] +input_properties = [ null, null, SubResource( 63 ), SubResource( 64 ) ] +output_properties = [ null, null, SubResource( 62 ), SubResource( 65 ) ] script = ExtResource( 19 ) image = SubResource( 65 ) a = SubResource( 63 ) @@ -438,8 +438,8 @@ output_slot_type = 0 [sub_resource type="MMNode" id=71] graph_position = Vector2( -1060, 280 ) -input_properties = [ SubResource( 68 ), SubResource( 67 ) ] -output_properties = [ SubResource( 70 ), SubResource( 69 ) ] +input_properties = [ null, null, SubResource( 68 ), SubResource( 67 ) ] +output_properties = [ null, null, SubResource( 70 ), SubResource( 69 ) ] script = ExtResource( 20 ) input = SubResource( 68 ) in_mask = SubResource( 67 ) @@ -475,8 +475,8 @@ value_step = 0.05 [sub_resource type="MMNode" id=73] graph_position = Vector2( -340, -420 ) -input_properties = [ SubResource( 75 ), SubResource( 74 ) ] -output_properties = [ SubResource( 72 ) ] +input_properties = [ null, null, SubResource( 75 ), SubResource( 74 ) ] +output_properties = [ null, SubResource( 72 ) ] script = ExtResource( 16 ) image = SubResource( 72 ) shape_type = 1 @@ -497,8 +497,8 @@ input_property = SubResource( 72 ) [sub_resource type="MMNode" id=78] graph_position = Vector2( -80, -520 ) -input_properties = [ SubResource( 77 ) ] -output_properties = [ SubResource( 76 ) ] +input_properties = [ null, SubResource( 77 ) ] +output_properties = [ null, SubResource( 76 ) ] script = ExtResource( 1 ) interpolation_type = 2 points = PoolRealArray( 0, 0, 0, 0, 1, 0.458472, 0.921875, 0.860657, 0.860657, 1, 1, 1, 0, 0, 1 ) diff --git a/game/addons/mat_maker_gd/nodes/filter/colorize.gd b/game/addons/mat_maker_gd/nodes/filter/colorize.gd index ab40c52b..438a70c0 100644 --- a/game/addons/mat_maker_gd/nodes/filter/colorize.gd +++ b/game/addons/mat_maker_gd/nodes/filter/colorize.gd @@ -1,5 +1,5 @@ tool -extends "res://addons/mat_maker_gd/nodes/bases/gradient_base.gd" +extends GradientBase export(Resource) var image : Resource export(Resource) var input : Resource diff --git a/game/addons/mat_maker_gd/nodes/filter/tonality.gd b/game/addons/mat_maker_gd/nodes/filter/tonality.gd index 9d7d8649..bdf4e5ec 100644 --- a/game/addons/mat_maker_gd/nodes/filter/tonality.gd +++ b/game/addons/mat_maker_gd/nodes/filter/tonality.gd @@ -1,5 +1,5 @@ tool -extends "res://addons/mat_maker_gd/nodes/bases/curve_base.gd" +extends CurveBase export(Resource) var image : Resource export(Resource) var input : Resource @@ -40,7 +40,7 @@ func _render(material) -> void: func _get_value_for(uv : Vector2, pseed : int) -> Color: var f : float = input.get_value(uv) - var cf : float = MMAlgos.curve(f, points) + var cf : float = MMAlgos.curve(f, points_array) return Color(cf, cf, cf, 1) diff --git a/game/addons/mat_maker_gd/nodes/gradient/circular_gradient.gd b/game/addons/mat_maker_gd/nodes/gradient/circular_gradient.gd index fa676635..e1d85614 100644 --- a/game/addons/mat_maker_gd/nodes/gradient/circular_gradient.gd +++ b/game/addons/mat_maker_gd/nodes/gradient/circular_gradient.gd @@ -1,5 +1,5 @@ tool -extends "res://addons/mat_maker_gd/nodes/bases/gradient_base.gd" +extends GradientBase export(Resource) var image : Resource export(float) var repeat : float = 1 @@ -36,7 +36,7 @@ func _get_value_for(uv : Vector2, pseed : int) -> Color: return Color(1, 1, 1, 1) -func get_gradient_color(x : float) -> Color: +func _get_gradient_color(x : float) -> Color: if interpolation_type == 0: return MMAlgos.gradient_type_1(x, points) elif interpolation_type == 1: diff --git a/game/addons/mat_maker_gd/nodes/gradient/gradient.gd b/game/addons/mat_maker_gd/nodes/gradient/gradient.gd index 9dca4d9d..42abef71 100644 --- a/game/addons/mat_maker_gd/nodes/gradient/gradient.gd +++ b/game/addons/mat_maker_gd/nodes/gradient/gradient.gd @@ -1,5 +1,5 @@ tool -extends "res://addons/mat_maker_gd/nodes/bases/gradient_base.gd" +extends GradientBase export(Resource) var image : Resource export(float) var repeat : float = 1 @@ -37,7 +37,7 @@ func _get_value_for(uv : Vector2, pseed : int) -> Color: return Color(1, 1, 1, 1) -func get_gradient_color(x : float) -> Color: +func _get_gradient_color(x : float) -> Color: if interpolation_type == 0: return MMAlgos.gradient_type_1(x, points) elif interpolation_type == 1: diff --git a/game/addons/mat_maker_gd/nodes/gradient/radial_gradient.gd b/game/addons/mat_maker_gd/nodes/gradient/radial_gradient.gd index 386f1d39..8eeed271 100644 --- a/game/addons/mat_maker_gd/nodes/gradient/radial_gradient.gd +++ b/game/addons/mat_maker_gd/nodes/gradient/radial_gradient.gd @@ -1,5 +1,5 @@ tool -extends "res://addons/mat_maker_gd/nodes/bases/gradient_base.gd" +extends GradientBase export(Resource) var image : Resource export(float) var repeat : float = 1 @@ -36,7 +36,7 @@ func _get_value_for(uv : Vector2, pseed : int) -> Color: return Color(1, 1, 1, 1) -func get_gradient_color(x : float) -> Color: +func _get_gradient_color(x : float) -> Color: if interpolation_type == 0: return MMAlgos.gradient_type_1(x, points) elif interpolation_type == 1: diff --git a/game/addons/mat_maker_gd/nodes/sdf2d/sd_shape_line.gd b/game/addons/mat_maker_gd/nodes/sdf2d/sd_shape_line.gd index 0d53b6db..f4744da4 100644 --- a/game/addons/mat_maker_gd/nodes/sdf2d/sd_shape_line.gd +++ b/game/addons/mat_maker_gd/nodes/sdf2d/sd_shape_line.gd @@ -1,5 +1,5 @@ tool -extends "res://addons/mat_maker_gd/nodes/bases/curve_base.gd" +extends CurveBase export(Resource) var output : Resource export(Vector2) var A : Vector2 = Vector2(-0.3, -0.3) @@ -33,7 +33,7 @@ func _get_property_value(uv : Vector2) -> float: #$(name_uv)_sdl.x - $r * $profile($(name_uv)_sdl.y) - return line.x - width * MMAlgos.curve(line.y, points) + return line.x - width * MMAlgos.curve(line.y, points_array) #a func get_a() -> Vector2: diff --git a/game/addons/mat_maker_gd/nodes/sdf2d/sd_shape_polygon.gd b/game/addons/mat_maker_gd/nodes/sdf2d/sd_shape_polygon.gd index 267c94d5..c52e1381 100644 --- a/game/addons/mat_maker_gd/nodes/sdf2d/sd_shape_polygon.gd +++ b/game/addons/mat_maker_gd/nodes/sdf2d/sd_shape_polygon.gd @@ -1,5 +1,5 @@ tool -extends "res://addons/mat_maker_gd/nodes/bases/polygon_base.gd" +extends PolygonBase export(Resource) var output : Resource diff --git a/game/addons/mat_maker_gd/nodes/sdf3d/sdf3d_shape_capsule.gd b/game/addons/mat_maker_gd/nodes/sdf3d/sdf3d_shape_capsule.gd index 12e8348c..a6b38dea 100644 --- a/game/addons/mat_maker_gd/nodes/sdf3d/sdf3d_shape_capsule.gd +++ b/game/addons/mat_maker_gd/nodes/sdf3d/sdf3d_shape_capsule.gd @@ -1,5 +1,5 @@ tool -extends "res://addons/mat_maker_gd/nodes/bases/curve_base.gd" +extends CurveBase export(Resource) var output : Resource export(int, "X,Y,Z") var axis : int = 1 @@ -47,7 +47,7 @@ func sdf3d_capsule_y(p : Vector3, r : float, l : float) -> Vector2: v.y -= clamp(v.y, -l, l); var cx : float = clamp(0.5 + 0.5 * p.y / l, 0.0, 1.0) - var cp : float = MMAlgos.curve(cx, points) + var cp : float = MMAlgos.curve(cx, points_array) var f : float = v.length() - r * cp return Vector2(f, 0.0); @@ -57,7 +57,7 @@ func sdf3d_capsule_x(p : Vector3, r : float, l : float) -> Vector2: v.x -= clamp(v.x, -l, l); var cx : float = clamp(0.5 + 0.5 * p.x / l, 0.0, 1.0) - var cp : float = MMAlgos.curve(cx, points) + var cp : float = MMAlgos.curve(cx, points_array) var f : float = v.length() - r * cp return Vector2(f, 0.0); @@ -67,7 +67,7 @@ func sdf3d_capsule_z(p : Vector3, r : float, l : float) -> Vector2: v.z -= clamp(v.z, -l, l); var cx : float = clamp(0.5 + 0.5 * p.z / l, 0.0, 1.0) - var cp : float = MMAlgos.curve(cx, points) + var cp : float = MMAlgos.curve(cx, points_array) var f : float = v.length() - r * cp return Vector2(f, 0.0); diff --git a/game/addons/mat_maker_gd/plugin.gd b/game/addons/mat_maker_gd/plugin.gd index 38bc3a16..1895a6be 100644 --- a/game/addons/mat_maker_gd/plugin.gd +++ b/game/addons/mat_maker_gd/plugin.gd @@ -1,47 +1,78 @@ tool extends EditorPlugin -var editor_packed_scene = preload("res://addons/mat_maker_gd/editor/MatMakerGDEditor.tscn") -var editor_scene = null +#var editor_packed_scene = preload("res://addons/mat_maker_gd/editor/MatMakerGDEditor.tscn") +#var editor_scene = null +#var tool_button : ToolButton = null -var tool_button : ToolButton = null +var folders : PoolStringArray = [ + "res://addons/mat_maker_gd/nodes/uniform", + "res://addons/mat_maker_gd/nodes/noise", + "res://addons/mat_maker_gd/nodes/filter", + "res://addons/mat_maker_gd/nodes/gradient", + "res://addons/mat_maker_gd/nodes/pattern", + "res://addons/mat_maker_gd/nodes/sdf2d", + "res://addons/mat_maker_gd/nodes/sdf3d", + "res://addons/mat_maker_gd/nodes/transform", + "res://addons/mat_maker_gd/nodes/simple", + "res://addons/mat_maker_gd/nodes/other", +] func _enter_tree(): - editor_scene = editor_packed_scene.instance() - editor_scene.set_plugin(self) - - tool_button = add_control_to_bottom_panel(editor_scene, "MMGD") - tool_button.hide() - -func _exit_tree(): - remove_control_from_bottom_panel(editor_scene) - - if editor_scene: - editor_scene.queue_free() - - editor_scene = null - tool_button = null + for s in folders: + evaluate_folder(s) -func handles(object): - return object is MMMaterial - -func edit(object): - #if editor_scene: - # make_bottom_panel_item_visible(editor_scene) - - if object is MMMaterial: - editor_scene.set_mmmaterial(object as MMMaterial) +func evaluate_folder(folder : String) -> void: + var category : String = folder.substr(folder.find_last("/") + 1) -func make_visible(visible): - if tool_button: - if visible: - tool_button.show() - else: - #if tool_button.pressed: - # tool_button.pressed = false - - if !tool_button.pressed: - tool_button.hide() + var dir = Directory.new() + if dir.open(folder) == OK: + dir.list_dir_begin() + var file_name = dir.get_next() + while file_name != "": + if !dir.current_is_dir(): + #print("Found file: " + file_name) + var file : String = folder + "/" + file_name + + MMAlgos.register_node_script(category, file) + + file_name = dir.get_next() + else: + print("An error occurred when trying to access the path.") + +#func _enter_tree(): +# editor_scene = editor_packed_scene.instance() +# editor_scene.set_plugin(self) +# tool_button = add_control_to_bottom_panel(editor_scene, "MMGD") +# tool_button.hide() + +#func _exit_tree(): +# remove_control_from_bottom_panel(editor_scene) +# if editor_scene: +# editor_scene.queue_free() +# editor_scene = null +# tool_button = null + +#func handles(object): +# return object is MMMaterial +# +#func edit(object): +# #if editor_scene: +# # make_bottom_panel_item_visible(editor_scene) +# +# if object is MMMaterial: +# editor_scene.set_mmmaterial(object as MMMaterial) +# +#func make_visible(visible): +# if tool_button: +# if visible: +# tool_button.show() +# else: +# #if tool_button.pressed: +# # tool_button.pressed = false +# +# if !tool_button.pressed: +# tool_button.hide() func get_plugin_icon(): return null diff --git a/game/addons/mat_maker_gd/widgets/curve_edit/curve_editor.tscn b/game/addons/mat_maker_gd/widgets/curve_edit/curve_editor.tscn index 60d5c386..d8c79359 100644 --- a/game/addons/mat_maker_gd/widgets/curve_edit/curve_editor.tscn +++ b/game/addons/mat_maker_gd/widgets/curve_edit/curve_editor.tscn @@ -10,4 +10,5 @@ margin_right = -10.0 margin_bottom = -10.0 mouse_filter = 0 script = ExtResource( 2 ) + [connection signal="gui_input" from="." to="." method="_on_CurveEditor_gui_input"] diff --git a/game/addons/mat_maker_gd/widgets/gradient_editor/gradient_editor.tscn b/game/addons/mat_maker_gd/widgets/gradient_editor/gradient_editor.tscn index 7293cc5b..5dc99e54 100644 --- a/game/addons/mat_maker_gd/widgets/gradient_editor/gradient_editor.tscn +++ b/game/addons/mat_maker_gd/widgets/gradient_editor/gradient_editor.tscn @@ -41,6 +41,7 @@ margin_bottom = 30.0 rect_min_size = Vector2( 120, 32 ) focus_mode = 1 script = ExtResource( 1 ) +embedded = true [node name="Background" type="ColorRect" parent="."] material = SubResource( 2 ) diff --git a/game/addons/mat_maker_gd/windows/file_dialog/file_dialog.tscn b/game/addons/mat_maker_gd/windows/file_dialog/file_dialog.tscn index a95bb780..ec783c49 100644 --- a/game/addons/mat_maker_gd/windows/file_dialog/file_dialog.tscn +++ b/game/addons/mat_maker_gd/windows/file_dialog/file_dialog.tscn @@ -7,6 +7,7 @@ margin_right = 360.0 margin_bottom = 130.0 window_title = "Enregistrer un fichier" resizable = true +show_hidden_files = true script = ExtResource( 1 ) [connection signal="dir_selected" from="." to="." method="_on_FileDialog_dir_selected"] diff --git a/game/textures/world/bricks/test_brick.tres b/game/textures/world/bricks/test_brick.tres index a944a59d..579ca6d1 100644 --- a/game/textures/world/bricks/test_brick.tres +++ b/game/textures/world/bricks/test_brick.tres @@ -123,7 +123,7 @@ default_vector3 = Vector3( 0, 0, 0 ) default_color = Color( 0, 0, 0, 1 ) input_property = SubResource( 4 ) -[sub_resource type="MMNode" id=14] +[sub_resource type="GradientBase" id=14] script = ExtResource( 8 ) graph_position = Vector2( 240, 200 ) interpolation_type = 1 @@ -209,7 +209,7 @@ default_vector3 = Vector3( 0, 0, 0 ) default_color = Color( 0, 0, 0, 1 ) input_property = SubResource( 20 ) -[sub_resource type="MMNode" id=24] +[sub_resource type="GradientBase" id=24] script = ExtResource( 8 ) graph_position = Vector2( 500, -300 ) interpolation_type = 1 diff --git a/game/textures/world/dirt/dirt.tres b/game/textures/world/dirt/dirt.tres index b7707920..03cd7ea2 100644 --- a/game/textures/world/dirt/dirt.tres +++ b/game/textures/world/dirt/dirt.tres @@ -41,7 +41,7 @@ default_vector3 = Vector3( 0, 0, 0 ) default_color = Color( 0, 0, 0, 1 ) input_property = SubResource( 1 ) -[sub_resource type="MMNode" id=4] +[sub_resource type="GradientBase" id=4] script = ExtResource( 4 ) graph_position = Vector2( -260, -80 ) interpolation_type = 1 @@ -92,7 +92,7 @@ default_vector3 = Vector3( 0, 0, 0 ) default_color = Color( 0, 0, 0, 1 ) input_property = SubResource( 5 ) -[sub_resource type="MMNode" id=9] +[sub_resource type="GradientBase" id=9] script = ExtResource( 4 ) graph_position = Vector2( 180, -80 ) interpolation_type = 1 @@ -135,7 +135,7 @@ default_vector3 = Vector3( 0, 0, 0 ) default_color = Color( 0, 0, 0, 1 ) input_property = SubResource( 10 ) -[sub_resource type="MMNode" id=13] +[sub_resource type="GradientBase" id=13] script = ExtResource( 4 ) graph_position = Vector2( -260, 360 ) interpolation_type = 1 @@ -332,7 +332,7 @@ default_vector3 = Vector3( 0, 0, 0 ) default_color = Color( 0, 0, 0, 1 ) input_property = SubResource( 21 ) -[sub_resource type="MMNode" id=35] +[sub_resource type="GradientBase" id=35] script = ExtResource( 4 ) graph_position = Vector2( -240, 940 ) interpolation_type = 1 @@ -349,7 +349,7 @@ default_vector3 = Vector3( 0, 0, 0 ) default_color = Color( 0, 0, 0, 1 ) input_property = SubResource( 22 ) -[sub_resource type="MMNode" id=36] +[sub_resource type="GradientBase" id=36] script = ExtResource( 4 ) graph_position = Vector2( 0, 940 ) interpolation_type = 1 diff --git a/game/textures/world/grass/grass.tres b/game/textures/world/grass/grass.tres index 6abda197..8b7c251f 100644 --- a/game/textures/world/grass/grass.tres +++ b/game/textures/world/grass/grass.tres @@ -92,7 +92,7 @@ default_vector3 = Vector3( 0, 0, 0 ) default_color = Color( 0, 0, 0, 1 ) input_property = SubResource( 14 ) -[sub_resource type="MMNode" id=10] +[sub_resource type="GradientBase" id=10] script = ExtResource( 2 ) graph_position = Vector2( 220, 40 ) interpolation_type = 1 @@ -125,7 +125,7 @@ default_vector3 = Vector3( 0, 0, 0 ) default_color = Color( 0, 0, 0, 1 ) input_property = SubResource( 19 ) -[sub_resource type="MMNode" id=13] +[sub_resource type="GradientBase" id=13] script = ExtResource( 2 ) graph_position = Vector2( 220, 640 ) interpolation_type = 1 diff --git a/game/textures/world/grass/grass_mossy.tres b/game/textures/world/grass/grass_mossy.tres index df08c86f..c710d2d8 100644 --- a/game/textures/world/grass/grass_mossy.tres +++ b/game/textures/world/grass/grass_mossy.tres @@ -92,7 +92,7 @@ default_vector3 = Vector3( 0, 0, 0 ) default_color = Color( 0, 0, 0, 1 ) input_property = SubResource( 14 ) -[sub_resource type="MMNode" id=10] +[sub_resource type="GradientBase" id=10] script = ExtResource( 2 ) graph_position = Vector2( 220, 40 ) interpolation_type = 1 @@ -125,7 +125,7 @@ default_vector3 = Vector3( 0, 0, 0 ) default_color = Color( 0, 0, 0, 1 ) input_property = SubResource( 28 ) -[sub_resource type="MMNode" id=13] +[sub_resource type="GradientBase" id=13] script = ExtResource( 2 ) graph_position = Vector2( 220, 640 ) interpolation_type = 1 diff --git a/game/textures/world/liquid/water.tres b/game/textures/world/liquid/water.tres index f68509f9..25df031d 100644 --- a/game/textures/world/liquid/water.tres +++ b/game/textures/world/liquid/water.tres @@ -40,7 +40,7 @@ default_vector3 = Vector3( 0, 0, 0 ) default_color = Color( 0, 0, 0, 1 ) input_property = SubResource( 1 ) -[sub_resource type="MMNode" id=5] +[sub_resource type="GradientBase" id=5] script = ExtResource( 4 ) graph_position = Vector2( 260, 0 ) interpolation_type = 1 diff --git a/game/textures/world/stone/stone_1.tres b/game/textures/world/stone/stone_1.tres index d45fd511..1003090d 100644 --- a/game/textures/world/stone/stone_1.tres +++ b/game/textures/world/stone/stone_1.tres @@ -85,7 +85,7 @@ default_vector3 = Vector3( 0, 0, 0 ) default_color = Color( 0, 0, 0, 1 ) input_property = SubResource( 1 ) -[sub_resource type="MMNode" id=10] +[sub_resource type="GradientBase" id=10] script = ExtResource( 7 ) graph_position = Vector2( 360, 20 ) interpolation_type = 1 @@ -153,7 +153,7 @@ default_vector3 = Vector3( 0, 0, 0 ) default_color = Color( 0, 0, 0, 1 ) input_property = SubResource( 11 ) -[sub_resource type="MMNode" id=18] +[sub_resource type="GradientBase" id=18] script = ExtResource( 7 ) graph_position = Vector2( 860, 140 ) interpolation_type = 1 diff --git a/game/textures/world/stone/stone_dungeon_1.tres b/game/textures/world/stone/stone_dungeon_1.tres index d1546331..980b646d 100644 --- a/game/textures/world/stone/stone_dungeon_1.tres +++ b/game/textures/world/stone/stone_dungeon_1.tres @@ -67,7 +67,7 @@ default_vector3 = Vector3( 0, 0, 0 ) default_color = Color( 0, 0, 0, 1 ) input_property = SubResource( 1 ) -[sub_resource type="MMNode" id=8] +[sub_resource type="GradientBase" id=8] script = ExtResource( 7 ) graph_position = Vector2( 280, 20 ) interpolation_type = 1 @@ -179,7 +179,7 @@ default_vector3 = Vector3( 0, 0, 0 ) default_color = Color( 0, 0, 0, 1 ) input_property = SubResource( 23 ) -[sub_resource type="MMNode" id=20] +[sub_resource type="GradientBase" id=20] script = ExtResource( 7 ) graph_position = Vector2( 1060, 340 ) interpolation_type = 1