From 34b97f10f95fa605475cfe0e40e84b62439e8659 Mon Sep 17 00:00:00 2001 From: Victor Doval <10011941+vicdoval@users.noreply.github.com> Date: Fri, 28 Feb 2020 08:34:07 +0100 Subject: [PATCH] Revert "Move mk3, Scale mk3 and Rotation m3 (#2899)" This reverts commit cb0ca3bedbacf20fb5b370ccc82501874c302c5f. --- data_structure.py | 6 - docs/nodes/transforms/move_mk2.rst | 58 ++++ docs/nodes/transforms/move_mk3.rst | 61 ---- .../{rotate_mk3.rst => rotation_mk2.rst} | 51 ++- .../{scale_mk3.rst => scale_mk2.rst} | 26 +- docs/nodes/transforms/transforms_index.rst | 6 +- index.md | 5 +- .../Design/Adaptive_Voronoi_panel.json | 114 +++---- json_examples/Design/Adaptive_per_face.json | 106 +++--- json_examples/Design/Color_Lights.json | 38 +-- json_examples/Introduction/BentTorus.json | 52 ++- .../Introduction/Donut_by_hands.json | 17 +- .../Keyboard_key_profile.json | 138 ++++---- json_examples/Shapes/Blender_logo.json | 98 +++--- json_examples/Shapes/Buddah_Lotus.json | 70 ++-- json_examples/Shapes/Donut.json | 200 +++++------ json_examples/Shapes/Sofa_Pillow.json | 14 +- {old_nodes => nodes/transforms}/move_mk2.py | 1 - nodes/transforms/move_mk3.py | 124 ------- nodes/transforms/rotate_mk3.py | 310 ------------------ .../transforms}/rotation_mk2.py | 4 +- {old_nodes => nodes/transforms}/scale_mk2.py | 2 +- nodes/transforms/scale_mk3.py | 127 ------- ui/nodes_replacement.py | 10 +- 24 files changed, 504 insertions(+), 1134 deletions(-) create mode 100644 docs/nodes/transforms/move_mk2.rst delete mode 100644 docs/nodes/transforms/move_mk3.rst rename docs/nodes/transforms/{rotate_mk3.rst => rotation_mk2.rst} (79%) rename docs/nodes/transforms/{scale_mk3.rst => scale_mk2.rst} (54%) rename {old_nodes => nodes/transforms}/move_mk2.py (94%) delete mode 100644 nodes/transforms/move_mk3.py delete mode 100644 nodes/transforms/rotate_mk3.py rename {old_nodes => nodes/transforms}/rotation_mk2.py (97%) rename {old_nodes => nodes/transforms}/scale_mk2.py (94%) delete mode 100644 nodes/transforms/scale_mk3.py diff --git a/data_structure.py b/data_structure.py index ffc1fba76..268345da1 100755 --- a/data_structure.py +++ b/data_structure.py @@ -261,15 +261,9 @@ def numpy_match_long_cycle(list_of_arrays): difl = maxl - array.shape[0] if difl > 0: if difl < array.shape[0]: - array = np.concatenate((array, array[:difl])) else: new_part = np.repeat(array, ceil(difl / array.shape[0]), axis=0) - if len(array.shape) > 1: - shape = (ceil(difl / array.shape[0]), 1) - else: - shape = ceil(difl / array.shape[0]) - new_part = np.tile(array, shape) array = np.concatenate((array, new_part[:difl])) out.append(array) return out diff --git a/docs/nodes/transforms/move_mk2.rst b/docs/nodes/transforms/move_mk2.rst new file mode 100644 index 000000000..d53f81434 --- /dev/null +++ b/docs/nodes/transforms/move_mk2.rst @@ -0,0 +1,58 @@ +Vector Move +=========== + +Functionality +------------- + +**equivalent to a Translate Transform** + +Moves incoming sets of Vertex Lists by a *Vector*. The Vector is bound to a multiplier (Scalar) which amplifies all components of the Vector. The resulting Vector is added to the locations of the incoming Vertices. + +You might use this to translate the center of an object away or towards from [0,0,0] in order to apply other transforms like Rotation and Scale. + + +Inputs & Parameters +------------------- + ++------------+-------------------------------------------------------------------------------------+ +| | Description | ++============+=====================================================================================+ +| Vertices | Vertex or Vertex Lists representing one or more objects | ++------------+-------------------------------------------------------------------------------------+ +| Vector | Vector to use for Translation, this is simple element wise addition to the Vector | +| | representations of the incoming vertices. If the input is Nested, it is possible | +| | to translate each sub-list by a different Vector. | ++------------+-------------------------------------------------------------------------------------+ +| Multiplier | Straightforward ``Vector * Scalar``, amplifies each element in the Vector parameter | ++------------+-------------------------------------------------------------------------------------+ + + +Outputs +------- + +A Vertex or nested Lists of Vertices + + +Examples +-------- + +This works for one vertice or many vertices + +.. image:: https://cloud.githubusercontent.com/assets/619340/4185766/ce3d6c1a-375a-11e4-86ea-6525a3e34dc3.PNG + :alt: VectorMoveDemo1.PNG + +*translate back to origin* + +.. image:: https://cloud.githubusercontent.com/assets/619340/4185765/ce3c512c-375a-11e4-9986-dc4a96777f0e.PNG + :alt: VectorMoveDemo2.PNG + +Move lists of matching nestedness. (whats that?! - elaborate) + +.. image:: https://cloud.githubusercontent.com/assets/619340/4185767/ce42339e-375a-11e4-926f-376f69b663bf.PNG + :alt: VectorMoveDemo3.PNG + +.. image:: https://cloud.githubusercontent.com/assets/619340/4185768/ce485684-375a-11e4-88dc-c35f1b2ce725.PNG + :alt: VectorMoveDemo4.PNG + +Notes +------- \ No newline at end of file diff --git a/docs/nodes/transforms/move_mk3.rst b/docs/nodes/transforms/move_mk3.rst deleted file mode 100644 index 0df06887f..000000000 --- a/docs/nodes/transforms/move_mk3.rst +++ /dev/null @@ -1,61 +0,0 @@ -Move -==== - -Functionality -------------- - -**equivalent to a Translate Transform** - -Moves incoming sets of Vertex Lists by a *Vector*. The Vector is bound to a multiplier (Scalar) which amplifies all components of the Vector. The resulting Vector is added to the locations of the incoming Vertices. - -Inputs & Parameters -------------------- - -+------------+-------------------------------------------------------------------------------------+ -| | Description | -+============+=====================================================================================+ -| Vertices | Vertex or Vertex Lists representing one or more objects | -+------------+-------------------------------------------------------------------------------------+ -| Movement | Vector to use for Translation, this is simple element wise addition to the Vector | -| Vectors | of the incoming vertices. | -+------------+-------------------------------------------------------------------------------------+ -| Strength | Straightforward ``Vector * Scalar``, amplifies each movement vector | -+------------+-------------------------------------------------------------------------------------+ - -Advanced Parameters -------------------- - -In the N-Panel (and on the right-click menu) you can find: - -**Output NumPy**: Output NumPy arrays in stead of regular lists (makes the node faster) - -**List Match**: Define how list with different lengths should be matched - -Outputs -------- - -A Vertex or nested Lists of Vertices - - -Examples --------- - -Moving a circle: - -.. image:: https://raw.githubusercontent.com/vicdoval/sverchok/docs_images/images_for_docs/transforms/move/move_vectors_blender_sverchok_example_1.png - - -Moving vertices along Y direction with a random multiplier - -.. image:: https://raw.githubusercontent.com/vicdoval/sverchok/docs_images/images_for_docs/transforms/move/move_vectors_blender_sverchok_example_2.png - :alt: VectorMoveDemo2.PNG - -The node will match different data structures, in this example a surface is generated from one Ngon - -.. image:: https://raw.githubusercontent.com/vicdoval/sverchok/docs_images/images_for_docs/transforms/move/move_vectors_blender_sverchok_example_3.png - - -With the List Matching properties we can create different data matches, in this case with "Cycle" a complex rhythm is generated - -.. image:: https://raw.githubusercontent.com/vicdoval/sverchok/docs_images/images_for_docs/transforms/move/move_vectors_blender_sverchok_example_4.png - :alt: VectorMoveDemo4.PNG diff --git a/docs/nodes/transforms/rotate_mk3.rst b/docs/nodes/transforms/rotation_mk2.rst similarity index 79% rename from docs/nodes/transforms/rotate_mk3.rst rename to docs/nodes/transforms/rotation_mk2.rst index bbb49e505..58526b6c4 100644 --- a/docs/nodes/transforms/rotate_mk3.rst +++ b/docs/nodes/transforms/rotation_mk2.rst @@ -1,5 +1,5 @@ -Rotate -====== +Rotation +======== Functionality ------------- @@ -15,7 +15,7 @@ Type of Rotation Description ======================= =========================================================================== Axis Rotation Based on axis (X, Y, Z) and a rotation angle (W) Euler Rotation Using Euler Gimbal: 3 axis with a hierarchical relationship between them -Quaternion rotation Based on four values (X, Y, Z, W). W value will avoid X, Y, Z rotation +Quaternion rotation Based on four values (X, Y, Z, W). W value will avoid X, Y, Z rotation ======================= =========================================================================== If you want to learn deeply about all this types of rotation, visit this link: http://wiki.blender.org/index.php/User:Pepribal/Ref/Appendices/Rotation @@ -44,9 +44,9 @@ All parameters except **Vertices** has a default value. **Angle** can be given b +----------------+---------------+-----------------+----------------------------------------------------+ -| Param | Type | Default | Description | +| Param | Type | Default | Description | +================+===============+=================+====================================================+ -| **Vertices** | Vertices | none | vertices to rotate | +| **Vertices** | Vertices | none | vertices to rotate | +----------------+---------------+-----------------+----------------------------------------------------+ | **Center** | Vertices | (0.0, 0.0, 0.0) | point to place the rotation axis | +----------------+---------------+-----------------+----------------------------------------------------+ @@ -58,15 +58,15 @@ All parameters except **Vertices** has a default value. **Angle** can be given b Outputs ^^^^^^^ -**Vertices**. +Only **Vertices** will be generated. Depending on the type of the inputs, if more than one angle is set, then more objects will be outputted. Example of usage ^^^^^^^^^^^^^^^^ -.. image:: https://raw.githubusercontent.com/vicdoval/sverchok/docs_images/images_for_docs/transforms/rotate/rotate_vectors_blender_sverchok_example_1.png +.. image:: https://cloud.githubusercontent.com/assets/5990821/4216976/adb4043a-38e1-11e4-8ff1-0ae83cbd9ccf.png :alt: AxisRotationDemo1.PNG -In this example we use axis rotation to rotate a torus around the X axis 45 degrees . +In this example we use axis rotation with multiple inputs in axis an angle to create a complex geometry from just one plane. Euler Rotation @@ -92,9 +92,9 @@ All parameters except **Vertices** has a default value. **X**, **Y** and **Z** c +----------------+---------------+-----------------+-----------------------------------------------------+ -| Param | Type | Default | Description | +| Param | Type | Default | Description | +================+===============+=================+=====================================================+ -| **Vertices** | Vertices | none | vertices to rotate | +| **Vertices** | Vertices | none | vertices to rotate | +----------------+---------------+-----------------+-----------------------------------------------------+ | **X** | Float | 0.00 | value to X axis rotation | +----------------+---------------+-----------------+-----------------------------------------------------+ @@ -108,24 +108,24 @@ All parameters except **Vertices** has a default value. **X**, **Y** and **Z** c Outputs ^^^^^^^ -**Vertices** +Only **Vertices** will be generated. Depending on the type of the inputs, if one or more inputs have multiple values, then more objects will be outputted. Example of usage ^^^^^^^^^^^^^^^^ -.. image::https://raw.githubusercontent.com/vicdoval/sverchok/docs_images/images_for_docs/transforms/rotate/rotate_vectors_blender_sverchok_example_2.png +.. image:: https://cloud.githubusercontent.com/assets/5990821/4216977/adb5f682-38e1-11e4-88f9-decc6485b81f.png :alt: EulerRotationDemo1.PNG -.. image:: https://raw.githubusercontent.com/vicdoval/sverchok/docs_images/images_for_docs/transforms/rotate/rotate_vectors_blender_sverchok_example_3.png +.. image:: https://cloud.githubusercontent.com/assets/5990821/4216975/adb3a990-38e1-11e4-8e3b-1584f37573e3.png :alt: EulerRotationDemo2.PNG -In the first example we use Euler rotation rotate the vertices of a line to create a 3d spiral -The second is more complex, with multiple inputs in Y and Z to create a complex geometry from just one line. +In the first example we use Euler rotation to perfomr a simple operation, we just rotate a plane around Z axis multiple times. +The second is more complex, with multiple inputs in Y and Z to create a complex geometry from just one plane, simulating infinite loop. Quaternion Rotation ------------------- -In this mode rotation is defined by 4 values (X, Y, Z, W), but it works in a different way than Axis Rotation. The important thing is the relation between all four values. For example, X value rotate the object around X axis up to 180 degrees. The effect of W is to avoid that rotation and leave the element with zero rotation. +In this mode rotation is defined by 4 velues (X, Y, Z, W), but it works in a different way than Axis Rotation. The important thing es the relation between all four values. For example, X value rotate the object around X axis up to 180 degrees. The effect of W is to avoid that rotation and leave the element with zero rotation. The final rotation is a combination of all four values. Inputs @@ -147,9 +147,9 @@ All parameters except **Vertices** has a default value. **X**, **Y**, **Z** and +----------------+---------------+-----------------+-----------------------------------------------------+ -| Param | Type | Default | Description | +| Param | Type | Default | Description | +================+===============+=================+=====================================================+ -| **Vertices** | Vertices | none | vertices to rotate | +| **Vertices** | Vertices | none | vertices to rotate | +----------------+---------------+-----------------+-----------------------------------------------------+ | **X** | Float | 0.00 | value to X axis rotation | +----------------+---------------+-----------------+-----------------------------------------------------+ @@ -163,21 +163,12 @@ All parameters except **Vertices** has a default value. **X**, **Y**, **Z** and Outputs ^^^^^^^ -**Vertices**. +Only **Vertices** will be generated. Depending on the type of the inputs, if one or more inputs have multiple values, then more objects will be outputted. Example of usage ^^^^^^^^^^^^^^^^ -.. image:: https://raw.githubusercontent.com/vicdoval/sverchok/docs_images/images_for_docs/transforms/rotate/rotate_vectors_blender_sverchok_example_4.png +.. image:: https://cloud.githubusercontent.com/assets/5990821/4216974/adab7018-38e1-11e4-9c43-78a2fdff2fe1.png :alt: QuatRotationDemo1.PNG -As we can see in this example, we try to rotate the plan 45 degrees and then set W with multiple values, each higher than before, but the plane is never get to rotate 180 degrees. - -Advanced Parameters -------------------- - -In the N-Panel (and on the right-click menu) you can find: - -**Output NumPy**: Output NumPy arrays in stead of regular lists (makes the node faster when you input one rotation value for each set of vertices) - -**List Match**: Define how list with different lengths should be matched +As we can see in this example, we try to rotate the plan 45 degrees and then set W with multiple values, each higher than before, but the plane is never get to rotate 180 degrees. \ No newline at end of file diff --git a/docs/nodes/transforms/scale_mk3.rst b/docs/nodes/transforms/scale_mk2.rst similarity index 54% rename from docs/nodes/transforms/scale_mk3.rst rename to docs/nodes/transforms/scale_mk2.rst index 9ae70f0a7..f4489473e 100644 --- a/docs/nodes/transforms/scale_mk3.rst +++ b/docs/nodes/transforms/scale_mk2.rst @@ -13,8 +13,7 @@ All inputs are vectorized and they will accept single or multiple values. There is three inputs: - **Vertices** -- **Centers** -- **Scale** +- **Center** - **Factor** Parameters @@ -24,15 +23,13 @@ All parameters except **Vertices** has a default value. **Factor** can be given +----------------+---------------+-----------------+----------------------------------------------------+ -| Param | Type | Default | Description | +| Param | Type | Default | Description | +================+===============+=================+====================================================+ -| **Vertices** | Vector | none | vertices to scale | +| **Vertices** | Vertices | none | vertices to scale | +----------------+---------------+-----------------+----------------------------------------------------+ -| **Centers** | Vector | (0.0, 0.0, 0.0) | point from which the scaling will be done | +| **Center** | Vertices | (0.0, 0.0, 0.0) | point from which the scaling will be done | +----------------+---------------+-----------------+----------------------------------------------------+ -| **Scale** | Vector | (1.0, 1.0, 1.0) | Axis scaling | -+----------------+---------------+-----------------+----------------------------------------------------+ -| **Multiplier** | Float | 1.0 | Uniform multiplier factor | +| **Factor** | Float | 1.0 | factor of scaling | +----------------+---------------+-----------------+----------------------------------------------------+ Outputs @@ -44,14 +41,7 @@ If you generate more outputs than inputs were given, then is probably that you n Example of usage ---------------- -Creating a spiral from a Circle: - -.. image:: https://raw.githubusercontent.com/vicdoval/sverchok/docs_images/images_for_docs/transforms/scale/scale_vectors_blender_sverchok_example_1.png - -The node will match different data structures, in this case this mechanism is used to create surface is generated from a line: - -.. image:: https://raw.githubusercontent.com/vicdoval/sverchok/docs_images/images_for_docs/transforms/scale/scale_vectors_blender_sverchok_example_2.png - -Deforming an icosphere into a distorted ovoid: +.. image:: https://cloud.githubusercontent.com/assets/5990821/4220292/73e9430e-3900-11e4-949f-02749baa7751.png + :alt: ScaleDemo1.PNG -.. image:: https://raw.githubusercontent.com/vicdoval/sverchok/docs_images/images_for_docs/transforms/scale/scale_vectors_blender_sverchok_example_3.png +In this example we use scale to convert a simple circle into a kind of parabola. \ No newline at end of file diff --git a/docs/nodes/transforms/transforms_index.rst b/docs/nodes/transforms/transforms_index.rst index 7a54cf68c..9ee18b61b 100644 --- a/docs/nodes/transforms/transforms_index.rst +++ b/docs/nodes/transforms/transforms_index.rst @@ -5,9 +5,9 @@ Transforms .. toctree:: :maxdepth: 2 - move_mk3 - scale_mk3 - rotate_mk3 + move_mk2 + scale_mk2 + rotation_mk2 apply barycentric_transform bend_along_path diff --git a/index.md b/index.md index 6f1bc322e..d97fbac72 100644 --- a/index.md +++ b/index.md @@ -93,10 +93,9 @@ SvChessSelection ## Transforms - SvMoveNodeMk3 - SvScaleNodeMk3 SvRotationNodeMK2 - SvRotationNodeMk3 + SvScaleNodeMK2 + SvMoveNodeMK2 SvSymmetrizeNode SvMirrorNodeMk2 MatrixApplyNode diff --git a/json_examples/Design/Adaptive_Voronoi_panel.json b/json_examples/Design/Adaptive_Voronoi_panel.json index 6f0eb2278..fee23d787 100644 --- a/json_examples/Design/Adaptive_Voronoi_panel.json +++ b/json_examples/Design/Adaptive_Voronoi_panel.json @@ -10,7 +10,7 @@ "Map Range": "Frame.001", "Map Range.001": "Frame", "Mesh Expression": "Frame", - "Move.001": "Frame.003", + "Move": "Frame.003", "Note": "Frame.002", "Note.001": "Frame.002", "Origins": "Frame.001", @@ -38,9 +38,7 @@ ], "params": { "float_": 2.380000114440918, - "float_draft_": 0.0, - "int_": 0, - "int_draft_": 0 + "int_": 0 }, "width": 140.0 }, @@ -55,9 +53,7 @@ ], "params": { "float_": 0.6699999570846558, - "float_draft_": 0.0, - "int_": 0, - "int_draft_": 0 + "int_": 0 }, "width": 140.0 }, @@ -111,7 +107,7 @@ }, "Frame": { "bl_idname": "NodeFrame", - "height": 319.0199279785156, + "height": 317.0199279785156, "hide": false, "label": "Donor", "location": [ @@ -119,11 +115,11 @@ 4.045716762542725 ], "params": {}, - "width": 397.815673828125 + "width": 397.8157958984375 }, "Frame.001": { "bl_idname": "NodeFrame", - "height": 378.7057800292969, + "height": 373.7057800292969, "hide": false, "label": "Donor parameters", "location": [ @@ -135,7 +131,7 @@ }, "Frame.002": { "bl_idname": "NodeFrame", - "height": 857.6201171875, + "height": 855.9534912109375, "hide": false, "label": "Recipient (Voronoi pattern)", "location": [ @@ -147,7 +143,7 @@ }, "Frame.003": { "bl_idname": "NodeFrame", - "height": 330.69970703125, + "height": 329.03302001953125, "hide": false, "label": "Randomize", "location": [ @@ -231,8 +227,8 @@ }, "width": 140.0 }, - "Move.001": { - "bl_idname": "SvMoveNodeMk3", + "Move": { + "bl_idname": "SvMoveNodeMK2", "height": 100.0, "hide": false, "label": "", @@ -240,9 +236,7 @@ -254.34125900268555, 190.09525871276855 ], - "params": { - "strength": 1.0 - }, + "params": {}, "width": 140.0 }, "Note": { @@ -550,23 +544,23 @@ [ "Plane MK2", 0, - "Move.001", + "Move", 0 ], [ "Vector Rewire", 0, - "Move.001", + "Move", 1 ], [ "A Number.001", 0, - "Move.001", + "Move", 2 ], [ - "Move.001", + "Move", 0, "Voronoi 2D", 0 @@ -609,14 +603,14 @@ ], [ "Flip normals", - "Vertices", - "Reroute.001", + "Polygons", + "Reroute", "Input" ], [ "Flip normals", - "Polygons", - "Reroute", + "Vertices", + "Reroute.001", "Input" ], [ @@ -640,57 +634,69 @@ [ "Vector Noise", 0, - "List Math.001", + "List Math", 0 ], [ "Vector Noise", 0, - "List Math", + "List Math.001", 0 ], [ "Vector Noise", 0, - "Map Range", + "Map Range.001", 0 ], [ "List Math", 0, - "Map Range", + "Map Range.001", 1 ], [ "List Math.001", 0, - "Map Range", + "Map Range.001", 2 ], + [ + "Map Range.001", + 0, + "Mesh Expression", + 0 + ], + [ + "Voronoi 2D", + 0, + "Viewer Draw Mk3.001", + 0 + ], + [ + "Voronoi 2D", + 1, + "Viewer Draw Mk3.001", + 1 + ], [ "Vector Noise", 0, - "Map Range.001", + "Map Range", 0 ], [ "List Math", 0, - "Map Range.001", + "Map Range", 1 ], [ "List Math.001", 0, - "Map Range.001", + "Map Range", 2 ], - [ - "Map Range.001", - 0, - "Mesh Expression", - 0 - ], [ "Reroute.001", "Output", @@ -722,40 +728,28 @@ 7 ], [ - "Adaptive Polygons Mk2", + "Move", 0, - "Viewer Draw Mk3", - 0 - ], - [ - "Adaptive Polygons Mk2", - 1, - "Viewer Draw Mk3", - 2 - ], - [ - "Voronoi 2D", - 0, - "Viewer Draw Mk3.001", + "Viewer Draw Mk3.002", 0 ], [ - "Voronoi 2D", + "Plane MK2", 1, - "Viewer Draw Mk3.001", + "Viewer Draw Mk3.002", 1 ], [ - "Move.001", + "Adaptive Polygons Mk2", 0, - "Viewer Draw Mk3.002", + "Viewer Draw Mk3", 0 ], [ - "Plane MK2", + "Adaptive Polygons Mk2", 1, - "Viewer Draw Mk3.002", - 1 + "Viewer Draw Mk3", + 2 ] ] } \ No newline at end of file diff --git a/json_examples/Design/Adaptive_per_face.json b/json_examples/Design/Adaptive_per_face.json index eeb3278e9..efb637eeb 100644 --- a/json_examples/Design/Adaptive_per_face.json +++ b/json_examples/Design/Adaptive_per_face.json @@ -8,8 +8,8 @@ "Map Range": "Frame.004", "Matrix in": "Frame.003", "Mesh Expression": "Frame.003", - "Move": "Frame.001", - "Move.002": "Frame", + "Move": "Frame", + "Move.001": "Frame.001", "Origins": "Frame.004", "Plane MK2": "Frame.002", "Proportional Edit Falloff": "Frame", @@ -39,9 +39,7 @@ ], "params": { "float_": 0.06000000238418579, - "float_draft_": 0.0, - "int_": 0, - "int_draft_": 0 + "int_": 0 }, "width": 140.0 }, @@ -56,9 +54,7 @@ ], "params": { "float_": 0.20000000298023224, - "float_draft_": 0.0, - "int_": 0, - "int_draft_": 0 + "int_": 0 }, "width": 140.0 }, @@ -97,7 +93,7 @@ }, "Frame": { "bl_idname": "NodeFrame", - "height": 387.03704833984375, + "height": 382.37030029296875, "hide": false, "label": "Buckle Up", "location": [ @@ -109,7 +105,7 @@ }, "Frame.001": { "bl_idname": "NodeFrame", - "height": 387.49041748046875, + "height": 382.49041748046875, "hide": false, "label": "Buckle Down", "location": [ @@ -121,7 +117,7 @@ }, "Frame.002": { "bl_idname": "NodeFrame", - "height": 648.910400390625, + "height": 643.910400390625, "hide": false, "label": "Recipient", "location": [ @@ -129,11 +125,11 @@ 35.03232192993164 ], "params": {}, - "width": 1808.922119140625 + "width": 1806.2554931640625 }, "Frame.003": { "bl_idname": "NodeFrame", - "height": 665.2750854492188, + "height": 661.941650390625, "hide": false, "label": "Donor", "location": [ @@ -141,11 +137,11 @@ 519.9917602539062 ], "params": {}, - "width": 960.30224609375 + "width": 957.6356201171875 }, "Frame.004": { "bl_idname": "NodeFrame", - "height": 282.80242919921875, + "height": 281.1357421875, "hide": false, "label": "Donor Parameters", "location": [ @@ -208,31 +204,27 @@ "width": 140.0 }, "Move": { - "bl_idname": "SvMoveNodeMk3", + "bl_idname": "SvMoveNodeMK2", "height": 100.0, "hide": false, "label": "", "location": [ - 679.4505615234375, - 746.8767433166504 + -47.5662841796875, + 772.3497047424316 ], - "params": { - "strength": 1.0 - }, + "params": {}, "width": 140.0 }, - "Move.002": { - "bl_idname": "SvMoveNodeMk3", + "Move.001": { + "bl_idname": "SvMoveNodeMK2", "height": 100.0, "hide": false, "label": "", "location": [ - -47.5662841796875, - 772.3497047424316 + 679.4505615234375, + 746.8767433166504 ], - "params": { - "strength": 1.0 - }, + "params": {}, "width": 140.0 }, "Origins": { @@ -560,26 +552,32 @@ "Proportional Edit Falloff", 1 ], + [ + "Plane MK2", + "Polygons", + "Reroute.002", + "Input" + ], [ "Plane MK2", 0, - "Move.002", + "Move", 0 ], [ "Vector in", 0, - "Move.002", + "Move", 1 ], [ "Proportional Edit Falloff", 0, - "Move.002", + "Move", 2 ], [ - "Move.002", + "Move", 0, "Select mesh elements by location.001", 0 @@ -591,7 +589,7 @@ 2 ], [ - "Move.002", + "Move", 0, "Proportional Edit Falloff.001", 0 @@ -603,35 +601,29 @@ 1 ], [ - "Move.002", - 0, "Move", + 0, + "Move.001", 0 ], [ "Vector in.001", 0, - "Move", + "Move.001", 1 ], [ "Proportional Edit Falloff.001", 0, - "Move", + "Move.001", 2 ], [ - "Move", - "Vertices", + "Move.001", + "vertices", "Reroute", "Input" ], - [ - "Plane MK2", - "Polygons", - "Reroute.002", - "Input" - ], [ "Reroute", "Output", @@ -662,18 +654,6 @@ "Reroute.001", "Input" ], - [ - "Reroute", - "Output", - "Viewer Draw Mk3.001", - "verts" - ], - [ - "Reroute.002", - "Output", - "Viewer Draw Mk3.001", - "faces" - ], [ "Reroute.001", "Output", @@ -788,6 +768,18 @@ "Viewer BMesh", 3 ], + [ + "Reroute", + "Output", + "Viewer Draw Mk3.001", + "verts" + ], + [ + "Reroute.002", + "Output", + "Viewer Draw Mk3.001", + "faces" + ], [ "Viewer BMesh", 0, diff --git a/json_examples/Design/Color_Lights.json b/json_examples/Design/Color_Lights.json index 9afb437d5..50f0cc0af 100644 --- a/json_examples/Design/Color_Lights.json +++ b/json_examples/Design/Color_Lights.json @@ -224,18 +224,16 @@ "params": {}, "width": 140.0 }, - "Move.001": { - "bl_idname": "SvMoveNodeMk3", + "Move": { + "bl_idname": "SvMoveNodeMK2", "height": 100.0, "hide": false, "label": "", "location": [ - -187.34600830078125, - 119.96371459960938 + -166.12974548339844, + 121.28948974609375 ], - "params": { - "strength": 1.0 - }, + "params": {}, "width": 140.0 }, "Plane MK2": { @@ -300,18 +298,6 @@ } }, "update_lists": [ - [ - "Line", - 0, - "Move.001", - 0 - ], - [ - "Vector in", - 0, - "Move.001", - 1 - ], [ "List Input", 0, @@ -337,7 +323,19 @@ 0 ], [ - "Move.001", + "Line", + 0, + "Move", + 0 + ], + [ + "Vector in", + 0, + "Move", + 1 + ], + [ + "Move", 0, "Lamp.001", 0 diff --git a/json_examples/Introduction/BentTorus.json b/json_examples/Introduction/BentTorus.json index e852f9e8b..daa207f60 100644 --- a/json_examples/Introduction/BentTorus.json +++ b/json_examples/Introduction/BentTorus.json @@ -2,7 +2,7 @@ "export_version": "0.079", "framed_nodes": { "A Number": "Frame.001", - "Move.001": "Frame.001", + "Move": "Frame.001", "Note.001": "Frame", "Note.002": "Frame.001", "Plane MK2": "Frame.001", @@ -18,13 +18,11 @@ "label": "Plane Size", "location": [ -1115.8090147972107, - -101.10517883300781 + -101.10517501831055 ], "params": { "float_": 0.0, - "float_draft_": 0.0, "int_": 6, - "int_draft_": 0, "selected_mode": "int" }, "width": 140.0 @@ -45,7 +43,7 @@ }, "Frame": { "bl_idname": "NodeFrame", - "height": 547.8262939453125, + "height": 547.7862548828125, "hide": false, "label": "Donor", "location": [ @@ -53,11 +51,11 @@ 10.079999923706055 ], "params": {}, - "width": 333.60284423828125 + "width": 334.082763671875 }, "Frame.001": { "bl_idname": "NodeFrame", - "height": 524.8558959960938, + "height": 525.1359252929688, "hide": false, "label": "Recipient", "location": [ @@ -65,7 +63,7 @@ -51.75472640991211 ], "params": {}, - "width": 831.7874145507812 + "width": 832.2673950195312 }, "List Split": { "bl_idname": "SvListSplitNode", @@ -81,8 +79,8 @@ }, "width": 140.0 }, - "Move.001": { - "bl_idname": "SvMoveNodeMk3", + "Move": { + "bl_idname": "SvMoveNodeMK2", "height": 100.0, "hide": false, "label": "", @@ -90,9 +88,7 @@ -484.02160024642944, 3.855915069580078 ], - "params": { - "strength": 1.0 - }, + "params": {}, "width": 140.0 }, "Note": { @@ -205,7 +201,7 @@ "label": "", "location": [ -675.0626769065857, - -49.35852813720703 + -49.358527183532715 ], "params": { "octaves": 2 @@ -295,38 +291,38 @@ [ "Plane MK2", 0, - "Move.001", + "Move", 0 ], [ "Vector Turbulence", 0, - "Move.001", + "Move", 1 ], [ - "Move.001", + "Move", 0, - "List Split", + "Viewer Draw Mk3", 0 ], [ - "A Number", - 0, - "List Split", - 1 + "Plane MK2", + 2, + "Viewer Draw Mk3", + 2 ], [ - "Move.001", + "Move", 0, - "Viewer Draw Mk3", + "List Split", 0 ], [ - "Plane MK2", - 2, - "Viewer Draw Mk3", - 2 + "A Number", + 0, + "List Split", + 1 ], [ "Torus", diff --git a/json_examples/Introduction/Donut_by_hands.json b/json_examples/Introduction/Donut_by_hands.json index b9cbb77be..d6fa2ffe0 100644 --- a/json_examples/Introduction/Donut_by_hands.json +++ b/json_examples/Introduction/Donut_by_hands.json @@ -60,8 +60,8 @@ }, "width": 140.0 }, - "Move.001": { - "bl_idname": "SvMoveNodeMk3", + "Move": { + "bl_idname": "SvMoveNodeMK2", "height": 100.0, "hide": false, "label": "", @@ -69,9 +69,7 @@ 137.00262451171875, 245.15399169921875 ], - "params": { - "strength": 1.0 - }, + "params": {}, "width": 140.0 }, "Number Range": { @@ -85,10 +83,13 @@ ], "params": { "count_": 16, + "mode": 3, "number_mode": "float", "range_mode": "RANGE_COUNT", "start_float": 0.0, + "step_": 60.0, "step_float": 60.0, + "stop_": 360.0, "stop_float": 360.0 }, "width": 140.0 @@ -181,17 +182,17 @@ [ "Circle", 0, - "Move.001", + "Move", 0 ], [ "Vectors in", 0, - "Move.001", + "Move", 1 ], [ - "Move.001", + "Move", 0, "Apply matrix for vectors", 0 diff --git a/json_examples/ParametricModelling/Keyboard_key_profile.json b/json_examples/ParametricModelling/Keyboard_key_profile.json index 244e83165..7de2de36f 100644 --- a/json_examples/ParametricModelling/Keyboard_key_profile.json +++ b/json_examples/ParametricModelling/Keyboard_key_profile.json @@ -9,14 +9,12 @@ "hide": false, "label": "", "location": [ - -430.605712890625, - -96.57962799072266 + -408.0633850097656, + -87.2991943359375 ], "params": { "float_": 2.049999952316284, - "float_draft_": 0.0, - "int_": 0, - "int_draft_": 0 + "int_": 0 }, "width": 140.0 }, @@ -26,14 +24,12 @@ "hide": false, "label": "", "location": [ - -616.9644775390625, - -323.5589599609375 + -594.422119140625, + -314.2785339355469 ], "params": { "float_": 2.0, - "float_draft_": 0.0, - "int_": 0, - "int_draft_": 0 + "int_": 0 }, "width": 140.0 }, @@ -43,14 +39,12 @@ "hide": false, "label": "", "location": [ - -700.0881958007812, - -563.3015747070312 + -677.5458374023438, + -554.0211181640625 ], "params": { "float_": 9.639999389648438, - "float_draft_": 0.0, - "int_": 0, - "int_draft_": 0 + "int_": 0 }, "width": 140.0 }, @@ -60,43 +54,37 @@ "hide": false, "label": "", "location": [ - -444.0143127441406, - -9.854941368103027 + -421.47198486328125, + -0.5745044350624084 ], "params": { "float_": 0.7200000286102295, - "float_draft_": 0.0, - "int_": 0, - "int_draft_": 0 + "int_": 0 }, "width": 140.0 }, "Move": { - "bl_idname": "SvMoveNodeMk3", + "bl_idname": "SvMoveNodeMK2", "height": 100.0, "hide": false, "label": "", "location": [ - 373.3113708496094, - -340.7271728515625 + 379.827392578125, + -79.8314208984375 ], - "params": { - "strength": 1.0 - }, + "params": {}, "width": 140.0 }, - "Move.002": { - "bl_idname": "SvMoveNodeMk3", + "Move.001": { + "bl_idname": "SvMoveNodeMK2", "height": 100.0, "hide": false, "label": "", "location": [ - 379.827392578125, - -79.8314208984375 + 373.3113708496094, + -340.7271728515625 ], - "params": { - "strength": 1.0 - }, + "params": {}, "width": 140.0 }, "Profile Parametric Mk3": { @@ -105,8 +93,8 @@ "hide": false, "label": "", "location": [ - -178.27545166015625, - 93.1209945678711 + -155.7331085205078, + 102.40142822265625 ], "params": { "filename": "Text", @@ -121,8 +109,8 @@ "hide": false, "label": "", "location": [ - 89.76090240478516, - 35.54173278808594 + 112.3032455444336, + 44.82217025756836 ], "params": { "current_mode": "EULER", @@ -137,8 +125,8 @@ "hide": false, "label": "", "location": [ - 96.58085632324219, - -481.4555969238281 + 119.12319946289062, + -472.1751708984375 ], "params": { "current_mode": "EULER", @@ -152,8 +140,8 @@ "hide": false, "label": "", "location": [ - -434.0495910644531, - -583.1076049804688 + -411.50726318359375, + -573.8271484375 ], "params": { "current_op": "NEG", @@ -167,8 +155,8 @@ "hide": false, "label": "", "location": [ - -438.2762145996094, - -230.544921875 + -415.73388671875, + -221.2644805908203 ], "params": { "current_op": "NEG", @@ -182,8 +170,8 @@ "hide": false, "label": "", "location": [ - 669.1881713867188, - -16.67555809020996 + 691.7305297851562, + -7.395121097564697 ], "params": { "cap_U": 1, @@ -205,8 +193,8 @@ "hide": false, "label": "", "location": [ - 907.2828369140625, - 84.55482482910156 + 929.8251953125, + 93.83525848388672 ], "params": { "activate": 1, @@ -221,8 +209,8 @@ "hide": false, "label": "", "location": [ - -253.00404357910156, - -290.7388916015625 + -230.46170043945312, + -281.4584655761719 ], "params": { "x_": 0.0, @@ -236,8 +224,8 @@ "hide": false, "label": "", "location": [ - -266.0361022949219, - -448.5808410644531 + -243.49375915527344, + -439.3004150390625 ], "params": { "x_": 0.0, @@ -248,11 +236,17 @@ }, "update_lists": [ [ - "A Number.002", + "A Number.001", 0, - "Scalar Math", + "Scalar Math.002", 0 ], + [ + "Scalar Math.002", + 0, + "Vector in", + 1 + ], [ "A Number", 0, @@ -265,18 +259,6 @@ "Profile Parametric Mk3", 2 ], - [ - "Profile Parametric Mk3", - 0, - "Rotation", - 0 - ], - [ - "Scalar Math", - 0, - "Rotation", - 1 - ], [ "Profile Parametric Mk3", 0, @@ -298,47 +280,53 @@ [ "Rotation.002", 0, - "Move", + "Move.001", 0 ], [ "Vector in.001", 0, - "Move", + "Move.001", 1 ], [ - "A Number.001", + "A Number.002", 0, - "Scalar Math.002", + "Scalar Math", 0 ], [ - "Scalar Math.002", + "Profile Parametric Mk3", 0, - "Vector in", + "Rotation", + 0 + ], + [ + "Scalar Math", + 0, + "Rotation", 1 ], [ "Rotation", 0, - "Move.002", + "Move", 0 ], [ "Vector in", 0, - "Move.002", + "Move", 1 ], [ - "Move.002", + "Move", 0, "UV Connection", 0 ], [ - "Move", + "Move.001", 0, "UV Connection", 1 diff --git a/json_examples/Shapes/Blender_logo.json b/json_examples/Shapes/Blender_logo.json index 6f454063a..c5792d847 100644 --- a/json_examples/Shapes/Blender_logo.json +++ b/json_examples/Shapes/Blender_logo.json @@ -89,9 +89,7 @@ ], "params": { "float_": 0.25, - "float_draft_": 0.0, - "int_": 0, - "int_draft_": 0 + "int_": 0 }, "width": 140.0 }, @@ -200,31 +198,27 @@ "width": 140.0 }, "Move": { - "bl_idname": "SvMoveNodeMk3", + "bl_idname": "SvMoveNodeMK2", "height": 100.0, "hide": false, "label": "", "location": [ - 2145.69677734375, - 251.08917236328125 + -82.24569702148438, + 300.9383239746094 ], - "params": { - "strength": 1.0 - }, + "params": {}, "width": 140.0 }, - "Move.002": { - "bl_idname": "SvMoveNodeMk3", + "Move.001": { + "bl_idname": "SvMoveNodeMK2", "height": 100.0, "hide": false, "label": "", "location": [ - -82.24569702148438, - 300.9383239746094 + 2145.69677734375, + 251.08917236328125 ], - "params": { - "strength": 1.0 - }, + "params": {}, "width": 140.0 }, "Perspective": { @@ -238,9 +232,7 @@ ], "params": { "float_": 0.0, - "float_draft_": 0.0, - "int_": 0, - "int_draft_": 0 + "int_": 0 }, "width": 140.0 }, @@ -269,9 +261,7 @@ ], "params": { "float_": 0.4000000059604645, - "float_draft_": 0.0, - "int_": 0, - "int_draft_": 0 + "int_": 0 }, "width": 140.0 }, @@ -321,9 +311,7 @@ ], "params": { "float_": 2.0, - "float_draft_": 0.0, - "int_": 0, - "int_draft_": 0 + "int_": 0 }, "width": 140.0 }, @@ -392,23 +380,23 @@ [ "List Slice.001", 0, - "Move.002", + "Move", 0 ], [ "List Slice", 0, - "Move.002", + "Move", 1 ], [ "Tails", 0, - "Move.002", + "Move", 2 ], [ - "Move.002", + "Move", 0, "UV Connection", 0 @@ -419,12 +407,6 @@ "UV Connection", 1 ], - [ - "Radi", - 0, - "Circle.002", - 0 - ], [ "Circle", 1, @@ -479,28 +461,34 @@ "Contour 2D", 3 ], + [ + "Radi", + 0, + "Circle.002", + 0 + ], [ "Contour 2D", - 1, - "List Join.003", + 0, + "List Join.002", 0 ], [ "Circle.002", - 1, - "List Join.003", + 0, + "List Join.002", 1 ], [ "Contour 2D", - 0, - "List Join.002", + 1, + "List Join.003", 0 ], [ "Circle.002", - 0, - "List Join.002", + 1, + "List Join.003", 1 ], [ @@ -528,49 +516,49 @@ 1 ], [ - "Perspective", + "Mesh Join.001", 0, - "Vector in", + "Proportional Edit Falloff", 0 ], [ - "Perspective", + "Select mesh elements by location", 0, - "Vector in", + "Proportional Edit Falloff", 1 ], [ - "Mesh Join.001", + "Perspective", 0, - "Proportional Edit Falloff", + "Vector in", 0 ], [ - "Select mesh elements by location", + "Perspective", 0, - "Proportional Edit Falloff", + "Vector in", 1 ], [ "Mesh Join.001", 0, - "Move", + "Move.001", 0 ], [ "Vector in", 0, - "Move", + "Move.001", 1 ], [ "Proportional Edit Falloff", 0, - "Move", + "Move.001", 2 ], [ - "Move", + "Move.001", 0, "VD Experimental", 0 diff --git a/json_examples/Shapes/Buddah_Lotus.json b/json_examples/Shapes/Buddah_Lotus.json index e5dc6b209..fb10cee2f 100644 --- a/json_examples/Shapes/Buddah_Lotus.json +++ b/json_examples/Shapes/Buddah_Lotus.json @@ -13,7 +13,7 @@ "Frame.008": "Frame.002", "Matrix in": "Frame.003", "Matrix in.001": "Frame.007", - "Move.001": "Frame.007", + "Move": "Frame.007", "Number Range": "Frame.006", "Objects in Lite": "Frame.001", "Scalar Math": "Frame.005", @@ -42,11 +42,9 @@ ], "params": { "float_": 0.0, - "float_draft_": 0.0, "float_max": 0.0, "float_min": 0.0, "int_": 0, - "int_draft_": 0, "show_limits": 0 }, "width": 140.0 @@ -62,9 +60,7 @@ ], "params": { "float_": 0.0, - "float_draft_": 0.0, "int_": 40, - "int_draft_": 0, "int_max": 40, "int_min": 1, "selected_mode": "int", @@ -84,9 +80,7 @@ ], "params": { "float_": 0.0, - "float_draft_": 0.0, "int_": 8, - "int_draft_": 0, "int_max": 8, "int_min": 8, "selected_mode": "int", @@ -116,7 +110,7 @@ }, "Frame.001": { "bl_idname": "NodeFrame", - "height": 291.18707275390625, + "height": 292.31988525390625, "hide": false, "label": "buddah", "location": [ @@ -124,11 +118,11 @@ -49.86566162109375 ], "params": {}, - "width": 400.0 + "width": 400.47998046875 }, "Frame.002": { "bl_idname": "NodeFrame", - "height": 722.866943359375, + "height": 723.5469970703125, "hide": false, "label": "lotus", "location": [ @@ -136,11 +130,11 @@ -204.2548065185547 ], "params": {}, - "width": 2040.1749267578125 + "width": 2041.1348876953125 }, "Frame.003": { "bl_idname": "NodeFrame", - "height": 288.82122802734375, + "height": 290.07403564453125, "hide": false, "label": "circle", "location": [ @@ -148,11 +142,11 @@ -2.66998291015625 ], "params": {}, - "width": 423.2730712890625 + "width": 423.7530517578125 }, "Frame.004": { "bl_idname": "NodeFrame", - "height": 90.0, + "height": 90.719970703125, "hide": false, "label": "saint number", "location": [ @@ -160,11 +154,11 @@ 27.570816040039062 ], "params": {}, - "width": 200.0 + "width": 200.47998046875 }, "Frame.005": { "bl_idname": "NodeFrame", - "height": 662.866943359375, + "height": 663.06689453125, "hide": false, "label": "limits", "location": [ @@ -172,11 +166,11 @@ 178.46022033691406 ], "params": {}, - "width": 214.9697265625 + "width": 215.44976806640625 }, "Frame.006": { "bl_idname": "NodeFrame", - "height": 235.1334228515625, + "height": 234.57342529296875, "hide": false, "label": "life stages", "location": [ @@ -184,11 +178,11 @@ 60.00001525878906 ], "params": {}, - "width": 909.409423828125 + "width": 909.889404296875 }, "Frame.007": { "bl_idname": "NodeFrame", - "height": 346.133056640625, + "height": 346.81304931640625, "hide": false, "label": "nirvana", "location": [ @@ -196,11 +190,11 @@ -0.753082275390625 ], "params": {}, - "width": 400.0 + "width": 400.47998046875 }, "Frame.008": { "bl_idname": "NodeFrame", - "height": 90.0, + "height": 90.719970703125, "hide": false, "label": " ", "location": [ @@ -208,7 +202,7 @@ 52.69804382324219 ], "params": {}, - "width": 200.0 + "width": 200.4801025390625 }, "Matrix in": { "bl_idname": "SvMatrixGenNodeMK2", @@ -247,8 +241,8 @@ }, "width": 140.0 }, - "Move.001": { - "bl_idname": "SvMoveNodeMk3", + "Move": { + "bl_idname": "SvMoveNodeMK2", "height": 100.0, "hide": false, "label": "", @@ -257,8 +251,7 @@ -415.5169372558594 ], "params": { - "separate": 0, - "strength": 1.0 + "separate": 0 }, "width": 140.0 }, @@ -273,10 +266,13 @@ ], "params": { "count_": 11, + "mode": 2, "number_mode": "float", "range_mode": "RANGE_COUNT", + "start_": 0.0, "start_float": 0.0, "step_float": 1.0, + "stop_": 10.0, "stop_float": 10.0 }, "width": 140.0 @@ -578,18 +574,18 @@ "Scalar Math.006", 0 ], - [ - "Scalar Math.006", - 0, - "Scalar Math.007", - 0 - ], [ "Scalar Math.001", 0, "Circle", 1 ], + [ + "Scalar Math.006", + 0, + "Scalar Math.007", + 0 + ], [ "Scalar Math.005", 0, @@ -605,23 +601,23 @@ [ "Circle", 0, - "Move.001", + "Move", 0 ], [ "Circle", 0, - "Move.001", + "Move", 1 ], [ "Scalar Math.008", 0, - "Move.001", + "Move", 2 ], [ - "Move.001", + "Move", 0, "Viewer Draw Mk3.001", 0 diff --git a/json_examples/Shapes/Donut.json b/json_examples/Shapes/Donut.json index ce173a17a..5992e1201 100644 --- a/json_examples/Shapes/Donut.json +++ b/json_examples/Shapes/Donut.json @@ -6,8 +6,8 @@ "Matrix Track To": "Tangent Move", "Matrix in": "Tangent Move", "Matrix out": "Tangent Move", - "Move": "Bottom Flat", - "Move.002": "Tangent Move", + "Move": "Tangent Move", + "Move.001": "Bottom Flat", "Note.001": "Tangent Move", "Note.003": "Fractal", "Note.005": "Tangent Move", @@ -15,7 +15,7 @@ "Note.008": "Bottom Flat", "Proportional Edit Falloff": "Bottom Flat", "Scale": "Fractal", - "Scale.002": "Fractal", + "Scale.001": "Fractal", "Select mesh elements by location.001": "Bottom Flat", "Vector Noise": "Fractal", "Vector in": "Bottom Flat", @@ -42,7 +42,7 @@ }, "Bottom Flat": { "bl_idname": "NodeFrame", - "height": 605.8386840820312, + "height": 606.2786254882812, "hide": false, "label": "Make Bottom Flat", "location": [ @@ -50,11 +50,11 @@ 10.079999923706055 ], "params": {}, - "width": 599.3994140625 + "width": 599.87939453125 }, "Fractal": { "bl_idname": "NodeFrame", - "height": 401.1192626953125, + "height": 401.27923583984375, "hide": false, "label": "Fractal vectors", "location": [ @@ -62,7 +62,7 @@ 193.4789276123047 ], "params": {}, - "width": 606.992431640625 + "width": 607.472412109375 }, "Inset faces": { "bl_idname": "SvInsetFaces", @@ -73,7 +73,6 @@ 2257.6279296875, 607.4078979492188 ], - "mask_type": [], "params": { "depth": 0.029999995604157448, "inset_type": "region", @@ -135,32 +134,29 @@ "width": 140.0 }, "Move": { - "bl_idname": "SvMoveNodeMk3", + "bl_idname": "SvMoveNodeMK2", "height": 100.0, "hide": false, "label": "", "location": [ - 2974.266345977783, - 914.8750438690186 + 2058.213367462158, + 192.87377738952637 ], "params": { - "strength": 1.0 + "mult_": 1.0 }, "width": 140.0 }, - "Move.002": { - "bl_idname": "SvMoveNodeMk3", + "Move.001": { + "bl_idname": "SvMoveNodeMK2", "height": 100.0, "hide": false, "label": "", "location": [ - 2058.213367462158, - 192.87377738952637 + 2974.266345977783, + 910.5752391815186 ], - "params": { - "mult_": 1.0, - "strength": 1.0 - }, + "params": {}, "width": 140.0 }, "Note": { @@ -345,7 +341,7 @@ }, "Output": { "bl_idname": "NodeFrame", - "height": 546.9617919921875, + "height": 548.0018310546875, "hide": false, "label": "Output", "location": [ @@ -353,7 +349,7 @@ 10.079999923706055 ], "params": {}, - "width": 483.674072265625 + "width": 484.154052734375 }, "Proportional Edit Falloff": { "bl_idname": "SvProportionalEditNode", @@ -430,32 +426,30 @@ "width": 16.0 }, "Scale": { - "bl_idname": "SvScaleNodeMk3", + "bl_idname": "SvScaleNodeMK2", "height": 100.0, "hide": false, "label": "", "location": [ - 975.0332698822021, - 832.4366912841797 + 568.0407161712646, + 797.7181854248047 ], "params": { - "factor_": 0.1600000262260437, - "multiplier": 0.1600000262260437 + "factor_": 1.0899999141693115 }, "width": 140.0 }, - "Scale.002": { - "bl_idname": "SvScaleNodeMk3", + "Scale.001": { + "bl_idname": "SvScaleNodeMK2", "height": 100.0, "hide": false, "label": "", "location": [ - 568.0407161712646, - 797.7181854248047 + 975.0332698822021, + 832.4366912841797 ], "params": { - "factor_": 1.0899999141693115, - "multiplier": 1.0899999141693115 + "factor_": 0.1600000262260437 }, "width": 140.0 }, @@ -524,7 +518,7 @@ }, "Tangent Move": { "bl_idname": "NodeFrame", - "height": 535.873779296875, + "height": 536.5537719726562, "hide": false, "label": "Move along Tangents", "location": [ @@ -532,7 +526,7 @@ 10.079999923706055 ], "params": {}, - "width": 1703.2313232421875 + "width": 1703.71142578125 }, "Torus": { "bl_idname": "SvTorusNode", @@ -625,7 +619,29 @@ 437.2855052947998 ], "params": { - "autosmooth": 1 + "autosmooth": 1, + "lp": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] }, "use_custom_color": true, "width": 140.0 @@ -640,36 +656,24 @@ ], [ "Torus", - "Vertices", - "Reroute", + "Edges", + "Reroute.002", "Input" ], [ + "Torus", + "Vertices", "Reroute", - "Output", - "Vertex Normal", - "Vertices" - ], - [ - "Reroute.001", - "Output", - "Vertex Normal", - "Polygons" - ], - [ - "Vertex Normal", - 0, - "Matrix Track To", - 3 + "Input" ], [ "Reroute", "Output", - "Scale.002", - "Vertices" + "Scale", + "vertices" ], [ - "Scale.002", + "Scale", 0, "Vector Noise", 0 @@ -677,11 +681,11 @@ [ "Vector Noise", 0, - "Scale", + "Scale.001", 0 ], [ - "Scale", + "Scale.001", 0, "Vector Rewire", 0 @@ -693,35 +697,35 @@ 0 ], [ - "Matrix Track To", - 0, - "Matrix Math", - 0 + "Reroute", + "Output", + "Vertex Normal", + "Vertices" ], [ - "Matrix in", + "Reroute.001", + "Output", + "Vertex Normal", + "Polygons" + ], + [ + "Vertex Normal", 0, - "Matrix Math", - 1 + "Matrix Track To", + 3 ], [ - "Torus", + "Matrix Track To", 0, - "Select mesh elements by location", + "Matrix Math", 0 ], [ - "Torus", - 1, - "Select mesh elements by location", + "Matrix in", + 0, + "Matrix Math", 1 ], - [ - "Torus", - 2, - "Select mesh elements by location", - 2 - ], [ "Matrix Math", 0, @@ -731,23 +735,35 @@ [ "Reroute", "Output", - "Move.002", - "Vertices" + "Move", + "vertices" ], [ "Matrix out", 0, - "Move.002", + "Move", 1 ], [ "Torus", - "Edges", - "Reroute.002", - "Input" + 0, + "Select mesh elements by location", + 0 + ], + [ + "Torus", + 1, + "Select mesh elements by location", + 1 + ], + [ + "Torus", + 2, + "Select mesh elements by location", + 2 ], [ - "Move.002", + "Move", 0, "Inset faces", 0 @@ -803,33 +819,33 @@ [ "Inset faces", 0, - "Move", + "Move.001", 0 ], [ "Vector in", 0, - "Move", + "Move.001", 1 ], [ "Proportional Edit Falloff", 0, - "Move", + "Move.001", 2 ], - [ - "Move", - "Vertices", - "Reroute.003", - "Input" - ], [ "Inset faces", "Faces", "Reroute.004", "Input" ], + [ + "Move.001", + "vertices", + "Reroute.003", + "Input" + ], [ "Reroute.003", "Output", diff --git a/json_examples/Shapes/Sofa_Pillow.json b/json_examples/Shapes/Sofa_Pillow.json index 9bbaeac49..30a5ef765 100644 --- a/json_examples/Shapes/Sofa_Pillow.json +++ b/json_examples/Shapes/Sofa_Pillow.json @@ -3,8 +3,8 @@ "framed_nodes": {}, "groups": {}, "nodes": { - "Move.001": { - "bl_idname": "SvMoveNodeMk3", + "Move": { + "bl_idname": "SvMoveNodeMK2", "height": 100.0, "hide": false, "label": "", @@ -12,9 +12,7 @@ 492.6460266113281, 208.35818481445312 ], - "params": { - "strength": 1.0 - }, + "params": {}, "width": 140.0 }, "Plane MK2": { @@ -141,17 +139,17 @@ [ "Rounded Box", 0, - "Move.001", + "Move", 0 ], [ "Vector Attraction", 0, - "Move.001", + "Move", 1 ], [ - "Move.001", + "Move", 0, "Viewer Draw Mk3", 0 diff --git a/old_nodes/move_mk2.py b/nodes/transforms/move_mk2.py similarity index 94% rename from old_nodes/move_mk2.py rename to nodes/transforms/move_mk2.py index 61294ca95..465a38bf4 100644 --- a/old_nodes/move_mk2.py +++ b/nodes/transforms/move_mk2.py @@ -31,7 +31,6 @@ class SvMoveNodeMK2(bpy.types.Node, SverchCustomTreeNode): bl_icon = 'NONE' #'MAN_TRANS' sv_icon = 'SV_MOVE' - replacement_nodes = [('SvMoveNodeMk3', dict(vertices='Vertices', vectors='Movement Vectors', multiplier='Strength'), dict(vertices='Vertices'))] mult_: FloatProperty(name='multiplier', default=1.0, update=updateNode) separate: BoolProperty( diff --git a/nodes/transforms/move_mk3.py b/nodes/transforms/move_mk3.py deleted file mode 100644 index 01674b66b..000000000 --- a/nodes/transforms/move_mk3.py +++ /dev/null @@ -1,124 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### -import bpy -from bpy.props import EnumProperty, FloatProperty, FloatVectorProperty, BoolProperty -import numpy as np -from sverchok.node_tree import SverchCustomTreeNode -from sverchok.data_structure import updateNode, list_match_func, numpy_list_match_modes, numpy_list_match_func -from sverchok.utils.sv_itertools import recurse_f_level_control - - -def move_meshes(params, constant, matching_f): - ''' - params are verts, movement vectors, strength - - verts and movement vectors should be list as [[[float, float, float],],] (Level 3) - - Strength should be list as [[float, float, ..], [float, ..], ..] (Level 2) - desired_levels = [3, 3, 2] - constant are the function options (data that does not need to be matched) - matching_f stands for list matching formula to use - ''' - result = [] - match_mode, output_numpy = constant - params = matching_f(params) - - local_match = numpy_list_match_func[match_mode] - - for props in zip(*params): - verts, move_verts, strength = local_match([np.array(p) for p in props]) - print(move_verts) - verts_out = verts + move_verts * strength[:, np.newaxis] - result.append(verts_out if output_numpy else verts_out.tolist()) - - return result - - -class SvMoveNodeMk3(bpy.types.Node, SverchCustomTreeNode): - """ - Triggers: Moves Vertices - Tooltip: Moves vectors based in another vector set and a multipier factor - - """ - - bl_idname = 'SvMoveNodeMk3' - bl_label = 'Move' - bl_icon = 'ORIENTATION_VIEW' - sv_icon = 'SV_MOVE' - - - movement_vectors: FloatVectorProperty( - name='Movement Vect.', description='Base movement vector', - size=3, default=(0, 0, 0), - update=updateNode) - - strength: FloatProperty( - name='Strength', description='Multiplyer of the movement vector', - default=1.0, update=updateNode) - - list_match: EnumProperty( - name="List Match", - description="Behavior on different list lengths", - items=numpy_list_match_modes, default="REPEAT", - update=updateNode) - - output_numpy: BoolProperty( - name='Output NumPy', - description='Output NumPy arrays', - default=False, update=updateNode) - - def sv_init(self, context): - - self.inputs.new('SvVerticesSocket', 'Vertices') - self.inputs.new('SvVerticesSocket', 'Movement Vectors').prop_name = 'movement_vectors' - self.inputs.new('SvStringsSocket', 'Strength').prop_name = 'strength' - - - self.outputs.new('SvVerticesSocket', 'Vertices') - - - def draw_buttons_ext(self, context, layout): - '''draw buttons on the N-panel''' - layout.prop(self, 'output_numpy') - layout.prop(self, 'list_match', expand=False) - - def rclick_menu(self, context, layout): - layout.prop(self, 'output_numpy') - layout.prop_menu_enum(self, "list_match", text="List Match") - - def migrate_from(self, old_node): - self.strength = old_node.mult_ - - def process(self): - inputs, outputs = self.inputs, self.outputs - - if not outputs[0].is_linked: - return - - result = [] - - params = [si.sv_get(default=[[]], deepcopy=False) for si in inputs] - - matching_f = list_match_func[self.list_match] - desired_levels = [3, 3, 2] - ops = [self.list_match, self.output_numpy] - - result = recurse_f_level_control(params, ops, move_meshes, matching_f, desired_levels) - - self.outputs[0].sv_set(result) - -classes = [SvMoveNodeMk3] -register, unregister = bpy.utils.register_classes_factory(classes) diff --git a/nodes/transforms/rotate_mk3.py b/nodes/transforms/rotate_mk3.py deleted file mode 100644 index 9b719d0df..000000000 --- a/nodes/transforms/rotate_mk3.py +++ /dev/null @@ -1,310 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### -from math import radians - -from mathutils import Matrix, Vector, Euler, Quaternion - -import bpy -from bpy.props import EnumProperty, FloatProperty, FloatVectorProperty, BoolProperty, StringProperty -import numpy as np -from sverchok.node_tree import SverchCustomTreeNode, throttled -from sverchok.data_structure import updateNode, list_match_func, numpy_list_match_modes, numpy_list_match_func -from sverchok.utils.sv_itertools import recurse_f_level_control - -def matrix_apply_np(verts, matrix): - '''taken from https://blender.stackexchange.com/a/139517''' - - verts_co_4d = np.ones(shape=(verts.shape[0], 4), dtype=np.float) - verts_co_4d[:, :-1] = verts # cos v (x,y,z,1) - point, v(x,y,z,0)- vector - return np.einsum('ij,aj->ai', matrix, verts_co_4d)[:, :-1] - -def np_rotate_many_centers(props, mat, np_local_match): - verts, centers = np_local_match([np.array(p) for p in props[:2]]) - return matrix_apply_np(verts - centers, mat) + centers - -def np_rotate_one_center(props, mat): - center = np.array(props[1][0])[np.newaxis,:] - verts = np.array(props[0]) - if np.linalg.norm(center[0]) > 0: - return matrix_apply_np(verts - center, mat) + center - - return matrix_apply_np(verts, mat) - -def rotate_one_center(props, mat): - c = Vector(props[1][0]) - if c.magnitude > 0: - return [(c + mat @ (Vector(ve) - c))[:] for ve in props[0]] - return [(mat @ Vector(ve))[:] for ve in props[0]] - -def rotate_vecs_constant_mat(props, mat, output_numpy, np_local_match, result): - if len(props[1]) > 1: - rotated = np_rotate_many_centers(props, mat, np_local_match) - result.append(rotated if output_numpy else rotated.tolist()) - else: - if output_numpy: - result.append(np_rotate_one_center(props, mat)) - else: - result.append(rotate_one_center(props, mat)) - -def axis_rotate_meshes(params, constant, matching_f): - ''' - params are verts, centers, axis and angle - - verts, centers and axis should be list as [[[float, float, float],],] (Level 3) - - Angle should be list as [[float, float, ..], [float, ..], ..] (Level 2) - desired_levels = [3, 3, 3, 2] - constant are the function options (data that does not need to be matched) - matching_f stands for list matching formula to use - ''' - result = [] - match_mode, output_numpy = constant - params = matching_f(params) - np_local_match = numpy_list_match_func[match_mode] - local_match = list_match_func[match_mode] - for props in zip(*params): - rotated = [] - lens = map(len, props[2:]) - if any(l > 1 for l in lens): - verts, centers, axis, angle = local_match(props) - for ve, ce, ax, an in zip(verts, centers, axis, angle): - mat = Matrix.Rotation(radians(an), 4, ax) - c = Vector(ce) - rotated.append((c + mat @ (Vector(ve) - c))[:]) - result.append(np.array(rotated) if output_numpy else rotated) - else: - ax = props[2][0] - an = props[3][0] - mat = Matrix.Rotation(radians(an), 4, ax) - rotate_vecs_constant_mat(props, mat, output_numpy, np_local_match, result) - - return result - -def euler_rotate_meshes(params, constant, matching_f): - ''' - params are verts, centers, x, y and z - - verts and centers should be list as [[[float, float, float],],] (Level 3) - - x,y,z should be list as [[float, float, ..], [float, ..], ..] (Level 2) - desired_levels = [3, 3, 2, 2, 2] - constant are the function options (data that does not need to be matched) - matching_f stands for list matching formula to use - ''' - result = [] - match_mode, output_numpy, order = constant - params = matching_f(params) - np_local_match = numpy_list_match_func[match_mode] - local_match = list_match_func[match_mode] - for props in zip(*params): - lens = map(len, props[2:]) - if any(l > 1 for l in lens): - verts, centers, x_ang, y_ang, z_ang = local_match(props) - rotated = [] - for ve, cent, x, y, z in zip(verts, centers, x_ang, y_ang, z_ang): - mat = Euler((radians(x), radians(y), radians(z)), order).to_matrix().to_4x4() - cen_v = Vector(cent) - rotated.append((mat @ (Vector(ve)- cen_v) + cen_v)[:]) - result.append(np.array(rotated) if output_numpy else rotated) - else: - x, y, z = props[2][0], props[3][0], props[4][0] - mat = Euler((radians(x), radians(y), radians(z)), order).to_matrix().to_4x4() - rotate_vecs_constant_mat(props, mat, output_numpy, np_local_match, result) - - return result - -def quat_rotate_meshes(params, constant, matching_f): - ''' - params are verts, centers, x, y, z and w - - verts and centers should be list as [[[float, float, float],],] (Level 3) - - x, y, z and w should be list as [[float, float, ..], [float, ..], ..] (Level 2) - desired_levels = [3, 3, 2, 2, 2, 2] - constant are the function options (data that does not need to be matched) - matching_f stands for list matching formula to use - ''' - result = [] - match_mode, output_numpy = constant - params = matching_f(params) - np_local_match = numpy_list_match_func[match_mode] - local_match = list_match_func[match_mode] - for props in zip(*params): - lens = map(len, props[2:]) - if any(l > 1 for l in lens): - verts, centers, x_ang, y_ang, z_ang, w_ang = local_match(props) - rotated = [] - for ve, ce, x, y, z, w in zip(verts, centers, x_ang, y_ang, z_ang, w_ang): - quat = Quaternion((w, x, y, z)).normalized() - ce_v = Vector(ce) - rotated.append(((quat @ (Vector(ve) - ce_v) + ce_v))[:]) - - result.append(np.array(rotated) if output_numpy else rotated) - else: - x, y, z, w = props[2][0], props[3][0], props[4][0], props[5][0] - mat = Quaternion((w, x, y, z)).normalized().to_matrix().to_4x4() - rotate_vecs_constant_mat(props, mat, output_numpy, np_local_match, result) - return result - -modes_dict = { - 'AXIS': (axis_rotate_meshes, ['Axis', 'Angle']), - 'EULER': (euler_rotate_meshes, ['X', 'Y', 'Z']), - 'QUAT': (quat_rotate_meshes, ['X', 'Y', 'Z', 'W']) -} -class SvRotationNodeMk3(bpy.types.Node, SverchCustomTreeNode): - """ - Triggers: Rotate vertices - Tooltip: Rotate input vertices using Axis/Angle, Euler or Quaternion - - """ - - bl_idname = 'SvRotationNodeMk3' - bl_label = 'Rotate' - bl_icon = 'NONE' - sv_icon = 'SV_ROTATE' - - - centers_: FloatVectorProperty( - name='Centers', description='Center of the scaling transform', - size=3, default=(0, 0, 0), - update=updateNode) - axis_: FloatVectorProperty( - name='Axis', description='Rotation Axis', - size=3, default=(0, 0, 1), - update=updateNode) - angle_: FloatProperty( - name='Angle', description='rotation angle', default=0.0, update=updateNode) - x_: FloatProperty( - name='X', description='X angle', default=0.0, update=updateNode) - y_: FloatProperty( - name='Y', description='Y angle', default=0.0, update=updateNode) - z_: FloatProperty( - name='Z', description='Z angle', default=0.0, update=updateNode) - w_: FloatProperty( - name='W', description='W', default=1.0, update=updateNode) - - actual_mode: StringProperty(default="AXIS") - - def update_sockets(self): - - mode = self.mode - if mode == self.actual_mode: - return - - - while len(self.inputs) > 2: - print(3, 'updating sockets', self.mode, self.actual_mode) - self.inputs.remove(self.inputs[-1]) - - if mode == 'AXIS': - # self.inputs.new('SvVerticesSocket', "center").prop_name = "centers" - self.inputs.new('SvVerticesSocket', "Axis").prop_name = "axis_" - self.inputs.new('SvStringsSocket', "Angle").prop_name = "angle_" - elif mode in ('EULER', 'QUAT'): - self.inputs.new('SvStringsSocket', "X").prop_name = "x_" - self.inputs.new('SvStringsSocket', "Y").prop_name = "y_" - self.inputs.new('SvStringsSocket', "Z").prop_name = "z_" - if mode == 'QUAT': - self.inputs.new('SvStringsSocket', "W").prop_name = "w_" - - self.actual_mode = mode - - @throttled - def mode_change(self, context): - self.update_sockets() - - - modes = [ - ("AXIS", "Axis", "Axis and angle rotation", 1), - ("EULER", "Euler", "Euler Rotation", 2), - ("QUAT", "Quat", "Quaternion Rotation", 3), - ] - - mode: EnumProperty( - name="mode", description="mode", default='AXIS', items=modes, update=mode_change) - - orders = [ - ('XYZ', "XYZ", "", 0), - ('XZY', 'XZY', "", 1), - ('YXZ', 'YXZ', "", 2), - ('YZX', 'YZX', "", 3), - ('ZXY', 'ZXY', "", 4), - ('ZYX', 'ZYX', "", 5), - ] - order: EnumProperty( - name="Order", description="Order", default="XYZ", items=orders, update=updateNode) - - multiplier: FloatProperty( - name='Scale', description='Multiplying factor', - default=1.0, update=updateNode) - - list_match: EnumProperty( - name="List Match", - description="Behavior on different list lengths", - items=numpy_list_match_modes, default="REPEAT", - update=updateNode) - - output_numpy: BoolProperty( - name='Output NumPy', - description='Output NumPy arrays', - default=False, update=updateNode) - - def sv_init(self, context): - new_input = self.inputs.new - new_input('SvVerticesSocket', "Vertices") - new_input('SvVerticesSocket', "Centers").prop_name = "centers_" - new_input('SvVerticesSocket', "Axis").prop_name = "axis_" - new_input('SvStringsSocket', "Angle").prop_name = "angle_" - - self.outputs.new('SvVerticesSocket', "Vertices") - - def draw_buttons(self, context, layout): - layout.prop(self, "mode", expand=True) - if self.mode == 'EULER': - layout.prop(self, "order", text="Order:") - - def draw_buttons_ext(self, context, layout): - '''draw buttons on the N-panel''' - self.draw_buttons(context, layout) - layout.prop(self, 'output_numpy') - layout.prop(self, 'list_match', expand=False) - - def rclick_menu(self, context, layout): - layout.prop(self, 'output_numpy') - layout.prop_menu_enum(self, "list_match", text="List Match") - - def migrate_props_pre_relink(self, old_node): - self.update_sockets() - - def process(self): - inputs, outputs = self.inputs, self.outputs - - if not outputs[0].is_linked: - return - - matching_f = list_match_func[self.list_match] - ops = [self.list_match, self.output_numpy] - inputs_used = ['Vertices', 'Centers'] + modes_dict[self.mode][1] - rotate_func = modes_dict[self.mode][0] - - if self.mode == 'EULER': - ops.append(self.order) - - desired_levels = [3 if inputs[s].bl_idname == 'SvVerticesSocket' else 2 for s in inputs_used] - params = [si.sv_get(default=[[]], deepcopy=False) for si in inputs if si.name in inputs_used] - - result = recurse_f_level_control(params, ops, rotate_func, matching_f, desired_levels) - - self.outputs[0].sv_set(result) - -classes = [SvRotationNodeMk3] -register, unregister = bpy.utils.register_classes_factory(classes) diff --git a/old_nodes/rotation_mk2.py b/nodes/transforms/rotation_mk2.py similarity index 97% rename from old_nodes/rotation_mk2.py rename to nodes/transforms/rotation_mk2.py index 66cd3889e..a1fc3433c 100644 --- a/old_nodes/rotation_mk2.py +++ b/nodes/transforms/rotation_mk2.py @@ -42,7 +42,7 @@ def euler_rotation(vertex, x, y, z, order): mat_eul = Euler((radians(x), radians(y), radians(z)), order).to_matrix().to_4x4() for i in vertex: v = Vector(i) - rotated.append((mat_eul @ v)[:]) + rotated.append((mat_eul@v)[:]) return rotated def quat_rotation(vertex, x, y, z, w): @@ -59,7 +59,7 @@ class SvRotationNodeMK2(bpy.types.Node, SverchCustomTreeNode): bl_label = 'Rotation' bl_icon = 'NONE' #'MAN_ROT' sv_icon = 'SV_ROTATE' - replacement_nodes = [('SvRotationNodeMk3', dict(vertices='Vertices', center='Centers', axis='Axis', angle='Angle'), dict(vertices='Vertices'))] + angle_: FloatProperty( name='Angle', description='rotation angle', default=0.0, update=updateNode) x_: FloatProperty( diff --git a/old_nodes/scale_mk2.py b/nodes/transforms/scale_mk2.py similarity index 94% rename from old_nodes/scale_mk2.py rename to nodes/transforms/scale_mk2.py index 34d550335..fc0a5c3c4 100644 --- a/old_nodes/scale_mk2.py +++ b/nodes/transforms/scale_mk2.py @@ -32,7 +32,7 @@ class SvScaleNodeMK2(bpy.types.Node, SverchCustomTreeNode): bl_label = 'Scale' bl_icon = 'NONE' #'MAN_SCALE' sv_icon = 'SV_SCALE' - replacement_nodes = [('SvScaleNodeMk3', dict(vertices='Vertices', centers='Centers', multiplier='Strength'), dict(vertices='Vertices'))] + factor_: FloatProperty( name='multiplyer', description='scaling factor', default=1.0, update=updateNode) diff --git a/nodes/transforms/scale_mk3.py b/nodes/transforms/scale_mk3.py deleted file mode 100644 index 5998cc0ad..000000000 --- a/nodes/transforms/scale_mk3.py +++ /dev/null @@ -1,127 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### -import bpy -from bpy.props import EnumProperty, FloatProperty, FloatVectorProperty, BoolProperty -import numpy as np -from sverchok.node_tree import SverchCustomTreeNode -from sverchok.data_structure import updateNode, list_match_func, numpy_list_match_modes, numpy_list_match_func -from sverchok.utils.sv_itertools import recurse_f_level_control - - -def scale_meshes(params, constant, matching_f): - ''' - params are verts, movement vectors, strength - - verts and movement vectors should be list as [[[float, float, float],],] (Level 3) - - Strength should be list as [[float, float, ..], [float, ..], ..] (Level 2) - desired_levels = [3, 3, 2] - constant are the function options (data that does not need to be matched) - matching_f stands for list matching formula to use - ''' - result = [] - match_mode, output_numpy = constant - params = matching_f(params) - - local_match = numpy_list_match_func[match_mode] - - for props in zip(*params): - verts, centers, scale, strength = local_match([np.array(p) for p in props]) - verts_out = centers + (verts - centers) * scale * strength[:, np.newaxis] - result.append(verts_out if output_numpy else verts_out.tolist()) - - return result - - -class SvScaleNodeMk3(bpy.types.Node, SverchCustomTreeNode): - """ - Triggers: Scale vertices - Tooltip: Scales vectors from a center point - - """ - - bl_idname = 'SvScaleNodeMk3' - bl_label = 'Scale' - bl_icon = 'ORIENTATION_VIEW' - sv_icon = 'SV_MOVE' - - - centers: FloatVectorProperty( - name='Centers', description='Center of the scaling transform', - size=3, default=(0, 0, 0), - update=updateNode) - scale: FloatVectorProperty( - name='Scale', description='Center of the scaling transform', - size=3, default=(1, 1, 1), - update=updateNode) - - multiplier: FloatProperty( - name='Multiplier', description='Multiplier factor', - default=1.0, update=updateNode) - - list_match: EnumProperty( - name="List Match", - description="Behavior on different list lengths", - items=numpy_list_match_modes, default="REPEAT", - update=updateNode) - - output_numpy: BoolProperty( - name='Output NumPy', - description='Output NumPy arrays', - default=False, update=updateNode) - - def sv_init(self, context): - - self.inputs.new('SvVerticesSocket', 'Vertices') - self.inputs.new('SvVerticesSocket', 'Centers').prop_name = 'centers' - self.inputs.new('SvVerticesSocket', 'Scale').prop_name = 'scale' - self.inputs.new('SvStringsSocket', 'Strength').prop_name = 'multiplier' - - - self.outputs.new('SvVerticesSocket', 'Vertices') - - def migrate_from(self, old_node): - self.multiplier = old_node.factor_ - - def draw_buttons_ext(self, context, layout): - '''draw buttons on the N-panel''' - layout.prop(self, 'output_numpy') - layout.prop(self, 'list_match', expand=False) - - def rclick_menu(self, context, layout): - layout.prop(self, 'output_numpy') - layout.prop_menu_enum(self, "list_match", text="List Match") - - def process(self): - inputs, outputs = self.inputs, self.outputs - - if not outputs[0].is_linked: - return - - result = [] - - params = [si.sv_get(default=[[]], deepcopy=False) for si in inputs] - - matching_f = list_match_func[self.list_match] - desired_levels = [3, 3, 3, 2] - ops = [self.list_match, self.output_numpy] - - result = recurse_f_level_control(params, ops, scale_meshes, matching_f, desired_levels) - - self.outputs[0].sv_set(result) - -classes = [SvScaleNodeMk3] -register, unregister = bpy.utils.register_classes_factory(classes) diff --git a/ui/nodes_replacement.py b/ui/nodes_replacement.py index f9c99df74..dedde6146 100644 --- a/ui/nodes_replacement.py +++ b/ui/nodes_replacement.py @@ -103,10 +103,6 @@ class SvReplaceNode(bpy.types.Operator): for prop_name, prop_value in old_node.items(): new_node[prop_name] = old_node[prop_name] - # get the node ready for linking - if hasattr(new_node, "migrate_props_pre_relink"): - new_node.migrate_props_pre_relink(old_node) - # Copy incoming / outgoing links old_in_links = [link for link in tree.links if link.to_node == old_node] old_out_links = [link for link in tree.links if link.from_node == old_node] @@ -136,14 +132,12 @@ class SvReplaceNode(bpy.types.Operator): # Allow new node to copy what generic code could not. new_node.migrate_from(old_node) - msg = "Node `{}' ({}) has been replaced with new node `{}' ({})".format( - old_node.name, old_node.bl_idname, - new_node.name, new_node.bl_idname) + old_node.name, old_node.bl_idname, + new_node.name, new_node.bl_idname) info(msg) self.report({'INFO'}, msg) - if old_node.parent and old_node.parent.label == "Deprecated node!": if old_node.parent.parent: new_node.parent = old_node.parent.parent -- GitLab