
パラメータ
| パラメータ | 型 | デフォルト値 | 説明 |
|---|---|---|---|
| camera_control_type | 選択 | "simple" | 事前定義されたカメラ運動タイプ。「simple」:カスタマイズ可能なカメラ運動;「down_back」:カメラが下降して後退;「forward_up」:カメラが前方へ移動し上向きに傾斜;「right_turn_forward」:右回転しながら前方へ移動;「left_turn_forward」:左回転しながら前方へ移動 |
| horizontal_movement | 浮動小数点数 | 0 | カメラの水平軸(x軸)方向への移動を制御。負の値は左方向、正の値は右方向を意味します |
| vertical_movement | 浮動小数点数 | 0 | カメラの垂直軸(y軸)方向への移動を制御。負の値は下方向、正の値は上方向を意味します |
| pan | 浮動小数点数 | 0.5 | カメラの垂直平面内(x軸)での回転を制御。負の値は下向き回転、正の値は上向き回転を意味します |
| tilt | 浮動小数点数 | 0 | カメラの水平平面内(y軸)での回転を制御。負の値は左向き回転、正の値は右向き回転を意味します |
| roll | 浮動小数点数 | 0 | カメラのロール量(z軸)を制御。負の値は反時計回り、正の値は時計回りを意味します |
| zoom | 浮動小数点数 | 0 | カメラの焦点距離を制御。負の値は画角を狭め、正の値は画角を広げます |
出力
| 出力 | 型 | 説明 |
|---|---|---|
| camera_control | CAMERA_CONTROL | カメラ設定を含む構成オブジェクト |
ソースコード
[ノードソースコード(2025-05-03 更新)]
class KlingCameraControls(KlingNodeBase):
"""Kling Camera Controls Node"""
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"camera_control_type": (
IO.COMBO,
{
"options": [
camera_control_type.value
for camera_control_type in CameraType
],
"default": "simple",
"tooltip": "Predefined camera movements type. simple: Customizable camera movement. down_back: Camera descends and moves backward. forward_up: Camera moves forward and tilts up. right_turn_forward: Rotate right and move forward. left_turn_forward: Rotate left and move forward.",
},
),
"horizontal_movement": get_camera_control_input_config(
"Controls camera's movement along horizontal axis (x-axis). Negative indicates left, positive indicates right"
),
"vertical_movement": get_camera_control_input_config(
"Controls camera's movement along vertical axis (y-axis). Negative indicates downward, positive indicates upward."
),
"pan": get_camera_control_input_config(
"Controls camera's rotation in vertical plane (x-axis). Negative indicates downward rotation, positive indicates upward rotation.",
default=0.5,
),
"tilt": get_camera_control_input_config(
"Controls camera's rotation in horizontal plane (y-axis). Negative indicates left rotation, positive indicates right rotation.",
),
"roll": get_camera_control_input_config(
"Controls camera's rolling amount (z-axis). Negative indicates counterclockwise, positive indicates clockwise.",
),
"zoom": get_camera_control_input_config(
"Controls change in camera's focal length. Negative indicates narrower field of view, positive indicates wider field of view.",
),
}
}
DESCRIPTION = "Kling Camera Controls Node. Not all model and mode combinations support camera control. Please refer to the Kling API documentation for more information."
RETURN_TYPES = ("CAMERA_CONTROL",)
RETURN_NAMES = ("camera_control",)
FUNCTION = "main"
@classmethod
def VALIDATE_INPUTS(
cls,
horizontal_movement: float,
vertical_movement: float,
pan: float,
tilt: float,
roll: float,
zoom: float,
) -> bool | str:
if not is_valid_camera_control_configs(
[
horizontal_movement,
vertical_movement,
pan,
tilt,
roll,
zoom,
]
):
return "Invalid camera control configs: at least one of the values must be non-zero"
return True
def main(
self,
camera_control_type: str,
horizontal_movement: float,
vertical_movement: float,
pan: float,
tilt: float,
roll: float,
zoom: float,
) -> tuple[CameraControl]:
return (
CameraControl(
type=CameraType(camera_control_type),
config=CameraConfig(
horizontal=horizontal_movement,
vertical=vertical_movement,
pan=pan,
roll=roll,
tilt=tilt,
zoom=zoom,
),
),
)