Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix bookmark paths are now updated when loading #342

Merged
merged 4 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions PRODUCT_RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 4.12.0-prerelease9
- bugfix sequenced bookmarks paths

## 4.12.0-prerelease8
- various fixes for focal length, batch rendering
- radiometry calculation changed
Expand Down
2 changes: 1 addition & 1 deletion aardium/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "PRo3D",
"productName": "PRo3D.Viewer",
"version": "4.12.0-prerelease8",
"version": "4.12.0-prerelease9",
"description": "PRo3D, short for Planetary Robotics 3D Viewer, is an interactive 3D visualization tool to allow planetary scientists to work with high-resolution 3D reconstructions of the Martian surface.",
"license": "AGPL",
"copyright": "VRVis Zentrum für Virtual Reality und Visualisierung Forschungs-GmbH",
Expand Down
19 changes: 14 additions & 5 deletions src/PRo3D.Core/SequencedBookmarks/BookmarkUtils.fs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ open Aether
open Aether.Operators

module BookmarkUtils =
let basePathFromScenePath (scenePath : string) =
Path.combine [Path.GetDirectoryName scenePath;
Path.GetFileNameWithoutExtension scenePath]

/// Links the animation to a field in the model by registering
/// a callback that uses the given lens to modify its value as the animation progresses.
let linkPrism (lens : Prism<'Model, 'Value>) (animation : IAnimation<'Model, 'Value>) =
Expand Down Expand Up @@ -163,18 +167,23 @@ module BookmarkUtils =
{m with bookmarks = bookmarks}

/// updates the path of the bookmark with the given basePath
/// IF the bookmark is loaded the bookmark is returned as-is
/// if it is not loaded
/// loaded AND unloaded bookmarks are updated
let updatePath (basePath : string) (bm : SequencedBookmark) =
match bm with
| SequencedBookmark.LoadedBookmark loaded ->
Log.line "Updating sequenced bookmark base path from %s to %s"
(string loaded.basePath) basePath
SequencedBookmark.LoadedBookmark {loaded with basePath = Some basePath}
| SequencedBookmarks.NotYetLoaded notLoaded ->
bm
let newPath = Path.combine [basePath;Path.GetFileName notLoaded.path]
if String.equals notLoaded.path newPath then
SequencedBookmarks.NotYetLoaded notLoaded
else
Log.line "Updating sequenced bookmark path from %s to %s" notLoaded.path newPath
SequencedBookmarks.NotYetLoaded {notLoaded with path = newPath}

/// updates the path of each bookmark with the given basePath
/// IF the bookmark is loaded the bookmark is returned as-is
/// if it is not loaded
/// loaded AND unloaded bookmarks are updated
let updatePaths (basePath : string) (m : SequencedBookmarks) =
let bookmarks =
HashMap.map (fun g bm -> updatePath basePath bm) m.bookmarks
Expand Down
2 changes: 1 addition & 1 deletion src/PRo3D.Viewer/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ type Result =
result : string;
}

let viewerVersion = "4.12.0-prerelease8"
let viewerVersion = "4.12.0-prerelease9"
let catchDomainErrors = false

open System.IO
Expand Down
8 changes: 7 additions & 1 deletion src/PRo3D.Viewer/Scene.fs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,14 @@ module SceneLoader =
|> HashMap.map(fun _ x -> Leaf.Surfaces x)

let sm = { m.surfacesModel.surfaces with flat = flat' }
let sequencedBookmarks =
let basePath = PRo3D.Core.BookmarkUtils.basePathFromScenePath p
BookmarkUtils.updatePaths basePath m.sequencedBookmarks
{ m with surfacesModel = { m.surfacesModel with surfaces = sm }
sequencedBookmarks = sequencedBookmarks
}


{ m with surfacesModel = { m.surfacesModel with surfaces = sm }}
| None -> m

let private readLine (filePath:string) =
Expand Down
Loading