Skip to main content
deleted 19 characters in body
Source Link
Robin Betts
  • 79.9k
  • 10
  • 85
  • 211

How about something along these lines?

import bpy scn = bpy.context.scene cols = scn.collection.children sorted_cols = sorted (cols, key = lambda c: c.name.lower()) for col in sorted_cols: dup = col cols.unlink(col) cols.link(dupcol) 

There may be problems with it.. I haven't covered all the bases, and you may want to do it recursively, etc..?

How about something along these lines?

import bpy scn = bpy.context.scene cols = scn.collection.children sorted_cols = sorted (cols, key = lambda c: c.name.lower()) for col in sorted_cols: dup = col cols.unlink(col) cols.link(dup) 

There may be problems with it.. I haven't covered all the bases, and you may want to do it recursively, etc..?

How about something along these lines?

import bpy scn = bpy.context.scene cols = scn.collection.children sorted_cols = sorted (cols, key = lambda c: c.name.lower()) for col in sorted_cols: cols.unlink(col) cols.link(col) 

There may be problems with it.. I haven't covered all the bases, and you may want to do it recursively, etc..?

deleted 53 characters in body
Source Link
Robin Betts
  • 79.9k
  • 10
  • 85
  • 211

How about something along these lines?

import bpy scn = bpy.context.scene cols = scn.collection.children sorted_cols = sorted (cols, key = lambda c: c.name.lower()) for col in sorted_cols: nm = col.name dup = col.copy() cols.unlink(col) dup.name = nm cols.link(dup) 

There may be problems with it.. I haven't covered all the bases, and you may want to do it recursively, etc..?

How about something along these lines?

import bpy scn = bpy.context.scene cols = scn.collection.children sorted_cols = sorted (cols, key = lambda c: c.name.lower()) for col in sorted_cols: nm = col.name dup = col.copy() cols.unlink(col) dup.name = nm cols.link(dup) 

There may be problems with it.. I haven't covered all the bases, and you may want to do it recursively, etc..?

How about something along these lines?

import bpy scn = bpy.context.scene cols = scn.collection.children sorted_cols = sorted (cols, key = lambda c: c.name.lower()) for col in sorted_cols: dup = col cols.unlink(col) cols.link(dup) 

There may be problems with it.. I haven't covered all the bases, and you may want to do it recursively, etc..?

Source Link
Robin Betts
  • 79.9k
  • 10
  • 85
  • 211

How about something along these lines?

import bpy scn = bpy.context.scene cols = scn.collection.children sorted_cols = sorted (cols, key = lambda c: c.name.lower()) for col in sorted_cols: nm = col.name dup = col.copy() cols.unlink(col) dup.name = nm cols.link(dup) 

There may be problems with it.. I haven't covered all the bases, and you may want to do it recursively, etc..?