mrice Posted October 18, 2010 Share Posted October 18, 2010 Is it possible to create a temporary hou.Geometry object in a sop? Seems like the freeze() method should work, but it looks broken to me: myGeo = hou.pwd().geometry() tempGeo = myGeo.freeze() inside a sop, and the sop's geometry still seems to be linked to tempGeo. I tried creating a temporary node to work with, but I get a permission error if I attempt to modify its geometry, even if its frozen. The hou.Geometry.__init__() method is disabled, and copy.deepcopy() doesn't work. Quote Link to comment Share on other sites More sharing options...
graham Posted October 19, 2010 Share Posted October 19, 2010 (edited) Unfortunately it's not possible to create temp geo objects with HOM. hou.Geometry.freeze() is more of a way to prevent the geometry from being modified, as opposed to creating a copy. I think it basically returns a const pointer to the original geo so you can't touch, but of course any changes to the main gdp are visible through that. One kind of neat thing you can do with it though is store a list of frozen objects somewhere to give you access to geometry from different frames. Each frame a SOP creates a new GU_Detail and freezing that will keep around the reference to that so you can access it later. You can't really do much else I'm afraid since there is no way to construct an empty hou.Geometry object. Trying to access geometry from any SOP node, outside of the cook code for that node will result in you getting an unmodifiable frozen hou.Geometry. You can merge in other hou.Geometry objects into your geometry inside of the Cook code but that's about it. Ideally HOM would have methods to create empty Geometry objects, make unassociated copies of geometry, create copies from specific groups/points/prims, etc. but alas it doesn't. I've got some RFEs in for them so it's all about the waiting game. Edited October 19, 2010 by graham Quote Link to comment Share on other sites More sharing options...
mrice Posted October 19, 2010 Author Share Posted October 19, 2010 Thanks Graham for the clarification. I swear hou.Geometry.freeze() used to return a deep copy This is a big omission from the HOM, hope your RFE's come true! I would at least expect hou.Geometry.freeze() to return a pointer-to-const though.. constGeo = hou.pwd().geometry().freeze() constGeo.clear() ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.