Category: hou-programming
Archived post by paqwak
yup, probably very ugly ‘coding’ wise, but … it works :O) (still need to add the break/stop) condition … kinda hypnotic 🙂 (I should rename it “retarded postman” or something 🙂 )
Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20232307/14/23/PseudoPostman3.hiplc
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20232307/14/23/GIF_7-14-2023_1-24-27_PM.gif
Archived post by ajk48n
cheers, that page almost does it, just need to convert the string to unicode “` uiString = unicode(hou.readFile(‘opdef:/blah/blah’), ‘utf-8’) uic.loadUi(io.StringIO(uiString), self) “`
Archived post by captainhammy
Did you try it using double quotes instead of single?
opchange “$JOB” bob will still cause the var to be expanded. Single quotes won’t
Archived post by toadstorm
i just threw together some notes about using callbacks and event scripts on disk to customize nodes without resorting to wrapper HDAs: www.toadstorm.com/blog/?p=1012
Archived post by profbetis
does anyone know how to make these breaks in parameter dropdown menus?
okay cool found it in docs > Any menu item with the token `_separator_` will be replaced with a menu separator.
Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20230001/30/23/image.png
Archived post by chris_gardner
i’m not sure that it’s you. re_replace can be pretty weird sometimes
i can’t make it capture $F5 despite using syntax that i know is valid regex
here’s a crappy workaround
“`string path = chs(“path”); s@blah = re_replace(sprintf(“%05d”, @Frame), ‘1234’, path); “`
aha
“`s@blah2 = re_replace(‘[$]F5’, ‘2345’, path);“`
escape the $ with square brackets. that’s totally sane and documented
Archived post by Remi Pierre
Thought that could be valuable to someone at some point. node.cook(force_cook=True) doesn’t work in manual mode, so here’s a shitty workaround for it 🙂 “` import tempfile def get_sop_node_geometry(node): “”” Force cook a node even in manual mode
Args: node (hou.SopNode): a Sop node to compute
Returns: hou.Geometry: The frozen geometry
“”” rop_geo = hou.node(‘/out’).createNode(‘geometry’) rop_geo.parm(‘soppath’).set(node.path()) tmp_file = tempfile.NamedTemporaryFile(suffix=’.bgeosc’) try: rop_geo.render(output_file=tmp_file.name) except hou.Error: rop_geo.destroy() return hou.Geometry() rop_geo.destroy() geometry = hou.Geometry() geometry.loadFromFile(tmp_file.name) return geometry “`
Archived post by TOADSTORM
“`python import fnmatch import hou
def glob_attrs(geo, pattern): all_attrs = list() out_attrs = list() all_attrs.extend(geo.pointAttribs()) all_attrs.extend(geo.primAttribs()) all_attrs.extend(geo.vertexAttribs()) all_attrs.extend(geo.globalAttribs()) matches = [f for f in pattern.split() if not f.startswith(“^”)] excludes = [f.strip(“^”) for f in pattern.split() if f.startswith(“^”)] for attr in all_attrs: for pattern in matches: if fnmatch.fnmatch(attr.name(), pattern): out_attrs.append(attr) for pattern in excludes: if fnmatch.fnmatch(attr.name(), pattern): if attr in out_attrs: out_attrs.remove(attr) out_attrs = list(set(out_attrs)) return out_attrs “`
feed it a Geometry object and a pattern and it’ll return hou.Attribs
no guarantees it isn’t shit but it might help you
Archived post by lcrs
in the textport you can do `vexprofile start`, play a few frames, then just `vexprofile` and you get stuff like “`/ -> vexprofile start / -> vexprofile —————————————————————————— VEX profile listing generated: Sun Mar 8 12:40:51 2020
Function Excl. Incl. Calls Instructions Instr. SIMD SIMD Min SIMD Max Code Local Secs Secs Per Call Size Storage —————————————————————————— op:/obj/geo1/mountain1/attribvop1 0.20 0.20 137,500 10,324,545 75.08 833.33 452 1,024 168 127,184 —————————————————————————— Invocations Instruction 22,000,000 mul 12,375,000 xnoise 12,375,000 br 11,024,750 set 11,013,200 add 11,013,200 select 1,379,950 div 1,375,000 eq 1,375,000 sqrt 1,375,000 _export 1,375,000 merge 1,375,000 swap 13,200 lt 13,200 ne 13,200 gt 13,200 and 9,900 getcomp 1,650 setcomp“`
idk if there’s a way to have it list your own functions in there though – does xnoise only appear because it’s actually a native vex function and not something defined in a header?