View2D(bpy_struct)

base class — bpy_struct

class bpy.types.View2D(bpy_struct)

Scroll and zoom for a 2D region

region_to_view(x, y)

Transform region coordinates to 2D view

Parameters:
  • x (float) – x, Region x coordinate (in [-inf, inf])

  • y (float) – y, Region y coordinate (in [-inf, inf])

Returns:

Result, View coordinates (array of 2 items, in [-inf, inf])

Return type:

bpy_prop_array[float]

view_to_region(x, y, *, clip=True)

Transform 2D view coordinates to region

Parameters:
  • x (float) – x, 2D View x coordinate (in [-inf, inf])

  • y (float) – y, 2D View y coordinate (in [-inf, inf])

  • clip (bool) – Clip, Clip coordinates to the visible region (optional)

Returns:

Result, Region coordinates (array of 2 items, in [-inf, inf])

Return type:

bpy_prop_array[int]

classmethod bl_rna_get_subclass(id, default=None, /)
Parameters:
  • id (str) – The RNA type identifier.

  • default (bpy.types.Struct | None) – The value to return when not found.

Returns:

The RNA type or default when not found.

Return type:

bpy.types.Struct

classmethod bl_rna_get_subclass_py(id, default=None, /)
Parameters:
  • id (str) – The RNA type identifier.

  • default (type | None) – The value to return when not found.

Returns:

The class or default when not found.

Return type:

type

Inherited Properties

Inherited Functions

References