WelderEngineRevamp icon indicating copy to clipboard operation
WelderEngineRevamp copied to clipboard

Editor Copy command does not work

Open jayrulez opened this issue 1 year ago • 0 comments

Select objects in the editor viewport, hit Space button, then select "Copy" from the list. You will get a error notification: There is no 'ClipboardEvent' available to run the command 'Copy'.

The clipboard changes broke the copy command in the editor. These methods in EditorCommands:

void SaveSelectionToClipboard(Editor* editor, Space* space);
void LoadObjectFromClipboard(Editor* editor, Space* space);

Were changed to

void SaveSelectionToClipboard(ClipboardEvent* event, Space* space);
void LoadObjectFromClipboard(ClipboardEvent* event, Space* space);

The problem with this is in EditorCommands.hpp:Commands2::Execute:

  void Execute(Command* command, CommandManager* manager) override
  {
    pt0* param0 = manager->GetContext()->Get<pt0>();
    pt1* param1 = manager->GetContext()->Get<pt1>();

    if (param0 == NULL)
      return CommandFailed(command, ZilchTypeId(pt0));

    if (param1 == NULL)
      return CommandFailed(command, ZilchTypeId(pt1));

    mFunction(param0, param1);
  }

This line

pt0* param0 = manager->GetContext()->Get<pt0>();

will return NULL since pt0 will be ClipboardEvent. It's responsible for the second part of this issue https://github.com/WelderFoundation/WelderEngineRevamp/issues/11.

jayrulez avatar Oct 28 '23 15:10 jayrulez