RESOLVED: Replicator Callbacks - onRemoveReplicant

When calling replicant.digits inside onRemoveReplicant I always get the last index, not the index of the replicant that is actually being destroyed. this is probably because you are calling this callback after reordering the list, how the hell am I supposed to know what was the index of that replicant?
Please fix this, call this function sooner or add an argument like replicantIndex.

Cheers

@ItayGal can you give a little more context to your workflow?

For example in this example:
base_remove_replicant.tox (2.2 KB)

I think I’m seeing consistent results with respect to which replicant is being deleted. Flipping the index on the switch DAT will add / remove replicants based on the results in the select DAT:

This looks to correctly report both attributes from the replicant destroyed along with the digits from that replicant:

def onRemoveReplicant(comp, replicant):
	print(replicant.par.file, replicant.digits)
	replicant.destroy()
	return

Is there a way to reproduce the issue you’re seeing so it’s easier to track down what’s going wrong?

Hi raganmg,

Here is an example tox:
replicantDestoryBug.tox (1.4 KB)

use the custom parameters page, press kill2 and the index of replicant being killed is always last.
I now get it, you are always deleting last instance and values are automatically updated.
I was expecting that the instance correlating to the deleted row will be destroyed but off course it is easier (and maybe faster in some cases) to kill the last instance.

Since I need to know the index in my project I’ll just add an index parameter to master op.

Thanks,
Itay.