Capturing the output from a Design Review session with Visionary Render enables the insights and changes to be incorporated into external workflows.
Using LUA scripts a Visionary Render Platform developer can write code to save annotation and markup data from their scene into an external file.
This code sample scans the tree for annotation related nodes and writes them to an XML file using a simple schema. The images of the viewpoint are also saved and referenced from the XML.
local id = 1 function VisitAnnotionNodes(node) local t = vrNodeGetMetaNode(node) if t == "Annotation" then io.write("<annotation name=\"" .. node:getName() .. "\" author=\"" .. node.CreatedBy .. "\">\n") node:forEachChild(VisitAnnotionNodes) io.write("</annotation>\n") return end if t == "AnnotationComment" then io.write("<comment author=\"" .. node.CreatedBy .. "\">\n") io.write(node.Comment) io.write("\n") io.write("</comment>\n") return end if t == "Viewpoint" then local pos, rot, scale = vrNodeDecomposeTransform(node) io.write("<viewpoint position=\"" .. tostring(pos) .. "\" rotation = \"" .. tostring(rot) .. "\">\n") local tex = node:sibling("Texture") if tex then local filename = "t:\\tmp\\viewpoint-" .. id .. ".png" id = id + 1 io.write("<texture filename=\"" .. filename .. "\">\n") vrExtractBinaryAssets(tex, filename, true, vrNodeGetMetaNode(tex, true)) io.write("</texture>\n") end io.write("</viewpoint>\n") end node:forEachChild(VisitAnnotionNodes) end function SaveAnnotations(filename) local s = vrScenesNode():find("Annotations") if not s then print("Scenes/Annotations not found") return end local fd = io.open(filename, "w") if not fd then print("Failed to open " .. filename) return end io.output(fd) io.write("<annotations exported=\"" .. os.date() .. "\">\n") VisitAnnotionNodes(s) io.write("</annotations>\n") io.close(fd) end local filename = "t://tmp//annotations.xml"; SaveAnnotations(filename)
Example output from the script is this:
<annotations exported="Mon Jun 10 10:03:55 2019"> <annotation name="Cube" author="Barry King"> <viewpoint position="-38.191717, 28.456570, -64.153620" rotation = "0.000000, 269.624903, 0.000000"> <texture /> </viewpoint> <comment author="Barry King"> This is some comment text. It may be on multiple lines. (Use Shift+Enter to insert a newline) </comment> </annotation> <annotation name="Cube" author="Barry King"> <viewpoint position="-38.191717, 28.456570, -64.153620" rotation = "0.000000, 269.624903, 0.000000"> <texture /> </viewpoint> <comment author="Barry King"> stuff </comment> <comment author="Barry King"> more stuff </comment> </annotation> <annotation name="Cube" author="Barry King"> <viewpoint position="-38.191717, 28.456570, -64.153620" rotation = "0.000000, 269.624903, 0.000000"> <texture /> </viewpoint> <comment author="Barry King"> well snap </comment> </annotation> </annotations>