I use Attribute Wrangle for add point on primitive centers ,But the problems When I select components point,the center point turn Integer in selection,I want just display face center only for snaping.
Like Ex Maya Display face centers
Is there A Python to create to shelf,To Display global display face center in scene not Usign each Attribute wrangle.
To create a temporary node and then remove it you can use python for creating template node and then bind createCenterPointsNode() and removeHelperNode() function calls to shortcuts.
This is very simple example that selects first selected node (it expects SOP node selection) and creates a templated wrangle node and stores its path in the context (parent) node. Then calling removeHelperNode() with selection in the same context will try to delete the node at the stored path. It remembers only single node for the context.
This is just a very simple example of one way how you can do it. Another way could be viewport states.
importhouTEMP_NODE="temp_wrangle_path"defgetCurrentNode(selected):selected=selectedifselectedelsehou.selectedNodes()ifnotselected:print("Nothing selected!")returnNoneinput=selected[0].inputs()ifnotinput:current=selected[0]else:current=input[0]returncurrentdefcreateCenterPointsNode(selected=None):current=getCurrentNode(selected)ifnotcurrent:returnNoneaw=current.createOutputNode("attribwrangle","__temp_prim_center_snap_helper__")aw.setTemplateFlag(1)# tempalte flag for snappingaw.parm("class").set(1)aw.parm("snippet").set("addpoint(0, v@P);")# create center pointsaw.setComment("helper node for snapping to primitive centers")aw.setGenericFlag(hou.nodeFlag.DisplayComment,1)context=current.parent()# contextcontext.setUserData(TEMP_NODE,aw.path())# store path to the temporary wranglereturnawdefremoveHelperNode(selected=None):current=getCurrentNode(selected)ifnotcurrent:returncontext=current.parent()# contextaw=hou.node(context.userData(TEMP_NODE))aw.destroy()# delete nodecontext.destroyUserData(TEMP_NODE)# usage:createCenterPointsNode()# create helperremoveHelperNode()# remove helper
Already,I have idea How to snap in Houdini,I'm not Talking exactly snap to center,Ex:I want display center faces for A simple move object single Axis To middle face ,There Are snap middle edge in Houdini,For Me Turn snap point Work,And give idea display divide very quickly to move object,For snap middle edge work for something else.