Run godot --convert-3to4 (automated conversion)
Apply Godot 4.6 automated conversion: renames Spatial.translate->position, margin_*->offset_*, tool->@tool, .empty()->.is_empty(), DynamicFont->FontFile, onready->@onready, export()->@export, and many more. 127 files changed by the tool. Manual fixes still required for: - godot_db_manager plugin (incompatible APIs: WindowDialog, Tabs, etc.) - lod plugin (Spatial -> Node3D renames) - ResourceLoader.load_interactive removed -> load_threaded_request - OS.set_window_fullscreen removed -> DisplayServer - Viewport.set_size_override removed Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/Roboto-Regular.ttf" type="DynamicFontData" id=1]
|
||||
|
||||
[resource]
|
||||
size = 8
|
||||
font_data = ExtResource( 1 )
|
||||
[gd_resource type="FontFile" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/Roboto-Regular.ttf" type="FontFile" id=1]
|
||||
|
||||
[resource]
|
||||
size = 8
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/Roboto-Regular.ttf" type="DynamicFontData" id=1]
|
||||
|
||||
[resource]
|
||||
size = 10
|
||||
font_data = ExtResource( 1 )
|
||||
[gd_resource type="FontFile" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/Roboto-Regular.ttf" type="FontFile" id=1]
|
||||
|
||||
[resource]
|
||||
size = 10
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/Roboto-Regular.ttf" type="DynamicFontData" id=1]
|
||||
|
||||
[resource]
|
||||
size = 12
|
||||
font_data = ExtResource( 1 )
|
||||
[gd_resource type="FontFile" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/Roboto-Regular.ttf" type="FontFile" id=1]
|
||||
|
||||
[resource]
|
||||
size = 12
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/Roboto-Regular.ttf" type="DynamicFontData" id=1]
|
||||
|
||||
[resource]
|
||||
size = 14
|
||||
font_data = ExtResource( 1 )
|
||||
[gd_resource type="FontFile" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/Roboto-Regular.ttf" type="FontFile" id=1]
|
||||
|
||||
[resource]
|
||||
size = 14
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/Roboto-Regular.ttf" type="DynamicFontData" id=1]
|
||||
|
||||
[resource]
|
||||
font_data = ExtResource( 1 )
|
||||
[gd_resource type="FontFile" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/Roboto-Regular.ttf" type="FontFile" id=1]
|
||||
|
||||
[resource]
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/Roboto-Regular.ttf" type="DynamicFontData" id=1]
|
||||
|
||||
[resource]
|
||||
size = 18
|
||||
font_data = ExtResource( 1 )
|
||||
[gd_resource type="FontFile" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/Roboto-Regular.ttf" type="FontFile" id=1]
|
||||
|
||||
[resource]
|
||||
size = 18
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/Roboto-Regular.ttf" type="DynamicFontData" id=1]
|
||||
|
||||
[resource]
|
||||
size = 20
|
||||
font_data = ExtResource( 1 )
|
||||
[gd_resource type="FontFile" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/Roboto-Regular.ttf" type="FontFile" id=1]
|
||||
|
||||
[resource]
|
||||
size = 20
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/Roboto-Regular.ttf" type="DynamicFontData" id=1]
|
||||
|
||||
[resource]
|
||||
size = 22
|
||||
font_data = ExtResource( 1 )
|
||||
[gd_resource type="FontFile" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/Roboto-Regular.ttf" type="FontFile" id=1]
|
||||
|
||||
[resource]
|
||||
size = 22
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/Roboto-Regular.ttf" type="DynamicFontData" id=1]
|
||||
|
||||
[resource]
|
||||
size = 24
|
||||
font_data = ExtResource( 1 )
|
||||
[gd_resource type="FontFile" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/Roboto-Regular.ttf" type="FontFile" id=1]
|
||||
|
||||
[resource]
|
||||
size = 24
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/Roboto-Regular.ttf" type="DynamicFontData" id=1]
|
||||
|
||||
[resource]
|
||||
size = 26
|
||||
font_data = ExtResource( 1 )
|
||||
[gd_resource type="FontFile" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/Roboto-Regular.ttf" type="FontFile" id=1]
|
||||
|
||||
[resource]
|
||||
size = 26
|
||||
font_data = ExtResource( 1 )
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
@tool
|
||||
"""
|
||||
class GDDBConstants
|
||||
"""
|
||||
|
||||
class_name GDDBConstants
|
||||
|
||||
tool
|
||||
extends Node
|
||||
|
||||
# GDDB signature
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
@tool
|
||||
"""
|
||||
class GDDBGlobals
|
||||
"""
|
||||
|
||||
class_name GDDBGlobals
|
||||
|
||||
tool
|
||||
extends Node
|
||||
|
||||
# a flag that tells if the tool's interface is active or not
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
@tool
|
||||
"""
|
||||
class GDDBTypes
|
||||
"""
|
||||
|
||||
class_name GDDBTypes
|
||||
|
||||
tool
|
||||
extends Node
|
||||
|
||||
# Database loading errors
|
||||
|
||||
@@ -188,11 +188,11 @@ func is_dirty() -> bool :
|
||||
|
||||
# serialization
|
||||
func save_db() -> void :
|
||||
if(m_db_name.empty()):
|
||||
if(m_db_name.is_empty()):
|
||||
print("ERROR: GDDatabase::save_db() - current database doesn't have a name")
|
||||
return
|
||||
|
||||
if(m_db_filepath.empty()):
|
||||
if(m_db_filepath.is_empty()):
|
||||
print("ERROR: GDDatabase::save_db() - current database doesn't have a path file")
|
||||
return
|
||||
|
||||
@@ -257,7 +257,9 @@ func load_db() -> int :
|
||||
file.open(get_db_filepath(), File.READ)
|
||||
var content = file.get_as_text()
|
||||
file.close()
|
||||
var dictionary = JSON.parse(content).result
|
||||
var test_json_conv = JSON.new()
|
||||
test_json_conv.parse(content).result
|
||||
var dictionary = test_json_conv.get_data()
|
||||
|
||||
# check the signature
|
||||
if(!dictionary.has(gddb_constants.c_gddb_signature)):
|
||||
|
||||
@@ -1,40 +1,40 @@
|
||||
"""
|
||||
GDDBData class
|
||||
"""
|
||||
|
||||
class_name GDDBData
|
||||
|
||||
extends Object
|
||||
|
||||
var m_prop_id : int = -1
|
||||
var m_row_idx : int = -1
|
||||
var m_data : String = ""
|
||||
|
||||
# sets the property id
|
||||
func set_prop_id(prop_id : int) -> void :
|
||||
m_prop_id = prop_id
|
||||
|
||||
# returns the property id
|
||||
func get_prop_id() -> int :
|
||||
return m_prop_id
|
||||
|
||||
# sets the row index
|
||||
func set_row_idx(row_idx : int) -> void :
|
||||
m_row_idx = row_idx
|
||||
|
||||
# returns the row index
|
||||
func get_row_idx() -> int :
|
||||
return m_row_idx
|
||||
|
||||
# sets the data
|
||||
func set_data(data : String) -> void :
|
||||
m_data = data
|
||||
|
||||
# returns the data
|
||||
func get_data() -> String :
|
||||
return m_data
|
||||
|
||||
# dumps the data
|
||||
func dump() -> String :
|
||||
var dump_text = "prop_id: " + str(m_prop_id) + ", row_idx: " + str(m_row_idx) + ", data: " + m_data
|
||||
return dump_text
|
||||
"""
|
||||
GDDBData class
|
||||
"""
|
||||
|
||||
class_name GDDBData
|
||||
|
||||
extends Object
|
||||
|
||||
var m_prop_id : int = -1
|
||||
var m_row_idx : int = -1
|
||||
var m_data : String = ""
|
||||
|
||||
# sets the property id
|
||||
func set_prop_id(prop_id : int) -> void :
|
||||
m_prop_id = prop_id
|
||||
|
||||
# returns the property id
|
||||
func get_prop_id() -> int :
|
||||
return m_prop_id
|
||||
|
||||
# sets the row index
|
||||
func set_row_idx(row_idx : int) -> void :
|
||||
m_row_idx = row_idx
|
||||
|
||||
# returns the row index
|
||||
func get_row_idx() -> int :
|
||||
return m_row_idx
|
||||
|
||||
# sets the data
|
||||
func set_data(data : String) -> void :
|
||||
m_data = data
|
||||
|
||||
# returns the data
|
||||
func get_data() -> String :
|
||||
return m_data
|
||||
|
||||
# dumps the data
|
||||
func dump() -> String :
|
||||
var dump_text = "prop_id: " + str(m_prop_id) + ", row_idx: " + str(m_row_idx) + ", data: " + m_data
|
||||
return dump_text
|
||||
|
||||
@@ -1,141 +1,141 @@
|
||||
"""
|
||||
GDDBMan class
|
||||
"""
|
||||
|
||||
class_name GDDBMan
|
||||
|
||||
extends Object
|
||||
|
||||
var m_databases = []
|
||||
|
||||
# adds a database
|
||||
func add_database(db_name : String) -> int :
|
||||
if(!can_add_db(db_name)):
|
||||
print("ERROR: GDDBMan::add_database(" + db_name + ") already exists")
|
||||
return gddb_constants.c_invalid_id
|
||||
# print("GDDBMan::add_database(" + db_name + ")")
|
||||
var db_id = generate_new_db_id()
|
||||
var db = load(gddb_constants.c_addon_main_path + "core/database.gd").new()
|
||||
db.set_db_id(db_id)
|
||||
db.set_db_name(db_name)
|
||||
m_databases.push_back(db)
|
||||
return db_id
|
||||
|
||||
# loads a database from a file
|
||||
func load_database(filepath : String) -> int :
|
||||
var db_id = generate_new_db_id()
|
||||
var db = load(gddb_constants.c_addon_main_path + "core/database.gd").new()
|
||||
db.set_db_id(db_id)
|
||||
db.set_db_filepath(filepath)
|
||||
|
||||
if(db.load_db() == gddb_types.e_db_invalid_file):
|
||||
db.free()
|
||||
return gddb_types.e_db_invalid_file
|
||||
|
||||
elif(db.load_db() == gddb_types.e_db_invalid_ver):
|
||||
db.free()
|
||||
return gddb_types.e_db_invalid_ver
|
||||
|
||||
m_databases.push_back(db)
|
||||
return db_id
|
||||
|
||||
# erases a database at index
|
||||
# it does not erase the database file
|
||||
func erase_db_at(idx : int) -> void :
|
||||
if(idx < 0 || idx > m_databases.size() - 1):
|
||||
print("ERROR: GDDBMan::erase_db_at(" + str(idx) + ") - index out of bounds")
|
||||
|
||||
m_databases[idx].clear()
|
||||
m_databases[idx].free()
|
||||
m_databases.remove(idx)
|
||||
|
||||
# erases a database by id
|
||||
# it does not erase the database file
|
||||
func erase_db_by_id(db_id : int) -> void :
|
||||
var db_found = false
|
||||
for idx in range(0, m_databases.size()):
|
||||
if(m_databases[idx].get_db_id() == db_id):
|
||||
m_databases[idx].clear()
|
||||
m_databases[idx].free()
|
||||
m_databases.remove(idx)
|
||||
db_found = true
|
||||
break
|
||||
|
||||
if(!db_found):
|
||||
print("ERROR: GDDBMan::erase_db_by_id(" + str(db_id) + ") - database not found")
|
||||
|
||||
# erases a database by name
|
||||
# it does not erase the database file
|
||||
func erase_db_by_name(db_name : String) -> void :
|
||||
var db_found = false
|
||||
for idx in range(0, m_databases.size()):
|
||||
if(m_databases[idx].get_db_name() == db_name):
|
||||
m_databases[idx].clear()
|
||||
m_databases[idx].free()
|
||||
m_databases.remove(idx)
|
||||
db_found = true
|
||||
break
|
||||
|
||||
if(!db_found):
|
||||
print("ERROR: GDDBMan::erase_db_by_id(" + db_name + ") - database not found")
|
||||
|
||||
# returns the databases count
|
||||
func get_databases_count() -> int :
|
||||
return m_databases.size()
|
||||
|
||||
# returns a database at index
|
||||
func get_db_at(idx : int) -> Object :
|
||||
if(idx < 0 || idx >= m_databases.size()):
|
||||
print("ERROR: GDDBMan::get_db_at(" + str(idx) + ") - invalid index")
|
||||
return null
|
||||
return m_databases[idx]
|
||||
|
||||
# returns a database by an id
|
||||
func get_db_by_id(db_id : int) -> Object :
|
||||
for idx in range(0, m_databases.size()):
|
||||
if(m_databases[idx].get_db_id() == db_id):
|
||||
return m_databases[idx]
|
||||
print("ERROR: GDDBMan::get_db_by_id(" + str(db_id) + ") - invalid id")
|
||||
return null
|
||||
|
||||
# returns a database by a name
|
||||
func get_db_by_name(db_name : String) -> Object :
|
||||
for idx in range(0, m_databases.size()):
|
||||
if(m_databases[idx].get_db_name() == db_name):
|
||||
return m_databases[idx]
|
||||
return null
|
||||
|
||||
# generates a new table id
|
||||
func generate_new_db_id() -> int :
|
||||
if(m_databases.size() == 0):
|
||||
return 0
|
||||
return m_databases[m_databases.size()-1].get_db_id() + 1
|
||||
|
||||
# checks if a database already exists
|
||||
func can_add_db(db_name : String) -> bool :
|
||||
for idx in range(0, m_databases.size()):
|
||||
if(m_databases[idx].get_db_name() == db_name):
|
||||
print("ERROR: Database with name \"" + db_name + "\" already exists")
|
||||
return false
|
||||
return true
|
||||
|
||||
# deletes all databases
|
||||
func clear() -> void :
|
||||
for idx in range(0, m_databases.size()):
|
||||
m_databases[idx].clear()
|
||||
m_databases[idx].free()
|
||||
m_databases.clear()
|
||||
|
||||
# dumps all databases
|
||||
func dump(to_console : bool = false) -> String :
|
||||
var dump_text = "\nDatabase manager - dump"
|
||||
|
||||
dump_text += "\n===================================================================================="
|
||||
for idx in range(0, m_databases.size()):
|
||||
dump_text += m_databases[idx].dump()
|
||||
dump_text += "===================================================================================="
|
||||
|
||||
if(to_console):
|
||||
print(dump_text)
|
||||
|
||||
return dump_text
|
||||
"""
|
||||
GDDBMan class
|
||||
"""
|
||||
|
||||
class_name GDDBMan
|
||||
|
||||
extends Object
|
||||
|
||||
var m_databases = []
|
||||
|
||||
# adds a database
|
||||
func add_database(db_name : String) -> int :
|
||||
if(!can_add_db(db_name)):
|
||||
print("ERROR: GDDBMan::add_database(" + db_name + ") already exists")
|
||||
return gddb_constants.c_invalid_id
|
||||
# print("GDDBMan::add_database(" + db_name + ")")
|
||||
var db_id = generate_new_db_id()
|
||||
var db = load(gddb_constants.c_addon_main_path + "core/database.gd").new()
|
||||
db.set_db_id(db_id)
|
||||
db.set_db_name(db_name)
|
||||
m_databases.push_back(db)
|
||||
return db_id
|
||||
|
||||
# loads a database from a file
|
||||
func load_database(filepath : String) -> int :
|
||||
var db_id = generate_new_db_id()
|
||||
var db = load(gddb_constants.c_addon_main_path + "core/database.gd").new()
|
||||
db.set_db_id(db_id)
|
||||
db.set_db_filepath(filepath)
|
||||
|
||||
if(db.load_db() == gddb_types.e_db_invalid_file):
|
||||
db.free()
|
||||
return gddb_types.e_db_invalid_file
|
||||
|
||||
elif(db.load_db() == gddb_types.e_db_invalid_ver):
|
||||
db.free()
|
||||
return gddb_types.e_db_invalid_ver
|
||||
|
||||
m_databases.push_back(db)
|
||||
return db_id
|
||||
|
||||
# erases a database at index
|
||||
# it does not erase the database file
|
||||
func erase_db_at(idx : int) -> void :
|
||||
if(idx < 0 || idx > m_databases.size() - 1):
|
||||
print("ERROR: GDDBMan::erase_db_at(" + str(idx) + ") - index out of bounds")
|
||||
|
||||
m_databases[idx].clear()
|
||||
m_databases[idx].free()
|
||||
m_databases.remove(idx)
|
||||
|
||||
# erases a database by id
|
||||
# it does not erase the database file
|
||||
func erase_db_by_id(db_id : int) -> void :
|
||||
var db_found = false
|
||||
for idx in range(0, m_databases.size()):
|
||||
if(m_databases[idx].get_db_id() == db_id):
|
||||
m_databases[idx].clear()
|
||||
m_databases[idx].free()
|
||||
m_databases.remove(idx)
|
||||
db_found = true
|
||||
break
|
||||
|
||||
if(!db_found):
|
||||
print("ERROR: GDDBMan::erase_db_by_id(" + str(db_id) + ") - database not found")
|
||||
|
||||
# erases a database by name
|
||||
# it does not erase the database file
|
||||
func erase_db_by_name(db_name : String) -> void :
|
||||
var db_found = false
|
||||
for idx in range(0, m_databases.size()):
|
||||
if(m_databases[idx].get_db_name() == db_name):
|
||||
m_databases[idx].clear()
|
||||
m_databases[idx].free()
|
||||
m_databases.remove(idx)
|
||||
db_found = true
|
||||
break
|
||||
|
||||
if(!db_found):
|
||||
print("ERROR: GDDBMan::erase_db_by_id(" + db_name + ") - database not found")
|
||||
|
||||
# returns the databases count
|
||||
func get_databases_count() -> int :
|
||||
return m_databases.size()
|
||||
|
||||
# returns a database at index
|
||||
func get_db_at(idx : int) -> Object :
|
||||
if(idx < 0 || idx >= m_databases.size()):
|
||||
print("ERROR: GDDBMan::get_db_at(" + str(idx) + ") - invalid index")
|
||||
return null
|
||||
return m_databases[idx]
|
||||
|
||||
# returns a database by an id
|
||||
func get_db_by_id(db_id : int) -> Object :
|
||||
for idx in range(0, m_databases.size()):
|
||||
if(m_databases[idx].get_db_id() == db_id):
|
||||
return m_databases[idx]
|
||||
print("ERROR: GDDBMan::get_db_by_id(" + str(db_id) + ") - invalid id")
|
||||
return null
|
||||
|
||||
# returns a database by a name
|
||||
func get_db_by_name(db_name : String) -> Object :
|
||||
for idx in range(0, m_databases.size()):
|
||||
if(m_databases[idx].get_db_name() == db_name):
|
||||
return m_databases[idx]
|
||||
return null
|
||||
|
||||
# generates a new table id
|
||||
func generate_new_db_id() -> int :
|
||||
if(m_databases.size() == 0):
|
||||
return 0
|
||||
return m_databases[m_databases.size()-1].get_db_id() + 1
|
||||
|
||||
# checks if a database already exists
|
||||
func can_add_db(db_name : String) -> bool :
|
||||
for idx in range(0, m_databases.size()):
|
||||
if(m_databases[idx].get_db_name() == db_name):
|
||||
print("ERROR: Database with name \"" + db_name + "\" already exists")
|
||||
return false
|
||||
return true
|
||||
|
||||
# deletes all databases
|
||||
func clear() -> void :
|
||||
for idx in range(0, m_databases.size()):
|
||||
m_databases[idx].clear()
|
||||
m_databases[idx].free()
|
||||
m_databases.clear()
|
||||
|
||||
# dumps all databases
|
||||
func dump(to_console : bool = false) -> String :
|
||||
var dump_text = "\nDatabase manager - dump"
|
||||
|
||||
dump_text += "\n===================================================================================="
|
||||
for idx in range(0, m_databases.size()):
|
||||
dump_text += m_databases[idx].dump()
|
||||
dump_text += "===================================================================================="
|
||||
|
||||
if(to_console):
|
||||
print(dump_text)
|
||||
|
||||
return dump_text
|
||||
|
||||
@@ -122,7 +122,7 @@ func add_table_prop(prop_name : String, table_name : String) -> int :
|
||||
func link_tables_props() -> void :
|
||||
for idx in range(0, m_props.size()):
|
||||
var custom_prop_type = m_props[idx].get_prop_custom_type()
|
||||
if(!custom_prop_type.empty()):
|
||||
if(!custom_prop_type.is_empty()):
|
||||
var table = m_parent_database.get_table_by_name(custom_prop_type)
|
||||
m_props[idx].set_prop_type(gddb_types.e_prop_types_count + table.get_table_id())
|
||||
m_props[idx].set_prop_custom_type("")
|
||||
@@ -396,7 +396,7 @@ func get_dictionary_at_row_idx(row_idx : int) -> Dictionary :
|
||||
dict[data_prop_name] = m_data[idx].get_data()
|
||||
prop_idx += 1
|
||||
|
||||
if(dict.empty()):
|
||||
if(dict.is_empty()):
|
||||
print("ERROR: GDDBDTable::get_data_at_row_idx(" + str(row_idx) + ") - invalid row index")
|
||||
|
||||
return dict
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
@tool
|
||||
"""
|
||||
class GDDBDataLabel
|
||||
"""
|
||||
|
||||
class_name GDDBDataLabel
|
||||
|
||||
tool
|
||||
extends Label
|
||||
|
||||
signal resize_property
|
||||
@@ -27,7 +27,7 @@ func _input(event : InputEvent) -> void :
|
||||
var evLocal = $resize_ctrl.make_input_local(event)
|
||||
|
||||
if event is InputEventMouseButton :
|
||||
if(event.button_index == BUTTON_LEFT):
|
||||
if(event.button_index == MOUSE_BUTTON_LEFT):
|
||||
if(event.pressed):
|
||||
var rect = Rect2(Vector2(0, 0), $resize_ctrl.get_size())
|
||||
var inside = rect.has_point(evLocal.position)
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/data_label.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_18.tres" type="DynamicFont" id=2]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/tex/gui.png" type="Texture" id=3]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/tex/debug.png" type="Texture" id=4]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_18.tres" type="FontFile" id=2]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/tex/gui.png" type="Texture2D" id=3]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/tex/debug.png" type="Texture2D" id=4]
|
||||
|
||||
[node name="lbl" type="Label"]
|
||||
anchor_right = 0.167
|
||||
margin_right = -0.300018
|
||||
margin_bottom = 11.52
|
||||
rect_min_size = Vector2( 150, 32 )
|
||||
offset_right = -0.300018
|
||||
offset_bottom = 11.52
|
||||
custom_minimum_size = Vector2( 150, 32 )
|
||||
mouse_filter = 0
|
||||
custom_fonts/font = ExtResource( 2 )
|
||||
theme_override_fonts/font = ExtResource( 2 )
|
||||
text = "ID"
|
||||
valign = 1
|
||||
script = ExtResource( 1 )
|
||||
@@ -34,7 +34,7 @@ __meta__ = {
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -3.0
|
||||
offset_left = -3.0
|
||||
mouse_filter = 0
|
||||
mouse_default_cursor_shape = 10
|
||||
texture = ExtResource( 3 )
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
@tool
|
||||
"""
|
||||
class GDDBEditor
|
||||
"""
|
||||
|
||||
class_name GDDBEditor
|
||||
|
||||
tool
|
||||
extends Tabs
|
||||
extends TabBar
|
||||
|
||||
var m_name = ""
|
||||
var m_database = null
|
||||
@@ -14,23 +14,23 @@ var m_filepath = ""
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void :
|
||||
set_tab_align(Tabs.ALIGN_LEFT)
|
||||
set_tab_close_display_policy(Tabs.CLOSE_BUTTON_SHOW_ALWAYS)
|
||||
set_tab_alignment(TabBar.ALIGN_LEFT)
|
||||
set_tab_close_display_policy(TabBar.CLOSE_BUTTON_SHOW_ALWAYS)
|
||||
|
||||
$tables_list.connect("resize_tables_list", self, "on_resize_the_table_list")
|
||||
$tables_list.connect("add_table", self, "on_add_table")
|
||||
$tables_list.connect("edit_table_name", self, "on_edit_table")
|
||||
$tables_list.connect("delete_table", self, "on_delete_table")
|
||||
$tables_list.connect("select_table", self, "on_select_table")
|
||||
$tables_list.connect("resize_tables_list", Callable(self, "on_resize_the_table_list"))
|
||||
$tables_list.connect("add_table", Callable(self, "on_add_table"))
|
||||
$tables_list.connect("edit_table_name", Callable(self, "on_edit_table"))
|
||||
$tables_list.connect("delete_table", Callable(self, "on_delete_table"))
|
||||
$tables_list.connect("select_table", Callable(self, "on_select_table"))
|
||||
|
||||
$table_editor.connect("set_dirty", self, "on_set_dirty")
|
||||
$table_editor.connect("set_dirty", Callable(self, "on_set_dirty"))
|
||||
|
||||
$delete_table_dlg.connect("delete_table", self, "on_confirm_delete_table")
|
||||
$delete_table_dlg.connect("delete_table", Callable(self, "on_confirm_delete_table"))
|
||||
|
||||
$new_table_dlg.connect("cancel_dialog", self, "on_close_new_table_dlg")
|
||||
$new_table_dlg.get_close_button().connect("pressed", self, "on_close_new_table_dlg")
|
||||
$new_table_dlg.connect("cancel_dialog", Callable(self, "on_close_new_table_dlg"))
|
||||
$new_table_dlg.get_close_button().connect("pressed", Callable(self, "on_close_new_table_dlg"))
|
||||
|
||||
$error_dlg.connect("confirmed", self, "on_retry_create_table")
|
||||
$error_dlg.connect("confirmed", Callable(self, "on_retry_create_table"))
|
||||
|
||||
# resizing the tables list
|
||||
func on_resize_the_table_list(diff_x : float) -> void :
|
||||
@@ -56,7 +56,7 @@ func on_resize_the_table_list(diff_x : float) -> void :
|
||||
# overrides the member from base class
|
||||
func set_name(ctrl_name) -> void :
|
||||
m_name = ctrl_name
|
||||
.set_name(ctrl_name)
|
||||
super.set_name(ctrl_name)
|
||||
|
||||
# sets the database; for easy access
|
||||
func set_database(db) -> void :
|
||||
@@ -92,9 +92,9 @@ func get_db_name() -> String :
|
||||
func set_dirty(dirty) -> void :
|
||||
if(dirty):
|
||||
var title = m_name + "*"
|
||||
.set_name(title)
|
||||
super.set_name(title)
|
||||
else:
|
||||
.set_name(m_name)
|
||||
super.set_name(m_name)
|
||||
|
||||
# called when the user presses the "add_table" button from the "tables_list/tables_header"
|
||||
func on_add_table() -> void :
|
||||
@@ -102,13 +102,13 @@ func on_add_table() -> void :
|
||||
$new_table_dlg.set_dld_type(gddb_types.e_new_dlg_type_new)
|
||||
$new_table_dlg.set_table_id(gddb_constants.c_invalid_id)
|
||||
$new_table_dlg.set_init_name("")
|
||||
$new_table_dlg.connect("create_new_table", self, "on_create_table")
|
||||
$new_table_dlg.connect("create_new_table", Callable(self, "on_create_table"))
|
||||
$new_table_dlg.popup_centered()
|
||||
|
||||
# called when the user accepts the name of the table in the "new_table_dlg"
|
||||
func on_create_table(table_name : String) -> void :
|
||||
# print("GDDBEditor::on_create_table(" + table_name + ")")
|
||||
$new_table_dlg.disconnect("create_new_table", self, "on_create_table")
|
||||
$new_table_dlg.disconnect("create_new_table", Callable(self, "on_create_table"))
|
||||
var table_id = m_database.add_table(table_name)
|
||||
if(table_id == gddb_constants.c_invalid_id):
|
||||
$error_dlg.set_text("Table with the name \"" + table_name + "\" already exists" )
|
||||
@@ -132,7 +132,7 @@ func on_edit_table(table_id : int, table_name : String) -> void :
|
||||
$new_table_dlg.set_dld_type(gddb_types.e_new_dlg_type_edit)
|
||||
$new_table_dlg.set_table_id(table_id)
|
||||
$new_table_dlg.set_init_name(table_name)
|
||||
$new_table_dlg.connect("create_new_table", self, "on_table_name_edited")
|
||||
$new_table_dlg.connect("create_new_table", Callable(self, "on_table_name_edited"))
|
||||
$new_table_dlg.popup_centered()
|
||||
|
||||
# gets called when canceling the new_table_dlg
|
||||
@@ -140,9 +140,9 @@ func on_close_new_table_dlg() -> void :
|
||||
# print("GDDBEditor::on_close_new_table_dlg()")
|
||||
var dlg_type = $new_table_dlg.get_dlg_type()
|
||||
if(dlg_type == gddb_types.e_new_dlg_type_new):
|
||||
$new_table_dlg.disconnect("create_new_table", self, "on_create_table")
|
||||
$new_table_dlg.disconnect("create_new_table", Callable(self, "on_create_table"))
|
||||
elif(dlg_type == gddb_types.e_new_dlg_type_edit):
|
||||
$new_table_dlg.disconnect("create_new_table", self, "on_table_name_edited")
|
||||
$new_table_dlg.disconnect("create_new_table", Callable(self, "on_table_name_edited"))
|
||||
|
||||
# called when the user presses the "delete_table" from the "tables/list/table"
|
||||
func on_delete_table(table_id : int) -> void :
|
||||
@@ -155,7 +155,7 @@ func on_delete_table(table_id : int) -> void :
|
||||
# called when the user accepts the name of the table in the "new_table_dlg"
|
||||
func on_table_name_edited(table_name : String) -> void :
|
||||
# print("GDDBEditor::on_table_name_edited(" + table_name + ")")
|
||||
$new_table_dlg.disconnect("create_new_table", self, "on_table_name_edited")
|
||||
$new_table_dlg.disconnect("create_new_table", Callable(self, "on_table_name_edited"))
|
||||
var table_id = $new_table_dlg.get_table_id()
|
||||
if(!m_database.edit_table_name(table_name, table_id)):
|
||||
$error_dlg.set_text("Table with the name \"" + table_name + "\" already exists" )
|
||||
@@ -198,7 +198,7 @@ func save_database() -> void:
|
||||
|
||||
# returns true if the database can be saved, otherwise false
|
||||
func can_save_database() -> bool:
|
||||
return !m_database.get_db_filepath().empty()
|
||||
return !m_database.get_db_filepath().is_empty()
|
||||
|
||||
# sets the database's path
|
||||
func set_database_filepath(filepath : String) -> void:
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
[ext_resource path="res://addons/godot_db_manager/dlgs/delete_table_dlg.tscn" type="PackedScene" id=6]
|
||||
[ext_resource path="res://addons/godot_db_manager/debug/dbg.tscn" type="PackedScene" id=7]
|
||||
|
||||
[node name="db_editor" type="Tabs"]
|
||||
[node name="db_editor" type="TabBar"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
tab_align = 0
|
||||
tab_alignment = 0
|
||||
tab_close_display_policy = 2
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
@@ -21,11 +21,11 @@ __meta__ = {
|
||||
|
||||
[node name="tables_list" parent="." instance=ExtResource( 2 )]
|
||||
anchor_right = 0.0
|
||||
margin_right = 170.0
|
||||
rect_min_size = Vector2( 180, 30 )
|
||||
offset_right = 170.0
|
||||
custom_minimum_size = Vector2( 180, 30 )
|
||||
|
||||
[node name="table_editor" parent="." instance=ExtResource( 4 )]
|
||||
margin_left = 181.0
|
||||
offset_left = 181.0
|
||||
|
||||
[node name="dbg" parent="." instance=ExtResource( 7 )]
|
||||
visible = false
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
@tool
|
||||
"""
|
||||
class GDDBInterface
|
||||
"""
|
||||
|
||||
class_name GDDBInterface
|
||||
|
||||
tool
|
||||
extends Control
|
||||
|
||||
var m_db_manager = null
|
||||
@@ -15,20 +15,20 @@ func _ready() -> void:
|
||||
m_db_manager = load(gddb_constants.c_addon_main_path + "core/db_man.gd").new()
|
||||
|
||||
# menu connections
|
||||
$dlg/menu.connect("new_database", self, "on_menu_new_database")
|
||||
$dlg/menu.connect("load_database", self, "on_menu_load_database")
|
||||
$dlg/menu.connect("save_database", self, "on_menu_save_database")
|
||||
$dlg/menu.connect("save_database_as", self, "on_menu_save_database_as")
|
||||
$dlg/menu.connect("new_database", Callable(self, "on_menu_new_database"))
|
||||
$dlg/menu.connect("load_database", Callable(self, "on_menu_load_database"))
|
||||
$dlg/menu.connect("save_database", Callable(self, "on_menu_save_database"))
|
||||
$dlg/menu.connect("save_database_as", Callable(self, "on_menu_save_database_as"))
|
||||
|
||||
# dialod notifications
|
||||
$dlg.connect("about_to_show", self, "on_about_to_show")
|
||||
$dlg.get_close_button().connect("pressed", self, "on_close")
|
||||
$dlg.connect("about_to_popup", Callable(self, "on_about_to_show"))
|
||||
$dlg.get_close_button().connect("pressed", Callable(self, "on_close"))
|
||||
|
||||
# new database connections
|
||||
$dlg/new_db_dlg.connect("create_new_db", self, "on_new_database")
|
||||
$dlg/new_db_dlg.connect("create_new_db", Callable(self, "on_new_database"))
|
||||
|
||||
# save / load connections
|
||||
$dlg/load_db_dlg.connect("file_selected", self, "on_file_selected")
|
||||
$dlg/load_db_dlg.connect("file_selected", Callable(self, "on_file_selected"))
|
||||
|
||||
# Called when the node is about to be shown.
|
||||
func on_about_to_show() -> void :
|
||||
@@ -44,7 +44,7 @@ func on_menu_new_database() -> void:
|
||||
|
||||
# called when loading a database from the menu
|
||||
func on_menu_load_database() -> void:
|
||||
$dlg/load_db_dlg.set_mode(FileDialog.MODE_OPEN_FILE)
|
||||
$dlg/load_db_dlg.set_mode(FileDialog.FILE_MODE_OPEN_FILE)
|
||||
$dlg/load_db_dlg.set_title("Load Database ...")
|
||||
$dlg/load_db_dlg.set_current_file("")
|
||||
$dlg/load_db_dlg.popup_centered()
|
||||
@@ -61,7 +61,7 @@ func on_menu_save_database() -> void:
|
||||
# called when saving a database as another from the menu
|
||||
func on_menu_save_database_as():
|
||||
# print("on_menu_save_database_as")
|
||||
$dlg/load_db_dlg.set_mode(FileDialog.MODE_SAVE_FILE)
|
||||
$dlg/load_db_dlg.set_mode(FileDialog.FILE_MODE_SAVE_FILE)
|
||||
$dlg/load_db_dlg.set_title("Save Database As ...")
|
||||
|
||||
var currnet_tab = $dlg/databases.get_current_tab_control()
|
||||
@@ -81,7 +81,7 @@ func on_new_database(db_name : String) -> void:
|
||||
var db = m_db_manager.get_db_by_id(db_id)
|
||||
# print("new DB added: " + str(db))
|
||||
|
||||
var db_editor = load(gddb_constants.c_addon_main_path + "db_editor.tscn").instance()
|
||||
var db_editor = load(gddb_constants.c_addon_main_path + "db_editor.tscn").instantiate()
|
||||
$dlg/databases.add_child(db_editor)
|
||||
db_editor.set_name(db_name)
|
||||
db.set_dirty(true)
|
||||
@@ -96,7 +96,7 @@ func on_new_database(db_name : String) -> void:
|
||||
func on_file_selected(filepath : String) -> void:
|
||||
# print("GDDBInterface::on_file_selected(" + filepath + ")")
|
||||
|
||||
if($dlg/load_db_dlg.get_mode() == FileDialog.MODE_SAVE_FILE):
|
||||
if($dlg/load_db_dlg.get_mode() == FileDialog.FILE_MODE_SAVE_FILE):
|
||||
var filepath_low = filepath.to_lower()
|
||||
|
||||
# check for the file extension
|
||||
@@ -117,7 +117,7 @@ func on_file_selected(filepath : String) -> void:
|
||||
|
||||
save_database_as(filepath)
|
||||
|
||||
elif($dlg/load_db_dlg.get_mode() == FileDialog.MODE_OPEN_FILE):
|
||||
elif($dlg/load_db_dlg.get_mode() == FileDialog.FILE_MODE_OPEN_FILE):
|
||||
load_database(filepath)
|
||||
|
||||
# saves a database to a given file path
|
||||
@@ -144,7 +144,7 @@ func load_database(filepath : String) -> void:
|
||||
db.set_dirty(false)
|
||||
# print("new DB added: " + str(db))
|
||||
|
||||
var db_editor = load(gddb_constants.c_addon_main_path + "db_editor.tscn").instance()
|
||||
var db_editor = load(gddb_constants.c_addon_main_path + "db_editor.tscn").instantiate()
|
||||
$dlg/databases.add_child(db_editor)
|
||||
db_editor.set_name(db.get_db_name())
|
||||
db_editor.set_database(db)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/debug/dbg.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_18.tres" type="DynamicFont" id=2]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_18.tres" type="FontFile" id=2]
|
||||
[ext_resource path="res://addons/godot_db_manager/dlgs/error_dlg.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://addons/godot_db_manager/db_interface.gd" type="Script" id=4]
|
||||
[ext_resource path="res://addons/godot_db_manager/dlgs/new_db_dlg.tscn" type="PackedScene" id=5]
|
||||
@@ -14,11 +14,11 @@ __meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="dlg" type="WindowDialog" parent="."]
|
||||
[node name="dlg" type="Window" parent="."]
|
||||
visible = true
|
||||
margin_right = 1147.0
|
||||
margin_bottom = 768.0
|
||||
popup_exclusive = true
|
||||
offset_right = 1147.0
|
||||
offset_bottom = 768.0
|
||||
exclusive = true
|
||||
window_title = "Godot Database Manager"
|
||||
resizable = true
|
||||
__meta__ = {
|
||||
@@ -30,9 +30,9 @@ __meta__ = {
|
||||
[node name="databases" type="TabContainer" parent="dlg"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_top = 30.0
|
||||
custom_fonts/font = ExtResource( 2 )
|
||||
tab_align = 0
|
||||
offset_top = 30.0
|
||||
theme_override_fonts/font = ExtResource( 2 )
|
||||
tab_alignment = 0
|
||||
drag_to_rearrange_enabled = true
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
@@ -40,23 +40,23 @@ __meta__ = {
|
||||
|
||||
[node name="new_db_dlg" parent="dlg" instance=ExtResource( 5 )]
|
||||
visible = false
|
||||
margin_right = 3.832
|
||||
offset_right = 3.832
|
||||
|
||||
[node name="error_dlg" parent="dlg" instance=ExtResource( 3 )]
|
||||
visible = false
|
||||
anchor_right = 0.187
|
||||
anchor_bottom = 0.136
|
||||
margin_right = 0.469986
|
||||
margin_bottom = -0.0800018
|
||||
offset_right = 0.469986
|
||||
offset_bottom = -0.0800018
|
||||
|
||||
[node name="load_db_dlg" type="FileDialog" parent="dlg"]
|
||||
anchor_right = 0.349
|
||||
anchor_bottom = 0.418
|
||||
margin_right = -0.309998
|
||||
margin_bottom = 0.209991
|
||||
offset_right = -0.309998
|
||||
offset_bottom = 0.209991
|
||||
window_title = "Open a File"
|
||||
mode = 0
|
||||
filters = PoolStringArray( "*.json" )
|
||||
filters = PackedStringArray( "*.json" )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
"""
|
||||
class GDDBManager
|
||||
"""
|
||||
|
||||
class_name GDDBManager
|
||||
|
||||
tool
|
||||
extends EditorPlugin
|
||||
|
||||
var DBInterface = preload("./db_interface.tscn")
|
||||
var db_interface : Node
|
||||
|
||||
func _enter_tree():
|
||||
add_autoload_singleton("gddb_constants", "res://addons/godot_db_manager/core/GDDBConstants.gd")
|
||||
add_autoload_singleton("gddb_types", "res://addons/godot_db_manager/core/GDDBTypes.gd")
|
||||
add_autoload_singleton("gddb_globals", "res://addons/godot_db_manager/core/GDDBGlobals.gd")
|
||||
|
||||
# Initialization of the plugin goes here
|
||||
db_interface = DBInterface.instance()
|
||||
|
||||
get_editor_interface().get_base_control().add_child(db_interface)
|
||||
add_tool_menu_item("Godot Database Manager", self, "open_config")
|
||||
|
||||
func _exit_tree():
|
||||
# Clean-up of the plugin goes here
|
||||
remove_tool_menu_item("Godot Database Manager")
|
||||
if(db_interface):
|
||||
db_interface.queue_free()
|
||||
|
||||
func open_config(UD):
|
||||
var window = db_interface.get_node("dlg") as WindowDialog
|
||||
if(window):
|
||||
window.popup_centered()
|
||||
@tool
|
||||
"""
|
||||
class GDDBManager
|
||||
"""
|
||||
|
||||
class_name GDDBManager
|
||||
|
||||
extends EditorPlugin
|
||||
|
||||
var DBInterface = preload("./db_interface.tscn")
|
||||
var db_interface : Node
|
||||
|
||||
func _enter_tree():
|
||||
add_autoload_singleton("gddb_constants", "res://addons/godot_db_manager/core/GDDBConstants.gd")
|
||||
add_autoload_singleton("gddb_types", "res://addons/godot_db_manager/core/GDDBTypes.gd")
|
||||
add_autoload_singleton("gddb_globals", "res://addons/godot_db_manager/core/GDDBGlobals.gd")
|
||||
|
||||
# Initialization of the plugin goes here
|
||||
db_interface = DBInterface.instantiate()
|
||||
|
||||
get_editor_interface().get_base_control().add_child(db_interface)
|
||||
add_tool_menu_item("Godot Database Manager", self, "open_config")
|
||||
|
||||
func _exit_tree():
|
||||
# Clean-up of the plugin goes here
|
||||
remove_tool_menu_item("Godot Database Manager")
|
||||
if(db_interface):
|
||||
db_interface.queue_free()
|
||||
|
||||
func open_config(UD):
|
||||
var window = db_interface.get_node("dlg") as Window
|
||||
if(window):
|
||||
window.popup_centered()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/tex/debug.png" type="Texture" id=1]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/tex/debug.png" type="Texture2D" id=1]
|
||||
|
||||
[node name="dbg" type="Control"]
|
||||
anchor_right = 1.0
|
||||
@@ -11,14 +11,14 @@ __meta__ = {
|
||||
}
|
||||
|
||||
[node name="1" type="Control" parent="."]
|
||||
margin_right = 40.0
|
||||
margin_bottom = 40.0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
mouse_filter = 2
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="1"]
|
||||
[node name="Sprite2D" type="Sprite2D" parent="1"]
|
||||
scale = Vector2( 4, 4 )
|
||||
texture = ExtResource( 1 )
|
||||
centered = false
|
||||
@@ -28,14 +28,14 @@ region_rect = Rect2( 2, 50, 10, 10 )
|
||||
[node name="2" type="Control" parent="."]
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
margin_left = -40.0
|
||||
margin_bottom = 40.0
|
||||
offset_left = -40.0
|
||||
offset_bottom = 40.0
|
||||
mouse_filter = 2
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="2"]
|
||||
[node name="Sprite2D" type="Sprite2D" parent="2"]
|
||||
scale = Vector2( 4, 4 )
|
||||
texture = ExtResource( 1 )
|
||||
centered = false
|
||||
@@ -45,14 +45,14 @@ region_rect = Rect2( 2, 50, 10, 10 )
|
||||
[node name="3" type="Control" parent="."]
|
||||
anchor_top = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_top = -40.0
|
||||
margin_right = 40.0
|
||||
offset_top = -40.0
|
||||
offset_right = 40.0
|
||||
mouse_filter = 2
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="3"]
|
||||
[node name="Sprite2D" type="Sprite2D" parent="3"]
|
||||
scale = Vector2( 4, 4 )
|
||||
texture = ExtResource( 1 )
|
||||
centered = false
|
||||
@@ -64,14 +64,14 @@ anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -40.0
|
||||
margin_top = -40.0
|
||||
offset_left = -40.0
|
||||
offset_top = -40.0
|
||||
mouse_filter = 2
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="4"]
|
||||
[node name="Sprite2D" type="Sprite2D" parent="4"]
|
||||
scale = Vector2( 4, 4 )
|
||||
texture = ExtResource( 1 )
|
||||
centered = false
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
@tool
|
||||
"""
|
||||
class GDDBDataPanel
|
||||
"""
|
||||
|
||||
class_name GDDBDataPanel
|
||||
|
||||
tool
|
||||
extends PopupPanel
|
||||
|
||||
signal select_data
|
||||
@@ -16,8 +16,8 @@ var m_table = null
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
connect("about_to_show", self, "on_about_to_show")
|
||||
$ItemList.connect("item_selected", self, "on_item_selected")
|
||||
connect("about_to_popup", Callable(self, "on_about_to_show"))
|
||||
$ItemList.connect("item_selected", Callable(self, "on_item_selected"))
|
||||
|
||||
# sets property id
|
||||
func set_prop_id(prop_id : int) -> void :
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/dlgs/data_dlg.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_12.tres" type="DynamicFont" id=2]
|
||||
|
||||
[node name="data_dlg" type="PopupPanel"]
|
||||
anchor_right = 0.285625
|
||||
anchor_bottom = 0.351111
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ItemList" type="ItemList" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 4.0
|
||||
margin_top = 4.0
|
||||
margin_right = -4.0
|
||||
margin_bottom = -4.0
|
||||
custom_fonts/font = ExtResource( 2 )
|
||||
items = [ "ababab", null, false, "cdcdcd", null, false, "efefef", null, false ]
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/dlgs/data_dlg.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_12.tres" type="FontFile" id=2]
|
||||
|
||||
[node name="data_dlg" type="PopupPanel"]
|
||||
anchor_right = 0.285625
|
||||
anchor_bottom = 0.351111
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ItemList" type="ItemList" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_left = 4.0
|
||||
offset_top = 4.0
|
||||
offset_right = -4.0
|
||||
offset_bottom = -4.0
|
||||
theme_override_fonts/font = ExtResource( 2 )
|
||||
items = [ "ababab", null, false, "cdcdcd", null, false, "efefef", null, false ]
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
@@ -1,41 +1,41 @@
|
||||
"""
|
||||
class GDDBDeletePropDlg
|
||||
"""
|
||||
|
||||
class_name GDDBDeletePropDlg
|
||||
|
||||
tool
|
||||
extends WindowDialog
|
||||
|
||||
signal delete_prop
|
||||
|
||||
var m_prop_id = gddb_constants.c_invalid_id
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void :
|
||||
$v_layout/buttons/ok_btn.connect("pressed", self, "on_ok_btn_pressed")
|
||||
$v_layout/buttons/cancel_btn.connect("pressed", self, "on_cancel_btn_pressed")
|
||||
|
||||
# sets the property id
|
||||
func set_prop_id(prop_id : int) -> void :
|
||||
m_prop_id = prop_id
|
||||
|
||||
# returns the property id
|
||||
func get_prop_id() -> int :
|
||||
return m_prop_id
|
||||
|
||||
func set_prop_name(prop_name : String) -> void:
|
||||
var text = "Delete property with name \"" + prop_name + "\" ?"
|
||||
$v_layout/prop_info/prop_lbl.set_text(text)
|
||||
|
||||
# returns the table id
|
||||
func get_table_id() -> int :
|
||||
return m_prop_id
|
||||
|
||||
# called when the OK button is pressed
|
||||
func on_ok_btn_pressed() -> void :
|
||||
emit_signal("delete_prop")
|
||||
hide()
|
||||
|
||||
func on_cancel_btn_pressed() -> void:
|
||||
hide()
|
||||
@tool
|
||||
"""
|
||||
class GDDBDeletePropDlg
|
||||
"""
|
||||
|
||||
class_name GDDBDeletePropDlg
|
||||
|
||||
extends Window
|
||||
|
||||
signal delete_prop
|
||||
|
||||
var m_prop_id = gddb_constants.c_invalid_id
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void :
|
||||
$v_layout/buttons/ok_btn.connect("pressed", Callable(self, "on_ok_btn_pressed"))
|
||||
$v_layout/buttons/cancel_btn.connect("pressed", Callable(self, "on_cancel_btn_pressed"))
|
||||
|
||||
# sets the property id
|
||||
func set_prop_id(prop_id : int) -> void :
|
||||
m_prop_id = prop_id
|
||||
|
||||
# returns the property id
|
||||
func get_prop_id() -> int :
|
||||
return m_prop_id
|
||||
|
||||
func set_prop_name(prop_name : String) -> void:
|
||||
var text = "Delete property with name \"" + prop_name + "\" ?"
|
||||
$v_layout/prop_info/prop_lbl.set_text(text)
|
||||
|
||||
# returns the table id
|
||||
func get_table_id() -> int :
|
||||
return m_prop_id
|
||||
|
||||
# called when the OK button is pressed
|
||||
func on_ok_btn_pressed() -> void :
|
||||
emit_signal("delete_prop")
|
||||
hide()
|
||||
|
||||
func on_cancel_btn_pressed() -> void:
|
||||
hide()
|
||||
|
||||
@@ -1,66 +1,66 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/dlgs/delete_prop_dlg.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_14.tres" type="DynamicFont" id=2]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_12.tres" type="DynamicFont" id=3]
|
||||
|
||||
[node name="delete_prop_dlg" type="WindowDialog"]
|
||||
visible = true
|
||||
anchor_right = 0.257
|
||||
anchor_bottom = 0.084
|
||||
margin_right = 0.799988
|
||||
margin_bottom = 0.399994
|
||||
focus_next = NodePath("v_layout/buttons/ok_btn")
|
||||
focus_mode = 1
|
||||
custom_fonts/title_font = ExtResource( 2 )
|
||||
popup_exclusive = true
|
||||
window_title = "Delete property"
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="v_layout" type="VBoxContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
custom_constants/separation = 10
|
||||
alignment = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="prop_info" type="HBoxContainer" parent="v_layout"]
|
||||
margin_top = 13.0
|
||||
margin_right = 412.0
|
||||
margin_bottom = 30.0
|
||||
alignment = 1
|
||||
|
||||
[node name="prop_lbl" type="Label" parent="v_layout/prop_info"]
|
||||
margin_left = 152.0
|
||||
margin_right = 259.0
|
||||
margin_bottom = 17.0
|
||||
custom_fonts/font = ExtResource( 2 )
|
||||
text = "Property name: "
|
||||
|
||||
[node name="buttons" type="HBoxContainer" parent="v_layout"]
|
||||
margin_top = 40.0
|
||||
margin_right = 412.0
|
||||
margin_bottom = 61.0
|
||||
custom_constants/separation = 50
|
||||
alignment = 1
|
||||
|
||||
[node name="ok_btn" type="Button" parent="v_layout/buttons"]
|
||||
margin_left = 81.0
|
||||
margin_right = 181.0
|
||||
margin_bottom = 21.0
|
||||
rect_min_size = Vector2( 100, 0 )
|
||||
custom_fonts/font = ExtResource( 3 )
|
||||
text = "OK"
|
||||
|
||||
[node name="cancel_btn" type="Button" parent="v_layout/buttons"]
|
||||
margin_left = 231.0
|
||||
margin_right = 331.0
|
||||
margin_bottom = 21.0
|
||||
rect_min_size = Vector2( 100, 0 )
|
||||
custom_fonts/font = ExtResource( 3 )
|
||||
text = "Cancel"
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/dlgs/delete_prop_dlg.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_14.tres" type="FontFile" id=2]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_12.tres" type="FontFile" id=3]
|
||||
|
||||
[node name="delete_prop_dlg" type="Window"]
|
||||
visible = true
|
||||
anchor_right = 0.257
|
||||
anchor_bottom = 0.084
|
||||
offset_right = 0.799988
|
||||
offset_bottom = 0.399994
|
||||
focus_next = NodePath("v_layout/buttons/ok_btn")
|
||||
focus_mode = 1
|
||||
theme_override_fonts/title_font = ExtResource( 2 )
|
||||
exclusive = true
|
||||
window_title = "Delete property"
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="v_layout" type="VBoxContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
theme_override_constants/separation = 10
|
||||
alignment = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="prop_info" type="HBoxContainer" parent="v_layout"]
|
||||
offset_top = 13.0
|
||||
offset_right = 412.0
|
||||
offset_bottom = 30.0
|
||||
alignment = 1
|
||||
|
||||
[node name="prop_lbl" type="Label" parent="v_layout/prop_info"]
|
||||
offset_left = 152.0
|
||||
offset_right = 259.0
|
||||
offset_bottom = 17.0
|
||||
theme_override_fonts/font = ExtResource( 2 )
|
||||
text = "Property name: "
|
||||
|
||||
[node name="buttons" type="HBoxContainer" parent="v_layout"]
|
||||
offset_top = 40.0
|
||||
offset_right = 412.0
|
||||
offset_bottom = 61.0
|
||||
theme_override_constants/separation = 50
|
||||
alignment = 1
|
||||
|
||||
[node name="ok_btn" type="Button" parent="v_layout/buttons"]
|
||||
offset_left = 81.0
|
||||
offset_right = 181.0
|
||||
offset_bottom = 21.0
|
||||
custom_minimum_size = Vector2( 100, 0 )
|
||||
theme_override_fonts/font = ExtResource( 3 )
|
||||
text = "OK"
|
||||
|
||||
[node name="cancel_btn" type="Button" parent="v_layout/buttons"]
|
||||
offset_left = 231.0
|
||||
offset_right = 331.0
|
||||
offset_bottom = 21.0
|
||||
custom_minimum_size = Vector2( 100, 0 )
|
||||
theme_override_fonts/font = ExtResource( 3 )
|
||||
text = "Cancel"
|
||||
|
||||
@@ -1,37 +1,37 @@
|
||||
"""
|
||||
class GDDBDeleteTableDlg
|
||||
"""
|
||||
|
||||
class_name GDDBDeleteTableDlg
|
||||
|
||||
tool
|
||||
extends WindowDialog
|
||||
|
||||
signal delete_table
|
||||
|
||||
var m_table_id = gddb_constants.c_invalid_id
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
$v_layout/buttons/ok_btn.connect("pressed", self, "on_ok_btn_pressed")
|
||||
$v_layout/buttons/cancel_btn.connect("pressed", self, "on_cancel_btn_pressed")
|
||||
|
||||
# sets the table id
|
||||
func set_table_id(table_id : int) -> void:
|
||||
m_table_id = table_id
|
||||
|
||||
func set_table_name(table_name : String) -> void:
|
||||
var text = "Delete table with name \"" + table_name + "\" ?"
|
||||
$v_layout/table_info/table_lbl.set_text(text)
|
||||
|
||||
# returns the table id
|
||||
func get_table_id() -> int:
|
||||
return m_table_id
|
||||
|
||||
# called when the OK button is pressed
|
||||
func on_ok_btn_pressed() -> void:
|
||||
emit_signal("delete_table")
|
||||
hide()
|
||||
|
||||
func on_cancel_btn_pressed() -> void:
|
||||
hide()
|
||||
@tool
|
||||
"""
|
||||
class GDDBDeleteTableDlg
|
||||
"""
|
||||
|
||||
class_name GDDBDeleteTableDlg
|
||||
|
||||
extends Window
|
||||
|
||||
signal delete_table
|
||||
|
||||
var m_table_id = gddb_constants.c_invalid_id
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
$v_layout/buttons/ok_btn.connect("pressed", Callable(self, "on_ok_btn_pressed"))
|
||||
$v_layout/buttons/cancel_btn.connect("pressed", Callable(self, "on_cancel_btn_pressed"))
|
||||
|
||||
# sets the table id
|
||||
func set_table_id(table_id : int) -> void:
|
||||
m_table_id = table_id
|
||||
|
||||
func set_table_name(table_name : String) -> void:
|
||||
var text = "Delete table with name \"" + table_name + "\" ?"
|
||||
$v_layout/table_info/table_lbl.set_text(text)
|
||||
|
||||
# returns the table id
|
||||
func get_table_id() -> int:
|
||||
return m_table_id
|
||||
|
||||
# called when the OK button is pressed
|
||||
func on_ok_btn_pressed() -> void:
|
||||
emit_signal("delete_table")
|
||||
hide()
|
||||
|
||||
func on_cancel_btn_pressed() -> void:
|
||||
hide()
|
||||
|
||||
@@ -1,66 +1,66 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/dlgs/delete_table_dlg.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_14.tres" type="DynamicFont" id=2]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_12.tres" type="DynamicFont" id=3]
|
||||
|
||||
[node name="delete_table_dlg" type="WindowDialog"]
|
||||
visible = true
|
||||
anchor_right = 0.257
|
||||
anchor_bottom = 0.084
|
||||
margin_right = 0.799988
|
||||
margin_bottom = 0.399994
|
||||
focus_next = NodePath("v_layout/buttons/ok_btn")
|
||||
focus_mode = 1
|
||||
custom_fonts/title_font = ExtResource( 2 )
|
||||
popup_exclusive = true
|
||||
window_title = "Delete table"
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="v_layout" type="VBoxContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
custom_constants/separation = 10
|
||||
alignment = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="table_info" type="HBoxContainer" parent="v_layout"]
|
||||
margin_top = 13.0
|
||||
margin_right = 412.0
|
||||
margin_bottom = 30.0
|
||||
alignment = 1
|
||||
|
||||
[node name="table_lbl" type="Label" parent="v_layout/table_info"]
|
||||
margin_left = 162.0
|
||||
margin_right = 249.0
|
||||
margin_bottom = 17.0
|
||||
custom_fonts/font = ExtResource( 2 )
|
||||
text = "Table name: "
|
||||
|
||||
[node name="buttons" type="HBoxContainer" parent="v_layout"]
|
||||
margin_top = 40.0
|
||||
margin_right = 412.0
|
||||
margin_bottom = 61.0
|
||||
custom_constants/separation = 50
|
||||
alignment = 1
|
||||
|
||||
[node name="ok_btn" type="Button" parent="v_layout/buttons"]
|
||||
margin_left = 81.0
|
||||
margin_right = 181.0
|
||||
margin_bottom = 21.0
|
||||
rect_min_size = Vector2( 100, 0 )
|
||||
custom_fonts/font = ExtResource( 3 )
|
||||
text = "OK"
|
||||
|
||||
[node name="cancel_btn" type="Button" parent="v_layout/buttons"]
|
||||
margin_left = 231.0
|
||||
margin_right = 331.0
|
||||
margin_bottom = 21.0
|
||||
rect_min_size = Vector2( 100, 0 )
|
||||
custom_fonts/font = ExtResource( 3 )
|
||||
text = "Cancel"
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/dlgs/delete_table_dlg.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_14.tres" type="FontFile" id=2]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_12.tres" type="FontFile" id=3]
|
||||
|
||||
[node name="delete_table_dlg" type="Window"]
|
||||
visible = true
|
||||
anchor_right = 0.257
|
||||
anchor_bottom = 0.084
|
||||
offset_right = 0.799988
|
||||
offset_bottom = 0.399994
|
||||
focus_next = NodePath("v_layout/buttons/ok_btn")
|
||||
focus_mode = 1
|
||||
theme_override_fonts/title_font = ExtResource( 2 )
|
||||
exclusive = true
|
||||
window_title = "Delete table"
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="v_layout" type="VBoxContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
theme_override_constants/separation = 10
|
||||
alignment = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="table_info" type="HBoxContainer" parent="v_layout"]
|
||||
offset_top = 13.0
|
||||
offset_right = 412.0
|
||||
offset_bottom = 30.0
|
||||
alignment = 1
|
||||
|
||||
[node name="table_lbl" type="Label" parent="v_layout/table_info"]
|
||||
offset_left = 162.0
|
||||
offset_right = 249.0
|
||||
offset_bottom = 17.0
|
||||
theme_override_fonts/font = ExtResource( 2 )
|
||||
text = "Table name: "
|
||||
|
||||
[node name="buttons" type="HBoxContainer" parent="v_layout"]
|
||||
offset_top = 40.0
|
||||
offset_right = 412.0
|
||||
offset_bottom = 61.0
|
||||
theme_override_constants/separation = 50
|
||||
alignment = 1
|
||||
|
||||
[node name="ok_btn" type="Button" parent="v_layout/buttons"]
|
||||
offset_left = 81.0
|
||||
offset_right = 181.0
|
||||
offset_bottom = 21.0
|
||||
custom_minimum_size = Vector2( 100, 0 )
|
||||
theme_override_fonts/font = ExtResource( 3 )
|
||||
text = "OK"
|
||||
|
||||
[node name="cancel_btn" type="Button" parent="v_layout/buttons"]
|
||||
offset_left = 231.0
|
||||
offset_right = 331.0
|
||||
offset_bottom = 21.0
|
||||
custom_minimum_size = Vector2( 100, 0 )
|
||||
theme_override_fonts/font = ExtResource( 3 )
|
||||
text = "Cancel"
|
||||
|
||||
@@ -1,59 +1,59 @@
|
||||
"""
|
||||
class GDDBEditStringDlg
|
||||
"""
|
||||
|
||||
class_name GDDBEditStringDlg
|
||||
|
||||
tool
|
||||
extends WindowDialog
|
||||
|
||||
signal string_edited
|
||||
|
||||
var m_prop_id = gddb_constants.c_invalid_id
|
||||
var m_row_idx = gddb_constants.c_invalid_id
|
||||
var m_data_text = ""
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
$v_layout/btns/ok_btn.connect("pressed", self, "on_ok_btn_pressed")
|
||||
$v_layout/btns/cancel_btn.connect("pressed", self, "on_cancel_btn_pressed")
|
||||
|
||||
$v_layout/text.connect("text_changed", self, "on_text_changed")
|
||||
|
||||
# sets property id
|
||||
func set_prop_id(prop_id : int) -> void:
|
||||
m_prop_id = prop_id
|
||||
|
||||
# returns property id
|
||||
func get_prop_id() -> int :
|
||||
return m_prop_id
|
||||
|
||||
# sets row index
|
||||
func set_row_idx(row_idx : int) -> void :
|
||||
m_row_idx = row_idx
|
||||
|
||||
# returns row index
|
||||
func get_row_idx() -> int :
|
||||
return m_row_idx
|
||||
|
||||
# sets data text
|
||||
func set_data_text(text : String) -> void :
|
||||
m_data_text = text
|
||||
$v_layout/text.set_text(text)
|
||||
|
||||
# returns data text
|
||||
func get_data_text() -> String :
|
||||
return m_data_text
|
||||
|
||||
# Called when the OK button is pressed
|
||||
func on_ok_btn_pressed() -> void :
|
||||
emit_signal("string_edited")
|
||||
hide()
|
||||
|
||||
# Called when the Cancel button is pressed
|
||||
func on_cancel_btn_pressed() -> void :
|
||||
hide()
|
||||
|
||||
# Called when text is changed
|
||||
func on_text_changed() -> void:
|
||||
m_data_text = $v_layout/text.get_text()
|
||||
@tool
|
||||
"""
|
||||
class GDDBEditStringDlg
|
||||
"""
|
||||
|
||||
class_name GDDBEditStringDlg
|
||||
|
||||
extends Window
|
||||
|
||||
signal string_edited
|
||||
|
||||
var m_prop_id = gddb_constants.c_invalid_id
|
||||
var m_row_idx = gddb_constants.c_invalid_id
|
||||
var m_data_text = ""
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
$v_layout/btns/ok_btn.connect("pressed", Callable(self, "on_ok_btn_pressed"))
|
||||
$v_layout/btns/cancel_btn.connect("pressed", Callable(self, "on_cancel_btn_pressed"))
|
||||
|
||||
$v_layout/text.connect("text_changed", Callable(self, "on_text_changed"))
|
||||
|
||||
# sets property id
|
||||
func set_prop_id(prop_id : int) -> void:
|
||||
m_prop_id = prop_id
|
||||
|
||||
# returns property id
|
||||
func get_prop_id() -> int :
|
||||
return m_prop_id
|
||||
|
||||
# sets row index
|
||||
func set_row_idx(row_idx : int) -> void :
|
||||
m_row_idx = row_idx
|
||||
|
||||
# returns row index
|
||||
func get_row_idx() -> int :
|
||||
return m_row_idx
|
||||
|
||||
# sets data text
|
||||
func set_data_text(text : String) -> void :
|
||||
m_data_text = text
|
||||
$v_layout/text.set_text(text)
|
||||
|
||||
# returns data text
|
||||
func get_data_text() -> String :
|
||||
return m_data_text
|
||||
|
||||
# Called when the OK button is pressed
|
||||
func on_ok_btn_pressed() -> void :
|
||||
emit_signal("string_edited")
|
||||
hide()
|
||||
|
||||
# Called when the Cancel button is pressed
|
||||
func on_cancel_btn_pressed() -> void :
|
||||
hide()
|
||||
|
||||
# Called when text is changed
|
||||
func on_text_changed() -> void:
|
||||
m_data_text = $v_layout/text.get_text()
|
||||
|
||||
@@ -1,60 +1,60 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/dlgs/edit_string_dlg.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_14.tres" type="DynamicFont" id=2]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_12.tres" type="DynamicFont" id=3]
|
||||
|
||||
[node name="edit_string_dlg" type="WindowDialog"]
|
||||
anchor_right = 0.430625
|
||||
anchor_bottom = 0.423333
|
||||
focus_next = NodePath("v_layout/text")
|
||||
custom_fonts/title_font = ExtResource( 3 )
|
||||
window_title = "Edit string"
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": true
|
||||
}
|
||||
|
||||
[node name="v_layout" type="VBoxContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="edit_text_btns" type="HBoxContainer" parent="v_layout"]
|
||||
margin_right = 689.0
|
||||
margin_bottom = 30.0
|
||||
rect_min_size = Vector2( 0, 30 )
|
||||
|
||||
[node name="text" type="TextEdit" parent="v_layout"]
|
||||
margin_top = 34.0
|
||||
margin_right = 689.0
|
||||
margin_bottom = 334.0
|
||||
rect_min_size = Vector2( 0, 300 )
|
||||
custom_fonts/font = ExtResource( 2 )
|
||||
caret_blink = true
|
||||
|
||||
[node name="btns" type="HBoxContainer" parent="v_layout"]
|
||||
margin_top = 338.0
|
||||
margin_right = 689.0
|
||||
margin_bottom = 368.0
|
||||
rect_min_size = Vector2( 0, 30 )
|
||||
custom_constants/separation = 200
|
||||
alignment = 1
|
||||
|
||||
[node name="ok_btn" type="Button" parent="v_layout/btns"]
|
||||
margin_left = 144.0
|
||||
margin_right = 244.0
|
||||
margin_bottom = 30.0
|
||||
rect_min_size = Vector2( 100, 0 )
|
||||
custom_fonts/font = ExtResource( 3 )
|
||||
text = "OK"
|
||||
|
||||
[node name="cancel_btn" type="Button" parent="v_layout/btns"]
|
||||
margin_left = 444.0
|
||||
margin_right = 544.0
|
||||
margin_bottom = 30.0
|
||||
rect_min_size = Vector2( 100, 0 )
|
||||
custom_fonts/font = ExtResource( 3 )
|
||||
text = "Cancel"
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/dlgs/edit_string_dlg.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_14.tres" type="FontFile" id=2]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_12.tres" type="FontFile" id=3]
|
||||
|
||||
[node name="edit_string_dlg" type="Window"]
|
||||
anchor_right = 0.430625
|
||||
anchor_bottom = 0.423333
|
||||
focus_next = NodePath("v_layout/text")
|
||||
theme_override_fonts/title_font = ExtResource( 3 )
|
||||
window_title = "Edit string"
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": true
|
||||
}
|
||||
|
||||
[node name="v_layout" type="VBoxContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="edit_text_btns" type="HBoxContainer" parent="v_layout"]
|
||||
offset_right = 689.0
|
||||
offset_bottom = 30.0
|
||||
custom_minimum_size = Vector2( 0, 30 )
|
||||
|
||||
[node name="text" type="TextEdit" parent="v_layout"]
|
||||
offset_top = 34.0
|
||||
offset_right = 689.0
|
||||
offset_bottom = 334.0
|
||||
custom_minimum_size = Vector2( 0, 300 )
|
||||
theme_override_fonts/font = ExtResource( 2 )
|
||||
caret_blink = true
|
||||
|
||||
[node name="btns" type="HBoxContainer" parent="v_layout"]
|
||||
offset_top = 338.0
|
||||
offset_right = 689.0
|
||||
offset_bottom = 368.0
|
||||
custom_minimum_size = Vector2( 0, 30 )
|
||||
theme_override_constants/separation = 200
|
||||
alignment = 1
|
||||
|
||||
[node name="ok_btn" type="Button" parent="v_layout/btns"]
|
||||
offset_left = 144.0
|
||||
offset_right = 244.0
|
||||
offset_bottom = 30.0
|
||||
custom_minimum_size = Vector2( 100, 0 )
|
||||
theme_override_fonts/font = ExtResource( 3 )
|
||||
text = "OK"
|
||||
|
||||
[node name="cancel_btn" type="Button" parent="v_layout/btns"]
|
||||
offset_left = 444.0
|
||||
offset_right = 544.0
|
||||
offset_bottom = 30.0
|
||||
custom_minimum_size = Vector2( 100, 0 )
|
||||
theme_override_fonts/font = ExtResource( 3 )
|
||||
text = "Cancel"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
[gd_scene format=2]
|
||||
|
||||
[node name="error_dlg" type="AcceptDialog"]
|
||||
visible = true
|
||||
anchor_right = 0.139
|
||||
anchor_bottom = 0.099
|
||||
margin_right = 0.599976
|
||||
margin_bottom = -0.100006
|
||||
popup_exclusive = true
|
||||
window_title = "Error"
|
||||
dialog_autowrap = true
|
||||
[gd_scene format=2]
|
||||
|
||||
[node name="error_dlg" type="AcceptDialog"]
|
||||
visible = true
|
||||
anchor_right = 0.139
|
||||
anchor_bottom = 0.099
|
||||
offset_right = 0.599976
|
||||
offset_bottom = -0.100006
|
||||
exclusive = true
|
||||
window_title = "Error"
|
||||
dialog_autowrap = true
|
||||
|
||||
@@ -1,76 +1,76 @@
|
||||
"""
|
||||
class GDDBLoadResourcePathDlg
|
||||
"""
|
||||
|
||||
class_name GDDBLoadResourcePathDlg
|
||||
|
||||
tool
|
||||
extends FileDialog
|
||||
|
||||
# TODO: put this list in a config file
|
||||
const file_filters = [
|
||||
# Godot resource file types
|
||||
"*.res, *.tres ; Godot resource file types",
|
||||
|
||||
# Godot scene files
|
||||
"*.scn, *.tscn, *escn ; Godot scene file types",
|
||||
|
||||
# Code file types
|
||||
"*.gd, *.cs, *.h, *.c, *.hpp, *.cpp ; Code file types",
|
||||
|
||||
# Shader file types
|
||||
"*.shader ; Shader file types",
|
||||
|
||||
# material file types
|
||||
"*.mat ; Material file types",
|
||||
|
||||
# mesh file types
|
||||
"*.dae, *.gltf, *.obj, *.fbx ; Mesh file types",
|
||||
|
||||
# animation file types
|
||||
"*.anim ; Animation file types",
|
||||
|
||||
# font file types
|
||||
"*.ttf, *.otf ; Font file types",
|
||||
|
||||
# image file types
|
||||
"*.png, *.jpg, *.jpeg, *.tiff, *.tga, *.bmp, *.webp, *.gif, *.hdr ; Images file types",
|
||||
|
||||
# soung file types
|
||||
"*.snd, *.wav, *.ogg, *.mp3 ; Sound file types",
|
||||
|
||||
# video file types
|
||||
"*.ogg, *.mpg, *.mpeg, *.avi, *.mov, *.mp4, *.webm ; Video file types",
|
||||
|
||||
# text file types
|
||||
"*.txt, *.csv, *.json, *.xml, *.cfg, *.ini ; Text file types",
|
||||
|
||||
# document file types
|
||||
"*.doc, *.docx, *.xls, *.xlsx, *.odt, *.ods, *.pdf ; Doc file types",
|
||||
|
||||
# binary data file types
|
||||
"*.dat, *.raw ; Binary data file types"
|
||||
]
|
||||
|
||||
var m_prop_id = gddb_constants.c_invalid_id
|
||||
var m_row_idx = gddb_constants.c_invalid_id
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
set_filters(PoolStringArray(file_filters))
|
||||
|
||||
# sets the property id
|
||||
func set_prop_id(prop_id : int) -> void :
|
||||
m_prop_id = prop_id
|
||||
|
||||
# returns the property id
|
||||
func get_prop_id() -> int :
|
||||
return m_prop_id
|
||||
|
||||
# sets the row index
|
||||
func set_row_idx(row_idx : int) -> void :
|
||||
m_row_idx = row_idx
|
||||
|
||||
# returns the row index
|
||||
func get_row_idx() -> int :
|
||||
return m_row_idx
|
||||
@tool
|
||||
"""
|
||||
class GDDBLoadResourcePathDlg
|
||||
"""
|
||||
|
||||
class_name GDDBLoadResourcePathDlg
|
||||
|
||||
extends FileDialog
|
||||
|
||||
# TODO: put this list in a config file
|
||||
const file_filters = [
|
||||
# Godot resource file types
|
||||
"*.res, *.tres ; Godot resource file types",
|
||||
|
||||
# Godot scene files
|
||||
"*.scn, *.tscn, *escn ; Godot scene file types",
|
||||
|
||||
# Code file types
|
||||
"*.gd, *.cs, *.h, *.c, *.hpp, *.cpp ; Code file types",
|
||||
|
||||
# Shader file types
|
||||
"*.shader ; Shader file types",
|
||||
|
||||
# material file types
|
||||
"*.mat ; Material file types",
|
||||
|
||||
# mesh file types
|
||||
"*.dae, *.gltf, *.obj, *.fbx ; Mesh file types",
|
||||
|
||||
# animation file types
|
||||
"*.anim ; Animation file types",
|
||||
|
||||
# font file types
|
||||
"*.ttf, *.otf ; Font file types",
|
||||
|
||||
# image file types
|
||||
"*.png, *.jpg, *.jpeg, *.tiff, *.tga, *.bmp, *.webp, *.gif, *.hdr ; Images file types",
|
||||
|
||||
# soung file types
|
||||
"*.snd, *.wav, *.ogg, *.mp3 ; Sound file types",
|
||||
|
||||
# video file types
|
||||
"*.ogg, *.mpg, *.mpeg, *.avi, *.mov, *.mp4, *.webm ; Video file types",
|
||||
|
||||
# text file types
|
||||
"*.txt, *.csv, *.json, *.xml, *.cfg, *.ini ; Text file types",
|
||||
|
||||
# document file types
|
||||
"*.doc, *.docx, *.xls, *.xlsx, *.odt, *.ods, *.pdf ; Doc file types",
|
||||
|
||||
# binary data file types
|
||||
"*.dat, *.raw ; Binary data file types"
|
||||
]
|
||||
|
||||
var m_prop_id = gddb_constants.c_invalid_id
|
||||
var m_row_idx = gddb_constants.c_invalid_id
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
set_filters(PackedStringArray(file_filters))
|
||||
|
||||
# sets the property id
|
||||
func set_prop_id(prop_id : int) -> void :
|
||||
m_prop_id = prop_id
|
||||
|
||||
# returns the property id
|
||||
func get_prop_id() -> int :
|
||||
return m_prop_id
|
||||
|
||||
# sets the row index
|
||||
func set_row_idx(row_idx : int) -> void :
|
||||
m_row_idx = row_idx
|
||||
|
||||
# returns the row index
|
||||
func get_row_idx() -> int :
|
||||
return m_row_idx
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/dlgs/load_res_path_dlg.gd" type="Script" id=1]
|
||||
|
||||
[node name="load_res_path_dlg" type="FileDialog"]
|
||||
anchor_right = 0.404
|
||||
anchor_bottom = 0.431
|
||||
margin_right = -0.400024
|
||||
margin_bottom = 0.0999756
|
||||
window_title = "Open a File"
|
||||
resizable = true
|
||||
mode = 0
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/dlgs/load_res_path_dlg.gd" type="Script" id=1]
|
||||
|
||||
[node name="load_res_path_dlg" type="FileDialog"]
|
||||
anchor_right = 0.404
|
||||
anchor_bottom = 0.431
|
||||
offset_right = -0.400024
|
||||
offset_bottom = 0.0999756
|
||||
window_title = "Open a File"
|
||||
resizable = true
|
||||
mode = 0
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
@@ -1,63 +1,63 @@
|
||||
"""
|
||||
class GDDBNewDBDlg
|
||||
"""
|
||||
|
||||
class_name GDDBNewDBDlg
|
||||
|
||||
tool
|
||||
extends WindowDialog
|
||||
|
||||
signal create_new_db
|
||||
|
||||
var m_current_db_name = ""
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void :
|
||||
$v_layout/buttons/ok_btn.connect("pressed", self, "on_ok_btn_pressed")
|
||||
$v_layout/buttons/cancel_btn.connect("pressed", self, "on_cancel_btn_pressed")
|
||||
connect("about_to_show", self, "on_about_to_show")
|
||||
$v_layout/db_info/db_edt.connect("text_changed", self, "on_text_changed")
|
||||
$v_layout/db_info/db_edt.connect("text_entered", self, "on_text_confirmed")
|
||||
|
||||
# Called when the node is about to be shown.
|
||||
func on_about_to_show() -> void :
|
||||
m_current_db_name = ""
|
||||
$v_layout/db_info/db_edt.set_text(m_current_db_name)
|
||||
|
||||
# called everytime the text is changed
|
||||
func on_text_changed(new_text: String) -> void :
|
||||
var change_text = true
|
||||
if(!gddb_globals.check_db_name(new_text)):
|
||||
change_text = false
|
||||
else:
|
||||
if(new_text.length() > gddb_constants.c_max_db_name_len):
|
||||
change_text = false
|
||||
else:
|
||||
change_text = true
|
||||
|
||||
if(change_text):
|
||||
m_current_db_name = $v_layout/db_info/db_edt.get_text()
|
||||
else:
|
||||
$v_layout/db_info/db_edt.set_text(m_current_db_name)
|
||||
$v_layout/db_info/db_edt.set_cursor_position(m_current_db_name.length())
|
||||
|
||||
# called when the user presses the ENTER key
|
||||
func on_text_confirmed(text : String) -> void :
|
||||
# print("GDDBNewDBDlg::on_text_confirmed(" + text + ")")
|
||||
if(m_current_db_name.empty()):
|
||||
return
|
||||
handle_db_name()
|
||||
hide()
|
||||
|
||||
# called when the OK button is pressed
|
||||
func on_ok_btn_pressed() -> void :
|
||||
if(!m_current_db_name.empty()):
|
||||
handle_db_name()
|
||||
|
||||
# called when the Cancel button is pressed
|
||||
func on_cancel_btn_pressed() -> void :
|
||||
hide()
|
||||
|
||||
# handles the name of the database
|
||||
func handle_db_name() -> void :
|
||||
emit_signal("create_new_db", m_current_db_name)
|
||||
@tool
|
||||
"""
|
||||
class GDDBNewDBDlg
|
||||
"""
|
||||
|
||||
class_name GDDBNewDBDlg
|
||||
|
||||
extends Window
|
||||
|
||||
signal create_new_db
|
||||
|
||||
var m_current_db_name = ""
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void :
|
||||
$v_layout/buttons/ok_btn.connect("pressed", Callable(self, "on_ok_btn_pressed"))
|
||||
$v_layout/buttons/cancel_btn.connect("pressed", Callable(self, "on_cancel_btn_pressed"))
|
||||
connect("about_to_popup", Callable(self, "on_about_to_show"))
|
||||
$v_layout/db_info/db_edt.connect("text_changed", Callable(self, "on_text_changed"))
|
||||
$v_layout/db_info/db_edt.connect("text_submitted", Callable(self, "on_text_confirmed"))
|
||||
|
||||
# Called when the node is about to be shown.
|
||||
func on_about_to_show() -> void :
|
||||
m_current_db_name = ""
|
||||
$v_layout/db_info/db_edt.set_text(m_current_db_name)
|
||||
|
||||
# called everytime the text is changed
|
||||
func on_text_changed(new_text: String) -> void :
|
||||
var change_text = true
|
||||
if(!gddb_globals.check_db_name(new_text)):
|
||||
change_text = false
|
||||
else:
|
||||
if(new_text.length() > gddb_constants.c_max_db_name_len):
|
||||
change_text = false
|
||||
else:
|
||||
change_text = true
|
||||
|
||||
if(change_text):
|
||||
m_current_db_name = $v_layout/db_info/db_edt.get_text()
|
||||
else:
|
||||
$v_layout/db_info/db_edt.set_text(m_current_db_name)
|
||||
$v_layout/db_info/db_edt.set_caret_column(m_current_db_name.length())
|
||||
|
||||
# called when the user presses the ENTER key
|
||||
func on_text_confirmed(text : String) -> void :
|
||||
# print("GDDBNewDBDlg::on_text_confirmed(" + text + ")")
|
||||
if(m_current_db_name.is_empty()):
|
||||
return
|
||||
handle_db_name()
|
||||
hide()
|
||||
|
||||
# called when the OK button is pressed
|
||||
func on_ok_btn_pressed() -> void :
|
||||
if(!m_current_db_name.is_empty()):
|
||||
handle_db_name()
|
||||
|
||||
# called when the Cancel button is pressed
|
||||
func on_cancel_btn_pressed() -> void :
|
||||
hide()
|
||||
|
||||
# handles the name of the database
|
||||
func handle_db_name() -> void :
|
||||
emit_signal("create_new_db", m_current_db_name)
|
||||
|
||||
@@ -1,82 +1,82 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_14.tres" type="DynamicFont" id=1]
|
||||
[ext_resource path="res://addons/godot_db_manager/dlgs/new_db_dlg.gd" type="Script" id=2]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_12.tres" type="DynamicFont" id=3]
|
||||
|
||||
[node name="new_db_dlg" type="WindowDialog"]
|
||||
visible = true
|
||||
anchor_right = 0.257
|
||||
anchor_bottom = 0.1
|
||||
margin_right = 0.799988
|
||||
focus_next = NodePath("v_layout/db_info/db_edt")
|
||||
focus_mode = 2
|
||||
custom_fonts/title_font = ExtResource( 1 )
|
||||
popup_exclusive = true
|
||||
window_title = "New database (max 16 characters)"
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_horizontal_guides_": [ 90.0781 ],
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="v_layout" type="VBoxContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
custom_constants/separation = 20
|
||||
alignment = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="db_info" type="HBoxContainer" parent="v_layout"]
|
||||
margin_top = 11.0
|
||||
margin_right = 412.0
|
||||
margin_bottom = 38.0
|
||||
alignment = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="db_lbl" type="Label" parent="v_layout/db_info"]
|
||||
margin_left = 18.0
|
||||
margin_top = 5.0
|
||||
margin_right = 89.0
|
||||
margin_bottom = 22.0
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
text = "DB name: "
|
||||
|
||||
[node name="db_edt" type="LineEdit" parent="v_layout/db_info"]
|
||||
margin_left = 93.0
|
||||
margin_right = 393.0
|
||||
margin_bottom = 27.0
|
||||
rect_min_size = Vector2( 300, 20 )
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
caret_blink = true
|
||||
caret_blink_speed = 0.5
|
||||
|
||||
[node name="buttons" type="HBoxContainer" parent="v_layout"]
|
||||
margin_top = 58.0
|
||||
margin_right = 412.0
|
||||
margin_bottom = 79.0
|
||||
custom_constants/separation = 80
|
||||
alignment = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ok_btn" type="Button" parent="v_layout/buttons"]
|
||||
margin_left = 66.0
|
||||
margin_right = 166.0
|
||||
margin_bottom = 21.0
|
||||
rect_min_size = Vector2( 100, 0 )
|
||||
custom_fonts/font = ExtResource( 3 )
|
||||
text = "OK"
|
||||
|
||||
[node name="cancel_btn" type="Button" parent="v_layout/buttons"]
|
||||
margin_left = 246.0
|
||||
margin_right = 346.0
|
||||
margin_bottom = 21.0
|
||||
rect_min_size = Vector2( 100, 0 )
|
||||
custom_fonts/font = ExtResource( 3 )
|
||||
text = "Cancel"
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_14.tres" type="FontFile" id=1]
|
||||
[ext_resource path="res://addons/godot_db_manager/dlgs/new_db_dlg.gd" type="Script" id=2]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_12.tres" type="FontFile" id=3]
|
||||
|
||||
[node name="new_db_dlg" type="Window"]
|
||||
visible = true
|
||||
anchor_right = 0.257
|
||||
anchor_bottom = 0.1
|
||||
offset_right = 0.799988
|
||||
focus_next = NodePath("v_layout/db_info/db_edt")
|
||||
focus_mode = 2
|
||||
theme_override_fonts/title_font = ExtResource( 1 )
|
||||
exclusive = true
|
||||
window_title = "New database (max 16 characters)"
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_horizontal_guides_": [ 90.0781 ],
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="v_layout" type="VBoxContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
theme_override_constants/separation = 20
|
||||
alignment = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="db_info" type="HBoxContainer" parent="v_layout"]
|
||||
offset_top = 11.0
|
||||
offset_right = 412.0
|
||||
offset_bottom = 38.0
|
||||
alignment = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="db_lbl" type="Label" parent="v_layout/db_info"]
|
||||
offset_left = 18.0
|
||||
offset_top = 5.0
|
||||
offset_right = 89.0
|
||||
offset_bottom = 22.0
|
||||
theme_override_fonts/font = ExtResource( 1 )
|
||||
text = "DB name: "
|
||||
|
||||
[node name="db_edt" type="LineEdit" parent="v_layout/db_info"]
|
||||
offset_left = 93.0
|
||||
offset_right = 393.0
|
||||
offset_bottom = 27.0
|
||||
custom_minimum_size = Vector2( 300, 20 )
|
||||
theme_override_fonts/font = ExtResource( 1 )
|
||||
caret_blink = true
|
||||
caret_blink_interval = 0.5
|
||||
|
||||
[node name="buttons" type="HBoxContainer" parent="v_layout"]
|
||||
offset_top = 58.0
|
||||
offset_right = 412.0
|
||||
offset_bottom = 79.0
|
||||
theme_override_constants/separation = 80
|
||||
alignment = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="ok_btn" type="Button" parent="v_layout/buttons"]
|
||||
offset_left = 66.0
|
||||
offset_right = 166.0
|
||||
offset_bottom = 21.0
|
||||
custom_minimum_size = Vector2( 100, 0 )
|
||||
theme_override_fonts/font = ExtResource( 3 )
|
||||
text = "OK"
|
||||
|
||||
[node name="cancel_btn" type="Button" parent="v_layout/buttons"]
|
||||
offset_left = 246.0
|
||||
offset_right = 346.0
|
||||
offset_bottom = 21.0
|
||||
custom_minimum_size = Vector2( 100, 0 )
|
||||
theme_override_fonts/font = ExtResource( 3 )
|
||||
text = "Cancel"
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
@tool
|
||||
"""
|
||||
class GDDBNewDBDlg
|
||||
"""
|
||||
|
||||
class_name GDDBNewTableDlg
|
||||
|
||||
tool
|
||||
extends WindowDialog
|
||||
extends Window
|
||||
|
||||
signal create_new_table
|
||||
signal cancel_dialog
|
||||
@@ -16,10 +16,10 @@ var m_current_table_name = ""
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
$v_layout/buttons/ok_btn.connect("pressed", self, "on_ok_btn_pressed")
|
||||
$v_layout/buttons/cancel_btn.connect("pressed", self, "on_cancel_btn_pressed")
|
||||
$v_layout/table_info/table_edt.connect("text_changed", self, "on_text_changed")
|
||||
$v_layout/table_info/table_edt.connect("text_entered", self, "on_text_confirmed")
|
||||
$v_layout/buttons/ok_btn.connect("pressed", Callable(self, "on_ok_btn_pressed"))
|
||||
$v_layout/buttons/cancel_btn.connect("pressed", Callable(self, "on_cancel_btn_pressed"))
|
||||
$v_layout/table_info/table_edt.connect("text_changed", Callable(self, "on_text_changed"))
|
||||
$v_layout/table_info/table_edt.connect("text_submitted", Callable(self, "on_text_confirmed"))
|
||||
m_current_table_name = ""
|
||||
|
||||
# sets the type of the dialog
|
||||
@@ -58,18 +58,18 @@ func on_text_changed(new_text: String) -> void:
|
||||
m_current_table_name = $v_layout/table_info/table_edt.get_text()
|
||||
else:
|
||||
$v_layout/table_info/table_edt.set_text(m_current_table_name)
|
||||
$v_layout/table_info/table_edt.set_cursor_position(m_current_table_name.length())
|
||||
$v_layout/table_info/table_edt.set_caret_column(m_current_table_name.length())
|
||||
|
||||
# called when the user presses the ENTER key
|
||||
func on_text_confirmed(text : String) -> void:
|
||||
if(m_current_table_name.empty()):
|
||||
if(m_current_table_name.is_empty()):
|
||||
return
|
||||
handle_table_name()
|
||||
hide()
|
||||
|
||||
# called when the OK button is pressed
|
||||
func on_ok_btn_pressed() -> void:
|
||||
if(!m_current_table_name.empty()):
|
||||
if(!m_current_table_name.is_empty()):
|
||||
handle_table_name()
|
||||
hide()
|
||||
|
||||
|
||||
@@ -1,73 +1,73 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_12.tres" type="DynamicFont" id=1]
|
||||
[ext_resource path="res://addons/godot_db_manager/dlgs/new_table_dlg.gd" type="Script" id=2]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_14.tres" type="DynamicFont" id=3]
|
||||
|
||||
[node name="new_table_dlg" type="WindowDialog"]
|
||||
visible = true
|
||||
anchor_right = 0.257
|
||||
anchor_bottom = 0.084
|
||||
margin_right = 0.799988
|
||||
margin_bottom = 0.399994
|
||||
focus_next = NodePath("v_layout/table_info/table_edt")
|
||||
focus_mode = 1
|
||||
custom_fonts/title_font = ExtResource( 3 )
|
||||
popup_exclusive = true
|
||||
window_title = "New table (max 16 characters)"
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="v_layout" type="VBoxContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
custom_constants/separation = 10
|
||||
alignment = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="table_info" type="HBoxContainer" parent="v_layout"]
|
||||
margin_top = 8.0
|
||||
margin_right = 412.0
|
||||
margin_bottom = 35.0
|
||||
alignment = 1
|
||||
|
||||
[node name="table_lbl" type="Label" parent="v_layout/table_info"]
|
||||
margin_left = 10.0
|
||||
margin_top = 5.0
|
||||
margin_right = 97.0
|
||||
margin_bottom = 22.0
|
||||
custom_fonts/font = ExtResource( 3 )
|
||||
text = "Table name: "
|
||||
|
||||
[node name="table_edt" type="LineEdit" parent="v_layout/table_info"]
|
||||
margin_left = 101.0
|
||||
margin_right = 401.0
|
||||
margin_bottom = 27.0
|
||||
rect_min_size = Vector2( 300, 20 )
|
||||
custom_fonts/font = ExtResource( 3 )
|
||||
caret_blink = true
|
||||
caret_blink_speed = 0.5
|
||||
|
||||
[node name="buttons" type="HBoxContainer" parent="v_layout"]
|
||||
margin_top = 45.0
|
||||
margin_right = 412.0
|
||||
margin_bottom = 66.0
|
||||
custom_constants/separation = 80
|
||||
alignment = 1
|
||||
|
||||
[node name="ok_btn" type="Button" parent="v_layout/buttons"]
|
||||
margin_left = 66.0
|
||||
margin_right = 166.0
|
||||
margin_bottom = 21.0
|
||||
rect_min_size = Vector2( 100, 0 )
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
text = "OK"
|
||||
|
||||
[node name="cancel_btn" type="Button" parent="v_layout/buttons"]
|
||||
margin_left = 246.0
|
||||
margin_right = 346.0
|
||||
margin_bottom = 21.0
|
||||
rect_min_size = Vector2( 100, 0 )
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
text = "Cancel"
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_12.tres" type="FontFile" id=1]
|
||||
[ext_resource path="res://addons/godot_db_manager/dlgs/new_table_dlg.gd" type="Script" id=2]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_14.tres" type="FontFile" id=3]
|
||||
|
||||
[node name="new_table_dlg" type="Window"]
|
||||
visible = true
|
||||
anchor_right = 0.257
|
||||
anchor_bottom = 0.084
|
||||
offset_right = 0.799988
|
||||
offset_bottom = 0.399994
|
||||
focus_next = NodePath("v_layout/table_info/table_edt")
|
||||
focus_mode = 1
|
||||
theme_override_fonts/title_font = ExtResource( 3 )
|
||||
exclusive = true
|
||||
window_title = "New table (max 16 characters)"
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="v_layout" type="VBoxContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
theme_override_constants/separation = 10
|
||||
alignment = 1
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="table_info" type="HBoxContainer" parent="v_layout"]
|
||||
offset_top = 8.0
|
||||
offset_right = 412.0
|
||||
offset_bottom = 35.0
|
||||
alignment = 1
|
||||
|
||||
[node name="table_lbl" type="Label" parent="v_layout/table_info"]
|
||||
offset_left = 10.0
|
||||
offset_top = 5.0
|
||||
offset_right = 97.0
|
||||
offset_bottom = 22.0
|
||||
theme_override_fonts/font = ExtResource( 3 )
|
||||
text = "Table name: "
|
||||
|
||||
[node name="table_edt" type="LineEdit" parent="v_layout/table_info"]
|
||||
offset_left = 101.0
|
||||
offset_right = 401.0
|
||||
offset_bottom = 27.0
|
||||
custom_minimum_size = Vector2( 300, 20 )
|
||||
theme_override_fonts/font = ExtResource( 3 )
|
||||
caret_blink = true
|
||||
caret_blink_interval = 0.5
|
||||
|
||||
[node name="buttons" type="HBoxContainer" parent="v_layout"]
|
||||
offset_top = 45.0
|
||||
offset_right = 412.0
|
||||
offset_bottom = 66.0
|
||||
theme_override_constants/separation = 80
|
||||
alignment = 1
|
||||
|
||||
[node name="ok_btn" type="Button" parent="v_layout/buttons"]
|
||||
offset_left = 66.0
|
||||
offset_right = 166.0
|
||||
offset_bottom = 21.0
|
||||
custom_minimum_size = Vector2( 100, 0 )
|
||||
theme_override_fonts/font = ExtResource( 1 )
|
||||
text = "OK"
|
||||
|
||||
[node name="cancel_btn" type="Button" parent="v_layout/buttons"]
|
||||
offset_left = 246.0
|
||||
offset_right = 346.0
|
||||
offset_bottom = 21.0
|
||||
custom_minimum_size = Vector2( 100, 0 )
|
||||
theme_override_fonts/font = ExtResource( 1 )
|
||||
text = "Cancel"
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
@tool
|
||||
"""
|
||||
class GDDBMenu
|
||||
"""
|
||||
|
||||
class_name GDDBMenu
|
||||
|
||||
tool
|
||||
extends Control
|
||||
|
||||
signal new_database
|
||||
@@ -29,18 +29,18 @@ var m_enable_save_as_db = false
|
||||
var m_check_autosave_on_load = false
|
||||
|
||||
func _ready() -> void:
|
||||
$layout/File.connect("about_to_show", self, "on_about_to_show_file_menu")
|
||||
$layout/File.connect("about_to_popup", Callable(self, "on_about_to_show_file_menu"))
|
||||
$layout/File.get_popup().clear()
|
||||
$layout/File.get_popup().add_item("New DB", e_file_new_id)
|
||||
$layout/File.get_popup().add_item("Load DB", e_file_load_id)
|
||||
$layout/File.get_popup().add_item("Save DB", e_file_save_id)
|
||||
$layout/File.get_popup().add_item("Save DB As ...", e_file_save_as_id)
|
||||
$layout/File.get_popup().connect("id_pressed", self, "on_file_id_pressed")
|
||||
$layout/File.get_popup().connect("id_pressed", Callable(self, "on_file_id_pressed"))
|
||||
|
||||
$layout/Options.connect("about_to_show", self, "on_about_to_show_options_menu")
|
||||
$layout/Options.connect("about_to_popup", Callable(self, "on_about_to_show_options_menu"))
|
||||
$layout/Options.get_popup().clear()
|
||||
$layout/Options.get_popup().add_check_item("Autosave on close", e_option_autosave_on_close_id)
|
||||
$layout/Options.get_popup().connect("id_pressed", self, "on_options_id_pressed")
|
||||
$layout/Options.get_popup().connect("id_pressed", Callable(self, "on_options_id_pressed"))
|
||||
|
||||
# called before showing the file menu
|
||||
func on_about_to_show_file_menu() -> void:
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/menu.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_18.tres" type="DynamicFont" id=2]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_18.tres" type="FontFile" id=2]
|
||||
|
||||
[node name="menu" type="Control"]
|
||||
anchor_right = 1.0
|
||||
rect_min_size = Vector2( 0, 30 )
|
||||
custom_minimum_size = Vector2( 0, 30 )
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_horizontal_guides_": [ 30.0 ],
|
||||
@@ -14,23 +14,23 @@ __meta__ = {
|
||||
}
|
||||
|
||||
[node name="layout" type="HBoxContainer" parent="."]
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 30.0
|
||||
offset_right = 1024.0
|
||||
offset_bottom = 30.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="File" type="MenuButton" parent="layout"]
|
||||
margin_right = 40.0
|
||||
margin_bottom = 30.0
|
||||
custom_fonts/font = ExtResource( 2 )
|
||||
offset_right = 40.0
|
||||
offset_bottom = 30.0
|
||||
theme_override_fonts/font = ExtResource( 2 )
|
||||
text = "File"
|
||||
items = [ "New DB", null, 0, false, false, 0, 0, null, "", false, "Load DB", null, 0, false, false, 1, 0, null, "", false, "Save DB", null, 0, false, false, 2, 0, null, "", false, "Save DB As ...", null, 0, false, false, 3, 0, null, "", false ]
|
||||
|
||||
[node name="Options" type="MenuButton" parent="layout"]
|
||||
margin_left = 44.0
|
||||
margin_right = 117.0
|
||||
margin_bottom = 30.0
|
||||
custom_fonts/font = ExtResource( 2 )
|
||||
offset_left = 44.0
|
||||
offset_right = 117.0
|
||||
offset_bottom = 30.0
|
||||
theme_override_fonts/font = ExtResource( 2 )
|
||||
text = "Options"
|
||||
items = [ "Autosave on close", null, 1, false, false, 4, 0, null, "", false ]
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
@tool
|
||||
"""
|
||||
class GDDBTableCell
|
||||
"""
|
||||
|
||||
class_name GDDBTableCell
|
||||
|
||||
tool
|
||||
extends Control
|
||||
|
||||
signal edit_data
|
||||
@@ -20,16 +20,16 @@ var m_row_idx : int = -1
|
||||
var m_text : String = ""
|
||||
|
||||
func _ready() -> void :
|
||||
$LineEdit.connect("text_changed", self, "on_text_changed")
|
||||
$LineEdit/edit_btn.connect("pressed", self, "on_edit_string")
|
||||
$LineEdit.connect("text_changed", Callable(self, "on_text_changed"))
|
||||
$LineEdit/edit_btn.connect("pressed", Callable(self, "on_edit_string"))
|
||||
|
||||
$Button.connect("pressed", self, "on_button_pressed")
|
||||
$Button.connect("pressed", Callable(self, "on_button_pressed"))
|
||||
$Button.set_clip_text(true)
|
||||
|
||||
$CheckBox.connect("toggled", self, "on_toggle_button")
|
||||
$CheckBox.connect("toggled", Callable(self, "on_toggle_button"))
|
||||
|
||||
func _exit_tree() -> void :
|
||||
$LineEdit.disconnect("text_changed", self, "on_text_changed")
|
||||
$LineEdit.disconnect("text_changed", Callable(self, "on_text_changed"))
|
||||
|
||||
# sets the property id
|
||||
func set_prop_id(id : int) -> void :
|
||||
@@ -137,10 +137,10 @@ func on_edit_string() -> void :
|
||||
|
||||
# called when edit the data
|
||||
func on_text_changed(new_text : String) -> void :
|
||||
if(new_text.empty()):
|
||||
if(new_text.is_empty()):
|
||||
m_text = ""
|
||||
$LineEdit.set_text(m_text)
|
||||
$LineEdit.set_cursor_position(0)
|
||||
$LineEdit.set_caret_column(0)
|
||||
return
|
||||
|
||||
if(m_prop_type == gddb_types.e_prop_type_int):
|
||||
@@ -163,25 +163,25 @@ func check_integer(text : String) -> bool :
|
||||
is_negative = true
|
||||
|
||||
# check if the current string is only "-"
|
||||
if(text.empty()):
|
||||
if(text.is_empty()):
|
||||
m_text = "-"
|
||||
$LineEdit.set_text(m_text)
|
||||
$LineEdit.set_cursor_position(m_text.length())
|
||||
$LineEdit.set_caret_column(m_text.length())
|
||||
return true
|
||||
|
||||
if(text.is_valid_integer()):
|
||||
if(text.is_valid_int()):
|
||||
if(text.begins_with("0")):
|
||||
# a negative integer cannot start with "0"
|
||||
if(is_negative):
|
||||
m_text = "-"
|
||||
$LineEdit.set_text(m_text)
|
||||
$LineEdit.set_cursor_position(1)
|
||||
$LineEdit.set_caret_column(1)
|
||||
return true
|
||||
|
||||
# a positive number starting with "0" can be only "0"
|
||||
m_text = "0"
|
||||
$LineEdit.set_text(m_text)
|
||||
$LineEdit.set_cursor_position(1)
|
||||
$LineEdit.set_caret_column(1)
|
||||
return true
|
||||
|
||||
# don't add more "-" in front of the number
|
||||
@@ -195,11 +195,11 @@ func check_integer(text : String) -> bool :
|
||||
m_text = text
|
||||
|
||||
$LineEdit.set_text(m_text)
|
||||
$LineEdit.set_cursor_position(m_text.length())
|
||||
$LineEdit.set_caret_column(m_text.length())
|
||||
return true
|
||||
|
||||
$LineEdit.set_text(m_text)
|
||||
$LineEdit.set_cursor_position(m_text.length())
|
||||
$LineEdit.set_caret_column(m_text.length())
|
||||
return false
|
||||
|
||||
func check_float(text : String) -> bool :
|
||||
@@ -210,12 +210,12 @@ func check_float(text : String) -> bool :
|
||||
|| text.begins_with("09")):
|
||||
m_text = "0"
|
||||
$LineEdit.set_text(m_text)
|
||||
$LineEdit.set_cursor_position(1)
|
||||
$LineEdit.set_caret_column(1)
|
||||
return true
|
||||
|
||||
m_text = text
|
||||
return true
|
||||
|
||||
$LineEdit.set_text(m_text)
|
||||
$LineEdit.set_cursor_position(m_text.length())
|
||||
$LineEdit.set_caret_column(m_text.length())
|
||||
return false
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/tex/gui.png" type="Texture" id=1]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/tex/gui.png" type="Texture2D" id=1]
|
||||
[ext_resource path="res://addons/godot_db_manager/table_cell.gd" type="Script" id=2]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_18.tres" type="DynamicFont" id=3]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_18.tres" type="FontFile" id=3]
|
||||
|
||||
[sub_resource type="AtlasTexture" id=1]
|
||||
atlas = ExtResource( 1 )
|
||||
@@ -18,8 +18,8 @@ region = Rect2( 28, 28, 24, 24 )
|
||||
|
||||
[node name="table_cell" type="Control"]
|
||||
anchor_right = 1.0
|
||||
margin_bottom = 15.36
|
||||
rect_min_size = Vector2( 150, 32 )
|
||||
offset_bottom = 15.36
|
||||
custom_minimum_size = Vector2( 150, 32 )
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_horizontal_guides_": [ 32.0 ],
|
||||
@@ -29,10 +29,10 @@ __meta__ = {
|
||||
[node name="LineEdit" type="LineEdit" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.914286
|
||||
custom_fonts/font = ExtResource( 3 )
|
||||
theme_override_fonts/font = ExtResource( 3 )
|
||||
text = "TESTING WWW"
|
||||
caret_blink = true
|
||||
caret_blink_speed = 0.5
|
||||
caret_blink_interval = 0.5
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": true
|
||||
}
|
||||
@@ -41,10 +41,10 @@ __meta__ = {
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -29.0
|
||||
margin_top = 4.0
|
||||
margin_right = -5.0
|
||||
margin_bottom = -4.0
|
||||
offset_left = -29.0
|
||||
offset_top = 4.0
|
||||
offset_right = -5.0
|
||||
offset_bottom = -4.0
|
||||
texture_normal = SubResource( 1 )
|
||||
texture_pressed = SubResource( 2 )
|
||||
texture_hover = SubResource( 3 )
|
||||
@@ -56,7 +56,7 @@ __meta__ = {
|
||||
visible = false
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
custom_fonts/font = ExtResource( 3 )
|
||||
theme_override_fonts/font = ExtResource( 3 )
|
||||
clip_text = true
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
@@ -66,7 +66,7 @@ __meta__ = {
|
||||
visible = false
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
custom_fonts/font = ExtResource( 3 )
|
||||
theme_override_fonts/font = ExtResource( 3 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
@tool
|
||||
"""
|
||||
class GDDBTableEditor
|
||||
"""
|
||||
|
||||
class_name GDDBTableEditor
|
||||
|
||||
tool
|
||||
extends Control
|
||||
|
||||
signal set_dirty
|
||||
@@ -13,17 +13,17 @@ var m_parent_table = null
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
$tabs/structure/header/new_property_btn.connect("pressed", self, "on_new_property_btn_pressed")
|
||||
$tabs/data/add_data_btn.connect("pressed", self, "on_add_row_data_btn_pressed")
|
||||
$tabs/structure/header/new_property_btn.connect("pressed", Callable(self, "on_new_property_btn_pressed"))
|
||||
$tabs/data/add_data_btn.connect("pressed", Callable(self, "on_add_row_data_btn_pressed"))
|
||||
$tabs/data/add_data_btn.set_disabled(true)
|
||||
|
||||
$load_res_path_dlg.connect("file_selected", self, "on_select_res_path")
|
||||
$load_res_path_dlg.connect("file_selected", Callable(self, "on_select_res_path"))
|
||||
|
||||
$data_dlg.connect("select_data", self, "on_select_data")
|
||||
$data_dlg.connect("select_data", Callable(self, "on_select_data"))
|
||||
|
||||
$edit_string_dlg.connect("string_edited", self, "on_text_edited")
|
||||
$edit_string_dlg.connect("string_edited", Callable(self, "on_text_edited"))
|
||||
|
||||
$delete_prop_dlg.connect("delete_prop", self, "on_confirm_delete_property")
|
||||
$delete_prop_dlg.connect("delete_prop", Callable(self, "on_confirm_delete_property"))
|
||||
|
||||
# called when resizing a property
|
||||
func on_resize_property(prop_id : int, diff_x : float) -> void :
|
||||
@@ -97,36 +97,36 @@ func on_new_property_btn_pressed() -> void:
|
||||
# adds a property to structure tab
|
||||
func add_prop_to_structure(prop_id : int, prop_type : int, prop_name : String) -> void:
|
||||
# print("GDDBTableEditor::add_prop_to_structure(" + str(prop_id) + ", " + str(prop_type) + ", " + prop_name + ")")
|
||||
var prop = load(gddb_constants.c_addon_main_path + "table_property.tscn").instance()
|
||||
var prop = load(gddb_constants.c_addon_main_path + "table_property.tscn").instantiate()
|
||||
$tabs/structure/scroll/properties.add_child(prop)
|
||||
prop.set_parent_table(m_parent_table)
|
||||
prop.setup(prop_id, prop_type, prop_name)
|
||||
prop.connect("edit_property", self, "on_edit_property")
|
||||
prop.connect("delete_property", self, "on_delete_property")
|
||||
prop.connect("enable_autoincrement", self, "on_enable_prop_autoincrement")
|
||||
prop.connect("edit_property", Callable(self, "on_edit_property"))
|
||||
prop.connect("delete_property", Callable(self, "on_delete_property"))
|
||||
prop.connect("enable_autoincrement", Callable(self, "on_enable_prop_autoincrement"))
|
||||
|
||||
# adds a property to data tab
|
||||
func add_prop_to_data(prop_id : int, prop_type : int, prop_name : String, has_autoincrement : bool) -> void:
|
||||
var prop = load(gddb_constants.c_addon_main_path + "data_label.tscn").instance()
|
||||
var prop = load(gddb_constants.c_addon_main_path + "data_label.tscn").instantiate()
|
||||
$tabs/data/scroll/data_holder/data_header.add_child(prop)
|
||||
prop.set_prop_id(prop_id)
|
||||
prop.set_text(prop_name)
|
||||
prop.connect("resize_property", self, "on_resize_property")
|
||||
prop.connect("resize_property", Callable(self, "on_resize_property"))
|
||||
|
||||
# add property to the existing rows
|
||||
for idx in range(0, $tabs/data/scroll/data_holder/data_container.get_child_count()):
|
||||
var row = $tabs/data/scroll/data_holder/data_container.get_child(idx)
|
||||
var cell = load(gddb_constants.c_addon_main_path + "table_cell.tscn").instance()
|
||||
var cell = load(gddb_constants.c_addon_main_path + "table_cell.tscn").instantiate()
|
||||
row.add_child(cell)
|
||||
cell.set_prop_id(prop_id)
|
||||
cell.set_row_idx(idx)
|
||||
cell.set_prop_type(prop_type)
|
||||
cell.set_text("")
|
||||
cell.enable_autoincrement(has_autoincrement)
|
||||
cell.connect("edit_data", self, "on_edit_data")
|
||||
cell.connect("choose_resource", self, "on_choose_resource")
|
||||
cell.connect("choose_data", self, "on_choose_data")
|
||||
cell.connect("edit_string", self, "on_edit_string")
|
||||
cell.connect("edit_data", Callable(self, "on_edit_data"))
|
||||
cell.connect("choose_resource", Callable(self, "on_choose_resource"))
|
||||
cell.connect("choose_data", Callable(self, "on_choose_data"))
|
||||
cell.connect("edit_string", Callable(self, "on_edit_string"))
|
||||
|
||||
# called when the add data button is pressed
|
||||
func on_add_row_data_btn_pressed() -> void:
|
||||
@@ -139,7 +139,7 @@ func on_add_row_data_btn_pressed() -> void:
|
||||
var row = HBoxContainer.new()
|
||||
$tabs/data/scroll/data_holder/data_container.add_child(row)
|
||||
for idx in range(0, $tabs/structure/scroll/properties.get_child_count()):
|
||||
var cell = load(gddb_constants.c_addon_main_path + "table_cell.tscn").instance()
|
||||
var cell = load(gddb_constants.c_addon_main_path + "table_cell.tscn").instantiate()
|
||||
var prop = $tabs/structure/scroll/properties.get_child(idx)
|
||||
var db_prop = m_parent_table.get_prop_by_id(idx)
|
||||
row.add_child(cell)
|
||||
@@ -150,10 +150,10 @@ func on_add_row_data_btn_pressed() -> void:
|
||||
cell.enable_autoincrement(db_prop.has_autoincrement())
|
||||
if(autoincrement):
|
||||
cell.set_text(str(row_idx+1))
|
||||
cell.connect("edit_data", self, "on_edit_data")
|
||||
cell.connect("choose_resource", self, "on_choose_resource")
|
||||
cell.connect("choose_data", self, "on_choose_data")
|
||||
cell.connect("edit_string", self, "on_edit_string")
|
||||
cell.connect("edit_data", Callable(self, "on_edit_data"))
|
||||
cell.connect("choose_resource", Callable(self, "on_choose_resource"))
|
||||
cell.connect("choose_data", Callable(self, "on_choose_data"))
|
||||
cell.connect("edit_string", Callable(self, "on_edit_string"))
|
||||
|
||||
emit_signal("set_dirty")
|
||||
|
||||
@@ -173,12 +173,12 @@ func fill_properties() -> void:
|
||||
for idx in range(0, props_count):
|
||||
var db_prop = m_parent_table.get_prop_at(idx)
|
||||
add_prop_to_structure(db_prop.get_prop_id(), db_prop.get_prop_type(), db_prop.get_prop_name())
|
||||
var prop = load(gddb_constants.c_addon_main_path + "data_label.tscn").instance()
|
||||
var prop = load(gddb_constants.c_addon_main_path + "data_label.tscn").instantiate()
|
||||
$tabs/data/scroll/data_holder/data_header.add_child(prop)
|
||||
prop.set_prop_id(db_prop.get_prop_id())
|
||||
prop.set_prop_type(db_prop.get_prop_type())
|
||||
prop.set_text(db_prop.get_prop_name())
|
||||
prop.connect("resize_property", self, "on_resize_property")
|
||||
prop.connect("resize_property", Callable(self, "on_resize_property"))
|
||||
if(props_count > 0):
|
||||
$tabs/data/add_data_btn.set_disabled(false)
|
||||
|
||||
@@ -198,7 +198,7 @@ func fill_data() -> void:
|
||||
#print("Prop type: " + str(db_prop.get_prop_type()))
|
||||
#print("Prop name: " + str(db_prop.get_prop_name()))
|
||||
|
||||
var cell = load(gddb_constants.c_addon_main_path + "table_cell.tscn").instance()
|
||||
var cell = load(gddb_constants.c_addon_main_path + "table_cell.tscn").instantiate()
|
||||
var cell_data = data_row[jdx].get_data()
|
||||
|
||||
var prop_type = db_prop.get_prop_type()
|
||||
@@ -215,10 +215,10 @@ func fill_data() -> void:
|
||||
cell.set_prop_type(prop_type)
|
||||
cell.set_text(cell_data)
|
||||
cell.enable_autoincrement(db_prop.has_autoincrement())
|
||||
cell.connect("edit_data", self, "on_edit_data")
|
||||
cell.connect("choose_resource", self, "on_choose_resource")
|
||||
cell.connect("choose_data", self, "on_choose_data")
|
||||
cell.connect("edit_string", self, "on_edit_string")
|
||||
cell.connect("edit_data", Callable(self, "on_edit_data"))
|
||||
cell.connect("choose_resource", Callable(self, "on_choose_resource"))
|
||||
cell.connect("choose_data", Callable(self, "on_choose_data"))
|
||||
cell.connect("edit_string", Callable(self, "on_edit_string"))
|
||||
|
||||
# links properties
|
||||
func link_props() -> void :
|
||||
@@ -312,7 +312,7 @@ func on_confirm_delete_property() -> void:
|
||||
for jdx in range(0, row.get_child_count()):
|
||||
var cell = row.get_child(jdx)
|
||||
if(cell.get_prop_id() == prop_id):
|
||||
cell.disconnect("edit_data", self, "on_edit_data")
|
||||
cell.disconnect("edit_data", Callable(self, "on_edit_data"))
|
||||
cell.queue_free()
|
||||
break
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
[ext_resource path="res://addons/godot_db_manager/dlgs/data_dlg.tscn" type="PackedScene" id=4]
|
||||
[ext_resource path="res://addons/godot_db_manager/dlgs/edit_string_dlg.tscn" type="PackedScene" id=5]
|
||||
[ext_resource path="res://addons/godot_db_manager/dlgs/delete_prop_dlg.tscn" type="PackedScene" id=6]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_18.tres" type="DynamicFont" id=7]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/tex/gui.png" type="Texture" id=8]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_18.tres" type="FontFile" id=7]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/tex/gui.png" type="Texture2D" id=8]
|
||||
|
||||
[sub_resource type="AtlasTexture" id=1]
|
||||
atlas = ExtResource( 8 )
|
||||
@@ -50,41 +50,41 @@ __meta__ = {
|
||||
[node name="tabs" type="TabContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
custom_fonts/font = ExtResource( 7 )
|
||||
theme_override_fonts/font = ExtResource( 7 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="structure" type="Tabs" parent="tabs"]
|
||||
[node name="structure" type="TabBar" parent="tabs"]
|
||||
visible = false
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 4.0
|
||||
margin_top = 40.0
|
||||
margin_right = -4.0
|
||||
margin_bottom = -4.0
|
||||
offset_left = 4.0
|
||||
offset_top = 40.0
|
||||
offset_right = -4.0
|
||||
offset_bottom = -4.0
|
||||
tab_close_display_policy = 2
|
||||
|
||||
[node name="header" type="HBoxContainer" parent="tabs/structure"]
|
||||
margin_right = 892.0
|
||||
margin_bottom = 24.0
|
||||
offset_right = 892.0
|
||||
offset_bottom = 24.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="new_property_btn" type="TextureButton" parent="tabs/structure/header"]
|
||||
margin_right = 24.0
|
||||
margin_bottom = 24.0
|
||||
offset_right = 24.0
|
||||
offset_bottom = 24.0
|
||||
texture_normal = SubResource( 1 )
|
||||
texture_pressed = SubResource( 2 )
|
||||
texture_hover = SubResource( 3 )
|
||||
|
||||
[node name="props_lbl" type="Label" parent="tabs/structure/header"]
|
||||
margin_left = 28.0
|
||||
margin_top = 1.0
|
||||
margin_right = 114.0
|
||||
margin_bottom = 23.0
|
||||
custom_fonts/font = ExtResource( 7 )
|
||||
offset_left = 28.0
|
||||
offset_top = 1.0
|
||||
offset_right = 114.0
|
||||
offset_bottom = 23.0
|
||||
theme_override_fonts/font = ExtResource( 7 )
|
||||
text = "Properties:"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
@@ -93,7 +93,7 @@ __meta__ = {
|
||||
[node name="scroll" type="ScrollContainer" parent="tabs/structure"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_top = 30.0
|
||||
offset_top = 30.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
@@ -103,18 +103,18 @@ __meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="data" type="Tabs" parent="tabs"]
|
||||
[node name="data" type="TabBar" parent="tabs"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = 4.0
|
||||
margin_top = 40.0
|
||||
margin_right = -4.0
|
||||
margin_bottom = -4.0
|
||||
offset_left = 4.0
|
||||
offset_top = 40.0
|
||||
offset_right = -4.0
|
||||
offset_bottom = -4.0
|
||||
tab_close_display_policy = 2
|
||||
|
||||
[node name="add_data_btn" type="TextureButton" parent="tabs/data"]
|
||||
margin_right = 24.0
|
||||
margin_bottom = 24.0
|
||||
offset_right = 24.0
|
||||
offset_bottom = 24.0
|
||||
disabled = true
|
||||
texture_normal = SubResource( 4 )
|
||||
texture_pressed = SubResource( 5 )
|
||||
@@ -127,31 +127,31 @@ __meta__ = {
|
||||
[node name="scroll" type="ScrollContainer" parent="tabs/data"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_top = 38.0
|
||||
offset_top = 38.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="data_holder" type="VBoxContainer" parent="tabs/data/scroll"]
|
||||
margin_bottom = 36.0
|
||||
offset_bottom = 36.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="data_header" type="HBoxContainer" parent="tabs/data/scroll/data_holder"]
|
||||
margin_bottom = 32.0
|
||||
rect_min_size = Vector2( 0, 32 )
|
||||
rect_clip_content = true
|
||||
offset_bottom = 32.0
|
||||
custom_minimum_size = Vector2( 0, 32 )
|
||||
clip_contents = true
|
||||
|
||||
[node name="data_container" type="VBoxContainer" parent="tabs/data/scroll/data_holder"]
|
||||
margin_top = 36.0
|
||||
margin_bottom = 36.0
|
||||
offset_top = 36.0
|
||||
offset_bottom = 36.0
|
||||
|
||||
[node name="error_dlg" parent="." instance=ExtResource( 1 )]
|
||||
visible = false
|
||||
|
||||
[node name="load_res_path_dlg" parent="." instance=ExtResource( 2 )]
|
||||
filters = PoolStringArray( "*.res, *.tres ; Godot resource file types", "*.scn, *.tscn, *escn ; Godot scene file types", "*.gd, *.cs, *.h, *.c, *.hpp, *.cpp ; Code file types", "*.shader ; Shader file types", "*.mat ; Material file types", "*.dae, *.gltf, *.obj, *.fbx ; Mesh file types", "*.anim ; Animation file types", "*.ttf, *.otf ; Font file types", "*.png, *.jpg, *.jpeg, *.tiff, *.tga, *.bmp, *.webp, *.gif, *.hdr ; Images file types", "*.snd, *.wav, *.ogg, *.mp3 ; Sound file types", "*.ogg, *.mpg, *.mpeg, *.avi, *.mov, *.mp4, *.webm ; Video file types", "*.txt, *.csv, *.json, *.xml, *.cfg, *.ini ; Text file types", "*.doc, *.docx, *.xls, *.xlsx, *.odt, *.ods, *.pdf ; Doc file types", "*.dat, *.raw ; Binary data file types" )
|
||||
filters = PackedStringArray( "*.res, *.tres ; Godot resource file types", "*.scn, *.tscn, *escn ; Godot scene file types", "*.gd, *.cs, *.h, *.c, *.hpp, *.cpp ; Code file types", "*.shader ; Shader file types", "*.mat ; Material file types", "*.dae, *.gltf, *.obj, *.fbx ; Mesh file types", "*.anim ; Animation file types", "*.ttf, *.otf ; Font file types", "*.png, *.jpg, *.jpeg, *.tiff, *.tga, *.bmp, *.webp, *.gif, *.hdr ; Images file types", "*.snd, *.wav, *.ogg, *.mp3 ; Sound file types", "*.ogg, *.mpg, *.mpeg, *.avi, *.mov, *.mp4, *.webm ; Video file types", "*.txt, *.csv, *.json, *.xml, *.cfg, *.ini ; Text file types", "*.doc, *.docx, *.xls, *.xlsx, *.odt, *.ods, *.pdf ; Doc file types", "*.dat, *.raw ; Binary data file types" )
|
||||
|
||||
[node name="data_dlg" parent="." instance=ExtResource( 4 )]
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
@tool
|
||||
"""
|
||||
class GDDBTableItem
|
||||
"""
|
||||
|
||||
class_name GDDBTableItem
|
||||
|
||||
tool
|
||||
extends Control
|
||||
|
||||
signal select_item
|
||||
@@ -18,9 +18,9 @@ var m_is_selected = false
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
$select_btn.connect("pressed", self, "on_select_btn_pressed")
|
||||
$edit_table_btn.connect("pressed", self, "on_edit_table_btn_pressed")
|
||||
$delete_table_btn.connect("pressed", self, "on_delete_table_btn_pressed")
|
||||
$select_btn.connect("pressed", Callable(self, "on_select_btn_pressed"))
|
||||
$edit_table_btn.connect("pressed", Callable(self, "on_edit_table_btn_pressed"))
|
||||
$delete_table_btn.connect("pressed", Callable(self, "on_delete_table_btn_pressed"))
|
||||
$select.hide()
|
||||
|
||||
# sets the table id
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
[gd_scene load_steps=11 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_18.tres" type="DynamicFont" id=1]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/tex/gui.png" type="Texture" id=2]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_18.tres" type="FontFile" id=1]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/tex/gui.png" type="Texture2D" id=2]
|
||||
[ext_resource path="res://addons/godot_db_manager/table_item.gd" type="Script" id=3]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/tex/debug.png" type="Texture" id=4]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/tex/debug.png" type="Texture2D" id=4]
|
||||
|
||||
[sub_resource type="AtlasTexture" id=1]
|
||||
atlas = ExtResource( 2 )
|
||||
@@ -32,8 +32,8 @@ region = Rect2( 54, 28, 24, 24 )
|
||||
[node name="table_item" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.021
|
||||
margin_bottom = 0.399998
|
||||
rect_min_size = Vector2( 180, 34 )
|
||||
offset_bottom = 0.399998
|
||||
custom_minimum_size = Vector2( 180, 34 )
|
||||
script = ExtResource( 3 )
|
||||
__meta__ = {
|
||||
"_edit_horizontal_guides_": [ 34.0 ],
|
||||
@@ -64,10 +64,10 @@ __meta__ = {
|
||||
[node name="table_name" type="Label" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_right = -6.10352e-05
|
||||
margin_bottom = -4.0
|
||||
rect_min_size = Vector2( 100, 0 )
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
offset_right = -6.10352e-05
|
||||
offset_bottom = -4.0
|
||||
custom_minimum_size = Vector2( 100, 0 )
|
||||
theme_override_fonts/font = ExtResource( 1 )
|
||||
text = "Table_999"
|
||||
valign = 1
|
||||
__meta__ = {
|
||||
@@ -85,10 +85,10 @@ __meta__ = {
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -56.0
|
||||
margin_top = 5.0
|
||||
margin_right = -32.0
|
||||
margin_bottom = -5.0
|
||||
offset_left = -56.0
|
||||
offset_top = 5.0
|
||||
offset_right = -32.0
|
||||
offset_bottom = -5.0
|
||||
texture_normal = SubResource( 1 )
|
||||
texture_pressed = SubResource( 2 )
|
||||
texture_hover = SubResource( 3 )
|
||||
@@ -100,10 +100,10 @@ __meta__ = {
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -28.0
|
||||
margin_top = 5.0
|
||||
margin_right = -4.0
|
||||
margin_bottom = -5.0
|
||||
offset_left = -28.0
|
||||
offset_top = 5.0
|
||||
offset_right = -4.0
|
||||
offset_bottom = -5.0
|
||||
texture_normal = SubResource( 4 )
|
||||
texture_pressed = SubResource( 5 )
|
||||
texture_hover = SubResource( 6 )
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
@tool
|
||||
"""
|
||||
class GDDBTableProperty
|
||||
"""
|
||||
|
||||
class_name GDDBTableProperty
|
||||
|
||||
tool
|
||||
extends Control
|
||||
|
||||
signal delete_property
|
||||
@@ -19,20 +19,20 @@ var m_parent_table = null
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
$prop_name.connect("text_changed", self, "on_name_changed")
|
||||
$prop_name.connect("text_changed", Callable(self, "on_name_changed"))
|
||||
|
||||
$prop_type.clear()
|
||||
for idx in range(0, gddb_types.e_prop_types_count):
|
||||
$prop_type.add_item(gddb_globals.get_data_name(idx), gddb_types.e_prop_type_bool + idx)
|
||||
$prop_type.select(0)
|
||||
|
||||
$prop_type.get_popup().connect("about_to_show", self, "on_about_to_show")
|
||||
$prop_type.connect("item_selected", self, "on_type_changed")
|
||||
$prop_type.get_popup().connect("about_to_popup", Callable(self, "on_about_to_show"))
|
||||
$prop_type.connect("item_selected", Callable(self, "on_type_changed"))
|
||||
|
||||
$delete_button.connect("pressed", self, "on_delete_button_pressed")
|
||||
$delete_button.connect("pressed", Callable(self, "on_delete_button_pressed"))
|
||||
|
||||
$autoincrement_btn.hide()
|
||||
$autoincrement_btn.connect("toggled", self, "on_set_autoincrement")
|
||||
$autoincrement_btn.connect("toggled", Callable(self, "on_set_autoincrement"))
|
||||
|
||||
# setup property
|
||||
func setup(prop_id : int, prop_type : int, prop_name : String) -> void:
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/tex/gui.png" type="Texture" id=1]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/tex/gui.png" type="Texture2D" id=1]
|
||||
[ext_resource path="res://addons/godot_db_manager/table_property.gd" type="Script" id=2]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_18.tres" type="DynamicFont" id=3]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_18.tres" type="FontFile" id=3]
|
||||
|
||||
[sub_resource type="AtlasTexture" id=1]
|
||||
atlas = ExtResource( 1 )
|
||||
@@ -18,8 +18,8 @@ region = Rect2( 54, 28, 24, 24 )
|
||||
|
||||
[node name="table_property" type="Control"]
|
||||
anchor_right = 1.0
|
||||
margin_bottom = 15.36
|
||||
rect_min_size = Vector2( 900, 32 )
|
||||
offset_bottom = 15.36
|
||||
custom_minimum_size = Vector2( 900, 32 )
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_horizontal_guides_": [ 32.0 ],
|
||||
@@ -27,10 +27,10 @@ __meta__ = {
|
||||
}
|
||||
|
||||
[node name="delete_button" type="TextureButton" parent="."]
|
||||
margin_left = 3.0
|
||||
margin_top = 4.0
|
||||
margin_right = 27.0
|
||||
margin_bottom = 28.0
|
||||
offset_left = 3.0
|
||||
offset_top = 4.0
|
||||
offset_right = 27.0
|
||||
offset_bottom = 28.0
|
||||
texture_normal = SubResource( 1 )
|
||||
texture_pressed = SubResource( 2 )
|
||||
texture_hover = SubResource( 3 )
|
||||
@@ -39,50 +39,50 @@ __meta__ = {
|
||||
}
|
||||
|
||||
[node name="prop_name_label" type="Label" parent="."]
|
||||
margin_left = 28.0
|
||||
margin_top = 2.0
|
||||
margin_right = 97.0
|
||||
margin_bottom = 24.0
|
||||
custom_fonts/font = ExtResource( 3 )
|
||||
offset_left = 28.0
|
||||
offset_top = 2.0
|
||||
offset_right = 97.0
|
||||
offset_bottom = 24.0
|
||||
theme_override_fonts/font = ExtResource( 3 )
|
||||
text = " Name:"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="prop_name" type="LineEdit" parent="."]
|
||||
margin_left = 109.0
|
||||
margin_right = 409.0
|
||||
margin_bottom = 32.0
|
||||
rect_min_size = Vector2( 300, 0 )
|
||||
custom_fonts/font = ExtResource( 3 )
|
||||
offset_left = 109.0
|
||||
offset_right = 409.0
|
||||
offset_bottom = 32.0
|
||||
custom_minimum_size = Vector2( 300, 0 )
|
||||
theme_override_fonts/font = ExtResource( 3 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="type_label" type="Label" parent="."]
|
||||
margin_left = 413.0
|
||||
margin_top = 2.0
|
||||
margin_right = 473.0
|
||||
margin_bottom = 24.0
|
||||
custom_fonts/font = ExtResource( 3 )
|
||||
offset_left = 413.0
|
||||
offset_top = 2.0
|
||||
offset_right = 473.0
|
||||
offset_bottom = 24.0
|
||||
theme_override_fonts/font = ExtResource( 3 )
|
||||
text = " Type:"
|
||||
|
||||
[node name="prop_type" type="OptionButton" parent="."]
|
||||
margin_left = 485.0
|
||||
margin_right = 735.0
|
||||
margin_bottom = 32.0
|
||||
rect_min_size = Vector2( 250, 0 )
|
||||
custom_fonts/font = ExtResource( 3 )
|
||||
offset_left = 485.0
|
||||
offset_right = 735.0
|
||||
offset_bottom = 32.0
|
||||
custom_minimum_size = Vector2( 250, 0 )
|
||||
theme_override_fonts/font = ExtResource( 3 )
|
||||
text = "Bool"
|
||||
items = [ "Bool", null, false, 0, null, "Integer", null, false, 1, null, "Float", null, false, 2, null, "String", null, false, 3, null, "Resource", null, false, 4, null ]
|
||||
selected = 0
|
||||
|
||||
[node name="autoincrement_btn" type="CheckBox" parent="."]
|
||||
visible = false
|
||||
margin_left = 740.0
|
||||
margin_right = 891.0
|
||||
margin_bottom = 32.0
|
||||
custom_fonts/font = ExtResource( 3 )
|
||||
offset_left = 740.0
|
||||
offset_right = 891.0
|
||||
offset_bottom = 32.0
|
||||
theme_override_fonts/font = ExtResource( 3 )
|
||||
text = "Auto increment"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
"""
|
||||
class GDDBTablesHeader
|
||||
"""
|
||||
|
||||
class_name GDDBTablesHeader
|
||||
|
||||
tool
|
||||
extends Control
|
||||
|
||||
signal add_table
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
$add_table_btn.connect("pressed", self, "on_add_table_btn_pressed")
|
||||
|
||||
func on_add_table_btn_pressed():
|
||||
emit_signal("add_table")
|
||||
@tool
|
||||
"""
|
||||
class GDDBTablesHeader
|
||||
"""
|
||||
|
||||
class_name GDDBTablesHeader
|
||||
|
||||
extends Control
|
||||
|
||||
signal add_table
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
$add_table_btn.connect("pressed", Callable(self, "on_add_table_btn_pressed"))
|
||||
|
||||
func on_add_table_btn_pressed():
|
||||
emit_signal("add_table")
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_20.tres" type="DynamicFont" id=1]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/fnt/roboto_20.tres" type="FontFile" id=1]
|
||||
[ext_resource path="res://addons/godot_db_manager/tables_header.gd" type="Script" id=2]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/tex/gui.png" type="Texture" id=3]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/tex/gui.png" type="Texture2D" id=3]
|
||||
|
||||
[sub_resource type="AtlasTexture" id=1]
|
||||
atlas = ExtResource( 3 )
|
||||
@@ -19,9 +19,9 @@ region = Rect2( 2, 28, 24, 24 )
|
||||
[node name="tables_header" type="Control"]
|
||||
anchor_right = 0.188889
|
||||
anchor_bottom = 0.019
|
||||
margin_right = 6.10352e-05
|
||||
margin_bottom = -0.4
|
||||
rect_min_size = Vector2( 170, 30 )
|
||||
offset_right = 6.10352e-05
|
||||
offset_bottom = -0.4
|
||||
custom_minimum_size = Vector2( 170, 30 )
|
||||
script = ExtResource( 2 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": true,
|
||||
@@ -29,10 +29,10 @@ __meta__ = {
|
||||
}
|
||||
|
||||
[node name="add_table_btn" type="TextureButton" parent="."]
|
||||
margin_left = 2.0
|
||||
margin_top = 2.0
|
||||
margin_right = 26.0
|
||||
margin_bottom = 26.0
|
||||
offset_left = 2.0
|
||||
offset_top = 2.0
|
||||
offset_right = 26.0
|
||||
offset_bottom = 26.0
|
||||
texture_normal = SubResource( 1 )
|
||||
texture_pressed = SubResource( 2 )
|
||||
texture_hover = SubResource( 3 )
|
||||
@@ -44,9 +44,9 @@ __meta__ = {
|
||||
anchor_left = 0.165
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.8
|
||||
margin_left = -0.0500259
|
||||
margin_right = -0.000152588
|
||||
custom_fonts/font = ExtResource( 1 )
|
||||
offset_left = -0.0500259
|
||||
offset_right = -0.000152588
|
||||
theme_override_fonts/font = ExtResource( 1 )
|
||||
text = "Tables "
|
||||
align = 1
|
||||
__meta__ = {
|
||||
@@ -56,8 +56,8 @@ __meta__ = {
|
||||
[node name="line" type="NinePatchRect" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_top = 29.0
|
||||
margin_right = -0.000152588
|
||||
offset_top = 29.0
|
||||
offset_right = -0.000152588
|
||||
texture = ExtResource( 3 )
|
||||
region_rect = Rect2( 80, 2, 24, 2 )
|
||||
__meta__ = {
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
@tool
|
||||
"""
|
||||
class GDDBTablesList
|
||||
"""
|
||||
|
||||
class_name GDDBTablesList
|
||||
|
||||
tool
|
||||
extends Control
|
||||
|
||||
signal resize_tables_list
|
||||
@@ -24,7 +24,7 @@ func _ready() -> void:
|
||||
m_mouse_pos_pressed = Vector2()
|
||||
m_mouse_pressed = false
|
||||
|
||||
$tables_header.connect("add_table", self, "on_add_table")
|
||||
$tables_header.connect("add_table", Callable(self, "on_add_table"))
|
||||
|
||||
# called when the node gets an input
|
||||
func _input(event : InputEvent) -> void :
|
||||
@@ -34,7 +34,7 @@ func _input(event : InputEvent) -> void :
|
||||
var evLocal = $resize_ctrl.make_input_local(event)
|
||||
|
||||
if event is InputEventMouseButton :
|
||||
if(event.button_index == BUTTON_LEFT):
|
||||
if(event.button_index == MOUSE_BUTTON_LEFT):
|
||||
if(event.pressed):
|
||||
var rect = Rect2(Vector2(0, 0), $resize_ctrl.get_size())
|
||||
var inside = rect.has_point(evLocal.position)
|
||||
@@ -66,13 +66,13 @@ func on_add_table() -> void :
|
||||
# creates a table
|
||||
func create_table(db_table : Object, select_table : bool = true) -> void:
|
||||
# print("GDDBTablesList::create_table(" + str(db_table) + ")")
|
||||
var table = load(gddb_constants.c_addon_main_path + "table_item.tscn").instance()
|
||||
var table = load(gddb_constants.c_addon_main_path + "table_item.tscn").instantiate()
|
||||
var table_id = db_table.get_table_id()
|
||||
table.set_table_id(table_id)
|
||||
table.set_table_name(db_table.get_table_name())
|
||||
table.connect("select_item", self, "on_select_item")
|
||||
table.connect("edit_table", self, "on_edit_table_name")
|
||||
table.connect("delete_table", self, "on_delete_table")
|
||||
table.connect("select_item", Callable(self, "on_select_item"))
|
||||
table.connect("edit_table", Callable(self, "on_edit_table_name"))
|
||||
table.connect("delete_table", Callable(self, "on_delete_table"))
|
||||
m_tables.push_back(table)
|
||||
$tables_container/tables.add_child(table)
|
||||
if(select_table):
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
[ext_resource path="res://addons/godot_db_manager/tables_list.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/godot_db_manager/tables_header.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://addons/godot_db_manager/debug/dbg.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/tex/gui.png" type="Texture" id=4]
|
||||
[ext_resource path="res://addons/godot_db_manager/assets/tex/gui.png" type="Texture2D" id=4]
|
||||
|
||||
[node name="tables_list" type="Control"]
|
||||
anchor_right = 0.2
|
||||
anchor_bottom = 1.0
|
||||
margin_right = -9.99991
|
||||
rect_min_size = Vector2( 180, 225 )
|
||||
offset_right = -9.99991
|
||||
custom_minimum_size = Vector2( 180, 225 )
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_horizontal_guides_": [ 29.9686, 584.0 ],
|
||||
@@ -20,21 +20,21 @@ __meta__ = {
|
||||
[node name="tables_header" parent="." instance=ExtResource( 2 )]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.0
|
||||
margin_right = -9.15527e-05
|
||||
margin_bottom = 30.0
|
||||
rect_min_size = Vector2( 180, 30 )
|
||||
offset_right = -9.15527e-05
|
||||
offset_bottom = 30.0
|
||||
custom_minimum_size = Vector2( 180, 30 )
|
||||
|
||||
[node name="tables_container" type="ScrollContainer" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_top = 32.0
|
||||
rect_min_size = Vector2( 180, 0 )
|
||||
offset_top = 32.0
|
||||
custom_minimum_size = Vector2( 180, 0 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="tables" type="VBoxContainer" parent="tables_container"]
|
||||
rect_clip_content = true
|
||||
clip_contents = true
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
@@ -43,7 +43,7 @@ __meta__ = {
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -3.0
|
||||
offset_left = -3.0
|
||||
mouse_filter = 0
|
||||
mouse_default_cursor_shape = 15
|
||||
texture = ExtResource( 4 )
|
||||
|
||||
Reference in New Issue
Block a user