public void CheckAttributes() { var init = ScriptableObject.CreateInstance <ContextTestInit>(); var update = ScriptableObject.CreateInstance <ContextTestUpdate>(); var output = ScriptableObject.CreateInstance <ContextTestOutput>(); init.LinkTo(update); update.LinkTo(output); VFXData data = init.GetData(); data.CollectAttributes(); Assert.AreEqual(4, data.GetNbAttributes()); Assert.IsTrue(data.IsAttributeStored(attrib1)); Assert.IsTrue(data.IsAttributeStored(attrib2)); Assert.IsTrue(data.IsAttributeLocal(attrib3)); Assert.IsTrue(data.IsAttributeLocal(attrib4)); Assert.IsTrue(data.IsCurrentAttributeRead(attrib1)); Assert.IsTrue(data.IsCurrentAttributeRead(attrib2)); Assert.IsTrue(data.IsCurrentAttributeRead(attrib3)); Assert.IsFalse(data.IsCurrentAttributeRead(attrib4)); Assert.IsTrue(data.IsCurrentAttributeWritten(attrib1)); Assert.IsTrue(data.IsCurrentAttributeWritten(attrib2)); Assert.IsFalse(data.IsCurrentAttributeWritten(attrib3)); Assert.IsTrue(data.IsCurrentAttributeWritten(attrib4)); }
public static IEnumerable <VFXAttributeInfo> GetReadableSizeAttributes(VFXData data, int nbComponents = 3) { if (nbComponents < 1 || nbComponents > 3) { throw new ArgumentException("NbComponents must be between 1 and 3"); } if (nbComponents >= 1) { yield return(new VFXAttributeInfo(VFXAttribute.SizeX, VFXAttributeMode.Read)); } if (nbComponents >= 2 && data.IsCurrentAttributeWritten(VFXAttribute.SizeY)) { yield return(new VFXAttributeInfo(VFXAttribute.SizeY, VFXAttributeMode.Read)); } if (nbComponents >= 3 && data.IsCurrentAttributeWritten(VFXAttribute.SizeZ)) { yield return(new VFXAttributeInfo(VFXAttribute.SizeZ, VFXAttributeMode.Read)); } }
internal static string CheckAlive(VFXData data) { var hasLifetime = data?.IsCurrentAttributeWritten(VFXAttribute.Alive) == true; if (hasLifetime) { return($@"{data.GetLoadAttributeCode(VFXAttribute.Alive, "isAlive", "index")} if (!isAlive) return; "); } return(""); }