-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Post effect sketches without root properly reload #473
base: alpha
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -35,14 +35,21 @@ export class SketchManager { | |||||
} | ||||||
|
||||||
public removeSketchFromScene = (instanceId: string): void => { | ||||||
const scene = getDebugScene().scene | ||||||
const oldSketch = scene.getObjectByName(instanceId) | ||||||
const engineScene = getDebugScene() | ||||||
const threeScene = engineScene.scene | ||||||
const oldSketch = threeScene.getObjectByName(instanceId) | ||||||
|
||||||
if (!oldSketch) { | ||||||
const pass = engineScene.getPassesByName(instanceId) | ||||||
if (pass?.length) { | ||||||
pass.forEach((p) => engineScene.removePass(p)) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this would also work 😉
Suggested change
|
||||||
delete this.sketchInstances[instanceId] | ||||||
return | ||||||
} | ||||||
throw new Error(`couldn't find sketch to remove: ${instanceId}`) | ||||||
} | ||||||
|
||||||
scene.remove(oldSketch) | ||||||
threeScene.remove(oldSketch) | ||||||
Comment on lines
+46
to
+52
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wondering if we may need to still call Is it not quite likely that some sketches may have both postprocessing and 3D objects? Rather than immediately returning at the end of the passes stuff, I'm wondering if it makes sense to shuffle the logic a bit so the code keeps keeps executing to the end of the method. You could optionally call |
||||||
delete this.sketchInstances[instanceId] | ||||||
} | ||||||
|
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this method? Can we not just do
this.sketchInstances[instanceId].getPasses
? Maybe you have a good reason for doing it this way though, curious to know.