Skip to main content
Jul 23, 2021 7:55 AM UTC
Solved

API to copy MPMOperation

Hello,

 

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

 

Thanks,

rzemmaliAnswer
Aug 19, 2021 2:54 PM UTC

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

Aug 17, 2021 3:58 PM UTC

@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

rzemmaliAuthorAnswer
Aug 19, 2021 2:54 PM UTC

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.