I have proceeded to create a custom MorphControl object (cage) with custom grips. Everything works OK, except in the phase where in the custom grips class a new object is created using the NewObject function. I am not sure how to proceed there; if I only update the shape of the cage in the morph control, the captive object is not updated; if I also replace the captive object with the updated shape I get a warning about “dragging has released the captive object”.
An example on how to update the captive object of a custom MorphControl would be very much appreciated.
I’ll try to work something up when I get back in the office after the new year. All of this is fairly complicated stuff, so no surprise you are struggling.
Upon further inspection, there isn’t any magic that I can provide you. The limitation, in this case, is imposed by the morph controls’ grip object. When you drag a morph control grip and the morph control has capture a Brep, then the underlying code always news up a new CRhinoBrepObject. So, there is nothing you can do work around this as far as cage editing is concerned.
But you do have a custom object. Thus, you can create whatever custom grips you want - even ones that emulate cage editing. That’s about all I can suggest for now.
I do have custom grips and I was indeed trying to emulate cage editing. I followed the example on custom grips as outlined here https://github.com/mcneel/Rhino5Samples_CPP/tree/master/SampleCustomGrips
In this example, the custom grips class has a function NewObject that creates a new grips object when the grips edit has been performed (e.g. after dragging).
Now, my question is, how to implement the NewObject function for a custom grips object that emulates a cage. My custom grips (CMyMorphGrips) control a custom morph object (CMyMorphControl) which has captured a CRhinoBrepObject. What I naively tried was to perform the Morph on the Brep of the CRhinoBrepObject and replace the result in the document and return a new CMyMorphControl. At thant point, I get the warning that the object was released from its cage. Even re-capturing it in the newly created CMyMorphControl did not work.
So, my question is centred around the problem: how to update the CRhinoBrepObject in the document after performing the requested Morph, without releasing it from the CMyMorphControl
Basically, in the original example the control hierarchy is
custom grips -> rectangle
but now I have
custom grips -> morph control -> captured object
so I"m trying to control the captured object at one level of indirection extra. I hope this makes sense