diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/import/editor_import_collada.cpp | 50 | ||||
-rw-r--r-- | editor/import/resource_importer_scene.cpp | 1 | ||||
-rw-r--r-- | editor/plugins/mesh_library_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/spatial_editor_plugin.cpp | 6 | ||||
-rw-r--r-- | editor/scene_tree_dock.cpp | 2 | ||||
-rw-r--r-- | editor/script_editor_debugger.h | 2 |
6 files changed, 33 insertions, 30 deletions
diff --git a/editor/import/editor_import_collada.cpp b/editor/import/editor_import_collada.cpp index e152827c63..1c4a8c43a9 100644 --- a/editor/import/editor_import_collada.cpp +++ b/editor/import/editor_import_collada.cpp @@ -1175,35 +1175,33 @@ Error ColladaImport::_create_resources(Collada::Node *p_node, bool p_use_compres morph = &collada.state.morph_controller_data_map[ngsource]; meshid = morph->mesh; - Vector<String> targets; - - morph->targets.has("MORPH_TARGET"); - String target = morph->targets["MORPH_TARGET"]; - bool valid = false; - if (morph->sources.has(target)) { - valid = true; - Vector<String> names = morph->sources[target].sarray; - for (int i = 0; i < names.size(); i++) { - - String meshid2 = names[i]; - if (collada.state.mesh_data_map.has(meshid2)) { - Ref<ArrayMesh> mesh = Ref<ArrayMesh>(memnew(ArrayMesh)); - const Collada::MeshData &meshdata = collada.state.mesh_data_map[meshid2]; - mesh->set_name(meshdata.name); - Error err = _create_mesh_surfaces(false, mesh, ng2->material_map, meshdata, apply_xform, bone_remap, skin, NULL, Vector<Ref<ArrayMesh> >(), false); - ERR_FAIL_COND_V(err, err); - - morphs.push_back(mesh); - } else { - valid = false; + if (morph->targets.has("MORPH_TARGET")) { + String target = morph->targets["MORPH_TARGET"]; + bool valid = false; + if (morph->sources.has(target)) { + valid = true; + Vector<String> names = morph->sources[target].sarray; + for (int i = 0; i < names.size(); i++) { + + String meshid2 = names[i]; + if (collada.state.mesh_data_map.has(meshid2)) { + Ref<ArrayMesh> mesh = Ref<ArrayMesh>(memnew(ArrayMesh)); + const Collada::MeshData &meshdata = collada.state.mesh_data_map[meshid2]; + mesh->set_name(meshdata.name); + Error err = _create_mesh_surfaces(false, mesh, ng2->material_map, meshdata, apply_xform, bone_remap, skin, NULL, Vector<Ref<ArrayMesh> >(), false); + ERR_FAIL_COND_V(err, err); + + morphs.push_back(mesh); + } else { + valid = false; + } } } - } - - if (!valid) - morphs.clear(); - ngsource = ""; + if (!valid) + morphs.clear(); + ngsource = ""; + } } if (ngsource != "") { diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp index 53b67c46b0..8e6a56a929 100644 --- a/editor/import/resource_importer_scene.cpp +++ b/editor/import/resource_importer_scene.cpp @@ -435,6 +435,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map<Ref<Mesh> Object::cast_to<Spatial>(sb)->set_transform(Object::cast_to<Spatial>(p_node)->get_transform()); p_node->replace_by(sb); memdelete(p_node); + p_node = NULL; CollisionShape *colshape = memnew(CollisionShape); if (empty_draw_type == "CUBE") { BoxShape *boxShape = memnew(BoxShape); diff --git a/editor/plugins/mesh_library_editor_plugin.cpp b/editor/plugins/mesh_library_editor_plugin.cpp index e582f6ded2..1fc6dae978 100644 --- a/editor/plugins/mesh_library_editor_plugin.cpp +++ b/editor/plugins/mesh_library_editor_plugin.cpp @@ -201,6 +201,8 @@ void MeshLibraryEditor::_import_scene_cbk(const String &p_str) { ERR_FAIL_COND(ps.is_null()); Node *scene = ps->instance(); + ERR_FAIL_COND(!scene); + _import_scene(scene, mesh_library, option == MENU_OPTION_UPDATE_FROM_SCENE); memdelete(scene); diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index 21349e18d4..52fadf1e71 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -69,7 +69,7 @@ #define FREELOOK_SPEED_MULTIPLIER 1.08 #define MIN_Z 0.01 -#define MAX_Z 10000 +#define MAX_Z 1000000.0 #define MIN_FOV 0.01 #define MAX_FOV 179 @@ -645,7 +645,7 @@ bool SpatialEditorViewport::_gizmo_select(const Vector2 &p_screenpos, bool p_hig Vector3 r; - if (Geometry::segment_intersects_sphere(ray_pos, ray_pos + ray * 10000.0, grabber_pos, grabber_radius, &r)) { + if (Geometry::segment_intersects_sphere(ray_pos, ray_pos + ray * MAX_Z, grabber_pos, grabber_radius, &r)) { float d = r.distance_to(ray_pos); if (d < col_d) { col_d = d; @@ -753,7 +753,7 @@ bool SpatialEditorViewport::_gizmo_select(const Vector2 &p_screenpos, bool p_hig Vector3 r; - if (Geometry::segment_intersects_sphere(ray_pos, ray_pos + ray * 10000.0, grabber_pos, grabber_radius, &r)) { + if (Geometry::segment_intersects_sphere(ray_pos, ray_pos + ray * MAX_Z, grabber_pos, grabber_radius, &r)) { float d = r.distance_to(ray_pos); if (d < col_d) { col_d = d; diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 009ac603e2..aeee829de2 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -301,6 +301,8 @@ bool SceneTreeDock::_track_inherit(const String &p_target_scene_path, Node *p_de Ref<PackedScene> data = ResourceLoader::load(path); if (data.is_valid()) { p = data->instance(PackedScene::GEN_EDIT_STATE_INSTANCE); + if (!p) + continue; instances.push_back(p); } else break; diff --git a/editor/script_editor_debugger.h b/editor/script_editor_debugger.h index 505eab266f..947b0cca52 100644 --- a/editor/script_editor_debugger.h +++ b/editor/script_editor_debugger.h @@ -173,7 +173,7 @@ class ScriptEditorDebugger : public Control { void _set_reason_text(const String &p_reason, MessageType p_type); void _scene_tree_property_select_object(ObjectID p_object); void _scene_tree_property_value_edited(const String &p_prop, const Variant &p_value); - int _update_scene_tree(TreeItem *parent, const Array &items, int current_index); + int _update_scene_tree(TreeItem *parent, const Array &nodes, int current_index); void _video_mem_request(); |