Skip to content

Commit

Permalink
Merge pull request #163 from nxt-dev/dev
Browse files Browse the repository at this point in the history
Release editor-v3.7.0
  • Loading branch information
ImLucasBrown authored Feb 9, 2021
2 parents f1bb611 + e631126 commit 0d0cb7d
Show file tree
Hide file tree
Showing 24 changed files with 1,091 additions and 386 deletions.
32 changes: 7 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[Installation/Usage](#installationusage) | [Docs](https://nxt-dev.github.io/) | [Contributing](CONTRIBUTING.md) | [Licensing](LICENSE)

# Installation/Usage
**To Use NXT please use the [NXT Standalone](#nxt-standalone) or [DCC plugin zip.](#maya-plugin)**
**To Use NXT please use the [NXT Standalone](#nxt-standalone) or [DCC plugin zip.](#DCC-Plugins)**
Only clone this repo if you're [contributing](CONTRIBUTING.md) to the NXT codebase.

<br>
Expand All @@ -24,32 +24,14 @@ Our releases are hosted on [PyPi](https://pypi.org/project/nxt-editor/).
- Update:
- `pip install -U nxt-editor`

### Blender addon:
- Install:
1. Download Blender addon (nxt_blender.zip) [latest release](https://github.com/nxt-dev/nxt_editor/releases/latest)
2. Extract and follow `README.md` inside [nxt_blender](nxt_editor/integration/blender/README.md) instructions (also included in the download)
- Launch:
1. Load the `nxt_blender` Addon (Edit > Preferences > Add-ons)
2. Navigate the newly created NXT menu and select Open Editor.
- Update:
- Automatically: NXT > Update NXT
- By Hand: `/path/to/python.exe -m pip install -U nxt-editor`
- Relaunch Blender after

### DCC Plugins

### Maya plugin:
Each of our supported DCC's get a zip file on our [latest release](https://github.com/nxt-dev/nxt_editor/releases/latest)

- Install:
1. Download the maya module(`nxt_maya.zip`) from the [latest release](https://github.com/nxt-dev/nxt_editor/releases/latest)
2. Follow the [nxt_maya](nxt_editor/integration/maya/README.md) instructions (also included in the download)
- Launch:
1. Load `nxt_maya` plugin in Maya
2. Select the `nxt` menu from the menus at the top of Maya
3. Click `Open Editor`
- Update:
1. Download the `nxt_maya` zip from the [latest release](https://github.com/nxt-dev/nxt_editor/releases/latest)
2. Extract the zip and replace the existing `nxt_maya` files with the newly extracted files.
3. Re-launch Maya
Each one contains a `README.md` inside to explain how to install/update them.
- [nxt_maya](nxt_editor/integration/maya/README.md)
- [nxt_blender](nxt_editor/integration/blender/README.md)
- [nxt_unreal](nxt_editor/integration/unreal/README.md)

<br>

Expand Down
6 changes: 5 additions & 1 deletion build/make_maya_plugin.nxt
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,11 @@
"os.makedirs('${mod_folder}/scripts/Qt')",
"",
"with open('${mod_folder}/scripts/Qt/__init__.py', 'w+') as fp:",
" fp.write(result.content)"
" if isinstance(result.content, str):",
" fp.write(result.content)",
" else:",
" fp.write(result.content.decode())",
""
]
}
}
Expand Down
60 changes: 60 additions & 0 deletions build/make_unreal_plugin.nxt
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"version": "1.17",
"alias": "make_unreal_plugin",
"color": "#879fda",
"mute": false,
"solo": false,
"meta_data": {
"positions": {
"/make_plugin": [
-144.0,
-49.0
]
}
},
"nodes": {
"/": {
"code": [
"import os",
"import shutil"
]
},
"/make_plugin": {
"start_point": true,
"attrs": {
"icon_path": {
"type": "raw",
"value": "${file::../nxt_editor/resources/icons/nxt_128.png}"
},
"result_dir": {
"type": "raw",
"value": "${path::nxt_unreal}"
},
"unreal_integration_dir": {
"type": "raw",
"value": "${file::../nxt_editor/integration/unreal}"
},
"uplugin_path": {
"type": "raw",
"value": "${file::${unreal_integration_dir}/nxt_unreal.uplugin}"
}
},
"code": [
"if os.path.exists('${result_dir}'):",
" shutil.rmtree('${result_dir}')",
"shutil.copytree('${unreal_integration_dir}', '${result_dir}')",
"resources_dir = '${result_dir}/Resources'",
"os.makedirs(resources_dir)",
"target_icon_path = os.path.join(resources_dir, 'Icon128.png')",
"shutil.copyfile('${icon_path}', target_icon_path)",
"leftover_init = os.path.join(self.result_dir, '__init__.py')",
"leftover_pycache = os.path.join(self.result_dir, '__pycache__')",
"os.remove(leftover_init)",
"try:",
" shutil.rmtree(leftover_pycache)",
"except:",
" pass"
]
}
}
}
61 changes: 56 additions & 5 deletions build/release.nxt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"mute": false,
"solo": false,
"references": [
"make_unreal_plugin.nxt",
"make_maya_plugin.nxt",
"make_blender_plugin.nxt",
"../../nxt/build/release.nxt"
Expand All @@ -23,8 +24,8 @@
},
"positions": {
"/CreateRelease": [
2460.0,
60.0
2861.9022362347496,
69.87218527196421
],
"/GitClone": [
-1000.0,
Expand Down Expand Up @@ -59,8 +60,8 @@
420.0
],
"/ReleaseLoop": [
2420.0,
0.0
2824.2201296032613,
7.554291903452558
],
"/build_maya_plugin": [
1800.0,
Expand All @@ -78,13 +79,21 @@
1820.0,
0.0
],
"/make_plugin": [
2465.5358761299212,
1.3083409543444589
],
"/versions": [
140.0,
0.0
],
"/zip_blender_addon": [
2140.0,
80.0
],
"/zip_blender_addon2": [
2460.556716567386,
151.71085853406586
]
},
"collapse": {
Expand Down Expand Up @@ -128,6 +137,7 @@
"DraftRelease",
"UploadBlenderAddon",
"UploadMayaPlugin",
"UploadUnrealPlugin",
"OpenReleaseURL"
]
},
Expand Down Expand Up @@ -157,8 +167,21 @@
}
}
},
"/CreateRelease/UploadUnrealPlugin": {
"instance": "/GitUpload",
"attrs": {
"asset_path": {
"type": "raw",
"value": "${/make_plugin/zip_unreal_plugin.zip_path}"
},
"content_type": {
"type": "raw",
"value": "application/zip"
}
}
},
"/ReleaseLoop": {
"execute_in": "/make_addon",
"execute_in": "/make_plugin",
"attrs": {
"release_types": {
"type": "tuple",
Expand Down Expand Up @@ -224,6 +247,34 @@
"shutil.rmtree('${mod_folder}')"
]
},
"/make_plugin": {
"start_point": false,
"execute_in": "/make_addon",
"child_order": [
"zip_unreal_plugin"
],
"attrs": {
"result_dir": {
"value": "${path::${release_dir}/nxt_unreal}"
}
}
},
"/make_plugin/zip_unreal_plugin": {
"attrs": {
"zip_name": {
"type": "raw",
"value": "${result_dir}"
},
"zip_path": {
"type": "raw",
"value": "${zip_name}.zip"
}
},
"code": [
"self.zip_path = shutil.make_archive('${zip_name}', 'zip', '${result_dir}')",
"shutil.rmtree('${result_dir}')"
]
},
"/versions": {
"attrs": {
"EDITOR": {
Expand Down
1 change: 1 addition & 0 deletions nxt_editor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def make_resources(qrc_path=None, result_path=None):
from nxt_editor import qresources
except ImportError:
make_resources()
from nxt_editor import qresources


def _new_qapp():
Expand Down
17 changes: 14 additions & 3 deletions nxt_editor/connection_graphics_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from . import colors
from nxt import nxt_path, nxt_node
import nxt_editor
from nxt_editor.node_graphics_item import MIN_LOD

logger = logging.getLogger(nxt_editor.LOGGER_NAME)

Expand Down Expand Up @@ -98,9 +99,19 @@ def rebuild_line(self):
self.update()

def paint(self, painter, option, widget):
painter.setRenderHints(QtGui.QPainter.Antialiasing |
QtGui.QPainter.SmoothPixmapTransform)
pen = QtGui.QPen(self.color, self.thickness, self.pen_style)
lod = QtWidgets.QStyleOptionGraphicsItem.levelOfDetailFromTransform(
painter.worldTransform())
if lod > MIN_LOD:
painter.setRenderHints(QtGui.QPainter.Antialiasing |
QtGui.QPainter.SmoothPixmapTransform)
thick_mult = 1
pen_style = self.pen_style
else:
painter.setRenderHints(False)
thick_mult = 3
pen_style = QtCore.Qt.PenStyle.SolidLine
pen = QtGui.QPen(self.color, self.thickness * thick_mult,
self.pen_style)
# if self.tgt_path in self.model.selection:
# pen.setColor(colors.SELECTED)
# elif self.is_hovered:
Expand Down
38 changes: 24 additions & 14 deletions nxt_editor/dockwidgets/code_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,19 +319,26 @@ def update_editor(self, node_list=()):
# for faster updates. And avoid that early exit check at the top.
get_code = self.stage_model.get_node_code_string
code_string = get_code(self.node_path,
self.stage_model.data_state,
self.stage_model.comp_layer)
self.stage_model.data_state,
self.stage_model.comp_layer)
cached_state = self.stage_model.data_state == DATA_STATE.CACHED
self.actual_display_state = DATA_STATE.RAW
if code_string and cached_state:
self.actual_display_state = DATA_STATE.CACHED
elif not code_string and cached_state:
self.actual_display_state = DATA_STATE.RAW
code_string = get_code(self.node_path, DATA_STATE.RAW,
self.stage_model.comp_layer)
self.stage_model.comp_layer)
else:
self.actual_display_state = self.stage_model.data_state
if self.editing_active:
self.overlay_widget.main_color = self.overlay_widget.base_color
self.overlay_widget.hide()
elif self.code_is_local:
self.overlay_widget.main_color = None
self.overlay_widget.show()
else:
self.overlay_widget.main_color = self.overlay_widget.ext_color
self.overlay_widget.show()
self.overlay_widget.update()
self.editor.verticalScrollBar().blockSignals(True)
self.cached_code_lines = code_string.split('\n')
Expand Down Expand Up @@ -397,11 +404,6 @@ def update_code_is_local(self):
self.editor.current_line_highlight = not is_local
self.overlay_widget.main_color = self.overlay_widget.base_color
self.update_background()
if self.editing_active or is_local:
self.overlay_widget.hide()
else:
self.overlay_widget.main_color = self.overlay_widget.ext_color
self.overlay_widget.show()
self.code_is_local = is_local

def localize_code(self):
Expand Down Expand Up @@ -1280,26 +1282,34 @@ def __init__(self, parent=None):
self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
self.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents)
self.data_state = ''
self.click_msg = 'Double Click To Edit'

def paintEvent(self, event):
painter = QtGui.QPainter()
painter.begin(self)
painter.setFont(QtGui.QFont("Roboto", 14))
font_metrics = QtGui.QFontMetrics(painter.font())
painter.setRenderHint(QtGui.QPainter.Antialiasing)
# actual_display_state
code_editor = self._parent.ce_widget
model = code_editor.stage_model
self.data_state = code_editor.actual_display_state
painter.setPen(QtCore.Qt.white)
font_matrics = QtGui.QFontMetrics(painter.font())
offset = font_matrics.boundingRect(self.data_state).width()
offset += painter.font().pointSize()
# Draw top right data state text
offset = font_metrics.boundingRect(self.data_state).width()
offset += painter.font().pointSize() * 1.5
painter.drawText(self.rect().right() - offset,
painter.font().pointSize() * 1.5, self.data_state)
# Draw center message text
msg_offset = font_metrics.boundingRect(self.click_msg).width()
msg_offset += painter.font().pointSize()
painter.drawText(self.rect().center().x() - (msg_offset*.5),
self.rect().center().y(), self.click_msg)
painter.setCompositionMode(QtGui.QPainter.CompositionMode_Darken)

path = QtGui.QPainterPath()
path.addRoundedRect(QtCore.QRectF(self.rect()), 9, 9)
painter.fillPath(path, QtGui.QBrush(self.main_color))
if self.main_color:
painter.fillPath(path, QtGui.QBrush(self.main_color))
painter.setCompositionMode(QtGui.QPainter.CompositionMode_Screen)
display_is_raw = self.data_state == DATA_STATE.RAW
mode_is_cache = model.data_state == DATA_STATE.CACHED
Expand Down
Loading

0 comments on commit 0d0cb7d

Please sign in to comment.