Properly update viewport/scene for CSTO [SOLVED]

On 16/02/2015 at 13:56, xxxxxxxx wrote:

I have a script that does current state to object, that NiklasR showed me some time ago. It works fine, but what I have been finding is that if I wanted to say move a joint and then CSTO that mesh, nothing I do seems to work. If I manually set it and run the script to CSTO it will work. So my question is, what must be done to update the viewport/editor or whatever to make it properly convert in the new pose?

Some pseudocode:

joint.SetRelPos(c4d.Vector(100, 0, 0))

It makes me a duplicate of the mesh, but not at this new deformed pose even though the CSTO code is using GetDeformCache(). The CSTO function basically gets the deform cache, creates a new polygon object with the same number of points, and does SetAllPoints on this new mesh to be the GetAllPoints from the deformCache, and the same for Polygons.

I've tried various EventAdd and DrawViews flags but neither seems to properly update upon duplication. Can someone point me in the right direction?

On 17/02/2015 at 02:32, xxxxxxxx wrote:

Hi Bret,

sometimes GetClone() is needed to make current state operations valid.
This code should work:

  joint4 = doc.SearchObject("Joint.4")  
  mesh = doc.SearchObject("Mesh")  
  pos = joint4.GetRelPos()  
  virtualop = utils.SendModelingCommand(command=c4d.MCOMMAND_CURRENTSTATETOOBJECT,  

Best wishes

On 18/02/2015 at 16:41, xxxxxxxx wrote:

Hi Bret,

I'd like to know if Martin's answer is sufficient or if you need more help?

Joey Gaspe
SDK Support Engineer

On 04/03/2015 at 07:25, xxxxxxxx wrote:


I'll close this topic as solved due to inactivity.

Joey Gaspe
SDK Support Engineer