parent.scaling / child.scaling, calculation of scaling

Hi,

i have a simple question:

lets say we have cube1(scaling = (1,1,1)
lets say we have cube2(scaling = (1,1,1)
lets say we have cube3(scaling = (1,1,1)

cube2 gets parented to cube1.
cube3 gets parented to cube2.

now we scale up cube1 to (5,5,5)

what size will cube3 have?

or: how to calculate scaling from child related to its parent…

I hope someone understands what i mean.
Where can i read about that behaviour and relations between childs and parents?

Im still working on NGUI, and i find out, that if one parent an object to another and scale the parent, it is not clear to see what exactly the scaling will be.

What is the logic to calculate that ?

For example:
(limited to scaling.x for simplify)

a = 1
b = 1
c = 1

scale a to 5:

a = 5
b = 5
c = 5

now scale b to 5, then scale a to 5 :

a = 1 / a = 5
b = 5 / b = 25
c = 5 / c = 125

???:spin:

How can i calculate a function, that sets every cubes scaling correct, without creating some problems…?

In other words; i would like to have relations of childs and parents, that i can delete a and all its children gets deletet. In the other hand i want to set scale like a = (5,5,5), but b should keep its scaling (1,1,1), while still beeing parented to (a).

I now, i could use en Empty, and parent all objects to that empty. but then i loose relation ( c is child of b), because all childs have the parent (a).

Another point is, that i need to keep the objects flexible, means nothing is pre.parented, all parenting is set n the game engine.

I could also then remove the parent, scale the object, and reparent the object, but this is somehow dangerous, sometimes a parent is lost or such things…

I hope someone could give me a link, where to read about that, or a hint where to find this in the blender code. At least i could try to create simple “parent-scaling-switch” , ant turn it off :eyebrowlift2:

edit:

Ok. i got some answers from blendercoders chat:
the scaling will be mnultiplicated, so callled matrix multiplication… i’m not good enough in math to handle it this way. So i’ll just parent all to ean Empty and code the relations my self…