forked from OGRECave/blender2ogre
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconsole.py
38 lines (30 loc) · 975 Bytes
/
console.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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(calc_tessface=True)
export_mesh(obj, '/tmp')
if __name__ == "__main__":
idx = sys.argv.index('--')
argv = sys.argv[idx+2:]
path = 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(path, 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(path, scene_name=scene_name)