浏览代码

Canvas2D bug fix for Sprite2D

Only the Texture's URL was used to create the ModelRenderCache which bugs is two textures instances using the same URL were created (and disposed)
nockawa 8 年之前
父节点
当前提交
506fd2330f
共有 1 个文件被更改,包括 14 次插入1 次删除
  1. 14 1
      canvas2D/src/Engine/babylon.smartPropertyPrim.ts

+ 14 - 1
canvas2D/src/Engine/babylon.smartPropertyPrim.ts

@@ -1057,7 +1057,20 @@
                         }
                     }
 
-                    modelKey += v.name + ":" + ((propVal != null) ? ((v.typeLevelCompare) ? Tools.getClassName(propVal) : propVal.toString()) : "[null]") + ";";
+                    let value = "[null]";
+                    if (propVal != null) {
+                        if (v.typeLevelCompare) {
+                            value = Tools.getClassName(propVal);
+                        } else {
+                            if (propVal instanceof BaseTexture) {
+                                value = propVal.uid;
+                            } else {
+                                value = propVal.toString();
+                            }
+                        }
+                    }
+
+                    modelKey += v.name + ":" + value + ";";
                 }
             });