From 7db4f4e793447f4e2a723f17d387fad75f79443d Mon Sep 17 00:00:00 2001 From: brutzman <brutzman@nps.edu> Date: Sun, 26 Jan 2020 11:43:42 -0800 Subject: [PATCH] provide consolidated processScenes.captureImages for thumbnail + viewpoints of each updated .x3d file (compared to .html) --- build.xml | 247 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 229 insertions(+), 18 deletions(-) diff --git a/build.xml b/build.xml index a1e672fb8c..fbb877a762 100644 --- a/build.xml +++ b/build.xml @@ -2266,12 +2266,12 @@ ignoreSetupDownloadErrors=true <target name="processScenes" description="process all scenes with all conversion tasks" depends="get.saxon"> <echo>TODO: note that if Viewpoint descriptions changed, or the visible rendered scene changed,</echo> <echo> then you must delete the pretty-print .html version in order to trigger target task</echo> - <echo> processScenes.captureViewpointImages that regenerates the viewpoint snapshot images.</echo> + <echo> processScenes.captureViewpoints that regenerates the viewpoint snapshot images.</echo> <!-- processScenes.regularExpressionChecks occurs first because provides diagnostic scene correctness checks --> <!-- processScenes.canonicalX3D occurs second because it replaces original .x3d scene --> <!-- processScenes.X3DtoVRML97 occurs third because provides diagnostic scene correctness checks --> <!-- processScripts.jslint, X3dToJson occur fourth,fifth & provide diagnostic script correctness checks --> - <!-- processScenes.captureViewpointImages occurs sixth because it must be performed before processScenes.X3dToHtmlListing --> + <!-- processScenes.captureViewpoints occurs sixth because it must be performed before processScenes.X3dToHtmlListing --> <!-- this task depends on other tasks to look through the directories, only updating as needed --> <antcall target="processScenes.regularExpressionChecks"/> <antcall target="processScenes.canonicalX3D"/> @@ -2286,9 +2286,9 @@ ignoreSetupDownloadErrors=true <antcall target="processScenes.X3dToX3domXhtml"/> <antcall target="processScenes.X3dToX3dvClassicVrmlEncoding"/> <antcall target="processScenes.X3dToX3dbCompressedBinaryEncoding"/> - <!-- processScenes.captureThumbnailImages, captureViewpointImages conversions should precede processScenes.X3dToHtmlListing --> - <antcall target="processScenes.captureThumbnailImages"/> - <antcall target="processScenes.captureViewpointImages"/> + <!-- processScenes.captureThumbnails, captureViewpointImages conversions should precede processScenes.X3dToHtmlListing --> + <antcall target="processScenes.captureThumbnails"/> + <antcall target="processScenes.captureViewpoints"/> <antcall target="processScenes.X3dToHtmlListing"/> <echo message="${archive.name} processScenes complete."/> </target> @@ -3108,12 +3108,12 @@ TODO: fix Xj3D from launching window, instead perform offline rendering while h possibly by using xvfb X-windows virtual frame buffer --> - <target name="processScenes.captureViewpointImages" depends="get.saxon,platformInitialize" - description="use Xj3D to create snapshot pictures of each viewpoint, triggered by html and then updates html"> - <echo message="use Xj3D to create snapshot pictures of each viewpoint, triggered by html and then updates html"/> + <target name="processScenes.captureViewpoints" depends="get.saxon,platformInitialize" + description="use Xj3D to create snapshot pictures of each viewpoint, triggered by html timestamp and then updates html"> + <echo message="use Xj3D to create snapshot pictures of each viewpoint, triggered by html timestamp and then updates html"/> <echo message="optional prerequisite: clean.htmlPrettyPrintDocumentation prior to reshooting all images"/> <echo message="rework usually minimized by only regenerating images for each triggering .html change as needed."/> - <echo message="processScenes.captureViewpointImages depends on local Xj3D installation, current directory xj3d.dir=${xj3d.dir}"/> + <echo message="processScenes.captureViewpoints depends on local Xj3D installation, current directory xj3d.dir=${xj3d.dir}"/> <!-- TODO -Djava.library.path needs to point to odejava64.dll driver, or jogl.dll driver??? --> <echo message="-Djava.library.path=${xj3d.dir.jars}/../${native.library.path}"/> <!-- TODO -Djava.ext.dirs=??? --> @@ -3284,25 +3284,236 @@ app.replica.args=-mode scene -mipmaps -antialias 8 -anisotropicDegree 16 -verbos </else> </if> <antcall target="echo.timestamp"/> - <echo>processScenes.captureViewpointImages complete.</echo> + <echo>processScenes.captureViewpoints complete.</echo> </target> - <target name="processScenes.captureImages" description="reshoot all thumbnail and viewpoint images"> + <target name="processScenes.captureThumbnailsViewpoints" description="reshoot all thumbnail and viewpoint images"> <echo message="reshoot all thumbnail and viewpoint images"/> <echo message="optional prerequisite: clean.htmlPrettyPrintDocumentation prior to reshooting all images"/> - <antcall target="processScenes.captureThumbnailImages"/><!-- triggered by html but does not update html --> + <antcall target="processScenes.captureThumbnails"/><!-- triggered by html but does not update html --> <echo message="- - - - - - - - - - - - - - - - - - - -"/> - <antcall target="processScenes.captureViewpointImages"/><!-- triggered by html and then updates html --> - <echo message="processScenes.captureAllImages complete, htmlPrettyPrintDocumentation updated."/> + <antcall target="processScenes.captureViewpoints"/><!-- triggered by html and then updates html --> + <echo message="processScenes.captureThumbnailsViewpoints complete, htmlPrettyPrintDocumentation updated."/> <echo message="- - - - - - - - - - - - - - - - - - - -"/> </target> - <target name="processScenes.captureThumbnailImages" + <target name="processScenes.captureImages" + description="use Xj3D's Replica class to create thumbnails and viewpoint images for each scene for use as icons, triggered by html timestamp then updates html"> + <echo message="optional prerequisite: clean.htmlPrettyPrintDocumentation prior to reshooting all images"/> + <echo message="rework usually minimized by only regenerating images for each triggering .html change as needed."/> + <echo message="processScenes.captureImages depends on local Xj3D installation, current directory xj3d.dir=${xj3d.dir}"/> + <!-- TODO -Djava.library.path needs to point to odejava64.dll driver, or jogl.dll driver??? --> + <echo message="-Djava.library.path=${xj3d.dir.jars}/../${native.library.path}"/> + <!-- TODO -Djava.ext.dirs=??? --> + <echo message="-Djava.ext.dirs=???"/> + <!-- output help for Replica --> + <java classname="xj3d.replica.Replica" fork="${fork}" dir="."> + <classpath> + <pathelement path="${classpath}"/> + <fileset refid="xj3d.jars.all"/> + </classpath> + <!-- -Djava.library.path needs to point to jogl.dll driver --> + <jvmarg value="-Djava.library.path=${xj3d.dir.jars}/../${native.library.path}"/> + <!-- Xj3D run.args --> + <arg value="-help"/> + </java> + <if> + <not> + <equals arg1="${jenkins.prepared}" arg2="true" /> + </not> + <then> + <for param="file.path.name"> + <path> + <fileset refid="x3dScenes"/> + </path> + <sequential> + <propertyregex + property="name.short" + override="true" + input="@{file.path.name}" + regexp="([^\n]*)[\\/]([^\n]*)\.x3d" + select="\2"/> + <propertyregex + property="relative.path1" + override="true" + input="@{file.path.name}" + regexp="([^\n]*)Savage[\\/]([^\n^\\^/]*)[\\/]([^\n]*)\.x3d" + select="\2"/> + <propertyregex + property="relative.path2" + override="true" + input="@{file.path.name}" + regexp="([^\n]*)Savage[\\/]([^\n^\\^/]*)[\\/]([^\n^\\^/]*)([\\/][^\n]*)\.x3d" + select="\3"/> + <!-- trace + <echo></echo> + <echo>@file.path.name = @{file.path.name}</echo> + <echo>$archive.path = ${archive.path}</echo> + <echo>$relative.path1 = ${relative.path1}</echo> + <echo>$relative.path2 = ${relative.path2}</echo> + <echo>$name.short = ${name.short}</echo> + --> + <outofdate> + <sourcefiles> + <filelist> + <file name="${archive.path}/${relative.path1}/${relative.path2}/${name.short}.x3d"/> + </filelist> + </sourcefiles> + <!-- match pretty-print .html creation as the trigger for viewpoint capture --> + <mapper dir="." type="glob" from="*.x3d" to="*.html"/> + <!-- note: targetfiles match with image filenames is not working, probably due to * wildcard. + also note that viewpoint image names are multiple, and each are variations on the original filename. + attempted invocations follow. + <targetfiles> + <pathelement path="${archive.path}/${relative.path1}/${relative.path2}/_viewpoints/${name.short}.x3d.*.png"/> + </targetfiles> + or + <mapper dir="." type="glob" from="*.x3d" to="_viewpoints/*.png"/> + --> + <sequential> + <!-- process individual files here. show full path to facilitate user loading, editing of reported files --> + <echo>============================================================================================================ </echo> + <echo>Xj3D Replica generation of Thumbnail (icon) image for:</echo> + <echo>${archive.path}/${relative.path1}/${relative.path2}/${name.short}.x3d</echo> + <mkdir dir="${relative.path1}/${relative.path2}/_thumbnails"/> + <var name="outfilePath" value="${relative.path1}/${relative.path2}/_thumbnails/${name.short}Thumbnail.png"/> + <!-- copy default thumbnail image as destination file to indicate if failure occurs and avoid repeated hangups --> + <copy file="../images/Xj3dRenderCaptureFailed.png" tofile="${outfilePath}" overwrite="true" verbose="true"/> + + <java classname="xj3d.replica.Replica" fork="${fork}" dir="." failonerror="false"> + <classpath> + <pathelement path="${classpath}"/> + <fileset refid="xj3d.jars.all"/> + </classpath> + <!-- -Djava.library.path needs to point to jogl.dll driver --> + <jvmarg value="-Djava.library.path=${xj3d.dir.jars}/../${native.library.path}"/> + <jvmarg value="-Djava.ext.dirs="/> + <!-- Replica run.args --> + <arg value="-mode"/><arg value="thumbnail"/> + <arg value="-mipmaps"/> + <arg value="-antialias"/><arg value="8"/> + <arg value="-anisotropicDegree"/><arg value="16"/> + <arg value="-quiet"/> <!-- -verbose or -quiet --> + <arg value="-size"/><arg value="128x128"/> + <arg value="-view"/><arg value="AUTO"/> <!-- Fit to world --> + <arg value="-outfile"/><arg value="${outfilePath}"/> <!-- output directory and file name --> + <arg value="-threepointlight"/> + <arg value="-timeout"/><arg value="10000"/><!-- ms --> + <arg value="--illegal-access=warn"/><!-- enable warnings of further illegal reflective access operations --> + <arg value="${relative.path1}/${relative.path2}/${name.short}.x3d"/> <!-- sceneFile --> + </java> + <!-- process individual files here. show full path to facilitate user loading, editing of reported files --> + <echo>============================================================================================================ </echo> + <echo>Xj3D generation of Viewpoint images for:</echo> + <echo>${archive.path}/${relative.path1}/${relative.path2}/${name.short}.x3d</echo> + <echo>Image output files each saved as: ${archive.path}/${relative.path1}/${relative.path2}/_viewpoints/${name.short}.x3d._VP_viewpoint_description.png</echo> + <mkdir dir="${relative.path1}/${relative.path2}/_viewpoints"/> + + <!-- + <java classname="xj3d.browser.Xj3DBrowser" fork="${fork}" dir="."> + <classpath> + <pathelement path="${classpath}"/> + <fileset refid="xj3d.jars.all"/> + </classpath> + < ! - - -Djava.library.path needs to point to jogl.dll driver - - > + <jvmarg value="-Djava.library.path=${xj3d.dir.jars}/../${native.library.path}"/> + <arg value="-captureViewpoints"/> + <arg value="-disableAudio"/> + <arg value="${relative.path1}/${relative.path2}/${name.short}.x3d"/> + </java> + --> + <!-- see Xj3D/nbprojects/ide-file-targets.xml for example: + + <java classname="${replica}" dir="${replica.dir}" fork="false"> + <classpath refid="app.classpath"/> + <jvmarg line="${run.args}"/> + <arg line="${app.replica.args} ${scene.name} -outdir '${basedir}/${test.products.dir}' '${scene.path}'"/> + </java> + --> + <java classname="xj3d.replica.Replica" fork="${fork}" dir="." failonerror="false"> + <classpath> + <pathelement path="${classpath}"/> + <fileset refid="xj3d.jars.all"/> + </classpath> + <!-- -Djava.library.path needs to point to jogl.dll driver --> + <jvmarg value="-Djava.library.path=${xj3d.dir.jars}/../${native.library.path}"/> + <jvmarg value="-Djava.ext.dirs="/> + <!-- Xj3D run.args --> + <arg value="-mode"/><arg value="viewpoints"/> + <arg value="-mipmaps"/> + <arg value="-antialias"/><arg value="8"/> + <arg value="-anisotropicDegree"/><arg value="16"/> + <arg value="-quiet"/> <!-- -verbose or -quiet --> + <arg value="-stats"/> + <arg value="-size"/><arg value="792x465"/> + <arg value="-timeout"/><arg value="10000"/><!-- ms --> + <arg value="--illegal-access=warn"/><!-- enable warnings of further illegal reflective access operations --> + <!-- <arg value="-view"/><arg value="ICON_VIEWPOINT"/> --> + <arg value="-filePrefix"/><arg value="${name.short}"/> + <arg value="-outdir"/><arg value="${relative.path1}/${relative.path2}/_viewpoints"/> <!-- output directory --> + <arg value="${relative.path1}/${relative.path2}/${name.short}.x3d"/> + </java> + +<!-- reference for Xj3D screenshot from Xj3D NPS branch build.xml and build.properties invocations: + +# mode can be thumbnail=ThumbnailImager, scene=SceneThumbnailImager, or sequence=SceneRecorder. +app.replica.args=-mode scene -mipmaps -antialias 8 -anisotropicDegree 16 -verbose -stats -size 256x256 -filePrefix + + <target name="run.replica" + depends="init" + if="replica.class.present" + description="Run the Xj3D Replica App"> + + <echo></echo> + <echo>Processing ${scene}</echo> + <echo></echo> + + <java classname="${replica}" dir="${replica.dir}" fork="false"> + <classpath refid="app.classpath"/> + <jvmarg line="${run.args}"/> + + <arg line="${app.replica.args} testCapture ${scene}"/> + </java> + <echo message="Look in ${replica.dir}/output for result"/> + </target> +--> + + <!-- Xj3D leaves images in same directory as file, rather than launch directory, and so move them to _viewpoints directory. --> + <!-- + <move todir="${relative.path1}/${relative.path2}/_viewpoints" verbose="true"> + <fileset dir="${relative.path1}/${relative.path2}"> + <include name="${name.short}.x3d.*.png"/> + </fileset> + </move> --> + + <!-- X3dToXhtml.xslt process individual files here. show full path to facilitate user loading, editing of reported files --> + <echo>${archive.path}/${relative.path1}/${relative.path2}/${name.short}.x3d processing with X3dToXhtml stylesheet pretty-print .html</echo> + <!-- Saxon9 is locally defined macro --> + <Saxon9 scene="${relative.path1}/${relative.path2}/${name.short}" + stylesheet="${stylesheet.dir}/X3dToXhtml" + extension="html" + parameterPair1="linkImages=true"/> + <!-- TODO -dtd:off --> + </sequential> + </outofdate> + </sequential> + </for> + </then> + <else> + <echo message="No viewpoint capture when run on jenkins server"/> + </else> + </if> + + <antcall target="echo.timestamp"/> + <echo>processScenes.captureImages complete, htmlPrettyPrintDocumentation updated.</echo> + </target> + + <target name="processScenes.captureThumbnails" description="use Xj3D's Replica class to create thumbnails of each scene for use as icons, triggered by html but does not update html"> - <echo message="use Xj3D's Replica class to create thumbnails of each scene for use as icons, triggered by html but does not update html"/> + <echo message="use Xj3D's Replica class to create thumbnails of each scene for use as icons, triggered by missing image, does not update html"/> <echo message="optional prerequisite: clean.htmlPrettyPrintDocumentation prior to reshooting all images"/> <echo message="rework usually minimized by only regenerating images for each triggering .html change as needed."/> - <echo message="processScenes.captureThumbnailImages depends on local Xj3D installation, current directory xj3d.dir=${xj3d.dir}"/> + <echo message="processScenes.captureThumbnails depends on local Xj3D installation, current directory xj3d.dir=${xj3d.dir}"/> <!-- TODO -Djava.library.path needs to point to odejava64.dll driver, or jogl.dll driver??? --> <echo message="-Djava.library.path=${xj3d.dir.jars}/../${native.library.path}"/> <!-- TODO -Djava.ext.dirs=??? --> @@ -3380,7 +3591,7 @@ app.replica.args=-mode scene -mipmaps -antialias 8 -anisotropicDegree 16 -verbos </sequential> </for> <antcall target="echo.timestamp"/> - <echo>processScenes.captureThumbnailImages complete.</echo> + <echo>processScenes.captureThumbnails complete.</echo> <echo/> </target> -- GitLab