Houdini 21.0 Pythonスクリプト

Pythonステート ハンドル

独自ステートとハンドルを紐づけて、そのハンドルを使ってユーザ操作に反応させる方法。

On this page

概要

ユーザがノードのViewer Stateでインタラクティブにパラメータを編集できるようにする標準的な方法は、ノードパラメータにハンドルをバインド(紐づけ)させることです。

While it’s possible to interpret lower-level input events, handles remain the primary method for enabling user interaction within a state. They offer a powerful and flexible interface for parameter configurations and are backed by a large library of predefined handle types.

Viewer states make use of handles by binding a node’s parameters to the handle’s parameters. Handle bindings typically occur during the state’s registration via its state template. However, it is also possible to bind and unbind viewer handles dynamically using hou.SceneViewer. Viewer states can manipulate handles at runtime through hou.Handle.

Bindings

Viewer states can bind to viewer handles either programmatically using the hou.ViewerStateTemplate API, or interactively using the Digital Asset Handle Bindings dialog. The hou.ViewerStateTemplate API is described in the following sections.

The Digital Asset dialog allows you to select a handle from a list of available handles that match the state context. Once selected, you can bind the handle parameters to the asset parameters you want to control with the handle.

Note

Binding a Python handle using the Digital Asset Handle Bindings dialog requires that a viewer state be added to your digital asset for the bindings to take effect. If your asset doesn’t already have a state, you can generate a blank default state using the Viewer Handle Code Generator, available from the Digital Asset New… button.

Static handles

A static handle binding supports a straightforward 1:1 mapping between handle parameters and node parameters. This is often sufficient, as handle parameters such as translate, rotate, scale, length, and others typically correspond directly to parameters on your node.

To add a static handle to your state, call hou.ViewerStateTemplate.bindHandleStatic with the handle type name, a unique internal name for the handle (unique among all handles in the tool), and a list of (“node_parm_name”, “handle_parm_name”) tuples that map node parameters to handle parameters.

簡単なテスト用にPython Source Editor内で以下のサンプルを実行することができます:

import hou

class PythonMeasureState():
    def __init__(self, state_name, scene_viewer):
        self.state_name = state_name
        self.scene_viewer = scene_viewer


template = hou.ViewerStateTemplate(
    "pythonmeasure",
    "Python Measure",
    hou.sopNodeTypeCategory()
)
template.bindFactory(PythonMeasureState)

# このステートのアセットに"start"と"end"の2個の移動パラメータがあることを想定します。
template.bindHandleStatic(
    "xform", "start_handle",
    [("startx", "tx"), ("starty", "ty"), ("startz", "tz")]
)
template.bindHandleStatic(
    "xform", "end_handle",
    [("endx", "tx"), ("endy", "ty"), ("endz", "tz")]
)

hou.ui.registerViewerState(template)

動的ハンドル

Dynamic handle bindings let you decide (using a callback) how changes to a handle affect parameters on the node, and how changes to the node’s parameters affect the handle.

To add a dynamic handle to your state, call hou.ViewerStateTemplate.bindHandle with the handle type name and a unique internal name for the handle (each handle name must be unique among all handles in the tool).

NOTE: hou.ViewerStateTemplate.bindHandle takes a cache_previous_parms boolean argument:

  • If you pass cache_previous_parms=True, Houdini keeps track of the handle values and provides both the previous and new values in the handle callback. This is useful for tracking deltas, for example, to determine how fast the user is moving the handle.

  • If you pass False (the default), Houdini does not include the previous values in the handle callback.

簡単なテスト用にPython Source Editor内で以下のサンプルを実行することができます:

import hou

class PythonTwistState():
    def __init__(self, state_name, scene_viewer):
        self.state_name = state_name
        self.scene_viewer = scene_viewer

    def onHandleToState(self, kwargs):
        # ユーザがハンドルを操作した時にコールされます。

        handle_name = kwargs["handle"]
        parms = kwargs["parms"]
        prev_parms = kwargs["prev_parms"]

        print("User edited handle:", handle_name)
        for parm_name in kwargs["mod_parms"]:
            old_value = prev_parms[parm_name]
            new_value = parms[parm_name]
            print("%s was: %s now: %s" % (parm_name, old_value, new_value))

    def onStateToHandle(self, kwargs):
        # 必要に応じて動的ハンドルを更新できるように、
        # ユーザがパラメータ(s)を変更した時にコールされます。

        parms = kwargs["parms"]
        print("Parameters are now:", parms)
        for p in parms:
            print(p)


template = hou.ViewerStateTemplate(
    "pythontwist",
    "Python Twist",
    hou.sopNodeTypeCategory()
)
template.bindFactory(PythonTwistState)
template.bindHandle("xform", "twist_handle", cache_previous_parms=True)

hou.ui.registerViewerState(template)

動的ハンドルイベントのメソッドに渡される辞書には、以下の標準アイテムが含まれています:

node

現行ステートで作用しているノードを表現したhou.OpNodeインスタンスを含んでいます。

state_parms

現行ステートにバインドされたステートパラメータを表現した名前を含んでいます。 この辞書は、パラメータステートを変更する際に使用します。 詳細は、ここを参照してください。

state_flags

ステートに関連した色々なフラグを含んだ辞書。 ステートフラグは、kwargs引数を介して、すべてのステートハンドラーで設定することができます。

フラグ

メモ

mouse_drag

(による)マウスドラッグイベントを生成するかどうかを制御します。 デフォルトでは、マウスドラッグイベントを生成します(True)。

mouse_dragFalseの時、マウスドラッグイベントを生成しません。セレクターがアクティブな場合、選択可能なエレメントはハイライトされません。

あなたのステートではマウスドラッグイベントが不要な場合は、mouse_dragFalseに設定して、オーバーヘッドを回避すると良いでしょう。

class MyState(object):
    def __init__(self, state_name, scene_viewer):
        self.state_name = state_name
        self.scene_viewer = scene_viewer

    def onEnter( self, kwargs):
        kwargs['state_flags']['mouse_drag'] = False
        ...                

redraw

このフラグは、Trueに設定すると、マウス移動またはマウスホイールのイベントが発生した時に、ビューポートの再描画をトリガーします。

デフォルトでは、ビューポートは常に再描画します。大規模シーンのパフォーマンス問題を軽減したいのであれば、あなたのステートがでビューポートの再描画が不要な時にはredrawFalseに設定してください。

class MyState(object):
    def __init__(self, state_name, scene_viewer):
        self.state_name = state_name
        self.scene_viewer = scene_viewer

    def onMouseEvent( self, kwargs):
        kwargs['state_flags']['redraw'] = False
        if __some_redraw_test__:
            kwargs['state_flags']['redraw'] = True
        ...                

indirect_handle_drag

このフラグは、True(デフォルト)に設定すると、ビューポート内で(を押したままにすることで)間接ハンドルドラッグが有効になります。 このフラグがFalseに設定されていれば、間接ハンドルドラッグが無効になります。 これによって、ステートはイベントを処理することができます。

Note

The state can also handle events if the following conditions are met:

  • Indirect mouse dragging is allowed in the viewport.

  • The current state allows indirect handle drags.

  • All active handles do not support indirect mouse handling.

class MyState(object):
    def __init__(self, state_name, scene_viewer):
        self.state_name = state_name
        self.scene_viewer = scene_viewer

    def onEnter( self, kwargs):
        # 間接ハンドルドラッグを無効にします。
        # ビューポート内でのMMBドラッグによってハンドルパラメータが修正できなくなります。
        kwargs['state_flags']['indirect_handle_drag'] = False
        ...

exit_on_node_select

このフラグは、別のノードが選択された時に、ステートを抜けるのか、それともアクティブのままにするのか決めます。 True(デフォルトの挙動)に設定すると、別のノードが選択されるとステートが抜けます。 Falseに設定すると、別のノードが選択されてもステートはアクティブのままになります。 exit_on_node_selectフラグは、ノードなしステートとノードありステートのどちらでも使用することができます。

class MyState(object):
    def __init__(self, state_name, scene_viewer):
        self.state_name = state_name
        self.scene_viewer = scene_viewer

    def onGenerate( self, kwargs):
        # ノード選択が行なわれても、このノードなしステートがアクティブのままになるように設定します。
        kwargs['state_flags']['exit_on_node_select'] = False
        ...                

interrupt_state

Volatileステートが有効な時または空っぽの文字列の時にPythonステートを中断するステートの名前。

onHandleToState

これは、ハンドルを変更した時にノードパラメータ(またはステート/表示)を更新することができます。

このメソッドに渡される辞書には、以下の追加アイテムが含まれています:

handle

ハンドルの文字列ID。

parms

新しいハンドルパラメータ値を含んだ辞書。

mod_parms

変更されたパラメータの名前のリスト。

prev_parms

このキーは、hou.ViewerStateTemplate.bindHandleメソッドにcache_previous_parms=Trueを渡した場合に のみ存在します

これは、前のハンドルのパラメータ値を含んだ辞書です。 これは、差分計算に役立ちます。

ui_event

ハンドル状態にアクセスするためのhou.UIEventオブジェクト。 例えば、hou.UIEvent.reasonが返したhou.uiEventReason値を使用することで、ユーザがハンドルのドラッグを開始または終了したかどうかを調べることができます。

以下のhou.uiEventReason値は、onHandleToStateに対して色々な意味があります:

  • uiEventReason.Active: ユーザがハンドルをドラッグ中です。

  • uiEventReason.Changed: ユーザがハンドルのドラッグを終了しました。この時点で、prev_parmsには直近のハンドル値が入っているはずです。

  • uiEventReason.Start: ユーザがハンドルのドラッグを開始しました。

  • uiEventReason.Picked: ハンドルメニュー操作、ホットキー、マウスクリック。例えば、Picked値はHUDスライダをクリックした時に生成されます。

onStateToHandle

このメソッドは、 ノードのパラメータを変更する度に ステートにバインドされた 動的ハンドル毎に 別々にコールされます。 これは、変更されたノードパラメータに合うようにハンドルパラメータを更新することができます。

このメソッドに渡される辞書には、以下の追加アイテムが含まれています:

handle

ハンドルの名前。

parms

ハンドルのパラメータ名と値をマッピングした辞書。 この辞書の値を変更することで、そのハンドルパラメータを編集することができます

このメソッドでは、ノードのパラメータからパラメータを読み込んで、kwargs["parms"]内の必要なハンドルのパラメータを動的に更新します:

def onStateToHandle(self, kwargs):
    node = kwargs["node"]
    handle_parms = kwargs["parms"]
    if kwargs["handle"] == "my_angle":
        node_tx = node.parm("tx").evalAsFloat()
        handle_parms["tx"] = node_tx * 2

特別な通知

Houdiniには、ユーザが動的ハンドルの制御を開始または終了した時にステートに通知するための特別なコールバックが備わっています。

onBeginHandleToStateは、onHandleToStateコールバックの直前にコールされます。 例えば、onBeginHandleToStateを使用することで、ユーザがハンドルを制御している間に Undoブロックを開いて、Undo可能オペレーションを実行することができます。

onEndHandleToStateは、onHandleToStateコールバックの直後にコールされます。 onEndHandleToStateを使用することで、onBeginHandleToStateで開いたUndoブロックを閉じることができます。

ハンドルタイプ

名前

説明

パラメータ

angle

位置と回転のハンドル

input, onoff, px, py, pz, rx, ry, rz, scale, trs_order, tx, ty, tz, xyz_order

bboxvector

Bounding Box Vector

input, onoff, scale, twist, tx, ty, tz, vx, vy, vz

boundingbox

Bounding Box

centerx, centery, centerz, constant_scale, onoff, rx, ry, rz, sizex, sizey, sizez, uniform_scale

boundingrect

Bounding Rectangle

centerx, centery, centerz, constant_scale, onoff, orient, rx, ry, rz, sizex, sizey, sizez, uniform_scale

boundboundingbox

Bounder Bounding Box

bound_type, centerx, centery, centerz, constant_scale, onoff, orient, rx, ry, rz, sizex, sizey, sizez, uniform_scale

circle

Circle Transform

onoff, orient, rx, ry, rz, sx, sy, tx, ty, tz

clayxlate

Clay Translate

input, onoff, tx, ty, tz, u, v

curvepoint

Curve Point Options

keepingeo, pointlist

distance

Distance

dist, input, onoff, px, py, pz, vx, vy, vz

domain

Domain

input, onoff, u0, u1, v0, v1

edit

Edit

brushswitcher, dist, handle_group_pivot, input, inputtype, localspace, onoff, pivot_comp_rx, pivot_comp_ry, pivot_comp_rz, pivot_comp_shear_xy, pivot_comp_shear_xz, pivot_comp_shear_yz, pivot_comp_sx, pivot_comp_sy, pivot_comp_sz, pivot_comp_trs_order, pivot_comp_tx, pivot_comp_ty, pivot_comp_tz, pivot_comp_xyz_order, pivot_rx, pivot_ry, pivot_rz, px, py, pz, rx, ry, rz, shear_xy, shear_xz, shear_yz, switcher, sx, sy, sz, trs_order, tx, ty, tz, upx, upy, upz, xyz_order

extrude

Extrude

roup_pivot, grst_order, grx, gry, grz, gshear_xy, gshear_xz, gshear_yz, gsx, gsy, gsz, gtx, gty, gtz, gxyz_order, input, onoff, pivot_comp_in_obj_prexform, pivot_comp_rx, pivot_comp_ry, pivot_comp_rz, pivot_comp_shear_xy, pivot_comp_shear_xz, pivot_comp_shear_yz, pivot_comp_sx, pivot_comp_sy, pivot_comp_sz, pivot_comp_trs_order, pivot_comp_tx, pivot_comp_ty, pivot_comp_tz, pivot_comp_xyz_order, pivot_rx, pivot_ry, pivot_rz, px, py, pz, roffsetx, roffsety, roffsetz, rpivotx, rpivoty, rpivotz, rpostx, rposty, rpostz, rprex, rprey, rprez, rx, ry, rz, shear_xy, shear_xz, shear_yz, soffsetx, soffsety, soffsetz, spivotx, spivoty, spivotz, sx, sy, sz, trs_order, tx, ty, tz, uniform_scale, xyz_order

extrude2

Extrude v2

input, onoff, pivot_comp_in_obj_prexform, pivot_comp_rx, pivot_comp_ry, pivot_comp_rz, pivot_comp_shear_xy, pivot_comp_shear_xz, pivot_comp_shear_yz, pivot_comp_sx, pivot_comp_sy, pivot_comp_sz, pivot_comp_trs_order, pivot_comp_tx, pivot_comp_ty, pivot_comp_tz, pivot_comp_xyz_order, pivot_rx, pivot_ry, pivot_rz, px, py, pz, roffsetx, roffsety, roffsetz, rpivotx, rpivoty, rpivotz, rpostx, rposty, rpostz, rprex, rprey, rprez, rx, ry, rz, shear_xy, shear_xz, shear_yz, soffsetx, soffsety, soffsetz, spivotx, spivoty, spivotz, sx, sy, sz, trs_order, tx, ty, tz, uniform_scale, xform_front, xyz_order

fallbackvector

Vector with Fallback

onoff, scale, useval, vx, vy, vz

hudintslider

HUD Int Slider

value, onoff

設定

hudslider

HUD Slider

value, onoff

設定

isosegment0

Isoparm Segment

input , knotu, knotv, onoff, scale, useu, width

isosegment1

Isoparm Segment

input, onoff, knotu, knotv, scale, useu, width

mousewheelbump

Mouse Wheel Bump

onoff, value

mousewheelradius

Mouse Wheel Radius

radius

pasterange

Paste Range

input1, input2, onoff, u0, u1, v0, v1

peak

Peak

dist, input, onoff, radius, px, py, pz, vx, vy, vz

pill

Pill

botheight, botrx, botry, botrz, cbotheight, cbotrx, cbotry, cbotrz, colorb, colorg, colorr, corient, crx, cry, crz, csx, csy, csz, ctopheight, ctoprx, ctopry, ctoprz, ctx, cty, ctz, czfactor, orient, onoff, rigadjrx, rigadjry, rigadjrz, rigadjsx, rigadjsy, rigadjsz, rigadjtx, rigadjty, rigadjtz, rigadjzfactor, rx, ry, rz, topheight, toprx, topry, toprz, tx, ty, tz, x, y, z, zfactor

pivot

Pivot

input, onoff, tx, ty, tz

project

Project

axis, input, onoff, scale, twist, vx, vy, vz

sidefx_tangentpivot

Tangent Pivot

tx, ty, tt1x, tt1y, tt2x, tt2y

sidefx_transform2d

Transform2d

tx, ty, rz, sx, sy, scale

softxform

Soft Transformer

input, localspace, onoff, pivot_comp_in_obj_prexform, pivot_comp_rx, pivot_comp_ry, pivot_comp_rz, pivot_comp_shear_xy, pivot_comp_shear_xz, pivot_comp_shear_yz, pivot_comp_sx, pivot_comp_sy, pivot_comp_sz, pivot_comp_trs_order, pivot_comp_tx, pivot_comp_ty, pivot_comp_tz, pivot_comp_xyz_order, pivot_rx, pivot_ry, pivot_rz, px, py, pz, roffsetx, roffsety, roffsetz, rpivotx, rpivoty, rpivotz, rpostx, rposty, rpostz, rprex, rprey, rprez, rx, ry, rz, shear_xy, shear_xz, shear_yz, soffsetx, soffsety, soffsetz, spivotx, spivoty, spivotz, sx, sy, sz, trs_order, tx, ty, tz, uniform_scale, upx, upy, upz, xyz_order

sphere

Sphere Transformer

onoff, orient, rx, ry, rz, sx, sy, sz, tx, ty, tz

translate

Translate

input, onoff, tx, ty, tz

torus

Torus Transformer

onoff, orient, rx, ry, rz, sx, sy, tx, ty, tz

tube

Tube Transformer

onoff, orient, rx, ry, rz, sx, sy, sz, tx, ty, tz

uisoparm

U Isoparm

input, k, onoff

uvedit

UV Edit Manipulator

input, onoff, px, py, rz, shear_xy, sx, sy, trs_order, tx, ty, xyz_order

uvedit_reversez

Texture Transformer

input, onoff, rz, sx, sy, tx, ty

uvpoint

UV Point

input, onoff, px, py, pz, rx, ry, rz, sx, sy, sz, u, v

uvproject

UV Project Manipulator

onoff, projtype, px, py, pz, rx, ry, rz, sx, sy, sz, torrad, trs_order, tx, ty, tz, xyz_order

uvrange

UV Range Manipulator

onoff, projtype, px, py, pz, rx, ry, rz, sx, sy, sz, torrad, trs_order, tx, ty, tz, u0, u1, v0, v1, xyz_order

uvxform

UV Transform Manipulator

group_pivot, input, onoff, px, py, rz, shear_xy, sx, sy, trs_order, tx, ty, xyz_order

uvunwrap

UV Unwrap Manipulator

input, onoff, projplanes, px, py, pz, ref_input, rx, ry, rz, trs_order, tx, ty, tz, xyz_order

vector

Vector

input, onoff, scale, twist, tx, ty, tz, vx, vy, vz

visoparm

V Isoparm

input, k, onoff

xform

Transformer

input, onoff, pivot_comp_in_obj_prexform, pivot_comp_rx, pivot_comp_ry, pivot_comp_rz, pivot_comp_shear_xy, pivot_comp_shear_xz, pivot_comp_shear_yz, pivot_comp_sx, pivot_comp_sy, pivot_comp_sz, pivot_comp_trs_order, pivot_comp_tx, pivot_comp_ty, pivot_comp_tz, pivot_comp_xyz_order, pivot_rx, pivot_ry, pivot_rz, px, py, pz, roffsetx, roffsety, roffsetz, rpivotx, rpivoty, rpivotz, rpostx, rposty, rpostz, rprex, rprey, rprez, rx, ry, rz, shear_xy, shear_xz, shear_yz, soffsetx, soffsety, soffsetz, spivotx, spivoty, spivotz, sx, sy, sz, trs_order, tx, ty, tz, uniform_scale, xyz_order

ハンドル設定

ハンドル設定は、ハンドルの挙動を変更するためのアトリビュートになっています。

関連項目:

HUD整数スライダの設定

hudharbourname('name') スライダをグループに割り当てます。同じグループのスライダ同士がドッキングされます。

hudharbourx(int) スライダグループのX位置。

hudharboury(int) スライダグループのY位置。

hudnameside(int) ラベル位置: 上(1), 左(2), 右(3), 下(4)

hudrangehigh(int) スライダ範囲の上限値。

hudrangelow(int) スライダ範囲の下限値。

hudlockhigh(int) 1に設定すると、スライダの上限がhudrangehighに設定され、スライダはその値より上に移動できません。

hudlocklow(int) 1に設定すると、スライダの下限がhudrangelowに設定され、スライダはその値より下に移動できません。

hudvalueside(int) 位置の値: 上(1), 左(2), 右(3), 下(4)

hudx(int) ビューアペイントのX位置。

hudy(int) ビューアペインのY位置。

hudw(int)

hudh: 高さ

HUDスライダ設定

hudh: 高さ

hudharbourname('name') スライダをグループに割り当てます。同じグループのスライダ同士がドッキングされます。

hudharbourx(int) スライダグループのX位置。

hudharboury(int) スライダグループのY位置。

hudnameside(int) ラベル位置: 上(1), 左(2), 右(3), 下(4)

hudrangehigh(float) スライダ範囲の上限値。

hudrangelow(float) スライダ範囲の下限値。

hudlockhigh(int) 1に設定すると、スライダの上限がhudrangehighに設定され、スライダはその値より上に移動できません。

hudlocklow(int) 1に設定すると、スライダの下限がhudrangelowに設定され、スライダはその値より下に移動できません。

hudvalueside(int) 位置の値: 上(1), 左(2), 右(3), 下(4)

hudx(int) ビューアペイントのX位置。

hudy(int) ビューアペイントのY位置。

hudw(int)

hudh(int) 高さ

sidefx_transform2d settings

The sidefx_transform2d handle provides control over bound parameters for translation, rotation, and scaling. This section lists the available settings for the handle. These settings allow for customization of the handle’s behavior, including its pivot coordinates.

The handle pivot settings (handlepivotx, handlepivoty, handlepivotrz) store the coordinates and rotation of the handle’s pivot point. These settings are useful for tracking the pivot’s position, for example, to update the placement of drawables that are dependent on the handle’s pivot.

sidefx_transform2d supports a detachable mode. When enabled, the handle pivot can be manipulated independently, without updating the bound parameters. By default, the handle detachable mode is OFF and follows the values of its bound parameters. Once the handle has been detached and the pivot modified, it no longer responds to changes in the bound parameters.

Setting

Description

Values

handledetachable(int)

Enable or disable the handle’s detached mode capability

0: The handle is not detachable (default).

1: The handle is detachable.

handlemode(int)

Set the handle mode

0: Rotate

1: Translate (default)

2: Scale

handlepivotx(float)

Stores the X-coordinate of the handle’s pivot point.

Value is typically overridden by the bound parameter upon handle creation.

handlepivoty(float)

Stores the Y-coordinate of the handle’s pivot point.

Value is typically overridden by the bound parameter upon handle creation.

handlepivotrz(float)

Stores the Z-axis rotation (in degrees) of the handle’s pivot point.

Value is typically overridden by the bound parameter upon handle creation.

rotateringstyle(int)

Controls the rotate ring style

0: 4 arcs (default)

1: the first quadrant’s arc

rotatestep(int)

Specifies the rotation step angle (in degrees). The parameter corresponds to an index to a predefined list of step sizes

1, 2, 3, 4, 5, 5.625, 10, 11.25, 12, 15, 20, 22.5, 30, 45, 60, 90

scalestep(float)

Specifies the step size for the scale parameters

Default to 0.1

translateaxes(int)

Toggles visibility of the translate axes

0: Disables both axes

1: Enables both axes (default)

translatepivotcolor(int)

Controls the translate pivot color

0: White

1: Pivot color

2: Point color

translatepivotstyle(int)

Controls the translate pivot style

0: Cross

1: Diamond

2: Dot

3: HollowDiamond

4: HollowDot

5: HollowSquare

6: Square

7: SquareCross

8: XShape

translatestep(float)

Specifies the step size for the translate parameters

Default to 0.1

xform設定

translate(int) xform移動モードを有効(1)または無効(0)。

scale(int) xformスケールモードを有効(1)または無効(0)。

rotate(int) xform回転モードを有効(1)または無効(0)。

snap_to_selection(int) 1に設定すると、ジオメトリコンポーネントへのスナップが有効になります。詳細はここを参照してください。

境界ボックス設定

translate(int) boundingbox移動モードを有効(1)または無効(0)。

rotate(int) boundingbox回転モードを有効(1)または無効(0)。

snap_to_selection(int) 1に設定すると、選択したジオメトリコンポーネントへのスナップが有効になります。詳細はここを参照してください。

ハンドルのスナップ

ほとんどのハンドル(例えば、xform, pivot, distance, boundingboxなど)では、選択したコンポーネントへのスナップを回避したいです。 これらのハンドルは選択したジオメトリを動かすことを想定しているので、そのハンドルを同じジオメトリにスナップさせると、良くないフィードバックループが起きます。 たいていの場合、ここで問題になる選択は、ノードが生成したクック選択です。

Houdiniは、選択が存在した時にジオメトリコンポーネントが選択されているのか選択されていないのかの区別しかできません。 選択が存在しなければ、Houdiniはそのハンドルにバインドされているノードが生成したジオメトリ全体が選択されていると見なし、ハンドルがそのジオメトリにスナップするのを回避します。 snap_to_selection設定を使用することで、選択されたコンポーネントにハンドルをスナップさせるかどうか制御することができ、 通常のAPIを使ってその設定をハンドルに適用することができます:

Pythonスクリプト

はじめよう

次のステップ

リファレンス

  • hou

    Houdiniにアクセスできるサブモジュール、クラス、ファンクションを含んだモジュール。

導師レベル

Python Viewerステート

Pythonビューアハンドル

プラグインタイプ