Skip to content

Commit

Permalink
Merge pull request #3 from aaronsmithtv/state_script_reformat
Browse files Browse the repository at this point in the history
Full revamp of HPaint viewer state and construction (HPaint 2.0)
  • Loading branch information
aaronsmithtv authored Jul 21, 2023
2 parents ede4880 + a3ff184 commit 66771bc
Show file tree
Hide file tree
Showing 13 changed files with 2,952 additions and 15 deletions.
75 changes: 75 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Project ignore
.ipynb_checkpoints
.mypy_cache
.vscode
__pycache__
.pytest_cache
htmlcov
dist
site
.coverage
coverage.xml
.netlify
test.db
log.txt
Pipfile.lock
env3.*
env
docs_build
venv
docs.zip
archive.zip

# Ignore IntelliJ IDEA directories
.idea/
*.iml
*.iws
*.ipr

# Ignore PyCharm directories
__pycache__/
*.pyc
*.pyo
*.pyd
*.pyc/

# Ignore VSCode directories
.vscode/

# Compiled source
*.com
*.class
*.dll
*.exe
*.o
*.so

# Packages
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

# Logs and databases
*.log
*.sql
*.sqlite

# OS generated files
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db

*.env
*.pypirc
*.egg-info
.ruff*
build
49 changes: 43 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,47 @@
# HPaint 1.2
The Hpaint SOP is a viewport drawing utility for Houdini 18.5 & 19 (py2 and py3), for representing 'painted' strokes as UVed geometry. Hpaint masks your (tablet pressure sensitive) strokes to the input geometry, as well as conforming strokes to the geometry normal of underlying faces.
# <img src="https://static.sidefx.com/images/apple-touch-icon.png" width="25" height="25" alt="Hbuild Logo"> HPaint 2.0

**Download:** https://github.com/aaronsmithtv/hpaint/blob/main/otls/aaron_smith__hpaint__1_2.hdalc
![license](https://img.shields.io/badge/license-MIT-green) ![version](https://img.shields.io/badge/version-2.0-blue)

**NOTE:** I only own an Indie license, so this is currently only available as a .hdalc file. The HDA was last generated in Houdini 19.0.426 py3
### 🎨 HPaint is a viewport drawing utility for Houdini 19.5, allowing you to digitally paint on any geometry.

![Hpaint Painting Example](https://github.com/aaronsmithtv/hpaint/blob/main/examples/images/hpaint_doc_gif_001.gif)
![Hpaint Painting Example](examples/images/hpaint_doc_gif_001.gif)

![Hpaint Annotation Example](https://github.com/aaronsmithtv/hpaint/blob/main/examples/images/hpaint_doc_gif_002.gif)
The concept is similar to Blender's Grease Pencil utility, with extra features allowing you to also perform 2D Animation tasks, draw in your viewport with Screen Drawing, control your drawing methods and enable geometry masking, as well as 'layer' your strokes with surface distance offsets and primitive groups.

Each stroke is a 3D card with UVs - allowing you to texture your strokes similar to using a custom brush in Photoshop.

### 🆕 New to HPaint 2.0
- Updated for Houdini 19.5
- Major optimizations for cache evaluation, drawing and data handling.
- Added `Colour Picker` utility, that samples the `Cd` attribute from the input geometry using `MMB`.
- Added `Disable Geometry Mask` toggle to allow strokes drawn off-geometry.
- Strokes are evaluated from the last normal-plane distance of the geometry before it went off-geometry.
- Strokes have an intelligent repositioning algorithm to allow strokes to look fluid no matter how they are drawn.
- Revamped `Screen Drawing` functionality.
- You can now screen draw in any present viewport. Previously you could only draw in camera view.
- You can choose between `Continuous` (Always screen draw at the `ScDraw Distance`) and `Once` (Draw from the first depth-picked position) modes.
- You can hold `Shift + MMB` to pick the `ScDraw Distance` depth from your present viewport.
- Added `Output Curves Only` toggle, which disables stroke card construction.
- Added extra visualization options in their own tab.
- Modern tool-tips have been added per 19.5 viewer state guidelines.

## 🗝️ Key Features
- **🖌️ Digital Painting on your Geometry**: Plug HPaint into any SOP and start drawing! By default, HPaint allows you to sample and draw on geometry and mask your strokes to the geometry itself.
- **✍️ Screen Drawing**: HPaint offers versatile options for screen drawing, with the `Depth Picker` utility, depth sampling methods and an interactive screen distance parameter.
- **🎬 2D Animation**: Get started instantly with the `$F` frame tag in your filename and the `Display Nearest Frame` toggle to start animating like you would in softwares such as Toon Boom!
- **💽 Smart Disk Caching**: Save your HPaint cache out and share it with other HPaint users - enabling collaborative workflows.

## 📥 Installation
[Download the HDA file](otls/aaronsmithtv__hpaint__2.0.hda) and install it to your `houdini19.5/otls/` folder. For detailed instructions, please refer to the [Houdini documentation](https://www.sidefx.com/docs/houdini/assets/install.html).

## ⏩ Quick Start
After installing HPaint, open a SOP context node view and connect HPaint's single input to any geometry, preferably with the `N` normal attribute configured correctly. A test geometry works well for initial usage.

With the display for the HPaint SOP enabled, move your cursor to the viewport and press `Enter`. This will display the tool-tips for HPaint, letting you know that the initialization has worked as intended.

Begin creating strokes by holding `LMB` on your geometry - as you would in any other digital painting software! If you want to draw everywhere, toggle `Screen Drawing` or toggle `Disable Geometry Mask` to paint wherever you want on the viewport.

## 💡 Feedback
If you have any feedback or run into issues, please feel free to open an issue on this GitHub project. I really appreciate your support!

![Hpaint Annotation Example](examples/images/hpaint_doc_gif_003b.gif)
1 change: 0 additions & 1 deletion examples/.gitkeep

This file was deleted.

1 change: 0 additions & 1 deletion examples/geo/.gitkeep

This file was deleted.

1 change: 0 additions & 1 deletion examples/hip/.gitkeep

This file was deleted.

1 change: 0 additions & 1 deletion examples/images/.gitkeep

This file was deleted.

18 changes: 18 additions & 0 deletions hda_py/OnCreated.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import hou

node = kwargs["node"]

# Set Colour
blue = hou.Color((0.6, 0.85, 0.98))
node.setColor(blue)

# Load initially pathed file
node.parm("hp_file_reload").pressButton()

# # register python callback to be called on hip file event
# # e.g loading, saving: for reloading hpaint cache
# def hpaint_reload_se_callback(event_type):
# node.parm("hp_file_reload").pressButton()

# with hou.undos.disabler():
# hou.hipFile.addEventCallback(hpaint_reload_se_callback)
Loading

0 comments on commit 66771bc

Please sign in to comment.