Jump to content

Script To Remove Keys? & Auto Place Nulls In Joint Skeleton


Recommended Posts

laugh.gif + thisrocks.gif Do you have a 128 Core quad for a brain?!!

I just can't believe this stuff and so quick!

Ok...the lastversion Deleted objects,deleted Keys and placed nulls(kind of)...but failed on moving the Root Bone of BVH Skeleton to the same position as The Root Joint(Pelvis) of my IKRig...not sure why,maybe the naming or maybe because its buried deep in another hierarchy?

A few things with theTarget Nulls,

1-The Target Nulls are created from copies of the IK Controllers...so they have a predetermined PSR that can not be changed,these are then placed into the a tpose skeleton..in other words i've already made these nulls,what i was trying to do was move them in to the BVH skeleton automatically....make any sense? sorry bit drunk wink.gif ....it looks to me like the script is making these nulls at the PSR of the BVH Bone of which they are a child,this is incorrect.....having said that if the script could generate these nulls from the existing IKRig controllers and place them in the BVH skeleton that would be great.

2- which i haven't quite determined yet if is a problem or not,is the nulls need to not break the chain of the bones...but i think it is..EG. the Body+Hip Controllers would be children of the Hips BVH bone but below the LHipJoint,RHipJoint and Lowerback bones in the hierarchy..and the same for all the other Target nulls placed in the Skeleton...they don't brealk the existing Hierarchy but are children of the relevant joints...included pic of OM to explain

have also attached a scene file with these null controllers

will sober up a bit and work out the motion clip process into something that makes sense :)

Cheers mala

Link to post

OK heres a quick run down on the motion bits.

After running the above script to remove all the unwanted parts,i do the following:

Select Parent null(skeleton)

add motion clip(Animation->Add Motion Clip)

in dialogue that opens click ok

In the Timeline select the newly created motion clip

(ONLY for the cgspeed.com BVH that need retiming from 120fps to 30fps)

->> in Attributes of the motion clip,you'll see the start and end frame times of the clip,divide the end time by 4 and re-enter the result into the end time window)

for all other 30fps BVH ...

Convert MotionClip to MotionSource(In Timeline..Motion System->Convert MotionClip to MotionSource)

Now on the far left of the timeline window you'll now have a new Motion Source(probably called"Skeleton) select this and right click,choose save motion source as, input the name and file path you want and hit OK.

thats about it,you'll have to try this on a demo of R11...and seems that the console doesn't display anything whilst i'm doing this so no CallCommands

Having had a little bit of time to think about the placing of Target nulls...

The way i've got this whole thing working atm,is to clean up the BVH

Then make a copy of it,The copy has ALL keys deleted,this copy is arranged to fit approx. my IKRig skeleton,and the target nulls are placed into its Hierarchy this is my "TPose" and will become the target the Motion Source is applied to.

The Original"cleaned" BVH is converted to a motion source and saved

So multiple motion sources can be loaded and mixed in the timeline and "applied" to the TPose rig which in turn animates my IKRig

Sorry,this is all so confusing and not very well thought out yet,i will try to make this a lot clearer and PM you some files with an IKRig later when i've had someting to eat and sobered up roflmao.gif

Thank you so much for your amazing work on this so far though!



Link to post

Just dipping in here - and thinking out loud as usual .. smile.gif

Maybe it might be better to just have the target nulls in a dummy version of the rig that's in the T pose to match your IK rig, then when you transfer the animation from the mocap file to this T Pose version the IK rig follows along with that.. it could be easier for reusability as apart from adding the nulls you'd still have to go and tie your IK rig to those each time whereas if the IK rig is permanently tied to a dummy rig with no animation you could reuse it more easily.

You've got me curious about this now (curse you! wink.gif ) so now I'm trying to get something working using Harvester. I'll post some results if I can figure it out.



Link to post

@Brian...Thats what i've been stuck between atm....I think that you are correct,to have a the Dummy rig pre-set and tied to the IKRig is the best way and simply apply the saved motions to this rig....

The problem i've been having which comes from using these files at cgspeed,is that the starting PSR in the TPose is quite messed up for some of these skeletons...So they are not all the same from one batch to the next(if you download the files you'll see the folders are mostly captures of one person or session per folder)

My hope was that by deleting any position keys except those on the root joint(the only one needed anyway) that any smallish difference in position of the child joints wouldn't matter...because the MotionSource would only be applying the rotations to the child bones....that was fine until i discovered the files with messed up rotations....what i found was that if i made a new tpose dummy rig from the messed up bvh...this would work fine with that folders files...but then how do you mix that with other files?....thats where it all started to go wrong laugh.gif

@Nebu....hoping you're following this wink.gif

Hope i haven't wasted any of your time...

Lets,forget the placing of the nulls and moving the skeleton about.

So here are the steps again:

Step1:Delete objects and Keys as per the list----Already done perfectly in your script signthankspin.gif

Step2:Convert to MotionClip(with re-time option) then save as MotionSource.

We can then take these MotionSource and apply them to our Pre-made Dummy rig to which the IKRig is tied

ps i've noticed you have mocca is it mocca3?....The IKRig i'm working with atm is built with CDTools so may take me a while to rebuild it so i can send you a moccaIKrig you can use to test all this with,hopefully early next week



Link to post

Here's a very rough test of using Harvester to transfer animation from one mocap file to a dummy version (well it's funny to look at at least) . The IK controllers were set up very quickly ( I just used one global one for the feet for example) and the offsets definitely need fixing but it seems like it might work..

I think I see what you mean though about the files, they don't seem very consistent. I installed the learning edition of Endorphin a while back and that came with some mocap files, I might look at those and see if they are cleaner. I notice a lot of juddering with the free mocap files, not sure if that's in them or it's errors introduced when I scaled them in the timeline (just deleted every 2nd frame using the Delete Nth key command and then squashed the whole range, not very precise but not sure if there's an easier way on 10.5.

BTW If Nebu downloads the CD Plugins he should be able to use your rig in runtime mode, that could save you building a mocca version. Since he's only really working with the IK controllers anyway he should be able to use the rig pretty much unrestricted.



Link to post

Hey Nebu...just cranked up my macpro(was on laptop for a while with no Cinema) and tested the latest version

Guessing you've not read my post above but i think like Brian said,placing the nulls in not necessary...

You are correct the scaling/positions of the nulls in the file i posted throws it all out when positioning the nulls...and yes the different BVH files all seem to have different sizes.

You've already got it to add the motion clip though... woohoo.gif this is so cool!

Great work on this Nebu!

I'll get up early tomorrow and put a rig together for you to test this with and point you to some files we can use to test

Cheers again,


Link to post

Thats cool!...nice one Brian and good point about the runtime feature with CDTools forgot about that.....will have to get back to it in the morning,supposed to be on a computer ban today!



Link to post

Hi Nebu,i'm just trying to put together a test rig for you...cinema is baking a motionclip to motionsource atm...so can't test the latest version just yet....i'm also having some scale problems with my dummy rig...hopefully have this sorted soon



Link to post

Well, I though I was wasting my night last night as for ages the results looked pretty bad, but then it started coming together a little. This is using one of those other BVH files I have, they are 30fps to begin with so much easier to manage for me.

They don't have a T Pose at all though, so I ended up creating a new T Pose for both the mocap skeleton and the IK rig (Using the CD Bind Skin tag to store these right inside the rigs themselves - this new feature is handy for so many things I just love it). Once I had the skeletons lined up pretty closely I created the root nulls for the IK controllers, constrained the controllers to them and then made them children of the mocap skeleton.

These Mocap files only have one joint for the foot though, no toe joint, so there's some manual work to add on top of what's there.

It seems to me that this is likely to be a usual stage of production with this kind of work as I guess the mocap rig will rarely just map totally cleanly to the IK one.

I was thinking about different methods to clean up the data and I had a bit of a brainwave - instead of fussing with the mocap too much and trying to get constraint offsets perfect I'm going to try baking the IK controllers and then deleting their constraints. (In R10 when you bake in the timeline it creates new copies of the objects which is no good for this but I have a script someone posted on CDTalk that will run through the timeline and key the controllers themselves). My reasoning behind this is that for things like the feet and getting them to stay contacting the ground cleanly it's a nightmare working with the mocap skeleton animation as you're essentially doing it in FK, which means loads of counter animation to keep the floor contact clean. If you bake the controllers you are then back to IK so you can adjust things like the Y-height right in the timeline.

The last issue then is dealing with so many keyframes on each controller - and the answer to that it seems is working in Reduced Modification mode with the FCurves, I haven't used it much before but I started learning more how to use it last night and wow, it's really powerful for this type of thing. You can move, scale and rotate whole chunks of animation with very precise control. It may even work for 'smoothing' out the curves as you asked about before. Have a look at 3D Kiwis' tutorial for the R10 timeline (be warned it's a long one!) if you havent used RM curves before, it seems like they were made for dealing with stuff like this.

Here's the current state of the clip, I havent' baked anything yet and you can see some parts look pretty wonky, but I think with some work and by applying some animation skillz on top of this I might get something decent :) (you should see it with the muscles showing too.. it's mad.. I'll only show that when it's working a little better though :) )

Here's the Clip (5mb QT)



Link to post

Hey Brian,looking cool mate spoton.gif would love to see it with all the muscles as well.

Good to see i've got you into this,Are you using the CDBindSkin on the MoCap Skeleton to store the tpose you've made or am i misreading that?

I was at one point thinking about baking the target nulls after they had been placed in the BVHSkeleton,that way you are dealing with less objects,should still hopefully get all the curves,providing the skeleton was scaled well,and you can still animate on top with IKcontrols if you use the parent&child setup you suggested over at CGtalk.

i really need to play about some more with the bascis of the method,the scaling of those bvh has been causing me some problems...Nebu has done amazing work with that plugin,getting the BVH to a nice 'light" motion source is ideal,because these can be blended really easy with the motion system..its just getting this Dummy rig right thats spinning me out

I'm guessing that the scaling was why Kai was using that 'in between"Rig with the retarget tag....but my attempts with the Retarget have not gone well.....are you still using Harvester somewhere in your pipeline?

@Nebu....Did those rigs i sent you make any sense,have you had any luck with them?



Link to post

Thanks guys, I'm glad I got into it now as it seems it could be quite useful, I want to make a little demo clip of the muscle rig to have on my web rigging reel so this might be a good way to do it.

,Are you using the CDBindSkin on the MoCap Skeleton to store the tpose you've made or am i misreading that?

Yeah, I just added a BindSkin Tag to the root null of the mocap skeleton, selected all of the bones (CD Transfer tools Select all Same command is very handy for this kind of thing) and dragged them into the object list and set the pose. It means if I want to reuse the rig I can then delete the animation from the mocap, restore the bind pose and key that pose if needed and then copy in another animation from a different BVH file to the mocap skeleton using Harvester. There's no blending with this setup but I could adapt it so that I have 2 mocap skeletons and transfer different animation to both and then blend the IK rig between them using constraints. That's overkill for my purposes right now though, I really just want to get the exercise animation baked into the IK rig and then try cleaning it up. I'll pose some more tests if I get some progress on it.



Link to post


This topic is now archived and is closed to further replies.

This topic is now closed to further replies.


We are dedicated Cinema 4D Community of friendly and passionate artists, hobbyists and developers. Feel free to join us to share your knowledge, your art and anything that might help Community to grow. We are providing guidance, free plugins and files, feedback, sponsorships and various discounts for our Contributors and much more. :cowboypistol:

  • Create New...

Copyright C4D Cafe © 2021 Powered by Invision Community