mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2025-12-31 09:49:06 +03:00
Port misc and plugin demos to Godot 3.1
This commit is contained in:
Binary file not shown.
56
plugins/custom_dock/custom_dock.tscn
Normal file
56
plugins/custom_dock/custom_dock.tscn
Normal file
@@ -0,0 +1,56 @@
|
||||
[gd_scene format=2]
|
||||
|
||||
[node name="CustomDock" type="VBoxContainer"]
|
||||
__meta__ = {
|
||||
"__editor_plugin_screen__": "2D"
|
||||
}
|
||||
|
||||
[node name="Title" type="Label" parent="."]
|
||||
margin_right = 141.0
|
||||
margin_bottom = 14.0
|
||||
text = "This is a Custom Dock"
|
||||
|
||||
[node name="Button" type="Button" parent="."]
|
||||
margin_top = 18.0
|
||||
margin_right = 141.0
|
||||
margin_bottom = 38.0
|
||||
text = "Really cool"
|
||||
|
||||
[node name="GridContainer" type="GridContainer" parent="."]
|
||||
margin_top = 42.0
|
||||
margin_right = 141.0
|
||||
margin_bottom = 74.0
|
||||
columns = 2
|
||||
|
||||
[node name="One" type="Label" parent="GridContainer"]
|
||||
margin_right = 36.0
|
||||
margin_bottom = 14.0
|
||||
text = "One"
|
||||
|
||||
[node name="Two" type="Label" parent="GridContainer"]
|
||||
margin_left = 40.0
|
||||
margin_right = 68.0
|
||||
margin_bottom = 14.0
|
||||
text = "Two"
|
||||
|
||||
[node name="Three" type="Label" parent="GridContainer"]
|
||||
margin_top = 18.0
|
||||
margin_right = 36.0
|
||||
margin_bottom = 32.0
|
||||
text = "Three"
|
||||
|
||||
[node name="Four" type="Label" parent="GridContainer"]
|
||||
margin_left = 40.0
|
||||
margin_top = 18.0
|
||||
margin_right = 68.0
|
||||
margin_bottom = 32.0
|
||||
text = "Four"
|
||||
|
||||
[node name="OptionButton" type="OptionButton" parent="."]
|
||||
margin_top = 78.0
|
||||
margin_right = 141.0
|
||||
margin_bottom = 98.0
|
||||
text = "Heho"
|
||||
items = [ "Heho", null, false, -1, null ]
|
||||
selected = 0
|
||||
|
||||
@@ -5,19 +5,11 @@ var dock = null
|
||||
|
||||
func _enter_tree():
|
||||
# When this plugin node enters tree, add the custom type
|
||||
|
||||
dock = preload("res://addons/custom_dock/custom_dock.scn").instance()
|
||||
|
||||
add_control_to_dock( DOCK_SLOT_LEFT_UL, dock )
|
||||
dock = preload("res://addons/custom_dock/custom_dock.tscn").instance()
|
||||
add_control_to_dock(DOCK_SLOT_LEFT_UL, dock)
|
||||
|
||||
func _exit_tree():
|
||||
|
||||
# Remove from docks (must be called so layout is updated and saved)
|
||||
remove_control_from_docks(dock)
|
||||
# Remove the node
|
||||
dock.free()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -5,10 +5,3 @@ description="Adds a new Customizable Dock"
|
||||
author="Juan Linietsky"
|
||||
version="1.0"
|
||||
script="dock_plugin.gd"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -23,12 +23,12 @@ func get_preset_count():
|
||||
|
||||
func get_preset_name(preset):
|
||||
match preset:
|
||||
PRESET_DEFAULT: return "Default"
|
||||
Presets.PRESET_DEFAULT: return "Default"
|
||||
_ : return "Unknown"
|
||||
|
||||
func get_import_options(preset):
|
||||
match preset:
|
||||
PRESET_DEFAULT:
|
||||
Presets.PRESET_DEFAULT:
|
||||
return [{
|
||||
"name": "use_red_anyway",
|
||||
"default_value": false
|
||||
|
||||
@@ -5,7 +5,6 @@ var import_plugin
|
||||
|
||||
func _enter_tree():
|
||||
import_plugin = preload("import_plugin.gd").new()
|
||||
|
||||
add_import_plugin(import_plugin)
|
||||
|
||||
func _exit_tree():
|
||||
|
||||
14
plugins/custom_import_plugin/test.mtxt.import
Normal file
14
plugins/custom_import_plugin/test.mtxt.import
Normal file
@@ -0,0 +1,14 @@
|
||||
[remap]
|
||||
|
||||
importer="demos.sillymaterial"
|
||||
type="Material"
|
||||
path="res://.import/test.mtxt-0850936d050b34fd8096ae7fe7a591cc.res"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/custom_import_plugin/test.mtxt"
|
||||
dest_files=[ "res://.import/test.mtxt-0850936d050b34fd8096ae7fe7a591cc.res" ]
|
||||
|
||||
[params]
|
||||
|
||||
use_red_anyway=false
|
||||
@@ -1,6 +1,6 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/custom_import_plugin/Silly_material_creator.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/custom_material_creator/silly_material_creator.gd" type="Script" id=1]
|
||||
|
||||
[node name="Silly Material Creator" type="Panel"]
|
||||
|
||||
@@ -4,20 +4,18 @@
|
||||
# SPECIAL NOTE: This technically should be using EditorImportPlugin and EditorExportPlugin
|
||||
# to handle the input and output of the silly material. However, currently you cannot export
|
||||
# custom resources in Godot, so instead we're using JSON files instead.
|
||||
# |
|
||||
#
|
||||
# This example should be replaced when EditorImportPlugin and EditorExportPlugin are both
|
||||
# fully working and you can save custom resources.
|
||||
|
||||
tool
|
||||
extends EditorPlugin
|
||||
|
||||
var io_material_dialog;
|
||||
var io_material_dialog
|
||||
|
||||
func _enter_tree():
|
||||
|
||||
io_material_dialog = preload("res://addons/custom_import_plugin/Custom_material_dock.tscn").instance()
|
||||
io_material_dialog.editor_interface = get_editor_interface();
|
||||
|
||||
io_material_dialog = preload("res://addons/custom_material_creator/custom_material_dock.tscn").instance()
|
||||
io_material_dialog.editor_interface = get_editor_interface()
|
||||
add_control_to_dock(DOCK_SLOT_LEFT_UL, io_material_dialog)
|
||||
|
||||
func _exit_tree():
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
tool
|
||||
extends Panel
|
||||
|
||||
var silly_material_resource = preload("res://addons/custom_import_plugin/Silly_material_resource.gd")
|
||||
var silly_material_resource = preload("res://addons/custom_material_creator/silly_material_resource.gd")
|
||||
var editor_interface
|
||||
|
||||
func _ready():
|
||||
@@ -1,12 +1,11 @@
|
||||
tool
|
||||
extends Node2D
|
||||
|
||||
|
||||
var heart = preload("res://addons/custom_node/heart.png")
|
||||
|
||||
func _draw():
|
||||
draw_texture(heart,-heart.get_size()/2)
|
||||
draw_texture(heart, -heart.get_size() / 2)
|
||||
|
||||
func _get_item_rect():
|
||||
#override
|
||||
return Rect2(-heart.get_size()/2,heart.get_size())
|
||||
# override
|
||||
return Rect2(-heart.get_size() / 2, heart.get_size())
|
||||
|
||||
31
plugins/custom_node/heart.png.import
Normal file
31
plugins/custom_node/heart.png.import
Normal file
@@ -0,0 +1,31 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/heart.png-53d6538480df02caf4bbbee10b65a623.stex"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/custom_node/heart.png"
|
||||
dest_files=[ "res://.import/heart.png-53d6538480df02caf4bbbee10b65a623.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
31
plugins/custom_node/heart_icon.png.import
Normal file
31
plugins/custom_node/heart_icon.png.import
Normal file
@@ -0,0 +1,31 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/heart_icon.png-8f04adf78b3bd1a5c39f790588a1fa78.stex"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/custom_node/heart_icon.png"
|
||||
dest_files=[ "res://.import/heart_icon.png-8f04adf78b3bd1a5c39f790588a1fa78.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
||||
@@ -1,18 +1,10 @@
|
||||
tool
|
||||
extends EditorPlugin
|
||||
|
||||
|
||||
func _enter_tree():
|
||||
# When this plugin node enters tree, add the custom type
|
||||
|
||||
add_custom_type("Heart","Node2D",preload("res://addons/custom_node/heart.gd"),preload("res://addons/custom_node/heart_icon.png"))
|
||||
add_custom_type("Heart", "Node2D", preload("res://addons/custom_node/heart.gd"), preload("res://addons/custom_node/heart_icon.png"))
|
||||
|
||||
func _exit_tree():
|
||||
# When the plugin node exits the tree, remove the custom type
|
||||
|
||||
remove_custom_type("Heart")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -5,10 +5,3 @@ description="Adds a new Heart node in 2D"
|
||||
author="Juan Linietsky"
|
||||
version="1.0"
|
||||
script="heart_plugin.gd"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user