static void CreateContextMenu(MenuCommand menuCommand) { if (CheckMenu()) { Remap p = AutoPipe.CreateGameObjectWithComponent <Remap>(menuCommand); } }
public override void Read(AssetReader reader) { base.Read(reader); Strength.Read(reader); StrengthY.Read(reader); StrengthZ.Read(reader); SeparateAxes = reader.ReadBoolean(); reader.AlignStream(AlignType.Align4); Frequency = reader.ReadSingle(); Damping = reader.ReadBoolean(); reader.AlignStream(AlignType.Align4); Octaves = reader.ReadInt32(); OctaveMultiplier = reader.ReadSingle(); OctaveScale = reader.ReadSingle(); Quality = (ParticleSystemNoiseQuality)reader.ReadInt32(); ScrollSpeed.Read(reader); Remap.Read(reader); RemapY.Read(reader); RemapZ.Read(reader); RemapEnabled = reader.ReadBoolean(); if (IsAlign(reader.Version)) { reader.AlignStream(AlignType.Align4); } if (IsReadPositionAmount(reader.Version)) { PositionAmount.Read(reader); RotationAmount.Read(reader); SizeAmount.Read(reader); } }
public override void Read(AssetStream stream) { base.Read(stream); Strength.Read(stream); StrengthY.Read(stream); StrengthZ.Read(stream); SeparateAxes = stream.ReadBoolean(); stream.AlignStream(AlignType.Align4); Frequency = stream.ReadSingle(); Damping = stream.ReadBoolean(); stream.AlignStream(AlignType.Align4); Octaves = stream.ReadInt32(); OctaveMultiplier = stream.ReadSingle(); OctaveScale = stream.ReadSingle(); Quality = stream.ReadInt32(); ScrollSpeed.Read(stream); Remap.Read(stream); RemapY.Read(stream); RemapZ.Read(stream); RemapEnabled = stream.ReadBoolean(); if (IsAlign(stream.Version)) { stream.AlignStream(AlignType.Align4); } if (IsReadPositionAmount(stream.Version)) { PositionAmount.Read(stream); RotationAmount.Read(stream); SizeAmount.Read(stream); } }
public static ProcessResultArray <Clip> ProcessCommand(Command command, Clip[] incomingClips, ClipMetaData targetMetadata) { var clips = new Clip[incomingClips.Length]; for (var i = 0; i < incomingClips.Length; i++) { clips[i] = new Clip(incomingClips[i]); } return(command.Id switch { TokenType.Arpeggiate => Arpeggiate.Apply(command, clips), TokenType.Concat => Concat.Apply(clips), TokenType.Crop => Crop.Apply(command, clips), TokenType.Filter => Filter.Apply(command, clips), TokenType.Interleave => Interleave.Apply(command, targetMetadata, clips), TokenType.Legato => Legato.Apply(clips), TokenType.Mask => Mask.Apply(command, clips), TokenType.Monophonize => Monophonize.Apply(clips), TokenType.Padding => Padding.Apply(command, clips), TokenType.Quantize => Quantize.Apply(command, clips), TokenType.Ratchet => Ratchet.Apply(command, clips), TokenType.Relength => Relength.Apply(command, clips), TokenType.Remap => Remap.Apply(command, clips), TokenType.Resize => Resize.Apply(command, clips), TokenType.Scale => Scale.Apply(command, clips), TokenType.Scan => Scan.Apply(command, clips), TokenType.SetLength => SetLength.Apply(command, clips), TokenType.SetPitch => SetPitch.Apply(command, clips), TokenType.SetRhythm => SetRhythm.Apply(command, clips), TokenType.Shuffle => Shuffle.Apply(command, clips), TokenType.Skip => Skip.Apply(command, clips), TokenType.Slice => Slice.Apply(command, clips), TokenType.Take => Take.Apply(command, clips), TokenType.Transpose => Transpose.Apply(command, clips), TokenType.VelocityScale => VelocityScale.Apply(command, clips), TokenType.InterleaveEvent => ((Func <ProcessResultArray <Clip> >)(() => { var(success, msg) = OptionParser.TryParseOptions(command, out InterleaveOptions options); if (!success) { return new ProcessResultArray <Clip>(msg); } options.Mode = InterleaveMode.Event; return Interleave.Apply(options, targetMetadata, clips); }))(), _ => new ProcessResultArray <Clip>($"Unsupported command {command.Id}") });
internal virtual IList <Row> RemoveGaps(int ind, IList <Row> old, IList <Row> to, int[] remap) { remap[ind] = to.Count; Row now = old[ind]; to.Add(now); foreach (Cell c in now.cells.Values) { if (c.@ref >= 0 && remap[c.@ref] < 0) { RemoveGaps(c.@ref, old, to, remap); } } to[remap[ind]] = new Remap(now, remap); return(to); }
public static ProcessResult <Clip[]> ProcessCommand(Command command, Clip[] incomingClips, ClipMetaData targetMetadata) { var clips = new Clip[incomingClips.Length]; for (var i = 0; i < incomingClips.Length; i++) { clips[i] = new Clip(incomingClips[i]); } return(command.Id switch { TokenType.Arpeggiate => Arpeggiate.Apply(command, clips), TokenType.Concat => Concat.Apply(clips), TokenType.Crop => Crop.Apply(command, clips), TokenType.Echo => Echo.Apply(command, clips), TokenType.Extract => Take.Apply(command, clips, true), TokenType.Filter => Filter.Apply(command, clips), TokenType.Invert => Invert.Apply(command, clips), TokenType.Interleave => Interleave.Apply(command, targetMetadata, clips, InterleaveMode.NotSpecified), TokenType.InterleaveEvent => Interleave.Apply(command, targetMetadata, clips, InterleaveMode.Event), TokenType.Legato => Legato.Apply(clips), TokenType.Loop => Loop.Apply(command, clips), TokenType.Mask => Mask.Apply(command, clips), TokenType.Monophonize => Monophonize.Apply(clips), TokenType.Padding => Padding.Apply(command, clips), TokenType.Quantize => Quantize.Apply(command, clips), TokenType.Ratchet => Ratchet.Apply(command, clips), TokenType.Relength => Relength.Apply(command, clips), TokenType.Remap => Remap.Apply(command, clips), TokenType.Resize => Resize.Apply(command, clips), TokenType.Scale => Scale.Apply(command, clips), TokenType.Scan => Scan.Apply(command, clips), TokenType.SetLength => SetLength.Apply(command, clips), TokenType.SetPitch => SetPitch.Apply(command, clips), TokenType.SetRhythm => SetRhythm.Apply(command, clips), TokenType.Shuffle => Shuffle.Apply(command, clips), TokenType.Skip => Skip.Apply(command, clips), TokenType.Slice => Slice.Apply(command, clips), TokenType.Take => Take.Apply(command, clips), TokenType.Transpose => Transpose.Apply(command, clips), TokenType.VelocityScale => VelocityScale.Apply(command, clips), _ => new ProcessResult <Clip[]>($"Unsupported command {command.Id}") });
internal virtual IList <Row> RemoveGaps(int ind, IList <Row> old, IList <Row> to, int[] remap) { remap[ind] = to.Count; Row now = old[ind]; to.Add(now); IEnumerator <Cell> i = now.cells.Values.GetEnumerator(); for (; i.MoveNext();) { Cell c = i.Current; if (c.@ref >= 0 && remap[c.@ref] < 0) { RemoveGaps(c.@ref, old, to, remap); } } to[remap[ind]] = new Remap(now, remap); return(to); }
/// <summary> /// Optimize (remove empty rows) from the given Trie and return the resulting /// Trie. /// </summary> /// <param name="orig">the <see cref="Trie"/> to consolidate</param> /// <returns>the newly consolidated Trie</returns> public override Trie Optimize(Trie orig) { IList <string> cmds = orig.cmds; IList <Row> rows = new JCG.List <Row>(); IList <Row> orows = orig.rows; int[] remap = new int[orows.Count]; for (int j = orows.Count - 1; j >= 0; j--) { Row now = new Remap(orows[j], remap); bool merged = false; for (int i = 0; i < rows.Count; i++) { Row q = Merge(now, rows[i]); if (q != null) { rows[i] = q; merged = true; remap[j] = i; break; } } if (merged == false) { remap[j] = rows.Count; rows.Add(now); } } int root = remap[orig.root]; Arrays.Fill(remap, -1); rows = RemoveGaps(root, rows, new JCG.List <Row>(), remap); return(new Trie(orig.forward, remap[root], cmds, rows)); }
public override YAMLNode ExportYAML(IExportContainer container) { YAMLMappingNode node = (YAMLMappingNode)base.ExportYAML(container); node.Add("strength", Strength.ExportYAML(container)); node.Add("strengthY", StrengthY.ExportYAML(container)); node.Add("strengthZ", StrengthZ.ExportYAML(container)); node.Add("separateAxes", SeparateAxes); node.Add("frequency", Frequency); node.Add("damping", Damping); node.Add("octaves", Octaves); node.Add("octaveMultiplier", OctaveMultiplier); node.Add("octaveScale", OctaveScale); node.Add("quality", (int)Quality); node.Add("scrollSpeed", ScrollSpeed.ExportYAML(container)); node.Add("remap", Remap.ExportYAML(container)); node.Add("remapY", RemapY.ExportYAML(container)); node.Add("remapZ", RemapZ.ExportYAML(container)); node.Add("remapEnabled", RemapEnabled); node.Add("positionAmount", GetExportPositionAmount(container.Version).ExportYAML(container)); node.Add("rotationAmount", GetExportRotationAmount(container.Version).ExportYAML(container)); node.Add("sizeAmount", GetExportSizeAmount(container.Version).ExportYAML(container)); return(node); }
public override YAMLNode ExportYAML(IExportContainer container) { YAMLMappingNode node = (YAMLMappingNode)base.ExportYAML(container); node.Add(StrengthName, Strength.ExportYAML(container)); node.Add(StrengthYName, StrengthY.ExportYAML(container)); node.Add(StrengthZName, StrengthZ.ExportYAML(container)); node.Add(SeparateAxesName, SeparateAxes); node.Add(FrequencyName, Frequency); node.Add(DampingName, Damping); node.Add(OctavesName, Octaves); node.Add(OctaveMultiplierName, OctaveMultiplier); node.Add(OctaveScaleName, OctaveScale); node.Add(QualityName, (int)Quality); node.Add(ScrollSpeedName, ScrollSpeed.ExportYAML(container)); node.Add(RemapName, Remap.ExportYAML(container)); node.Add(RemapYName, RemapY.ExportYAML(container)); node.Add(RemapZName, RemapZ.ExportYAML(container)); node.Add(RemapEnabledName, RemapEnabled); node.Add(PositionAmountName, GetExportPositionAmount(container.Version).ExportYAML(container)); node.Add(RotationAmountName, GetExportRotationAmount(container.Version).ExportYAML(container)); node.Add(SizeAmountName, GetExportSizeAmount(container.Version).ExportYAML(container)); return(node); }
public override YAMLNode ExportYAML(IAssetsExporter exporter) { YAMLMappingNode node = (YAMLMappingNode)base.ExportYAML(exporter); node.Add("strength", Strength.ExportYAML(exporter)); node.Add("strengthY", StrengthY.ExportYAML(exporter)); node.Add("strengthZ", StrengthZ.ExportYAML(exporter)); node.Add("separateAxes", SeparateAxes); node.Add("frequency", Frequency); node.Add("damping", Damping); node.Add("octaves", Octaves); node.Add("octaveMultiplier", OctaveMultiplier); node.Add("octaveScale", OctaveScale); node.Add("quality", Quality); node.Add("scrollSpeed", ScrollSpeed.ExportYAML(exporter)); node.Add("remap", Remap.ExportYAML(exporter)); node.Add("remapY", RemapY.ExportYAML(exporter)); node.Add("remapZ", RemapZ.ExportYAML(exporter)); node.Add("remapEnabled", RemapEnabled); node.Add("positionAmount", PositionAmount.ExportYAML(exporter)); node.Add("rotationAmount", RotationAmount.ExportYAML(exporter)); node.Add("sizeAmount", SizeAmount.ExportYAML(exporter)); return(node); }
public RemapEventArgs(Remap remap) { Remap = remap; }
/// <summary> /// Optimize (remove empty rows) from the given Trie and return the resulting /// Trie. /// </summary> /// <param name="orig">the <see cref="Trie"/> to consolidate</param> /// <returns>the newly consolidated Trie</returns> public override Trie Optimize(Trie orig) { IList<string> cmds = orig.cmds; IList<Row> rows = new List<Row>(); IList<Row> orows = orig.rows; int[] remap = new int[orows.Count]; for (int j = orows.Count - 1; j >= 0; j--) { Row now = new Remap(orows[j], remap); bool merged = false; for (int i = 0; i < rows.Count; i++) { Row q = Merge(now, rows[i]); if (q != null) { rows[i] = q; merged = true; remap[j] = i; break; } } if (merged == false) { remap[j] = rows.Count; rows.Add(now); } } int root = remap[orig.root]; Arrays.Fill(remap, -1); rows = RemoveGaps(root, rows, new List<Row>(), remap); return new Trie(orig.forward, remap[root], cmds, rows); }
internal override Module GetModule() { Module a = GetInputValue <ModuleWrapper>("input0", ModuleWrapper.Zero).m; Module b = GetInputValue <ModuleWrapper>("input1", ModuleWrapper.Zero).m; Module c = GetInputValue <ModuleWrapper>("input2", ModuleWrapper.Zero).m; Module m; if (parameters == null) { parameters = new float[6]; } if (curve == null) { curve = new AnimationCurve(); } switch (opType) { case OperatorType.Select: if (a == null || b == null || c == null) { return(null); } m = new Select(a, b, c, parameters[0], parameters[1], parameters[2]); break; case OperatorType.Curve: if (a == null) { return(null); } m = new Curve(a, curve); break; case OperatorType.Blend: if (a == null || b == null) { return(null); } m = new Blend(a, b, parameters[0]); break; case OperatorType.Remap: if (parameters.Length != 6) { parameters = new float[6]; } if (a == null) { return(null); } m = new Remap(a, parameters); break; case OperatorType.Add: if (a == null || b == null) { return(null); } m = new Add(a, b); break; case OperatorType.Subtract: if (a == null || b == null) { return(null); } m = new Subtract(a, b); break; case OperatorType.Multiply: if (a == null || b == null) { return(null); } m = new Multiply(a, b); break; case OperatorType.Min: if (a == null || b == null) { return(null); } m = new Min(a, b); break; case OperatorType.Max: if (a == null || b == null) { return(null); } m = new Max(a, b); break; case OperatorType.Scale: if (a == null) { return(null); } m = new Scale(a, parameters[0]); break; case OperatorType.ScaleBias: if (a == null) { return(null); } m = new ScaleBias(a, parameters[0], parameters[1]); break; case OperatorType.Abs: if (a == null) { return(null); } m = new Abs(a); break; case OperatorType.Invert: if (a == null) { return(null); } m = new Invert(a); break; case OperatorType.Clamp: if (a == null) { return(null); } m = new Clamp(a, parameters[0], parameters[1]); break; default: m = new Const(parameters[0]); break; } return(m); }