0

Since Blender 2.93 hair system not support curves anymore, I have to convert them to meshes.

Trying to replace bpy.ops.object.convert(target='MESH')

with obj.to_mesh() function. but, It is not able to keep attributes like the ops option can.

any ideas? thanks

import bpy

try : hair_colection = bpy.data.collections['Hairs'] hairs_objects = hair_colection.all_objects

for hair in hairs_objects:
    if hair.type == 'CURVE':
        hair.select_set(True)
        bpy.context.view_layer.objects.active = hair
        bpy.ops.object.convert(target='MESH')
        print (hair,hair.type)

except: print( "no hairs collection")

barakooda
  • 183
  • 7
  • Hello, could you elaborate on which attributes are lost in the process ? – Gorgious Jan 26 '22 at 14:53
  • 2
    And why do you not want to use the operator ? Have you seen this q&a ? https://blender.stackexchange.com/a/146911/86891 – Gorgious Jan 26 '22 at 14:57
  • Might also be that the context is not initialized yet. Use a timer to wait for a little bit before executing the logic eg https://blenderartists.org/t/run-text-data-block-from-command-line-post-context/1356926 – Gorgious Jan 26 '22 at 16:55

0 Answers0