Offset Edges

That´s weird, I just tried Offset edges 3.9 with interactive mode and it worked just fine in a nightly 2.83 build… and I have a gazillion addons active.

Edit: Aah, Offset and move works fine, but Extrude crashes Blender. Didn´t notice because I only ever use the move tool :stuck_out_tongue:

1 Like

can anyone confirm if that fixes crashes?

bmesh.update_edit_mesh(ob_edit.data)

add that in line 938:


5 Likes

Holy cr*p it works! You fixed it!
Sherlock holmes move! :smiley:

Would you mind explaining how you discovered it, what made you come to the conclusion that what was missing? I’m starting to dive into python programming for Blender so I’m interested in the logic process of addon developers hehe

sure
i’m nether experienced coder or professional addon developer, so my methods are not most sophisticated and i was kinda doing that in blind, but here it is:

my searching for bug

before i looked at code i knew:

  1. it worked by operator, but not in modal
  2. it gives blender crash with ACCESS_VIOLATION and not python code
  3. sometimes it worked

and that told me:

  1. problem is rather in area of modal execution, and not rest should be fine
  2. it is trying to read data that it is not supposed to read, so it messed up how it is being executed, or it messed data it operates or maybe even blender bug
  3. input data (mesh) or environment somewhat affected that

so… i placed bunch of “print(something)” commands to see where is last line executed before crash (cause i dont know how to properly use debugger)
https://i.imgur.com/a7eGO6F.png
and last printed text was before ‘return’ in ‘invoke’ method and before first line of ‘modal’ that should be executed right after invoke
so… wtf, crash is not even during python code execution, so either data of operator is weird or it messes up data of blender

i’ve checked code of example modals in blender and in this one, but didn’t noticed anything extraordinary

i’ve googled how to ouput all data of class in python and compared move type (that run fine) and extrude(that crashes)
https://i.imgur.com/KO5Mh87.png
but it didn’t looked suspicious to me

i again added “print(“method name”) in methods in addon to know which ones are executed at all”

at this point i knew that parts that is executed, so mainly invoke and functions from within
nothing interesting

i thought that interactive ‘move’ worked and ‘extrude’ didn’t so i tried to find how it differs and i’ve serched for “geometry_mode”
and found get_exverts function that is called from modal_prepare_bmeshes that is called from invoke (according to previous prints and searching code)
that does different stuff depending on geometry_mode
https://i.imgur.com/mp3jRRJ.png

so… i’ve just commented that function
and it obviously failed to correctly execute, but it didn’t crash
good sign
so code that is causing crash might be there

now instead of self.extrude_and_pairing method i’ve pasted code from move part and again it didn’t crash (and behaved like move)
ok, so error is probably in extrude_and_pairing

first line is “bmesh.ops.extrude_edge_only”
i recalled that after operations on bmesh you should(or must) do something with it

if you google that you can find even an example code from developers in documentation:
https://docs.blender.org/api/current/bmesh.ops.html

it didn’t look too different, but devs had section “# Finish up, write the bmesh into a new mesh”
not excacly as in this case
so i googled a little to know more about handling bmesh
https://blender.stackexchange.com/questions/414/how-to-use-bmesh-to-add-verts-faces-and-edges-to-existing-geometry
and in this question there is answer from ideasman42 (blender developer)
and after operations on bmesh he uses
“bmesh.update_edit_mesh(obj.data)”

and in documentation it is described as “Update the mesh after changes to the BMesh in editmode, optionally recalculating n-gon tessellation”
i didnt found anything done with that bmesh after that and before crash section so i assumed that this is missing

pasted that line in last lines of preparing_bmesh

test… bingo! it is not crashing and it is working!

and thats more or less how i found that missing line

9 Likes

good work, so it’s version 4.0 that needs that lined injected to 938…

https://raw.githubusercontent.com/Zuorion/HidesatoIkeya_OffsetEdges/master/0.4.0/mesh_hidesato_offset_edges.py
938

2 Likes

getting a horrible indent error

i love how python gives you and an error, when using tab instead of spaces or vice-versa.

2 Likes

As a non-programmer I had to fix this by changing Notepad++ (which I use to edit .py files) to change tabs to spaces. It’s under the Settings > Language options.

I took the 4.0 version that was posted a while ago and added the line, and while it worked my Preferences said that the add-on needed to be updated to 2.8.

Dheim can you post the file here. Thanks

here stupid notepad++, easier in pycharm
hopefully the original dev can update the source
mesh_hidesato_offset_edges2.py (42.3 KB)

8 Likes

I switched to using VIsual Studio Code now because of that crap in Blender editor.

1 Like

Sorry to bump like this, but what is the latest version of addon. The interactive one?

That one is the latest.
0.4.0 + interactive

1 Like

Really interesting read, thanks for sharing!
(thanks to you I now have more knowledge to work with bmesh in the future :smiley: :clap: )

Thank you OnlineRender

I am using an older version currently. But I can try the latest if that makes a difference. But has anyone else noticed offset edges running quite slow, if your scene is getting heavier?

My mesh is very light, like 350 verts, but is still quite laggy/slow to change the width value for example, in real time. In 2.82 or 2.83 builds.

Great Add-on!

But in windows / Blender 2.83 crashes.

It is possible to add feature like Slide edge with clone?

Imgur

10 Likes

Such a think is very needed really! Especially if the newly cloned edge could be moved all over the object without being hindered at all.

In fact the needed think is to have a way to slide a loop all over the surface of a mesh.