wiremas / spore

paintable particle node for Maya
MIT License
80 stars 29 forks source link

Remove tool breaking - InstanceData is out of sync #4

Open mkolar opened 6 years ago

mkolar commented 6 years ago

Hey.

In some spores, when we want to use the remove button we get the following error:

# Traceback (most recent call last):
#   File "K:/core/software/maya/spore/plug-ins\scripted\spore_context.py", line 1302, in clicked
#     self.tool_cmd.doIt()
#   File "K:/core/software/maya/spore/plug-ins\scripted\spore_context.py", line 182, in doIt
#     self.change_visibility(flag, 0)
#   File "K:/core/software/maya/spore/plug-ins\scripted\spore_context.py", line 676, in change_visibility
#     old_vis = self.instance_data.visibility[index]
#   File "S:\Maya_2018_DI\build\Release\runTime\Python\Lib\site-packages\maya\OpenMaya.py", line 13619, in __getitem__
# IndexError: list index out of range

In the same scene when saving the scene this pops up

100
100
100
51
100
100
100
100
100
100
100
100
// Error: instance_data : Cleanup operation failed, Instance Data is out of sync. // 
// scripted.spore_context : Spore Context clean up // 
file -save;
// Result: P:/path/to/scene/scene.ma // 
// Error: instance_data : InstanceData validation failed! // 

There is 100 instances in this spore so one of those assert (the visibility one) seems to be off, but I can't figure out why.

Here's a link to a cleaned up scene where this is happening. http://bit.ly/spore_remove_bug

Unfortunately it's a little bit random, so we can't get a reproducible from just a few steps. Hope this is enough to find out what's going on.

Thanks

wiremas commented 6 years ago

hard to tell what went wrong here. some bug has caused the instance data to get out of sync. unfortunately, the traceback does not help much why this happend. I also can't reproduce the issue. Maybe you can give more information on reproducing this behavior once it happens again.

meanwhile i've written a hotfix that tries to repair the instance data once it got out of sync. i've tried it with the scene you've provided and it seems that it solves the problem. however this solution is not really ideal for two reasons:

  1. some of the internal data actually can't be repaired (e.g. position, scale, rotation, etc.)
  2. the data that can be repaired (like visibility in this case) will be reset to a default value. hence points deleted by the last operation will be restored.
mkolar commented 6 years ago

interesting. we'll keep an eye on when exactly this starts happening and try to isolate it better. I think we only experienced it with the visibility so far, so the hotfix will actually help. Having to re-delete some points is better than having to throw away the full node :).