Increase Blender driver expression character limit
AS SOME OF YOU MAY KNOW, or don't know, the character limit for driver expressions is 256. im here to say, that pretty much sucks! i don't know why there's a limit, but unless there's a critical reason the limit is placed there, it should be removed. at the very least extended.
now you may be asking, "what did you do to reach that limit? the expression field is tiny anyways"
funny story! i've been working with source engine models a lot, and one day decided to make facial expressions work the same way it does in SFM. and let me tell you, i've succeeded. it works perfectly fine, but there's some shape keys i cannot use due to the expressions for them exceeding the limit. want to see the longest expression i could find?
(((((((((min(1, (-min(0, (-1 - multi_Smile)))) * min(1, (-min(0, (multi_Smile - 0))))) * min(max((multi_Smile - -1) / (0 - -1), 0), 1)) + (-(min(1, (-min(0, (multi_Smile - 0)))) - 1) * -(min(1, (-min(0, (0 - multi_Smile)))) - 1)) + ((min(1, (-min(0, (0 - multi_Smile)))) * min(1, (-min(0, (multi_Smile - 1))))) * (1 - (min(max((multi_Smile - 0) / (1 - 0), 0), 1))))) * (right_Smile)) * right_CheekV) * (1 - right_PuckerLipLo)) * (1 - right_PuckerLipUp)) * (1 - (min(max(right_FoldLipLo, 0), 1)))) * (1 - (min(max(right_FoldLipUp, 0), 1))))
i need all of that to fit into one expression. i've tried shortening it the best i can, still won't fit. if it weren't for the limit, everything would work.
if you agree to some extent that the limit should be lengthed, then please! feel free to request this too.
bye!
a very real, very bad example of the demoman that i have made, using the same sliders that SFM uses
7 Comments
This is a global issue. Object names are restricted to 64 chars for example. If you're working with professional imported data, that comes from CAD systems then this becomes to a real problem.
<out of topic> Do you intend to release that SFM-like control system? And if so, will it be usable only on Demoman or it could be applied on most classes ?
not out of topic at all! i will release the sfm script, once i've optimized it, on my yt channel along with a tutorial. and this will be usable on EVERY source model that contains flex data. (unless there's a shape key limit i don't know about. still, it should be ok.) however, the script will not be as useful as i had first intended it to be due to the limit. but if that ever gets removed, then this will work with full functionality.
when i release the script, i'll make sure to notify you
hey! it's been awhile, but i got it!
youtube.com/watch
Seems like it's just a single hardcoded number . Since Blender 3.x includes some compatibility breaking changes (so newer files can't be opened safely in Blender 2.x), I think it should be fine to just increase this number, but I'm not completely sure about it.
You can also create a text datablock, which registers functions in the driver namespace . Then you can put the complex driver logic into python instead. Just make sure to run/register the script as well.