The right way to Hide / Disable objects

I am currently working on a project with a character that has about 10-20 different clothing accessory that can be cycled through. Only 1 is shown at a time.
They are all sharing an armature and each have an armature modifier.
Initially I set it up so my script would just “.visible = True/False” on each item to hide and show them.
However I found that performance began to suffer as I added more clothes. I assume the Armature modifier is still processing the meshes in the background and after testing this theory with a really dense mesh I think this was correct.
despite the mesh being set to .visible = False the project was super slow

So I tried Suspending the collections using the Collection Actuator. but the result is the same. Despite the mesh not being on screen and even the collection being “Suspended” the meshes armature modifier is still being processes.

It’s not as bad as if the mesh is visible but there is still a measurable impact to the frame rate.

Does anyone know the solution to this, how would I go about truly “Disabling” an asset when needed?

Here’s a snippet of the code, really the main part of interest will be right at the end. “scene.objects[str(currentassetname)].visible = True”

def CycleAsset(direction, assetlist):
	assetlistlen = len(assetlist)
    #Set all assets in the list to invisible
	for asset in assetlist:
		scene.objects[str(asset)].visible = False
    #direction controlas next asset or previous asset
	bl.AccessoryIteration += direction
    #loop if end or begining of list
	if bl.AccessoryIteration > assetlistlen -1:
		bl.AccessoryIteration =	 0
	elif bl.AccessoryIteration < 0:
		bl.AccessoryIteration = assetlistlen -1
    #get asset and make invisible
	currentassetname = assetlist[bl.AccessoryIteration]
	scene.objects[str(currentassetname)].visible = True

A few optrions:

option 1: visibility toggle - only stops it’s visual render
option 2: add/remove the objects - you add the object and kill the object when not needed
option 3: changeMesh() - you have 1 mesh that gets changed into an other one when switching
option 4: libload/libfree - loads the object from an other blend and with libfree you remove the objects completely, untill you libload them in again.

additional option would be:
To suspendPhysics() on the objects

1 Like

Thanks I’ll do some more research and give some of those a go.