Need More speed ! Scale/resetXform/Re-snapPivot

Hi, I am doing a brush that paint snapshot of objects while applying them some modifications. Among the modifs a scale.

Here’s what I am doing. Scale, resetXform, re align pivot.
It works all good BUT it is very slow.
I have try to cut the Undo Off but it don’t seem to change anything.
Is there anything else I could do to improve the speed ?

To avoid the reset xform I have think getting the position of each verts of my object and apply a offset to it, so it will give me a cleaner scale and no need for resetxform anymore, whish should greatly improve the speed, BUT I’d rather not doing that and wonder if there is something else I can do.
Like disabling the command Panel refreshing for instance (which seem to be one the the cause of the slowiness) ?

undo off
		(	
			-- //////////////////////////Scale//////////////////////////
			if ScaleTrigger	== True do
			(
				for Orientvalues = 0.5 to 1.2 do
				(
					ScaleIndex = random 0.5 1.2	
					scale MySnapshot [ScaleIndex,ScaleIndex,ScaleIndex]
				)					
				--need Reset Xform...
					ResetXForm MySnapshot
					-- ...and re-align pivot
					MySnapshot.pivot = [MySnapshot.center.x,MySnapshot.center.y,MySnapshot.min.z]
			)	
               )

Thanks
Bloby

There is a section on “making it better” and “making it faster” in the help. Be sure to take a GOOD read there. One thing i would try first with a script like that is turning off viewport updates during operations (see disableSceneRedraw() and enableSceneRedraw() if i am not mistaken).

Cheers,
Thorsten

[QUOTE=instinct-vfx;24658]There is a section on “making it better” and “making it faster” in the help. Be sure to take a GOOD read there. One thing i would try first with a script like that is turning off viewport updates during operations (see disableSceneRedraw() and enableSceneRedraw() if i am not mistaken).

Cheers,
Thorsten[/QUOTE]

Well actually this is where I have found the Undo Off. I was wondering if there was (and there is probably) things that could apply to my case I didn’t think of? (I will definitely have other read pass too : ))
For the scene redraw, I am not sure, since it is a painting tool, which paint in the viewport, I need it redrawing… :confused: (no ?)

If you can, try forcing the Create command panel before executing. See if this speeds up the process. The problem is that some functions require you to be in the Modify command panel to work (skin specific functions for instance).