|
@@ -234,21 +234,6 @@ static String _fixstr(const String &p_what, const String &p_str) {
|
|
return what;
|
|
return what;
|
|
}
|
|
}
|
|
|
|
|
|
-static void _gen_shape_list(const Ref<Mesh> &mesh, List<Ref<Shape3D>> &r_shape_list, bool p_convex) {
|
|
|
|
- ERR_FAIL_NULL_MSG(mesh, "Cannot generate shape list with null mesh value");
|
|
|
|
- if (!p_convex) {
|
|
|
|
- Ref<Shape3D> shape = mesh->create_trimesh_shape();
|
|
|
|
- r_shape_list.push_back(shape);
|
|
|
|
- } else {
|
|
|
|
- Vector<Ref<Shape3D>> cd = mesh->convex_decompose();
|
|
|
|
- if (cd.size()) {
|
|
|
|
- for (int i = 0; i < cd.size(); i++) {
|
|
|
|
- r_shape_list.push_back(cd[i]);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
static void _pre_gen_shape_list(const Ref<EditorSceneImporterMesh> &mesh, List<Ref<Shape3D>> &r_shape_list, bool p_convex) {
|
|
static void _pre_gen_shape_list(const Ref<EditorSceneImporterMesh> &mesh, List<Ref<Shape3D>> &r_shape_list, bool p_convex) {
|
|
ERR_FAIL_NULL_MSG(mesh, "Cannot generate shape list with null mesh value");
|
|
ERR_FAIL_NULL_MSG(mesh, "Cannot generate shape list with null mesh value");
|
|
if (!p_convex) {
|
|
if (!p_convex) {
|
|
@@ -426,7 +411,7 @@ Node *ResourceImporterScene::_pre_fix_node(Node *p_node, Node *p_root, Map<Ref<E
|
|
if (collision_map.has(mesh)) {
|
|
if (collision_map.has(mesh)) {
|
|
shapes = collision_map[mesh];
|
|
shapes = collision_map[mesh];
|
|
} else {
|
|
} else {
|
|
- _gen_shape_list(mesh, shapes, true);
|
|
|
|
|
|
+ _pre_gen_shape_list(mesh, shapes, true);
|
|
}
|
|
}
|
|
|
|
|
|
RigidBody3D *rigid_body = memnew(RigidBody3D);
|
|
RigidBody3D *rigid_body = memnew(RigidBody3D);
|
|
@@ -452,10 +437,10 @@ Node *ResourceImporterScene::_pre_fix_node(Node *p_node, Node *p_root, Map<Ref<E
|
|
if (collision_map.has(mesh)) {
|
|
if (collision_map.has(mesh)) {
|
|
shapes = collision_map[mesh];
|
|
shapes = collision_map[mesh];
|
|
} else if (_teststr(name, "col")) {
|
|
} else if (_teststr(name, "col")) {
|
|
- _gen_shape_list(mesh, shapes, false);
|
|
|
|
|
|
+ _pre_gen_shape_list(mesh, shapes, false);
|
|
collision_map[mesh] = shapes;
|
|
collision_map[mesh] = shapes;
|
|
} else if (_teststr(name, "convcol")) {
|
|
} else if (_teststr(name, "convcol")) {
|
|
- _gen_shape_list(mesh, shapes, true);
|
|
|
|
|
|
+ _pre_gen_shape_list(mesh, shapes, true);
|
|
collision_map[mesh] = shapes;
|
|
collision_map[mesh] = shapes;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -510,11 +495,11 @@ Node *ResourceImporterScene::_pre_fix_node(Node *p_node, Node *p_root, Map<Ref<E
|
|
if (collision_map.has(mesh)) {
|
|
if (collision_map.has(mesh)) {
|
|
shapes = collision_map[mesh];
|
|
shapes = collision_map[mesh];
|
|
} else if (_teststr(mesh->get_name(), "col")) {
|
|
} else if (_teststr(mesh->get_name(), "col")) {
|
|
- _gen_shape_list(mesh, shapes, false);
|
|
|
|
|
|
+ _pre_gen_shape_list(mesh, shapes, false);
|
|
collision_map[mesh] = shapes;
|
|
collision_map[mesh] = shapes;
|
|
mesh->set_name(_fixstr(mesh->get_name(), "col"));
|
|
mesh->set_name(_fixstr(mesh->get_name(), "col"));
|
|
} else if (_teststr(mesh->get_name(), "convcol")) {
|
|
} else if (_teststr(mesh->get_name(), "convcol")) {
|
|
- _gen_shape_list(mesh, shapes, true);
|
|
|
|
|
|
+ _pre_gen_shape_list(mesh, shapes, true);
|
|
collision_map[mesh] = shapes;
|
|
collision_map[mesh] = shapes;
|
|
mesh->set_name(_fixstr(mesh->get_name(), "convcol"));
|
|
mesh->set_name(_fixstr(mesh->get_name(), "convcol"));
|
|
}
|
|
}
|