Skip to content
This repository was archived by the owner on Apr 15, 2024. It is now read-only.

Commit 539a4d1

Browse files
authored
Merge pull request #16 from takavfx/develop
Merge for release v4.2.0
2 parents 40907b3 + 1d38bbd commit 539a4d1

File tree

8 files changed

+96
-53
lines changed

8 files changed

+96
-53
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ Bento is a toolset for Houdini.
99

1010
### Shelf tool
1111

12-
![alt tag](docs/img/ss_shelf_tool_0002.png)
12+
![alt tag](docs/img/ss_shelf_tool.png)
1313

1414
* [Cache Dependency](docs/cacheDependency.md)
1515
* [Creat Delayed Load Procedural](docs/create-dlp.md)
16+
* [Color Nodes](docs/color-nodes.md)
1617

1718
### Python Panel
1819

docs/color-nodes.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1-
# Cache Manager
1+
# Color Nodes
22

33
## Feature
44

5+
### Shelf Tool
6+
7+
Color nodes when shelf-tool button clicked.
8+
If you have already selected nodes, this affects only for them.
9+
10+
### OnCreated Script
11+
512
Color nodes when nodes are created.
613

714
## Detail

docs/img/ss_shelf_tool.png

11.1 KB
Loading

docs/img/ss_shelf_tool_0001.png

-12.5 KB
Binary file not shown.

docs/img/ss_shelf_tool_0002.png

-10.2 KB
Binary file not shown.

python2.7libs/colornodes.py

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# -*- coding: utf-8 -*-
2+
#-------------------------------------------------------------------------------
3+
## Description
4+
"""
5+
This script for color nodes shelf tool and also used in OnCreated script.
6+
"""
7+
#-------------------------------------------------------------------------------
8+
9+
import hou
10+
11+
manager_color = (0, 0.4, 1)
12+
generator_color = (0.8, 0.8, 0.8)
13+
14+
# Common node type colors. These colors affect these types in all contexts.
15+
# Node names are matched identically with keys.
16+
common_type_colors = {
17+
18+
### Gray ###
19+
"null": (0.36, 0.36, 0.36),
20+
"cam": (0.36, 0.36, 0.36),
21+
"merge": (0.36, 0.36, 0.36),
22+
"output": (0.36, 0.36, 0.36),
23+
24+
### Blue: Disk Output ###
25+
"df_alembic_export": (0, 0.4, 1),
26+
"PRT_ROPDriver": (0, 0.4, 1),
27+
"rop_geometry": (0, 0.4, 1),
28+
"rop_alembic": (0, 0.4, 1),
29+
"ropnet": (0, 0.4, 1),
30+
31+
### Yellow: Disk Input ###
32+
"file": (1, 0.8, 0),
33+
"filecache": (1, 0.8, 0),
34+
"filemerge": (1, 0.8, 0),
35+
"alembic": (1, 0.8, 0),
36+
"alembicarchive": (1, 0.8, 0),
37+
38+
### Purple Blue: Dop I/O ###
39+
"dopimport": (0.6, 0.6, 1),
40+
"dopimportfield": (0.6, 0.6, 1),
41+
"dopimportrecords": (0.6, 0.6, 1),
42+
"dopio": (0.6, 0.6, 1),
43+
44+
### Purple ###
45+
"dopnet": (0.4, 0, 0.6),
46+
47+
### Green: Geometry Fetch ###
48+
"object_merge": (0, 0.4, 0),
49+
50+
### Dark Green ###
51+
"geo": (0, 0.267, 0)
52+
53+
54+
}
55+
56+
def run():
57+
if len(hou.selectedNodes()) is 0:
58+
nodes = hou.pwd().allSubChildren()
59+
else:
60+
nodes = hou.selectedNodes()
61+
62+
for node in nodes:
63+
node_type = node.type()
64+
node_type_name = node_type.name()
65+
type_category_name = node_type.category().name().lower()
66+
67+
node_color = None
68+
69+
if node_type.isManager():
70+
node_color = manager_color
71+
72+
elif node_type_name in common_type_colors:
73+
node_color = common_type_colors[node_type_name]
74+
75+
if node_color is not None:
76+
node.setColor(hou.Color(node_color))

scripts/OnCreated.py

Lines changed: 4 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -3,74 +3,27 @@
33
## Description
44
"""
55
This script runs when Houdini nodes are created.
6-
7-
This code is basaed on
86
"""
97
#-------------------------------------------------------------------------------
108

11-
manager_color = (0, 0.4, 1)
12-
generator_color = (0.8, 0.8, 0.8)
13-
14-
# Common node type colors. These colors affect these types in all contexts.
15-
# Node names are matched identically with keys.
16-
common_type_colors = {
17-
18-
### Gray ###
19-
"null": (0.36, 0.36, 0.36),
20-
"cam": (0.36, 0.36, 0.36),
21-
"merge": (0.36, 0.36, 0.36),
22-
"output": (0.36, 0.36, 0.36),
23-
24-
### Blue: Disk Output ###
25-
"df_alembic_export": (0, 0.4, 1),
26-
"PRT_ROPDriver": (0, 0.4, 1),
27-
"rop_geometry": (0, 0.4, 1),
28-
"rop_alembic": (0, 0.4, 1),
29-
"ropnet": (0, 0.4, 1),
30-
31-
### Yellow: Disk Input ###
32-
"file": (1, 0.8, 0),
33-
"filecache": (1, 0.8, 0),
34-
"filemerge": (1, 0.8, 0),
35-
"alembic": (1, 0.8, 0),
36-
"alembicarchive": (1, 0.8, 0),
37-
38-
### Purple Blue: Dop I/O ###
39-
"dopimport": (0.6, 0.6, 1),
40-
"dopimportfield": (0.6, 0.6, 1),
41-
"dopimportrecords": (0.6, 0.6, 1),
42-
"dopio": (0.6, 0.6, 1),
43-
44-
### Purple ###
45-
"dopnet": (0.4, 0, 0.6),
46-
47-
### Green: Geometry Fetch ###
48-
"object_merge": (0, 0.4, 0),
49-
50-
### Dark Green ###
51-
"geo": (0, 0.267, 0)
52-
53-
54-
}
9+
import colornodes
5510

5611
# Node type information.
5712
node = kwargs["node"]
5813
node_type = node.type()
5914
node_type_name = node_type.name()
60-
type_category_name = node_type.category().name().lower()
61-
6215

6316
# Start with no node color:
6417
node_color = None
6518

6619
# Manager nodes (sopnet, chopnet, ropnet, etc).
6720
if node_type.isManager():
68-
node_color = manager_color
21+
node_color = colornodes.manager_color
6922

7023
# Common node types (nulls, switches, etc) are colored the same across
7124
# different contexts.
72-
elif node_type_name in common_type_colors:
73-
node_color = common_type_colors[node_type_name]
25+
elif node_type_name in colornodes.common_type_colors:
26+
node_color = colornodes.common_type_colors[node_type_name]
7427

7528

7629
# If we found a color mapping, set the color of the node.

toolbar/bento.shelf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<toolshelf name="bento_shelf" label="Bento">
99
<memberTool name="cr_cacheDendency"/>
1010
<memberTool name="create_dlp"/>
11+
<memberTool name="color_nodes"/>
1112
</toolshelf>
1213

1314
<tool name="cr_cacheDendency" label="cCDP" icon="SOP_file">
@@ -25,4 +26,9 @@ reload(createDlp)
2526
2627
createDlp.main()]]></script>
2728
</tool>
29+
30+
<tool name="color_nodes" label="CNodes" icon="COP2_colorwheel">
31+
<script scriptType="python"><![CDATA[import colornodes
32+
colornodes.run()]]></script>
33+
</tool>
2834
</shelfDocument>

0 commit comments

Comments
 (0)