Skip to content

Commit

Permalink
feat(docs): patching section of the tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
evgenykochetkov committed Apr 8, 2019
1 parent 85596d7 commit a13f6f9
Show file tree
Hide file tree
Showing 5 changed files with 418 additions and 0 deletions.
18 changes: 18 additions & 0 deletions workspace/welcome-to-xod/300-creating-nodes/patch.xodp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"comments": [
{
"content": "# Creating your own nodes\n\nIn this part of the tutorial, you will learn how to create our own XOD nodes.\n\nWe will take an existing patch, and *extract* a part of it into a separate node and add pins to control hard-coded parameters. Then we will add labels and descriptions that will be displayed in the help panel for our node, just like in XOD's standard library.",
"id": "HJmjFoNFV",
"position": {
"units": "slots",
"x": 1,
"y": 1
},
"size": {
"height": 3,
"units": "slots",
"width": 7
}
}
]
}
141 changes: 141 additions & 0 deletions workspace/welcome-to-xod/301-create-new-patch/patch.xodp
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
{
"comments": [
{
"content": "# Creating a new patch\n\nHere is a patch that checks if a number is between `0.4` and `0.7`. Let's make it reusable. We will make a node that takes three numbers and outputs a boolean. (First number is the one we want to check and other two are boundaries instead of hard-coded `0.4` and `0.7`.)\n\n## Instructions\n\n1. Select `less`, `greater` and `nor` nodes and copy them.\n2. Select File -> New Patch... from the main menu.\n3. Choose a name (`between` is a nice one).\n4. Your new patch will open in a new tab. Paste nodes that you copied earlier inside.\n",
"id": "SkZ6KsEFE",
"position": {
"units": "slots",
"x": -1,
"y": 1
},
"size": {
"height": 4,
"units": "slots",
"width": 8
}
}
],
"links": [
{
"id": "BJosTaOKN",
"input": {
"nodeId": "BktiaTOtV",
"pinKey": "HkXK-dGob"
},
"output": {
"nodeId": "H1_YaadK4",
"pinKey": "rJqfIRdHwkW"
}
},
{
"id": "H1sKTTuKE",
"input": {
"nodeId": "H1_YaadK4",
"pinKey": "S1dG8AOBPJW"
},
"output": {
"nodeId": "BJpLTauYE",
"pinKey": "B19RYS3lW"
}
},
{
"id": "HkO96adK4",
"input": {
"nodeId": "BJpLTauYE",
"pinKey": "rJg00Nhe-"
},
"output": {
"nodeId": "Hy19pauKN",
"pinKey": "ByfGSDjQE"
}
},
{
"id": "SJ5tppdtV",
"input": {
"nodeId": "H1_YaadK4",
"pinKey": "r1tz8CdBDkb"
},
"output": {
"nodeId": "Hkh7TTOtN",
"pinKey": "HktZUCdrPkZ"
}
},
{
"id": "rkDqaadKE",
"input": {
"nodeId": "Hkh7TTOtN",
"pinKey": "HJjZLRdBw1-"
},
"output": {
"nodeId": "Hy19pauKN",
"pinKey": "ByfGSDjQE"
}
}
],
"nodes": [
{
"boundLiterals": {
"HJbACN3gb": "0.7"
},
"id": "BJpLTauYE",
"position": {
"units": "slots",
"x": 12,
"y": 4
},
"type": "xod/core/greater"
},
{
"id": "BktiaTOtV",
"position": {
"units": "slots",
"x": 9,
"y": 7
},
"size": {
"height": 1,
"units": "slots",
"width": 2
},
"type": "xod/debug/watch"
},
{
"id": "H1_YaadK4",
"position": {
"units": "slots",
"x": 9,
"y": 5
},
"type": "xod/core/nor"
},
{
"boundLiterals": {
"SJqZ8COrDkW": "0.4"
},
"id": "Hkh7TTOtN",
"position": {
"units": "slots",
"x": 9,
"y": 4
},
"type": "xod/core/less"
},
{
"boundLiterals": {
"ByfGSDjQE": "0.5"
},
"id": "Hy19pauKN",
"position": {
"units": "slots",
"x": 9,
"y": 2
},
"size": {
"height": 1,
"units": "slots",
"width": 2
},
"type": "xod/debug/tweak-number"
}
]
}
128 changes: 128 additions & 0 deletions workspace/welcome-to-xod/302-add-terminals/patch.xodp
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
{
"comments": [
{
"content": "# Terminals\n\nWe need a way for the between node to get values in and put values out. In XOD patch nodes interact with the outside world using terminal nodes. You can find the terminal nodes in `xod/patch-nodes` library, they are called `input-number`, `input-pulse`, `output-boolean`, etc.\n\nWe already placed an `input-number` and `output-boolean` instead of `tweak-number` and `watch`. Because of them, our node will have one number input pin and one boolean output. You can check it out by highlighting it in Project browser and invoking a help panel.\n\n## Instructions\n\n1. Add two more `input-number`s.\n2. Connect them to `less` and `greater`'s pins instead of hardcoded `0.4` and `0.7` values.\n3. Check how the node looks now in the help panel.\n\nNote that node's pin order is determined by the order of respective terminals. Try adding an `input-string` and moving it between other terminals.",
"id": "rkyWciVFV",
"position": {
"units": "slots",
"x": 0,
"y": 0
},
"size": {
"height": 5,
"units": "slots",
"width": 8
}
}
],
"links": [
{
"id": "BJId0a_FV",
"input": {
"nodeId": "r1gT8CaOYE",
"pinKey": "rJg00Nhe-"
},
"output": {
"nodeId": "SkX_Ca_YV",
"pinKey": "__out__"
}
},
{
"id": "HyfaUCp_FE",
"input": {
"nodeId": "rk-pLC6uYV",
"pinKey": "r1tz8CdBDkb"
},
"output": {
"nodeId": "S1T8RTdKV",
"pinKey": "HktZUCdrPkZ"
}
},
{
"id": "SJsvAaOFN",
"input": {
"nodeId": "ByYwA6dKN",
"pinKey": "__in__"
},
"output": {
"nodeId": "rk-pLC6uYV",
"pinKey": "rJqfIRdHwkW"
}
},
{
"id": "ryVOAp_YE",
"input": {
"nodeId": "S1T8RTdKV",
"pinKey": "HJjZLRdBw1-"
},
"output": {
"nodeId": "SkX_Ca_YV",
"pinKey": "__out__"
}
},
{
"id": "ryma8Cp_t4",
"input": {
"nodeId": "rk-pLC6uYV",
"pinKey": "S1dG8AOBPJW"
},
"output": {
"nodeId": "r1gT8CaOYE",
"pinKey": "B19RYS3lW"
}
}
],
"nodes": [
{
"id": "ByYwA6dKN",
"position": {
"units": "slots",
"x": 10,
"y": 6
},
"type": "xod/patch-nodes/output-boolean"
},
{
"boundLiterals": {
"SJqZ8COrDkW": "0.4"
},
"id": "S1T8RTdKV",
"position": {
"units": "slots",
"x": 10,
"y": 3
},
"type": "xod/core/less"
},
{
"id": "SkX_Ca_YV",
"position": {
"units": "slots",
"x": 10,
"y": 1
},
"type": "xod/patch-nodes/input-number"
},
{
"boundLiterals": {
"HJbACN3gb": "0.7"
},
"id": "r1gT8CaOYE",
"position": {
"units": "slots",
"x": 13,
"y": 3
},
"type": "xod/core/greater"
},
{
"id": "rk-pLC6uYV",
"position": {
"units": "slots",
"x": 10,
"y": 4
},
"type": "xod/core/nor"
}
]
}
88 changes: 88 additions & 0 deletions workspace/welcome-to-xod/303-use-our-new-node/patch.xodp
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"comments": [
{
"content": "# Using Our New Node\n\nNow you can use the new node just like any other. Add it from the Suggester or by dragging from the Project Browser.",
"id": "BkIsFbYY4",
"position": {
"units": "slots",
"x": 4,
"y": 2
},
"size": {
"height": 4,
"units": "slots",
"width": 8
}
}
],
"links": [
{
"id": "HyVFAaOY4",
"input": {
"nodeId": "ry4r9sVtV",
"pinKey": "SkX_Ca_YV"
},
"output": {
"nodeId": "rkZKC6dF4",
"pinKey": "ByfGSDjQE"
}
},
{
"id": "Sk65C6uY4",
"input": {
"nodeId": "HyKqCTOFN",
"pinKey": "HkXK-dGob"
},
"output": {
"nodeId": "ry4r9sVtV",
"pinKey": "ByYwA6dKN"
}
}
],
"nodes": [
{
"id": "HyKqCTOFN",
"position": {
"units": "slots",
"x": 14,
"y": 5
},
"size": {
"height": 1,
"units": "slots",
"width": 2
},
"type": "xod/debug/watch"
},
{
"boundLiterals": {
"ByfGSDjQE": "0.5"
},
"id": "rkZKC6dF4",
"position": {
"units": "slots",
"x": 14,
"y": 3
},
"size": {
"height": 1,
"units": "slots",
"width": 2
},
"type": "xod/debug/tweak-number"
},
{
"boundLiterals": {
"SybBlRdtN": "0.7",
"rygHlRuFV": "0.4"
},
"id": "ry4r9sVtV",
"position": {
"units": "slots",
"x": 14,
"y": 4
},
"type": "@/302-add-terminals"
}
]
}
Loading

0 comments on commit a13f6f9

Please sign in to comment.