Browse Source

Copy commands in execution order, not selection order

master
chrisgregan 10 years ago
parent
commit
834e1de34e
  1. 18
      Assets/Fungus/FungusScript/Editor/SequenceEditor.cs

18
Assets/Fungus/FungusScript/Editor/SequenceEditor.cs

@ -530,15 +530,19 @@ namespace Fungus
CommandCopyBuffer commandCopyBuffer = CommandCopyBuffer.GetInstance(); CommandCopyBuffer commandCopyBuffer = CommandCopyBuffer.GetInstance();
commandCopyBuffer.Clear(); commandCopyBuffer.Clear();
foreach (Command command in fungusScript.selectedCommands) // Scan through all commands in execution order to see if each needs to be copied
foreach (Command command in fungusScript.selectedSequence.commandList)
{ {
System.Type type = command.GetType(); if (fungusScript.selectedCommands.Contains(command))
Command newCommand = Undo.AddComponent(commandCopyBuffer.gameObject, type) as Command;
System.Reflection.FieldInfo[] fields = type.GetFields();
foreach (System.Reflection.FieldInfo field in fields)
{ {
field.SetValue(newCommand, field.GetValue(command)); System.Type type = command.GetType();
Command newCommand = Undo.AddComponent(commandCopyBuffer.gameObject, type) as Command;
System.Reflection.FieldInfo[] fields = type.GetFields();
foreach (System.Reflection.FieldInfo field in fields)
{
field.SetValue(newCommand, field.GetValue(command));
}
} }
} }
} }

Loading…
Cancel
Save