Python script for separating linksets easily.

Thread Started By Huggypie

1964
1
  • 5 Vote(s) - 1.6 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rate Thread
#1
Thumbs Up 
Hi everyone! I have noticed that when trying to parse XML files with multiple links in MeshesSL, I often get .dae files that are unable to be read properly by the viewer when uploading. I solved this problem by creating a python script that separates a multi-link xml file into separate xml files, each only containing the info for a single mesh.

To use it, just install python and copy save the script to the folder containing your xml file. Rename your xml file as 'source.xml' and run the script c:#This parameter determines whether link names keep their original names or not.
#Set to False to name each link numerically instead
RENAME_LINKS = True



FILE_START = '\n \n'
FILE_END = '
\n
'
LINK_NAME = ' name'


f = open('source.xml')
ftext = f.read()
f.close()
flist = ftext.split('\n')
#print(len(flist))
#spaces of 326
newString = ''
imesh = 1
skip = False
for i in range(2,len(flist)-1):
#print(flist[i])
add = flist[i] + '\n'
if not (flist[i] == ' parent' or flist[i-1] == ' parent'):
if flist[i - 1] == LINK_NAME and RENAME_LINKS == True:
add = ' ' + 'link{}'.format(imesh) + '\n'
newString += add
else:
newString += add
if i < len(flist):
end = ' '
beginPlus1 = ' '
if (flist[i] == end and flist[i+2] == beginPlus1) or (flist[i+1] == '
'):
#print('true')
newfile = open('m{}.xml'.format(imesh),'w+')
output = FILE_START + newString + FILE_END
newfile.write(output)
newfile.close()
newString = ''
imesh += 1
#print(flist[i])
print('Finished')
Reply


#2
I miss the old days copyboting was so easy and mesh was only just starting to come in
Howdy from down Under. Stay blazzed n work for lulzs
Old-school
Patricotic niggras
Woodbury
And others I won't mention
Hire hacker pm me on fb peepantsfunnyclown
Activist hacker 4
Anonymous lulzsec redcult n my own crew
Modbrothersaustralia
Reply




Possibly Related Threads…
Thread Author Replies Views Last Post
  i need "Sim Crasher Script".. i can pay 10,000L$ for the script.. melih 0 2,702 04-26-2013, 06:49 PM
Last Post: melih

Forum Jump:

1 Guest(s)
Share this:

About Second Life Copybot

Second Life CopyBot Forum is a place where you can get items for Second Life and other vitual worlds for free. With our CopyBot viewers you can export and import any content from these virtual worlds and modify them in 3D software such as Blender, 3D studio Macx etc...