Skip to content

Commit

Permalink
Polish particle system editor
Browse files Browse the repository at this point in the history
  • Loading branch information
julien-moreau committed May 28, 2019
1 parent 02bbb23 commit 71b1034
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/editor/edition-tools/particles/particle-system-tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ export default class ParticleSystemTool extends AbstractEditionTool<ParticleSyst
// Actions
const actions = this.tool.addFolder('Actions');
actions.open();
actions.add(ps, 'preventAutoStart').name('Prevent Auto Start');
actions.add(ps, 'rebuild').name('Rebuild');
actions.add(ps, 'start').name('Start');
actions.add(ps, 'stop').name('Stop');
Expand Down
4 changes: 3 additions & 1 deletion src/editor/particles/asset-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,11 @@ export default class ParticlesAssetComponent implements IAssetComponent {

asset.data.psData.systems.forEach(s => {
const rootUrl = s.textureName ? (s.textureName.indexOf('data:') === 0 ? '' : 'file:') : '';
const ps = ParticleSystem.Parse(s, this.editor.core.scene, rootUrl, false);
const ps = ParticleSystem.Parse(s, this.editor.core.scene, rootUrl, true);
ps.id = Tools.RandomId();
ps.emitter = m;
ps.preventAutoStart = false;
ps.start();

Tags.AddTagsTo(ps, 'added');
this.editor.graph.add({
Expand Down
8 changes: 5 additions & 3 deletions src/tools/particles-creator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ export default class ParticlesCreator extends EditorPlugin {
// Toolbar
this.toolbar = new Toolbar('PARTICLES-CREATOR-TOOLBAR');
this.toolbar.items = [
{ id: 'add', text: 'Add...', caption: 'Add...', img: 'icon-add' },
{ id: 'add', text: 'Add System...', caption: 'Add System...', img: 'icon-add' },
{ id: 'reset', text: 'Reset', caption: 'Reset', img: 'icon-play-game' },
{ type: 'break' },
{ id: 'export', text: 'Export As...', caption: 'Export As...', img: 'icon-export' },
{ type: 'break' },
{ id: 'preset', type: 'menu', text: 'Presets', caption: 'Presets', img: 'icon-particles', items: [
{ id: 'smoke', text: 'Smoke', caption: 'Smoke' },
{ id: 'sun', text: 'Sun', caption: 'Sun' },
{ id: 'rain', text: 'Rain', caption: 'Rain' },
// { id: 'rain', text: 'Rain', caption: 'Rain' },
{ id: 'fire', text: 'Fire', caption: 'Fire' },
{ id: 'explosion', text: 'Explosion', caption: 'Explosion' }
] }
Expand Down Expand Up @@ -208,6 +208,7 @@ export default class ParticlesCreator extends EditorPlugin {
case 'add':
const name = await Dialog.CreateWithTextInput('Particle System name?');
await this.addSystemToSet(ParticlesCreator.DefaultSet.systems[0], name);
this.saveSet();
this.resetSet(true);
break;
// Reset particle systems set
Expand Down Expand Up @@ -328,7 +329,8 @@ export default class ParticlesCreator extends EditorPlugin {
// Remove from tree
this.tree.remove(ps.id);

// Reset
// Save & reset
this.saveSet();
this.resetSet(true);
}

Expand Down

0 comments on commit 71b1034

Please sign in to comment.