PDA

View Full Version : Lscript plugin idea - where to start?



Bitboy
02-04-2008, 01:46 AM
Not sure if this exists but I have a project where I need to make a lot of animated titles, and instead of constructing each title from a bunch of premade objects (have made the characters already) I wanted to have a plugin that could do the following:

- Be able to select a directory where the models of the characters reside
- An input field where you could type your title
- Creates an object or scene where the letters (based on the input string) are spaced according to individual character size + 15% of it's width
- The letters should be in layers of the same object (or if defined in layout, as children of a null) so they could be animated if needed

Does anyone here know of such a Lscript or plugin that does this?

It's my very first Lscript I'm starting on and I'm not a traditional programmer though I know HTML and PHP pretty well. I've downloaded the documentation and made the interface with LSID and right now I'm using the E Text Editor to write it. And honestly I haven't come very far. :s

Any ideas what would be the best way to achieve the above? Right now I can't seem to figure out how to select a directory instead of a file. Pretty basic problem but I gotta start somewhere :D

stib
02-04-2008, 09:52 PM
I don't think you can open up a folder requester with lscript (you'll find out how half-baked and shonky lscript is the more you use it).

You could choose a file and then use split() to split the path into an array, then find the length of the array, and subtract 2 from it (the last 2 elements of an array made with split(0 are the file name and extension), to give you your path.


myfile= getfile("choose a file");
patharray = myfile.split();
pathlength = myfile.count();
foreach(pathitem, myfile)
{
filepath += pathitem;
}


Check out dodgy's lscript index if you're starting off.


should do the trick, ugly and klunky as it is.

stib
02-04-2008, 09:59 PM
I meant my code was ugly and klunky not Dodgy's lscript index, which is a thing of beauty. Functional, minimalist beauty, perhaps, but beauty nonetheless.


I don't think you can open up a folder requester with lscript (you'll find out how half-baked and shonky lscript is the more you use it).

You could choose a file and then use split() to split the path into an array, then find the length of the array, and subtract 2 from it (the last 2 elements of an array made with split(0 are the file name and extension), to give you your path.


myfile= getfile("choose a file");
patharray = myfile.split();
pathlength = myfile.count();
foreach(pathitem, myfile)
{
filepath += pathitem;
}


Check out dodgy's lscript index if you're starting off.


should do the trick, ugly and klunky as it is.

Bitboy
02-05-2008, 05:28 AM
Thanks stib!

Yeah dodgy's page is awesome. And apparently that directory lookup had me fooled. Looked everywhere for something usable and thank you for the code snippet. I'll take a look at it. :)

stib
02-05-2008, 05:56 AM
That snippet is all wrong. I originally had a for() loop in there, for some reason I changed it to a foreach(). That would just recreate the original array. Sorry, you'd need


for(i=1; i<=pathlength-2; i++) // arrays are numbered from 1 in lscript..
filepath += pathitem;

Dodgy
02-05-2008, 02:00 PM
I meant my code was ugly and klunky not Dodgy's lscript index, which is a thing of beauty. Functional, minimalist beauty, perhaps, but beauty nonetheless.

I take that in the spirit in which it was meant :)

adamredwoods
02-05-2008, 02:08 PM
Assuming:
You cannot make the titles in another app (After Effects).
You need 100's of titles, or the style of text may change, that making a plugin would be more economical than just creating the titles.

The letters would have to be premade. That I see being the main task.

For the script:
Choose directory of objects.
Load in the A to Z objects (punctuation, numbers) precreated in Modeler.
Hide these objects.
For each "Title" inputed from the user:
- create a null named with the title
- parse the Title requested
- create a clone of each character needed from the preloaded bunch
- parent the appropriate letter to the null
- set the offset X of the letter object
- repeat, rinse