mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-22 20:06:49 +01:00
parent
15f092866b
commit
eb8943a4f6
@ -610,6 +610,12 @@
|
||||
<member name="debug/shapes/navigation/link_connection_disabled_color" type="Color" setter="" getter="" default="Color( 0.5, 0.5, 0.5, 1 )">
|
||||
Color to use to display disabled navigation link connections, visible when "Visible Navigation" is enabled in the Debug menu.
|
||||
</member>
|
||||
<member name="debug/shapes/paths/geometry_color" type="Color" setter="" getter="" default="Color(0.1, 1, 0.7, 0.4)">
|
||||
Color of the curve path geometry, visible when "Visible Paths" is enabled in the Debug menu.
|
||||
</member>
|
||||
<member name="debug/shapes/paths/geometry_width" type="float" setter="" getter="" default="2.0">
|
||||
Line width of the curve path geometry, visible when "Visible Paths" is enabled in the Debug menu.
|
||||
</member>
|
||||
<member name="display/mouse_cursor/custom_image" type="String" setter="" getter="" default="""">
|
||||
Custom image for the mouse cursor (limited to 256×256).
|
||||
</member>
|
||||
|
@ -232,6 +232,9 @@
|
||||
If [code]true[/code], navigation polygons will be visible when running the game from the editor for debugging purposes.
|
||||
[b]Note:[/b] This property is not designed to be changed at run-time. Changing the value of [member debug_navigation_hint] while the project is running will not have the desired effect.
|
||||
</member>
|
||||
<member name="debug_paths_hint" type="bool" setter="set_debug_paths_hint" getter="is_debugging_paths_hint" default="false">
|
||||
If [code]true[/code], curves from [Path2D] and [Path3D] nodes will be visible when running the game from the editor for debugging purposes.
|
||||
</member>
|
||||
<member name="edited_scene_root" type="Node" setter="set_edited_scene_root" getter="get_edited_scene_root">
|
||||
The root of the edited scene.
|
||||
</member>
|
||||
|
@ -371,6 +371,10 @@ void EditorExportPlatform::gen_debug_flags(Vector<String> &r_flags, int p_flags)
|
||||
r_flags.push_back("--debug-avoidance");
|
||||
}
|
||||
|
||||
if (p_flags & DEBUG_FLAG_VIEW_PATHS) {
|
||||
r_flags.push_back("--debug-paths");
|
||||
}
|
||||
|
||||
if (p_flags & DEBUG_FLAG_SHADER_FALLBACKS) {
|
||||
r_flags.push_back("--debug-shader-fallbacks");
|
||||
}
|
||||
@ -1301,6 +1305,10 @@ void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags
|
||||
if (p_flags & DEBUG_FLAG_VIEW_AVOIDANCE) {
|
||||
r_flags.push_back("--debug-avoidance");
|
||||
}
|
||||
|
||||
if (p_flags & DEBUG_FLAG_VIEW_PATHS) {
|
||||
r_flags.push_back("--debug-paths");
|
||||
}
|
||||
}
|
||||
EditorExportPlatform::EditorExportPlatform() {
|
||||
}
|
||||
|
@ -322,7 +322,8 @@ public:
|
||||
DEBUG_FLAG_VIEW_COLLISONS = 8,
|
||||
DEBUG_FLAG_VIEW_NAVIGATION = 16,
|
||||
DEBUG_FLAG_VIEW_AVOIDANCE = 32,
|
||||
DEBUG_FLAG_SHADER_FALLBACKS = 64,
|
||||
DEBUG_FLAG_VIEW_PATHS = 64,
|
||||
DEBUG_FLAG_SHADER_FALLBACKS = 128,
|
||||
};
|
||||
|
||||
virtual Error run(const Ref<EditorExportPreset> &p_preset, int p_device, int p_debug_flags) { return OK; }
|
||||
|
@ -2777,6 +2777,14 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
|
||||
editor_run.set_debug_avoidance(!ischecked);
|
||||
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_debug_avoidance", !ischecked);
|
||||
|
||||
} break;
|
||||
case RUN_DEBUG_PATHS: {
|
||||
bool ischecked = debug_menu->get_popup()->is_item_checked(debug_menu->get_popup()->get_item_index(RUN_DEBUG_PATHS));
|
||||
debug_menu->get_popup()->set_item_checked(debug_menu->get_popup()->get_item_index(RUN_DEBUG_PATHS), !ischecked);
|
||||
run_native->set_debug_paths(!ischecked);
|
||||
editor_run.set_debug_paths(!ischecked);
|
||||
EditorSettings::get_singleton()->set_project_metadata("debug_options", "run_debug_paths", !ischecked);
|
||||
|
||||
} break;
|
||||
case RUN_DEBUG_SHADER_FALLBACKS: {
|
||||
bool ischecked = debug_menu->get_popup()->is_item_checked(debug_menu->get_popup()->get_item_index(RUN_DEBUG_SHADER_FALLBACKS));
|
||||
@ -3070,6 +3078,7 @@ void EditorNode::_update_debug_options() {
|
||||
bool check_debug_collisons = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_debug_collisons", false);
|
||||
bool check_debug_navigation = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_debug_navigation", false);
|
||||
bool check_debug_avoidance = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_debug_avoidance", false);
|
||||
bool check_debug_paths = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_debug_paths", false);
|
||||
bool check_debug_shader_fallbacks = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_debug_shader_fallbacks", false);
|
||||
bool check_live_debug = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_live_debug", true);
|
||||
bool check_reload_scripts = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_reload_scripts", true);
|
||||
@ -3089,6 +3098,9 @@ void EditorNode::_update_debug_options() {
|
||||
if (check_debug_avoidance) {
|
||||
_menu_option_confirm(RUN_DEBUG_AVOIDANCE, true);
|
||||
}
|
||||
if (check_debug_paths) {
|
||||
_menu_option_confirm(RUN_DEBUG_PATHS, true);
|
||||
}
|
||||
if (check_debug_shader_fallbacks) {
|
||||
_menu_option_confirm(RUN_DEBUG_SHADER_FALLBACKS, true);
|
||||
}
|
||||
@ -6528,6 +6540,10 @@ EditorNode::EditorNode() {
|
||||
p->get_item_count() - 1,
|
||||
TTR("When this option is enabled, avoidance debug information will be visible in the running project."));
|
||||
|
||||
p->add_check_shortcut(ED_SHORTCUT("editor/visible_paths", TTR("Visible Paths")), RUN_DEBUG_PATHS);
|
||||
p->set_item_tooltip(-1,
|
||||
TTR("When this option is enabled, curve resources used by path nodes will be visible in the running project."));
|
||||
|
||||
if (GLOBAL_GET("rendering/quality/driver/driver_name") == "GLES3") {
|
||||
p->add_separator();
|
||||
|
||||
|
@ -448,6 +448,7 @@ private:
|
||||
RUN_DEBUG_COLLISONS,
|
||||
RUN_DEBUG_NAVIGATION,
|
||||
RUN_DEBUG_AVOIDANCE,
|
||||
RUN_DEBUG_PATHS,
|
||||
RUN_DEBUG_SHADER_FALLBACKS,
|
||||
RUN_DEPLOY_REMOTE_DEBUG,
|
||||
RUN_RELOAD_SCRIPTS,
|
||||
|
@ -94,6 +94,10 @@ Error EditorRun::run(const String &p_scene, const String &p_custom_args, const L
|
||||
args.push_back("--debug-avoidance");
|
||||
}
|
||||
|
||||
if (debug_paths) {
|
||||
args.push_back("--debug-paths");
|
||||
}
|
||||
|
||||
if (debug_shader_fallbacks) {
|
||||
args.push_back("--debug-shader-fallbacks");
|
||||
}
|
||||
@ -309,6 +313,14 @@ bool EditorRun::get_debug_avoidance() const {
|
||||
return debug_avoidance;
|
||||
}
|
||||
|
||||
void EditorRun::set_debug_paths(bool p_debug) {
|
||||
debug_paths = p_debug;
|
||||
}
|
||||
|
||||
bool EditorRun::get_debug_paths() const {
|
||||
return debug_paths;
|
||||
}
|
||||
|
||||
void EditorRun::set_debug_shader_fallbacks(bool p_debug) {
|
||||
debug_shader_fallbacks = p_debug;
|
||||
}
|
||||
@ -323,5 +335,6 @@ EditorRun::EditorRun() {
|
||||
debug_collisions = false;
|
||||
debug_navigation = false;
|
||||
debug_avoidance = false;
|
||||
debug_paths = false;
|
||||
debug_shader_fallbacks = false;
|
||||
}
|
||||
|
@ -51,6 +51,7 @@ private:
|
||||
bool debug_collisions;
|
||||
bool debug_navigation;
|
||||
bool debug_avoidance;
|
||||
bool debug_paths;
|
||||
bool debug_shader_fallbacks;
|
||||
Status status;
|
||||
String running_scene;
|
||||
@ -73,6 +74,9 @@ public:
|
||||
void set_debug_avoidance(bool p_debug);
|
||||
bool get_debug_avoidance() const;
|
||||
|
||||
void set_debug_paths(bool p_debug);
|
||||
bool get_debug_paths() const;
|
||||
|
||||
void set_debug_shader_fallbacks(bool p_debug);
|
||||
bool get_debug_shader_fallbacks() const;
|
||||
|
||||
|
@ -159,6 +159,9 @@ void EditorRunNative::_run_native(int p_idx, int p_platform) {
|
||||
if (debug_avoidance) {
|
||||
flags |= EditorExportPlatform::DEBUG_FLAG_VIEW_AVOIDANCE;
|
||||
}
|
||||
if (debug_paths) {
|
||||
flags |= EditorExportPlatform::DEBUG_FLAG_VIEW_PATHS;
|
||||
}
|
||||
if (debug_shader_fallbacks) {
|
||||
flags |= EditorExportPlatform::DEBUG_FLAG_SHADER_FALLBACKS;
|
||||
}
|
||||
@ -221,6 +224,14 @@ bool EditorRunNative::get_debug_avoidance() const {
|
||||
return debug_avoidance;
|
||||
}
|
||||
|
||||
void EditorRunNative::set_debug_paths(bool p_debug) {
|
||||
debug_paths = p_debug;
|
||||
}
|
||||
|
||||
bool EditorRunNative::get_debug_paths() const {
|
||||
return debug_paths;
|
||||
}
|
||||
|
||||
void EditorRunNative::set_debug_shader_fallbacks(bool p_debug) {
|
||||
debug_shader_fallbacks = p_debug;
|
||||
}
|
||||
@ -246,6 +257,7 @@ EditorRunNative::EditorRunNative() {
|
||||
debug_collisions = false;
|
||||
debug_navigation = false;
|
||||
debug_avoidance = false;
|
||||
debug_paths = false;
|
||||
debug_shader_fallbacks = false;
|
||||
resume_idx = 0;
|
||||
resume_platform = 0;
|
||||
|
@ -52,6 +52,7 @@ class EditorRunNative : public HBoxContainer {
|
||||
bool debug_collisions;
|
||||
bool debug_navigation;
|
||||
bool debug_avoidance;
|
||||
bool debug_paths;
|
||||
bool debug_shader_fallbacks;
|
||||
|
||||
int resume_idx;
|
||||
@ -79,6 +80,9 @@ public:
|
||||
void set_debug_avoidance(bool p_debug);
|
||||
bool get_debug_avoidance() const;
|
||||
|
||||
void set_debug_paths(bool p_debug);
|
||||
bool get_debug_paths() const;
|
||||
|
||||
void set_debug_shader_fallbacks(bool p_debug);
|
||||
bool get_debug_shader_fallbacks() const;
|
||||
|
||||
|
@ -160,6 +160,7 @@ static bool use_debug_profiler = false;
|
||||
static bool debug_collisions = false;
|
||||
static bool debug_navigation = false;
|
||||
static bool debug_avoidance = false;
|
||||
static bool debug_paths = false;
|
||||
static bool debug_shader_fallbacks = false;
|
||||
#endif
|
||||
static int frame_delay = 0;
|
||||
@ -376,7 +377,8 @@ void Main::print_help(const char *p_binary) {
|
||||
#if defined(DEBUG_ENABLED) && !defined(SERVER_ENABLED)
|
||||
OS::get_singleton()->print(" --debug-collisions Show collision shapes when running the scene.\n");
|
||||
OS::get_singleton()->print(" --debug-navigation Show navigation polygons when running the scene.\n");
|
||||
OS::get_singleton()->print(" --debug-avoidance Show navigation polygons when running the scene.\n");
|
||||
OS::get_singleton()->print(" --debug-avoidance Show navigation polygons when running the scene.\n");
|
||||
OS::get_singleton()->print(" --debug-paths Show path lines when running the scene.\n");
|
||||
OS::get_singleton()->print(" --debug-shader-fallbacks Use the fallbacks of the shaders which have one when running the scene (GL ES 3 only).\n");
|
||||
#endif
|
||||
OS::get_singleton()->print(" --frame-delay <ms> Simulate high CPU load (delay each frame by <ms> milliseconds).\n");
|
||||
@ -916,6 +918,8 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
||||
debug_navigation = true;
|
||||
} else if (I->get() == "--debug-avoidance") {
|
||||
debug_avoidance = true;
|
||||
} else if (I->get() == "--debug-paths") {
|
||||
debug_paths = true;
|
||||
} else if (I->get() == "--debug-shader-fallbacks") {
|
||||
debug_shader_fallbacks = true;
|
||||
#endif
|
||||
@ -1936,6 +1940,9 @@ bool Main::start() {
|
||||
if (debug_avoidance) {
|
||||
sml->set_debug_avoidance_hint(true);
|
||||
}
|
||||
if (debug_paths) {
|
||||
sml->set_debug_paths_hint(true);
|
||||
}
|
||||
if (debug_navigation || debug_avoidance) {
|
||||
NavigationServer::get_singleton()->set_active(true);
|
||||
NavigationServer::get_singleton()->set_debug_enabled(true);
|
||||
|
@ -91,7 +91,7 @@ void Path2D::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_DRAW && curve.is_valid()) {
|
||||
//draw the curve!!
|
||||
|
||||
if (!Engine::get_singleton()->is_editor_hint() && !get_tree()->is_debugging_navigation_hint()) {
|
||||
if (!Engine::get_singleton()->is_editor_hint() && !get_tree()->is_debugging_paths_hint()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -100,11 +100,10 @@ void Path2D::_notification(int p_what) {
|
||||
}
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
const float line_width = 2 * EDSCALE;
|
||||
const float line_width = get_tree()->get_debug_paths_width() * EDSCALE;
|
||||
#else
|
||||
const float line_width = 2;
|
||||
const float line_width = get_tree()->get_debug_paths_width();
|
||||
#endif
|
||||
const Color color = Color(1.0, 1.0, 1.0, 1.0);
|
||||
|
||||
_cached_draw_pts.resize(curve->get_point_count() * 8);
|
||||
int count = 0;
|
||||
@ -117,7 +116,7 @@ void Path2D::_notification(int p_what) {
|
||||
}
|
||||
}
|
||||
|
||||
draw_polyline(_cached_draw_pts, color, line_width, true);
|
||||
draw_polyline(_cached_draw_pts, get_tree()->get_debug_paths_color(), line_width, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,7 +125,7 @@ void Path2D::_curve_changed() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Engine::get_singleton()->is_editor_hint() && !get_tree()->is_debugging_navigation_hint()) {
|
||||
if (!Engine::get_singleton()->is_editor_hint() && !get_tree()->is_debugging_paths_hint()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -32,9 +32,97 @@
|
||||
|
||||
#include "core/config/engine.h"
|
||||
#include "scene/resources/curve.h"
|
||||
#include "scene/resources/mesh.h"
|
||||
#include "scene/resources/world_3d.h"
|
||||
#include "scene/scene_string_names.h"
|
||||
#include "servers/rendering_server.h"
|
||||
|
||||
Path::Path() {
|
||||
SceneTree *st = SceneTree::get_singleton();
|
||||
if (st && st->is_debugging_paths_hint()) {
|
||||
debug_instance = RS::get_singleton()->instance_create();
|
||||
set_notify_transform(true);
|
||||
}
|
||||
|
||||
set_curve(Ref<Curve3D>(memnew(Curve3D))); //create one by default
|
||||
}
|
||||
|
||||
Path::~Path() {
|
||||
if (debug_instance.is_valid()) {
|
||||
RS::get_singleton()->free(debug_instance);
|
||||
}
|
||||
if (debug_mesh.is_valid()) {
|
||||
RS::get_singleton()->free(debug_mesh->get_rid());
|
||||
}
|
||||
}
|
||||
|
||||
void Path::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
SceneTree *st = SceneTree::get_singleton();
|
||||
if (st && st->is_debugging_paths_hint()) {
|
||||
_update_debug_mesh();
|
||||
}
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_EXIT_TREE: {
|
||||
SceneTree *st = SceneTree::get_singleton();
|
||||
if (st && st->is_debugging_paths_hint()) {
|
||||
RS::get_singleton()->instance_set_visible(debug_instance, false);
|
||||
}
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_TRANSFORM_CHANGED: {
|
||||
if (is_inside_tree() && debug_instance.is_valid()) {
|
||||
RS::get_singleton()->instance_set_transform(debug_instance, get_global_transform());
|
||||
}
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
void Path::_update_debug_mesh() {
|
||||
SceneTree *st = SceneTree::get_singleton();
|
||||
if (!(st && st->is_debugging_paths_hint())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!debug_mesh.is_valid()) {
|
||||
debug_mesh = Ref<ArrayMesh>(memnew(ArrayMesh));
|
||||
}
|
||||
|
||||
if (!(curve.is_valid())) {
|
||||
RS::get_singleton()->instance_set_visible(debug_instance, false);
|
||||
return;
|
||||
}
|
||||
if (curve->get_point_count() < 2) {
|
||||
RS::get_singleton()->instance_set_visible(debug_instance, false);
|
||||
return;
|
||||
}
|
||||
|
||||
Vector<Vector3> vertex_array;
|
||||
|
||||
for (int i = 1; i < curve->get_point_count(); i++) {
|
||||
Vector3 line_end = curve->get_point_position(i);
|
||||
Vector3 line_start = curve->get_point_position(i - 1);
|
||||
vertex_array.push_back(line_start);
|
||||
vertex_array.push_back(line_end);
|
||||
}
|
||||
|
||||
Array mesh_array;
|
||||
mesh_array.resize(Mesh::ARRAY_MAX);
|
||||
mesh_array[Mesh::ARRAY_VERTEX] = vertex_array;
|
||||
|
||||
debug_mesh->clear_surfaces();
|
||||
debug_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_LINES, mesh_array);
|
||||
|
||||
RS::get_singleton()->instance_set_base(debug_instance, debug_mesh->get_rid());
|
||||
RS::get_singleton()->mesh_surface_set_material(debug_mesh->get_rid(), 0, st->get_debug_paths_material()->get_rid());
|
||||
|
||||
if (is_inside_tree()) {
|
||||
RS::get_singleton()->instance_set_scenario(debug_instance, get_world_3d()->get_scenario());
|
||||
RS::get_singleton()->instance_set_transform(debug_instance, get_global_transform());
|
||||
RS::get_singleton()->instance_set_visible(debug_instance, is_visible_in_tree());
|
||||
}
|
||||
}
|
||||
|
||||
void Path::_curve_changed() {
|
||||
@ -55,6 +143,11 @@ void Path::_curve_changed() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SceneTree *st = SceneTree::get_singleton();
|
||||
if (st && st->is_debugging_paths_hint()) {
|
||||
_update_debug_mesh();
|
||||
}
|
||||
}
|
||||
|
||||
void Path::set_curve(const Ref<Curve3D> &p_curve) {
|
||||
@ -84,10 +177,6 @@ void Path::_bind_methods() {
|
||||
ADD_SIGNAL(MethodInfo("curve_changed"));
|
||||
}
|
||||
|
||||
Path::Path() {
|
||||
set_curve(Ref<Curve3D>(memnew(Curve3D))); //create one by default
|
||||
}
|
||||
|
||||
//////////////
|
||||
|
||||
void PathFollow::_update_transform(bool p_update_xyz_rot) {
|
||||
|
@ -42,6 +42,12 @@ class Path : public Spatial {
|
||||
|
||||
void _curve_changed();
|
||||
|
||||
RID debug_instance;
|
||||
Ref<ArrayMesh> debug_mesh;
|
||||
|
||||
private:
|
||||
void _update_debug_mesh();
|
||||
|
||||
protected:
|
||||
void _notification(int p_what);
|
||||
static void _bind_methods();
|
||||
@ -51,6 +57,7 @@ public:
|
||||
Ref<Curve3D> get_curve() const;
|
||||
|
||||
Path();
|
||||
~Path();
|
||||
};
|
||||
|
||||
class PathFollow : public Spatial {
|
||||
|
@ -992,6 +992,15 @@ void SceneTree::set_debug_avoidance_hint(bool p_enabled) {
|
||||
bool SceneTree::is_debugging_avoidance_hint() const {
|
||||
return debug_avoidance_hint;
|
||||
}
|
||||
|
||||
void SceneTree::set_debug_paths_hint(bool p_enabled) {
|
||||
debug_paths_hint = p_enabled;
|
||||
}
|
||||
|
||||
bool SceneTree::is_debugging_paths_hint() const {
|
||||
return debug_paths_hint;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void SceneTree::set_debug_collisions_color(const Color &p_color) {
|
||||
@ -1010,6 +1019,39 @@ Color SceneTree::get_debug_collision_contact_color() const {
|
||||
return debug_collision_contact_color;
|
||||
}
|
||||
|
||||
void SceneTree::set_debug_paths_color(const Color &p_color) {
|
||||
debug_paths_color = p_color;
|
||||
}
|
||||
|
||||
Color SceneTree::get_debug_paths_color() const {
|
||||
return debug_paths_color;
|
||||
}
|
||||
|
||||
void SceneTree::set_debug_paths_width(float p_width) {
|
||||
debug_paths_width = p_width;
|
||||
}
|
||||
|
||||
float SceneTree::get_debug_paths_width() const {
|
||||
return debug_paths_width;
|
||||
}
|
||||
|
||||
Ref<Material> SceneTree::get_debug_paths_material() {
|
||||
if (debug_paths_material.is_valid()) {
|
||||
return debug_paths_material;
|
||||
}
|
||||
|
||||
Ref<SpatialMaterial> _debug_material = Ref<SpatialMaterial>(memnew(SpatialMaterial));
|
||||
_debug_material->set_flag(SpatialMaterial::FLAG_UNSHADED, true);
|
||||
_debug_material->set_feature(SpatialMaterial::FEATURE_TRANSPARENT, true);
|
||||
_debug_material->set_flag(SpatialMaterial::FLAG_SRGB_VERTEX_COLOR, true);
|
||||
_debug_material->set_flag(SpatialMaterial::FLAG_ALBEDO_FROM_VERTEX_COLOR, true);
|
||||
_debug_material->set_albedo(get_debug_paths_color());
|
||||
|
||||
debug_paths_material = _debug_material;
|
||||
|
||||
return debug_paths_material;
|
||||
}
|
||||
|
||||
Ref<Material> SceneTree::get_debug_collision_material() {
|
||||
_THREAD_SAFE_METHOD_
|
||||
|
||||
@ -2152,6 +2194,8 @@ void SceneTree::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("is_debugging_navigation_hint"), &SceneTree::is_debugging_navigation_hint);
|
||||
ClassDB::bind_method(D_METHOD("set_debug_avoidance_hint", "enable"), &SceneTree::set_debug_avoidance_hint);
|
||||
ClassDB::bind_method(D_METHOD("is_debugging_avoidance_hint"), &SceneTree::is_debugging_avoidance_hint);
|
||||
ClassDB::bind_method(D_METHOD("set_debug_paths_hint", "enable"), &SceneTree::set_debug_paths_hint);
|
||||
ClassDB::bind_method(D_METHOD("is_debugging_paths_hint"), &SceneTree::is_debugging_paths_hint);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("set_edited_scene_root", "scene"), &SceneTree::set_edited_scene_root);
|
||||
ClassDB::bind_method(D_METHOD("get_edited_scene_root"), &SceneTree::get_edited_scene_root);
|
||||
@ -2233,6 +2277,7 @@ void SceneTree::_bind_methods() {
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "debug_collisions_hint"), "set_debug_collisions_hint", "is_debugging_collisions_hint");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "debug_navigation_hint"), "set_debug_navigation_hint", "is_debugging_navigation_hint");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "debug_paths_hint"), "set_debug_paths_hint", "is_debugging_paths_hint");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "paused"), "set_pause", "is_paused");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "refuse_new_network_connections"), "set_refuse_new_network_connections", "is_refusing_new_network_connections");
|
||||
ADD_PROPERTY_DEFAULT("refuse_new_network_connections", false);
|
||||
@ -2356,9 +2401,12 @@ SceneTree::SceneTree() {
|
||||
debug_collisions_hint = false;
|
||||
debug_navigation_hint = false;
|
||||
debug_avoidance_hint = false;
|
||||
debug_paths_hint = false;
|
||||
#endif
|
||||
debug_collisions_color = GLOBAL_DEF("debug/shapes/collision/shape_color", Color(0.0, 0.6, 0.7, 0.42));
|
||||
debug_collision_contact_color = GLOBAL_DEF("debug/shapes/collision/contact_color", Color(1.0, 0.2, 0.1, 0.8));
|
||||
debug_paths_color = GLOBAL_DEF("debug/shapes/paths/geometry_color", Color(0.1, 1.0, 0.7, 0.4));
|
||||
debug_paths_width = GLOBAL_DEF("debug/shapes/paths/geometry_width", 2.0);
|
||||
collision_debug_contacts = GLOBAL_DEF("debug/shapes/collision/max_contacts_displayed", 10000);
|
||||
ProjectSettings::get_singleton()->set_custom_property_info("debug/shapes/collision/max_contacts_displayed", PropertyInfo(Variant::INT, "debug/shapes/collision/max_contacts_displayed", PROPERTY_HINT_RANGE, "0,20000,1")); // No negative
|
||||
|
||||
|
@ -119,6 +119,7 @@ private:
|
||||
bool debug_collisions_hint;
|
||||
bool debug_navigation_hint;
|
||||
bool debug_avoidance_hint;
|
||||
bool debug_paths_hint;
|
||||
#endif
|
||||
bool pause;
|
||||
int root_lock;
|
||||
@ -182,9 +183,12 @@ private:
|
||||
Color debug_collision_contact_color;
|
||||
Color debug_navigation_color;
|
||||
Color debug_navigation_disabled_color;
|
||||
Color debug_paths_color;
|
||||
float debug_paths_width = 1.0f;
|
||||
Ref<ArrayMesh> debug_contact_mesh;
|
||||
Ref<Material> navigation_material;
|
||||
Ref<Material> navigation_disabled_material;
|
||||
Ref<Material> debug_paths_material;
|
||||
Ref<Material> collision_material;
|
||||
int collision_debug_contacts;
|
||||
|
||||
@ -356,6 +360,9 @@ public:
|
||||
|
||||
void set_debug_avoidance_hint(bool p_enabled);
|
||||
bool is_debugging_avoidance_hint() const;
|
||||
|
||||
void set_debug_paths_hint(bool p_enabled);
|
||||
bool is_debugging_paths_hint() const;
|
||||
#else
|
||||
void set_debug_collisions_hint(bool p_enabled) {}
|
||||
bool is_debugging_collisions_hint() const {
|
||||
@ -371,6 +378,11 @@ public:
|
||||
bool is_debugging_avoidance_hint() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
void set_debug_paths_hint(bool p_enabled) {}
|
||||
bool is_debugging_paths_hint() const {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
void set_debug_collisions_color(const Color &p_color);
|
||||
@ -379,6 +391,13 @@ public:
|
||||
void set_debug_collision_contact_color(const Color &p_color);
|
||||
Color get_debug_collision_contact_color() const;
|
||||
|
||||
void set_debug_paths_color(const Color &p_color);
|
||||
Color get_debug_paths_color() const;
|
||||
|
||||
void set_debug_paths_width(float p_width);
|
||||
float get_debug_paths_width() const;
|
||||
|
||||
Ref<Material> get_debug_paths_material();
|
||||
Ref<Material> get_debug_collision_material();
|
||||
Ref<ArrayMesh> get_debug_contact_mesh();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user