├── .gitattributes ├── .gitignore ├── LICENSE.md ├── MainMenuCommon.xml ├── PaneTabTypeMenu.xml ├── README.md ├── python3.7libs ├── __init__.py └── vex_snippet_library │ ├── __init__.py │ ├── main_panel.py │ └── widgets │ ├── __init__.py │ ├── button_table.py │ ├── snippet_editor.py │ ├── snippet_viewer.py │ ├── vex_editor.py │ └── vex_highlighter.py ├── python_panels └── vex_snippet_library.pypanel ├── resources ├── fonts │ └── SourceCodePro-Regular.ttf ├── icons │ ├── add.svg │ ├── cancel.png │ ├── clear_filter.svg │ ├── copy.png │ ├── delete.svg │ ├── display_primitive_normals.svg │ ├── edit.png │ ├── filter_color_blue.svg │ ├── filter_color_purple.svg │ ├── info.svg │ └── save.png ├── readme.jpg └── vex_syntax │ ├── validate.txt │ ├── vex_comments.txt │ ├── vex_data_types.txt │ ├── vex_functions.txt │ ├── vex_keywords.txt │ ├── vex_macros.txt │ └── vex_operators.txt └── vex_snippet_library.json /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # options.ini 2 | options.ini 3 | 4 | # Byte-compiled / optimized / DLL files 5 | __pycache__/ 6 | *.py[cod] 7 | 8 | # Json snippets 9 | *.json 10 | 11 | # C extensions 12 | *.so 13 | 14 | # Distribution / packaging 15 | bin/ 16 | build/ 17 | develop-eggs/ 18 | dist/ 19 | eggs/ 20 | lib/ 21 | lib64/ 22 | parts/ 23 | sdist/ 24 | var/ 25 | *.egg-info/ 26 | .installed.cfg 27 | *.egg 28 | 29 | # Installer logs 30 | pip-log.txt 31 | pip-delete-this-directory.txt 32 | 33 | # Unit test / coverage reports 34 | .tox/ 35 | .coverage 36 | .cache 37 | nosetests.xml 38 | coverage.xml 39 | 40 | # Translations 41 | *.mo 42 | 43 | # Mr Developer 44 | .mr.developer.cfg 45 | .project 46 | .pydevproject 47 | 48 | # Rope 49 | .ropeproject 50 | 51 | # Django stuff: 52 | *.log 53 | *.pot 54 | 55 | # Sphinx documentation 56 | docs/_build/ 57 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 dchow1992 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MainMenuCommon.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | windows_menu_sep_2 9 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /PaneTabTypeMenu.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Vex Snippet Library 2 | ## Python Panel utility for creating, storing, and accessing vex snippets in Houdini. 3 | 4 | https://vimeo.com/665899325 5 | 6 | ![Image of the Panel](/resources/readme.jpg?raw=true) 7 | 8 | ## Installation 9 | * Copy vex_snippet_library.json to $HOUDINI_USER_PREF_DIR/packages 10 | * Inside the package file, change "path/to/root" to the root folder of vex_snippet_library 11 | ``` 12 | e.g. "VEX_SNIPPET_LIBRARY": "C:\Users\myuser\Documents\houdini_markingmenu" 13 | ``` 14 | -------------------------------------------------------------------------------- /python3.7libs/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /python3.7libs/vex_snippet_library/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /python3.7libs/vex_snippet_library/main_panel.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | import json 4 | 5 | import logging 6 | 7 | import sys 8 | 9 | import configparser 10 | 11 | from PySide2 import QtWidgets, QtCore, QtGui 12 | 13 | from .widgets import snippet_editor 14 | 15 | from .widgets import snippet_viewer 16 | 17 | from .widgets import button_table 18 | 19 | logger = logging.getLogger(__name__) 20 | logger.setLevel(logging.INFO) 21 | 22 | 23 | class Options(object): 24 | def __init__(self, root_dir): 25 | self.package = root_dir 26 | self.config = os.path.join(self.package, 'options.ini') 27 | 28 | if not os.path.isfile(self.config): 29 | self.build_default_options() 30 | 31 | def build_default_options(self): 32 | config = configparser.ConfigParser() 33 | config.add_section('GENERAL') 34 | 35 | editor_font_default = 7 36 | if sys.platform == "linux" or sys.platform == "linux2": 37 | editor_font_default = 9 38 | 39 | config.set( 40 | 'GENERAL', 'editor_font_size', '{}'.format(editor_font_default)) 41 | 42 | with open(self.config, 'w+') as f: 43 | config.write(f) 44 | 45 | def read(self): 46 | config = configparser.ConfigParser() 47 | config.read(self.config) 48 | return { 49 | 'editor_font_size': config.getfloat('GENERAL', 'editor_font_size') 50 | } 51 | 52 | 53 | class Snippet(object): 54 | def __init__(self, input_dict): 55 | self.label = input_dict['label'] 56 | self.context = input_dict['context'] 57 | self.data = input_dict['data'] 58 | self.new_name = '' 59 | 60 | def to_dict(self): 61 | return { 62 | 'label': self.label, 63 | 'context': self.context, 64 | 'data': self.data 65 | } 66 | 67 | 68 | class VexSnippetLibrary(QtWidgets.QWidget): 69 | def __init__(self): 70 | super(VexSnippetLibrary, self).__init__() 71 | self._creating = False 72 | self._editing = False 73 | self.snippet = None 74 | self._snippet_data = {} 75 | self.cached_index = None 76 | self.cached_label = '' 77 | self.new_label = '' 78 | self.root = os.path.abspath( 79 | os.path.join(os.path.abspath(__file__), '..', '..', '..')) 80 | self.json_path = os.path.join(self.root, 'json') 81 | self.options = Options(self.root).read() 82 | self._init_ui() 83 | 84 | def _init_ui(self): 85 | logger.debug('initializing panel..') 86 | self.layout = QtWidgets.QHBoxLayout(self) 87 | 88 | self.snippet_viewer = snippet_viewer.SnippetViewer(self) 89 | self.snippet_editor = snippet_editor.SnippetEditor(self) 90 | self.vex_editor = self.snippet_editor.editor 91 | self.vex_editor.setFont( 92 | QtGui.QFont('Source Code Pro', self.options['editor_font_size'])) 93 | self.table = self.snippet_viewer.table 94 | self.model = self.table.model 95 | 96 | self.splitter = QtWidgets.QSplitter(QtCore.Qt.Horizontal) 97 | self.splitter.addWidget(self.snippet_viewer) 98 | self.splitter.addWidget(self.snippet_editor) 99 | self.splitter.setSizes([200, 200]) 100 | self.splitter.setStretchFactor(1, 2.5) 101 | 102 | self.snippet_viewer.add_btn.clicked.connect(self.begin_new_snippet) 103 | self.snippet_viewer.del_btn.clicked.connect(self.delete_snippet) 104 | self.snippet_editor.edit_btn.clicked.connect(self.edit_snippet) 105 | self.snippet_editor.save_btn.clicked.connect(self.save_snippet) 106 | self.snippet_editor.cancel_btn.clicked.connect(self.discard_snippet) 107 | self.model.dataChanged.connect(self.label_renamed) 108 | self.table.selectionModel().selectionChanged.connect( 109 | self.update_selection) 110 | 111 | self.layout.addWidget(self.splitter) 112 | 113 | self.snippet_editor.edit_btn.blockSignals(True) 114 | if not os.path.isdir(self.json_path): 115 | os.makedirs(self.json_path) 116 | 117 | self.load_snippets() 118 | 119 | # initial selection 120 | idx = self.table.filter.index(0, 0) 121 | self.snippet = idx.data(role=QtCore.Qt.UserRole) 122 | self.table.setCurrentIndex(idx) 123 | 124 | def load_snippets(self): 125 | snippets = [] 126 | for (dirpath, dirnames, filenames) in os.walk(self.json_path): 127 | for file in filenames: 128 | head, tail = os.path.splitext(file) 129 | if tail == '.json': 130 | snippets.append(os.path.join(dirpath, file)) 131 | for file in snippets: 132 | with open(file, 'r') as f: 133 | item_dict = json.load(f) 134 | self.table.add_item(Snippet(item_dict)) 135 | 136 | def begin_new_snippet(self): 137 | self.table.blockSignals(True) 138 | new_label, ok = QtWidgets.QInputDialog().getText( 139 | self, 140 | 'Create', 141 | 'Snippet Name:', 142 | QtWidgets.QLineEdit.Normal, 143 | 'NewSnippet') 144 | self.table.blockSignals(False) 145 | 146 | if ok and new_label: 147 | self._creating = True 148 | self.new_label = self.model.build_unique_label(new_label) 149 | self.table.selectionModel().reset() 150 | self.snippet_editor.edit_btn.blockSignals(False) 151 | self.snippet_editor.edit_btn.animateClick() 152 | self.vex_editor.setPlainText('') 153 | 154 | def save_snippet(self): 155 | new_snippet = self.build_new_snippet() 156 | self.write_snippet(new_snippet) 157 | self.snippet_viewer.setEnabled(True) 158 | 159 | if self._editing: 160 | filter_idx = self.table.currentIndex() 161 | model_idx = self.table.filter.mapToSource(filter_idx) 162 | snippet = self.model.data(model_idx, QtCore.Qt.UserRole) 163 | snippet.context = self.snippet_editor.combo.currentText() 164 | snippet.data = self.vex_editor.toPlainText().strip() + '\n' 165 | self.model.setData(model_idx, snippet, QtCore.Qt.UserRole) 166 | self.vex_editor.setPlainText(snippet.data) 167 | if self._creating: 168 | self.table.add_item(new_snippet) 169 | rows = self.model.rowCount() 170 | model_idx = self.model.index(rows - 1, 0) 171 | filter_idx = self.table.filter.mapFromSource(model_idx) 172 | if not self.snippet: 173 | self.snippet = self.model.data(model_idx, QtCore.Qt.UserRole) 174 | self.table.setCurrentIndex(filter_idx) 175 | 176 | self._creating = False 177 | self._editing = False 178 | 179 | def edit_snippet(self): 180 | if not self._creating: 181 | if self.table.selectionModel().hasSelection(): 182 | self._editing = True 183 | self.snippet_viewer.setEnabled(False) 184 | self.update_selection() 185 | else: 186 | self.snippet_viewer.setEnabled(False) 187 | 188 | def discard_snippet(self): 189 | self.vex_editor.setPlainText('') 190 | if self._creating: 191 | self.table.blockSignals(False) 192 | self.snippet_viewer.setEnabled(True) 193 | if self.cached_index: 194 | self.vex_editor.setPlainText(self.snippet.data) 195 | self._creating = False 196 | self._editing = False 197 | 198 | def build_new_snippet(self): 199 | snippet_context = self.snippet_editor.combo.currentText() 200 | snippet_text = self.vex_editor.toPlainText().strip() + '\n' 201 | snippet_label = self.snippet.label if self.snippet else '' 202 | if self._creating: 203 | snippet_label = self.new_label 204 | new_dict = { 205 | 'label': snippet_label, 206 | 'context': snippet_context, 207 | 'data': snippet_text 208 | } 209 | return Snippet(new_dict) 210 | 211 | def write_snippet(self, snippet): 212 | logger.debug('Writing snippet: {}'.format(snippet.to_dict())) 213 | new_json = os.path.join( 214 | self.json_path, '{}.json'.format(snippet.label)) 215 | with open(new_json, 'w+') as f: 216 | json.dump(snippet.to_dict(), f, indent=4) 217 | 218 | def delete_snippet(self): 219 | sel = self.table.selectionModel().selectedIndexes() 220 | if sel: 221 | filter_idx = sel[0] 222 | model_idx = self.table.filter.mapToSource(filter_idx) 223 | data = self.model.data(model_idx, QtCore.Qt.DisplayRole) 224 | to_del = os.path.join(self.json_path, '{}.json'.format(data)) 225 | if os.path.isfile(to_del): 226 | os.remove(to_del) 227 | self.table.remove_item() 228 | logger.debug('removed item') 229 | self.table.selectionModel().clear() 230 | self.update_selection() 231 | 232 | def update_selection(self): 233 | sel = self.table.selectionModel().selectedIndexes() 234 | logger.debug(sel) 235 | if sel: 236 | self.snippet_editor.edit_btn.blockSignals(False) 237 | self.cached_index = sel[0] 238 | self.cached_label = self.snippet.label 239 | self.snippet = self.cached_index.data(role=QtCore.Qt.UserRole) 240 | self.vex_editor.setPlainText(self.snippet.data) 241 | combo_index = self.snippet_editor.combo.findText( 242 | self.snippet.context) 243 | self.snippet_editor.combo.setCurrentIndex(combo_index) 244 | logger.debug('New Selection: (From: {}, To: {})'.format( 245 | self.cached_label, self.snippet.label)) 246 | else: 247 | logger.debug('Selection Cleared') 248 | self.cached_index = None 249 | self.snippet_editor.edit_btn.blockSignals(True) 250 | self.vex_editor.setPlainText('') 251 | self.snippet_viewer.add_btn.setFocus() # table select hotfix 252 | 253 | def label_renamed(self, top_left, bottom_right, roles): 254 | if QtCore.Qt.EditRole not in roles: 255 | return 256 | logger.debug('Rename: (From: {}, To: {})'.format( 257 | self.snippet.label, self.snippet.new_name)) 258 | 259 | snippet = top_left.data(role=QtCore.Qt.UserRole) 260 | src = os.path.join(self.json_path, '{}.json'.format(snippet.label)) 261 | dst = os.path.join(self.json_path, '{}.json'.format(snippet.new_name)) 262 | os.rename(src, dst) 263 | 264 | self.model.beginResetModel() 265 | self.table.blockSignals(True) 266 | snippet.label = snippet.new_name 267 | self.model.endResetModel() 268 | self.table.blockSignals(False) 269 | 270 | self.write_snippet(snippet) 271 | filter_idx = self.table.filter.mapFromSource(top_left) 272 | self.table.setCurrentIndex(filter_idx) 273 | 274 | 275 | if __name__ == '__main__': 276 | app = QtWidgets.QApplication(sys.argv) 277 | editor = VexSnippetLibrary() 278 | editor.setGeometry(355, 225, 800, 800) 279 | editor.show() 280 | 281 | app.exec_() 282 | -------------------------------------------------------------------------------- /python3.7libs/vex_snippet_library/widgets/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /python3.7libs/vex_snippet_library/widgets/button_table.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | import re 4 | 5 | import string 6 | 7 | import logging 8 | 9 | from PySide2 import QtCore, QtGui, QtWidgets 10 | 11 | logger = logging.getLogger('vex_snippet_library.main_panel.button_table') 12 | 13 | 14 | class ButtonDelegate(QtWidgets.QStyledItemDelegate): 15 | copyRequest = QtCore.Signal(QtCore.QModelIndex) 16 | 17 | def __init__(self, parent): 18 | super().__init__(parent) 19 | 20 | def paint(self, painter, option, index): 21 | if isinstance(self.parent(), QtWidgets.QAbstractItemView): 22 | self.parent().openPersistentEditor(index) 23 | super(ButtonDelegate, self).paint(painter, option, index) 24 | 25 | def createEditor(self, parent, option, index): 26 | editor = QtWidgets.QPushButton(parent) 27 | editor.setToolTip('Copy Snippet') 28 | root = os.path.abspath( 29 | os.path.join(os.path.abspath(__file__), '..', '..', '..', '..')) 30 | icons = os.path.join(root, 'resources', 'icons') 31 | icon = QtGui.QIcon(QtGui.QPixmap(os.path.join(icons, 'copy.png'))) 32 | editor.setIcon(icon) 33 | 34 | table = self.parent() 35 | row_height = table.verticalHeader().defaultSectionSize() 36 | editor.setIconSize(QtCore.QSize(row_height/1.7, row_height/1.7)) 37 | editor.setFixedSize(row_height/1.1, row_height/1.1) 38 | editor.clicked.connect(lambda: self.copyRequest.emit(index)) 39 | return editor 40 | 41 | def setEditorData(self, editor, index): 42 | pass 43 | 44 | def setModelData(self, editor, model, index): 45 | pass 46 | 47 | def updateEditorGeometry(self, editor, option, index): 48 | rect = option.rect 49 | rect.setX(rect.x() + rect.width()/2-editor.size().width()/2) 50 | rect.setY(rect.y() + rect.height()/2-editor.size().height()/2) 51 | editor.setGeometry(rect) 52 | 53 | 54 | class SnippetModel(QtCore.QAbstractTableModel): 55 | def __init__(self, parent=None): 56 | super(SnippetModel, self).__init__() 57 | self.table_data = [] 58 | self.n_columns = 2 59 | 60 | def rowCount(self, parent=QtCore.QModelIndex()): 61 | return len(self.table_data) 62 | 63 | def columnCount(self, parent=QtCore.QModelIndex()): 64 | return self.n_columns 65 | 66 | def flags(self, index): 67 | col = index.column() 68 | if col == 0: 69 | return (QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable | 70 | QtCore.Qt.ItemIsEditable) 71 | else: 72 | return QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable 73 | 74 | def data(self, index, role): 75 | if not index.isValid(): 76 | return None 77 | item = self.table_data[index.row()] 78 | if role == QtCore.Qt.DisplayRole: 79 | if index.column() == 1: # button column 80 | return None 81 | return item.label 82 | elif role == QtCore.Qt.UserRole: 83 | return item 84 | elif role == QtCore.Qt.EditRole or role == QtCore.Qt.ToolTipRole: 85 | return item.label 86 | elif role == QtCore.Qt.DecorationRole: 87 | if index.column() == 0: 88 | img = { 89 | 'Detail': 'info.svg', 90 | 'Points': 'filter_color_blue.svg', 91 | 'Primitives': 'display_primitive_normals.svg', 92 | 'Vertices': 'filter_color_purple.svg' 93 | } 94 | root = os.path.abspath( 95 | os.path.join(__file__, '..', '..', '..', '..')) 96 | icons = os.path.join(root, 'resources', 'icons') 97 | path = os.path.join(icons, img[item.context]) 98 | pxmap = QtGui.QPixmap(path) 99 | icon = QtGui.QIcon(pxmap) 100 | return icon 101 | 102 | def setData(self, index, value, role=QtCore.Qt.EditRole): 103 | if index.isValid(): 104 | item = self.table_data[index.row()] 105 | if role == QtCore.Qt.EditRole: 106 | is_valid = re.match(r'^(?=.*[^\W_])[\w ]*$', value) 107 | if not is_valid: 108 | return False 109 | if item.label == value: 110 | return True 111 | item.new_name = self.build_unique_label(value) 112 | self.table_data[index.row()] = item 113 | self.dataChanged.emit(index, index, [QtCore.Qt.EditRole]) 114 | return True 115 | elif role == QtCore.Qt.UserRole: 116 | self.table_data[index.row()] = value 117 | # self.dataChanged.emit(index, index, [QtCore.Qt.DecorationRole]) 118 | return True 119 | else: 120 | return False 121 | 122 | def removeRows(self, pos, rows=1): 123 | self.beginRemoveRows(QtCore.QModelIndex(), pos, pos + rows - 1) 124 | self.table_data.pop(pos) 125 | self.endRemoveRows() 126 | return True 127 | 128 | def insertRows(self, data): 129 | n = self.rowCount() 130 | self.beginInsertRows(QtCore.QModelIndex(), n, n) 131 | data.label = self.build_unique_label(data.label) 132 | self.table_data.append(data) 133 | self.endInsertRows() 134 | 135 | def build_unique_label(self, input_str): 136 | new_name = input_str.strip().replace(' ', '_') 137 | data = self.table_data 138 | labels = [x.label for x in data] 139 | while(new_name in labels): 140 | head = new_name.rstrip(string.digits) 141 | tail = new_name.replace(head, '') 142 | digit = int(tail) + 1 if tail else 1 143 | new_name = '{}{}'.format(head, digit) 144 | return new_name 145 | 146 | 147 | class SnippetProxyModel(QtCore.QSortFilterProxyModel): 148 | def __init(self, parent): 149 | super(SnippetProxyModel, self).__init__(parent) 150 | 151 | def lessThan(self, left, right): 152 | left_data = self.sourceModel().data(left, role=QtCore.Qt.DisplayRole) 153 | right_data = self.sourceModel().data(right, role=QtCore.Qt.DisplayRole) 154 | input_set = set([left_data, right_data]) 155 | sorted_set = self.sorted_nicely(input_set) 156 | return right_data == sorted_set[0] 157 | 158 | def sorted_nicely(self, input_set): 159 | """ Sort the given iterable in the way that humans expect.""" 160 | conv = lambda text: int(text) if text.isdigit() else text.lower() 161 | alphanum_key = lambda key: [conv(c) for c in re.split('([0-9]+)', key)] 162 | return sorted(input_set, key=alphanum_key) 163 | 164 | 165 | class ButtonTable(QtWidgets.QTableView): 166 | def __init__(self, parent=None): 167 | super(ButtonTable, self).__init__(parent) 168 | self.model = SnippetModel() 169 | self.setModel(self.model) 170 | 171 | self.filter = SnippetProxyModel(self) 172 | self.filter.setSourceModel(self.model) 173 | self.filter.setFilterKeyColumn(0) 174 | self.setModel(self.filter) 175 | 176 | btn_delegate = ButtonDelegate(self) 177 | btn_delegate.copyRequest.connect(self.btn_callback) 178 | self.setItemDelegateForColumn(1, btn_delegate) 179 | self.model.rowsInserted.connect(self.scrollToBottom) 180 | 181 | v_header = self.verticalHeader() 182 | v_header.hide() 183 | h_header = self.horizontalHeader() 184 | h_header.setSectionResizeMode(0, QtWidgets.QHeaderView.Stretch) 185 | h_header.setSectionResizeMode(1, QtWidgets.QHeaderView.Fixed) 186 | h_header.resizeSection(1, 36) 187 | h_header.hide() 188 | 189 | sel = QtWidgets.QTableView.SingleSelection 190 | beh = QtWidgets.QTableView.SelectRows 191 | 192 | self.setSelectionMode(sel) 193 | self.setSelectionBehavior(beh) 194 | self.setSortingEnabled(True) 195 | self.setShowGrid(False) 196 | 197 | def mousePressEvent(self, event): 198 | pt = QtCore.QPoint(1, event.pos().y()) 199 | if self.indexAt(pt).row() == -1: # deselect on bg click 200 | self.selectionModel().clear() 201 | self.parent().add_btn.setFocus() # focus fix 202 | else: 203 | index = self.indexAt(event.pos()) 204 | if index.column() == 0: # snippet select 205 | super(ButtonTable, self).mousePressEvent(event) 206 | elif index.column() == 1: # column behind button 207 | self.parent().add_btn.setFocus() # focus fix 208 | 209 | def add_item(self, snippet): 210 | self.model.beginResetModel() 211 | self.model.insertRows(snippet) 212 | self.model.endResetModel() 213 | 214 | def remove_item(self): 215 | self.model.beginResetModel() 216 | proxy_index = self.currentIndex() 217 | model_index = self.filter.mapToSource(proxy_index) 218 | r = model_index.row() 219 | self.model.removeRows(r) 220 | self.model.endResetModel() 221 | 222 | def btn_callback(self, index): 223 | model_index = self.filter.mapToSource(index) 224 | snippet = model_index.siblingAtColumn(1).data(role=QtCore.Qt.UserRole) 225 | 226 | logger.debug('Filter Index: {}'.format(index)) 227 | logger.debug('Model Index: {}'.format(model_index)) 228 | logger.debug('Copied Snippet: {}'.format(snippet.label)) 229 | 230 | cb = QtWidgets.QApplication.clipboard() 231 | cb.clear(mode=cb.Clipboard) 232 | cb.setText(snippet.data, mode=cb.Clipboard) 233 | self.parent().add_btn.setFocus() # focus fix 234 | -------------------------------------------------------------------------------- /python3.7libs/vex_snippet_library/widgets/snippet_editor.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from PySide2 import QtWidgets, QtCore, QtGui 4 | 5 | from . import vex_editor 6 | 7 | 8 | class SnippetEditor(QtWidgets.QWidget): 9 | def __init__(self, parent=None): 10 | super(SnippetEditor, self).__init__(parent) 11 | self.editable = False 12 | self._init_ui() 13 | 14 | def _init_ui(self): 15 | self.layout = QtWidgets.QVBoxLayout(self) 16 | root = os.path.abspath(os.path.join(__file__, '..', '..', '..', '..')) 17 | icons = os.path.join(root, 'resources', 'icons') 18 | 19 | self.edit_btn = QtWidgets.QPushButton('') 20 | self.edit_btn.setToolTip('Allow Editing') 21 | icon = QtGui.QIcon( 22 | QtGui.QPixmap(os.path.join(icons, 'edit.png'))) 23 | self.edit_btn.setIcon(icon) 24 | self.edit_btn.clicked.connect(self.edit_btn_callback) 25 | self.edit_btn.setStyleSheet( 26 | ''' 27 | QPushButton:disabled 28 | { 29 | background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, 30 | stop: 0.0 rgba(64, 164, 64, 40%), 31 | stop: 1.0 rgba(38, 255, 38, 40%)); 32 | } 33 | ''') 34 | 35 | self.save_btn = QtWidgets.QPushButton('') 36 | self.save_btn.setToolTip('Save Changes') 37 | icon = QtGui.QIcon(os.path.join(icons, 'save.png')) 38 | self.save_btn.setIcon(icon) 39 | self.save_btn.clicked.connect(self.save_btn_callback) 40 | 41 | self.cancel_btn = QtWidgets.QPushButton('') 42 | self.cancel_btn.setToolTip('Discard Changes') 43 | icon = QtGui.QIcon(os.path.join(icons, 'cancel.png')) 44 | self.cancel_btn.setIcon(icon) 45 | self.cancel_btn.clicked.connect(self.cancel_btn_callback) 46 | 47 | self.combo_lbl = QtWidgets.QLabel('Run Over') 48 | self.combo = QtWidgets.QComboBox() 49 | combo_items = [ 50 | 'Detail', 51 | 'Primitives', 52 | 'Points', 53 | 'Vertices' 54 | ] 55 | self.combo.addItems(combo_items) 56 | self.combo.setCurrentIndex(2) 57 | 58 | self.editor = vex_editor.VexEditor(self) 59 | 60 | # defaults 61 | self.editor.disable_editor() 62 | self.combo.setEnabled(False) 63 | self.save_btn.setEnabled(False) 64 | self.cancel_btn.setEnabled(False) 65 | self.combo_lbl.setEnabled(False) 66 | 67 | btn_layout = QtWidgets.QHBoxLayout() 68 | btn_layout.addWidget(self.edit_btn) 69 | btn_layout.addWidget(self.save_btn) 70 | btn_layout.addWidget(self.cancel_btn) 71 | 72 | combo_layout = QtWidgets.QHBoxLayout() 73 | combo_layout.addSpacing(12) 74 | combo_layout.addWidget(self.combo_lbl) 75 | combo_layout.addWidget(self.combo) 76 | combo_layout.addStretch() 77 | 78 | self.layout.addLayout(btn_layout) 79 | self.layout.addLayout(combo_layout) 80 | self.layout.addWidget(self.editor) 81 | 82 | def edit_btn_callback(self): 83 | if not self.editable: 84 | self.editable = True 85 | self.editor.enable_editor() 86 | self.save_btn.setEnabled(True) 87 | self.cancel_btn.setEnabled(True) 88 | self.combo.setEnabled(True) 89 | self.combo_lbl.setEnabled(True) 90 | self.edit_btn.setEnabled(False) 91 | self.editor.setFocus() 92 | 93 | def save_btn_callback(self): 94 | self.editable = False 95 | self.editor.disable_editor() 96 | self.save_btn.setEnabled(False) 97 | self.cancel_btn.setEnabled(False) 98 | self.combo.setEnabled(False) 99 | self.combo_lbl.setEnabled(False) 100 | self.edit_btn.setEnabled(True) 101 | 102 | def cancel_btn_callback(self): 103 | self.editable = False 104 | self.editor.disable_editor() 105 | self.save_btn.setEnabled(False) 106 | self.cancel_btn.setEnabled(False) 107 | self.combo.setEnabled(False) 108 | self.combo_lbl.setEnabled(False) 109 | self.edit_btn.setEnabled(True) 110 | -------------------------------------------------------------------------------- /python3.7libs/vex_snippet_library/widgets/snippet_viewer.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | import json 4 | 5 | from PySide2 import QtWidgets, QtGui, QtCore 6 | 7 | from . import button_table 8 | 9 | 10 | class ClickableLabel(QtWidgets.QLabel): 11 | clicked = QtCore.Signal(str) 12 | 13 | def __init__(self, width, height): 14 | super(ClickableLabel, self).__init__() 15 | self.setObjectName('ClickableLabel') 16 | 17 | def mousePressEvent(self, event): 18 | self.clicked.emit(self.objectName()) 19 | 20 | 21 | class SnippetViewer(QtWidgets.QWidget): 22 | def __init__(self, parent=None): 23 | super(SnippetViewer, self).__init__(parent) 24 | self.icons = os.path.abspath( 25 | os.path.join(__file__, '..', '..', '..', '..', 'icons')) 26 | self.filter_text = '' 27 | self._init_ui() 28 | 29 | def _init_ui(self): 30 | self.layout = QtWidgets.QVBoxLayout(self) 31 | root = os.path.abspath(os.path.join(__file__, '..', '..', '..', '..')) 32 | icons = os.path.join(root, 'resources', 'icons') 33 | 34 | self.add_btn = QtWidgets.QPushButton() 35 | self.add_btn.setToolTip('Add New Snippet') 36 | icon = QtGui.QIcon(os.path.join(icons, 'add.svg')) 37 | self.add_btn.setIcon(icon) 38 | 39 | self.del_btn = QtWidgets.QPushButton() 40 | self.del_btn.setToolTip('Delete Selected Snippet') 41 | icon = QtGui.QIcon(os.path.join(icons, 'delete.svg')) 42 | self.del_btn.setIcon(icon) 43 | 44 | self.search_edit = QtWidgets.QLineEdit() 45 | self.search_edit.setPlaceholderText('Filter') 46 | self.search_edit.textChanged.connect(self.filter_snippets) 47 | 48 | self.clear_btn = ClickableLabel(35, 35) 49 | icon = QtGui.QIcon( 50 | QtGui.QPixmap(os.path.join(icons, 'clear_filter.svg'))) 51 | pixmap = icon.pixmap(QtCore.QSize(64, 64)) 52 | self.clear_btn.setPixmap(pixmap) 53 | self.clear_btn.clicked.connect(self.clear_btn_callback) 54 | 55 | btn_layout = QtWidgets.QHBoxLayout() 56 | btn_layout.addWidget(self.add_btn) 57 | btn_layout.addWidget(self.del_btn) 58 | 59 | search_layout = QtWidgets.QHBoxLayout() 60 | search_layout.addWidget(self.search_edit) 61 | search_layout.addWidget(self.clear_btn) 62 | 63 | self.table = button_table.ButtonTable() 64 | self.table.setStyleSheet( 65 | ''' 66 | QTableView 67 | { 68 | font-size: 15px; 69 | } 70 | QTableView::item 71 | { 72 | border-right: 0; 73 | border-left: 0; 74 | border-bottom: 0; 75 | } 76 | ''') 77 | 78 | self.layout.addLayout(btn_layout) 79 | self.layout.addLayout(search_layout) 80 | self.layout.addSpacing(5) 81 | self.layout.addWidget(self.table) 82 | 83 | def filter_snippets(self): 84 | self.table.model.beginResetModel() 85 | self.table.filter.setFilterRegExp(QtCore.QRegExp( 86 | self.search_edit.text(), 87 | QtCore.Qt.CaseInsensitive, 88 | QtCore.QRegExp.FixedString)) 89 | self.table.model.endResetModel() 90 | 91 | def setEnabled(self, mode=True): 92 | self.add_btn.setEnabled(mode) 93 | self.del_btn.setEnabled(mode) 94 | self.search_edit.setEnabled(mode) 95 | self.table.setEnabled(mode) 96 | 97 | def clear_btn_callback(self): 98 | self.search_edit.setText('') 99 | -------------------------------------------------------------------------------- /python3.7libs/vex_snippet_library/widgets/vex_editor.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | import re 4 | 5 | import logging 6 | 7 | from PySide2 import QtWidgets, QtCore, QtGui 8 | 9 | from . import vex_highlighter 10 | 11 | logger = logging.getLogger('vex_snippet_library.main_panel.vex_editor') 12 | 13 | 14 | class LineNumberArea(QtWidgets.QWidget): 15 | def __init__(self, editor): 16 | super().__init__(editor) 17 | self.myeditor = editor 18 | self.bg_color = QtGui.QColor(43, 43, 43) 19 | self.line_color = QtGui.QColor(75, 75, 75) 20 | self.num_color = QtGui.QColor(200, 200, 200) 21 | 22 | def sizeHint(self): 23 | return QtCore.Qt.Qsize(self.editor._line_num_area_width(), 0) 24 | 25 | def paintEvent(self, event): 26 | self.myeditor.line_num_area_paint(event) 27 | 28 | def disable(self): 29 | self.bg_color = QtGui.QColor(83, 83, 83) 30 | self.line_color = QtGui.QColor(105, 105, 105) 31 | self.num_color = QtGui.QColor(200, 200, 200) 32 | 33 | def enable(self): 34 | self.bg_color = QtGui.QColor(43, 43, 43) 35 | self.line_color = QtGui.QColor(75, 75, 75) 36 | self.num_color = QtGui.QColor(200, 200, 200) 37 | 38 | 39 | class VexEditor(QtWidgets.QPlainTextEdit): 40 | def __init__(self, parent=None): 41 | super(VexEditor, self).__init__(parent) 42 | self.line_num_area = LineNumberArea(self) 43 | self.connect(self, QtCore.SIGNAL('blockCountChanged(int)'), 44 | self._update_line_num_width) 45 | self.connect(self, QtCore.SIGNAL('updateRequest(QRect,int)'), 46 | self._update_line_num_area) 47 | self._update_line_num_width(0) 48 | self._init_ui() 49 | 50 | def _init_ui(self): 51 | self.setLineWrapMode(QtWidgets.QPlainTextEdit.NoWrap) 52 | self.installEventFilter(self) 53 | self.highlighter = vex_highlighter.VexHighlighter( 54 | self.document()) 55 | root = os.path.abspath(os.path.join(__file__, '..', '..', '..', '..')) 56 | fonts = os.path.join(root, 'resources', 'fonts') 57 | QtGui.QFontDatabase.addApplicationFont( 58 | os.path.join(fonts, 'SourceCodePro-Regular.ttf')) 59 | 60 | font = QtGui.QFont('Source Code Pro') 61 | self.setFont(font) 62 | self.enable_editor() 63 | 64 | def eventFilter(self, widget, event): 65 | """Custom support for editor behavior""" 66 | if (event.type() == QtCore.QEvent.KeyPress and widget is self): 67 | key = event.key() 68 | # tabs to spaces 69 | if key == QtCore.Qt.Key_Tab: 70 | cursor = self.textCursor() 71 | if cursor.hasSelection(): 72 | lines = self._lines_from_sel(cursor) 73 | cursor.beginEditBlock() 74 | for line in lines: 75 | doc = self.document() 76 | get_block = doc.findBlockByLineNumber(line) 77 | cursor = QtGui.QTextCursor(get_block) 78 | self.setTextCursor(cursor) 79 | self.insertPlainText(' ') 80 | cursor.endEditBlock() 81 | self._select_lines(lines) 82 | else: 83 | self.insertPlainText(' ') 84 | return True 85 | 86 | # shift tab 87 | if key == QtCore.Qt.Key_Backtab: 88 | cursor = self.textCursor() 89 | if cursor.hasSelection(): 90 | lines = self._lines_from_sel(cursor) 91 | cursor.beginEditBlock() 92 | for line in lines: 93 | doc = self.document() 94 | get_block = doc.findBlockByLineNumber(line) 95 | cursor = QtGui.QTextCursor(get_block) 96 | self._unindent_line(cursor) 97 | cursor.endEditBlock() 98 | self._select_lines(lines) 99 | return True 100 | else: 101 | self._unindent_line(cursor) 102 | return True 103 | 104 | # enter indent level 105 | if key == QtCore.Qt.Key_Return: 106 | cursor = self.textCursor() 107 | tmp = self.textCursor() 108 | pos = tmp.position() 109 | tmp.clearSelection() 110 | tmp.movePosition(QtGui.QTextCursor.EndOfLine, 111 | QtGui.QTextCursor.MoveAnchor) 112 | tmp.movePosition(QtGui.QTextCursor.StartOfLine, 113 | QtGui.QTextCursor.KeepAnchor) 114 | line_txt = str(tmp.selectedText()).replace('\u2029', '\n') 115 | leading_whitespace = len(line_txt) - len(line_txt.lstrip()) 116 | x = 4 117 | indent_level = round(leading_whitespace / x) 118 | out = '\n' 119 | if leading_whitespace: 120 | for i in range(indent_level): 121 | out += ' ' 122 | cursor.insertText(out) 123 | return True 124 | 125 | return QtWidgets.QWidget.eventFilter(self, widget, event) 126 | 127 | def disable_editor(self): 128 | self.setReadOnly(True) 129 | self.line_num_area.disable() 130 | self.setStyleSheet("QPlainTextEdit {background-color:#404040;}") 131 | 132 | def enable_editor(self): 133 | self.setReadOnly(False) 134 | self.line_num_area.enable() 135 | self.setStyleSheet("QPlainTextEdit {background-color:#131313;}") 136 | 137 | def _unindent_line(self, cursor): 138 | """Unindent current line at cursor""" 139 | pos = cursor.position() 140 | cursor.clearSelection() 141 | cursor.movePosition(QtGui.QTextCursor.EndOfLine, 142 | QtGui.QTextCursor.MoveAnchor) 143 | cursor.movePosition(QtGui.QTextCursor.StartOfLine, 144 | QtGui.QTextCursor.KeepAnchor) 145 | 146 | line_txt = str(cursor.selectedText()).replace('\u2029', '\n') 147 | leading_whitespace = len(line_txt) - len(line_txt.lstrip()) 148 | cursor.insertText(line_txt[min(3, leading_whitespace):]) 149 | cursor.setPosition(pos - min(3, leading_whitespace)) 150 | 151 | def _select_lines(self, lines): 152 | """Selects full lines, expects lines to be a generator""" 153 | doc = self.document() 154 | start_block = doc.findBlockByLineNumber(lines[0]) 155 | cursor = QtGui.QTextCursor(start_block) 156 | cursor.movePosition(QtGui.QTextCursor.EndOfLine, 157 | QtGui.QTextCursor.KeepAnchor) 158 | for x in lines[1:]: 159 | cursor.movePosition(QtGui.QTextCursor.NextBlock, 160 | QtGui.QTextCursor.KeepAnchor) 161 | cursor.movePosition(QtGui.QTextCursor.EndOfBlock, 162 | QtGui.QTextCursor.KeepAnchor) 163 | self.setTextCursor(cursor) 164 | 165 | def _lines_from_sel(self, cursor): 166 | """Return selected lines as a generator object""" 167 | sel_start = cursor.selectionStart() 168 | sel_end = cursor.selectionEnd() 169 | tmp = self.textCursor() 170 | tmp.setPosition(sel_start) 171 | start_line = tmp.blockNumber() 172 | tmp.setPosition(sel_end) 173 | end_line = tmp.blockNumber() 174 | return range(start_line, end_line + 1) 175 | 176 | def _line_num_area_width(self): 177 | digits = 1 178 | # count = max(1, self.blockCount()) 179 | # while count >= 10: 180 | # count /= 10 181 | # digits += 1 182 | digits = 2 183 | space = 18 + self.fontMetrics().width('9') * digits 184 | return space 185 | 186 | def _update_line_num_width(self, _): 187 | self.setViewportMargins(self._line_num_area_width(), 0, 0, 0) 188 | 189 | def _update_line_num_area(self, rect, dy): 190 | 191 | if dy: 192 | self.line_num_area.scroll(0, dy) 193 | else: 194 | self.line_num_area.update( 195 | 0, rect.y(), self.line_num_area.width(), rect.height()) 196 | 197 | if rect.contains(self.viewport().rect()): 198 | self._update_line_num_width(0) 199 | 200 | def resizeEvent(self, event): 201 | super().resizeEvent(event) 202 | 203 | cr = self.contentsRect() 204 | self.line_num_area.setGeometry( 205 | QtCore.QRect( 206 | cr.left(), cr.top(), self._line_num_area_width(), cr.height())) 207 | 208 | def line_num_area_paint(self, event): 209 | my_painter = QtGui.QPainter(self.line_num_area) 210 | 211 | my_painter.fillRect(event.rect(), self.line_num_area.bg_color) 212 | 213 | block = self.firstVisibleBlock() 214 | blockNumber = block.blockNumber() 215 | top = self.blockBoundingGeometry(block).translated( 216 | self.contentOffset()).top() 217 | bottom = top + self.blockBoundingRect(block).height() 218 | 219 | height = self.fontMetrics().height() 220 | while block.isValid() and (top <= event.rect().bottom()): 221 | if block.isVisible() and (bottom >= event.rect().top()): 222 | number = str(blockNumber + 1) 223 | if block == self.textCursor().block(): 224 | line_rect = QtCore.QRect( 225 | 0, top, self.line_num_area.width(), height) 226 | my_painter.fillRect( 227 | line_rect, self.line_num_area.line_color) 228 | my_painter.setPen(self.line_num_area.num_color) 229 | my_painter.drawText( 230 | 0, top, self.line_num_area.width(), 231 | height, QtCore.Qt.AlignRight, number) 232 | 233 | block = block.next() 234 | top = bottom 235 | bottom = top + self.blockBoundingRect(block).height() 236 | blockNumber += 1 237 | -------------------------------------------------------------------------------- /python3.7libs/vex_snippet_library/widgets/vex_highlighter.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from zipfile import ZipFile 4 | 5 | from PySide2 import QtGui, QtCore 6 | 7 | 8 | class VexSyntaxUtilities(): 9 | def __init__(self): 10 | self.package = os.path.abspath( 11 | os.path.join(__file__, '..', '..', '..', '..')) 12 | self.vex_dir = os.path.join(self.package, 'resources', 'vex_syntax') 13 | self.vex_data_types = '' 14 | self.vex_functions = '' 15 | self.vex_keywords = '' 16 | self.vex_macros = '' 17 | self.vex_comments = '' 18 | 19 | def load_vex_syntax(self): 20 | data_types_file = os.path.join(self.vex_dir, 'vex_data_types.txt') 21 | with open(data_types_file, 'r') as t: 22 | self.vex_data_types = '|'.join(t.read().splitlines()) 23 | 24 | functions_file = os.path.join(self.vex_dir, 'vex_functions.txt') 25 | with open(functions_file, 'r') as t: 26 | self.vex_functions = '|'.join(t.read().splitlines()) 27 | 28 | keywords_file = os.path.join(self.vex_dir, 'vex_keywords.txt') 29 | with open(keywords_file, 'r') as t: 30 | self.vex_keywords = '|'.join(t.read().splitlines()) 31 | 32 | macros_file = os.path.join(self.vex_dir, 'vex_macros.txt') 33 | with open(macros_file, 'r') as t: 34 | self.vex_macros = '|'.join(t.read().splitlines()) 35 | 36 | comments_file = os.path.join(self.vex_dir, 'vex_comments.txt') 37 | with open(comments_file, 'r') as t: 38 | self.vex_comments = '|'.join(t.read().splitlines()) 39 | 40 | def verify_vex_syntax(self): 41 | if not os.path.isdir(self.vex_dir): 42 | os.makedirs(self.vex_dir) 43 | self.write_vex_function_list() 44 | 45 | def write_vex_function_list(self): 46 | hfs = os.path.abspath(os.environ['HFS']) 47 | zip_file = os.path.join(hfs, 'houdini', 'help', 'vex.zip') 48 | with ZipFile(zip_file, 'r') as zip_obj: 49 | list_of_files = zip_obj.namelist() 50 | vex_functions = [] 51 | for x in list_of_files: 52 | if 'functions/' in x: 53 | vex_functions.append(x.split('/')[-1].split('.txt')[0]) 54 | textfile = os.path.join(self.vex_dir, 'vex_functions.txt') 55 | with open(textfile, 'w+') as t: 56 | for f in vex_functions: 57 | t.write('{}\n'.format(f)) 58 | 59 | 60 | class VexColors(): 61 | def __init__(self): 62 | self.colors = { 63 | 'default': QtGui.QTextCharFormat(), 64 | 'data_types': QtGui.QTextCharFormat(), 65 | 'functions': QtGui.QTextCharFormat(), 66 | 'keywords': QtGui.QTextCharFormat(), 67 | 'macros': QtGui.QTextCharFormat(), 68 | 'comment': QtGui.QTextCharFormat(), 69 | 'string_double': QtGui.QTextCharFormat(), 70 | 'string_single': QtGui.QTextCharFormat(), 71 | 'attributes': QtGui.QTextCharFormat() 72 | } 73 | for key, value in self.colors.items(): 74 | value.setFontWeight(QtGui.QFont.Bold) 75 | 76 | self.colors['default'].setForeground(QtGui.QBrush( 77 | QtGui.QColor(255, 255, 255))) 78 | 79 | self.colors['data_types'].setForeground(QtGui.QBrush( 80 | QtGui.QColor(255, 128, 255))) 81 | 82 | self.colors['functions'].setForeground(QtGui.QBrush( 83 | QtGui.QColor(115, 230, 230))) 84 | 85 | self.colors['keywords'].setForeground(QtGui.QBrush( 86 | QtGui.QColor(237, 119, 237))) 87 | 88 | self.colors['macros'].setForeground(QtGui.QBrush( 89 | QtGui.QColor(207, 162, 104))) 90 | 91 | self.colors['attributes'].setForeground(QtGui.QBrush( 92 | QtGui.QColor(207, 162, 104))) 93 | 94 | self.colors['comment'].setForeground(QtGui.QBrush( 95 | QtGui.QColor(250, 250, 125))) 96 | 97 | self.colors['string_double'].setForeground(QtGui.QBrush( 98 | QtGui.QColor(102, 204, 102))) 99 | 100 | self.colors['string_single'].setForeground(QtGui.QBrush( 101 | QtGui.QColor(102, 204, 102))) 102 | 103 | 104 | class VexHighlighter(QtGui.QSyntaxHighlighter): 105 | def __init__(self, *args, **kwargs): 106 | super(VexHighlighter, self).__init__(*args, **kwargs) 107 | self.utils = VexSyntaxUtilities() 108 | self.utils.load_vex_syntax() 109 | self.colors = VexColors().colors 110 | self.patterns = { 111 | 'data_types': r'\b({})\b(?=\s|$)'.format(self.utils.vex_data_types), 112 | 'functions': r'\b({})(?=\s|[(]|$)'.format(self.utils.vex_functions), 113 | 'keywords': r'\b({})(?=\s|[(]|$)'.format(self.utils.vex_keywords), 114 | 'attributes': r'((?= 0: 158 | # Look for the ending delimiter 159 | end = end_pattern.indexIn(text, start + add) 160 | # Ending delimiter on this line? 161 | if end >= add: 162 | length = end - start + add + end_pattern.matchedLength() 163 | self.setCurrentBlockState(0) 164 | # No; multi-line string 165 | else: 166 | self.setCurrentBlockState(in_state) 167 | length = len(text) - start + add 168 | # Apply formatting 169 | self.setFormat(start, length, style) 170 | # Look for the next match 171 | start = start_pattern.indexIn(text, start + length) 172 | 173 | # Return True if still inside a multi-line string, False otherwise 174 | if self.currentBlockState() == in_state: 175 | return True 176 | else: 177 | return False 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | -------------------------------------------------------------------------------- /python_panels/vex_snippet_library.pypanel: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /resources/fonts/SourceCodePro-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dchow1992/Vex_Snippet_Library/HEAD/resources/fonts/SourceCodePro-Regular.ttf -------------------------------------------------------------------------------- /resources/icons/cancel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dchow1992/Vex_Snippet_Library/HEAD/resources/icons/cancel.png -------------------------------------------------------------------------------- /resources/icons/clear_filter.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 22 | 24 | 28 | 32 | 33 | 42 | 43 | 64 | 67 | 68 | 70 | 71 | 73 | image/svg+xml 74 | 76 | 77 | 78 | 79 | 80 | 84 | 89 | 90 | 91 | -------------------------------------------------------------------------------- /resources/icons/copy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dchow1992/Vex_Snippet_Library/HEAD/resources/icons/copy.png -------------------------------------------------------------------------------- /resources/icons/delete.svg: -------------------------------------------------------------------------------- 1 | document-remove-filled -------------------------------------------------------------------------------- /resources/icons/display_primitive_normals.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 20 | 22 | 25 | 29 | 33 | 34 | 36 | 40 | 44 | 45 | 47 | 51 | 55 | 56 | 58 | 62 | 66 | 67 | 77 | 87 | 97 | 98 | 117 | 119 | 120 | 122 | image/svg+xml 123 | 125 | 126 | 127 | 128 | 129 | 133 | 138 | 143 | 148 | 153 | 154 | 155 | -------------------------------------------------------------------------------- /resources/icons/edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dchow1992/Vex_Snippet_Library/HEAD/resources/icons/edit.png -------------------------------------------------------------------------------- /resources/icons/filter_color_blue.svg: -------------------------------------------------------------------------------- 1 | 2 | 18 | 20 | 21 | 23 | image/svg+xml 24 | 26 | 16 27 | 28 | 29 | 30 | 51 | 52 | 16 54 | Created with Sketch. 56 | 58 | 61 | 65 | 69 | 70 | 78 | 82 | 86 | 87 | 95 | 99 | 103 | 104 | 112 | 116 | 120 | 121 | 132 | 135 | 139 | 143 | 147 | 148 | 159 | 160 | 168 | 174 | 184 | 190 | 191 | -------------------------------------------------------------------------------- /resources/icons/filter_color_purple.svg: -------------------------------------------------------------------------------- 1 | 2 | 18 | 20 | 21 | 23 | image/svg+xml 24 | 26 | 16 27 | 28 | 29 | 30 | 51 | 52 | 16 54 | Created with Sketch. 56 | 58 | 61 | 65 | 69 | 70 | 78 | 82 | 86 | 87 | 95 | 99 | 103 | 104 | 112 | 116 | 120 | 121 | 132 | 135 | 139 | 143 | 147 | 148 | 159 | 160 | 168 | 174 | 184 | 190 | 191 | -------------------------------------------------------------------------------- /resources/icons/info.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 23 | 25 | 27 | 31 | 35 | 36 | 38 | 42 | 46 | 47 | 57 | 60 | 64 | 68 | 69 | 80 | 91 | 92 | 116 | 118 | 119 | 121 | image/svg+xml 122 | 124 | 126 | 127 | 128 | 129 | Jakub Steiner 130 | 131 | 132 | 133 | 134 | emblem 135 | photos 136 | pictures 137 | raw 138 | jpeg 139 | 140 | 141 | 142 | 144 | 146 | 148 | 150 | 152 | 154 | 156 | 157 | 158 | 159 | 163 | 173 | 183 | 187 | 191 | 192 | 193 | -------------------------------------------------------------------------------- /resources/icons/save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dchow1992/Vex_Snippet_Library/HEAD/resources/icons/save.png -------------------------------------------------------------------------------- /resources/readme.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dchow1992/Vex_Snippet_Library/HEAD/resources/readme.jpg -------------------------------------------------------------------------------- /resources/vex_syntax/validate.txt: -------------------------------------------------------------------------------- 1 | // this is a comment 2 | /* 3 | this is a multiline 4 | comment 5 | /* 6 | int i = 4; 7 | string foo = "hi"; 8 | */ 9 | 10 | #include 11 | #ifndef 12 | #define test 13 | #endif 14 | 15 | vector x = set(1,2,3); 16 | int y = 1; 17 | int np; vector nuv; 18 | float d = xyzdist(1, @P, np, nuv); 19 | string str = "this is a string"; 20 | string str2 = 'this is a string'; 21 | point 22 | point( 23 | bpoint( 24 | vectorx 25 | xpoint 26 | intersect 27 | 28 | while(1) 29 | if ( 30 | foreach ( int x = 0; x < npoints(1); x++) 31 | { 32 | 33 | } 34 | 35 | /* fsdfsf 36 | test 2 37 | dlkfj 38 | vfec */ 39 | -------------------------------------------------------------------------------- /resources/vex_syntax/vex_comments.txt: -------------------------------------------------------------------------------- 1 | / 2 | /* 3 | */ -------------------------------------------------------------------------------- /resources/vex_syntax/vex_data_types.txt: -------------------------------------------------------------------------------- 1 | bsdf 2 | float 3 | int 4 | matrix 5 | matrix2 6 | matrix3 7 | string 8 | vector 9 | vector2 10 | vector4 11 | void 12 | -------------------------------------------------------------------------------- /resources/vex_syntax/vex_functions.txt: -------------------------------------------------------------------------------- 1 | abs 2 | abspath 3 | accessframe 4 | acos 5 | addattrib 6 | addattribute 7 | adddetailattrib 8 | addgroup 9 | addpoint 10 | addpointattrib 11 | addprim 12 | addprimattrib 13 | addvariablename 14 | addvertex 15 | addvertexattrib 16 | addvisualizer 17 | agentaddclip 18 | agentchannelcount 19 | agentchannelnames 20 | agentchannelvalue 21 | agentchannelvalues 22 | agentclipcatalog 23 | agentclipchannel 24 | agentclipchannelnames 25 | agentcliplength 26 | agentclipnames 27 | agentclipsample 28 | agentclipsamplelocal 29 | agentclipsamplerate 30 | agentclipsampleworld 31 | agentclipstarttime 32 | agentcliptimes 33 | agentcliptransformgroups 34 | agentclipweights 35 | agentcollisionlayer 36 | agentcollisionlayers 37 | agentcurrentlayer 38 | agentcurrentlayers 39 | agentfindlayer 40 | agentfindtransformgroup 41 | agentlayerbindings 42 | agentlayers 43 | agentlayershapes 44 | agentlocaltransform 45 | agentlocaltransforms 46 | agentmetadata 47 | agentrigchildren 48 | agentrigfind 49 | agentrigfindchannel 50 | agentrigparent 51 | agentsolvefbik 52 | agenttransformcount 53 | agenttransformgroupmember 54 | agenttransformgroupmemberchannel 55 | agenttransformgroups 56 | agenttransformgroupweight 57 | agenttransformnames 58 | agenttransformtolocal 59 | agenttransformtoworld 60 | agentworldtransform 61 | agentworldtransforms 62 | albedo 63 | alphaname 64 | ambient 65 | anoise 66 | append 67 | area 68 | argsort 69 | array 70 | ashikhmin 71 | asin 72 | assert_enabled 73 | assign 74 | atan 75 | atan2 76 | atof 77 | atoi 78 | atten 79 | attrib 80 | attribclass 81 | attribdataid 82 | attribsize 83 | attribtype 84 | attribtypeinfo 85 | avg 86 | binput 87 | blackbody 88 | blinn 89 | blinnBRDF 90 | bouncelabel 91 | bouncemask 92 | bumpmap 93 | bumpmapA 94 | bumpmapB 95 | bumpmapG 96 | bumpmapL 97 | bumpmapR 98 | bumpname 99 | cbrt 100 | ceil 101 | ch 102 | ch2 103 | ch3 104 | ch4 105 | chadd 106 | chattr 107 | chattrnames 108 | chdict 109 | chend 110 | chendf 111 | chendt 112 | chexpr 113 | chexprf 114 | chexprt 115 | chf 116 | chi 117 | chiang 118 | chid 119 | chindex 120 | chinput 121 | chinputlimits 122 | chname 123 | chnames 124 | chnumchan 125 | chop 126 | choplocal 127 | choplocalt 128 | chopt 129 | chp 130 | chr 131 | chramp 132 | chrampderiv 133 | chrate 134 | chreadbuf 135 | chremove 136 | chremoveattr 137 | chrename 138 | chresizebuf 139 | chs 140 | chsetattr 141 | chsetlength 142 | chsetrate 143 | chsetstart 144 | chsop 145 | chsraw 146 | chstart 147 | chstartf 148 | chstartt 149 | chu 150 | chv 151 | chwritebuf 152 | cinput 153 | ckspline 154 | clamp 155 | clip 156 | colormap 157 | colorname 158 | combinelocaltransform 159 | computenormal 160 | concat 161 | cone 162 | cos 163 | cosh 164 | cracktransform 165 | create_cdf 166 | create_pdf 167 | cregioncapturetransform 168 | cregiondeformtransform 169 | cregionoverridetransform 170 | cross 171 | cspline 172 | ctransform 173 | curlnoise 174 | curlnoise2d 175 | curlxnoise 176 | curlxnoise2d 177 | curvearclen 178 | cvex_bsdf 179 | cwnoise 180 | decode 181 | decodeattrib 182 | decodeparm 183 | decodeutf8 184 | degrees 185 | depthmap 186 | depthname 187 | detail 188 | detailattrib 189 | detailattribsize 190 | detailattribtype 191 | detailattribtypeinfo 192 | detailintrinsic 193 | determinant 194 | diagonalizesymmetric 195 | diffuse 196 | diffuseBRDF 197 | dihedral 198 | dimport 199 | distance 200 | distance2 201 | dot 202 | dsmpixel 203 | Du 204 | Dv 205 | Dw 206 | efit 207 | eigenvalues 208 | encode 209 | encodeattrib 210 | encodeparm 211 | encodeutf8 212 | endswith 213 | environment 214 | erf 215 | erfc 216 | erf_inv 217 | error 218 | eulertoquaternion 219 | eval_bsdf 220 | exp 221 | expandedgegroup 222 | expandpointgroup 223 | expandprimgroup 224 | expandvertexgroup 225 | expand_udim 226 | extractlocaltransform 227 | fastshadow 228 | filamentsample 229 | file_stat 230 | filtershadow 231 | filterstep 232 | filter_remap 233 | find 234 | findattribval 235 | findattribvalcount 236 | finput 237 | fit 238 | fit01 239 | fit10 240 | fit11 241 | floor 242 | flownoise 243 | flowpnoise 244 | foreach 245 | forpoints 246 | frac 247 | fresnel 248 | fromNDC 249 | frontface 250 | fuzzify 251 | fuzzy_and 252 | fuzzy_defuzz_centroid 253 | fuzzy_nand 254 | fuzzy_nor 255 | fuzzy_not 256 | fuzzy_nxor 257 | fuzzy_or 258 | fuzzy_xor 259 | gather 260 | geoself 261 | geounwrap 262 | getattrib 263 | getattribute 264 | getbbox 265 | getbbox_center 266 | getbbox_max 267 | getbbox_min 268 | getbbox_size 269 | getblurP 270 | getbounces 271 | getbounds 272 | getcomp 273 | getcomponents 274 | getderiv 275 | getfogname 276 | getglobalraylevel 277 | getgroupid 278 | getlight 279 | getlightid 280 | getlightname 281 | getlights 282 | getlightscope 283 | getlocalcurvature 284 | getmaterial 285 | getmaterialid 286 | getobjectid 287 | getobjectname 288 | getpackedtransform 289 | getphotonlight 290 | getpointbbox 291 | getpointbbox_center 292 | getpointbbox_max 293 | getpointbbox_min 294 | getpointbbox_size 295 | getprimid 296 | getptextureid 297 | getraylevel 298 | getrayweight 299 | getsamplestore 300 | getscope 301 | getsmoothP 302 | getspace 303 | getuvtangents 304 | ggx 305 | gradient 306 | hair 307 | hasattrib 308 | hasdetailattrib 309 | haslight 310 | hasmetadata 311 | hasplane 312 | haspointattrib 313 | hasprimattrib 314 | hasvertexattrib 315 | has_udim 316 | hedge_dstpoint 317 | hedge_dstvertex 318 | hedge_equivcount 319 | hedge_isequiv 320 | hedge_isprimary 321 | hedge_isvalid 322 | hedge_next 323 | hedge_nextequiv 324 | hedge_postdstpoint 325 | hedge_postdstvertex 326 | hedge_presrcpoint 327 | hedge_presrcvertex 328 | hedge_prev 329 | hedge_prim 330 | hedge_primary 331 | hedge_srcpoint 332 | hedge_srcvertex 333 | henyeygreenstein 334 | hscript_noise 335 | hscript_rand 336 | hscript_snoise 337 | hscript_sturb 338 | hscript_turb 339 | hsvtorgb 340 | iaspect 341 | ichname 342 | ident 343 | idtopoint 344 | idtoprim 345 | iend 346 | iendtime 347 | ihasplane 348 | illuminance 349 | import 350 | importance_remap 351 | index 352 | inedgegroup 353 | ingroup 354 | inpointgroup 355 | inprimgroup 356 | insert 357 | instance 358 | interpolate 359 | intersect 360 | intersect_all 361 | intersect_lights 362 | inumplanes 363 | invert 364 | invertexgroup 365 | invlerp 366 | iplaneindex 367 | iplanename 368 | iplanesize 369 | irate 370 | irradiance 371 | isalpha 372 | isbound 373 | isconnected 374 | isdigit 375 | isfinite 376 | isfogray 377 | isframes 378 | islpeactive 379 | isnan 380 | isotropic 381 | israytracing 382 | issamples 383 | isseconds 384 | isshadingRHS 385 | isshadowray 386 | istart 387 | istarttime 388 | isuvrendering 389 | isvalidindex 390 | isvarying 391 | itoa 392 | ixres 393 | iyres 394 | join 395 | json_dumps 396 | json_loads 397 | keys 398 | kspline 399 | len 400 | length 401 | length2 402 | lerp 403 | lightbounces 404 | lightid 405 | lightstate 406 | limit_sample_space 407 | limport 408 | lkspline 409 | log 410 | log10 411 | lookat 412 | lspline 413 | lstrip 414 | luminance 415 | lumname 416 | makebasis 417 | maketransform 418 | maskname 419 | mask_bsdf 420 | match 421 | matchvex_blinn 422 | matchvex_specular 423 | mattrib 424 | max 425 | mdensity 426 | metadata 427 | metaimport 428 | metamarch 429 | metanext 430 | metastart 431 | metaweight 432 | min 433 | minpos 434 | mspace 435 | mwnoise 436 | mx_cellnoise 437 | mx_perlin 438 | nametopoint 439 | nametoprim 440 | nbouncetypes 441 | ndcdepth 442 | nearpoint 443 | nearpoints 444 | nedgesgroup 445 | neighbour 446 | neighbourcount 447 | neighbours 448 | newgroup 449 | newsampler 450 | nextsample 451 | ninput 452 | ninputs 453 | noise 454 | noised 455 | normalize 456 | normalname 457 | normal_bsdf 458 | npoints 459 | npointsgroup 460 | nprimitives 461 | nprimitivesgroup 462 | nrandom 463 | ntransform 464 | nuniqueval 465 | nvertices 466 | nverticesgroup 467 | objectstate 468 | occlusion 469 | ocean_sample 470 | ocio_activedisplays 471 | ocio_activeviews 472 | ocio_import 473 | ocio_parsecolorspace 474 | ocio_roles 475 | ocio_spaces 476 | ocio_transform 477 | onoise 478 | opdigits 479 | opend 480 | opfullpath 481 | opid 482 | opparentbonetransform 483 | opparenttransform 484 | opparmtransform 485 | oppreconstrainttransform 486 | oppreparmtransform 487 | opprerawparmtransform 488 | oppretransform 489 | oprawparmtransform 490 | opstart 491 | optransform 492 | ord 493 | orthographic 494 | osd_facecount 495 | osd_firstpatch 496 | osd_limitsurface 497 | osd_limitsurfacevertex 498 | osd_lookupface 499 | osd_lookuppatch 500 | osd_patchcount 501 | osd_patches 502 | outerproduct 503 | ow_nspace 504 | ow_space 505 | ow_vspace 506 | packedtransform 507 | pack_inttosafefloat 508 | pathtrace 509 | pbr_mask_h 510 | pcclose 511 | pccone 512 | pccone_radius 513 | pcconvex 514 | pcexport 515 | pcfarthest 516 | pcfilter 517 | pcfind 518 | pcfind_radius 519 | pcgenerate 520 | pcimport 521 | pcimportbyidx3 522 | pcimportbyidx4 523 | pcimportbyidxf 524 | pcimportbyidxi 525 | pcimportbyidxp 526 | pcimportbyidxs 527 | pcimportbyidxv 528 | pciterate 529 | pcline 530 | pcline_radius 531 | pcnumfound 532 | pcopen 533 | pcopenlod 534 | pcsampleleaf 535 | pcsegment 536 | pcsegment_radius 537 | pcsize 538 | pcunshaded 539 | pcwrite 540 | perspective 541 | pgfind 542 | phong 543 | phongBRDF 544 | phonglobe 545 | photonmap 546 | planeindex 547 | planename 548 | planepointdistance 549 | planesize 550 | planesphereintersect 551 | pluralize 552 | pnoise 553 | point 554 | pointattrib 555 | pointattribsize 556 | pointattribtype 557 | pointattribtypeinfo 558 | pointedge 559 | pointhedge 560 | pointhedgenext 561 | pointlocaltransforms 562 | pointname 563 | pointprims 564 | pointtransform 565 | pointtransformrigid 566 | pointtransforms 567 | pointtransformsrigid 568 | pointvertex 569 | pointvertices 570 | polardecomp 571 | polyneighbours 572 | pop 573 | pow 574 | predicate_incircle 575 | predicate_insphere 576 | predicate_orient2d 577 | predicate_orient3d 578 | premul 579 | prerotate 580 | prescale 581 | pretranslate 582 | prim 583 | primarclen 584 | primattrib 585 | primattribsize 586 | primattribtype 587 | primattribtypeinfo 588 | primduv 589 | primfind 590 | primhedge 591 | primintrinsic 592 | primpoint 593 | primpoints 594 | primuv 595 | primuvconvert 596 | primvertex 597 | primvertexcount 598 | primvertices 599 | prim_attribute 600 | prim_normal 601 | printf 602 | print_once 603 | product 604 | ptexture 605 | ptlined 606 | ptransform 607 | push 608 | pxnoise 609 | pxnoised 610 | qconvert 611 | qdistance 612 | qinvert 613 | qmultiply 614 | qrotate 615 | quaternion 616 | quaterniontoeuler 617 | radians 618 | ramp_lookup 619 | ramp_pack 620 | ramp_unpack 621 | rand 622 | random 623 | random_brj 624 | random_fhash 625 | random_ihash 626 | random_poisson 627 | random_shash 628 | random_sobol 629 | rawbumpmap 630 | rawbumpmapA 631 | rawbumpmapB 632 | rawbumpmapG 633 | rawbumpmapL 634 | rawbumpmapR 635 | rawcolormap 636 | rayhittest 637 | rayimport 638 | reflect 639 | reflectlight 640 | refract 641 | refractlight 642 | relativepath 643 | relbbox 644 | relpath 645 | relpointbbox 646 | removegroup 647 | removeindex 648 | removepoint 649 | removeprim 650 | removevalue 651 | removevertex 652 | renderstate 653 | reorder 654 | replace 655 | replace_match 656 | resample_linear 657 | resize 658 | resolvemissedray 659 | reverse 660 | re_find 661 | re_findall 662 | re_match 663 | re_replace 664 | re_split 665 | rgbtohsv 666 | rgbtoxyz 667 | rint 668 | rotate 669 | rotate_x_to 670 | rstrip 671 | sampledisk 672 | sample_bsdf 673 | sample_cauchy 674 | sample_cdf 675 | sample_circle_arc 676 | sample_circle_edge_uniform 677 | sample_circle_ring_uniform 678 | sample_circle_slice 679 | sample_circle_uniform 680 | sample_direction_cone 681 | sample_direction_uniform 682 | sample_discrete 683 | sample_exponential 684 | sample_geometry 685 | sample_hemisphere 686 | sample_hypersphere_cone 687 | sample_hypersphere_uniform 688 | sample_light 689 | sample_lognormal 690 | sample_lognormal_by_median 691 | sample_normal 692 | sample_orientation_cone 693 | sample_orientation_uniform 694 | sample_photon 695 | sample_sphere_cone 696 | sample_sphere_shell_uniform 697 | sample_sphere_uniform 698 | scale 699 | scatter 700 | select 701 | sensor_panorama_create 702 | sensor_panorama_getcolor 703 | sensor_panorama_getcone 704 | sensor_panorama_getdepth 705 | sensor_save 706 | serialize 707 | set 708 | setagentchannelvalue 709 | setagentchannelvalues 710 | setagentclipnames 711 | setagentclips 712 | setagentcliptimes 713 | setagentclipweights 714 | setagentcollisionlayer 715 | setagentcollisionlayers 716 | setagentcurrentlayer 717 | setagentcurrentlayers 718 | setagentlocaltransform 719 | setagentlocaltransforms 720 | setagentworldtransform 721 | setagentworldtransforms 722 | setattrib 723 | setattribtypeinfo 724 | setcomp 725 | setcurrentlight 726 | setdetailattrib 727 | setdetailintrinsic 728 | setedgegroup 729 | setpackedtransform 730 | setpointattrib 731 | setpointgroup 732 | setpointlocaltransforms 733 | setpointtransform 734 | setpointtransforms 735 | setprimattrib 736 | setprimgroup 737 | setprimintrinsic 738 | setprimvertex 739 | setsamplestore 740 | setvertexattrib 741 | setvertexgroup 742 | setvertexpoint 743 | shadow 744 | shadowmap 745 | shadow_light 746 | shimport 747 | shl 748 | shr 749 | shrz 750 | sign 751 | simport 752 | sin 753 | sinh 754 | sleep 755 | slerp 756 | slice 757 | slideframe 758 | smooth 759 | smoothrotation 760 | snoise 761 | solid_angle 762 | solveconstraint 763 | solvecubic 764 | solvecurve 765 | solvefbik 766 | solveik 767 | solvephysfbik 768 | solvepoly 769 | solvequadratic 770 | solvetriangleSSS 771 | sort 772 | specular 773 | specularBRDF 774 | spline 775 | spline_cdf 776 | split 777 | splitpath 778 | split_bsdf 779 | sprintf 780 | sqrt 781 | sssapprox 782 | startswith 783 | storelightexport 784 | strip 785 | strlen 786 | sum 787 | surfacedist 788 | svddecomp 789 | switch 790 | swizzle 791 | tan 792 | tanh 793 | tet_adjacent 794 | tet_faceindex 795 | teximport 796 | texprintf 797 | texture 798 | texture3d 799 | texture3dBox 800 | titlecase 801 | tolower 802 | toNDC 803 | toupper 804 | trace 805 | translate 806 | translucent 807 | transpose 808 | trunc 809 | tw_nspace 810 | tw_space 811 | tw_vspace 812 | uniqueval 813 | uniquevals 814 | unpack_intfromsafefloat 815 | unserialize 816 | upush 817 | usd_addattrib 818 | usd_addcollectionexclude 819 | usd_addcollectioninclude 820 | usd_addinversetotransformorder 821 | usd_addorient 822 | usd_addprim 823 | usd_addprimvar 824 | usd_addrelationshiptarget 825 | usd_addrotate 826 | usd_addscale 827 | usd_addtotransformorder 828 | usd_addtransform 829 | usd_addtranslate 830 | usd_attrib 831 | usd_attribelement 832 | usd_attriblen 833 | usd_attribnames 834 | usd_attribsize 835 | usd_attribtimesamples 836 | usd_attribtypename 837 | usd_blockattrib 838 | usd_blockprimvar 839 | usd_blockprimvarindices 840 | usd_blockrelationship 841 | usd_boundmaterialpath 842 | usd_clearmetadata 843 | usd_cleartransformorder 844 | usd_collectioncomputedpaths 845 | usd_collectioncontains 846 | usd_collectionexcludes 847 | usd_collectionexpansionrule 848 | usd_collectionincludes 849 | usd_drawmode 850 | usd_findtransformname 851 | usd_flattenediprimvar 852 | usd_flattenediprimvarelement 853 | usd_flattenedprimvar 854 | usd_flattenedprimvarelement 855 | usd_getbbox 856 | usd_getbbox_center 857 | usd_getbbox_max 858 | usd_getbbox_min 859 | usd_getbbox_size 860 | usd_getbounds 861 | usd_getpointinstancebounds 862 | usd_hasapi 863 | usd_haspayload 864 | usd_iprimvar 865 | usd_iprimvarelement 866 | usd_iprimvarelementsize 867 | usd_iprimvarindices 868 | usd_iprimvarinterpolation 869 | usd_iprimvarlen 870 | usd_iprimvarnames 871 | usd_iprimvarsize 872 | usd_iprimvartimesamples 873 | usd_iprimvartypename 874 | usd_isabstract 875 | usd_isactive 876 | usd_isarray 877 | usd_isarrayiprimvar 878 | usd_isarraymetadata 879 | usd_isarrayprimvar 880 | usd_isattrib 881 | usd_iscollection 882 | usd_iscollectionpath 883 | usd_isindexediprimvar 884 | usd_isindexedprimvar 885 | usd_isinstance 886 | usd_isiprimvar 887 | usd_iskind 888 | usd_ismetadata 889 | usd_ismodel 890 | usd_isprim 891 | usd_isprimvar 892 | usd_isrelationship 893 | usd_isstage 894 | usd_istransformreset 895 | usd_istype 896 | usd_isvisible 897 | usd_kind 898 | usd_localtransform 899 | usd_makeattribpath 900 | usd_makecollectionpath 901 | usd_makepropertypath 902 | usd_makerelationshippath 903 | usd_makevalidprimname 904 | usd_makevalidprimpath 905 | usd_metadata 906 | usd_metadataelement 907 | usd_metadatalen 908 | usd_metadatanames 909 | usd_name 910 | usd_parentpath 911 | usd_pointinstancetransform 912 | usd_pointinstance_getbbox 913 | usd_pointinstance_getbbox_center 914 | usd_pointinstance_getbbox_max 915 | usd_pointinstance_getbbox_min 916 | usd_pointinstance_getbbox_size 917 | usd_pointinstance_relbbox 918 | usd_primvar 919 | usd_primvarattribname 920 | usd_primvarelement 921 | usd_primvarelementsize 922 | usd_primvarindices 923 | usd_primvarinterpolation 924 | usd_primvarlen 925 | usd_primvarnames 926 | usd_primvarsize 927 | usd_primvartimesamples 928 | usd_primvartypename 929 | usd_purpose 930 | usd_relationshipforwardedtargets 931 | usd_relationshipnames 932 | usd_relationshiptargets 933 | usd_relbbox 934 | usd_removerelationshiptarget 935 | usd_setactive 936 | usd_setattrib 937 | usd_setattribelement 938 | usd_setcollectionexcludes 939 | usd_setcollectionexpansionrule 940 | usd_setcollectionincludes 941 | usd_setdrawmode 942 | usd_setkind 943 | usd_setmetadata 944 | usd_setmetadataelement 945 | usd_setprimvar 946 | usd_setprimvarelement 947 | usd_setprimvarelementsize 948 | usd_setprimvarindices 949 | usd_setprimvarinterpolation 950 | usd_setpurpose 951 | usd_setrelationshiptargets 952 | usd_settransformorder 953 | usd_settransformreset 954 | usd_setvariantselection 955 | usd_setvisibility 956 | usd_setvisible 957 | usd_specifier 958 | usd_transformname 959 | usd_transformorder 960 | usd_transformsuffix 961 | usd_transformtype 962 | usd_typename 963 | usd_uniquetransformname 964 | usd_variants 965 | usd_variantselection 966 | usd_variantsets 967 | usd_worldtransform 968 | uvdist 969 | uvintersect 970 | uvsample 971 | uvunwrap 972 | variance 973 | velocityname 974 | vertex 975 | vertexattrib 976 | vertexattribsize 977 | vertexattribtype 978 | vertexattribtypeinfo 979 | vertexhedge 980 | vertexindex 981 | vertexnext 982 | vertexpoint 983 | vertexprev 984 | vertexprim 985 | vertexprimindex 986 | vnoise 987 | volume 988 | volumecubicsample 989 | volumecubicsamplev 990 | volumegradient 991 | volumeindex 992 | volumeindexactive 993 | volumeindexorigin 994 | volumeindextopos 995 | volumeindexv 996 | volumepostoindex 997 | volumeres 998 | volumesample 999 | volumesamplev 1000 | volumesmoothsample 1001 | volumesmoothsamplev 1002 | volumevoxeldiameter 1003 | vtransform 1004 | warning 1005 | wireblinn 1006 | wirediffuse 1007 | wnoise 1008 | wo_nspace 1009 | wo_space 1010 | wo_vspace 1011 | writepixel 1012 | wt_nspace 1013 | wt_space 1014 | wt_vspace 1015 | xnoise 1016 | xnoised 1017 | xyzdist 1018 | xyztorgb 1019 | _adaptive_variadic 1020 | _area_variadic 1021 | _bias_variadic 1022 | _common 1023 | _derive_variadic 1024 | _gather_variadic 1025 | _groups_en.ini 1026 | _imagefilter_variadic 1027 | _lightmask_variadic 1028 | _rayopts_variadic 1029 | _space_args 1030 | __uniform_mul 1031 | __uniform_premul 1032 | -------------------------------------------------------------------------------- /resources/vex_syntax/vex_keywords.txt: -------------------------------------------------------------------------------- 1 | break 2 | bsdf 3 | continue 4 | do 5 | else 6 | for 7 | foreach 8 | forpoints 9 | gather 10 | if 11 | illuminance 12 | return 13 | while 14 | -------------------------------------------------------------------------------- /resources/vex_syntax/vex_macros.txt: -------------------------------------------------------------------------------- 1 | # 2 | #define 3 | #else 4 | #endif 5 | #ifndef 6 | #ifdef 7 | #if 8 | #include 9 | #pragma 10 | #undef -------------------------------------------------------------------------------- /resources/vex_syntax/vex_operators.txt: -------------------------------------------------------------------------------- 1 | () 2 | ! 3 | ~ 4 | ++ 5 | -- 6 | * 7 | / 8 | % 9 | + 10 | - 11 | < 12 | > 13 | <= 14 | >= 15 | == 16 | != 17 | & 18 | ^ 19 | | 20 | && 21 | || 22 | ? : 23 | = 24 | += 25 | -= 26 | *= 27 | /= 28 | %= 29 | &= 30 | |= 31 | ^= 32 | , 33 | @ -------------------------------------------------------------------------------- /vex_snippet_library.json: -------------------------------------------------------------------------------- 1 | { 2 | "enable" : true, 3 | "env": [ 4 | { 5 | "VEX_SNIPPET_LIBRARY": "path/to/root" 6 | } 7 | ], 8 | "path": [ 9 | "$VEX_SNIPPET_LIBRARY" 10 | ] 11 | } --------------------------------------------------------------------------------