Skip to content

Commit 7e62378

Browse files
committed
references to external material
Adds references to external material. * Logo and docs in the readme * OpenVDBDocumentation[], which can open the docs in a web browser or download them locally. Signed-off-by: ghurstunither <[email protected]>
1 parent 24aa6a1 commit 7e62378

File tree

2 files changed

+132
-2
lines changed

2 files changed

+132
-2
lines changed

openvdb_wolfram/OpenVDBLink/OpenVDBLink.m

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,16 @@
3535
PackageExport["$OpenVDBInstallationDirectory"]
3636

3737

38+
PackageExport["OpenVDBDocumentation"]
39+
40+
3841
$OpenVDBLibrary::usage = "$OpenVDBLibrary is the full path to the OpenVDB Library loaded by OpenVDBLink.";
3942
$OpenVDBInstallationDirectory::usage = "$OpenVDBInstallationDirectory gives the top-level directory in which your OpenVDB installation resides.";
4043

4144

45+
OpenVDBDocumentation::usage = "OpenVDBDocumentation[] opens the OpenVDBLink documentation.\nOpenVDBDocumentation[\"Web\"] opens the OpenVDBLink in a web browser.";
46+
47+
4248
OpenVDBLink`Developer`Recompile::usage = "OpenVDBLink`Developer`Recompile[] recompiles the OpenVDB library and reloads the functions.";
4349

4450

@@ -1214,3 +1220,125 @@
12141220

12151221

12161222
carefulPixelGridQ[vdb_] := OpenVDBGridQ[vdb] && pixelGridQ[vdb]
1223+
1224+
1225+
(* ::Section:: *)
1226+
(*Documentation*)
1227+
1228+
1229+
(* ::Subsection::Closed:: *)
1230+
(*OpenVDBDocumentation*)
1231+
1232+
1233+
(* ::Subsubsection::Closed:: *)
1234+
(*OpenVDBDocumentation*)
1235+
1236+
1237+
OpenVDBDocumentation[args___] /; !CheckArgs[OpenVDBDocumentation[args], {0, 1}] = $Failed;
1238+
1239+
1240+
OpenVDBDocumentation[args___] :=
1241+
With[{res = iOpenVDBDocumentation[args]},
1242+
res /; res =!= $Failed
1243+
]
1244+
1245+
1246+
OpenVDBDocumentation[args___] := mOpenVDBDocumentation[args]
1247+
1248+
1249+
(* ::Subsubsection::Closed:: *)
1250+
(*iOpenVDBDocumentation*)
1251+
1252+
1253+
iOpenVDBDocumentation[] := iOpenVDBDocumentation["Notebook"]
1254+
1255+
1256+
iOpenVDBDocumentation["Web"] := SystemOpen[$vdbWebDocURL]
1257+
1258+
1259+
iOpenVDBDocumentation["Notebook"] := notebookDocumentation[]
1260+
1261+
1262+
iOpenVDBDocumentation["Update"] :=
1263+
(
1264+
Quiet[DeleteFile[$vdbDoc]];
1265+
notebookDocumentation[]
1266+
)
1267+
1268+
1269+
iOpenVDBDocumentation[___] = $Failed;
1270+
1271+
1272+
(* ::Subsubsection::Closed:: *)
1273+
(*Argument conform & completion*)
1274+
1275+
1276+
SyntaxInformation[OpenVDBDocumentation] = {"ArgumentsPattern" -> {_.}};
1277+
1278+
1279+
addCodeCompletion[OpenVDBDocumentation][{"Web", "Notebook", "Update"}];
1280+
1281+
1282+
(* ::Subsubsection::Closed:: *)
1283+
(*notebookDocumentation*)
1284+
1285+
1286+
notebookDocumentation[] /; FileExistsQ[$vdbDoc] := NotebookOpen[$vdbDoc]
1287+
1288+
1289+
notebookDocumentation[] :=
1290+
Block[{zip},
1291+
If[!FileExistsQ[$vdbDocDir],
1292+
CreateDirectory[$vdbDocDir];
1293+
];
1294+
1295+
zip = URLDownload[$vdbDocURL, $vdbDocDir];
1296+
(
1297+
Quiet[
1298+
ExtractArchive[zip, $vdbDocDir, FileNameTake[$vdbDoc]];
1299+
DeleteFile[zip];
1300+
];
1301+
1302+
NotebookOpen[$vdbDoc] /; FileExistsQ[$vdbDoc]
1303+
1304+
) /; FileExistsQ[zip]
1305+
]
1306+
1307+
1308+
notebookDocumentation[___] = $Failed;
1309+
1310+
1311+
(* ::Subsubsection::Closed:: *)
1312+
(*Documentation paths and URLs*)
1313+
1314+
1315+
$vdbDocDir = FileNameJoin[{$UserBaseDirectory, "ApplicationData", "OpenVDBLink"}];
1316+
1317+
1318+
$vdbDoc = FileNameJoin[{$vdbDocDir, "OpenVDBLink.nb"}];
1319+
1320+
1321+
$vdbDocURL = "https://www.openvdb.org/download/files/OpenVDBLink.nb.zip";
1322+
1323+
1324+
$vdbWebDocURL = "https://www.openvdb.org/documentation/wolfram";
1325+
1326+
1327+
(* ::Subsubsection::Closed:: *)
1328+
(*Messages*)
1329+
1330+
1331+
mOpenVDBDocumentation[type_] :=
1332+
(
1333+
If[type =!= "Web" && type =!= "Notebook",
1334+
Message[OpenVDBDocumentation::type, type, 1];
1335+
];
1336+
1337+
$Failed
1338+
)
1339+
1340+
1341+
mOpenVDBDocumentation[___] = $Failed;
1342+
1343+
1344+
OpenVDBDocumentation::type = "`1` at position `2` is not one of \"Web\", \"Notebook\", or \"Update\".";

openvdb_wolfram/OpenVDBLink/Readme.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
logo?
1+
![OpenVDBLink](https://www.openvdb.org/images/openvdblink_logo.png)
22

33
# OpenVDBLink
44
OpenVDBLink provides a Mathematica interface to [OpenVDB](https://www.openvdb.org), an efficient sparse voxel data structure ubiquitous in the VFX industry. This link ports over access to various grid containers including level sets, fog volumes, vector grids, integer grids, Boolean grids, and mask grids. Construction, modification, combinations, visualisations, queries, import, export, etc. can be achieved over grids too. Any Mathematica 3D region that's ConstantRegionQ and BoundedRegionQ can be represented as a level set grid, providing a more seamless integration with OpenVDB.
@@ -13,7 +13,9 @@ OpenVDB is an Academy Award-winning open-source C++ library comprising a novel h
1313

1414
### Documentation
1515

16-
* [URL to docs?](.....)
16+
* [Web version](https://www.openvdb.org/documentation/wolfram)
17+
* [Notebook version](https://www.openvdb.org/download/files/OpenVDBLink.nb.zip)
18+
* Access documentation in a Wolfram notebook with `OpenVDBDocumentation[]`.
1719

1820
### Loading
1921

0 commit comments

Comments
 (0)