diff options
-rw-r--r-- | editor/spatial_editor_gizmos.cpp | 18 | ||||
-rw-r--r-- | modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs | 10 | ||||
-rw-r--r-- | scene/resources/packed_scene.cpp | 3 |
3 files changed, 25 insertions, 6 deletions
diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp index cfd9ec19d2..fd9e44cd5f 100644 --- a/editor/spatial_editor_gizmos.cpp +++ b/editor/spatial_editor_gizmos.cpp @@ -202,6 +202,9 @@ void EditorSpatialGizmo::add_mesh(const Ref<ArrayMesh> &p_mesh, bool p_billboard } void EditorSpatialGizmo::add_lines(const Vector<Vector3> &p_lines, const Ref<Material> &p_material, bool p_billboard) { + if (p_lines.empty()) { + return; + } ERR_FAIL_COND(!spatial_node); Instance ins; @@ -4190,8 +4193,19 @@ void JointSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) { p_gizmo->clear(); - const Spatial *node_body_a = Object::cast_to<Spatial>(joint->get_node(joint->get_node_a())); - const Spatial *node_body_b = Object::cast_to<Spatial>(joint->get_node(joint->get_node_b())); + Spatial *node_body_a = NULL; + if (!joint->get_node_a().is_empty()) { + node_body_a = Object::cast_to<Spatial>(joint->get_node(joint->get_node_a())); + } + + Spatial *node_body_b = NULL; + if (!joint->get_node_b().is_empty()) { + node_body_b = Object::cast_to<Spatial>(joint->get_node(joint->get_node_b())); + } + + if (!node_body_a && !node_body_b) { + return; + } Ref<Material> common_material = get_material("joint_material", p_gizmo); Ref<Material> body_a_material = get_material("joint_body_a_material", p_gizmo); diff --git a/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs b/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs index b9b2b0fded..c7e8ea511a 100644 --- a/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs +++ b/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs @@ -209,23 +209,25 @@ namespace GodotTools.Export string TemplateDirName() => $"data.mono.{platform}.{bits}.{target}"; string templateDirPath = Path.Combine(Internal.FullTemplatesDir, TemplateDirName()); + bool validTemplatePathFound = true; if (!Directory.Exists(templateDirPath)) { - templateDirPath = null; + validTemplatePathFound = false; if (isDebug) { target = "debug"; // Support both 'release_debug' and 'debug' for the template data directory name templateDirPath = Path.Combine(Internal.FullTemplatesDir, TemplateDirName()); + validTemplatePathFound = true; if (!Directory.Exists(templateDirPath)) - templateDirPath = null; + validTemplatePathFound = false; } } - if (templateDirPath == null) - throw new FileNotFoundException("Data template directory not found"); + if (!validTemplatePathFound) + throw new FileNotFoundException("Data template directory not found", templateDirPath); string outputDataDir = Path.Combine(outputDir, DataDirName); diff --git a/scene/resources/packed_scene.cpp b/scene/resources/packed_scene.cpp index 7d62873bbd..5ce269fff9 100644 --- a/scene/resources/packed_scene.cpp +++ b/scene/resources/packed_scene.cpp @@ -397,6 +397,9 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map if (p_owner->get_scene_inherited_state().is_null() && (p_node == p_owner || (p_node->get_owner() == p_owner && (p_node->get_parent() == p_owner || p_node->get_parent()->get_owner() == p_owner)))) { //do not save index, because it belongs to saved scene and scene is not inherited nd.index = -1; + } else if (p_node == p_owner) { + //This (hopefully) happens if the node is a scene root, so its index is irrelevant. + nd.index = -1; } else { //part of an inherited scene, or parent is from an instanced scene nd.index = p_node->get_index(); |