Python script to load multiple props
Right .. I know how to run python scripts, but zilch about writing them.
And what I have in mind may not even be possible at all. But somehow I think it is.
The task: I have made some Poser fish. Fairly low rez, because fish looks most real when they're together in a school.
So ... a script to duplicate and sorta scatter the fish into a school is what I'm after.
PhilC once made me a script that duplicated a segment of a hallway so a loooong hallway could be made with a few clicks. So this would be something similar, only with some kind of randomising thing to scatter the fishies in more axes.
IS this possible? And would someone try it out? My fishies are free, and preferably, so should the script be.
Fishies are here, if someone wants them: http://freebies.trekkiegrrrl.com/Fishies.zip
Not a free one, but DAZ used to have Send In the Clones which would do what you want.
I made you a script. Come back if you have questions. Note: I'm getting on an airplane tomorrow and out of touch for a while.
The script is in my site file cabinet here:
The script is called LoadFishes.py
So long, and thanks for all the fish.
Note: The first fish is the parent of all the others so select Fish_1 and you can move or rotate them all together.
Note: Every time you run the script it deletes all the current fish. The line of code that does this is where it says
To disable that, place a # at the beginning of the line, like the other comments.
By the way, the thread title is not a good choice. Probably 90% of non-programmers will skip it, instead of coming in to learn that there's a free script that shows how to load many props into a scene and place them randomly.
I found out that the UI was updating on every fish being loaded because of the call to SetParent. I modified the script to do the parenting at the end. This makes it faster as the UI only updates every 10 fish now.
If you got the first version yesterday, come get it again. It says v.2 in the file cabinet listing.
Awesome! A million thanks!
I was busy rendering yesterday, so I hadn't had time to check this out yet. But I will now, this very instant :D
And sorry about the silly headline ... wasn't quite sure how to put it briefly.
Still ... it worked ;)
I changed the title and added tags to it.
Hmm... I wonder if a script could be written so that all the fish use the same geometry? But that would make it an instance, wouldn't it?
If they use external geometry, they will all use the same geometry