Editor StringName and Viewport optimizations
* Added explicit return type to the SNAME macro. * Add some extra SNAME usages. * Change some ClassDB methods to use const StringName & arguments. * Cache the Window parent in Control because it's used in is_layout_rtl(), which is called often. * Only enable internal processing for viewports that need it. * Change CanvasItem::group to be a StringName because it's only used as that.
This commit is contained in:
parent
b1eee24e26
commit
a6adb58493
11 changed files with 80 additions and 66 deletions
|
@ -602,7 +602,7 @@ static MethodInfo info_from_bind(MethodBind *p_method) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void ClassDB::get_method_list(StringName p_class, List<MethodInfo> *p_methods, bool p_no_inheritance, bool p_exclude_from_properties) {
|
void ClassDB::get_method_list(const StringName &p_class, List<MethodInfo> *p_methods, bool p_no_inheritance, bool p_exclude_from_properties) {
|
||||||
OBJTYPE_RLOCK;
|
OBJTYPE_RLOCK;
|
||||||
|
|
||||||
ClassInfo *type = classes.getptr(p_class);
|
ClassInfo *type = classes.getptr(p_class);
|
||||||
|
@ -655,7 +655,7 @@ void ClassDB::get_method_list(StringName p_class, List<MethodInfo> *p_methods, b
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClassDB::get_method_info(StringName p_class, StringName p_method, MethodInfo *r_info, bool p_no_inheritance, bool p_exclude_from_properties) {
|
bool ClassDB::get_method_info(const StringName &p_class, const StringName &p_method, MethodInfo *r_info, bool p_no_inheritance, bool p_exclude_from_properties) {
|
||||||
OBJTYPE_RLOCK;
|
OBJTYPE_RLOCK;
|
||||||
|
|
||||||
ClassInfo *type = classes.getptr(p_class);
|
ClassInfo *type = classes.getptr(p_class);
|
||||||
|
@ -706,7 +706,7 @@ bool ClassDB::get_method_info(StringName p_class, StringName p_method, MethodInf
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
MethodBind *ClassDB::get_method(StringName p_class, StringName p_name) {
|
MethodBind *ClassDB::get_method(const StringName &p_class, const StringName &p_name) {
|
||||||
OBJTYPE_RLOCK;
|
OBJTYPE_RLOCK;
|
||||||
|
|
||||||
ClassInfo *type = classes.getptr(p_class);
|
ClassInfo *type = classes.getptr(p_class);
|
||||||
|
@ -910,7 +910,7 @@ bool ClassDB::has_enum(const StringName &p_class, const StringName &p_name, bool
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClassDB::add_signal(StringName p_class, const MethodInfo &p_signal) {
|
void ClassDB::add_signal(const StringName &p_class, const MethodInfo &p_signal) {
|
||||||
OBJTYPE_WLOCK;
|
OBJTYPE_WLOCK;
|
||||||
|
|
||||||
ClassInfo *type = classes.getptr(p_class);
|
ClassInfo *type = classes.getptr(p_class);
|
||||||
|
@ -929,7 +929,7 @@ void ClassDB::add_signal(StringName p_class, const MethodInfo &p_signal) {
|
||||||
type->signal_map[sname] = p_signal;
|
type->signal_map[sname] = p_signal;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClassDB::get_signal_list(StringName p_class, List<MethodInfo> *p_signals, bool p_no_inheritance) {
|
void ClassDB::get_signal_list(const StringName &p_class, List<MethodInfo> *p_signals, bool p_no_inheritance) {
|
||||||
OBJTYPE_RLOCK;
|
OBJTYPE_RLOCK;
|
||||||
|
|
||||||
ClassInfo *type = classes.getptr(p_class);
|
ClassInfo *type = classes.getptr(p_class);
|
||||||
|
@ -951,7 +951,7 @@ void ClassDB::get_signal_list(StringName p_class, List<MethodInfo> *p_signals, b
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClassDB::has_signal(StringName p_class, StringName p_signal, bool p_no_inheritance) {
|
bool ClassDB::has_signal(const StringName &p_class, const StringName &p_signal, bool p_no_inheritance) {
|
||||||
OBJTYPE_RLOCK;
|
OBJTYPE_RLOCK;
|
||||||
ClassInfo *type = classes.getptr(p_class);
|
ClassInfo *type = classes.getptr(p_class);
|
||||||
ClassInfo *check = type;
|
ClassInfo *check = type;
|
||||||
|
@ -968,7 +968,7 @@ bool ClassDB::has_signal(StringName p_class, StringName p_signal, bool p_no_inhe
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClassDB::get_signal(StringName p_class, StringName p_signal, MethodInfo *r_signal) {
|
bool ClassDB::get_signal(const StringName &p_class, const StringName &p_signal, MethodInfo *r_signal) {
|
||||||
OBJTYPE_RLOCK;
|
OBJTYPE_RLOCK;
|
||||||
ClassInfo *type = classes.getptr(p_class);
|
ClassInfo *type = classes.getptr(p_class);
|
||||||
ClassInfo *check = type;
|
ClassInfo *check = type;
|
||||||
|
@ -985,7 +985,7 @@ bool ClassDB::get_signal(StringName p_class, StringName p_signal, MethodInfo *r_
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClassDB::add_property_group(StringName p_class, const String &p_name, const String &p_prefix) {
|
void ClassDB::add_property_group(const StringName &p_class, const String &p_name, const String &p_prefix) {
|
||||||
OBJTYPE_WLOCK;
|
OBJTYPE_WLOCK;
|
||||||
ClassInfo *type = classes.getptr(p_class);
|
ClassInfo *type = classes.getptr(p_class);
|
||||||
ERR_FAIL_COND(!type);
|
ERR_FAIL_COND(!type);
|
||||||
|
@ -993,7 +993,7 @@ void ClassDB::add_property_group(StringName p_class, const String &p_name, const
|
||||||
type->property_list.push_back(PropertyInfo(Variant::NIL, p_name, PROPERTY_HINT_NONE, p_prefix, PROPERTY_USAGE_GROUP));
|
type->property_list.push_back(PropertyInfo(Variant::NIL, p_name, PROPERTY_HINT_NONE, p_prefix, PROPERTY_USAGE_GROUP));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClassDB::add_property_subgroup(StringName p_class, const String &p_name, const String &p_prefix) {
|
void ClassDB::add_property_subgroup(const StringName &p_class, const String &p_name, const String &p_prefix) {
|
||||||
OBJTYPE_WLOCK;
|
OBJTYPE_WLOCK;
|
||||||
ClassInfo *type = classes.getptr(p_class);
|
ClassInfo *type = classes.getptr(p_class);
|
||||||
ERR_FAIL_COND(!type);
|
ERR_FAIL_COND(!type);
|
||||||
|
@ -1002,7 +1002,7 @@ void ClassDB::add_property_subgroup(StringName p_class, const String &p_name, co
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: For implementation simplicity reasons, this method doesn't allow setters to have optional arguments at the end.
|
// NOTE: For implementation simplicity reasons, this method doesn't allow setters to have optional arguments at the end.
|
||||||
void ClassDB::add_property(StringName p_class, const PropertyInfo &p_pinfo, const StringName &p_setter, const StringName &p_getter, int p_index) {
|
void ClassDB::add_property(const StringName &p_class, const PropertyInfo &p_pinfo, const StringName &p_setter, const StringName &p_getter, int p_index) {
|
||||||
lock.read_lock();
|
lock.read_lock();
|
||||||
ClassInfo *type = classes.getptr(p_class);
|
ClassInfo *type = classes.getptr(p_class);
|
||||||
lock.read_unlock();
|
lock.read_unlock();
|
||||||
|
@ -1060,14 +1060,14 @@ void ClassDB::add_property(StringName p_class, const PropertyInfo &p_pinfo, cons
|
||||||
type->property_setget[p_pinfo.name] = psg;
|
type->property_setget[p_pinfo.name] = psg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClassDB::set_property_default_value(StringName p_class, const StringName &p_name, const Variant &p_default) {
|
void ClassDB::set_property_default_value(const StringName &p_class, const StringName &p_name, const Variant &p_default) {
|
||||||
if (!default_values.has(p_class)) {
|
if (!default_values.has(p_class)) {
|
||||||
default_values[p_class] = HashMap<StringName, Variant>();
|
default_values[p_class] = HashMap<StringName, Variant>();
|
||||||
}
|
}
|
||||||
default_values[p_class][p_name] = p_default;
|
default_values[p_class][p_name] = p_default;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClassDB::get_property_list(StringName p_class, List<PropertyInfo> *p_list, bool p_no_inheritance, const Object *p_validator) {
|
void ClassDB::get_property_list(const StringName &p_class, List<PropertyInfo> *p_list, bool p_no_inheritance, const Object *p_validator) {
|
||||||
OBJTYPE_RLOCK;
|
OBJTYPE_RLOCK;
|
||||||
|
|
||||||
ClassInfo *type = classes.getptr(p_class);
|
ClassInfo *type = classes.getptr(p_class);
|
||||||
|
@ -1090,7 +1090,7 @@ void ClassDB::get_property_list(StringName p_class, List<PropertyInfo> *p_list,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClassDB::get_property_info(StringName p_class, StringName p_property, PropertyInfo *r_info, bool p_no_inheritance, const Object *p_validator) {
|
bool ClassDB::get_property_info(const StringName &p_class, const StringName &p_property, PropertyInfo *r_info, bool p_no_inheritance, const Object *p_validator) {
|
||||||
OBJTYPE_RLOCK;
|
OBJTYPE_RLOCK;
|
||||||
|
|
||||||
ClassInfo *check = classes.getptr(p_class);
|
ClassInfo *check = classes.getptr(p_class);
|
||||||
|
@ -1258,7 +1258,7 @@ Variant::Type ClassDB::get_property_type(const StringName &p_class, const String
|
||||||
return Variant::NIL;
|
return Variant::NIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringName ClassDB::get_property_setter(StringName p_class, const StringName &p_property) {
|
StringName ClassDB::get_property_setter(const StringName &p_class, const StringName &p_property) {
|
||||||
ClassInfo *type = classes.getptr(p_class);
|
ClassInfo *type = classes.getptr(p_class);
|
||||||
ClassInfo *check = type;
|
ClassInfo *check = type;
|
||||||
while (check) {
|
while (check) {
|
||||||
|
@ -1273,7 +1273,7 @@ StringName ClassDB::get_property_setter(StringName p_class, const StringName &p_
|
||||||
return StringName();
|
return StringName();
|
||||||
}
|
}
|
||||||
|
|
||||||
StringName ClassDB::get_property_getter(StringName p_class, const StringName &p_property) {
|
StringName ClassDB::get_property_getter(const StringName &p_class, const StringName &p_property) {
|
||||||
ClassInfo *type = classes.getptr(p_class);
|
ClassInfo *type = classes.getptr(p_class);
|
||||||
ClassInfo *check = type;
|
ClassInfo *check = type;
|
||||||
while (check) {
|
while (check) {
|
||||||
|
@ -1305,7 +1305,7 @@ bool ClassDB::has_property(const StringName &p_class, const StringName &p_proper
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClassDB::set_method_flags(StringName p_class, StringName p_method, int p_flags) {
|
void ClassDB::set_method_flags(const StringName &p_class, const StringName &p_method, int p_flags) {
|
||||||
OBJTYPE_WLOCK;
|
OBJTYPE_WLOCK;
|
||||||
ClassInfo *type = classes.getptr(p_class);
|
ClassInfo *type = classes.getptr(p_class);
|
||||||
ClassInfo *check = type;
|
ClassInfo *check = type;
|
||||||
|
@ -1314,7 +1314,7 @@ void ClassDB::set_method_flags(StringName p_class, StringName p_method, int p_fl
|
||||||
check->method_map[p_method]->set_hint_flags(p_flags);
|
check->method_map[p_method]->set_hint_flags(p_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClassDB::has_method(StringName p_class, StringName p_method, bool p_no_inheritance) {
|
bool ClassDB::has_method(const StringName &p_class, const StringName &p_method, bool p_no_inheritance) {
|
||||||
ClassInfo *type = classes.getptr(p_class);
|
ClassInfo *type = classes.getptr(p_class);
|
||||||
ClassInfo *check = type;
|
ClassInfo *check = type;
|
||||||
while (check) {
|
while (check) {
|
||||||
|
@ -1442,14 +1442,14 @@ void ClassDB::get_virtual_methods(const StringName &p_class, List<MethodInfo> *p
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClassDB::set_class_enabled(StringName p_class, bool p_enable) {
|
void ClassDB::set_class_enabled(const StringName &p_class, bool p_enable) {
|
||||||
OBJTYPE_WLOCK;
|
OBJTYPE_WLOCK;
|
||||||
|
|
||||||
ERR_FAIL_COND_MSG(!classes.has(p_class), "Request for nonexistent class '" + p_class + "'.");
|
ERR_FAIL_COND_MSG(!classes.has(p_class), "Request for nonexistent class '" + p_class + "'.");
|
||||||
classes[p_class].disabled = !p_enable;
|
classes[p_class].disabled = !p_enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClassDB::is_class_enabled(StringName p_class) {
|
bool ClassDB::is_class_enabled(const StringName &p_class) {
|
||||||
OBJTYPE_RLOCK;
|
OBJTYPE_RLOCK;
|
||||||
|
|
||||||
ClassInfo *ti = classes.getptr(p_class);
|
ClassInfo *ti = classes.getptr(p_class);
|
||||||
|
@ -1463,7 +1463,7 @@ bool ClassDB::is_class_enabled(StringName p_class) {
|
||||||
return !ti->disabled;
|
return !ti->disabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClassDB::is_class_exposed(StringName p_class) {
|
bool ClassDB::is_class_exposed(const StringName &p_class) {
|
||||||
OBJTYPE_RLOCK;
|
OBJTYPE_RLOCK;
|
||||||
|
|
||||||
ClassInfo *ti = classes.getptr(p_class);
|
ClassInfo *ti = classes.getptr(p_class);
|
||||||
|
|
|
@ -311,7 +311,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class M>
|
template <class M>
|
||||||
static MethodBind *bind_vararg_method(uint32_t p_flags, StringName p_name, M p_method, const MethodInfo &p_info = MethodInfo(), const Vector<Variant> &p_default_args = Vector<Variant>(), bool p_return_nil_is_variant = true) {
|
static MethodBind *bind_vararg_method(uint32_t p_flags, const StringName &p_name, M p_method, const MethodInfo &p_info = MethodInfo(), const Vector<Variant> &p_default_args = Vector<Variant>(), bool p_return_nil_is_variant = true) {
|
||||||
GLOBAL_LOCK_FUNCTION;
|
GLOBAL_LOCK_FUNCTION;
|
||||||
|
|
||||||
MethodBind *bind = create_vararg_method_bind(p_method, p_info, p_return_nil_is_variant);
|
MethodBind *bind = create_vararg_method_bind(p_method, p_info, p_return_nil_is_variant);
|
||||||
|
@ -345,31 +345,31 @@ public:
|
||||||
|
|
||||||
static void bind_method_custom(const StringName &p_class, MethodBind *p_method);
|
static void bind_method_custom(const StringName &p_class, MethodBind *p_method);
|
||||||
|
|
||||||
static void add_signal(StringName p_class, const MethodInfo &p_signal);
|
static void add_signal(const StringName &p_class, const MethodInfo &p_signal);
|
||||||
static bool has_signal(StringName p_class, StringName p_signal, bool p_no_inheritance = false);
|
static bool has_signal(const StringName &p_class, const StringName &p_signal, bool p_no_inheritance = false);
|
||||||
static bool get_signal(StringName p_class, StringName p_signal, MethodInfo *r_signal);
|
static bool get_signal(const StringName &p_class, const StringName &p_signal, MethodInfo *r_signal);
|
||||||
static void get_signal_list(StringName p_class, List<MethodInfo> *p_signals, bool p_no_inheritance = false);
|
static void get_signal_list(const StringName &p_class, List<MethodInfo> *p_signals, bool p_no_inheritance = false);
|
||||||
|
|
||||||
static void add_property_group(StringName p_class, const String &p_name, const String &p_prefix = "");
|
static void add_property_group(const StringName &p_class, const String &p_name, const String &p_prefix = "");
|
||||||
static void add_property_subgroup(StringName p_class, const String &p_name, const String &p_prefix = "");
|
static void add_property_subgroup(const StringName &p_class, const String &p_name, const String &p_prefix = "");
|
||||||
static void add_property(StringName p_class, const PropertyInfo &p_pinfo, const StringName &p_setter, const StringName &p_getter, int p_index = -1);
|
static void add_property(const StringName &p_class, const PropertyInfo &p_pinfo, const StringName &p_setter, const StringName &p_getter, int p_index = -1);
|
||||||
static void set_property_default_value(StringName p_class, const StringName &p_name, const Variant &p_default);
|
static void set_property_default_value(const StringName &p_class, const StringName &p_name, const Variant &p_default);
|
||||||
static void get_property_list(StringName p_class, List<PropertyInfo> *p_list, bool p_no_inheritance = false, const Object *p_validator = nullptr);
|
static void get_property_list(const StringName &p_class, List<PropertyInfo> *p_list, bool p_no_inheritance = false, const Object *p_validator = nullptr);
|
||||||
static bool get_property_info(StringName p_class, StringName p_property, PropertyInfo *r_info, bool p_no_inheritance = false, const Object *p_validator = nullptr);
|
static bool get_property_info(const StringName &p_class, const StringName &p_property, PropertyInfo *r_info, bool p_no_inheritance = false, const Object *p_validator = nullptr);
|
||||||
static bool set_property(Object *p_object, const StringName &p_property, const Variant &p_value, bool *r_valid = nullptr);
|
static bool set_property(Object *p_object, const StringName &p_property, const Variant &p_value, bool *r_valid = nullptr);
|
||||||
static bool get_property(Object *p_object, const StringName &p_property, Variant &r_value);
|
static bool get_property(Object *p_object, const StringName &p_property, Variant &r_value);
|
||||||
static bool has_property(const StringName &p_class, const StringName &p_property, bool p_no_inheritance = false);
|
static bool has_property(const StringName &p_class, const StringName &p_property, bool p_no_inheritance = false);
|
||||||
static int get_property_index(const StringName &p_class, const StringName &p_property, bool *r_is_valid = nullptr);
|
static int get_property_index(const StringName &p_class, const StringName &p_property, bool *r_is_valid = nullptr);
|
||||||
static Variant::Type get_property_type(const StringName &p_class, const StringName &p_property, bool *r_is_valid = nullptr);
|
static Variant::Type get_property_type(const StringName &p_class, const StringName &p_property, bool *r_is_valid = nullptr);
|
||||||
static StringName get_property_setter(StringName p_class, const StringName &p_property);
|
static StringName get_property_setter(const StringName &p_class, const StringName &p_property);
|
||||||
static StringName get_property_getter(StringName p_class, const StringName &p_property);
|
static StringName get_property_getter(const StringName &p_class, const StringName &p_property);
|
||||||
|
|
||||||
static bool has_method(StringName p_class, StringName p_method, bool p_no_inheritance = false);
|
static bool has_method(const StringName &p_class, const StringName &p_method, bool p_no_inheritance = false);
|
||||||
static void set_method_flags(StringName p_class, StringName p_method, int p_flags);
|
static void set_method_flags(const StringName &p_class, const StringName &p_method, int p_flags);
|
||||||
|
|
||||||
static void get_method_list(StringName p_class, List<MethodInfo> *p_methods, bool p_no_inheritance = false, bool p_exclude_from_properties = false);
|
static void get_method_list(const StringName &p_class, List<MethodInfo> *p_methods, bool p_no_inheritance = false, bool p_exclude_from_properties = false);
|
||||||
static bool get_method_info(StringName p_class, StringName p_method, MethodInfo *r_info, bool p_no_inheritance = false, bool p_exclude_from_properties = false);
|
static bool get_method_info(const StringName &p_class, const StringName &p_method, MethodInfo *r_info, bool p_no_inheritance = false, bool p_exclude_from_properties = false);
|
||||||
static MethodBind *get_method(StringName p_class, StringName p_name);
|
static MethodBind *get_method(const StringName &p_class, const StringName &p_name);
|
||||||
|
|
||||||
static void add_virtual_method(const StringName &p_class, const MethodInfo &p_method, bool p_virtual = true);
|
static void add_virtual_method(const StringName &p_class, const MethodInfo &p_method, bool p_virtual = true);
|
||||||
static void get_virtual_methods(const StringName &p_class, List<MethodInfo> *p_methods, bool p_no_inheritance = false);
|
static void get_virtual_methods(const StringName &p_class, List<MethodInfo> *p_methods, bool p_no_inheritance = false);
|
||||||
|
@ -388,10 +388,10 @@ public:
|
||||||
|
|
||||||
static StringName get_category(const StringName &p_node);
|
static StringName get_category(const StringName &p_node);
|
||||||
|
|
||||||
static void set_class_enabled(StringName p_class, bool p_enable);
|
static void set_class_enabled(const StringName &p_class, bool p_enable);
|
||||||
static bool is_class_enabled(StringName p_class);
|
static bool is_class_enabled(const StringName &p_class);
|
||||||
|
|
||||||
static bool is_class_exposed(StringName p_class);
|
static bool is_class_exposed(const StringName &p_class);
|
||||||
|
|
||||||
static void add_resource_base_extension(const StringName &p_extension, const StringName &p_class);
|
static void add_resource_base_extension(const StringName &p_extension, const StringName &p_class);
|
||||||
static void get_resource_base_extensions(List<String> *p_extensions);
|
static void get_resource_base_extensions(List<String> *p_extensions);
|
||||||
|
|
|
@ -167,6 +167,6 @@ bool operator!=(const char *p_name, const StringName &p_string_name);
|
||||||
|
|
||||||
StringName _scs_create(const char *p_chr, bool p_static = false);
|
StringName _scs_create(const char *p_chr, bool p_static = false);
|
||||||
|
|
||||||
#define SNAME(m_arg) ([]() { static StringName sname = _scs_create(m_arg, true); return sname; })()
|
#define SNAME(m_arg) ([]() -> const StringName & { static StringName sname = _scs_create(m_arg, true); return sname; })()
|
||||||
|
|
||||||
#endif // STRING_NAME_H
|
#endif // STRING_NAME_H
|
||||||
|
|
|
@ -47,9 +47,9 @@ void Container::add_child_notify(Node *p_child) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
control->connect("size_flags_changed", callable_mp(this, &Container::queue_sort));
|
control->connect(SNAME("size_flags_changed"), callable_mp(this, &Container::queue_sort));
|
||||||
control->connect("minimum_size_changed", callable_mp(this, &Container::_child_minsize_changed));
|
control->connect(SNAME("minimum_size_changed"), callable_mp(this, &Container::_child_minsize_changed));
|
||||||
control->connect("visibility_changed", callable_mp(this, &Container::_child_minsize_changed));
|
control->connect(SNAME("visibility_changed"), callable_mp(this, &Container::_child_minsize_changed));
|
||||||
|
|
||||||
minimum_size_changed();
|
minimum_size_changed();
|
||||||
queue_sort();
|
queue_sort();
|
||||||
|
|
|
@ -446,6 +446,10 @@ Control *Control::get_parent_control() const {
|
||||||
return data.parent;
|
return data.parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Window *Control::get_parent_window() const {
|
||||||
|
return data.parent_window;
|
||||||
|
}
|
||||||
|
|
||||||
void Control::set_layout_direction(Control::LayoutDirection p_direction) {
|
void Control::set_layout_direction(Control::LayoutDirection p_direction) {
|
||||||
ERR_FAIL_INDEX((int)p_direction, 4);
|
ERR_FAIL_INDEX((int)p_direction, 4);
|
||||||
|
|
||||||
|
@ -459,21 +463,21 @@ Control::LayoutDirection Control::get_layout_direction() const {
|
||||||
|
|
||||||
bool Control::is_layout_rtl() const {
|
bool Control::is_layout_rtl() const {
|
||||||
if (data.layout_dir == LAYOUT_DIRECTION_INHERITED) {
|
if (data.layout_dir == LAYOUT_DIRECTION_INHERITED) {
|
||||||
Window *parent_window = Object::cast_to<Window>(get_parent());
|
Window *parent_window = get_parent_window();
|
||||||
Control *parent_control = get_parent_control();
|
Control *parent_control = get_parent_control();
|
||||||
if (parent_control) {
|
if (parent_control) {
|
||||||
return parent_control->is_layout_rtl();
|
return parent_control->is_layout_rtl();
|
||||||
} else if (parent_window) {
|
} else if (parent_window) {
|
||||||
return parent_window->is_layout_rtl();
|
return parent_window->is_layout_rtl();
|
||||||
} else {
|
} else {
|
||||||
if (GLOBAL_GET("internationalization/rendering/force_right_to_left_layout_direction")) {
|
if (GLOBAL_GET(SNAME("internationalization/rendering/force_right_to_left_layout_direction"))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
String locale = TranslationServer::get_singleton()->get_tool_locale();
|
String locale = TranslationServer::get_singleton()->get_tool_locale();
|
||||||
return TS->is_locale_right_to_left(locale);
|
return TS->is_locale_right_to_left(locale);
|
||||||
}
|
}
|
||||||
} else if (data.layout_dir == LAYOUT_DIRECTION_LOCALE) {
|
} else if (data.layout_dir == LAYOUT_DIRECTION_LOCALE) {
|
||||||
if (GLOBAL_GET("internationalization/rendering/force_right_to_left_layout_direction")) {
|
if (GLOBAL_GET(SNAME("internationalization/rendering/force_right_to_left_layout_direction"))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
String locale = TranslationServer::get_singleton()->get_tool_locale();
|
String locale = TranslationServer::get_singleton()->get_tool_locale();
|
||||||
|
@ -543,6 +547,7 @@ void Control::_notification(int p_notification) {
|
||||||
|
|
||||||
case NOTIFICATION_ENTER_CANVAS: {
|
case NOTIFICATION_ENTER_CANVAS: {
|
||||||
data.parent = Object::cast_to<Control>(get_parent());
|
data.parent = Object::cast_to<Control>(get_parent());
|
||||||
|
data.parent_window = Object::cast_to<Window>(get_parent());
|
||||||
|
|
||||||
Node *parent = this; //meh
|
Node *parent = this; //meh
|
||||||
Control *parent_control = nullptr;
|
Control *parent_control = nullptr;
|
||||||
|
@ -607,6 +612,7 @@ void Control::_notification(int p_notification) {
|
||||||
|
|
||||||
data.parent = nullptr;
|
data.parent = nullptr;
|
||||||
data.parent_canvas_item = nullptr;
|
data.parent_canvas_item = nullptr;
|
||||||
|
data.parent_window = nullptr;
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_MOVED_IN_PARENT: {
|
case NOTIFICATION_MOVED_IN_PARENT: {
|
||||||
|
|
|
@ -202,6 +202,7 @@ private:
|
||||||
Ref<Theme> theme;
|
Ref<Theme> theme;
|
||||||
Control *theme_owner = nullptr;
|
Control *theme_owner = nullptr;
|
||||||
Window *theme_owner_window = nullptr;
|
Window *theme_owner_window = nullptr;
|
||||||
|
Window *parent_window = nullptr;
|
||||||
StringName theme_type_variation;
|
StringName theme_type_variation;
|
||||||
|
|
||||||
String tooltip;
|
String tooltip;
|
||||||
|
@ -342,6 +343,7 @@ public:
|
||||||
Size2 get_custom_minimum_size() const;
|
Size2 get_custom_minimum_size() const;
|
||||||
|
|
||||||
Control *get_parent_control() const;
|
Control *get_parent_control() const;
|
||||||
|
Window *get_parent_window() const;
|
||||||
|
|
||||||
void set_layout_direction(LayoutDirection p_direction);
|
void set_layout_direction(LayoutDirection p_direction);
|
||||||
LayoutDirection get_layout_direction() const;
|
LayoutDirection get_layout_direction() const;
|
||||||
|
|
|
@ -526,7 +526,7 @@ void CanvasItem::_enter_canvas() {
|
||||||
get_viewport()->gui_reset_canvas_sort_index();
|
get_viewport()->gui_reset_canvas_sort_index();
|
||||||
}
|
}
|
||||||
|
|
||||||
get_tree()->call_group_flags(SceneTree::GROUP_CALL_UNIQUE, group, "_top_level_raise_self");
|
get_tree()->call_group_flags(SceneTree::GROUP_CALL_UNIQUE, group, SNAME("_top_level_raise_self"));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
CanvasItem *parent = get_parent_item();
|
CanvasItem *parent = get_parent_item();
|
||||||
|
@ -545,7 +545,7 @@ void CanvasItem::_exit_canvas() {
|
||||||
notification(NOTIFICATION_EXIT_CANVAS, true); //reverse the notification
|
notification(NOTIFICATION_EXIT_CANVAS, true); //reverse the notification
|
||||||
RenderingServer::get_singleton()->canvas_item_set_parent(canvas_item, RID());
|
RenderingServer::get_singleton()->canvas_item_set_parent(canvas_item, RID());
|
||||||
canvas_layer = nullptr;
|
canvas_layer = nullptr;
|
||||||
group = "";
|
group = StringName();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CanvasItem::_notification(int p_what) {
|
void CanvasItem::_notification(int p_what) {
|
||||||
|
@ -591,7 +591,7 @@ void CanvasItem::_notification(int p_what) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (group != "") {
|
if (group != StringName()) {
|
||||||
get_tree()->call_group_flags(SceneTree::GROUP_CALL_UNIQUE, group, "_top_level_raise_self");
|
get_tree()->call_group_flags(SceneTree::GROUP_CALL_UNIQUE, group, "_top_level_raise_self");
|
||||||
} else {
|
} else {
|
||||||
CanvasItem *p = get_parent_item();
|
CanvasItem *p = get_parent_item();
|
||||||
|
@ -651,7 +651,7 @@ void CanvasItem::update() {
|
||||||
|
|
||||||
pending_update = true;
|
pending_update = true;
|
||||||
|
|
||||||
MessageQueue::get_singleton()->push_call(this, "_update_callback");
|
MessageQueue::get_singleton()->push_call(this, SNAME("_update_callback"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CanvasItem::set_modulate(const Color &p_modulate) {
|
void CanvasItem::set_modulate(const Color &p_modulate) {
|
||||||
|
|
|
@ -187,7 +187,7 @@ private:
|
||||||
mutable SelfList<Node> xform_change;
|
mutable SelfList<Node> xform_change;
|
||||||
|
|
||||||
RID canvas_item;
|
RID canvas_item;
|
||||||
String group;
|
StringName group;
|
||||||
|
|
||||||
CanvasLayer *canvas_layer = nullptr;
|
CanvasLayer *canvas_layer = nullptr;
|
||||||
|
|
||||||
|
|
|
@ -408,9 +408,9 @@ bool SceneTree::physics_process(float p_time) {
|
||||||
|
|
||||||
emit_signal(SNAME("physics_frame"));
|
emit_signal(SNAME("physics_frame"));
|
||||||
|
|
||||||
_notify_group_pause("physics_process_internal", Node::NOTIFICATION_INTERNAL_PHYSICS_PROCESS);
|
_notify_group_pause(SNAME("physics_process_internal"), Node::NOTIFICATION_INTERNAL_PHYSICS_PROCESS);
|
||||||
call_group_flags(GROUP_CALL_REALTIME, "_viewports", "_process_picking");
|
call_group_flags(GROUP_CALL_REALTIME, SNAME("_picking_viewports"), SNAME("_process_picking"));
|
||||||
_notify_group_pause("physics_process", Node::NOTIFICATION_PHYSICS_PROCESS);
|
_notify_group_pause(SNAME("physics_process"), Node::NOTIFICATION_PHYSICS_PROCESS);
|
||||||
_flush_ugc();
|
_flush_ugc();
|
||||||
MessageQueue::get_singleton()->flush(); //small little hack
|
MessageQueue::get_singleton()->flush(); //small little hack
|
||||||
|
|
||||||
|
@ -442,8 +442,8 @@ bool SceneTree::process(float p_time) {
|
||||||
|
|
||||||
flush_transform_notifications();
|
flush_transform_notifications();
|
||||||
|
|
||||||
_notify_group_pause("process_internal", Node::NOTIFICATION_INTERNAL_PROCESS);
|
_notify_group_pause(SNAME("process_internal"), Node::NOTIFICATION_INTERNAL_PROCESS);
|
||||||
_notify_group_pause("process", Node::NOTIFICATION_PROCESS);
|
_notify_group_pause(SNAME("process"), Node::NOTIFICATION_PROCESS);
|
||||||
|
|
||||||
_flush_ugc();
|
_flush_ugc();
|
||||||
MessageQueue::get_singleton()->flush(); //small little hack
|
MessageQueue::get_singleton()->flush(); //small little hack
|
||||||
|
@ -490,7 +490,7 @@ bool SceneTree::process(float p_time) {
|
||||||
|
|
||||||
if (Engine::get_singleton()->is_editor_hint()) {
|
if (Engine::get_singleton()->is_editor_hint()) {
|
||||||
//simple hack to reload fallback environment if it changed from editor
|
//simple hack to reload fallback environment if it changed from editor
|
||||||
String env_path = ProjectSettings::get_singleton()->get("rendering/environment/defaults/default_environment");
|
String env_path = ProjectSettings::get_singleton()->get(SNAME("rendering/environment/defaults/default_environment"));
|
||||||
env_path = env_path.strip_edges(); //user may have added a space or two
|
env_path = env_path.strip_edges(); //user may have added a space or two
|
||||||
String cpath;
|
String cpath;
|
||||||
Ref<Environment> fallback = get_root()->get_world_3d()->get_fallback_environment();
|
Ref<Environment> fallback = get_root()->get_world_3d()->get_fallback_environment();
|
||||||
|
|
|
@ -444,6 +444,7 @@ void Viewport::_notification(int p_what) {
|
||||||
RenderingServer::get_singleton()->instance_set_base(contact_3d_debug_instance, contact_3d_debug_multimesh);
|
RenderingServer::get_singleton()->instance_set_base(contact_3d_debug_instance, contact_3d_debug_multimesh);
|
||||||
RenderingServer::get_singleton()->instance_set_scenario(contact_3d_debug_instance, find_world_3d()->get_scenario());
|
RenderingServer::get_singleton()->instance_set_scenario(contact_3d_debug_instance, find_world_3d()->get_scenario());
|
||||||
//RenderingServer::get_singleton()->instance_geometry_set_flag(contact_3d_debug_instance, RS::INSTANCE_FLAG_VISIBLE_IN_ALL_ROOMS, true);
|
//RenderingServer::get_singleton()->instance_geometry_set_flag(contact_3d_debug_instance, RS::INSTANCE_FLAG_VISIBLE_IN_ALL_ROOMS, true);
|
||||||
|
set_physics_process_internal(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
@ -477,10 +478,6 @@ void Viewport::_notification(int p_what) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Enable processing for tooltips, collision debugging, physics object picking, etc.
|
|
||||||
set_process_internal(true);
|
|
||||||
set_physics_process_internal(true);
|
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
case NOTIFICATION_EXIT_TREE: {
|
case NOTIFICATION_EXIT_TREE: {
|
||||||
_gui_cancel_tooltip();
|
_gui_cancel_tooltip();
|
||||||
|
@ -500,6 +497,7 @@ void Viewport::_notification(int p_what) {
|
||||||
}
|
}
|
||||||
|
|
||||||
remove_from_group("_viewports");
|
remove_from_group("_viewports");
|
||||||
|
set_physics_process_internal(false);
|
||||||
|
|
||||||
RS::get_singleton()->viewport_set_active(viewport, false);
|
RS::get_singleton()->viewport_set_active(viewport, false);
|
||||||
RenderingServer::get_singleton()->viewport_set_parent_viewport(viewport, RID());
|
RenderingServer::get_singleton()->viewport_set_parent_viewport(viewport, RID());
|
||||||
|
@ -510,6 +508,7 @@ void Viewport::_notification(int p_what) {
|
||||||
gui.tooltip_timer -= get_process_delta_time();
|
gui.tooltip_timer -= get_process_delta_time();
|
||||||
if (gui.tooltip_timer < 0) {
|
if (gui.tooltip_timer < 0) {
|
||||||
_gui_show_tooltip();
|
_gui_show_tooltip();
|
||||||
|
set_process_internal(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1482,6 +1481,7 @@ void Viewport::_gui_sort_roots() {
|
||||||
void Viewport::_gui_cancel_tooltip() {
|
void Viewport::_gui_cancel_tooltip() {
|
||||||
gui.tooltip_control = nullptr;
|
gui.tooltip_control = nullptr;
|
||||||
gui.tooltip_timer = -1;
|
gui.tooltip_timer = -1;
|
||||||
|
set_process_internal(false);
|
||||||
if (gui.tooltip_popup) {
|
if (gui.tooltip_popup) {
|
||||||
gui.tooltip_popup->queue_delete();
|
gui.tooltip_popup->queue_delete();
|
||||||
gui.tooltip_popup = nullptr;
|
gui.tooltip_popup = nullptr;
|
||||||
|
@ -2133,6 +2133,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
|
||||||
gui.tooltip_control = over;
|
gui.tooltip_control = over;
|
||||||
gui.tooltip_pos = over->get_screen_transform().xform(pos);
|
gui.tooltip_pos = over->get_screen_transform().xform(pos);
|
||||||
gui.tooltip_timer = gui.tooltip_delay;
|
gui.tooltip_timer = gui.tooltip_delay;
|
||||||
|
set_process_internal(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3172,8 +3173,13 @@ bool Viewport::is_using_own_world_3d() const {
|
||||||
|
|
||||||
void Viewport::set_physics_object_picking(bool p_enable) {
|
void Viewport::set_physics_object_picking(bool p_enable) {
|
||||||
physics_object_picking = p_enable;
|
physics_object_picking = p_enable;
|
||||||
if (!physics_object_picking) {
|
if (physics_object_picking) {
|
||||||
|
add_to_group("_picking_viewports");
|
||||||
|
} else {
|
||||||
physics_picking_events.clear();
|
physics_picking_events.clear();
|
||||||
|
if (is_in_group("_picking_viewports")) {
|
||||||
|
remove_from_group("_picking_viewports");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1325,14 +1325,14 @@ bool Window::is_layout_rtl() const {
|
||||||
if (parent) {
|
if (parent) {
|
||||||
return parent->is_layout_rtl();
|
return parent->is_layout_rtl();
|
||||||
} else {
|
} else {
|
||||||
if (GLOBAL_GET("internationalization/rendering/force_right_to_left_layout_direction")) {
|
if (GLOBAL_GET(SNAME("internationalization/rendering/force_right_to_left_layout_direction"))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
String locale = TranslationServer::get_singleton()->get_tool_locale();
|
String locale = TranslationServer::get_singleton()->get_tool_locale();
|
||||||
return TS->is_locale_right_to_left(locale);
|
return TS->is_locale_right_to_left(locale);
|
||||||
}
|
}
|
||||||
} else if (layout_dir == LAYOUT_DIRECTION_LOCALE) {
|
} else if (layout_dir == LAYOUT_DIRECTION_LOCALE) {
|
||||||
if (GLOBAL_GET("internationalization/rendering/force_right_to_left_layout_direction")) {
|
if (GLOBAL_GET(SNAME("internationalization/rendering/force_right_to_left_layout_direction"))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
String locale = TranslationServer::get_singleton()->get_tool_locale();
|
String locale = TranslationServer::get_singleton()->get_tool_locale();
|
||||||
|
|
Loading…
Reference in a new issue