MackeyK24 Posted November 9, 2016 Share Posted November 9, 2016 I have the following particle system serialized into the scene... works great except for that fact that they always auto start the particles... What if i don't want some to start at scene load, but ill start them later... Is there some kinda of 'autoStart' flag we can add to deserialization that will only start a deserialized particle system if autostart is set to true, other you will have to call particles.start() in code. Here is the following son i have for the particle system but see any kind of 'started' flags that be set: { "emitterId" : "1d03dbd4-f86a-4ee3-b11a-1e99606bf25a", "gravity" : [ 0, -9.81, 0 ], "direction1" : [ -7, 8, 3 ], "direction2" : [ 7, 8, -3 ], "minEmitBox" : [ -1, 0, 0 ], "maxEmitBox" : [ 1, 0, 0 ], "color1" : [ 0.8161765, 0.390084326, 0.390084326, 1 ], "color2" : [ 0.06893382, 0.375, 0.134368643, 1 ], "colorDead" : [ 0.350237876, 0.399548054, 0.5808823, 1 ], "deadAlpha" : 0, "emitRate" : 1000, "updateSpeed" : 0.01, "targetStopFrame" : 5, "minEmitPower" : 1, "maxEmitPower" : 3, "minLifeTime" : 0.3, "maxLifeTime" : 1.5, "minSize" : 0.1, "maxSize" : 0.5, "minAngularSpeed" : 0, "maxAngularSpeed" : 3.14, "textureName" : "Flare.png", "blendMode" : 0, "capacity" : 500, "textureMask" : [ 0, 0, 0, 0 ], "linkToEmitter" : true, "name" : "solo1" } Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted November 9, 2016 Author Share Posted November 9, 2016 I found it... But it is NOT in the BabylonExporter.Entities assembly... Neither is Name or id (it looks like it default name to id though)... Si i had to subclass it like so: [DataContract] public class UnityParticleSystem : BabylonExport.Entities.BabylonParticleSystem { [DataMember] public string name; [DataMember] public bool preventAutoStart; } Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted November 9, 2016 Share Posted November 9, 2016 just dont emitter.start() ? Ok I reread... how are you creating it? I would create a blank emitter never ;start it set it to isVisible = false; then when you wanna unseralize your settings just iterate through your object keys and set the matching values on the cloned particle system, with a flag to turn it on as you spoke of or not. Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted November 9, 2016 Share Posted November 9, 2016 @Pryme8 I think what he means is that he have a particle system in a .babylon file, which autostarts when the file is loaded (without calling emitter.start()) Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted November 9, 2016 Share Posted November 9, 2016 is there a tag in blender to stop that? I do nothing with .babylon files i wont even touch them... o_O OBJ and FBX all day all day.... or my own 3d file type for what ever project so I don't think I will be much help with this topic then if its about a bjs file... now if its a JSON object and (which a bjs file is i think) its the approach I described above. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 10, 2016 Share Posted November 10, 2016 Do you mind updating the BabylonParticleSystem class: https://github.com/BabylonJS/Babylon.js/blob/master/Exporters/3ds Max/BabylonExport.Entities/BabylonParticleSystem.cs Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted November 10, 2016 Share Posted November 10, 2016 If you would be so kind as to point me to some good resources to learn typescript? Im all vanilla js so this is kinda gibberish to me for right now. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 10, 2016 Share Posted November 10, 2016 I suggest trying the typescript playground, it is a good starter http://www.typescriptlang.org/play/index.html Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted November 11, 2016 Share Posted November 11, 2016 quick question what is the point of TS? I mean learn another language to do what I already know how to do in JS? is there any specific benefit? Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted November 11, 2016 Author Share Posted November 11, 2016 Hey Delta... I actually have a few missing entities ... I will PR them.. But There is no BabylonShaderMaterial.cs So i created one that i am using in my BabylonJS Toolkit for unity. But i use Dictionaries some some of ht floats and colors and vectors... I could see anywhere else you have something structured like that so i just made one... It works great. I have build in Babylon.ShaderMaterial support direct from unity WITH NO CLIENT CODE necessary, all thru de-serialization or Parsing. Anyways, take a look and tell me if you want this Babylon.ShaderMaterial class added to the PR for 3ds max entities project: using System.Collections.Generic; using System.Runtime.Serialization; namespace BabylonExport.Entities { [DataContract] public class BabylonShaderMaterial : BabylonMaterial { [DataMember] public string customType { get; private set; } [DataMember] public object shaderPath { get; set; } [DataMember] public BabylonShaderOptions options { get; set; } [DataMember] public Dictionary<string, object> textures { get; set; } [DataMember] public Dictionary<string, object[]> textureArrays { get; set; } [DataMember] public Dictionary<string, object> floats { get; set; } [DataMember] public Dictionary<string, object[]> floatArrays { get; set; } [DataMember] public Dictionary<string, object> colors3 { get; set; } [DataMember] public Dictionary<string, object> colors4 { get; set; } [DataMember] public Dictionary<string, object> vectors2 { get; set; } [DataMember] public Dictionary<string, object> vectors3 { get; set; } [DataMember] public Dictionary<string, object> vectors4 { get; set; } [DataMember] public Dictionary<string, object> matrices { get; set; } [DataMember] public Dictionary<string, object> matrices2x2 { get; set; } [DataMember] public Dictionary<string, object> matrices3x3 { get; set; } [DataMember] public Dictionary<string, object[]> vectors3Arrays { get; set; } public BabylonShaderMaterial() { this.customType = "BABYLON.ShaderMaterial"; this.shaderPath = null; this.options = new BabylonShaderOptions(); this.textures = new Dictionary<string, object>(); this.textureArrays = new Dictionary<string, object[]>(); this.floats = new Dictionary<string, object>(); this.floatArrays = new Dictionary<string, object[]>(); this.colors3 = new Dictionary<string, object>(); this.colors4 = new Dictionary<string, object>(); this.vectors2 = new Dictionary<string, object>(); this.vectors3 = new Dictionary<string, object>(); this.vectors4 = new Dictionary<string, object>(); this.matrices = new Dictionary<string, object>(); this.matrices2x2 = new Dictionary<string, object>(); this.matrices3x3 = new Dictionary<string, object>(); this.vectors3Arrays = new Dictionary<string, object[]>(); } } [DataContract] public class BabylonShaderOptions { [DataMember] public string[] attributes { get; set; } [DataMember] public string[] uniforms { get; set; } [DataMember] public bool needAlphaBlending { get; set; } [DataMember] public bool needAlphaTesting { get; set; } [DataMember] public string[] samplers { get; set; } [DataMember] public string[] defines { get; set; } public BabylonShaderOptions() { this.attributes = null; this.uniforms = null; this.needAlphaBlending = false; this.needAlphaTesting = false; this.samplers = null; this.defines = null; } } } Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted November 11, 2016 Author Share Posted November 11, 2016 Also... I made this HDRCubeTexture... Do want this PR as well: using System.Runtime.Serialization; namespace BabylonExport.Entities { [DataContract] public class BabylonHDRCubeTexture : BabylonTexture { [DataMember] public string customType { get; private set; } [DataMember] public int size { get; set; } [DataMember] public bool useInGammaSpace { get; set; } [DataMember] public bool generateHarmonics { get; set; } [DataMember] public bool usePMREMGenerator { get; set; } [DataMember] public bool isBABYLONPreprocessed { get; set; } public BabylonHDRCubeTexture() { this.customType = "BABYLON.HDRCubeTexture"; this.size = 0; this.isCube = true; this.useInGammaSpace = false; this.generateHarmonics = true; this.usePMREMGenerator = false; this.isBABYLONPreprocessed = false; } } } Quote Link to comment Share on other sites More sharing options...
DigiHz Data Posted November 11, 2016 Share Posted November 11, 2016 FYI Discussion i started about this issue is here: Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted November 11, 2016 Share Posted November 11, 2016 So Ts like constructs all your setter and getters automatically or something? Quote Link to comment Share on other sites More sharing options...
MackeyK24 Posted November 11, 2016 Author Share Posted November 11, 2016 No... Typescript is basically a strong type like language (a lot like the old Adobe ActionScript AS3)... It uses Es6 style syntax... var mystring:String = "Hello" and many other language syntax features... This ES6 style script is 'transpiled' or 'compiled' to ES5 regular Javascript. The main advantage is that you can write your web application (Especially Larger Web Applications) using a strong type language and all its language features... But at its heart... It ultimately ends up as regulate javascript. Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted November 11, 2016 Share Posted November 11, 2016 So truly, if you know how to do all the constructors and prototypes wrapping and timeouts then there is really no point? I was kinda interested because at face value it looks like less work but then again to have to compile my script every time I save it.. yeah but no. I think ill just keep powerleveling in plain old js. AS2 and AS3 ahhh man I remember those days RIP flash... Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 14, 2016 Share Posted November 14, 2016 @MackeyK24 You ROCK! Thank you so much for your help on the Unity Exporter. You are literally nailing it Sebavan 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.