DragonFF icon indicating copy to clipboard operation
DragonFF copied to clipboard

export col with auto bound only from OBJ mesh for LOD

Open NaufalFajri opened this issue 9 months ago • 2 comments

need this thing for far distance object don't want use manual to each collection

also remove suffix .dff on collision object name thank

NaufalFajri avatar May 10 '25 01:05 NaufalFajri

I don't think this should be part of DragonFF, but you can use a script like this:

import bpy

def find_layer_collection(layer_coll, target_coll):
    for layer in layer_coll.children:
        if layer.collection == target_coll:
            return layer

        result = find_layer_collection(layer, target_coll)
        if result:
            return result

    return None

context = bpy.context

objects = [obj for obj in context.scene.objects if obj.dff.type == 'OBJ']
collections = {obj.users_collection[0] for obj in objects}

for obj in objects:
	obj.dff.type = 'COL'

for coll in collections:
	context.view_layer.active_layer_collection = find_layer_collection(context.view_layer.layer_collection, coll)
	coll.dff.auto_bounds = False
	bpy.ops.collection.dff_generate_bounds('INVOKE_DEFAULT')

for obj in objects:
	obj.dff.type = 'OBJ'

Psycrow101 avatar Jul 05 '25 13:07 Psycrow101

maybe need? it used on map testing / LOD export option (mean don't export collision mesh, only auto bound box)

NaufalFajri avatar Jul 05 '25 13:07 NaufalFajri