Lugaru Model Import / Export scripts for Blender
-
- official Wolfire heckler
- Posts: 2193
- Joined: Sun Aug 28, 2005 11:19 pm
- Location: Hamburg City
- Contact:
Lugaru Model Import / Export scripts for Blender
Hi,
I just finished an importer and an exporter for Blender.
These two scripts are written in Python, and Blender can use them directly. Once they're in the proper directory, you can access them via the File -> Import / File -> Export menus from inside Blender.
You can get the scripts in a ZIP archive right here: viewtopic.php?f=7&t=5620&p=232622#p232622
(Used to be http://www.alice-dsl.net/wolf.mathwig/tools/py/ -- not anymore though)
Make sure you read the instructions on that site carefully. For Blender 2.49, you HAVE to install Python. You HAVE to place the scripts into the proper directory after unzipping the archive, this differs by Blender version. For 2.58, it's Blender's addons folder.
The scripts are self-explanatory, but I'll tell you how you're supposed to use them anyway:
Importer
You select the menu point File -> Import -> Lugaru models (.solid)...
You choose what type of model you want to import: Body, Weapon or Immobile
You choose the file from your disk, press the button "Import Solid"
Done
Blender 2.49: If you want to import more models, do that. Otherwise, click the button "Exit"
Exporter
You select one or more models in Object mode (Blender 2.58: Only one model per export!)
Make sure they've only got triangle faces and that they have some kind of UV map
You select the menu point File -> Export -> Lugaru models (.solid)...
Blender 2.49: You read the text. You understand what it says.
You select what type of model you want to export: Body, Weapon or Immobile
You choose the filename, press the button "Export Solid"
Done
Blender 2.49: If you want to export the selected models again for some reason, do that. Otherwise, click the button "Exit"
Please backup your Lugaru/Data folder BEFORE replacing models.
If there's something weird happening or if you have problems installing / using these scripts, post away. Random nerd posts are also welcome.
Blender 2.49: Note that this is opensource. So if you want to tinker with the source code, go ahead, it's right there. Python scripts aren't compiled in some way, and the language is one of the simplest languages around in terms of syntax.
Blender 2.58: The scripts are now GPL.
Have fun with that stuff.
Doesn't work with Black Shades, by the way. Black Shades has no texture mapping on SOLID models or something along those lines.
I just finished an importer and an exporter for Blender.
These two scripts are written in Python, and Blender can use them directly. Once they're in the proper directory, you can access them via the File -> Import / File -> Export menus from inside Blender.
You can get the scripts in a ZIP archive right here: viewtopic.php?f=7&t=5620&p=232622#p232622
(Used to be http://www.alice-dsl.net/wolf.mathwig/tools/py/ -- not anymore though)
Make sure you read the instructions on that site carefully. For Blender 2.49, you HAVE to install Python. You HAVE to place the scripts into the proper directory after unzipping the archive, this differs by Blender version. For 2.58, it's Blender's addons folder.
The scripts are self-explanatory, but I'll tell you how you're supposed to use them anyway:
Importer
You select the menu point File -> Import -> Lugaru models (.solid)...
You choose what type of model you want to import: Body, Weapon or Immobile
You choose the file from your disk, press the button "Import Solid"
Done
Blender 2.49: If you want to import more models, do that. Otherwise, click the button "Exit"
Exporter
You select one or more models in Object mode (Blender 2.58: Only one model per export!)
Make sure they've only got triangle faces and that they have some kind of UV map
You select the menu point File -> Export -> Lugaru models (.solid)...
Blender 2.49: You read the text. You understand what it says.
You select what type of model you want to export: Body, Weapon or Immobile
You choose the filename, press the button "Export Solid"
Done
Blender 2.49: If you want to export the selected models again for some reason, do that. Otherwise, click the button "Exit"
Please backup your Lugaru/Data folder BEFORE replacing models.
If there's something weird happening or if you have problems installing / using these scripts, post away. Random nerd posts are also welcome.
Blender 2.49: Note that this is opensource. So if you want to tinker with the source code, go ahead, it's right there. Python scripts aren't compiled in some way, and the language is one of the simplest languages around in terms of syntax.
Blender 2.58: The scripts are now GPL.
Have fun with that stuff.
Doesn't work with Black Shades, by the way. Black Shades has no texture mapping on SOLID models or something along those lines.
Last edited by rudel_ic on Thu Jan 08, 2015 8:14 am, edited 4 times in total.
-
- official Wolfire heckler
- Posts: 2193
- Joined: Sun Aug 28, 2005 11:19 pm
- Location: Hamburg City
- Contact:
Re: Lugaru Model Import / Export scripts for Blender
If you need help in all things modeling, then go to the Blender wiki. If you need specific hints regarding modeling for Lugaru, read these:
viewtopic.php?f=7&t=5474
viewtopic.php?f=7&t=5246#p86391
Of course, for these scripts, you should disregard all instructions that are related to Brainfart.
viewtopic.php?f=7&t=5474
viewtopic.php?f=7&t=5246#p86391
Of course, for these scripts, you should disregard all instructions that are related to Brainfart.
-
- official Wolfire heckler
- Posts: 2193
- Joined: Sun Aug 28, 2005 11:19 pm
- Location: Hamburg City
- Contact:
Re: Lugaru Model Import / Export scripts for Blender
WATUP DAWG
Obviously, you _CAN_ replace Body.solid and it works, at least with this script. I think I simply messed stuff up in Brainfart.
What you want to do is import Body.solid, then just move vertices / faces, rotate them, scale them.
Do not introduce new faces or vertices, do not remove old vertices or faces. The number of faces and vertices has to stay the same.
Don't go too wild though. You want to keep the hands at the same place so that the weapons grab correctly; you want to keep the body shaped in such a way that holstered weapons still connect; you want to keep the feet touching the ground at the same point (don't move the lowest vertices).
For a convenient editing view, press CTRL-NUM7.
When you're done, export the misformed abomination to solid, backup Body.solid, Body2.solid etc.
Overwrite Body.solid - Body6.solid with your new creation. No morphing, nothing. Awesome!
You don't want to replace Body7.solid though. That's the one with the exploded head.
You might also want to adjust the UV mapping and textures.
You can also edit Bodylow.solid in exactly the same way (that's the mesh for low Level of Detail).
Have fun making new dudes.
Edit: Here's the ant guy you can see above. Unzip that to Data/Models. You'll get a new folder called "ant".
Backup Body.solid, Body2.solid, Body3.solid, Body4.solid, Body5.solid, Body6.solid, Body7.solid and Bodylow.solid.
Copy all files in Data/Models/ant/ to Data/Models, overwriting the original files.
-
- Posts: 2218
- Joined: Sun Aug 31, 2008 6:03 pm
Re: Lugaru Model Import / Export scripts for Blender
Very nice, rudel! They work great! To get an idea of the scale (DimX) of weapons, the original sword has a scale of 0.858. Remember this is the length of your weapon, not width or thickness. Importing a solid then exporting it creates no errors, so feel free to open up any of my models to get an idea of the scale, or for any other reason. (It would be cool if the got used somewhere else, just give me credit )
Edit: I still think I'll wait for characters to be fully implemented before I mess with them, but I'd still be on the lookout for a tweak or two.
Edit: I still think I'll wait for characters to be fully implemented before I mess with them, but I'd still be on the lookout for a tweak or two.
- Attachments
-
- Morphoid.zip
- Here he is if you want to play with him.
- (126.91 KiB) Downloaded 1443 times
-
- Posts: 157
- Joined: Sat Oct 31, 2009 6:27 pm
Re: Lugaru Model Import / Export scripts for Blender
Hey, i have a mac osx ppc running blender 249.2 and python 2.3, i've put the folders in and the importer works fine. but when i try to run the exporter, just run the script. it says error, and directs me to were it says
finally:
It highlights it, is something wrong?
finally:
It highlights it, is something wrong?
-
- Posts: 2218
- Joined: Sun Aug 31, 2008 6:03 pm
Re: Lugaru Model Import / Export scripts for Blender
for blender 2.8 and up you need python 2.5 or 2.6 you can install both if you like, that's what I've done. The scripts probably need 2.5 or 2.6 to run. 2.3 is old.........
-
- official Wolfire heckler
- Posts: 2193
- Joined: Sun Aug 28, 2005 11:19 pm
- Location: Hamburg City
- Contact:
Re: Lugaru Model Import / Export scripts for Blender
The Blender console should contain a more descriptive error message, please post that.Precastwig wrote:Hey, i have a mac osx ppc running blender 249.2 and python 2.3, i've put the folders in and the importer works fine. but when i try to run the exporter, just run the script. it says error, and directs me to were it says
finally:
It highlights it, is something wrong?
Edit: Don't bother, I found the issue, read next post
Not the issue:
Usually, what's wrong is that you either didn't convert all faces to triangles or that you forgot to generate a UV map.
You convert all faces to triangles by pressing CTRL-T in Edit Mode when all faces are selected.
You can also do this by pressing SPACE in the editing window, then choosing Edit -> Faces -> Convert to Triangles
You generate a UV map by pressing U in Edit Mode when all faces are selected, then you choose some unwrapping method. You can see how the unwrapping ends up by opening a UV/Image View while in Edit mode.
Apart from these hints, Lotus Wolf is certainly right in saying that Python 2.3 is rather outdated.
Maybe exception handling with try: except: finally: doesn't work in your Python version, in which case you (or I) can edit the source to not contain exception handling. If you don't know Python though, I recommend not to do that.
Edit: See the next post to find out how to do it. I may put this into the next release myself.
Ignore this:
It would be really cool if you tried tackling this with following my first suggestion, then updating Python if that's not the issue. I'd love to know how you resolve this so that I can fix stuff for Python 2.3 dudes; although 2.3 is old, I'd happily make the script work for it, obviously.
Edit: Also, thanks for trying to do things with this! I really need PowerPC people to test it out; the reason is that I don't have one myself.
Last edited by rudel_ic on Thu Nov 05, 2009 3:00 pm, edited 1 time in total.
-
- official Wolfire heckler
- Posts: 2193
- Joined: Sun Aug 28, 2005 11:19 pm
- Location: Hamburg City
- Contact:
Re: Lugaru Model Import / Export scripts for Blender
Alright, I found out why this error occurs. It's not your fault!
http://python.active-venture.com/ref/try.html
So I guess I can't mix try: except: with finally: under Python 2.3.
You can easily fix that issue yourself, by the way.
All you have to do is remove the finally:
Then, copy the self.file.close() into the except: block, over the raise thing.
Then, remove a tab before the old self.file.close()
This should emulate the finally: behavior.
So the source looks like this afterwards:
You need to overwrite the script. Save it over the original.
Then, you can restart Blender and it should just work.
Hope this helps.
http://python.active-venture.com/ref/try.html
So I guess I can't mix try: except: with finally: under Python 2.3.
You can easily fix that issue yourself, by the way.
All you have to do is remove the finally:
Then, copy the self.file.close() into the except: block, over the raise thing.
Then, remove a tab before the old self.file.close()
This should emulate the finally: behavior.
So the source looks like this afterwards:
Code: Select all
except:
self.file.close()
raise
self.file.close()
Then, you can restart Blender and it should just work.
Hope this helps.
-
- Posts: 157
- Joined: Sat Oct 31, 2009 6:27 pm
Re: Lugaru Model Import / Export scripts for Blender
It now has the same error for the 'except:'
heres what i have:
heres what i have:
-
- Posts: 2218
- Joined: Sun Aug 31, 2008 6:03 pm
Re: Lugaru Model Import / Export scripts for Blender
Not triangulating the model doesn't make the script mess up, it show up in game with what looks like the mesh with half of the would-be triangles missing.rudel_ic wrote:Usually, what's wrong is that you either didn't convert all faces to triangles or that you forgot to generate a UV map.
-
- official Wolfire heckler
- Posts: 2193
- Joined: Sun Aug 28, 2005 11:19 pm
- Location: Hamburg City
- Contact:
Re: Lugaru Model Import / Export scripts for Blender
Well, this is how I meant it: The tabs are important.Precastwig wrote:It now has the same error for the 'except:'
heres what i have:
Ah right, that makes sense.Lotus Wolf wrote: Not triangulating the model doesn't make the script mess up, it show up in game with what looks like the mesh with half of the would-be triangles missing.
-
- Posts: 157
- Joined: Sat Oct 31, 2009 6:27 pm
Re: Lugaru Model Import / Export scripts for Blender
Thank you,
But anyway. I've done that, its come up with ANOTHER error slightly lower, same error.
But anyway. I've done that, its come up with ANOTHER error slightly lower, same error.
-
- official Wolfire heckler
- Posts: 2193
- Joined: Sun Aug 28, 2005 11:19 pm
- Location: Hamburg City
- Contact:
Re: Lugaru Model Import / Export scripts for Blender
That one looks easy at first glance. Seems like we're almost therePrecastwig wrote:Thank you,
But anyway. I've done that, its come up with ANOTHER error slightly lower, same error.
Here's the quick fix:
-
- Posts: 157
- Joined: Sat Oct 31, 2009 6:27 pm
Re: Lugaru Model Import / Export scripts for Blender
OMG it works, it's like christmas a month early...
you my friend, are a genius.
you my friend, are a genius.
-
- official Wolfire heckler
- Posts: 2193
- Joined: Sun Aug 28, 2005 11:19 pm
- Location: Hamburg City
- Contact:
Re: Lugaru Model Import / Export scripts for Blender
It's a pleasure mate, I'm happy you can use it!