-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheditor.py
30 lines (23 loc) · 868 Bytes
/
editor.py
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
import ryven
from PySide2.QtWidgets import QApplication
import os
import sys
def init_editor():
# create new editor instance
app = QApplication.instance()
blender_window = app.blender_widget
# editor = EditorWindow(main_window)
editor = ryven.run_ryven(
qt_app=app, show_dialog=False,
gui_parent=blender_window, window_title='Ryven Blender',
flow_theme='Blender'
)
session = editor.session
# important: relative imports don't work here our of the box;
# this file's dir serves now as base directory for relative imports within this package
sys.path.append(os.path.dirname(__file__))
# register nodes (though Ryven!)
editor.import_nodes(path=os.path.join(os.path.dirname(__file__), 'blender_nodes'))
# create main script
session.create_script('main')
return editor, session