Skip to content

Commit

Permalink
1.2.0 (#34)
Browse files Browse the repository at this point in the history
* Refactor controllers by adding a base class

Because we now have a new case for houdini that does not use an editor, we need a base controller class so we can keep everything as it is.

* Refactor tests to new base class

* Improve logging message

* Add example in docs

* Add houdini controller

* Rename module

* Cleanup vscode tasks

* Add py37 specific testenv case

* Remove user from about info

* Renamed and move modules

* Add missing type annotations for parent

* Update changelog

* Update local script name

* Check if button is none

* Fix path

* Update houdini package.json

* Update readme

* Bump to 1.2.0

* Bump version

* Rename scripts to tools

houdini includes a scripts folder which shoud not be on the git
attributes exclude

* Fix comment

* Fix houdini exec with exception

* Refactor local editor

* Improve logging message

* Refactor exec code with stdout capture

* Add tests for exec_code

* Fix format
  • Loading branch information
sisoe24 authored Jan 1, 2025
1 parent 26da3b5 commit baa3733
Show file tree
Hide file tree
Showing 30 changed files with 407 additions and 213 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ CHANGELOG.md export-ignore
.githooks export-ignore
.vscode export-ignore
images export-ignore
scripts export-ignore
tools export-ignore
tests export-ignore

# Source files
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: double-quote-string-fixer
- id: end-of-file-fixer
- id: check-ast
- repo: https://github.com/hhatto/autopep8
rev: v2.0.4
rev: v2.3.1
hooks:
- id: autopep8
args: [--global-config=pyproject.toml, --in-place]
Expand Down
20 changes: 3 additions & 17 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,7 @@
{
"label": "RunApp",
"type": "shell",
"options": {
"env": {
"PYTHONDONTWRITEBYTECODE": "1"
}
},
"osx": {
"command": ".venv/bin/python",
},
"windows": {
"command": ".venv\\Scripts\\python.exe",
},
"args": [
"-m",
"nukeserversocket.controllers.local_app"
],
"command": "poetry run nukeserversocket",
"problemMatcher": []
},
{
Expand All @@ -36,8 +22,8 @@
"run",
"pytest",
"-xsl",
// "--lf",
"-vvv",
"--count",
"2",
// "-m quick"
],
"group": "test",
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## [1.2.0] - 2024-11-17

### Added

- Houdini support through new `HoudiniController` and `HoudiniEditor` in `controllers.houdini` module.

### Changed

- Refactor the core controller components to allow multiple controllers types (houdini does not uses a script editor for example).
- Moved and rename some files for better organizzation.
- Updated logging and documentation

## [1.1.0] - 2024-08-18

### Added
Expand Down
151 changes: 93 additions & 58 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,47 +10,36 @@
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/5b59bd7f80c646a8b2b16ad4b8cba599)](https://www.codacy.com/gh/sisoe24/nukeserversocket/dashboard?utm_source=github.com&utm_medium=referral&utm_content=sisoe24/nukeserversocket&utm_campaign=Badge_Grade)
[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/5b59bd7f80c646a8b2b16ad4b8cba599)](https://www.codacy.com/gh/sisoe24/nukeserversocket/dashboard?utm_source=github.com&utm_medium=referral&utm_content=sisoe24/nukeserversocket&utm_campaign=Badge_Coverage)


[![NukeTools](https://img.shields.io/github/v/release/sisoe24/Nuke-Tools?label=NukeTools)](https://marketplace.visualstudio.com/items?itemName=virgilsisoe.nuke-tools)
![x](https://img.shields.io/badge/Nuke-✅-success)
![x](https://img.shields.io/badge/Houdini-✅-success)
![x](https://img.shields.io/badge/Python-3.*-success)
![x](https://img.shields.io/badge/Nuke-_13_|_14_|_15-yellow)

A Nuke plugin to run code from external applications.
[![NukeTools](https://img.shields.io/github/v/release/sisoe24/Nuke-Tools?label=NukeTools)](https://marketplace.visualstudio.com/items?itemName=virgilsisoe.nuke-tools)

- [1. nukeserversocket README](#1-nukeserversocket-readme)
- [1.1. 1.0.0 Release](#11-100-release)
- [1.2. Features](#12-features)
- [1.3. Client applications](#13-client-applications)
- [1.3.1. Create a custom client](#131-create-a-custom-client)
- [1.4. Installation](#14-installation)
- [1.5. Usage](#15-usage)
- [1.6. Settings](#16-settings)
- [1.7. Known Issues](#17-known-issues)
- [1.8. Compatibility](#18-compatibility)
- [1.9. Contributing](#19-contributing)

## 1.1. 1.0.0 Release

This is the initial stable version of nukeserversocket. It's a total rewrite of the earlier version with the primary goal to enhance stability and simplify maintenance. Now, the plugin is more flexible and straightforward to use in different applications.

For a full list of changes, see the [CHANGELOG](https://github.com/sisoe24/nukeserversocket/blob/main/CHANGELOG.md)
- [1.1. Client applications](#11-client-applications)
- [1.1.1. Create a custom client](#111-create-a-custom-client)
- [1.2. Installation](#12-installation)
- [1.2.1. Nuke](#121-nuke)
- [1.2.1.1. Using NukeTools (Recommended)](#1211-using-nuketools-recommended)
- [1.2.1.2. Manual Installation](#1212-manual-installation)
- [1.2.2. Houdini Installation](#122-houdini-installation)
- [1.2.2.1. HOUDINI\_PACKAGE\_DIR](#1221-houdini_package_dir)
- [1.2.2.2. Using Houdini Preferences](#1222-using-houdini-preferences)
- [1.2.3. Houdini Notes](#123-houdini-notes)
- [1.3. Usage](#13-usage)
- [1.4. Settings](#14-settings)
- [1.5. Known Issues](#15-known-issues)
- [1.6. Compatibility](#16-compatibility)
- [1.7. Python2.7](#17-python27)
- [1.8. Contributing](#18-contributing)

>[!IMPORTANT]
> The repository name has changed from `NukeServerSocket` to `nukeserversocket`. Although GitHub url seems to be case insensitive, if you have cloned the repository before, you might need to update the remote url.
> ```bash
> git remote set-url origin https://github.com/sisoe24/nukeserversocket.git
> ```
>[!NOTE]
>If you are using Nuke 12 or Python 2.7, you can still use the previous version of the plugin `<=0.6.2` from the [releases page](https://github.com/sisoe24/nukeserversocket/releases/tag/v0.6.2)
---
## 1.2. Features
> You can now execute code for Houdini! See installation notes
- Receive Python or BlinkScript code from any client in your local network.
- Connect more than one client to the same Nuke instance.
A PySide2 plugin for executing Python/BlinkScript remotely in Nuke from any network client, supporting multiple connections. Compatible with both Nuke and Houdini.

## 1.3. Client applications
## 1.1. Client applications

Client applications that use nukeserversocket:

Expand All @@ -59,7 +48,7 @@ Client applications that use nukeserversocket:
- [Nuke Tools ST](https://packagecontrol.io/packages/NukeToolsST) - Sublime Text package.
- [DCC WebSocket](https://marketplace.visualstudio.com/items?itemName=virgilsisoe.dcc-websocket) - Visual Studio Code Web extension (deprecated at the moment).

### 1.3.1. Create a custom client
### 1.1.1. Create a custom client

You can create a custom client in any programming language that supports socket communication. The client sends the code to the server, which then executes it in Nuke and sends back the result. For more information, see the [wiki page](https://github.com/sisoe24/nukeserversocket/wiki/Client-Applications-for-NukeServerSocket)

Expand All @@ -79,20 +68,70 @@ for node in nodes:
print(node)
```

## 1.4. Installation
## 1.2. Installation

### 1.2.1. Nuke

#### 1.2.1.1. Using NukeTools (Recommended)

If you use [Nuke Tools](https://marketplace.visualstudio.com/items?itemName=virgilsisoe.nuke-tools), simply run the command `Nuke: Add Packages` to install.

#### 1.2.1.2. Manual Installation

1. Download from [releases page](https://github.com/sisoe24/nukeserversocket/releases) or clone from GitHub
2. Place in *~/.nuke* or your preferred directory
3. Add to your *menu.py*:
```python
from nukeserversocket import nukeserversocket
nukeserversocket.install_nuke()
```

### 1.2.2. Houdini Installation

> **Note:** These instructions assume NukeServerSocket was installed via NukeTools in `$HOME/.nuke/NukeTools`. If installed manually, adjust paths accordingly. Also, you dont need to have Nuke installed to make this work.
#### 1.2.2.1. HOUDINI_PACKAGE_DIR

Add to your shell configuration:

**Mac/Linux** (.bashrc or .zshrc):
```bash
export HOUDINI_PACKAGE_DIR=$HOME/.nuke/NukeTools/nukeserversocket
```

1. Download the repository via the [releases page](https://github.com/sisoe24/nukeserversocket/releases) or by cloning it from GitHub.
2. Place the folder inside the _~/.nuke_ directory or into a custom one.
3. Then, in your _menu.py_, write
```python
from nukeserversocket import nukeserversocket
nukeserversocket.install_nuke()
```
**Windows:**
- Add `HOUDINI_PACKAGE_DIR` to Environment Variables (start menu)
- Set value to `%USERPROFILE%\.nuke\NukeTools\nukeserversocket`

>[!NOTE]
> If you use [Nuke Tools](https://marketplace.visualstudio.com/items?itemName=virgilsisoe.nuke-tools), use the command `Nuke: Add Packages` then select nukeServerSocket.
>For CMD/PowerShell users, refer to Microsoft's documentation on environment variables for alternative setup methods.
#### 1.2.2.2. Using Houdini Preferences

1. Navigate to your Houdini packages directory:
- Windows: `C:/Users/YourName/Documents/houdiniXX.X/packages`
- Mac: `~/Library/Preferences/houdini/XX.X/packages`
- Linux: `~/houdiniXX.X/packages`

2. Create `nukeserversocket.json`:
```json
{
"hpath": [
"$HOME/.nuke/NukeTools/nukeserversocket/nukeserversocket/controllers/houdini"
],
"env": [
{
"PYTHONPATH": "$HOME/.nuke/NukeTools/nukeserversocket"
}
]
}
```

### 1.2.3. Houdini Notes

The Houdini execution method differs from Nuke's. Nuke relies on its internal script editor, while Houdini uses Python's `exec`. The Nuke controller also used to rely on `exec`, but I removed that functionality because it didn't work in all scenarios. If you have better suggestions, let me know!

## 1.5. Usage
## 1.3. Usage

![Execute Code](images/run_code.gif)

Expand All @@ -102,7 +141,10 @@ for node in nodes:
>[!NOTE]
> If you receive a message: "_Server did not initiate. Error: The bound address is already in use_", change the **port** to a random number between `49152` and `65535` and try again.
## 1.6. Settings
## 1.4. Settings

>[!NOTE]
> Only the server timeout setting applies to Houdini.
You can access the settings from the plugin toolbar.

Expand All @@ -120,27 +162,20 @@ You can access the settings from the plugin toolbar.
- **Clear Output**: The script editor output window will clear the code after each execution.
- **Server Timeout**: Set the Timeout when clicking the **Connect** button. The default value is `10` minutes.

## 1.7. Known Issues
## 1.5. Known Issues

- Changing workspace with an active open connection makes Nuke load a new plugin instance with the default UI state. So it would look as if the previous connection has been closed, whereas in reality is still open and listening. To force close all of the listening connections, you can:
- Restart the Nuke instance.
- Wait for the connection timeout.

## 1.8. Compatibility
Nuke version: 13, 14, 15
## 1.6. Compatibility

While it should work the same on all platforms, I have tested the plugin only on:
Should work everywhere PySide2 and Python 3 work.

- Linux:
- CentOS 8
- macOS:
- Mojave 10.14.06
- Catalina 10.15.07
- Monterey 12.6.3
- Windows 10
## 1.7. Python2.7

If you are using Python 2.7, you can still use the previous version of the plugin `<=0.6.2` from the [releases page](https://github.com/sisoe24/nukeserversocket/releases/tag/v0.6.2)

## 1.9. Contributing
## 1.8. Contributing

If you have any suggestions, bug reports, or questions, feel free to open an issue or a pull request. I am always open to new ideas and improvements. Occasionally, I pick something from the [Projects](https://github.com/users/sisoe24/projects/4) tab, so feel free to check it out.
10 changes: 10 additions & 0 deletions houdini_package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"hpath": [
"$HOUDINI_PACKAGE_PATH/nukeserversocket/controllers/houdini"
],
"env": [
{
"PYTHONPATH": "$HOUDINI_PACKAGE_PATH"
}
]
}
1 change: 0 additions & 1 deletion nukeserversocket/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
"""Module will initialize the logging system and import Nuke."""
from __future__ import annotations

from .main import NukeServerSocket
Expand Down
7 changes: 4 additions & 3 deletions nukeserversocket/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

import sys
import logging
from typing import Optional

from PySide2.QtCore import Slot
from PySide2.QtWidgets import (QCheckBox, QGroupBox, QHBoxLayout, QPushButton,
QVBoxLayout, QPlainTextEdit)
from PySide2.QtWidgets import (QWidget, QCheckBox, QGroupBox, QHBoxLayout,
QPushButton, QVBoxLayout, QPlainTextEdit)

from .logger import get_logger

Expand All @@ -21,7 +22,7 @@


class NssConsole(QGroupBox):
def __init__(self, parent=None):
def __init__(self, parent: Optional[QWidget] = None):
super().__init__(parent, title='Logs')

self._console = QPlainTextEdit()
Expand Down
Loading

0 comments on commit baa3733

Please sign in to comment.