1
$\begingroup$

diagram of sorting order

Not sure if Blender has a built in mechanism that "knows" the order the user selects Objects in 3D view or Components by Index.

I wanted to achieve this using Python for later usage incorporated into node in Sverchok or Animation Nodes.

$\endgroup$
2
$\begingroup$

bmesh records (or provides access to) the selection history of a mesh.

import bpy
import bmesh

obj = bpy.context.object

if obj.mode == 'EDIT':
    bm = bmesh.from_edit_mesh(obj.data)
elif obj.mode == 'OBJECT':
    bm = bmesh.new()
    bm.from_mesh(obj.data)

for i in bm.select_history:
    print(type(i),i.index)

Notice the use of type() as the history list can contain verts, edges and faces at the same time and in any order.

$\endgroup$
  • $\begingroup$ Thanks for this answer. Works really well when I select the component one by one using RMB click. But when I use C and draw select, it does not quite work. Is there a work around? $\endgroup$ – Blender Sushi Guy Apr 16 '17 at 11:36
  • $\begingroup$ Seems it only works with manual selection, any other selection method fails to add to the history, though deselecting always removes items. I would consider that a bug. $\endgroup$ – sambler Apr 17 '17 at 1:50
0
$\begingroup$

enter image description here

Based on Python from @sambler above I tested and use Sverchok nodes to re-order the index of Polygon Face.

$\endgroup$
  • 4
    $\begingroup$ Answers are for answers to the original question only, not to post updates on how well another answer worked. $\endgroup$ – Ray Mairlot Apr 16 '17 at 11:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.