Untitled

 avatar
unknown
python
a year ago
1.3 kB
7
Indexable
import bpy

# Obje vertex sayısını döndüren fonksiyon
def get_vertex_count(obj):
    return len(obj.data.vertices)

# Obje gizli mi kontrol eden fonksiyon
def is_hidden(obj):
    return obj.hide_viewport or any([col.hide_viewport for col in obj.users_collection])

# Tüm objeleri vertex sayılarına göre gruplayan fonksiyon
def group_by_vertex_count():
    vertex_count_dict = {}
    for obj in bpy.data.objects:
        if obj.type == 'MESH' and not is_hidden(obj):  # Gizli objeleri atla
            v_count = get_vertex_count(obj)
            if v_count in vertex_count_dict:
                vertex_count_dict[v_count].append(obj)
            else:
                vertex_count_dict[v_count] = [obj]
    return vertex_count_dict

# İlk elemanın value değerlerindeki objeleri seçen fonksiyon
def select_first_vertex_count_group():
    vertex_count_dict = group_by_vertex_count()
    bpy.ops.object.select_all(action='DESELECT')  # Önce tüm seçimleri kaldır
    if vertex_count_dict:
        first_key = next(iter(vertex_count_dict))  # İlk anahtarı al
        first_group = vertex_count_dict[first_key]  # İlk grubun objelerini al
        for obj in first_group:
            obj.select_set(True)

# Scripti çalıştır
select_first_vertex_count_group()
Editor is loading...
Leave a Comment