pasted object not in inlined scene

  • Email
  • Sharebar
  • Email
4 replies [Last post]
aplesch
aplesch's picture
Offline
MathematicianScientistTechnologistRegular Blogger
Joined: 05/10/2015

When I copy and paste a shape, it works fine in the world viewer after I run the logo program. However, after exporting the x3d and including the scene via inline in a blog  the object does not show up although it is definitely there as a "USE" shape in the x3d.

I think, the problem may be that the USE object comes in the x3d file before the DEF shape. Running the Logo dynamically updates the DOM, eg. there the scene has the DEF shape before the USE shape. In contrast, when x3dom parses the x3d file, it does not yet know about the DEF shape when it encounters the USE shape and cannot render it.

I could confirm that the order of def and use objects is the issue by manually editing the x3d to switch the use/def order for the blue gear in the scene to def/use order:

https://vrmath2.net/content/ap-scenes

shows the result which now has the back plate for the blue gear.

Is there a way to put the use DEF object before the USE object in the x3d export ?

 

Andy
Andy's picture
Offline
MathematicianTechnologistProfessional Blogger
Joined: 02/10/2010
DEF before USE

Thanks for identifying this problem. Sometime ago I made a decision to append object on top of the children stack under root transform because then in the Object Tree window I can get the latest object on top (and perhaps there is another reason I forgot). X3DOM seems to cache the geometry to in the 3D view window it seems to work (if click on the refresh on the 3D window bar the pasted will not render) but after exported to x3d and reloaded it certainly won't work.

A temporary manual solution will be to drag the pasted object before the copied object in the Object Tree window. I implemented this drag and drop for a while already and knew it can sometimes cause unknown crash in the Object Tree window (guess that's the limit in this old version of KendoUI).

I will look into my program and I think the better solution will be to insert/append the pasted after the copied object by default. But this can be complicated by setparent.... I guess the x3d programmer needs to be aware of the node sequence..

Another solution is using move command https://vrmath2.net/content/logo-guidereference#sec6_14

will put obj_0 back on top (if obj_0 is the copied object).

aplesch
aplesch's picture
Offline
MathematicianScientistTechnologistRegular Blogger
Joined: 05/10/2015
great tip

Thanks for looking into this and the tips. I will use the drag and drop workaround for now. I am unclear how setparent would be affected.

Andy
Andy's picture
Offline
MathematicianTechnologistProfessional Blogger
Joined: 02/10/2010
Order

Since DEF has to render first before it can USE, I mean that programmers have to be aware when using SETPARENT. It is possible that an object was copied then pasted under another parent transform, which may be before the copied transform.

At the moment in VRMath2 the object will be appended on top of the tree. I am thinking to return to my original design, which is just normal appendChild in DOM. That will make the DOM tree in order of creation. This way may avoid the USE before DEF situation.  

Andy
Andy's picture
Offline
MathematicianTechnologistProfessional Blogger
Joined: 02/10/2010
Fixed: pasted object

I have just updated now PASTE will have the object pasted at the bottom of the father tree. 

In the Object Tree window, the order will be:

obj_1
obj_0
obj_2