|
@@ -118,9 +118,10 @@ export class ParticleSystemPropertyGridComponent extends React.Component<IPartic
|
|
if (system instanceof GPUParticleSystem) {
|
|
if (system instanceof GPUParticleSystem) {
|
|
let isStarted = system.isStarted() && !system.isStopped();
|
|
let isStarted = system.isStarted() && !system.isStopped();
|
|
return (
|
|
return (
|
|
- <ButtonLineComponent label={isStarted ? "Pause" : "Start"} onClick={() => {
|
|
|
|
|
|
+ <ButtonLineComponent label={isStarted ? "Stop" : "Start"} onClick={() => {
|
|
if (isStarted) {
|
|
if (isStarted) {
|
|
system.stop();
|
|
system.stop();
|
|
|
|
+ system.reset();
|
|
} else {
|
|
} else {
|
|
system.start();
|
|
system.start();
|
|
}
|
|
}
|
|
@@ -165,11 +166,12 @@ export class ParticleSystemPropertyGridComponent extends React.Component<IPartic
|
|
Tools.ReadFile(file, (data) => {
|
|
Tools.ReadFile(file, (data) => {
|
|
let decoder = new TextDecoder("utf-8");
|
|
let decoder = new TextDecoder("utf-8");
|
|
let jsonObject = JSON.parse(decoder.decode(data));
|
|
let jsonObject = JSON.parse(decoder.decode(data));
|
|
|
|
+ let isGpu = system instanceof GPUParticleSystem
|
|
|
|
|
|
system.dispose();
|
|
system.dispose();
|
|
this.props.globalState.onSelectionChangedObservable.notifyObservers(null);
|
|
this.props.globalState.onSelectionChangedObservable.notifyObservers(null);
|
|
|
|
|
|
- let newSystem = ParticleSystem.Parse(jsonObject, scene, "");
|
|
|
|
|
|
+ let newSystem = isGpu ? GPUParticleSystem.Parse(jsonObject, scene, "") : ParticleSystem.Parse(jsonObject, scene, "");
|
|
this.props.globalState.onSelectionChangedObservable.notifyObservers(newSystem);
|
|
this.props.globalState.onSelectionChangedObservable.notifyObservers(newSystem);
|
|
}, undefined, true);
|
|
}, undefined, true);
|
|
}
|
|
}
|
|
@@ -219,7 +221,7 @@ export class ParticleSystemPropertyGridComponent extends React.Component<IPartic
|
|
<TextInputLineComponent lockObject={this.props.lockObject} label="Name" target={system} propertyName="name" onPropertyChangedObservable={this.props.onPropertyChangedObservable}/>
|
|
<TextInputLineComponent lockObject={this.props.lockObject} label="Name" target={system} propertyName="name" onPropertyChangedObservable={this.props.onPropertyChangedObservable}/>
|
|
<TextLineComponent label="Class" value={system.getClassName()} />
|
|
<TextLineComponent label="Class" value={system.getClassName()} />
|
|
<TextLineComponent label="Capacity" value={system.getCapacity().toString()} />
|
|
<TextLineComponent label="Capacity" value={system.getCapacity().toString()} />
|
|
- <TextLineComponent label="Capacity" value={system.getActiveCount().toString()} />
|
|
|
|
|
|
+ <TextLineComponent label="Active count" value={system.getActiveCount().toString()} />
|
|
<TextureLinkLineComponent label="Texture" texture={system.particleTexture} onSelectionChangedObservable={this.props.onSelectionChangedObservable}/>
|
|
<TextureLinkLineComponent label="Texture" texture={system.particleTexture} onSelectionChangedObservable={this.props.onSelectionChangedObservable}/>
|
|
<OptionsLineComponent label="Blend mode" options={blendModeOptions} target={system} propertyName="blendMode" onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
|
|
<OptionsLineComponent label="Blend mode" options={blendModeOptions} target={system} propertyName="blendMode" onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
|
|
<Vector3LineComponent label="Gravity" target={system} propertyName="gravity"
|
|
<Vector3LineComponent label="Gravity" target={system} propertyName="gravity"
|
|
@@ -355,20 +357,23 @@ export class ParticleSystemPropertyGridComponent extends React.Component<IPartic
|
|
</LineContainerComponent>
|
|
</LineContainerComponent>
|
|
<LineContainerComponent globalState={this.props.globalState} title="EMISSION">
|
|
<LineContainerComponent globalState={this.props.globalState} title="EMISSION">
|
|
<FloatLineComponent lockObject={this.props.lockObject} label="Rate" target={system} propertyName="emitRate" onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
|
|
<FloatLineComponent lockObject={this.props.lockObject} label="Rate" target={system} propertyName="emitRate" onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
|
|
- <ValueGradientGridComponent globalState={this.props.globalState} gradients={system.getEmitRateGradients()!}
|
|
|
|
- label="Velocity gradients"
|
|
|
|
- docLink="https://doc.babylonjs.com/babylon101/particles#emit-rate-over-time"
|
|
|
|
- onCreateRequired={() => {
|
|
|
|
- system.addEmitRateGradient(0, 50, 50);
|
|
|
|
- this.props.globalState.onCodeChangedObservable.notifyObservers({
|
|
|
|
- object: system,
|
|
|
|
- code: `TARGET.addEmitRateGradient(0, 50, 50);`
|
|
|
|
- });
|
|
|
|
- }}
|
|
|
|
- mode={GradientGridMode.Factor}
|
|
|
|
- host={system}
|
|
|
|
- codeRecorderPropertyName="getEmitRateGradients()"
|
|
|
|
- lockObject={this.props.lockObject}/>
|
|
|
|
|
|
+ {
|
|
|
|
+ system instanceof ParticleSystem &&
|
|
|
|
+ <ValueGradientGridComponent globalState={this.props.globalState} gradients={system.getEmitRateGradients()!}
|
|
|
|
+ label="Velocity gradients"
|
|
|
|
+ docLink="https://doc.babylonjs.com/babylon101/particles#emit-rate-over-time"
|
|
|
|
+ onCreateRequired={() => {
|
|
|
|
+ system.addEmitRateGradient(0, 50, 50);
|
|
|
|
+ this.props.globalState.onCodeChangedObservable.notifyObservers({
|
|
|
|
+ object: system,
|
|
|
|
+ code: `TARGET.addEmitRateGradient(0, 50, 50);`
|
|
|
|
+ });
|
|
|
|
+ }}
|
|
|
|
+ mode={GradientGridMode.Factor}
|
|
|
|
+ host={system}
|
|
|
|
+ codeRecorderPropertyName="getEmitRateGradients()"
|
|
|
|
+ lockObject={this.props.lockObject}/>
|
|
|
|
+ }
|
|
<FloatLineComponent lockObject={this.props.lockObject} label="Min emit power" target={system} propertyName="minEmitPower" onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
|
|
<FloatLineComponent lockObject={this.props.lockObject} label="Min emit power" target={system} propertyName="minEmitPower" onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
|
|
<FloatLineComponent lockObject={this.props.lockObject} label="Max emit power" target={system} propertyName="maxEmitPower" onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
|
|
<FloatLineComponent lockObject={this.props.lockObject} label="Max emit power" target={system} propertyName="maxEmitPower" onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
|
|
<ValueGradientGridComponent globalState={this.props.globalState} gradients={system.getVelocityGradients()!}
|
|
<ValueGradientGridComponent globalState={this.props.globalState} gradients={system.getVelocityGradients()!}
|
|
@@ -421,21 +426,23 @@ export class ParticleSystemPropertyGridComponent extends React.Component<IPartic
|
|
<FloatLineComponent lockObject={this.props.lockObject} label="Max scale X" target={system} propertyName="maxScaleX" onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
|
|
<FloatLineComponent lockObject={this.props.lockObject} label="Max scale X" target={system} propertyName="maxScaleX" onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
|
|
<FloatLineComponent lockObject={this.props.lockObject} label="Min scale Y" target={system} propertyName="minScaleY" onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
|
|
<FloatLineComponent lockObject={this.props.lockObject} label="Min scale Y" target={system} propertyName="minScaleY" onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
|
|
<FloatLineComponent lockObject={this.props.lockObject} label="Max scale Y" target={system} propertyName="maxScaleY" onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
|
|
<FloatLineComponent lockObject={this.props.lockObject} label="Max scale Y" target={system} propertyName="maxScaleY" onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
|
|
- <ValueGradientGridComponent globalState={this.props.globalState} gradients={system.getStartSizeGradients()!}
|
|
|
|
- label="Start size gradients"
|
|
|
|
- docLink="https://doc.babylonjs.com/babylon101/particles#start-size-over-time"
|
|
|
|
- onCreateRequired={() => {
|
|
|
|
- system.addStartSizeGradient(0, 1, 1);
|
|
|
|
- this.props.globalState.onCodeChangedObservable.notifyObservers({
|
|
|
|
- object: system,
|
|
|
|
- code: `TARGET.addStartSizeGradient(0, 1, 1);`
|
|
|
|
- });
|
|
|
|
- }}
|
|
|
|
- host={system}
|
|
|
|
- codeRecorderPropertyName="getStartSizeGradients()"
|
|
|
|
- mode={GradientGridMode.Factor}
|
|
|
|
- lockObject={this.props.lockObject}/>
|
|
|
|
-
|
|
|
|
|
|
+ {
|
|
|
|
+ system instanceof ParticleSystem &&
|
|
|
|
+ <ValueGradientGridComponent globalState={this.props.globalState} gradients={system.getStartSizeGradients()!}
|
|
|
|
+ label="Start size gradients"
|
|
|
|
+ docLink="https://doc.babylonjs.com/babylon101/particles#start-size-over-time"
|
|
|
|
+ onCreateRequired={() => {
|
|
|
|
+ system.addStartSizeGradient(0, 1, 1);
|
|
|
|
+ this.props.globalState.onCodeChangedObservable.notifyObservers({
|
|
|
|
+ object: system,
|
|
|
|
+ code: `TARGET.addStartSizeGradient(0, 1, 1);`
|
|
|
|
+ });
|
|
|
|
+ }}
|
|
|
|
+ host={system}
|
|
|
|
+ codeRecorderPropertyName="getStartSizeGradients()"
|
|
|
|
+ mode={GradientGridMode.Factor}
|
|
|
|
+ lockObject={this.props.lockObject}/>
|
|
|
|
+ }
|
|
<ValueGradientGridComponent globalState={this.props.globalState} gradients={system.getSizeGradients()!}
|
|
<ValueGradientGridComponent globalState={this.props.globalState} gradients={system.getSizeGradients()!}
|
|
label="Size gradients"
|
|
label="Size gradients"
|
|
docLink="https://doc.babylonjs.com/babylon101/particles#size"
|
|
docLink="https://doc.babylonjs.com/babylon101/particles#size"
|
|
@@ -455,20 +462,23 @@ export class ParticleSystemPropertyGridComponent extends React.Component<IPartic
|
|
<FloatLineComponent lockObject={this.props.lockObject} label="Min lifetime" target={system} propertyName="minLifeTime" onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
|
|
<FloatLineComponent lockObject={this.props.lockObject} label="Min lifetime" target={system} propertyName="minLifeTime" onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
|
|
<FloatLineComponent lockObject={this.props.lockObject} label="Max lifetime" target={system} propertyName="maxLifeTime" onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
|
|
<FloatLineComponent lockObject={this.props.lockObject} label="Max lifetime" target={system} propertyName="maxLifeTime" onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
|
|
<FloatLineComponent lockObject={this.props.lockObject} label="Target stop duration" target={system} propertyName="targetStopDuration" onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
|
|
<FloatLineComponent lockObject={this.props.lockObject} label="Target stop duration" target={system} propertyName="targetStopDuration" onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
|
|
- <ValueGradientGridComponent globalState={this.props.globalState} gradients={system.getLifeTimeGradients()!}
|
|
|
|
- label="Lifetime gradients"
|
|
|
|
- docLink="https://doc.babylonjs.com/babylon101/particles#lifetime"
|
|
|
|
- onCreateRequired={() => {
|
|
|
|
- system.addLifeTimeGradient(0, 1, 1);
|
|
|
|
- this.props.globalState.onCodeChangedObservable.notifyObservers({
|
|
|
|
- object: system,
|
|
|
|
- code: `TARGET.addLifeTimeGradient(0, 1, 1);`
|
|
|
|
- });
|
|
|
|
- }}
|
|
|
|
- host={system}
|
|
|
|
- codeRecorderPropertyName="getLifeTimeGradients()"
|
|
|
|
- mode={GradientGridMode.Factor}
|
|
|
|
- lockObject={this.props.lockObject}/>
|
|
|
|
|
|
+ {
|
|
|
|
+ system instanceof ParticleSystem &&
|
|
|
|
+ <ValueGradientGridComponent globalState={this.props.globalState} gradients={system.getLifeTimeGradients()!}
|
|
|
|
+ label="Lifetime gradients"
|
|
|
|
+ docLink="https://doc.babylonjs.com/babylon101/particles#lifetime"
|
|
|
|
+ onCreateRequired={() => {
|
|
|
|
+ system.addLifeTimeGradient(0, 1, 1);
|
|
|
|
+ this.props.globalState.onCodeChangedObservable.notifyObservers({
|
|
|
|
+ object: system,
|
|
|
|
+ code: `TARGET.addLifeTimeGradient(0, 1, 1);`
|
|
|
|
+ });
|
|
|
|
+ }}
|
|
|
|
+ host={system}
|
|
|
|
+ codeRecorderPropertyName="getLifeTimeGradients()"
|
|
|
|
+ mode={GradientGridMode.Factor}
|
|
|
|
+ lockObject={this.props.lockObject}/>
|
|
|
|
+ }
|
|
</LineContainerComponent>
|
|
</LineContainerComponent>
|
|
<LineContainerComponent globalState={this.props.globalState} title="COLORS">
|
|
<LineContainerComponent globalState={this.props.globalState} title="COLORS">
|
|
<Color4LineComponent label="Color 1" target={system} propertyName="color1"
|
|
<Color4LineComponent label="Color 1" target={system} propertyName="color1"
|
|
@@ -491,51 +501,55 @@ export class ParticleSystemPropertyGridComponent extends React.Component<IPartic
|
|
codeRecorderPropertyName="getColorGradients()"
|
|
codeRecorderPropertyName="getColorGradients()"
|
|
mode={GradientGridMode.Color4}
|
|
mode={GradientGridMode.Color4}
|
|
lockObject={this.props.lockObject}/>
|
|
lockObject={this.props.lockObject}/>
|
|
-
|
|
|
|
- <CheckBoxLineComponent label="Use ramp grandients" target={system} propertyName="useRampGradients"/>
|
|
|
|
- <ValueGradientGridComponent globalState={this.props.globalState} gradients={system.getRampGradients()!}
|
|
|
|
- label="Ramp gradients"
|
|
|
|
- docLink="https://doc.babylonjs.com/babylon101/particles#ramp-gradients"
|
|
|
|
- onCreateRequired={() => {
|
|
|
|
- system.addRampGradient(0, Color3.White());
|
|
|
|
- this.props.globalState.onCodeChangedObservable.notifyObservers({
|
|
|
|
- object: system,
|
|
|
|
- code: `TARGET.addRampGradient(0, BABYLON.Color3.White());`
|
|
|
|
- });
|
|
|
|
- }}
|
|
|
|
- mode={GradientGridMode.Color3}
|
|
|
|
- host={system}
|
|
|
|
- codeRecorderPropertyName="getRampGradients()"
|
|
|
|
- lockObject={this.props.lockObject}/>
|
|
|
|
-
|
|
|
|
- <ValueGradientGridComponent globalState={this.props.globalState} gradients={system.getColorRemapGradients()!}
|
|
|
|
- label="Color remap gradients"
|
|
|
|
- docLink="https://doc.babylonjs.com/babylon101/particles#ramp-gradients"
|
|
|
|
- onCreateRequired={() => {
|
|
|
|
- system.addColorRemapGradient(0, 1, 1);
|
|
|
|
- this.props.globalState.onCodeChangedObservable.notifyObservers({
|
|
|
|
- object: system,
|
|
|
|
- code: `TARGET.addColorRemapGradient(0, 1, 1);`
|
|
|
|
- });
|
|
|
|
- }}
|
|
|
|
- host={system}
|
|
|
|
- codeRecorderPropertyName="getColorRemapGradients()"
|
|
|
|
- mode={GradientGridMode.Factor}
|
|
|
|
- lockObject={this.props.lockObject}/>
|
|
|
|
- <ValueGradientGridComponent globalState={this.props.globalState} gradients={system.getAlphaRemapGradients()!}
|
|
|
|
- label="Alpha remap gradients"
|
|
|
|
- docLink="https://doc.babylonjs.com/babylon101/particles#ramp-gradients"
|
|
|
|
- onCreateRequired={() => {
|
|
|
|
- system.addAlphaRemapGradient(0, 1, 1);
|
|
|
|
- this.props.globalState.onCodeChangedObservable.notifyObservers({
|
|
|
|
- object: system,
|
|
|
|
- code: `TARGET.addAlphaRemapGradient(0, 1, 1);`
|
|
|
|
- });
|
|
|
|
- }}
|
|
|
|
- host={system}
|
|
|
|
- codeRecorderPropertyName="getAlphaRemapGradients()"
|
|
|
|
- mode={GradientGridMode.Factor}
|
|
|
|
- lockObject={this.props.lockObject}/>
|
|
|
|
|
|
+ {
|
|
|
|
+ system instanceof ParticleSystem &&
|
|
|
|
+ <>
|
|
|
|
+ <CheckBoxLineComponent label="Use ramp grandients" target={system} propertyName="useRampGradients"/>
|
|
|
|
+ <ValueGradientGridComponent globalState={this.props.globalState} gradients={system.getRampGradients()!}
|
|
|
|
+ label="Ramp gradients"
|
|
|
|
+ docLink="https://doc.babylonjs.com/babylon101/particles#ramp-gradients"
|
|
|
|
+ onCreateRequired={() => {
|
|
|
|
+ system.addRampGradient(0, Color3.White());
|
|
|
|
+ this.props.globalState.onCodeChangedObservable.notifyObservers({
|
|
|
|
+ object: system,
|
|
|
|
+ code: `TARGET.addRampGradient(0, BABYLON.Color3.White());`
|
|
|
|
+ });
|
|
|
|
+ }}
|
|
|
|
+ mode={GradientGridMode.Color3}
|
|
|
|
+ host={system}
|
|
|
|
+ codeRecorderPropertyName="getRampGradients()"
|
|
|
|
+ lockObject={this.props.lockObject}/>
|
|
|
|
+
|
|
|
|
+ <ValueGradientGridComponent globalState={this.props.globalState} gradients={system.getColorRemapGradients()!}
|
|
|
|
+ label="Color remap gradients"
|
|
|
|
+ docLink="https://doc.babylonjs.com/babylon101/particles#ramp-gradients"
|
|
|
|
+ onCreateRequired={() => {
|
|
|
|
+ system.addColorRemapGradient(0, 1, 1);
|
|
|
|
+ this.props.globalState.onCodeChangedObservable.notifyObservers({
|
|
|
|
+ object: system,
|
|
|
|
+ code: `TARGET.addColorRemapGradient(0, 1, 1);`
|
|
|
|
+ });
|
|
|
|
+ }}
|
|
|
|
+ host={system}
|
|
|
|
+ codeRecorderPropertyName="getColorRemapGradients()"
|
|
|
|
+ mode={GradientGridMode.Factor}
|
|
|
|
+ lockObject={this.props.lockObject}/>
|
|
|
|
+ <ValueGradientGridComponent globalState={this.props.globalState} gradients={system.getAlphaRemapGradients()!}
|
|
|
|
+ label="Alpha remap gradients"
|
|
|
|
+ docLink="https://doc.babylonjs.com/babylon101/particles#ramp-gradients"
|
|
|
|
+ onCreateRequired={() => {
|
|
|
|
+ system.addAlphaRemapGradient(0, 1, 1);
|
|
|
|
+ this.props.globalState.onCodeChangedObservable.notifyObservers({
|
|
|
|
+ object: system,
|
|
|
|
+ code: `TARGET.addAlphaRemapGradient(0, 1, 1);`
|
|
|
|
+ });
|
|
|
|
+ }}
|
|
|
|
+ host={system}
|
|
|
|
+ codeRecorderPropertyName="getAlphaRemapGradients()"
|
|
|
|
+ mode={GradientGridMode.Factor}
|
|
|
|
+ lockObject={this.props.lockObject}/>
|
|
|
|
+ </>
|
|
|
|
+ }
|
|
</LineContainerComponent>
|
|
</LineContainerComponent>
|
|
<LineContainerComponent globalState={this.props.globalState} title="ROTATION">
|
|
<LineContainerComponent globalState={this.props.globalState} title="ROTATION">
|
|
<FloatLineComponent lockObject={this.props.lockObject} label="Min angular speed" target={system} propertyName="minAngularSpeed" onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
|
|
<FloatLineComponent lockObject={this.props.lockObject} label="Min angular speed" target={system} propertyName="minAngularSpeed" onPropertyChangedObservable={this.props.onPropertyChangedObservable} />
|