Apply modifiers and Keep Blendshapes Addon - SKKeeper

Hi Blender Community,

i created this addon for @GloriaTheAnimat to speed up applying of modifiers on objects that have shapekeys. I updated the addon today and thought i should also post it here, to make it more accessible.

This addon is provided free of charge. And can be downloaded from Github, Gumroad, or the bottom of this post!

This Addon automates the process of collapsing down modifiers on a mesh with shapekeys while keeping the shapekeys intact.

How to Install

Download the zipfile from the Releases page and install via Blenders Addon-Preferences

Edit > Preferences > Add-ons > Install… > SKkeeper.zip

How to Use

This Addon adds 3 new operators which can be found in via the Quick Search floater ( **Hotkey: F3) and typing “shapekey” or anything else in the names listed below:

  • Sk: Apply All Modifiers (Keep Shapekeys)
    • Applies all modifiers on the object
  • Sk: Apply Subdivision (Keep Shapekeys)
    • Applies only the top most subdivision modifier and keeps the others
  • Sk: Apply Chosen Modifiers (Keep Shapekeys) (Added in this update [version 1.2])
    • Shows a popup with all modifiers on the object and only applies those you select
    • Might lead to unexpected behaviour if you choose to apply modifiers that aren’t at the top of the modifier stack

Select the Object you want to apply modifiers to and select one of the options.

It also add 3 menu entries to the 3DViews >> Object Menu:

11 Likes

This is some kind of magic. Thanks very much!

2 Likes

This thread needs to get some traction. I already dowloaded it from Gumroad and shared it on my socials. Let’s see how people like this one.
Thank you for arranging this code.
Cheers!

*** UPDATE ***
THANKS! This addon should be default on Blender. It works fantastically.

2 Likes

Unlike the other script that tries to do the same thing, this one actually works well!
In comparison, the other script took nearly two hours, and did not recombine in the end.
This script took 19 minutes and worked perfectly.
It worked on my complex skeletal mesh with over 400 shape keys.
Based on its behavior, this appears to be a very well written script instead of a hack.
I am not a python programmer so i cannot analyze the code, but based on the way it works and interacts with Blender, it has my vote to be added to the core Blender release.
Thank you very much for making and releasing this open source tool!

2 Likes

Hi everyone,
thank you for all the kind words and your interest in the addon. I’m very glad this helps you out!

I just pushed a small update with a minor bugfix and updated the main post to reflect all the changes made.

Here are all the changes made:

  • rebranded the addon. It’s now called SKkeeper (ShapekeyKeeper).
  • fixed a bug that lead to a crash if the selected object only had the base shapekey
  • tested in the newest blender release 2.91.0 and the blender stable LTS 2.83.10
  • removed the download from the mainpost because it was outdated and not used by many

The latest version v1.4 is available at Gumroad and Github.

To give the Addon a little further reach i also put it on blendermarket where you can choose to donate if you want.

If the addon has helped you save time please consider donating (a percentage of the donation also goes to the blender foundation).

1 Like

Unfortunately, i have either hit the limitations of the plugin, or my system itself.
i9 32gigs ram
When i run the model through with the base 450 shape keys, everythings works great!
When i run it through with all the shape keys, 691 of them, it crashes about 3/4 of the way through.
Now to eliminate a possible errant shape key, i have broken the 691 shape keys in to 3 sections and tested 1/3 at a time. each 1/3 section works fine, but combined, it hard crashes out of blender. I thought maybe it had something to do with auto save, so i disabled that. no change. The thought just occured to me, maybe it has to do with my Undo level allowances. i will decrease undo level limits and try again. I will report back here soon.
Thanks again for the plugin, it is amazing!
I really think this is probably more of a system issue than the plugin itself.

Sadly, disabling Global undo, and setting undo history to just 2 had no effect. If anyone has any ideas, they would be appreciated.
This is the only error message i have been able to track down.
Error : Unrecognized Exception
Address : 0x00007FF92B9DD759
Module : C:\Windows\System32\KERNELBASE.dll

Hey @NoMoreCookies,

Thanks again for your input! Wow, that’s a lot of shapekeys. Since the addon currently creates a copy of your object for every shapekey and then has to apply the modifier to it and then merges them all back into one object i think your assumption that this is now a case where your hardware limits you is correct. In your case the addon tries to create 691 copies of your mesh and then applies their modifiers (potentially subdivision surface). That would result in an absurd number of polygons.
(You could confirm this suspicion by looking at your RAM usage in Windows Task Manager, while executing the addon)

To make this case work on your Hardware the code of the addon would have to be changed.
All the shapekeys would have to be built after each other instead of simultaneously or they could be built in chunks (i.e only 100 shapekeys at a time) until all 691 have been reached.

I wrote the code pretty quickly and didn’t assume somebody would actually have a case where they had that many shapekeys.

Maybe i have some time this weekend to look over the code again and make some adjustments.

That would be awesome if you could, thank you!

Yes, it uses all 32gigs of ram, at which point it seems to start adressing virtual memory, but eventually fails, regardless. Yes indeed it is an absurd numer of polygons, but it will actually be more in the end! :slight_smile: It is for characters/monsters so i have to do this procedure for many different models. It is for a character/monster creator i am making. After the shape keys are set by the user, they are baked and removed so runtime memory will be minimal.
Thank you again for making this. It is a daunting task already, and much more so without your script.

Hey @NoMoreCookies,

I just had a look and made some changes to the code. I wrote a new Operator that is now also available in the object menu of the 3DView right next to the others.
Apply All Modifiers (High-Performance)

This operator now works through the shapekeys one after the other. This means there will not be as many copies of your model as there are shapekeys on them during execution.
Instead there will be only a maximum of 3 copies during script execution time.

I did a small test / benchmark:

Normal Operator:
Mesh faces: 14,336
Shapekeys: 300
Max RAM Usage: 1.2 GB
Execution Time: 45 seconds

High-Performance Operator:
Mesh faces: 14,336
Shapekeys: 300
Max RAM Usage: 450 MB
Execution Time: 27 seconds

There is a new release on the github repository and the blendermarket listing also has the latest version as a download.

I hope this will enable you to get that boatload of shapekeys handled. Best of luck to you!

That is amazing! Thank you! :grinning: previously with the 600+ shape keys the time exceeded 25 minutes and RAM/Swap file usage exceeded 64GB at which point the failure occurred.
Now, with the same set of 600+ shape keys on the complex character mesh, time to successful completion is ~4.5 minutes, and RAM usage never exceeds a few hundred MBs!

A note to others… On completion, if you select wireframe view it gives the illusion that nothing was done (it shows the wireframe count of the original model, not the subdivision that was applied). This is, as far as i can tell, a Blender issue and has nothing to do with this amazing script. if you simply tab over to edit mode, the proper subdivided model display will appear. It was already subdivided, and appears as such with solid rendering view. all that switching to edit mode does is force a refresh of the displayed view.

Thank you again for creating and sharing this @nidus . Truly a sanity, and project saver!
Considering its amazing successful performance with your latest changes, are you considering adding a high performance option that applies only the subdivision but leaves the other modifiers untouched?

Thank you for testing! I’m glad it’s working fine now. I didn’t want to bother updating the other operators until I had the feedback from you, that it’s working. It seems like the new code performs well even under heavy load.

I took the time to update all other operators to work the same way as the “High Performance” one and pushed a new release (v1.6) to all platforms the addon is currently available on.

SKkeeper v1.6:

  • Operator names are back to the way they were in version 1.4
  • I also looked over the code again and improved it a little bit more, so it should be even faster now!
    (The execution time in my testcase, that i posted above dropped from 27 seconds down to 18 seconds)
  • The display bug with the Optimal Display view of the Subdivision Modifier staying around after collapsing the modifiers has been fixed.

See ya around!

It is perfect, and down to 3.5 minutes!! :grinning:

I am sure you are aware of this link Blender plugin submission information, but your plugin is so important and working so well, i wanted to share it just to be sure.
A sincere thank you, and best wishes!