Wiggle bones (a jiggle bone implementation for 2.8)

I was testing the baking and was wondering why the bake doesnt automatically select the bone. Is there a reason why we need to run that other operator first? I tried adding it as a invoke and it works nice. Now i dont need to run that “Select Operator” first.

Another thing i was thinking of, since the baking is kinda destructive. I populate a list right before the actual bake is done. I name this list tree_list_old. Then i can enable all the bones afterwards using an operator. One can always save before the baking, but that is kinda a tricky one of course.
I added a special menu and a operator which enables all the bones like it was before the bake.
Screen Shot 2022-06-21 at 14.15.00

I also added the action name when stuff is baked, that makes it more clear if you have some actions already.
Screen Shot 2022-06-21 at 14.14.24

With this old tree list, i could also add a toggle for all bones.

I sometimes stumble into issues where nothing works, i need to restart blender in order to get it working again. Still have not figured out where or what is causing this

1 Like

yeah I’d been trying to think through that workflow at the time too. my logic was maybe you only want to bake a specific bone so rather than have the bake operator make assumptions about which bones you want to bake, you can either select yourself or use that select all button to select them all.

also for the remembering which ones were enabled, thats why I put the object and scene level wiggle-enable toggles, so after baking you can quickly use to disable the dynamic effect and then re-enable if you wanted to revisit later and still have all the bones enabled.

but it was all just a first stab at a workflow so I’m down for whatever people find most useful!

I noticed now when you bake all bones using the bake operator, wiggle_enable are disabled, as done by bake operator. Shouldn’t it then simply disable the global wiggle_enable in scene prop vs bone by bone?

Thats why i thought this extra operator could be useful. Because when you dont like the bake and want to do some adjustments, now you need to enable them one by one. But that could be a hard, one needs to remember all the bones.

This is in id.bake_wiggle
#turn off dynamics according to bpy.context.scene.jiggle_disable_mask
mask = context.scene.jiggle_disable_mask
if mask == 'BONES':
for b in bpy.context.selected_pose_bones:
b.jiggle_enable = False
elif mask == 'ARMATURE':
context.object.data.jiggle_enable = False
elif mask == 'SCENE':
context.scene.jiggle_enable = False

simpler would be then to simpe disable the scene wiggle_enable, but i guess that is why that mask is. I have not fully read all the “how to”.

But have you got any idea why sometimes everything stops working? I tried enabling one by one, enabling the scene wiggle. Nothing seems to help done other than a restart of Blender

I might be misunderstanding, but basically you can set what is disabled after baking. so ‘bones’ will disable the individual bones, but you can select from the dropdown to disable object or scene also. and the value is remembered at the scene level so whatever you set it will persist through future bakes.

1 Like

the fact that it resets itself after a restart is weird. sometimes keyframes can get set on internal wiggle properties because I was storing the data as user accessible custom properties, and using the ‘whole character’ keying set I found would add keys on those. in my rewrite I tried putting everything in a cleaner property group, and then ran into the issue where you can’t animate bone property groups. :smiling_face_with_tear:

No its not reset, everything is active, it simply wont show any wiggle. I enable and disable everything and still nothing happens. There is a jiggle tree, i see a list with bones, it simply wont show anything. Doesnt work in any file after that point. Only thing which works is a Blender restart. I guess i need to use a lot PRINT codes to find this issue

Yeah noticed that option, i thought it was related to the bake operator. Guess the scene methods is best in this case. Its the easiest one to activate again afterwards.

same here bro. Once in a blue moon all wiggles just stop working for no reason. Blender restart helps. Also, adding a new armature and adding the wiggle to a bone in it fixes all wiggles on other bones too.

1 Like

Sometimes I got the t working again by deactivating one bone, sometimes by deactivating and activating scene wiggle. But when I was testing the linked rig with proxy approach it happened quite often. I still haven’t found the culprit.

I thought it was perhaps the cause of me implementing the preset manager or some minor changes. Though I see it happening in the original as well.

I’ll keep trying to pin point it

sounds like its somewhere in the code where the list of bones is supposed to get regenerated but for some reason isn’t. it should check if a bone exists or not before attempting to wiggle, and it regenerates the list if the bone isn’t found or when you toggle ‘enable’ on a new bone.

one catch where it won’t properly add a new bone to the list is if you duplicate a bone that already has wiggle enabled. the issue there is unless you tack on some sort of check for a wiggle bone as a callback to blender’s own duplication operator (is that even possible?) it won’t know about a new bone until you toggle the list. but maybe there’s some other broader limitation in that vein that is messing things up.

Do i understand correct that list should exist already. Because i looked at those scene props and saw a list. I noticed in the code the list gets generated a lot, sometimes looks to be even generated twice in the same function. The thing is none of the bones wiggle at that point. When i open a file which already was setup, nothing happens. When i start a new file and add a test armature with a couple wiggle bones, again nothing happens. Perhaps if i add print comments in the pre and post handler, perhaps that helps to find the culprit.

by pressing the “bake widggle” button

Blender 3.2

Python: Traceback (most recent call last):
  File "/home/bazza/.config/blender/3.2/scripts/addons/wiggle_bones1_5_b20.py", line 925, in execute
    track.strips.new(action.name, action.frame_range[0], action)
TypeError: NlaStrips.new(): error with argument 2, "start" -  Function.start expected an int type, not float

It’s good, but it’s not perfect.
Please add feedback to the force field (e.g. wind force)

Thats weird, 0 is int and action should return frame numnber, these are not float?!

Thats weird, in bl 2.83 when i run this code, it returns indeed a float. action.frame_range[0]


Wrapping it with int is easy fix int(action.frame_range[0])

This error is kinda weird as documentation notes its a float?!?!

Screen Shot 2022-06-28 at 12.34.02

Something is off here. when i tried to add a new strip but use the list of frame_range like this
track.strips.new(action.name, action.frame_range, action)

i got this error, i noticed, here it also states INT in blender 2.83 but it simply takes the float without errors. Kinda weird!

Traceback (most recent call last):

  File "<blender_console>", line 1, in <module>
TypeError: NlaStrips.new(): error with argument 2, "start" -  Function.start expected an int type, not Vector

When i check what frame_range[0] is, it does return float. So weird it gets a float while it needs an Int and does bugger about it. Yet in 3.2.1 it does?!

yeah I remember that float/int issue came in one of the last few releases of blender. its annoying, but yeah casting it as an int is usually enough. I’ve been spoiled by python usually not being so grumpy about these kinds of things.

This error seems like a bug, unless it was updated in the API and the documentation is not updated yet

Perhaps report it?

It was the docu about strips.new where both show exact same info, the start in both wants a INT. Didnt found any API change about this