public static void ReasignNodeParent(InAudioNode current, InAudioNode newParent) { if (current._parent._type == AudioNodeType.Random) { //Remove self from parent random int currentIndexInParent = current._parent._children.IndexOf(current); (current._parent._nodeData as RandomData).weights.RemoveAt(currentIndexInParent); } RemoveFromParent(current); current.AssignParent(newParent); if (newParent._type == AudioNodeType.Random) { (newParent._nodeData as RandomData).weights.Add(50); } }
public static void AddNewParent(InAudioNode node, AudioNodeType parentType) { InUndoHelper.RecordObject(new Object[] { node, node._parent }, "Undo Add New Parent for " + node.Name); var newParent = CreateNode(node.gameObject, node._parent, parentType); var oldParent = node._parent; newParent.MixerGroup = node.MixerGroup; newParent.EditorSettings.IsFoldedOut = true; int index = oldParent._children.FindIndex(node); NodeWorker.RemoveFromParent(node); node.AssignParent(newParent); OnRandomNode(newParent); NodeWorker.RemoveFromParent(newParent); oldParent._children.Insert(index, newParent); }
public static void AddNewParent(InAudioNode node, AudioNodeType parentType) { UndoHelper.RecordObject(new Object[] { node, node.Parent, node.GetBankDirect() }, "Undo Add New Parent for " + node.Name); var newParent = CreateNode(node.gameObject, node.Parent, parentType); var oldParent = node.Parent; newParent.Bus = node.Bus; newParent.FoldedOut = true; if (node.Type == AudioNodeType.Folder) { InFolderData data = (InFolderData)newParent.NodeData; data.BankLink = oldParent.GetBank(); } int index = oldParent.Children.FindIndex(node); NodeWorker.RemoveFromParent(node); node.AssignParent(newParent); OnRandomNode(newParent); NodeWorker.RemoveFromParent(newParent); oldParent.Children.Insert(index, newParent); }
public static void AddNewParent(InAudioNode node, AudioNodeType parentType) { InUndoHelper.RecordObject(new Object[] { node, node._parent, node.GetBank() }, "Undo Add New Parent for " + node.Name); var newParent = CreateNode(node.gameObject, node._parent, parentType); var oldParent = node._parent; newParent.MixerGroup = node.MixerGroup; newParent.FoldedOut = true; if (node._type == AudioNodeType.Folder) { InFolderData data = (InFolderData)newParent._nodeData; data.BankLink = oldParent.GetBank(); } int index = oldParent._children.FindIndex(node); NodeWorker.RemoveFromParent(node); node.AssignParent(newParent); OnRandomNode(newParent); NodeWorker.RemoveFromParent(newParent); oldParent._children.Insert(index, newParent); }