Skip to content

Commit

Permalink
Add Align node
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelTallet committed Apr 20, 2021
1 parent 9b52dc5 commit 9ea7422
Show file tree
Hide file tree
Showing 10 changed files with 574 additions and 3 deletions.
2 changes: 1 addition & 1 deletion source/parametric_modeling.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module ParametricModeling

if Sketchup.version.to_i >= 17

VERSION = '0.0.5-dev'
VERSION = '0.0.5'

# Load translation if it's available for current locale.
TRANSLATE = LanguageHandler.new('pmg.translation')
Expand Down
24 changes: 24 additions & 0 deletions source/parametric_modeling/HTML Dialogs/images/align-node-icon.svg
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: 31px;
height: 31px;
width: 30px;
height: 30px;

cursor: pointer;

Expand Down
30 changes: 30 additions & 0 deletions source/parametric_modeling/HTML Dialogs/nodes-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -1057,6 +1057,8 @@ class GetPointsReteComponent extends Rete.Component {

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

var outputGroup = new Rete.Output('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)
Expand All @@ -1077,6 +1079,7 @@ class GetPointsReteComponent extends Rete.Component {

return node
.addInput(inputGroup)
.addOutput(outputGroup)
.addOutput(outputFrontBottomLeft)
.addOutput(outputFrontBottomRight)
.addOutput(outputFrontCenter)
Expand Down Expand Up @@ -1255,6 +1258,32 @@ class MoveReteComponent extends Rete.Component {

}

class AlignReteComponent extends Rete.Component {

constructor() {
super('Align')
}

builder(node) {

var inputGroup = new Rete.Input('groups', t('Group'), PMG.NodesEditor.sockets.groups)
var inputOrigin = new Rete.Input('origin', t('Origin'), PMG.NodesEditor.sockets.point)
var inputTarget = new Rete.Input('target', t('Target'), PMG.NodesEditor.sockets.point)

var outputGroup = new Rete.Output('groups', t('Group'), PMG.NodesEditor.sockets.groups)

return node
.addInput(inputGroup)
.addInput(inputOrigin)
.addInput(inputTarget)
.addOutput(outputGroup)

}

worker(_node, _inputs, _outputs) {}

}

class RotateReteComponent extends Rete.Component {

constructor() {
Expand Down Expand Up @@ -1624,6 +1653,7 @@ PMG.NodesEditor.initializeComponents = () => {
"Subtract solids": new SubtractSolidsReteComponent(),
"Push/Pull": new PushPullReteComponent(),
"Move": new MoveReteComponent(),
"Align": new AlignReteComponent(),
"Rotate": new RotateReteComponent(),
"Scale": new ScaleReteComponent(),
"Paint": new PaintReteComponent(),
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 @@ -68,6 +68,7 @@

<img class="node-icon" data-node-name="Push/Pull" />
<img class="node-icon" data-node-name="Move" />
<img class="node-icon" data-node-name="Align" />
<img class="node-icon" data-node-name="Rotate" />
<img class="node-icon" data-node-name="Scale" />
<img class="node-icon" data-node-name="Paint" />
Expand Down
3 changes: 3 additions & 0 deletions source/parametric_modeling/Resources/fr/pmg.translation
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@
"Increment distance"="Incrémenter la distance";
"Position"="Position";
"Position is absolute"="La position est absolue";
"Origin"="Origine";
"Target"="Cible";
"Axis"="Axe";
"Angle"="Angle";
"X factor"="Facteur X";
Expand Down Expand Up @@ -110,6 +112,7 @@
"Subtract solids"="Soustraire des solides";
"Push/Pull"="Pousser/Tirer";
"Move"="Déplacer";
"Align"="Aligner";
"Rotate"="Faire pivoter";
"Scale"="Mettre à l'échelle";
"Paint"="Peindre";
Expand Down
Loading

0 comments on commit 9ea7422

Please sign in to comment.