faster blender export with blender python scripting starting with mob agent
This commit is contained in:
parent
fe1e3994f6
commit
3c7d2eb94b
|
@ -21,7 +21,10 @@ to make the model textures clearer in blender check the upper left menu bar - fi
|
||||||
- switch to UV editing view in the upper top menu bar
|
- switch to UV editing view in the upper top menu bar
|
||||||
- have the same view over the mob in blender and minecraft to see if anything is off
|
- have the same view over the mob in blender and minecraft to see if anything is off
|
||||||
|
|
||||||
### Exporting is complex and best be automated so if you know blender scripting post [here](https://github.com/22i/minecraft-voxel-blender-models/issues/2)
|
## Exporting with Blender python scripting
|
||||||
|
- Exporting is complex and best be scripted
|
||||||
|
- the scripts are inside /models/extra/blender-scripting/
|
||||||
|
- there are more instructions inside /models/extra/blender-scripting/agent.sh
|
||||||
|
|
||||||
## Exporting 180 degress rotated
|
## Exporting 180 degress rotated
|
||||||
|
|
||||||
|
@ -85,7 +88,7 @@ to make the model textures clearer in blender check the upper left menu bar - fi
|
||||||
<img src="https://i.imgur.com/Gr0ZUqy.png">
|
<img src="https://i.imgur.com/Gr0ZUqy.png">
|
||||||
|
|
||||||
## Thanks to:
|
## Thanks to:
|
||||||
<img src="https://avatars1.githubusercontent.com/u/47129783?s=400" width="45"> [Oil_boi](https://www.youtube.com/user/313hummer/videos) making Crafter
|
<img src="https://avatars1.githubusercontent.com/u/47129783?s=400" width="45"> [Jordan4ibanez](https://www.youtube.com/user/313hummer/videos) making mobs shine
|
||||||
|
|
||||||
<img src="https://avatars0.githubusercontent.com/u/16853304?v=4&s=400" width="45"> [toby109tt](https://github.com/tobyplowy) mapping fixes - help with backface culling
|
<img src="https://avatars0.githubusercontent.com/u/16853304?v=4&s=400" width="45"> [toby109tt](https://github.com/tobyplowy) mapping fixes - help with backface culling
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,17 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# https://www.blender.org/download/previous-versions/
|
||||||
|
# path to your blender2.97b executable
|
||||||
|
# mine is in my home folder
|
||||||
|
# make sure you have b3d exporter installed and enabled on that version
|
||||||
|
blender=$HOME/blender-2.79b-linux-glibc219-x86_64/blender
|
||||||
|
|
||||||
|
# exports agent 180 degress rotated
|
||||||
|
$blender ../../agent.blend --python $PWD/lib/agent.py
|
||||||
|
|
||||||
|
# move b3d into exported folder
|
||||||
|
# move all b3d files into exported folder
|
||||||
|
mv ../../*.b3d $PWD/exported/
|
||||||
|
|
||||||
|
|
||||||
|
echo done everything
|
Binary file not shown.
|
@ -0,0 +1,38 @@
|
||||||
|
import bpy
|
||||||
|
import os
|
||||||
|
|
||||||
|
# join them together ctrl+j
|
||||||
|
bpy.ops.object.join()
|
||||||
|
|
||||||
|
def get_override(area_type, region_type):
|
||||||
|
for area in bpy.context.screen.areas:
|
||||||
|
if area.type == area_type:
|
||||||
|
for region in area.regions:
|
||||||
|
if region.type == region_type:
|
||||||
|
override = {'area': area, 'region': region}
|
||||||
|
return override
|
||||||
|
#error message if the area or region wasn't found
|
||||||
|
raise RuntimeError("Wasn't able to find", region_type," in area ", area_type,
|
||||||
|
"\n Make sure it's open while executing script.")
|
||||||
|
|
||||||
|
|
||||||
|
#we need to override the context of our operator
|
||||||
|
override = get_override( 'VIEW_3D', 'WINDOW' )
|
||||||
|
#rotate about the X-axis by 45 degrees
|
||||||
|
bpy.ops.transform.rotate(override, axis=(0,0,1))
|
||||||
|
bpy.ops.transform.rotate(override, axis=(0,0,1))
|
||||||
|
|
||||||
|
blend_file_path = bpy.data.filepath
|
||||||
|
directory = os.path.dirname(blend_file_path)
|
||||||
|
#target_file = os.path.join(directory, 'agent.obj')
|
||||||
|
#target_file = os.path.join(directory, 'exported/agent.b3d')
|
||||||
|
target_file = os.path.join(directory, 'agent.b3d')
|
||||||
|
|
||||||
|
#bpy.ops.export_scene.obj(filepath=target_file)
|
||||||
|
bpy.ops.screen.b3d_export(filepath=target_file)
|
||||||
|
|
||||||
|
#bpy.ops.export_scene.obj()
|
||||||
|
#bpy.ops.screen.b3d_export()
|
||||||
|
|
||||||
|
# exits blender
|
||||||
|
bpy.ops.wm.quit_blender()
|
Loading…
Reference in New Issue