CR2 (Poser) importer, bones-only, Blender 2.40

I’ve searched the forums, and there didn’t seem to be any signs of a working CR2/Poser importer for Blender (but a good deal of links to formats). I whipped this up in a day, just enough to create an armature with appropriately named bones and parents:

http://www.linux.ucla.edu/~phaethon/blender/cr2bone_import/cr2bone_import.html

(direct link to script: http://www.linux.ucla.edu/~phaethon/blender/cr2bone_import/cr2bone_import.py )

As the script name implies, only the bones are imported. I referenced the python 2.3 docs, so it should runnable under python2.3 and python2.4. I also referenced Blender’ 2.40 python API docs, so I think 2.40 is required, especially the armatures bit.

The script “works for me” (two files tested), so I’m fishing for guinea pigs to test how this works. Also, I don’t know if I should cross-post to blender.org forums or not.

I’ll be testing this some for you. I’ve been playing a lot with Daz|Studio and can’t get the Morph loader to work with blender; it’s pickier than Poser. This may let me work on the characters in blender while still retaining posability…shiny!

I won’t have access to my machine that has all of my poser content till this evening, so I could only test on two free dl’s so far. Both test have been positive with some tweaking.

Using 2.40’s weighting envelopes requires a bit of work with these imports. All envelopes are set at such a high weight that the character looks like the michelin man in the envelope view until I scale down all of the bones and reset all of the envelopes. That is not too bad a pain since the new system is AMAZINGLY easy, but is this a potential upgrade to the script? I’m aware that we will always need to tweak things, but if the envelopes started somewhat closer to what is needed it might be easier. I noticed that you reference vertex groups in the write up on the script, so I wasn’t sure if you had looked at the envelopes.

Also, just to get way ahead of things…could this path lead to a .cr2 exporter, so that rigged characters could be exported to Poser and Daz|Studio?

Now having read up on Blender’s envelopes and playing around with it, I see the Michelin-Man problem. I’m not sure what data in the CR2 file would encode or hint at envelope size; I’d rather do the envelopes “right” than do a hacky scaling fudge factor. I probably won’t be able to do any more work on this script until my evening (roughly seven hours after I post this).

As for an exporter, maybe, but since I don’t have anything that properly reads Poser files (i.e. “a control group” to test output), I doubt I personally will do an exporter.

If you do want to try a free poser equivalent, daz3d.com has Daz|studio for free. It is freeware, not opensource. They intend to make money off of the content and from plugins, which aren’t free. They are reasonably priced right now, and scripting is supposed to be available…soon… It opens poser content and does poser-y stuff, but does not save to poser format. Oh, daz3d.com also has several of their base figures for free download if you want more content to test the blender importer with.

It also does not have rigging ability (yet), so an exporter would make me happy. :wink: That way I could try and make more than just props with morphs (RVK’s). I don’t know python for crap, but I may crack the hood and see if I can figure something out from other export scripts.

Poser uses two ellipsoids per bone one defines skin which has 100% influence, the second defines the maximum influence range for the bone, then the skin between the two spheres is linearly interpolated.

LetterRip

Let me know if you’d be interested in having this bundled in the release.

LetterRip

Do you have any code that would make it so? Like I said, I’m not so good with the python coding.

The information about the ellipsoid helps, but now my hurdle is trying to map ellipsoids to Blender bone envelopes.

These are my current obstacles/ignorances:- Each “dial” (degree of freedom, e.g. rotate-X and rotate-Y) seems to potentially have its own set of envelope-ellipsoids. Blender has one envelope per bone, not thirty-something, so I think I need a way to merge these many ellipsoids together somehow.

  • The ellipsoids seem to not care about the roots of its associated dial, whereas Blender envelopes are essentially stuck to their bones.
  • Apparently an ellipsoid is expressed as a (4x4) transformation of a unit sphere. While I know what this means conceptually, I don’t know how to do the math related to it (e.g. calculating diamters or volume).
  • Ellipsoid is a 3D oval. Blender envelope is two spheres connected by a tube. I need some funky geometry math to set up a meaningful translation (again, that 4x4 transform of a sphere thing).
    I tried mapping the sizes of the first assocated ellipsoids to Bone-Envelope sizes (where size was taken by matrix norm), but this turned up some odd looking envelopes (not Michelin-Man, but still didn’t look right).

The alternate implementation I can think of is to assign all vertices a weight which is equivalent to its location in regions of ellipsoids. In other words, reimplement Poser’s notion of envelopes with vertex groups while ignoring Blender envelopes. This approach, however, would make exporting to cr2 extremely non-trivial.

Also, I took a long side journey to make (yet) another OBJ importer that can handle the inline/embedded OBJ data of Poser files.

Oh, and school (UCLA) started on the 9th, so I have even less time to work on this :frowning:

There is a envelope script bundled with Blender, perhaps that can be of use to you?

LetterRip

I fooled around some more until numbers looked a little more meaningful (but still a little quirky). While I can programmatically set the size of the external envelope in Blender (“deformDist”), I can’t modify the size of the internal envelope from python. Searching through the Blender sources reveals that the fields rad_head and rad_tail correspond to the size(s) of the internal envelope, but neither field is accessible from python. I don’t know if this restriction counts as a bug or a security/stability feature. In the meantime, I can’t figure out a way to resize the internal envelope. I’m at a loss as to what to do from here.

Hi we can add those probably shortly after release (tomorrow or tuesday is release).

you can either post your request in the API requests forum or if you feel ambitious post a patch to the patch tracker :slight_smile:

LetterRip

I tried to import Daz/Poser cr2. It works, but the Imported Bone I have to EDIT+ROTATE 90 degree for to work in Blender. I think this is a problem in z/y cordinates.