<h5 dir="auto">Description of the problem</h5>
<p dir="auto">GLTF2 models that are clones do not displayed correctly. This is for a number of reasons</p>
<ul dir="auto">
<li>the onBeforeRender callback is not copied</li>
<li>GLTFShader is not cloned across</li>
<li>SkinnedModel skeleton is reinitialised to 0 bones and the source skinnedmodel skeleton is not cloned</li>
</ul>
<p dir="auto"><a href="http://jsfiddle.net/mn768h35/" rel="nofollow">http://jsfiddle.net/mn768h35/</a></p>
<h5 dir="auto">Three.js version</h5>
<ul class="contains-task-list">
<li>[X ] Dev</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> r85</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> ...</li>
</ul>
<h5 dir="auto">Browser</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> All of them</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Chrome</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Firefox</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Internet Explorer</li>
</ul>
<h5 dir="auto">OS</h5>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> All of them</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Windows</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> macOS</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Linux</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Android</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> iOS</li>
</ul>
<h5 dir="auto">Hardware Requirements (graphics card, VR Device, ...)</h5>
<h5 dir="auto">Description of the problem</h5>
<p dir="auto">The current glTF loader works in a slightly unexpected manner: shaders and animations point to a specific instance of a loaded glTF hierarchy, so .clone() or .copy() operations on that hierarchy will drop the links, resulting in the copy not rendering nor animating.</p>
<p dir="auto">I am intending to patch this in vizor.io initially by providing a deepCopyglTF() function which also goes off and clones the animations and shaders and rebinds them to the new copy.</p>
<p dir="auto">However as a long-term-solution for three.js it would be preferable to be able to copy and clone these things via the standard three.js way - i.e. calling .copy() or .clone(). This would require the glTF loader to be refactored so that the loaded mesh hierarchy is entirely self contained with no extra external resources pointing to it (this would also remove the need to update glTFAnimator and glTFShaders explicitly). I'm unlikely to get to that anytime soon but would be interested in hearing if anyone else has given thought to this or is working on a similar issue?</p>
<p dir="auto">ping <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/tparisi/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/tparisi">@tparisi</a></p>