Error in CSV reading script

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  04 April 2012
Error in CSV reading script

I'm getting an error in the "theDummy.position.controller.percent = (readValue theFile)" line: "Unknown Property: "Position" in undefined". I have tried using .pos as well and keep getting the error.

What I'm trying to do is read a CSV file that I've calculated the "Time" and "Percent" along a path with. This script should automatically insert those values in the animation, but obviously I'm getting an error. Any ideas?

(--start a local scope.
  --pick the file:
  local theFilename = getOpenFileName types:"Comma Separated Values (*.CSV)|*.CSV|All Files (*.*)|*.*"
  if theFilename != undefined do ( --if a valid filename picked,
  	local theFile = openFile theFilename --open the file
  	local theDummy = Dummy005 --set dummy
  	while not eof theFile do ( --loop until the end of tile
  		theTime = (readValue theFile) --read the time
  		with animate on --enable autokey animation context
  			at time theTime  --set the current time for the following expression
  				theDummy.position.controller.percent = (readValue theFile)
  	)--and read the percent from the file for each time step
  	close theFile --close the file when done
  )--end if
  )--end script
 
  04 April 2012
I think you forgot a dollar sign ($) in this line:
local theDummy = Dummy005 --set dummy

Assuming that an object named Dummy005 exists, it should be:
local theDummy = $Dummy005 --set dummy
 
  04 April 2012
Originally Posted by AyTrane:
(--start a local scope.
      --pick the file:
      local theFilename = getOpenFileName types:"Comma Separated Values (*.CSV)|*.CSV|All Files (*.*)|*.*"
      if theFilename != undefined do ( --if a valid filename picked,
      	local theFile = openFile theFilename --open the file
      	local theDummy = $Dummy005 --set dummy
      	while not eof theFile do ( --loop until the end of tile
      		theTime = (readValue theFile) --read the time
      		with animate on --enable autokey animation context
      			at time theTime  --set the current time for the following expression
      				theDummy.position.controller.percent = (readValue theFile)
      	)--and read the percent from the file for each time step
      	close theFile --close the file when done
      )--end if
      )--end script


hopefully it fixed your problem

oops. i'm late...
 
  04 April 2012
That was it, thanks a lot! Simple mistake, easy fix.
 
  04 April 2012
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 09:04 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.