igor333
01-09-2005, 09:46 AM
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.
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.
