-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ColladaLoader: Added possibility to manually set path #12614
Conversation
examples/js/loaders/ColladaLoader.js
Outdated
var path = THREE.Loader.prototype.extractUrlBase( url ); | ||
|
||
|
||
scope.path = scope.path === undefined ? THREE.Loader.prototype.extractUrlBase( url ) : scope.path; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would make this:
var path = scope.path === undefined ? THREE.Loader.prototype.extractUrlBase( url ) : scope.path;
Otherwise consider this case:
var loader = new THREE.ColladaLoader();
loader.load('path/to/first/model.dae', () => ...);
loader.load('other/path/to/second/model.dae', () => ...);
The first model will modify scope.path
and break the second model.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we do it like this, we also handle the path for textureLoader
correctly, see
@cnspaha The path
variable at this place is passed as a parameter of parse()
. With your current implementation, this value isn't set correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be the best to handle this in the same way like GLTFLoader
does.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@donmccurdy
I get your point.
Just saw, that I pretty messed up this one...
I like your idea, thanks again for your input ;)
@Mugen87
The suggestion of @donmccurdy is exactly what the GLTFLoader does, isn't it?
edit: commited it
examples/js/loaders/ColladaLoader.js
Outdated
var loader = new THREE.FileLoader( scope.manager ); | ||
loader.setPath( scope.path ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is not necessary. Everything else is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
examples/js/loaders/ColladaLoader.js
Outdated
|
||
var path = scope.path === undefined ? THREE.Loader.prototype.extractUrlBase( url ) : scope.path; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sry for being so pedantic. But it seems you used soft tabs here. Please ensure correct code style by using hard tabs instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't worry about it, you are totaly right ;)
didn't pay attention to this one
Looks good now! Thanks! |
@mrdoob |
@mrdoob This one can be safely merged 😊 |
Sorry for the delay guys! |
Thanks! |
see #12609
@Mugen87