Anim8or Community

General Category => ASL Scripts => Topic started by: cooldude234 on May 04, 2010, 01:29:57 am

Title: Request for a script
Post by: cooldude234 on May 04, 2010, 01:29:57 am
Well I dont know much about the anim8or scripts (havent taken the time to learn the language to program one), so I am going to request one. I havnt seen any like this so far, but would it be possible to set a automatic hide and show of meshes (in object mode) and objects (in scene mode) that are too far away from the camera.
eg. mesh1 distance from camera is 50 -show
      mesh1 distance from camera is 200 - hide

So basicaly, when the camera moves away from mesh1, mesh1 would atomatically hide.
I aslo want to do this for multiple (hundreds, literaly) of meshes, so implementing somthing to do this to mass amounts of meshes and objects would help.
Point of this would to help anim8or from crashing while working with alot of grass.
Thank you, I know this would be alot of work, but it will be much apreiciated.
Title: Re: Request for a script
Post by: BOB_I_Ts on May 04, 2010, 04:57:09 am
yes you can do this but you have to change position values to suite the scene the hide area in this script is is cuboid

double click element you want to disappear and click the ... button in visiblility
enable expression then edit
then copy paste code below into the window

> means if camera position is greater than world coordinate object will be invisible
< means if camera is inside the cuboid area the element become visible
number 100 and 50 in script is the world coordinate border of the cuboid

remember you can copy paste this into each scene element but you will have to edit the 100 and 50 value to match the scene

Code: [Select]
point3 $camera;
$camera = GetAttributePoint3("camera01","position");

if ($camera.x < 100 && $camera.x > 50 ){
$visibility = 1;
if ($camera.y < 100 && $camera.y > 50 ){
$visibility = 1;
if ($camera.z < 100 && $camera.z > 50 ){
$visibility = 1;
else {$visibility = 0;}
Title: Re: Request for a script
Post by: cooldude234 on May 04, 2010, 02:16:03 pm
Thankyou, I will try this as soon as I can.
Title: Re: Request for a script
Post by: cooldude234 on May 04, 2010, 02:36:51 pm
Alright, I did this and it works but it was not what I was wanting/needing. First of all, I need it to be in the object mode aswell, second of all, I need it to work with all cameras (not just the scene camera thats animated and what not, but even the cameras used to while modeling and related stuff, like the orthographical views.
Cause the issue with my graphics card is it runs out of VRAM and crashes when I make grass, so having a automatic hide, would save it from running out and thus would render like it should. Also I need everything to be visible when redering, or else it would be just defeating the point on why I need it (for HUGE scenes with LOTS of grass, ie a larg valley).
Title: Re: Request for a script
Post by: BOB_I_Ts on May 04, 2010, 05:11:18 pm
expressions are scene mode only
you can do same thing to multiple cameras in scene mode
just change were it say in script camera01 to camera02 and so on

solution this also includes parts of a single model
A)save an8 then create object > new (you can rename it in settings > object ...)
B)edit > deattache faces (switch to object mode and then C)
C)  cut (not copy because it will cause issue before step D) then paste the attached part into the new object
D) after edit copy paste back into the original object
E) in object mode build>join solids & then in point edit select all points then use edit>merge points ...(set value to 0.0 it will then only reattach the detached points ignoring all other points) wella complete
Title: Re: Request for a script
Post by: cooldude234 on May 04, 2010, 07:15:43 pm
I know about camera01 and so one, but I want to know if it is possible for the workspace cameras, Eg when you aremodeling somthing you use the camera that are defaulted in animator, you do not create them and move them around like that in a scenel.

Also if it cannot be associated with object mode direct, then it will be considered useless. You see, when I make grass, my graphics card looses every maga byte it has in that giga byte! This case runs ulrat slow to the piont where it takes a minute to make and position a box, without converting it to a mesh! So if I hide the grass my graphics card runs good again, but unfortunatly spending an hour on hiding and showing grass is not an option (cause it does take that long), and I have to do that several times while tweaking stuff out. Do you now see my problem, and why I kinda need this to be in object mode and scene mode with a render that renders even the hiden stuff?
Title: Re: Request for a script
Post by: BOB_I_Ts on May 04, 2010, 09:52:20 pm
there is call for camera in system function of asl but i do not think camera view-port exist out side scene mode ?
the 4 system functions are

refresh();                  // Refresh the screen
view("viewport name");          // Change view
render();                   // Render an image
renderer("renderer name");  // Set the renderer

i think there specific use is for general and command script type

viewport tags = "front", "left", "right", "back", "top", "bottom", "ortho", "user1", "user2", "user3", "user4", "perspective", "camera", "stereo"
viewport mode tags = "all" and "one"
renderer tags = "scanline", "OpenGL", "ART Ray Tracer"