diff --git a/plm_web_3d/static/src/js/lib/odoocad/loaders.js b/plm_web_3d/static/src/js/lib/odoocad/loaders.js index 13357e5d..e74c9881 100644 --- a/plm_web_3d/static/src/js/lib/odoocad/loaders.js +++ b/plm_web_3d/static/src/js/lib/odoocad/loaders.js @@ -105,9 +105,11 @@ class Loader { gLTFLoader.load( url, function ( gltf ) { var children = gltf.scene.children; var i; + var out_html_structure; for (i = 0; i < children.length; i++) { - self.odooCad.addItemToScene(children[i]); + out_html_structure+=self.odooCad.addItemToScene(children[i]); } + self.odooCad.create_tree_structure(out_html_structure) }, function ( xhr ) { var percentage = (xhr.loaded / xhr.total) * 100; @@ -121,23 +123,6 @@ class Loader { } load3mf(document_name, url){ - - var load3emfObj = function(args){ - if(args.type=="Group"){ - var i; - var children = args.children; - for (i = 0; i < children.length; i++) { - if(children[i].type=="Mesh"){ - self.odooCad.addItemToScene(args); - break; - } - else { - load3emfObj(children[i]); - } - } - } - } - var self=this; threeMFLoader.load( url, //load @@ -145,7 +130,9 @@ class Loader { mfArgs.traverse( function ( child ) { child.castShadow = true; } ); - self.odooCad.addItemToScene(mfArgs, false); + const out_html_structure = self.odooCad.addItemToScene(mfArgs, false); + self.odooCad.create_tree_structure(out_html_structure) + }, //progress function ( xhr ) { diff --git a/plm_web_3d/static/src/js/lib/odoocad/odoocad.js b/plm_web_3d/static/src/js/lib/odoocad/odoocad.js index 6cae3513..cd26c61c 100644 --- a/plm_web_3d/static/src/js/lib/odoocad/odoocad.js +++ b/plm_web_3d/static/src/js/lib/odoocad/odoocad.js @@ -61,9 +61,11 @@ class OdooCAD{ }); object.material=material; } + // this.scene.add(object); this.items.push(object); - this.create_relation_structure(object); + // + const out_htm_structure = this.create_relation_structure(object); // Center the object // fit item progress.display = 'none'; @@ -71,6 +73,7 @@ class OdooCAD{ html_canvas.dispatchEvent(fitItem); // recompute the bounding box this.active_bbox=this.getBBox(); + return out_htm_structure; } // @@ -103,11 +106,11 @@ class OdooCAD{ for (let i = 0; i < object.children.length; i++) { if (object.children[i].type=='Group' || object.children[i].name!=''){ const [inner_html, children_found] = self.get_li_structure(object.children[i], true); - var obj_name=object.children[i].name; + var obj_name = object.children[i].name; var internal_obj_name = guid() var span_lable = "" + obj_name + ""; if(children_found || object.children[i].name!=''){ - self.tree_ref_elements[internal_obj_name]=object.children[i] + self.tree_ref_elements[internal_obj_name] = object.children[i] out_lis += "