Python call of 'copy morphs from' and 'copy joint zones from'

  • I have most of the essential functions for my little Python project, called 1-2-Rig, ready now. Essential steps work for La Femme. Before I link the separate code pieces up I would , but I need some help from you people to smooth one last hiccup.

    Let me explain what 1-2-Rig contains.

    1 - Python code to group a mesh I loaded as a .obj file (based on boolean functions defined in xyz space for the current target figures: PE and La Femme. Thank you Mr. PhilC for the basic concept.)
    2 - Python calls to let Poser save that .obj as it is: a prop .obj with facet groups.
    3 - Python calls to let Poser save a copy of my mannequin (a clothing-optimized figure conformed to target with all the relavant morphs. Thank you Erogensis for the concept ) to my Runtime library; adds a .cr2, a .obj, and a .png.
    4 - System python calls to modify the figureres comments in the .cr2 with calls to the geometry I just saved. and delete the generated .obj file (tbd, but should not be a challenge)
    5 - Python calls to let Poser load my saved figure with the generated geomety. At this point in time the figure would blow apart when posed because vertex indices in weight maps and morphs, so shold not be touched.
    6 - Python calls to let Poser think the user made the 'Copy Morphs from ...' function (1739) from the menu. (thank you all who helped me there)
    7 - NEEDED - Python code to let Poser think the mannequin figure was selected, the dialog OK button hit, and the OK button of the morphs selection hit. ( so Poser will overwrite the mapping of the morphs to the mesh of the garment)
    8 - Python calls to let Poser think the user made the 'Copy Joint Zones from ...' function (1718) from the menu. (again thank you all who helped me there)
    9 - NEEDED - Python code to let Poser think the mannequin figure was selected as the source and the dialog OK button was hit, ( so Poser will map the morphs to the mesh of the garment)
    10 - Python calls to conform the new garment to the target figure.

    The result, you may have guessed that much by now, is a rigged conformer figure that, as far as I can see from test done up to now nicely follows the LaFemme figure it is conformed to. I need to confirm correct function with PE.
    The result is rough, quick and dirty and it contains loads of bones and other stuff that the garment will not need. It is meant for single use only.

    1-2-Rig of course ties in with the MDBridge for Poser. The idea is to use the conformed version of the garment for the scene setup, and use the result of the simulation in the final render, so we get for La Femme wearing BF's shirt (where is that guy, by the way?) from the dreadful conformer behaviour: (FYI this is the 1-2-Rig garment)
    to something looking a lot more like it should be, with the loose sleeves slid down the arms, the shirt nicely hung from her butt, and the front panels split at the centre to make space for the knee.

    The whole thing could run automatically but there are two points that need user intervention. This is not because the user has to do something necessary ot useful. No. He just need to make up for two missing methods in PoserPython's Figure class:
    <NoneType> CopyJointZonesFrom(<FigureType> sourcefigure) and
    <NoneType> CopyMorphsFrom(SelectFigure(<FigureType> sourcefigure), {<StringType list> morphs = ALL})

    So this is the background. Let me formulate my question: If the name of the mannequin is always the same: MDBasis. Then is there a Python trick to let Poser act as if the user selected the mannequin to copy morphs and joint zones from, and that he selected all the morphs for copy?

  • If I recall correctly, these issues were addressed and used in the script that allowed you to create a WM V4 - you can get a copy of the script here ->V4 Weight Mapped

  • @structure: Thank you for the answer.
    Where the operaation performed has some similarity, the main differenc was that the injector script for V4WM wrote a set of weight maps into a CR2 for a known geometry. It was mainly removing some items from a .cr2 and writing some new info into it, For 1-2-Rig the target geometry is not known and we need the poser functions.
    I did not find a location where the script actually simulates user input, but maybe I overlook something.

  • Juist hammering on. Testing baggy 'harem' pants.
    Product of the procedure I want to automate, be it I started the partial script steps manually and did the .cr2 file editing manually. There was one vertex in the upper thigh that cross-contaminated between left leg and right leg. I corrected that before I made the shots.
    and a combination with a gamurra made in same process:

    I just need to get away from this frigging manual selecting of 'MDBasis' and hitting OK keys.

  • @f_verbaas Not bad, but that crotch needs some work.

  • @f_verbaas looks good, if this was windows only I would suggest using sendkeys (ISTR there is an implementation in python), not sure if there is an equivalent in Mac though

  • Poser Ambassadors

    Good remark Earl.

    The hip group on some figures is very small in the crotch area, just like the chest group can get very small between the collars on some figures.

    All "autogrouping" tools are having issues in these area's because they try to weld rThigh and lThigh together just like they try to weld rCollar and lColalr together. This results in mesh cracks (weld cracks).

  • @eclark1849
    Thanks. Indeed I did not work on that area. This was just to see if the pants follow the figure correctly. Had it not been for the shots I did show I would not even have bothered about the spike.
    In the end this pants is just a disposable placeholder for the prop version from MD. It takes one mouse click (plus a few more because PythonAPI misses some functions) and an odd second of processing to make. It helps me to see color and volume while posing. I would never use a conformer for his garment for this pose in this view.