Featured post

new redirect for blender.org bpy docs.

http://www.blender.org/api/blender_python_api_current/ As of 10/11 november 2015 we can now link to the current api docs and not be worr...

Showing posts with label debug. Show all posts
Showing posts with label debug. Show all posts

March 26, 2014

Note to self BMesh

small note to self: useful snippets for debugging mesh editing tools. and then

Removing Edges

From my understanding of this (may be wrong, still experimenting): say I have edges with indices [0,1,2,3,4,5,6,7] and I delete an edge with index 4.
  • I won't get [0,1,2,3, 5,6,7]
  • But will become [0,1,2,3,4,5,6].
    Don't assume that there's a direct remap happening, like: (5->4, 6->5, 7->6). Indices may be jumbled up.
  • In the case of removing multiple edges from a list, ordering your edge indices from highest to lowest won't guarantee that you are deleting the right edge.

Using bmesh.ops.remove()

As per this post on StackExchange. Using any other method has given me unexpected results. So whether you need to remove 1 or multiple edges, the bmesh.ops.remove method will happily take a list of edges and remove them without the headache of bookkeeping or tagging.

July 02, 2012

Debugging Python Scripts for Blender

Today for the first time in months I couldn't figure out why an old Addon (Monster Tile Renderer) didn't work. The python interactive console remained suspiciously silent, blender was simply closing upon executing the Render button. I had forgotten how to use the script for Blender Internal, because Cycles has been my go-to renderer since it came out.

The only way to get some information is to run blender in debug mode: blender --debug-all. This told me blender was
"""
ERROR: Cannot render, no camera
Evaluate all animation - 0.000000
 No Actions, so no animation needs to be evaluated...
bpy.ops.render.render(animation=False, write_still=False, layer="", scene="")
zsh: segmentation fault (core dumped)  ./blender --debug-all
"""
So now I know to check for a camera before allowing render, this is something I had taken for granted.