question about LoadMorphTargetFile (python)



  • Hello,
    I have a simple question, i just do that in the poser python shell (Poser 10, python 2.7.1):

    obj = poser.Scene().Actor("position0B_1")
    obj.LoadMorphTargetFile("C:\\Temp" , "115.obj")
    

    but the morph is not added in the parameters window of the object ..., no error message either, nothing happens ...
    is not that enough?
    Am I stupid?

    please help ;)..., i need to do some automations with several morph target.



  • I specify that my obj works very well when I use the menu => Object => Load morph target ...



  • @robculp said in question about LoadMorphTargetFile (python):

    Hello,
    I have a simple question, i just do that in the poser python shell (Poser 10, python 2.7.1):

    obj = poser.Scene().Actor("position0B_1")
    obj.LoadMorphTargetFile("C:\\Temp" , "115.obj")
    

    but the morph is not added in the parameters window of the object ..., no error message either, nothing happens ...
    is not that enough?
    Am I stupid?

    please help ;)..., i need to do some automations with several morph target.

    Haven't got poser in front of me but ISTR the LoadMorphTargetFile just takes a path arg so it should be

    	obj = poser.Scene().Actor("position0B_1")
    	obj.LoadMorphTargetFile("C:\\Temp\\115.obj")


  • Hi ,
    Hmm ..., I already tried, I re-try and..no, it makes me the same: it seems to work, no error returned, but no morph is added ..., strange ...
    indeed, there must be a problem with the path ..., sometimes with other syntaxes, Poser ask me to locate "temp" ..., Obviously I missed something...
    I feel like I tried everything yesterday, and when I do:

    poser.Scene().Actor("position0B_1").LoadMorphTargetFile("C:\\Temp\\115.obj")
    

    then, i get a "Error parsing morph target file name"...

    And with:

    poser.Scene().Actor("position0B_1").LoadMorphTargetFile("C:\\Temp", "115.obj")
    

    then, he looks for "temp", and when i use an os.path.join : same ...
    Well, im too stupid..., I'm going to use "Poser file editor" from dimension3D to load my multiple morphs ...

    I will try that with an more recent version of Poser...,
    Thanks anyway, friend ! ;))


  • Poser Ambassadors

    The documentation (both external and internal) for the method LoadMorphTargetFile is incorrect.

    The parameters are file_name, morph_name.

    Try obj.LoadMorphTarget("c:\\Temp\\115.obj", "MyMorph")

    I figured this out by thinking about how a morph target loader method could work without having a second argument for the morph name - it could not possibly work. Therefore there had to be one.



  • @bagginsbill Yep, that works, I was assuming it would do what the UI does and take the morph name to be the same as the file with the .obj stripped out


  • Poser Ambassadors

    My phrasing was off. As you point out, it could work by taking the name from the file. However, while that would be a reasonable behavior, SM are frequently unreasonable, and I would expect to be ABLE to specify the morph name.

    From there, it was an easy guess that you are REQUIRED to specify the morph name.