Skip to content

Commit ae19402

Browse files
committed
Fix bug in compound
1 parent 4aae91d commit ae19402

File tree

10 files changed

+46
-36
lines changed

10 files changed

+46
-36
lines changed

ForInstalledPython/glow.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

GlowScriptOffline/glowscript_libraries/glow.3.1.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

GlowScriptOffline3.1.zip

13 Bytes
Binary file not shown.

build-tools/Symbols.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
GlowScript 3.0
1+
GlowScript 3.1
22
var ver = glowscript.version
33

44
console.log( glowscript.glowscript )

docs/MakingNewVersion.txt

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,15 @@ for example, GlowScript version 2.2 uses the same verdir value as 2.1 for jquery
5050
In untrusted/run.js, update choice of jquery library.
5151
Add to css/redmond a folder with the new name if necessary (sometimes no change is needed)
5252

53-
Modify build_original.py and property.js to have version = "0.4" and
53+
Modify build_original.py and lib/glow/property.js to have version = "0.4" and
5454
run it to create the final packages for 0.4.
55-
Then change build_original.py and property.js to have version = "0.5dev" and save build_original.py,
55+
Then change build_original.py and lib/glow/property.js to have version = "0.5dev" and save build_original.py,
5656
so that the 0.4 package doesn't get overwritten by accident.
5757

58-
If you're just fixing a bug in 0.4, all you need to do is Deploy from the Google App Engine Launcher,
59-
to update the package files produced in the previous step that involved build.py and property.js.
60-
6158
There is a Glowscript program in build-tools/Symbols.js which you need to copy into (presumably local)
6259
glowscript and run to compile the symbols.
6360
You have to copy and paste the results into the appropriate file (package/symbols.X.Y.min.js).
64-
You also have to make a change at the end of ide/index.html to point to the new Symbols file,
61+
You also have to make a change at the end of ide/templates/index.html to point to the new Symbols file,
6562
since the IDE doesn't yet dynamically load symbols based on the version header.
6663

6764
Also change "G l o w S c r i p t X.Y" appropriately in ide/index.html.
@@ -78,6 +75,18 @@ Ideally we should create a branch "version-0.4" in the repository at this point,
7875
in case we have to come back and patch an old version for some critical bug.
7976
This has not actually been done so far.
8077

78+
If you're just fixing a bug in 0.4, all you need to do to update the package files produced
79+
in the previous step that involved build.py and property.js is this:
80+
81+
In a terminal, cd to glowscript folder.
82+
Execute 'gcloud info' to check that the project is set to 'glowscript'.
83+
gcloud app deploy --no-promote
84+
This will give a URL to use to test in the cloud, similar to this: https://20211014t164505-dot-glowscript.appspot.com
85+
Alternatively, 'gcloud app browse' brings up glowscript.appspot.com, though I saw this fail (didn't see changes, but this might have been due to caching of an earlier version).
86+
If okay, go to https://console.cloud.google.com/appengine/versions?project=glowscript
87+
You will be in App Engine > Versions; make the window wide to see MIGRATE TRAFFIC.
88+
Choose the new version and then click MIGRATE TRAFFIC to update user glowscript.org
89+
8190
************************************************************************************
8291
UPDATE library files in the GlowScriptOffline package and create zip file
8392
UPDATE the glow library used in VPython 7; generate it with build_original_no_overload.py

ide/templates/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ <h2>G l o w S c r i p t&nbsp;&nbsp; 3.0</h2>
328328
<script type="text/javascript" language="javascript" src="lib/editor.js"></script>
329329
<script type="text/javascript" language="javascript" src="lib/ace/mode-javascript.js"></script>
330330
<script type="text/javascript" language="javascript" src="lib/ace/mode-python.js"></script>
331-
<script type="text/javascript" language="javascript" src="package/symbols.3.0.min.js"></script>
331+
<script type="text/javascript" language="javascript" src="package/symbols.3.1.min.js"></script>
332332
<script type="text/javascript" language="javascript" src="ide.js"></script>
333333

334334
</body>

lib/glow/WebGLRenderer.js

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,12 @@
152152
var name = t.name
153153
if (name.substring(name.length-3)=="[0]") name = name.substring(0, name.length-3)
154154
P.uniforms[name] = gls.getUniformLocation(P, name)
155-
//console.log('uniforms',t.name, name)
156155
}
157156
var attributes = gls.getProgramParameter(P, gls.ACTIVE_ATTRIBUTES)
158157
P.attributes = {}
159158
for (var i = 0; i < attributes; i++) {
160159
var t = gls.getActiveAttrib(P, i)
161160
P.attributes[t.name] = gls.getAttribLocation(P, t.name)
162-
//console.log('attributes',t.name, name)
163161
}
164162
return P
165163
}
@@ -472,30 +470,30 @@
472470
// Code is left in place for a possible later try.
473471

474472
if (mode == RENDER) {
475-
for (let a of cvs.arrows) { // attach_arrow
476-
let pos
477-
if (!a.__run) continue
478-
if (a.__object !== undefined) {
479-
if (a.__object.pos !== undefined) pos = a.__object.pos
480-
else continue // trailed object no longer exists
481-
}
482-
a.pos = pos
483-
if (a.__object[a.__attr] !== undefined) {
473+
for (let a of cvs.arrows) { // attach_arrow
474+
let pos
475+
if (!a.__run) continue
476+
if (a.__object !== undefined) {
477+
if (a.__object.pos !== undefined) pos = a.__object.pos
478+
else continue // trailed object no longer exists
479+
}
480+
a.pos = pos
481+
if (a.__object[a.__attr] !== undefined) {
484482
let axis = a.__object[a.__attr]
485483
if (axis.mag > 0) {
486484
if (!a.visible) a.visible = true
487485
a.axis = axis.multiply(a.scale)
488486
} else a.visible = false
489-
}
490-
/*
491-
// TODO: The following needs revision after further discussion of the API:
492-
if (typeof a.attr !== "function") { // a string representing an attribute
493-
a.axis = a.__obj[a.__attr].multiply(a.__scale)
494-
} else { // a function to be called
495-
a.axis = a.__attr().multiply(a.__scale)
496-
}
497-
*/
498-
}
487+
}
488+
/*
489+
// TODO: The following needs revision after further discussion of the API:
490+
if (typeof a.attr !== "function") { // a string representing an attribute
491+
a.axis = a.__obj[a.__attr].multiply(a.__scale)
492+
} else { // a function to be called
493+
a.axis = a.__attr().multiply(a.__scale)
494+
}
495+
*/
496+
}
499497

500498
for (var i in cvs.trails) { // attach_trail
501499
var pos

lib/glow/primitives.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@
646646
Y = Y.multiply(this.__size.y)
647647
Z = Z.multiply(this.__size.z)
648648
var matrix = [X.x, X.y, X.z, 0, Y.x, Y.y, Y.z, 0, Z.x, Z.y, Z.z, 0, T.x, T.y, T.z, 1]
649-
return this.__model.mesh.transformed(matrix);
649+
return this.__model.mesh.transformed(matrix)
650650
}
651651
}
652652
})
@@ -1498,6 +1498,7 @@
14981498
this.__origin = parameters.origin
14991499
delete parameters.origin
15001500
}
1501+
15011502
var mesh = new Mesh()
15021503
var release = [] // list of vertex objects that can be released
15031504
var temp
@@ -1550,7 +1551,8 @@
15501551
if (temp === null) compound_error(i)
15511552
update_extent( self, temp )
15521553
} else if (o.__components !== undefined) { // currently, only arrow has components
1553-
var c = o.__components
1554+
var c = o.__components
1555+
o.__update() // ensure that all components are up to date at time of compounding
15541556
for (var ci=0; ci<c.length; ci++) {
15551557
var comp = c[ci]
15561558
temp = mesh.merge(comp.getTransformedMesh(), comp, 0)
@@ -1600,12 +1602,13 @@
16001602
}
16011603
if (parameters.make_trail !== undefined) makeTrail(self, parameters)
16021604
for (var attr in parameters) self[attr] = parameters[attr]
1605+
window.__compounding = false
16031606
}
16041607

16051608
function compound(objects, parameters) {
16061609
if (!(this instanceof compound)) return new compound(objects, parameters)
16071610
if (objects.length === undefined && objects.canvas === null) return // it's null if first setting up objects; see subclass function
1608-
parameters = parameters || {}
1611+
parameters = parameters || {}
16091612
if (objects.length === undefined) throw new Error("compound takes a list of objects")
16101613
if (parameters.canvas !== undefined) initObject(this, compound, {canvas:parameters.canvas})
16111614
else initObject(this, compound, {canvas:objects[0].canvas})

lib/glow/property.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
;(function () {
22
"use strict";
33

4-
var glowscript = { version: "3.0" }
4+
var glowscript = { version: "3.1" }
55

66
// GlowScript uses lots of javascript properties (Object.defineProperty) with getters and setters
77
// This is an attempt to create a more declarative syntax for declaring an object with lots of properties

package/glow.3.1.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)