summaryrefslogtreecommitdiff
path: root/servers/rendering/renderer_canvas_cull.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'servers/rendering/renderer_canvas_cull.cpp')
-rw-r--r--servers/rendering/renderer_canvas_cull.cpp200
1 files changed, 100 insertions, 100 deletions
diff --git a/servers/rendering/renderer_canvas_cull.cpp b/servers/rendering/renderer_canvas_cull.cpp
index 456c736731..46683e8e68 100644
--- a/servers/rendering/renderer_canvas_cull.cpp
+++ b/servers/rendering/renderer_canvas_cull.cpp
@@ -100,7 +100,7 @@ void _collect_ysort_children(RendererCanvasCull::Item *p_canvas_item, Transform2
void _mark_ysort_dirty(RendererCanvasCull::Item *ysort_owner, RID_Owner<RendererCanvasCull::Item, true> &canvas_item_owner) {
do {
ysort_owner->ysort_children_count = -1;
- ysort_owner = canvas_item_owner.owns(ysort_owner->parent) ? canvas_item_owner.getornull(ysort_owner->parent) : nullptr;
+ ysort_owner = canvas_item_owner.owns(ysort_owner->parent) ? canvas_item_owner.get_or_null(ysort_owner->parent) : nullptr;
} while (ysort_owner && ysort_owner->sort_y);
}
@@ -396,9 +396,9 @@ void RendererCanvasCull::canvas_initialize(RID p_rid) {
}
void RendererCanvasCull::canvas_set_item_mirroring(RID p_canvas, RID p_item, const Point2 &p_mirroring) {
- Canvas *canvas = canvas_owner.getornull(p_canvas);
+ Canvas *canvas = canvas_owner.get_or_null(p_canvas);
ERR_FAIL_COND(!canvas);
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
int idx = canvas->find_item(canvas_item);
@@ -407,7 +407,7 @@ void RendererCanvasCull::canvas_set_item_mirroring(RID p_canvas, RID p_item, con
}
void RendererCanvasCull::canvas_set_modulate(RID p_canvas, const Color &p_color) {
- Canvas *canvas = canvas_owner.getornull(p_canvas);
+ Canvas *canvas = canvas_owner.get_or_null(p_canvas);
ERR_FAIL_COND(!canvas);
canvas->modulate = p_color;
}
@@ -417,7 +417,7 @@ void RendererCanvasCull::canvas_set_disable_scale(bool p_disable) {
}
void RendererCanvasCull::canvas_set_parent(RID p_canvas, RID p_parent, float p_scale) {
- Canvas *canvas = canvas_owner.getornull(p_canvas);
+ Canvas *canvas = canvas_owner.get_or_null(p_canvas);
ERR_FAIL_COND(!canvas);
canvas->parent = p_parent;
@@ -432,15 +432,15 @@ void RendererCanvasCull::canvas_item_initialize(RID p_rid) {
}
void RendererCanvasCull::canvas_item_set_parent(RID p_item, RID p_parent) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
if (canvas_item->parent.is_valid()) {
if (canvas_owner.owns(canvas_item->parent)) {
- Canvas *canvas = canvas_owner.getornull(canvas_item->parent);
+ Canvas *canvas = canvas_owner.get_or_null(canvas_item->parent);
canvas->erase_item(canvas_item);
} else if (canvas_item_owner.owns(canvas_item->parent)) {
- Item *item_owner = canvas_item_owner.getornull(canvas_item->parent);
+ Item *item_owner = canvas_item_owner.get_or_null(canvas_item->parent);
item_owner->child_items.erase(canvas_item);
if (item_owner->sort_y) {
@@ -453,13 +453,13 @@ void RendererCanvasCull::canvas_item_set_parent(RID p_item, RID p_parent) {
if (p_parent.is_valid()) {
if (canvas_owner.owns(p_parent)) {
- Canvas *canvas = canvas_owner.getornull(p_parent);
+ Canvas *canvas = canvas_owner.get_or_null(p_parent);
Canvas::ChildItem ci;
ci.item = canvas_item;
canvas->child_items.push_back(ci);
canvas->children_order_dirty = true;
} else if (canvas_item_owner.owns(p_parent)) {
- Item *item_owner = canvas_item_owner.getornull(p_parent);
+ Item *item_owner = canvas_item_owner.get_or_null(p_parent);
item_owner->child_items.push_back(canvas_item);
item_owner->children_order_dirty = true;
@@ -476,7 +476,7 @@ void RendererCanvasCull::canvas_item_set_parent(RID p_item, RID p_parent) {
}
void RendererCanvasCull::canvas_item_set_visible(RID p_item, bool p_visible) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
canvas_item->visible = p_visible;
@@ -485,35 +485,35 @@ void RendererCanvasCull::canvas_item_set_visible(RID p_item, bool p_visible) {
}
void RendererCanvasCull::canvas_item_set_light_mask(RID p_item, int p_mask) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
canvas_item->light_mask = p_mask;
}
void RendererCanvasCull::canvas_item_set_transform(RID p_item, const Transform2D &p_transform) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
canvas_item->xform = p_transform;
}
void RendererCanvasCull::canvas_item_set_clip(RID p_item, bool p_clip) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
canvas_item->clip = p_clip;
}
void RendererCanvasCull::canvas_item_set_distance_field_mode(RID p_item, bool p_enable) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
canvas_item->distance_field = p_enable;
}
void RendererCanvasCull::canvas_item_set_custom_rect(RID p_item, bool p_custom_rect, const Rect2 &p_rect) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
canvas_item->custom_rect = p_custom_rect;
@@ -521,35 +521,35 @@ void RendererCanvasCull::canvas_item_set_custom_rect(RID p_item, bool p_custom_r
}
void RendererCanvasCull::canvas_item_set_modulate(RID p_item, const Color &p_color) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
canvas_item->modulate = p_color;
}
void RendererCanvasCull::canvas_item_set_self_modulate(RID p_item, const Color &p_color) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
canvas_item->self_modulate = p_color;
}
void RendererCanvasCull::canvas_item_set_draw_behind_parent(RID p_item, bool p_enable) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
canvas_item->behind = p_enable;
}
void RendererCanvasCull::canvas_item_set_update_when_visible(RID p_item, bool p_update) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
canvas_item->update_when_visible = p_update;
}
void RendererCanvasCull::canvas_item_add_line(RID p_item, const Point2 &p_from, const Point2 &p_to, const Color &p_color, float p_width) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
Item::CommandPrimitive *line = canvas_item->alloc_command<Item::CommandPrimitive>();
@@ -573,7 +573,7 @@ void RendererCanvasCull::canvas_item_add_line(RID p_item, const Point2 &p_from,
void RendererCanvasCull::canvas_item_add_polyline(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width, bool p_antialiased) {
ERR_FAIL_COND(p_points.size() < 2);
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
Color color = Color(1, 1, 1, 1);
@@ -714,7 +714,7 @@ void RendererCanvasCull::canvas_item_add_polyline(RID p_item, const Vector<Point
void RendererCanvasCull::canvas_item_add_multiline(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, float p_width) {
ERR_FAIL_COND(p_points.size() < 2);
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
Item::CommandPolygon *pline = canvas_item->alloc_command<Item::CommandPolygon>();
@@ -730,7 +730,7 @@ void RendererCanvasCull::canvas_item_add_multiline(RID p_item, const Vector<Poin
}
void RendererCanvasCull::canvas_item_add_rect(RID p_item, const Rect2 &p_rect, const Color &p_color) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
Item::CommandRect *rect = canvas_item->alloc_command<Item::CommandRect>();
@@ -740,7 +740,7 @@ void RendererCanvasCull::canvas_item_add_rect(RID p_item, const Rect2 &p_rect, c
}
void RendererCanvasCull::canvas_item_add_circle(RID p_item, const Point2 &p_pos, float p_radius, const Color &p_color) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
Item::CommandPolygon *circle = canvas_item->alloc_command<Item::CommandPolygon>();
@@ -776,7 +776,7 @@ void RendererCanvasCull::canvas_item_add_circle(RID p_item, const Point2 &p_pos,
}
void RendererCanvasCull::canvas_item_add_texture_rect(RID p_item, const Rect2 &p_rect, RID p_texture, bool p_tile, const Color &p_modulate, bool p_transpose) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
Item::CommandRect *rect = canvas_item->alloc_command<Item::CommandRect>();
@@ -807,7 +807,7 @@ void RendererCanvasCull::canvas_item_add_texture_rect(RID p_item, const Rect2 &p
}
void RendererCanvasCull::canvas_item_add_msdf_texture_rect_region(RID p_item, const Rect2 &p_rect, RID p_texture, const Rect2 &p_src_rect, const Color &p_modulate, int p_outline_size, float p_px_range) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
Item::CommandRect *rect = canvas_item->alloc_command<Item::CommandRect>();
@@ -841,7 +841,7 @@ void RendererCanvasCull::canvas_item_add_msdf_texture_rect_region(RID p_item, co
}
void RendererCanvasCull::canvas_item_add_texture_rect_region(RID p_item, const Rect2 &p_rect, RID p_texture, const Rect2 &p_src_rect, const Color &p_modulate, bool p_transpose, bool p_clip_uv) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
Item::CommandRect *rect = canvas_item->alloc_command<Item::CommandRect>();
@@ -882,7 +882,7 @@ void RendererCanvasCull::canvas_item_add_texture_rect_region(RID p_item, const R
}
void RendererCanvasCull::canvas_item_add_nine_patch(RID p_item, const Rect2 &p_rect, const Rect2 &p_source, RID p_texture, const Vector2 &p_topleft, const Vector2 &p_bottomright, RS::NinePatchAxisMode p_x_axis_mode, RS::NinePatchAxisMode p_y_axis_mode, bool p_draw_center, const Color &p_modulate) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
Item::CommandNinePatch *style = canvas_item->alloc_command<Item::CommandNinePatch>();
@@ -906,7 +906,7 @@ void RendererCanvasCull::canvas_item_add_primitive(RID p_item, const Vector<Poin
uint32_t pc = p_points.size();
ERR_FAIL_COND(pc == 0 || pc > 4);
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
Item::CommandPrimitive *prim = canvas_item->alloc_command<Item::CommandPrimitive>();
@@ -932,7 +932,7 @@ void RendererCanvasCull::canvas_item_add_primitive(RID p_item, const Vector<Poin
}
void RendererCanvasCull::canvas_item_add_polygon(RID p_item, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, RID p_texture) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
#ifdef DEBUG_ENABLED
int pointcount = p_points.size();
@@ -953,7 +953,7 @@ void RendererCanvasCull::canvas_item_add_polygon(RID p_item, const Vector<Point2
}
void RendererCanvasCull::canvas_item_add_triangle_array(RID p_item, const Vector<int> &p_indices, const Vector<Point2> &p_points, const Vector<Color> &p_colors, const Vector<Point2> &p_uvs, const Vector<int> &p_bones, const Vector<float> &p_weights, RID p_texture, int p_count) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
int vertex_count = p_points.size();
@@ -976,7 +976,7 @@ void RendererCanvasCull::canvas_item_add_triangle_array(RID p_item, const Vector
}
void RendererCanvasCull::canvas_item_add_set_transform(RID p_item, const Transform2D &p_transform) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
Item::CommandTransform *tr = canvas_item->alloc_command<Item::CommandTransform>();
@@ -985,7 +985,7 @@ void RendererCanvasCull::canvas_item_add_set_transform(RID p_item, const Transfo
}
void RendererCanvasCull::canvas_item_add_mesh(RID p_item, const RID &p_mesh, const Transform2D &p_transform, const Color &p_modulate, RID p_texture) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
ERR_FAIL_COND(!p_mesh.is_valid());
@@ -1004,7 +1004,7 @@ void RendererCanvasCull::canvas_item_add_mesh(RID p_item, const RID &p_mesh, con
}
void RendererCanvasCull::canvas_item_add_particles(RID p_item, RID p_particles, RID p_texture) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
Item::CommandParticles *part = canvas_item->alloc_command<Item::CommandParticles>();
@@ -1018,7 +1018,7 @@ void RendererCanvasCull::canvas_item_add_particles(RID p_item, RID p_particles,
}
void RendererCanvasCull::canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p_texture) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
Item::CommandMultiMesh *mm = canvas_item->alloc_command<Item::CommandMultiMesh>();
@@ -1029,7 +1029,7 @@ void RendererCanvasCull::canvas_item_add_multimesh(RID p_item, RID p_mesh, RID p
}
void RendererCanvasCull::canvas_item_add_clip_ignore(RID p_item, bool p_ignore) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
Item::CommandClipIgnore *ci = canvas_item->alloc_command<Item::CommandClipIgnore>();
@@ -1038,7 +1038,7 @@ void RendererCanvasCull::canvas_item_add_clip_ignore(RID p_item, bool p_ignore)
}
void RendererCanvasCull::canvas_item_add_animation_slice(RID p_item, double p_animation_length, double p_slice_begin, double p_slice_end, double p_offset) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
Item::CommandAnimationSlice *as = canvas_item->alloc_command<Item::CommandAnimationSlice>();
@@ -1050,7 +1050,7 @@ void RendererCanvasCull::canvas_item_add_animation_slice(RID p_item, double p_an
}
void RendererCanvasCull::canvas_item_set_sort_children_by_y(RID p_item, bool p_enable) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
canvas_item->sort_y = p_enable;
@@ -1061,21 +1061,21 @@ void RendererCanvasCull::canvas_item_set_sort_children_by_y(RID p_item, bool p_e
void RendererCanvasCull::canvas_item_set_z_index(RID p_item, int p_z) {
ERR_FAIL_COND(p_z < RS::CANVAS_ITEM_Z_MIN || p_z > RS::CANVAS_ITEM_Z_MAX);
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
canvas_item->z_index = p_z;
}
void RendererCanvasCull::canvas_item_set_z_as_relative_to_parent(RID p_item, bool p_enable) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
canvas_item->z_relative = p_enable;
}
void RendererCanvasCull::canvas_item_attach_skeleton(RID p_item, RID p_skeleton) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
if (canvas_item->skeleton == p_skeleton) {
return;
@@ -1104,7 +1104,7 @@ void RendererCanvasCull::canvas_item_attach_skeleton(RID p_item, RID p_skeleton)
}
void RendererCanvasCull::canvas_item_set_copy_to_backbuffer(RID p_item, bool p_enable, const Rect2 &p_rect) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
if (p_enable && (canvas_item->copy_back_buffer == nullptr)) {
canvas_item->copy_back_buffer = memnew(RendererCanvasRender::Item::CopyBackBuffer);
@@ -1121,25 +1121,25 @@ void RendererCanvasCull::canvas_item_set_copy_to_backbuffer(RID p_item, bool p_e
}
void RendererCanvasCull::canvas_item_clear(RID p_item) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
canvas_item->clear();
}
void RendererCanvasCull::canvas_item_set_draw_index(RID p_item, int p_index) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
canvas_item->index = p_index;
if (canvas_item_owner.owns(canvas_item->parent)) {
- Item *canvas_item_parent = canvas_item_owner.getornull(canvas_item->parent);
+ Item *canvas_item_parent = canvas_item_owner.get_or_null(canvas_item->parent);
canvas_item_parent->children_order_dirty = true;
return;
}
- Canvas *canvas = canvas_owner.getornull(canvas_item->parent);
+ Canvas *canvas = canvas_owner.get_or_null(canvas_item->parent);
if (canvas) {
canvas->children_order_dirty = true;
return;
@@ -1147,21 +1147,21 @@ void RendererCanvasCull::canvas_item_set_draw_index(RID p_item, int p_index) {
}
void RendererCanvasCull::canvas_item_set_material(RID p_item, RID p_material) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
canvas_item->material = p_material;
}
void RendererCanvasCull::canvas_item_set_use_parent_material(RID p_item, bool p_enable) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
canvas_item->use_parent_material = p_enable;
}
void RendererCanvasCull::canvas_item_set_visibility_notifier(RID p_item, bool p_enable, const Rect2 &p_area, const Callable &p_enter_callable, const Callable &p_exit_callable) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
if (p_enable) {
@@ -1181,7 +1181,7 @@ void RendererCanvasCull::canvas_item_set_visibility_notifier(RID p_item, bool p_
}
void RendererCanvasCull::canvas_item_set_canvas_group_mode(RID p_item, RS::CanvasGroupMode p_mode, float p_clear_margin, bool p_fit_empty, float p_fit_margin, bool p_blur_mipmaps) {
- Item *canvas_item = canvas_item_owner.getornull(p_item);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!canvas_item);
if (p_mode == RS::CANVAS_GROUP_MODE_DISABLED) {
@@ -1206,12 +1206,12 @@ RID RendererCanvasCull::canvas_light_allocate() {
}
void RendererCanvasCull::canvas_light_initialize(RID p_rid) {
canvas_light_owner.initialize_rid(p_rid);
- RendererCanvasRender::Light *clight = canvas_light_owner.getornull(p_rid);
+ RendererCanvasRender::Light *clight = canvas_light_owner.get_or_null(p_rid);
clight->light_internal = RSG::canvas_render->light_create();
}
void RendererCanvasCull::canvas_light_set_mode(RID p_light, RS::CanvasLightMode p_mode) {
- RendererCanvasRender::Light *clight = canvas_light_owner.getornull(p_light);
+ RendererCanvasRender::Light *clight = canvas_light_owner.get_or_null(p_light);
ERR_FAIL_COND(!clight);
if (clight->mode == p_mode) {
@@ -1232,11 +1232,11 @@ void RendererCanvasCull::canvas_light_set_mode(RID p_light, RS::CanvasLightMode
}
void RendererCanvasCull::canvas_light_attach_to_canvas(RID p_light, RID p_canvas) {
- RendererCanvasRender::Light *clight = canvas_light_owner.getornull(p_light);
+ RendererCanvasRender::Light *clight = canvas_light_owner.get_or_null(p_light);
ERR_FAIL_COND(!clight);
if (clight->canvas.is_valid()) {
- Canvas *canvas = canvas_owner.getornull(clight->canvas);
+ Canvas *canvas = canvas_owner.get_or_null(clight->canvas);
if (clight->mode == RS::CANVAS_LIGHT_MODE_POINT) {
canvas->lights.erase(clight);
} else {
@@ -1251,7 +1251,7 @@ void RendererCanvasCull::canvas_light_attach_to_canvas(RID p_light, RID p_canvas
clight->canvas = p_canvas;
if (clight->canvas.is_valid()) {
- Canvas *canvas = canvas_owner.getornull(clight->canvas);
+ Canvas *canvas = canvas_owner.get_or_null(clight->canvas);
if (clight->mode == RS::CANVAS_LIGHT_MODE_POINT) {
canvas->lights.insert(clight);
} else {
@@ -1261,28 +1261,28 @@ void RendererCanvasCull::canvas_light_attach_to_canvas(RID p_light, RID p_canvas
}
void RendererCanvasCull::canvas_light_set_enabled(RID p_light, bool p_enabled) {
- RendererCanvasRender::Light *clight = canvas_light_owner.getornull(p_light);
+ RendererCanvasRender::Light *clight = canvas_light_owner.get_or_null(p_light);
ERR_FAIL_COND(!clight);
clight->enabled = p_enabled;
}
void RendererCanvasCull::canvas_light_set_texture_scale(RID p_light, float p_scale) {
- RendererCanvasRender::Light *clight = canvas_light_owner.getornull(p_light);
+ RendererCanvasRender::Light *clight = canvas_light_owner.get_or_null(p_light);
ERR_FAIL_COND(!clight);
clight->scale = p_scale;
}
void RendererCanvasCull::canvas_light_set_transform(RID p_light, const Transform2D &p_transform) {
- RendererCanvasRender::Light *clight = canvas_light_owner.getornull(p_light);
+ RendererCanvasRender::Light *clight = canvas_light_owner.get_or_null(p_light);
ERR_FAIL_COND(!clight);
clight->xform = p_transform;
}
void RendererCanvasCull::canvas_light_set_texture(RID p_light, RID p_texture) {
- RendererCanvasRender::Light *clight = canvas_light_owner.getornull(p_light);
+ RendererCanvasRender::Light *clight = canvas_light_owner.get_or_null(p_light);
ERR_FAIL_COND(!clight);
if (clight->texture == p_texture) {
@@ -1294,35 +1294,35 @@ void RendererCanvasCull::canvas_light_set_texture(RID p_light, RID p_texture) {
}
void RendererCanvasCull::canvas_light_set_texture_offset(RID p_light, const Vector2 &p_offset) {
- RendererCanvasRender::Light *clight = canvas_light_owner.getornull(p_light);
+ RendererCanvasRender::Light *clight = canvas_light_owner.get_or_null(p_light);
ERR_FAIL_COND(!clight);
clight->texture_offset = p_offset;
}
void RendererCanvasCull::canvas_light_set_color(RID p_light, const Color &p_color) {
- RendererCanvasRender::Light *clight = canvas_light_owner.getornull(p_light);
+ RendererCanvasRender::Light *clight = canvas_light_owner.get_or_null(p_light);
ERR_FAIL_COND(!clight);
clight->color = p_color;
}
void RendererCanvasCull::canvas_light_set_height(RID p_light, float p_height) {
- RendererCanvasRender::Light *clight = canvas_light_owner.getornull(p_light);
+ RendererCanvasRender::Light *clight = canvas_light_owner.get_or_null(p_light);
ERR_FAIL_COND(!clight);
clight->height = p_height;
}
void RendererCanvasCull::canvas_light_set_energy(RID p_light, float p_energy) {
- RendererCanvasRender::Light *clight = canvas_light_owner.getornull(p_light);
+ RendererCanvasRender::Light *clight = canvas_light_owner.get_or_null(p_light);
ERR_FAIL_COND(!clight);
clight->energy = p_energy;
}
void RendererCanvasCull::canvas_light_set_z_range(RID p_light, int p_min_z, int p_max_z) {
- RendererCanvasRender::Light *clight = canvas_light_owner.getornull(p_light);
+ RendererCanvasRender::Light *clight = canvas_light_owner.get_or_null(p_light);
ERR_FAIL_COND(!clight);
clight->z_min = p_min_z;
@@ -1330,7 +1330,7 @@ void RendererCanvasCull::canvas_light_set_z_range(RID p_light, int p_min_z, int
}
void RendererCanvasCull::canvas_light_set_layer_range(RID p_light, int p_min_layer, int p_max_layer) {
- RendererCanvasRender::Light *clight = canvas_light_owner.getornull(p_light);
+ RendererCanvasRender::Light *clight = canvas_light_owner.get_or_null(p_light);
ERR_FAIL_COND(!clight);
clight->layer_max = p_max_layer;
@@ -1338,35 +1338,35 @@ void RendererCanvasCull::canvas_light_set_layer_range(RID p_light, int p_min_lay
}
void RendererCanvasCull::canvas_light_set_item_cull_mask(RID p_light, int p_mask) {
- RendererCanvasRender::Light *clight = canvas_light_owner.getornull(p_light);
+ RendererCanvasRender::Light *clight = canvas_light_owner.get_or_null(p_light);
ERR_FAIL_COND(!clight);
clight->item_mask = p_mask;
}
void RendererCanvasCull::canvas_light_set_item_shadow_cull_mask(RID p_light, int p_mask) {
- RendererCanvasRender::Light *clight = canvas_light_owner.getornull(p_light);
+ RendererCanvasRender::Light *clight = canvas_light_owner.get_or_null(p_light);
ERR_FAIL_COND(!clight);
clight->item_shadow_mask = p_mask;
}
void RendererCanvasCull::canvas_light_set_directional_distance(RID p_light, float p_distance) {
- RendererCanvasRender::Light *clight = canvas_light_owner.getornull(p_light);
+ RendererCanvasRender::Light *clight = canvas_light_owner.get_or_null(p_light);
ERR_FAIL_COND(!clight);
clight->directional_distance = p_distance;
}
void RendererCanvasCull::canvas_light_set_blend_mode(RID p_light, RS::CanvasLightBlendMode p_mode) {
- RendererCanvasRender::Light *clight = canvas_light_owner.getornull(p_light);
+ RendererCanvasRender::Light *clight = canvas_light_owner.get_or_null(p_light);
ERR_FAIL_COND(!clight);
clight->blend_mode = p_mode;
}
void RendererCanvasCull::canvas_light_set_shadow_enabled(RID p_light, bool p_enabled) {
- RendererCanvasRender::Light *clight = canvas_light_owner.getornull(p_light);
+ RendererCanvasRender::Light *clight = canvas_light_owner.get_or_null(p_light);
ERR_FAIL_COND(!clight);
if (clight->use_shadow == p_enabled) {
@@ -1378,21 +1378,21 @@ void RendererCanvasCull::canvas_light_set_shadow_enabled(RID p_light, bool p_ena
}
void RendererCanvasCull::canvas_light_set_shadow_filter(RID p_light, RS::CanvasLightShadowFilter p_filter) {
- RendererCanvasRender::Light *clight = canvas_light_owner.getornull(p_light);
+ RendererCanvasRender::Light *clight = canvas_light_owner.get_or_null(p_light);
ERR_FAIL_COND(!clight);
clight->shadow_filter = p_filter;
}
void RendererCanvasCull::canvas_light_set_shadow_color(RID p_light, const Color &p_color) {
- RendererCanvasRender::Light *clight = canvas_light_owner.getornull(p_light);
+ RendererCanvasRender::Light *clight = canvas_light_owner.get_or_null(p_light);
ERR_FAIL_COND(!clight);
clight->shadow_color = p_color;
}
void RendererCanvasCull::canvas_light_set_shadow_smooth(RID p_light, float p_smooth) {
- RendererCanvasRender::Light *clight = canvas_light_owner.getornull(p_light);
+ RendererCanvasRender::Light *clight = canvas_light_owner.get_or_null(p_light);
ERR_FAIL_COND(!clight);
clight->shadow_smooth = p_smooth;
}
@@ -1405,11 +1405,11 @@ void RendererCanvasCull::canvas_light_occluder_initialize(RID p_rid) {
}
void RendererCanvasCull::canvas_light_occluder_attach_to_canvas(RID p_occluder, RID p_canvas) {
- RendererCanvasRender::LightOccluderInstance *occluder = canvas_light_occluder_owner.getornull(p_occluder);
+ RendererCanvasRender::LightOccluderInstance *occluder = canvas_light_occluder_owner.get_or_null(p_occluder);
ERR_FAIL_COND(!occluder);
if (occluder->canvas.is_valid()) {
- Canvas *canvas = canvas_owner.getornull(occluder->canvas);
+ Canvas *canvas = canvas_owner.get_or_null(occluder->canvas);
canvas->occluders.erase(occluder);
}
@@ -1420,24 +1420,24 @@ void RendererCanvasCull::canvas_light_occluder_attach_to_canvas(RID p_occluder,
occluder->canvas = p_canvas;
if (occluder->canvas.is_valid()) {
- Canvas *canvas = canvas_owner.getornull(occluder->canvas);
+ Canvas *canvas = canvas_owner.get_or_null(occluder->canvas);
canvas->occluders.insert(occluder);
}
}
void RendererCanvasCull::canvas_light_occluder_set_enabled(RID p_occluder, bool p_enabled) {
- RendererCanvasRender::LightOccluderInstance *occluder = canvas_light_occluder_owner.getornull(p_occluder);
+ RendererCanvasRender::LightOccluderInstance *occluder = canvas_light_occluder_owner.get_or_null(p_occluder);
ERR_FAIL_COND(!occluder);
occluder->enabled = p_enabled;
}
void RendererCanvasCull::canvas_light_occluder_set_polygon(RID p_occluder, RID p_polygon) {
- RendererCanvasRender::LightOccluderInstance *occluder = canvas_light_occluder_owner.getornull(p_occluder);
+ RendererCanvasRender::LightOccluderInstance *occluder = canvas_light_occluder_owner.get_or_null(p_occluder);
ERR_FAIL_COND(!occluder);
if (occluder->polygon.is_valid()) {
- LightOccluderPolygon *occluder_poly = canvas_light_occluder_polygon_owner.getornull(p_polygon);
+ LightOccluderPolygon *occluder_poly = canvas_light_occluder_polygon_owner.get_or_null(p_polygon);
if (occluder_poly) {
occluder_poly->owners.erase(occluder);
}
@@ -1447,7 +1447,7 @@ void RendererCanvasCull::canvas_light_occluder_set_polygon(RID p_occluder, RID p
occluder->occluder = RID();
if (occluder->polygon.is_valid()) {
- LightOccluderPolygon *occluder_poly = canvas_light_occluder_polygon_owner.getornull(p_polygon);
+ LightOccluderPolygon *occluder_poly = canvas_light_occluder_polygon_owner.get_or_null(p_polygon);
if (!occluder_poly) {
occluder->polygon = RID();
ERR_FAIL_COND(!occluder_poly);
@@ -1461,19 +1461,19 @@ void RendererCanvasCull::canvas_light_occluder_set_polygon(RID p_occluder, RID p
}
void RendererCanvasCull::canvas_light_occluder_set_as_sdf_collision(RID p_occluder, bool p_enable) {
- RendererCanvasRender::LightOccluderInstance *occluder = canvas_light_occluder_owner.getornull(p_occluder);
+ RendererCanvasRender::LightOccluderInstance *occluder = canvas_light_occluder_owner.get_or_null(p_occluder);
ERR_FAIL_COND(!occluder);
}
void RendererCanvasCull::canvas_light_occluder_set_transform(RID p_occluder, const Transform2D &p_xform) {
- RendererCanvasRender::LightOccluderInstance *occluder = canvas_light_occluder_owner.getornull(p_occluder);
+ RendererCanvasRender::LightOccluderInstance *occluder = canvas_light_occluder_owner.get_or_null(p_occluder);
ERR_FAIL_COND(!occluder);
occluder->xform = p_xform;
}
void RendererCanvasCull::canvas_light_occluder_set_light_mask(RID p_occluder, int p_mask) {
- RendererCanvasRender::LightOccluderInstance *occluder = canvas_light_occluder_owner.getornull(p_occluder);
+ RendererCanvasRender::LightOccluderInstance *occluder = canvas_light_occluder_owner.get_or_null(p_occluder);
ERR_FAIL_COND(!occluder);
occluder->light_mask = p_mask;
@@ -1484,12 +1484,12 @@ RID RendererCanvasCull::canvas_occluder_polygon_allocate() {
}
void RendererCanvasCull::canvas_occluder_polygon_initialize(RID p_rid) {
canvas_light_occluder_polygon_owner.initialize_rid(p_rid);
- LightOccluderPolygon *occluder_poly = canvas_light_occluder_polygon_owner.getornull(p_rid);
+ LightOccluderPolygon *occluder_poly = canvas_light_occluder_polygon_owner.get_or_null(p_rid);
occluder_poly->occluder = RSG::canvas_render->occluder_polygon_create();
}
void RendererCanvasCull::canvas_occluder_polygon_set_shape(RID p_occluder_polygon, const Vector<Vector2> &p_shape, bool p_closed) {
- LightOccluderPolygon *occluder_poly = canvas_light_occluder_polygon_owner.getornull(p_occluder_polygon);
+ LightOccluderPolygon *occluder_poly = canvas_light_occluder_polygon_owner.get_or_null(p_occluder_polygon);
ERR_FAIL_COND(!occluder_poly);
uint32_t pc = p_shape.size();
@@ -1513,7 +1513,7 @@ void RendererCanvasCull::canvas_occluder_polygon_set_shape(RID p_occluder_polygo
}
void RendererCanvasCull::canvas_occluder_polygon_set_cull_mode(RID p_occluder_polygon, RS::CanvasOccluderPolygonCullMode p_mode) {
- LightOccluderPolygon *occluder_poly = canvas_light_occluder_polygon_owner.getornull(p_occluder_polygon);
+ LightOccluderPolygon *occluder_poly = canvas_light_occluder_polygon_owner.get_or_null(p_occluder_polygon);
ERR_FAIL_COND(!occluder_poly);
occluder_poly->cull_mode = p_mode;
RSG::canvas_render->occluder_polygon_set_cull_mode(occluder_poly->occluder, p_mode);
@@ -1550,12 +1550,12 @@ void RendererCanvasCull::canvas_texture_set_texture_repeat(RID p_canvas_texture,
}
void RendererCanvasCull::canvas_item_set_default_texture_filter(RID p_item, RS::CanvasItemTextureFilter p_filter) {
- Item *ci = canvas_item_owner.getornull(p_item);
+ Item *ci = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!ci);
ci->texture_filter = p_filter;
}
void RendererCanvasCull::canvas_item_set_default_texture_repeat(RID p_item, RS::CanvasItemTextureRepeat p_repeat) {
- Item *ci = canvas_item_owner.getornull(p_item);
+ Item *ci = canvas_item_owner.get_or_null(p_item);
ERR_FAIL_COND(!ci);
ci->texture_repeat = p_repeat;
}
@@ -1600,11 +1600,11 @@ void RendererCanvasCull::update_visibility_notifiers() {
bool RendererCanvasCull::free(RID p_rid) {
if (canvas_owner.owns(p_rid)) {
- Canvas *canvas = canvas_owner.getornull(p_rid);
+ Canvas *canvas = canvas_owner.get_or_null(p_rid);
ERR_FAIL_COND_V(!canvas, false);
while (canvas->viewports.size()) {
- RendererViewport::Viewport *vp = RSG::viewport->viewport_owner.getornull(canvas->viewports.front()->get());
+ RendererViewport::Viewport *vp = RSG::viewport->viewport_owner.get_or_null(canvas->viewports.front()->get());
ERR_FAIL_COND_V(!vp, true);
Map<RID, RendererViewport::Viewport::CanvasData>::Element *E = vp->canvas_map.find(p_rid);
@@ -1629,15 +1629,15 @@ bool RendererCanvasCull::free(RID p_rid) {
canvas_owner.free(p_rid);
} else if (canvas_item_owner.owns(p_rid)) {
- Item *canvas_item = canvas_item_owner.getornull(p_rid);
+ Item *canvas_item = canvas_item_owner.get_or_null(p_rid);
ERR_FAIL_COND_V(!canvas_item, true);
if (canvas_item->parent.is_valid()) {
if (canvas_owner.owns(canvas_item->parent)) {
- Canvas *canvas = canvas_owner.getornull(canvas_item->parent);
+ Canvas *canvas = canvas_owner.get_or_null(canvas_item->parent);
canvas->erase_item(canvas_item);
} else if (canvas_item_owner.owns(canvas_item->parent)) {
- Item *item_owner = canvas_item_owner.getornull(canvas_item->parent);
+ Item *item_owner = canvas_item_owner.get_or_null(canvas_item->parent);
item_owner->child_items.erase(canvas_item);
if (item_owner->sort_y) {
@@ -1663,11 +1663,11 @@ bool RendererCanvasCull::free(RID p_rid) {
canvas_item_owner.free(p_rid);
} else if (canvas_light_owner.owns(p_rid)) {
- RendererCanvasRender::Light *canvas_light = canvas_light_owner.getornull(p_rid);
+ RendererCanvasRender::Light *canvas_light = canvas_light_owner.get_or_null(p_rid);
ERR_FAIL_COND_V(!canvas_light, true);
if (canvas_light->canvas.is_valid()) {
- Canvas *canvas = canvas_owner.getornull(canvas_light->canvas);
+ Canvas *canvas = canvas_owner.get_or_null(canvas_light->canvas);
if (canvas) {
canvas->lights.erase(canvas_light);
}
@@ -1678,25 +1678,25 @@ bool RendererCanvasCull::free(RID p_rid) {
canvas_light_owner.free(p_rid);
} else if (canvas_light_occluder_owner.owns(p_rid)) {
- RendererCanvasRender::LightOccluderInstance *occluder = canvas_light_occluder_owner.getornull(p_rid);
+ RendererCanvasRender::LightOccluderInstance *occluder = canvas_light_occluder_owner.get_or_null(p_rid);
ERR_FAIL_COND_V(!occluder, true);
if (occluder->polygon.is_valid()) {
- LightOccluderPolygon *occluder_poly = canvas_light_occluder_polygon_owner.getornull(occluder->polygon);
+ LightOccluderPolygon *occluder_poly = canvas_light_occluder_polygon_owner.get_or_null(occluder->polygon);
if (occluder_poly) {
occluder_poly->owners.erase(occluder);
}
}
if (occluder->canvas.is_valid() && canvas_owner.owns(occluder->canvas)) {
- Canvas *canvas = canvas_owner.getornull(occluder->canvas);
+ Canvas *canvas = canvas_owner.get_or_null(occluder->canvas);
canvas->occluders.erase(occluder);
}
canvas_light_occluder_owner.free(p_rid);
} else if (canvas_light_occluder_polygon_owner.owns(p_rid)) {
- LightOccluderPolygon *occluder_poly = canvas_light_occluder_polygon_owner.getornull(p_rid);
+ LightOccluderPolygon *occluder_poly = canvas_light_occluder_polygon_owner.get_or_null(p_rid);
ERR_FAIL_COND_V(!occluder_poly, true);
RSG::canvas_render->free(occluder_poly->occluder);