Update rig for new MHX return error

Issue #1100 resolved
engetudouiti created an issue

The rig was generated with old version Daz importer and MHX rts, You offer up-date button, (thanks), then I tried it,

but it seems return error.. (though it now return panel but do not know I can keep working..or not ^^;)

Traceback (most recent call last):
File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\MHXrts\utils.py", line 195, in execute
self.run(context)
File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\MHXrts\props.py", line 135, in run
setattr(rig, key, rig.data[key])
TypeError: bpy_struct: item.attr = val: expected a string enum, not int
Error: Python: Traceback (most recent call last):
File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\MHXrts\utils.py", line 195, in execute
self.run(context)
File "C:\Users\TAKE\AppData\Roaming\Blender Foundation\Blender\3.2\scripts\addons\MHXrts\props.py", line 135, in run
setattr(rig, key, rig.data[key])
TypeError: bpy_struct: item.attr = val: expected a string enum, not int

Comments (5)

  1. engetudouiti reporter
    class MHX_OT_UpdateMhx(MhxOperator):
        bl_idname = "mhx.update_mhx"
        bl_label = "Update MHX"
        bl_options = {'UNDO'}
    
        def run(self, context):
            rig = context.object
            for key in list(rig.data.keys()):
                if key[0:3] == "Mha" and hasattr(rig, key):
                    print("FIX", key)
                    #setattr(rig, key, rig.data[key])<<< do you really need to use setattr? 
                    rig[key] = rig.data[key]
    

    seems worked.. but hope you confirm… (I really feel I may better to keep scenes without up-date or not…though recent version alrady solve issue I suppose,, but miss up-date should be problem ^^;

  2. engetudouiti reporter

    And I do not know if this dependency cycle log will cause problem or not… I can ignore ?

    I remember there had been dependency cycle issue,, for new morph system and hidden driver.. (but it seems worked, and I recently did not see those..)

    then do not know when these dependency cycle are shown….(after up-date rig, or not)

    Dependency cycle detected:
    OBGenesis 3 Female/neck-1/POSE_IK_SOLVER() depends on
    OBGenesis 3 Female/ik_tongue/BONE_DONE() via 'IK'
    OBGenesis 3 Female/ik_tongue/BONE_READY() via 'Ready -> Done'
    OBGenesis 3 Female/ik_tongue/BONE_POSE_PARENT() via 'Pose -> Ready'
    OBGenesis 3 Female/lowerTeeth/BONE_READY() via 'Parent Bone -> Child Bone'
    OBGenesis 3 Female/lowerTeeth/BONE_CONSTRAINTS() via 'Constraints -> Ready'
    OBGenesis 3 Female/lowerTeeth/BONE_POSE_PARENT() via 'Pose -> Constraints Stack'
    OBGenesis 3 Female/lowerJaw/BONE_READY() via 'Parent Bone -> Child Bone'
    OBGenesis 3 Female/lowerJaw/BONE_CONSTRAINTS() via 'Constraints -> Ready'
    OBGenesis 3 Female/lowerJaw(drv)/BONE_DONE() via 'Copy Location'
    OBGenesis 3 Female/lowerJaw(drv)/BONE_READY() via 'Ready -> Done'
    OBGenesis 3 Female/lowerJaw(drv)/BONE_POSE_PARENT() via 'Pose -> Ready'
    OBGenesis 3 Female/head/BONE_DONE() via 'Parent Bone -> Child Bone'
    OBGenesis 3 Female/neck-1/POSE_IK_SOLVER() via 'IK Chain Result'

  3. Thomas Larsson repo owner

    The enum issue is should be fixed; the elbow and knee targets should be enums rather than ints, so that case is handled separately.

    The confusion with the old mhx rig was the mixture of rna properties (api defined, accessed with getattr and setattr or the . notation) and id properties (accessed with a dict key). They are related but not the same, and perhaps the relation is not the same across Blender versions. Rna properties should be used for properties that are known at compile time, like the mhx controls. Id properties should be used when the user can create an arbitrary number of them, like morphs. Before I used id properties for floats, to make them animatable, and rna properties for booleans, to make the show up as checkboxes. That was really confusing, so the new version only uses rna properties.

    I didn’t run across the dependency cycles. Please let me know if it persists.

  4. engetudouiti reporter

    With test up-date now it seems work. snap IK <> FK no problem. Though I still do not understand a few property which you offered for MHX

    and I do not see the dependency cycles anymore. (maybe it was because I up-date with my wrong edit I supposed)

  5. Log in to comment