Skip to content

Commit

Permalink
chore: include saturday06/starry-bpy-type-stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
saturday06 committed Jun 19, 2024
1 parent 543b1e0 commit d7350f2
Show file tree
Hide file tree
Showing 40 changed files with 3,399 additions and 18 deletions.
19 changes: 2 additions & 17 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ dulwich = "*"
mypy = "*"
pyright = "*"
ruff = "*"
starry-bpy-type-stubs = { git = "https://github.com/saturday06/starry-bpy-type-stubs.git" }
tqdm = "*"
types-tqdm = "*"

Expand Down
28 changes: 28 additions & 0 deletions typings/bgl/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
GL_BACK: int
GL_BLEND: int
GL_CLAMP_TO_EDGE: int
GL_COLOR_BUFFER_BIT: int
GL_CULL_FACE: int
GL_DEPTH_BUFFER_BIT: int
GL_DEPTH_TEST: int
GL_ONE: int
GL_ONE_MINUS_SRC_ALPHA: int
GL_SRC_ALPHA: int
GL_TEXTURE0: int
GL_TEXTURE1: int
GL_TEXTURE_2D: int
GL_TEXTURE_WRAP_S: int
GL_TEXTURE_WRAP_T: int
GL_TRUE: int
GL_ZERO: int

def glClearColor(red: float, green: float, blue: float, alpha: float) -> None: ...
def glClear(mask: int) -> None: ...
def glEnable(cap: int) -> None: ...
def glDisable(cap: int) -> None: ...
def glBlendFunc(sfactor: int, dfactor: int) -> None: ...
def glDepthMask(flag: int) -> None: ...
def glCullFace(mode: int) -> None: ...
def glActiveTexture(texture: int) -> None: ...
def glBindTexture(target: int, texture: int) -> None: ...
def glTexParameteri(target: int, pname: int, param: int) -> None: ...
4 changes: 4 additions & 0 deletions typings/bmesh/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import ops as ops
from . import types as types

def new(use_operators: bool = True) -> types.BMesh: ...
8 changes: 8 additions & 0 deletions typings/bmesh/ops/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from bmesh.types import BMesh, BMFaceSeq

def recalc_face_normals(
bm: BMesh,
/,
*,
faces: BMFaceSeq = ...,
) -> set[str]: ...
110 changes: 110 additions & 0 deletions typings/bmesh/types/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
from collections.abc import Iterator, Sequence
from typing import Generic, Optional, TypeVar

from bpy.types import Mesh
from mathutils import Vector

__BMElemSeqElement = TypeVar("__BMElemSeqElement")

class BMElemSeq(Generic[__BMElemSeqElement]):
def __len__(self) -> int: ...
def __getitem__(self, key: int) -> __BMElemSeqElement: ...
def __iter__(self) -> Iterator[__BMElemSeqElement]: ...

class BMLoopUV:
uv: Vector

class BMVert:
index: int
co: Vector

def __getitem__(
self,
value: BMLoopUV,
) -> Vector: ... # ドキュメントには存在しない

class BMLayerItem:
def copy_from(self, other: BMLayerItem) -> None: ...
@property
def name(self) -> str: ...

class BMLayerCollection:
def __getitem__(self, key: str) -> BMLoopUV: ... # ドキュメントに記載はない?
def keys(self) -> Iterator[str]: ...
def values(self) -> Iterator[BMLayerItem]: ...
def items(self) -> Iterator[tuple[str, BMLayerItem]]: ...

class BMLayerAccessLoop:
uv: BMLayerCollection

class BMLayerAccessVert:
shape: BMLayerCollection

class BMVertSeq:
def new(
self,
co: Sequence[float] = (0.0, 0.0, 0.0),
example: Optional[BMVert] = None,
) -> BMVert: ...
@property
def layers(self) -> BMLayerAccessVert: ...

class BMEdge: ...

class BMEdgeSeq:
def new(
self,
verts: tuple[
BMVert,
BMVert,
], # 実際にはSequenceだと思うが、2要素チェックをしたいのでtuple
example: Optional[BMEdge] = None,
) -> BMEdge: ...

class BMLoop:
index: int
@property
def face(self) -> BMFace: ...
@property
def vert(self) -> BMVert: ...
def __getitem__(
self,
uv: BMLoopUV,
) -> BMLoopUV: ... # TODO: ドキュメントに存在しない

class BMLoopSeq:
@property
def layers(self) -> BMLayerAccessLoop: ...

class BMFace:
material_index: int
@property
def loops(self) -> BMElemSeq[BMLoop]: ...

class BMFaceSeq:
def new(
self,
verts: Sequence[BMVert],
example: Optional[BMFace] = None,
) -> BMFace: ...
def __iter__(self) -> Iterator[BMFace]: ...

class BMesh:
@property
def faces(self) -> BMFaceSeq: ...
@property
def edges(self) -> BMEdgeSeq: ...
@property
def verts(self) -> BMVertSeq: ...
@property
def loops(self) -> BMLoopSeq: ...
def free(self) -> None: ...
def to_mesh(self, mesh: Mesh) -> None: ...
def from_mesh(
self,
mesh: Mesh,
face_normals: bool = True,
use_shape_key: bool = False,
shape_key_index: int = 0,
) -> None: ...
def calc_loop_triangles(self) -> list[tuple[BMLoop, ...]]: ... # TODO: 正しい型
9 changes: 9 additions & 0 deletions typings/bpy/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from . import app as app
from . import msgbus as msgbus
from . import ops as ops
from . import props as props
from . import types as types
from . import utils as utils

context: types.Context
data: types.BlendData
27 changes: 27 additions & 0 deletions typings/bpy/app/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from . import handlers as handlers
from . import timers as timers
from . import translations as translations

debug: bool
debug_depsgraph: bool
debug_depsgraph_build: bool
debug_depsgraph_eval: bool
debug_depsgraph_pretty: bool
debug_depsgraph_tag: bool
debug_depsgraph_time: bool
debug_events: bool
debug_ffmpeg: bool
debug_freestyle: bool
debug_handlers: bool
debug_io: bool
debug_python: bool
debug_simdata: bool
debug_value: bool
debug_wm: bool
tempdir: str
use_event_simulate: bool
build_platform: bytes
build_type: bytes
version_cycle: str
version: tuple[int, int, int]
binary_path: str
13 changes: 13 additions & 0 deletions typings/bpy/app/handlers/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from collections.abc import MutableSequence
from typing import Callable

def persistent(function: Callable[[object], None]) -> Callable[[object], None]: ...

# TODO: 引数の型を調べる
depsgraph_update_pre: MutableSequence[Callable[[object], None]]
depsgraph_update_post: MutableSequence[Callable[[object], None]]

save_pre: MutableSequence[Callable[[object], None]]
frame_change_pre: MutableSequence[Callable[[object], None]]
frame_change_post: MutableSequence[Callable[[object], None]]
load_post: MutableSequence[Callable[[object], None]]
8 changes: 8 additions & 0 deletions typings/bpy/app/timers/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from typing import Callable, Optional

def register(
function: Callable[[], Optional[float]],
first_interval: float = 0,
persistent: bool = False,
) -> None: ...
def is_registered(function: Callable[[], Optional[float]]) -> bool: ...
10 changes: 10 additions & 0 deletions typings/bpy/app/translations/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from typing import Optional

locale: str

def pgettext(msgid: str, msgctxt: Optional[str] = None) -> str: ...
def unregister(module_name: str) -> None: ...
def register(
module_name: str,
dictionary: dict[str, dict[tuple[str, str], str]],
) -> None: ...
1 change: 1 addition & 0 deletions typings/bpy/context/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import preferences as preferences
1 change: 1 addition & 0 deletions typings/bpy/context/preferences/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import view as view
1 change: 1 addition & 0 deletions typings/bpy/context/preferences/view/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use_translate_interface: bool
10 changes: 10 additions & 0 deletions typings/bpy/msgbus/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# TODO: 正しい型
def subscribe_rna(
key: object,
owner: object,
args: object,
notify: object,
options: set[str] = ...,
) -> None: ...
def publish_rna(key: object) -> None: ...
def clear_by_owner(owner: object) -> None: ...
10 changes: 10 additions & 0 deletions typings/bpy/ops/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from . import export_scene as export_scene
from . import icyp as icyp
from . import import_scene as import_scene
from . import mesh as mesh
from . import object as object
from . import outliner as outliner
from . import preferences as preferences
from . import uv as uv
from . import vrm as vrm
from . import wm as wm
95 changes: 95 additions & 0 deletions typings/bpy/ops/export_scene/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
def vrm(
execution_context: str = "EXEC_DEFAULT",
/,
*,
filepath: str = "",
use_addon_preferences: bool = False,
ignore_warning: bool = True,
armature_object_name: str = "",
) -> set[str]: ...
def vrma(
execution_context: str = "EXEC_DEFAULT",
/,
*,
filepath: str = "",
armature_object_name: str = "",
) -> set[str]: ...
def gltf(
execution_context: str = "EXEC_DEFAULT",
/,
*,
filepath: str = "",
check_existing: bool = True,
export_import_convert_lighting_mode: str = "SPEC",
gltf_export_id: str = "",
export_format: str = "GLB",
ui_tab: str = "GENERAL",
export_copyright: str = "",
export_image_format: str = "AUTO",
export_image_add_webp: bool = False,
export_image_webp_fallback: bool = False,
export_texture_dir: str = "",
export_jpeg_quality: int = 75,
export_image_quality: int = 75,
export_keep_originals: int = False,
export_texcoords: bool = True,
export_normals: bool = True,
export_draco_mesh_compression_enable: bool = False,
export_draco_mesh_compression_level: int = 6,
export_draco_position_quantization: int = 14,
export_draco_normal_quantization: int = 10,
export_draco_texcoord_quantization: int = 12,
export_draco_color_quantization: int = 10,
export_draco_generic_quantization: int = 12,
export_tangents: bool = False,
export_materials: str = "EXPORT",
export_colors: bool = True,
export_attributes: bool = False,
use_mesh_edges: bool = False,
use_mesh_vertices: bool = False,
export_cameras: bool = False,
use_selection: bool = False,
use_visible: bool = False,
use_renderable: bool = False,
use_active_collection_with_nested: bool = True,
use_active_collection: bool = False,
use_active_scene: bool = False,
export_extras: bool = False,
export_yup: bool = True,
export_apply: bool = False,
export_animations: bool = True,
export_frame_range: bool = False,
export_frame_step: int = 1,
export_force_sampling: bool = True,
export_animation_mode: str = "ACTIONS",
export_nla_strips_merged_animation_name: str = "Animation",
export_def_bones: bool = False,
export_hierarchy_flatten_bones: bool = False,
export_optimize_animation_size: bool = True,
export_optimize_animation_keep_anim_armature: bool = True,
export_optimize_animation_keep_anim_object: bool = False,
export_negative_frame: str = "SLIDE",
export_anim_slide_to_zero: bool = False,
export_bake_animation: bool = False,
export_anim_single_armature: bool = True,
export_reset_pose_bones: bool = True,
export_current_frame: bool = False,
export_rest_position_armature: bool = True,
export_anim_scene_split_object: bool = True,
export_skins: bool = True,
export_influence_nb: int = 4,
export_all_influences: bool = False,
export_morph: bool = True,
export_morph_normal: bool = True,
export_morph_tangent: bool = False,
export_morph_animation: bool = True,
export_morph_reset_sk_data: bool = True,
export_lights: bool = False,
export_try_sparse_sk: bool = True,
export_try_omit_sparse_sk: bool = False,
export_gpu_instances: bool = False,
export_nla_strips: bool = True,
export_original_specular: bool = False,
will_save_settings: bool = False,
filter_glob: str = "*.glb",
) -> set[str]: ...
7 changes: 7 additions & 0 deletions typings/bpy/ops/icyp/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
def make_basic_armature(
execution_context: str = "EXEC_DEFAULT",
/,
*,
WIP_with_template_mesh: bool = False, # noqa: N803
custom_property_name: str = "",
) -> set[str]: ...
Loading

0 comments on commit d7350f2

Please sign in to comment.