summaryrefslogtreecommitdiff
path: root/modules/csg
diff options
context:
space:
mode:
authorDESKTOP-9O27V4U\Navi <gengeroro@gmail.com>2022-09-27 20:47:05 -0700
committerRĂ©mi Verschelde <rverschelde@gmail.com>2023-02-13 20:41:23 +0100
commitac92704f395b70098771814686466681cee345c9 (patch)
tree2f115f574fa6bf7d3cb1cb631ecb2852c62ace4d /modules/csg
parent854d9c3d9c77270ff3260a8edcc12fccc85514c1 (diff)
Add compatibility code for CSGBox3D width/height/depth from Godot 3.x
Fixes #66420.
Diffstat (limited to 'modules/csg')
-rw-r--r--modules/csg/csg_shape.cpp24
-rw-r--r--modules/csg/csg_shape.h4
2 files changed, 28 insertions, 0 deletions
diff --git a/modules/csg/csg_shape.cpp b/modules/csg/csg_shape.cpp
index 13c7a8202c..afb8e62eea 100644
--- a/modules/csg/csg_shape.cpp
+++ b/modules/csg/csg_shape.cpp
@@ -1255,6 +1255,30 @@ Vector3 CSGBox3D::get_size() const {
return size;
}
+#ifndef DISABLE_DEPRECATED
+// Kept for compatibility from 3.x to 4.0.
+bool CSGBox3D::_set(const StringName &p_name, const Variant &p_value) {
+ if (p_name == "width") {
+ size.x = p_value;
+ _make_dirty();
+ update_gizmos();
+ return true;
+ } else if (p_name == "height") {
+ size.y = p_value;
+ _make_dirty();
+ update_gizmos();
+ return true;
+ } else if (p_name == "depth") {
+ size.z = p_value;
+ _make_dirty();
+ update_gizmos();
+ return true;
+ } else {
+ return false;
+ }
+}
+#endif
+
void CSGBox3D::set_material(const Ref<Material> &p_material) {
material = p_material;
_make_dirty();
diff --git a/modules/csg/csg_shape.h b/modules/csg/csg_shape.h
index 9012c37679..c244107bfb 100644
--- a/modules/csg/csg_shape.h
+++ b/modules/csg/csg_shape.h
@@ -248,6 +248,10 @@ class CSGBox3D : public CSGPrimitive3D {
protected:
static void _bind_methods();
+#ifndef DISABLE_DEPRECATED
+ // Kept for compatibility from 3.x to 4.0.
+ bool _set(const StringName &p_name, const Variant &p_value);
+#endif
public:
void set_size(const Vector3 &p_size);