Gary Hsu 4 yıl önce
ebeveyn
işleme
56b74d3f25

+ 7 - 5
inspector/src/components/globalState.ts

@@ -132,11 +132,6 @@ export class GlobalState {
             this.glTFLoaderExtensions[extension.name] = extension;
         });
 
-        if (this.validationResults) {
-            this.validationResults = null;
-            this.onValidationResultsUpdatedObservable.notifyObservers(null);
-        }
-
         loader.onValidatedObservable.add((results: IGLTFValidationResults) => {
             this.validationResults = results;
             this.onValidationResultsUpdatedObservable.notifyObservers(results);
@@ -148,6 +143,13 @@ export class GlobalState {
         });
     }
 
+    public resetGLTFValidationResults() {
+        if (this.validationResults) {
+            this.validationResults = null;
+            this.onValidationResultsUpdatedObservable.notifyObservers(null);
+        }
+    }
+
     // Light gizmos
     public lightGizmos: Array<LightGizmo> = [];
     public enableLightGizmo(light: Light, enable = true) {

+ 2 - 0
inspector/src/inspector.ts

@@ -335,6 +335,8 @@ export class Inspector {
     public static EarlyAttachToLoader() {
         if (!this._GlobalState.onPluginActivatedObserver) {
             this._GlobalState.onPluginActivatedObserver = SceneLoader.OnPluginActivatedObservable.add((rawLoader) => {
+                this._GlobalState.resetGLTFValidationResults();
+
                 const loader = rawLoader as import("babylonjs-loaders/glTF/index").GLTFFileLoader;
                 if (loader.name === "gltf") {
                     this._GlobalState.prepareGLTFPlugin(loader);

+ 3 - 3
sandbox/src/components/renderingZone.tsx

@@ -12,7 +12,7 @@ import { EnvironmentTools } from "../tools/environmentTools";
 import { Tools } from "babylonjs/Misc/tools";
 import { FilesInput } from "babylonjs/Misc/filesInput";
 import { Animation } from "babylonjs/Animations/animation";
-import { PBRMaterial, StringTools, Texture } from "babylonjs";
+import { PBRBaseMaterial, PBRMaterial, StringTools, Texture } from "babylonjs";
 import { Mesh } from "babylonjs/Meshes/mesh";
 
 require("../scss/renderingZone.scss");
@@ -213,8 +213,8 @@ export class RenderingZone extends React.Component<IRenderingZoneProps> {
             }
         } else {
             var pbrPresent = false;
-            for (var i = 0; i < this._scene.materials.length; i++) {
-                if (this._scene.materials[i].transparencyMode !== undefined) {
+            for (const material of this._scene.materials) {
+                if (material instanceof PBRBaseMaterial) {
                     pbrPresent = true;
                     break;
                 }