Skip to content

JSONLoader with absolute material paths #3491

@jjv360

Description

@jjv360

I'm writing an offline app that uses the FileSystem API for storing objects and textures, and in order to do that I have to change the material file name to a blob url, but it seems JSONLoader doesn't support absolute paths?

I got around this by adding these lines to Three.js at line 9451:

...
var fullPath = texturePath + "/" + sourceFile;

// Check for absolute URLs
if (sourceFile.indexOf(":") != -1)
    fullPath = sourceFile;

if ( isCompressed ) {
...

After that it works perfectly. Is there a better way of checking if a string is an absolute path?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions