More blender crash fixes

This commit is contained in:
Jack Andersen 2016-08-09 09:30:23 -10:00
parent 9169cac38c
commit 6972926b66
6 changed files with 18 additions and 12 deletions

View File

@ -116,8 +116,9 @@ bool ReadMAPAToBlender(hecl::BlenderConnection& conn,
"\n" "\n"
"# Clear Scene\n" "# Clear Scene\n"
"for ob in bpy.data.objects:\n" "for ob in bpy.data.objects:\n"
" bpy.context.scene.objects.unlink(ob)\n" " if ob.type != 'CAMERA':\n"
" bpy.data.objects.remove(ob)\n" " bpy.context.scene.objects.unlink(ob)\n"
" bpy.data.objects.remove(ob)\n"
"\n" "\n"
"def add_triangle(bm, verts):\n" "def add_triangle(bm, verts):\n"
" verts = [bm.verts[vi] for vi in verts]\n" " verts = [bm.verts[vi] for vi in verts]\n"

View File

@ -39,8 +39,9 @@ bool ReadMLVLToBlender(hecl::BlenderConnection& conn,
"\n" "\n"
"# Clear Scene\n" "# Clear Scene\n"
"for ob in bpy.data.objects:\n" "for ob in bpy.data.objects:\n"
" bpy.context.scene.objects.unlink(ob)\n" " if ob.type != 'CAMERA':\n"
" bpy.data.objects.remove(ob)\n"); " bpy.context.scene.objects.unlink(ob)\n"
" bpy.data.objects.remove(ob)\n");
/* Insert area empties */ /* Insert area empties */
int areaIdx = 0; int areaIdx = 0;

View File

@ -353,8 +353,9 @@ bool FRME::Extract(const SpecBase &dataSpec,
"bpy.types.Object.retro_widget_model_draw_flags = bpy.props.EnumProperty(items=model_draw_flags, name='Retro: Model Draw Flags', default='RETRO_ALPHA')\n" "bpy.types.Object.retro_widget_model_draw_flags = bpy.props.EnumProperty(items=model_draw_flags, name='Retro: Model Draw Flags', default='RETRO_ALPHA')\n"
"# Clear Scene\n" "# Clear Scene\n"
"for ob in bpy.data.objects:\n" "for ob in bpy.data.objects:\n"
" bpy.context.scene.objects.unlink(ob)\n" " if ob.type != 'CAMERA':\n"
" bpy.data.objects.remove(ob)\n" " bpy.context.scene.objects.unlink(ob)\n"
" bpy.data.objects.remove(ob)\n"
"\n" "\n"
"def duplicateObject(copy_obj):\n" "def duplicateObject(copy_obj):\n"
" # Create new mesh\n" " # Create new mesh\n"

View File

@ -95,8 +95,9 @@ bool MREA::Extract(const SpecBase& dataSpec,
MaterialSet::RegisterMaterialProps(os); MaterialSet::RegisterMaterialProps(os);
os << "# Clear Scene\n" os << "# Clear Scene\n"
"for ob in bpy.data.objects:\n" "for ob in bpy.data.objects:\n"
" bpy.context.scene.objects.unlink(ob)\n" " if ob.type != 'CAMERA':\n"
" bpy.data.objects.remove(ob)\n" " bpy.context.scene.objects.unlink(ob)\n"
" bpy.data.objects.remove(ob)\n"
"bpy.types.Lamp.retro_layer = bpy.props.IntProperty(name='Retro: Light Layer')\n" "bpy.types.Lamp.retro_layer = bpy.props.IntProperty(name='Retro: Light Layer')\n"
"bpy.types.Lamp.retro_origtype = bpy.props.IntProperty(name='Retro: Original Type')\n" "bpy.types.Lamp.retro_origtype = bpy.props.IntProperty(name='Retro: Original Type')\n"
"bpy.types.Object.retro_disable_enviro_visor = bpy.props.BoolProperty(name='Retro: Disable in Combat/Scan Visor')\n" "bpy.types.Object.retro_disable_enviro_visor = bpy.props.BoolProperty(name='Retro: Disable in Combat/Scan Visor')\n"

View File

@ -227,8 +227,9 @@ bool MREA::Extract(const SpecBase& dataSpec,
MaterialSet::RegisterMaterialProps(os); MaterialSet::RegisterMaterialProps(os);
os << "# Clear Scene\n" os << "# Clear Scene\n"
"for ob in bpy.data.objects:\n" "for ob in bpy.data.objects:\n"
" bpy.context.scene.objects.unlink(ob)\n" " if ob.type != 'CAMERA':\n"
" bpy.data.objects.remove(ob)\n" " bpy.context.scene.objects.unlink(ob)\n"
" bpy.data.objects.remove(ob)\n"
"bpy.types.Lamp.retro_layer = bpy.props.IntProperty(name='Retro: Light Layer')\n" "bpy.types.Lamp.retro_layer = bpy.props.IntProperty(name='Retro: Light Layer')\n"
"bpy.types.Lamp.retro_origtype = bpy.props.IntProperty(name='Retro: Original Type')\n" "bpy.types.Lamp.retro_origtype = bpy.props.IntProperty(name='Retro: Original Type')\n"
"bpy.types.Object.retro_disable_enviro_visor = bpy.props.BoolProperty(name='Retro: Disable in Combat/Scan Visor')\n" "bpy.types.Object.retro_disable_enviro_visor = bpy.props.BoolProperty(name='Retro: Disable in Combat/Scan Visor')\n"

View File

@ -126,8 +126,9 @@ bool MREA::Extract(const SpecBase& dataSpec,
MaterialSet::RegisterMaterialProps(os); MaterialSet::RegisterMaterialProps(os);
os << "# Clear Scene\n" os << "# Clear Scene\n"
"for ob in bpy.data.objects:\n" "for ob in bpy.data.objects:\n"
" bpy.context.scene.objects.unlink(ob)\n" " if ob.type != 'CAMERA':\n"
" bpy.data.objects.remove(ob)\n" " bpy.context.scene.objects.unlink(ob)\n"
" bpy.data.objects.remove(ob)\n"
"bpy.types.Lamp.retro_layer = bpy.props.IntProperty(name='Retro: Light Layer')\n" "bpy.types.Lamp.retro_layer = bpy.props.IntProperty(name='Retro: Light Layer')\n"
"bpy.types.Lamp.retro_origtype = bpy.props.IntProperty(name='Retro: Original Type')\n" "bpy.types.Lamp.retro_origtype = bpy.props.IntProperty(name='Retro: Original Type')\n"
"\n"; "\n";