Skip to main content
12-Amethyst
July 23, 2021
Solved

API to copy MPMOperation

  • July 23, 2021
  • 2 replies
  • 1752 views

Hello,

 

Is there an API to make a copy of an MPMOperation ?

 

Thanks,

Best answer by rzemmali

I used CopyMPMOperationDelegate and it worked fine :

CopyMPMOperationDelegate delegate = new CopyMPMOperationDelegate();
MPMOperation copy =(MPMOperation) delegate.newCopy(original);

 

Just one remark: Name and Description will not be copied so just use getters and setters.

2 replies

18-Opal
August 17, 2021

@rzemmali 

Try this:

 

To copy an operation

MPMOperation copiedOp = MPMOperation.newMPMOperation(<the MPMOperation to be copied>);

 

To make a new operation from scratch

MPMOperation newOp = MPMOperation.newMPMOperation();

 

Hope this helps,

 

David

rzemmali12-AmethystAuthorAnswer
12-Amethyst
August 19, 2021

I used CopyMPMOperationDelegate and it worked fine :

CopyMPMOperationDelegate delegate = new CopyMPMOperationDelegate();
MPMOperation copy =(MPMOperation) delegate.newCopy(original);

 

Just one remark: Name and Description will not be copied so just use getters and setters.