Blender EdgeTools

Thanks a lot Brikbot ! and you welcome for the blend, as i said, not knowing python, this is the least i can do.
You are damn fast at cleaning code ! I’m pretty impressed !

OK i see what you talk about, though i don’t remember the math behind the coplanarity test of 4 points ( my school is too long ago :stuck_out_tongue_winking_eye: )
However i thought about a potential coplanarity problem for the 4 point of the cutter plane. Therefore, i tried with a triangle from this plane ( i used CTRL+T KEY on the cutter plane ), and with a triangle as the cutter, i also had an error.
Here it is:



It’s some domain error but this time, not on sqrt it’s acos. I believe there’s some infinite or NAN stuff around there.
However, your script might not be intended to use a tri as the cutter ?

Tomorrow i’ll give a try to your last update and will keep you informed :slight_smile:
Thanks a lot and g’nite !

regards.

Well, for the 4 points I’m not using a “pure” math method . . . I’m kinda cheating: I’m using three of the points to form a plane, then just checking to see if the distance of the fourth from the created plane is zero or not. If the quad is planar, then the distance must be zero (it’s on the plane). The nicety of that is that I can extend it for an infinite number of points (n-gons) with a simple loop.

Now for that tri error. First, a tri should work fine, and in fact the calculation we are interested in is completed. In the code, I have a function that calculates the intersection point of a line with a surface (tri, planar n-gon, and non-planar quad). Then, because I am using it in the two projection functions, it has to check and see if the point is “inside” the surface or “outside” the surface. The triangle “version” of the test (which is irrelevant for “slice” so shouldn’t even be checking it) is what is throwing the error. Now why the error is being caused, I don’t know yet but I’ll bet it is something like a sqrt(-1) type of error - which would be a domain type of error - which I think can happen with an arccos . . . IIRC arccos only gives a Real when it is between -1 and 1, noninclusive.

Anyway, enough thinking out loud - I’ve got homework to finish and a new interesting bug to figure out :evilgrin:

Edit:
If it ever struck your fancy, I have a bit of debug type of stuff hidden in the add-on (prints to console, test functions, in-work stuff). It shows up when Blender is started in debug mode (with the “–debug” argument).

OK, work very fine when i select the quad roof part from my .blend as a cutter plane.

I still have the acos domain error when i CTRL+T this quad to 2 triangles and use one of those triangles as cutter plane.
Nevertheless this is, as i use to say in my raw french, some ( sorry for the bad word :stuck_out_tongue_winking_eye: ) flyfuck. This bug don’t bother me at all as i just need to subdiv one of the edges of the cutter triangle, for the script to work.

So thanks again for the debugging and have nice blends !

regards.

EDIT for new bug report:
Hi again Brikbot !
I just fell on a lil bug i didn’t notice before ( till now i didn’t slice UVed meshes ). The slice function works perfectly
for slicing meshes, but don’t cut UV segments properly. Those edges are always cut at their center instead of beeing cut at a point matching the ratio cut_seg_length/cut_pos of the mesh segment.
A picture beeing 1000 time more explicit than long text, lemme post one there:


Here, you can see the highlighted quads & tris to cut, and the cutter plane ( damn i really wonder how i did this before without your script !!! 8-O ) on the left side of the picture. on the right side, there are 2 samples from the UV window. At the top, you got the UVs before the slice, and under, you got it after the slice.
I surrounded the added vertices generated by the slice. As you can see they all cut the segments in their middle, as they should be cut at a place approximatively corresponding to the green dots i put by hand on the picture.

At the moment, i cheat and move them by hand :wink:
but i guess the UV cut place is not the correct one, so if you confirm this and have time enough for changing it…
would be GREAT 8-D !
As usual, if you need my blend file, just tell me and i’ll post it right here.

At last but not least, i wanted to ask wether an additionnal feature on the edge-tools could be added ? or not.
Here’s my idea. When you slice a mesh as i do on the picture in this post, i obtain exactely the same mesh with more vertices ( the vertices added from the slice ). But i don’t see the slice line. I guess it’s due to Bmesh system that allows several vertices ( more than 4 ) per face.
well… as usual, picture instead of words… :



ok. What i got after slice is on the left part of the picture. When in vertex mode, you can see the added vertices but in edge or face mode, you don’t see anything. And also, when i CTRL+T the faces, the popping triangles don’t respect the slice line.
On the rightmost capture is what i got after some hand work. You perfectly see the slice line wich make the polygons very convenient to UV.
My question is: Do you think it could be possible to get what’s on the right picture, with et edge-tool slice ? I guess it is, but i imagine this can be a pain as it might be some sorting and triangles ordering in lists…
but would be great too :stuck_out_tongue_winking_eye:
Mebe for those Bmesh addicts who don’t want what’s on the right, add a toggle in interface saying “show slice line” ?

Thanks for your time and help !

Regards.

I’ll have to look into it . . . since I rarely even use UV mapping (I tend to use procedurals so I can skip the un-wrapping process) this totally has never occurred to me. I feel like it should be fairly simple assuming that the actual mesh and the UV are close to proportional (which normally, they should).

The second one is a really good idea. I guess I never though about it since I would just switch to verts and press CTRL+J, but automating it with an option would be a nice feature. I think I’d call it something like “Split cut faces” since that is basically what it is doing.

I’ll have time this afternoon to get some coding done, so hopefully I can clear some of this up by tonight.

Edit: I seem to have hit a bug with the “remove BMesh edge” in the API crashing Blender (the “Rip” option of slice uses it). I’m going to search and ask around and see if there is a legitimate bug. I know it used to work, so I’m guessing that it was broken somewhere in a recent revision.

Hi Brikbot !

You gonna debug during the night ? Nice of you but think about sleeping a bit too :wink:

For the UV question, i’d say no, UVs are not at all proportional to mesh shape. I often deform my UVs when i hand-edit them. Therefore i think that the thing that has to be done is someting like keeping the ratios.
*when you cut an edge named AB in C you get a ratio r=AB/AC

  • here note that an edge may be part of 2 polys. Then it mean that it can correspond to 2 edges in the UV list…
  • get the matching edge(s) in UV list, retrieve their A and B vertices and cut then in C with the corresponding ratio r.
    I think that could do it. However i confess it’s much faster said than coded ;-S
    You say you use procedural thingies for UVing your mesh. I never heard about this ( mean in blender. In unity3D i already used this thing ). Though it’s off topic, could you please tell me more about this ? or mebe in PM ? I’d really be interrested in getting rid of this looooooong spend of time in UVing meshes.

For the “added feature”, am not sure i catch you thought. CTRL+J joins vertices but don’t show the cut line…? hmm am not sure tho… gonna give it a try. Anyway, what i thought about is not a split. Vertices in the rightmost picture of the las one in previous post are still shared by faces. What i only have here is just a shoxup of the cut line. Do you want me to send you the blend file ?
so that you can see it clearly ?

About the bug, unfortunately i cannot be of high help. I hope you’ll find people who can solve this problem quickly.

Thanks a lot and have a good codebugging Brikbot ! :slight_smile:

Hi Brikbot.

Any news on your work ? Or are you stuck in the slice rip bug ? :-S

regards.

pitibonom:

Don’t worry, I haven’t forgotten :wink: Sadly I have been buried under homework this week, and with a bunch of exams next week I don’t know if I’ll have time to work on this till after then. But if I manage to get anything done over the weekend I’ll let you know.

Okies !
Of course it’s much more important you work on exams than on blender script :wink: Don’t force the things. It seems i’m the only one interrested in your great script and btw, am not in a hurry.
I wish you good luck for your next week exams and will keep an eye on this topic.
cya later :slight_smile:

I noticed your script is now integrated in 2.64 RC1 ! a good thing :wink:
there were some little things missing in 2.63a, and the incoming 2.64 seems perfect to me.

EDIT: erf ! me saying rubbish… in 2.64 it is not… however, when installing it, it works as before :wink:

congrats on the 2.64 integration! You’re hard work has brought many blender artists an even more capable toolset. Thank you.

hi, If you get a chance drop into irc, I need to discuss some merges :slight_smile:

Any news on your script Brikbot ?

Nothing significant. I’ve gotten some of the code cleaned up so it makes more sense, updated some documentation, repaired a couple easy-to-fix bugs, that sort of thing.

Okies :slight_smile: it has to be done too.

I keep an eye on this topic for when you put upgrades for test. Like UV slicingat right place instead of 0.5

thanks and have nice blends !

Hey combining this with TinyCAD would be awesome!