Page MenuHome

Destructive Extrude Operator
Needs ReviewPublic

Authored by CandleComet (CandleComet) on Jul 24 2019, 9:18 PM.
Tokens
"Mountain of Wealth" token, awarded by franMarz."Love" token, awarded by hitrpr."Love" token, awarded by Alumx."Love" token, awarded by Arkhangels."Burninate" token, awarded by neotam."Love" token, awarded by the_old_ben."Love" token, awarded by drx."Like" token, awarded by bignatov."Love" token, awarded by ReinhardK."Love" token, awarded by markh."Orange Medal" token, awarded by duarteframos."Love" token, awarded by Tetone."Love" token, awarded by billreynish."Love" token, awarded by cncl."Love" token, awarded by brezdo."Love" token, awarded by pierogo."Love" token, awarded by Schiette."Evil Spooky Haunted Tree" token, awarded by Gwenda."Love" token, awarded by DiogoX2."The World Burns" token, awarded by zgorg."Love" token, awarded by rnederhorst."Love" token, awarded by Eritar."Love" token, awarded by vitorbalbio."Love" token, awarded by chimpman252."Love" token, awarded by Qwerky."Love" token, awarded by Rongix."Love" token, awarded by Samuel_Mezger."Love" token, awarded by AnityEx."Love" token, awarded by Schamph."Love" token, awarded by ckohl_art."Love" token, awarded by ckat609."Love" token, awarded by dpdp."Like" token, awarded by ws01."Like" token, awarded by Fracture128."Love" token, awarded by julperado."Love" token, awarded by Debuk."Love" token, awarded by buoy."Burninate" token, awarded by shader."Love" token, awarded by Shimoon."Love" token, awarded by WWS3D."Like" token, awarded by filibis."Like" token, awarded by CobraA."Love" token, awarded by Leul."Love" token, awarded by masterxeon1001."Love" token, awarded by Dspazio."Like" token, awarded by vademenev."Love" token, awarded by ZohaibAli."Love" token, awarded by stormrider."Love" token, awarded by Way."Love" token, awarded by jsm."Love" token, awarded by plundh."Love" token, awarded by linolafett."Burninate" token, awarded by imad_mss."Love" token, awarded by Artsolit."Party Time" token, awarded by Zino."Love" token, awarded by vitos1k."Cup of Joe" token, awarded by MasterNurmi."Burninate" token, awarded by sopranoo."Love" token, awarded by Dogway."Love" token, awarded by AndreasAustPMX."Love" token, awarded by cyrkiel-network."Love" token, awarded by Zuorion."Love" token, awarded by ogierm."Like" token, awarded by knightknight."Love" token, awarded by MetinSeven."Love" token, awarded by Scio."Love" token, awarded by valera."Love" token, awarded by Linkun."Love" token, awarded by KevanC."Burninate" token, awarded by JayE01."Love" token, awarded by weasel."Love" token, awarded by monio."Burninate" token, awarded by DotBow."Love" token, awarded by craig_jones."Love" token, awarded by muratagawa."Like" token, awarded by xan2622."Love" token, awarded by marcclintdion."Dat Boi" token, awarded by ostapblender."Love" token, awarded by plyczkowski."Love" token, awarded by Mephisto."Love" token, awarded by ambient."Love" token, awarded by xdanic."Love" token, awarded by LahceneB."Like" token, awarded by yebyte."Love" token, awarded by jc4d."Love" token, awarded by iWaraxe."Love" token, awarded by n-pigeon."Like" token, awarded by YAFU."Love" token, awarded by Rusculleda."Love" token, awarded by roman13."Like" token, awarded by belich."Love" token, awarded by johnandress."Love" token, awarded by fiendish55."Love" token, awarded by maxivz."Love" token, awarded by mazigh."100" token, awarded by Frozen_Death_Knight."Love" token, awarded by bnzs."Like" token, awarded by hjrabi."Yellow Medal" token, awarded by madminstrel."Love" token, awarded by ugosantana."Burninate" token, awarded by jfmatheu."Like" token, awarded by astrand130."Like" token, awarded by johnpdelacruz26."Love" token, awarded by rl.amorato."Love" token, awarded by brilliant_ape."Love" token, awarded by JulienKaspar."Love" token, awarded by amonpaike."Love" token, awarded by jendrzych."Love" token, awarded by xrg."Love" token, awarded by TheRedWaxPolice."Love" token, awarded by Okavango."Like" token, awarded by ace_dragon."Love" token, awarded by Otilla."Love" token, awarded by HooglyBoogly."Like" token, awarded by meta-androcto."Like" token, awarded by campbellbarton.

Details

Summary

This code adds an extrude variant which functions by first extruding normally then joining and dissolving certain geometry. The operator makes it extremely quick and simple to block out environments, complex buildings, stairs, doors, etc.

This tool has four options:

  • Original Loop determines whether to keep the original boundary edges of the extrusion.
  • Successive Loops determines whether to insert loops after contacting new geometry.
  • Destroy End determines whether to delete open faces after the extrusion, simulating a boolean hole.
  • Keep Sides keeps the faces sides of the extrusion, even when extruding in.

These options are hard to explain, try looking at the video to see exactly what I mean.
Also, there is the ability to snap to existing loops while holding ctrl.

Recording
Demonstrates the four options and some of the capabilities of the tool.

( Recordings of past versions: F7835975 F7779114 F7673205 )

Design Points:

  • This operator does not use boolean. It accesses only local geometry. Disconnected and in-adjacent geometry is basically ignored. This means that it is usually impossible to create a hole by extruding 'all the way through.'
  • The operator utilizes code from automerge split edges & faces when welding itself onto an edge loop.

Diff Detail

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

"Teardown Extrude" would be my proposal for this.

Anyhow this is really nice!
! Please review this!

Why not go simple and just call it "Free Extrude"? 😉

Dan Pool (dpdp) awarded a token.
-- (zgorg) awarded a token.

it's always up to date, any news ?

I think any name similar to push/pull still can be confusing to new users, like press/pull, press/tug, etc. Smart Extrude, Manifold Extrude, and Free Extrude seems ok.

I think any name similar to push/pull still can be confusing to new users, like press/pull, press/tug, etc. Smart Extrude, Manifold Extrude, and Free Extrude seems ok.

I was going to suggest maybe Free Extrude, would be the way to go with the naming convention of the tool.

I like smart extrude

This looks great. Fantastic work by the author. I think it would be great to have this in Blender. I registered an account just to add this comment.

CandleComet (CandleComet) updated this revision to Diff 22995.EditedMar 21 2020, 3:57 PM
  • Fixed problems @Juan Gea (juang3d) pointed out, so it is now up to date with the current master.
  • Renamed to Extrude manifold, but only on the surface (I haven't gone through and renamed every code function yet).
  • Also, recent automerge improvements in the master branch made this more reliable, since this utilizes some of that code.

Note that this tool is missing a gizmo. For the way the tools currently work, where clicking and dragging outside the gizmo performs a selection, a gizmo is now required for modelling tools. Since it appears that this tool only works along the normal, you should be able to use the Normal gizmo here.

  • Extrude Manifold now uses the generic gizmo.
  • Cleanup

@CandleComet (CandleComet) The gizmo you added appears to work correctly. Thanks. All that's needed from a UI POV is an icon, but it's not required for you to provide that - we usually just do the necessary icons separately so that we ensure they all look consistent.

@Dalai Felinto (dfelinto) Any chance it could make it to the 2.83? please

Will this still be able to make it in time for 2.83?

@Dalai Felinto (dfelinto) Any chance it could make it to the 2.83? please

Will this still be able to make it in time for 2.83?

This, would really appreciate it if this could make it into 2.83

Thanks for working on this CandleComet.

IMO this should really be default behavior for the extrude tool. Compared to Sketchup, it feels so un-intuitive right now to try to extrude into the edge of an object only to end up with overlapping faces. You shouldn't need to watch a tutorial to figure out how to do something so basic, and I doubt beginners will know to look for "Extrude Manifold".

>>! In D5336#172239, @Matt (chimpman252) wrote:

IMO this should really be default behavior for the extrude tool.

Agreed. This should at least be the default selection in the toolbar for the extrude set of tools.

IMO this should really be default behavior for the extrude tool.

I really like this tool, but I don't think it should be the default for extruding. It has certain limitations which the normal extrude operation doesn't have, and if you were just expecting a traditional extrusion operation, it can have unintended side-effects. Also, for someone who is new and learning how to do polygon modeling, using this tool can give the incorrect impression of how polygon modeling works under the hood, and lead to further confusion down the road. Of course, that's just my opinion.

However, it is great to have as an option, especially when doing architectural-style or mechanical block-outs.

When testing the patch and I came across an assert another one:

BLI_assert failed: ...\source\blender\bmesh\intern\bmesh_marking.c:1159, BM_mesh_elem_hflag_disable_test(), at '(htype & ~(BM_VERT | BM_EDGE | BM_FACE)) == 0'
BLI_assert failed: ...\source\blender\bmesh\intern\bmesh_mods.c:228, BM_faces_join_pair(), at '(l_a != l_b) && (l_a->e == l_b->e)'
BLI_assert failed: ...\source\blender\bmesh\intern\bmesh_operators.c:963, BMO_slot_buffer_from_single(), at 'slot->slot_subtype.elem & BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE'
BLI_assert failed: ...\source\blender\bmesh\intern\bmesh_iterators.c:433, bmiter__elem_of_mesh_step(), at '((BMIter *)iter)->count <= BLI_mempool_len(iter->pooliter.pool)'
BLI_assert failed: ...\source\blender\bmesh\intern\bmesh_operators.c:963, BMO_slot_buffer_from_single(), at 'slot->slot_subtype.elem & BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE'

It took a long time but I fix each assert one by one:

When testing the patch, one thing that bothered me is that it has its own transform system.
So it does not take advantage of various transform features (Snap, AutoMerge, Orientation).
It also limits the affected geometry to the linked nearby geometry:


And also seemed slow.

@Germano Cavalcante (mano-wii)

  • This uses its own snapping and orientation, but it does utilize the automerge function.
  • The reason it is slow is because each frame it recalculates from the original geometry by iterating the destructive extrude bmop for each edge it's extruded past (line 350 of editmesh_extrude_destructive). This is very slow after extruding past many edges. But it could be optimized if the mesh were stored after each iteration so it would not have to recalculate from the original geometry, or something like that.

As far as the nearby/linked geometry:
It seems that being able to extrude all the way through is an important feature. Is there a good way to detect when non-local geometry was extruded past, then merge the extrusion into that geometry? Once the coplanar boolean improvements are in place, maybe some of that code could be utilized for this, in cases like @Juan Gea (juang3d) pointed out:

  • Create a cube
  • Make an inset in a face
  • Extrude backwards until you trespass the other side of the cube
  • I think a hole should be created, but instead we just trespass the faces and no hole is present.

Otherwise, with the boolean improvements, I wonder if using boolean entirely (like this addon) will be better than the method in this patch. The trade-off is that features like successive loop, original loop, and snapping to existing loops might not be possible.

I hope this is a transparent extension of the actual extrude with same shortcut |E|. gismow will automatically appears if a selection and same about snap. I mean extrude has just to be by default positive or negative

Thanks for the patch.
While this isn't being committed I used it as reference/inspiration for rBb79a5bdd5ae0.

Thanks for the patch.
While this isn't being committed I used it as reference/inspiration for rBb79a5bdd5ae0.

@Germano Cavalcante (mano-wii) it’s great to see it implemented on 2.90 alpha. But the options presented on @CandleComet (CandleComet) proposal are great, specially the option to keep edges and to make a hole on the object.

I understand your solution is different. But I hope you can implement some options to it for 2.90. Thank you both for your work! Very important tool!

@Germano Cavalcante (mano-wii), @Campbell Barton (campbellbarton), as maintainers of modeling and snapping, can you clarify the current situation and define the way forward?

My understanding is that the new "Extrude, Dissolve and Intersect" provides a subset of this functionality. But it's not clear to me exactly what is missing relative to this patch, or relative to what we want to support ideally.

Also, from what I gather the approach taken in this patch is not considered acceptable, since it has its own snapping system which is problematic in terms of performance and usability design.

So what I suggest is:

  • Find a better name for "Extrude, Dissolve and Intersect" (maybe "Extrude Manifold" as suggested here?). The UI team can help with this.
  • Create a task with a list of further improvements to be made to this new tool, or this type of functionality in general.
  • Briefly explain in that task what the right way/place is to implement such improvements so that they can be accepted.
  • Close this code review.

If possible, I'd really like to have a shortcut for it. In terms of modeling this is something to use on daily basis, and I think people would appreciate it. Ctrl + E would work good in my opinion.

Thoughts?

Comparision for DE addon and new tool.
Two cases where adon still better.

This is probably / technically another task.... but it would be awesome if we could have ALL Extrude Operators able to ACTUALLY Cancel.
Currently if you Hit Escape / Right Click, it will leave overlapped geometry behind, which is often not known to new users/can be annoying for existing users.

I think Right-Clicking to leave overlapping Geo alone is maybe OK, if you don't want to Translate the new geo along the normals.
But, if the user hits Escape, it should really/ideally ACTUALLY cancel/undo the operation completely.

I am a huge noob to C++, but I was digging into the Extrude Code/Inset/Bevel, to see how things work. It appears that Extrude cannot cancel, because it's not running as a normal Modal.
It seems to run a single loop/command to Extrude with 0 Height, then runs another macro/function (TRANSFORM_OT_translate) or (TRANSFORM_OT_shrink_fatten) to actually offset the new faces.
Which is why we can't cancel/have to undo I suppose.. If I am correct anyways.

I was able to hack something together using some Inset code, to where I could start to Extrude Individual Faces and ACTUALLY Cancel it. But I cannot adjust the height, since it was using the Shrink/Fatten.
So at this point, it seems like it's probably better to maybe re-write it, or possibly have to call that same operator in another way.

Currently i think it runs this, (when doing individual face extrusions):

Mesh_ops.c

ot = WM_operatortype_append_macro("MESH_OT_extrude_faces_move",
                                  "Extrude Individual Faces and Move",
                                  "Extrude each individual face separately along local normals",
                                  OPTYPE_UNDO | OPTYPE_REGISTER);
otmacro = WM_operatortype_macro_define(ot, "MESH_OT_extrude_faces_indiv");
otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_shrink_fatten");
RNA_boolean_set(otmacro->ptr, "use_proportional_edit", false);
RNA_boolean_set(otmacro->ptr, "mirror", false);

This is probably / technically another task.... but it would be awesome if we could have ALL Extrude Operators able to ACTUALLY Cancel.
Currently if you Hit Escape / Right Click, it will leave overlapped geometry behind, which is often not known to new users/can be annoying for existing users.

At first. I agree that partial undo confuses new users and produce manu trash geometry.
But I use move-escape much and there is simple solution to prevent duplication: autoweld.

So at one hand full undo will be much more clear and at another, it will break pipeline and it will need compensation

ATM I think, autoweld with very tiny threshold will deal with problem for newbies, but expirienced users will disable it in their startups.

This is probably / technically another task.... but it would be awesome if we could have ALL Extrude Operators able to ACTUALLY Cancel.
Currently if you Hit Escape / Right Click, it will leave overlapped geometry behind, which is often not known to new users/can be annoying for existing users.

At first. I agree that partial undo confuses new users and produce manu trash geometry.
But I use move-escape much and there is simple solution to prevent duplication: autoweld.

So at one hand full undo will be much more clear and at another, it will break pipeline and it will need compensation

ATM I think, autoweld with very tiny threshold will deal with problem for newbies, but expirienced users will disable it in their startups.

Well. If we had right click yet to stop the extrude but leave it overlapped. It’s same as it is now. But if we also setup escape to actually cancel , gives both options ?

But yeah, basically what I’m saying I guess is, some tools actually let you cancel for real, and others don’t. So is just confusing/ not consistent across the bmesh operators.

Or another way to see it is, if you couldn’t undo all actions in blender and only randomly undo some here and there.