zeffii / TubeTool

generate tubing between two selected polygons (now supports 2 objects simultaneously in edit mode) b2.8+
GNU General Public License v2.0
290 stars 28 forks source link

preliminary state #1

Closed zeffii closed 9 years ago

zeffii commented 9 years ago

This tool is a direct result of this post on Blender.StackExchange http://blender.stackexchange.com/questions/28190/a-problem-with-blenders-bridge-edge-loops-system

tldr; Maya user moving to Blender missing certain Bridging functionality not yet available in Blender.

I'm a modeller and I also like tubes and stuff, and can imagine some conveniences regarding the creation of Curve objects .

screenshot from 2015-04-07 16 30 33 screenshot from 2015-04-07 16 20 23

does:

does not yet:

zeffii commented 9 years ago

collection_reverse

toomanydemons commented 9 years ago

untitled-1

It works great! This is exactly what I needed. I predict Autodesk will die in the next ten years (they're doing away with perpetual licensing) and Blender is a good investment for time. This sort of curve tool should be in the core package.

This is fabulous work and may even be the most useful plugin i've found so far. I'm keeping my eye on your development of this and letting people know.

toomanydemons commented 9 years ago

I should also add I found a Blender Plugin called VisMaya that has a "freeze transforms" option. When I originally used your pipe-builder tool on my forklift robot, the curves spawned out of place in world space. But once I froze the transforms on the object, the curves spawned exactly where they should be. :)

zeffii commented 9 years ago

I will make it so you don't have to freeze transforms, just hadn't gotten around to it.. (really just one line of code... actually less code than this response is in character-length... )

zeffii commented 9 years ago

hmm. it may be more like 3 lines of code, to include the Curve width guesstimation relative to the object's world _matrix.

glad you find it useful. I'll be using it for future stuff too so am invested in getting it to work efficiently.

image

toomanydemons commented 9 years ago

That bike is awesome. This sort of tool should definitely be in any modeler's arsenal. It's a must for hard-surface. Do you have a gallery?

zeffii commented 9 years ago

http://blenderpython.tumblr.com/ is where I stick the shareable stuff, no real gallery though, but pages and pages of unrelated code / graphics.

toomanydemons commented 9 years ago

The only code I know is C# (game programming in Unity). Python is looking pretty essential at this point. Creating tools for modeling like this would be a handy skill to have. I look forward to the completion of this one :)

zeffii commented 9 years ago

Python is indeed worth investing time on, I find bpy quite tolerable to work with.

zeffii commented 9 years ago

i've pushed a minimal fix, this copies the matrix_world of the object you are working on, to the new curve.. so it should always match up. I think it's a sane solution.. update and let me know how it goes.

I think next i'll add an operator to place a circle with the correct orientation to align with a selected face, the circle shall be editable as the normal circle operator.

toomanydemons commented 9 years ago

I tested it on a few of my models and some different objects exported from maya, using faces of different sizes. It works fantastic. The curve instantiates exactly where it should be every single time.

This is my new favorite tool. I'm going to be using this a lot. Thanks. :+1:

zeffii commented 9 years ago

cool! BTW, I use space-bar instead of W, and then type tu and use the cursors to navigate to the Tube Tool operator. The next time you use space-bar, it will suggest the most recently triggered operator. I find this slightly more convenient.

toomanydemons commented 9 years ago

Thanks for the tip! There's something about the parameters that come with the curve. The 'num profile verts' adjustment seems to duplicate the curve dozens of times, and I can only scale it up, not down. It doesn't subidivide the curve (I assume it is supposed to work this way?). Instead it adds tons of curves to my outliner. The handle_ext_1 and 2 adjustments don't seem to do anything. Still, I can just adjust the curve in edit mode. I'm very happy with the tool. It has as much control as Maya's counterpart and may even be better (since I don't have to hunt the curve down in the outliner to adjust it and adjust the resolution separately in the attribute history).

zeffii commented 9 years ago

F6 is the shortcut to show the operator properties after triggering the operator ( you probably know, so I say this for the benefit of anyone reading)

The UI for the curve is not implemented yet (hence it is absolutely fucked). maybe today, i've been a little swamped.

zeffii commented 9 years ago

design document:

Operator UI shall have (ideally):

If the above properties work, i'd call that prototype 2, then the addon has most of the difficult (not hard, just slightly headwrecking) code in place for future improvements.

toomanydemons commented 9 years ago

That sounds very awesome! It's perfect. length and profile subdivisions. The extension ratio sounds like a very nice feature. I wouldn't be surprised if this addon makes it into the core package.

Aside from its width being set by the the selected polys, a width adjustment (the bevel depth setting in the curve tab) would be the cherry on top ;D I found I was using that setting often despite the preset width of the pipes.

Another tool you would love if you don't have it yet is QuickPipes. It draws the pipe along selected edges. In combination with this fun toy, i'm pretty sure I can model just about anything now :) Curves for pipes was such a hassle in the core package.

On Thu, Apr 9, 2015 at 11:48 PM, Dealga McArdle notifications@github.com wrote:

design document:

Operator UI shall have (ideally):

  • subdivisions over length of curve
  • subdivisions over profile (or choice to select profile)
  • extention ratio for the handles aligned with the face normals of the selected polygons

If the above properties work, i'd call that prototype 2, then the addon has most of the difficult (not hard, just slightly headwrecking) code in place for future improvements.

— Reply to this email directly or view it on GitHub https://github.com/zeffii/TubeTool/issues/1#issuecomment-91437519.

zeffii commented 9 years ago

A few python addons should be part of the core but aren't, the closest most will get is to be accepted into addons_contrib, which ships with the buildbot blender builds. I don't think most people care if an add-on ships with a release or not, people build a collection of addons and simply point new Blender releases at their custom scripts folder.

QuickPipes, yes i've seen it but not needed it

zeffii commented 9 years ago

regarding TubeTool: currently the profile radius for both ends is a function of the distance between the median of a polygon and the first vertex of the polygon, it might be more helpful if it is instead the average distance between the median and each vertex of the face.

I agree on the following parameters

But first focus on https://github.com/zeffii/TubeTool/issues/1#issuecomment-91437519 , getting it to that state is the least trivial, anything after than will be (most likely) easier.

toomanydemons commented 9 years ago

Sounds right to me. Scale factor for first and last bezier, I hadn't thought of that. For certain shapes/models it would be extremely useful. Typically in hard surface its all wires and pipes, but the ability to do that would be great for some designs.

zeffii commented 9 years ago

some progress ... not updated the master source yet junk-optimize

zeffii commented 9 years ago

( you can try the branch "modify_insitu" if you know how, else I will merge to master tomorrow... )

toomanydemons commented 9 years ago

just got ahold of your latest upload. you're really truckin' along :+1:

zeffii commented 9 years ago

yeah, just merged a few minutes ago. I don't know how the tool works in maya, and definitely don't want to clone tools just for the sake of it, so i'll discuss the options here. It's a

code economy vs UI slickness

The one thing that currently bugs me a little is that a user won't be able to know (easily) before dragging handle_ext_1 / 2 which endpoint that handle refers to. For me this isn't a big deal, but it would be nicer UX to know which is which before touching the slider. There's a feature in the API that can return the order in which faces have been selected, i'll probably use that to assign the handles.

Some options are to

  1. include some vicinity checking code, so the mouse cursor when over f.ex the first polygon and click-dragged could extend that handle (without leaving edit mode for the main object)
  2. alternatively, draw greasepencil extender lines with two different colours to indicate ext_1 and ext_2 (colourblind friendly, or user definable)
  3. go mental with BGL and BLF module (drawing custom openGL info)

For now the development won't include any of those. prototype 3 shall include the details mentioned earlier, so at least it functions and is useful.

toomanydemons commented 9 years ago

I don't think it's too big a deal. I played with the handle options for 1 and 2 and all it took was a ctrl+z tap in between toying with the floats. I didn't even consciously notice. But I suppose if you're a perfectionist you'll want your tool to be perfect... lolol.

The tool in Maya comes with floats to control subdivisions. The length and angle of the pipe determines the number of subdivisions in the curve which can be manipluated in component mode. Maya curves don't come with tangent handles though, just vertex points that are adjusted with the move tool.

So far you are 1-up on the maya tool in terms of control, and almost as fast. For basic set-up what you have now is just fine. Odds are the user will want to subdivide the curve and tweak the tangents anyway.

toomanydemons commented 9 years ago

"almost as fast", I take that back. Maya's pipe curve is pretty fast, but your tool is equal I think. In maya you can't select the curve except in the outliner, and you have to set the adjustments before you make the curve, or go into the history (which is a serious pain in the ass sometimes) and find the tab that has the curve options. It's either that or go into a mountain of tabs in the surfaces menu and locate the option to subdivide the curve.

Maya hotkeys are nearly nonexistent. rofl. It's all tabs and icons. On that note, what makes Maya fast is the advanced user who knows where everything is and has assigned his own hotkeys and icons (and a mountain of plugins). In truth, modeling in Maya is blazing fast (contrary to popular belief). I'm happy to be able to get good speed in Blender :)

zeffii commented 9 years ago

The operator should run in Modal mode until a different selection is made or some other operator is triggered.

While the operator is running Modal all properties of the Curve are pretty much adjustable, but only this limited set has been exposed through my current code. I'd like to keep the modal UI limited, as you say : it's easy (and maybe desirable) to enter edit_mode of the Curve and adjust the parameters from the panel. So I'll focus mostly on exposing features which are not standard to the Curve panel.

I think it's irregular in Blender to be able to edit a new Object while an existing Object is still in _editmode, but whatever. Convenience > Convention (imho)

zeffii commented 9 years ago

further discussion happens here: https://github.com/zeffii/TubeTool/issues/4