|
@@ -170,7 +170,7 @@ String ResourceImporterScene::get_visible_name() const {
|
|
|
|
|
|
void ResourceImporterScene::get_recognized_extensions(List<String> *p_extensions) const {
|
|
void ResourceImporterScene::get_recognized_extensions(List<String> *p_extensions) const {
|
|
|
|
|
|
- for (Set<Ref<EditorSceneImporter> >::Element *E = importers.front(); E; E = E->next()) {
|
|
|
|
|
|
+ for (Set<Ref<EditorSceneImporter>>::Element *E = importers.front(); E; E = E->next()) {
|
|
E->get()->get_extensions(p_extensions);
|
|
E->get()->get_extensions(p_extensions);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -276,7 +276,7 @@ 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<Shape> > &r_shape_list, bool p_convex) {
|
|
|
|
|
|
+static void _gen_shape_list(const Ref<Mesh> &mesh, List<Ref<Shape>> &r_shape_list, bool p_convex) {
|
|
|
|
|
|
if (!p_convex) {
|
|
if (!p_convex) {
|
|
|
|
|
|
@@ -284,7 +284,7 @@ static void _gen_shape_list(const Ref<Mesh> &mesh, List<Ref<Shape> > &r_shape_li
|
|
r_shape_list.push_back(shape);
|
|
r_shape_list.push_back(shape);
|
|
} else {
|
|
} else {
|
|
|
|
|
|
- Vector<Ref<Shape> > cd = mesh->convex_decompose();
|
|
|
|
|
|
+ Vector<Ref<Shape>> cd = mesh->convex_decompose();
|
|
if (cd.size()) {
|
|
if (cd.size()) {
|
|
for (int i = 0; i < cd.size(); i++) {
|
|
for (int i = 0; i < cd.size(); i++) {
|
|
r_shape_list.push_back(cd[i]);
|
|
r_shape_list.push_back(cd[i]);
|
|
@@ -293,7 +293,7 @@ static void _gen_shape_list(const Ref<Mesh> &mesh, List<Ref<Shape> > &r_shape_li
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>, List<Ref<Shape> > > &collision_map, LightBakeMode p_light_bake_mode) {
|
|
|
|
|
|
+Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>, List<Ref<Shape>>> &collision_map, LightBakeMode p_light_bake_mode) {
|
|
|
|
|
|
// children first
|
|
// children first
|
|
for (int i = 0; i < p_node->get_child_count(); i++) {
|
|
for (int i = 0; i < p_node->get_child_count(); i++) {
|
|
@@ -382,7 +382,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
|
|
Ref<Mesh> mesh = mi->get_mesh();
|
|
Ref<Mesh> mesh = mi->get_mesh();
|
|
|
|
|
|
if (mesh.is_valid()) {
|
|
if (mesh.is_valid()) {
|
|
- List<Ref<Shape> > shapes;
|
|
|
|
|
|
+ List<Ref<Shape>> shapes;
|
|
String fixed_name;
|
|
String fixed_name;
|
|
if (collision_map.has(mesh)) {
|
|
if (collision_map.has(mesh)) {
|
|
shapes = collision_map[mesh];
|
|
shapes = collision_map[mesh];
|
|
@@ -412,7 +412,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
|
|
p_node = col;
|
|
p_node = col;
|
|
|
|
|
|
int idx = 0;
|
|
int idx = 0;
|
|
- for (List<Ref<Shape> >::Element *E = shapes.front(); E; E = E->next()) {
|
|
|
|
|
|
+ for (List<Ref<Shape>>::Element *E = shapes.front(); E; E = E->next()) {
|
|
|
|
|
|
CollisionShape *cshape = memnew(CollisionShape);
|
|
CollisionShape *cshape = memnew(CollisionShape);
|
|
cshape->set_shape(E->get());
|
|
cshape->set_shape(E->get());
|
|
@@ -468,7 +468,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
|
|
Ref<Mesh> mesh = mi->get_mesh();
|
|
Ref<Mesh> mesh = mi->get_mesh();
|
|
|
|
|
|
if (mesh.is_valid()) {
|
|
if (mesh.is_valid()) {
|
|
- List<Ref<Shape> > shapes;
|
|
|
|
|
|
+ List<Ref<Shape>> shapes;
|
|
if (collision_map.has(mesh)) {
|
|
if (collision_map.has(mesh)) {
|
|
shapes = collision_map[mesh];
|
|
shapes = collision_map[mesh];
|
|
} else {
|
|
} else {
|
|
@@ -486,7 +486,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
|
|
mi->set_owner(rigid_body->get_owner());
|
|
mi->set_owner(rigid_body->get_owner());
|
|
|
|
|
|
int idx = 0;
|
|
int idx = 0;
|
|
- for (List<Ref<Shape> >::Element *E = shapes.front(); E; E = E->next()) {
|
|
|
|
|
|
+ for (List<Ref<Shape>>::Element *E = shapes.front(); E; E = E->next()) {
|
|
|
|
|
|
CollisionShape *cshape = memnew(CollisionShape);
|
|
CollisionShape *cshape = memnew(CollisionShape);
|
|
cshape->set_shape(E->get());
|
|
cshape->set_shape(E->get());
|
|
@@ -505,7 +505,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
|
|
Ref<Mesh> mesh = mi->get_mesh();
|
|
Ref<Mesh> mesh = mi->get_mesh();
|
|
|
|
|
|
if (mesh.is_valid()) {
|
|
if (mesh.is_valid()) {
|
|
- List<Ref<Shape> > shapes;
|
|
|
|
|
|
+ List<Ref<Shape>> shapes;
|
|
String fixed_name;
|
|
String fixed_name;
|
|
if (collision_map.has(mesh)) {
|
|
if (collision_map.has(mesh)) {
|
|
shapes = collision_map[mesh];
|
|
shapes = collision_map[mesh];
|
|
@@ -536,7 +536,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
|
|
col->set_owner(mi->get_owner());
|
|
col->set_owner(mi->get_owner());
|
|
|
|
|
|
int idx = 0;
|
|
int idx = 0;
|
|
- for (List<Ref<Shape> >::Element *E = shapes.front(); E; E = E->next()) {
|
|
|
|
|
|
+ for (List<Ref<Shape>>::Element *E = shapes.front(); E; E = E->next()) {
|
|
|
|
|
|
CollisionShape *cshape = memnew(CollisionShape);
|
|
CollisionShape *cshape = memnew(CollisionShape);
|
|
cshape->set_shape(E->get());
|
|
cshape->set_shape(E->get());
|
|
@@ -618,7 +618,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
|
|
Ref<ArrayMesh> mesh = mi->get_mesh();
|
|
Ref<ArrayMesh> mesh = mi->get_mesh();
|
|
if (!mesh.is_null()) {
|
|
if (!mesh.is_null()) {
|
|
|
|
|
|
- List<Ref<Shape> > shapes;
|
|
|
|
|
|
+ List<Ref<Shape>> shapes;
|
|
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")) {
|
|
@@ -638,7 +638,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh>
|
|
col->set_owner(p_node->get_owner());
|
|
col->set_owner(p_node->get_owner());
|
|
|
|
|
|
int idx = 0;
|
|
int idx = 0;
|
|
- for (List<Ref<Shape> >::Element *E = shapes.front(); E; E = E->next()) {
|
|
|
|
|
|
+ for (List<Ref<Shape>>::Element *E = shapes.front(); E; E = E->next()) {
|
|
|
|
|
|
CollisionShape *cshape = memnew(CollisionShape);
|
|
CollisionShape *cshape = memnew(CollisionShape);
|
|
cshape->set_shape(E->get());
|
|
cshape->set_shape(E->get());
|
|
@@ -957,7 +957,7 @@ void ResourceImporterScene::_find_meshes(Node *p_node, Map<Ref<ArrayMesh>, Trans
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-void ResourceImporterScene::_make_external_resources(Node *p_node, const String &p_base_path, bool p_make_animations, bool p_animations_as_text, bool p_keep_animations, bool p_make_materials, bool p_materials_as_text, bool p_keep_materials, bool p_make_meshes, bool p_meshes_as_text, Map<Ref<Animation>, Ref<Animation> > &p_animations, Map<Ref<Material>, Ref<Material> > &p_materials, Map<Ref<ArrayMesh>, Ref<ArrayMesh> > &p_meshes) {
|
|
|
|
|
|
+void ResourceImporterScene::_make_external_resources(Node *p_node, const String &p_base_path, bool p_make_animations, bool p_animations_as_text, bool p_keep_animations, bool p_make_materials, bool p_materials_as_text, bool p_keep_materials, bool p_make_meshes, bool p_meshes_as_text, Map<Ref<Animation>, Ref<Animation>> &p_animations, Map<Ref<Material>, Ref<Material>> &p_materials, Map<Ref<ArrayMesh>, Ref<ArrayMesh>> &p_meshes) {
|
|
|
|
|
|
List<PropertyInfo> pi;
|
|
List<PropertyInfo> pi;
|
|
|
|
|
|
@@ -1209,7 +1209,7 @@ Node *ResourceImporterScene::import_scene_from_other_importer(EditorSceneImporte
|
|
Ref<EditorSceneImporter> importer;
|
|
Ref<EditorSceneImporter> importer;
|
|
String ext = p_path.get_extension().to_lower();
|
|
String ext = p_path.get_extension().to_lower();
|
|
|
|
|
|
- for (Set<Ref<EditorSceneImporter> >::Element *E = importers.front(); E; E = E->next()) {
|
|
|
|
|
|
+ for (Set<Ref<EditorSceneImporter>>::Element *E = importers.front(); E; E = E->next()) {
|
|
|
|
|
|
if (E->get().ptr() == p_exception)
|
|
if (E->get().ptr() == p_exception)
|
|
continue;
|
|
continue;
|
|
@@ -1241,7 +1241,7 @@ Ref<Animation> ResourceImporterScene::import_animation_from_other_importer(Edito
|
|
Ref<EditorSceneImporter> importer;
|
|
Ref<EditorSceneImporter> importer;
|
|
String ext = p_path.get_extension().to_lower();
|
|
String ext = p_path.get_extension().to_lower();
|
|
|
|
|
|
- for (Set<Ref<EditorSceneImporter> >::Element *E = importers.front(); E; E = E->next()) {
|
|
|
|
|
|
+ for (Set<Ref<EditorSceneImporter>>::Element *E = importers.front(); E; E = E->next()) {
|
|
|
|
|
|
if (E->get().ptr() == p_exception)
|
|
if (E->get().ptr() == p_exception)
|
|
continue;
|
|
continue;
|
|
@@ -1276,7 +1276,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
|
|
EditorProgress progress("import", TTR("Import Scene"), 104);
|
|
EditorProgress progress("import", TTR("Import Scene"), 104);
|
|
progress.step(TTR("Importing Scene..."), 0);
|
|
progress.step(TTR("Importing Scene..."), 0);
|
|
|
|
|
|
- for (Set<Ref<EditorSceneImporter> >::Element *E = importers.front(); E; E = E->next()) {
|
|
|
|
|
|
+ for (Set<Ref<EditorSceneImporter>>::Element *E = importers.front(); E; E = E->next()) {
|
|
|
|
|
|
List<String> extensions;
|
|
List<String> extensions;
|
|
E->get()->get_extensions(&extensions);
|
|
E->get()->get_extensions(&extensions);
|
|
@@ -1368,7 +1368,7 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
|
|
float anim_optimizer_maxang = p_options["animation/optimizer/max_angle"];
|
|
float anim_optimizer_maxang = p_options["animation/optimizer/max_angle"];
|
|
int light_bake_mode = p_options["meshes/light_baking"];
|
|
int light_bake_mode = p_options["meshes/light_baking"];
|
|
|
|
|
|
- Map<Ref<Mesh>, List<Ref<Shape> > > collision_map;
|
|
|
|
|
|
+ Map<Ref<Mesh>, List<Ref<Shape>>> collision_map;
|
|
|
|
|
|
scene = _fix_node(scene, scene, collision_map, LightBakeMode(light_bake_mode));
|
|
scene = _fix_node(scene, scene, collision_map, LightBakeMode(light_bake_mode));
|
|
|
|
|
|
@@ -1456,9 +1456,9 @@ Error ResourceImporterScene::import(const String &p_source_file, const String &p
|
|
}
|
|
}
|
|
|
|
|
|
if (external_animations || external_materials || external_meshes) {
|
|
if (external_animations || external_materials || external_meshes) {
|
|
- Map<Ref<Animation>, Ref<Animation> > anim_map;
|
|
|
|
- Map<Ref<Material>, Ref<Material> > mat_map;
|
|
|
|
- Map<Ref<ArrayMesh>, Ref<ArrayMesh> > mesh_map;
|
|
|
|
|
|
+ Map<Ref<Animation>, Ref<Animation>> anim_map;
|
|
|
|
+ Map<Ref<Material>, Ref<Material>> mat_map;
|
|
|
|
+ Map<Ref<ArrayMesh>, Ref<ArrayMesh>> mesh_map;
|
|
|
|
|
|
bool keep_materials = bool(p_options["materials/keep_on_reimport"]);
|
|
bool keep_materials = bool(p_options["materials/keep_on_reimport"]);
|
|
|
|
|