mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-04 23:10:08 +01:00
Update most demos for Godot 4.0.beta10 (#782)
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture2D"
|
||||
path="res://.godot/imported/heart.png-53d6538480df02caf4bbbee10b65a623.stex"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bs4k1qi5vdken"
|
||||
path="res://.godot/imported/heart.png-53d6538480df02caf4bbbee10b65a623.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
@@ -10,26 +11,24 @@ metadata={
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/custom_node/heart.png"
|
||||
dest_files=["res://.godot/imported/heart.png-53d6538480df02caf4bbbee10b65a623.stex"]
|
||||
dest_files=["res://.godot/imported/heart.png-53d6538480df02caf4bbbee10b65a623.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/hdr_compression=1
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture2D"
|
||||
path="res://.godot/imported/heart_icon.png-8f04adf78b3bd1a5c39f790588a1fa78.stex"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bjgimovw2g5qv"
|
||||
path="res://.godot/imported/heart_icon.png-8f04adf78b3bd1a5c39f790588a1fa78.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
@@ -10,26 +11,24 @@ metadata={
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/custom_node/heart_icon.png"
|
||||
dest_files=["res://.godot/imported/heart_icon.png-8f04adf78b3bd1a5c39f790588a1fa78.stex"]
|
||||
dest_files=["res://.godot/imported/heart_icon.png-8f04adf78b3bd1a5c39f790588a1fa78.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/hdr_compression=1
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
process/normal_map_invert_y=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
[gd_scene load_steps=2 format=3 uid="uid://b8623u0gk1acu"]
|
||||
|
||||
[ext_resource path="res://addons/main_screen/print_hello.gd" type="Script" id=1]
|
||||
[ext_resource type="Script" path="res://addons/main_screen/print_hello.gd" id="1"]
|
||||
|
||||
[node name="MainPanel" type="CenterContainer"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_vertical = 3
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="PrintHello" type="Button" parent="."]
|
||||
offset_left = 472.0
|
||||
offset_top = 290.0
|
||||
offset_right = 552.0
|
||||
offset_bottom = 310.0
|
||||
text = "Print Hello"
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
layout_mode = 2
|
||||
offset_left = 460.0
|
||||
offset_top = 297.0
|
||||
offset_right = 691.0
|
||||
offset_bottom = 351.0
|
||||
text = "Print Hello
|
||||
(check Output bottom panel)"
|
||||
script = ExtResource("1")
|
||||
|
||||
[connection signal="pressed" from="PrintHello" to="PrintHello" method="_on_PrintHello_pressed"]
|
||||
|
||||
@@ -8,9 +8,9 @@ var main_panel_instance
|
||||
func _enter_tree():
|
||||
main_panel_instance = MainPanel.instantiate()
|
||||
# Add the main panel to the editor's main viewport.
|
||||
get_editor_interface().get_editor_viewport().add_child(main_panel_instance)
|
||||
get_editor_interface().get_editor_main_screen().add_child(main_panel_instance)
|
||||
# Hide the main panel. Very much required.
|
||||
make_visible(false)
|
||||
_make_visible(false)
|
||||
|
||||
|
||||
func _exit_tree():
|
||||
@@ -18,24 +18,24 @@ func _exit_tree():
|
||||
main_panel_instance.queue_free()
|
||||
|
||||
|
||||
func has_main_screen():
|
||||
func _has_main_screen():
|
||||
return true
|
||||
|
||||
|
||||
func make_visible(visible):
|
||||
func _make_visible(visible):
|
||||
if main_panel_instance:
|
||||
main_panel_instance.visible = visible
|
||||
|
||||
|
||||
# If your plugin doesn't handle any node types, you can remove this method.
|
||||
func handles(obj):
|
||||
return obj is preload("res://addons/main_screen/handled_by_main_screen.gd")
|
||||
func _handles(object):
|
||||
return object is preload("res://addons/main_screen/handled_by_main_screen.gd")
|
||||
|
||||
|
||||
func get_plugin_name():
|
||||
func _get_plugin_name():
|
||||
return "Main Screen Plugin"
|
||||
|
||||
|
||||
func get_plugin_icon():
|
||||
func _get_plugin_icon():
|
||||
# Must return some kind of Texture2D for the icon.
|
||||
return get_editor_interface().get_base_control().get_icon("Node", "EditorIcons")
|
||||
return get_editor_interface().get_base_control().get_theme_icon("Node", "EditorIcons")
|
||||
|
||||
@@ -6,12 +6,12 @@ var silly_material_resource = preload("res://addons/material_creator/material_re
|
||||
var editor_interface
|
||||
|
||||
func _ready():
|
||||
# Connect all of the signals we'll need to save and load silly materials
|
||||
get_node(^"VBoxContainer/ApplyButton").connect(&"pressed", self.apply_pressed)
|
||||
get_node(^"VBoxContainer/SaveButton").connect(&"pressed", self.save_pressed)
|
||||
get_node(^"VBoxContainer/LoadButton").connect(&"pressed", self.load_pressed)
|
||||
get_node(^"SaveMaterialDialog").connect(&"file_selected", self.save_file_selected)
|
||||
get_node(^"LoadMaterialDialog").connect(&"file_selected", self.load_file_selected)
|
||||
# Connect all of the signals we'll need to save and load silly materials.
|
||||
get_node(^"VBoxContainer/ApplyButton").pressed.connect(self.apply_pressed)
|
||||
get_node(^"VBoxContainer/SaveButton").pressed.connect(self.save_pressed)
|
||||
get_node(^"VBoxContainer/LoadButton").pressed.connect(self.load_pressed)
|
||||
get_node(^"SaveMaterialDialog").file_selected.connect(self.save_file_selected)
|
||||
get_node(^"LoadMaterialDialog").file_selected.connect(self.load_file_selected)
|
||||
RenderingServer.canvas_item_set_clip(get_canvas_item(), true)
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ func load_pressed():
|
||||
|
||||
|
||||
func apply_pressed():
|
||||
# Using the passed in editor interface, get the selected nodes in the editor
|
||||
# Using the passed in editor interface, get the selected nodes in the editor.
|
||||
var editor_selection = editor_interface.get_selection()
|
||||
var selected_nodes = editor_selection.get_selected_nodes()
|
||||
if selected_nodes.size() == 0:
|
||||
@@ -41,58 +41,53 @@ func apply_pressed():
|
||||
|
||||
func save_file_selected(path):
|
||||
var silly_resource = _silly_resource_from_values()
|
||||
# Make a file, store the silly material as a json string, then close the file.
|
||||
var file = File.new()
|
||||
file.open(path, File.WRITE)
|
||||
# Make a file, store the silly material as a JSON string.
|
||||
var file = FileAccess.open(path, FileAccess.WRITE)
|
||||
file.store_string(silly_resource.make_json())
|
||||
file.close()
|
||||
|
||||
return true
|
||||
|
||||
|
||||
func load_file_selected(path):
|
||||
var file = File.new()
|
||||
var SpatialMaterial_Silly = null
|
||||
|
||||
# Make a new silly resource (which in this case actually is a node)
|
||||
# and initialize it
|
||||
# and initialize it.
|
||||
var silly_resource = silly_material_resource.new()
|
||||
silly_resource.init()
|
||||
|
||||
# If the file exists, then open it
|
||||
if file.file_exists(path):
|
||||
file.open(path, File.READ)
|
||||
# If the file exists, then open it.
|
||||
if FileAccess.file_exists(path):
|
||||
var file = FileAccess.open(path, FileAccess.READ)
|
||||
|
||||
# Get the JSON string and convert it into a silly material.
|
||||
var json_dict_as_string = file.get_line()
|
||||
if json_dict_as_string != null:
|
||||
silly_resource.from_json(json_dict_as_string)
|
||||
else:
|
||||
file.close()
|
||||
return false
|
||||
|
||||
get_node(^"VBoxContainer/AlbedoColorPicker").color = silly_resource.albedo_color
|
||||
get_node(^"VBoxContainer/MetallicSlider").value = silly_resource.metallic_strength
|
||||
get_node(^"VBoxContainer/RoughnessSlider").value = silly_resource.roughness_strength
|
||||
|
||||
# Close the file and return true (success!)
|
||||
file.close()
|
||||
# Return `true` to indicate success.
|
||||
return true
|
||||
|
||||
#else: If the file does not exist, then return false (failure)
|
||||
# If the file does not exist, then return `false` to indicate failure.
|
||||
return false
|
||||
|
||||
|
||||
func _silly_resource_from_values():
|
||||
# Get the values from the sliders and color picker
|
||||
# Get the values from the sliders and color picker.
|
||||
var color = get_node(^"VBoxContainer/AlbedoColorPicker").color
|
||||
var metallic = get_node(^"VBoxContainer/MetallicSlider").value
|
||||
var roughness = get_node(^"VBoxContainer/RoughnessSlider").value
|
||||
# Make a new silly resource (which in this case actually is a node) and initialize it
|
||||
# Make a new silly resource (which in this case actually is a node) and initialize it.
|
||||
var silly_resource = silly_material_resource.new()
|
||||
silly_resource.init()
|
||||
|
||||
# Assign the values
|
||||
# Assign the values.
|
||||
silly_resource.albedo_color = color
|
||||
silly_resource.metallic_strength = metallic
|
||||
silly_resource.roughness_strength = roughness
|
||||
|
||||
@@ -1,139 +1,106 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
[gd_scene load_steps=2 format=3 uid="uid://n44d53us24uu"]
|
||||
|
||||
[ext_resource path="res://addons/material_creator/material_creator.gd" type="Script" id=1]
|
||||
[ext_resource type="Script" path="res://addons/material_creator/material_creator.gd" id="1"]
|
||||
|
||||
[node name="Material Creator Plugin" type="Panel"]
|
||||
offset_right = 220.0
|
||||
offset_bottom = 340.0
|
||||
rect_min_size = Vector2(210, 410)
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
script = ExtResource("1")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
anchors_preset = 13
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -100.0
|
||||
offset_right = 100.0
|
||||
rect_min_size = Vector2(0, 400)
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="DockName" type="Label" parent="VBoxContainer"]
|
||||
offset_right = 200.0
|
||||
offset_bottom = 30.0
|
||||
rect_min_size = Vector2(200, 30)
|
||||
custom_constants/shadow_as_outline = 1
|
||||
offset_bottom = 26.0
|
||||
text = "Material creator"
|
||||
align = 1
|
||||
valign = 2
|
||||
|
||||
[node name="AlbedoLabel" type="Label" parent="VBoxContainer"]
|
||||
offset_top = 34.0
|
||||
offset_top = 30.0
|
||||
offset_right = 200.0
|
||||
offset_bottom = 64.0
|
||||
rect_min_size = Vector2(200, 30)
|
||||
offset_bottom = 56.0
|
||||
text = "Albedo color"
|
||||
align = 1
|
||||
valign = 2
|
||||
|
||||
[node name="AlbedoColorPicker" type="ColorPickerButton" parent="VBoxContainer"]
|
||||
offset_top = 68.0
|
||||
offset_top = 60.0
|
||||
offset_right = 200.0
|
||||
offset_bottom = 98.0
|
||||
rect_min_size = Vector2(200, 30)
|
||||
offset_bottom = 68.0
|
||||
color = Color(1, 1, 1, 1)
|
||||
|
||||
[node name="MetallicLabel" type="Label" parent="VBoxContainer"]
|
||||
offset_top = 102.0
|
||||
offset_top = 72.0
|
||||
offset_right = 200.0
|
||||
offset_bottom = 132.0
|
||||
rect_min_size = Vector2(200, 30)
|
||||
offset_bottom = 98.0
|
||||
text = "Metallic strength"
|
||||
align = 1
|
||||
valign = 2
|
||||
|
||||
[node name="MetallicSlider" type="HSlider" parent="VBoxContainer"]
|
||||
offset_top = 136.0
|
||||
offset_top = 102.0
|
||||
offset_right = 200.0
|
||||
offset_bottom = 166.0
|
||||
rect_min_size = Vector2(200, 30)
|
||||
offset_bottom = 118.0
|
||||
max_value = 1.0
|
||||
step = 0.05
|
||||
|
||||
[node name="RoughnessLabel" type="Label" parent="VBoxContainer"]
|
||||
offset_top = 170.0
|
||||
offset_top = 122.0
|
||||
offset_right = 200.0
|
||||
offset_bottom = 200.0
|
||||
rect_min_size = Vector2(200, 30)
|
||||
offset_bottom = 148.0
|
||||
text = "Roughness strength"
|
||||
align = 1
|
||||
valign = 2
|
||||
|
||||
[node name="RoughnessSlider" type="HSlider" parent="VBoxContainer"]
|
||||
offset_top = 204.0
|
||||
offset_top = 152.0
|
||||
offset_right = 200.0
|
||||
offset_bottom = 234.0
|
||||
rect_min_size = Vector2(200, 30)
|
||||
offset_bottom = 168.0
|
||||
max_value = 1.0
|
||||
step = 0.05
|
||||
ticks_on_borders = true
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="VBoxContainer"]
|
||||
offset_top = 238.0
|
||||
offset_top = 172.0
|
||||
offset_right = 200.0
|
||||
offset_bottom = 258.0
|
||||
rect_min_size = Vector2(200, 20)
|
||||
offset_bottom = 176.0
|
||||
|
||||
[node name="ApplyButton" type="Button" parent="VBoxContainer"]
|
||||
offset_top = 262.0
|
||||
offset_top = 180.0
|
||||
offset_right = 200.0
|
||||
offset_bottom = 312.0
|
||||
rect_min_size = Vector2(200, 50)
|
||||
offset_bottom = 211.0
|
||||
text = "Apply material"
|
||||
|
||||
[node name="SaveButton" type="Button" parent="VBoxContainer"]
|
||||
offset_top = 316.0
|
||||
offset_top = 215.0
|
||||
offset_right = 200.0
|
||||
offset_bottom = 366.0
|
||||
rect_min_size = Vector2(200, 50)
|
||||
offset_bottom = 246.0
|
||||
text = "Save material"
|
||||
|
||||
[node name="LoadButton" type="Button" parent="VBoxContainer"]
|
||||
offset_top = 370.0
|
||||
offset_top = 250.0
|
||||
offset_right = 200.0
|
||||
offset_bottom = 420.0
|
||||
rect_min_size = Vector2(200, 50)
|
||||
offset_bottom = 281.0
|
||||
text = "Load material"
|
||||
clip_text = true
|
||||
|
||||
[node name="Label" type="Label" parent="VBoxContainer/LoadButton"]
|
||||
visible = false
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_bottom = -10.0
|
||||
rect_min_size = Vector2(0, 50)
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
text = "Load silly material and
|
||||
apply to selected node(s)"
|
||||
align = 1
|
||||
valign = 1
|
||||
autowrap = true
|
||||
|
||||
[node name="SaveMaterialDialog" type="FileDialog" parent="."]
|
||||
offset_left = 150.0
|
||||
offset_top = 20.0
|
||||
offset_right = 600.0
|
||||
offset_bottom = 360.0
|
||||
resizable = true
|
||||
filters = PackedStringArray("*.silly_mat")
|
||||
|
||||
[node name="LoadMaterialDialog" type="FileDialog" parent="."]
|
||||
offset_left = 150.0
|
||||
offset_top = 20.0
|
||||
offset_right = 600.0
|
||||
offset_bottom = 360.0
|
||||
rect_min_size = Vector2(200, 100)
|
||||
window_title = "Open a File"
|
||||
resizable = true
|
||||
mode = 0
|
||||
title = "Open a File"
|
||||
ok_button_text = "Open"
|
||||
file_mode = 0
|
||||
filters = PackedStringArray("*.silly_mat")
|
||||
|
||||
@@ -3,37 +3,37 @@ extends EditorImportPlugin
|
||||
|
||||
enum Presets { PRESET_DEFAULT }
|
||||
|
||||
func get_importer_name():
|
||||
func _get_importer_name():
|
||||
return "demos.sillymaterial"
|
||||
|
||||
|
||||
func get_visible_name():
|
||||
func _get_visible_name():
|
||||
return "Silly Material"
|
||||
|
||||
|
||||
func get_recognized_extensions():
|
||||
func _get_recognized_extensions():
|
||||
return ["mtxt"]
|
||||
|
||||
|
||||
func get_save_extension():
|
||||
func _get_save_extension():
|
||||
return "res"
|
||||
|
||||
|
||||
func get_resource_type():
|
||||
func _get_resource_type():
|
||||
return "Material"
|
||||
|
||||
|
||||
func get_preset_count():
|
||||
func _get_preset_count():
|
||||
return Presets.size()
|
||||
|
||||
|
||||
func get_preset_name(preset):
|
||||
func _get_preset_name(preset):
|
||||
match preset:
|
||||
Presets.PRESET_DEFAULT: return "Default"
|
||||
_: return "Unknown"
|
||||
|
||||
|
||||
func get_import_options(preset):
|
||||
func _get_import_options(_path, preset):
|
||||
match preset:
|
||||
Presets.PRESET_DEFAULT:
|
||||
return [{
|
||||
@@ -43,20 +43,18 @@ func get_import_options(preset):
|
||||
_: return []
|
||||
|
||||
|
||||
func get_option_visibility(option, options):
|
||||
func _get_import_order():
|
||||
return ResourceImporter.IMPORT_ORDER_DEFAULT
|
||||
|
||||
|
||||
func _get_option_visibility(path, option, options):
|
||||
return true
|
||||
|
||||
|
||||
func import(source_file, save_path, options, r_platform_variants, r_gen_files):
|
||||
var file = File.new()
|
||||
var err = file.open(source_file, File.READ)
|
||||
if err != OK:
|
||||
return err
|
||||
|
||||
func _import(source_file, save_path, options, r_platform_variants, r_gen_files):
|
||||
var file = FileAccess.open(source_file, FileAccess.READ)
|
||||
var line = file.get_line()
|
||||
|
||||
file.close()
|
||||
|
||||
var channels = line.split(",")
|
||||
if channels.size() != 3:
|
||||
return ERR_PARSE_ERROR
|
||||
@@ -69,4 +67,4 @@ func import(source_file, save_path, options, r_platform_variants, r_gen_files):
|
||||
|
||||
material.albedo_color = color
|
||||
|
||||
return ResourceSaver.save("%s.%s" % [save_path, get_save_extension()], material)
|
||||
return ResourceSaver.save(material ,"%s.%s" % [save_path, _get_save_extension()])
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
importer="demos.sillymaterial"
|
||||
type="Material"
|
||||
uid="uid://0kxvpjo37ehr"
|
||||
path="res://.godot/imported/test.mtxt-32ce4469df24b9f725d1e3476ff3b332.res"
|
||||
|
||||
[deps]
|
||||
|
||||
Reference in New Issue
Block a user