AE ENHANCERS

Expressions/Scripts/Presets
It is currently Wed May 22, 2013 10:19 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 14 posts ] 
Author Message
 Post subject: AE to C4D
PostPosted: Thu Jun 08, 2006 3:59 am 
Offline

Joined: Tue Sep 21, 2004 7:29 am
Posts: 36
Hi,

This is a copy of a mail I posted in the AE list :

I would like to know if someone here knew how to write a script doing that :

Take a layers 3D position data and format it this way :

Original :

Code:
Adobe After Effects 7.0 Keyframe Data

    Units Per Second    25
    Source Width    768
    Source Height    576
    Source Pixel Aspect Ratio    1
    Comp Pixel Aspect Ratio    1

Transform    Position
    Frame    X pixels    Y pixels    Z pixels   
    0    394    298    -736.667   
    89    374    278    -756.667 


End of Keyframe Data


Formated :

Code:
Point    X    Y    Z
0    394    298    -736.667
1    374    -278    -756.667


I know this is quite easy to do with a simple text editor, but my main idea is to write an AE script that exports the following data to Cinema 4D :
Camera Position
Camera Point of interest
Layer position
Layer size
...

This would be great if a project started in AE required 3D elements and allow me to export the project to C4D.

If anyone has an idea how to do that or where to find help, I'll appreciate.

Thanks,

Salvador


Top
 Profile  
 
 Post subject: Re: AE to C4D
PostPosted: Fri Jun 09, 2006 12:21 pm 
Offline

Joined: Wed Jul 20, 2005 12:07 am
Posts: 139
salvazalvi wrote:
I know this is quite easy to do with a simple text editor, but my main idea is to write an AE script that exports the following data to Cinema 4D :
Camera Position
Camera Point of interest
Layer position
Layer size


How would you go about it? Do you plan on using a COFFEE expression in C4D to read your data? If not, your only option is XML import and for that:

a) Simple notation conversion wouldn't do it

b) You needed to add all the extra XML definitions

Especially the latter would make it a very large and slow script, even for just a simple camera animation. So from my point of view this really isn't feasible as a script until the day C4D has a simplified XML or ASCII importer or something like that.

Mylenium

_________________
[Pour Mylène, ange sur terre]


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 09, 2006 4:42 pm 
Offline

Joined: Tue Sep 21, 2004 7:29 am
Posts: 36
Yes, the idea is to write a coffee script in C4D.

But to be honest, so far, I've only used simple expressions in AE and simple Xpresso in C4D.

From AE to C4D by hand works quite well but it's not really fast : export data from AE, format it for C4D (this part involves a spreadsheet editor to invert Y axis), create a spline in C4D, import ASCII data to define the spline points, attach the camera's position, the camera's target or the layer's position to the spline, match C4D's amera with AE's.

So AE's script would only have to select relevant layers (based on layers name), copy relevant data, process and format it for C4D, create a txt file.

C4D's script would look into a folder containing relevant txt files, create each spline, camera, target,layer, light... with correctly set tag (attach to spline)

This doesn't seem impossible to do to me because I can understand needed steps, but maybe my lack of understanding of how both AE's scripts and C4D coffee work makes me believe it when in reality it isn't.

I know it's a long process, but hey, it's a good way to learn.

Salvador

P.S. : someone on AE's list posted me this link http://www.creativemac.com/articles/viewarticle.jsp?id=42002. It seems there already exists an Xpresso doing part of what I need.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 09, 2006 10:40 pm 
Offline

Joined: Tue Nov 29, 2005 3:00 am
Posts: 201
Location: Paris
salut Salvador,

I think I can help you ... if you post a typical txt file (recognized by c4d) containing all properties you want to export. What should be written to specify POI, orientation (instead of "Point") ...

As an example, select a 3D layer and apply the following script. Position datas will be exported in a txt file.
This can be easily extended to other properties and also easily modified if the format isn't exactly the one you need for C4D.

Code:
{

var myComp = app.project.activeItem;
var myLayer = myComp.selectedLayers[0];
var myFileName = myComp.name + "_" + myLayer.name + "_position.txt";
var theFile = filePutDialog("Save and open layer's position :", myFileName, "TEXT txt");
if (theFile != null) {
   theFile.open("w","TEXT","????");
   theFile.write("Point   X   Y   Z\r");
   var nbFrames = Math.floor(myComp.duration / myComp.frameDuration);
   for (var f = 0; f < nbFrames; f++) {
      var myPos = myLayer.position.valueAtTime(f * myComp.frameDuration,true);
      theFile.write(f + "\t" + myPos[0] + "\t" + myPos[1] + "\t" + myPos[2] + "\r");
   }
   theFile.close();
   theFile.execute();
}

}


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 10, 2006 2:32 am 
Offline

Joined: Tue Sep 21, 2004 7:29 am
Posts: 36
Hi nab (enfin salut),

Thanks,

With your script I managed to export both Position and POI with these little modifications (my first script editing !!!!) :

Code:
{

var myComp = app.project.activeItem;
var myLayer = myComp.selectedLayers[0];
var myFileName = myComp.name + "_" + myLayer.name + "_position.txt";
var theFile = filePutDialog("Save and open layer's position :", myFileName, "TEXT txt");
if (theFile != null) {
   theFile.open("w","TEXT","????");
   theFile.write("Point   X   Y   Z\r");
   var nbFrames = Math.floor(myComp.duration / myComp.frameDuration);
   for (var f = 0; f < nbFrames; f++) {
      var myPos = myLayer.position.valueAtTime(f * myComp.frameDuration,true);
      theFile.write(f + "\t" + myPos[0] + "\t" + ("-") + myPos[1] + "\t" + myPos[2] + "\r");
   }
   theFile.close();
}

var myComp = app.project.activeItem;
var myLayer = myComp.selectedLayers[0];
var myFileName = myComp.name + "_" + myLayer.name + "_POI.txt";
var theFile = filePutDialog("Save and open layer's POI :", myFileName, "TEXT txt");
if (theFile != null) {
   theFile.open("w","TEXT","????");
   theFile.write("Point   X   Y   Z\r");
   var nbFrames = Math.floor(myComp.duration / myComp.frameDuration);
   for (var f = 0; f < nbFrames; f++) {
      var myPos = myLayer.pointOfInterest.valueAtTime(f * myComp.frameDuration,true);
      theFile.write(f + "\t" + myPos[0] + "\t" + ("-") + myPos[1] + "\t" + myPos[2] + "\r");
   }
   theFile.close();
}
}


It works quite well in C4D.

I'll ask C4D specialist of what exactly would be needed to have a layers orientation, lights parameters or camera settings and then I'll come back to you.

Thanks again,

Salvador

[EDIT : ] Do you know the difference between Orientation and Rotation in AE, manual isn't very explicit about it ?
So far I'm trying to export only the camera's position and POI because I can then use splines in C4D and attach the camera to these splines.
I've already had problems exporting AE rotation data to 3DSMax and the coders (who didn't spend much time but they where just giving me a hand) didn't manage to convert rotation data. But if I can have position and POI, I'll just need Z rotation to have everything I need.
This would mean that when animating a camera in AE script users would hve to always use these 3 parameters and not orientation or individual rotation values, unless we find a way to use them in C4D or convert them to POI values.


Last edited by salvazalvi on Sat Jun 10, 2006 2:48 am, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 10, 2006 2:33 am 
Offline

Joined: Tue Sep 21, 2004 7:29 am
Posts: 36
By the way, nab, do you mind if I share what's said here with members from AE list and FrenchC4D ? Of course I'll always mention who's done what.

Salvador


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jun 10, 2006 9:47 am 
Offline

Joined: Tue Nov 29, 2005 3:00 am
Posts: 201
Location: Paris
Of course, you can share info with other users.
Your first script is quite funny but bravo ! :D
When more details about the txt format will be given, I could write the script for you.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 02, 2007 8:08 am 
Offline

Joined: Fri Feb 02, 2007 6:14 am
Posts: 5
Hello to all.
It's great to be here.

I'm an AE and C4D user, but in expressions i'm a newbie with a few basic knowledge.
I always wonder how you can take the camera data from AE to C4D. It's very useful.
This expression looks great, but can someone write with details how you can achieve that in more depth?

Thanks in advance..


Top
 Profile  
 
 Post subject:
PostPosted: Sun Feb 04, 2007 9:51 am 
Offline

Joined: Fri Feb 02, 2007 6:14 am
Posts: 5
Is there anybody here who can help newbies?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 06, 2007 2:39 am 
Offline

Joined: Tue Nov 29, 2005 3:00 am
Posts: 201
Location: Paris
What kind of help do your need ?
please be more precise


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 06, 2007 9:36 am 
Offline

Joined: Fri Feb 02, 2007 6:14 am
Posts: 5
Thanx for your reply.
I would be more precise.

In that script you said that you can export camera data from AE to C4D. Where do you write that script? In the position of any 3D layer? I've done that and it says script error. I'm doing something wrong here?
And 2nd, if i can make to export that txt file which has my data, where do i have to go in C4D so i can use that script? How can i open it? How can i use it?

thanx in advance again and sorry for my english


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 06, 2007 9:36 pm 
Offline

Joined: Tue Nov 29, 2005 3:00 am
Posts: 201
Location: Paris
This is a script (not an expression), so copy/paste the code into a text editor and save it with the .jsx extension.
In AE you access script through the command File>>Scripts>>...


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 13, 2007 12:40 am 
Offline

Joined: Fri Feb 02, 2007 6:14 am
Posts: 5
Ooow...this is a script :?
I am irrelevant with this.

Anyway, i have execute the script to a 3D null layer and export me 2 txt files.
Congrats to me..:P
What is my next steps? How can i import that to C4D? That's the hard part..


Top
 Profile  
 
 Post subject:
PostPosted: Sun Apr 22, 2007 1:10 pm 
Offline

Joined: Sat Jun 05, 2004 7:59 am
Posts: 646
Location: London, UK
I couldn't figure it out either. :)

Anyway, I hope you guys are still interested in this because I've been busy:
http://aenhancers.com/viewtopic.php?p=2430


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group