summaryrefslogtreecommitdiffstats
path: root/tests/core/object/test_object.h
diff options
context:
space:
mode:
authordemolke <demolke@gmail.com>2024-01-11 20:47:31 +0100
committerdemolke <demolke@gmail.com>2024-08-29 19:17:04 +0200
commitc409e6d7225a8331a81914fb545770d7b322edaf (patch)
tree27ada90f9014f25eb23d301f0640bb75205058d6 /tests/core/object/test_object.h
parentfd7239cfab228c50777cd54a8bf6eb279a02ef81 (diff)
downloadredot-engine-c409e6d7225a8331a81914fb545770d7b322edaf.tar.gz
Import/export GLTF extras to node->meta
This is useful for custom tagging of objects with properties (for example in Blender) and having this available in the editor for scripting. - Adds import logic to propagate the parsed GLTF extras all the way to the resulting Node->meta - Adds export logic to save Godot Object meta into GLTF extras - Supports `nodes`, `meshes` and `materials` (in GLTF sense of the words)
Diffstat (limited to 'tests/core/object/test_object.h')
-rw-r--r--tests/core/object/test_object.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/core/object/test_object.h b/tests/core/object/test_object.h
index 57bc65328a..f1bb62cb70 100644
--- a/tests/core/object/test_object.h
+++ b/tests/core/object/test_object.h
@@ -174,6 +174,31 @@ TEST_CASE("[Object] Metadata") {
CHECK_MESSAGE(
meta_list2.size() == 0,
"The metadata list should contain 0 items after removing all metadata items.");
+
+ Object other;
+ object.set_meta("conflicting_meta", "string");
+ object.set_meta("not_conflicting_meta", 123);
+ other.set_meta("conflicting_meta", Color(0, 1, 0));
+ other.set_meta("other_meta", "other");
+ object.merge_meta_from(&other);
+
+ CHECK_MESSAGE(
+ Color(object.get_meta("conflicting_meta")).is_equal_approx(Color(0, 1, 0)),
+ "String meta should be overwritten with Color after merging.");
+
+ CHECK_MESSAGE(
+ int(object.get_meta("not_conflicting_meta")) == 123,
+ "Not conflicting meta on destination should be kept intact.");
+
+ CHECK_MESSAGE(
+ object.get_meta("other_meta", String()) == "other",
+ "Not conflicting meta name on source should merged.");
+
+ List<StringName> meta_list3;
+ object.get_meta_list(&meta_list3);
+ CHECK_MESSAGE(
+ meta_list3.size() == 3,
+ "The metadata list should contain 3 items after merging meta from two objects.");
}
TEST_CASE("[Object] Construction") {