[x3d-public] Prototype Expander, Question on design of instance expansions

John Carlson yottzumm at gmail.com
Sun Jul 3 14:00:35 PDT 2016


I push scope once when I get  a ProtoDeclare, twice when I get a ProtoInstance (the first is for the Declare @name, the second is for the @DEF or a incrementing number).

I precede Declare and Instance scope with a DECL followed by the @name.  If the @DEF for an Instance is undefined, the def becomes INSTANCE.  If a def has been saved, then the Instance becomes INSTANCE+(i*1000) where I > 1.   If a def hadn’t been saved, the original def is used.  In addition, I push a scope on fieldValues called FIELD+protoField.

When I getScope with a def, I check to see if the def is there, if it’s there, and a def has been saved (a saved scope), I prepend the saved scope to _+def and return it.  If the def hasn’t been saved, then  I return the passed in def as the scope. Otherwise, I join the scope from the bottom to the top with a _ and return that.

When I save a def to compute a new def, I first assign the saved scope (not the scope stack) to getScope() and then I return getScope(def)

John

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20160703/9ff2e818/attachment.html>


More information about the x3d-public mailing list