feat: modules moved and engine moved to submodule
This commit is contained in:
parent
dfb5e645cd
commit
c33d2130cc
5136 changed files with 225275 additions and 64485 deletions
|
|
@ -30,13 +30,31 @@
|
|||
|
||||
#include "visible_on_screen_notifier_2d.h"
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
Dictionary VisibleOnScreenNotifier2D::_edit_get_state() const {
|
||||
Dictionary state = Node2D::_edit_get_state();
|
||||
state["rect"] = rect;
|
||||
return state;
|
||||
}
|
||||
|
||||
void VisibleOnScreenNotifier2D::_edit_set_state(const Dictionary &p_state) {
|
||||
ERR_FAIL_COND(p_state.is_empty() || !p_state.has("rect"));
|
||||
set_rect(p_state["rect"]);
|
||||
Node2D::_edit_set_state(p_state);
|
||||
}
|
||||
|
||||
void VisibleOnScreenNotifier2D::_edit_set_rect(const Rect2 &p_edit_rect) {
|
||||
set_rect(p_edit_rect);
|
||||
}
|
||||
#endif // TOOLS_ENABLED
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
Rect2 VisibleOnScreenNotifier2D::_edit_get_rect() const {
|
||||
return rect;
|
||||
}
|
||||
|
||||
bool VisibleOnScreenNotifier2D::_edit_use_rect() const {
|
||||
return true;
|
||||
return show_rect;
|
||||
}
|
||||
#endif // DEBUG_ENABLED
|
||||
|
||||
|
|
@ -71,6 +89,18 @@ Rect2 VisibleOnScreenNotifier2D::get_rect() const {
|
|||
return rect;
|
||||
}
|
||||
|
||||
void VisibleOnScreenNotifier2D::set_show_rect(bool p_show_rect) {
|
||||
if (show_rect == p_show_rect) {
|
||||
return;
|
||||
}
|
||||
show_rect = p_show_rect;
|
||||
queue_redraw();
|
||||
}
|
||||
|
||||
bool VisibleOnScreenNotifier2D::is_showing_rect() const {
|
||||
return show_rect;
|
||||
}
|
||||
|
||||
void VisibleOnScreenNotifier2D::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
|
|
@ -79,7 +109,7 @@ void VisibleOnScreenNotifier2D::_notification(int p_what) {
|
|||
} break;
|
||||
|
||||
case NOTIFICATION_DRAW: {
|
||||
if (Engine::get_singleton()->is_editor_hint()) {
|
||||
if (show_rect && Engine::get_singleton()->is_editor_hint()) {
|
||||
draw_rect(rect, Color(1, 0.5, 1, 0.2));
|
||||
}
|
||||
} break;
|
||||
|
|
@ -98,9 +128,12 @@ bool VisibleOnScreenNotifier2D::is_on_screen() const {
|
|||
void VisibleOnScreenNotifier2D::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("set_rect", "rect"), &VisibleOnScreenNotifier2D::set_rect);
|
||||
ClassDB::bind_method(D_METHOD("get_rect"), &VisibleOnScreenNotifier2D::get_rect);
|
||||
ClassDB::bind_method(D_METHOD("set_show_rect", "show_rect"), &VisibleOnScreenNotifier2D::set_show_rect);
|
||||
ClassDB::bind_method(D_METHOD("is_showing_rect"), &VisibleOnScreenNotifier2D::is_showing_rect);
|
||||
ClassDB::bind_method(D_METHOD("is_on_screen"), &VisibleOnScreenNotifier2D::is_on_screen);
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::RECT2, "rect", PROPERTY_HINT_NONE, "suffix:px"), "set_rect", "get_rect");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "show_rect"), "set_show_rect", "is_showing_rect");
|
||||
|
||||
ADD_SIGNAL(MethodInfo("screen_entered"));
|
||||
ADD_SIGNAL(MethodInfo("screen_exited"));
|
||||
|
|
@ -154,7 +187,7 @@ NodePath VisibleOnScreenEnabler2D::get_enable_node_path() {
|
|||
}
|
||||
|
||||
void VisibleOnScreenEnabler2D::_update_enable_mode(bool p_enable) {
|
||||
Node *node = static_cast<Node *>(ObjectDB::get_instance(node_id));
|
||||
Node *node = ObjectDB::get_instance<Node>(node_id);
|
||||
if (node) {
|
||||
if (p_enable) {
|
||||
switch (enable_mode) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue