Geometry unpacked from folder isn't writable? Why?

   701   2   1
User Avatar
Member
213 posts
Joined: 6月 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 - 2023年12月23日 02:29:14
User Avatar
Member
8606 posts
Joined: 7月 2007
Offline
try doing this:
skel = geo.unpackFromFolder("/Base.skel").freeze()
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
7752 posts
Joined: 7月 2005
Online
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