Can anyone tell me how to wordsearch and replace an AS file for line widths? Say I have a lot of layers where the width of a line is 1.2 and I want to replace all widths of 1.2 with 2?
What are the search parameters for line widths?
Thanks
D.K
Wordsearch and replace line widths in AS file
Moderators: Víctor Paredes, Belgarath, slowtiger
It's kind of tricky because in the text file a line width of 1.2 is not listed that way. It is a value that is relative to the document so that the line widths can change based on resolution.
HAH! UPDATE
You have to divide the weight of the stroke in AS by the height of the project dimensions. In my example that would be 540.
For instance a document set to NTSC (720 x 540) with a shape that has a stroke width of 1.2 is listed in the "shapes" area of the file format as 0.002222. However if you change the resolution of the file to web (320 x 240) and set the stroke width BACK 1.2 the value in the file is 0.005. When changing resoluion of the project AS maintains the stroke widths. They change in the AS document, but they don't change in the internal file format value.
So depending on the resolution of the project "1.2" might be different values. My advice would be to use named styles from now on. I NEVER use the stroke setting in the shape directly. I always create a style for it so I can make global changes.
Here is the code where the stroke width is found. This file has 1 shape on one layer. The file is set to NTSC and the stroke width is 1.2. I've marked below where this number is located.
The first line "shapes 1" indicates the total number of shapes on that layer. The next line starts with the name you gave that shape in AS. If you didn't name it that would just be empty quotes "".
-vern
HAH! UPDATE
You have to divide the weight of the stroke in AS by the height of the project dimensions. In my example that would be 540.
For instance a document set to NTSC (720 x 540) with a shape that has a stroke width of 1.2 is listed in the "shapes" area of the file format as 0.002222. However if you change the resolution of the file to web (320 x 240) and set the stroke width BACK 1.2 the value in the file is 0.005. When changing resoluion of the project AS maintains the stroke widths. They change in the AS document, but they don't change in the internal file format value.
So depending on the resolution of the project "1.2" might be different values. My advice would be to use named styles from now on. I NEVER use the stroke setting in the shape directly. I always create a style for it so I can make global changes.
Here is the code where the stroke width is found. This file has 1 shape on one layer. The file is set to NTSC and the stroke width is 1.2. I've marked below where this number is located.
The first line "shapes 1" indicates the total number of shapes on that layer. The next line starts with the name you gave that shape in AS. If you didn't name it that would just be empty quotes "".
Code: Select all
shapes 1
"Stroke Shape 1" true false true false
1
0 0
""
false
[
keys 1
0 0 0.1 0.5 1 1 1 1
]
false 0.002222 ------> "this is the stroke width"
false
[
keys 1
0 0 0.1 0.5 0 0 0 1
]
""
false
6.283185
0.25
true
-1
-1
-1
""
""
It's tricky to find.
Look in the section of the file format that starts the points of the vector.
This is a snippet from a layer with a 4 point circle:
This is further down the file for one of the points. In this example there is no width setting:
This is the exact same point on a duplicate file with the point width changed:
I do not know what the values represent. All I know is that "-1" seems to imply no width is set and the other corresponding number indicates the width value.
What is amazingly helpful finding out this stuff is if you have a text application that can compare two files and find the differences. I was able to compare these two identical files and instantly find the exact spot that changes.
I use a program for Mac only called TextMate, but jEdit is also good for this and is a cross platform java application.
EDIT: I didn't check this for a keyed value later in the time line. It's probably similar. I think the key frames are listed below the "keys 1" line within the keys brackets. So if you had 10 key frames for one point it would say "keys 10" and each key would be on it's own line under it as in the example above. Each point would have its own bracketed set of keys. Each point seems to have two sets of bracketed "keys". Not sure what the second set is for.
-vern
Look in the section of the file format that starts the points of the vector.
This is a snippet from a layer with a 4 point circle:
Code: Select all
### mesh layer values
noisy_shapes false
noisy_lines false
animated_noise false
noise_amp 0.014815
noise_scale 0.059259
extra_lines 0
gap_filling false
fill_texture ""
line_texture ""
mesh
[
points 4
Code: Select all
[
keys 1
0 1 0.1 0.5 0.01634 0.169531
]
[
keys 1
0 1 0.1 0.5 -1
]
Code: Select all
[
keys 1
0 1 0.1 0.5 0.01634 0.169531
]
[
keys 1
0 1 0.1 0.5 0.053009
]
What is amazingly helpful finding out this stuff is if you have a text application that can compare two files and find the differences. I was able to compare these two identical files and instantly find the exact spot that changes.
I use a program for Mac only called TextMate, but jEdit is also good for this and is a cross platform java application.
EDIT: I didn't check this for a keyed value later in the time line. It's probably similar. I think the key frames are listed below the "keys 1" line within the keys brackets. So if you had 10 key frames for one point it would say "keys 10" and each key would be on it's own line under it as in the example above. Each point would have its own bracketed set of keys. Each point seems to have two sets of bracketed "keys". Not sure what the second set is for.
-vern
Last edited by heyvern on Tue Mar 11, 2008 11:58 am, edited 1 time in total.