Replies: 2 comments
-
|
Hi @DraTeots - sorry for the late reply! I'm afraid I don't know this code super well. Perhaps @emiliocortina @9inpachi @kjvbrt might know more? |
Beta Was this translation helpful? Give feedback.
-
|
Hi @DraTeots, this is a great question I traced through the full pipeline while working on the codebase and can share what I found. Why the JSON round-trip exists: The pipeline is: build(obj, { dflt_colors: true }) → .toJSON() → ObjectLoader.parse() → processGeometry(). This looks redundant since build() already returns a perfectly good Object3D, but the JSON step serves a few purposes:
On the stripped node information: If the goal is to preserve the TGeo hierarchy and allow per-node visibility control, the direct processGeometry() on the build() output approach you're suggesting would make sense - but it would also need changes to how meshes are registered in the UI menu (currently one toggle per geometry group, not per TGeo node). This could be a useful enhancement - exposing the TGeo node tree in the Phoenix menu instead of flattening it. Would that be useful for your DD4Hep work? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Working on reading DD4Hep geometry figured that essentially the core of the function is:
Where
build(obj, { dflt_colors: true })is a fundamental function from TGeoPainter.mjs of JSRoot, which returns three.js Object3D. The Object3D in turn could be loaded directly throughprocessGeometryof the ImportManager without hassle of converting to Json and importing through Json loader.Is it just historical or are there other reasons for that?
The context why I would like to discuss this. I would like to have a bit more control over the geometry after it has been added to Three.js tree. But a lot of data is being stripped during the conversion and navigating and working with geometry children become cumbersome.
Jsroot
buildmethod strips some information jsroot 303, still it has some initial information: jsroot 304. But after going throughtoJSon-loadJSONGeometrythe nodes information is stripped off completely. Even meshes are nameless (or maybe I miss something?). Moreover, the same name that was provided toloadJSONGeometryis used as Meshes name. Is that on purpose to easier grab all meshes that relate to that imported part?P.S. I am trying to figure out how it works and what are the design ideas to be helpful.
Beta Was this translation helpful? Give feedback.
All reactions