Skip to content
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

[NME] Set Block #15090

Merged
merged 5 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ export enum TrigonometryBlockOperations {
Radians,
/** To degrees (from radians) */
Degrees,
/** To Set a = b */
Set,
}

/**
Expand Down Expand Up @@ -171,6 +173,10 @@ export class TrigonometryBlock extends NodeMaterialBlock {
operation = "degrees";
break;
}
case TrigonometryBlockOperations.Set: {
operation = "";
break;
}
}

state.compilationString += state._declareOutput(output) + ` = ${operation}(${this.input.associatedVariableName});\n`;
Expand Down
5 changes: 5 additions & 0 deletions packages/tools/nodeEditor/src/blockTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,11 @@ export class BlockTools {
triangleWaveBlock.kind = WaveBlockKind.Triangle;
return triangleWaveBlock;
}
case "SetBlock": {
const cosBlock = new TrigonometryBlock("Set");
onekit-boss marked this conversation as resolved.
Show resolved Hide resolved
cosBlock.operation = TrigonometryBlockOperations.Set;
return cosBlock;
}
case "WorldMatrixBlock": {
const worldMatrixBlock = new InputBlock("World");
worldMatrixBlock.setAsSystemValue(NodeMaterialSystemValues.World);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export class NodeListComponent extends React.Component<INodeListComponentProps,
ArcSinBlock: "Outputs the inverse of the sine value based on the input value",
ArcTan2Block: "Outputs the inverse of the tangent value based on the input value",
ArcTanBlock: "Outputs the inverse of the tangent value based on the input value",
SetBlock: "Outputs the alias based on the input value",
CosBlock: "Outputs the cosine value based on the input value",
DegreesToRadiansBlock: "Converts the input degrees value to radians",
Exp2Block: "Outputs the input value multiplied by itself 1 time. (Exponent of 2)",
Expand Down Expand Up @@ -385,6 +386,7 @@ export class NodeListComponent extends React.Component<INodeListComponentProps,
"SquareWaveBlock",
"TanBlock",
"TriangleWaveBlock",
"SetBlock",
],
Math__Vector: [
"CrossBlock",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export class TrigonometryPropertyTabComponent extends React.Component<IPropertyC
{ label: "Sign", value: TrigonometryBlockOperations.Sign },
{ label: "Radians to degrees", value: TrigonometryBlockOperations.Degrees },
{ label: "Degrees to radians", value: TrigonometryBlockOperations.Radians },
{ label: "Set", value: TrigonometryBlockOperations.Set },
];

operationOptions.sort((a, b) => {
Expand Down