Anim8or Community
General Category => ASL Scripts => Topic started by: vobla on January 16, 2008, 06:45:14 pm
-
Hi all,
I'm very happy that I found this brilliant software by accident. ;)
It's very usefull, simple and quite powerfull.
I found the basics of syntax very simple, so I wrote this small script (called advanced, because it's a bit better than plane_plugin ::)).
Now, you can draw a plane and divide it to as many segments as you like (it's a bit lie, but anyway :D )
BTW, comments in spring_pugin_1.a8s are helped alot, thanks. ;)
You can find it in the attachment.
Cheers. ;)
EDIT: please download the latest version from the very last post.
-
cool! until now ive been using the original and subdived faces to get this result now i don't have too!
-
Great little script there.
I've been hoping there would be one with these options.
-
Hi vobla
Good work.
I have a few suggestion if your interested.
1)Use a different line for comments.It would make your
code easier to read.
2)You don't need to initialize $i and $j to 0.
3)Right now,your faces(normals) are facing down toward -Y.It might
be better to have them facing up.You just have to reverse the winding(the
order you're adding the vertices)Seen from the top,you're going counter clock wise.
Go clock wise.
4)You could also calculate the UV coords so that your mesh would show a
complete texture,seen from the top.
Texture coords are:
Image UVcoords
Bottom left 0,0
Bottom right 1,0
Top left 0,1
Top right 1,1
So,you can calculate them in a way similar to the one you used for the vertices.
Hope it helps.
Welcome to Anim8or.
Claude
-
Hi vobla
Good work.
I have a few suggestion if your interested.
1)Use a different line for comments.It would make your
code easier to read.
2)You don't need to initialize $i and $j to 0.
3)Right now,your faces(normals) are facing down toward -Y.It might
be better to have them facing up.You just have to reverse the winding(the
order you're adding the vertices)Seen from the top,you're going counter clock wise.
Go clock wise.
4)You could also calculate the UV coords so that your mesh would show a
complete texture,seen from the top.
Texture coords are:
Image UVcoords
Bottom left 0,0
Bottom right 1,0
Top left 0,1
Top right 1,1
So,you can calculate them in a way similar to the one you used for the vertices.
Hope it helps.
Welcome to Anim8or.
Claude
Hey thanks,
This help very much. I'll definitely take a look at that tomorow ;)
EDIT:
Hi all,
Here's the new version.
Roadmap:)
1) -- DONE --
2) I preffer to keep things clear ;) You are free to modify it anyway ;)
3) -- DONE --
4) According to my calculations, new ST (UV ..whatever) coords formula result is correct, but when I add texture to a plane in Anim8or it gets clamped. Is it normal behaviour? If not, I messed something up.. ::)
-
2)The reason I was saying you don't need it is that your doing it
again in the loop: for $i = 0 to and for $j = 0 to
4)UV and ST are both used.I've made a few corrections to the
uvcoords calculation.Have a look.
Bye
Claude
-
Hey,
And about that 2) I knaow I'm doing it twice, but I like to initialize default values even if its zero by default or I do it later in the code. It's just easyer to devide the script like that (params, vars, default values, code) and most importantly read. ::)
Thank you for your corrections.
Thanks to Claude here's the newest version (suppose the last release :D )
Cheers
-
I found another issue :p
Basically with your script, none of the points are actually connected. It'd be much more useful if it was an attached grid rather than many small planes placed next to each other. I'm not any kind of a coder, so I'm not sure how to do this, but I hope you can attach the sections of the plane. Perhaps ASL can merge points or something?
-
If this is what you want,then you simply have to reuse the points created for
the existing adjacent quad or more precisely their index that you would have
to store.
-
In other word, I create too many points. If the coords are the same, I should just add reference of the point. I wish I could use C# list, PHP array or recursing funcion.. :D
Anyway, I'll try to fix it as soon as I can, it should be posible anyway, is't it ;)
And hey, thanks for commenting. I really appreciate that. ;)
EIDT:
I looked at http://www.anim8or.com/scripts/mesh_1.txt
example and found
$index[$i] = $mymesh.AddPoint(($x, $y, $z));
so what exactly "$mymesh.AddPoint(($x, $y, $z))" do? retuns int value ??? Added point index ?
-
Is there a way to get point coords when you know index?
It's so hard when there's no documentation.. ;(
-
Here's what you're looking for I think:
http://www.anim8or.com/scripts/spec/Anim8or_Scripting_Language.html
Mesh and Meshdata Types section.
-
Hi,
I managed to fix the script, finaly. ;)
1. Plane is facing up the Y axis;
2. Texture coords are counted well, tnx Claude;
3. Drawn points are reused;
4. Icon updated;
5. Beer is gone.. ups, did I say too much ;)
Thank you for the link. Actually it helped alot in debuging ;)
Script is in the attachment. Any feedback appreciated.
-
:) cool plane with divisions another thing easily could add is scale_x and scale_z to the parametesr
#parameter("length", float, 10.0, 0.01, 99999, scale,scale_x);
#parameter("width", float, 10.0, 0.01, 99999, scale,scale_z);
then after plane is created the user could use the non uniform scale tool in top viewpoint to scale both length and width using just the mouse
-
Wow cool script. I'll definitely be using it in the future. :)
-
Thank you lads ;)
Here is the newest version.
+Parameters added allowing non uniform scaling, tnx BOB_I_Ts
-------------------------------------------------------------
+ Plane is facing up the Y axis;
+ Texture coords are counted well, tnx Claude;
+ Drawn points are reused;
+ Icon updated;