Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:16 pm)
hi Phil,
yes..point to a directory & let it load in everything,maybe using the last used import settings?(everything unchecked)
I've got a parented prop set with over 100 parts & importing manually takes forever.
thanks for looking into this Phil..unfortunately I get the message '0 OBJ files imported'
it allows me to browse & select the folder but nothing imports
using P7 & 6 and selecting a geometrie folder at the root of drive
I should add I know bugger all about Python so it may be something simple I'm missing,
Your files need to have the extension ".obj" or ".OBJ"
Alternatively edit the script so that it will attempt to import every file.
def visit(something, dirname, names):<br></br>
for name in names:<br></br>
try: <br></br>
filepath = os.path.join(dirname,name) <br></br>
importOBJ(filepath)<br></br>
except:<br></br>
pass
Quote - Your files need to have the extension ".obj" or ".OBJ"
They do have the right extension, but Windows Explorer is set to hide them.
This doesn't affect anything but what it displays.
Although it doesn't appear necessary in this case, but why not use string.split(name,".")[1].lower() == "obj" as the extension test to cover odd combinations of cases.
Originally I was using :-
if string.split(name,".")[1] == "obj" or string.split(name,".")[1] == "OBJ":
which is pretty much the same thing unless the extension was "oBj" which though possible I felt unlikely.
I appreciate that the extension has been hidden. It should indeed not make a difference but the script was failing to import the files so I used the try/except edit to take the file type out of the equation.
The next questions to ask would be:-
Are they well formed OBJ files?
Can they be imported manually?
Has the latest Poser service release been installed?
OK duh!
This line was missing from the top of the script:-
scene = poser.Scene()
I've also changed the extension test to include the mixed case scenario as opposed to the either upper or lower case that I had originally.
http://www.philc.net/forum/viewtopic.php?p=12956
The script worked on my machine because I had previously been running any number of scripts that had set this variable. I found the error when I ran the script on a different computer after a reboot.
hey that new version works perfectly...117 props loaded... whilst making a coffee :)
thank you very much Phil!
semidieu..I wanted everything from one folder loaded,but having an option to selected a group of objects might make the script handy for others.
I always dread having to manually bring in each part to Poser as my sets are so big,so many parts,
Phil you've saved me from a hell of a repetetitve task..I owe you one :)
Cheers
Stefan
hey if your working on import scripts..how about a batch export while your at it?..not really anything I have an immediate use for but to fill out the suite it would be a cool adition.
This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.
hi guys..I'm wondering if it's possible to have a script do batch imports with Poser?
Cheers
Stefan
Cg Society Portfolio