/MeshLint/ - "Like a Spell-Checker for your Meshes"

(Note: BMesh only! Maybe try a Trunk build from here until 2.63 is out: http://builder.blender.org/download/ )

https://github.com/ryanjosephking/meshlint/raw/master/img/logo-suzanne.png
A Blender Addon to help you keep your meshes clean and lint-free.

https://github.com/ryanjosephking/meshlint/raw/master/img/messed-up-mesh.png

Can check for:

  • Tris: Evil.
  • Ngons: Also pretty bad.
  • Nonmanifold Elements: Stray Verts and Edges that have < or > than 2 faces.
  • Interior Faces: Faces spanning inside the mesh that cause confusing effects with Subsurf and Edge Loops. By the Blender definition, this is only true for a face if absolutely none of its edges are connected to <= 2 faces.
  • 6±Poles: Verts with 6 or more edges (check disabled by default, because some meshes legitimately have these).
  • Default Names (like Cube.002)
  • Unapplied Scale (remember that Ctrl+a,s This causes so many problems I don’t even plan on making it an optional warning. If you have a selection that includes an object with an Unapplied Scale, you’ll hear about it from MeshLint)
  • …can you think of more? We’ll add them!

So if you click Select Lint, in Object or Edit Modes, it will set your current selection to all elements that fail the enabled checks. A good thing to do if you are having trouble finding pieces is to hit Numpad ‘.’, which will center the 3D Viewport on the problems. You might have to do this iteratively with border selects and Middle Mouse Button to deselect the elements you already know about.

https://github.com/ryanjosephking/meshlint/raw/master/img/infobar.png

Also, you can enable Continuous Check, which is a huge aspect to this. It is good for cases where you think you won’t be creating any new problem geometry. Whenever something goes wrong, the Info Bar at the top will display a message describing what MeshLint found. Also, you will notice the counts are updated.

Furthermore, it works on the whole selection (but starting with the Active Object). So you can quickly check your entire scene with a to Select All and then click Select Lint. The checker will stop on the first found bit of lint, and throw you into Edit Mode so you can see it.

And finally, it now has a Deselect all Lint-free Objects button. This is a process improvement for the “whole scene” checks, allowing you to see a better overview.

Getting

Best way is to:
git clone [email protected]:ryanjosephking/meshlint.git That way, you can git pull later on and it will automatically refresh to the latest (theoretically-)good version.

But I realize that not everyone has git or an operating system capable of symlinking.

So, for those that can’t: You can simply download the meshlint.py script directly. (And re-visit that URL for the newest version, later on.)

Installing

The super-awesome way is to directly symlink meshlint.py into your Blender Addons Dir. The advantage is that the previous section’s git pull will download the newest version automatically. But not everyone can be expected to be superawesome all the time, so continue on:

https://github.com/ryanjosephking/meshlint/raw/master/img/install-addon.png

Hit Ctrl+Alt+u to load up the User Preferences (I always use the keystroke for this because of the occasional time where you miss, using the File menu, and click Save User Settings. Click the Install Addon… button at the bottom, then navigate to your meshlint.py script.

https://github.com/ryanjosephking/meshlint/raw/master/img/enable-checkbox.png

Next, and this is a tricky bit, if you’re not used to installing Addons: you have to follow up by checking this little box on the right of the Addon entry in the list. If, for some reason, you have a hard time finding it, you can search for MeshLint or click on the Mesh button on the left. Hopefully, though, it comes right up when you do Install Addon…

If you want to keep MeshLint available (and who wouldn’t?), follow the above steps on a fresh .blend (one you Ctrl+nd), then hit Ctrl+u at this point. The next time you run Blender you won’t have to repeat the above.

https://github.com/ryanjosephking/meshlint/raw/master/img/where-is-it.png

When installed, it will add a new Subpanel to the bottom of the Object Data properties (the button in the Properties Editor that looks like the inverted triangle).

Going Further

We really want to make this a top-grade Addon. This will take a bit of debugging and brainstorming, both. There’s a spot right below this text for a “Thanks”, for users who give such feedback.
[email protected]

Thanks

  • taniwha / Bill Currie - For being part of the original idea and for Alpha and Beta testing.
  • endikos / William Knechtel - For also being an idea guy and tester, and for being a great Brother in the Lord, anyway.
  • lsmft / Kevin Wood - For being a premeir Beta tester, complete with a UI improvement mockup, and also for providing the hardware that was used to write it. (!)
  • moth3r / Ivan Šantić - For being one of the most enthusiastic Blenderers I ever met, and for testing/feedback, too.
  • @encn - For the idea about “Deselect all Lint-free Objects”, plus others.

I’d appreciate any feedback you guys might have. Sounds like it’s about to hit BlenderNation, soon!
-rking

I have looked for and wondered about this useful function in Blender for awhile now. Thank you all for putting it together and making it available. I use a similar tool in other 3D programs to help keep meshes clean. Thank you once again. Hopefully it will be part of the standard package in the near future???
Paul

Neat script. Saves time having to check these elements individually through the ‘Select’ menu. Although, I don’t think one can track down poles via the Select menu unless one already has a similar construct selected.

Maybe for completeness you could also check for loose edges / verts , disparate facing normals, and intersecting / concave polygons.

Thanks for your efforts.

paulhart2: Thanks! Yep, I’ll take the steps necessary to get the attention of the devs, and hopefully see it at least in the addons_contrib/ section before too long.

aomeoni: Yep, the Select menu actually has several of these things, and some of them are new with BMesh. But the point of the script is to automate those checks… for example, with MeshLint you can select all objects with ‘a’ then click “Select Lint” to check them all. That would be very tedious with the “Select” menu for each aspect.

But yes, it checks for “loose edges / verts” – that’s the Nonmanifold Elements check. Disparate facing normals, we talked about – but the problem is that not even Ctrl+n can always get it right, so I don’t know of a good solution. The intersecting polygons is on the long-term TODO list, though I fear the algorithm might be rather expensive (and a bit hard to debug). Finally, concave polygons – I didn’t think of that. It’s a very interesting idea. Perhaps it should even have a “coplanar” check which will show you quads/ngons that are not 100% coplanar? Good idea, will consider it.

Thanks, guys!
-rking

Yup. Very tedious. That’s why this script is so neat. I’m putting it in my ‘must have’ toolbox. Been using it on downloaded meshes of questionable quality. [ As mine are always perfect you understand… :wink: ]

Regarding loose bits and nonmanifold… The suggestion for a separate check is due to the fact that sometimes one wants to have split edges in one’s mesh [ to retain sharpness when exporting to a game engine for instance ] and the nonmanifold selection option of the MeshLint script includes intentionally split edges and thereby occludes the location of any stray loose edges or verts that one may otherwise be unaware of.

Hunting down disparate face normals could operate by iterating through how many normals are front facing and how many are back facing. The polys belonging to the group with the lowest number of members would be considered to be disparate and therefore selected [selectable]. It’s not meant to resolve the issue just hi-light a difference of normal direction.

And I’m all for co-planar checking !

Nice. Would a ‘Tricount’ option be possible? It’s the amount of tris after triangulating the whole mesh.

Wonderful! This is super-valuable, especially this early in the process of Blenderheads getting used to ngons. Should definitely be in the first wave of trunked Bmesh-boosters in 2.64 (unless that release is “hardcore Mango all the time” or something).

Here’s some feedback, just based on some very basic experimentation.

UI:
I know there’s a lot of bitching about putting stuff in the T/N panels, but having a general-purpose tool under Object Data just adds to the confusion for me. It also disables the tools in any layout that doesn’t have a Properties-panel open, like modeling in a maximised 3d-view.
But I know there’s a lot of different well-reasoned points of view regarding this, it’d be interesting to hear yours. I won’t argue beyond the points above, I dont’ intend to start “one of those UI discussions”:stuck_out_tongue:

The checkboxes are confusing… I read an unchecked “Don’t check Tris”-checkbox as “DO check Tris”. Just have it say “Check tris” all the time.

Some additional options I’d like to see, in order of importance and ontopic-ness for your concept:

*Skip to next object (maybe even back) in an object mode multi-selection.

*Run through all selected objects, de-select the ones found lint-free. Or de-select the problem-objects, if the user for example wants to hide the good ones

*Check arbitrary *gon/pole values. This would add a lot of value for surveying tolopogy in general, not just technically bad stuff. And cases where… someone is OK with 5-sided ngons, for example, but wants to clear out anything else.

*A check if Mesh name matches Object name. And… I appreciate this as a pure search/check tool, but I’ve always wanted a magic renaming button for that case:P

aomeoni: Re: Loose Bits - Can you maybe upload a .blend that demonstrates the kind of split elements you want to be OK with, along with the ones you still want to check for? Also, I’ll add the Normals and Co-planar stuff to the TODO list.

PLyczkowski: Tricount - Hrm… I am not 100% sure it’s within the scope of the tool. It isn’t about mesh statistics as much as it is about mesh /problem/ statistics. If you can sell me on the idea I’ll think about it. Maybe it should have a stats block just for the heck of it?

encn: The T/N panels thing is a real problem, yes. Originally I did have it in the N-panel, but I didn’t like it when I went to use it, because I found it unstable in location – I’d want to go look at some other part of the panel, then I’d lose my view of the Linteroo. Something that might help here (such as in the case of a maximized 3D View) is the “Continuous Check” mode. If you have the Play button pressed, it will notifiy you up in the Info bar.

I updated the double-negative “Don’t check” thing. You are actually the 2nd person to say that, so I know I was wrong, before.

Regarding skip to next object… the intention at this point is to simply let the Selection manage that. If you select all then it stops on something that you later decide is OK, simply hit Tab, Shift+RMB the offender, then click “Select Lint” again. Does this help?

Now then, your idea bout “Deselect lint-free” is pretty reasonable. Keep in mind that I only added the ability to work with multiple objects four days ago – so you will probably be able to figure out some process optimizations like that. I’ll add this to the TODO list, though I am not completely sure how its UI should work. Maybe have a button that only shows up when multiple objects are selected that says “Deselect Lint-free Objects”?

Checking arbitrary ngon/poles is maybe a good idea. Keep in mind that you can already be in Vertex Select mode, select a pole, and do Shift+g > Amount of Adjacent Faces. This is very fast and it’s an intuitive UI - select whatever type of pole you want to highlight. Can you help me see the case where someone would be OK with 5-gons but not 6±gons?

Regarding the Object Data name matches Object name, I agree that this is something I sometimes want. It can help you sort out what is what. When it is me doing it, I type out something like this in the Python console:

for o in bpy.context.selected_objects: o.data.name = o.name

(By the way - if you have any Empty’s selected, it will fail, because their .data is a “None”.)

Granted, this is somewhat inconvenient, especially for people uncomfortable with bpy. Still, I am concerned that the use case is basically only for picky people like me, while at the expense of the sleekness of the UI for people who are only trying to find problems with the model. I am not sure.

Thanks for the feedback, fellas!
-rking

This rocks!

I approve of this addon.

encn: I decided that your idea for “Deselect all Lint-Free Objects” was pretty solid, and implemented it. If you check the latest code from github it should be working.

It doesn’t clutter up the interface, but it clearly provides a useful workflow.

Thanks a bunch!

-rking

Thanks for this tool Rking! After playing with Bmesh, I really wanted a tool to check for ngons.

“Deselect all Lint-free Objects” works great! Can’t think of any improvement over that single magic button.

For those not used to install-addons, you should probably mention that you need to re-install to update, not just replace the original download. I forgot about it myself for a moment, and I think I’ve seen it pop up in other install-script threads.

Testing the script in some of my actual scenes… I agree with aomeoni about non-manifolds.
I often have “open borders” in my models for various reasons, but I very much want to hunt down any “interior walls”. Technically… I guess I want to distinguish between non-manifolds where edges connect to 1 vs 3+ faces. A good example: Mirrored models!

Some more suggestions to the pile:
1.
Enable the Continous Check button in Object Mode, and have it detect errors in the active object without entering Edit Mode. This would make it much more convenient to “browse” for errors, but be compatible with any selection method the user prefers. If it was a choice, I’d prefer it over a next/previous feature.
There’s a “nice trick” version available by double-tapping tab between selections, with Continous Check enabled. But it’s a lot of extra button-tapping, less than obvious, and I can imagine some situations where the user would prefer to involve Edit Mode as little as possible… because the models are super-heavy or something.

Using the Continous Check button is just a random UI-suggestion, of course. It slightly bugs me that the “checking” can’t be disabled without entering Edit Mode, even if it currently doesn’t do anything in Object Mode.

A convenient luxury thing: Something to make it easier to Select Lint by a single parameter. Maybe just a “check/uncheck all” button. Or maybe something like this
(which could easily snowball into weirdness with those other requests… manifold options, arbitrary values etc. but yeah yeah):

I just get a sense there’d be a lot of frantic box-clicking in some troubleshooting situations, and I always appreciate UIs that alleviate that. In this case, I especially think optimal parameters for “object mode survey”/“edit mode lint-select” are quite different.

But I’ll un-request auto-rename. I agree it wouldn’t feel entirely at home here - I’d prefer to see it as a part of some Outliner- or general housecleaning addon. I should have asked around for a code snippet like that earlier… bringing it out when organizing the scene isn’t that much of a bother, even if the coding console is a bit scary. Thanks!

suuuuuuper useful! thank you for sharing!

also, the GIT repository is a welcome feature!

This is fantastic :slight_smile:

Just saved me a few hours of hunting for the non-manifold element mudbox was angry about.

And insulted my meshes name all-in-one. What a deal!

great!!Thank you for this great script!!!

This is great! Thanks for the good work.

A small feature request would be a button to select each type of lint. For example, select all NGons, or all Tris. Rather than selecting all lint.

Jonny Dubbz!

Your vids emphasizing Quad modeling are definitely near the root of why MeshLint even exists.

So, re: the feature request - You can deselect checks by clicking the “Toggle” boxes at the bottom of the UI. Some people have kicked around the idea of adding a “Toggle All” button, which might be nice. I’ve been focusing on getting €mployment, so I haven’t had much time to focus on niceties like that. For now users will have to manually click!

And:

Version 1.0 is Out!

I fixed what I considered a big bug about the way it looks/acts when you do “Select Lint”, and it’s now good enough that I’m throwing it into 1.0 mode.

-rking
[P.S.: v1.1 will be the one that doesn’t consider mirror-plane verts nonmanifest. Not sure when I’ll write that part.]