Skip to content

Commit

Permalink
Fixed broken compatibility with new variadic nodes (restored original…
Browse files Browse the repository at this point in the history
… nodes and renamed new ones)
  • Loading branch information
RodZill4 committed May 5, 2024
1 parent 6128931 commit f18b5da
Show file tree
Hide file tree
Showing 11 changed files with 532 additions and 117 deletions.
33 changes: 13 additions & 20 deletions addons/material_maker/nodes/sdboolean.mmg
Original file line number Diff line number Diff line change
@@ -1,58 +1,51 @@
{
"generic_size": 1,
"name": "sdboolean",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"op1": 0
"op": 0
},
"seed_int": 0,
"shader_model": {
"code": [
"float $(name_uv)_b = $b($uv);",
"",
"#for",
"$(name_uv)_b = $op# $s#($uv), $(name_uv)_b);",
"#end"
],
"code": "",
"global": "",
"inputs": [
{
"default": "0.0",
"label": "",
"longdesc": "The first shape, defined as a signed distance function",
"name": "b",
"shortdesc": "Base Shape",
"name": "in1",
"shortdesc": "Input1",
"type": "sdf2d"
},
{
"default": "0.0",
"label": "",
"longdesc": "The subsequent shape, defined as a signed distance function",
"name": "s#",
"shortdesc": "Shape#",
"longdesc": "The second shape, defined as a signed distance function",
"name": "in2",
"shortdesc": "Input2",
"type": "sdf2d"
}
],
"instance": "",
"longdesc": "Performs boolean operation(s) (union, intersection or difference) between two or more shapes",
"longdesc": "Performs a boolean operation (union, intersection or difference) between two shapes",
"name": "sdBoolean",
"outputs": [
{
"longdesc": "The shape generated by the boolean operation(s)",
"sdf2d": "$(name_uv)_b",
"longdesc": "The shape generated by the boolean operation",
"sdf2d": "$op $in1($uv), $in2($uv))",
"shortdesc": "Output",
"type": "sdf2d"
}
],
"parameters": [
{
"default": 0,
"label": "2:",
"default": 2,
"label": "",
"longdesc": "The operation performed by this node",
"name": "op#",
"name": "op",
"shortdesc": "Operation",
"type": "enum",
"values": [
Expand Down
77 changes: 77 additions & 0 deletions addons/material_maker/nodes/sdboolean_v.mmg
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"generic_size": 1,
"name": "sdboolean",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"op1": 0
},
"seed_int": 0,
"shader_model": {
"code": [
"float $(name_uv)_b = $b($uv);",
"",
"#for",
"$(name_uv)_b = $op# $s#($uv), $(name_uv)_b);",
"#end"
],
"global": "",
"inputs": [
{
"default": "0.0",
"label": "",
"longdesc": "The first shape, defined as a signed distance function",
"name": "b",
"shortdesc": "Base Shape",
"type": "sdf2d"
},
{
"default": "0.0",
"label": "",
"longdesc": "The subsequent shape, defined as a signed distance function",
"name": "s#",
"shortdesc": "Shape#",
"type": "sdf2d"
}
],
"instance": "",
"longdesc": "Performs boolean operation(s) (union, intersection or difference) between two or more shapes",
"name": "sdBoolean",
"outputs": [
{
"longdesc": "The shape generated by the boolean operation(s)",
"sdf2d": "$(name_uv)_b",
"shortdesc": "Output",
"type": "sdf2d"
}
],
"parameters": [
{
"default": 0,
"label": "2:",
"longdesc": "The operation performed by this node",
"name": "op#",
"shortdesc": "Operation",
"type": "enum",
"values": [
{
"name": "Union",
"value": "min("
},
{
"name": "Subtraction",
"value": "max(-"
},
{
"name": "Intersection",
"value": "max("
}
]
}
],
"shortdesc": "sdBoolean"
},
"type": "shader"
}
36 changes: 15 additions & 21 deletions addons/material_maker/nodes/sdf3d_boolean.mmg
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
{
"generic_size": 1,
"name": "sdf3d_boolean",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"op1": 0
"op": 0
},
"seed_int": 0,
"seed": 60292,
"seed_locked": true,
"shader_model": {
"code": [
"vec2 $(name_uv)_b = $b($uv);",
"",
"#for",
"$(name_uv)_b = $op#($s#($uv), $(name_uv)_b);",
"#end"
],
"code": "",
"global": [
"vec2 sdf3dc_union(vec2 a, vec2 b) {",
"\treturn vec2(min(a.x, b.x), mix(b.y, a.y, step(a.x, b.x)));",
Expand All @@ -34,36 +28,36 @@
"default": "vec2(100.0, 0.0)",
"label": "",
"longdesc": "The first shape, defined as a signed distance function",
"name": "b",
"shortdesc": "Base Shape",
"name": "in1",
"shortdesc": "Input1",
"type": "sdf3dc"
},
{
"default": "vec2(100.0, 0.0)",
"label": "",
"longdesc": "The subsequent shape, defined as a signed distance function",
"name": "s#",
"shortdesc": "Shape#",
"longdesc": "The second shape, defined as a signed distance function",
"name": "in2",
"shortdesc": "Input2",
"type": "sdf3dc"
}
],
"instance": "",
"longdesc": "Performs boolean operation(s) (union, intersection or difference) between two or more shapes",
"longdesc": "Performs a boolean operation (union, intersection or difference) between two shapes",
"name": "Boolean",
"outputs": [
{
"longdesc": "The shape generated by the boolean operation(s)",
"sdf3dc": "$(name_uv)_b",
"longdesc": "The shape generated by the boolean operation",
"sdf3dc": "$op($in1($uv), $in2($uv))",
"shortdesc": "Output",
"type": "sdf3dc"
}
],
"parameters": [
{
"default": 0,
"label": "2:",
"default": 2,
"label": "",
"longdesc": "The operation performed by this node",
"name": "op#",
"name": "op",
"shortdesc": "Operation",
"type": "enum",
"values": [
Expand Down
88 changes: 88 additions & 0 deletions addons/material_maker/nodes/sdf3d_boolean_v.mmg
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
{
"generic_size": 1,
"name": "sdf3d_boolean",
"node_position": {
"x": 0,
"y": 0
},
"parameters": {
"op1": 0
},
"seed_int": 0,
"shader_model": {
"code": [
"vec2 $(name_uv)_b = $b($uv);",
"",
"#for",
"$(name_uv)_b = $op#($s#($uv), $(name_uv)_b);",
"#end"
],
"global": [
"vec2 sdf3dc_union(vec2 a, vec2 b) {",
"\treturn vec2(min(a.x, b.x), mix(b.y, a.y, step(a.x, b.x)));",
"}",
"vec2 sdf3dc_sub(vec2 a, vec2 b) {",
"\treturn vec2(max(-a.x, b.x), a.y);",
"}",
"vec2 sdf3dc_inter(vec2 a, vec2 b) {",
"\treturn vec2(max(a.x, b.x), mix(a.y, b.y, step(a.x, b.x)));",
"}",
""
],
"inputs": [
{
"default": "vec2(100.0, 0.0)",
"label": "",
"longdesc": "The first shape, defined as a signed distance function",
"name": "b",
"shortdesc": "Base Shape",
"type": "sdf3dc"
},
{
"default": "vec2(100.0, 0.0)",
"label": "",
"longdesc": "The subsequent shape, defined as a signed distance function",
"name": "s#",
"shortdesc": "Shape#",
"type": "sdf3dc"
}
],
"instance": "",
"longdesc": "Performs boolean operation(s) (union, intersection or difference) between two or more shapes",
"name": "Boolean",
"outputs": [
{
"longdesc": "The shape generated by the boolean operation(s)",
"sdf3dc": "$(name_uv)_b",
"shortdesc": "Output",
"type": "sdf3dc"
}
],
"parameters": [
{
"default": 0,
"label": "2:",
"longdesc": "The operation performed by this node",
"name": "op#",
"shortdesc": "Operation",
"type": "enum",
"values": [
{
"name": "Union",
"value": "sdf3dc_union"
},
{
"name": "Subtraction",
"value": "sdf3dc_sub"
},
{
"name": "Intersection",
"value": "sdf3dc_inter"
}
]
}
],
"shortdesc": "Boolean"
},
"type": "shader"
}
Loading

0 comments on commit f18b5da

Please sign in to comment.