Skip to content

Commit

Permalink
set sop/copy type as enum
Browse files Browse the repository at this point in the history
  • Loading branch information
frading committed Jul 14, 2022
1 parent be46c69 commit a088ec5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/engine/expressions/methods/copy.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {SopType} from './../../poly/registers/nodes/types/Sop';
/**
* The copy expression allows the copy SOP node to evaluates its input graph multiple times, and vary its result each time.
*
Expand Down Expand Up @@ -41,7 +42,7 @@ export class CopyExpression extends BaseMethod {
const node = this.findReferencedGraphNode(indexOrPath) as BaseNodeType;
// I'd prefer testing with if(node instanceof CopySopNode || node instanceof CopyAnimNode)
// but tslib generates an error when doing so
if (node && node.type() == 'copy') {
if (node && node.type() == SopType.COPY) {
const stampNode = (node as CopyNode).stampNode();
return this.createDependency(stampNode, indexOrPath);
}
Expand Down
3 changes: 2 additions & 1 deletion src/engine/nodes/sop/Copy.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {SopType} from './../../poly/registers/nodes/types/Sop';
/**
* Copies a geometry onto every point from the right input.
*
Expand Down Expand Up @@ -68,7 +69,7 @@ const ParamsConfig = new CopySopParamsConfig();
export class CopySopNode extends TypedSopNode<CopySopParamsConfig> {
override paramsConfig = ParamsConfig;
static override type() {
return 'copy';
return SopType.COPY;
}

private _attribNamesToCopy: string[] = [];
Expand Down
1 change: 0 additions & 1 deletion src/engine/params/_Numeric.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ export abstract class TypedNumericParam<T extends ParamType> extends TypedParam<
this.emitController.emit(ParamEvent.EXPRESSION_UPDATED);
}
} else {
console.log('this._raw_input', this._raw_input);
this.states.error.set(`param input is invalid (${this.path()})`);
}
}
Expand Down
1 change: 1 addition & 0 deletions src/engine/poly/registers/nodes/types/Sop.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export enum SopType {
COPY = 'copy',
PARTICLES_SYSTEM_GPU = 'particlesSystemGpu',
SHEAR = 'shear',
TRANSFORM = 'transform',
Expand Down

0 comments on commit a088ec5

Please sign in to comment.