View Full Version : Filename class help
Benek 06-01-2010, 01:20 PM I'm struggling with something quite simple and could really use some help...
I wanted to load a sound file into a BaseSound object, but I really can't figure out how to use the Filename class to load the file in the first place. I've pasted my code below – I keep getting Incompatible value errors.
I know this should be a straightforward task and I've been using the SDK as my main reference. I've really been trying to learn COFFEE recently and would really appreciate any help....
main(doc,op)
{
var fn=new(Filename);
var bs=new(BaseSound);
fn->SetFullString("/Volumes ... File.wav");
bs->Load(fn);
}
|
|
Benek
06-01-2010, 04:27 PM
OK, so if I enter my code into the script manager, it works
var fn=new(Filename);
fn->FileSelect("Select File", 0);
var path=fn->GetFullString();
println(path);
but when I put it in a COFFEE tag I get the error – Incompatible values... NIL / OBJECT...
main(doc,op)
{
var fn=new(Filename);
fn->FileSelect("Select File", 0);
var path=fn->GetFullString();
println(path);
}
How might I get this working in a COFFEE TAG? All I'm after at the moment is to be able to pass a filename into a BaseSound.
Cairyn
06-01-2010, 05:03 PM
OK, so if I enter my code into the script manager, it works
but when I put it in a COFFEE tag I get the error – Incompatible values... NIL / OBJECT...
How might I get this working in a COFFEE TAG? All I'm after at the moment is to be able to pass a filename into a BaseSound.
I would assume that the filename class is deactivated in a COFFEE tag. After all, the tag is evaluated every time something relevant changes in the scene - that would mean permanent harddisk access, and this sound file would be loaded again and again and... Not a good idea.
Besides, do you work with R11 or later? The animation classes from earlier Coffee have been overridden with CTrack, CCurve and CKey, and I have not yet found out how to access a sound track/curve from Coffee.
Benek
06-01-2010, 06:01 PM
I'm using 11.5... I get what you say about a file being loaded at every evaluation, so maybe I'm heading in the wrong direction...
thanks Cairyn
bobtronic
06-01-2010, 06:10 PM
File access is not allowed in expressions.
cheers,
Matthias
CGTalk Moderation
06-01-2010, 06:10 PM
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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.