From d7d130295ecf3f5c97b4db8d5813ea7ab17dc871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mikrut?= Date: Tue, 1 Nov 2022 20:49:52 +0100 Subject: Support for checking that Projection is(not) null --- core/variant/variant_op.cpp | 4 ++++ .../tests/scripts/runtime/features/compare-builtin-equals-null.gd | 4 ++++ .../tests/scripts/runtime/features/compare-builtin-equals-null.out | 1 + .../tests/scripts/runtime/features/compare-builtin-not-equals-null.gd | 4 ++++ .../scripts/runtime/features/compare-builtin-not-equals-null.out | 1 + 5 files changed, 14 insertions(+) diff --git a/core/variant/variant_op.cpp b/core/variant/variant_op.cpp index 301fd00d26..4c6ee8df1b 100644 --- a/core/variant/variant_op.cpp +++ b/core/variant/variant_op.cpp @@ -561,6 +561,7 @@ void Variant::_register_variant_operators() { register_op>(Variant::OP_EQUAL, Variant::AABB, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::BASIS, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::TRANSFORM3D, Variant::NIL); + register_op>(Variant::OP_EQUAL, Variant::PROJECTION, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::COLOR, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::STRING_NAME, Variant::NIL); register_op>(Variant::OP_EQUAL, Variant::NODE_PATH, Variant::NIL); @@ -597,6 +598,7 @@ void Variant::_register_variant_operators() { register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::AABB); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::BASIS); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::TRANSFORM3D); + register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::PROJECTION); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::COLOR); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::STRING_NAME); register_op>(Variant::OP_EQUAL, Variant::NIL, Variant::NODE_PATH); @@ -682,6 +684,7 @@ void Variant::_register_variant_operators() { register_op>(Variant::OP_NOT_EQUAL, Variant::AABB, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::BASIS, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::TRANSFORM3D, Variant::NIL); + register_op>(Variant::OP_NOT_EQUAL, Variant::PROJECTION, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::COLOR, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::STRING_NAME, Variant::NIL); register_op>(Variant::OP_NOT_EQUAL, Variant::NODE_PATH, Variant::NIL); @@ -718,6 +721,7 @@ void Variant::_register_variant_operators() { register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::AABB); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::BASIS); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::TRANSFORM3D); + register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::PROJECTION); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::COLOR); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::STRING_NAME); register_op>(Variant::OP_NOT_EQUAL, Variant::NIL, Variant::NODE_PATH); diff --git a/modules/gdscript/tests/scripts/runtime/features/compare-builtin-equals-null.gd b/modules/gdscript/tests/scripts/runtime/features/compare-builtin-equals-null.gd index c6645c2c34..809d0d28a9 100644 --- a/modules/gdscript/tests/scripts/runtime/features/compare-builtin-equals-null.gd +++ b/modules/gdscript/tests/scripts/runtime/features/compare-builtin-equals-null.gd @@ -69,6 +69,10 @@ func test(): value = Transform3D() print(value == null) + # Projection + value = Projection() + print(value == null) + # Color value = Color() print(value == null) diff --git a/modules/gdscript/tests/scripts/runtime/features/compare-builtin-equals-null.out b/modules/gdscript/tests/scripts/runtime/features/compare-builtin-equals-null.out index 639f6027b9..27423ab8e7 100644 --- a/modules/gdscript/tests/scripts/runtime/features/compare-builtin-equals-null.out +++ b/modules/gdscript/tests/scripts/runtime/features/compare-builtin-equals-null.out @@ -33,3 +33,4 @@ false false false false +false diff --git a/modules/gdscript/tests/scripts/runtime/features/compare-builtin-not-equals-null.gd b/modules/gdscript/tests/scripts/runtime/features/compare-builtin-not-equals-null.gd index ee622bf22f..f46afb0f18 100644 --- a/modules/gdscript/tests/scripts/runtime/features/compare-builtin-not-equals-null.gd +++ b/modules/gdscript/tests/scripts/runtime/features/compare-builtin-not-equals-null.gd @@ -69,6 +69,10 @@ func test(): value = Transform3D() print(value != null) + # Projection + value = Projection() + print(value != null) + # Color value = Color() print(value != null) diff --git a/modules/gdscript/tests/scripts/runtime/features/compare-builtin-not-equals-null.out b/modules/gdscript/tests/scripts/runtime/features/compare-builtin-not-equals-null.out index d1e332afba..a11c47854a 100644 --- a/modules/gdscript/tests/scripts/runtime/features/compare-builtin-not-equals-null.out +++ b/modules/gdscript/tests/scripts/runtime/features/compare-builtin-not-equals-null.out @@ -33,3 +33,4 @@ true true true true +true -- cgit v1.2.3