소스 검색

Fix ts errors

Popov72 5 년 전
부모
커밋
6fbe91b4a1
2개의 변경된 파일5개의 추가작업 그리고 8개의 파일을 삭제
  1. 4 7
      nodeEditor/src/components/preview/previewManager.ts
  2. 1 1
      nodeEditor/src/sharedComponents/color3LineComponent.tsx

+ 4 - 7
nodeEditor/src/components/preview/previewManager.ts

@@ -26,7 +26,6 @@ import { ParticleSystem } from 'babylonjs/Particles/particleSystem';
 import { ParticleHelper } from 'babylonjs/Particles/particleHelper';
 import { Texture } from 'babylonjs/Materials/Textures/texture';
 import { ParticleTextureBlock } from 'babylonjs/Materials/Node/Blocks/Particle/particleTextureBlock';
-import { Effect } from 'babylonjs/Materials/effect';
 import { FileTools } from 'babylonjs/Misc/fileTools';
 
 export class PreviewManager {
@@ -440,17 +439,15 @@ export class PreviewManager {
                 case NodeMaterialModes.Particle: {
                     this._globalState.onIsLoadingChanged.notifyObservers(false);
 
-                    if (this._particleSystemDrawObserver) {
-                        this._particleSystem.onBeforeDrawParticlesObservable.remove(this._particleSystemDrawObserver);
-                    }
+                    this._particleSystem!.onBeforeDrawParticlesObservable.clear();
 
-                    this._particleSystem.onBeforeDrawParticlesObservable.add((effect) => {
+                    this._particleSystem!.onBeforeDrawParticlesObservable.add((effect) => {
                         const textureBlock = tempMaterial.getBlockByPredicate((block) => block instanceof ParticleTextureBlock);
-                        if (textureBlock && (textureBlock as ParticleTextureBlock).texture) {
+                        if (textureBlock && (textureBlock as ParticleTextureBlock).texture && effect) {
                             effect.setTexture("diffuseSampler", (textureBlock as ParticleTextureBlock).texture);
                         }
                     });
-                    tempMaterial.createEffectForParticles(this._particleSystem);
+                    tempMaterial.createEffectForParticles(this._particleSystem!);
                     break;
                 }
 

+ 1 - 1
nodeEditor/src/sharedComponents/color3LineComponent.tsx

@@ -148,7 +148,7 @@ export class Color3LineComponent extends React.Component<IColor3LineComponentPro
                         {this.props.label}
                     </div>
                     <div className="color3">
-                        <ColorPickerLineComponent value={this.state.color} disableAlpha={true} onColorChanged={color => {
+                        <ColorPickerLineComponent value={this.state.color} disableAlpha={true} globalState={this.props.globalState} onColorChanged={color => {
                                 this.onChange(color);
                             }} />  
                     </div>