Skip to content

Commit

Permalink
Add "Get points" node
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelTallet committed Apr 19, 2021
1 parent f7fd8e0 commit 9b52dc5
Show file tree
Hide file tree
Showing 7 changed files with 196 additions and 90 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions source/parametric_modeling/HTML Dialogs/nodes-editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ body {

display: inline-block;

width: 32px;
height: 32px;
width: 31px;
height: 31px;

cursor: pointer;

Expand Down
158 changes: 74 additions & 84 deletions source/parametric_modeling/HTML Dialogs/nodes-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,9 +425,7 @@ class DrawBoxReteComponent extends Rete.Component {

}

worker(_node, _inputs, outputs) {
outputs['groups'] = []
}
worker(_node, _inputs, _outputs) {}

}

Expand Down Expand Up @@ -461,9 +459,7 @@ class DrawPrismReteComponent extends Rete.Component {

}

worker(_node, _inputs, outputs) {
outputs['groups'] = []
}
worker(_node, _inputs, _outputs) {}

}

Expand Down Expand Up @@ -497,9 +493,7 @@ class DrawCylinderReteComponent extends Rete.Component {

}

worker(_node, _inputs, outputs) {
outputs['groups'] = []
}
worker(_node, _inputs, _outputs) {}

}

Expand Down Expand Up @@ -537,9 +531,7 @@ class DrawTubeReteComponent extends Rete.Component {

}

worker(_node, _inputs, outputs) {
outputs['groups'] = []
}
worker(_node, _inputs, _outputs) {}

}

Expand Down Expand Up @@ -573,9 +565,7 @@ class DrawPyramidReteComponent extends Rete.Component {

}

worker(_node, _inputs, outputs) {
outputs['groups'] = []
}
worker(_node, _inputs, _outputs) {}

}

Expand Down Expand Up @@ -609,9 +599,7 @@ class DrawConeReteComponent extends Rete.Component {

}

worker(_node, _inputs, outputs) {
outputs['groups'] = []
}
worker(_node, _inputs, _outputs) {}

}

Expand Down Expand Up @@ -641,9 +629,7 @@ class DrawSphereReteComponent extends Rete.Component {

}

worker(_node, _inputs, outputs) {
outputs['groups'] = []
}
worker(_node, _inputs, _outputs) {}

}

Expand All @@ -665,9 +651,7 @@ class DrawShapeReteComponent extends Rete.Component {

}

worker(_node, _inputs, outputs) {
outputs['groups'] = []
}
worker(_node, _inputs, _outputs) {}

}

Expand Down Expand Up @@ -1059,15 +1043,60 @@ class PointReteComponent extends Rete.Component {

}

worker(node, _inputs, outputs) {
worker(node, _inputs, _outputs) {}

var x = PMG.Utils.isValidNumber(node.data.x) ? node.data.x : 0
var y = PMG.Utils.isValidNumber(node.data.y) ? node.data.y : 0
var z = PMG.Utils.isValidNumber(node.data.z) ? node.data.z : 0
}

outputs['point'] = { x, y, z }
class GetPointsReteComponent extends Rete.Component {

constructor() {
super('Get points')
}

builder(node) {

var inputGroup = new Rete.Input('groups', t('Group'), PMG.NodesEditor.sockets.groups)

var outputFrontBottomLeft = new Rete.Output('front_bottom_left', t('Front bottom left'), PMG.NodesEditor.sockets.point)
var outputFrontBottomRight = new Rete.Output('front_bottom_right', t('Front bottom right'), PMG.NodesEditor.sockets.point)
var outputFrontCenter = new Rete.Output('front_center', t('Front center'), PMG.NodesEditor.sockets.point)
var outputFrontTopLeft = new Rete.Output('front_top_left', t('Front top left'), PMG.NodesEditor.sockets.point)
var outputFrontTopRight = new Rete.Output('front_top_right', t('Front top right'), PMG.NodesEditor.sockets.point)

var outputBottomCenter = new Rete.Output('bottom_center', t('Bottom center'), PMG.NodesEditor.sockets.point)
var outputLeftCenter = new Rete.Output('left_center', t('Left center'), PMG.NodesEditor.sockets.point)
var outputCenter = new Rete.Output('center', t('Center'), PMG.NodesEditor.sockets.point)
var outputRightCenter = new Rete.Output('right_center', t('Right center'), PMG.NodesEditor.sockets.point)
var outputTopCenter = new Rete.Output('top_center', t('Top center'), PMG.NodesEditor.sockets.point)

var outputBackBottomLeft = new Rete.Output('back_bottom_left', t('Back bottom left'), PMG.NodesEditor.sockets.point)
var outputBackBottomRight = new Rete.Output('back_bottom_right', t('Back bottom right'), PMG.NodesEditor.sockets.point)
var outputBackCenter = new Rete.Output('back_center', t('Back center'), PMG.NodesEditor.sockets.point)
var outputBackTopLeft = new Rete.Output('back_top_left', t('Back top left'), PMG.NodesEditor.sockets.point)
var outputBackTopRight = new Rete.Output('back_top_right', t('Back top right'), PMG.NodesEditor.sockets.point)

return node
.addInput(inputGroup)
.addOutput(outputFrontBottomLeft)
.addOutput(outputFrontBottomRight)
.addOutput(outputFrontCenter)
.addOutput(outputFrontTopLeft)
.addOutput(outputFrontTopRight)
.addOutput(outputBottomCenter)
.addOutput(outputLeftCenter)
.addOutput(outputCenter)
.addOutput(outputRightCenter)
.addOutput(outputTopCenter)
.addOutput(outputBackBottomLeft)
.addOutput(outputBackBottomRight)
.addOutput(outputBackCenter)
.addOutput(outputBackTopLeft)
.addOutput(outputBackTopRight)

}

worker(_node, _inputs, _outputs) {}

}

class VectorReteComponent extends Rete.Component {
Expand Down Expand Up @@ -1097,15 +1126,8 @@ class VectorReteComponent extends Rete.Component {

}

worker(node, _inputs, outputs) {

var x = PMG.Utils.isValidNumber(node.data.x) ? node.data.x : 0
var y = PMG.Utils.isValidNumber(node.data.y) ? node.data.y : 0
var z = PMG.Utils.isValidNumber(node.data.z) ? node.data.z : 0

outputs['vector'] = { x, y, z }
worker(_node, _inputs, _outputs) {}

}
}

class IntersectSolidsReteComponent extends Rete.Component {
Expand All @@ -1128,9 +1150,7 @@ class IntersectSolidsReteComponent extends Rete.Component {

}

worker(_node, _inputs, outputs) {
outputs['groups'] = []
}
worker(_node, _inputs, _outputs) {}

}

Expand All @@ -1154,9 +1174,7 @@ class UniteSolidsReteComponent extends Rete.Component {

}

worker(_node, _inputs, outputs) {
outputs['groups'] = []
}
worker(_node, _inputs, _outputs) {}

}

Expand All @@ -1180,9 +1198,7 @@ class SubtractSolidsReteComponent extends Rete.Component {

}

worker(_node, _inputs, outputs) {
outputs['groups'] = []
}
worker(_node, _inputs, _outputs) {}

}

Expand Down Expand Up @@ -1210,9 +1226,7 @@ class PushPullReteComponent extends Rete.Component {

}

worker(_node, _inputs, outputs) {
outputs['groups'] = []
}
worker(_node, _inputs, _outputs) {}

}

Expand All @@ -1237,9 +1251,7 @@ class MoveReteComponent extends Rete.Component {

}

worker(_node, _inputs, outputs) {
outputs['groups'] = []
}
worker(_node, _inputs, _outputs) {}

}

Expand Down Expand Up @@ -1268,9 +1280,7 @@ class RotateReteComponent extends Rete.Component {

}

worker(_node, _inputs, outputs) {
outputs['groups'] = []
}
worker(_node, _inputs, _outputs) {}

}

Expand Down Expand Up @@ -1303,9 +1313,7 @@ class ScaleReteComponent extends Rete.Component {

}

worker(_node, _inputs, outputs) {
outputs['groups'] = []
}
worker(_node, _inputs, _outputs) {}

}

Expand All @@ -1328,9 +1336,7 @@ class PaintReteComponent extends Rete.Component {

}

worker(_node, _inputs, outputs) {
outputs['groups'] = []
}
worker(_node, _inputs, _outputs) {}

}

Expand All @@ -1353,9 +1359,7 @@ class TagReteComponent extends Rete.Component {

}

worker(_node, _inputs, outputs) {
outputs['groups'] = []
}
worker(_node, _inputs, _outputs) {}

}

Expand All @@ -1374,8 +1378,7 @@ class EraseReteComponent extends Rete.Component {

}

worker(_node, _inputs, _outputs) {
}
worker(_node, _inputs, _outputs) {}

}

Expand Down Expand Up @@ -1403,12 +1406,7 @@ class CopyReteComponent extends Rete.Component {

}

worker(_node, _inputs, outputs) {

outputs['groups'] = []
outputs['original_groups'] = []

}
worker(_node, _inputs, _outputs) {}

}

Expand Down Expand Up @@ -1452,9 +1450,7 @@ class ConcatenateReteComponent extends Rete.Component {

}

worker(_node, _inputs, outputs) {
outputs['groups'] = []
}
worker(_node, _inputs, _outputs) {}

}

Expand Down Expand Up @@ -1528,12 +1524,7 @@ class SelectReteComponent extends Rete.Component {

}

worker(_node, _inputs, outputs) {

outputs['groups'] = []
outputs['not_groups'] = []

}
worker(_node, _inputs, _outputs) {}

}

Expand Down Expand Up @@ -1580,9 +1571,7 @@ class MakeGroupReteComponent extends Rete.Component {

}

worker(_node, _inputs, outputs) {
outputs['groups'] = []
}
worker(_node, _inputs, _outputs) {}

}

Expand Down Expand Up @@ -1628,6 +1617,7 @@ PMG.NodesEditor.initializeComponents = () => {
"Divide": new DivideReteComponent(),
"Calculate": new CalculateReteComponent(),
"Point": new PointReteComponent(),
"Get points": new GetPointsReteComponent(),
"Vector": new VectorReteComponent(),
"Intersect solids": new IntersectSolidsReteComponent(),
"Unite solids": new UniteSolidsReteComponent(),
Expand Down
1 change: 1 addition & 0 deletions source/parametric_modeling/HTML Dialogs/nodes-editor.rhtml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
<img class="node-icon" data-node-name="Calculate" />

<img class="node-icon" data-node-name="Point" />
<img class="node-icon" data-node-name="Get points" />
<img class="node-icon" data-node-name="Vector" />

<img class="node-icon" data-node-name="Intersect solids" />
Expand Down
Loading

0 comments on commit 9b52dc5

Please sign in to comment.