diff --git a/README.md b/README.md index 1a208c6..f177db0 100644 --- a/README.md +++ b/README.md @@ -33,8 +33,9 @@ Install alongside your Blender addon project for type checking with mypy, pyrigh import bpy # Full autocomplete and type checking -obj: bpy.types.Object = bpy.context.active_object -obj.location.x = 1.0 +obj = bpy.context.active_object +if obj is not None: + print(obj.name) # Collection types with proper methods bpy.data.objects.new("Cube", bpy.data.meshes.new("Mesh")) diff --git a/main.py b/main.py index 5d539dd..e8ac04c 100644 --- a/main.py +++ b/main.py @@ -185,8 +185,9 @@ pip install "blender-python-stubs>={major_minor},<{next_minor}" ```python import bpy -obj: bpy.types.Object = bpy.context.active_object -obj.location.x = 1.0 +obj = bpy.context.active_object +if obj is not None: + print(obj.name) bpy.data.objects.new("Cube", bpy.data.meshes.new("Mesh")) ```