I need to do a loop cut on a mesh I've generated, so I found some code that works when I run Blender normally then the script. The catch is, I need it to work when I launch Blender from the command line and currently it causes an EXCEPTION_ACCESS_VIOLATION that crashes blender :(
Here is the code I'm using:
bpy.ops.object.select_all(action='DESELECT')
bpy.context.view_layer.objects.active = argObject
argObject.select_set(True)
bpy.ops.object.editmode_toggle()
# setup a bunch of context for the loop cut operation
region, rv3d, v3d, area = self.view3d_find(True)
override = {
'scene' : bpy.context.scene,
'region': region,
'area':area,
'space':v3d
}
# perform the loop cut operation
bpy.ops.mesh.loopcut_slide(
override,
MESH_OT_loopcut = {
"number_cuts":loopNumber,
"smoothness":0,
"falloff":'INVERSE_SQUARE',
"object_index": 0,
"edge_index": 2,
"mesh_select_mode_init":(True, False, False)
},
TRANSFORM_OT_edge_slide = {
"value": 0,
"mirror": False,
"snap": False,
"snap_target": 'CLOSEST',
"snap_point": (0,0,0),
"snap_align": False,
"snap_normal": (0,0,0),
"correct_uv": False,
"release_confirm": False,
"use_accurate": False
}
)
Here's the error message I get in the command line:
Error : EXCEPTION_ACCESS_VIOLATION Address : 0x00007FF7193BE4C3 Module : blender.exe Thread : 00007ec0 Writing: C:\Users\Me\AppData\Local\Temp\MyBlend.crash.txt
I had a look in the crash log above for a thread with the id listed, but there was none :/
override ={'window':bpy.context.window,'screen':bpy.context.window.screen,'area':area,'region': region}. and try toprint(type(area), type(region))and make sure they really are classesbpy.types.Areaandbpy.types.Region– Harry McKenzie Aug 01 '22 at 06:35crash.txtlog or paste the last few lines of the error in that crash.txt log. – Harry McKenzie Aug 01 '22 at 06:44Thanks for all your help :)
Unfortunately, after making the changes it's still crashing :/
– ioflow Aug 01 '22 at 06:59Is there a way to add the crash log as a file?
– ioflow Aug 01 '22 at 07:04"Bin\blender-3.2.1-windows-x64\blender" -b Blends\Vanity.blend -P Scripts\RenderParametricVanity.py -- --cycles-device OPTIX --vanityConfig marquis_bay_wall_1200 --themeConfig florentine_walnut --outputPath ..\Output --optionsConfigFilePath Data\Company\Configs\Options\ExampleOptions01.json
– ioflow Aug 01 '22 at 07:07Scripts\Parametric\box.py", line 215 in addVerticalBanding, are the contents exactly that snippet you posted in the question? so if you just do a pass inside the functionaddVerticalBandingwill it still crash? – Harry McKenzie Aug 01 '22 at 07:11