Browse Source
* Build Ogre meshes and convert .png textures to dds, all in a pre-build step. There's plenty of room for improvement, but it's a good stop-gap for now * Added more ignorespitch-detection
4 changed files with 166 additions and 2 deletions
@ -0,0 +1,63 @@ |
|||
"""import bpy |
|||
import sys |
|||
import os |
|||
import re |
|||
from os.path import join, split |
|||
|
|||
def export(object_names): |
|||
for name in object_names: |
|||
index = bpy.data.objects.find(name) |
|||
if index != -1: |
|||
obj = bpy.data.objects[index] |
|||
obj.data.update() |
|||
obj.data.calc_loop_triangles() |
|||
export_mesh(obj, '/tmp') |
|||
|
|||
if __name__ == "__main__": |
|||
idx = sys.argv.index('--') |
|||
argv = sys.argv[idx+2:] |
|||
outputPath = sys.argv[idx+1] |
|||
|
|||
# cut off file name |
|||
io_ogre = os.path.split(__file__)[0] |
|||
# cut off io_ogre dir |
|||
io_ogre = os.path.split(io_ogre)[0] |
|||
sys.path.append(io_ogre) |
|||
|
|||
os.makedirs(outputPath, exist_ok=True, mode=0o775) |
|||
|
|||
from io_ogre import config |
|||
from io_ogre.ogre.scene import dot_scene |
|||
from io_ogre.ogre.mesh import dot_mesh |
|||
from io_ogre.ogre.skeleton import dot_skeleton |
|||
|
|||
match = re.compile("scene (.*)").match(argv[0]) |
|||
if match: |
|||
scene_name = match.group(1) |
|||
dot_scene(outputPath, scene_name=scene_name) |
|||
else: |
|||
print("Did not understand arg {}. Expected scene blah".format(argv[0])) |
|||
""" |
|||
|
|||
import sys |
|||
|
|||
if __name__ == "__main__": |
|||
idx = sys.argv.index('--') |
|||
restArgv = sys.argv[idx+2:] |
|||
outputPath = sys.argv[idx+1] |
|||
|
|||
# Not necessary if plugin is enabled by default, I think |
|||
# (besides, the options would all need to be set here too) |
|||
# io_ogre_path = "Dependencies/blender2ogre" |
|||
# sys.path.append(io_ogre_path) |
|||
|
|||
from io_ogre import config |
|||
from io_ogre.ogre.scene import dot_scene |
|||
from io_ogre.ogre.mesh import dot_mesh |
|||
from io_ogre.ogre.skeleton import dot_skeleton |
|||
|
|||
# dot_scene does this for us |
|||
# os.makedirs(outputPath, exist_ok=True, mode=0o775) |
|||
|
|||
# Export the root scene |
|||
dot_scene(outputPath) |
Loading…
Reference in new issue