mergeMaxFile nodes to array

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  04 April 2013
Indeed, nice one denisT, thanks.

For the #select issues, here is the main issue : as soon as an object is in a hidden layer, it's not selected.
 
  04 April 2013
Originally Posted by MrPingouin: Indeed, nice one denisT, thanks.

For the #select issues, here is the main issue : as soon as an object is in a hidden layer, it's not selected.

nice catch! probably it was it. thanks!
 
  04 April 2013
The other issue with using #select is if the selection lock toggle is enabled, it doesn't allow the selection focus to be passed onto the new objects.

I use the premerge/postmerge node comparison method for this, as we have an multiple instancing system that merges and renames assets in scene.
__________________
Regards,
Pete

Read my technical blog - lonerobot.net
 
  04 April 2013
Originally Posted by LoneRobot: The other issue with using #select is if the selection lock toggle is enabled, it doesn't allow the selection focus to be passed onto the new objects.

yes! that's exactly why i stopped using merge with #select option 8-10 years ago.
 
  05 May 2013
How about the combination of these two event callback.

#filePreMerge: integer
#sceneNodeAdded: node
 
  05 May 2013
Here's a simpler method I've just been using:


(
local filename = (whatever)
local objNames = #(whatever)

-- Collect list of objects in scene before merge:
local preMergeNodes = (objects as array)

-- Merge objects:
mergeMAXFile filename objNames #mergeDups #renameMtlDups #noRedraw

-- Collect objects that weren't in preMergeNodes list:
local mergedNodes = for obj in objects where (appendIfUnique preMergeNodes obj) collect obj
)


This is me de-lurking - I've mined this forum for knowledge for many years, I thought I'd might as well get around to actually posting something
 
  05 May 2013
Hey nice one guplik, this one is really easily readable.
 
  05 May 2013
here is a test that shows difference of three 'find merged' methods:

  (	
  	resetmaxfile #noPrompt
  	seed 0
  
  	objs0 = for k=1 to 10000 collect box name:((random 1 10000) as string) 
  	objs1 = for k=1 to 5000 collect box name:((random 1 10000) as string) 
  	select objs1
  
  	file = getdir #temp + @"merge_test2.max"
  	saveNodes objs1 file quiet:on
  	delete objs1
  
  	old = #{}
  	for obj in objects do append old (getHandleByAnim obj)
  	
  	mergeMAXFile file #deleteOldDups quiet:on
  		
  	t1 = timestamp()
  	m1 = heapfree
  
  	--new = for obj in objects where (appendifunique objs0 obj) collect obj
  	--new = for obj in objects where (finditem objs0 obj) == 0 collect obj
  	new = for obj in objects where not old[getHandleByAnim obj] collect obj	
  		
  	format ">> objetcs:% merged:% time:% memory:%\n" objects.count new.count (timestamp() - t1) (m1 - heapfree)
  )
  /*
  >> #appendifunique 	objetcs:12543 merged:5000 time:1975 memory:682088L
  >> #finditem 		objetcs:12543 merged:5000 time:1722 memory:683984L
  >> #gethandlebyanim	objetcs:12543 merged:5000 time:61 memory:692432L
  */
  

you can see that #appendifunique or #finditem methods give almost the same result.
#gethandlebyanim method is much faster. and difference will be bigger with lager amount of nodes...
but of course all three take just a little of whole merging process time.
 
  05 May 2013
Ahaha, denisT, you're killing me !
Everytime I read you I find a function I've never heard before
 
  05 May 2013
Originally Posted by denisT: but of course all three take just a little of whole merging process time.

which is not actually true... i've made a test and merged 10,000 nodes to 20,000 node file...

merging time is ~24 secs...
find merged nodes using appendifunique (or finditem) takes ~8 sec (it's more than 25% of whole merging process)
find merged nodes using gethandlebyanim still takes only ~0.120 sec
 
  05 May 2013
shown results are for max 2012/64
could anyone post the numbers for a 32 bit version?
 
  05 May 2013
Originally Posted by denisT: shown results are for max 2012/64
could anyone post the numbers for a 32 bit version?


What's 32 bit?
 
  05 May 2013
Originally Posted by lo: What's 32 bit?


I've already requested 128bit from Autodesk :P
__________________
Maxscript Made Easy...
http://davewortley.wordpress.com/
 
  05 May 2013
Originally Posted by lo: What's 32 bit?

we would see it when someone posts the numbers...
 
  05 May 2013
I don't have max2012 32bit but:

Windows Xp SP3 32bit installed on Virtual machine + Max2009 32 bit:

appendifunique
objetcs:12543 merged:5000 time:7765 memory:340720L

findItem
objetcs:12543 merged:5000 time:7328 memory:340656L

getHandleByAnim
objetcs:12543 merged:5000 time:47 memory:340680L
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 05:35 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.