How to imitate scaling a mesh in Edit Mode (transforms stay at 1, 1, 1 with modal control of scale)

How to imitate scaling a mesh in Edit Mode without Edit Mode (ie. keeping object transforms at (1, 1, 1) with modal control of the scale).

If you have the time please read through, it might shed some light on my particular issue.

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):

GIF - What happens if I scale the object…

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):

GIF - The effect I am looking for…

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))

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.

Hopefully some of this made sense. Any help would be greatly appreciated

I think you should turn the transform orientation ( below the workspace menu ) to median point and then scale.

I dont know what else you can do if this does not work :slightly_frowning_face: try reading the manual or asking on the stack exchange.

I wish it were that simple.

The problem seems to be when binding the array to the length of the curve. I can scale the object normally and apply transforms after to get the desired result (this is my current workaround) but I wish I could find a better way so I can visualize the correct scale effect being applied live during the mouse_move modal event.

I always ask both here and on Stack Exchange, but they’re mean over there. When it comes to new questions people are much nicer here.

Yes, stack exchange is not so good, you get answers here better.

1 Like

You can just move the points. newloc = loc + dir * val. You have to do this in a loop over point and so loc is going to be the current points location, direction will be (loc-origin).normalized(), and val is whatever your mouse movement modal thing (thats effectively your scale amount)

You can find more info by searching for stuff like moving points along vector or something in stack exchange if you need to know what that exact code might look like. Stackexchange is an invaluable resource, but definitely need to search the right terms.

I will try that, I just didn’t know what to search, but you have provided some direction. If it provides a solution I’ll repost it here. Thanks.

hi, how do you scale the mesh, does your mesh composed of multiple meshes, and when you scale or drag the original mesh, it scales adaptives and adjust the number of elements.
is this an algorithm? how ho you generate the gif

It’s a single mesh with Array and Curve modifiers. The array count is set to match the length of the curve. If you scale the mesh in edit mode the Array count will adapt automatically to the new size. No scripting required for that.

I recorded the GIF with a program called ShareX which is mostly for taking screenshots. There’s different software out there that might be better, but this one works for me.

Since this has been revived, the answer to this:


put before Array and Curve modifiers.

“the Array count will adapt ” is this implemented bu blender itself or some other add-ons

That’s native blender. Modifiers have tons of options that people rarely explore, check them out.