AE On A Mac does not generate LF character.

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
User avatar
Atomic
Posts: 157
Joined: April 30th, 2007, 5:55 am
Location: United States, Ohio

Hi All,

I have been working on an export script. It examines an AE project and generates python code to re-create the scene inside of Blender.

This all works great on windows, however, when the .JSX script is run on a Mac, it fails to output the line feed character. Thus all the code it generates ends up on a single line.

Does anyone have a workaround for this?

The code base I am using is the urban spaceman's camera exporter. So you may be familiar with the code.

Here is the line where the CRLF character combination is defined:

Code: Select all

G.RET = "\n\r"; 
I also tried:

Code: Select all

G.RET = "\r\n";
"Up And Atom

No...No

Up And At Them!"
Yenaphe
Posts: 84
Joined: February 3rd, 2009, 6:30 pm
Location: Paris - France
Contact:

I thought that mac was using only CR ("\r") for a new line.
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

I've had this problem with a lot of my scripts, one of which came up here:
viewtopic.php?f=9&t=653&st=0&sk=t&sd=a&start=15
The way I fixed that issue was to change the code that writes the lines in the text file from write(....\r) to writeLn(...)

But not having a Windows machine for testing, I still don't really know the answer to this either.
User avatar
Atomic
Posts: 157
Joined: April 30th, 2007, 5:55 am
Location: United States, Ohio

I have adjusted the G.RET to be "\r" and I have modified the final output routine like so:

Code: Select all

/*-----------------------------------------------------------------------------------*/    
function write3DFile() // writes a ASCII file that the 3D softwave can read
/*-----------------------------------------------------------------------------------*/    
{      
	var file = File(G.FILE_PATH);	
	if (!file)
	{
		return;
	}
	if (file.open("w", "TEXT", "????"))
	{
		aryLines = G.SCENE_STRING.split(G.RET)
		for (i=0; i<aryLines.length; i++){
			file.writeln(aryLines[i]);
		}
		file.close();
	}
}
But that still does not create a CRLF in the file, only CR. While most text editors can interpret the line feeds, the Blender text window, on a Mac, can not, making the generated code useless. Even BBedit can not fix the generated output.

I have submited a bug report to Blender.ORG. It works fine on Windows.
"Up And Atom

No...No

Up And At Them!"
nab
Posts: 203
Joined: November 29th, 2005, 3:00 am
Location: Royan
Contact:

I don't know what G.SCENE_STRING contains but it sounds like this string already contains the newline sign. Did you try to write it directly to the file, i.e., file.write(G.SCENE_STRING) ?

According to my test, "\r\n" seems to be the winner :

Image
User avatar
Atomic
Posts: 157
Joined: April 30th, 2007, 5:55 am
Location: United States, Ohio

Thanks for the chart!

I am begining to think it is a bug in the Blender text window on the mac version.
"Up And Atom

No...No

Up And At Them!"
Post Reply