Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add inline loaded files to the DOM #45

Closed
ghost opened this issue Oct 18, 2011 · 2 comments
Closed

Add inline loaded files to the DOM #45

ghost opened this issue Oct 18, 2011 · 2 comments
Assignees
Labels
Milestone

Comments

@ghost
Copy link

ghost commented Oct 18, 2011

When loading X3D files using the node, the DOM does not reflect the loaded nodes. Make this the default behavior but allow turning it off by switch for performance reasons.

Also see: http://sourceforge.net/projects/x3dom/forums/forum/957286/topic/4523067

@ghost
Copy link
Author

ghost commented Nov 15, 2011

THIS POSTING ON THE MAILING LIST MIGHT HELP IN INPLEMENTING THIS


Hi,

I saw a ticket opened on the subject of inline nodes whose child nodes are not accessible
via dom nodes.

Here is the way I access values of "Field" nodes of a "ComposedShader" which is inside
the scene I import with an "inline" node :

vfAdd = function(a,d) {
$('inline[DEF=planX3domInline]').get()
[0]._x3domNode._childNodes[0]._childNodes[0]._childNodes[0]._childNodes[0]._childNodes[2]
._vf[a]+=d;
}

This can give you an idea about how to access nodes and attribute values inside an inline
scene. Explanation of this function:

$('inline[DEF=planX3domInline]').get() gives access to the inline dom.

._x3domNode gives access to the javascript object that is representing the scripted
behaviour of the node

._childNodes[n] ^m is traversing the hierarchy m times which is the same as if it were a
dom element

._vf[stringName] gives access to the attribute I want, so as to alter my shader

I think all this is not documented, but you can get the particular information for the
node you want to access by using Chrome :

  • press Ctrl + shift + J
  • choose "Elements"
  • find your inline node with the search text area "Search Element" searching for "inline"
  • look at "Properties" on the right side and click on the first "HTMLUnknownElement"
  • and here it is : the _x3domNode whose you can explore the childNodes

or using Firefox roughly the same way : (with developer tools !!)

  • press Ctrl + shift + K
  • if you have jQuery, type $('inline[DEF=planX3domInline]').get() that will directly give
    you access to the inline dom node
  • and then explore it the same way

But Be Careful ! all what you implement this way is dependent on all that changes in the
implementation of x3dom that we should not manipulate this way.

Hope this can help.

Regards.

Alexis
EDF R&D SINETICS RVVS I2C
INSA Rouen


@ghost ghost assigned annakasia79 Nov 29, 2011
@annakasia79
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant