Skip to content

Commit a75bd90

Browse files
authored
Merge pull request #121 from vidartf/fixes
Fixes some issues from #88
2 parents fe47fb9 + b1cb688 commit a75bd90

File tree

5 files changed

+22
-15
lines changed

5 files changed

+22
-15
lines changed

examples/Animation.ipynb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,8 @@
280280
"metadata": {},
281281
"outputs": [],
282282
"source": [
283+
"# This lets three.js create the geometry, then syncs back vertex positions etc.\n",
284+
"# For this reason, you should allow for the sync to complete before executing the next cell\n",
283285
"morph = PlainBufferGeometry.from_geometry(SphereBufferGeometry(1, 32, 16))"
284286
]
285287
},

examples/superellipsoid.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"y_box = np.concatenate((-np.ones(n-1), np.linspace(-1, 1., n), np.ones(n-2), np.linspace(1, -1., n-1, endpoint=False)))\n",
3030
"nx_box = x_box.size\n",
3131
"\n",
32-
"coords = np.empty((nx_box**2, 3))\n",
32+
"coords = np.empty((nx_box**2, 3), dtype=np.float32)\n",
3333
"\n",
3434
"def superellipse(rx, ry, m):\n",
3535
" \"\"\"\n",
@@ -176,6 +176,7 @@
176176
" superellipsoid(rx_slider.value, ry_slider.value, rz_slider.value, \n",
177177
" m1_slider.value, m2_slider.value)\n",
178178
" coordinate_widget.array = coords\n",
179+
" coordinate_widget.notify_changed()\n",
179180
" \n",
180181
"m1_slider.observe(update, names=['value'])\n",
181182
"m2_slider.observe(update, names=['value'])\n",

js/scripts/generate-wrappers.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -946,16 +946,18 @@ function createPythonFiles() {
946946
}
947947

948948
return mapPromiseFnOverThreeModules(function(relativePath) {
949-
createPythonWrapper(relativePath);
950-
// ensures each dir has empty __init__.py file for proper importing of sub dirs
951-
createPythonModuleInitFile(relativePath);
949+
return createPythonWrapper(relativePath).then(function() {
950+
// ensures each dir has empty __init__.py file for proper importing of sub dirs
951+
createPythonModuleInitFile(relativePath);
952+
});
952953
})
953954
.then(function() {
954955
return mapPromiseFnOverFileList(CUSTOM_CLASSES, function(relativePath) {
955-
createPythonWrapper(relativePath);
956-
// ensures each dir has empty __init__.py file for proper importing of sub dirs
957-
createPythonModuleInitFile(relativePath);
958-
})
956+
return createPythonWrapper(relativePath).then(function() {
957+
// ensures each dir has empty __init__.py file for proper importing of sub dirs
958+
createPythonModuleInitFile(relativePath);
959+
});
960+
});
959961
})
960962
.then(function() {
961963
// top level __init__.py file imports *all* pythreejs modules into namespace

pythreejs/geometries/PlainBufferGeometry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def validate(self, proposal):
2222

2323
if 'index' in value:
2424
# We treat index special, so we might as well do some checking:
25-
idx = value['index']
25+
idx = value['index'].array
2626
array = idx.array if isinstance(idx, NDArrayWidget) else idx
2727
if array.dtype.kind != 'u':
2828
raise TraitError('Index attribute must have unsigned integer data')

pythreejs/traits.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 -*-
13

24
from traitlets import (
35
Unicode, Int, CInt, Instance, Enum, List, Dict, Float, CFloat,
@@ -42,16 +44,16 @@ def Matrix4(trait_type=CFloat, default=None, **kwargs):
4244

4345
def Face3(**kwargs):
4446
return Tuple(
45-
CInt(), # a Vertex A index.
46-
CInt(), # b Vertex B index.
47-
CInt(), # c Vertex C index.
48-
Union([ # normal (optional) Face normal (Vector3) or array of 3 vertex normals.
47+
CInt(), # a - Vertex A index.
48+
CInt(), # b - Vertex B index.
49+
CInt(), # c - Vertex C index.
50+
Union([ # normal - (optional) Face normal (Vector3) or array of 3 vertex normals.
4951
Vector3(),
5052
List(Vector3(), minlen=3, maxlen=3)]),
51-
Union([ # color (optional) Face color or array of vertex colors.
53+
Union([ # color - (optional) Face color or array of vertex colors.
5254
Unicode(),
5355
List(Unicode(), minlen=3, maxlen=3)]),
54-
CInt(), # materialIndex (optional) which index of an array of materials to associate with the face.
56+
CInt(), # materialIndex - (optional) which index of an array of materials to associate with the face.
5557
)
5658

5759
def Euler(default=None, **kwargs):

0 commit comments

Comments
 (0)