From e550d1eae5f798017d548760b0a56a646366c3ec Mon Sep 17 00:00:00 2001 From: zeffii Date: Mon, 26 Sep 2016 19:12:05 +0200 Subject: [PATCH 01/19] add help browser to a node if it has help_url --- nodes/list_basic/modifier.py | 3 ++- ui/development.py | 20 +++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/nodes/list_basic/modifier.py b/nodes/list_basic/modifier.py index 0a1af8e07..0e00905d8 100644 --- a/nodes/list_basic/modifier.py +++ b/nodes/list_basic/modifier.py @@ -19,7 +19,7 @@ from itertools import accumulate import bpy -from bpy.props import EnumProperty, IntProperty, BoolProperty +from bpy.props import EnumProperty, IntProperty, BoolProperty, StringProperty from sverchok.node_tree import SverchCustomTreeNode from sverchok.data_structure import updateNode @@ -103,6 +103,7 @@ class SvListModifierNode(bpy.types.Node, SverchCustomTreeNode): update=updateNode ) + help_url = StringProperty(default='list_main/list_modifier') def draw_buttons(self, context, layout): layout.prop(self, "func_", text='') diff --git a/ui/development.py b/ui/development.py index 34cf2907a..d950b49b8 100644 --- a/ui/development.py +++ b/ui/development.py @@ -18,6 +18,7 @@ import subprocess import os +import webbrowser import bpy from bpy.props import StringProperty, CollectionProperty, BoolProperty, FloatProperty @@ -77,6 +78,17 @@ class SvCopyIDName(bpy.types.Operator): return {'FINISHED'} +class SvViewHelpForNode(bpy.types.Operator): + + bl_idname = "node.view_node_help" + bl_label = "display a browser with compiled html" + + def execute(self, context): + n = context.active_node + prefix = 'http://nikitron.cc.ua/sverch/html/nodes/' + n.help_url + '.html' + webbrowser.open(prefix) + return {'FINISHED'} + def idname_draw(self, context): if not displaying_sverchok_nodes(context): @@ -88,12 +100,17 @@ def idname_draw(self, context): bl_idname = node.bl_idname layout.operator('node.copy_bl_idname', text=bl_idname + ' (copy)').name = bl_idname + if hasattr(node, 'help_url'): + layout.operator('node.view_node_help', text='view node help') + + def register(): get_branch() if BRANCH: bpy.types.NODE_HT_header.append(node_show_branch) bpy.utils.register_class(SvCopyIDName) + bpy.utils.register_class(SvViewHelpForNode) bpy.types.NODE_PT_active_node_generic.append(idname_draw) @@ -101,4 +118,5 @@ def unregister(): if BRANCH: bpy.types.NODE_HT_header.remove(node_show_branch) bpy.types.NODE_PT_active_node_generic.remove(idname_draw) - bpy.utils.unregister_class(SvCopyIDName) \ No newline at end of file + bpy.utils.unregister_class(SvCopyIDName) + bpy.utils.unregister_class(SvViewHelpForNode) \ No newline at end of file -- GitLab From f1c19bc95d2ca1560598c8aaa65d10dc7b916d1d Mon Sep 17 00:00:00 2001 From: zeffii Date: Tue, 27 Sep 2016 12:13:38 +0200 Subject: [PATCH 02/19] add offline option for help --- ui/development.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/ui/development.py b/ui/development.py index d950b49b8..b7467889e 100644 --- a/ui/development.py +++ b/ui/development.py @@ -82,11 +82,20 @@ class SvViewHelpForNode(bpy.types.Operator): bl_idname = "node.view_node_help" bl_label = "display a browser with compiled html" - + kind = StringProperty(default='online') + def execute(self, context): n = context.active_node - prefix = 'http://nikitron.cc.ua/sverch/html/nodes/' + n.help_url + '.html' - webbrowser.open(prefix) + if self.kind == 'online': + destination = 'http://nikitron.cc.ua/sverch/html/nodes/' + n.help_url + '.html' + else: + # destination = r'file:///C:/Users/zeffi/Desktop/GITHUB/sverchok/docs/nodes/list_main/list_modifier.rst' + basepath = os.path.dirname(sverchok.__file__) + '/docs/nodes/' + destination = r'file:///' + basepath + n.help_url + '.rst' + # print(destination) + # return {'CANCELLED'} + + webbrowser.open(destination) return {'FINISHED'} @@ -101,7 +110,10 @@ def idname_draw(self, context): layout.operator('node.copy_bl_idname', text=bl_idname + ' (copy)').name = bl_idname if hasattr(node, 'help_url'): - layout.operator('node.view_node_help', text='view node help') + row = layout.row(align=True) + row.label('help') + row.operator('node.view_node_help', text='online').kind = 'online' + row.operator('node.view_node_help', text='offline').kind = 'offline' def register(): -- GitLab From c176f3e9065dd886fec5c4e055abe68209cf981c Mon Sep 17 00:00:00 2001 From: zeffii Date: Tue, 27 Sep 2016 12:14:13 +0200 Subject: [PATCH 03/19] remove comment --- ui/development.py | 1 - 1 file changed, 1 deletion(-) diff --git a/ui/development.py b/ui/development.py index b7467889e..fa7e0c13e 100644 --- a/ui/development.py +++ b/ui/development.py @@ -89,7 +89,6 @@ class SvViewHelpForNode(bpy.types.Operator): if self.kind == 'online': destination = 'http://nikitron.cc.ua/sverch/html/nodes/' + n.help_url + '.html' else: - # destination = r'file:///C:/Users/zeffi/Desktop/GITHUB/sverchok/docs/nodes/list_main/list_modifier.rst' basepath = os.path.dirname(sverchok.__file__) + '/docs/nodes/' destination = r'file:///' + basepath + n.help_url + '.rst' # print(destination) -- GitLab From 811ca752b342b6c2cc15a38d3e69d381f24c6289 Mon Sep 17 00:00:00 2001 From: zeffii Date: Thu, 29 Sep 2016 11:21:29 +0200 Subject: [PATCH 04/19] start doc shuffle --- docs/nodes.rst | 11 ++++++++--- docs/nodes/{analyzer => analyzers}/analyzer.rst | 0 docs/nodes/{analyzer => analyzers}/area.rst | 0 docs/nodes/{analyzer => analyzers}/bbox.rst | 0 docs/nodes/{analyzer => analyzers}/calc_normals.rst | 0 docs/nodes/{analyzer => analyzers}/distance_pp.rst | 0 docs/nodes/{analyzer => analyzers}/edge_angles.rst | 0 docs/nodes/{analyzer => analyzers}/kd_tree.rst | 0 docs/nodes/{analyzer => analyzers}/kd_tree_edges.rst | 0 docs/nodes/{analyzer => analyzers}/mesh_filter.rst | 0 .../{analyzer => analyzers}/polygons_centers.rst | 0 docs/nodes/{analyzer => analyzers}/raycast.rst | 0 docs/nodes/{analyzer => analyzers}/vector_normal.rst | 0 docs/nodes/{analyzer => analyzers}/volume.rst | 0 docs/nodes/{analyzer => analyzers}/weights.rst | 0 docs/nodes/{beta => beta_nodes}/beta.rst | 0 docs/nodes/{beta => beta_nodes}/set_dataobject.rst | 0 docs/nodes/{generator => generators}/2pt_spline.rst | 0 docs/nodes/{generator => generators}/3pt_arc.rst | 0 docs/nodes/{generator => generators}/box.rst | 0 docs/nodes/{generator => generators}/box_rounded.rst | 0 docs/nodes/{generator => generators}/bricks.rst | 0 docs/nodes/{generator => generators}/circle.rst | 0 docs/nodes/{generator => generators}/cylinder.rst | 0 docs/nodes/{generator => generators}/exponential.rst | 0 docs/nodes/{generator => generators}/fibonacci.rst | 0 .../nodes/{generator => generators}/formula_shape.rst | 0 .../{generator => generators}/generative_art.rst | 0 docs/nodes/{generator => generators}/generator.rst | 0 docs/nodes/{generator => generators}/hilbert.rst | 0 docs/nodes/{generator => generators}/hilbert3d.rst | 0 .../nodes/{generator => generators}/hilbert_image.rst | 0 docs/nodes/{generator => generators}/image.rst | 0 .../{generator => generators}/image_decompose.rst | 0 docs/nodes/{generator => generators}/line.rst | 0 docs/nodes/{generator => generators}/ngon.rst | 0 docs/nodes/{generator => generators}/plane.rst | 0 .../{generator => generators}/profile_parametric.rst | 0 .../nodes/{generator => generators}/random_vector.rst | 0 docs/nodes/{generator => generators}/scripted.rst | 0 docs/nodes/{generator => generators}/scripted2.rst | 0 .../{generator => generators}/scripted_intro.rst | 0 docs/nodes/{generator => generators}/sphere.rst | 0 43 files changed, 8 insertions(+), 3 deletions(-) rename docs/nodes/{analyzer => analyzers}/analyzer.rst (100%) rename docs/nodes/{analyzer => analyzers}/area.rst (100%) rename docs/nodes/{analyzer => analyzers}/bbox.rst (100%) rename docs/nodes/{analyzer => analyzers}/calc_normals.rst (100%) rename docs/nodes/{analyzer => analyzers}/distance_pp.rst (100%) rename docs/nodes/{analyzer => analyzers}/edge_angles.rst (100%) rename docs/nodes/{analyzer => analyzers}/kd_tree.rst (100%) rename docs/nodes/{analyzer => analyzers}/kd_tree_edges.rst (100%) rename docs/nodes/{analyzer => analyzers}/mesh_filter.rst (100%) rename docs/nodes/{analyzer => analyzers}/polygons_centers.rst (100%) rename docs/nodes/{analyzer => analyzers}/raycast.rst (100%) rename docs/nodes/{analyzer => analyzers}/vector_normal.rst (100%) rename docs/nodes/{analyzer => analyzers}/volume.rst (100%) rename docs/nodes/{analyzer => analyzers}/weights.rst (100%) rename docs/nodes/{beta => beta_nodes}/beta.rst (100%) rename docs/nodes/{beta => beta_nodes}/set_dataobject.rst (100%) rename docs/nodes/{generator => generators}/2pt_spline.rst (100%) rename docs/nodes/{generator => generators}/3pt_arc.rst (100%) rename docs/nodes/{generator => generators}/box.rst (100%) rename docs/nodes/{generator => generators}/box_rounded.rst (100%) rename docs/nodes/{generator => generators}/bricks.rst (100%) rename docs/nodes/{generator => generators}/circle.rst (100%) rename docs/nodes/{generator => generators}/cylinder.rst (100%) rename docs/nodes/{generator => generators}/exponential.rst (100%) rename docs/nodes/{generator => generators}/fibonacci.rst (100%) rename docs/nodes/{generator => generators}/formula_shape.rst (100%) rename docs/nodes/{generator => generators}/generative_art.rst (100%) rename docs/nodes/{generator => generators}/generator.rst (100%) rename docs/nodes/{generator => generators}/hilbert.rst (100%) rename docs/nodes/{generator => generators}/hilbert3d.rst (100%) rename docs/nodes/{generator => generators}/hilbert_image.rst (100%) rename docs/nodes/{generator => generators}/image.rst (100%) rename docs/nodes/{generator => generators}/image_decompose.rst (100%) rename docs/nodes/{generator => generators}/line.rst (100%) rename docs/nodes/{generator => generators}/ngon.rst (100%) rename docs/nodes/{generator => generators}/plane.rst (100%) rename docs/nodes/{generator => generators}/profile_parametric.rst (100%) rename docs/nodes/{generator => generators}/random_vector.rst (100%) rename docs/nodes/{generator => generators}/scripted.rst (100%) rename docs/nodes/{generator => generators}/scripted2.rst (100%) rename docs/nodes/{generator => generators}/scripted_intro.rst (100%) rename docs/nodes/{generator => generators}/sphere.rst (100%) diff --git a/docs/nodes.rst b/docs/nodes.rst index 1a7fc9545..c3a1009c5 100644 --- a/docs/nodes.rst +++ b/docs/nodes.rst @@ -5,9 +5,10 @@ Nodes .. toctree:: :maxdepth: 3 - Generators + Generators + Generators Extended Transforms - Analyzer + Analyzers Modifier Change Modifier Make @@ -17,10 +18,14 @@ Nodes Logic List Main List Structure + List Masks + List Mutators Viz Text Scene Layout + Network - Beta + Beta Nodes + Alpha Nodes diff --git a/docs/nodes/analyzer/analyzer.rst b/docs/nodes/analyzers/analyzer.rst similarity index 100% rename from docs/nodes/analyzer/analyzer.rst rename to docs/nodes/analyzers/analyzer.rst diff --git a/docs/nodes/analyzer/area.rst b/docs/nodes/analyzers/area.rst similarity index 100% rename from docs/nodes/analyzer/area.rst rename to docs/nodes/analyzers/area.rst diff --git a/docs/nodes/analyzer/bbox.rst b/docs/nodes/analyzers/bbox.rst similarity index 100% rename from docs/nodes/analyzer/bbox.rst rename to docs/nodes/analyzers/bbox.rst diff --git a/docs/nodes/analyzer/calc_normals.rst b/docs/nodes/analyzers/calc_normals.rst similarity index 100% rename from docs/nodes/analyzer/calc_normals.rst rename to docs/nodes/analyzers/calc_normals.rst diff --git a/docs/nodes/analyzer/distance_pp.rst b/docs/nodes/analyzers/distance_pp.rst similarity index 100% rename from docs/nodes/analyzer/distance_pp.rst rename to docs/nodes/analyzers/distance_pp.rst diff --git a/docs/nodes/analyzer/edge_angles.rst b/docs/nodes/analyzers/edge_angles.rst similarity index 100% rename from docs/nodes/analyzer/edge_angles.rst rename to docs/nodes/analyzers/edge_angles.rst diff --git a/docs/nodes/analyzer/kd_tree.rst b/docs/nodes/analyzers/kd_tree.rst similarity index 100% rename from docs/nodes/analyzer/kd_tree.rst rename to docs/nodes/analyzers/kd_tree.rst diff --git a/docs/nodes/analyzer/kd_tree_edges.rst b/docs/nodes/analyzers/kd_tree_edges.rst similarity index 100% rename from docs/nodes/analyzer/kd_tree_edges.rst rename to docs/nodes/analyzers/kd_tree_edges.rst diff --git a/docs/nodes/analyzer/mesh_filter.rst b/docs/nodes/analyzers/mesh_filter.rst similarity index 100% rename from docs/nodes/analyzer/mesh_filter.rst rename to docs/nodes/analyzers/mesh_filter.rst diff --git a/docs/nodes/analyzer/polygons_centers.rst b/docs/nodes/analyzers/polygons_centers.rst similarity index 100% rename from docs/nodes/analyzer/polygons_centers.rst rename to docs/nodes/analyzers/polygons_centers.rst diff --git a/docs/nodes/analyzer/raycast.rst b/docs/nodes/analyzers/raycast.rst similarity index 100% rename from docs/nodes/analyzer/raycast.rst rename to docs/nodes/analyzers/raycast.rst diff --git a/docs/nodes/analyzer/vector_normal.rst b/docs/nodes/analyzers/vector_normal.rst similarity index 100% rename from docs/nodes/analyzer/vector_normal.rst rename to docs/nodes/analyzers/vector_normal.rst diff --git a/docs/nodes/analyzer/volume.rst b/docs/nodes/analyzers/volume.rst similarity index 100% rename from docs/nodes/analyzer/volume.rst rename to docs/nodes/analyzers/volume.rst diff --git a/docs/nodes/analyzer/weights.rst b/docs/nodes/analyzers/weights.rst similarity index 100% rename from docs/nodes/analyzer/weights.rst rename to docs/nodes/analyzers/weights.rst diff --git a/docs/nodes/beta/beta.rst b/docs/nodes/beta_nodes/beta.rst similarity index 100% rename from docs/nodes/beta/beta.rst rename to docs/nodes/beta_nodes/beta.rst diff --git a/docs/nodes/beta/set_dataobject.rst b/docs/nodes/beta_nodes/set_dataobject.rst similarity index 100% rename from docs/nodes/beta/set_dataobject.rst rename to docs/nodes/beta_nodes/set_dataobject.rst diff --git a/docs/nodes/generator/2pt_spline.rst b/docs/nodes/generators/2pt_spline.rst similarity index 100% rename from docs/nodes/generator/2pt_spline.rst rename to docs/nodes/generators/2pt_spline.rst diff --git a/docs/nodes/generator/3pt_arc.rst b/docs/nodes/generators/3pt_arc.rst similarity index 100% rename from docs/nodes/generator/3pt_arc.rst rename to docs/nodes/generators/3pt_arc.rst diff --git a/docs/nodes/generator/box.rst b/docs/nodes/generators/box.rst similarity index 100% rename from docs/nodes/generator/box.rst rename to docs/nodes/generators/box.rst diff --git a/docs/nodes/generator/box_rounded.rst b/docs/nodes/generators/box_rounded.rst similarity index 100% rename from docs/nodes/generator/box_rounded.rst rename to docs/nodes/generators/box_rounded.rst diff --git a/docs/nodes/generator/bricks.rst b/docs/nodes/generators/bricks.rst similarity index 100% rename from docs/nodes/generator/bricks.rst rename to docs/nodes/generators/bricks.rst diff --git a/docs/nodes/generator/circle.rst b/docs/nodes/generators/circle.rst similarity index 100% rename from docs/nodes/generator/circle.rst rename to docs/nodes/generators/circle.rst diff --git a/docs/nodes/generator/cylinder.rst b/docs/nodes/generators/cylinder.rst similarity index 100% rename from docs/nodes/generator/cylinder.rst rename to docs/nodes/generators/cylinder.rst diff --git a/docs/nodes/generator/exponential.rst b/docs/nodes/generators/exponential.rst similarity index 100% rename from docs/nodes/generator/exponential.rst rename to docs/nodes/generators/exponential.rst diff --git a/docs/nodes/generator/fibonacci.rst b/docs/nodes/generators/fibonacci.rst similarity index 100% rename from docs/nodes/generator/fibonacci.rst rename to docs/nodes/generators/fibonacci.rst diff --git a/docs/nodes/generator/formula_shape.rst b/docs/nodes/generators/formula_shape.rst similarity index 100% rename from docs/nodes/generator/formula_shape.rst rename to docs/nodes/generators/formula_shape.rst diff --git a/docs/nodes/generator/generative_art.rst b/docs/nodes/generators/generative_art.rst similarity index 100% rename from docs/nodes/generator/generative_art.rst rename to docs/nodes/generators/generative_art.rst diff --git a/docs/nodes/generator/generator.rst b/docs/nodes/generators/generator.rst similarity index 100% rename from docs/nodes/generator/generator.rst rename to docs/nodes/generators/generator.rst diff --git a/docs/nodes/generator/hilbert.rst b/docs/nodes/generators/hilbert.rst similarity index 100% rename from docs/nodes/generator/hilbert.rst rename to docs/nodes/generators/hilbert.rst diff --git a/docs/nodes/generator/hilbert3d.rst b/docs/nodes/generators/hilbert3d.rst similarity index 100% rename from docs/nodes/generator/hilbert3d.rst rename to docs/nodes/generators/hilbert3d.rst diff --git a/docs/nodes/generator/hilbert_image.rst b/docs/nodes/generators/hilbert_image.rst similarity index 100% rename from docs/nodes/generator/hilbert_image.rst rename to docs/nodes/generators/hilbert_image.rst diff --git a/docs/nodes/generator/image.rst b/docs/nodes/generators/image.rst similarity index 100% rename from docs/nodes/generator/image.rst rename to docs/nodes/generators/image.rst diff --git a/docs/nodes/generator/image_decompose.rst b/docs/nodes/generators/image_decompose.rst similarity index 100% rename from docs/nodes/generator/image_decompose.rst rename to docs/nodes/generators/image_decompose.rst diff --git a/docs/nodes/generator/line.rst b/docs/nodes/generators/line.rst similarity index 100% rename from docs/nodes/generator/line.rst rename to docs/nodes/generators/line.rst diff --git a/docs/nodes/generator/ngon.rst b/docs/nodes/generators/ngon.rst similarity index 100% rename from docs/nodes/generator/ngon.rst rename to docs/nodes/generators/ngon.rst diff --git a/docs/nodes/generator/plane.rst b/docs/nodes/generators/plane.rst similarity index 100% rename from docs/nodes/generator/plane.rst rename to docs/nodes/generators/plane.rst diff --git a/docs/nodes/generator/profile_parametric.rst b/docs/nodes/generators/profile_parametric.rst similarity index 100% rename from docs/nodes/generator/profile_parametric.rst rename to docs/nodes/generators/profile_parametric.rst diff --git a/docs/nodes/generator/random_vector.rst b/docs/nodes/generators/random_vector.rst similarity index 100% rename from docs/nodes/generator/random_vector.rst rename to docs/nodes/generators/random_vector.rst diff --git a/docs/nodes/generator/scripted.rst b/docs/nodes/generators/scripted.rst similarity index 100% rename from docs/nodes/generator/scripted.rst rename to docs/nodes/generators/scripted.rst diff --git a/docs/nodes/generator/scripted2.rst b/docs/nodes/generators/scripted2.rst similarity index 100% rename from docs/nodes/generator/scripted2.rst rename to docs/nodes/generators/scripted2.rst diff --git a/docs/nodes/generator/scripted_intro.rst b/docs/nodes/generators/scripted_intro.rst similarity index 100% rename from docs/nodes/generator/scripted_intro.rst rename to docs/nodes/generators/scripted_intro.rst diff --git a/docs/nodes/generator/sphere.rst b/docs/nodes/generators/sphere.rst similarity index 100% rename from docs/nodes/generator/sphere.rst rename to docs/nodes/generators/sphere.rst -- GitLab From 0f0229cd379eb0ae071f9a9bcbe93f7840556b1f Mon Sep 17 00:00:00 2001 From: zeffii Date: Thu, 29 Sep 2016 15:55:09 +0200 Subject: [PATCH 05/19] further update docs/nodes names --- docs/nodes/analyzers/calc_normals.rst | 42 -- docs/nodes/analyzers/vector_normal.rst | 41 -- docs/nodes/generators/2pt_spline.rst | 61 --- docs/nodes/generators/3pt_arc.rst | 44 -- docs/nodes/generators/box_rounded.rst | 51 --- docs/nodes/generators/generative_art.rst | 336 ---------------- docs/nodes/generators/hilbert.rst | 44 -- docs/nodes/generators/hilbert3d.rst | 44 -- docs/nodes/generators/hilbert_image.rst | 48 --- docs/nodes/generators/image_decompose.rst | 66 --- docs/nodes/generators/profile_parametric.rst | 141 ------- docs/nodes/generators/scripted.rst | 378 ------------------ docs/nodes/generators/scripted2.rst | 293 -------------- docs/nodes/generators/scripted_intro.rst | 126 ------ docs/nodes/list_main/list_decompose.rst | 39 -- docs/nodes/list_main/list_del_levels.rst | 55 --- docs/nodes/list_main/list_join.rst | 46 --- docs/nodes/list_main/list_length.rst | 34 -- docs/nodes/list_main/list_mask_in.rst | 48 --- docs/nodes/list_main/list_mask_out.rst | 2 - docs/nodes/list_main/list_match.rst | 2 - docs/nodes/list_main/list_math.rst | 41 -- docs/nodes/list_main/list_modifier.rst | 101 ----- docs/nodes/list_main/list_sum.rst | 24 -- docs/nodes/list_main/list_zip.rst | 35 -- docs/nodes/list_struct/list_first_last.rst | 30 -- docs/nodes/list_struct/list_flip.rst | 37 -- docs/nodes/list_struct/list_item.rst | 41 -- docs/nodes/list_struct/list_repeater.rst | 47 --- docs/nodes/list_struct/list_shift.rst | 35 -- docs/nodes/list_struct/list_shuffle.rst | 45 --- docs/nodes/list_struct/list_slice.rst | 64 --- docs/nodes/list_struct/list_sort.rst | 31 -- docs/nodes/list_struct/list_split.rst | 53 --- docs/nodes/modifier_change/fill_holes.rst | 36 -- .../nodes/modifier_change/intersect_edges.rst | 42 -- docs/nodes/modifier_change/mask_vertices.rst | 36 -- docs/nodes/modifier_change/polygon_boom.rst | 20 - .../modifier_change/separate_loose_parts.rst | 34 -- docs/nodes/modifier_make/adaptative_edges.rst | 2 - .../modifier_make/adaptative_polygons.rst | 35 -- docs/nodes/modifier_make/uv_connection.rst | 41 -- docs/nodes/modifier_make/voronoi.rst | 2 - docs/nodes/transforms/matrix_apply.rst | 41 -- 44 files changed, 2814 deletions(-) delete mode 100644 docs/nodes/analyzers/calc_normals.rst delete mode 100644 docs/nodes/analyzers/vector_normal.rst delete mode 100644 docs/nodes/generators/2pt_spline.rst delete mode 100644 docs/nodes/generators/3pt_arc.rst delete mode 100644 docs/nodes/generators/box_rounded.rst delete mode 100644 docs/nodes/generators/generative_art.rst delete mode 100644 docs/nodes/generators/hilbert.rst delete mode 100644 docs/nodes/generators/hilbert3d.rst delete mode 100644 docs/nodes/generators/hilbert_image.rst delete mode 100644 docs/nodes/generators/image_decompose.rst delete mode 100644 docs/nodes/generators/profile_parametric.rst delete mode 100644 docs/nodes/generators/scripted.rst delete mode 100644 docs/nodes/generators/scripted2.rst delete mode 100644 docs/nodes/generators/scripted_intro.rst delete mode 100644 docs/nodes/list_main/list_decompose.rst delete mode 100644 docs/nodes/list_main/list_del_levels.rst delete mode 100644 docs/nodes/list_main/list_join.rst delete mode 100644 docs/nodes/list_main/list_length.rst delete mode 100644 docs/nodes/list_main/list_mask_in.rst delete mode 100644 docs/nodes/list_main/list_mask_out.rst delete mode 100644 docs/nodes/list_main/list_match.rst delete mode 100644 docs/nodes/list_main/list_math.rst delete mode 100644 docs/nodes/list_main/list_modifier.rst delete mode 100644 docs/nodes/list_main/list_sum.rst delete mode 100644 docs/nodes/list_main/list_zip.rst delete mode 100644 docs/nodes/list_struct/list_first_last.rst delete mode 100644 docs/nodes/list_struct/list_flip.rst delete mode 100644 docs/nodes/list_struct/list_item.rst delete mode 100644 docs/nodes/list_struct/list_repeater.rst delete mode 100644 docs/nodes/list_struct/list_shift.rst delete mode 100644 docs/nodes/list_struct/list_shuffle.rst delete mode 100644 docs/nodes/list_struct/list_slice.rst delete mode 100644 docs/nodes/list_struct/list_sort.rst delete mode 100644 docs/nodes/list_struct/list_split.rst delete mode 100644 docs/nodes/modifier_change/fill_holes.rst delete mode 100644 docs/nodes/modifier_change/intersect_edges.rst delete mode 100644 docs/nodes/modifier_change/mask_vertices.rst delete mode 100644 docs/nodes/modifier_change/polygon_boom.rst delete mode 100644 docs/nodes/modifier_change/separate_loose_parts.rst delete mode 100644 docs/nodes/modifier_make/adaptative_edges.rst delete mode 100644 docs/nodes/modifier_make/adaptative_polygons.rst delete mode 100644 docs/nodes/modifier_make/uv_connection.rst delete mode 100644 docs/nodes/modifier_make/voronoi.rst delete mode 100644 docs/nodes/transforms/matrix_apply.rst diff --git a/docs/nodes/analyzers/calc_normals.rst b/docs/nodes/analyzers/calc_normals.rst deleted file mode 100644 index a034cfb8e..000000000 --- a/docs/nodes/analyzers/calc_normals.rst +++ /dev/null @@ -1,42 +0,0 @@ -Calculate Normals -================= - -*destination after Beta: Analyzers* - -Functionality -------------- - -This node calculates normals for faces and edges of given mesh. Normals can be calculated even for meshes without faces, i.e. curves. - -Inputs ------- - -This node has the following inputs: - -- **Vertices** -- **Edges** -- **Polygons** - -Outputs -------- - -This node has the following outputs: - -- **FaceNormals**. Normals of faces. This output will be empty if **Polygons** input is empty. -- **VertexNormals**. Normals of vertices. - -Examples of usage ------------------ - -Move each face of cube along its normal: - -.. image:: https://cloud.githubusercontent.com/assets/284644/5989203/f86367f2-a9a0-11e4-9292-d303838d561d.png - -Visualization of vertex normals for bezier curve: - -.. image:: https://cloud.githubusercontent.com/assets/284644/5989204/f8655fbc-a9a0-11e4-94d5-caf403d3a64a.png - -Normals can be also calculated for closed curves: - -.. image:: https://cloud.githubusercontent.com/assets/284644/5989202/f8632a44-a9a0-11e4-8745-19065eb13bcd.png - diff --git a/docs/nodes/analyzers/vector_normal.rst b/docs/nodes/analyzers/vector_normal.rst deleted file mode 100644 index 0db8b2444..000000000 --- a/docs/nodes/analyzers/vector_normal.rst +++ /dev/null @@ -1,41 +0,0 @@ -Vertex normal -===== -*Alias - vector normal* - -Functionality -------------- - -Vertex normal node finds normals of vectors - -Inputs ------- - -**Vertices** and **Polygons** are needed. -Both inputs need to be of the kind Vertices and Strings, respectively - -Parameters ----------- - -All parameters need to proceed from an external node. - - -+------------------+---------------+-------------+-----------------------------------------------+ -| Param | Type | Default | Description | -+==================+===============+=============+===============================================+ -| **Vertices** | Vertices | None | vertices of the polygons | -+------------------+---------------+-------------+-----------------------------------------------+ -| **Polygons** | Strings | None | polygons referenced to vertices | -+------------------+---------------+-------------+-----------------------------------------------+ - -Outputs -------- - -**Vertices normals** will be calculated only if both **Vertices** and **Polygons** inputs are linked. - - -Example of usage ----------------- - -.. image:: https://cloud.githubusercontent.com/assets/5783432/18602881/e4cf2508-7c7d-11e6-8c63-8918c9a160a5.png - :alt: Vector_normal.PNG - diff --git a/docs/nodes/generators/2pt_spline.rst b/docs/nodes/generators/2pt_spline.rst deleted file mode 100644 index 0accdb4c0..000000000 --- a/docs/nodes/generators/2pt_spline.rst +++ /dev/null @@ -1,61 +0,0 @@ -2 Point Spline -============== - -Functionality -------------- - -Single section Bezier Spline. Creates a *Spline Curve* from 2 sets of points. Analogue to the Blender native Curve object, but limited to 2 pairs of *knots* and *control points* per curve. - -Inputs ------- - -+-----------+--------+-------------------------------------------------------------+ -| Parameter | Type | Description | -+===========+========+=============================================================+ -| num verts | int | per curve this sets how many verts define the curve | -+-----------+--------+-------------------------------------------------------------+ -| knot 1 | Vector | These place and adjust the shape of the curve. The knots | -+-----------+--------+ are vectors on the curve, the controls are vectors to which | -| control 1 | Vector | the curve is mathematically attracted | -+-----------+--------+ | -| control 2 | Vector | | -+-----------+--------+ | -| knot 2 | Vector | | -+-----------+--------+-------------------------------------------------------------+ - -The node accepts these -The node will adjust to make sure the length of - - -Parameters ---------- - -The Node is vectorized in the following way. If any of the *knots* or *control points* are given in a list that doesn't match the length of the other lists, then the last value of that shorter list is repeated to match the length of the longest. - -This means; if *knot1, control1, knot2* are length 3, 4 and 8 and control2 is length 20 then -*knot1, control1, knot2* will all get their last value repeated till the full list matches 20 values. - -The same *filling* procedure is applied to the *Num Verts* parameter. - -Outputs -------- - -- (verts, edges) : A set of each of these that correspond with a packet of commands like 'knot1, ctrl1, ctrl2, knot2' -- verts needs to be connected to get output -- edges is optional - -**optionals for visualizing the curve handles** - -- hnd. Verts -- hnd. Edges - -Passing hnd.Verts and hnd.Edges to a ViewerDraw node helps visualize the Handles that operate on your Spline curve. - - -Examples --------- - -.. image:: https://cloud.githubusercontent.com/assets/619340/3362071/c3b7f346-fb05-11e3-9af7-35dfda973712.png -.. image:: https://cloud.githubusercontent.com/assets/619340/3362910/c18e4eea-fb0e-11e3-9a80-4624d30c65e9.gif - -See the progress of how this node came to life `here `_ (gifs, screenshots) diff --git a/docs/nodes/generators/3pt_arc.rst b/docs/nodes/generators/3pt_arc.rst deleted file mode 100644 index 07f378883..000000000 --- a/docs/nodes/generators/3pt_arc.rst +++ /dev/null @@ -1,44 +0,0 @@ -3 Point Arc -=========== - -Functionality -------------- - -Given a *start coordinate*, a *through coordinate*, and an *end coordinate* this Node will find the Arc that passes through those points. - -Inputs ------- - -- arc_pts input is `[begin, mid, end, begin, mid, end, begin, mid, end..... ]` - - - must be (len % 3 == 0 ) - -- num verts is either - - - constant - - unique - - or repeats last value if the number of arcs exceeds the number of values in the `num_vert` list - - -Parameters ----------- - -The UI is quite minimal. - - -- **num verts** can be changed via Slider input on the UI or as described above, it can be fed multiple values through the input sockets. - - -Output ------- - -- (verts, edges) : A set of each of these that correspond with a packet of commands like 'start, through, end, num_verts' -- verts needs to be connected to get output -- edges is optional - -Examples --------- - -.. image:: https://cloud.githubusercontent.com/assets/619340/3375992/3bbc0c86-fbd0-11e3-9456-353c77fd0d17.gif - -See the progress of how this node came to life `here `_ (gifs, screenshots) diff --git a/docs/nodes/generators/box_rounded.rst b/docs/nodes/generators/box_rounded.rst deleted file mode 100644 index e11f1a0f3..000000000 --- a/docs/nodes/generators/box_rounded.rst +++ /dev/null @@ -1,51 +0,0 @@ -Rounded box -=========== - -Functionality -------------- -See the BlenderArtists thread by original author Phymec. This node merely encapsulates -the code into a form that works for Sverchok. Internally the main driver is the amount of -input vectors, each vector represents the x y z dimensions of a box. Each box can have -unique settings. If fewer parameters are provided than sizes, then a default or the last -parameter is repeated. - -Inputs & Parameters -------------------- - -+----------------+-----------------------+----------------------------------------------------------------------------+ -| name | type | info | -+================+=======================+============================================================================+ -| radius | single value or list | radius of corner fillets | -+----------------+-----------------------+----------------------------------------------------------------------------+ -| arc div | single value or list | number of divisions in the fillet | -+----------------+-----------------------+----------------------------------------------------------------------------+ -| lin div | single value or list | number of internal divisions on straight parts (``[0..1]`` or ``[1..20]``) | -+----------------+-----------------------+----------------------------------------------------------------------------+ -| Vector Size | single vector or list | x y z dimensions for each box | -+----------------+-----------------------+----------------------------------------------------------------------------+ -| div type | 3way switch, integers | just corners, corners and edges, all | -+----------------+-----------------------+----------------------------------------------------------------------------+ -| odd axis align | 0..1 on or off | internal rejiggery, not sure. | -+----------------+-----------------------+----------------------------------------------------------------------------+ - -Outputs -------- - -Depending on how many objects the input asks for, you get a Verts and Polygons list of rounded box representations. - - -Examples --------- - -.. image:: https://cloud.githubusercontent.com/assets/619340/4471754/4987c79a-493e-11e4-89fe-bb9210af45c9.png - -.. image:: https://cloud.githubusercontent.com/assets/619340/4470969/f7dca97c-4930-11e4-9cae-63f8b17826be.png - -Notes ------ - -see: - -**Round Cube, real Quadsphere, Capsule (snipped thread title):** - -`original thread `_ \ No newline at end of file diff --git a/docs/nodes/generators/generative_art.rst b/docs/nodes/generators/generative_art.rst deleted file mode 100644 index ff5e07e20..000000000 --- a/docs/nodes/generators/generative_art.rst +++ /dev/null @@ -1,336 +0,0 @@ -Generative Art -================== - -*destination after Beta: Generators* - -Functionality -------------- - -This node can be used to produce recursive three dimensional structures following a design specified in a separate xml file. These structures are similar to fractals or lsystems. - -The xml file defines a set of transformation rules and instructions to place objects. A simple set of rules can often generate surprising and complex structures. - -Inputs & Parameters -------------------- - -This node has the following parameters: - -- **xml file** - Required. This specifies the LSystem design and should be a linked text block in the .blend file. -- **r seed** - Integer to initialize python's random number generator. If the design includes a choice of multiple rules, changing this will change the appearance of the design -- **max mats** - To avoid long delays or lock ups the output of the node is limited to this number of matrices - -This node has the following inputs: - -- **Vertices** - Optional. A list of vertices to be joined in a ring and used as the basis for a tube structure. Typically the output of a Circle or NGon node. -- **data** - Optional. The xml file can have optional variables defined using {myvar} type format notation. Extra named data inputs are generated for each of these these variables. These variables can be used to control animations. - - -Outputs -------- - -- **Vertices, Edges and Faces** - If the Vertices input is connected, these outputs will define the mesh of a tube that skins the structure defined in the xml file. - -- **Shapes Matrices** - For each *shape* atribute defined in the xml file a named output will be generated. This output is a list list of matrices that define the structure. - - -Examples of usage ------------------- - -A simplified description of the algorithm for the evaluation of a design. - -The xml file (see below for examples and descriptions) consist of a set of rules, each rule has a list of instructions, each instruction defines a transform and either a call to a rule or an instruction to place an instance. - -The system is implemented by a stack where each item in the stack consists of the next rule to call, the current depth of the system and the current state of the system. At each iteration of the processor the last item is removed from the stack and processed. - -Each instruction in the rule removed from the stack is processed in turn. The current state of this system is set to that of the item removed from the stack. Any transform in the instruction is applied to the system state. If the instruction is a call to a rule, a new item is added to the stack with the new rule, the depth increased by one, and the new system state. If the instruction is to place an instance, the matrix representing the new system state is added to the output matrix list for that type of shape. The processor then proceeds to what is now the last item on the stack. - -If the max_depth for the current rule is reached or the max_depth for overall design is reached then the processor goes back and processes what is now the last item on the stack without taking any other action. If the stack is empty or the maximum number of matrices has been reached the processor stops. - - -A simple example of an xml design file: - -6 Spirals -:: - - - - - - - - - - - - - - - - -This specifies the following design with 6 spirals. - -.. image:: https://cloud.githubusercontent.com/assets/7930130/13376231/cb79f476-de1b-11e5-90e9-845f3c201228.png - :alt: 6 spiral screen shot with node diagram and text file and structure - -The xml file consists of a list of rules. There must be at least one rule called entry. This is the starting point for the processor. Each rule consists of a list of instructions. These instructions can either be a call to another rule or an instruction to place an instance of an object. - -Calls can be recursive. For the example above the first instruction in rule R1 also calls rule R1. This recursion stops when the max_depth value is reached or the max_mats value set in the node is reached. The max_depth can also be set separately for each rule and is added as an attribute eg ````. - -Each of these instructions can be modified with a set of transforms. If the transform is omitted it defaults to the identity transform. - -A transform consist of translations, rotations and scaling operations. For example ``tx 1.3`` means translated 1.3 units in the ``x`` direction, ``rz 6`` means rotate 6 degrees about the ``z`` axis and ``sa 0.99`` means scale all axes by 0.99. - -The full list of transforms that take one argument : ``tx ty tz rx ry rz sx sy sz sa`` -In addition all three axes values for either a translation or scale can be applied at once with a triplet of values. -For example: ``t 1.1 2.2 3.3 s 0.9 0.9 0.7`` - -Instead of using a single *transform* attribute, each transform can be specified individually. For example ``transforms="tx 1 rz 90 sa 0.75"`` can be replaced with ``tx="1" rz="90" sa="0.75"``. - -The count attribute specifies how many times that instruction is repeated. if count is omitted it defaults to 1. For example the instruction ```` calls rule ``R1`` applying a 120 degree rotation about ``z`` in between each call. - -An instance instruction tells the processor to add a matrix to the output list defining the state of the system at that point. The names used in the shape attribute are used as the names for the node's output sockets. If there is more than one type of shape each will have its own output socket. - - -Multiple Rule Definition Example -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -There can be multiple definitions of the same rule in an xml file. - -For example - -Tree -:: - - - - - - - - - - - - - - - - - - - - - - - -.. image:: https://cloud.githubusercontent.com/assets/7930130/7782285/25164a80-0162-11e5-9feb-32c4f3908f1e.png - :alt: tree structure image - -In the above xml file there are four definitions of the ``spiral`` rule. Each rule version has a weight attribute. The processor will call each version of the ``spiral`` rule in a random manner. The weight attribute will determine the probability a particular rule version is called. - -The first three definitions of the ``spiral`` rule all place an object instance and then call the ``spiral`` rule with the same translation along the ``z`` axis and rotation about the ``x`` axis but different amounts of rotation about the ``y`` and ``z`` axis. The fourth definition calls the ``spiral`` rule twice without placing an instance. This causes the branches in the tree structure. Changing the value of the weight attribute for this rule version will change how often the tree branches. For a larger weight value, the rule gets called more often and there are more branches. - -If the weight attribute is omitted each version will have equal weight. Changing the value of ``r seed`` in the node interface will change the generated structure for xml files with multiple rule definitions. This example had rseed = 1. - - -Successor Rule Example -~~~~~~~~~~~~~~~~~~~~~~~~~ - -Normally when the ``max_depth`` for a rule is reached that 'arm' of the structure is finished. If a rule defines a successor rule then this rule will be called when the ``max_depth`` is reached. In the following example when the ``y180`` rule gets called it will be called 90 times in succession and produce a 180 degree turn about the y axis. When it finishes the successor rule ``r`` will be called and either produce a 180 degree turn about the ``y`` axis or the ``z`` axis. - -Nouveau variation -:: - - - - - - - - - - - - - - - - - - - - -.. image:: https://cloud.githubusercontent.com/assets/7930130/7629793/cb2d4a30-fa83-11e4-8c75-2fa6488f65fe.png - :alt: nouveau variation structure - -This example needs "max matrices" set to 5000 to get the above result. - - -Mesh Mode Example -~~~~~~~~~~~~~~~~~~ - -Using the matrices output allows a separate object to be placed at each location. The vertices input and the mesh (vertices, edges, faces) output "skins" the mesh into a much smaller number of objects. The vertices input should be a list of vertices such as that generated by the "Circle" node or "NGon" node. It could also be a circle type object taking from the scene using the "Objects In" node. The list of vertices should be in order so they can be made into a ring with the last vertex joined to the first. That ring dosen't have to be planar. - -.. image:: https://cloud.githubusercontent.com/assets/7930130/13376232/d20249ce-de1b-11e5-968d-727f0038305e.png - :alt: node and result picture for 6 spiral in mesh mode - -The output will not always be one mesh. If the rule set ends one 'arm' and goes back to start another 'arm' these two sub-parts will be separate meshes. Sometimes the mesh does not turn out how you would like. This can often be fixed by changing the rule set. - -Often a mesh tube will turn out flat rather than being tube like. This can usually be fixed by either rotating the vertex ring in the scene or by adding a rotation transform to the "instance" commands in the rule set. - -For example change ```` to ```` - -In other cases the mesh can be connected in the wrong order. - -For example the following two xml files will look the same when the matrix output is used to place objects, but have different output when they are used in mesh mode. Both sets of xml rules produce the same list of matrices just in a different order. - -Fern 1 -:: - - - - - - - - - - - - - - - - - - - -.. image:: https://cloud.githubusercontent.com/assets/7930130/7629779/b6553802-fa83-11e4-8390-aa9ba2a0c44d.png - :alt: image fern wrong - -Fern 2 -:: - - - - - - - - - - - - - - - - - - - - - - - -.. image:: https://cloud.githubusercontent.com/assets/7930130/7629783/bbe99588-fa83-11e4-8d70-92cc2909675e.png - :alt: image fern right - -Again these were both done with max mats set to 5000. - -Constants and Variables Example -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Constants and variables can be included in the xml file by replacing a numerical value with a pair of braces. -:: - - transforms = "tx 0.5 rx 20 sa 0.9" - -becomes -:: - - transforms = "tx {x_const} rx 20 sa 0.9" - -Constants are defined within the xml as follows: -:: - - - -Multiple constants can be defined within one element and several *constants* elements can be used as required in the xml file. - -If a field name in between curly brackets is not given a value in a *constants* element then a named input socket will be added to the node. A *Float*, *Integer* or similar node input can be wired up to this input variable. - -The example below uses a variable ({curl_angle}) to animate the amount of curl on the fern structure shown in the mesh mode example and two constants to fix the the value of the ``tz`` transform in the large curl and the scale ({sxy}) in all the curls. - -Fern 3 -:: - - - - - - - - - - - - - - - - - - - - - - - - -.. image:: https://cloud.githubusercontent.com/assets/7930130/13376233/d7303744-de1b-11e5-8c91-1d56f412b27d.png - :alt: image fern animation - -For this animation the index number of the current frame in the animation is translated from the range 1 to 250 to the range 16 to 6 via the "Map Range" node and wired into the ``curl_angle`` input of the "Generative Art" node. This cause the fern to unwind as the animation proceeds. - -Simple maths can also be use in the transforms definition. This has been used above in the ``curlsmall`` rule. The ``rx`` rotation of the transform will always be twice that of the ``rx`` rotation in the ``curl1`` and ``curl2`` rules. There cannot be any spaces in any maths expressions for the rotation, translation or scale parameters when using a single transforms attribute string. To allow for more complicated expressions each transform can be separated out into its own attribute. - -transforms as single attribute (no spaces allowed in maths expression) -:: - - - -each transform with its own attribute (can have spaces) -:: - - - - -All this is implemented by first using python's string ``format`` method to substitute in the variable value from the node data input. Then the resulting string is passed to python's ``eval()`` function. The string must evaluate to a single number (float or integer). Using ``eval()`` is a potential security problem as in theory someone could put some malicious code inside an xml lsystem definition. As always don't run code from a source you don't trust. - -The python ``math`` and ``random`` modules exist in the namespace of the "Generative Art" node so for example a transform could be defined as: -:: - - tx="2**0.5" - -or: -:: - - tx="math.sqrt(2)" - -Only the transforms that take a single number that is ``tx, ty, tz, rx, ry, rz, sx, sy, sz`` and ``sa`` have been implemented using individual attributes. The ones that use triplets to specify all three translations or scales at once (``t`` and ``s``) can only be used in a transform string. - - -References ----------- - -This node is closely based on `Structure Synth`_ but the xml design format and most of the code comes from `Philip Rideout's`_ `lsystem`_ repository on github. - - -.. _Structure Synth: http://structuresynth.sourceforge.net/ -.. _lsystem: https://github.com/prideout/lsystem -.. _Philip Rideout's: http://prideout.net/ - - - - diff --git a/docs/nodes/generators/hilbert.rst b/docs/nodes/generators/hilbert.rst deleted file mode 100644 index 16a2d17ed..000000000 --- a/docs/nodes/generators/hilbert.rst +++ /dev/null @@ -1,44 +0,0 @@ -Hilbert 2D -======================= - -Functionality -------------- - -Hilbert field generator. this is concept of dence flooding of space by continuous line, that achived with division and special knotting. Hilbert space can be only square, because of his nature. - -Inputs ------- - -All inputs are not vectorized and they will accept single value. -There is two inputs: - -- **level** -- **size** - -Parameters ----------- - -All parameters can be given by the node or an external input. - - -+-------------+---------------+-------------+------------------------------------------+ -| Param | Type | Default | Description | -+=============+===============+=============+==========================================+ -| **level** | Int | 2 | level of division of hilbert square | -+-------------+---------------+-------------+------------------------------------------+ -| **size** | float | 1.0 | scale of hilbert mesh | -+-------------+---------------+-------------+------------------------------------------+ - -Outputs -------- - -**Vertices**, **Edges**. - - -Example of usage ----------------- - -.. image:: https://cloud.githubusercontent.com/assets/5783432/4380966/a5d73b7c-436f-11e4-89e0-5a4be8f130aa.png - :alt: hilbert.PNG - -Smooth labirynth diff --git a/docs/nodes/generators/hilbert3d.rst b/docs/nodes/generators/hilbert3d.rst deleted file mode 100644 index b0d82296d..000000000 --- a/docs/nodes/generators/hilbert3d.rst +++ /dev/null @@ -1,44 +0,0 @@ -Hilbert 3D -======================= - -Functionality -------------- - -Hilbert space generator. this is concept of dence flooding of space by continuous line, that achived with division and special knotting. Hilbert space can be only cube, because of his nature. - -Inputs ------- - -All inputs are not vectorized and they will accept single value. -There is two inputs: - -- **level** -- **size** - -Parameters ----------- - -All parameters can be given by the node or an external input. - - -+-------------+---------------+-------------+------------------------------------------+ -| Param | Type | Default | Description | -+=============+===============+=============+==========================================+ -| **level** | Int | 2 | level of division of hilbert square | -+-------------+---------------+-------------+------------------------------------------+ -| **size** | float | 1.0 | scale of hilbert mesh | -+-------------+---------------+-------------+------------------------------------------+ - -Outputs -------- - -**Vertices**, **Edges**. - - -Example of usage ----------------- - -.. image:: https://cloud.githubusercontent.com/assets/5783432/4380965/a5a3019a-436f-11e4-9ec9-982ab3f25671.png - :alt: hilbert3d.PNG - -Smooth labirynth diff --git a/docs/nodes/generators/hilbert_image.rst b/docs/nodes/generators/hilbert_image.rst deleted file mode 100644 index 746506691..000000000 --- a/docs/nodes/generators/hilbert_image.rst +++ /dev/null @@ -1,48 +0,0 @@ -Hilbert 3D -======================= - -Functionality -------------- - -Hilbert image recreator. Based on hilbert space this node recreates image by interpolating it on pixels. - -Inputs ------- - -- **level** -- **size** -- **sensitivity** - -Parameters ----------- - -All parameters can be given by the node or an external input. - - -+-----------------+---------------+-------------------+----------------------------------------------------------+ -| Param | Type | Default | Description | -+=================+===============+===================+==========================================================+ -| **RGB** | float | 0.3,0.59,0.11 | RGB map of imported image, sensitivity to each color | -+-----------------+---------------+-------------------+----------------------------------------------------------+ -| **image name** | string | None | enumerate popup to choose image from stack | -+-----------------+---------------+-------------------+----------------------------------------------------------+ -| **level** | Int | 2 | level of division of hilbert square | -+-----------------+---------------+-------------------+----------------------------------------------------------+ -| **size** | float | 1.0 | scale of hilbert mesh | -+-----------------+---------------+-------------------+----------------------------------------------------------+ -| **sensitivity** | float | 1.0 | define scale of values to react and build image | -+-----------------+---------------+-------------------+----------------------------------------------------------+ - -Outputs -------- - -**Vertices**, **Edges**. - - -Example of usage ----------------- - -.. image:: https://cloud.githubusercontent.com/assets/5783432/4381109/5bca94dc-4371-11e4-8de0-eb3ee7356aa8.png - :alt: hilbertimage.PNG - -recreate image in hilbert diff --git a/docs/nodes/generators/image_decompose.rst b/docs/nodes/generators/image_decompose.rst deleted file mode 100644 index 253b3fea6..000000000 --- a/docs/nodes/generators/image_decompose.rst +++ /dev/null @@ -1,66 +0,0 @@ -Image Decomposer -================ - -*destination after Beta: analyzers* - -.. image:: https://cloud.githubusercontent.com/assets/619340/4495748/bbd3fe56-4a5e-11e4-9202-3b86f7c57c22.png - - -Functionality -------------- - -To get output from this node you must connect something to the first 2 output sockets (xya and rgb), polygons is optional -and only outputs faces when ``Filter?`` is off. - -Takes the ``rgba`` components of an image currently loaded in Blender and decomposes -them into ``xya`` and ``rgb`` Vertex-style sockets. ``xy`` are inferred by the number of pixels in the image and the image width. ``z`` doesn't make much sense in relation to a pixel and was replaced by the Alpha channel of the pixel (``a``). - -If you don't have images loaded in the UV editor, they can be imported from N panel -into Blender and loaded from there. - - -Inputs & Parameters -------------------- - -+---------------+-------------------------------------------------------------------+ -| name | function | -+===============+===================================================================+ -| Skip n pixels | allows to sample a reduced grid of the image, every nth pixel in | -| | either direction. | -+---------------+-------------------------------------------------------------------+ -| xy_spread | the ``xy`` component of the ``xya`` socket can be multiplied to | -| | get a wider spread. | -+---------------+-------------------------------------------------------------------+ -| z_spread | this amplifies ``rgb``, not ``a`` (which you can amplify yourself | -| | if that was needed.) | -+---------------+-------------------------------------------------------------------+ -| Filter? | uses a restricted eval to drop pixels using a simple typed command| -| | : example ``r < 0.8 and g > 0.4`` (more below) | -+---------------+-------------------------------------------------------------------+ - - -Outputs -------- - - -+-------------+--------------------------------------------------------------------+ -| name | function | -+=============+====================================================================+ -| ``xya`` | the **x** and **y** of the pixel, combined with the Alpha channel. | -| | The value of **x** and **y** are multiplied by ``xy_spread``. | -+-------------+--------------------------------------------------------------------+ -| ``rgb`` | each (unfiltered) pixel component is multiplied by ``z_spread`` | -+-------------+--------------------------------------------------------------------+ -| polygons | this output will generate sensible polygon index list for ``xya`` | -| | when pixels are unfiltered. | -+-------------+--------------------------------------------------------------------+ - -Examples --------- - -`The development thread `_ contains working examples of this Node used as preprocessor for game maps. - -Notes ------ - -The loaded image gets a fake user automagically, tho perhaps this should be optional. \ No newline at end of file diff --git a/docs/nodes/generators/profile_parametric.rst b/docs/nodes/generators/profile_parametric.rst deleted file mode 100644 index b376f2c59..000000000 --- a/docs/nodes/generators/profile_parametric.rst +++ /dev/null @@ -1,141 +0,0 @@ -======================= -Profile Parametric Node -======================= - - -**Profile Node** implements a useful subset of the SVG path section commands. Currently the following segment types are available: - -+---------+------+---------------------------------------------------------------------------------+ -| name | cmd | parameters | -+=========+======+=================================================================================+ -| MoveTo | M, m| <2v coordinate> | -+---------+------+---------------------------------------------------------------------------------+ -| LineTo | L, l| <2v coordinate 1> <2v coordinate 2> <2v coordinate n> [z] | -+---------+------+---------------------------------------------------------------------------------+ -| CurveTo | C, c| <2v control1> <2v control2> <2v knot2> [z] | -+---------+------+---------------------------------------------------------------------------------+ -| ArcTo | A, a| <2v rx,ry> <2v x,y> [z] | -+---------+------+---------------------------------------------------------------------------------+ -| Close | X | | -+---------+------+---------------------------------------------------------------------------------+ -| comment | # | must be first thing on the line, no trailing comment instructions. | -+---------+------+---------------------------------------------------------------------------------+ - -:: - - <> : mandatory field - [] : optional field - 2v : two point vector `a,b` - - no space between , - - no backticks - - a and b can be - - number literals - - lowercase 1-character symbols for variables - int : means the value will be cast as an int even if you input float - flags generally are 0 or 1. - z : is optional for closing a line - X : as a final command to close the edges (cyclic) [-1, 0] - in addition, if the first and last vertex share coordinate space - the last vertex is dropped and the cycle is made anyway. - # : single line comment prefix - - -**Mode 0:** default behaviour, variables may be negated - -:: - - M a,-a - L a,a -a,a -a,-a z - -There are 2 slightly more elaborate evaluation modes: - -**Mode 1:** Requires the use or parentheses to indicate where extra operations take place. -Mode 1 is restrictive and only allows addition and subtraction - -:: - -(a+b-c) - -**Mode 2:** Also requires parentheses but allows a more liberal evaluation of operations. Allowed operations are: - -:: - -(a*b(c/d)) - -To use Mode 2, you must enable the *extended parsing* switch in the N-panel for the Profile node. - - -Examples --------- - -If you have experience with SVG paths most of this will be familiar. The biggest difference is that only the -LineTo command accepts many points, and we always start the profile with a M ,. - -:: - - M 0,0 - L a,a b,0 c,0 d,d e,-e - - -CurveTo and ArcTo only take enough parameters to complete one Curve or Arc, -unlike real SVG commands which take a whole sequence of chained CurveTo or ArcTo commands. The decision to keep -it at one segment type per line is mainly to preserve readability. - -The CurveTo and ArcTo segment types allow you to specify how many vertices are used to generate the segment. SVG -doesn't let you specify such things, but it makes sense to allow it for the creation of geometry. - -the fun bit about this is that all these variables / components can be dynamic - -:: - - M 0,0 - L 0,3 2,3 2,4 - C 2,5 2,5 3,5 10 0 - L 5,5 - C 7,5 7,5 7,3 10 0 - L 7,2 5,0 - X - -or - -:: - - M a,a - L a,b c,b -c,d - C c,e c,e b,e g 0 - L e,e - C f,e f,e f,-b g 0 - L f,c e,a - X - - -More Info ---------- - -The node started out as a thought experiment and turned into something quite useful, you can see how it evolved in the `github thread `_ - -Example usage: - -.. image:: https://cloud.githubusercontent.com/assets/619340/3905771/193b5d86-22ec-11e4-93e5-724863a30bbc.png - - -.. image:: https://cloud.githubusercontent.com/assets/619340/3895396/81f3b96c-224d-11e4-9ca7-f07756f40a0e.png - - -Gotchas -------- - -The update mechanism doesn't process inputs or anything until the following conditions are satisfied: - - * Profile Node has at least one input socket connected - * The file field on the Node points to an existing Text File. - - -Keyboard Shortcut to refresh Profile Node ------------------------------------------ - -Updates made to the profile path text file are not propagated automatically to any nodes that might be reading that file. -To refresh a Profile Node simply hit ``Ctrl+Enter`` In TextEditor while you are editing the file, or click one of the -inputs or output sockets of Profile Node. There are other ways to refresh (change a value on one of the incoming nodes, -or clicking the sockets of the incoming nodes) - diff --git a/docs/nodes/generators/scripted.rst b/docs/nodes/generators/scripted.rst deleted file mode 100644 index 5129bca63..000000000 --- a/docs/nodes/generators/scripted.rst +++ /dev/null @@ -1,378 +0,0 @@ -Scripted Node (Generator) -========================= - -aka Script Node or SN. (iteration 1) - -- Introduction -- Features -- Structure -- Templates -- Conveniences -- Examples -- Techniques to improve Python performance -- Limitations -- Future - -Introduction ------------- - -When you want to express an idea in written form and the concept is suitable -for a one line Python expression then often you can use a Formula node. If you -need access to imports, classes, temporary variables, and functions then you can -write a script to load into ScriptNode. - -ScriptNode (SN) allows you to write multi-line python programs that define -the functionality of a Node, while avoiding some of the boilerplate associated -with a regular Node. SN can be used as an environment for experimenting -with algorithms. Scripts written for SN are easily converted to full PyNodes. - -It's a prototype so bug reports are welcome. - -Here's a short tutorial to SN1, see :ref:`scripted-tutorial` - - -Features --------- - -allows: - -- Loading/Reloading scripts currently in TextEditor -- imports and aliasing, ie anything you can import from console works in SN -- nested functions and lambdas -- named inputs and outputs -- named operators (buttons to action something upon button press) - -Structure ---------- - -At present all scripts for SN must (strict list - general): - -- have 1 `sv_main` function as the main workhorse -- `sv_main` must take 1 or more arguments (even if you don't use it) -- all function arguments for ``sv_main`` must have defaults. -- each script shall define ``in_sockets`` and ``out_sockets`` -- `ui_operators` is an optional third output parameter - -**sv_main()** - - -``sv_main()`` can take int, float and list or nested list. -Here are some legal examples:: - - def sv_main(vecs_in_multi=[[]], vecs_in_flat=[], some_var=1, some_ratio=1.2): - pass - - [[]] # for nested input (lists of lists of any data type currently supported) - [] # for flat (one list) - int, float # for single value input - -**in_sockets** - -:: - - in_sockets = [ - [type, 'socket name on ui', input_variable], - [type, 'socket name on ui 2', input_variable2], - # ... - ] - -**out_sockets** - -:: - - out_sockets = [ - [type, 'socket name on ui', output_variable], - [type, 'socket name on ui 2', output_variable2], - # ... - ] - -**in_sockets and out_sockets** - -- Each *socket name on ui* string shall be unique. - -- **type** are currently limited to - - +---------+-------------------------------------+ - | type id | type data | - +=========+=====================================+ - | 's' | floats, ints, edges, faces, strings | - +---------+-------------------------------------+ - | 'v' | vertices, vectors, 3-tuples | - +---------+-------------------------------------+ - | 'm' | matrices, 4 x 4 nested lists | - +---------+-------------------------------------+ - - - -**ui_operators** - -:: - - ui_operators = [ - ['button_name', func1] - ] - -- Here `func1` is the function you want to call when pressing the button. -- Each `"button_name"` is the text you want to appear on the button. - For simplicity it must be a unique and valid python variable name - - - with no special characters (``|().\/...etc``) - - doesn't start with a number - - contains no spaces, use single underscores if you need word separation. The UI code replaces underscores with spaces. - - -**return** - - -Simple, only two flavours are allowed at the moment. :: - - return in_sockets, out_sockets - return in_sockets, out_sockets, ui_operators - -Templates ---------- - -Sverchok includes a list of easily accessible examples and templates. They can be accessed -from the SN node if nothing is loaded, or from the `Template Menu` in `TextEditor` as ``sv NodeScripts``. - - -Conveniences ------------- - -We vale our time, i'm sure you do too, so features have been added to help speed up the -script creation process. - -**Text Editor** - -- has automatic ``in_sockets`` list creation when the key cursor is over ``sv_main``. - (please note: it doesn't attempt to detect if you want nested verts or edge/polygon so it assumes you want 'v') - - - kb shortcut: ``Ctrl+I -> Generate in_sockets`` - -.. image:: https://cloud.githubusercontent.com/assets/619340/2854040/e6351180-d14b-11e3-8055-b3d8c707675d.gif - -- can also convert a template description (like `kv lang` if you know Kivy) into - valid ScriptNode ready python. Example `available here `_ - - - kb shortcut: ``Ctrl+I -> Convert svlang`` - -- can refresh the Script Node which currently loads that script by hitting ``Ctrl+Enter`` - - -Examples --------- - -The best way to get familiarity with SN is to go through the templates folder. -They are intended to be lightweight and educational, but some of them will show -advanced use cases. The images and animations on this `thread on github -`_. -may also provide some insight into what's possible. - -A typical nodescript may look like this:: - - - from math import sin, cos, radians, pi - from mathutils import Vector, Euler - - - def sv_main(n_petals=8, vp_petal=20, profile_radius=1.3, amp=1.0): - - in_sockets = [ - ['s', 'Num Petals', n_petals], - ['s', 'Verts per Petal', vp_petal], - ['s', 'Profile Radius', profile_radius], - ['s', 'Amp', amp], - ] - - # variables - z_float = 0.0 - n_verts = n_petals * vp_petal - section_angle = 360.0 / n_verts - position = (2 * (pi / (n_verts / n_petals))) - - # consumables - Verts = [] - - # makes vertex coordinates - for i in range(n_verts): - # difference is a function of the position on the circumference - difference = amp * cos(i * position) - arm = profile_radius + difference - ampline = Vector((arm, 0.0, 0.0)) - - rad_angle = radians(section_angle * i) - myEuler = Euler((0.0, 0.0, rad_angle), 'XYZ') - - # changes the vector in place, successive calls are accumulative - # we reset at the start of the loop. - ampline.rotate(myEuler) - x_float = ampline.x - y_float = ampline.y - Verts.append((x_float, y_float, z_float)) - - # makes edge keys, ensure cyclic - Edges = [[i, i + 1] for i in range(n_verts - 1)] - Edges.append([i, 0]) - - out_sockets = [ - ['v', 'Verts', [Verts]], - ['s', 'Edges', [Edges]], - ] - - return in_sockets, out_sockets - -but we are not forced to have all code inside sv_main, we can also do:: - - - def lorenz(N, verts): - add_vert = verts.append - h = 0.01 - a = 10.0 - b = 28.0 - c = 8.0 / 3.0 - - x0 = 0.1 - y0 = 0 - z0 = 0 - for i in range(N): - x1 = x0 + h * a * (y0 - x0) - y1 = y0 + h * (x0 * (b - z0) - y0) - z1 = z0 + h * (x0 * y0 - c * z0) - x0, y0, z0 = x1, y1, z1 - - add_vert((x1,y1,z1)) - - def sv_main(N=1000): - - verts = [] - in_sockets = [['s', 'N', N]] - out_sockets = [['v','verts', [verts]]] - - lorenz(N, verts) - return in_sockets, out_sockets - - -We can even define classes inside the .py file, or import from elsewhere. - -Here's a `ui_operator` example, it acts like a throughput (because in and out -are still needed by design). You'll notice that inside `func1` the node's input -socket is accessed using `SvGetSockeyAnyType(...)`. It is probably more logical -if we could access the input data directly from the variable `items_in`, -currently this is not possible -- therefor the solution is to use what -sverchok nodes use in their internal code too. The upshot, is that this exposes -you to how you might access the socket content of other nodes. Experiment :) - -:: - - def sv_main(items_in=[[]]): - - in_sockets = [ - ['v', 'items_in', items_in]] - - def func1(): - # directly from incoming Object_in socket. - sn = bpy.context.node - - # safe? or return early - if not (sn.inputs and sn.inputs[0].links): - return - - verts = SvGetSocketAnyType(sn, sn.inputs['items_in']) - print(verts) - - out_sockets = [['v', 'Verts', items_in]] - ui_operators = [['print_names', func1]] - - return in_sockets, out_sockets, ui_operators - - -Breakout Scripts ----------------- - -For lack of a better term, SN scripts written in this style let you pass -variables to a script located in ``/sverchok-master/..`` or -``/sverchok-master/your_module_name/some_library``. To keep your sverchok-master -folder organized I recommend using a module folder. In the example below, -I made a folder inside sverchok-master called ``sv_modules`` and inside that I -have a file called `sv_curve_utils`, which contains a function `loft`. This way -of coding requires a bit of setup work, but then you can focus purely on -the algorithm inside `loft`. :: - - - from mathutils import Vector, Euler, Matrix - import sv_modules - from sv_modules.sv_curve_utils import loft - - def sv_main(verts_p=[], edges_p=[], verts_t=[], edges_t=[]): - - in_sockets = [ - ['v', 'verts_p', verts_p], - ['s', 'edges_p', edges_p], - ['v', 'verts_t', verts_t], - ['s', 'edges_t', edges_t]] - - verts_out = [] - - def out_sockets(): - return [['v', 'verts_out', verts_out]] - - if not all([verts_p, edges_p, verts_t, edges_t]): - return in_sockets, out_sockets() - - # while developing, it can be useful to uncomment this - if 'loft' in globals(): - import imp - imp.reload(sv_modules.sv_curve_utils) - from sv_modules.sv_curve_utils import loft - - verts_out = loft(verts_p[0], verts_t[0]) # this is your break-out code - - # here the call to out_sockets() will pick up verts_out - return in_sockets, out_sockets() - - -Techniques to improve Python performance ----------------------------------------- - -There are many ways to speed up python code. Some slowness will be down to -innefficient algorithm design, other slowness is caused purely by how much -processing is minimally required to solve a problem. A decent read regarding -general methods to improve python code performance can be found -on `python.org `_. -If you don't know where the cycles are being consumed, then you don't know -if your efforts to optimize will have any significant impact. - -Read these 5 rules by Rob Pike before any optimization. -http://users.ece.utexas.edu/~adnan/pike.html - -Limitations ------------ - -Most limitations are voided by increasing your Python and ``bpy`` skills. - -Future ------- - -SN iteration 1 is itself a prototype and is a testing ground for iteration 2. -The intention was always to provide multiple programming language interfaces, -initially coffeescript because it's a lightweight language with crazy expressive -capacity. iteration 2 might work a little different, perhaps working from -within a class but trying to do extra introspection to reduce boilerplate. - -The only reason in_sockets needs to be declared at the moment is if you want -to have socket names that are different than the function arguments. It -would be possible to allow `sv_main()` to take zero arguments too. -So possible configurations should be:: - - sv_main() - sv_main() + in_sockets - sv_main() + out_sockets - sv_main(a=[],..) - sv_main(a=[],..) + in_sockets - sv_main(a=[],..) + out_sockets - sv_main(a=[],..) + in_socket + out_sockets - -etc, with ui_operators optional to all combinations - - -That's it for now. diff --git a/docs/nodes/generators/scripted2.rst b/docs/nodes/generators/scripted2.rst deleted file mode 100644 index c6d496489..000000000 --- a/docs/nodes/generators/scripted2.rst +++ /dev/null @@ -1,293 +0,0 @@ -Scripted Node 2(Generator) -========================= - -aka Script Node MK2 - -- Introduction -- Features -- Structure -- Templates -- Conveniences -- Examples -- Techniques to improve Python performance -- Limitations - -Introduction ------------- - -When you want to express an idea in written form and the concept is suitable -for a one line Python expression then often you can use a Formula node. If you -need access to imports, classes, temporary variables, and functions then you can -write a script to load into Script Node 2. - -Script Node MK2 differs from Script Node iteratrion 1 in that offers more control. -It also has a prototype system where you could for example reuse the behavior of -a generator and the template takes care of all the details leaving you to focus -on the function. Scripts using the templates automatically becomes more powerful. - -It's a prototype so bug reports, questions and feature request are very welcome. - -Features --------- - -allows: - -- Loading/Reloading scripts currently in TextEditor -- imports and aliasing, ie anything you can import from console works in SN2 -- nested functions and lambdas -- named inputs and outputs -- named operators (buttons to action something upon button press) - -Structure ---------- - -At present all scripts for SN2 must: - -- be subclasses SvScript -- include a function called process in the class -- have member attributes called ``inputs`` and ``outputs`` -- have one Script class per file, if more than one, last one found will be used - -**process(self)** - - -``process(self)`` is the main flow control function. It is called when all sockets -without defaults are connected. Usually the template provides a ``process`` function -for you. - -**inputs** - -Default can be a float or integer value, not other types are usable yet:: - - inputs = [ - [type, 'socket name on ui', default], - [type, 'socket name on ui2', default], - # ... - ] - - -**outputs** - -:: - - outputs = [ - [type, 'socket name on ui'], - [type, 'socket name on ui 2'], - # ... - ] - -**inputs and outputs** - -- Each *socket name on ui* string shall be unique. - -- **type** are currently limited to - - +---------+-------------------------------------+ - | type id | type data | - +=========+=====================================+ - | 's' | floats, ints, edges, faces, strings | - +---------+-------------------------------------+ - | 'v' | vertices, vectors, 3-tuples | - +---------+-------------------------------------+ - | 'm' | matrices, 4 x 4 nested lists | - +---------+-------------------------------------+ - -There are a series of names that have special meaning that scripts should -avoid as class attributes or only used for the intended meaning. To be described: - ``node`` ``draw_buttons`` ``update`` ``process`` ``enum_func`` ``inputs`` -``outputs`` - - -Templates ---------- - -Sverchok includes a series of examples for the different templates. - - -Conveniences ------------- - -We value our time, we are sure you do too, so features have been added to help speed up the -script creation process. - -**Text Editor** - -- can refresh the Script Node which currently loads that script by hitting ``Ctrl+Enter`` - -Main classes for your subclasses are: - - - ``SvScript`` - - ``SvScriptSimpleGenerator`` - - ``SvScriptSimpleFunction`` - -Limitations ------------ - -Using ``SvScriptSimpleGenerator`` and ``SvScriptSimpleFunction`` you limit inputs to deal with one object. -For plane, for example, you'll get next data: - - [(0.0, 0.0, 0.0), (1.0, 0.0, 0.0), (0.0, 1.0, 0.0), (1.0, 1.0, 0.0)] [(0, 1, 3, 2)] - -If you need Full support of Sverchok data - you'd better use ``SvScript`` -class and ``self.node.inputs[0].sv_get()`` function. - -Examples --------- - -The best way to get familiarity with Script Node 2 is to go through the templates folder. -They are intended to be lightweight and educational, but some of them will show -advanced use cases. The images and animations on this `thread on github -`_. -may also provide some insight into what's possible. - -A typical nodescript using the ``SvScriptSimpleGenerator`` may look like this, note that -the third argument for outputs is specific to this template:: - - import numpy - import itertools - - class GridGen(SvScriptSimpleGenerator): - inputs = [("s", "Size", 10.0), - ("s", "Subdivs", 10)] - outputs = [("v", "verts", "make_verts"), - ("s", "edges", "make_edges")] - - @staticmethod - def make_verts(size, sub): - side = numpy.linspace(-size / 2, size / 2, sub) - return tuple((x, y, 0) for x, y in itertools.product(side, side)) - - @staticmethod - def make_edges(size, sub): - edges = [] - for i in range(sub): - for j in range(sub - 1): - edges.append((sub * i + j, sub * i + j + 1)) - edges.append((sub * j + i, sub * j + i + sub)) - return edges - - -Note that here the name of the method that should be called for producing data -for each socket in the final last arguments to ``outputs`` but we are not forced -to have all code inside the class, we can also do -:: - - def lorenz(N, verts, h, a, b, c): - add_vert = verts.append - - x0 = 0.1 - y0 = 0 - z0 = 0 - for i in range(N): - x1 = x0 + h * a * (y0 - x0) - y1 = y0 + h * (x0 * (b - z0) - y0) - z1 = z0 + h * (x0 * y0 - c * z0) - x0, y0, z0 = x1, y1, z1 - - add_vert((x1,y1,z1)) - - class LorenzAttractor(SvScriptSimpleGenerator): - - inputs = [ - ['s', 'N', 1000], - ['s', 'h', 0.01], - ['s', 'a', 10.0], - ['s', 'b', 28.0], - ['s', 'c', 8.0/3.0] - ] - - @staticmethod - def make_verts(N, h, a, b, c): - verts = [] - lorenz(N, verts, h, a, b, c) - return verts - - @staticmethod - def make_edges(N, h a, b, c: - edges = [(i, i+1) for i in range(N-1)] - return edges - - outputs = [ - ['v','verts', "make_verts"], - ['s','edges', "make_edges"] - ] - - -Here is a simple script for deleting loose vertices from mesh data, it also serves as an -illustration for a type of script that uses the ```SvScriptSimpleFunction``` template that -has one main function that decomposes into separate sockets. The methods don't have be static -but in general it is good practice to keep them free from side effects. -:: - - from itertools import chain - - class DeleteLooseVerts(SvScriptSimpleFunction): - inputs = [ - ('v', 'verts'), - ('s', 'pol') - ] - outputs = [ - ('v', 'verts'), - ('s', 'pol') - ] - - # delete loose verts - @staticmethod - def function(*args, **kwargs): - ve, pe = args - # find used indexes - v_index = sorted(set(chain.from_iterable(pe))) - # remap the vertices - v_out = [ve[i] for i in v_index] - # create a mapping from old to new vertices index - mapping = dict(((j, i) for i, j in enumerate(v_index))) - # apply mapping to input polygon index - p_out = [tuple(map(mapping.get, p)) for p in pe] - return v_out, p_out - - -Breakout Scripts ----------------- -Scripts that needs to access the node can do so via the ```self.node``` variable -that is automatically set. -:: - - class Breakout(SvScript): - def process(self): - pass - - def update(self): - node = self.node - node_group = self.node.id_data - # here you can do anything to the node or node group - # that real a real node could do including multisocket - # adaptive sockets etc. templates and examples for this are - # coming - - -Admit, you can call sockets data directly when using ```SvScript``` as ```self.node.inputs[0].sv_get()```. -And other ```self.node.``` operations possible from this class. - - -Techniques to improve Python performance ----------------------------------------- - -There are many ways to speed up python code. Some slowness will be down to -innefficient algorithm design, other slowness is caused purely by how much -processing is minimally required to solve a problem. A decent read regarding -general methods to improve python code performance can be found -on `python.org `_. -If you don't know where the cycles are being consumed, then you don't know -if your efforts to optimize will have any significant impact. - -Read these 5 rules by Rob Pike before any optimization. -http://users.ece.utexas.edu/~adnan/pike.html - -Limitations ------------ - -Most limitations are voided by increasing your Python and ``bpy`` skills. But -one should also realize what is approriate for a node script to do. - - -That's it for now. diff --git a/docs/nodes/generators/scripted_intro.rst b/docs/nodes/generators/scripted_intro.rst deleted file mode 100644 index 24bcd7d1e..000000000 --- a/docs/nodes/generators/scripted_intro.rst +++ /dev/null @@ -1,126 +0,0 @@ -.. _scripted-tutorial: - -An introduction and tutorial for the Scripted Nodes -=================================================== - -> Dealga Mcardle | 2014 | October - -In my opinion new users should avoid the Script Nodes until they understand a majority of the existing nodes and the Sverchok `Eco-system` as a concept. This suggestion applies to everyone, even competent coders. - -Script Nodes are great when you want to encapsulate a behaviour which may not be easy to achieve with existing nodes alone. They are my prefered way to either 1) prototype code, or 2) write custom nodes that are too specific to be submitted as regular nodes. - -At the moment Sverchok has 2 Scripted Node implementations: SN and SN2. Exactly how they differ from eachother will be shown later. Both offer `practical shorthand` ways to define what a node does, which sliders and sane defaults it might have, and what socket types can connect to it. These scripts have a minimal interface, are stored inside the `.blend` file as plain text python, and can be shared easily. - -If you've ever written code for a Blender addon or script, you will be familiar with registration of classes. Nodes normally also need to be registered so Blender can find them, but Script Nodes don't because they are in essence a shell for your code -- and the shell is already registered, all you have to do is write code to process input into output. - -Scripted Node 1 -- an informal introduction -------------------------------------------- - -Here is a classic 'Hello World' style example used to demonstrate graphics coding. It's called a Lorenz Attractor. :: - - - def lorenz(N, verts): - add_vert = verts.append - h = 0.01 - a = 10.0 - b = 28.0 - c = 8.0 / 3.0 - - x0 = 0.1 - y0 = 0 - z0 = 0 - for i in range(N): - x1 = x0 + h * a * (y0 - x0) - y1 = y0 + h * (x0 * (b - z0) - y0) - z1 = z0 + h * (x0 * y0 - c * z0) - x0, y0, z0 = x1, y1, z1 - - add_vert((x1,y1,z1)) - - def sv_main(N=1000): - - verts = [] - in_sockets = [['s', 'N', N]] - out_sockets = [['v','verts', [verts]]] - - lorenz(N, verts) - return in_sockets, out_sockets - - -Here's what this code produces. - -.. image:: https://cloud.githubusercontent.com/assets/619340/5219883/5d3e1252-765d-11e4-87e8-56e1eef2d5ae.png - -Infact, here's the Node Interface that the script produces too - -.. image:: https://cloud.githubusercontent.com/assets/619340/5219902/a310c824-765d-11e4-9836-c34cb0d8a7b4.png - -Compare the code with the image of the node and you might get a fair idea where the sockets are defined and where the default comes from. Look carefully at -``in_sockets`` and ``out_sockets``, two of the elements are strings (socket type and socket name), and the third element is the Python variable that we automatically bind to those sockets. - -Brief Guided Explanation -------------------------- - -You've probably got a fair idea already from the example script. SN1 has a few conventions which let you quickly define sockets and defaults. What follows are short remarks about the elements that make up these scripts, aimed at someone who is about to write their first script for SN1. - -Sockets -------- - -Sverchok at present has 3 main socket types: VerticesSocket, StringsSocket and MatrixSocket. Script Nodes refer to these socket types with only their first letter in lowercase. 's','v','m':: - - 's' to hold: floats, ints, edges, faces, strings - 'v' to hold: vertices, vectors, 3-tuples - 'm' to hold: matrices, 4 x 4 nested lists - - -Socket Names ------------- - -Each socket has a name. Take a minute to think about a good descriptive name for each. Socket names can always be changed later, but my advice is to use clear names from the very beginning. - -Variable names --------------- - -Variable names are used to expose the values of the associated socket to your script. If the socket is unconnected then the value of the variable will be taken from the specified default. - -node function `(sv_main)` -------------------------- - -The main function for SN1 is ``sv_main``, in the body of this function is where we declare socket types, socket names, and variable names for input and output sockets. These are declared in two arrays ``in_sockets`` and ``out_sockets``. - -The argument list of ``sv_main`` is where you provide defaults values or the nestedness of an incoming datatype. (don't worry if this makes no sense, read it again later). - -That's great, show me! ----------------------- - -The easiest way to get started is to first load an existing script. Here are some steps: - -- Go to `Generators / Scripted Node` and add it to the NodeView. -- Open a Blender TextEditor window so you can see the TextEditor and the NodeView at the same time. -- Paste the Lorenz Attractor script (from above) into the TextEditor and call it 'attractor.py' -- In NodeView look at the field on the second row of the Scripted Node. This is a file selector which shows all Text files in blender. When you click on it you will see "attractor.py" -- Select "attractor.py" press the button the right, the one that looks like a powersocket. -- This changes the way the Node appears. The node will now have 1 input socket and one output socket. It might even have changed to a light blue. - -That's pretty much all there is to loading a script. All you do now is hook the output Verts to a Viewer Node and you'll see a classic Lorenz Attractor point set. - -Study the sv_main ------------------ - -If you look carefully in ``sv_main`` there's not a lot to the whole process. ``sv_main`` has two **required** lists; ``in_sockets`` and ``out_sockets``. sv_main also has a argument list which you must fill with defaults, here the only variable is N so the argument list was ``sv_main(N=1000)``. - -The lorenz function takes 2 arguments: - -- **N**, to set the number of vertices. -- **verts**, a list-variable to store the vertices generated by the algorithm. - -In this example the ``verts`` variable is also what will be sent to the output socket, because it says so in ``out_sockets``. Notice that the lorenz function doesn't return the verts variable. All the lorenz function does is fill that list with values. Just to be clear about this example. At the time ``sv_main`` ends, the content of ``verts`` is full, but before ``lorenz()`` is called, ``verts`` is an empty list. - -Here is the same lorenz attractor with more parameters exposed, see can you load it? -https://github.com/nortikin/sverchok/blob/master/node_scripts/templates/zeffii/LorenzAttractor2.py - -Lastly ------- - -If none of this makes sense, spend time learning about Python and dig through the ``node_scripts/templates`` directory. - diff --git a/docs/nodes/list_main/list_decompose.rst b/docs/nodes/list_main/list_decompose.rst deleted file mode 100644 index 0e505db22..000000000 --- a/docs/nodes/list_main/list_decompose.rst +++ /dev/null @@ -1,39 +0,0 @@ -List Decompose -============== - -Functionality -------------- - -Inverse to list join node. Separate list at some level of data to several sockets. Sockets count the same as items count in exact level. - -Inputs ------- - -- **data** - adaptable socket - -Parameters ----------- - -+----------------+---------------+-------------+----------------------------------------------------------+ -| Parameter | Type | Default | Description | -+================+===============+=============+==========================================================+ -| **level** | Int | 1 | Level of data to operate. | -+----------------+---------------+-------------+----------------------------------------------------------+ -| **Count** | Int | 1 | Output sockets' count. defined manually or with Auto set | -+----------------+---------------+-------------+----------------------------------------------------------+ -| **Auto set** | Button | | Calculate output sockets' count based on data count on | -| | | | choosen level | -+----------------+---------------+-------------+----------------------------------------------------------+ - -Outputs -------- - -- **data** - multisocket - - -Example of usage ----------------- - -Decomposed simple list in 2 level: - -.. image:: https://cloud.githubusercontent.com/assets/5783432/18610849/4b14c4fc-7d38-11e6-90ac-6dcad29b0a7d.png diff --git a/docs/nodes/list_main/list_del_levels.rst b/docs/nodes/list_main/list_del_levels.rst deleted file mode 100644 index 54fd57328..000000000 --- a/docs/nodes/list_main/list_del_levels.rst +++ /dev/null @@ -1,55 +0,0 @@ -List Delete Levels -================== - -Functionality -------------- - -This helps flatten lists, or make them less nested. - -The analogy to keep in mind might be: - -.. pull-quote:: - knocking through walls in a house to join two spaces, or knock non load bearing walls between buildings to join them. - -Incoming nested lists can be made less nested. - -.. code-block:: python - - # del level 0, remove outer wrapping - - [[0,1,2,3,4]] - >>> [0,1,2,3,4] - - [[4, 5, 6], [4, 7, 10], [4, 9, 14]] - >>> [4, 5, 6, 4, 7, 10, 4, 9, 14] - - [[5], [5], [5], [5], [5], [5]] - >>> [5, 5, 5, 5, 5, 5] - - -Throughput ----------- - -====== ================================================= -Socket Description -====== ================================================= -Input Any meaningful input, lists, nested lists -Output Modified according to Levels parameter, or None -====== ================================================= - - -Parameters ----------- - -Levels, this text field - - -Examples --------- - -.. image:: https://cloud.githubusercontent.com/assets/619340/4198552/851ac6f4-37fa-11e4-9c8e-4715ded8c717.PNG - :alt: delete_levels_demo1 - - -Notes ------ \ No newline at end of file diff --git a/docs/nodes/list_main/list_join.rst b/docs/nodes/list_main/list_join.rst deleted file mode 100644 index e1a32aac2..000000000 --- a/docs/nodes/list_main/list_join.rst +++ /dev/null @@ -1,46 +0,0 @@ -List Join -========= - -Functionality -------------- - -level 1: -[ [ (1,2,3), (4,5,6) ] ] + [ [ (7,8,9), (10,11,12) ] ] = [ [ (1,2,3), (4,5,6), (7,8,9), (10,11,12) ] ] - -level 2 mix: -[ [ (1,2,3), (4,5,6) ] ] + [ [ (7,8,9), (10,11,12) ] ] = [ [ (1,2,3),(7,8,9),(4,5,6),(10,11,12) ] ] - -level 2 wrap: -[ [ (1,2,3), (4,5,6) ] ] + [ [ (7,8,9), (10,11,12) ] ] = [ [ [ (1,2,3),(4,5,6) ], [ (7,8,9),(10,11,12) ] ] ] - -level 2 mix + wrap: -[ [ (1,2,3), (4,5,6) ] ] + [ [ (7,8,9), (10,11,12) ] ] = [ [ [ (1,2,3),(7,8,9) ], [ (4,5,6),(10,11,12) ] ] ] - -level 3: -[ [ (1,2,3), (4,5,6) ] ] + [ [ (7,8,9), (10,11,12) ] ] = [ [ [1,2,3,4,5,6,7,8,9,10,11,12] ] ] - -level 3 mix: -[ [ (1,2,3), (4,5,6) ] ] + [ [ (7,8,9), (10,11,12) ] ] = [ [ [1,7,2,8,3,9,4,10,5,11,6,12] ] ] - -level 3 wrap: -[ [ (1,2,3), (4,5,6) ] ] + [ [ (7,8,9), (10,11,12) ] ] = [ [ [1,2,3,4,5,6],[7,8,9,10,11,12] ] ] - -level 3 mix + wrap: -[ [ (1,2,3), (4,5,6) ] ] + [ [ (7,8,9), (10,11,12) ] ] = [ [ [1,7],[2,8],[3,9],[4,10],[5,11],[6,12] ] ] - -Inputs ------- - -**data** multisocket - -Parameters ----------- - -**mix** to mix (not zip) data inside -**wrap** to wrap additional level -**levels** level of joining - -Outputs -------- - -**data** adaptable socket diff --git a/docs/nodes/list_main/list_length.rst b/docs/nodes/list_main/list_length.rst deleted file mode 100644 index ef145ebea..000000000 --- a/docs/nodes/list_main/list_length.rst +++ /dev/null @@ -1,34 +0,0 @@ -List Length -=========== - -Functionality -------------- - -The Node equivalent of the Python ``len()`` function. The length is inspected at the Level needed. - -Inputs ------- - -Takes any kind of data. - -Parameters ----------- - -**Level:** Set the level at which to observe the List. - -Outputs -------- - -Depends on incoming data and can be nested. Level 0 is top level (totally zoomed out), higher levels get more granular (zooming in) until no higher level is found (atomic). The length of the most atomic level will be 1, for instance single ints or float or characters. The output will reflect the nestedness of the incoming data. - - -Examples --------- - -Often a few experiments with input hooked-up to a debug node will make the exact working of this Node instantly clearer than any explanation. - -.. image:: https://cloud.githubusercontent.com/assets/619340/4186453/1a375026-3761-11e4-8e41-11b57736be1a.PNG - :alt: ListLengthDemo1.PNG - -.. image:: https://cloud.githubusercontent.com/assets/619340/4186454/1a3de7b0-3761-11e4-9520-79b331ad6822.PNG - :alt: ListLengthDemo2.PNG \ No newline at end of file diff --git a/docs/nodes/list_main/list_mask_in.rst b/docs/nodes/list_main/list_mask_in.rst deleted file mode 100644 index e5181865f..000000000 --- a/docs/nodes/list_main/list_mask_in.rst +++ /dev/null @@ -1,48 +0,0 @@ -List Mask In -============ - -Functionality -------------- - -This node use the mask list i.e. 1,0,0,0 as switch to mix two data list together. - -**0** means false, an item from the **Data False** will be appended to the output data; - -**1** will be considered as true (actually any value that evaluate as true in python), an item from the **Data True** will be appended to the output data. If the mask list is not long enough to cover all the inputs, it will be repeated as the mask for the rest of inputs. - -Length of mask list affect output because every item (without Choice activated) corresponding to Inputs several times. - -The main design reason behind this node is to be able to conditionally apply operations to one a masked list, for example select vertices based on location and move them or as shown below, select numbers and negate them. - -Inputs ------- - -**Mask:** Input socket for mask list. - -**Data True:** Input socket for True Data list. - -**Data False:** Input socket for False Data list. - - - -Parameters ----------- - -**Level:** Set the level at which the items to be masked. - -**Choise:** Make length of out list the same as length of input list - - -Outputs -------- - -**Data:** Mixed data of the incoming data, the length of Outputs depends on the **Data True** and **Data False** list length. - -Example -------- - -.. image:: https://cloud.githubusercontent.com/assets/5409756/11457323/e7af5960-96e0-11e5-86e0-a9401f5e059e.png - :alt: ListMaskDemo.PNG - -.. image:: https://cloud.githubusercontent.com/assets/6241382/11584560/2604eebe-9a65-11e5-9aff-8eb123167a6a.png - :alt: Masked apply diff --git a/docs/nodes/list_main/list_mask_out.rst b/docs/nodes/list_main/list_mask_out.rst deleted file mode 100644 index 3ff71b4e1..000000000 --- a/docs/nodes/list_main/list_mask_out.rst +++ /dev/null @@ -1,2 +0,0 @@ -List Mask Out -============= \ No newline at end of file diff --git a/docs/nodes/list_main/list_match.rst b/docs/nodes/list_main/list_match.rst deleted file mode 100644 index 8d0f245bf..000000000 --- a/docs/nodes/list_main/list_match.rst +++ /dev/null @@ -1,2 +0,0 @@ -List Match -========== \ No newline at end of file diff --git a/docs/nodes/list_main/list_math.rst b/docs/nodes/list_main/list_math.rst deleted file mode 100644 index 985d1f2c3..000000000 --- a/docs/nodes/list_main/list_math.rst +++ /dev/null @@ -1,41 +0,0 @@ -List Math -========= - -Functionality -------------- - -This nodes offers some operations to make over list, meaning a group of numbers. - -Inputs ------- - -It will operate only with list of single numbers, not tuples or vectors. - -Parameters ----------- - -**Level:** Set the level at which to observe the List. -**Function:** Select the type of operation. - -=================== ====================================== -Tables description -=================== ====================================== -Sum sum of all the elements of the list -Average average of element at selected level -Maximum Maximum value of the list -Minimum Minimum value of the list - -Outputs -------- - -The output is always going to be a number, integer or float, depending on the input list. - -* You can try to use this node with vectors, but it isn't going to work properly. For operations with vectors you should use **Vector Math** node. - -Examples --------- - -.. image:: https://cloud.githubusercontent.com/assets/5990821/4191546/dd4edc6e-378e-11e4-8015-8f66ec59b68e.png - :alt: ListMathDemo1.PNG - -In this example the node shows all the possible outputs. \ No newline at end of file diff --git a/docs/nodes/list_main/list_modifier.rst b/docs/nodes/list_main/list_modifier.rst deleted file mode 100644 index cf9018bd9..000000000 --- a/docs/nodes/list_main/list_modifier.rst +++ /dev/null @@ -1,101 +0,0 @@ -List Modifier -============= - -This node offers an assortment of list modification functions. The node has both Unary and Binary modes. - -- In Unary mode it will use the input of either sockets, it will use data1 first, then check data2 -- If both are linked data1 is used. -- The node will draw the name of the current mode into the node header, useful for minimized nodes. - -Behaviour ---------- - -+----------------------+----------+--------------------------------------------------------------------------+ -| Modes | inputs | Behaviour Description | -+======================+==========+==========================================================================+ -| Set | unary | turns the valid input into a set :: | -| | | | -| | | input = [0,0,0,1,1,1,3,3,3,5,5,5,6,7,8,4,4,4,6,6,6,7,7,7,8] | -| | | output = [set(input)] | -| | | | -+----------------------+----------+--------------------------------------------------------------------------+ -| Ordered Set by input | unary | only unique numbers but ordered by the original input sequence :: | -| | | | -| | | input = [0,0,0,1,1,1,3,3,3,5,5,5,6,7,8,4,4,4,6,6,6,7,7,7,8] | -| | | output = [0,1,3,5,6,7,8,4] | -| | | | -+----------------------+----------+--------------------------------------------------------------------------+ -| Unique Consecutives | unary | no consecutive repeats :: | -| | | | -| | | input = [0,0,0,1,1,1,3,3,3,5,5,5,6,7,8,4,4,4,6,6,6,7,7,7,8] | -| | | output = [0,1,3,5,6,7,8,4,6,7,8] | -| | | | -+----------------------+----------+--------------------------------------------------------------------------+ -| Sequential Set | unary | unique input values, ordered by their value :: | -| | | | -| | | input = [0,0,0,1,1,1,3,3,3,5,5,5,6,7,8,4,4,4,6,6,6,7,7,7,8] | -| | | output = [0,1,3,4,5,6,7,8] | -| | | | -+----------------------+----------+--------------------------------------------------------------------------+ -| Sequential Set Rev | unary | unique input values, ordered by their value, reversed :: | -| | | | -| | | input = [0,0,0,1,1,1,3,3,3,5,5,5,6,7,8,4,4,4,6,6,6,7,7,7,8] | -| | | output = [8,7,6,5,4,3,1,0] | -| | | | -+----------------------+----------+--------------------------------------------------------------------------+ -| Normalize | unary | scales down the values in the list to the range ``-1.0 .. 1.0`` | -+----------------------+----------+--------------------------------------------------------------------------+ -| Accumulating Sum | unary | see ``itertools.accumulate`` :: | -| | | | -| | | input = list(accumulate(range(10))) | -| | | output = [0,1,3,6,10,15,21,28,36,45] | -| | | | -+----------------------+----------+--------------------------------------------------------------------------+ -| Mask Subset | binary | generates a mask to indicate for each value in A whether it appears in B | -| | | :: | -| | | | -| | | A = [0,1,2,3,4,5,6,7] | -| | | B = [2,3,4,5] | -| | | output = [False, False, True, True, True, True, False, False] | -| | | | -+----------------------+----------+--------------------------------------------------------------------------+ -| Intersection | binary | returns the set of items that appear in both A and B | -| | | | -| | | |image1| | -| | | | -+----------------------+----------+--------------------------------------------------------------------------+ -| Union | binary | returns the set of items A joined with B | -| | | | -| | | |image2| | -| | | | -+----------------------+----------+--------------------------------------------------------------------------+ -| Difference | binary | returns the set of items from A that don’t appear in B | -| | | | -| | | |image3| | -| | | | -+----------------------+----------+--------------------------------------------------------------------------+ -| Symmetric Diff | binary | returns the set of elements of A and B that don’t appear in Both | -| | | | -| | | |image4| | -| | | | -+----------------------+----------+--------------------------------------------------------------------------+ - -*output as list* - -The boolean switch to *output as list* will be on by default, -essentially it will wrap the output as a list because true sets don’t -have a defined order (which we do need most of the time). - -Example -------- - -See the pullrequest for details : https://github.com/nortikin/sverchok/pull/884 - -also see the original thread : https://github.com/nortikin/sverchok/issues/865 - - - -.. |image1| image:: https://cloud.githubusercontent.com/assets/619340/18662881/733c219c-7f1c-11e6-85fc-fcfc1ea7768d.png -.. |image2| image:: https://cloud.githubusercontent.com/assets/619340/18662921/a24aac7e-7f1c-11e6-80c1-684e513607a2.png -.. |image3| image:: https://cloud.githubusercontent.com/assets/619340/18663232/ec821d80-7f1d-11e6-83bc-3fd64ff037b4.png -.. |image4| image:: https://cloud.githubusercontent.com/assets/619340/18662983/f252aeba-7f1c-11e6-963b-e2b7d7111e17.png \ No newline at end of file diff --git a/docs/nodes/list_main/list_sum.rst b/docs/nodes/list_main/list_sum.rst deleted file mode 100644 index 56b02f3a2..000000000 --- a/docs/nodes/list_main/list_sum.rst +++ /dev/null @@ -1,24 +0,0 @@ -List Summa -========== - -Functionality -------------- - -This node operates the sum of all the values in the inputs, no matter the levels or sublist inside the input. - -Inputs ------- - -Takes any kind of data: singles values, vectors or even matrixes. - -Outputs -------- - -No matter the type of input, the output will be the sum of all the values in the input list. -This node works in a different way of the "Sum" function in **List Math** node. See the example below to see the difference. - -Examples --------- - -.. image:: https://cloud.githubusercontent.com/assets/5990821/4200340/20740696-3810-11e4-8e2d-8397e801b644.png - :alt: ListSummaDemo1.PNG \ No newline at end of file diff --git a/docs/nodes/list_main/list_zip.rst b/docs/nodes/list_main/list_zip.rst deleted file mode 100644 index 7b3bccdc3..000000000 --- a/docs/nodes/list_main/list_zip.rst +++ /dev/null @@ -1,35 +0,0 @@ -List Zip -======== - -Functionality -------------- - -Making pares of data to mix togather as zip function. - -x = [[[1,2],[3,4]]] -y = [[[5,6],[7,8]]] - - -out level 1 = [[[[1, 2], [5, 6]], [[3, 4], [7, 8]]]] -out level 1 unwrap = [[[1, 2], [5, 6]], [[3, 4], [7, 8]]] -out level 2 = [[[[1, 3], [2, 4]], [[5, 7], [6, 8]]]] -out level 2 unwrap = [[[1, 3], [2, 4]], [[5, 7], [6, 8]]] -out level 3 = [[[[], []], [[], []]]] - -Inputs ------- - -**data** multysocket - -Properties ----------- - -**level** integer to operate level of conjunction -**unwrap** boolean to unwrap from additional level, added when zipped - -Outputs -------- - -**data** adaptable socket - - diff --git a/docs/nodes/list_struct/list_first_last.rst b/docs/nodes/list_struct/list_first_last.rst deleted file mode 100644 index 1379f9ecd..000000000 --- a/docs/nodes/list_struct/list_first_last.rst +++ /dev/null @@ -1,30 +0,0 @@ -List First & Last -================= - -Functionality -------------- - -First and last items of data on some level - -Inputs ------- - -**Data** - data to take items - -Properties ----------- - -**level** - leve to take first and last items - -Outputs -------- - -**Middl** - all between first and last items -**First** - First item -**Last** - Last item - -Examples --------- - -.. image:: https://cloud.githubusercontent.com/assets/5783432/5603173/c487d550-9387-11e4-8b3e-f45c2250048b.jpg - :alt: First-Last \ No newline at end of file diff --git a/docs/nodes/list_struct/list_flip.rst b/docs/nodes/list_struct/list_flip.rst deleted file mode 100644 index 905fb28ee..000000000 --- a/docs/nodes/list_struct/list_flip.rst +++ /dev/null @@ -1,37 +0,0 @@ -List Flip -========= - -Functionality -------------- - -Flips the data on selected level. -[[[1,2,3],[4,5,6],[7,8,9]],[[3,3,3],[1,1,1],[8,8,8]]] (two objects, three vertices) -with level 2 turns to: -[[[1, 2, 3], [3, 3, 3]], [[4, 5, 6], [1, 1, 1]], [[7, 8, 9], [8, 8, 8]]] (three objects, two vertices) -with level 3 turns to: -[[1, 4, 7], [2, 5, 8], [3, 6, 9], [3, 1, 8], [3, 1, 8], [3, 1, 8]] (six objects with three digits) - -last example is not straight result, more as deviation. -Ideally Flip has to work with preserving data levels and with respect to other levels structure. -But for now working level is 2 - -Inputs ------- - -**data** - data to flip - -Properties ----------- - -**level** - level to deal with - -Outputs -------- - -**data** - flipped data - -Examples --------- - -.. image:: https://cloud.githubusercontent.com/assets/5783432/5603155/cd1cc280-9386-11e4-9998-a066258ca94b.jpg - :alt: flip \ No newline at end of file diff --git a/docs/nodes/list_struct/list_item.rst b/docs/nodes/list_struct/list_item.rst deleted file mode 100644 index 6462c186a..000000000 --- a/docs/nodes/list_struct/list_item.rst +++ /dev/null @@ -1,41 +0,0 @@ -List Item -========= - -Functionality -------------- - -Select items from list based on index. The node is *data type agnostic*, meaning it makes no assumptions about the data you feed it. It shoudld accepts any type of data native to Sverchok.. - -Inputs ------- - -+--------+--------------------------------------------------------------------------+ -| Input | Description | -+========+==========================================================================+ -| Data | The data - can be anything | -+--------+--------------------------------------------------------------------------+ -| item | Item(s) to select, allows negative index python index | -+--------+--------------------------------------------------------------------------+ - -Parameters ----------- - - -**Level** - -It is essentially how many chained element look-ups you do on a list. If ``SomeList`` has a considerable *nestedness* then you might access the most atomic element of the list doing ``SomeList[0][0][0][0]``. Levels in this case would be 4. - -**item** - -A list of items to select, allow negative index python indexing so that -1 the last element. The items doesn't have to be in order and a single item can be selected more than a single time. - -Outputs -------- - -Item, the selected items on the specifed level. -Other, the list with the selected items deleted. - -Examples --------- - -Trying various inputs, adjusting the parameters, and piping the output to a *Debug Print* (or stethoscope) node will be the fastest way to acquaint yourself with the inner workings of the *List Item* Node. diff --git a/docs/nodes/list_struct/list_repeater.rst b/docs/nodes/list_struct/list_repeater.rst deleted file mode 100644 index 3e1abca9d..000000000 --- a/docs/nodes/list_struct/list_repeater.rst +++ /dev/null @@ -1,47 +0,0 @@ -List Repeater -============= - -Functionality -------------- - -Allows explicit repeat of lists and elements. The node is *data type agnostic*, meaning it makes no assumptions about the data you feed it. It shoudld accepts any type of data native to Sverchok.. - -Inputs ------- - -+--------+--------------------------------------------------------------------------+ -| Input | Description | -+========+==========================================================================+ -| Data | The data - can be anything | -+--------+--------------------------------------------------------------------------+ -| Number | The amount of times to repeat elements selected by the `Level` parameter | -+--------+--------------------------------------------------------------------------+ - -Parameters ----------- - -Level and unwrap. - -**Level** - -It is essentially how many chained element look-ups you do on a list. If ``SomeList`` has a considerable *nestedness* then you might access the most atomic element of the list doing ``SomeList[0][0][0][0]``. Levels in this case would be 4. - -**unwrap** - -Removes any extra layers of wrapping (brackets or parentheses) found at the current Level. If the element pointed at is ``[[0,2,3,2]]`` it will become ``[0,2,3,2]``. - - -Outputs -------- - -Lists (nested). The type of *Data out* will be appropriate for the operations defined by the parameters of the Node. - -Examples --------- - -Trying various inputs, adjusting the parameters, and piping the output to a *Debug Print* (or stethoscope) node will be the fastest way to acquaint yourself with the inner workings of the *List Repeater* Node. - -A practical reason to use the node is when you need a series of copies of edge or polygon lists. Usually in conjunction with `Matrix Apply`, which outputs a series of `vertex lists` as a result of transform parameters. - -.. image:: https://cloud.githubusercontent.com/assets/619340/4186432/efb79892-3760-11e4-9d17-5c7a7a22d9d9.PNG - :alt: ListRepeater_Demo1.PNG \ No newline at end of file diff --git a/docs/nodes/list_struct/list_shift.rst b/docs/nodes/list_struct/list_shift.rst deleted file mode 100644 index 468e06806..000000000 --- a/docs/nodes/list_struct/list_shift.rst +++ /dev/null @@ -1,35 +0,0 @@ -List Shift -========== - -Functionality -------------- - -Shifting data in selected level on selected integer value as: - - [0,1,2,3,4,5,6,7,8,9] with shift integer 4 will be - [4,5,6,7,8,9] - But with enclose flag: - [4,5,6,7,8,9,0,1,2,3] - -Inputs ------- - -**data** - list of data any type to shift -**Shift** - value that defines shift - -Properties ----------- - -**level** - manipulation level, 0 - is objects shifting -**enclose** - close data when shifting, that way ending cutted numbers turns to beginning - -Outputs -------- - -**data** - shifter data, adaptive socket - -Examples --------- - -.. image:: https://cloud.githubusercontent.com/assets/5783432/5603102/bec2bc6e-9384-11e4-9e4a-905da01b7ac1.gif - :alt: shift \ No newline at end of file diff --git a/docs/nodes/list_struct/list_shuffle.rst b/docs/nodes/list_struct/list_shuffle.rst deleted file mode 100644 index 41dcf11bb..000000000 --- a/docs/nodes/list_struct/list_shuffle.rst +++ /dev/null @@ -1,45 +0,0 @@ -List Shuffle -============ - -Functionality -------------- - -Shuffle (randomize) the order of input lists. - -Inputs ------- - -+--------+--------------------------------------------------------------------------+ -| Input | Description | -+========+==========================================================================+ -| Data | The data - can be anything | -+--------+--------------------------------------------------------------------------+ -| Seed | Seed setting used by shuffle operation | -+--------+--------------------------------------------------------------------------+ - -Parameters ----------- - - -**Level** - -It is essentially how many chained element look-ups you do on a list. If ``SomeList`` has a considerable *nestedness* then you might access the most atomic element of the list doing ``SomeList[0][0][0][0]``. Levels in this case would be 4. - -**Seed** - -Affects the output order. - - -Outputs -------- - -Item, the selected items on the specified level. -Other, the list with the selected items deleted. - -Examples --------- - - -The shuffle operation is based on the python random.shuffle. https://docs.python.org/3.4/library/random.html?highlight=shuffle#random.shuffle - -Trying various inputs, adjusting the parameters, and piping the output to a *Debug Print* (or stethoscope) node will be the fastest way to acquaint yourself with the inner workings of the *List Shuffle* Node. diff --git a/docs/nodes/list_struct/list_slice.rst b/docs/nodes/list_struct/list_slice.rst deleted file mode 100644 index 651ec4305..000000000 --- a/docs/nodes/list_struct/list_slice.rst +++ /dev/null @@ -1,64 +0,0 @@ -List Slice -========== -Functionality -------------- - -Select a slice from a list. The node is *data type agnostic*, meaning it makes no assumptions about the data you feed it. It shoudld accepts any type of data native to Sverchok.. -Functionality is a subset of python list slicing, the stride parameter functionality isn't implemented. - -Inputs ------- - -+--------+--------------------------------------------------------------------------+ -| Input | Description | -+========+==========================================================================+ -| Data | The data - can be anything | -+--------+--------------------------------------------------------------------------+ -| Start | Slice start, allows negative python index | -+--------+--------------------------------------------------------------------------+ -| Stop | Slice stop, allows negative python index | -+--------+--------------------------------------------------------------------------+ - -Parameters ----------- - -**Level** - -It is essentially how many chained element look-ups you do on a list. If ``SomeList`` has a considerable *nestedness* then you might access the most atomic element of the list doing ``SomeList[0][0][0][0]``. Levels in this case would be 4. - -**Start** - -Start point for the slice - -**Stop** - -Stop point for the slice. - -Outputs -------- - -Slice, the selected slices. -Other, the list with the slices removed. - -Examples --------- - -Trying various inputs, adjusting the parameters, and piping the output to a *Debug Print* (or stethoscope) node will be the fastest way to acquaint yourself with the inner workings of the *List Item* Node. - -Some slice examples. ->>> l -[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] ->>> l[1:-1] -[1, 2, 3, 4, 5, 6, 7, 8] ->>> l[0:2] -[0, 1] ->>> l[-1:2] -[] - -.. image:: https://cloud.githubusercontent.com/assets/5783432/5229789/771e02b8-7725-11e4-8970-ac33c87f55ec.png - :alt: slice multiple objects from one list (may be many objects also) - -Notes ------ - - diff --git a/docs/nodes/list_struct/list_sort.rst b/docs/nodes/list_struct/list_sort.rst deleted file mode 100644 index 2a5f003da..000000000 --- a/docs/nodes/list_struct/list_sort.rst +++ /dev/null @@ -1,31 +0,0 @@ -List Sort -========= - -Functionality -------------- - -Sort items from list based on index. It should accept any type of data from Sverchok: Vertices, Strings (Edges, Polygons) or Matrix. - -Inputs ------- - -Takes any kind of data. - -Parameters ----------- - - -**Level:** Set the level at which to observe the List. - -Outputs -------- - -Depends on incoming data and can be nested. Level 0 is top level (totally zoomed out), higher levels get more granular (zooming in) until no higher level is found (atomic). The node will just reverse the data at the level selected. - -Examples --------- - -.. image:: https://cloud.githubusercontent.com/assets/5990821/4190847/0979eeba-3789-11e4-9e51-7ca4c532c418.png - :alt: ListSortDemo1.PNG - -In this example the node sort a list a integers previously shuffled. \ No newline at end of file diff --git a/docs/nodes/list_struct/list_split.rst b/docs/nodes/list_struct/list_split.rst deleted file mode 100644 index c4665bfcb..000000000 --- a/docs/nodes/list_struct/list_split.rst +++ /dev/null @@ -1,53 +0,0 @@ -List Split -========== -Functionality -------------- - -Split list into chuncks. The node is *data type agnostic*, meaning it makes no assumptions about the data you feed it. It shoudld accepts any type of data native to Sverchok. - -Inputs ------- - -+--------------+---------------------------------------------------+ -| Input | Description | -+==============+===================================================+ -| Data | The data - can be anything | -+--------------+---------------------------------------------------+ -| Split size | Size of individual chuncks | -+--------------+---------------------------------------------------+ - -Parameters ----------- - - -**Level** - -It is essentially how many chained element look-ups you do on a list. If ``SomeList`` has a considerable *nestedness* then you might access the most atomic element of the list doing ``SomeList[0][0][0][0]``. Levels in this case would be 4. - -**unwrap** - -Unrwap the list if possible, this generally what you want. -[[1, 2, 3, 4]] size 2. -+--------+-------------------+ -| Unwrap | Result | -+========+===================+ -| On | [[1, 2], [3, 4]] | -+--------+-------------------+ -| Off | [[[1, 2], [3, 4]]]| -+--------+-------------------+ - -**Split size** - -Size of output chuncks. - -Outputs -------- - -**Split** - -The list split on the selected level into chuncks, the last chunck will be what is left over. - -Examples --------- - -Trying various inputs, adjusting the parameters, and piping the output to a *Debug Print* (or stethoscope) node will be the fastest way to acquaint yourself with the inner workings of the *List Item* Node. diff --git a/docs/nodes/modifier_change/fill_holes.rst b/docs/nodes/modifier_change/fill_holes.rst deleted file mode 100644 index 0daa5a987..000000000 --- a/docs/nodes/modifier_change/fill_holes.rst +++ /dev/null @@ -1,36 +0,0 @@ -Fill Holes -========== - -Functionality -------------- - -It fills closed countors from edges that own minimum vertices-sides with polygons. - -Inputs ------- - -- **Vertices** -- **Edges** - -Parameters ----------- - -+-----------------+---------------+-------------+-------------------------------------------------------------+ -| Param | Type | Default | Description | -+=================+===============+=============+=============================================================+ -| **Sides** | Float | 4 | Number of sides that will be collapsed to polygon. | -+-----------------+---------------+-------------+-------------------------------------------------------------+ - -Outputs -------- - -- **Vertices** -- **Edges** -- **Polygons**. All faces of resulting mesh. - -Examples of usage ------------------ - -Fill holes of formula shape, edges of initial shape + voronoi grid + fill holes - -.. image:: https://cloud.githubusercontent.com/assets/5783432/18611146/24f2afaa-7d42-11e6-9822-5637a752a1b6.png diff --git a/docs/nodes/modifier_change/intersect_edges.rst b/docs/nodes/modifier_change/intersect_edges.rst deleted file mode 100644 index 787cd97ec..000000000 --- a/docs/nodes/modifier_change/intersect_edges.rst +++ /dev/null @@ -1,42 +0,0 @@ -Intersect Edges -=============== - -Functionality -------------- - -The code is straight out of TinyCAD plugin's XALL operator, which is part of Blender Contrib distributions. - -It operates on Edge based geometry only and will create new vertices on all intersections of the given geometry. -This node goes through a recursive process (divide and conquer) and its speed is directly proportional to the -number of intersecting edges passed into it. The algorithm is not optimized for large edges counts, but tends -to work well in most cases. - -**implementation note** - -An Edge that touches the vertex of another edge is not considered an `Intersection` in the current implementation. -*Touching* might be included as an intersection type in the future via an extra toggle in the Properties Panel. - -Inputs ------- - -Verts and Edges only. Warning: Does not support faces, or Vectorized (nested lists) input - - -Parameters ----------- - -Currently no parameters, but in the future could include a tolerance parameter and a setting to consider Touching Verts-to-Edge as an Intersection. - - -Outputs -------- - -Vertices and Edges, the mesh does not preserve any old vertex or edge index ordering due to the Hashing algorithm used for fast intersection lookups. - - -Examples --------- - -.. image:: https://cloud.githubusercontent.com/assets/619340/2811581/16032c72-ce26-11e3-9055-925d2cd03719.png - -See the progress of how this node came to life `here `_ (gifs, screenshots) \ No newline at end of file diff --git a/docs/nodes/modifier_change/mask_vertices.rst b/docs/nodes/modifier_change/mask_vertices.rst deleted file mode 100644 index f17bfc69c..000000000 --- a/docs/nodes/modifier_change/mask_vertices.rst +++ /dev/null @@ -1,36 +0,0 @@ -Mask Vertices -============= - -Functionality -------------- - -Filter vertices with False/True bool values and automatically removes not connected edges and polygons. - -Inputs ------- - -- **Mask** -- **Vertices** -- **Poly Edge** - -Parameters ----------- - -+-----------+------------------+-----------+----------------------------------------------------------------+ -| Param | Type | Default | Description | -+===========+==================+===========+================================================================+ -| Mask | list of booleans | [1,0] | Mask can be defined with ListInput node or Formula node | -| | | | or other as list [n,n1,n2...ni] where n's can be 0 or 1 | -| | | | (False or True) | -+-----------+------------------+-----------+----------------------------------------------------------------+ - -Outputs -------- - -- **Vertices** -- **Poly Edge** - -Examples of usage ------------------ - -.. image:: https://cloud.githubusercontent.com/assets/5783432/18615011/cc68a924-7dab-11e6-82f0-6f72bfde7ba7.png diff --git a/docs/nodes/modifier_change/polygon_boom.rst b/docs/nodes/modifier_change/polygon_boom.rst deleted file mode 100644 index 6284ae759..000000000 --- a/docs/nodes/modifier_change/polygon_boom.rst +++ /dev/null @@ -1,20 +0,0 @@ -Polygon Boom -============ - -Functionality -------------- - -The vertices of each polygon will be placed into separate lists. If polygons share vertices then the coordinates are duplicates into new vertices. The end result will be a nested list of polygons with each their own unique vertices. This facilitates rotation of a polygon around an arbitrary points without affecting the vertices of other polygons in the list. - -Inputs & Outputs ----------------- - -Lists of Vertices and Edge/Polygon lists. The type of data in the *edg_pol* output socket content depends on the what kind of input is passed to *edge_pol* input socket. If you input edges only, that's what the output will be. - -Examples --------- - -The Box on default settings is a Cube with 6 polygons and each vertex is shared by three polygons. Polygon Boom separates the polygons into seperate coordinate lists (vertices). - -.. image:: https://cloud.githubusercontent.com/assets/619340/4186234/1ef77fb6-375f-11e4-8e45-4ce14df9fd94.PNG - :alt: PolygonBoomDemo1.PNG \ No newline at end of file diff --git a/docs/nodes/modifier_change/separate_loose_parts.rst b/docs/nodes/modifier_change/separate_loose_parts.rst deleted file mode 100644 index 1547317d7..000000000 --- a/docs/nodes/modifier_change/separate_loose_parts.rst +++ /dev/null @@ -1,34 +0,0 @@ -Separate Loose Parts -==================== - -Functionality -------------- - -Split a mesh into unconnected parts in a pure topological operation. - -Input & Output --------------- - -+--------+-----------+-------------------------------------------+ -| socket | name | Description | -+========+===========+===========================================+ -| input | Vertices | Inputs vertices | -+--------+-----------+-------------------------------------------+ -| input | Poly Edge | Polygon or Edge data | -+--------+-----------+-------------------------------------------+ -| output | Vertices | Vertices for each mesh part | -+--------+-----------+-------------------------------------------+ -| output | Poly Edge | Corresponding mesh data | -+--------+-----------+-------------------------------------------+ - -Examples --------- - -.. image:: https://cloud.githubusercontent.com/assets/619340/4186249/46e799f2-375f-11e4-8fab-4bf1776b244a.png - :alt: separate-looseDemo1.png - -Notes -------- - -Note that it doesn't take double vertices into account. -There is no guarantee about the order of the outputs diff --git a/docs/nodes/modifier_make/adaptative_edges.rst b/docs/nodes/modifier_make/adaptative_edges.rst deleted file mode 100644 index 6cfe018ef..000000000 --- a/docs/nodes/modifier_make/adaptative_edges.rst +++ /dev/null @@ -1,2 +0,0 @@ -Adaptative Edges -================ \ No newline at end of file diff --git a/docs/nodes/modifier_make/adaptative_polygons.rst b/docs/nodes/modifier_make/adaptative_polygons.rst deleted file mode 100644 index 171eac793..000000000 --- a/docs/nodes/modifier_make/adaptative_polygons.rst +++ /dev/null @@ -1,35 +0,0 @@ -Adaptative Polygons -=================== - -Functionality -------------- - -Share one object to other. Donor spreading himself to recipient polygons. every polygon recieve one object and deform as normals say to him. - -Inputs ------- - -**VersR** and **PolsR** is Recipient object's data. **VersD** and **PolsD** is donor's object data. **Z_Coef** is coefficient of height, can be vectorized. - -Parameters ----------- - -table - -+------------------+---------------+-------------------------------------------------------------------+ -| Param | Type | Description | -+==================+===============+===================================================================+ -| **Donor width** | Float | Width of spreaded donors is part from recipient's polygon's width | -+------------------+---------------+-------------------------------------------------------------------+ - -Outputs -------- - -**Vertices** and **Polygons** are data for created object. - -Example of usage ----------------- - -.. image:: https://cloud.githubusercontent.com/assets/5783432/4222738/25e20e00-3916-11e4-9aca-5127f2edaa95.jpg - :alt: Adaptive_Polygons.jpg - diff --git a/docs/nodes/modifier_make/uv_connection.rst b/docs/nodes/modifier_make/uv_connection.rst deleted file mode 100644 index 5d67671cb..000000000 --- a/docs/nodes/modifier_make/uv_connection.rst +++ /dev/null @@ -1,41 +0,0 @@ -UV Connection -============= - -Functionality -------------- - -Making edges/polygons between vertices objects it several ways. - -Inputs ------- - -Vertices. Multysockets can eat many objects. every object to be connecting with other. - -Parameters ----------- - -table - -+---------------+---------------+-----------------------------------------------------------------+ -| Param | Type | Description | -+===============+===============+=================================================================+ -| **UVdir** | Enum | Direction to connect edges and polygons | -+---------------+---------------+-----------------------------------------------------------------+ -| **cicled** | Bool, toggle | For edges and polygons close loop | -+---------------+---------------+-----------------------------------------------------------------+ -| **polygons** | Bool, toggle | Active - make polygon, else edge | -+---------------+---------------+-----------------------------------------------------------------+ -| **slice** | Bool, toggle | Polygons can be as slices or quads | -+---------------+---------------+-----------------------------------------------------------------+ - -Outputs -------- - -**Vertices** and **Edges/Polygons**. Verts and Polys will be generated. The Operator doesn't consider the ordering of the Vertex and Face indices that it outputs. This might make additional processing complicated, use IndexViewer to better understand the generated geometry. Faces will however have consistent Normals. - -Example of usage ----------------- - -.. image:: https://cloud.githubusercontent.com/assets/5783432/4199915/97853346-380a-11e4-9968-3661e95bf80c.png - :alt: ConnectingUV.PNG - diff --git a/docs/nodes/modifier_make/voronoi.rst b/docs/nodes/modifier_make/voronoi.rst deleted file mode 100644 index bc444e466..000000000 --- a/docs/nodes/modifier_make/voronoi.rst +++ /dev/null @@ -1,2 +0,0 @@ -Voronoi 2D -========== \ No newline at end of file diff --git a/docs/nodes/transforms/matrix_apply.rst b/docs/nodes/transforms/matrix_apply.rst deleted file mode 100644 index 5cbba6e0f..000000000 --- a/docs/nodes/transforms/matrix_apply.rst +++ /dev/null @@ -1,41 +0,0 @@ -Matrix Apply -============ - -Functionality -------------- - -Applies a Transform Matrix to a list or nested lists of vectors (and therefore vertices) - - -Inputs ------- - -+----------+-----------------------------------------------------------------------------+ -| Inputs | Description | -+==========+=============================================================================+ -| Vectors | Represents vertices or intermediate vectors used for further vector math | -+----------+-----------------------------------------------------------------------------+ -| Matrices | One or more, never empty | -+----------+-----------------------------------------------------------------------------+ - - -Outputs -------- - -Nested list of vectors / vertices, matching the number nested incoming *matrices*. - - -Examples --------- - -.. image:: https://cloud.githubusercontent.com/assets/619340/4186410/a3e00666-3760-11e4-9d67-b32345329e9d.PNG - :alt: MatrixApplyDemo1.PNG - -.. image:: https://cloud.githubusercontent.com/assets/619340/4186411/a3e1c14a-3760-11e4-84fe-2acaf1858ad7.PNG - :alt: MatrixApplyDemo5.PNG - - -Notes -------- - -The ``update`` function is outdated, functionally this is of no relevance to users but we should change it for future compatibility. \ No newline at end of file -- GitLab From cee082f189ec11ce09827ee01d66d32ef670a431 Mon Sep 17 00:00:00 2001 From: zeffii Date: Thu, 29 Sep 2016 16:08:24 +0200 Subject: [PATCH 06/19] further update docs/nodes names 2 --- docs/nodes/analyzers/normal.rst | 41 ++ docs/nodes/analyzers/normals.rst | 40 ++ docs/nodes/analyzers/polygons_centers_mk3.rst | 37 ++ docs/nodes/generators/basic_3pt_arc.rst | 44 ++ docs/nodes/generators/basic_spline.rst | 61 +++ .../nodes/generators_extended/box_rounded.rst | 51 +++ .../generators_extended/generative_art.rst | 336 ++++++++++++++++ docs/nodes/generators_extended/hilbert.rst | 44 ++ docs/nodes/generators_extended/hilbert3d.rst | 44 ++ .../generators_extended/hilbert_image.rst | 48 +++ .../generators_extended/image_components.rst | 66 +++ docs/nodes/generators_extended/profile.rst | 141 +++++++ docs/nodes/generators_extended/script.rst | 378 ++++++++++++++++++ docs/nodes/generators_extended/script3.rst | 293 ++++++++++++++ docs/nodes/generators_extended/script_mk2.rst | 293 ++++++++++++++ .../generators_extended/scripted_intro.rst | 126 ++++++ docs/nodes/list_main/decompose.rst | 39 ++ docs/nodes/list_main/func.rst | 41 ++ docs/nodes/list_main/join.rst | 46 +++ docs/nodes/list_main/length.rst | 34 ++ docs/nodes/list_main/levels.rst | 55 +++ docs/nodes/list_main/match.rst | 2 + docs/nodes/list_main/sum_mk2.rst | 24 ++ docs/nodes/list_main/zip.rst | 35 ++ docs/nodes/list_masks/mask.rst | 2 + docs/nodes/list_masks/mask_join.rst | 48 +++ docs/nodes/list_mutators/modifier.rst | 101 +++++ docs/nodes/list_struct/flip.rst | 37 ++ docs/nodes/list_struct/item.rst | 41 ++ docs/nodes/list_struct/repeater.rst | 47 +++ docs/nodes/list_struct/shift_mk2.rst | 35 ++ docs/nodes/list_struct/shuffle.rst | 45 +++ docs/nodes/list_struct/slice.rst | 64 +++ docs/nodes/list_struct/sort_mk2.rst | 31 ++ docs/nodes/list_struct/split.rst | 53 +++ docs/nodes/list_struct/start_end.rst | 30 ++ .../nodes/modifier_change/edges_intersect.rst | 42 ++ docs/nodes/modifier_change/holes_fill.rst | 36 ++ docs/nodes/modifier_change/mesh_separate.rst | 34 ++ docs/nodes/modifier_change/polygons_boom.rst | 20 + docs/nodes/modifier_change/vertices_mask.rst | 36 ++ docs/nodes/modifier_make/edges_adaptative.rst | 2 + .../modifier_make/polygons_adaptative.rst | 35 ++ docs/nodes/modifier_make/uv_connect.rst | 41 ++ docs/nodes/modifier_make/voronoi_2d.rst | 2 + .../{generators => number}/exponential.rst | 0 .../{generators => number}/fibonacci.rst | 0 .../{float2int.rst => float_to_int.rst} | 0 .../number/{formula.rst => formula2.rst} | 0 docs/nodes/number/{int.rst => integer.rst} | 0 .../number/{map_range.rst => range_map.rst} | 0 docs/nodes/number/{math.rst => scalar.rst} | 0 docs/nodes/transforms/apply.rst | 41 ++ 53 files changed, 3142 insertions(+) create mode 100644 docs/nodes/analyzers/normal.rst create mode 100644 docs/nodes/analyzers/normals.rst create mode 100644 docs/nodes/analyzers/polygons_centers_mk3.rst create mode 100644 docs/nodes/generators/basic_3pt_arc.rst create mode 100644 docs/nodes/generators/basic_spline.rst create mode 100644 docs/nodes/generators_extended/box_rounded.rst create mode 100644 docs/nodes/generators_extended/generative_art.rst create mode 100644 docs/nodes/generators_extended/hilbert.rst create mode 100644 docs/nodes/generators_extended/hilbert3d.rst create mode 100644 docs/nodes/generators_extended/hilbert_image.rst create mode 100644 docs/nodes/generators_extended/image_components.rst create mode 100644 docs/nodes/generators_extended/profile.rst create mode 100644 docs/nodes/generators_extended/script.rst create mode 100644 docs/nodes/generators_extended/script3.rst create mode 100644 docs/nodes/generators_extended/script_mk2.rst create mode 100644 docs/nodes/generators_extended/scripted_intro.rst create mode 100644 docs/nodes/list_main/decompose.rst create mode 100644 docs/nodes/list_main/func.rst create mode 100644 docs/nodes/list_main/join.rst create mode 100644 docs/nodes/list_main/length.rst create mode 100644 docs/nodes/list_main/levels.rst create mode 100644 docs/nodes/list_main/match.rst create mode 100644 docs/nodes/list_main/sum_mk2.rst create mode 100644 docs/nodes/list_main/zip.rst create mode 100644 docs/nodes/list_masks/mask.rst create mode 100644 docs/nodes/list_masks/mask_join.rst create mode 100644 docs/nodes/list_mutators/modifier.rst create mode 100644 docs/nodes/list_struct/flip.rst create mode 100644 docs/nodes/list_struct/item.rst create mode 100644 docs/nodes/list_struct/repeater.rst create mode 100644 docs/nodes/list_struct/shift_mk2.rst create mode 100644 docs/nodes/list_struct/shuffle.rst create mode 100644 docs/nodes/list_struct/slice.rst create mode 100644 docs/nodes/list_struct/sort_mk2.rst create mode 100644 docs/nodes/list_struct/split.rst create mode 100644 docs/nodes/list_struct/start_end.rst create mode 100644 docs/nodes/modifier_change/edges_intersect.rst create mode 100644 docs/nodes/modifier_change/holes_fill.rst create mode 100644 docs/nodes/modifier_change/mesh_separate.rst create mode 100644 docs/nodes/modifier_change/polygons_boom.rst create mode 100644 docs/nodes/modifier_change/vertices_mask.rst create mode 100644 docs/nodes/modifier_make/edges_adaptative.rst create mode 100644 docs/nodes/modifier_make/polygons_adaptative.rst create mode 100644 docs/nodes/modifier_make/uv_connect.rst create mode 100644 docs/nodes/modifier_make/voronoi_2d.rst rename docs/nodes/{generators => number}/exponential.rst (100%) rename docs/nodes/{generators => number}/fibonacci.rst (100%) rename docs/nodes/number/{float2int.rst => float_to_int.rst} (100%) rename docs/nodes/number/{formula.rst => formula2.rst} (100%) rename docs/nodes/number/{int.rst => integer.rst} (100%) rename docs/nodes/number/{map_range.rst => range_map.rst} (100%) rename docs/nodes/number/{math.rst => scalar.rst} (100%) create mode 100644 docs/nodes/transforms/apply.rst diff --git a/docs/nodes/analyzers/normal.rst b/docs/nodes/analyzers/normal.rst new file mode 100644 index 000000000..0db8b2444 --- /dev/null +++ b/docs/nodes/analyzers/normal.rst @@ -0,0 +1,41 @@ +Vertex normal +===== +*Alias - vector normal* + +Functionality +------------- + +Vertex normal node finds normals of vectors + +Inputs +------ + +**Vertices** and **Polygons** are needed. +Both inputs need to be of the kind Vertices and Strings, respectively + +Parameters +---------- + +All parameters need to proceed from an external node. + + ++------------------+---------------+-------------+-----------------------------------------------+ +| Param | Type | Default | Description | ++==================+===============+=============+===============================================+ +| **Vertices** | Vertices | None | vertices of the polygons | ++------------------+---------------+-------------+-----------------------------------------------+ +| **Polygons** | Strings | None | polygons referenced to vertices | ++------------------+---------------+-------------+-----------------------------------------------+ + +Outputs +------- + +**Vertices normals** will be calculated only if both **Vertices** and **Polygons** inputs are linked. + + +Example of usage +---------------- + +.. image:: https://cloud.githubusercontent.com/assets/5783432/18602881/e4cf2508-7c7d-11e6-8c63-8918c9a160a5.png + :alt: Vector_normal.PNG + diff --git a/docs/nodes/analyzers/normals.rst b/docs/nodes/analyzers/normals.rst new file mode 100644 index 000000000..7f0286530 --- /dev/null +++ b/docs/nodes/analyzers/normals.rst @@ -0,0 +1,40 @@ +Calculate Normals +================= + +Functionality +------------- + +This node calculates normals for faces and edges of given mesh. Normals can be calculated even for meshes without faces, i.e. curves. + +Inputs +------ + +This node has the following inputs: + +- **Vertices** +- **Edges** +- **Polygons** + +Outputs +------- + +This node has the following outputs: + +- **FaceNormals**. Normals of faces. This output will be empty if **Polygons** input is empty. +- **VertexNormals**. Normals of vertices. + +Examples of usage +----------------- + +Move each face of cube along its normal: + +.. image:: https://cloud.githubusercontent.com/assets/284644/5989203/f86367f2-a9a0-11e4-9292-d303838d561d.png + +Visualization of vertex normals for bezier curve: + +.. image:: https://cloud.githubusercontent.com/assets/284644/5989204/f8655fbc-a9a0-11e4-94d5-caf403d3a64a.png + +Normals can be also calculated for closed curves: + +.. image:: https://cloud.githubusercontent.com/assets/284644/5989202/f8632a44-a9a0-11e4-8745-19065eb13bcd.png + diff --git a/docs/nodes/analyzers/polygons_centers_mk3.rst b/docs/nodes/analyzers/polygons_centers_mk3.rst new file mode 100644 index 000000000..39bad5680 --- /dev/null +++ b/docs/nodes/analyzers/polygons_centers_mk3.rst @@ -0,0 +1,37 @@ +Centers Polygons +================ + +Functionality +------------- + +Analizing geometry and finding centers of polygons, normals (from global zero), normals from local centers of polygons and matrices that find polygons rotation. Not works with edges. + +Inputs +------ + +**Vertices** and **Polygons** from object that we analizing. + +Outputs +------- + +**Normals** is normals from global zero coordinates, vector. **Norm_abs** is normals shifted to centers of polygons. **Origins** centers of polygons. **Centers** matrices that has rotation and location of polygons. + +Example of usage +---------------- + +.. image:: https://cloud.githubusercontent.com/assets/5783432/4222939/b86a1d3e-3917-11e4-8e03-c24980672404.jpg + :alt: Centers_of_polygons_normals.jpg + +.. image:: https://cloud.githubusercontent.com/assets/5783432/4222936/b863cb46-3917-11e4-9cfe-0d863c4850b6.jpg + :alt: Centers_of_polygons_normalsabs.jpg + +.. image:: https://cloud.githubusercontent.com/assets/5783432/4222937/b864c8fc-3917-11e4-9368-b5260703e4c5.jpg + :alt: Centers_of_polygons_locations.jpg + +.. image:: https://cloud.githubusercontent.com/assets/5783432/4222949/c5874906-3917-11e4-9c9c-94c016560f98.jpg + :alt: Centers_of_polygons_matrices.jpg + +Problems +-------- + +The code of matrix rotation based on Euler rotation, so when you rotate to plane X-oriented, it makes wrong. We need spherical coordinates and quaternion rotation here, needed help or something diff --git a/docs/nodes/generators/basic_3pt_arc.rst b/docs/nodes/generators/basic_3pt_arc.rst new file mode 100644 index 000000000..07f378883 --- /dev/null +++ b/docs/nodes/generators/basic_3pt_arc.rst @@ -0,0 +1,44 @@ +3 Point Arc +=========== + +Functionality +------------- + +Given a *start coordinate*, a *through coordinate*, and an *end coordinate* this Node will find the Arc that passes through those points. + +Inputs +------ + +- arc_pts input is `[begin, mid, end, begin, mid, end, begin, mid, end..... ]` + + - must be (len % 3 == 0 ) + +- num verts is either + + - constant + - unique + - or repeats last value if the number of arcs exceeds the number of values in the `num_vert` list + + +Parameters +---------- + +The UI is quite minimal. + + +- **num verts** can be changed via Slider input on the UI or as described above, it can be fed multiple values through the input sockets. + + +Output +------ + +- (verts, edges) : A set of each of these that correspond with a packet of commands like 'start, through, end, num_verts' +- verts needs to be connected to get output +- edges is optional + +Examples +-------- + +.. image:: https://cloud.githubusercontent.com/assets/619340/3375992/3bbc0c86-fbd0-11e3-9456-353c77fd0d17.gif + +See the progress of how this node came to life `here `_ (gifs, screenshots) diff --git a/docs/nodes/generators/basic_spline.rst b/docs/nodes/generators/basic_spline.rst new file mode 100644 index 000000000..0accdb4c0 --- /dev/null +++ b/docs/nodes/generators/basic_spline.rst @@ -0,0 +1,61 @@ +2 Point Spline +============== + +Functionality +------------- + +Single section Bezier Spline. Creates a *Spline Curve* from 2 sets of points. Analogue to the Blender native Curve object, but limited to 2 pairs of *knots* and *control points* per curve. + +Inputs +------ + ++-----------+--------+-------------------------------------------------------------+ +| Parameter | Type | Description | ++===========+========+=============================================================+ +| num verts | int | per curve this sets how many verts define the curve | ++-----------+--------+-------------------------------------------------------------+ +| knot 1 | Vector | These place and adjust the shape of the curve. The knots | ++-----------+--------+ are vectors on the curve, the controls are vectors to which | +| control 1 | Vector | the curve is mathematically attracted | ++-----------+--------+ | +| control 2 | Vector | | ++-----------+--------+ | +| knot 2 | Vector | | ++-----------+--------+-------------------------------------------------------------+ + +The node accepts these +The node will adjust to make sure the length of + + +Parameters +--------- + +The Node is vectorized in the following way. If any of the *knots* or *control points* are given in a list that doesn't match the length of the other lists, then the last value of that shorter list is repeated to match the length of the longest. + +This means; if *knot1, control1, knot2* are length 3, 4 and 8 and control2 is length 20 then +*knot1, control1, knot2* will all get their last value repeated till the full list matches 20 values. + +The same *filling* procedure is applied to the *Num Verts* parameter. + +Outputs +------- + +- (verts, edges) : A set of each of these that correspond with a packet of commands like 'knot1, ctrl1, ctrl2, knot2' +- verts needs to be connected to get output +- edges is optional + +**optionals for visualizing the curve handles** + +- hnd. Verts +- hnd. Edges + +Passing hnd.Verts and hnd.Edges to a ViewerDraw node helps visualize the Handles that operate on your Spline curve. + + +Examples +-------- + +.. image:: https://cloud.githubusercontent.com/assets/619340/3362071/c3b7f346-fb05-11e3-9af7-35dfda973712.png +.. image:: https://cloud.githubusercontent.com/assets/619340/3362910/c18e4eea-fb0e-11e3-9a80-4624d30c65e9.gif + +See the progress of how this node came to life `here `_ (gifs, screenshots) diff --git a/docs/nodes/generators_extended/box_rounded.rst b/docs/nodes/generators_extended/box_rounded.rst new file mode 100644 index 000000000..e11f1a0f3 --- /dev/null +++ b/docs/nodes/generators_extended/box_rounded.rst @@ -0,0 +1,51 @@ +Rounded box +=========== + +Functionality +------------- +See the BlenderArtists thread by original author Phymec. This node merely encapsulates +the code into a form that works for Sverchok. Internally the main driver is the amount of +input vectors, each vector represents the x y z dimensions of a box. Each box can have +unique settings. If fewer parameters are provided than sizes, then a default or the last +parameter is repeated. + +Inputs & Parameters +------------------- + ++----------------+-----------------------+----------------------------------------------------------------------------+ +| name | type | info | ++================+=======================+============================================================================+ +| radius | single value or list | radius of corner fillets | ++----------------+-----------------------+----------------------------------------------------------------------------+ +| arc div | single value or list | number of divisions in the fillet | ++----------------+-----------------------+----------------------------------------------------------------------------+ +| lin div | single value or list | number of internal divisions on straight parts (``[0..1]`` or ``[1..20]``) | ++----------------+-----------------------+----------------------------------------------------------------------------+ +| Vector Size | single vector or list | x y z dimensions for each box | ++----------------+-----------------------+----------------------------------------------------------------------------+ +| div type | 3way switch, integers | just corners, corners and edges, all | ++----------------+-----------------------+----------------------------------------------------------------------------+ +| odd axis align | 0..1 on or off | internal rejiggery, not sure. | ++----------------+-----------------------+----------------------------------------------------------------------------+ + +Outputs +------- + +Depending on how many objects the input asks for, you get a Verts and Polygons list of rounded box representations. + + +Examples +-------- + +.. image:: https://cloud.githubusercontent.com/assets/619340/4471754/4987c79a-493e-11e4-89fe-bb9210af45c9.png + +.. image:: https://cloud.githubusercontent.com/assets/619340/4470969/f7dca97c-4930-11e4-9cae-63f8b17826be.png + +Notes +----- + +see: + +**Round Cube, real Quadsphere, Capsule (snipped thread title):** + +`original thread `_ \ No newline at end of file diff --git a/docs/nodes/generators_extended/generative_art.rst b/docs/nodes/generators_extended/generative_art.rst new file mode 100644 index 000000000..ff5e07e20 --- /dev/null +++ b/docs/nodes/generators_extended/generative_art.rst @@ -0,0 +1,336 @@ +Generative Art +================== + +*destination after Beta: Generators* + +Functionality +------------- + +This node can be used to produce recursive three dimensional structures following a design specified in a separate xml file. These structures are similar to fractals or lsystems. + +The xml file defines a set of transformation rules and instructions to place objects. A simple set of rules can often generate surprising and complex structures. + +Inputs & Parameters +------------------- + +This node has the following parameters: + +- **xml file** - Required. This specifies the LSystem design and should be a linked text block in the .blend file. +- **r seed** - Integer to initialize python's random number generator. If the design includes a choice of multiple rules, changing this will change the appearance of the design +- **max mats** - To avoid long delays or lock ups the output of the node is limited to this number of matrices + +This node has the following inputs: + +- **Vertices** - Optional. A list of vertices to be joined in a ring and used as the basis for a tube structure. Typically the output of a Circle or NGon node. +- **data** - Optional. The xml file can have optional variables defined using {myvar} type format notation. Extra named data inputs are generated for each of these these variables. These variables can be used to control animations. + + +Outputs +------- + +- **Vertices, Edges and Faces** - If the Vertices input is connected, these outputs will define the mesh of a tube that skins the structure defined in the xml file. + +- **Shapes Matrices** - For each *shape* atribute defined in the xml file a named output will be generated. This output is a list list of matrices that define the structure. + + +Examples of usage +------------------ + +A simplified description of the algorithm for the evaluation of a design. + +The xml file (see below for examples and descriptions) consist of a set of rules, each rule has a list of instructions, each instruction defines a transform and either a call to a rule or an instruction to place an instance. + +The system is implemented by a stack where each item in the stack consists of the next rule to call, the current depth of the system and the current state of the system. At each iteration of the processor the last item is removed from the stack and processed. + +Each instruction in the rule removed from the stack is processed in turn. The current state of this system is set to that of the item removed from the stack. Any transform in the instruction is applied to the system state. If the instruction is a call to a rule, a new item is added to the stack with the new rule, the depth increased by one, and the new system state. If the instruction is to place an instance, the matrix representing the new system state is added to the output matrix list for that type of shape. The processor then proceeds to what is now the last item on the stack. + +If the max_depth for the current rule is reached or the max_depth for overall design is reached then the processor goes back and processes what is now the last item on the stack without taking any other action. If the stack is empty or the maximum number of matrices has been reached the processor stops. + + +A simple example of an xml design file: + +6 Spirals +:: + + + + + + + + + + + + + + + + +This specifies the following design with 6 spirals. + +.. image:: https://cloud.githubusercontent.com/assets/7930130/13376231/cb79f476-de1b-11e5-90e9-845f3c201228.png + :alt: 6 spiral screen shot with node diagram and text file and structure + +The xml file consists of a list of rules. There must be at least one rule called entry. This is the starting point for the processor. Each rule consists of a list of instructions. These instructions can either be a call to another rule or an instruction to place an instance of an object. + +Calls can be recursive. For the example above the first instruction in rule R1 also calls rule R1. This recursion stops when the max_depth value is reached or the max_mats value set in the node is reached. The max_depth can also be set separately for each rule and is added as an attribute eg ````. + +Each of these instructions can be modified with a set of transforms. If the transform is omitted it defaults to the identity transform. + +A transform consist of translations, rotations and scaling operations. For example ``tx 1.3`` means translated 1.3 units in the ``x`` direction, ``rz 6`` means rotate 6 degrees about the ``z`` axis and ``sa 0.99`` means scale all axes by 0.99. + +The full list of transforms that take one argument : ``tx ty tz rx ry rz sx sy sz sa`` +In addition all three axes values for either a translation or scale can be applied at once with a triplet of values. +For example: ``t 1.1 2.2 3.3 s 0.9 0.9 0.7`` + +Instead of using a single *transform* attribute, each transform can be specified individually. For example ``transforms="tx 1 rz 90 sa 0.75"`` can be replaced with ``tx="1" rz="90" sa="0.75"``. + +The count attribute specifies how many times that instruction is repeated. if count is omitted it defaults to 1. For example the instruction ```` calls rule ``R1`` applying a 120 degree rotation about ``z`` in between each call. + +An instance instruction tells the processor to add a matrix to the output list defining the state of the system at that point. The names used in the shape attribute are used as the names for the node's output sockets. If there is more than one type of shape each will have its own output socket. + + +Multiple Rule Definition Example +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +There can be multiple definitions of the same rule in an xml file. + +For example + +Tree +:: + + + + + + + + + + + + + + + + + + + + + + + +.. image:: https://cloud.githubusercontent.com/assets/7930130/7782285/25164a80-0162-11e5-9feb-32c4f3908f1e.png + :alt: tree structure image + +In the above xml file there are four definitions of the ``spiral`` rule. Each rule version has a weight attribute. The processor will call each version of the ``spiral`` rule in a random manner. The weight attribute will determine the probability a particular rule version is called. + +The first three definitions of the ``spiral`` rule all place an object instance and then call the ``spiral`` rule with the same translation along the ``z`` axis and rotation about the ``x`` axis but different amounts of rotation about the ``y`` and ``z`` axis. The fourth definition calls the ``spiral`` rule twice without placing an instance. This causes the branches in the tree structure. Changing the value of the weight attribute for this rule version will change how often the tree branches. For a larger weight value, the rule gets called more often and there are more branches. + +If the weight attribute is omitted each version will have equal weight. Changing the value of ``r seed`` in the node interface will change the generated structure for xml files with multiple rule definitions. This example had rseed = 1. + + +Successor Rule Example +~~~~~~~~~~~~~~~~~~~~~~~~~ + +Normally when the ``max_depth`` for a rule is reached that 'arm' of the structure is finished. If a rule defines a successor rule then this rule will be called when the ``max_depth`` is reached. In the following example when the ``y180`` rule gets called it will be called 90 times in succession and produce a 180 degree turn about the y axis. When it finishes the successor rule ``r`` will be called and either produce a 180 degree turn about the ``y`` axis or the ``z`` axis. + +Nouveau variation +:: + + + + + + + + + + + + + + + + + + + + +.. image:: https://cloud.githubusercontent.com/assets/7930130/7629793/cb2d4a30-fa83-11e4-8c75-2fa6488f65fe.png + :alt: nouveau variation structure + +This example needs "max matrices" set to 5000 to get the above result. + + +Mesh Mode Example +~~~~~~~~~~~~~~~~~~ + +Using the matrices output allows a separate object to be placed at each location. The vertices input and the mesh (vertices, edges, faces) output "skins" the mesh into a much smaller number of objects. The vertices input should be a list of vertices such as that generated by the "Circle" node or "NGon" node. It could also be a circle type object taking from the scene using the "Objects In" node. The list of vertices should be in order so they can be made into a ring with the last vertex joined to the first. That ring dosen't have to be planar. + +.. image:: https://cloud.githubusercontent.com/assets/7930130/13376232/d20249ce-de1b-11e5-968d-727f0038305e.png + :alt: node and result picture for 6 spiral in mesh mode + +The output will not always be one mesh. If the rule set ends one 'arm' and goes back to start another 'arm' these two sub-parts will be separate meshes. Sometimes the mesh does not turn out how you would like. This can often be fixed by changing the rule set. + +Often a mesh tube will turn out flat rather than being tube like. This can usually be fixed by either rotating the vertex ring in the scene or by adding a rotation transform to the "instance" commands in the rule set. + +For example change ```` to ```` + +In other cases the mesh can be connected in the wrong order. + +For example the following two xml files will look the same when the matrix output is used to place objects, but have different output when they are used in mesh mode. Both sets of xml rules produce the same list of matrices just in a different order. + +Fern 1 +:: + + + + + + + + + + + + + + + + + + + +.. image:: https://cloud.githubusercontent.com/assets/7930130/7629779/b6553802-fa83-11e4-8390-aa9ba2a0c44d.png + :alt: image fern wrong + +Fern 2 +:: + + + + + + + + + + + + + + + + + + + + + + + +.. image:: https://cloud.githubusercontent.com/assets/7930130/7629783/bbe99588-fa83-11e4-8d70-92cc2909675e.png + :alt: image fern right + +Again these were both done with max mats set to 5000. + +Constants and Variables Example +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Constants and variables can be included in the xml file by replacing a numerical value with a pair of braces. +:: + + transforms = "tx 0.5 rx 20 sa 0.9" + +becomes +:: + + transforms = "tx {x_const} rx 20 sa 0.9" + +Constants are defined within the xml as follows: +:: + + + +Multiple constants can be defined within one element and several *constants* elements can be used as required in the xml file. + +If a field name in between curly brackets is not given a value in a *constants* element then a named input socket will be added to the node. A *Float*, *Integer* or similar node input can be wired up to this input variable. + +The example below uses a variable ({curl_angle}) to animate the amount of curl on the fern structure shown in the mesh mode example and two constants to fix the the value of the ``tz`` transform in the large curl and the scale ({sxy}) in all the curls. + +Fern 3 +:: + + + + + + + + + + + + + + + + + + + + + + + + +.. image:: https://cloud.githubusercontent.com/assets/7930130/13376233/d7303744-de1b-11e5-8c91-1d56f412b27d.png + :alt: image fern animation + +For this animation the index number of the current frame in the animation is translated from the range 1 to 250 to the range 16 to 6 via the "Map Range" node and wired into the ``curl_angle`` input of the "Generative Art" node. This cause the fern to unwind as the animation proceeds. + +Simple maths can also be use in the transforms definition. This has been used above in the ``curlsmall`` rule. The ``rx`` rotation of the transform will always be twice that of the ``rx`` rotation in the ``curl1`` and ``curl2`` rules. There cannot be any spaces in any maths expressions for the rotation, translation or scale parameters when using a single transforms attribute string. To allow for more complicated expressions each transform can be separated out into its own attribute. + +transforms as single attribute (no spaces allowed in maths expression) +:: + + + +each transform with its own attribute (can have spaces) +:: + + + + +All this is implemented by first using python's string ``format`` method to substitute in the variable value from the node data input. Then the resulting string is passed to python's ``eval()`` function. The string must evaluate to a single number (float or integer). Using ``eval()`` is a potential security problem as in theory someone could put some malicious code inside an xml lsystem definition. As always don't run code from a source you don't trust. + +The python ``math`` and ``random`` modules exist in the namespace of the "Generative Art" node so for example a transform could be defined as: +:: + + tx="2**0.5" + +or: +:: + + tx="math.sqrt(2)" + +Only the transforms that take a single number that is ``tx, ty, tz, rx, ry, rz, sx, sy, sz`` and ``sa`` have been implemented using individual attributes. The ones that use triplets to specify all three translations or scales at once (``t`` and ``s``) can only be used in a transform string. + + +References +---------- + +This node is closely based on `Structure Synth`_ but the xml design format and most of the code comes from `Philip Rideout's`_ `lsystem`_ repository on github. + + +.. _Structure Synth: http://structuresynth.sourceforge.net/ +.. _lsystem: https://github.com/prideout/lsystem +.. _Philip Rideout's: http://prideout.net/ + + + + diff --git a/docs/nodes/generators_extended/hilbert.rst b/docs/nodes/generators_extended/hilbert.rst new file mode 100644 index 000000000..16a2d17ed --- /dev/null +++ b/docs/nodes/generators_extended/hilbert.rst @@ -0,0 +1,44 @@ +Hilbert 2D +======================= + +Functionality +------------- + +Hilbert field generator. this is concept of dence flooding of space by continuous line, that achived with division and special knotting. Hilbert space can be only square, because of his nature. + +Inputs +------ + +All inputs are not vectorized and they will accept single value. +There is two inputs: + +- **level** +- **size** + +Parameters +---------- + +All parameters can be given by the node or an external input. + + ++-------------+---------------+-------------+------------------------------------------+ +| Param | Type | Default | Description | ++=============+===============+=============+==========================================+ +| **level** | Int | 2 | level of division of hilbert square | ++-------------+---------------+-------------+------------------------------------------+ +| **size** | float | 1.0 | scale of hilbert mesh | ++-------------+---------------+-------------+------------------------------------------+ + +Outputs +------- + +**Vertices**, **Edges**. + + +Example of usage +---------------- + +.. image:: https://cloud.githubusercontent.com/assets/5783432/4380966/a5d73b7c-436f-11e4-89e0-5a4be8f130aa.png + :alt: hilbert.PNG + +Smooth labirynth diff --git a/docs/nodes/generators_extended/hilbert3d.rst b/docs/nodes/generators_extended/hilbert3d.rst new file mode 100644 index 000000000..b0d82296d --- /dev/null +++ b/docs/nodes/generators_extended/hilbert3d.rst @@ -0,0 +1,44 @@ +Hilbert 3D +======================= + +Functionality +------------- + +Hilbert space generator. this is concept of dence flooding of space by continuous line, that achived with division and special knotting. Hilbert space can be only cube, because of his nature. + +Inputs +------ + +All inputs are not vectorized and they will accept single value. +There is two inputs: + +- **level** +- **size** + +Parameters +---------- + +All parameters can be given by the node or an external input. + + ++-------------+---------------+-------------+------------------------------------------+ +| Param | Type | Default | Description | ++=============+===============+=============+==========================================+ +| **level** | Int | 2 | level of division of hilbert square | ++-------------+---------------+-------------+------------------------------------------+ +| **size** | float | 1.0 | scale of hilbert mesh | ++-------------+---------------+-------------+------------------------------------------+ + +Outputs +------- + +**Vertices**, **Edges**. + + +Example of usage +---------------- + +.. image:: https://cloud.githubusercontent.com/assets/5783432/4380965/a5a3019a-436f-11e4-9ec9-982ab3f25671.png + :alt: hilbert3d.PNG + +Smooth labirynth diff --git a/docs/nodes/generators_extended/hilbert_image.rst b/docs/nodes/generators_extended/hilbert_image.rst new file mode 100644 index 000000000..746506691 --- /dev/null +++ b/docs/nodes/generators_extended/hilbert_image.rst @@ -0,0 +1,48 @@ +Hilbert 3D +======================= + +Functionality +------------- + +Hilbert image recreator. Based on hilbert space this node recreates image by interpolating it on pixels. + +Inputs +------ + +- **level** +- **size** +- **sensitivity** + +Parameters +---------- + +All parameters can be given by the node or an external input. + + ++-----------------+---------------+-------------------+----------------------------------------------------------+ +| Param | Type | Default | Description | ++=================+===============+===================+==========================================================+ +| **RGB** | float | 0.3,0.59,0.11 | RGB map of imported image, sensitivity to each color | ++-----------------+---------------+-------------------+----------------------------------------------------------+ +| **image name** | string | None | enumerate popup to choose image from stack | ++-----------------+---------------+-------------------+----------------------------------------------------------+ +| **level** | Int | 2 | level of division of hilbert square | ++-----------------+---------------+-------------------+----------------------------------------------------------+ +| **size** | float | 1.0 | scale of hilbert mesh | ++-----------------+---------------+-------------------+----------------------------------------------------------+ +| **sensitivity** | float | 1.0 | define scale of values to react and build image | ++-----------------+---------------+-------------------+----------------------------------------------------------+ + +Outputs +------- + +**Vertices**, **Edges**. + + +Example of usage +---------------- + +.. image:: https://cloud.githubusercontent.com/assets/5783432/4381109/5bca94dc-4371-11e4-8de0-eb3ee7356aa8.png + :alt: hilbertimage.PNG + +recreate image in hilbert diff --git a/docs/nodes/generators_extended/image_components.rst b/docs/nodes/generators_extended/image_components.rst new file mode 100644 index 000000000..253b3fea6 --- /dev/null +++ b/docs/nodes/generators_extended/image_components.rst @@ -0,0 +1,66 @@ +Image Decomposer +================ + +*destination after Beta: analyzers* + +.. image:: https://cloud.githubusercontent.com/assets/619340/4495748/bbd3fe56-4a5e-11e4-9202-3b86f7c57c22.png + + +Functionality +------------- + +To get output from this node you must connect something to the first 2 output sockets (xya and rgb), polygons is optional +and only outputs faces when ``Filter?`` is off. + +Takes the ``rgba`` components of an image currently loaded in Blender and decomposes +them into ``xya`` and ``rgb`` Vertex-style sockets. ``xy`` are inferred by the number of pixels in the image and the image width. ``z`` doesn't make much sense in relation to a pixel and was replaced by the Alpha channel of the pixel (``a``). + +If you don't have images loaded in the UV editor, they can be imported from N panel +into Blender and loaded from there. + + +Inputs & Parameters +------------------- + ++---------------+-------------------------------------------------------------------+ +| name | function | ++===============+===================================================================+ +| Skip n pixels | allows to sample a reduced grid of the image, every nth pixel in | +| | either direction. | ++---------------+-------------------------------------------------------------------+ +| xy_spread | the ``xy`` component of the ``xya`` socket can be multiplied to | +| | get a wider spread. | ++---------------+-------------------------------------------------------------------+ +| z_spread | this amplifies ``rgb``, not ``a`` (which you can amplify yourself | +| | if that was needed.) | ++---------------+-------------------------------------------------------------------+ +| Filter? | uses a restricted eval to drop pixels using a simple typed command| +| | : example ``r < 0.8 and g > 0.4`` (more below) | ++---------------+-------------------------------------------------------------------+ + + +Outputs +------- + + ++-------------+--------------------------------------------------------------------+ +| name | function | ++=============+====================================================================+ +| ``xya`` | the **x** and **y** of the pixel, combined with the Alpha channel. | +| | The value of **x** and **y** are multiplied by ``xy_spread``. | ++-------------+--------------------------------------------------------------------+ +| ``rgb`` | each (unfiltered) pixel component is multiplied by ``z_spread`` | ++-------------+--------------------------------------------------------------------+ +| polygons | this output will generate sensible polygon index list for ``xya`` | +| | when pixels are unfiltered. | ++-------------+--------------------------------------------------------------------+ + +Examples +-------- + +`The development thread `_ contains working examples of this Node used as preprocessor for game maps. + +Notes +----- + +The loaded image gets a fake user automagically, tho perhaps this should be optional. \ No newline at end of file diff --git a/docs/nodes/generators_extended/profile.rst b/docs/nodes/generators_extended/profile.rst new file mode 100644 index 000000000..b376f2c59 --- /dev/null +++ b/docs/nodes/generators_extended/profile.rst @@ -0,0 +1,141 @@ +======================= +Profile Parametric Node +======================= + + +**Profile Node** implements a useful subset of the SVG path section commands. Currently the following segment types are available: + ++---------+------+---------------------------------------------------------------------------------+ +| name | cmd | parameters | ++=========+======+=================================================================================+ +| MoveTo | M, m| <2v coordinate> | ++---------+------+---------------------------------------------------------------------------------+ +| LineTo | L, l| <2v coordinate 1> <2v coordinate 2> <2v coordinate n> [z] | ++---------+------+---------------------------------------------------------------------------------+ +| CurveTo | C, c| <2v control1> <2v control2> <2v knot2> [z] | ++---------+------+---------------------------------------------------------------------------------+ +| ArcTo | A, a| <2v rx,ry> <2v x,y> [z] | ++---------+------+---------------------------------------------------------------------------------+ +| Close | X | | ++---------+------+---------------------------------------------------------------------------------+ +| comment | # | must be first thing on the line, no trailing comment instructions. | ++---------+------+---------------------------------------------------------------------------------+ + +:: + + <> : mandatory field + [] : optional field + 2v : two point vector `a,b` + - no space between , + - no backticks + - a and b can be + - number literals + - lowercase 1-character symbols for variables + int : means the value will be cast as an int even if you input float + flags generally are 0 or 1. + z : is optional for closing a line + X : as a final command to close the edges (cyclic) [-1, 0] + in addition, if the first and last vertex share coordinate space + the last vertex is dropped and the cycle is made anyway. + # : single line comment prefix + + +**Mode 0:** default behaviour, variables may be negated + +:: + + M a,-a + L a,a -a,a -a,-a z + +There are 2 slightly more elaborate evaluation modes: + +**Mode 1:** Requires the use or parentheses to indicate where extra operations take place. +Mode 1 is restrictive and only allows addition and subtraction + +:: + +(a+b-c) + +**Mode 2:** Also requires parentheses but allows a more liberal evaluation of operations. Allowed operations are: + +:: + +(a*b(c/d)) + +To use Mode 2, you must enable the *extended parsing* switch in the N-panel for the Profile node. + + +Examples +-------- + +If you have experience with SVG paths most of this will be familiar. The biggest difference is that only the +LineTo command accepts many points, and we always start the profile with a M ,. + +:: + + M 0,0 + L a,a b,0 c,0 d,d e,-e + + +CurveTo and ArcTo only take enough parameters to complete one Curve or Arc, +unlike real SVG commands which take a whole sequence of chained CurveTo or ArcTo commands. The decision to keep +it at one segment type per line is mainly to preserve readability. + +The CurveTo and ArcTo segment types allow you to specify how many vertices are used to generate the segment. SVG +doesn't let you specify such things, but it makes sense to allow it for the creation of geometry. + +the fun bit about this is that all these variables / components can be dynamic + +:: + + M 0,0 + L 0,3 2,3 2,4 + C 2,5 2,5 3,5 10 0 + L 5,5 + C 7,5 7,5 7,3 10 0 + L 7,2 5,0 + X + +or + +:: + + M a,a + L a,b c,b -c,d + C c,e c,e b,e g 0 + L e,e + C f,e f,e f,-b g 0 + L f,c e,a + X + + +More Info +--------- + +The node started out as a thought experiment and turned into something quite useful, you can see how it evolved in the `github thread `_ + +Example usage: + +.. image:: https://cloud.githubusercontent.com/assets/619340/3905771/193b5d86-22ec-11e4-93e5-724863a30bbc.png + + +.. image:: https://cloud.githubusercontent.com/assets/619340/3895396/81f3b96c-224d-11e4-9ca7-f07756f40a0e.png + + +Gotchas +------- + +The update mechanism doesn't process inputs or anything until the following conditions are satisfied: + + * Profile Node has at least one input socket connected + * The file field on the Node points to an existing Text File. + + +Keyboard Shortcut to refresh Profile Node +----------------------------------------- + +Updates made to the profile path text file are not propagated automatically to any nodes that might be reading that file. +To refresh a Profile Node simply hit ``Ctrl+Enter`` In TextEditor while you are editing the file, or click one of the +inputs or output sockets of Profile Node. There are other ways to refresh (change a value on one of the incoming nodes, +or clicking the sockets of the incoming nodes) + diff --git a/docs/nodes/generators_extended/script.rst b/docs/nodes/generators_extended/script.rst new file mode 100644 index 000000000..5129bca63 --- /dev/null +++ b/docs/nodes/generators_extended/script.rst @@ -0,0 +1,378 @@ +Scripted Node (Generator) +========================= + +aka Script Node or SN. (iteration 1) + +- Introduction +- Features +- Structure +- Templates +- Conveniences +- Examples +- Techniques to improve Python performance +- Limitations +- Future + +Introduction +------------ + +When you want to express an idea in written form and the concept is suitable +for a one line Python expression then often you can use a Formula node. If you +need access to imports, classes, temporary variables, and functions then you can +write a script to load into ScriptNode. + +ScriptNode (SN) allows you to write multi-line python programs that define +the functionality of a Node, while avoiding some of the boilerplate associated +with a regular Node. SN can be used as an environment for experimenting +with algorithms. Scripts written for SN are easily converted to full PyNodes. + +It's a prototype so bug reports are welcome. + +Here's a short tutorial to SN1, see :ref:`scripted-tutorial` + + +Features +-------- + +allows: + +- Loading/Reloading scripts currently in TextEditor +- imports and aliasing, ie anything you can import from console works in SN +- nested functions and lambdas +- named inputs and outputs +- named operators (buttons to action something upon button press) + +Structure +--------- + +At present all scripts for SN must (strict list - general): + +- have 1 `sv_main` function as the main workhorse +- `sv_main` must take 1 or more arguments (even if you don't use it) +- all function arguments for ``sv_main`` must have defaults. +- each script shall define ``in_sockets`` and ``out_sockets`` +- `ui_operators` is an optional third output parameter + +**sv_main()** + + +``sv_main()`` can take int, float and list or nested list. +Here are some legal examples:: + + def sv_main(vecs_in_multi=[[]], vecs_in_flat=[], some_var=1, some_ratio=1.2): + pass + + [[]] # for nested input (lists of lists of any data type currently supported) + [] # for flat (one list) + int, float # for single value input + +**in_sockets** + +:: + + in_sockets = [ + [type, 'socket name on ui', input_variable], + [type, 'socket name on ui 2', input_variable2], + # ... + ] + +**out_sockets** + +:: + + out_sockets = [ + [type, 'socket name on ui', output_variable], + [type, 'socket name on ui 2', output_variable2], + # ... + ] + +**in_sockets and out_sockets** + +- Each *socket name on ui* string shall be unique. + +- **type** are currently limited to + + +---------+-------------------------------------+ + | type id | type data | + +=========+=====================================+ + | 's' | floats, ints, edges, faces, strings | + +---------+-------------------------------------+ + | 'v' | vertices, vectors, 3-tuples | + +---------+-------------------------------------+ + | 'm' | matrices, 4 x 4 nested lists | + +---------+-------------------------------------+ + + + +**ui_operators** + +:: + + ui_operators = [ + ['button_name', func1] + ] + +- Here `func1` is the function you want to call when pressing the button. +- Each `"button_name"` is the text you want to appear on the button. + For simplicity it must be a unique and valid python variable name + + - with no special characters (``|().\/...etc``) + - doesn't start with a number + - contains no spaces, use single underscores if you need word separation. The UI code replaces underscores with spaces. + + +**return** + + +Simple, only two flavours are allowed at the moment. :: + + return in_sockets, out_sockets + return in_sockets, out_sockets, ui_operators + +Templates +--------- + +Sverchok includes a list of easily accessible examples and templates. They can be accessed +from the SN node if nothing is loaded, or from the `Template Menu` in `TextEditor` as ``sv NodeScripts``. + + +Conveniences +------------ + +We vale our time, i'm sure you do too, so features have been added to help speed up the +script creation process. + +**Text Editor** + +- has automatic ``in_sockets`` list creation when the key cursor is over ``sv_main``. + (please note: it doesn't attempt to detect if you want nested verts or edge/polygon so it assumes you want 'v') + + - kb shortcut: ``Ctrl+I -> Generate in_sockets`` + +.. image:: https://cloud.githubusercontent.com/assets/619340/2854040/e6351180-d14b-11e3-8055-b3d8c707675d.gif + +- can also convert a template description (like `kv lang` if you know Kivy) into + valid ScriptNode ready python. Example `available here `_ + + - kb shortcut: ``Ctrl+I -> Convert svlang`` + +- can refresh the Script Node which currently loads that script by hitting ``Ctrl+Enter`` + + +Examples +-------- + +The best way to get familiarity with SN is to go through the templates folder. +They are intended to be lightweight and educational, but some of them will show +advanced use cases. The images and animations on this `thread on github +`_. +may also provide some insight into what's possible. + +A typical nodescript may look like this:: + + + from math import sin, cos, radians, pi + from mathutils import Vector, Euler + + + def sv_main(n_petals=8, vp_petal=20, profile_radius=1.3, amp=1.0): + + in_sockets = [ + ['s', 'Num Petals', n_petals], + ['s', 'Verts per Petal', vp_petal], + ['s', 'Profile Radius', profile_radius], + ['s', 'Amp', amp], + ] + + # variables + z_float = 0.0 + n_verts = n_petals * vp_petal + section_angle = 360.0 / n_verts + position = (2 * (pi / (n_verts / n_petals))) + + # consumables + Verts = [] + + # makes vertex coordinates + for i in range(n_verts): + # difference is a function of the position on the circumference + difference = amp * cos(i * position) + arm = profile_radius + difference + ampline = Vector((arm, 0.0, 0.0)) + + rad_angle = radians(section_angle * i) + myEuler = Euler((0.0, 0.0, rad_angle), 'XYZ') + + # changes the vector in place, successive calls are accumulative + # we reset at the start of the loop. + ampline.rotate(myEuler) + x_float = ampline.x + y_float = ampline.y + Verts.append((x_float, y_float, z_float)) + + # makes edge keys, ensure cyclic + Edges = [[i, i + 1] for i in range(n_verts - 1)] + Edges.append([i, 0]) + + out_sockets = [ + ['v', 'Verts', [Verts]], + ['s', 'Edges', [Edges]], + ] + + return in_sockets, out_sockets + +but we are not forced to have all code inside sv_main, we can also do:: + + + def lorenz(N, verts): + add_vert = verts.append + h = 0.01 + a = 10.0 + b = 28.0 + c = 8.0 / 3.0 + + x0 = 0.1 + y0 = 0 + z0 = 0 + for i in range(N): + x1 = x0 + h * a * (y0 - x0) + y1 = y0 + h * (x0 * (b - z0) - y0) + z1 = z0 + h * (x0 * y0 - c * z0) + x0, y0, z0 = x1, y1, z1 + + add_vert((x1,y1,z1)) + + def sv_main(N=1000): + + verts = [] + in_sockets = [['s', 'N', N]] + out_sockets = [['v','verts', [verts]]] + + lorenz(N, verts) + return in_sockets, out_sockets + + +We can even define classes inside the .py file, or import from elsewhere. + +Here's a `ui_operator` example, it acts like a throughput (because in and out +are still needed by design). You'll notice that inside `func1` the node's input +socket is accessed using `SvGetSockeyAnyType(...)`. It is probably more logical +if we could access the input data directly from the variable `items_in`, +currently this is not possible -- therefor the solution is to use what +sverchok nodes use in their internal code too. The upshot, is that this exposes +you to how you might access the socket content of other nodes. Experiment :) + +:: + + def sv_main(items_in=[[]]): + + in_sockets = [ + ['v', 'items_in', items_in]] + + def func1(): + # directly from incoming Object_in socket. + sn = bpy.context.node + + # safe? or return early + if not (sn.inputs and sn.inputs[0].links): + return + + verts = SvGetSocketAnyType(sn, sn.inputs['items_in']) + print(verts) + + out_sockets = [['v', 'Verts', items_in]] + ui_operators = [['print_names', func1]] + + return in_sockets, out_sockets, ui_operators + + +Breakout Scripts +---------------- + +For lack of a better term, SN scripts written in this style let you pass +variables to a script located in ``/sverchok-master/..`` or +``/sverchok-master/your_module_name/some_library``. To keep your sverchok-master +folder organized I recommend using a module folder. In the example below, +I made a folder inside sverchok-master called ``sv_modules`` and inside that I +have a file called `sv_curve_utils`, which contains a function `loft`. This way +of coding requires a bit of setup work, but then you can focus purely on +the algorithm inside `loft`. :: + + + from mathutils import Vector, Euler, Matrix + import sv_modules + from sv_modules.sv_curve_utils import loft + + def sv_main(verts_p=[], edges_p=[], verts_t=[], edges_t=[]): + + in_sockets = [ + ['v', 'verts_p', verts_p], + ['s', 'edges_p', edges_p], + ['v', 'verts_t', verts_t], + ['s', 'edges_t', edges_t]] + + verts_out = [] + + def out_sockets(): + return [['v', 'verts_out', verts_out]] + + if not all([verts_p, edges_p, verts_t, edges_t]): + return in_sockets, out_sockets() + + # while developing, it can be useful to uncomment this + if 'loft' in globals(): + import imp + imp.reload(sv_modules.sv_curve_utils) + from sv_modules.sv_curve_utils import loft + + verts_out = loft(verts_p[0], verts_t[0]) # this is your break-out code + + # here the call to out_sockets() will pick up verts_out + return in_sockets, out_sockets() + + +Techniques to improve Python performance +---------------------------------------- + +There are many ways to speed up python code. Some slowness will be down to +innefficient algorithm design, other slowness is caused purely by how much +processing is minimally required to solve a problem. A decent read regarding +general methods to improve python code performance can be found +on `python.org `_. +If you don't know where the cycles are being consumed, then you don't know +if your efforts to optimize will have any significant impact. + +Read these 5 rules by Rob Pike before any optimization. +http://users.ece.utexas.edu/~adnan/pike.html + +Limitations +----------- + +Most limitations are voided by increasing your Python and ``bpy`` skills. + +Future +------ + +SN iteration 1 is itself a prototype and is a testing ground for iteration 2. +The intention was always to provide multiple programming language interfaces, +initially coffeescript because it's a lightweight language with crazy expressive +capacity. iteration 2 might work a little different, perhaps working from +within a class but trying to do extra introspection to reduce boilerplate. + +The only reason in_sockets needs to be declared at the moment is if you want +to have socket names that are different than the function arguments. It +would be possible to allow `sv_main()` to take zero arguments too. +So possible configurations should be:: + + sv_main() + sv_main() + in_sockets + sv_main() + out_sockets + sv_main(a=[],..) + sv_main(a=[],..) + in_sockets + sv_main(a=[],..) + out_sockets + sv_main(a=[],..) + in_socket + out_sockets + +etc, with ui_operators optional to all combinations + + +That's it for now. diff --git a/docs/nodes/generators_extended/script3.rst b/docs/nodes/generators_extended/script3.rst new file mode 100644 index 000000000..c6d496489 --- /dev/null +++ b/docs/nodes/generators_extended/script3.rst @@ -0,0 +1,293 @@ +Scripted Node 2(Generator) +========================= + +aka Script Node MK2 + +- Introduction +- Features +- Structure +- Templates +- Conveniences +- Examples +- Techniques to improve Python performance +- Limitations + +Introduction +------------ + +When you want to express an idea in written form and the concept is suitable +for a one line Python expression then often you can use a Formula node. If you +need access to imports, classes, temporary variables, and functions then you can +write a script to load into Script Node 2. + +Script Node MK2 differs from Script Node iteratrion 1 in that offers more control. +It also has a prototype system where you could for example reuse the behavior of +a generator and the template takes care of all the details leaving you to focus +on the function. Scripts using the templates automatically becomes more powerful. + +It's a prototype so bug reports, questions and feature request are very welcome. + +Features +-------- + +allows: + +- Loading/Reloading scripts currently in TextEditor +- imports and aliasing, ie anything you can import from console works in SN2 +- nested functions and lambdas +- named inputs and outputs +- named operators (buttons to action something upon button press) + +Structure +--------- + +At present all scripts for SN2 must: + +- be subclasses SvScript +- include a function called process in the class +- have member attributes called ``inputs`` and ``outputs`` +- have one Script class per file, if more than one, last one found will be used + +**process(self)** + + +``process(self)`` is the main flow control function. It is called when all sockets +without defaults are connected. Usually the template provides a ``process`` function +for you. + +**inputs** + +Default can be a float or integer value, not other types are usable yet:: + + inputs = [ + [type, 'socket name on ui', default], + [type, 'socket name on ui2', default], + # ... + ] + + +**outputs** + +:: + + outputs = [ + [type, 'socket name on ui'], + [type, 'socket name on ui 2'], + # ... + ] + +**inputs and outputs** + +- Each *socket name on ui* string shall be unique. + +- **type** are currently limited to + + +---------+-------------------------------------+ + | type id | type data | + +=========+=====================================+ + | 's' | floats, ints, edges, faces, strings | + +---------+-------------------------------------+ + | 'v' | vertices, vectors, 3-tuples | + +---------+-------------------------------------+ + | 'm' | matrices, 4 x 4 nested lists | + +---------+-------------------------------------+ + +There are a series of names that have special meaning that scripts should +avoid as class attributes or only used for the intended meaning. To be described: + ``node`` ``draw_buttons`` ``update`` ``process`` ``enum_func`` ``inputs`` +``outputs`` + + +Templates +--------- + +Sverchok includes a series of examples for the different templates. + + +Conveniences +------------ + +We value our time, we are sure you do too, so features have been added to help speed up the +script creation process. + +**Text Editor** + +- can refresh the Script Node which currently loads that script by hitting ``Ctrl+Enter`` + +Main classes for your subclasses are: + + - ``SvScript`` + - ``SvScriptSimpleGenerator`` + - ``SvScriptSimpleFunction`` + +Limitations +----------- + +Using ``SvScriptSimpleGenerator`` and ``SvScriptSimpleFunction`` you limit inputs to deal with one object. +For plane, for example, you'll get next data: + + [(0.0, 0.0, 0.0), (1.0, 0.0, 0.0), (0.0, 1.0, 0.0), (1.0, 1.0, 0.0)] [(0, 1, 3, 2)] + +If you need Full support of Sverchok data - you'd better use ``SvScript`` +class and ``self.node.inputs[0].sv_get()`` function. + +Examples +-------- + +The best way to get familiarity with Script Node 2 is to go through the templates folder. +They are intended to be lightweight and educational, but some of them will show +advanced use cases. The images and animations on this `thread on github +`_. +may also provide some insight into what's possible. + +A typical nodescript using the ``SvScriptSimpleGenerator`` may look like this, note that +the third argument for outputs is specific to this template:: + + import numpy + import itertools + + class GridGen(SvScriptSimpleGenerator): + inputs = [("s", "Size", 10.0), + ("s", "Subdivs", 10)] + outputs = [("v", "verts", "make_verts"), + ("s", "edges", "make_edges")] + + @staticmethod + def make_verts(size, sub): + side = numpy.linspace(-size / 2, size / 2, sub) + return tuple((x, y, 0) for x, y in itertools.product(side, side)) + + @staticmethod + def make_edges(size, sub): + edges = [] + for i in range(sub): + for j in range(sub - 1): + edges.append((sub * i + j, sub * i + j + 1)) + edges.append((sub * j + i, sub * j + i + sub)) + return edges + + +Note that here the name of the method that should be called for producing data +for each socket in the final last arguments to ``outputs`` but we are not forced +to have all code inside the class, we can also do +:: + + def lorenz(N, verts, h, a, b, c): + add_vert = verts.append + + x0 = 0.1 + y0 = 0 + z0 = 0 + for i in range(N): + x1 = x0 + h * a * (y0 - x0) + y1 = y0 + h * (x0 * (b - z0) - y0) + z1 = z0 + h * (x0 * y0 - c * z0) + x0, y0, z0 = x1, y1, z1 + + add_vert((x1,y1,z1)) + + class LorenzAttractor(SvScriptSimpleGenerator): + + inputs = [ + ['s', 'N', 1000], + ['s', 'h', 0.01], + ['s', 'a', 10.0], + ['s', 'b', 28.0], + ['s', 'c', 8.0/3.0] + ] + + @staticmethod + def make_verts(N, h, a, b, c): + verts = [] + lorenz(N, verts, h, a, b, c) + return verts + + @staticmethod + def make_edges(N, h a, b, c: + edges = [(i, i+1) for i in range(N-1)] + return edges + + outputs = [ + ['v','verts', "make_verts"], + ['s','edges', "make_edges"] + ] + + +Here is a simple script for deleting loose vertices from mesh data, it also serves as an +illustration for a type of script that uses the ```SvScriptSimpleFunction``` template that +has one main function that decomposes into separate sockets. The methods don't have be static +but in general it is good practice to keep them free from side effects. +:: + + from itertools import chain + + class DeleteLooseVerts(SvScriptSimpleFunction): + inputs = [ + ('v', 'verts'), + ('s', 'pol') + ] + outputs = [ + ('v', 'verts'), + ('s', 'pol') + ] + + # delete loose verts + @staticmethod + def function(*args, **kwargs): + ve, pe = args + # find used indexes + v_index = sorted(set(chain.from_iterable(pe))) + # remap the vertices + v_out = [ve[i] for i in v_index] + # create a mapping from old to new vertices index + mapping = dict(((j, i) for i, j in enumerate(v_index))) + # apply mapping to input polygon index + p_out = [tuple(map(mapping.get, p)) for p in pe] + return v_out, p_out + + +Breakout Scripts +---------------- +Scripts that needs to access the node can do so via the ```self.node``` variable +that is automatically set. +:: + + class Breakout(SvScript): + def process(self): + pass + + def update(self): + node = self.node + node_group = self.node.id_data + # here you can do anything to the node or node group + # that real a real node could do including multisocket + # adaptive sockets etc. templates and examples for this are + # coming + + +Admit, you can call sockets data directly when using ```SvScript``` as ```self.node.inputs[0].sv_get()```. +And other ```self.node.``` operations possible from this class. + + +Techniques to improve Python performance +---------------------------------------- + +There are many ways to speed up python code. Some slowness will be down to +innefficient algorithm design, other slowness is caused purely by how much +processing is minimally required to solve a problem. A decent read regarding +general methods to improve python code performance can be found +on `python.org `_. +If you don't know where the cycles are being consumed, then you don't know +if your efforts to optimize will have any significant impact. + +Read these 5 rules by Rob Pike before any optimization. +http://users.ece.utexas.edu/~adnan/pike.html + +Limitations +----------- + +Most limitations are voided by increasing your Python and ``bpy`` skills. But +one should also realize what is approriate for a node script to do. + + +That's it for now. diff --git a/docs/nodes/generators_extended/script_mk2.rst b/docs/nodes/generators_extended/script_mk2.rst new file mode 100644 index 000000000..c6d496489 --- /dev/null +++ b/docs/nodes/generators_extended/script_mk2.rst @@ -0,0 +1,293 @@ +Scripted Node 2(Generator) +========================= + +aka Script Node MK2 + +- Introduction +- Features +- Structure +- Templates +- Conveniences +- Examples +- Techniques to improve Python performance +- Limitations + +Introduction +------------ + +When you want to express an idea in written form and the concept is suitable +for a one line Python expression then often you can use a Formula node. If you +need access to imports, classes, temporary variables, and functions then you can +write a script to load into Script Node 2. + +Script Node MK2 differs from Script Node iteratrion 1 in that offers more control. +It also has a prototype system where you could for example reuse the behavior of +a generator and the template takes care of all the details leaving you to focus +on the function. Scripts using the templates automatically becomes more powerful. + +It's a prototype so bug reports, questions and feature request are very welcome. + +Features +-------- + +allows: + +- Loading/Reloading scripts currently in TextEditor +- imports and aliasing, ie anything you can import from console works in SN2 +- nested functions and lambdas +- named inputs and outputs +- named operators (buttons to action something upon button press) + +Structure +--------- + +At present all scripts for SN2 must: + +- be subclasses SvScript +- include a function called process in the class +- have member attributes called ``inputs`` and ``outputs`` +- have one Script class per file, if more than one, last one found will be used + +**process(self)** + + +``process(self)`` is the main flow control function. It is called when all sockets +without defaults are connected. Usually the template provides a ``process`` function +for you. + +**inputs** + +Default can be a float or integer value, not other types are usable yet:: + + inputs = [ + [type, 'socket name on ui', default], + [type, 'socket name on ui2', default], + # ... + ] + + +**outputs** + +:: + + outputs = [ + [type, 'socket name on ui'], + [type, 'socket name on ui 2'], + # ... + ] + +**inputs and outputs** + +- Each *socket name on ui* string shall be unique. + +- **type** are currently limited to + + +---------+-------------------------------------+ + | type id | type data | + +=========+=====================================+ + | 's' | floats, ints, edges, faces, strings | + +---------+-------------------------------------+ + | 'v' | vertices, vectors, 3-tuples | + +---------+-------------------------------------+ + | 'm' | matrices, 4 x 4 nested lists | + +---------+-------------------------------------+ + +There are a series of names that have special meaning that scripts should +avoid as class attributes or only used for the intended meaning. To be described: + ``node`` ``draw_buttons`` ``update`` ``process`` ``enum_func`` ``inputs`` +``outputs`` + + +Templates +--------- + +Sverchok includes a series of examples for the different templates. + + +Conveniences +------------ + +We value our time, we are sure you do too, so features have been added to help speed up the +script creation process. + +**Text Editor** + +- can refresh the Script Node which currently loads that script by hitting ``Ctrl+Enter`` + +Main classes for your subclasses are: + + - ``SvScript`` + - ``SvScriptSimpleGenerator`` + - ``SvScriptSimpleFunction`` + +Limitations +----------- + +Using ``SvScriptSimpleGenerator`` and ``SvScriptSimpleFunction`` you limit inputs to deal with one object. +For plane, for example, you'll get next data: + + [(0.0, 0.0, 0.0), (1.0, 0.0, 0.0), (0.0, 1.0, 0.0), (1.0, 1.0, 0.0)] [(0, 1, 3, 2)] + +If you need Full support of Sverchok data - you'd better use ``SvScript`` +class and ``self.node.inputs[0].sv_get()`` function. + +Examples +-------- + +The best way to get familiarity with Script Node 2 is to go through the templates folder. +They are intended to be lightweight and educational, but some of them will show +advanced use cases. The images and animations on this `thread on github +`_. +may also provide some insight into what's possible. + +A typical nodescript using the ``SvScriptSimpleGenerator`` may look like this, note that +the third argument for outputs is specific to this template:: + + import numpy + import itertools + + class GridGen(SvScriptSimpleGenerator): + inputs = [("s", "Size", 10.0), + ("s", "Subdivs", 10)] + outputs = [("v", "verts", "make_verts"), + ("s", "edges", "make_edges")] + + @staticmethod + def make_verts(size, sub): + side = numpy.linspace(-size / 2, size / 2, sub) + return tuple((x, y, 0) for x, y in itertools.product(side, side)) + + @staticmethod + def make_edges(size, sub): + edges = [] + for i in range(sub): + for j in range(sub - 1): + edges.append((sub * i + j, sub * i + j + 1)) + edges.append((sub * j + i, sub * j + i + sub)) + return edges + + +Note that here the name of the method that should be called for producing data +for each socket in the final last arguments to ``outputs`` but we are not forced +to have all code inside the class, we can also do +:: + + def lorenz(N, verts, h, a, b, c): + add_vert = verts.append + + x0 = 0.1 + y0 = 0 + z0 = 0 + for i in range(N): + x1 = x0 + h * a * (y0 - x0) + y1 = y0 + h * (x0 * (b - z0) - y0) + z1 = z0 + h * (x0 * y0 - c * z0) + x0, y0, z0 = x1, y1, z1 + + add_vert((x1,y1,z1)) + + class LorenzAttractor(SvScriptSimpleGenerator): + + inputs = [ + ['s', 'N', 1000], + ['s', 'h', 0.01], + ['s', 'a', 10.0], + ['s', 'b', 28.0], + ['s', 'c', 8.0/3.0] + ] + + @staticmethod + def make_verts(N, h, a, b, c): + verts = [] + lorenz(N, verts, h, a, b, c) + return verts + + @staticmethod + def make_edges(N, h a, b, c: + edges = [(i, i+1) for i in range(N-1)] + return edges + + outputs = [ + ['v','verts', "make_verts"], + ['s','edges', "make_edges"] + ] + + +Here is a simple script for deleting loose vertices from mesh data, it also serves as an +illustration for a type of script that uses the ```SvScriptSimpleFunction``` template that +has one main function that decomposes into separate sockets. The methods don't have be static +but in general it is good practice to keep them free from side effects. +:: + + from itertools import chain + + class DeleteLooseVerts(SvScriptSimpleFunction): + inputs = [ + ('v', 'verts'), + ('s', 'pol') + ] + outputs = [ + ('v', 'verts'), + ('s', 'pol') + ] + + # delete loose verts + @staticmethod + def function(*args, **kwargs): + ve, pe = args + # find used indexes + v_index = sorted(set(chain.from_iterable(pe))) + # remap the vertices + v_out = [ve[i] for i in v_index] + # create a mapping from old to new vertices index + mapping = dict(((j, i) for i, j in enumerate(v_index))) + # apply mapping to input polygon index + p_out = [tuple(map(mapping.get, p)) for p in pe] + return v_out, p_out + + +Breakout Scripts +---------------- +Scripts that needs to access the node can do so via the ```self.node``` variable +that is automatically set. +:: + + class Breakout(SvScript): + def process(self): + pass + + def update(self): + node = self.node + node_group = self.node.id_data + # here you can do anything to the node or node group + # that real a real node could do including multisocket + # adaptive sockets etc. templates and examples for this are + # coming + + +Admit, you can call sockets data directly when using ```SvScript``` as ```self.node.inputs[0].sv_get()```. +And other ```self.node.``` operations possible from this class. + + +Techniques to improve Python performance +---------------------------------------- + +There are many ways to speed up python code. Some slowness will be down to +innefficient algorithm design, other slowness is caused purely by how much +processing is minimally required to solve a problem. A decent read regarding +general methods to improve python code performance can be found +on `python.org `_. +If you don't know where the cycles are being consumed, then you don't know +if your efforts to optimize will have any significant impact. + +Read these 5 rules by Rob Pike before any optimization. +http://users.ece.utexas.edu/~adnan/pike.html + +Limitations +----------- + +Most limitations are voided by increasing your Python and ``bpy`` skills. But +one should also realize what is approriate for a node script to do. + + +That's it for now. diff --git a/docs/nodes/generators_extended/scripted_intro.rst b/docs/nodes/generators_extended/scripted_intro.rst new file mode 100644 index 000000000..24bcd7d1e --- /dev/null +++ b/docs/nodes/generators_extended/scripted_intro.rst @@ -0,0 +1,126 @@ +.. _scripted-tutorial: + +An introduction and tutorial for the Scripted Nodes +=================================================== + +> Dealga Mcardle | 2014 | October + +In my opinion new users should avoid the Script Nodes until they understand a majority of the existing nodes and the Sverchok `Eco-system` as a concept. This suggestion applies to everyone, even competent coders. + +Script Nodes are great when you want to encapsulate a behaviour which may not be easy to achieve with existing nodes alone. They are my prefered way to either 1) prototype code, or 2) write custom nodes that are too specific to be submitted as regular nodes. + +At the moment Sverchok has 2 Scripted Node implementations: SN and SN2. Exactly how they differ from eachother will be shown later. Both offer `practical shorthand` ways to define what a node does, which sliders and sane defaults it might have, and what socket types can connect to it. These scripts have a minimal interface, are stored inside the `.blend` file as plain text python, and can be shared easily. + +If you've ever written code for a Blender addon or script, you will be familiar with registration of classes. Nodes normally also need to be registered so Blender can find them, but Script Nodes don't because they are in essence a shell for your code -- and the shell is already registered, all you have to do is write code to process input into output. + +Scripted Node 1 -- an informal introduction +------------------------------------------- + +Here is a classic 'Hello World' style example used to demonstrate graphics coding. It's called a Lorenz Attractor. :: + + + def lorenz(N, verts): + add_vert = verts.append + h = 0.01 + a = 10.0 + b = 28.0 + c = 8.0 / 3.0 + + x0 = 0.1 + y0 = 0 + z0 = 0 + for i in range(N): + x1 = x0 + h * a * (y0 - x0) + y1 = y0 + h * (x0 * (b - z0) - y0) + z1 = z0 + h * (x0 * y0 - c * z0) + x0, y0, z0 = x1, y1, z1 + + add_vert((x1,y1,z1)) + + def sv_main(N=1000): + + verts = [] + in_sockets = [['s', 'N', N]] + out_sockets = [['v','verts', [verts]]] + + lorenz(N, verts) + return in_sockets, out_sockets + + +Here's what this code produces. + +.. image:: https://cloud.githubusercontent.com/assets/619340/5219883/5d3e1252-765d-11e4-87e8-56e1eef2d5ae.png + +Infact, here's the Node Interface that the script produces too + +.. image:: https://cloud.githubusercontent.com/assets/619340/5219902/a310c824-765d-11e4-9836-c34cb0d8a7b4.png + +Compare the code with the image of the node and you might get a fair idea where the sockets are defined and where the default comes from. Look carefully at +``in_sockets`` and ``out_sockets``, two of the elements are strings (socket type and socket name), and the third element is the Python variable that we automatically bind to those sockets. + +Brief Guided Explanation +------------------------- + +You've probably got a fair idea already from the example script. SN1 has a few conventions which let you quickly define sockets and defaults. What follows are short remarks about the elements that make up these scripts, aimed at someone who is about to write their first script for SN1. + +Sockets +------- + +Sverchok at present has 3 main socket types: VerticesSocket, StringsSocket and MatrixSocket. Script Nodes refer to these socket types with only their first letter in lowercase. 's','v','m':: + + 's' to hold: floats, ints, edges, faces, strings + 'v' to hold: vertices, vectors, 3-tuples + 'm' to hold: matrices, 4 x 4 nested lists + + +Socket Names +------------ + +Each socket has a name. Take a minute to think about a good descriptive name for each. Socket names can always be changed later, but my advice is to use clear names from the very beginning. + +Variable names +-------------- + +Variable names are used to expose the values of the associated socket to your script. If the socket is unconnected then the value of the variable will be taken from the specified default. + +node function `(sv_main)` +------------------------- + +The main function for SN1 is ``sv_main``, in the body of this function is where we declare socket types, socket names, and variable names for input and output sockets. These are declared in two arrays ``in_sockets`` and ``out_sockets``. + +The argument list of ``sv_main`` is where you provide defaults values or the nestedness of an incoming datatype. (don't worry if this makes no sense, read it again later). + +That's great, show me! +---------------------- + +The easiest way to get started is to first load an existing script. Here are some steps: + +- Go to `Generators / Scripted Node` and add it to the NodeView. +- Open a Blender TextEditor window so you can see the TextEditor and the NodeView at the same time. +- Paste the Lorenz Attractor script (from above) into the TextEditor and call it 'attractor.py' +- In NodeView look at the field on the second row of the Scripted Node. This is a file selector which shows all Text files in blender. When you click on it you will see "attractor.py" +- Select "attractor.py" press the button the right, the one that looks like a powersocket. +- This changes the way the Node appears. The node will now have 1 input socket and one output socket. It might even have changed to a light blue. + +That's pretty much all there is to loading a script. All you do now is hook the output Verts to a Viewer Node and you'll see a classic Lorenz Attractor point set. + +Study the sv_main +----------------- + +If you look carefully in ``sv_main`` there's not a lot to the whole process. ``sv_main`` has two **required** lists; ``in_sockets`` and ``out_sockets``. sv_main also has a argument list which you must fill with defaults, here the only variable is N so the argument list was ``sv_main(N=1000)``. + +The lorenz function takes 2 arguments: + +- **N**, to set the number of vertices. +- **verts**, a list-variable to store the vertices generated by the algorithm. + +In this example the ``verts`` variable is also what will be sent to the output socket, because it says so in ``out_sockets``. Notice that the lorenz function doesn't return the verts variable. All the lorenz function does is fill that list with values. Just to be clear about this example. At the time ``sv_main`` ends, the content of ``verts`` is full, but before ``lorenz()`` is called, ``verts`` is an empty list. + +Here is the same lorenz attractor with more parameters exposed, see can you load it? +https://github.com/nortikin/sverchok/blob/master/node_scripts/templates/zeffii/LorenzAttractor2.py + +Lastly +------ + +If none of this makes sense, spend time learning about Python and dig through the ``node_scripts/templates`` directory. + diff --git a/docs/nodes/list_main/decompose.rst b/docs/nodes/list_main/decompose.rst new file mode 100644 index 000000000..0e505db22 --- /dev/null +++ b/docs/nodes/list_main/decompose.rst @@ -0,0 +1,39 @@ +List Decompose +============== + +Functionality +------------- + +Inverse to list join node. Separate list at some level of data to several sockets. Sockets count the same as items count in exact level. + +Inputs +------ + +- **data** - adaptable socket + +Parameters +---------- + ++----------------+---------------+-------------+----------------------------------------------------------+ +| Parameter | Type | Default | Description | ++================+===============+=============+==========================================================+ +| **level** | Int | 1 | Level of data to operate. | ++----------------+---------------+-------------+----------------------------------------------------------+ +| **Count** | Int | 1 | Output sockets' count. defined manually or with Auto set | ++----------------+---------------+-------------+----------------------------------------------------------+ +| **Auto set** | Button | | Calculate output sockets' count based on data count on | +| | | | choosen level | ++----------------+---------------+-------------+----------------------------------------------------------+ + +Outputs +------- + +- **data** - multisocket + + +Example of usage +---------------- + +Decomposed simple list in 2 level: + +.. image:: https://cloud.githubusercontent.com/assets/5783432/18610849/4b14c4fc-7d38-11e6-90ac-6dcad29b0a7d.png diff --git a/docs/nodes/list_main/func.rst b/docs/nodes/list_main/func.rst new file mode 100644 index 000000000..985d1f2c3 --- /dev/null +++ b/docs/nodes/list_main/func.rst @@ -0,0 +1,41 @@ +List Math +========= + +Functionality +------------- + +This nodes offers some operations to make over list, meaning a group of numbers. + +Inputs +------ + +It will operate only with list of single numbers, not tuples or vectors. + +Parameters +---------- + +**Level:** Set the level at which to observe the List. +**Function:** Select the type of operation. + +=================== ====================================== +Tables description +=================== ====================================== +Sum sum of all the elements of the list +Average average of element at selected level +Maximum Maximum value of the list +Minimum Minimum value of the list + +Outputs +------- + +The output is always going to be a number, integer or float, depending on the input list. + +* You can try to use this node with vectors, but it isn't going to work properly. For operations with vectors you should use **Vector Math** node. + +Examples +-------- + +.. image:: https://cloud.githubusercontent.com/assets/5990821/4191546/dd4edc6e-378e-11e4-8015-8f66ec59b68e.png + :alt: ListMathDemo1.PNG + +In this example the node shows all the possible outputs. \ No newline at end of file diff --git a/docs/nodes/list_main/join.rst b/docs/nodes/list_main/join.rst new file mode 100644 index 000000000..e1a32aac2 --- /dev/null +++ b/docs/nodes/list_main/join.rst @@ -0,0 +1,46 @@ +List Join +========= + +Functionality +------------- + +level 1: +[ [ (1,2,3), (4,5,6) ] ] + [ [ (7,8,9), (10,11,12) ] ] = [ [ (1,2,3), (4,5,6), (7,8,9), (10,11,12) ] ] + +level 2 mix: +[ [ (1,2,3), (4,5,6) ] ] + [ [ (7,8,9), (10,11,12) ] ] = [ [ (1,2,3),(7,8,9),(4,5,6),(10,11,12) ] ] + +level 2 wrap: +[ [ (1,2,3), (4,5,6) ] ] + [ [ (7,8,9), (10,11,12) ] ] = [ [ [ (1,2,3),(4,5,6) ], [ (7,8,9),(10,11,12) ] ] ] + +level 2 mix + wrap: +[ [ (1,2,3), (4,5,6) ] ] + [ [ (7,8,9), (10,11,12) ] ] = [ [ [ (1,2,3),(7,8,9) ], [ (4,5,6),(10,11,12) ] ] ] + +level 3: +[ [ (1,2,3), (4,5,6) ] ] + [ [ (7,8,9), (10,11,12) ] ] = [ [ [1,2,3,4,5,6,7,8,9,10,11,12] ] ] + +level 3 mix: +[ [ (1,2,3), (4,5,6) ] ] + [ [ (7,8,9), (10,11,12) ] ] = [ [ [1,7,2,8,3,9,4,10,5,11,6,12] ] ] + +level 3 wrap: +[ [ (1,2,3), (4,5,6) ] ] + [ [ (7,8,9), (10,11,12) ] ] = [ [ [1,2,3,4,5,6],[7,8,9,10,11,12] ] ] + +level 3 mix + wrap: +[ [ (1,2,3), (4,5,6) ] ] + [ [ (7,8,9), (10,11,12) ] ] = [ [ [1,7],[2,8],[3,9],[4,10],[5,11],[6,12] ] ] + +Inputs +------ + +**data** multisocket + +Parameters +---------- + +**mix** to mix (not zip) data inside +**wrap** to wrap additional level +**levels** level of joining + +Outputs +------- + +**data** adaptable socket diff --git a/docs/nodes/list_main/length.rst b/docs/nodes/list_main/length.rst new file mode 100644 index 000000000..ef145ebea --- /dev/null +++ b/docs/nodes/list_main/length.rst @@ -0,0 +1,34 @@ +List Length +=========== + +Functionality +------------- + +The Node equivalent of the Python ``len()`` function. The length is inspected at the Level needed. + +Inputs +------ + +Takes any kind of data. + +Parameters +---------- + +**Level:** Set the level at which to observe the List. + +Outputs +------- + +Depends on incoming data and can be nested. Level 0 is top level (totally zoomed out), higher levels get more granular (zooming in) until no higher level is found (atomic). The length of the most atomic level will be 1, for instance single ints or float or characters. The output will reflect the nestedness of the incoming data. + + +Examples +-------- + +Often a few experiments with input hooked-up to a debug node will make the exact working of this Node instantly clearer than any explanation. + +.. image:: https://cloud.githubusercontent.com/assets/619340/4186453/1a375026-3761-11e4-8e41-11b57736be1a.PNG + :alt: ListLengthDemo1.PNG + +.. image:: https://cloud.githubusercontent.com/assets/619340/4186454/1a3de7b0-3761-11e4-9520-79b331ad6822.PNG + :alt: ListLengthDemo2.PNG \ No newline at end of file diff --git a/docs/nodes/list_main/levels.rst b/docs/nodes/list_main/levels.rst new file mode 100644 index 000000000..54fd57328 --- /dev/null +++ b/docs/nodes/list_main/levels.rst @@ -0,0 +1,55 @@ +List Delete Levels +================== + +Functionality +------------- + +This helps flatten lists, or make them less nested. + +The analogy to keep in mind might be: + +.. pull-quote:: + knocking through walls in a house to join two spaces, or knock non load bearing walls between buildings to join them. + +Incoming nested lists can be made less nested. + +.. code-block:: python + + # del level 0, remove outer wrapping + + [[0,1,2,3,4]] + >>> [0,1,2,3,4] + + [[4, 5, 6], [4, 7, 10], [4, 9, 14]] + >>> [4, 5, 6, 4, 7, 10, 4, 9, 14] + + [[5], [5], [5], [5], [5], [5]] + >>> [5, 5, 5, 5, 5, 5] + + +Throughput +---------- + +====== ================================================= +Socket Description +====== ================================================= +Input Any meaningful input, lists, nested lists +Output Modified according to Levels parameter, or None +====== ================================================= + + +Parameters +---------- + +Levels, this text field + + +Examples +-------- + +.. image:: https://cloud.githubusercontent.com/assets/619340/4198552/851ac6f4-37fa-11e4-9c8e-4715ded8c717.PNG + :alt: delete_levels_demo1 + + +Notes +----- \ No newline at end of file diff --git a/docs/nodes/list_main/match.rst b/docs/nodes/list_main/match.rst new file mode 100644 index 000000000..8d0f245bf --- /dev/null +++ b/docs/nodes/list_main/match.rst @@ -0,0 +1,2 @@ +List Match +========== \ No newline at end of file diff --git a/docs/nodes/list_main/sum_mk2.rst b/docs/nodes/list_main/sum_mk2.rst new file mode 100644 index 000000000..56b02f3a2 --- /dev/null +++ b/docs/nodes/list_main/sum_mk2.rst @@ -0,0 +1,24 @@ +List Summa +========== + +Functionality +------------- + +This node operates the sum of all the values in the inputs, no matter the levels or sublist inside the input. + +Inputs +------ + +Takes any kind of data: singles values, vectors or even matrixes. + +Outputs +------- + +No matter the type of input, the output will be the sum of all the values in the input list. +This node works in a different way of the "Sum" function in **List Math** node. See the example below to see the difference. + +Examples +-------- + +.. image:: https://cloud.githubusercontent.com/assets/5990821/4200340/20740696-3810-11e4-8e2d-8397e801b644.png + :alt: ListSummaDemo1.PNG \ No newline at end of file diff --git a/docs/nodes/list_main/zip.rst b/docs/nodes/list_main/zip.rst new file mode 100644 index 000000000..7b3bccdc3 --- /dev/null +++ b/docs/nodes/list_main/zip.rst @@ -0,0 +1,35 @@ +List Zip +======== + +Functionality +------------- + +Making pares of data to mix togather as zip function. + +x = [[[1,2],[3,4]]] +y = [[[5,6],[7,8]]] + + +out level 1 = [[[[1, 2], [5, 6]], [[3, 4], [7, 8]]]] +out level 1 unwrap = [[[1, 2], [5, 6]], [[3, 4], [7, 8]]] +out level 2 = [[[[1, 3], [2, 4]], [[5, 7], [6, 8]]]] +out level 2 unwrap = [[[1, 3], [2, 4]], [[5, 7], [6, 8]]] +out level 3 = [[[[], []], [[], []]]] + +Inputs +------ + +**data** multysocket + +Properties +---------- + +**level** integer to operate level of conjunction +**unwrap** boolean to unwrap from additional level, added when zipped + +Outputs +------- + +**data** adaptable socket + + diff --git a/docs/nodes/list_masks/mask.rst b/docs/nodes/list_masks/mask.rst new file mode 100644 index 000000000..3ff71b4e1 --- /dev/null +++ b/docs/nodes/list_masks/mask.rst @@ -0,0 +1,2 @@ +List Mask Out +============= \ No newline at end of file diff --git a/docs/nodes/list_masks/mask_join.rst b/docs/nodes/list_masks/mask_join.rst new file mode 100644 index 000000000..e5181865f --- /dev/null +++ b/docs/nodes/list_masks/mask_join.rst @@ -0,0 +1,48 @@ +List Mask In +============ + +Functionality +------------- + +This node use the mask list i.e. 1,0,0,0 as switch to mix two data list together. + +**0** means false, an item from the **Data False** will be appended to the output data; + +**1** will be considered as true (actually any value that evaluate as true in python), an item from the **Data True** will be appended to the output data. If the mask list is not long enough to cover all the inputs, it will be repeated as the mask for the rest of inputs. + +Length of mask list affect output because every item (without Choice activated) corresponding to Inputs several times. + +The main design reason behind this node is to be able to conditionally apply operations to one a masked list, for example select vertices based on location and move them or as shown below, select numbers and negate them. + +Inputs +------ + +**Mask:** Input socket for mask list. + +**Data True:** Input socket for True Data list. + +**Data False:** Input socket for False Data list. + + + +Parameters +---------- + +**Level:** Set the level at which the items to be masked. + +**Choise:** Make length of out list the same as length of input list + + +Outputs +------- + +**Data:** Mixed data of the incoming data, the length of Outputs depends on the **Data True** and **Data False** list length. + +Example +------- + +.. image:: https://cloud.githubusercontent.com/assets/5409756/11457323/e7af5960-96e0-11e5-86e0-a9401f5e059e.png + :alt: ListMaskDemo.PNG + +.. image:: https://cloud.githubusercontent.com/assets/6241382/11584560/2604eebe-9a65-11e5-9aff-8eb123167a6a.png + :alt: Masked apply diff --git a/docs/nodes/list_mutators/modifier.rst b/docs/nodes/list_mutators/modifier.rst new file mode 100644 index 000000000..cf9018bd9 --- /dev/null +++ b/docs/nodes/list_mutators/modifier.rst @@ -0,0 +1,101 @@ +List Modifier +============= + +This node offers an assortment of list modification functions. The node has both Unary and Binary modes. + +- In Unary mode it will use the input of either sockets, it will use data1 first, then check data2 +- If both are linked data1 is used. +- The node will draw the name of the current mode into the node header, useful for minimized nodes. + +Behaviour +--------- + ++----------------------+----------+--------------------------------------------------------------------------+ +| Modes | inputs | Behaviour Description | ++======================+==========+==========================================================================+ +| Set | unary | turns the valid input into a set :: | +| | | | +| | | input = [0,0,0,1,1,1,3,3,3,5,5,5,6,7,8,4,4,4,6,6,6,7,7,7,8] | +| | | output = [set(input)] | +| | | | ++----------------------+----------+--------------------------------------------------------------------------+ +| Ordered Set by input | unary | only unique numbers but ordered by the original input sequence :: | +| | | | +| | | input = [0,0,0,1,1,1,3,3,3,5,5,5,6,7,8,4,4,4,6,6,6,7,7,7,8] | +| | | output = [0,1,3,5,6,7,8,4] | +| | | | ++----------------------+----------+--------------------------------------------------------------------------+ +| Unique Consecutives | unary | no consecutive repeats :: | +| | | | +| | | input = [0,0,0,1,1,1,3,3,3,5,5,5,6,7,8,4,4,4,6,6,6,7,7,7,8] | +| | | output = [0,1,3,5,6,7,8,4,6,7,8] | +| | | | ++----------------------+----------+--------------------------------------------------------------------------+ +| Sequential Set | unary | unique input values, ordered by their value :: | +| | | | +| | | input = [0,0,0,1,1,1,3,3,3,5,5,5,6,7,8,4,4,4,6,6,6,7,7,7,8] | +| | | output = [0,1,3,4,5,6,7,8] | +| | | | ++----------------------+----------+--------------------------------------------------------------------------+ +| Sequential Set Rev | unary | unique input values, ordered by their value, reversed :: | +| | | | +| | | input = [0,0,0,1,1,1,3,3,3,5,5,5,6,7,8,4,4,4,6,6,6,7,7,7,8] | +| | | output = [8,7,6,5,4,3,1,0] | +| | | | ++----------------------+----------+--------------------------------------------------------------------------+ +| Normalize | unary | scales down the values in the list to the range ``-1.0 .. 1.0`` | ++----------------------+----------+--------------------------------------------------------------------------+ +| Accumulating Sum | unary | see ``itertools.accumulate`` :: | +| | | | +| | | input = list(accumulate(range(10))) | +| | | output = [0,1,3,6,10,15,21,28,36,45] | +| | | | ++----------------------+----------+--------------------------------------------------------------------------+ +| Mask Subset | binary | generates a mask to indicate for each value in A whether it appears in B | +| | | :: | +| | | | +| | | A = [0,1,2,3,4,5,6,7] | +| | | B = [2,3,4,5] | +| | | output = [False, False, True, True, True, True, False, False] | +| | | | ++----------------------+----------+--------------------------------------------------------------------------+ +| Intersection | binary | returns the set of items that appear in both A and B | +| | | | +| | | |image1| | +| | | | ++----------------------+----------+--------------------------------------------------------------------------+ +| Union | binary | returns the set of items A joined with B | +| | | | +| | | |image2| | +| | | | ++----------------------+----------+--------------------------------------------------------------------------+ +| Difference | binary | returns the set of items from A that don’t appear in B | +| | | | +| | | |image3| | +| | | | ++----------------------+----------+--------------------------------------------------------------------------+ +| Symmetric Diff | binary | returns the set of elements of A and B that don’t appear in Both | +| | | | +| | | |image4| | +| | | | ++----------------------+----------+--------------------------------------------------------------------------+ + +*output as list* + +The boolean switch to *output as list* will be on by default, +essentially it will wrap the output as a list because true sets don’t +have a defined order (which we do need most of the time). + +Example +------- + +See the pullrequest for details : https://github.com/nortikin/sverchok/pull/884 + +also see the original thread : https://github.com/nortikin/sverchok/issues/865 + + + +.. |image1| image:: https://cloud.githubusercontent.com/assets/619340/18662881/733c219c-7f1c-11e6-85fc-fcfc1ea7768d.png +.. |image2| image:: https://cloud.githubusercontent.com/assets/619340/18662921/a24aac7e-7f1c-11e6-80c1-684e513607a2.png +.. |image3| image:: https://cloud.githubusercontent.com/assets/619340/18663232/ec821d80-7f1d-11e6-83bc-3fd64ff037b4.png +.. |image4| image:: https://cloud.githubusercontent.com/assets/619340/18662983/f252aeba-7f1c-11e6-963b-e2b7d7111e17.png \ No newline at end of file diff --git a/docs/nodes/list_struct/flip.rst b/docs/nodes/list_struct/flip.rst new file mode 100644 index 000000000..905fb28ee --- /dev/null +++ b/docs/nodes/list_struct/flip.rst @@ -0,0 +1,37 @@ +List Flip +========= + +Functionality +------------- + +Flips the data on selected level. +[[[1,2,3],[4,5,6],[7,8,9]],[[3,3,3],[1,1,1],[8,8,8]]] (two objects, three vertices) +with level 2 turns to: +[[[1, 2, 3], [3, 3, 3]], [[4, 5, 6], [1, 1, 1]], [[7, 8, 9], [8, 8, 8]]] (three objects, two vertices) +with level 3 turns to: +[[1, 4, 7], [2, 5, 8], [3, 6, 9], [3, 1, 8], [3, 1, 8], [3, 1, 8]] (six objects with three digits) + +last example is not straight result, more as deviation. +Ideally Flip has to work with preserving data levels and with respect to other levels structure. +But for now working level is 2 + +Inputs +------ + +**data** - data to flip + +Properties +---------- + +**level** - level to deal with + +Outputs +------- + +**data** - flipped data + +Examples +-------- + +.. image:: https://cloud.githubusercontent.com/assets/5783432/5603155/cd1cc280-9386-11e4-9998-a066258ca94b.jpg + :alt: flip \ No newline at end of file diff --git a/docs/nodes/list_struct/item.rst b/docs/nodes/list_struct/item.rst new file mode 100644 index 000000000..6462c186a --- /dev/null +++ b/docs/nodes/list_struct/item.rst @@ -0,0 +1,41 @@ +List Item +========= + +Functionality +------------- + +Select items from list based on index. The node is *data type agnostic*, meaning it makes no assumptions about the data you feed it. It shoudld accepts any type of data native to Sverchok.. + +Inputs +------ + ++--------+--------------------------------------------------------------------------+ +| Input | Description | ++========+==========================================================================+ +| Data | The data - can be anything | ++--------+--------------------------------------------------------------------------+ +| item | Item(s) to select, allows negative index python index | ++--------+--------------------------------------------------------------------------+ + +Parameters +---------- + + +**Level** + +It is essentially how many chained element look-ups you do on a list. If ``SomeList`` has a considerable *nestedness* then you might access the most atomic element of the list doing ``SomeList[0][0][0][0]``. Levels in this case would be 4. + +**item** + +A list of items to select, allow negative index python indexing so that -1 the last element. The items doesn't have to be in order and a single item can be selected more than a single time. + +Outputs +------- + +Item, the selected items on the specifed level. +Other, the list with the selected items deleted. + +Examples +-------- + +Trying various inputs, adjusting the parameters, and piping the output to a *Debug Print* (or stethoscope) node will be the fastest way to acquaint yourself with the inner workings of the *List Item* Node. diff --git a/docs/nodes/list_struct/repeater.rst b/docs/nodes/list_struct/repeater.rst new file mode 100644 index 000000000..3e1abca9d --- /dev/null +++ b/docs/nodes/list_struct/repeater.rst @@ -0,0 +1,47 @@ +List Repeater +============= + +Functionality +------------- + +Allows explicit repeat of lists and elements. The node is *data type agnostic*, meaning it makes no assumptions about the data you feed it. It shoudld accepts any type of data native to Sverchok.. + +Inputs +------ + ++--------+--------------------------------------------------------------------------+ +| Input | Description | ++========+==========================================================================+ +| Data | The data - can be anything | ++--------+--------------------------------------------------------------------------+ +| Number | The amount of times to repeat elements selected by the `Level` parameter | ++--------+--------------------------------------------------------------------------+ + +Parameters +---------- + +Level and unwrap. + +**Level** + +It is essentially how many chained element look-ups you do on a list. If ``SomeList`` has a considerable *nestedness* then you might access the most atomic element of the list doing ``SomeList[0][0][0][0]``. Levels in this case would be 4. + +**unwrap** + +Removes any extra layers of wrapping (brackets or parentheses) found at the current Level. If the element pointed at is ``[[0,2,3,2]]`` it will become ``[0,2,3,2]``. + + +Outputs +------- + +Lists (nested). The type of *Data out* will be appropriate for the operations defined by the parameters of the Node. + +Examples +-------- + +Trying various inputs, adjusting the parameters, and piping the output to a *Debug Print* (or stethoscope) node will be the fastest way to acquaint yourself with the inner workings of the *List Repeater* Node. + +A practical reason to use the node is when you need a series of copies of edge or polygon lists. Usually in conjunction with `Matrix Apply`, which outputs a series of `vertex lists` as a result of transform parameters. + +.. image:: https://cloud.githubusercontent.com/assets/619340/4186432/efb79892-3760-11e4-9d17-5c7a7a22d9d9.PNG + :alt: ListRepeater_Demo1.PNG \ No newline at end of file diff --git a/docs/nodes/list_struct/shift_mk2.rst b/docs/nodes/list_struct/shift_mk2.rst new file mode 100644 index 000000000..468e06806 --- /dev/null +++ b/docs/nodes/list_struct/shift_mk2.rst @@ -0,0 +1,35 @@ +List Shift +========== + +Functionality +------------- + +Shifting data in selected level on selected integer value as: + + [0,1,2,3,4,5,6,7,8,9] with shift integer 4 will be + [4,5,6,7,8,9] + But with enclose flag: + [4,5,6,7,8,9,0,1,2,3] + +Inputs +------ + +**data** - list of data any type to shift +**Shift** - value that defines shift + +Properties +---------- + +**level** - manipulation level, 0 - is objects shifting +**enclose** - close data when shifting, that way ending cutted numbers turns to beginning + +Outputs +------- + +**data** - shifter data, adaptive socket + +Examples +-------- + +.. image:: https://cloud.githubusercontent.com/assets/5783432/5603102/bec2bc6e-9384-11e4-9e4a-905da01b7ac1.gif + :alt: shift \ No newline at end of file diff --git a/docs/nodes/list_struct/shuffle.rst b/docs/nodes/list_struct/shuffle.rst new file mode 100644 index 000000000..41dcf11bb --- /dev/null +++ b/docs/nodes/list_struct/shuffle.rst @@ -0,0 +1,45 @@ +List Shuffle +============ + +Functionality +------------- + +Shuffle (randomize) the order of input lists. + +Inputs +------ + ++--------+--------------------------------------------------------------------------+ +| Input | Description | ++========+==========================================================================+ +| Data | The data - can be anything | ++--------+--------------------------------------------------------------------------+ +| Seed | Seed setting used by shuffle operation | ++--------+--------------------------------------------------------------------------+ + +Parameters +---------- + + +**Level** + +It is essentially how many chained element look-ups you do on a list. If ``SomeList`` has a considerable *nestedness* then you might access the most atomic element of the list doing ``SomeList[0][0][0][0]``. Levels in this case would be 4. + +**Seed** + +Affects the output order. + + +Outputs +------- + +Item, the selected items on the specified level. +Other, the list with the selected items deleted. + +Examples +-------- + + +The shuffle operation is based on the python random.shuffle. https://docs.python.org/3.4/library/random.html?highlight=shuffle#random.shuffle + +Trying various inputs, adjusting the parameters, and piping the output to a *Debug Print* (or stethoscope) node will be the fastest way to acquaint yourself with the inner workings of the *List Shuffle* Node. diff --git a/docs/nodes/list_struct/slice.rst b/docs/nodes/list_struct/slice.rst new file mode 100644 index 000000000..651ec4305 --- /dev/null +++ b/docs/nodes/list_struct/slice.rst @@ -0,0 +1,64 @@ +List Slice +========== +Functionality +------------- + +Select a slice from a list. The node is *data type agnostic*, meaning it makes no assumptions about the data you feed it. It shoudld accepts any type of data native to Sverchok.. +Functionality is a subset of python list slicing, the stride parameter functionality isn't implemented. + +Inputs +------ + ++--------+--------------------------------------------------------------------------+ +| Input | Description | ++========+==========================================================================+ +| Data | The data - can be anything | ++--------+--------------------------------------------------------------------------+ +| Start | Slice start, allows negative python index | ++--------+--------------------------------------------------------------------------+ +| Stop | Slice stop, allows negative python index | ++--------+--------------------------------------------------------------------------+ + +Parameters +---------- + +**Level** + +It is essentially how many chained element look-ups you do on a list. If ``SomeList`` has a considerable *nestedness* then you might access the most atomic element of the list doing ``SomeList[0][0][0][0]``. Levels in this case would be 4. + +**Start** + +Start point for the slice + +**Stop** + +Stop point for the slice. + +Outputs +------- + +Slice, the selected slices. +Other, the list with the slices removed. + +Examples +-------- + +Trying various inputs, adjusting the parameters, and piping the output to a *Debug Print* (or stethoscope) node will be the fastest way to acquaint yourself with the inner workings of the *List Item* Node. + +Some slice examples. +>>> l +[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] +>>> l[1:-1] +[1, 2, 3, 4, 5, 6, 7, 8] +>>> l[0:2] +[0, 1] +>>> l[-1:2] +[] + +.. image:: https://cloud.githubusercontent.com/assets/5783432/5229789/771e02b8-7725-11e4-8970-ac33c87f55ec.png + :alt: slice multiple objects from one list (may be many objects also) + +Notes +----- + + diff --git a/docs/nodes/list_struct/sort_mk2.rst b/docs/nodes/list_struct/sort_mk2.rst new file mode 100644 index 000000000..2a5f003da --- /dev/null +++ b/docs/nodes/list_struct/sort_mk2.rst @@ -0,0 +1,31 @@ +List Sort +========= + +Functionality +------------- + +Sort items from list based on index. It should accept any type of data from Sverchok: Vertices, Strings (Edges, Polygons) or Matrix. + +Inputs +------ + +Takes any kind of data. + +Parameters +---------- + + +**Level:** Set the level at which to observe the List. + +Outputs +------- + +Depends on incoming data and can be nested. Level 0 is top level (totally zoomed out), higher levels get more granular (zooming in) until no higher level is found (atomic). The node will just reverse the data at the level selected. + +Examples +-------- + +.. image:: https://cloud.githubusercontent.com/assets/5990821/4190847/0979eeba-3789-11e4-9e51-7ca4c532c418.png + :alt: ListSortDemo1.PNG + +In this example the node sort a list a integers previously shuffled. \ No newline at end of file diff --git a/docs/nodes/list_struct/split.rst b/docs/nodes/list_struct/split.rst new file mode 100644 index 000000000..c4665bfcb --- /dev/null +++ b/docs/nodes/list_struct/split.rst @@ -0,0 +1,53 @@ +List Split +========== +Functionality +------------- + +Split list into chuncks. The node is *data type agnostic*, meaning it makes no assumptions about the data you feed it. It shoudld accepts any type of data native to Sverchok. + +Inputs +------ + ++--------------+---------------------------------------------------+ +| Input | Description | ++==============+===================================================+ +| Data | The data - can be anything | ++--------------+---------------------------------------------------+ +| Split size | Size of individual chuncks | ++--------------+---------------------------------------------------+ + +Parameters +---------- + + +**Level** + +It is essentially how many chained element look-ups you do on a list. If ``SomeList`` has a considerable *nestedness* then you might access the most atomic element of the list doing ``SomeList[0][0][0][0]``. Levels in this case would be 4. + +**unwrap** + +Unrwap the list if possible, this generally what you want. +[[1, 2, 3, 4]] size 2. ++--------+-------------------+ +| Unwrap | Result | ++========+===================+ +| On | [[1, 2], [3, 4]] | ++--------+-------------------+ +| Off | [[[1, 2], [3, 4]]]| ++--------+-------------------+ + +**Split size** + +Size of output chuncks. + +Outputs +------- + +**Split** + +The list split on the selected level into chuncks, the last chunck will be what is left over. + +Examples +-------- + +Trying various inputs, adjusting the parameters, and piping the output to a *Debug Print* (or stethoscope) node will be the fastest way to acquaint yourself with the inner workings of the *List Item* Node. diff --git a/docs/nodes/list_struct/start_end.rst b/docs/nodes/list_struct/start_end.rst new file mode 100644 index 000000000..1379f9ecd --- /dev/null +++ b/docs/nodes/list_struct/start_end.rst @@ -0,0 +1,30 @@ +List First & Last +================= + +Functionality +------------- + +First and last items of data on some level + +Inputs +------ + +**Data** - data to take items + +Properties +---------- + +**level** - leve to take first and last items + +Outputs +------- + +**Middl** - all between first and last items +**First** - First item +**Last** - Last item + +Examples +-------- + +.. image:: https://cloud.githubusercontent.com/assets/5783432/5603173/c487d550-9387-11e4-8b3e-f45c2250048b.jpg + :alt: First-Last \ No newline at end of file diff --git a/docs/nodes/modifier_change/edges_intersect.rst b/docs/nodes/modifier_change/edges_intersect.rst new file mode 100644 index 000000000..787cd97ec --- /dev/null +++ b/docs/nodes/modifier_change/edges_intersect.rst @@ -0,0 +1,42 @@ +Intersect Edges +=============== + +Functionality +------------- + +The code is straight out of TinyCAD plugin's XALL operator, which is part of Blender Contrib distributions. + +It operates on Edge based geometry only and will create new vertices on all intersections of the given geometry. +This node goes through a recursive process (divide and conquer) and its speed is directly proportional to the +number of intersecting edges passed into it. The algorithm is not optimized for large edges counts, but tends +to work well in most cases. + +**implementation note** + +An Edge that touches the vertex of another edge is not considered an `Intersection` in the current implementation. +*Touching* might be included as an intersection type in the future via an extra toggle in the Properties Panel. + +Inputs +------ + +Verts and Edges only. Warning: Does not support faces, or Vectorized (nested lists) input + + +Parameters +---------- + +Currently no parameters, but in the future could include a tolerance parameter and a setting to consider Touching Verts-to-Edge as an Intersection. + + +Outputs +------- + +Vertices and Edges, the mesh does not preserve any old vertex or edge index ordering due to the Hashing algorithm used for fast intersection lookups. + + +Examples +-------- + +.. image:: https://cloud.githubusercontent.com/assets/619340/2811581/16032c72-ce26-11e3-9055-925d2cd03719.png + +See the progress of how this node came to life `here `_ (gifs, screenshots) \ No newline at end of file diff --git a/docs/nodes/modifier_change/holes_fill.rst b/docs/nodes/modifier_change/holes_fill.rst new file mode 100644 index 000000000..0daa5a987 --- /dev/null +++ b/docs/nodes/modifier_change/holes_fill.rst @@ -0,0 +1,36 @@ +Fill Holes +========== + +Functionality +------------- + +It fills closed countors from edges that own minimum vertices-sides with polygons. + +Inputs +------ + +- **Vertices** +- **Edges** + +Parameters +---------- + ++-----------------+---------------+-------------+-------------------------------------------------------------+ +| Param | Type | Default | Description | ++=================+===============+=============+=============================================================+ +| **Sides** | Float | 4 | Number of sides that will be collapsed to polygon. | ++-----------------+---------------+-------------+-------------------------------------------------------------+ + +Outputs +------- + +- **Vertices** +- **Edges** +- **Polygons**. All faces of resulting mesh. + +Examples of usage +----------------- + +Fill holes of formula shape, edges of initial shape + voronoi grid + fill holes + +.. image:: https://cloud.githubusercontent.com/assets/5783432/18611146/24f2afaa-7d42-11e6-9822-5637a752a1b6.png diff --git a/docs/nodes/modifier_change/mesh_separate.rst b/docs/nodes/modifier_change/mesh_separate.rst new file mode 100644 index 000000000..1547317d7 --- /dev/null +++ b/docs/nodes/modifier_change/mesh_separate.rst @@ -0,0 +1,34 @@ +Separate Loose Parts +==================== + +Functionality +------------- + +Split a mesh into unconnected parts in a pure topological operation. + +Input & Output +-------------- + ++--------+-----------+-------------------------------------------+ +| socket | name | Description | ++========+===========+===========================================+ +| input | Vertices | Inputs vertices | ++--------+-----------+-------------------------------------------+ +| input | Poly Edge | Polygon or Edge data | ++--------+-----------+-------------------------------------------+ +| output | Vertices | Vertices for each mesh part | ++--------+-----------+-------------------------------------------+ +| output | Poly Edge | Corresponding mesh data | ++--------+-----------+-------------------------------------------+ + +Examples +-------- + +.. image:: https://cloud.githubusercontent.com/assets/619340/4186249/46e799f2-375f-11e4-8fab-4bf1776b244a.png + :alt: separate-looseDemo1.png + +Notes +------- + +Note that it doesn't take double vertices into account. +There is no guarantee about the order of the outputs diff --git a/docs/nodes/modifier_change/polygons_boom.rst b/docs/nodes/modifier_change/polygons_boom.rst new file mode 100644 index 000000000..6284ae759 --- /dev/null +++ b/docs/nodes/modifier_change/polygons_boom.rst @@ -0,0 +1,20 @@ +Polygon Boom +============ + +Functionality +------------- + +The vertices of each polygon will be placed into separate lists. If polygons share vertices then the coordinates are duplicates into new vertices. The end result will be a nested list of polygons with each their own unique vertices. This facilitates rotation of a polygon around an arbitrary points without affecting the vertices of other polygons in the list. + +Inputs & Outputs +---------------- + +Lists of Vertices and Edge/Polygon lists. The type of data in the *edg_pol* output socket content depends on the what kind of input is passed to *edge_pol* input socket. If you input edges only, that's what the output will be. + +Examples +-------- + +The Box on default settings is a Cube with 6 polygons and each vertex is shared by three polygons. Polygon Boom separates the polygons into seperate coordinate lists (vertices). + +.. image:: https://cloud.githubusercontent.com/assets/619340/4186234/1ef77fb6-375f-11e4-8e45-4ce14df9fd94.PNG + :alt: PolygonBoomDemo1.PNG \ No newline at end of file diff --git a/docs/nodes/modifier_change/vertices_mask.rst b/docs/nodes/modifier_change/vertices_mask.rst new file mode 100644 index 000000000..f17bfc69c --- /dev/null +++ b/docs/nodes/modifier_change/vertices_mask.rst @@ -0,0 +1,36 @@ +Mask Vertices +============= + +Functionality +------------- + +Filter vertices with False/True bool values and automatically removes not connected edges and polygons. + +Inputs +------ + +- **Mask** +- **Vertices** +- **Poly Edge** + +Parameters +---------- + ++-----------+------------------+-----------+----------------------------------------------------------------+ +| Param | Type | Default | Description | ++===========+==================+===========+================================================================+ +| Mask | list of booleans | [1,0] | Mask can be defined with ListInput node or Formula node | +| | | | or other as list [n,n1,n2...ni] where n's can be 0 or 1 | +| | | | (False or True) | ++-----------+------------------+-----------+----------------------------------------------------------------+ + +Outputs +------- + +- **Vertices** +- **Poly Edge** + +Examples of usage +----------------- + +.. image:: https://cloud.githubusercontent.com/assets/5783432/18615011/cc68a924-7dab-11e6-82f0-6f72bfde7ba7.png diff --git a/docs/nodes/modifier_make/edges_adaptative.rst b/docs/nodes/modifier_make/edges_adaptative.rst new file mode 100644 index 000000000..6cfe018ef --- /dev/null +++ b/docs/nodes/modifier_make/edges_adaptative.rst @@ -0,0 +1,2 @@ +Adaptative Edges +================ \ No newline at end of file diff --git a/docs/nodes/modifier_make/polygons_adaptative.rst b/docs/nodes/modifier_make/polygons_adaptative.rst new file mode 100644 index 000000000..171eac793 --- /dev/null +++ b/docs/nodes/modifier_make/polygons_adaptative.rst @@ -0,0 +1,35 @@ +Adaptative Polygons +=================== + +Functionality +------------- + +Share one object to other. Donor spreading himself to recipient polygons. every polygon recieve one object and deform as normals say to him. + +Inputs +------ + +**VersR** and **PolsR** is Recipient object's data. **VersD** and **PolsD** is donor's object data. **Z_Coef** is coefficient of height, can be vectorized. + +Parameters +---------- + +table + ++------------------+---------------+-------------------------------------------------------------------+ +| Param | Type | Description | ++==================+===============+===================================================================+ +| **Donor width** | Float | Width of spreaded donors is part from recipient's polygon's width | ++------------------+---------------+-------------------------------------------------------------------+ + +Outputs +------- + +**Vertices** and **Polygons** are data for created object. + +Example of usage +---------------- + +.. image:: https://cloud.githubusercontent.com/assets/5783432/4222738/25e20e00-3916-11e4-9aca-5127f2edaa95.jpg + :alt: Adaptive_Polygons.jpg + diff --git a/docs/nodes/modifier_make/uv_connect.rst b/docs/nodes/modifier_make/uv_connect.rst new file mode 100644 index 000000000..5d67671cb --- /dev/null +++ b/docs/nodes/modifier_make/uv_connect.rst @@ -0,0 +1,41 @@ +UV Connection +============= + +Functionality +------------- + +Making edges/polygons between vertices objects it several ways. + +Inputs +------ + +Vertices. Multysockets can eat many objects. every object to be connecting with other. + +Parameters +---------- + +table + ++---------------+---------------+-----------------------------------------------------------------+ +| Param | Type | Description | ++===============+===============+=================================================================+ +| **UVdir** | Enum | Direction to connect edges and polygons | ++---------------+---------------+-----------------------------------------------------------------+ +| **cicled** | Bool, toggle | For edges and polygons close loop | ++---------------+---------------+-----------------------------------------------------------------+ +| **polygons** | Bool, toggle | Active - make polygon, else edge | ++---------------+---------------+-----------------------------------------------------------------+ +| **slice** | Bool, toggle | Polygons can be as slices or quads | ++---------------+---------------+-----------------------------------------------------------------+ + +Outputs +------- + +**Vertices** and **Edges/Polygons**. Verts and Polys will be generated. The Operator doesn't consider the ordering of the Vertex and Face indices that it outputs. This might make additional processing complicated, use IndexViewer to better understand the generated geometry. Faces will however have consistent Normals. + +Example of usage +---------------- + +.. image:: https://cloud.githubusercontent.com/assets/5783432/4199915/97853346-380a-11e4-9968-3661e95bf80c.png + :alt: ConnectingUV.PNG + diff --git a/docs/nodes/modifier_make/voronoi_2d.rst b/docs/nodes/modifier_make/voronoi_2d.rst new file mode 100644 index 000000000..bc444e466 --- /dev/null +++ b/docs/nodes/modifier_make/voronoi_2d.rst @@ -0,0 +1,2 @@ +Voronoi 2D +========== \ No newline at end of file diff --git a/docs/nodes/generators/exponential.rst b/docs/nodes/number/exponential.rst similarity index 100% rename from docs/nodes/generators/exponential.rst rename to docs/nodes/number/exponential.rst diff --git a/docs/nodes/generators/fibonacci.rst b/docs/nodes/number/fibonacci.rst similarity index 100% rename from docs/nodes/generators/fibonacci.rst rename to docs/nodes/number/fibonacci.rst diff --git a/docs/nodes/number/float2int.rst b/docs/nodes/number/float_to_int.rst similarity index 100% rename from docs/nodes/number/float2int.rst rename to docs/nodes/number/float_to_int.rst diff --git a/docs/nodes/number/formula.rst b/docs/nodes/number/formula2.rst similarity index 100% rename from docs/nodes/number/formula.rst rename to docs/nodes/number/formula2.rst diff --git a/docs/nodes/number/int.rst b/docs/nodes/number/integer.rst similarity index 100% rename from docs/nodes/number/int.rst rename to docs/nodes/number/integer.rst diff --git a/docs/nodes/number/map_range.rst b/docs/nodes/number/range_map.rst similarity index 100% rename from docs/nodes/number/map_range.rst rename to docs/nodes/number/range_map.rst diff --git a/docs/nodes/number/math.rst b/docs/nodes/number/scalar.rst similarity index 100% rename from docs/nodes/number/math.rst rename to docs/nodes/number/scalar.rst diff --git a/docs/nodes/transforms/apply.rst b/docs/nodes/transforms/apply.rst new file mode 100644 index 000000000..5cbba6e0f --- /dev/null +++ b/docs/nodes/transforms/apply.rst @@ -0,0 +1,41 @@ +Matrix Apply +============ + +Functionality +------------- + +Applies a Transform Matrix to a list or nested lists of vectors (and therefore vertices) + + +Inputs +------ + ++----------+-----------------------------------------------------------------------------+ +| Inputs | Description | ++==========+=============================================================================+ +| Vectors | Represents vertices or intermediate vectors used for further vector math | ++----------+-----------------------------------------------------------------------------+ +| Matrices | One or more, never empty | ++----------+-----------------------------------------------------------------------------+ + + +Outputs +------- + +Nested list of vectors / vertices, matching the number nested incoming *matrices*. + + +Examples +-------- + +.. image:: https://cloud.githubusercontent.com/assets/619340/4186410/a3e00666-3760-11e4-9d67-b32345329e9d.PNG + :alt: MatrixApplyDemo1.PNG + +.. image:: https://cloud.githubusercontent.com/assets/619340/4186411/a3e1c14a-3760-11e4-84fe-2acaf1858ad7.PNG + :alt: MatrixApplyDemo5.PNG + + +Notes +------- + +The ``update`` function is outdated, functionally this is of no relevance to users but we should change it for future compatibility. \ No newline at end of file -- GitLab From 91f949e09826b0a5fab19502a6afd1d4594c06b3 Mon Sep 17 00:00:00 2001 From: zeffii Date: Fri, 30 Sep 2016 11:32:04 +0200 Subject: [PATCH 07/19] fully push new doc names --- docs/nodes.rst | 42 +++---- docs/nodes/alpha_nodes/alpha_nodes_index.rst | 7 ++ .../{analyzer.rst => analyzers_index.rst} | 11 +- .../{beta.rst => beta_nodes_index.rst} | 5 +- docs/nodes/generators/generator.rst | 32 ----- docs/nodes/generators/generators_index.rst | 20 +++ .../generators_extended_index.rst | 18 +++ .../{socket_converter.rst => converter.rst} | 0 .../layout/{layout.rst => layout_index.rst} | 2 +- docs/nodes/list_main/list_main.rst | 18 --- docs/nodes/list_main/list_main_index.rst | 15 +++ docs/nodes/list_masks/list_masks_index.rst | 9 ++ .../list_mutators/list_mutators_index.rst | 8 ++ docs/nodes/list_struct/list_struct.rst | 17 --- docs/nodes/list_struct/list_struct_index.rst | 17 +++ .../logic/{logic.rst => logic_index.rst} | 4 +- .../logic/{elman.rst => neuro_elman.rst} | 0 ..._apply_and_join.rst => apply_and_join.rst} | 0 .../matrix/{matrix_deform.rst => deform.rst} | 0 docs/nodes/matrix/euler.rst | 0 .../matrix/{matrix_input.rst => input.rst} | 0 ...ix_interpolation.rst => interpolation.rst} | 0 docs/nodes/matrix/matrix.rst | 14 --- docs/nodes/matrix/matrix_index.rst | 14 +++ .../matrix/{matrix_shear.rst => shear.rst} | 0 ...r_change.rst => modifier_change_index.rst} | 17 +-- ...ifier_make.rst => modifier_make_index.rst} | 8 +- docs/nodes/network/network_index.rst | 7 ++ .../number/{number.rst => number_index.rst} | 18 +-- docs/nodes/scene/eval_knieval.rst | 116 ------------------ ...{get_set_properties.rst => getsetprop.rst} | 0 .../scene/{object_in.rst => objects.rst} | 0 .../scene/{scene.rst => scene_index.rst} | 6 +- .../nodes/text/{debug.rst => debug_print.rst} | 0 docs/nodes/text/{text.rst => text_index.rst} | 13 +- .../{transforms.rst => transforms_index.rst} | 6 +- .../vector/{vector_xyz.rst => axis_input.rst} | 0 .../vector/{vector_drop.rst => drop.rst} | 0 ...nterpolation.rst => interpolation_mk3.rst} | 0 ...{vector_evaluate.rst => line_evaluate.rst} | 0 .../vector/{vector_math.rst => math.rst} | 0 .../vector/{vector_noise.rst => noise.rst} | 0 docs/nodes/vector/vector.rst | 19 --- docs/nodes/vector/vector_index.rst | 19 +++ ...oubles.rst => vertices_delete_doubles.rst} | 0 .../{vector_sort.rst => vertices_sort.rst} | 0 ...{viewer_bmesh.rst => viewer_bmesh_mk2.rst} | 0 .../{viewer_indx.rst => viewer_indices.rst} | 0 .../viz/{viewer_draw.rst => viewer_mk2.rst} | 0 docs/nodes/viz/viz.rst | 11 -- docs/nodes/viz/viz_index.rst | 11 ++ index.md | 6 +- menu.py | 4 +- nodes/number/{logic.py => logic_node.py} | 0 54 files changed, 217 insertions(+), 297 deletions(-) create mode 100644 docs/nodes/alpha_nodes/alpha_nodes_index.rst rename docs/nodes/analyzers/{analyzer.rst => analyzers_index.rst} (69%) rename docs/nodes/beta_nodes/{beta.rst => beta_nodes_index.rst} (64%) delete mode 100644 docs/nodes/generators/generator.rst create mode 100644 docs/nodes/generators/generators_index.rst create mode 100644 docs/nodes/generators_extended/generators_extended_index.rst rename docs/nodes/layout/{socket_converter.rst => converter.rst} (100%) rename docs/nodes/layout/{layout.rst => layout_index.rst} (75%) delete mode 100644 docs/nodes/list_main/list_main.rst create mode 100644 docs/nodes/list_main/list_main_index.rst create mode 100644 docs/nodes/list_masks/list_masks_index.rst create mode 100644 docs/nodes/list_mutators/list_mutators_index.rst delete mode 100644 docs/nodes/list_struct/list_struct.rst create mode 100644 docs/nodes/list_struct/list_struct_index.rst rename docs/nodes/logic/{logic.rst => logic_index.rst} (82%) rename docs/nodes/logic/{elman.rst => neuro_elman.rst} (100%) rename docs/nodes/matrix/{matrix_apply_and_join.rst => apply_and_join.rst} (100%) rename docs/nodes/matrix/{matrix_deform.rst => deform.rst} (100%) create mode 100644 docs/nodes/matrix/euler.rst rename docs/nodes/matrix/{matrix_input.rst => input.rst} (100%) rename docs/nodes/matrix/{matrix_interpolation.rst => interpolation.rst} (100%) delete mode 100644 docs/nodes/matrix/matrix.rst create mode 100644 docs/nodes/matrix/matrix_index.rst rename docs/nodes/matrix/{matrix_shear.rst => shear.rst} (100%) rename docs/nodes/modifier_change/{modifier_change.rst => modifier_change_index.rst} (75%) rename docs/nodes/modifier_make/{modifier_make.rst => modifier_make_index.rst} (73%) create mode 100644 docs/nodes/network/network_index.rst rename docs/nodes/number/{number.rst => number_index.rst} (55%) delete mode 100644 docs/nodes/scene/eval_knieval.rst rename docs/nodes/scene/{get_set_properties.rst => getsetprop.rst} (100%) rename docs/nodes/scene/{object_in.rst => objects.rst} (100%) rename docs/nodes/scene/{scene.rst => scene_index.rst} (73%) rename docs/nodes/text/{debug.rst => debug_print.rst} (100%) rename docs/nodes/text/{text.rst => text_index.rst} (56%) rename docs/nodes/transforms/{transforms.rst => transforms_index.rst} (86%) rename docs/nodes/vector/{vector_xyz.rst => axis_input.rst} (100%) rename docs/nodes/vector/{vector_drop.rst => drop.rst} (100%) rename docs/nodes/vector/{vector_interpolation.rst => interpolation_mk3.rst} (100%) rename docs/nodes/vector/{vector_evaluate.rst => line_evaluate.rst} (100%) rename docs/nodes/vector/{vector_math.rst => math.rst} (100%) rename docs/nodes/vector/{vector_noise.rst => noise.rst} (100%) delete mode 100644 docs/nodes/vector/vector.rst create mode 100644 docs/nodes/vector/vector_index.rst rename docs/nodes/vector/{vector_doubles.rst => vertices_delete_doubles.rst} (100%) rename docs/nodes/vector/{vector_sort.rst => vertices_sort.rst} (100%) rename docs/nodes/viz/{viewer_bmesh.rst => viewer_bmesh_mk2.rst} (100%) rename docs/nodes/viz/{viewer_indx.rst => viewer_indices.rst} (100%) rename docs/nodes/viz/{viewer_draw.rst => viewer_mk2.rst} (100%) delete mode 100644 docs/nodes/viz/viz.rst create mode 100644 docs/nodes/viz/viz_index.rst rename nodes/number/{logic.py => logic_node.py} (100%) diff --git a/docs/nodes.rst b/docs/nodes.rst index c3a1009c5..a403fee1d 100644 --- a/docs/nodes.rst +++ b/docs/nodes.rst @@ -5,27 +5,27 @@ Nodes .. toctree:: :maxdepth: 3 - Generators - Generators Extended - Transforms - Analyzers - Modifier Change - Modifier Make + Generators + Generators Extended + Transforms + Analyzers + Modifier Change + Modifier Make - Number - Vector - Matrix - Logic - List Main - List Structure - List Masks - List Mutators + Number + Vector + Matrix + Logic + List Main + List Structure + List Masks + List Mutators - Viz - Text - Scene - Layout - Network + Viz + Text + Scene + Layout + Network - Beta Nodes - Alpha Nodes + Beta Nodes + Alpha Nodes diff --git a/docs/nodes/alpha_nodes/alpha_nodes_index.rst b/docs/nodes/alpha_nodes/alpha_nodes_index.rst new file mode 100644 index 000000000..816d2e9e2 --- /dev/null +++ b/docs/nodes/alpha_nodes/alpha_nodes_index.rst @@ -0,0 +1,7 @@ +*********** +Alpha Nodes +*********** + +.. toctree:: + :maxdepth: 2 + diff --git a/docs/nodes/analyzers/analyzer.rst b/docs/nodes/analyzers/analyzers_index.rst similarity index 69% rename from docs/nodes/analyzers/analyzer.rst rename to docs/nodes/analyzers/analyzers_index.rst index e685d248d..5ce695e15 100644 --- a/docs/nodes/analyzers/analyzer.rst +++ b/docs/nodes/analyzers/analyzers_index.rst @@ -1,20 +1,21 @@ -******** -Analyzer -******** +********* +Analyzers +********* .. toctree:: :maxdepth: 2 area bbox - calc_normals distance_pp edge_angles kd_tree kd_tree_edges mesh_filter + normal + normals polygons_centers + polygons_centers_mk3 raycast - vector_normal volume weights diff --git a/docs/nodes/beta_nodes/beta.rst b/docs/nodes/beta_nodes/beta_nodes_index.rst similarity index 64% rename from docs/nodes/beta_nodes/beta.rst rename to docs/nodes/beta_nodes/beta_nodes_index.rst index 586d9a51b..86e2ddada 100644 --- a/docs/nodes/beta_nodes/beta.rst +++ b/docs/nodes/beta_nodes/beta_nodes_index.rst @@ -1,9 +1,8 @@ ********** -Beta +Beta Nodes ********** .. toctree:: :maxdepth: 2 - iterate - + set_dataobject diff --git a/docs/nodes/generators/generator.rst b/docs/nodes/generators/generator.rst deleted file mode 100644 index 3a490fe17..000000000 --- a/docs/nodes/generators/generator.rst +++ /dev/null @@ -1,32 +0,0 @@ -********* -Generator -********* - -.. toctree:: - :maxdepth: 2 - - 2pt_spline - 3pt_arc - box - box_rounded - bricks - circle - cylinder - exponential - fibonacci - formula_shape - generative_art - hilbert - hilbert3d - hilbert_image - image - image_decompose - line - ngon - plane - profile_parametric - random_vector - scripted - scripted2 - scripted_intro - sphere diff --git a/docs/nodes/generators/generators_index.rst b/docs/nodes/generators/generators_index.rst new file mode 100644 index 000000000..b987f2493 --- /dev/null +++ b/docs/nodes/generators/generators_index.rst @@ -0,0 +1,20 @@ +********** +Generators +********** + +.. toctree:: + :maxdepth: 2 + + basic_3pt_arc + basic_spline + box + bricks + circle + cylinder + formula_shape + image + line + ngon + plane + random_vector + sphere diff --git a/docs/nodes/generators_extended/generators_extended_index.rst b/docs/nodes/generators_extended/generators_extended_index.rst new file mode 100644 index 000000000..19b1f4d0a --- /dev/null +++ b/docs/nodes/generators_extended/generators_extended_index.rst @@ -0,0 +1,18 @@ +******************* +Generators Extended +******************* + +.. toctree:: + :maxdepth: 2 + + box_rounded + generative_art + hilbert + hilbert3d + hilbert_image + image_components + profile + script + script3 + scripted_intro + script_mk2 diff --git a/docs/nodes/layout/socket_converter.rst b/docs/nodes/layout/converter.rst similarity index 100% rename from docs/nodes/layout/socket_converter.rst rename to docs/nodes/layout/converter.rst diff --git a/docs/nodes/layout/layout.rst b/docs/nodes/layout/layout_index.rst similarity index 75% rename from docs/nodes/layout/layout.rst rename to docs/nodes/layout/layout_index.rst index 2e0478d73..958f951e6 100644 --- a/docs/nodes/layout/layout.rst +++ b/docs/nodes/layout/layout_index.rst @@ -5,5 +5,5 @@ Layout .. toctree:: :maxdepth: 2 + converter wifi - socket_converter diff --git a/docs/nodes/list_main/list_main.rst b/docs/nodes/list_main/list_main.rst deleted file mode 100644 index 491e7fbcb..000000000 --- a/docs/nodes/list_main/list_main.rst +++ /dev/null @@ -1,18 +0,0 @@ -********* -List Main -********* - -.. toctree:: - :maxdepth: 2 - - list_decompose - list_join - list_zip - list_del_levels - list_length - list_sum - list_mask_out - list_mask_in - list_match - list_math - list_modifier diff --git a/docs/nodes/list_main/list_main_index.rst b/docs/nodes/list_main/list_main_index.rst new file mode 100644 index 000000000..509a7b124 --- /dev/null +++ b/docs/nodes/list_main/list_main_index.rst @@ -0,0 +1,15 @@ +********* +List Main +********* + +.. toctree:: + :maxdepth: 2 + + decompose + func + join + length + levels + match + sum_mk2 + zip diff --git a/docs/nodes/list_masks/list_masks_index.rst b/docs/nodes/list_masks/list_masks_index.rst new file mode 100644 index 000000000..e72701d78 --- /dev/null +++ b/docs/nodes/list_masks/list_masks_index.rst @@ -0,0 +1,9 @@ +********** +List Masks +********** + +.. toctree:: + :maxdepth: 2 + + mask + mask_join diff --git a/docs/nodes/list_mutators/list_mutators_index.rst b/docs/nodes/list_mutators/list_mutators_index.rst new file mode 100644 index 000000000..69a7f1952 --- /dev/null +++ b/docs/nodes/list_mutators/list_mutators_index.rst @@ -0,0 +1,8 @@ +************* +List Mutators +************* + +.. toctree:: + :maxdepth: 2 + + modifier diff --git a/docs/nodes/list_struct/list_struct.rst b/docs/nodes/list_struct/list_struct.rst deleted file mode 100644 index 357bbb76b..000000000 --- a/docs/nodes/list_struct/list_struct.rst +++ /dev/null @@ -1,17 +0,0 @@ -************** -List Structure -************** - -.. toctree:: - :maxdepth: 2 - - list_shift - list_repeater - list_slice - list_split - list_first_last - list_item - list_reverse - list_shuffle - list_sort - list_flip \ No newline at end of file diff --git a/docs/nodes/list_struct/list_struct_index.rst b/docs/nodes/list_struct/list_struct_index.rst new file mode 100644 index 000000000..3c7170576 --- /dev/null +++ b/docs/nodes/list_struct/list_struct_index.rst @@ -0,0 +1,17 @@ +*********** +List Struct +*********** + +.. toctree:: + :maxdepth: 2 + + flip + item + list_reverse + repeater + shift_mk2 + shuffle + slice + sort_mk2 + split + start_end diff --git a/docs/nodes/logic/logic.rst b/docs/nodes/logic/logic_index.rst similarity index 82% rename from docs/nodes/logic/logic.rst rename to docs/nodes/logic/logic_index.rst index 632c693ef..fe0a017be 100644 --- a/docs/nodes/logic/logic.rst +++ b/docs/nodes/logic/logic_index.rst @@ -5,6 +5,6 @@ Logic .. toctree:: :maxdepth: 2 - switch logic_node - elman + neuro_elman + switch diff --git a/docs/nodes/logic/elman.rst b/docs/nodes/logic/neuro_elman.rst similarity index 100% rename from docs/nodes/logic/elman.rst rename to docs/nodes/logic/neuro_elman.rst diff --git a/docs/nodes/matrix/matrix_apply_and_join.rst b/docs/nodes/matrix/apply_and_join.rst similarity index 100% rename from docs/nodes/matrix/matrix_apply_and_join.rst rename to docs/nodes/matrix/apply_and_join.rst diff --git a/docs/nodes/matrix/matrix_deform.rst b/docs/nodes/matrix/deform.rst similarity index 100% rename from docs/nodes/matrix/matrix_deform.rst rename to docs/nodes/matrix/deform.rst diff --git a/docs/nodes/matrix/euler.rst b/docs/nodes/matrix/euler.rst new file mode 100644 index 000000000..e69de29bb diff --git a/docs/nodes/matrix/matrix_input.rst b/docs/nodes/matrix/input.rst similarity index 100% rename from docs/nodes/matrix/matrix_input.rst rename to docs/nodes/matrix/input.rst diff --git a/docs/nodes/matrix/matrix_interpolation.rst b/docs/nodes/matrix/interpolation.rst similarity index 100% rename from docs/nodes/matrix/matrix_interpolation.rst rename to docs/nodes/matrix/interpolation.rst diff --git a/docs/nodes/matrix/matrix.rst b/docs/nodes/matrix/matrix.rst deleted file mode 100644 index 6754eb8d9..000000000 --- a/docs/nodes/matrix/matrix.rst +++ /dev/null @@ -1,14 +0,0 @@ -****** -Matrix -****** - -.. toctree:: - :maxdepth: 2 - - matrix_apply_and_join - matrix_in_out - matrix_input - matrix_deform - matrix_shear - matrix_interpolation - diff --git a/docs/nodes/matrix/matrix_index.rst b/docs/nodes/matrix/matrix_index.rst new file mode 100644 index 000000000..230383465 --- /dev/null +++ b/docs/nodes/matrix/matrix_index.rst @@ -0,0 +1,14 @@ +****** +Matrix +****** + +.. toctree:: + :maxdepth: 2 + + apply_and_join + deform + euler + input + interpolation + matrix_in_out + shear diff --git a/docs/nodes/matrix/matrix_shear.rst b/docs/nodes/matrix/shear.rst similarity index 100% rename from docs/nodes/matrix/matrix_shear.rst rename to docs/nodes/matrix/shear.rst diff --git a/docs/nodes/modifier_change/modifier_change.rst b/docs/nodes/modifier_change/modifier_change_index.rst similarity index 75% rename from docs/nodes/modifier_change/modifier_change.rst rename to docs/nodes/modifier_change/modifier_change_index.rst index 95d11a95f..70d3a82f5 100644 --- a/docs/nodes/modifier_change/modifier_change.rst +++ b/docs/nodes/modifier_change/modifier_change_index.rst @@ -7,19 +7,20 @@ Modifier Change bevel delete_loose - extrude_separate + edges_intersect extrude_edges extrude_edges_old - fill_holes - intersect_edges - mask_vertices + extrude_separate + holes_fill + iterate mesh_join + mesh_separate objects_along_edge offset - polygon_boom + polygons_boom polygons_to_edges - triangulate - recalc_normals randomize + recalc_normals remove_doubles - separate_loose_parts + triangulate + vertices_mask diff --git a/docs/nodes/modifier_make/modifier_make.rst b/docs/nodes/modifier_make/modifier_make_index.rst similarity index 73% rename from docs/nodes/modifier_make/modifier_make.rst rename to docs/nodes/modifier_make/modifier_make_index.rst index c5a465fef..7ce8e72e3 100644 --- a/docs/nodes/modifier_make/modifier_make.rst +++ b/docs/nodes/modifier_make/modifier_make_index.rst @@ -5,17 +5,17 @@ Modifier Make .. toctree:: :maxdepth: 2 - adaptative_edges - adaptative_polygons bisect convex_hull cross_section delaunay + edges_adaptative lathe matrix_tube pipe_tubes + polygons_adaptative solidify - uv_connection - voronoi + uv_connect + voronoi_2d wafel wireframe diff --git a/docs/nodes/network/network_index.rst b/docs/nodes/network/network_index.rst new file mode 100644 index 000000000..673ea9c6f --- /dev/null +++ b/docs/nodes/network/network_index.rst @@ -0,0 +1,7 @@ +******* +Network +******* + +.. toctree:: + :maxdepth: 2 + diff --git a/docs/nodes/number/number.rst b/docs/nodes/number/number_index.rst similarity index 55% rename from docs/nodes/number/number.rst rename to docs/nodes/number/number_index.rst index 2b8e9fab3..3e1df7820 100644 --- a/docs/nodes/number/number.rst +++ b/docs/nodes/number/number_index.rst @@ -5,13 +5,15 @@ Number .. toctree:: :maxdepth: 2 - range_int - range_float + exponential + fibonacci + float + float_to_int + formula2 + integer list_input random - float - int - float2int - formula - math - map_range + range_float + range_int + range_map + scalar diff --git a/docs/nodes/scene/eval_knieval.rst b/docs/nodes/scene/eval_knieval.rst deleted file mode 100644 index 9b968ebdc..000000000 --- a/docs/nodes/scene/eval_knieval.rst +++ /dev/null @@ -1,116 +0,0 @@ -Eval Knieval -================ - -*destination after Beta: control (or basic data..but preferably a new ``control`` menu)* - - -Functionality -------------- - -This is a massively powerful node, it allows you to control pretty much anything in Blender with minimal admin. -The node has 3 main modes (``Set, Get, and Do``). Do has 3 of its own modes (``eval_text, read_text, do_function``). - - -+-----------+-------------+---------------------------------------+ -| main mode | minor mode | quick info | -+===========+=============+=======================================+ -| Set | | ``path.to.prop`` (set from Sverchok) | -+-----------+-------------+---------------------------------------+ -| Get | | ``path.to.prop`` (take into Sverchok) | -+-----------+-------------+---------------------------------------+ -| Do | eval_text | ``eval_text(a, b, [True])`` | -+-----------+-------------+---------------------------------------+ -| | read_text | ``read_text(a, [True])`` | -+-----------+-------------+---------------------------------------+ -| | do_function | ``do_function(a) with x`` | -+-----------+-------------+---------------------------------------+ - -Inputs & Parameters & Outputs ------------------------------ - -Heavily depending on which mode you have switched to. - -**Set and Get** - -Set takes only an input, while Get only makes an output. Both have convenience local aliases. -:: - c = bpy.context - scene = c.scene - data = bpy.data - objs = data.objects - mats = data.materials - meshes = data.meshes - texts = data.texts - -The scheme for both is the same, and the node will figure out in the background what socket to use -depending on the type of data you reference:: - - """ - - SET: `path.to.prop` - - GET: `path.to.prop` - """ - # you might do something like this to set the cube location - # depending on if you have Set or Get it will make an input or output socket - objs['Cube'].location - - # more - - - -**eval_text** - -``eval_text(function_text, out_text, update=True)`` - -+---------------+---------------------------------------------------------------------------------+ -| parameter | description | -+===============+=================================================================================+ -| function_text | a reference to a file inside blender. This text should be initiated outside | -| | of blender or made external by saving and loading. The content of this file is | -| | what writes to the out_text. | -+---------------+---------------------------------------------------------------------------------+ -| out_text | the internal text file to read from. The content of which might be changing on | -| | each update. | -+---------------+---------------------------------------------------------------------------------+ -| update | this parameter isn't very useful at the moment, but keep it to True if you | -| | want to update the content of the internal text file. Else only the external | -| | file will be read. | -+---------------+---------------------------------------------------------------------------------+ - - -**do_function** - -This function aims to facilitate the repeated execution of a python file -located inside Blender. Similar to Scripted Node but with the restriction -that it has one input by design. Realistically the input can be an array, -and therefore nested with a collection of variables. - -The python file to exec shall be specified in the eval string like so: - - ``do_function('file_name.py') with x`` - -Here x is the value of the input socket, this will automatically be in the -scope of the function when EK calls it. First it is executed in a -try/except scenario, and if that went OK then the next update is without -try/except. - -The content of file_name.py can be anything that executes, function or -a flat file. The following convenience variables will be present. -:: - c = bpy.context - scene = c.scene - data = bpy.data - objs = data.objects - mats = data.materials - meshes = data.meshes - texts = data.texts - - -Examples --------- - -.. image:: https://cloud.githubusercontent.com/assets/7894950/4715836/5513ae5c-5902-11e4-8f05-40520d57476a.png - -Notes ------ - -str datatype not currently supported, but can be easily. diff --git a/docs/nodes/scene/get_set_properties.rst b/docs/nodes/scene/getsetprop.rst similarity index 100% rename from docs/nodes/scene/get_set_properties.rst rename to docs/nodes/scene/getsetprop.rst diff --git a/docs/nodes/scene/object_in.rst b/docs/nodes/scene/objects.rst similarity index 100% rename from docs/nodes/scene/object_in.rst rename to docs/nodes/scene/objects.rst diff --git a/docs/nodes/scene/scene.rst b/docs/nodes/scene/scene_index.rst similarity index 73% rename from docs/nodes/scene/scene.rst rename to docs/nodes/scene/scene_index.rst index 35dca808b..0b9dadd1e 100644 --- a/docs/nodes/scene/scene.rst +++ b/docs/nodes/scene/scene_index.rst @@ -5,8 +5,8 @@ Scene .. toctree:: :maxdepth: 2 - object_in + dupli_instances frame_info - get_set_properties + getsetprop + objects obj_remote - dupli_instances diff --git a/docs/nodes/text/debug.rst b/docs/nodes/text/debug_print.rst similarity index 100% rename from docs/nodes/text/debug.rst rename to docs/nodes/text/debug_print.rst diff --git a/docs/nodes/text/text.rst b/docs/nodes/text/text_index.rst similarity index 56% rename from docs/nodes/text/text.rst rename to docs/nodes/text/text_index.rst index 9375a0a5b..b92ef8e9b 100644 --- a/docs/nodes/text/text.rst +++ b/docs/nodes/text/text_index.rst @@ -5,11 +5,10 @@ Text .. toctree:: :maxdepth: 2 - viewer_text - note + debug_print gtext - debug - stethoscope - text_out - text_in - + note + stethoscope + text_in + text_out + viewer_text diff --git a/docs/nodes/transforms/transforms.rst b/docs/nodes/transforms/transforms_index.rst similarity index 86% rename from docs/nodes/transforms/transforms.rst rename to docs/nodes/transforms/transforms_index.rst index 64417bab3..6db89823e 100644 --- a/docs/nodes/transforms/transforms.rst +++ b/docs/nodes/transforms/transforms_index.rst @@ -5,8 +5,8 @@ Transforms .. toctree:: :maxdepth: 2 - scale - rotation + apply mirror move - matrix_apply + rotation + scale diff --git a/docs/nodes/vector/vector_xyz.rst b/docs/nodes/vector/axis_input.rst similarity index 100% rename from docs/nodes/vector/vector_xyz.rst rename to docs/nodes/vector/axis_input.rst diff --git a/docs/nodes/vector/vector_drop.rst b/docs/nodes/vector/drop.rst similarity index 100% rename from docs/nodes/vector/vector_drop.rst rename to docs/nodes/vector/drop.rst diff --git a/docs/nodes/vector/vector_interpolation.rst b/docs/nodes/vector/interpolation_mk3.rst similarity index 100% rename from docs/nodes/vector/vector_interpolation.rst rename to docs/nodes/vector/interpolation_mk3.rst diff --git a/docs/nodes/vector/vector_evaluate.rst b/docs/nodes/vector/line_evaluate.rst similarity index 100% rename from docs/nodes/vector/vector_evaluate.rst rename to docs/nodes/vector/line_evaluate.rst diff --git a/docs/nodes/vector/vector_math.rst b/docs/nodes/vector/math.rst similarity index 100% rename from docs/nodes/vector/vector_math.rst rename to docs/nodes/vector/math.rst diff --git a/docs/nodes/vector/vector_noise.rst b/docs/nodes/vector/noise.rst similarity index 100% rename from docs/nodes/vector/vector_noise.rst rename to docs/nodes/vector/noise.rst diff --git a/docs/nodes/vector/vector.rst b/docs/nodes/vector/vector.rst deleted file mode 100644 index 4e168e190..000000000 --- a/docs/nodes/vector/vector.rst +++ /dev/null @@ -1,19 +0,0 @@ -****** -Vector -****** - -.. toctree:: - :maxdepth: 2 - - vector_in - vector_out - vector_math - vector_drop - vector_doubles - vector_evaluate - vector_interpolation - vector_sort - vector_noise - vector_xyz - vector_polar_in - vector_polar_out \ No newline at end of file diff --git a/docs/nodes/vector/vector_index.rst b/docs/nodes/vector/vector_index.rst new file mode 100644 index 000000000..31dea6a18 --- /dev/null +++ b/docs/nodes/vector/vector_index.rst @@ -0,0 +1,19 @@ +****** +Vector +****** + +.. toctree:: + :maxdepth: 2 + + axis_input + drop + interpolation_mk3 + line_evaluate + math + noise + vector_in + vector_out + vector_polar_in + vector_polar_out + vertices_delete_doubles + vertices_sort diff --git a/docs/nodes/vector/vector_doubles.rst b/docs/nodes/vector/vertices_delete_doubles.rst similarity index 100% rename from docs/nodes/vector/vector_doubles.rst rename to docs/nodes/vector/vertices_delete_doubles.rst diff --git a/docs/nodes/vector/vector_sort.rst b/docs/nodes/vector/vertices_sort.rst similarity index 100% rename from docs/nodes/vector/vector_sort.rst rename to docs/nodes/vector/vertices_sort.rst diff --git a/docs/nodes/viz/viewer_bmesh.rst b/docs/nodes/viz/viewer_bmesh_mk2.rst similarity index 100% rename from docs/nodes/viz/viewer_bmesh.rst rename to docs/nodes/viz/viewer_bmesh_mk2.rst diff --git a/docs/nodes/viz/viewer_indx.rst b/docs/nodes/viz/viewer_indices.rst similarity index 100% rename from docs/nodes/viz/viewer_indx.rst rename to docs/nodes/viz/viewer_indices.rst diff --git a/docs/nodes/viz/viewer_draw.rst b/docs/nodes/viz/viewer_mk2.rst similarity index 100% rename from docs/nodes/viz/viewer_draw.rst rename to docs/nodes/viz/viewer_mk2.rst diff --git a/docs/nodes/viz/viz.rst b/docs/nodes/viz/viz.rst deleted file mode 100644 index 764e9cd55..000000000 --- a/docs/nodes/viz/viz.rst +++ /dev/null @@ -1,11 +0,0 @@ -************* -Vizualization -************* - -.. toctree:: - :maxdepth: 2 - - viewer_draw - viewer_indx - viewer_bmesh - 3dview_props diff --git a/docs/nodes/viz/viz_index.rst b/docs/nodes/viz/viz_index.rst new file mode 100644 index 000000000..f47b4fecf --- /dev/null +++ b/docs/nodes/viz/viz_index.rst @@ -0,0 +1,11 @@ +*** +Viz +*** + +.. toctree:: + :maxdepth: 2 + + 3dview_props + viewer_bmesh_mk2 + viewer_indices + viewer_mk2 diff --git a/index.md b/index.md index dfe1a8d16..06a824e40 100644 --- a/index.md +++ b/index.md @@ -23,7 +23,7 @@ SvBricksNode ImageNode -## Extended Generators +## Generators Extended SvBoxRoundedNode HilbertNode Hilbert3dNode @@ -99,7 +99,7 @@ ## List Mutators SvListModifierNode -## List main +## List Main ListJoinNode ZipNode ListLevelsNode @@ -109,7 +109,7 @@ ListFuncNode SvListDecomposeNode -## List struct +## List Struct ShiftNodeMK2 ListRepeaterNode ListSliceNode diff --git a/menu.py b/menu.py index cd796d966..323943399 100644 --- a/menu.py +++ b/menu.py @@ -85,10 +85,10 @@ def juggle_and_join(node_cats): # put masks into list main for ltype in ["List Masks", "List Mutators"]: node_refs = node_cats.pop(ltype) - node_cats["List main"].extend(node_refs) + node_cats["List Main"].extend(node_refs) # add extended gens to Gens menu - gen_ext = node_cats.pop("Extended Generators") + gen_ext = node_cats.pop("Generators Extended") node_cats["Generators"].extend(gen_ext) return node_cats diff --git a/nodes/number/logic.py b/nodes/number/logic_node.py similarity index 100% rename from nodes/number/logic.py rename to nodes/number/logic_node.py -- GitLab From df19e4fde594a8a82e7816ee9911f220ef9927a9 Mon Sep 17 00:00:00 2001 From: zeffii Date: Fri, 30 Sep 2016 12:07:23 +0200 Subject: [PATCH 08/19] rejigs to match current state --- docs/nodes.rst | 2 +- docs/nodes/matrix/euler.rst | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/nodes.rst b/docs/nodes.rst index a403fee1d..d4551a409 100644 --- a/docs/nodes.rst +++ b/docs/nodes.rst @@ -19,7 +19,7 @@ Nodes List Main List Structure List Masks - List Mutators + List Mutators Viz Text diff --git a/docs/nodes/matrix/euler.rst b/docs/nodes/matrix/euler.rst index e69de29bb..6ce56ceaf 100644 --- a/docs/nodes/matrix/euler.rst +++ b/docs/nodes/matrix/euler.rst @@ -0,0 +1,2 @@ +Euler +===== \ No newline at end of file -- GitLab From 68d5b33151d27e91942c40e9d99647ca43e340a4 Mon Sep 17 00:00:00 2001 From: zeffii Date: Fri, 30 Sep 2016 13:48:27 +0200 Subject: [PATCH 09/19] add last big edits --- __init__.py | 2 +- menu.py | 15 ++++++++++----- ui/development.py | 23 ++++++++++++++++------- utils/sv_help.py | 28 ++++++++++++++++++++++++++++ 4 files changed, 55 insertions(+), 13 deletions(-) create mode 100644 utils/sv_help.py diff --git a/__init__.py b/__init__.py index 809d90dcf..d6daa3927 100755 --- a/__init__.py +++ b/__init__.py @@ -90,7 +90,7 @@ utils_modules = [ "text_editor_submenu", "text_editor_plugins", # UI operators and tools "sv_panels_tools", "sv_gist_tools", "sv_IO_panel_tools", - "monad", + "monad", "sv_help" #"loadscript", ] diff --git a/menu.py b/menu.py index 323943399..b82bc9a7e 100644 --- a/menu.py +++ b/menu.py @@ -25,6 +25,8 @@ import bpy from nodeitems_utils import NodeCategory, NodeItem, NodeItemCustom import nodeitems_utils +from sverchok.utils.sv_help import build_help_remap + class SverchNodeCategory(NodeCategory): @classmethod @@ -152,6 +154,7 @@ def draw_node_ops(self,layout, context): def make_categories(): original_categories = make_node_cats() + node_cats = juggle_and_join(original_categories) node_categories = [] @@ -164,24 +167,26 @@ def make_categories(): node_count += len(nodes) node_categories.append(SverchNodeCategory("SVERCHOK_GROUPS", "Groups", items=sv_group_items)) - return node_categories, node_count - - + return node_categories, node_count, original_categories def reload_menu(): - menu, node_count = make_categories() + menu, node_count, original_categories = make_categories() if 'SVERCHOK' in nodeitems_utils._node_categories: nodeitems_utils.unregister_node_categories("SVERCHOK") nodeitems_utils.register_node_categories("SVERCHOK", menu) + + build_help_remap(original_categories) def register(): - menu, node_count = make_categories() + menu, node_count, original_categories = make_categories() if 'SVERCHOK' in nodeitems_utils._node_categories: nodeitems_utils.unregister_node_categories("SVERCHOK") nodeitems_utils.register_node_categories("SVERCHOK", menu) + build_help_remap(original_categories) + print("\n** Sverchok loaded with {i} nodes **".format(i=node_count)) diff --git a/ui/development.py b/ui/development.py index fa7e0c13e..854bd268f 100644 --- a/ui/development.py +++ b/ui/development.py @@ -25,6 +25,7 @@ from bpy.props import StringProperty, CollectionProperty, BoolProperty, FloatPro # global variables in tools import sverchok +from sverchok.utils.sv_help import remapper BRANCH = "" @@ -86,11 +87,19 @@ class SvViewHelpForNode(bpy.types.Operator): def execute(self, context): n = context.active_node + + string_dir = remapper.get(n.bl_idname) + if not string_dir: + return {'CANCELLED'} + else: + filename = n.__module__.split('.')[-1] + help_url = string_dir + '/' + filename + if self.kind == 'online': - destination = 'http://nikitron.cc.ua/sverch/html/nodes/' + n.help_url + '.html' + destination = 'http://nikitron.cc.ua/sverch/html/nodes/' + help_url + '.html' else: basepath = os.path.dirname(sverchok.__file__) + '/docs/nodes/' - destination = r'file:///' + basepath + n.help_url + '.rst' + destination = r'file:///' + basepath + help_url + '.rst' # print(destination) # return {'CANCELLED'} @@ -108,11 +117,11 @@ def idname_draw(self, context): bl_idname = node.bl_idname layout.operator('node.copy_bl_idname', text=bl_idname + ' (copy)').name = bl_idname - if hasattr(node, 'help_url'): - row = layout.row(align=True) - row.label('help') - row.operator('node.view_node_help', text='online').kind = 'online' - row.operator('node.view_node_help', text='offline').kind = 'offline' + # show these anyway, can fail and let us know.. + row = layout.row(align=True) + row.label('help') + row.operator('node.view_node_help', text='online').kind = 'online' + row.operator('node.view_node_help', text='offline').kind = 'offline' def register(): diff --git a/utils/sv_help.py b/utils/sv_help.py new file mode 100644 index 000000000..ec0b4f369 --- /dev/null +++ b/utils/sv_help.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +# ##### 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 ##### + +remapper = {} + +def build_help_remap(fdict): + for k, v in fdict.items(): + print(fdict) + for bl_idname in v: + remapper[bl_idname[0]] = k.lower().replace('_', ' ') + + print(remapper) -- GitLab From a546f5f356a2a1de707ef1474cd66ed0d0a354a2 Mon Sep 17 00:00:00 2001 From: zeffii Date: Fri, 30 Sep 2016 14:18:14 +0200 Subject: [PATCH 10/19] drop debug print from new code --- utils/sv_help.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/utils/sv_help.py b/utils/sv_help.py index ec0b4f369..d18ddc9bc 100644 --- a/utils/sv_help.py +++ b/utils/sv_help.py @@ -24,5 +24,3 @@ def build_help_remap(fdict): print(fdict) for bl_idname in v: remapper[bl_idname[0]] = k.lower().replace('_', ' ') - - print(remapper) -- GitLab From 7b679e57caf27987be0ba65a15d1c12527d37529 Mon Sep 17 00:00:00 2001 From: zeffii Date: Fri, 30 Sep 2016 14:19:27 +0200 Subject: [PATCH 11/19] drop debug print from new code 2 --- utils/sv_help.py | 1 - 1 file changed, 1 deletion(-) diff --git a/utils/sv_help.py b/utils/sv_help.py index d18ddc9bc..e6ab9ff51 100644 --- a/utils/sv_help.py +++ b/utils/sv_help.py @@ -21,6 +21,5 @@ remapper = {} def build_help_remap(fdict): for k, v in fdict.items(): - print(fdict) for bl_idname in v: remapper[bl_idname[0]] = k.lower().replace('_', ' ') -- GitLab From 7c7cf46f51fd0f81da4c496983dc2fbbd62022e6 Mon Sep 17 00:00:00 2001 From: zeffii Date: Sun, 2 Oct 2016 17:41:49 +0200 Subject: [PATCH 12/19] add offline 404 test --- docs/404.css | 21 +++++++++++++++++++++ ui/development.py | 21 +++++++++++++++++---- 2 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 docs/404.css diff --git a/docs/404.css b/docs/404.css new file mode 100644 index 000000000..725045a32 --- /dev/null +++ b/docs/404.css @@ -0,0 +1,21 @@ +#vh { + margin: auto; + position: absolute; + top: 0; + left: 0; + bottom: 0; + right: 0; +} +.box{ + border-radius: 11px; + box-shadow: 0 0 8px rgba(0, 0, 0, 0.2); + padding: 25px; + width: 40em; + height: 7em; + background: white; + font-family: sans-serif; +} + +body { + background: #8acdff; +} \ No newline at end of file diff --git a/ui/development.py b/ui/development.py index 854bd268f..7d7fc8239 100644 --- a/ui/development.py +++ b/ui/development.py @@ -19,6 +19,7 @@ import subprocess import os import webbrowser +from pathlib import Path import bpy from bpy.props import StringProperty, CollectionProperty, BoolProperty, FloatProperty @@ -89,12 +90,24 @@ class SvViewHelpForNode(bpy.types.Operator): n = context.active_node string_dir = remapper.get(n.bl_idname) - if not string_dir: + filename = n.__module__.split('.')[-1] + help_url = string_dir + '/' + filename + + # first let's find if this is a valid doc file, by inspecting locally for the rst file. + VALID = False + try: + tk = os.path.join(os.path.dirname(sverchok.__file__), 'docs', 'nodes', string_dir.replace(' ', '_'), filename + '.rst') + my_file = Path(tk) + VALID = my_file.is_file() + except: + pass + + if not VALID: + local_404 = os.path.join(os.path.dirname(sverchok.__file__), 'docs', '404.html') + webbrowser.open(local_404) return {'CANCELLED'} - else: - filename = n.__module__.split('.')[-1] - help_url = string_dir + '/' + filename + # valid doc link! if self.kind == 'online': destination = 'http://nikitron.cc.ua/sverch/html/nodes/' + help_url + '.html' else: -- GitLab From 26fe9cbe1dc8a41466ea413d7a49a80fb8e287b2 Mon Sep 17 00:00:00 2001 From: zeffii Date: Sun, 2 Oct 2016 17:42:17 +0200 Subject: [PATCH 13/19] add offline 404 test file --- docs/404.html | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 docs/404.html diff --git a/docs/404.html b/docs/404.html new file mode 100644 index 000000000..f7d861ac0 --- /dev/null +++ b/docs/404.html @@ -0,0 +1,25 @@ + + + + + + + Oops + + + + + + +
+ Sorry! It appears that this node doesn't have a document associated with it. +

+ Please contact us on the GitHub issue tracker or any of the following social sites: + G+, VK or Blenderartists. +
+ + + + + + -- GitLab From e5d35fcd157cca2831e4bdad48bebd390ee9635c Mon Sep 17 00:00:00 2001 From: zeffii Date: Sun, 2 Oct 2016 18:30:02 +0200 Subject: [PATCH 14/19] add small non jquery dom manip to local 404 --- docs/404.html | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/docs/404.html b/docs/404.html index f7d861ac0..6498bd738 100644 --- a/docs/404.html +++ b/docs/404.html @@ -12,12 +12,31 @@
- Sorry! It appears that this node doesn't have a document associated with it. + Sorry! It appears that {{bl_idname}} doesn't have a document associated with it.

Please contact us on the GitHub issue tracker or any of the following social sites: G+, VK or Blenderartists.
+ + + -- GitLab From 50aa65c8d1bde8956a58f1e6cc6c139e8c9f5d6c Mon Sep 17 00:00:00 2001 From: zeffii Date: Sun, 2 Oct 2016 18:32:11 +0200 Subject: [PATCH 15/19] drop d3.js dependency --- docs/404.html | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/404.html b/docs/404.html index 6498bd738..9f4549c61 100644 --- a/docs/404.html +++ b/docs/404.html @@ -6,7 +6,6 @@ Oops - -- GitLab From 09c39adc1ea3d285ce52a101bb3bcfc30a7030b5 Mon Sep 17 00:00:00 2001 From: zeffii Date: Mon, 3 Oct 2016 15:05:41 +0200 Subject: [PATCH 16/19] commit prior to eventually removal --- docs/404.html | 8 ++++---- ui/development.py | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/404.html b/docs/404.html index 9f4549c61..b15fcfef2 100644 --- a/docs/404.html +++ b/docs/404.html @@ -11,7 +11,7 @@
- Sorry! It appears that {{bl_idname}} doesn't have a document associated with it. + Sorry! It appears that {{bl_label}} doesn't have a document associated with it.

Please contact us on the GitHub issue tracker or any of the following social sites: G+, VK or Blenderartists. @@ -24,10 +24,10 @@ console.log(parameters); var temp = parameters[0].split("="); - var bl_idname = unescape(temp[1]); - var element = document.getElementById('dumbo') + var bl_label = unescape(temp[1]); + var element = document.getElementById('label') var current_value = element.textContent; - element.textContent = current_value.replace('{{bl_idname}}', bl_idname); + element.textContent = current_value.replace('{{bl_label}}', bl_label); } window.onload = function() { diff --git a/ui/development.py b/ui/development.py index 7d7fc8239..d5d109cdb 100644 --- a/ui/development.py +++ b/ui/development.py @@ -103,7 +103,9 @@ class SvViewHelpForNode(bpy.types.Operator): pass if not VALID: - local_404 = os.path.join(os.path.dirname(sverchok.__file__), 'docs', '404.html') + # bl_label of some nodes is edited by us, but those nodes do have docs .. + local_404 = 'file:///' + os.path.join(os.path.dirname(sverchok.__file__), 'docs', '404.html?bl_label=' + n.bl_idname) + print(local_404) webbrowser.open(local_404) return {'CANCELLED'} -- GitLab From c3d3824c9fe52a7607850d71486151c5e205c498 Mon Sep 17 00:00:00 2001 From: zeffii Date: Mon, 3 Oct 2016 15:35:26 +0200 Subject: [PATCH 17/19] write local file instead of pass vars to 404 --- docs/404.html | 21 +-------------------- ui/development.py | 23 +++++++++++++++++------ 2 files changed, 18 insertions(+), 26 deletions(-) diff --git a/docs/404.html b/docs/404.html index b15fcfef2..05a8f3e91 100644 --- a/docs/404.html +++ b/docs/404.html @@ -11,31 +11,12 @@
- Sorry! It appears that {{bl_label}} doesn't have a document associated with it. + Sorry! It appears that {{variable}} doesn't have a document associated with it.

Please contact us on the GitHub issue tracker or any of the following social sites: G+, VK or Blenderartists.
- - - diff --git a/ui/development.py b/ui/development.py index d5d109cdb..4834beaf5 100644 --- a/ui/development.py +++ b/ui/development.py @@ -103,10 +103,7 @@ class SvViewHelpForNode(bpy.types.Operator): pass if not VALID: - # bl_label of some nodes is edited by us, but those nodes do have docs .. - local_404 = 'file:///' + os.path.join(os.path.dirname(sverchok.__file__), 'docs', '404.html?bl_label=' + n.bl_idname) - print(local_404) - webbrowser.open(local_404) + self.throw_404(n) return {'CANCELLED'} # valid doc link! @@ -115,12 +112,26 @@ class SvViewHelpForNode(bpy.types.Operator): else: basepath = os.path.dirname(sverchok.__file__) + '/docs/nodes/' destination = r'file:///' + basepath + help_url + '.rst' - # print(destination) - # return {'CANCELLED'} webbrowser.open(destination) return {'FINISHED'} + def throw_404(self, n): + # bl_label of some nodes is edited by us, but those nodes do have docs .. + _dirname = os.path.dirname(sverchok.__file__) + path1 = os.path.join(_dirname, 'docs', '404.html') + path2 = os.path.join(_dirname, 'docs', '404_custom.html') + + with open(path1) as origin: + with open(path2, 'w') as destination: + for line in origin: + if '{{variable}}' in line: + destination.write(line.replace("{{variable}}", n.bl_label)) + else: + destination.write(line) + + webbrowser.open(path2) + def idname_draw(self, context): if not displaying_sverchok_nodes(context): -- GitLab From adc89de345317600a1d9807cba150aefae406d3c Mon Sep 17 00:00:00 2001 From: zeffii Date: Mon, 3 Oct 2016 15:35:54 +0200 Subject: [PATCH 18/19] adds 404 file template --- docs/404_custom.html | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 docs/404_custom.html diff --git a/docs/404_custom.html b/docs/404_custom.html new file mode 100644 index 000000000..ce030240d --- /dev/null +++ b/docs/404_custom.html @@ -0,0 +1,24 @@ + + + + + + + Oops + + + + + +
+ Sorry! It appears that Curve Viewer doesn't have a document associated with it. +

+ Please contact us on the GitHub issue tracker or any of the following social sites: + G+, VK or Blenderartists. +
+ + + + + + -- GitLab From 180d12e43fec4a22478b00a2630771f813ea0954 Mon Sep 17 00:00:00 2001 From: zeffii Date: Wed, 5 Oct 2016 20:24:49 +0200 Subject: [PATCH 19/19] use older path detection technique --- ui/development.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ui/development.py b/ui/development.py index 4834beaf5..c4253d8f9 100644 --- a/ui/development.py +++ b/ui/development.py @@ -16,10 +16,10 @@ # # ##### END GPL LICENSE BLOCK ##### -import subprocess import os +from os.path import exists, isfile +import subprocess import webbrowser -from pathlib import Path import bpy from bpy.props import StringProperty, CollectionProperty, BoolProperty, FloatProperty @@ -97,8 +97,7 @@ class SvViewHelpForNode(bpy.types.Operator): VALID = False try: tk = os.path.join(os.path.dirname(sverchok.__file__), 'docs', 'nodes', string_dir.replace(' ', '_'), filename + '.rst') - my_file = Path(tk) - VALID = my_file.is_file() + VALID = exists(tk) and isfile(tk) except: pass -- GitLab