access the target of pose morph [SOLVED]

On 08/09/2016 at 11:06, xxxxxxxx wrote:

hi , 
I tried to add an object to morph "target" option

    obj = doc.GetActiveObject()
    corr= obj.GetDownLast()  #get the last child  
    if not corr : return False
    pmTag = obj.GetTag(c4d.Tposemorph) 
    mo = pmTag.AddMorph()
    pmTag.UpdateMorphs()
    count =mo.GetID()
    Id = 1000 + count*100 +1
    print Id
    pmTag[c4d.ID_CA_POSE_TARGET,Id]=corr
    c4d.EventAdd()

I wanted to add it to the last morph (the one that was created with the script ) , so I made a little cheat get the Id , then do some math to match the style of the index (1101,1201,1301...etc )
this cheat worked with the strength (I used the Id 4000 ) 
but it does not seem to work with the target , it only affect the selected morph . 
is there any way to make it affect specific morph ?
or "force " select a morph with its index ?
when I was searching in the older post , I found similar topic with C++ , but someone mentioned that Maxon made the tree view private so it is not possible to access it . 
is there any workaround to this problem ?

On 09/09/2016 at 01:42, xxxxxxxx wrote:

Hello,

if I understand your intentions correctly you want to add a new morph and set the "Target" parameter?

The pose morph tag has a dedicated API to use this tag: CAPoseMorphTag. This class includes SetActiveMorphIndex() which can be used to select a morph. With that morph select you can simply set the parameter:

  
# create new morph  
morph = morphTag.AddMorph()  
if morph is None:  
     return  
  
morph.SetName("New Morph")  
  
# select latest morph  
count = morphTag.GetMorphCount()  
morphTag.SetActiveMorphIndex(count-1)  
  
# set "Target"  
morphTag[c4d.ID_CA_POSE_TARGET] = targetObject  
  
c4d.EventAdd()  

best wishes,
Sebastian

On 09/09/2016 at 09:37, xxxxxxxx wrote:

thanks for help , 
it is working as expected :) 
I didn't have this method in my python SDK , because I didn't updated it . 
just to be sure , the user have to use the latest update of cinema 4d R17(.053) to use the script ?

On 12/09/2016 at 00:20, xxxxxxxx wrote:

Hello,

yes, some functions were added to the CAPoseMorphTag class with R17 SP3. So these functions are only available for users of this service pack or of R18.

best wishes,
Sebastian