ipygany icon indicating copy to clipboard operation
ipygany copied to clipboard

Scene not updated when changing an effect's input

Open benbovy opened this issue 5 years ago • 7 comments

(adapted from the notebook example in this repo):

In [2]: mesh2 = TetraMesh.from_vtk('piston.vtu')
   ...
   ...  iso2 = IsoColor(mesh2, input=('RESU____DEPL', 'DX'), min=-1.3931281e-06, max=1.3929895e-06)
   ...
   ...  scene2 = Scene([iso2])
In [3]: scene2

I'd like to change the isocolor input, e.g., from another notebook cell

In [4]: iso2.input = ('RESU____DEPL', 'DY')

But it has no effect on the scene that is already rendered in cell 3 output. To see the new input color I need to re-execute that cell.

Is it the normal behavior? I see that Effect.input is synchronized so I'd rather expect that changing it would update the scene(s) already shown in output cells.

benbovy avatar Sep 28 '20 11:09 benbovy

It looks like a bug indeed, thanks for reporting

martinRenou avatar Sep 28 '20 11:09 martinRenou

Hmm I've tracked the input change down to https://github.com/QuantStack/GanyJS/blob/ebfdea022ddf068b56d6d18b0707091d4d885809/src/NodeMesh.ts#L166 in GanyJS and everything seems to be updated properly. I don't know much three.js so I'm afraid I can't do more to tackle the issue here. In the meantime I've found a workaround for my use case.

benbovy avatar Sep 30 '20 07:09 benbovy

Thanks for tracking it down. I fear this is due to the ThreeJS update. I'll try to find time to fix this.

martinRenou avatar Sep 30 '20 07:09 martinRenou

Hi, I recently encountered this issue myself and was just curious about the workaround you (@benbovy) implemented?

For now I opted for clearing my output and re-creating it:

from IPython.display import clear_output, display

clear_output()
display(app)

Hopefully your workaround is slightly more elegant than mine :)

Krande avatar Aug 12 '21 13:08 Krande

@Krande my workaround is the same than yours 🙂

benbovy avatar Aug 12 '21 13:08 benbovy

😕 I need to find time to work on this

martinRenou avatar Aug 12 '21 13:08 martinRenou

No rush @martinRenou! That workaround is not ideal but it's only minor annoyance.

benbovy avatar Aug 12 '21 13:08 benbovy