Merge pull request #5396 from larsbrubaker/main

main
This commit is contained in:
Lars Brubaker 2022-11-04 11:38:39 -07:00 committed by GitHub
commit 791d71a7da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 11 deletions

View file

@ -504,9 +504,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
"Cancel Print".Localize(),
"Continue Printing".Localize());
}
else if (this.TabContent is DesignTabPage partTab
&& partTab?.Workspace?.SceneContext?.Scene is InteractiveScene scene
&& scene.HasUnsavedChanges)
else if (this.TabContent is DesignTabPage partTab // we are a part tap
&& partTab?.Workspace?.SceneContext is ISceneContext sceneContext // we have a context
&& sceneContext.Scene is InteractiveScene scene // we have a scene
&& scene.HasUnsavedChanges // we have unsaved changes
&& (sceneContext.EditContext.ContentStore != null || scene.Descendants().Count() > 0)) // we are not an unsaved empty tab (new with only deleting phil)
{
StyledMessageBox.ShowYNCMessageBox(
(response) =>
@ -516,7 +518,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
case StyledMessageBox.ResponseType.YES:
UiThread.RunOnIdle(async () =>
{
var sceneContext = partTab.Workspace.SceneContext;
if (sceneContext.EditContext.ContentStore == null)
{
// If we are about to close a tab that has never been saved it will need a name before it can actually save

View file

@ -164,14 +164,22 @@ namespace MatterHackers.MatterControl.DesignTools
var currentName = SheetData[x, y].Name;
if (!string.IsNullOrEmpty(currentName))
{
existingNames.Add(currentName);
existingNames.Add(currentName.ToLower());
}
}
}
}
// first replace spaces with '_'
var name = editSelectedName.Text.Replace(' ', '_');
var reservedWords = new string[] { "pi", "e", "true", "false", "round" };
// add all the reserved words to the existing names
foreach (var reservedWord in reservedWords)
{
existingNames.Add(reservedWord);
}
// first replace spaces with '_'
var name = editSelectedName.Text.Replace(' ', '_');
// next make sure we don't have the exact name already
name = agg_basics.GetNonCollidingName(name, existingNames, false);
editSelectedName.Text = name;

View file

@ -2225,9 +2225,15 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{
if (object3D.GetBVHData().Contains(intersectionInfo.HitPosition))
{
CurrentSelectInfo.PlaneDownHitPos = intersectionInfo.HitPosition;
CurrentSelectInfo.LastMoveDelta = default(Vector3);
return object3D;
// run the same hit on this object only and see if is still the same position
var singleObjectIntersection = object3D.GetBVHData().GetClosestIntersection(ray);
if (singleObjectIntersection != null
&& singleObjectIntersection.HitPosition == intersectionInfo.HitPosition)
{
CurrentSelectInfo.PlaneDownHitPos = intersectionInfo.HitPosition;
CurrentSelectInfo.LastMoveDelta = default(Vector3);
return object3D;
}
}
}
}

@ -1 +1 @@
Subproject commit 03768ac1437d052a39a0945204e80625ad1cad80
Subproject commit 4008f642a465afdc229322751629391b8a729507