DAZ Genesis1/2 .dae rigging addon

Okay, I haven’t followed this section of the forum. I don’t know if this is the place to post a WIP thread, but I do know that 98.2% of the public don’t believe that rigging done in Python code belongs aside artwork. And, I also know that I am a beginner.

What I’m working on is an add-on to create a character body rig given a Genesis or Genesis2 model, imported by .dae file, from DAZ Studio. It doesn’t yet create “my rig”, but it does clean out unused bones, set proper bone rolls, and rename bones with DEF- prefix and proper .L/.R suffix. I don’t know how badly it will choke on a Genesis3 armature, since I don’t have one to experiment with. It is still a WIP, but I thought I’d post the code, since it is already quite useful for cleaning up a Genesis1/2 dae import.

It works as an add-on. Just drop it into your addons folder and it shows up in the armature property panel. I would really like feedback on that portion of the code(Gen2_Rig). It is barebones, and I don’t really understand everything involved in getting that button into the properties panel. I’ve taken code from Rigify’s ui.py file, and stripped it to fit what I’m doing. That portion seems to operate correctly, but I’m curious if it’s missing anything.

At this point, the only real caveat is, it expects the object and it’s armature to both be named “RootNode”(That’s the default for a DAZ dae.)

The guts of the code(Gen2_Generate) is nothing elegant. It’s just top-down, brute force, step by step.

My biggest question at this point is about my selection routine. Send it a list of bone names, it selects them and sets the first one active. Searching in my google says to switch to pose mode to set the active bone, and try as I might, I can’t make it work without switching modes. Is there some way around that? So far, the program isn’t doing anything really intensive, yet it’s getting slower and slower as I add to it. I think that mode switch is sucking on it’s mojo. Any thoughts? Advice?


def select(lst):
  # lst is list of bone names
  bpy.ops.armature.select_all(action = "DESELECT")
  # if lst is empty, deselect all and return
  if lst == []:
    return
  for name in lst:
    # test if it's a valid bone name
    if arm.edit_bones.get(name):
      # select it
      arm.edit_bones[name].select = True
  # set the first name in the list as active
  bpy.ops.object.mode_set(mode='POSE')
  arm.bones.active = arm.bones[lst[0]]
  bpy.ops.object.mode_set(mode='EDIT')

Wow, the attachment option say my .py file is invalid. I assume that’s a forum setting??? But I don’t know why it would be. I’ll look into that, but I’m on my phone so I slow, and stupider than IRL. :slight_smile: I’ll get it sorted.

EDIT: Oop, it’s gotta be zipped up.

Attachments

Gen2_Rig.zip (3.45 KB)

1 Like

Crikey! First update is YUGE!

We’ve got a 5 bone, pivot slide reverse spine, w/ a dangley pelvis, on a DAZ import… WITH A SINGLE CLICK!!!

Today’s hurdles…

Adding constraints: They’re mostly just world space, copy_transforms. But there’s a bunch of 'em. And they’re just code!

Adding drivers: This was two hurdles actually. Figured out how to create the driver, but adding single_prop values had me way confused.

Adding custom properties: Got this to work, but I need to figure it out differently. Added the pivot_slide property to the Pivot bone, but it shows in the properties panel as “API Defined” and won’t allow editing. You can change it’s value, but can’t edit it, like change min or max limits. I want to fix that.


Attachments

Gen2_Rig-040415.zip (5.21 KB)

I was reading your text and then started to skim it so I “may” not be getting what exactly it is that you’re doing but it sounds like you’re making an addon that will allow you to import a .DAE file from Daz (Genesis models) into Blender with Rigify rigging.

Khalibloo already does that mostly, excluding some of the models (not sure which, so I opt to do it manually).
http://www.blenderartists.org/forum/showthread.php?321572-Khalibloo-Panel

Thanks for the reply Edition.

That’s what I’m doing, but it’s not rigify. I’ll take a look at the link you dropped, but like you I don’t have a problem doing it myself. In the first post I put “my rig” in quotes. I like my rig, but if it’s on a DAZ model I can’t share it.
This is just an exercise, trying to learn bpy, and put my rig onto a button I can share.

Okay, it’s been a few days without an update… Like anyone really noticed… :wink:

I’ve got the main IK/FK chains done, and switching as they should.

The big hurdles I’ve overcome…

  • Broke down the main limb bones to add tweaks. AND, used bone matrices to locate mesh vertices relative to the bone, and broke down vertex groups of child meshes to work with the tweaks.
  • Used bone matrices to locate IK pole targets.
  • In seperate test files, I’ve got creating mesh objects from both algorithm and stored data worked out, so I can build decent boneshape meshes.

I’m not going to upload the py file at this time. Looking at the hit count on the attachments, there doesn’t seem to be a great interest in it, and my code is absolutely hideous!

Like I’ve said, I am a Python newbie. My program flow is just top down meat grinder. All over I use double quotes where I shouldn’t. There is so much redundancy that could be broken out into functions. It’s really not something I’m proud of, but I do hope it will generate a decent rig.

Thanks.


Keep at it. We need tools like this and developers like you discover things that really help the community. Thanks for putting this together.

Thanks for the encouragement Safetyman. I enjoy poking at the system, and letting people watch how the system reacts. :slight_smile:

Here’s an update. It’s been a while, but in the offtime I updated my Linux, and also updated my DAZ Studio. That means I’ve now got a copy of the Genesis3 base models. I’m stoked about Genesis3. I’ve been playing with it a lot. I asked earlier about feedback regarding this script and Genesis3… It WILL ruin a Genesis3 armature! Given what I’ve learned during this project I know my code needs a full rewrite. I hope the next generation of the script will support Genesis3, including the face rig.

Yet, I need to push this project forward as is, mainly because I haven’t yet rigged the hands and feet, and I want to do that, so that the next time it’ll be better.

I really don’t see any major hurdles ahead. I’ve got the most difficult bone shapes worked out, and the base UI script written and registered. From here on it should just be a matter of using what I’ve learned, and pushing forward.


Have Fun!

Skip

Not sure where you’re at with this, Skip, but I’m looking forward to updates! This is something I’d like to have a play with, especially with Genesis 3.

I’ve started learning to script with Blender Python, a very different project to this one but can appreciate the work that’s going into this. I too am probably reinventing the wheel in places, but it’s a good way to learn.

How to use? Please add this tutorial, thank you!

Bump. Any updates?