mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Merge pull request #67043 from clayjohn/clip_children
Improve behaviour of clip_children by clipping to parent alpha value but still retaining parent color
This commit is contained in:
commit
e1caa8797b
11 changed files with 135 additions and 31 deletions
|
|
@ -66,8 +66,16 @@ public:
|
|||
TEXTURE_REPEAT_MAX,
|
||||
};
|
||||
|
||||
enum ClipChildrenMode {
|
||||
CLIP_CHILDREN_DISABLED,
|
||||
CLIP_CHILDREN_ONLY,
|
||||
CLIP_CHILDREN_AND_DRAW,
|
||||
CLIP_CHILDREN_MAX,
|
||||
};
|
||||
|
||||
private:
|
||||
mutable SelfList<Node> xform_change;
|
||||
mutable SelfList<Node>
|
||||
xform_change;
|
||||
|
||||
RID canvas_item;
|
||||
StringName canvas_group;
|
||||
|
|
@ -85,7 +93,6 @@ private:
|
|||
Window *window = nullptr;
|
||||
bool visible = true;
|
||||
bool parent_visible_in_tree = false;
|
||||
bool clip_children = false;
|
||||
bool pending_update = false;
|
||||
bool top_level = false;
|
||||
bool drawing = false;
|
||||
|
|
@ -95,6 +102,8 @@ private:
|
|||
bool notify_local_transform = false;
|
||||
bool notify_transform = false;
|
||||
|
||||
ClipChildrenMode clip_children_mode = CLIP_CHILDREN_DISABLED;
|
||||
|
||||
RS::CanvasItemTextureFilter texture_filter_cache = RS::CANVAS_ITEM_TEXTURE_FILTER_LINEAR;
|
||||
RS::CanvasItemTextureRepeat texture_repeat_cache = RS::CANVAS_ITEM_TEXTURE_REPEAT_DISABLED;
|
||||
TextureFilter texture_filter = TEXTURE_FILTER_PARENT_NODE;
|
||||
|
|
@ -202,8 +211,8 @@ public:
|
|||
void queue_redraw();
|
||||
void move_to_front();
|
||||
|
||||
void set_clip_children(bool p_enabled);
|
||||
bool is_clipping_children() const;
|
||||
void set_clip_children_mode(ClipChildrenMode p_clip_mode);
|
||||
ClipChildrenMode get_clip_children_mode() const;
|
||||
|
||||
virtual void set_light_mask(int p_light_mask);
|
||||
int get_light_mask() const;
|
||||
|
|
@ -326,6 +335,7 @@ public:
|
|||
|
||||
VARIANT_ENUM_CAST(CanvasItem::TextureFilter)
|
||||
VARIANT_ENUM_CAST(CanvasItem::TextureRepeat)
|
||||
VARIANT_ENUM_CAST(CanvasItem::ClipChildrenMode)
|
||||
|
||||
class CanvasTexture : public Texture2D {
|
||||
GDCLASS(CanvasTexture, Texture2D);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue