Script to enable vrml model by maya to load in artoolkit

Guys we had a lot of trouble to import our model which we designed in maya ,so we designed a script which removed parts which didnt allow it to be displayed in vrml and also improved its display in bright shine same as bee model provided with artoolkit , feel free to use the scripts and at Your Own risk , n please leave a little thanks if it was useful for you.__version__ = “1.0″
__author__ = “Sydney Yvan Moutia/Rajub Atish Koomar”

import re, sys

PATT_DIFFUSE = ‘diffuseColor’
PATT_EMISSIVE = ‘emissiveColor’
PATT_CONVEX = ‘convex FALSE’
PATT_INFO = ‘VRML2.0 created with Version 1.3, from Alias Maya 8.5′
PATT_SUB_INFO = ‘8.5′
PATT_SUB_INFO_REP = ‘8.5 and improved by Sydney Yvan Moutia and Atish Rajub’

if __name__ == ‘__main__’:
if len(sys.argv) is not 4:
print ‘vrml_maya input.wrl output.wrl scale’
else:
strInput = sys.argv[1]
strOutput = sys.argv[2]

input = open(strInput, ‘r’)
output = open(strOutput, ‘w’)

scale = sys.argv[3]
lines = input.readlines()

tmp = ”
for line in lines:
if re.search(PATT_INFO, line) is not None:
output.write(re.sub(PATT_SUB_INFO, PATT_SUB_INFO_REP, line))
continue

if re.search(PATT_DIFFUSE, line) is not None:
tmp = line

if re.search(PATT_EMISSIVE, line) is not None:
output.write(re.sub(PATT_DIFFUSE, PATT_EMISSIVE, tmp))
elif re.search(PATT_CONVEX, line) is None:
output.write(line)

input.close()
output.close()

datFile = open(re.sub(‘wrl’, ‘dat’, strOutput), ‘w’)
datFile.write(strOutput + ‘\n’)
datFile.write(‘0 0 0\n’)
datFile.write(‘90 1 0 0\n’)
datFile.write(” + scale + ‘ ‘ + scale + ‘ ‘ + scale)
datFile.close()

Leave a Reply