Some of MHX facial bone (real deform bone) not copy drv bone rotation

Issue #1113 closed
engetudouiti created an issue

So I usually direct manipulate or use controller to pose G3 MHX face, then it worked well (I believed so) but now I clear see, most of facial bone only copy location of drv-bone, but not copy rotation (and scale if it work) of drv bone.

But you make eye-lids bone seems copy location, rotation ^^; (so maybe most of user do not notice it)

Before, we use deform bone as child of drv bone (really old way, without constrain) so it need not copy rotaiton,

but now you use constrain, then each deform bone (face rig bone) and aech drv bone have no relation, but only use constrain.

So even though you rotate facial drv bone, it not rotate actual deform facial bones.

I think it is most important problem which I recently reported ^^; I really do not remember, when it change or you made it so

about MHX …

or was there reason, maybe I forgot, but you can not make it so? As my custom purpose, I may not try to import daz pose (seldom)

but often use already improted basic morphs then if they rotate these facial bones, now I suppose drv bone only rotate, but

deform bone not rotate at all… even though drv bone rotate (drv bone will be driven by each transform propertys, when import pose files. as long as Xin introduced way, and I remember it cicrulate correctly and already work well without issue,,, but we need to rotate real deform bone too (need set off set for user manipulate).. so it must need to copy rotation.. to actually deform with drv bone.

Comments (20)

  1. engetudouiti reporter

    I feel it is really random,, some bone seems remain copy rotation, but some bones not ^^;

    So I suppose,, add on only set copy rotation when we import morph, and when rotate was used , I suppose…. but it should not. because if vendor pose, or custom pose I made, then it need to rotate,

    So there is almost no reason you remove copy rotation, for facial deform bones. all facial bone need, copy-transform and copy-rotation of their drv-bone..

    And I do not confirm if it work or not, but I can find some expression often use bone scale^^;

    so I think at current we can not manipulate it right? (then if you try it, you need to use copy scale too.. you need to remember, new facial bone not child of drv bone anymore..)

  2. engetudouiti reporter

    mmm,,,, we should first add copy location and rotation for almost bone which have drv bone, I think

    eg,, I can see MHX breast twk bone only copy rotation but not location… even though you do not believe, actually I hope to add controller which can transform those bones. at same time without select breast etc… (because I can use it to kind of shape morph. (so change breast pos etc)

    But at current I can only use rotation for this purpose. then even though I made controller in daz studio, which pose (translate) breast bone,, it may not work as I expect..

    Though I do not know if importer auto add constrain, when I import those morph, (eg breast location controller, or cheek bone rotation)

    I may not expect much about bone scale pose, or bone scale pose controller, but about rotate and translate, I hope we can easy make controller which can rotate / translate all drv-bone for bones which not break bone chain.. then it auto copy for deform bone.

  3. engetudouiti reporter

    I tought if it was my miss-understand, then when import custom morph which may drive those bone roation or translation, add on will generate constrain,, but unfortunatelly No.

    I made Simple berast bone transform pose controller,, which transform breast bones. then save it as dsf = real pose controller file.

    then now import it to G3 character .. I do not see any error about this, but console out-put these

    Making missing morphs level 0
    Building drivers
    Building sum drivers

    • lPectoral(drv)
    • rPectoral(drv)
      No rest drivers
      Folder loaded in 0.448 seconds
      Make all bones poseable
      Rig Genesis 3 Female already has extra driven bones
      Rename bones
      Change constraints
      Restore bone drivers
      Restore sum drivers
      Update scripted drivers
      Update drivers
      Update vertex groups
      Update shapekeys
      Make All Bones Poseable completed in 2.3 seconds
      REFRESH JIGGLE LIST
      GENERATING BONES FOR: Genesis 3 Female

    Then now I can find new controller as TK body >> set value as 1.0

    But it only drive Pectoral_drv bones. (so it actually circulate and drive bone location correctly maybe devide as each props >>> but real deform bone have not constrain about location>> my character not deform at all.

    The good thing is, even though there is no constrain, drv bone circulate location correctly.

    so I suppose it is same as facial bone which not have rotation consrtain.

    Then if I add those constrain manually, I suppose, it should work . that means,

    To solve issue, you may only need to check these facial or some tweak deform bones, (which can drive by drv bones, with controllers) and apply copy rotation/copy location, when they are not .

    (so It can be offered by up-date button.. though about my real case,, I already convert as mhx, then need to start from scratch,, to import these controller… ^^;

  4. engetudouiti reporter

    Now I could confirm , you may need to set constrain first. or even though import new pose controller, which roate or translate drv bones, add on script only set new driver, but not generate new constrain.

    I made new facial pose controller (not preset, real controll file) to test it use facial bone rotation.

    Then import it as custom morph >> generate new custom morph (expression ctrl)

    Add on can add new drv.. so drv bone rotate. but it not deform real character.

    Actually add on not generate new constrain for these bone rotation.

    Then I run custom script, it try to check each drv name bone, and find target bone, and add Copy Roatation,Copy location when there is no constrain. (I set ignore “tongue, toe” name bones, because it may cause issue, with current hieralchy,, Though I suppose about tongue bones, if we can change it to all case work…)

    after set constrain correctly, now it show the deform.. (I feel almost same, so believe, all rotation axis correctly used)

    When there is drv-bone (script generate) , it means there should be same name real deform bone. which will copy drv-bone. (when we do not use mirror name)

    So I may recommend, auto add both constrain when generate drv-bone. So all pose controller which rotate, or transform should work as it made.

    I suppose you have rig bone map for G3 or G8, to add constarin, so you may only need to change it then add both constrain, (but should not touch G3 toes / tongue name bones , if I add copy rotation for toes, it may broken, because it already have constrain for toe rotation.)

    I will atach, g3 test controller dsf files. you may import to G3 as custom morph, and see how it work or not. (facial cotnroller, and breast controller). (you can check it in G3, but need to locate it correctly in g3 data directory, with vendor name, and product category sub folda)

  5. engetudouiti reporter

    I notice, so when we first import controller morph with all bone posable, you add new drv bone, and set constrain which may need for . so if the controller only use rotation script not generate translate constrain. (I suppose)

    then later I import new one, which use same drv bone, but need to translate (location),

    your script find drv bone, then report so, but not add new necessary constrain. I currently test with merged gen bone, your script actually generate location constrain, then I may test import another pose controller which will rotate it, then check how it work. (I think, maybe script can not generate rotation constrain)

    Yes I could confirm it,

    1 import controller which translate gen bone >> importer generate drv bone, + copy location

    2 import controller which rotate gen bone >> importer set driver for drv bone >> fail to add copy rotation.

    Do not know if I install both at same time how your script work though.. of course same problem may happen about scale constrain.. (I confirm your script add new driver for scale, as I made in daz, but there is no scale controller and it not child of Genital-drv >> no scale used.

  6. engetudouiti reporter

    Yes I could confirm, if I import 2 pose controller at same time (first time import which add drv for gen, select both and set all bone posable) it generate all constraints. so it happen when user later import custom morphs then it need to use new constrain, your script ignore it. (about driver, it seems generate new props correctly, (re-circulate then add new driver for rotation/translate/scale

  7. Thomas Larsson repo owner

    Fixed in last commit. Make All Bones Posable now generates all three copy constraint instead of just the ones needed at the moment. That seems to work, but burdens the rig with unnecessary constraints. Therefore there is a new tool Finalize Armature that removes unnecessary constraints once the character is fully set up. It is no longer possible to make bones posable after that.

    It is not necessary to call Finalize Armature if you intend to convert the rig to mhx or rigify, because that is done automatically.

  8. engetudouiti reporter

    Yes about this issue, I may prefer, only generate necessary constrain when we import morphs and it need to use them. as same as drivers.

    But if it cause these problem I can not check each time, if constrain correctly generated or not, then untill it work as expected, I may prefer anyway generate necessary constrain for future use.

    I see, so once I Finalize, I can not add new drv bone and constrain..

    (I actually see, when I try to import gen bone controller, MHX generate driver, but directly drive, gen bone (so not generate drv bone)

    So this need some test to confirm it work well, I may keep open untill I can confrim all ^^; thanks you understand why it need.

  9. engetudouiti reporter

    mmm…I up-date MHX and daz importer , (so now I could confirm import mirror pose for MHX)

    but even though I use Make bones posable for def rig scene, it not generate new constrain which need for new import breast bone morphs. (I test with pectoral pose controller, because it is most simple and clear,,)

    And we have 2 “Make all bones posable” option. so which option had changed? One is when we import custom morph, we need to toggle it. (I keep it so)

    Second is , in Setting>Finishing section,,, I tried both..

    when I install new breast translate morph, I activate make all bones posable >> it not generate copy location for pectoral (it have only copy rotation) so only drv bone translate.

    Next I use Finalize > make all bones posable, it not still generate copy location for pectoral. (I believe, I do not touch FInalize mesh. because for me I may not need it… without I never add new morph, but usually I may need to add new morph for each play scene when I hope so…

    I may test with clean rig, but if new way is un-stable, I may hope Finishing> Make all bones posable, anyway try to generate all constrain for bones with rig-map… (there are few bone which you should not add all constrain, like tongue or toes bone though..)

    At current I make script, which can check and add rotate and transform, but maybe add scale too, but basically I depend your add on script so hope you may check it, actually it work or not for your saved scene.

  10. engetudouiti reporter

    No. I can confirm new Make all bones posable do nothing for facial bone too.

    I feel, you check driver f-curve for drv bone..(loc rot scale) then you need to check deform bone, and if it have constrain which copy loc rot scale.

    , but seems not add new constrain. or the function which generate new constrain seems failed.

    about F-curve (set props and drive with morph for drv-bone) your importer already manage correctly (add new drv-bone, or add new f-curve to drive drv bone. but only fail to generate new constrain, when drv bone alraedy generated, and need it..

  11. engetudouiti reporter

    Ok I think, I can make script ,, I may up-load it after confirm.

    1. Check drv bone. and make list with exclude un-necessary one
    2. about each drv bone transform prop, check animation prop driver (loc, rot, scale)
    3. when each drv bone have driver for each (loc rot, scale), check deform bone (drv bone target deform bone) constraints
    4. only when there is no constraint which copy (loc rot scale) of drv bone, generate it, (check constraint type, and target = rig, sub-target (drv bone)

    if you make it so, it up-date constraints and not add un-necessary constraints.

    your importer already can generate drv-bone drivers, and props only when it need. so deform bone constraints is only matter. then I may only generate each type constraints it actually need. = no need to finalize mesh

  12. engetudouiti reporter

    Check it please.. though I suppose you already made each function and try to ues it, but some step seems failed. I check driver type with string, so it can only generate actually used constrain for deform bone. (though I do not care which axis value only used for driver, ,, simply copy all about deform bone constrain when each type used.

    import bpy
    rig = bpy.context.active_object
    pbs = rig.pose.bones
    
    # make drv bone list as "drv_pbs", we need to make it for each figure, to avoid generate wrong cosntrain.
    # for genesis 3, I avoid modify toe bones, and tongue bones.
    # I never import pose bone driver for limb chain bones, so they do not have drv bone basically
    # If it need, I may recommend make bone map precisely which can add constraints as same as facial or pectorals
    
    drv_pbs = [] 
    for pb in pbs:
        if pb.name[-5:] == "(drv)" and ("Toe" not in pb.name) and ("tongue" not in pb.name):
            drv_pbs.append(pb)
    
    #get drform bone which will copy transform by constrain from each drv bone.
    
    def get_deform_bone(pbs, pb):
        dazpbn = pb.name[:-5]
        if dazpbn in pbs.keys():
            return pbs[dazpbn]
        else:
            return None
    
    def set_loc_cst(rig, pb, d_pb):
        flg = True
        for cst in d_pb.constraints:
            if cst.type == 'COPY_LOCATION' and cst.subtarget == pb.name:
                flg = False
                break
    
        if flg:
            lcst = d_pb.constraints.new('COPY_LOCATION')
            lcst.name = "Copy Location " + d_pb.name
            lcst.target = rig
            lcst.subtarget = pb.name
            lcst.use_offset = True
            lcst.target_space = 'LOCAL'
            lcst.owner_space = 'LOCAL'
            print(d_pb.name, " add loc constrain")
    
    def set_rot_cst(rig, pb, d_pb):
        flg = True
        for cst in d_pb.constraints:
            if cst.type == 'COPY_ROTATION' and cst.subtarget == pb.name:
                flg = False
                break
        if flg:
            rcst = d_pb.constraints.new('COPY_ROTATION')
            rcst.name = "Copy Rotation " + d_pb.name
            rcst.target = rig
            rcst.subtarget = pb.name
            rcst.mix_mode = 'ADD'
            rcst.target_space = 'LOCAL'
            rcst.owner_space = 'LOCAL'
            print(d_pb.name, " add rot constrain")
    
    def set_scale_cst(rig, pb, d_pb):
        flg = True
        for cst in d_pb.constraints:
            if cst.type == 'COPY_SCALE' and cst.subtarget == pb.name:
                flg = False
                break
        if flg:
            rcst = d_pb.constraints.new('COPY_SCALE')
            rcst.name = "Copy Scale " + d_pb.name
            rcst.target = rig
            rcst.subtarget = pb.name
            rcst.use_offset = True
            rcst.target_space = 'LOCAL'
            rcst.owner_space = 'LOCAL'
            print(d_pb.name, " add scale constrain")
    
    # check each drv bone animation prop driver, then only when it need add same type constrain
    # for pair deform bone.
    
    def has_trans_drv(rig, pb, drv_type):
        d_pb = get_deform_bone(pbs, pb)
        flg = False
        pb_path = pb.path_from_id()
        pb_drv_path = pb_path + "." + drv_type
    
        for drv in rig.animation_data.drivers:
            if pb_drv_path in drv.data_path:
                flg = True
                break
    
        if flg:
            print(pb.name , d_pb.name , drv_type)
            if d_pb and drv_type == "location":
                set_loc_cst(rig, pb, d_pb)
            if d_pb and drv_type == "rotation":
                set_rot_cst(rig, pb, d_pb)
            if d_pb and drv_type == "scale":
               set_scale_cst(rig, pb, d_pb)
    
    
    drv_types = ["location", "rotation", "scale"]
    for pb in drv_pbs:
        for drv_type in drv_types:
            has_trans_drv(rig, pb, drv_type)
    

    It seems work for me,, so after import custom morphs, I run this. then it only generate when there is no constrain which actually need… maybe which drv bone check depend each daz figure,,and I suppose I can make it work for MHX^^; (need to consider rename case to get deform bone of each drv bone though…)

    So even though old MHX scene, it can add constrain (if morph had been imported when convert MHX, but no constrain for deform bone = drv bone only moved…)

  13. Thomas Larsson repo owner

    Strange. I know that I did fix this problem, but when I look at the code the fix wasn’t there. Now it should work better.

  14. engetudouiti reporter

    I see 😀 I thoght there seems no code it may add constrain etc,, but so your add on large, and many module, then I do not know other function auto check and add them..

    At same time as I said, I think you can check which constrain actually need, with check drv bone driver type. type string (“location, rotation, scale” should be included in drv.data_path with drv bone name, so you can avoid to add un-necessary constrain for the deform bone.

  15. engetudouiti reporter

    about mirror rename case,, I am now confuse if you had changed naming way or not..

    At current I can only correct, when user have not use mirror name, for def rig.

    hope your script work for all case (though I do not remember, def rig have mirror name option or not, I seldom use def rig, so do not know (only use it to import morphs or add new morph or set custom mat etc to add driver, constrain,, so main olay rig is MHX,,)

  16. engetudouiti reporter

    Test with 1124, then test with saved def rig scene, import custom face controller, and breast controller,

    with toggle all bone posabe >>> no change. ☹

    then click Finishing >> Make all bones posabe >> no change🤢

    run my script >> add constrain for necessary one >> so I can see these controller effect.

    You may test it please… (i suppose you do not test,, only update^^;)

    1. load G3, then import basic morphs. (It maybe usually add all necessary constraint for deform bone, with make bone posable) then save scene once

    2. import attached morphs file, as import custom morphs.

    ustom facial pose include some bone rotation which not be used by default daz facial morph. breast pose controller include breast translate, but breast bone only driven by sholder bone, (then you generate constrain for rotation only)

    about both case, add on function can not add new constrain. then drv bone only move. Though I do not know why your script can not do it.

    I can clear see if run my attached script ,generate new constrain only for necessary one. (so some facial bone add new rotation constrain, breast bone add new copy location constrain.. as it need. and can see deform with keep value immideately.

  17. engetudouiti reporter

    I see,, I need to re-import morphs for pure scene..

    then now your script seems generate loation, rotation for all deform bone. when drv bone generate, I suppose. it not work for already saved g3 characters which already imported and generate drv bones.

    To test it if you do not have old saved G3 scene which improted morphs, you can not test it I suppose. I still think we need not Finalize (which avoid to add new drv and constrain,) button, but just need clean up-date button which check and add necessary constrain with check current drv bone drivers. but I report this issue, then anyway you solve it with your way.. so I may close it as solved now.

    ==

    btw why you did not add scale controller? I check each facial bone, but they do not have scale constrain.

    do you think if I import new scale morph as custom morph, add on can generate scale constrain ? though I do not hope to test this anymore ^^; (sorry I may use it my script)

  18. Log in to comment