Page MenuHome

The length of scripted expression strings is limited to 256 characters.
Closed, ResolvedPublic


System Information
Win 7 64 bit

Blender Version

Short description of error
The length of scripted expression strings is limited to 256 characters. A misfeature rather than a bug, but something that I ran into and I don't know how to get around.

Exact steps for others to reproduce the error
I have a script that imports duf/dsf files from Daz Studio. In the Genesis3 character, the face is deformed by bones, but it is more convenient to manipulate high-level facial expressions and visemes, which I have mapped to object properties that drive the face bones. The problem is that Daz has created many of these, and the length of the expression string grows too big.

As an illustration, the first expression that becomes too big is the following:

x00 : ["eCTRLCheeksBalloon"]
x01 : ["eCTRLCheeksBalloonPucker"]
x02 : ["eCTRLLipBottomUp-DownR"]
x03 : ["eCTRLLipsPart"]
x04 : ["eCTRLLipsPucker"]
x05 : ["eCTRLLipsPuckerWide"]
x06 : ["eCTRLMouthCornerBackR"]
x07 : ["eCTRLMouthCornerUp-Down"]
x08 : ["eCTRLMouthFrown"]
x09 : ["eCTRLMouthNarrowR"]
x10 : ["eCTRLMouthOpen"]
x11 : ["eCTRLMouthOpenWide"]
x12 : ["eCTRLMouthSide-SideL"]
x13 : ["eCTRLMouthSide-SideR"]
x14 : ["eCTRLMouthSmile"]
x15 : ["eCTRLMouthSmileOpen"]
x16 : ["eCTRLMouthSmileSimpleR"]
x17 : ["eCTRLvAA"]
x18 : ["eCTRLvEE"]

ERROR: Cannot add driver ["eCTRLvEE"] to bone rLipLowerOuter.
Expression too long.

Event Timeline

Thomas Larsson (thomasl) set Type to Bug.
Thomas Larsson (thomasl) created this task.
Thomas Larsson (thomasl) raised the priority of this task from to Needs Triage by Developer.
Joshua Leung (aligorith) claimed this task.

Eek! That is quite a horrendous "little" thing :P

I never expected anyone would have any need for something quite that long! (Annoyingly, it just tops out at 260 characters too)

Is this the longest one it generates, or is this on the short end?

Joshua Leung (aligorith) triaged this task as Normal priority.Mar 23 2016, 5:39 AM

It is the first string that contains more than 256 characters. The expression is put in an ordinary string before assigning it to the driver, in order to generate a better error message.

I don't expect that anybody human would write such a thing, but a script can. The script halts when it has created a too long string; otherwise it would add more variables. As you might guess from the variable names, there are at least half a dozen more visemes waiting to be loaded. With some work the expression could be trimmed somewhat, but hardly enough to squeeze in six or eight more variables.

The easy fix would be to increase the limit to 512 characters. This would probably solve my problem, but the problem would remain in principle, and I don't think that my script is important enough to increase the memory consumption for everybody else.

With some extra work I did manage too squeeze everything into 256 characters. The worst case is the following expression that weighs in at 190+.

(+95*B +95*C +90*D -9*E +45*F -65*G +97*H +33*I +74*J -31*K +121*L +12*M -7*N -4
2*O +43*P +9*Q +22*R +37*S +4*T +9*U -2*V -18*W +10*X +21*Y +128*Z -15*a +52*b +
22*c +57*d +96*e +108*f +28*A)/1000

A : ["eCTRLCheeksBalloon"]
B : ["eCTRLCheeksBalloonPucker"]
C : ["eCTRLLipsPucker"]
D : ["eCTRLLipsPuckerWide"]
E : ["eCTRLMouthCornerBackL"]
F : ["eCTRLMouthCornerUp-Down"]
G : ["eCTRLMouthFrown"]
H : ["eCTRLMouthNarrowL"]
I : ["eCTRLMouthOpen"]
J : ["eCTRLMouthOpenWide"]
K : ["eCTRLMouthSide-SideL"]
L : ["eCTRLMouthSide-SideR"]
M : ["eCTRLMouthSmile"]
N : ["eCTRLMouthSmileOpen"]
O : ["eCTRLMouthSmileSimpleL"]
P : ["eCTRLvAA"]
Q : ["eCTRLvEE"]
R : ["eCTRLvEH"]
S : ["eCTRLvER"]
T : ["eCTRLvF"]
U : ["eCTRLvIH"]
V : ["eCTRLvIY"]
W : ["eCTRLvK"]
X : ["eCTRLvL"]
Y : ["eCTRLvM"]
Z : ["eCTRLvOW"]
a : ["eCTRLvS"]
b : ["eCTRLvSH"]
c : ["eCTRLvT"]
d : ["eCTRLvTH"]
e : ["eCTRLvUW"]
f : ["eCTRLvW"]

ERROR: Cannot add driver ["eCTRLCheeksBalloon"] to bone lLipCorner.
Expression too long.