Skip to content

Commit

Permalink
Debug info for helpers not being cleared
Browse files Browse the repository at this point in the history
  • Loading branch information
nkallen committed Mar 1, 2022
1 parent f609003 commit d6be7cf
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 14 deletions.
39 changes: 25 additions & 14 deletions src/command/CommandExecutor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { SolidCopier } from "../editor/SolidCopier";
import { HasSelectedAndHovered } from "../selection/SelectionDatabase";
import { Cancel, Finish, Interrupt } from "../util/Cancellable";
import { AlreadyFinishedError } from "../util/CancellablePromise";
import { Helpers } from "../util/Helpers";
import { GConstructor } from "../util/Util";
import Command from "./Command";
import { NoOpError, ValidationError } from "./GeometryFactory";
Expand All @@ -29,6 +30,7 @@ export interface EditorLike {
meshCreator: CachingMeshCreator;
snaps: SnapManager;
copier: SolidCopier;
helpers: Helpers;
}

export class CommandExecutor {
Expand Down Expand Up @@ -79,7 +81,7 @@ export class CommandExecutor {
}

private async execute(command: Command) {
const { snaps, signals, registry, originator, history, selection, contours, db, meshCreator, copier } = this.editor;
const { snaps, signals, registry, originator, history, selection, contours, db, meshCreator, copier, helpers } = this.editor;
signals.commandStarted.dispatch(command);
const disposable = registry.add('plasticity-viewport', {
'command:finish': () => command.finish(),
Expand Down Expand Up @@ -112,22 +114,31 @@ export class CommandExecutor {
originator.discardSideEffects(state);
throw e;
} finally {
document.body.removeAttribute("command");
for (const viewport of this.editor.viewports) {
viewport.enableControls();
PostCommandInvariants: {
document.body.removeAttribute("command");
for (const viewport of this.editor.viewports) {
viewport.enableControls();
}
disposable.dispose();
db.clearTemporaryObjects();
snaps.xor = false;
PlaneDatabase.ScreenSpace.reset();
// TODO: remove when more data is gathered
if (helpers.scene.children.length > 0) console.error("Helpers scene is not empty");
helpers.clear();
}
disposable.dispose();
db.clearTemporaryObjects();
snaps.xor = false;
PlaneDatabase.ScreenSpace.reset();

signals.commandEnded.dispatch(command);
originator.validate();
console.groupCollapsed(command.title);
originator.debug();
for (const viewport of this.editor.viewports) {
viewport.validate();

DebugValidate: {
originator.validate();
console.groupCollapsed(command.title);
originator.debug();
for (const viewport of this.editor.viewports) {
viewport.validate();
}
console.groupEnd();
}
console.groupEnd();
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/util/Helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,8 @@ export class Helpers {
remove(...objects: THREE.Object3D[]) {
this.scene.remove(...objects);
}

clear() {
this.scene.clear();
}
}

0 comments on commit d6be7cf

Please sign in to comment.