-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathOnCreated.py
More file actions
45 lines (37 loc) · 1.3 KB
/
Copy pathOnCreated.py
File metadata and controls
45 lines (37 loc) · 1.3 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/python
#TILE: HOUDINI HELP TO COMMENT
#AUTHOR: eng. ANDREA LEGANZA
#HOUDINI VERSION: TESTED ON HOUDINI 16.0 AND 16.5
#SCRIPT VERSION: 1.0
#DESCRIPTION:
# 1) place script inside <$houdini>/scripts/
# 2) restart Houdini
# 3) create a geometry node
# 4) inside it create any kind of node
# 5) script will add for any new node as comment the headline taken from online documentation
# NOTE: some scripts don't have headline or entire documentation
import hou
import os
import zipfile
ZIPFOLDER = os.environ['HFS']+"/houdini/help/nodes.zip".replace("/",os.sep)
ARCHIVE = zipfile.ZipFile(ZIPFOLDER, 'r')
def getHeader(path):
#print "Path"+path
path = path.lower()
path = path.replace("operator:","").replace("object/","obj/").split("?")[0]
if "invalid" in path:
return ""
try:
nodeHelpContent = ARCHIVE.read(path+".txt")
splitted = nodeHelpContent.split("\"\"\"")
return splitted[1] if len(splitted)>1 else "Not found"
except:
return "Not found"
def main(kwargs):
#node = kwargs["node"]
for node in hou.selectedNodes():
description = getHeader(node.type().defaultHelpUrl())
if node.isEditable():
node.setComment(description)
node.setGenericFlag(hou.nodeFlag.DisplayComment,True)
main(kwargs)