Page MenuHome

'Select Similar' for the UV Editor
Open, NormalPublic

Description

Benefits: Artists can more easily isolate parts of the UV map to operate on, using a selection method they will already be families with from other parts of Blender.

Description: With this option you could select UV's based on characteristics of the mesh, eg:

  • Material
  • Face Area
  • UV Area
  • Polygon Sides
  • Pinned State

... possibly other options too, note that a subset of these can be accepted for the initial patch.

See mesh edit-mode, Select Grouped (Shift-G).

Challenges: adding key binding, operator and evaluating/comparing mesh data.

Details

Differential Revisions
D2738: Basic Select Similar tool for UV faces
Type
To Do

Event Timeline

Campbell Barton (campbellbarton) renamed this task from Select similar for the UV Editor to 'Select Similar' for the UV Editor.Feb 16 2016, 7:55 PM

Is this task completed?
I would like to try this.

What's the status on this? Can I try it?

Yes (no need to ask, any open quick-hack is a candidate to try).

Cool, thanks! I have used blender for a while and know C++, but I am new to blender development - any pointers on how to do this? Mostly I am having trouble navigating the rather large codebase, so any advice would be greatly appreciated.

I had worked on this a couple of weeks ago. I updated my version to current master (D4792).

@Campbell Barton (campbellbarton) Could you have a look at D4792 to determine whether this approach could serve @Kalyan (coder.kalyan) as a basis?

@matc (matc) Thanks for the diff, I'll take a look at it when I have time and try to implement this task.

Quick question - where does the 2.8 codebase store keymaps? I've looked at some old diffs but they seem to be outdated. There's some code regarding window managers and keymaps, but where can I define custom keymaps for a space/editor?

Keymaps appear to be in release/scripts/presets/keyconfig/keymap_data/.

I don't think you do have to change any key bindings. I usually just use the operator search menu (Space or F3) to run an operator.

Ahh finally I have some time to work on this! I've implemented @matc (matc)'s patch (D4792) as well as adding the Shift-G keybind for consistency (turned out to be very simple once I figured out how the keymaps worked). Unfortunately, I don't have enough Blender internal/general knowledge to know the inner workings of kdtrees, gsets, etc... does anyone have any pointers on how to extend D4792 to edge and vertex select?

I don't like asking for step by step guidance like this - I'm sure others have work to do, but I really have no idea how to go about anything in this multi-million line codebase.

Gset is just the equivalent to a set in C++ or Java. You can find the implementation in BLI_ghash.c by looking for the BLI_gset_ prefix.

From wikipedia: "In computer science, a k-d tree (short for k-dimensional tree) is a space-partitioning data structure for organizing points in a k-dimensional space."
The implementation of kdtree is in kdtree_impl.h.

I don't think you have to worry all that much about those. In each case you will just be using for example the length of an edge measured in uv space instead of mesh space. The collections should not need to be changed.

Essentially all functions in D4792 exist for vertices and edges too. Their names should be the same with "face" replaced by "vert" or "edge".

As a start I suggest to modify similar_edge_select_exec to optionally make the selection in uv editor instead of the viewport.
Basically make the following code work with edges.

if (select) {
  if (selection_mode == SIM_DATA_MODE_MESH) {
    BM_face_select_set(bm, face, true);
  }
  else {
    uvedit_face_select_enable(scene, em, face, true, cd_loop_uv_offset);
  }
  changed = true;
}

Ok I have a preliminary diff working on edge direction and length select (see D5108). It adds on to @matc (matc)'s D4792. I would love to get feedback on this diff!