Merge pull request #94047 from KoBeWi/resource_printer
Improve `to_string()` and add it to Resource
This commit is contained in:
@ -459,8 +459,8 @@ Variant Tween::interpolate_variant(const Variant &p_initial_val, const Variant &
|
||||
return ret;
|
||||
}
|
||||
|
||||
String Tween::to_string() {
|
||||
String ret = Object::to_string();
|
||||
String Tween::_to_string() {
|
||||
String ret = Object::_to_string();
|
||||
Node *node = get_bound_node();
|
||||
if (node) {
|
||||
ret += vformat(" (bound to %s)", node->get_name());
|
||||
|
||||
@ -140,10 +140,9 @@ private:
|
||||
|
||||
protected:
|
||||
static void _bind_methods();
|
||||
virtual String _to_string() override;
|
||||
|
||||
public:
|
||||
virtual String to_string() override;
|
||||
|
||||
Ref<PropertyTweener> tween_property(const Object *p_target, const NodePath &p_property, Variant p_to, double p_duration);
|
||||
Ref<IntervalTweener> tween_interval(double p_time);
|
||||
Ref<CallbackTweener> tween_callback(const Callable &p_callback);
|
||||
|
||||
@ -2779,27 +2779,6 @@ void Node::get_storable_properties(HashSet<StringName> &r_storable_properties) c
|
||||
}
|
||||
}
|
||||
|
||||
String Node::to_string() {
|
||||
// Keep this method in sync with `Object::to_string`.
|
||||
ERR_THREAD_GUARD_V(String());
|
||||
if (get_script_instance()) {
|
||||
bool valid;
|
||||
String ret = get_script_instance()->to_string(&valid);
|
||||
if (valid) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
if (_get_extension() && _get_extension()->to_string) {
|
||||
String ret;
|
||||
GDExtensionBool is_valid;
|
||||
_get_extension()->to_string(_get_extension_instance(), &is_valid, &ret);
|
||||
if (is_valid) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
return (get_name() ? String(get_name()) + ":" : "") + Object::to_string();
|
||||
}
|
||||
|
||||
void Node::set_scene_instance_state(const Ref<SceneState> &p_state) {
|
||||
ERR_THREAD_GUARD
|
||||
data.instance_state = p_state;
|
||||
@ -3615,6 +3594,11 @@ void Node::_validate_property(PropertyInfo &p_property) const {
|
||||
}
|
||||
}
|
||||
|
||||
String Node::_to_string() {
|
||||
ERR_THREAD_GUARD_V(String());
|
||||
return (get_name() ? String(get_name()) + ":" : "") + Object::_to_string();
|
||||
}
|
||||
|
||||
void Node::input(const Ref<InputEvent> &p_event) {
|
||||
}
|
||||
|
||||
|
||||
@ -407,6 +407,7 @@ protected:
|
||||
void _call_unhandled_key_input(const Ref<InputEvent> &p_event);
|
||||
|
||||
void _validate_property(PropertyInfo &p_property) const;
|
||||
virtual String _to_string() override;
|
||||
|
||||
Variant _get_node_rpc_config_bind() const {
|
||||
return get_node_rpc_config().duplicate(true);
|
||||
@ -631,8 +632,6 @@ public:
|
||||
#endif
|
||||
void get_storable_properties(HashSet<StringName> &r_storable_properties) const;
|
||||
|
||||
virtual String to_string() override;
|
||||
|
||||
/* NOTIFICATIONS */
|
||||
|
||||
void propagate_notification(int p_notification);
|
||||
|
||||
Reference in New Issue
Block a user