참고 사이트: http://odforce.net/wiki/doku.php?id=viewers


간단한 예)

- 뷰창에서 임의의 포인트를 클릭하고 엔터를 누르면, 그 포인트의 정보가 반환된다.

import toolutils


def parent(obj_node, new_parent):

    xform = obj_node.worldTransform()

    obj_node.setFirstInput(new_parent)

    obj_node.setWorldTransform(xform)


def aa():

    viewer = toolutils.sceneViewer()

    node_to_reparent = viewer.selectObjects(quick_select=True)[-1]

    new_parent = viewer.selectObjects(use_existing_selection=False, quick_select=True,

    prompt="select new parent node")[-1]

    parent(node_to_reparent, new_parent)


def tmp():

    viewer = toolutils.sceneViewer()

    selection = viewer.selectGeometry("select some point and enter",

        geometry_types=(hou.geometryType.Points,), use_existing_selection=False)

    

    print selection, type(selection)                                                                                     # class instance

    print selection.mergedSelectionString(), type(selection.mergedSelectionString()) # ptnum

    print selection.nodes()                                                                     # select point has Node instance 


'Houdini > Python' 카테고리의 다른 글

[REGEX] Greedy vs Non-Greedy  (0) 2016.10.09
[PySide] Python panel Test UI  (0) 2016.01.25
rot, trans, scale  (0) 2013.05.25
hou Module Functions  (0) 2013.04.01
Python으로 만든 뷰창 옵션 지우기  (0) 2013.02.23
Posted by scii
: