Python and permissions.

   7865   7   0
User Avatar
Member
20 posts
Joined: 7月 2008
Offline
When I try to change the positions of the points of a cube, I bump into a GeometryPermissionError. It seems all geometry nodes have their geometry in a read-only state. Methods to change the permissions (removePermission/setPermission) are not implemented yet. As such the Python scripting model seems not usable at all.
This combined with the many not-yet-implemented functions and the early state of the documentation makes Python difficult and cumbersome to use.
Also are their any functions for creating geometry (vertices, edges, faces) from scratch or adding to existing geometry. I believe not. Coming from Blender that supports even OpenGL in-viewport through Python this is a big step back in terms of functionality.
Pity.
User Avatar
Member
58 posts
Joined: 9月 2007
Offline
euh, this might be a stupid question but, are you trying to modify the points of a node other than than the node that is connected to your python node?

Reading you are coming from blender, this makes me think your trying to write a shelf script that modifies the points of a node?

If one of the 2 above is the case then you must understand that you can't just edit the Geometry of a node.
Only when the node is cooking will the node switch from read to write.

If you create a new python Operator“Sop Node” then in the script you can say hou.pwd() witch means “give me the node that i am executing from”.

This will mean that your python script will execute the moment your node is being cooked and so the points of that node will be in “write” mode and so you can edit the input.
User Avatar
Member
20 posts
Joined: 7月 2008
Offline
I suppose your answer holds the key to solving this problem. I don't get it to work yet though. I set current node to my box node:

hou.cd(“/obj/geo1/box1”)

Then try to modify it:

hou.pwd().geometry … .setPosition((0,0,0))

And still get a GeometryPermissionError: read-only.


Is there any other method for setting pwd() that does work ?
User Avatar
Member
7899 posts
Joined: 7月 2005
Offline
There's nothing wrong with setting pwd. The problem is as Tamis describes. One can only modify geometry when cooking inside a SOP node.
User Avatar
Member
20 posts
Joined: 7月 2008
Offline
Ah, I see.
And there is no way of programming modifications so that they happen only at cooking time ?
Maybe by using hou.Node.cook ?

I mean, can I modify the point positions of my box or , sadly, not ?


With “cooking inside a SOP Node” you mean my box node that I want to modify, or do you mean I need a separate SOP Node? I am a bit confused…
User Avatar
Member
58 posts
Joined: 9月 2007
Offline
Yes you are looking at Houdini as if it is a linear modeling package, it is not.

The idea is that every time you put down a new node and connect for example node A to node B, the geometry will be copied from A to B and then that node performs a operation on that geometry and shows you the result.

so,… when you want to edit the cube you need to use a node that comes with Houdini or you need to make your own using python, vex or using the HDK(C++).

Sadly i can't tell you exactly what to do because i broken Houdini and i need to reinstall it.

But i think this is approximately what you should do:

go: File->Create New Operator Type
choose python.
Give your node(Operator) a name.
Go to the node view and press tap.
type the name of your node.
press your right mouse button.
got to the last item in the menu list.
go to the Code section.

Here you can write your own python script.

the first line is something like: geo = hou.pwd().geometry

you can then do something like:

for p in geo.points():
pos =
p.position(pos)

something like that would move your points to that position.
User Avatar
Member
20 posts
Joined: 7月 2008
Offline
Thanks so much for the clear and helpful replies!

One last question: can I create geometry from scratch in python by hooking up points and primitives ?
User Avatar
Member
58 posts
Joined: 9月 2007
Offline
Wel look at help files under HOM (houdini object model).

I think the geometry class has a createPoint() function and i think there is a createFace function but i never used that.
  • Quick Links