If I scale the object non-uniformly, say (2.0, 0.5, 0.75), what go.get_scale_uniform() will return after that? It doesn’t make sense since the scaling is no longer uniform. Please correct me if I am missing something here.
Good question! It is possible to get this behaviour today with the current API as it is. If you do for example go.set_scale(math.vector3(2.0, 0.5, 0.75))
, a call to go.get_scale()
will attempt to return the “uniform” scale which currently is implemented as the min element value of the scale vector (in this example it will return 0.5 as the uniform scale).
If users have to change the code to replace go.get_scale() with go.get_scale_uniform(), they might change it to go.get_scale().x instead. Since it’s uniform, it doesn’t matter what vector component they will choose.
In the case of a uniform vector go.get_scale().x
will return the same value as go.get_scale_uniform()
just like you said. The point with go.get_scale_uniform()
and deprecating go.get_scale_vector()
is to be explicit about when we are using a scalar value and not the vector, instead of the other way around. It is also the same heuristic we use internally when setting scale on the physics engine, only the uniform scale is used.
It is difficult to get around users having to change some code when breaking backward compatibility. We will try and make the required modifications to user code as minimal as possible.
go.animate
will accept either scalar or vector3 as input when animating the scale propertygo.set(".", "scale", ...)
will take either scalar or vector3go.set_scale(...)
will also take either scalar or vector3
This would allow a user to only work with only uniform scale if it is desired, while granting the flexibility for users who want to use non-uniform scaling. It will be possible to get, set, animate the scale regardless.
The breaking changes are:
go.get(".", "scale")
will return vector3 instead of a scalar uniform scale factorgo.get_scale()
will return vector3, usego.get_scale_uniform()
to get scalar value insteadgo.get_world_scale()
will also return vector3, usego.get_world_scale_uniform()
instead