Merge pull request #66476 from GK-GreyGhost/csgbox-updater

Support CSGBox3D conversion of width/height/depth in 3 to size in 4
This commit is contained in:
Rémi Verschelde 2023-02-13 21:07:30 +01:00
commit c787eb6609
No known key found for this signature in database
GPG key ID: C3336907360768E1
2 changed files with 28 additions and 0 deletions

View file

@ -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();

View file

@ -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);