Notifications
Clear all

[Closed] File size problem

Hi,

I’m having a strange problem, after making a replace object code
I’m getting a file which is 3 times bigger then the old one,what I’m doing is
replacing a non texture object with an object with texture and uv mapping,
it strange that the uv mapping tripple the size of my file, here is my code:
(Please ignore the efficiency of my code,I didn’t have so much time for it)

fn tr =
(

group_name = #()

Obj_name = #()

count = 0

grp_arr = #()

fobj_names = #()

objs_group_arr = #(#())

for i= 1 to selection.count do

(

group_flag = true

if classof(selection[i].baseobject) == Dummy then

(

append grp_arr selection[i]

group_flag = false

count = count + 1

group_name = filterString selection[i].name “.”

objs_group_arr[count] = #()

)

if (group_flag == true) then

(

Obj_name = filterString selection[i].name “.”

if(Obj_name[1] == group_name[1]) then

(

  append objs_group_arr[count] selection[i]

)

)

)

fobj_names = getmaxfileobjectnames “obj_with_texture.max”

mergemaxfile “obj_with_texture.max” fobj_names #select

for i = 1 to grp_arr.count do

(

res = “”

new_arr = #()

setGroupOpen grp_arr[i] true

for n = 1 to fobj_names.count do

(

 a = fobj_names[n] as string

 res = filterString a "."

name = trimright res[1] "-1234567890"

 mesh_mat = getnodebyname fobj_names[n]

 for j = 1 to objs_group_arr[i].count do

(

   obj = objs_group_arr[i][j]

   if(obj != undefined) then

 ( 

   res = filterString obj.name "."

   curr_name = trimright res[1] "-1234567890"

    if( name == curr_name) then

  (

   w = copy mesh_mat 

   w.rotation = obj.rotation

   w.pos = obj.pos

     append new_arr w

  )

)

)

)

group new_arr name:grp_arr[i].name

)

for i = 1 to grp_arr.count do

(

– Deleting the old objects that have been replaced

for j = 1 to objs_group_arr[i].count do

(

delete objs_group_arr[i][j]

)

)

– Deleting the merge objects with the textures on it

for n = 1 to fobj_names.count do

(

temp_mesh = getnodebyname fobj_names[n]

delete temp_mesh

)

)

What seems to cause the inflating problem?

Thanks,

Igor.

5 Replies

Help me with that please.

Thanks.

Hello Igor,

Are you using max 6 or 7? Max 6 has a file bloat problem that is a known issue (though they don’t know what causes it). Does the bloat go away if you run the gc() function?

Hello Frances,
I’m using 3ds max 5,I tried to use the gc() function,but the bloat doesn’t go away.
I just called gc() at the end of my function.

yes, this is a known issue, unfortunatly this still isn’t fixed properly in max7, too.
but you can shrink the file size by doing the following:

open the XRefs-Objects dialog and close it.
open the XRefs-Scenes dialog and close it.
type gc() into the listener.
save scene.
unfortunatly, this is not scriptable

another method would be to save all your objects (save selected), reset the scene and merge them back in, but this does not clean up everything…

hope it helps,
andre

Sorry it didn’t help. I don’t know much about Max 5. Have you tried asking on the Discreet Maxscript forum? I hope you find an answer.