Creates a new node in the specified parent.
(self, node_type, parent_path="/obj", name=None, position=None, parameters=None)
| 342 | return {"error": str(e)} |
| 343 | |
| 344 | def create_node(self, node_type, parent_path="/obj", name=None, position=None, parameters=None): |
| 345 | """Creates a new node in the specified parent.""" |
| 346 | try: |
| 347 | parent = hou.node(parent_path) |
| 348 | if not parent: |
| 349 | raise ValueError(f"Parent path not found: {parent_path}") |
| 350 | |
| 351 | node = parent.createNode(node_type, node_name=name) |
| 352 | if position and len(position) >= 2: |
| 353 | node.setPosition([position[0], position[1]]) |
| 354 | if parameters: |
| 355 | for p_name, p_val in parameters.items(): |
| 356 | parm = node.parm(p_name) |
| 357 | if parm: |
| 358 | parm.set(p_val) |
| 359 | |
| 360 | return { |
| 361 | "name": node.name(), |
| 362 | "path": node.path(), |
| 363 | "type": node.type().name(), |
| 364 | "position": list(node.position()), |
| 365 | } |
| 366 | except Exception as e: |
| 367 | raise Exception(f"Failed to create node: {str(e)}") |
| 368 | |
| 369 | def modify_node(self, path, parameters=None, position=None, name=None): |
| 370 | """Modifies an existing node.""" |
nothing calls this directly
no outgoing calls
no test coverage detected