Unwrap moveselected undo
Hello. I have two related problems with Unwrap moveselected functions. Actually I need rotate and scale as well, but to simplify my question I will talk only about move.
There are two move functions in Unwrap: moveSelected and moveSelectedVertices.
Problem with moveSelected.
It eats a RAM on big meshes, maybe because of Undo stack, but it does that even with Undo off. And if undo is on, then it creates only 1 record.
fn moveVerts = with undo "Move verts" off ( unw = modPanel.getCurrentObject() for i=1 to 100 do ( unw.selectVertices #{i} unw.moveSelected [0.1,0.1,0] ) ) moveVerts()
Each iteration of this function will eat ~150MB of RAM and it doesn't even create Undo record. gc() doesn't help. That's why I ended up with next function.
_________________________________________
Problem with moveSelectedVertices.
I can't enable undo record. I tried theHold also.
fn moveVerts = with undo "Move verts" on ( unw = modPanel.getCurrentObject() for i=1 to 100 do ( unw.selectVertices #{i} unw.moveSelectedVertices [0.1,0.1,0] ) ) moveVerts()
So this function won't eat memory at all. But it doesn't create undo record.
_________________________________________
And I need function that creates 1 undo record and doesn't eat much ram :)
P.S. Is it a bug with memory leak in moveSelected?
Comments
So when I'm trying to parse
So when I'm trying to parse 10k polygons in this plane then 3dsmax eats 20gigs :)
And when I'm dealing with "moveSelectedVertices" 3dsmax doesn't eat ram at all. And actually it's a little faster in my case.
But even theHold can't undo UV transformations with "moveSelectedVertices" :( It creates undo record but undoing doesn't revert changes.
Here you go. This changes cannot be undone. Maybe this is the reason why it doesn't eat memory :)
.
actually we can trick it with single moveSelected call (which is creating Undo record)
But I'm still curious why
But I'm still curious why moveselected needs so much memory compared to moveselectedvertices.
Can you confirm that?
This trick did the
This trick did the job!
Спасибо в очередной раз :)
I tested it more. It seems
I tested it more. It seems 1000-4000 operations with unwrap transforms should eat some gigs of ram for Undo stack. When I'm talk about ram eating I mean 3dsmax ram consumption in TaskMakager.
I used incorrect terminology when I said that script eat this ram. Not script, 3dsmax itself.
Here is a bigass plane and 4000 operations. 3dmsax eats ~3-4GB after this. And I suppose this ram consumes mainly for undo because gc() can clean it.
So... it seems there is no leaks, there is no bugs, 3dsmax should eat that gigs for such operations?
.
What's the point in moving verts one by one? :)
All of the below examples create "MaxScript" Undo entry, but wipe out previous undo stack entirely.
I'd like to know how this behavior can be prevented too.
btw. if you place theHold.Accept() before function call you'll have a correct Undo entry name as a result.
moveVertsOneByOne Time: 1.444sec. Mem: 162184L
moveVertsOnce Time: 0.001sec. Mem: 704L
moveVertsOnce2 Time: 0.001sec. Mem: 632L
"What's the point in moving
"What's the point in moving verts one by one? :)"
Forgot to mention. That piece of code is just for demo of course :) Just to reduce strings. My script parse elements and select whole elements, not verts one by one.
Anyway. At first I used "moveSelected" and faces, not vertices. But this function somehow leaks memory very dramatically. But it created undo record.
Then I found that "moveSelectedVertices" doesn't leak ram and I was happy until I realised that I can't undo it.
.
I use max2014 and can't confirm any of the issues you're talking about.
Here's 800k faces geoSphere. Can you post your results for this one?
moveFacesOnce Time: 0.291sec. Mem: 1024L
max2016 - moveFacesOnce
max2016 - moveFacesOnce Time: 0.182sec. Mem: 6184L
But my case is different. I need to randomize some array of UV faces bitarrays.
Select each bitarray of faces and then randomize it. Speed is not impressive but okay.
I'll explain it other way.
I have a test mesh that contains 2500 attached boxes. Next code will randomize offset on first (for example) 3000 faces. My task is not exactly like this, this is only general idea.
This script takes 4GB ram. I'm not sure why, because undo record is only one.
.
Nope, can't confirm. Some test scene would be great tho.
randomizeFacesOnce Time: 1.369sec. Mem: 8256L