Skip to content

Commit 1ccd9e6

Browse files
author
Hannah
authored
Merge pull request #6710 from AnalyticalGraphicsInc/kml-bad-image-fix
Fixed issue where we constantly fail to load the same image.
2 parents 58ba7b5 + 1cf8883 commit 1ccd9e6

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Change Log
2323
* Fixed a bug causing Point Cloud tiles with unsigned int batch-ids to not load. [#6666](https://github.com/AnalyticalGraphicsInc/cesium/pull/6666)
2424
* Fixed a bug with Draco encoded i3dm tiles, and loading two Draco models with the same url. [#6668](https://github.com/AnalyticalGraphicsInc/cesium/issues/6668)
2525
* Fixed terrain clipping when the camera was close to flat terrain and was using logarithmic depth. [#6701](https://github.com/AnalyticalGraphicsInc/cesium/pull/6701)
26+
* Fixed KML bug that constantly requested the same image if it failed to load. [#6710](https://github.com/AnalyticalGraphicsInc/cesium/pull/6710)
2627
* Fixed an issue where KMLs containing a `colorMode` of `random` could return the exact same color on successive calls to `Color.fromRandom()`.
2728

2829
### 1.46.1 - 2018-06-01

Source/Scene/Material.js

+15-7
Original file line numberDiff line numberDiff line change
@@ -788,9 +788,17 @@ define([
788788
return;
789789
}
790790

791-
if (uniformValue !== material._texturePaths[uniformId]) {
792-
if (typeof uniformValue === 'string' || uniformValue instanceof Resource) {
793-
var resource = Resource.createIfNeeded(uniformValue);
791+
// When using the entity layer, the Resource objects get recreated on getValue because
792+
// they are clonable. That's why we check the url property for Resources
793+
// because the instances aren't the same and we keep trying to load the same
794+
// image if it fails to load.
795+
var isResource = (uniformValue instanceof Resource);
796+
if (!defined(material._texturePaths[uniformId]) ||
797+
(isResource && uniformValue.url !== material._texturePaths[uniformId].url) ||
798+
(!isResource && uniformValue !== material._texturePaths[uniformId])) {
799+
if (typeof uniformValue === 'string' || isResource) {
800+
var resource = isResource ? uniformValue : Resource.createIfNeeded(uniformValue);
801+
794802
var promise;
795803
if (ktxRegex.test(uniformValue)) {
796804
promise = loadKTX(resource);
@@ -801,14 +809,14 @@ define([
801809
}
802810
when(promise, function(image) {
803811
material._loadedImages.push({
804-
id : uniformId,
805-
image : image
812+
id: uniformId,
813+
image: image
806814
});
807815
});
808816
} else if (uniformValue instanceof HTMLCanvasElement) {
809817
material._loadedImages.push({
810-
id : uniformId,
811-
image : uniformValue
818+
id: uniformId,
819+
image: uniformValue
812820
});
813821
}
814822

0 commit comments

Comments
 (0)