summaryrefslogtreecommitdiff
path: root/core/undo_redo.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <juan@godotengine.org>2020-02-20 18:58:05 -0300
committerJuan Linietsky <reduzio@gmail.com>2020-02-21 14:25:29 +0100
commit3c0059650da3f1feb3c95364d571fe706826dec6 (patch)
treea36ba94f313e2dee88dc2eb253175849fb2d4138 /core/undo_redo.cpp
parent7ac0973e9abb308b91597dd8881aeed62682733c (diff)
Added StringName as a variant type.
Also changed all relevant properties defined manually to StringName.
Diffstat (limited to 'core/undo_redo.cpp')
-rw-r--r--core/undo_redo.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/core/undo_redo.cpp b/core/undo_redo.cpp
index 0eef75d587..02f460c93d 100644
--- a/core/undo_redo.cpp
+++ b/core/undo_redo.cpp
@@ -105,7 +105,7 @@ void UndoRedo::create_action(const String &p_name, MergeMode p_mode) {
action_level++;
}
-void UndoRedo::add_do_method(Object *p_object, const String &p_method, VARIANT_ARG_DECLARE) {
+void UndoRedo::add_do_method(Object *p_object, const StringName &p_method, VARIANT_ARG_DECLARE) {
VARIANT_ARGPTRS
ERR_FAIL_COND(p_object == NULL);
@@ -125,7 +125,7 @@ void UndoRedo::add_do_method(Object *p_object, const String &p_method, VARIANT_A
actions.write[current_action + 1].do_ops.push_back(do_op);
}
-void UndoRedo::add_undo_method(Object *p_object, const String &p_method, VARIANT_ARG_DECLARE) {
+void UndoRedo::add_undo_method(Object *p_object, const StringName &p_method, VARIANT_ARG_DECLARE) {
VARIANT_ARGPTRS
ERR_FAIL_COND(p_object == NULL);
@@ -149,7 +149,7 @@ void UndoRedo::add_undo_method(Object *p_object, const String &p_method, VARIANT
}
actions.write[current_action + 1].undo_ops.push_back(undo_op);
}
-void UndoRedo::add_do_property(Object *p_object, const String &p_property, const Variant &p_value) {
+void UndoRedo::add_do_property(Object *p_object, const StringName &p_property, const Variant &p_value) {
ERR_FAIL_COND(p_object == NULL);
ERR_FAIL_COND(action_level <= 0);
@@ -164,7 +164,7 @@ void UndoRedo::add_do_property(Object *p_object, const String &p_property, const
do_op.args[0] = p_value;
actions.write[current_action + 1].do_ops.push_back(do_op);
}
-void UndoRedo::add_undo_property(Object *p_object, const String &p_property, const Variant &p_value) {
+void UndoRedo::add_undo_property(Object *p_object, const StringName &p_property, const Variant &p_value) {
ERR_FAIL_COND(p_object == NULL);
ERR_FAIL_COND(action_level <= 0);
@@ -446,17 +446,17 @@ Variant UndoRedo::_add_do_method(const Variant **p_args, int p_argcount, Callabl
return Variant();
}
- if (p_args[1]->get_type() != Variant::STRING) {
+ if (p_args[1]->get_type() != Variant::STRING_NAME && p_args[1]->get_type() != Variant::STRING) {
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument = 1;
- r_error.expected = Variant::STRING;
+ r_error.expected = Variant::STRING_NAME;
return Variant();
}
r_error.error = Callable::CallError::CALL_OK;
Object *object = *p_args[0];
- String method = *p_args[1];
+ StringName method = *p_args[1];
Variant v[VARIANT_ARG_MAX];
@@ -484,17 +484,17 @@ Variant UndoRedo::_add_undo_method(const Variant **p_args, int p_argcount, Calla
return Variant();
}
- if (p_args[1]->get_type() != Variant::STRING) {
+ if (p_args[1]->get_type() != Variant::STRING_NAME && p_args[1]->get_type() != Variant::STRING) {
r_error.error = Callable::CallError::CALL_ERROR_INVALID_ARGUMENT;
r_error.argument = 1;
- r_error.expected = Variant::STRING;
+ r_error.expected = Variant::STRING_NAME;
return Variant();
}
r_error.error = Callable::CallError::CALL_OK;
Object *object = *p_args[0];
- String method = *p_args[1];
+ StringName method = *p_args[1];
Variant v[VARIANT_ARG_MAX];
@@ -518,7 +518,7 @@ void UndoRedo::_bind_methods() {
MethodInfo mi;
mi.name = "add_do_method";
mi.arguments.push_back(PropertyInfo(Variant::OBJECT, "object"));
- mi.arguments.push_back(PropertyInfo(Variant::STRING, "method"));
+ mi.arguments.push_back(PropertyInfo(Variant::STRING_NAME, "method"));
ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "add_do_method", &UndoRedo::_add_do_method, mi, varray(), false);
}
@@ -527,7 +527,7 @@ void UndoRedo::_bind_methods() {
MethodInfo mi;
mi.name = "add_undo_method";
mi.arguments.push_back(PropertyInfo(Variant::OBJECT, "object"));
- mi.arguments.push_back(PropertyInfo(Variant::STRING, "method"));
+ mi.arguments.push_back(PropertyInfo(Variant::STRING_NAME, "method"));
ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "add_undo_method", &UndoRedo::_add_undo_method, mi, varray(), false);
}