3D Part Preview added to Parts Tracker


RE: 3D Part Preview added to Parts Tracker
(2022-07-04, 0:44)Orion Pobursky Wrote: It's not turned on by default? The curves look smooth leading me to believe that smooth curved prims were being subbed in.

It should not be. To turn it on, force has to be set as an option to ldrLoader:

Code:
ldrLoader = new THREE.LDRLoader(onLoad, null, {force:8, // ... or 48 for high resolution.

// And the settings for ldrLoader is used when constructing the studs:

LDR.Studs.setStuds(ldrLoader, ...

And in order to perform substitution on other primitives, the following transformation can be made after loading (Assuming the primitives in the other resolution are present):

Code:
ldrLoader.applyOnPartTypes(function(pt) {
      if(!pt.isPart) return; // Only parts.

      function handleSubModel(sm) {
        if(sm.ID.startsWith('8/')) return; // Already substituted.
        let id2 = '8/' + sm.ID;
        if(ldrLoader.partTypes.hasOwnProperty(id2)) {
          sm.ID = id2;
        }
      }
      pt.steps.forEach(s => s.subModels.forEach(handleSubModel));
});

That is how I'm doing it - perhaps there is a prettier way.
Reply
« Next Oldest | Next Newest »



Messages In This Thread
RE: 3D Part Preview added to Parts Tracker - by Lasse Deleuran - 2022-07-04, 6:08

Forum Jump:


Users browsing this thread: 2 Guest(s)