Skip to content

Commit

Permalink
Merge pull request #383 from vidartf/ipyw8
Browse files Browse the repository at this point in the history
Fix shadowMap interactive use + renderer props update + deprecations
  • Loading branch information
vidartf authored Aug 24, 2022
2 parents 33a8aaf + b8537f0 commit cc7f93f
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 37 deletions.
2 changes: 1 addition & 1 deletion examples/Examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
"size = int(32) # size of image\n",
"im = np.zeros((size,size)) # create zero image\n",
"points = size*np.random.random((2, n**2)) # locations of seed values\n",
"im[(points[0]).astype(np.int), (points[1]).astype(np.int)] = size # seed high values\n",
"im[(points[0]).astype(np.int32), (points[1]).astype(np.int32)] = size # seed high values\n",
"im = ndimage.gaussian_filter(im, sigma=size/(float(4)*n)) # smooth high values into surrounding areas\n",
"im *= 1/np.max(im)# rescale to be in the range [0,1]\n",
"rgba_im = img_as_ubyte(jet(im)) # convert the values to rgba image using the jet colormap\n",
Expand Down
4 changes: 2 additions & 2 deletions examples/Picker.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@
"scene.add(hover_point)\n",
"\n",
"# Have sphere follow picker point:\n",
"jslink((hover_point, 'position'), (hover_picker, 'point'))"
"jslink((hover_point, 'position'), (hover_picker, 'point'));"
]
},
{
Expand Down Expand Up @@ -254,7 +254,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"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."
"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."
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion examples/Shadows.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"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:"
"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:"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions examples/superellipsoid.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@
"outputs": [],
"source": [
"from pythreejs import *\n",
"from ipydatawidgets import ConstrainedNDArrayWidget\n",
"from ipydatawidgets import create_constrained_arraywidget \n",
"from IPython.display import display\n",
"\n",
"view_width = 600\n",
"view_height = 400\n",
"\n",
"coordinate_widget = ConstrainedNDArrayWidget(dtype='float32')(array=coords)\n",
"coordinate_widget = create_constrained_arraywidget(dtype='float32')(array=coords)\n",
"\n",
"surf_g = BufferGeometry(attributes=dict(\n",
" position=BufferAttribute(coordinate_widget),\n",
Expand Down
9 changes: 0 additions & 9 deletions examples/threejs/voxel_painter.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,6 @@
" - Delete voxel when shift-clicked"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from __future__ import division, print_function"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
2 changes: 0 additions & 2 deletions js/scripts/templates/py_top_level_init.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# This file automatically generated by {{ generateScriptName }}
#

from __future__ import absolute_import

{{#each modules as |module|}}
from {{ module.pyRelativePath }} import *
{{/each}}
Expand Down
4 changes: 4 additions & 0 deletions js/src/_base/Renderable.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,10 @@ class RenderableView extends widgets.DOMWidgetView {

this.updateSize();

// We need to ensure that renderer properties are applied
// (we have no idea where the renderer has been...)
this.updateProperties(true);

this.debug('ThreeView.acquireRenderer(' + this.renderer.poolId + ')');
}

Expand Down
2 changes: 1 addition & 1 deletion js/src/_base/Three.js
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ class ThreeModel extends widgets.WidgetModel {
toSet[propName] = converterFn.bind(this)(this.obj[propName], propName);
}, this);

if (toSet) {
if (Object.keys(toSet).length) {
// Apply all direct changes at once
this.set(toSet, 'pushFromThree');
}
Expand Down
8 changes: 0 additions & 8 deletions js/src/core/Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,6 @@ class RendererView extends RenderableView {
}
}

acquireRenderer() {
RenderableView.prototype.acquireRenderer.call(this);

// We need to ensure that renderer properties are applied
// (we have no idea where the renderer has been...)
this.updateProperties(true);
}

}

module.exports = {
Expand Down
8 changes: 0 additions & 8 deletions js/src/renderers/WebGLRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,6 @@ class WebGLRendererView extends RenderableView {
console.log('WGLR(' + this.id + '): ' + str);
}

acquireRenderer() {
RenderableView.prototype.acquireRenderer.call(this);

// We need to ensure that renderer properties are applied
// (we have no idea where the renderer has been...)
this.updateProperties();
}

//
// Handlers
//
Expand Down
2 changes: 1 addition & 1 deletion js/src/renderers/webgl/WebGLShadowMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class WebGLShadowMapModel extends WebGLShadowMapAutogenModel {
// Leave this to Renderable
}

synToModel(syncAllProps) {
syncToModel(syncAllProps) {
// Leave this to Renderable
}

Expand Down
2 changes: 0 additions & 2 deletions pythreejs/pythreejs.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
will use this foundation to build higher-level interfaces to build 3d plots.
"""

from __future__ import absolute_import

from ipywidgets import Widget, widget_serialization
from traitlets import Unicode, CInt, Instance, List, CFloat, Bool, observe, validate
import numpy as np
Expand Down

0 comments on commit cc7f93f

Please sign in to comment.