rodrigorc / papercraft

Papercraft is a tool to unwrap 3D models.
GNU General Public License v3.0
124 stars 1 forks source link

[Bug] Incorrect handling of edge type with open objects #6

Closed kroozo closed 11 months ago

kroozo commented 11 months ago

Hi,

While testing on the other thread I found an issue that with how cut / fold lines are handled if the object is not closed.

I created a simple shape in blender, just a box, moved the edges a bit to not look uniform, then deleted two faces, forming a kind of a tube. image

When loading this up, it does look good, no flaps are added to edges that has only one side connected to them. (Nor can you add by clicking, or get an error, or something when trying):

image

However, the generated svg indicates these edges as folds, rather than cuts (the red edges on the left and right):

image

My theory is that only edges that are spit by purpose during flattening or in edge mode are considered cuts, the rest considered are folds, and these just happen to not have a neighbor in the object, but that is never checked.

(I originally was looking at how the hidden flaps handle this, but that works as excepted)

rodrigorc commented 11 months ago

That is what I call a "rim", and you are right, they are cuts and should be black. It should be easy to fix...

About not adding tabs to the rims, that is by design, because there it nothing to glue to. If I needed additional flags, I could just add them manually when cutting. I keep on forgetting the cutting machines.

Do you find useful the ability to add a tab to a rim?

kroozo commented 11 months ago

That is what I call a "rim", and you are right, they are cuts and should be black. It should be easy to fix...

Great, thanks!

About not adding tabs to the rims, that is by design, because there it nothing to glue to. If I needed additional flags, I could just add them manually when cutting. I keep on forgetting the cutting machines.

Besides my slight OCD for doing things proper in their place :) and the machines, the assembler might not be the one that did the project, and knows the missing flaps. For eg, there is a healthy market where people basically sell pepakura generated pdfs for a few bucks. It's pretty annoying when there's a slight mistake in them, or they have extra/missing stuff.

Do you find useful the ability to add a tab to a rim?

Ah, I added that to indicate that otherwise then interaction with those edges does what is excepted (ie: nothing happens, but no crash or errors either), but it also does not affect the output.

I would't think I needed them, but I can imagine use cases where it might be useful:

On the con side it might be a bit confusing, but since normal sides have a nice indication on their pair it's very clearly visible that this is a rim, so I think clicking on it toggling the flap on/off instead of swapping it with its pair is actually pretty intuitive.

rodrigorc commented 11 months ago

The thing with adding a tab to a rim is that I use the geometry and the texture of the adjacent face to compute some things (limit the tab geometry, texturize the tab...).

Not having that face makes things tricky, I would have to build an unconstrained tab, that seems easy in theory, but the tab-building code is a bit of a mess, so let's put that in the wish-list bin for now...

Also I'm thinking of changing the visual hints of a rim, maybe highlighting it with a dashed green/blue line instead of a solid one?

kroozo commented 11 months ago

Also I'm thinking of changing the visual hints of a rim, maybe highlighting it with a dashed green/blue line instead of a solid one?

It will help with understanding that this is a bit different from the rest. Dash is good, or something gray(ed), that usually indicates "you can't do anything with this" which right now is true. But it might not look good with textures?

kroozo commented 11 months ago

I would't think I needed them,

Of course I meant "I would not think I needed them"

rodrigorc commented 11 months ago

SVG fixed in the commit above, let me reopen it so that I don't forget about the tab-in-a-rim issue.

Dash is good, or something gray(ed) ... But it might not look good with textures? I went for a different dash pattern. I'd like to keep the color because it hints at the user edit mode: tab-mode vs edge-mode. And adding shades of grayish-blue or grayish-green... yes, I selected full saturated colors to prevent clashing with the user texture.

kroozo commented 11 months ago

Works good, and the dashes look ... well, dashing :)

Thanks!

rodrigorc commented 11 months ago

This commit implements tabs in rim edges.

It was tricky because I don't have a face to use as a texture template for the tab, so I wanted to use the available face, but mirrored. I think I managed to make it work quite nicely.

The only drawback is that in previous versions of Papercraft, when importing an OBJ file, I was marking the rims as "with tab", but then the tabs were invisible, so it didn't matter. But now that tabs are visible, when importing an OBJ file, rims are marked as "with hidden tab".

This means that if you open a model with rims imported with an old Papercraft version, all rims will show tabs. But if you import it with a new Papercraft version, then it will not show tabs by default. A bit inconvenient... but rims are not so frequent, I think.