Introduction to Maya - Rendering in Arnold
This course will look at the fundamentals of rendering in Arnold. We'll go through the different light types available, cameras, shaders, Arnold's render settings and finally how to split an image into render passes (AOV's), before we then reassemble it i
# 1 22-03-2007 , 02:59 PM
Registered User
Join Date: Jan 2007
Location: Tulsa
Posts: 3

Scirpt help Please

Sorry to bother you guys with this but can you tell me what I am doing wrong? I am trying to get what ever geometry I have selected to instance its self every of many frames. Here is the scrpit,

global proc nhGeometryInstancer ()
{

//Declare the variables

string $objSel[];
int $rateOfFire;
int $time;
int $dupFrame;
int $fps;
int $count;


$objSel = `ls -sl`;
$rateOfFire = 5;
$fps = 24;
$time = `currentTime -q`;
$dupFrame = $rateOfFire / $fps;
$count = 1;

if ($time = $dupFrame * $count);
{
instance $objSel;
$count ++;
}
}



As I am sure you can tell I am kinda new to mel so any help would rock.

-nathan

# 2 22-03-2007 , 05:13 PM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
I'm not really sure what exactly are you trying to do here? Since you don't have any looping going on in your code I got to ask are you really trying to create a script or an expression? Can you try to explain your problem in bit more detail, please?


Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
# 3 22-03-2007 , 06:00 PM
Xander-0's Avatar
Registered User
Join Date: Feb 2005
Location: This Place
Posts: 220
Well, I think I can tell you what your first problem is. The "=" in 'if ($time = $dupFrame * $count);' should actually be a "==" - the singe '=' is used for assigning values, while the double '==' is used for comparing them. Also, I'm not sure you're supposed to have a semi-colon at the end of the same line.
Without actually running the code, that's what stands out to me as being the most in trouble. Although there's certainly a number of things you could do to improve and tighten your code, to simply make it run that may be enough.


Book Wise

https://X4nd5r.deviantart.com
# 4 23-03-2007 , 04:51 AM
Registered User
Join Date: Jan 2007
Location: Tulsa
Posts: 3

Originally posted by kbrown
I'm not really sure what exactly are you trying to do here? Since you don't have any looping going on in your code I got to ask are you really trying to create a script or an expression? Can you try to explain your problem in bit more detail, please?


Sure. What I am trying to do is have a piece of geometry instance itself over time. That is where the "rate of fire" vaiable comes in. I would like to make something like a partcle generator but geometry instead. I know I could just use a partcile emiter and make it instance my geometry but I want it to be rigid bodies. If you could think of a better way to do this that would rock.

# 5 25-03-2007 , 01:47 AM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
You can't use instances if you intend to turn them all to separate rigid bodies afterwards so you'd have to duplicate instead. Nevertheless it sounds like you're trying to do something overly heavy with rigid bodies. I would probably create few rigid body hero bits manually and think of using the particle geometry instancer for the rest. Then again I still don't know what your scene is all about user added image

I have actually done something like this before. I had a particle flow system which was moving soft-body driven geometry (blood cells in a vein). The softies were created and maintained (and removed) on the fly in the particle's creation/runtime expressions. It worked but I remember it being a very "hairy" setup user added image


Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
# 6 25-03-2007 , 04:17 AM
Registered User
Join Date: Jan 2007
Location: Tulsa
Posts: 3
With the help of a friend I created a Particle emitter that emits rigid bodies instead. He used a creation expression to do it. The only draw back is that you can not rewind the geometry and play it again. You have to delete the geometry every time you do a sim. We need to figure out a way to cache the geometry. Any thoughts? Maybe I could use a fluid to control the sim? Paint the velocity on maybe? Just some thoughts


-Nathan

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off