| 2519 | } |
| 2520 | |
| 2521 | int Window::get_theme_constant(const StringName &p_name, const StringName &p_theme_type) const { |
| 2522 | ERR_READ_THREAD_GUARD_V(0); |
| 2523 | if (!initialized) { |
| 2524 | WARN_PRINT_ONCE(vformat("Attempting to access theme items too early in %s; prefer NOTIFICATION_POSTINITIALIZE and NOTIFICATION_THEME_CHANGED", get_description())); |
| 2525 | } |
| 2526 | |
| 2527 | if (p_theme_type == StringName() || p_theme_type == get_class_name() || p_theme_type == theme_type_variation) { |
| 2528 | const int *constant = theme_constant_override.getptr(p_name); |
| 2529 | if (constant) { |
| 2530 | return *constant; |
| 2531 | } |
| 2532 | } |
| 2533 | |
| 2534 | if (theme_constant_cache.has(p_theme_type) && theme_constant_cache[p_theme_type].has(p_name)) { |
| 2535 | return theme_constant_cache[p_theme_type][p_name]; |
| 2536 | } |
| 2537 | |
| 2538 | Vector<StringName> theme_types; |
| 2539 | theme_owner->get_theme_type_dependencies(this, p_theme_type, theme_types); |
| 2540 | int constant = theme_owner->get_theme_item_in_types(Theme::DATA_TYPE_CONSTANT, p_name, theme_types); |
| 2541 | theme_constant_cache[p_theme_type][p_name] = constant; |
| 2542 | return constant; |
| 2543 | } |
| 2544 | |
| 2545 | Variant Window::get_theme_item(Theme::DataType p_data_type, const StringName &p_name, const StringName &p_theme_type) const { |
| 2546 | switch (p_data_type) { |