Convert to Rig-fy show errors

Issue #1102 resolved
engetudouiti created an issue

I just hoped to test, how current convert rig-fy manage, when I add custom tail bone for meta-rig/ daz def rig,

with convert options. but I see some strange issue and error.

when I directly convert g3 def-rig to rig-fy (without edit rig), I got those error

Traceback (most recent call last):
File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\import_daz\error.py", line 207, in execute
self.run(context)
File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\import_daz\rigify.py", line 1469, in run
gen = self.rigifyMeta(context)
File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\import_daz\rigify.py", line 858, in rigifyMeta
self.rigifyMeta1(context)
File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\import_daz\rigify.py", line 974, in rigifyMeta1
self.addSingleGazeBone(gen, suffix, R_FACE, R_HELP)
File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\import_daz\fix.py", line 377, in addSingleGazeBone
eye = rig.data.edit_bones[prefix + "Eye"]
KeyError: 'bpy_prop_collection[key]: key ".lEye" not found'
Error: Python: Traceback (most recent call last):
File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\import_daz\error.py", line 207, in execute
self.run(context)
File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\import_daz\rigify.py", line 1469, in run
gen = self.rigifyMeta(context)
File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\import_daz\rigify.py", line 858, in rigifyMeta
self.rigifyMeta1(context)
File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\import_daz\rigify.py", line 974, in rigifyMeta1
self.addSingleGazeBone(gen, suffix, R_FACE, R_HELP)
File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\import_daz\fix.py", line 377, in addSingleGazeBone
eye = rig.data.edit_bones[prefix + "Eye"]
KeyError: 'bpy_prop_collection[key]: key ".lEye" not found'

And it seems generate rig as new armature but remain all other rigs, and miss skin (maybe process stop?)

Do I need to change collecition hieralchy etc? I often customize collections, but can convert MHX without problem.

Do I need manually change rig, or it is bug?

Comments (8)

  1. engetudouiti reporter

    in rigify.py line 1131 to 1135 for gaze bone.

            # Gaze bones 
            #for suffix in [".L", ".R"]:
            for suffix in ["L", "R"]:
                self.addGazeConstraint(gen, suffix) 
            self.addGazeFollowsHead(gen)
            self.addTongueIk(gen)
    

    and line 971 to 975 (above error for leye and Reye)

            # Gaze bones
            print("  Create gaze bones")
            #for suffix in [".L", ".R"]:
            for suffix in ["L", "R"]:
                self.addSingleGazeBone(gen, suffix, R_FACE, R_HELP)
    

    after that I could generate rig-fy then it seems work. (though not test all bone, but script finish,

    and can only see new rig-fy rig with current genesis3rig name.

    Btw you already offer function which can rename for default import rig, I think when user use it, script will fail to convert as Rig fy anymore.

    So I may recommend, add return name button if you prefer to keep the function for def-rig. (actually I use my custom version, then it can return / set mirror bone name, as I need..)

    Or I suppose you may need to check, if current rig bones already have mirror bone name. or not. when convert..

  2. engetudouiti reporter

    Then,, (though I do not know how many user will use the option)

    generate meta-rig >> convert rig-fy option cause another attribute errors (I only test G3 sorry)

    Traceback (most recent call last):
      File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\import_daz\error.py", line 207, in execute
        self.run(context)
      File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\import_daz\rigify.py", line 1526, in run
        self.rigifyMeta(context)
      File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\import_daz\rigify.py", line 858, in rigifyMeta
        self.rigifyMeta1(context)
      File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\import_daz\rigify.py", line 1134, in rigifyMeta1
        self.addGazeConstraint(gen, suffix)
      File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\import_daz\fix.py", line 417, in addGazeConstraint
        if not constraintExists(eye, eyedrv):
      File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\import_daz\fix.py", line 403, in constraintExists
        if pb.name in self.constraints.keys():
      File "C:\myprograms\Blender Foundation\blender-3.2.2-rc\3.2\scripts\modules\bpy_types.py", line 804, in __getattribute__
        return super().__getattribute__(attr)
    AttributeError: 'DAZ_OT_RigifyMetaRig' object has no attribute 'constraints'
    Error: Python: Traceback (most recent call last):
      File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\import_daz\error.py", line 207, in execute
        self.run(context)
      File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\import_daz\rigify.py", line 1526, in run
        self.rigifyMeta(context)
      File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\import_daz\rigify.py", line 858, in rigifyMeta
        self.rigifyMeta1(context)
      File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\import_daz\rigify.py", line 1134, in rigifyMeta1
        self.addGazeConstraint(gen, suffix)
      File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\import_daz\fix.py", line 417, in addGazeConstraint
        if not constraintExists(eye, eyedrv):
      File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\import_daz\fix.py", line 403, in constraintExists
        if pb.name in self.constraints.keys():
      File "C:\myprograms\Blender Foundation\blender-3.2.2-rc\3.2\scripts\modules\bpy_types.py", line 804, in __getattribute__
        return super().__getattribute__(attr)
    AttributeError: 'DAZ_OT_RigifyMetaRig' object has no attribute 'constraints'
    

    It too complex for me, so I may wait if you can correct it…

    And one thing, if I add new bone for Daz import rig. (simply just add tail bone as child of pelvis)

    after merged rig. then convert rig-fy, rig-fy seems remove new added bone.

    Or your script actually keep it but just hidden? I do not know.

    I suppose, if I must need to add bone untill daz importer merge function if user hope to add new bone then convert rig-fy.

    Of course after generate rig-fy, I suppose I can free edit, as I need so just ask it why not work.

  3. Thomas Larsson repo owner

    I think things should work now, and sorry for skipping the obvious tests. The mhx code was a bit confusing, since the left/right suffix was sometimes specified with an extra dot and sometimes without. Now the suffix in mhx is always defined without a dot. However, some of the code (in fix.py) is shared between mhx and rigify, so the same convention had to be applied to rigify too.

  4. engetudouiti reporter

    I see anyway, if basic options work it is OK for me. I only test sometimes to remember how rig-fy working.. then basically use MHX ^^; (so Update mHX need to work correctly,, if you can)

  5. engetudouiti reporter

    Directly convert to rig fy now work for G3 thanks, (I do not test options though)

    but if I generate meta-rig first >> select metarig >> Rigify Metarig , it still cause error.

    Error: Python: Traceback (most recent call last):
      File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\import_daz\error.py", line 207, in execute
        self.run(context)
      File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\import_daz\rigify.py", line 1524, in run
        self.rigifyMeta(context)
      File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\import_daz\rigify.py", line 858, in rigifyMeta
        self.rigifyMeta1(context)
      File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\import_daz\rigify.py", line 1132, in rigifyMeta1
        self.addGazeConstraint(gen, suffix)
      File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\import_daz\fix.py", line 417, in addGazeConstraint
        if not constraintExists(eye, eyedrv):
      File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\import_daz\fix.py", line 403, in constraintExists
        if pb.name in self.constraints.keys():
      File "C:\myprograms\Blender Foundation\blender-3.2.2-rc\3.2\scripts\modules\bpy_types.py", line 804, in __getattribute__
        return super().__getattribute__(attr)
    AttributeError: 'DAZ_OT_RigifyMetaRig' object has no attribute 'constraints'
    

  6. engetudouiti reporter

    I only notice it should not self.constraints. then now I change them as pb.constraints (pb = each eye bone)

    it worked for me, but no confidence…. (I can not clear understand, how these function used to generate gaze, and which constrain you need to check..)

        def addGazeConstraint(self, rig, suffix):
            def constraintExists(pb, drv):
                #if pb.name in self.constraints.keys():
                if pb.name in pb.constraints.keys():
                    #for struct in self.constraints[pb.name]:
                    for struct in pb.constraints[pb.name]:
                        if (struct["type"] == 'COPY_ROTATION' and
                            struct["subtarget"] == drv.name):
                            return True
                return False
    

    anyway,, then now I can add custom rig-fy bone for meta-rig with set rigi fy type.. (basic.spuer.copy etc), then it seems generated correctly. thanks.. it may related this issue. (if someone hope to add custom rig-fy bone for meta-rig,,then generate)

    https://bitbucket.org/Diffeomorphic/import_daz/issues/1101/updating-rigify-with-metarig-face-rig

  7. Log in to comment