• S sverchok
  • Информация о проекте
    • Информация о проекте
    • Активность
    • Метки
    • Участники
  • Репозиторий
    • Репозиторий
    • Файлы
    • Коммиты
    • Ветки
    • Теги
    • Участники
    • Диаграмма
    • Сравнение
  • Задачи 148
    • Задачи 148
    • Список
    • Доски
    • Спринты
  • Запросы на слияние 21
    • Запросы на слияние 21
  • CI/CD
    • CI/CD
    • Конвейеры
    • Задания
    • Расписания
  • Развертывания
    • Развертывания
    • Окружения
    • Релизы
  • Пакеты и реестры
    • Пакеты и реестры
    • Реестр пакетов
    • Реестр контейнеров
  • Мониторинг
    • Мониторинг
    • Инциденты
  • Аналитика
    • Аналитика
    • Поток ценности
    • CI/CD
    • Репозиторий
  • Wiki
    • Wiki
  • Сниппеты
    • Сниппеты
  • Активность
  • Диаграмма
  • Создать новую задачу
  • Задания
  • Коммиты
  • Доски с задачами
Свернуть панель
  • nikitronn
  • sverchok
  • Wiki
  • LowLevelNodeDetails

LowLevelNodeDetails · Изменения

История страницы
Created LowLevelNodeDetails (markdown) создал Май 05, 2017 по автору Dealga McArdle's avatar Dealga McArdle
Показать
Построчно Рядом
LowLevelNodeDetails.md 0 → 100644
Просмотреть страницу @361900a8
## Low Level Details
I'll say this again, the best place to look for objective information about this is to read the code of existing nodes. Start with simpler nodes. Anyone who has contributed to Sverchok has been able to understand the boilerplate stuff mentioned above, most of the problems have come from being unfamiliar with Python. Having said that, there are a few things that might be helpful to explain.
#### getting data from sockets / setting data on sockets
You can reference a socket by index or name, you'll see we use whatever is convenient.
##### inputs
```python
socket = self.inputs[socket_name] # by name
socket = self.inputs[0] # by index
data = socket.sv_get()
```
##### outputs
```python
socket = self.outputs[socket_name] # by name
socket = self.outputs[0] # by index
socket.sv_set(data)
```
#### data with layers / nested data
We often pass around multiple lists inside a socket stream, like `[list1, list2, list3]`, each list can have a different length but should carry comparable data at the lowest level. For example: Never pass edges and polygons in a single socket stream. Pass either edges or polygons. There are several nodes with sockets labelled 'poly_edge', do not use those nodes as an example of good practice.
The main confusion we've seen people face is the nestedness of the input socket data, you can narrow down the level of nestedness by indexing:
```python
data = socket_verts.sv_get() # don't unwrap (level 0)
data = socket_verts.sv_get()[0] # take first element (level 1)
data = socket_verts.sv_get()[0][0] # take first element of first element. (level 2)
```
![img](https://cloud.githubusercontent.com/assets/619340/23399114/639cdc34-fd9f-11e6-8aa2-0238f2020373.png)
Клонировать репозиторий

Sverchok Node Tutorial

  • High Level Overview
  • Details