I have a modal operator that adds and adjusts an array of elements along a curve, but I have a problem with scaling. I'm using the 'Fit to Curve' setting for the array modifier so it automatically adds the necessary duplicates of the object until it fits the curve.
If I scale normally this happens (it just scales in 2 dimensions and ignores the curve as an axis):
This can be solved by applying transformations after with a KeyPress (similar to pressing Ctrl+A) but you won't see the correct effect until that moment, so it's not exactly ideal for a modal operator you're constantly adjusting and where seeing the correct result live is kind of the point.
I figured the solution was to apply transforms constantly but then I'm just scaling the already scaled object and the modal scale grows exponentially and has other unintended side effects as well.
This is the effect I would like to achieve (right now I get it by going into edit mode and scaling the mesh directly):
The obvious problem is that I have to leave the modal operator, select the faces, press S to scale the object, then go back in to the modal.
I would very much like to be able to replicate the effect of Scaling in Edit Mode without going into edit mode or at least enter and exiting fast enough that the user doesn't realize it. The desired effect being: the object transforms stay at (1, 1, 1) but moving the mouse to the right increases the scale and to the left decreases it with no exponential growth.
I tried doing something like this:
val = self.start_scale + (start_mouse_x - current_mouse_x) * multiplier scale_matrix = Matrix.Diagonal((val, val, val, val)) mesh.data.transform(scale_matrix)
The advantage is that I avoid switching into edit mode entirely, the disadvantage is I have the same problem as if we were constantly applying transformations (I'm just scaling the current scale again and I get the same exponential growth instead of setting an absolute scale value).
What's the best way of mimicking the Edit Mode Scale where mouse to the right makes the scale bigger, to the left makes the scale smaller and the object transform stays at (1, 1, 1)? The other important aspect being that the scale is not multiplying itself, but rather increasing/decreasing with a constant effect and NOT exponentially.