mirror of
https://github.com/godotengine/godot.git
synced 2025-02-16 15:50:45 +00:00
begin work on debugging collisions....
This commit is contained in:
parent
89a901c4b6
commit
3f9e5afe68
@ -97,6 +97,7 @@ static OS::VideoMode video_mode;
|
|||||||
static bool init_maximized=false;
|
static bool init_maximized=false;
|
||||||
static bool init_fullscreen=false;
|
static bool init_fullscreen=false;
|
||||||
static bool init_use_custom_pos=false;
|
static bool init_use_custom_pos=false;
|
||||||
|
static bool debug_collisions=false;
|
||||||
static Vector2 init_custom_pos;
|
static Vector2 init_custom_pos;
|
||||||
static int video_driver_idx=-1;
|
static int video_driver_idx=-1;
|
||||||
static int audio_driver_idx=-1;
|
static int audio_driver_idx=-1;
|
||||||
@ -514,6 +515,8 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas
|
|||||||
|
|
||||||
} else if (I->get()=="-debug" || I->get()=="-d") {
|
} else if (I->get()=="-debug" || I->get()=="-d") {
|
||||||
debug_mode="local";
|
debug_mode="local";
|
||||||
|
} else if (I->get()=="-debugcol" || I->get()=="-dc") {
|
||||||
|
debug_collisions=true;
|
||||||
} else if (I->get()=="-editor_scene") {
|
} else if (I->get()=="-editor_scene") {
|
||||||
|
|
||||||
if (I->next()) {
|
if (I->next()) {
|
||||||
@ -1154,8 +1157,12 @@ bool Main::start() {
|
|||||||
|
|
||||||
SceneTree *sml = main_loop->cast_to<SceneTree>();
|
SceneTree *sml = main_loop->cast_to<SceneTree>();
|
||||||
|
|
||||||
|
if (debug_collisions) {
|
||||||
|
sml->set_debug_collisions_hint(true);
|
||||||
|
}
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
|
|
||||||
|
|
||||||
EditorNode *editor_node=NULL;
|
EditorNode *editor_node=NULL;
|
||||||
if (editor) {
|
if (editor) {
|
||||||
|
|
||||||
|
@ -92,8 +92,12 @@ void CollisionShape2D::_notification(int p_what) {
|
|||||||
} break;*/
|
} break;*/
|
||||||
case NOTIFICATION_DRAW: {
|
case NOTIFICATION_DRAW: {
|
||||||
|
|
||||||
|
if (!get_tree()->is_editor_hint() && !get_tree()->is_debugging_collisions_hint())
|
||||||
|
break;
|
||||||
|
|
||||||
rect=Rect2();
|
rect=Rect2();
|
||||||
|
|
||||||
|
|
||||||
Color draw_col=Color(0,0.6,0.7,0.5);
|
Color draw_col=Color(0,0.6,0.7,0.5);
|
||||||
|
|
||||||
if (shape->cast_to<LineShape2D>()) {
|
if (shape->cast_to<LineShape2D>()) {
|
||||||
|
@ -471,6 +471,7 @@ void SceneTree::init() {
|
|||||||
|
|
||||||
|
|
||||||
editor_hint=false;
|
editor_hint=false;
|
||||||
|
debug_collisions_hint=false;
|
||||||
pause=false;
|
pause=false;
|
||||||
|
|
||||||
root->_set_tree(this);
|
root->_set_tree(this);
|
||||||
@ -624,6 +625,16 @@ bool SceneTree::is_editor_hint() const {
|
|||||||
return editor_hint;
|
return editor_hint;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SceneTree::set_debug_collisions_hint(bool p_enabled) {
|
||||||
|
|
||||||
|
debug_collisions_hint=p_enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SceneTree::is_debugging_collisions_hint() const {
|
||||||
|
|
||||||
|
return debug_collisions_hint;
|
||||||
|
}
|
||||||
|
|
||||||
void SceneTree::set_pause(bool p_enabled) {
|
void SceneTree::set_pause(bool p_enabled) {
|
||||||
|
|
||||||
if (p_enabled==pause)
|
if (p_enabled==pause)
|
||||||
@ -1424,6 +1435,8 @@ void SceneTree::_bind_methods() {
|
|||||||
|
|
||||||
ObjectTypeDB::bind_method(_MD("set_editor_hint","enable"),&SceneTree::set_editor_hint);
|
ObjectTypeDB::bind_method(_MD("set_editor_hint","enable"),&SceneTree::set_editor_hint);
|
||||||
ObjectTypeDB::bind_method(_MD("is_editor_hint"),&SceneTree::is_editor_hint);
|
ObjectTypeDB::bind_method(_MD("is_editor_hint"),&SceneTree::is_editor_hint);
|
||||||
|
ObjectTypeDB::bind_method(_MD("set_debug_collisions_hint","enable"),&SceneTree::set_debug_collisions_hint);
|
||||||
|
ObjectTypeDB::bind_method(_MD("is_debugging_collisions_hint"),&SceneTree::is_debugging_collisions_hint);
|
||||||
#ifdef TOOLS_ENABLED
|
#ifdef TOOLS_ENABLED
|
||||||
ObjectTypeDB::bind_method(_MD("set_edited_scene_root","scene"),&SceneTree::set_edited_scene_root);
|
ObjectTypeDB::bind_method(_MD("set_edited_scene_root","scene"),&SceneTree::set_edited_scene_root);
|
||||||
ObjectTypeDB::bind_method(_MD("get_edited_scene_root"),&SceneTree::get_edited_scene_root);
|
ObjectTypeDB::bind_method(_MD("get_edited_scene_root"),&SceneTree::get_edited_scene_root);
|
||||||
|
@ -87,6 +87,7 @@ private:
|
|||||||
uint32_t last_id;
|
uint32_t last_id;
|
||||||
|
|
||||||
bool editor_hint;
|
bool editor_hint;
|
||||||
|
bool debug_collisions_hint;
|
||||||
bool pause;
|
bool pause;
|
||||||
int root_lock;
|
int root_lock;
|
||||||
|
|
||||||
@ -270,6 +271,9 @@ public:
|
|||||||
void set_camera(const RID& p_camera);
|
void set_camera(const RID& p_camera);
|
||||||
RID get_camera() const;
|
RID get_camera() const;
|
||||||
|
|
||||||
|
void set_debug_collisions_hint(bool p_enabled);
|
||||||
|
bool is_debugging_collisions_hint() const;
|
||||||
|
|
||||||
int64_t get_frame() const;
|
int64_t get_frame() const;
|
||||||
|
|
||||||
int get_node_count() const;
|
int get_node_count() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user