Archived post by paqwak

Hello, so looks like packedbounds = bound of the packed geo before any transformation. So if I use copy to point with a scale/pscale attribute it doesn’t not get reflected on packedbound value :S … How do I extract the scale value (x y z) between the the rest (intrinsic.local.transform ?) and intrisic.packedfulltransform ? I’m so lost with those matrix stuff. I could copy/transfer the exising scale/pscale in my copy to point attrib transfer options, but I would like to have the system working just form the packed geo data.

…. mmm looks like the reply is “cracktransform” Oo

“`matrix3 test = primintrinsic(0,”transform”,@primnum); vector t,r,s;
cracktransform (0, 0, @P, test, t, r, s);
vector bound[] = primintrinsic(0, “packedbounds”, @primnum);
vector bboxMin = bound[0]; vector bboxMax = bound[1];
vector bboxDimensions = bboxMax – bboxMin;
float radius = length(max(bboxDimensions.x, bboxDimensions.y,bboxDimensions.z));
@pscale = radius*0.5*chf(“offset”)*max(s.x,s.y,s.z);“`

Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20233608/12/23/image.png

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 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