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
|
|
@ -292,6 +292,13 @@ void CanvasItem::_exit_canvas() {
|
|||
|
||||
void CanvasItem::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_ACCESSIBILITY_UPDATE: {
|
||||
RID ae = get_accessibility_element();
|
||||
ERR_FAIL_COND(ae.is_null());
|
||||
|
||||
DisplayServer::get_singleton()->accessibility_update_set_flag(ae, DisplayServer::AccessibilityFlags::FLAG_HIDDEN, !visible);
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
ERR_MAIN_THREAD_GUARD;
|
||||
ERR_FAIL_COND(!is_inside_tree());
|
||||
|
|
@ -743,7 +750,7 @@ void CanvasItem::draw_arc(const Vector2 &p_center, real_t p_radius, real_t p_sta
|
|||
Point2 *points_ptr = points.ptrw();
|
||||
|
||||
// Clamp angle difference to full circle so arc won't overlap itself.
|
||||
const real_t delta_angle = CLAMP(p_end_angle - p_start_angle, -Math_TAU, Math_TAU);
|
||||
const real_t delta_angle = CLAMP(p_end_angle - p_start_angle, -Math::TAU, Math::TAU);
|
||||
for (int i = 0; i < p_point_count; i++) {
|
||||
real_t theta = (i / (p_point_count - 1.0f)) * delta_angle + p_start_angle;
|
||||
points_ptr[i] = p_center + Vector2(Math::cos(theta), Math::sin(theta)) * p_radius;
|
||||
|
|
@ -816,7 +823,7 @@ void CanvasItem::draw_circle(const Point2 &p_pos, real_t p_radius, const Color &
|
|||
points.resize(circle_segments + 1);
|
||||
|
||||
Vector2 *points_ptr = points.ptrw();
|
||||
const real_t circle_point_step = Math_TAU / circle_segments;
|
||||
const real_t circle_point_step = Math::TAU / circle_segments;
|
||||
|
||||
for (int i = 0; i < circle_segments; i++) {
|
||||
float angle = i * circle_point_step;
|
||||
|
|
@ -1245,6 +1252,38 @@ void CanvasItem::_validate_property(PropertyInfo &p_property) const {
|
|||
}
|
||||
}
|
||||
|
||||
PackedStringArray CanvasItem::get_configuration_warnings() const {
|
||||
PackedStringArray warnings = Node::get_configuration_warnings();
|
||||
|
||||
if (clip_children_mode != CLIP_CHILDREN_DISABLED && is_inside_tree()) {
|
||||
bool warned_about_ancestor_clipping = false;
|
||||
bool warned_about_canvasgroup_ancestor = false;
|
||||
Node *n = get_parent();
|
||||
while (n) {
|
||||
CanvasItem *as_canvas_item = Object::cast_to<CanvasItem>(n);
|
||||
if (!warned_about_ancestor_clipping && as_canvas_item && as_canvas_item->clip_children_mode != CLIP_CHILDREN_DISABLED) {
|
||||
warnings.push_back(vformat(RTR("Ancestor \"%s\" clips its children, so this node will not be able to clip its children."), as_canvas_item->get_name()));
|
||||
warned_about_ancestor_clipping = true;
|
||||
}
|
||||
|
||||
CanvasGroup *as_canvas_group = Object::cast_to<CanvasGroup>(n);
|
||||
if (!warned_about_canvasgroup_ancestor && as_canvas_group) {
|
||||
warnings.push_back(vformat(RTR("Ancestor \"%s\" is a CanvasGroup, so this node will not be able to clip its children."), as_canvas_group->get_name()));
|
||||
warned_about_canvasgroup_ancestor = true;
|
||||
}
|
||||
|
||||
// Only break out early once both warnings have been triggered, so
|
||||
// that the user is aware of both possible reasons for clipping not working.
|
||||
if (warned_about_ancestor_clipping && warned_about_canvasgroup_ancestor) {
|
||||
break;
|
||||
}
|
||||
n = n->get_parent();
|
||||
}
|
||||
}
|
||||
|
||||
return warnings;
|
||||
}
|
||||
|
||||
void CanvasItem::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("_top_level_raise_self"), &CanvasItem::_top_level_raise_self);
|
||||
|
||||
|
|
@ -1646,6 +1685,8 @@ void CanvasItem::set_clip_children_mode(ClipChildrenMode p_clip_mode) {
|
|||
}
|
||||
clip_children_mode = p_clip_mode;
|
||||
|
||||
update_configuration_warnings();
|
||||
|
||||
if (Object::cast_to<CanvasGroup>(this) != nullptr) {
|
||||
//avoid accidental bugs, make this not work on CanvasGroup
|
||||
return;
|
||||
|
|
@ -1653,6 +1694,7 @@ void CanvasItem::set_clip_children_mode(ClipChildrenMode p_clip_mode) {
|
|||
|
||||
RS::get_singleton()->canvas_item_set_canvas_group_mode(get_canvas_item(), RS::CanvasGroupMode(clip_children_mode));
|
||||
}
|
||||
|
||||
CanvasItem::ClipChildrenMode CanvasItem::get_clip_children_mode() const {
|
||||
ERR_READ_THREAD_GUARD_V(CLIP_CHILDREN_DISABLED);
|
||||
return clip_children_mode;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue