Skip to content

Commit

Permalink
Merge branch 'master' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
noidexe committed Oct 23, 2021
2 parents 95a607a + 875b253 commit 11b4a87
Show file tree
Hide file tree
Showing 16 changed files with 12,470 additions and 0 deletions.
7 changes: 7 additions & 0 deletions default_env.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[gd_resource type="Environment" load_steps=2 format=2]

[sub_resource type="ProceduralSky" id=1]

[resource]
background_mode = 2
background_sky = SubResource( 1 )
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions icon.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://icon.png"
dest_files=[ "res://.import/icon.png-487276ed1e3a0c39cad0279d744ee560.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
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
Binary file added icons/alpha.res
Binary file not shown.
Binary file added icons/beta.res
Binary file not shown.
Binary file added icons/icons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions icons/icons.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/icons.png-3fe91a2709956b6c1be8ec63fe45960f.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://icons/icons.png"
dest_files=[ "res://.import/icons.png-3fe91a2709956b6c1be8ec63fe45960f.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
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0
Binary file added icons/master.res
Binary file not shown.
Binary file added icons/rc.res
Binary file not shown.
Binary file added icons/stable.res
Binary file not shown.
23 changes: 23 additions & 0 deletions project.godot
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters

config_version=4

[application]

config/name="Godot Version Manager"
run/main_scene="res://scenes/Main.tscn"
config/icon="res://icon.png"

[physics]

common/enable_pause_aware_picking=true

[rendering]

environment/default_environment="res://default_env.tres"
18 changes: 18 additions & 0 deletions scenes/Add.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
extends Button

export var add_popup : NodePath

# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.


# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass


func _on_Add_pressed():
var popup = get_node(add_popup) as Popup
popup.popup_centered()
pass # Replace with function body.
47 changes: 47 additions & 0 deletions scenes/AddNew.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
extends Popup


export var select_dialog : NodePath

signal version_added()

# Called when the node enters the scene tree for the first time.
func _ready():
_validate()
pass


func _on_Select_pressed():
var popup = get_node(select_dialog) as FileDialog
popup.popup()
$Margin/VBox/path/LineEdit.text = yield(popup,"file_selected")
if $Margin/VBox/name/LineEdit.text == "":
$Margin/VBox/name/LineEdit.text = $Margin/VBox/path/LineEdit.text.get_file()
_validate()

func _validate(_unused = ""):
$Margin/VBox/Add.disabled = $Margin/VBox/name/LineEdit.text == "" or not $Margin/VBox/path/LineEdit.text.is_abs_path()
pass

func _on_Add_pressed():
var entry = {
"name": $Margin/VBox/name/LineEdit.text,
"path" :$Margin/VBox/path/LineEdit.text,
"arguments" :$Margin/VBox/arguments/LineEdit.text
}
var file = File.new()
file.open("user://config.json",File.READ)
var config = parse_json(file.get_as_text())
config.versions.append(entry)
file.close()
file.open("user://config.json",File.WRITE)
file.store_line(to_json(config))
file.close()
emit_signal("version_added")
hide()


func _on_AddNew_about_to_show():
$Margin/VBox/name/LineEdit.text = ""
$Margin/VBox/arguments/LineEdit.text = ""
$Margin/VBox/path/LineEdit.text = ""
75 changes: 75 additions & 0 deletions scenes/Installed.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
extends ItemList

var icons = {
"tool" : preload("res://icons/master.res"),
"alpha" : preload("res://icons/alpha.res"),
"beta" : preload("res://icons/beta.res"),
"rc" : preload("res://icons/rc.res"),
"stable" : preload("res://icons/stable.res")
}

var config : Dictionary = { "versions" : [] }
export var context_menu : NodePath
# Called when the node enters the scene tree for the first time.
func _ready():
_reload()
pass # Replace with function body.


func _reload():
var file = File.new()
if not file.file_exists("user://config.json"):
_save()
file.open("user://config.json",File.READ)
var content = file.get_as_text()
config = parse_json(content)
file.close()
_update_list()



func _update_list():
clear()
for version in config.versions:
add_item(version.name, _get_correct_icon(version.name))

func _get_correct_icon(v_name : String):
for test in ["tool", "alpha", "beta", "rc", "stable"]:
if test in v_name:
return icons[test]
return preload("res://icon.png")


func _on_Installed_item_activated(index):
var path : String = config.versions[index].path
var args : PoolStringArray = config.versions[index].arguments.split(" ")
args.append("-p")
OS.execute(ProjectSettings.globalize_path(path), args, false)


func _on_version_added():
_reload()
pass # Replace with function body.


func _on_ContextMenu_id_pressed(id):
if id == 0 and is_anything_selected():
_delete(get_selected_items()[0])

func _delete(idx):
config.versions.remove(idx)
_save()
_reload()


func _on_Installed_item_rmb_selected(_index, at_position):
var menu = get_node(context_menu) as PopupMenu
menu.rect_position = at_position
menu.popup()
pass # Replace with function body.

func _save():
var file = File.new()
file.open("user://config.json",File.WRITE)
file.store_line(to_json(config))
file.close()
12,076 changes: 12,076 additions & 0 deletions scenes/Main.tscn

Large diffs are not rendered by default.

Loading

0 comments on commit 11b4a87

Please sign in to comment.