Description
Most appropriate sub-area of p5.js?
- Accessibility
- Color
- Core/Environment/Rendering
- Data
- DOM
- Events
- Image
- IO
- Math
- Typography
- Utilities
- p5.strands
- WebGL
- DevOps, Build process, Unit testing
- Internationalization (i18n)
- Friendly Errors
- Other (specify if possible)
p5.js version
2.0.3
Web browser and version
Firefox 139.0.4 (aarch64)
Operating system
macOS 15.5
Steps to reproduce this
intro
When trying to export an ".obj" file from a p5 sketch, the console throws an error. Claims it doesn't recognize a "fn" function.
Could this be related to line 415-416 in https://github.com/processing/p5.js/blob/v2.0.3/src/webgl/p5.Geometry.js?
const blob = new Blob([objStr], { type: 'text/plain' });
fn.downloadFile(blob, fileName , 'obj');
Steps:
- WEBGL renderer
- buildGeometry() in setup()
- saveObj() in keyPressed()
- When pressing the key ("s" in this case), the console given an error
- Swapping the CNV version for a local minified one makes no difference. Also, buildGeometry does not seem to work for older p5 versions.
Snippet:
let myModel;
function setup() {
createCanvas(400, 400, WEBGL);
myModel = buildGeometry(() => {
blah blah
});
}
function draw() {
model(myModel);
}
function keyPressed() {
if (key === 's') {
myModel.saveObj();
}
}
console error
Uncaught ReferenceError: fn is not defined
saveObj http://127.0.0.1:5500/p5.min.js:1
keyPressed http://127.0.0.1:5500/sketch.js:60
_onkeydown http://127.0.0.1:5500/p5.min.js:1
e http://127.0.0.1:5500/p5.min.js:1
p5 http://127.0.0.1:5500/p5.min.js:1
promise callback*p5< http://127.0.0.1:5500/p5.min.js:1
http://127.0.0.1:5500/p5.min.js:1
p5.min.js:1:179337
saveObj http://127.0.0.1:5500/p5.min.js:1
keyPressed http://127.0.0.1:5500/sketch.js:60
_onkeydown http://127.0.0.1:5500/p5.min.js:1
(Async: EventListener.handleEvent)
e http://127.0.0.1:5500/p5.min.js:1
p5 http://127.0.0.1:5500/p5.min.js:1
(Async: promise callback)
p5 http://127.0.0.1:5500/p5.min.js:1
http://127.0.0.1:5500/p5.min.js:1
Metadata
Metadata
Assignees
Type
Projects
Status