Introduction to Maya - Modeling Fundamentals Vol 2
This course will look in the fundamentals of modeling in Maya with an emphasis on creating good topology. It's aimed at people that have some modeling experience in Maya but are having trouble with complex objects.
# 1 02-03-2012 , 08:36 PM
Edward256's Avatar
Registered User
Join Date: Dec 2007
Location: Sweden
Posts: 27

Invalid argument: 0

Hi.
I like the way one can program in Maya, but it would be nice if it could tell me where the errors are.
Code:
string $nextline;
string $fileName = "......\\GOL.TXT";

if ( frame == 0 )
{
	//open file
	$fileID = `fopen $fileName "r"`;

	// Init black
	setAttr (ramp1.colorEntryList[0].colorR) 0;
	setKeyframe -outTangentType linear -t 0sec (ramp1.colorEntryList[0].colorR);
	setAttr (ramp1.colorEntryList[0].colorG) 0;
	setKeyframe -outTangentType linear -t 0sec (ramp1.colorEntryList[0].colorG);
	setAttr (ramp1.colorEntryList[0].colorB) 0;
	setKeyframe -outTangentType linear -t 0sec (ramp1.colorEntryList[0].colorB);

	setAttr (ramp1.colorEntryList[2].colorR) 0;
	setKeyframe -outTangentType linear -t 0sec (ramp1.colorEntryList[2].colorR);
	setAttr (ramp1.colorEntryList[2].colorG) 0;
	setKeyframe -outTangentType linear -t 0sec (ramp1.colorEntryList[2].colorG);
	setAttr (ramp1.colorEntryList[2].colorB) 0;
	setKeyframe -outTangentType linear -t 0sec (ramp1.colorEntryList[2].colorB);

	// first string
	$nextline = `fgetline $fileID`;

	while ( size( $nextline )>0 )
	{
		// Get the line
		string $time = `match "/\* [0-9]+ms \*/" $nextline`;
		print ( $time );

		$nextline = `fgetline $fileID`;
	}

	//close file
	fclose $fileID;
}
Code:
// Error: Invalid argument: 0 //
// Error: An execution error occured in the expression cameraColors. //
// Result: cameraColors //
Where does it go wrong?

/Edward

# 2 03-03-2012 , 03:41 AM
NextDesign's Avatar
Technical Director
Join Date: Feb 2004
Posts: 2,988
Hi Edward.

In the script editor, under History, check "Line numbers in errors".


Imagination is more important than knowledge.
# 3 03-03-2012 , 12:35 PM
Edward256's Avatar
Registered User
Join Date: Dec 2007
Location: Sweden
Posts: 27
Ah, thanks.
Code:
// Error: line 11: Invalid argument: 0 //
// Error: line 1: An execution error occured in the expression cameraColors. //
// Result: cameraColors //
So, if I count the lines correctly, it's complaining about
Code:
setAttr (ramp1.colorEntryList[0].colorR) 0;
What's wrong with this then? I was going according to the example in "Read animation values from a text file".

/Edward

# 4 03-03-2012 , 05:40 PM
NextDesign's Avatar
Technical Director
Join Date: Feb 2004
Posts: 2,988
You need to put the object name in quotes. Eg: setAttr ("ramp1.colorEntryList[0].colorR") 0;


Imagination is more important than knowledge.
# 5 03-03-2012 , 07:15 PM
Edward256's Avatar
Registered User
Join Date: Dec 2007
Location: Sweden
Posts: 27
Ah, many thanks. Didn't realise that from the small example. Now just to filter out the elements from the text file.

/Edward

Posting Rules Forum 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

Similar Threads