Merge pull request #70294 from KoBeWi/treedulate

Add a method to get global modulate
This commit is contained in:
Rémi Verschelde 2023-01-21 20:51:42 +01:00
commit 229c82690d
No known key found for this signature in database
GPG key ID: C3336907360768E1
3 changed files with 12 additions and 1 deletions

View file

@ -388,6 +388,16 @@ Color CanvasItem::get_modulate() const {
return modulate;
}
Color CanvasItem::get_modulate_in_tree() const {
Color final_modulate = modulate;
CanvasItem *parent_item = get_parent_item();
while (parent_item) {
final_modulate *= parent_item->get_modulate();
parent_item = parent_item->get_parent_item();
}
return final_modulate;
}
void CanvasItem::set_as_top_level(bool p_top_level) {
if (top_level == p_top_level) {
return;

View file

@ -224,6 +224,7 @@ public:
void set_modulate(const Color &p_modulate);
Color get_modulate() const;
Color get_modulate_in_tree() const;
void set_self_modulate(const Color &p_self_modulate);
Color get_self_modulate() const;