Threejs AttributeError FBXLoader

I tried it use FBXLoader in threejs
Got AttributeError. Any Suggestions?

Best Regards Gerhard

<html>
    <head>

        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta charset="UTF-8" />

        <link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
        <link href="./styles.css" rel="stylesheet" type="text/css">
        <script defer src="https://pyscript.net/latest/pyscript.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.js"></script>
        <script scr="./examples/js/loaders/FBXLoader.js"></script>
        <script src="./examples/js/controls/OrbitControls.js"></script>
    </head>
    <body>
        <h1>three.js with pyscript </h1>
        <div id="container">
        </div>
        <py-script>

from pyodide import create_proxy, to_js
from js import THREE, window, document, Array

loader = THREE.FBXLoader.new()

       </py-script>
    </body>
</html>
1 Like

Dear hebi.

nice to meet you.
Thank you very much for the valuable information.

The cause is that PyScript is also given priority because the runtime is written in js.

I think the current solution is to use different HTML instead of coexisting three.js and PyScript in the same HTML.

It may be possible to solve it in the future, but for now it is difficult.

see you.
ktsh.tanaka.2020

Hello,

I am using threejs an pyscript in the same html and it works.
I am using OrbitControl.js and that works.

But with FBXLoader there is an error. What is the difference?

Best regards Hebi

1 Like

dear hebi.

Sincerest apologies.
Originally, I should have searched StackOverflow for three.js before answering.

In FBXLoader, AttributeError occurs because the required modules have not been imported.

The correct answer can be found at the following URL:

see you.
ktsh.tanaka.2020

1 Like

Hello Hebi,
I haven’t tried out the FBXLoader yet but when I used the TextureLoader I did this:

foo = THREE.TextureLoader.new().load("path_for_image")

I think that the TextureLoader from my pseudo code above is built into Three.js rather than an additional module like OrbitControls or FBXLoader so my suggestion is probably not going to be very helpful (sorry).
I wonder if the FBXLoader has to wait for the model to finish loading as it is probably using javascript fetch to get the FBX model data?

Best wishes
Adam

2 Likes