created fog of war
This commit is contained in:
21
addons/godot_debug_environments/LICENSE
Normal file
21
addons/godot_debug_environments/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Vladi
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
2
addons/godot_debug_environments/README.md
Normal file
2
addons/godot_debug_environments/README.md
Normal file
@@ -0,0 +1,2 @@
|
||||
# Debug_environments
|
||||
A simple Godot addon that allows to add context (extra scene) to scenes in "Run Current Scene" mode.
|
||||
@@ -0,0 +1,37 @@
|
||||
@tool
|
||||
extends EditorInspectorPlugin
|
||||
|
||||
func _can_handle(object):
|
||||
return object is Node and object == EditorInterface.get_edited_scene_root()
|
||||
|
||||
func _parse_begin(object):
|
||||
add_custom_control(create_ui(object))
|
||||
|
||||
func create_ui(node: Node) -> Control:
|
||||
var path = DebugEnvironmentLib.get_debug_path(node)
|
||||
var button = Button.new()
|
||||
button.icon = load("res://addons/godot_debug_environments/flask.svg")
|
||||
if(FileAccess.file_exists(path)):
|
||||
button.text = "Edit testing environment"
|
||||
button.pressed.connect(func(): edit_env(path), CONNECT_DEFERRED)
|
||||
else:
|
||||
button.text = "Create testing environment"
|
||||
button.pressed.connect(func(): create_env(path), CONNECT_DEFERRED)
|
||||
return button
|
||||
|
||||
func edit_env(path: String):
|
||||
EditorInterface.open_scene_from_path(path)
|
||||
|
||||
func create_env(path: String):
|
||||
if !DirAccess.dir_exists_absolute(path.get_base_dir()):
|
||||
DirAccess.make_dir_recursive_absolute(path.get_base_dir())
|
||||
var env = Node.new()
|
||||
env.name = path.get_file().replace(".tscn", "")
|
||||
var target = Node.new()
|
||||
target.name = "$DEBUG_TARGET$"
|
||||
env.add_child(target)
|
||||
target.owner = env
|
||||
var scene = PackedScene.new()
|
||||
scene.pack(env)
|
||||
ResourceSaver.save(scene, path)
|
||||
edit_env(path)
|
||||
6
addons/godot_debug_environments/debug_environment_lib.gd
Normal file
6
addons/godot_debug_environments/debug_environment_lib.gd
Normal file
@@ -0,0 +1,6 @@
|
||||
class_name DebugEnvironmentLib extends Object
|
||||
|
||||
const debug_environment_path = "res://editor/debug_environments/debug_env_$SCENE$"
|
||||
|
||||
static func get_debug_path(node:Node) -> String:
|
||||
return debug_environment_path.replace("$SCENE$", node.scene_file_path.get_file())
|
||||
10
addons/godot_debug_environments/debug_environment_watcher.gd
Normal file
10
addons/godot_debug_environments/debug_environment_watcher.gd
Normal file
@@ -0,0 +1,10 @@
|
||||
extends Node
|
||||
|
||||
func _ready() -> void:
|
||||
# Get loaded scene
|
||||
var node = get_tree().current_scene
|
||||
# Check if debug environment is stored
|
||||
var path = DebugEnvironmentLib.get_debug_path(node)
|
||||
if not FileAccess.file_exists(path): return
|
||||
# Replace instance with debug environment
|
||||
get_tree().call_deferred("change_scene_to_file",path)
|
||||
1
addons/godot_debug_environments/flask.svg
Normal file
1
addons/godot_debug_environments/flask.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="#ffffff" class="icon icon-tabler icons-tabler-filled icon-tabler-flask"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M15 2a1 1 0 0 1 0 2v4.826l3.932 10.814l.034 .077a1.7 1.7 0 0 1 -.002 1.193l-.07 .162a1.7 1.7 0 0 1 -1.213 .911l-.181 .017h-11l-.181 -.017a1.7 1.7 0 0 1 -1.285 -2.266l.039 -.09l3.927 -10.804v-4.823a1 1 0 1 1 0 -2h6zm-2 2h-2v4h2v-4z" /></svg>
|
||||
|
After Width: | Height: | Size: 467 B |
37
addons/godot_debug_environments/flask.svg.import
Normal file
37
addons/godot_debug_environments/flask.svg.import
Normal file
@@ -0,0 +1,37 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://clfknatufch1h"
|
||||
path="res://.godot/imported/flask.svg-2fc53ef5b1742277dd2e351a1ac292cf.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/godot_debug_environments/flask.svg"
|
||||
dest_files=["res://.godot/imported/flask.svg-2fc53ef5b1742277dd2e351a1ac292cf.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
svg/scale=1.0
|
||||
editor/scale_with_editor_scale=false
|
||||
editor/convert_colors_with_editor_theme=false
|
||||
19
addons/godot_debug_environments/launchSettingsBase.json
Normal file
19
addons/godot_debug_environments/launchSettingsBase.json
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
{
|
||||
"profiles": {
|
||||
"Godot Debug": {
|
||||
"commandName": "Executable",
|
||||
"executablePath": "$EDITOR$",
|
||||
"commandLineArgs": "--path . --verbose",
|
||||
"workingDirectory": ".",
|
||||
"nativeDebugging": true
|
||||
},
|
||||
"Godot Debug $NAME$": {
|
||||
"commandName": "Executable",
|
||||
"executablePath": "$EDITOR$",
|
||||
"commandLineArgs": "--upwards $PATH$ --verbose",
|
||||
"workingDirectory": ".",
|
||||
"nativeDebugging": true
|
||||
}
|
||||
}
|
||||
}
|
||||
10
addons/godot_debug_environments/plugin.cfg
Normal file
10
addons/godot_debug_environments/plugin.cfg
Normal file
@@ -0,0 +1,10 @@
|
||||
[plugin]
|
||||
|
||||
name="Debug environments"
|
||||
description="
|
||||
A simple script that loads a given scene in a specified environment.
|
||||
Good to test scenes in a certain context without having to manually select the right test scene.
|
||||
"
|
||||
author="Douwe Ravers"
|
||||
version="1.0"
|
||||
script="plugin.gd"
|
||||
13
addons/godot_debug_environments/plugin.gd
Normal file
13
addons/godot_debug_environments/plugin.gd
Normal file
@@ -0,0 +1,13 @@
|
||||
@tool
|
||||
extends EditorPlugin
|
||||
|
||||
var plugin
|
||||
|
||||
func _enter_tree():
|
||||
plugin = preload("res://addons/godot_debug_environments/debug_environment_editor_inspector.gd").new()
|
||||
add_autoload_singleton("DebugEnvironmentWatcher", "res://addons/godot_debug_environments/debug_environment_watcher.gd")
|
||||
add_inspector_plugin(plugin)
|
||||
|
||||
func _exit_tree():
|
||||
remove_autoload_singleton("DebugEnvironmentWatcher")
|
||||
remove_inspector_plugin(plugin)
|
||||
Reference in New Issue
Block a user