Corruption removing script

Corruption removing script

Anonymous
Not applicable
1,135 Views
8 Replies
Message 1 of 9

Corruption removing script

Anonymous
Not applicable
Hello I am having an issue when coming to Max from Maya via collada exporter. its the only exporter that correctly transfers multiple sets of uv's. unfortunately it adds a node to all the geometry that corrupts the geometry. I found a work around that will delete the collada node but I have to do it to hundreds of thousands of scene items. I would really like a script to do this for me. The work around is as follows.

First create a cube. Then convert that cube into editable poly. Next select attach then select an item in the scene. When you do this it renames that object to the name of the cube I need to keep the name of the object that is being attached to the cube. After attaching the item to the cube the collada node is gone so the next step is to detach the cube and then name the recently attached item back to what it was named before. then repeat till everything in the scene has been put through this process. the biggest problem I see with this script is keeping the names of all the objects that are being attached. If anyone could help me out with this i would greatly appreciate it. Thanks.
0 Likes
1,136 Views
8 Replies
Replies (8)
Message 2 of 9

keithm
Enthusiast
Enthusiast
Here's a go at it...


-- select Objects to convert and execute script...
-- make sure you're working in a COPY of your scene.

for SelObj in Selection do
(
-- save name
local TempName = SelObj.name

-- create Poly object in same location and delete faces
local TempObj = Box pos:SelObj.pos
convertto TempObj editable_Poly
polyOp.deleteFaces TempObj TempObj.faces delIsoVerts:true

-- Attach to Poly Object In Selection
-- This attach will destroy the node : SelObj
polyOp.attach TempObj SelObj
TempObj.name = TempName
)


Hope this works, or at least is a good start...
0 Likes
Message 3 of 9

Anonymous
Not applicable
awsome! i will certainly give this a shot and let you know if it works tomarrow. thanks for the time you took to help out i really appreciate it.
0 Likes
Message 4 of 9

keithm
Enthusiast
Enthusiast
Looking at it again... you may want to change the

pos:SelObj.pos
to
transform:SelObj.transform

to get all the transformations of the original object... I'm not sure what it will have...
0 Likes
Message 5 of 9

Anonymous
Not applicable
Well this works great for individual objects but when i come across stuff that is grouped i have to traverse down the tree running the script for each object in the group unfortunately this is ungrouping things. I didn't think about this and now I'm not sure how to go about keeping my groups but still getting rid of the collada node. by the way I'm using " transform:SelObj.transform " thanks so much this is still going to save on a bunch of problems and headaches.
0 Likes
Message 6 of 9

keithm
Enthusiast
Enthusiast
No big... this is easy stuff for me...


-- select Objects to convert and execute script...
-- make sure you're working in a COPY of your scene.

for SelObj in Selection do
(
if ( not isGroupHead SelObj ) then
(
-- save name
local TempName = SelObj.name
local TempParent = undefined
if ( isgroupmember SelObj ) then TempParent = SelObj.parent

-- create Poly object in same location and delete faces
local TempObj = Box transform:SelObj.transform
convertto TempObj editable_Poly
polyOp.deleteFaces TempObj TempObj.faces delIsoVerts:true

-- Attach to Poly Object In Selection
-- This attach will destroy the node : SelObj
polyOp.attach TempObj SelObj
TempObj.name = TempName

if ( TempParent != undefined ) then
(
TempObj.parent = TempParent
setGroupMember TempObj true
append TempParent.children TempObj
)
)
)


5 min update for ya.. should keep your happy grouping... I hate groups in max..
0 Likes
Message 7 of 9

Anonymous
Not applicable
well that don't seem to be doing what i need it to. I have provided an image to show you what is going on. if you can think of any better way of getting rid of those nasty collada nodes feel free. I know I cant select them and delete them. As you should be able to see in the image the top node is the slider node I selected then ran the script and it separated it from the rest of the group and left all the collada nastiness in the rest of the tree. The script did get rid of the collada node attached to the slider though. I'm with you one hundred percent on not liking maxes grouping. especially when coming from a clean Maya scene.

0 Likes
Message 8 of 9

keithm
Enthusiast
Enthusiast
Could you post up a small scene.. It appears the nodes have a Custom Attribute on them as well... the 'Collada CA'... but I can not tell from what you sent...

A scene with just a few objects, perhaps the tree you've posted, so I can work with the actual objects....

Keith
0 Likes
Message 9 of 9

Anonymous
Not applicable
I'm not sure why this isn't working i select the objects and run the script and it says "OK" but nothing happens and the scene is still corrupt. I'm using the scene i sent you as a test scene so if its working for you mabey I'm not doing something the same.
0 Likes