>: CG Forums on 3dtotal - The best forums for CG artists :.
threedy forums home
 


top-table-gradient
Go Back   3DTotal Forums > Archives > Archives > Scripting & coding
bottom-table-gradient

Reply
 
Thread Tools Display Modes
14211 rads test
Old 29-10-2004, 08:10 AM   #1
WightWorks
Registered User
 
Join Date: Jun 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Stuck on a max 6 script bug

I created this utility script for max 6 to import specially formatted text files that control the motion of the objects in my scene (I'm using this to visualize simulations). Although the script itself seems to work well, there is one bug that I haven't been able to find. After I open max, I open my animation file, then open and evaluate the script below, click "Process Data File", and select my file. It always returns with "Unknown property: pos in undefined" and "CurrentObject.pos = [x,y,z];" is highlighted. I then evaluate the script a second time, click process data, select my file and everything works perfectly. I only need to do this each time I start max, so I'm assuming that there is a global variable I'm setting somewhere that I'm not initializing or something like that? Any suggestions would be appreciated. Thanks!

Derek Wight.


utility IllacImporter2D "Illac Importer 2D"
(

button ButProcess "Process Data File"

on ButProcess pressed do
(
clearListener()

FileName = getOpenFileName()

if FileName != undefined then
(
print FileName
fid = openFile FileName

Frames = readValue fid
print Frames

Objects = readValue fid
print Objects

undo "Load Animation Data" on
(
for i = 1 to Objects do
(

ObjectName = readLine fid
ObjectName = "CurrentObject = $" + ObjectName
print ObjectName

execute ObjectName

animate on
(
rr_last = 0;

for j = 1 to Frames do
(

x = readValue fid
z = readValue fid
y = readValue fid

y = -y

rr = readValue fid
rot = angleaxis (rr-rr_last) [1,0,0]
rr_last = rr;

vis = readValue fid

at time (j-1)
(

CurrentObject.pos = [x,y,z];
rotate CurrentObject rot;
)
) -- end for
) -- end animate on
) -- end for
) -- end undo

close fid

) else (

print "User canceled"
)
)
)
WightWorks is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 09:35 AM.


Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
all images displayed on this site are copyright the original artists and may not be reproduced, copied or published elsewhere without their express permission