Geometry unpacked from folder isn't writable? Why?

   1275   2   1
User Avatar
Member
373 posts
Joined: June 2023
Offline
For example, this Python SOP (assuming Base.skel exists):


geo = node.geometry()

skel = geo.unpackFromFolder("/Base.skel")
skel.addAttrib(hou.attribType.Global, "frame_range", (1, 1))
skel.setGlobalAttribValue("frame_range", (1,120))

results in:

hou.GeometryPermissionError: Geometry is read-only.


It's a bit weird tho... geoitself is writable, why isn't the geometry unpacked from it? What's the correct way to handle it? Just create a new hou.Geometry()then copy()?
Edited by kodra - Dec. 23, 2023 02:29:14
User Avatar
Member
9262 posts
Joined: July 2007
Online
try doing this:
skel = geo.unpackFromFolder("/Base.skel").freeze()
Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
8054 posts
Joined: July 2005
Offline
Just to explain, the geometry objects returned by unpackFromFolder() can be a reference to the geometry directly inside the packed primitive for efficiency reasons. So doing "freeze()" gives you a writable copy of the geometry.
  • Quick Links