Skip to content

Commit 09044c8

Browse files
committed
Use updated geometry names in examples
1 parent 006d35e commit 09044c8

File tree

7 files changed

+23
-13
lines changed

7 files changed

+23
-13
lines changed

examples/Animation.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@
282282
"source": [
283283
"# This lets three.js create the geometry, then syncs back vertex positions etc.\n",
284284
"# For this reason, you should allow for the sync to complete before executing the next cell\n",
285-
"morph = PlainBufferGeometry.from_geometry(SphereBufferGeometry(1, 32, 16))"
285+
"morph = BufferGeometry.from_geometry(SphereBufferGeometry(1, 32, 16))"
286286
]
287287
},
288288
{
@@ -370,7 +370,7 @@
370370
"N_BONES = 3\n",
371371
"\n",
372372
"ref_cylinder = CylinderGeometry(5, 5, 50, 5, N_BONES * 5, True)\n",
373-
"cylinder = PlainGeometry.from_geometry(ref_cylinder)"
373+
"cylinder = Geometry.from_geometry(ref_cylinder)"
374374
]
375375
},
376376
{

examples/BufferAttributes and BufferGeometry.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
"metadata": {},
9494
"outputs": [],
9595
"source": [
96-
"geometry = PlainBufferGeometry(\n",
96+
"geometry = BufferGeometry(\n",
9797
" attributes={'position': vertices},\n",
9898
")"
9999
]
@@ -195,7 +195,7 @@
195195
"metadata": {},
196196
"outputs": [],
197197
"source": [
198-
"geometry = PlainBufferGeometry(\n",
198+
"geometry = BufferGeometry(\n",
199199
" attributes={\n",
200200
" 'position': vertices,\n",
201201
" 'index': index,\n",
@@ -242,7 +242,7 @@
242242
"metadata": {},
243243
"outputs": [],
244244
"source": [
245-
"plain = PlainBufferGeometry.from_geometry(sphere)"
245+
"plain = BufferGeometry.from_geometry(sphere)"
246246
]
247247
},
248248
{
@@ -268,7 +268,7 @@
268268
"outputs": [],
269269
"source": [
270270
"# Now from a non-buffer geometry:\n",
271-
"box = PlainBufferGeometry.from_geometry(BoxGeometry())"
271+
"box = BufferGeometry.from_geometry(BoxGeometry())"
272272
]
273273
},
274274
{

examples/Examples.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@
218218
"source": [
219219
"# On windows, linewidth of the material has no effect\n",
220220
"size = 4\n",
221-
"linesgeom = PlainGeometry(vertices=[[0, 0, 0],\n",
221+
"linesgeom = Geometry(vertices=[[0, 0, 0],\n",
222222
" [size, 0, 0],\n",
223223
" [0, 0, 0],\n",
224224
" [0, size, 0],\n",
@@ -335,7 +335,7 @@
335335
"faces = [f + [None, [vertexcolors[i] for i in f]] for f in faces]\n",
336336
"\n",
337337
"# Create the geometry:\n",
338-
"cubeGeometry = PlainGeometry(vertices=vertices,\n",
338+
"cubeGeometry = Geometry(vertices=vertices,\n",
339339
" faces=faces,\n",
340340
" colors=vertexcolors)\n",
341341
"# Calculate normals per face, for nice crisp edges:\n",
@@ -408,7 +408,7 @@
408408
"vertexcolors = np.asarray([(0,0,0), (0,0,1), (0,1,0), (1,0,0),\n",
409409
" (0,1,1), (1,0,1), (1,1,0), (1,1,1)], dtype='float32')\n",
410410
"\n",
411-
"cubeGeometry = PlainBufferGeometry(attributes=dict(\n",
411+
"cubeGeometry = BufferGeometry(attributes=dict(\n",
412412
" position=BufferAttribute(vertices, normalized=False),\n",
413413
" index=BufferAttribute(faces, normalized=False),\n",
414414
" color=BufferAttribute(vertexcolors),\n",

examples/GeometryVertices.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"metadata": {},
5454
"outputs": [],
5555
"source": [
56-
"g2 = PlainGeometry.from_geometry(g)"
56+
"g2 = Geometry.from_geometry(g)"
5757
]
5858
},
5959
{
@@ -80,7 +80,7 @@
8080
"metadata": {},
8181
"outputs": [],
8282
"source": [
83-
"g3 = PlainGeometry(vertices=g2.vertices[:], faces=g2.faces[:])"
83+
"g3 = Geometry(vertices=g2.vertices[:], faces=g2.faces[:])"
8484
]
8585
},
8686
{

examples/superellipsoid.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
"\n",
123123
"coordinate_widget = ConstrainedNDArrayWidget(dtype='float32')(array=coords)\n",
124124
"\n",
125-
"surf_g = PlainBufferGeometry(attributes=dict(\n",
125+
"surf_g = BufferGeometry(attributes=dict(\n",
126126
" position=BufferAttribute(coordinate_widget),\n",
127127
" index=BufferAttribute(cvx.simplices.ravel().astype(np.uint16)),\n",
128128
"))\n",

js/scripts/templates/py_wrapper.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ class {{ className }}({{ superClass.className }}):
3838

3939
{{#each properties as |prop propName|}}
4040
{{ propName }} = {{{ prop.trait_declaration }}}
41-
{{/each}}
4241

42+
{{/each}}
4343

4444
if six.PY3:
4545
import inspect

pythreejs/core/BufferAttribute.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from ipywidgets import register
22

3+
from .._base.Three import ThreeWidget
34
from .BufferAttribute_autogen import BufferAttribute as BaseBufferAttribute
45

56

@@ -15,3 +16,12 @@ def __init__(self, array=None, normalized=True, **kwargs):
1516
kwargs['normalized'] = normalized
1617
# NOTE: skip init of direct parent class on purpose:
1718
super(BaseBufferAttribute, self).__init__(**kwargs)
19+
20+
def _ipython_display_(self, **kwargs):
21+
# Preview widget doesn't make any sense for attributes
22+
from IPython.display import display
23+
data = {
24+
'text/plain': repr(self),
25+
}
26+
display(data, raw=True)
27+
self._handle_displayed(**kwargs)

0 commit comments

Comments
 (0)