summaryrefslogtreecommitdiff
path: root/scene/resources/mesh.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources/mesh.cpp')
-rw-r--r--scene/resources/mesh.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index 244ee09c22..6d0a1cf76b 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -99,6 +99,12 @@ bool Mesh::_set(const StringName& p_name, const Variant& p_value) {
return true;
}
+ if (sname=="custom_aabb/custom_aabb") {
+
+ set_custom_aabb(p_value);
+ return true;
+ }
+
if (!sname.begins_with("surfaces"))
return false;
@@ -165,6 +171,10 @@ bool Mesh::_get(const StringName& p_name,Variant &r_ret) const {
int idx=sname.get_slice("/",1).to_int()-1;
r_ret=surface_get_material(idx);
return true;
+ } else if (sname=="custom_aabb/custom_aabb") {
+
+ r_ret=custom_aabb;
+ return true;
} else if (!sname.begins_with("surfaces"))
return false;
@@ -202,6 +212,9 @@ void Mesh::_get_property_list( List<PropertyInfo> *p_list) const {
p_list->push_back( PropertyInfo( Variant::DICTIONARY,"surfaces/"+itos(i), PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR ) );
p_list->push_back( PropertyInfo( Variant::OBJECT,"materials/"+itos(i+1), PROPERTY_HINT_RESOURCE_TYPE,"Material",PROPERTY_USAGE_EDITOR ) );
}
+
+ p_list->push_back( PropertyInfo( Variant::_AABB,"custom_aabb/custom_aabb" ) );
+
}
@@ -473,6 +486,19 @@ AABB Mesh::get_aabb() const {
return aabb;
}
+
+void Mesh::set_custom_aabb(const AABB& p_custom) {
+
+ custom_aabb=p_custom;
+ VS::get_singleton()->mesh_set_custom_aabb(mesh,custom_aabb);
+}
+
+AABB Mesh::get_custom_aabb() const {
+
+ return custom_aabb;
+}
+
+
DVector<Face3> Mesh::get_faces() const {
@@ -700,6 +726,8 @@ void Mesh::_bind_methods() {
ObjectTypeDB::bind_method(_MD("center_geometry"),&Mesh::center_geometry);
ObjectTypeDB::set_method_flags(get_type_static(),_SCS("center_geometry"),METHOD_FLAGS_DEFAULT|METHOD_FLAG_EDITOR);
+ ObjectTypeDB::bind_method(_MD("set_custom_aabb","aabb"),&Mesh::set_custom_aabb);
+ ObjectTypeDB::bind_method(_MD("get_custom_aabb"),&Mesh::get_custom_aabb);
BIND_CONSTANT( NO_INDEX_ARRAY );