<div dir="ltr"><div dir="ltr">May I suggest @sourceCode as a good alternative to #sourceCode in JSON? The @ or - preceding the property name symbolizes that it came from X3DUOM, so things like #comment and #sourceCode are handled outside X3DUOM, AFAIK, and things like @sourceCode are specified by X3DUOM.</div><div dir="ltr"><br></div><div>What I'm thinking is that #sourceCode will make JSON schema generation from X3DUOM more difficult. I'm not sure how much at this time. What I may do is ignore the X3DUOM version of sourceCode and forge ahead with #sourceCode by hard coding in the JSON schema generator, similar to #sourceText</div><div><br></div><div>In any case, I think that @sourceCode, #sourceText and #sourceCode should all be supported, with warnings, if possible.</div><div><br></div><div>I'm going to write code that supports #sourceCode in the JSON schema generator now.</div><div><br></div><div>What do you think?</div><div><br></div><div>John</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Jan 15, 2022 at 3:45 PM Brutzman, Donald (Don) (CIV) <<a href="mailto:brutzman@nps.edu">brutzman@nps.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div lang="EN-US" style="overflow-wrap: break-word;">
<div class="gmail-m_-8374108212063145950WordSection1">
<p class="MsoNormal">Thanks for all feedback, Holger and John.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Simple proposal for the moment: am working to demonstrate consistently unescaped script code within Script node. We achieved that capability with X3D JSON draft encoding, but didn’t use it anywhere else.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">While adding the capability to X3DUOM and Java (so far), it became obvious that the term “sourceText” is ambiguous since typically the entire model consists of source text (for XML, ClassicVRML, source code, etc.)<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">This name is not yet in any of our X3D specifications so we are free to change it… am suggesting “sourceCode” as a less ambiguous name, for containing unescaped source code within Script, ShaderProgram or ShaderPart node.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">No further improvements to “sourceCode” yet heard – if that name is OK, then great. It seems clear when used in a sentence.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">We can certainly carry forward code support for the original “sourceText” for a while, not trying to break experimental code/model implementation and evaluation, but am thinking that we don’t want to perpetuate two names forever, since
that just leads to confusion and inconsistency in years to come.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<ul style="margin-top:0in" type="disc">
<li class="gmail-m_-8374108212063145950MsoListParagraph" style="margin-left:0in">Wikipedia: Don't repeat yourself (DRY principle)<u></u><u></u></li><li class="gmail-m_-8374108212063145950MsoListParagraph" style="margin-left:0in"><a href="https://en.wikipedia.org/wiki/Don't_repeat_yourself" target="_blank">https://en.wikipedia.org/wiki/Don't_repeat_yourself</a><u></u><u></u></li></ul>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Hope this sounds sensible... thanks for continuing consideration.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I’ll work on adding “sourceCode” capabilities to X3DPSAIL Python and X3D Ontology Turtle next, continuing with regression testing.<u></u><u></u></p>
<div>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">all the best, Don<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">-- <u></u>
<u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">Don Brutzman Naval Postgraduate School, Code USW/Br <a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">Watkins 270, MOVES Institute, Monterey CA 93943-5000 USA +1.831.656.2149<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">X3D graphics, virtual worlds, Navy robotics https://</span>
<span style="font-size:10pt;font-family:"Courier New""><a href="http://faculty.nps.edu/brutzman" target="_blank">faculty.nps.edu/brutzman</a><u></u><u></u></span></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0in 0in">
<p class="MsoNormal"><b>From:</b> x3d-public <<a href="mailto:x3d-public-bounces@web3d.org" target="_blank">x3d-public-bounces@web3d.org</a>> <b>On Behalf Of
</b>Holger Seelig<br>
<b>Sent:</b> Saturday, January 15, 2022 1:28 PM<br>
<b>To:</b> X3D <<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a>><br>
<b>Subject:</b> Re: [x3d-public] Possible issue with X3dToPython.xslt, newly tested file from X3D4WA: need x3d.py python support for Script CDATA<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">A good way to implement changes in parser/generator is to output new style code, and parse new and old style code, ie. be backwardly compatible. It depends on how much changes in X3D JSON encoding. If it is only the change of #sourceText
to #sourceCode then it is very easy to provide both variations. If it is more than this, a detailed list of changes would be very useful.<u></u><u></u></p>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Best regards,<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">Holger<u></u><u></u></p>
<div>
<p class="MsoNormal"><br>
<br>
<u></u><u></u></p>
<blockquote style="margin-top:5pt;margin-bottom:5pt">
<div>
<p class="MsoNormal">Am 15.01.2022 um 22:12 schrieb John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>>:<u></u><u></u></p>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">In other words, let’s fix known problems before creating new ones.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Thanks!<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">John<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Sat, Jan 15, 2022 at 3:06 PM John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<div>
<p class="MsoNormal">It’s higher priority for me to fix the X3dToJson.xslt so that Navigation.type produces a consistent type of data. At this time, I don’t know if it produces a JSON string or a JSON array. I believe the JSON Schema says array. If we want
it to be a string, okay, but can we change all other MFStrings to output JSON strings in X3dToJson.xslt?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">Maybe I missed an email on this?<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">John<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Sat, Jan 15, 2022 at 2:52 PM John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<div>
<p class="MsoNormal">It’s just that people may already have JSON files working with X_ITE. We will have to go through regression testing etc. We don’t have scripting with X3DOM working yet except on some of my published work. And even some of that is not
working. AFAIK, all my scripts work ok in X_ITE. So I would encourage us to tread carefully when modifying JSONParser.js in X_ITE, and provide for a deprecation period.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I don’t have to retest my shaders—they are in external files.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">If we decide to force a change to X3D JSON Schema, I will probably slowly deprecate #sourceText in favor of sourceCode, but I doubt if all this will happen overnight. My surgery was postponed and I want to minimize impact on my wrists
right now. That is, I will support sourceCode and sourceText in parallel. I will have to figure out how the new X3DUOM impacts all my python generators as well.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I’m guessing you don’t actually have any Scripting working on those older products you mention, so it didn’t really impact you until you wanted to do python+scripting in Jupyter.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I will look a bit into X3DUOM changes to see how much my other code is impacted, or can be enhanced.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">There’s also probably X3DJSONLD.java and X3DJSONLD.cpp that need to be changed.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I would encourage maintaining at least a synonym “#sourceText” for sourceCode.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">We should probably create a plan for updating JSONParser.js in X_ITE.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">I’m not really sure there will ever be a JSON encoding for X3D, but I’m glad X3dToJson.xslt is being maintained as I don’t have a good replacement yet.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">“someday” is today for me. What will it take to make X3D JSON a standard? We already have two working implementations, AFAIK.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<p class="MsoNormal">John<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div>
<p class="MsoNormal">On Sat, Jan 15, 2022 at 1:12 PM Brutzman, Donald (Don) (CIV) <<a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal">I’ve got X3DUOM and Java working on my machine. Python, X3D Ontology and Tooltips next.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">John, can we please change the JSON encoding to use “<span style="color:black;background:yellow">sourceCode</span>” instead of
<span style="color:black;background:yellow">sourceText</span> for consistency? I don’t think there is any need for synonyms or backwards compatibility, the encoding hasn’t been formalized yet and (someday) JSON Schema will help people confirm correctness.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<ul type="disc">
<li class="MsoNormal">
X3D to JSON Stylesheet Converter: Data Types<u></u><u></u></li><li class="MsoNormal">
<a href="https://www.web3d.org/x3d/stylesheets/X3dToJson.html#DataTypes" target="_blank">https://www.web3d.org/x3d/stylesheets/X3dToJson.html#DataTypes</a><u></u><u></u></li></ul>
<div>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New""> </span><u></u><u></u></p>
<div align="center">
<table border="1" cellspacing="5" cellpadding="0">
<tbody>
<tr>
<td style="padding:0.6pt">
<p class="MsoNormal"><span style="font-family:"Times New Roman",serif">Embedded source code for<br>
<a href="https://www.web3d.org/x3d/content/X3dTooltips.html#Script" target="_blank">Script</a>, <a href="https://www.web3d.org/x3d/content/X3dTooltips.html#ShaderPart" target="_blank">ShaderPart</a> and <a href="https://www.web3d.org/x3d/content/X3dTooltips.html#ShaderProgram" target="_blank">ShaderProgram</a> nodes</span><u></u><u></u></p>
</td>
<td style="padding:0.6pt">
<p class="MsoNormal"><span style="font-family:"Times New Roman",serif">CDATA (Character DATA) section<br>
</span><span style="font-size:10pt;font-family:"Courier New""><[CDATA[ "world wild Web!" ]]></span><u></u><u></u></p>
</td>
<td style="padding:0.6pt">
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">"#<span style="color:black;background:yellow">sourceText</span>"</span><span style="font-family:"Times New Roman",serif"> string
array containing original code, possibly escaped</span><u></u><u></u></p>
</td>
</tr>
</tbody>
</table>
</div>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New";color:white"> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New""> </span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">all the best, Don</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">--
</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">Don Brutzman Naval Postgraduate School, Code USW/Br
<a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a></span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">Watkins 270, MOVES Institute, Monterey CA 93943-5000 USA +1.831.656.2149</span><u></u><u></u></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:"Courier New"">X3D graphics, virtual worlds, Navy robotics https://</span>
<span style="font-size:10pt;font-family:"Courier New""><a href="http://faculty.nps.edu/brutzman" target="_blank">faculty.nps.edu/brutzman</a></span><u></u><u></u></p>
</div>
</div>
</div>
<div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<div style="border-right:none;border-bottom:none;border-left:none;border-top:1pt solid rgb(225,225,225);padding:3pt 0in 0in">
<p class="MsoNormal"><b>From:</b> John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>>
<br>
<b>Sent:</b> Friday, January 14, 2022 5:25 AM<br>
<b>To:</b> Brutzman, Donald (Don) (CIV) <<a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a>><br>
<b>Cc:</b> X3D Graphics public mailing list <<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a>><br>
<b>Subject:</b> Re: Possible issue with X3dToPython.xslt, newly tested file from X3D4WA: need x3d.py python support for Script CDATA<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">I finally got a chance to think about this, and I think it will be good to support legacy files by providing a synonym for “#sourceText”—“sourceCode” as you say. If a particular
binding can’t provide for #sourceText, then sourceCode can be used as a fallback.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">We can discuss changes to the JSON WD Draft at some point.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">We will have to update X3D JSON schema as previously discussed implicitly.<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal">John <u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"> <u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">On Tue, Jan 11, 2022 at 1:03 AM Brutzman, Donald (Don) (CIV) <<a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a>> wrote:<u></u><u></u></p>
</div>
<blockquote style="border-top:none;border-right:none;border-bottom:none;border-left:1pt solid rgb(204,204,204);padding:0in 0in 0in 6pt;margin:5pt 0in 5pt 4.8pt">
<p class="MsoNormal">1. Following some initial testing, am happy to report that this approach to embed source code in Script nodes seems consistently feasible for X3DUOM, Python, Java and X3D Ontology
all at once.<br>
<br>
It will take a little work to fully implement, but it should improve the expressive power (meaning "fix a hole") in each of our programming-language bindings.<br>
<br>
------<br>
<br>
2. In some sense embedding script code is already possible - you can put such a program in first string contained in a Script url list - but in practice that tends to be quite difficult because then all sorts of obfuscating escaping of special characters has
to take place.<br>
<br>
So having a separate place for source-code blocks is very helpful. The X3D Architecture recognizes this possibility and defines corresponding behaviors. Further details can be found in X3D XML Encoding.<br>
<br>
* X3D4 Architecture, clause 19 Scripting component, 29.4.1 Script<br>
* <a href="https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-CD1/Part01/components/scripting.html#Script" target="_blank">
https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-CD1/Part01/components/scripting.html#Script</a><br>
<br>
* X3D4 Architecture, 9.2.3 Scripting language protocols<br>
<a href="https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-CD1/Part01/components/networking.html#ScriptingLanguageProtocols" target="_blank">https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-CD1/Part01/components/networking.html#ScriptingLanguageProtocols</a><br>
<br>
* X3D XML Encoding, Clause 4 Concepts, 4.3.13 Encapsulating Script node code<br>
<a href="https://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/concepts.html#EncapsulatingScriptNodeCode" target="_blank">https://www.web3d.org/documents/specifications/19776-1/V3.3/Part01/concepts.html#EncapsulatingScriptNodeCode</a><br>
<br>
"If both a url field and a CDATA clause are encountered, the url field is processed first. Thus, the CDATA construct can also be considered equivalent to one additional value appended to the url MFString array. This ordering allows an online script code
url to take priority over fallback default script code in the CDATA construct. This ordering also allows run-time updates if a viewer is connected to the network, if so desired by the originating author."<br>
<br>
------<br>
<br>
3. Next - naming. "CDATA" is pretty obscure as a field name, especially since that is an XML datatype (for Character Data). Thus am thinking "sourceCode" might be a better name... what do you think?<br>
<br>
The ability to embed safe scripting code within any X3D Script is a powerful capability that also improves security possibilities for advanced X3D... it is easier to secure and safely transport an embedded script than it is to have multiple files handled safely.<br>
<br>
John, it looks like we already did something just like this in the JSON encoding, we called it "sourceText", excerpt follows. (Excessive string quoting was necessary to pass JSON parsing rules for multiline text.)<br>
<br>
----------------------------------------------------------------------------------------------------------------------------------------------<br>
* <a href="https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fx3dgraphics.com%2Fexamples%2FX3dForWebAuthors%2FChapter14Prototypes%2FMaterialModulator.json&data=04%7C01%7Cbrutzman%40nps.edu%7Ca21361bf5da14489edc908d9d86dfc84%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637778789185932285%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=IOpAF1lGWKRYlN5OO8Sl%2FT1S7Ed7MxBT6BocnOHxq4U%3D&reserved=0" target="_blank">
https://X3dGraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/MaterialModulator.json</a><br>
<br>
{ "Script":<br>
{<br>
[....]<br>
"#sourceText":[<br>
"",<br>
"",<br>
"ecmascript:",<br>
"function initialize ()",<br>
"{",<br>
" newColor = diffuseColor; // start with original color",<br>
"}",<br>
"function clockTrigger (timeValue)",<br>
"{",<br>
" if (!enabled) return;",<br>
" red = newColor.r;",<br>
" green = newColor.g;",<br>
" blue = newColor.b;",<br>
"",<br>
" // note different modulation rates for each color component, % is modulus operator",<br>
" newColor = new SFColor ((red + 0.02) % 1, (green + 0.03) % 1, (blue + 0.04) % 1);",<br>
"\tif (enabled)",<br>
"\t{",<br>
"\t\tBrowser.print ('diffuseColor=(' + red +',' + green + ',' + blue + ') newColor=' + newColor.toString() + '\n');",<br>
"\t}",<br>
"}",<br>
"function set_enabled (newValue)",<br>
"{",<br>
"\tenabled = newValue;",<br>
"}",<br>
"",<br>
""<br>
]<br>
----------------------------------------------------------------------------------------------------------------------------------------------<br>
Which in the .x3d XML CDATA simply looks like<br>
<br>
<Script DEF='MaterialModulatorScript'><br>
<field accessType='inputOutput' name='enabled' type='SFBool'/><br>
<field accessType='inputOutput' name='diffuseColor' type='SFColor'/><br>
<field accessType='outputOnly' name='newColor' type='SFColor'/><br>
<field accessType='inputOnly' name='clockTrigger' type='SFTime'/><br>
<IS><br>
<connect nodeField='enabled' protoField='enabled'/><br>
<connect nodeField='diffuseColor' protoField='diffuseColor'/><br>
</IS><br>
<![CDATA[<br>
ecmascript:<br>
function initialize ()<br>
{<br>
newColor = diffuseColor; // start with original color<br>
}<br>
function clockTrigger (timeValue)<br>
{<br>
if (!enabled) return;<br>
red = newColor.r;<br>
green = newColor.g;<br>
blue = newColor.b;<br>
<br>
// note different modulation rates for each color component, % is modulus operator<br>
newColor = new SFColor ((red + 0.02) % 1, (green + 0.03) % 1, (blue + 0.04) % 1);<br>
if (enabled)<br>
{<br>
Browser.print ('diffuseColor=(' + red +',' + green + ',' + blue + ') newColor=' + newColor.toString() + '\n');<br>
}<br>
}<br>
function set_enabled (newValue)<br>
{<br>
enabled = newValue;<br>
}<br>
]]><br>
</Script><br>
<br>
----------------------------------------------------------------------------------------------------------------------------------------------<br>
<br>
So this possibility is a cool prospect, again thanks for flagging it. I'll work further on X3DUOM and Python, Java, OWL compatibility next.<br>
<br>
Have fun with X3D! 8)<br>
<br>
all the best, Don<br>
-- <br>
Don Brutzman Naval Postgraduate School, Code USW/Br <a href="mailto:brutzman@nps.edu" target="_blank">
brutzman@nps.edu</a><br>
Watkins 270, MOVES Institute, Monterey CA 93943-5000 USA +1.831.656.2149<br>
X3D graphics, virtual worlds, navy robotics https:// <a href="http://faculty.nps.edu/brutzman" target="_blank">
faculty.nps.edu/brutzman</a><br>
<br>
-----Original Message-----<br>
From: Brutzman, Donald (Don) (CIV) <<a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a>>
<br>
Sent: Monday, January 10, 2022 6:37 PM<br>
To: John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>><br>
Cc: X3D Graphics public mailing list <<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a>>; Brutzman, Donald (Don) (CIV) <<a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a>><br>
Subject: RE: Possible issue with X3dToPython.xslt, newly tested file from X3D4WA: need x3d.py python support for Script CDATA<br>
<br>
Thanks for the interesting trouble report John.<br>
<br>
No changes needed to original X3D model, it passes all X3D Validator tests (though X3D Schematron provides a few warnings).<br>
<br>
* <a href="https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fx3dgraphics.com%2Fexamples%2FX3dForWebAuthors%2FChapter14Prototypes%2FMaterialModulator.x3d&data=04%7C01%7Cbrutzman%40nps.edu%7Ca21361bf5da14489edc908d9d86dfc84%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637778789185932285%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=PcRk1T5cpkV1jnuSTR2%2FdvaYOc%2BALUhOr%2FvKGwVvfDA%3D&reserved=0" target="_blank">
https://X3dGraphics.com/examples/X3dForWebAuthors/Chapter14Prototypes/MaterialModulator.x3d</a><br>
* <a href="https://savage.nps.edu/X3dValidator" target="_blank">https://savage.nps.edu/X3dValidator</a><br>
<br>
XMLSpy was stricter about type handling than our Java-based Saxon10 conversions for this example. XMLSpy diagnosed some problems that I fixed.<br>
<br>
After also fixing the stylesheet name provided by a diagnostic, all X3dToPython.xslt changes were checked into subversion.<br>
<br>
I now get the following conversion error:<br>
<br>
=====================<br>
create python:<br>
C:\x3d-code\<a href="http://www.web3d.org/" target="_blank">www.web3d.org</a>\x3d\content\examples\X3dForWebAuthors/Chapter14Prototypes//MaterialModulator.x3d processing with X3dToPython stylesheet...<br>
*** TODO x3d.py and X3dToPython.xslt need to handle embedded CDATA source code for Script C:\x3d-code\<a href="http://www.web3d.org/" target="_blank">www.web3d.org</a>\x3d\content\examples\X3dForWebAuthors/Chapter14Prototypes//MaterialModulator.py self-validation
tests...<br>
validate python:<br>
File "C:\x3d-code\<a href="http://www.web3d.org/" target="_blank">www.web3d.org</a>\x3d\content\examples\X3dForWebAuthors\Chapter14Prototypes\MaterialModulator.py", line 74<br>
*** TODO x3d.py and X3dToPython.xslt need to handle embedded CDATA source code for Script<br>
^<br>
SyntaxError: invalid syntax<br>
Result: 1<br>
===================================<br>
<br>
So, embedded CDATA scripting code inside a Script node (and similar Shader nodes) remains an omission in our Python support.<br>
<br>
To remedy this, we need to create a special field in the X3DPSAIL class Script. *What shall we call it?* Creating a Script member named CDATA seems unambiguous and eponymous with the XML encoding...<br>
<br>
* X3D Tooltips, Script and Script url<br>
<a href="https://www.web3d.org/x3d/tooltips/X3dTooltips.html#Script" target="_blank">https://www.web3d.org/x3d/tooltips/X3dTooltips.html#Script</a><br>
<a href="https://www.web3d.org/x3d/tooltips/X3dTooltips.html#Script.url" target="_blank">https://www.web3d.org/x3d/tooltips/X3dTooltips.html#Script.url</a><br>
<br>
* X3D Tooltips, XML Data Types<br>
<a href="https://www.web3d.org/x3d/tooltips/X3dTooltips.html#XML" target="_blank">https://www.web3d.org/x3d/tooltips/X3dTooltips.html#XML</a><br>
<br>
" CDATA is an XML term for Character Data. The base type for all XML attributes consists of string-based CDATA characters. CDATA is used throughout the X3D DOCTYPE definitions, which can only check for the presence of legal strings and thus are not able to
validate numeric type information. XML Schema provides stricter validation based on data types."<br>
<br>
* XML, 2.4 Character Data and Markup<br>
<a href="https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.w3.org%2FTR%2FREC-xml%2F%23syntax&data=04%7C01%7Cbrutzman%40nps.edu%7Ca21361bf5da14489edc908d9d86dfc84%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637778789185932285%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=hURgR6DMZ4HAQdimBlphKzMDVhWzG5zrz9bOkVb9y6Y%3D&reserved=0" target="_blank">https://www.w3.org/TR/REC-xml/#syntax</a><br>
<br>
all the best, Don<br>
-- <br>
Don Brutzman Naval Postgraduate School, Code USW/Br <a href="mailto:brutzman@nps.edu" target="_blank">
brutzman@nps.edu</a><br>
Watkins 270, MOVES Institute, Monterey CA 93943-5000 USA +1.831.656.2149<br>
X3D graphics, virtual worlds, navy robotics https:// <a href="http://faculty.nps.edu/brutzman" target="_blank">
faculty.nps.edu/brutzman</a><br>
<br>
-----Original Message-----<br>
From: John Carlson <<a href="mailto:yottzumm@gmail.com" target="_blank">yottzumm@gmail.com</a>><br>
Sent: Monday, January 10, 2022 4:06 PM<br>
To: Brutzman, Donald (Don) (CIV) <<a href="mailto:brutzman@nps.edu" target="_blank">brutzman@nps.edu</a>>; X3D Graphics public mailing list <<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a>><br>
Subject: Possible issue with X3dToPython.xslt, newly tested file from X3D4WA<br>
<br>
X3D XML file attached. From X3DJSONLD's maven build log:<br>
<br>
[INFO] --- xml-maven-plugin:1.0.2:transform (default) @ X3DJSONLD --- [INFO] Transforming file:<br>
/home/coderextreme/X3DJSONLD/src/main/data/MaterialModulatorExamples.x3d<br>
[INFO] Transforming file:<br>
/home/coderextreme/X3DJSONLD/src/main/data/MaterialModulator.x3d<br>
Type error at char 37 in xsl:value-of/@select on line 610 column 120 of<br>
X3dToPython.xslt:<br>
XPTY0004: A sequence of more than one item is not allowed as the first argument of<br>
normalize-space() ("", "", ...)<br>
at xsl:apply-templates<br>
(file:/home/coderextreme/X3DJSONLD/src/main/lib/stylesheets/X3dToPython.xslt#606)<br>
processing /X3D/Scene[1]/ProtoDeclare[1]/ProtoBody[1]/Script[1]<br>
at xsl:apply-templates<br>
(file:/home/coderextreme/X3DJSONLD/src/main/lib/stylesheets/X3dToPython.xslt#606)<br>
processing /X3D/Scene[1]/ProtoDeclare[1]/ProtoBody[1]<br>
at xsl:apply-templates<br>
(file:/home/coderextreme/X3DJSONLD/src/main/lib/stylesheets/X3dToPython.xslt#606)<br>
processing /X3D/Scene[1]/ProtoDeclare[1]<br>
at xsl:apply-templates<br>
(file:/home/coderextreme/X3DJSONLD/src/main/lib/stylesheets/X3dToPython.xslt#606)<br>
processing /X3D/Scene[1]<br>
at xsl:apply-templates<br>
(file:/home/coderextreme/X3DJSONLD/src/main/lib/stylesheets/X3dToPython.xslt#123)<br>
processing /X3D<br>
[INFO]<br>
------------------------------------------------------------------------<br>
[INFO] BUILD FAILURE<br>
[INFO]<br>
------------------------------------------------------------------------<br>
[INFO] Total time: 2.840 s<br>
[INFO] Finished at: 2022-01-10T17:59:22-06:00 [INFO]<br>
------------------------------------------------------------------------<br>
[ERROR] Failed to execute goal<br>
org.codehaus.mojo:xml-maven-plugin:1.0.2:transform (default) on project<br>
X3DJSONLD: Failed to transform input file<br>
/home/coderextreme/X3DJSONLD/src/main/data/MaterialModulator.x3d: A sequence of more than one item is not allowed as the first argument of<br>
normalize-space() ("", "", ...) -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.<br>
[ERROR] Re-run Maven using the -X switch to enable full debug logging.<br>
[ERROR]<br>
[ERROR] For more information about the errors and possible solutions, please read the following articles:<br>
[ERROR] [Help 1]<br>
<a href="https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcwiki.apache.org%2Fconfluence%2Fdisplay%2FMAVEN%2FMojoExecutionException&data=04%7C01%7Cbrutzman%40nps.edu%7Ca21361bf5da14489edc908d9d86dfc84%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637778789185932285%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=GEjKI%2BOCI%2FfcHC9D6D%2BZgZ4o4TF9GKL%2FJYEyyCHQ8fs%3D&reserved=0" target="_blank">https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fcwiki.apache.org%2Fconfluence%2Fdisplay%2FMAVEN%2FMojoExecutionException&data=04%7C01%7Cbrutzman%40nps.edu%7C79b6d0212127425f31b408d9d4ab3773%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637774654099751000%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=VYVojdsW4QsyjrkZGnqfPOPmUp7x5ftTGE3H0TzrTts%3D&reserved=0</a><u></u><u></u></p>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div>
</div>
_______________________________________________<br>
x3d-public mailing list<br>
<a href="mailto:x3d-public@web3d.org" target="_blank">x3d-public@web3d.org</a><br>
<a href="http://web3d.org/mailman/listinfo/x3d-public_web3d.org" rel="noreferrer" target="_blank">http://web3d.org/mailman/listinfo/x3d-public_web3d.org</a><br>
</blockquote></div></div>