Skip to content

Changelog

cobrapitz edited this page Oct 28, 2019 · 16 revisions

Changelog


  • Rewrote almost everything (but still the bloated 1k lines file)
  • Added a way to add flags (see ConsoleFlags.Type)
# examples:
console.write("i am indented", ConsoleFlags.Type.INDENT) # indents the line
console.write_line("i have a time stamp", ConsoleFlags.Type.SHOW_TIME) # indents the line
console.write_channel("written by user", ConsoleFlags.Type.USER_PREFIX) # indents the line
console.write_line_channel("/haha this is not handled as command", ConsoleFlags.Type.NO_COMMANDS) # indents the line
# and more like
  • Channels:
  • Added channels, can be written to with ('All'-channel contains ALL text you write to any channel):
DebugConsole.write_channel(<channel_name>, <text>, flags) # channel "All" is default channel
DebugConsole.write_line_channel(<channel_name>, <text>, flags)
  • Creating Channel by adding an Name to the "channelNames" Array in the editor -> properties of the console node.
  • Editing Channels
add_channel(<channel_name>) 
get_channel(<channel_name>) # or null if not existing
get_channels()
remove_channel(<channel_name>)
write(<text>, <flags>) # writes default to the 'All'-channel
write_line(<text>, <flags>) # writes default to the 'All'-channel
write_channel(<channel_name>, <text>, <flags>) # creates Channels automatically if not added already
write_line_channel(<channel_name>, <text>, <flags>) # creates Channels automatically if not added already
get_channel_text(<channel_name>)

# additional:
# error/success/warn can have an second argument channel 
# (@param1: message, @param2: channelName = default is 'All')
  • Added commands:
/tree : Shows the !whole! tree beginning by current node. (Colors for Control/Spatial/Node2D/Other)
/cd : Change dir to child node (starting from root node: 
/set : Like the set method that every node has, let's u edit the value (only float/int/string supported)
/get : Get method of nodes, prints value of node variable or null if it doesn't exist.
/has : True if the node has the variable 
/pwd : Shows current directory path. (= node.get_path())
/ls : Shows children.
/addChild : Loads and adds a scene to the current node or given node.

  • Added Scene 'DebugConsole.tscn' in order avoid naming collision, when addressing the console globally.
  • Also added CanvasLayer (+ script) on top to simplify the usage and see available methods.
  • Fixed Text disappear

  • Moved the update functions for export variables to the end of the 'console.gd' file.
  • Warn/Success/Error... will no longer be added to the message history. (can be accessed by using arrow up/down)
  • Fixed "~List: Condition ' _first != __null ' is true.", which appeared when exiting the application.
  • Fixed typo 'fikle'. (file)

  • Fixed "global" (autoload) usage
  • Added logging, happens after certain amount of time (editable, default: 300 sec) (also saves logs when exiting)
  • Added additional logging functions: warn, success, error; these display the message in different colors and mark them in the log file ([SUCCESS], [WARNING], [ERROR])
console.warn("This is a warning in yellow")
console.error("This is a error message in red")
console.success("This is a succes message in green")
  • Added the option to log the message (default: true)
write_line("my message", addToLog = true, ... ) # also aplies to all other methods that can send messages

  • Fixed help not having newlines


  • Added Textbackground (default: hidden)
  • Added new theme: "text_only" (can be used to define a custom background)
  • Added user right: "NONE" (can't use any (default) command, if you don't want the user to use any command)
  • Added user color
  • Added user message sign
  • Added option to toggle scrollbar
  • Added commands:
    • showDefaultCommands / helpDefault (shows all default commands)
    • toggleTextBackground
    • setUserColor [color_name] (sets the color of the user name
  • Additional options to define a custom theme
func add_theme(themeName : String, textColor, dockingStation, \
			showTitleBar, roundedTitleBar, titleBarColor, \
			backgroundColor, showLine, lineEditColor, showButton, buttonColor, \
			showTextBackground = false, textBackgroundColor = Color(0.0, 0.0, 0.0, 0.3),\
			animation = "slide_in_console_2", hideScrollBar = false):

# OR

#add this to the _customThemes
"dark": {
		"dockingStation" : "custom",
		"showButton" : false,
		"showLine" : false,
		"showTitleBar" : true,
		"showTextBackground" : false,
		"titleBarColor" : Color(0, 0, 0, 0.95),
		"roundedTitleBar" : true,
		"backgroundColor" : Color(0.06, 0.06, 0.08, 0.88),
		"lineEditColor" : Color(0.21, 0.21, 0.21, 0.82),
		"buttonColor" : Color(0.14, 0.14, 0.18, 0.34),
		"textBackgroundColor" : Color(0.0, 0.0, 0.0, 1.0),
		"textColor" : "white",
		"animation" : "slide_in_console_2",
		"hideScrollBar" : false
}
  • Added colors-change on changing user rights (see below)
const _CallRights = {
	CallRights.NONE : ["none", "white"], 
	CallRights.USER : ["user", "teal"], 
	CallRights.TESTER : ["tester", "lime"], 
	CallRights.MODERATOR : ["moderator", "fuchsia"], 
	CallRights.ADMIN : ["admin", "maroon"], 
	CallRights.DEV : ["dev", "red"]
}
  • removed input map from export variabels (autocomplete, next/previous entered message history)


  • fixed titlebar not showing


  • Titlebar can be toggled
    • changed some dockings to not show the titlebar
  • Added new 'slide_in_console_2', that slides in from top
  • Additional commands
    • toggleTitlebar
    • setConsoleSize [w] [h]
  • Additional way to write to console
    • with new line: write_line (changed from writeLine), send_message
    • no new line: write, append_message
  • Removed 'next_message_history' and 'previous_message_history' from export vars
  • User name and rights added (error message when not sufficient rights for command)
# the higher the value, the higher the priviliges
enum CallRights {
	USER = 1, # default user right
	TESTER = 2,
	MODERATOR = 3,
	ADMIN = 4,
	DEV = 65535
}

Usage

const CommandRef = preload("res://console/command_ref.gd")
const Console = preload("res://console/console.tscn")
const ConsoleRights = preload("res://console/console_rights.gd")

onready var testConsole = $console

func _ready():
	var printRef = CommandRef.new(self, "my_print", CommandRef.COMMAND_REF_TYPE.FUNC, 1)
	var printCommand = Command.new('test_print', printRef, [], 'Custom print.', \
                         ConsoleRights.CallRights.USER) # <----------  
	testConsole.add_command(printCommand)
	
	testConsole.add_theme("test", Color.black, Color.azure, Color.white, Color.pink, Color.purple, true)

func my_print(input : Array):
	print("This is my first message: %s" % message[0] )


Clone this wiki locally