I'm working on a script to quickly setup cloth simulations for an outfit I'm working on. And it works
but one part of the script seems very awkward to me and I'm wondering if there is a better way.
Basically the outfit is in a few parts, pants and a top. Now I know that people may not always want to use them together. Specifically for my script what matters is if the user wants to use the top but not the pants. I need the script to behave slightly differently in that case. So I need to check and see if the pants are in the scene or not.
Here's the relevant part of the code:
And yay! It works. But it seems like a lot of code just to check and see if an actor called DawnPants exists in the scene or not. Now it's possible this is the only way to do it, but I was wondering if there was a better way. I suppose it doesn't really matter because at the moment I have less than 50 lines of code, but it's the principle of the thing.
Any thoughts?
Basically the outfit is in a few parts, pants and a top. Now I know that people may not always want to use them together. Specifically for my script what matters is if the user wants to use the top but not the pants. I need the script to behave slightly differently in that case. So I need to check and see if the pants are in the scene or not.
Here's the relevant part of the code:
Code:
import poser
scene = poser.Scene()
inscene = False
allActors = scene.Actors()
for a in allActors:
if a.Name() == "DawnPants":
inscene = True
if inscene == True:
sim.AddCollisionActor(scene.Actor("DawnPants"))
And yay! It works. But it seems like a lot of code just to check and see if an actor called DawnPants exists in the scene or not. Now it's possible this is the only way to do it, but I was wondering if there was a better way. I suppose it doesn't really matter because at the moment I have less than 50 lines of code, but it's the principle of the thing.
Any thoughts?
Last edited: