Notifications
Clear all

[Closed] MAX 2017 Unwrap UVW – SetVertexPosition2() Bug

Another bug found?. I am not sure if this is strictly related to the Unwrap UVW Modifier itself or a side issue caused by the new MXS improvements (see this thread).

Below is a sample code to reproduce the problem:

  1. Huge memory leak
  2. Very slow performance

This applies also to the related “ByNode” methods of the Unwrap UVW Modifier.

(
	/* CREATE TEST SCENE ---------------------------- */
	delete objects
	obj = converttopoly (teapot segs:20 isselected:on)
	
	max modify mode
	uvw = unwrap_uvw()
	modpanel.addmodtoselection uvw
	/* ---------------------------------------------- */
	
	gc(); st=timestamp(); sh=heapfree
	sysRAM = (sysinfo.getSystemMemoryInfo())[3]

	GetVertexPosition  = uvw.getVertexPosition
	SetVertexPosition2 = uvw.setVertexPosition2
		
	for j = 1 to uvw.numberVertices() do
	(
		pos = GetVertexPosition currenttime j
		pos += 0.5
		SetVertexPosition2 currenttime j pos true false				-- << LEAK + SLOWDOWN
	)
	
	uvw.updateview()
	
	format "3DS MAX %
" (((maxversion())[1]/1000)+1998)
	
	local t = timestamp()-st
	local h = sh-heapfree
	local r = (sysRAM-(sysinfo.getSystemMemoryInfo())[3]) / 1024.^2
	format "time:%ms heap:% LEAK:%MB
" t h r
	
	msg = "" as stringstream
	format "So far we have:

Time: %ms
Heap: %
LEAK: %MB" t h r to:msg
	format "

NOW LETS ISSUE AN UNDO()" to:msg
	messagebox msg
		
	
	/* UNDO OPERATION ------------------------------- */
	st=timestamp(); sh=heapfree
	sysRAM = (sysinfo.getSystemMemoryInfo())[3]
	
	max undo

	local t = timestamp()-st
	local h = sh-heapfree
	local r = (sysRAM-(sysinfo.getSystemMemoryInfo())[3]) / 1024.^2
	format "UNDO >> time:%ms heap:% LEAK:%MB
" t h r
		
	msg = "" as stringstream
	format "UNDO RESULT:

Time: %ms
Heap: %
LEAK: %MB" t h r to:msg
	messagebox msg
	/* ---------------------------------------------- */
)

3DS MAX 2016
time:47ms heap:1352L LEAK:0.00390625MB
UNDO >> time:0ms heap:3984L LEAK:0.015625MB

3DS MAX 2017
time:1143ms heap:1540L LEAK:3798.47MB
UNDO >> time:34533ms heap:2864L LEAK:3824.97MB

1 Reply

Maybe somebody will need this answer.

I disabled “hold” argument.
SetVertexPosition2 currenttime j pos false false

3DS MAX 2017
time:61ms heap:1228L LEAK:0.0MB
UNDO >> time:0ms heap:388L LEAK:0.0MB

with undo off () will lead to same results.