Skip to content

Commit

Permalink
Merge branch 'master' into 2021_gcode_revieling
Browse files Browse the repository at this point in the history
  • Loading branch information
nortikin committed Apr 1, 2021
2 parents f7ab6b8 + 8bef791 commit afff67e
Show file tree
Hide file tree
Showing 89 changed files with 3,157 additions and 768 deletions.
4 changes: 2 additions & 2 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
from sverchok.core import reload_event, handle_reload_event
from sverchok.utils import utils_modules
from sverchok.ui import ui_modules
from sverchok.ui.nodeview_add_menu import perform_menu_monkey_patch

from sverchok.utils.profile import profiling_startup

imported_modules = init_architecture(__name__, utils_modules, ui_modules)
Expand All @@ -92,7 +92,7 @@ def register():
if reload_event:
data_structure.RELOAD_EVENT = True
menu.reload_menu()
# perform_menu_monkey_patch() <-- this hijacks other custom node trees


def unregister():
sverchok.utils.clear_node_classes()
Expand Down
10 changes: 9 additions & 1 deletion core/sockets.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,7 @@ class SvMatrixSocket(NodeSocket, SvSocketCommon):

color = (0.2, 0.8, 0.8, 1.0)
quick_link_to_node = 'SvMatrixInNodeMK4'
nesting_level: IntProperty(default=1)

def do_flatten(self, data):
return flatten_data(data, 1, data_types=(Matrix,))
Expand Down Expand Up @@ -814,7 +815,7 @@ class SvColorSocket(NodeSocket, SvSocketCommon):
default_property: FloatVectorProperty(default=(0, 0, 0, 1), size=4, subtype='COLOR', min=0, max=1,
update=process_from_socket)
expanded: BoolProperty(default=False) # for minimizing showing socket property

nesting_level: IntProperty(default=3)
def draw_property(self, layout, prop_origin=None, prop_name='default_property'):
if prop_origin is None:
prop_origin = self
Expand All @@ -837,6 +838,9 @@ def draw_group_property(self, layout, text, interface_socket):
layout.prop(self, 'default_property', text=text)
else:
layout.label(text=text)

def do_flat_topology(self, data):
return flatten_data(data, 3)

class SvDummySocket(NodeSocket, SvSocketCommon):
'''Dummy Socket for sockets awaiting assignment of type'''
Expand Down Expand Up @@ -1232,6 +1236,10 @@ class SvLinkNewNodeInput(bpy.types.Operator):
bl_idname = "node.sv_quicklink_new_node_input"
bl_label = "Add a new node to the left"

@classmethod
def poll(cls, context):
return hasattr(context, 'socket')

def execute(self, context):
tree, node, socket = context.node.id_data, context.node, context.socket

Expand Down
3 changes: 2 additions & 1 deletion docs/nodes/analyzer/analyzer_index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ Analyzers
kd_tree_path
linked_verts
mesh_filter
mesh_select
mesh_select_mk2
select_similar
proportional
normals
nearest_point_on_mesh
bvh_overlap_polys
object_insolation
path_length_2
Expand Down
File renamed without changes.
53 changes: 53 additions & 0 deletions docs/nodes/analyzer/nearest_point_on_mesh.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Nearest Point on Mesh
=====================

Functionality
-------------

Finds the closest point in a specified mesh.

Inputs
------

Vertices, Faces: Base mesh for the search
Points: Points to query
Distance: Maximum query distance (only for Nearest in Range mode)

Parameters
----------

*Mode*:
- Nearest: Nearest point on the mesh surface
- Nearest in range: Nearest points on the mesh within a range (one per face)

*Flat Output*: (only in Nearest in Range) Flattens the list of every vertex to have only a list for every inputted list.

*Safe Check*: (in N-Panel) When disabled polygon indices referring to unexisting points will crash Blender. Not performing this check makes node faster

Outputs
-------

*Location*: Position of the closest point in the mesh

*Normal*: mesh normal at closets point

*Index*: Face index of the closest point

*Distance*: Distance from the queried point to the closest point

Examples
--------

Used as skin-wrap modifier:

.. image:: https://user-images.githubusercontent.com/10011941/111774583-f3733480-88af-11eb-9559-78392166b00c.png


Determine which polygons are nearer than a distance:

.. image:: https://user-images.githubusercontent.com/10011941/111812010-f255fd80-88d7-11eb-8f48-de67716dd93a.png


Placing objects on mesh:

.. image:: https://user-images.githubusercontent.com/10011941/111810852-bf5f3a00-88d6-11eb-9cff-eb2a6c18a01a.png
77 changes: 45 additions & 32 deletions docs/nodes/list_main/statistics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ List Statistics
Functionality
-------------

List Statistics node computes various statistical quantities for the values in a list.
List Statistics node computes various statistical quantities for the input values.

Inputs
------
Expand All @@ -17,42 +17,55 @@ Parameters

The **Function** parameter allows to select the statistical function to compute the corresponding statistical quantity for the input values.

+----------------+---------------------+---------+------------------------------------------+
| Param | Type | Default | Description |
+================+=====================+=========+==========================================+
| **Function** | Enum | Average | The statistical function applied to |
| | All Statistics | | the input values. |
| | Sum | | |
| | Sum Of Squares | | For "All Statistics" selection the node |
| | Product | | computes and outputs the statistical |
| | Average | | quantities for all the statistical |
| | Geometric Mean | | functions along with their corresponding |
| | Harmonic Mean | | names. |
| | Standard Deviation | | |
| | Root Mean Square | | |
| | Skewness | | |
| | Kurtosis | | |
| | Minimum | | |
| | Maximum | | |
| | Median | | |
| | Percentile | | |
| | Histogram | | |
+----------------+---------------------+---------+------------------------------------------+
| **Percentage** | Float | 0.75 | The percentage value for the |
| | | | percentile function. [1] |
+----------------+---------------------+---------+------------------------------------------+
| **Normalize** | Boolean | False | Flag to normalize the histogram bins |
| | | | to the given normalize size. [2] |
+----------------+---------------------+---------+------------------------------------------+
| **Bins** | Int | 10 | The number of bins in the histogram. [2] |
+----------------+---------------------+---------+------------------------------------------+
| **Size** | Float | 10.00 | The normalized size of the histogram.[2] |
+----------------+---------------------+---------+------------------------------------------+
+----------------+----------------------+---------+-------------------------------------------+
| Param | Type | Default | Description |
+================+======================+=========+===========================================+
| **Function** | Enum | Average | The statistical function applied to |
| | All Statistics | | the input values. |
| | Selected Statistics | | |
| | | | |
| | Sum | | |
| | Sum Of Squares | | |
| | Sum Of Inverse | | For "All Statistics" selection the node |
| | Product | | computes and outputs the statistical |
| | Average | | quantities for all the statistical |
| | Geometric Mean | | functions along with their corresponding |
| | Harmonic Mean | | names. |
| | Variance | | |
| | Standard Deviation | | |
| | Standard Error | | |
| | Root Mean Square | | For "Selected Statistics" selection the |
| | Skewness | | node computes and outputs the statistical |
| | Kurtosis | | quantities for the selected statistical |
| | Minimum | | functions along with their corresponding |
| | Maximum | | names. |
| | Range | | |
| | Median | | |
| | Percentile | | |
| | Histogram | | |
| | Count | | |
+----------------+----------------------+---------+-------------------------------------------+
| **Percentage** | Float | 0.75 | The percentage value for the |
| | | | percentile function. [1] |
+----------------+----------------------+---------+-------------------------------------------+
| **Normalize** | Boolean | False | Flag to normalize the histogram bins |
| | | | to the given normalize size. [2] |
+----------------+----------------------+---------+-------------------------------------------+
| **Bins** | Int | 10 | The number of bins in the histogram. [2] |
+----------------+----------------------+---------+-------------------------------------------+
| **Size** | Float | 10.00 | The normalized size of the histogram.[2] |
+----------------+----------------------+---------+-------------------------------------------+

Notes:
[1] : The **Percentage** input socket is available only for the **Percentile** function.
[2] : The **Normalize** setting and the **Bins** and **Size** input sockets are available only for the **Histogram** function.

Extra Parameters
----------------
The Property Panel contains additional settings to configure the statistics drawn in the node editor: font, text color, text scale and floating point presicion of the displayed statistics, the x/y offsest of the displayed statistics relative to the node and a setting for toggling the statistics names between full names and abreviations.

The fonts used for this node are monospace fonts for best text alignment.

Outputs
-------
**Name(s)**
Expand Down
2 changes: 1 addition & 1 deletion docs/nodes/matrix/matrix_index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Matrix
input
interpolation
matrix_in_mk4
matrix_out
matrix_out_mk2
matrix_math
matrix_track_to
shear
Expand Down
2 changes: 0 additions & 2 deletions docs/nodes/matrix/matrix_out.rst

This file was deleted.

79 changes: 79 additions & 0 deletions docs/nodes/matrix/matrix_out_mk2.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
Matrix Out
==========

Functionality
-------------

Matrix Out node converts a 4x4 matrix into its location, rotation and scale components. The rotation component can be represented in various formats: quaternion, axis-angle or Euler angles.


Modes
-----

The available **Modes** are: EULER, AXIS-ANGLE & QUATERNION. These specify
how the output *rotation component* of the matrix is going to be represented.

Regardless of the selected mode the node always outputs the **Location** and the **Scale** components of the 4x4 matrix.

+------------+---------------------------------------------------------------------------------------+
| Mode | Description |
+============+=======================================================================================+
| EULER | Converts the rotation component of the matrix into X, Y, Z angles |
| | corresponding to the Euler rotation given an Euler rotation order. [1,2] |
+------------+---------------------------------------------------------------------------------------+
| AXIS-ANGLE | Converts the rotation component of the matrix into the Axis & Angle of rotation. [1] |
+------------+---------------------------------------------------------------------------------------+
| QUATERNION | Converts the rotation component of the matrix into a quaternion. |
+------------+---------------------------------------------------------------------------------------+

Notes:
[1] : For EULER and AXIS-ANGLE modes, which output angles, the node provides an angle unit conversion to let the angle output values be converted to Radians, Degrees or Unities (0-1 range).
[2] : For EULER mode the node provides the option to select the Euler rotation order: "XYZ", "XZY", "YXZ", "YZX", "ZXY" or "ZYX".


Inputs
------

**Matrix**
The node takes a list of (one or more) matrices and based on the selected mode
it converts the matrices into the corresponding components.


Extra Parameters
----------------
A set of extra parameters are available on the property panel.
These parameters do not receive external input.

+-----------------+----------+---------+--------------------------------------+
| Extra Param | Type | Default | Description |
+=================+==========+=========+======================================+
| **Angle Units** | Enum | DEGREES | Interprets the angle values based on |
| | RADIANS | | the selected angle units: |
| | DEGREES | | Radians = 0 - 2pi |
| | UNITIES | | Degrees = 0 - 360 |
| | | | Unities = 0 - 1 |
+-----------------+----------+---------+--------------------------------------+


Outputs
=======

Based on the selected **Mode** the node makes available the corresponding output sockets:

+------------+-----------------------------------------+
| Mode | Output Sockets (types) |
+============+=========================================+
| <any> | Location and Scale components (vectors) |
+------------+-----------------------------------------+
| EULER | X, Y, Z angles (floats) [1] |
+------------+-----------------------------------------+
| AXIS-ANGLE | Axis (vector) & Angle (float) [1] |
+------------+-----------------------------------------+
| QUATERNION | Quaternion |
+------------+-----------------------------------------+

Notes:
[1] : The angles are by default in DEGREES. The Property Panel has option to set angle units as: RADIANS, DEGREES or UNITIES.

The node only generates the conversion when the output sockets are connected.

5 changes: 3 additions & 2 deletions docs/nodes/number/curve_mapper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ This node has the following outputs:
always lying in XOY plane along the OX axis. The domain of the curve is
defined by **Min X** and **Max X** parameters, which are defined in the curve
editor widget.
* **Control Points: Location over the XOY Plane of the control points of the widget.
It can be used as a 2D slider.
Examples
--------
Expand All @@ -40,9 +42,8 @@ Basic range remapping:

Using the node to define the column profile:

.. image:: https://raw.githubusercontent.com/vicdoval/sverchok/docs_images/images_for_docs/number/Curve%20Mapper/curve_mapper_sverchok__blender_example_2.png
.. image:: https://raw.githubusercontent.com/vicdoval/sverchok/docs_images/images_for_docs/number/Curve%20Mapper/curve_mapper_sverchok__blender_example_2.png

Example of the Curve output usage:

.. image:: https://user-images.githubusercontent.com/284644/80520701-4051d200-89a3-11ea-92fd-2f2f2004e4e7.png

9 changes: 6 additions & 3 deletions docs/nodes/number/easing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@ https://zeffii.github.io/docs_easing_node/
the original development thread is here:
https://github.com/nortikin/sverchok/issues/695

You can see kind of curve, because we draw it to the right of the node.
add the node to the tree, and scroll through the list of options.
You can see the kind of easing curve because we draw it to the right of the node.
Add the node to the tree and connect something useful to the input, and scroll through the list of easing curve types.

|visual_viewport|

.. |visual_easing| image:: https://user-images.githubusercontent.com/619340/82451459-51779580-9aae-11ea-9dce-9a4dc1236014.png

.. |visual_easing| image:: https://user-images.githubusercontent.com/619340/82451459-51779580-9aae-11ea-9dce-9a4dc1236014.png
.. |visual_viewport| image:: https://user-images.githubusercontent.com/619340/111627552-76808600-87ef-11eb-9929-f9295d766623.png
18 changes: 16 additions & 2 deletions docs/nodes/object_nodes/getsetprop_mk2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,33 @@ There are also convenience aliases. Instead of writing ``bpy.data.objects['Cube'
"mats": "bpy.data.materials",
"M": "bpy.data.materials",
"meshes": "bpy.data.meshes",
"texts": "bpy.data.texts"
"texts": "bpy.data.texts",
"nodes": node_tree.nodes,
"ng": "bpy.data.node_groups"
}

useful info for path lookups:

Many properties can be right-clicked and have the option to "copy data path" (to your clipboard for pasting), this can help reduce some console probing / documentation reading.

Usually, however, you will need to provide the start of the path yourself. For example: if you copy the path to one of the Color properties in a ColorRamp of a shader, then following will be be copied to the clipboard:
Usually, however, you will need to provide the start of the path yourself. You must provide an explicit path to a distinct node tree. For example: if you copy the path to one of the Color properties in a ColorRamp of a shader, then following will be be copied to the clipboard:

``node_tree.nodes["ColorRamp"].color_ramp.elements[0].color`` ,

this is not the full path, you will need to add the path to the ``node_tree``, something like: ``bpy.data.materials['Material'].node_tree.nodes["ColorRamp"].color_ramp.elements[0].color``, then the node will know what your intention is.

Alias ``nodes``
---------------

The alias ``nodes`` allows you to reference nodes in the current node tree (ie, a sverchok node tree) by writing::
nodes["your node"].inputs[0].default_int_property

Alias ``ng``
------------

If you are referencing a different sverchok nodetree, you write ``ng["NodeTreeName"].nodes["NodeName]..etc``


Input
-----
Expand Down
1 change: 1 addition & 0 deletions docs/nodes/object_nodes/object_nodes_index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ Objects
assign_materials
material_index
set_custom_uv_map
set_loop_normals
Loading

0 comments on commit afff67e

Please sign in to comment.