Skip to content

Commit cc7f93f

Browse files
authored
Merge pull request #383 from vidartf/ipyw8
Fix shadowMap interactive use + renderer props update + deprecations
2 parents 33a8aaf + b8537f0 commit cc7f93f

File tree

12 files changed

+12
-37
lines changed

12 files changed

+12
-37
lines changed

examples/Examples.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@
185185
"size = int(32) # size of image\n",
186186
"im = np.zeros((size,size)) # create zero image\n",
187187
"points = size*np.random.random((2, n**2)) # locations of seed values\n",
188-
"im[(points[0]).astype(np.int), (points[1]).astype(np.int)] = size # seed high values\n",
188+
"im[(points[0]).astype(np.int32), (points[1]).astype(np.int32)] = size # seed high values\n",
189189
"im = ndimage.gaussian_filter(im, sigma=size/(float(4)*n)) # smooth high values into surrounding areas\n",
190190
"im *= 1/np.max(im)# rescale to be in the range [0,1]\n",
191191
"rgba_im = img_as_ubyte(jet(im)) # convert the values to rgba image using the jet colormap\n",

examples/Picker.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@
224224
"scene.add(hover_point)\n",
225225
"\n",
226226
"# Have sphere follow picker point:\n",
227-
"jslink((hover_point, 'position'), (hover_picker, 'point'))"
227+
"jslink((hover_point, 'position'), (hover_picker, 'point'));"
228228
]
229229
},
230230
{
@@ -254,7 +254,7 @@
254254
"cell_type": "markdown",
255255
"metadata": {},
256256
"source": [
257-
"Next, we set up a picker for when the user double clikcs on the surface. This should trigger the execution and visualization of the alogrithm."
257+
"Finally, we set up a picker for when the user double clikcs on the surface. This should trigger the execution and visualization of the alogrithm."
258258
]
259259
},
260260
{

examples/Shadows.ipynb

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@
244244
"cell_type": "markdown",
245245
"metadata": {},
246246
"source": [
247-
"Here, we can see that there is some pixelation of the shadows (although it is smoothed by using `PCFSoftShadowMap`). This can be fixed by increasing the resolution of the shadow map:"
247+
"Here, we can see that there is some pixelation of the shadows (although it is smoothed by using `PCFSoftShadowMap`). This can be adjusted by increasing the resolution of the shadow map:"
248248
]
249249
},
250250
{

examples/superellipsoid.ipynb

+2-2
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@
114114
"outputs": [],
115115
"source": [
116116
"from pythreejs import *\n",
117-
"from ipydatawidgets import ConstrainedNDArrayWidget\n",
117+
"from ipydatawidgets import create_constrained_arraywidget \n",
118118
"from IPython.display import display\n",
119119
"\n",
120120
"view_width = 600\n",
121121
"view_height = 400\n",
122122
"\n",
123-
"coordinate_widget = ConstrainedNDArrayWidget(dtype='float32')(array=coords)\n",
123+
"coordinate_widget = create_constrained_arraywidget(dtype='float32')(array=coords)\n",
124124
"\n",
125125
"surf_g = BufferGeometry(attributes=dict(\n",
126126
" position=BufferAttribute(coordinate_widget),\n",

examples/threejs/voxel_painter.ipynb

-9
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,6 @@
2121
" - Delete voxel when shift-clicked"
2222
]
2323
},
24-
{
25-
"cell_type": "code",
26-
"execution_count": null,
27-
"metadata": {},
28-
"outputs": [],
29-
"source": [
30-
"from __future__ import division, print_function"
31-
]
32-
},
3324
{
3425
"cell_type": "code",
3526
"execution_count": null,

js/scripts/templates/py_top_level_init.mustache

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
# This file automatically generated by {{ generateScriptName }}
33
#
44

5-
from __future__ import absolute_import
6-
75
{{#each modules as |module|}}
86
from {{ module.pyRelativePath }} import *
97
{{/each}}

js/src/_base/Renderable.js

+4
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,10 @@ class RenderableView extends widgets.DOMWidgetView {
427427

428428
this.updateSize();
429429

430+
// We need to ensure that renderer properties are applied
431+
// (we have no idea where the renderer has been...)
432+
this.updateProperties(true);
433+
430434
this.debug('ThreeView.acquireRenderer(' + this.renderer.poolId + ')');
431435
}
432436

js/src/_base/Three.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ class ThreeModel extends widgets.WidgetModel {
440440
toSet[propName] = converterFn.bind(this)(this.obj[propName], propName);
441441
}, this);
442442

443-
if (toSet) {
443+
if (Object.keys(toSet).length) {
444444
// Apply all direct changes at once
445445
this.set(toSet, 'pushFromThree');
446446
}

js/src/core/Renderer.js

-8
Original file line numberDiff line numberDiff line change
@@ -166,14 +166,6 @@ class RendererView extends RenderableView {
166166
}
167167
}
168168

169-
acquireRenderer() {
170-
RenderableView.prototype.acquireRenderer.call(this);
171-
172-
// We need to ensure that renderer properties are applied
173-
// (we have no idea where the renderer has been...)
174-
this.updateProperties(true);
175-
}
176-
177169
}
178170

179171
module.exports = {

js/src/renderers/WebGLRenderer.js

-8
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,6 @@ class WebGLRendererView extends RenderableView {
5555
console.log('WGLR(' + this.id + '): ' + str);
5656
}
5757

58-
acquireRenderer() {
59-
RenderableView.prototype.acquireRenderer.call(this);
60-
61-
// We need to ensure that renderer properties are applied
62-
// (we have no idea where the renderer has been...)
63-
this.updateProperties();
64-
}
65-
6658
//
6759
// Handlers
6860
//

js/src/renderers/webgl/WebGLShadowMap.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class WebGLShadowMapModel extends WebGLShadowMapAutogenModel {
2424
// Leave this to Renderable
2525
}
2626

27-
synToModel(syncAllProps) {
27+
syncToModel(syncAllProps) {
2828
// Leave this to Renderable
2929
}
3030

pythreejs/pythreejs.py

-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
will use this foundation to build higher-level interfaces to build 3d plots.
1010
"""
1111

12-
from __future__ import absolute_import
13-
1412
from ipywidgets import Widget, widget_serialization
1513
from traitlets import Unicode, CInt, Instance, List, CFloat, Bool, observe, validate
1614
import numpy as np

0 commit comments

Comments
 (0)