GithubHelp home page GithubHelp logo

nutti / fake-bpy-module Goto Github PK

View Code? Open in Web Editor NEW
1.3K 39.0 93.0 2.4 MB

Fake Blender Python API module collection for the code completion.

License: MIT License

Python 83.45% Shell 15.90% Dockerfile 0.43% Smarty 0.23%
blender-addon blender-scripts blender blender3d python b3d

fake-bpy-module's Introduction

Fake Blender Python API module collection: fake-bpy-module

fake-bpy-module is the collections of the fake Blender Python API modules for the code completion in commonly used IDEs.

Note: The similar project for Blender Game Engine (BGE) is available on fake-bge-module which targets UPBGE.

fake-bpy-module Thumbnail

To realize the long support of this project, your support is helpful. You can support the development of this project via GitHub Sponsors. See the contribution document for the detail of the support.

Requirements

fake-bpy-module uses typing module and type hints which are available from Python 3.8. Check your Python version is >= 3.8.

Install

fake-bpy-module can be installed via a pip package, or pre-generated modules. You can also generate and install modules manually.

Install via pip package

fake-bpy-module is registered to PyPI.
You can install it as a pip package.

Install a latest package

If you install fake-bpy-module for Blender latest build (master branch daily build powered by nutti/blender-daily-build), run below command.

pip install fake-bpy-module

or, specify version "latest".

pip install fake-bpy-module-latest

Install a version specific package

If you want to install a version specific package, run below command.

pip install fake-bpy-module-<version>

If you install fake-bpy-module for Blender 2.93, run below command.

pip install fake-bpy-module-2.93

Note: For PyCharm users, change the value idea.max.intellisense.filesize in idea.properties file to more than 2600 because some modules have the issue of being too big for intelliSense to work.

Supported Blender Version
Version PyPI
2.78 https://pypi.org/project/fake-bpy-module-2.78/
2.79 https://pypi.org/project/fake-bpy-module-2.79/
2.80 https://pypi.org/project/fake-bpy-module-2.80/
2.81 https://pypi.org/project/fake-bpy-module-2.81/
2.82 https://pypi.org/project/fake-bpy-module-2.82/
2.83 https://pypi.org/project/fake-bpy-module-2.83/
2.90 https://pypi.org/project/fake-bpy-module-2.90/
2.91 https://pypi.org/project/fake-bpy-module-2.91/
2.92 https://pypi.org/project/fake-bpy-module-2.92/
2.93 https://pypi.org/project/fake-bpy-module-2.93/
3.0 https://pypi.org/project/fake-bpy-module-3.0/
3.1 https://pypi.org/project/fake-bpy-module-3.1/
3.2 https://pypi.org/project/fake-bpy-module-3.2/
3.3 https://pypi.org/project/fake-bpy-module-3.3/
3.4 https://pypi.org/project/fake-bpy-module-3.4/
3.5 https://pypi.org/project/fake-bpy-module-3.5/
3.6 https://pypi.org/project/fake-bpy-module-3.6/
4.0 https://pypi.org/project/fake-bpy-module-4.0/
latest https://pypi.org/project/fake-bpy-module/
https://pypi.org/project/fake-bpy-module-latest/

Install via pre-generated modules

Download Pre-generated modules from Release page.

The process of installation via pre-generated modules is different by IDE. See the installation processes as follows for detail.

Generate Modules Manually

You can also generate modules manually. See Generate Module for detail.

Change Log

See CHANGELOG.md

Bug report / Feature request / Disscussions

If you want to report bug, request features or discuss about this project, see ISSUES.md.

fake-bpy-module channel is available on blender.chat.
The timely discussion and release announcement about fake-bpy-module will be made in this channel.

Note: Registration of blender.chat is required for accessing fake-bpy-module channel.

Contribution

If you want to contribute to this project, see CONTRIBUTING.md.

Project Authors

Owner

@nutti

Indie Game/Application Developer.
Especially, I spend most time to improve Blender and Unreal Game Engine via providing the extensions.

Support via GitHub Sponsors

Contributors

fake-bpy-module's People

Contributors

espiondev avatar grische avatar jonathanplasse avatar kant avatar nutti avatar road-hog123 avatar theoryshaw avatar uuunyaa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fake-bpy-module's Issues

Add `addon_utils`

Description about the feature
Add the addon_utils module aswell. I use this module for my testing setup

Are you willing to contribute about this feature. (Yes/No)
I could contribute, but would probably need some time

Enums should be considered as String instead of Int in Python

System Information

  • OS: Windows
  • Blender version: 2.79 (Python version 3.6 used in IDE)
  • IDE: PyCharm

Expected behavior
in types.py (Downloaded from the README)
def report(self, type: typing.Set[int], message: str):
Should be:
def report(self, type: typing.Set[str], message: str):
As enums are exposed as strings in Python. If this seems non-intuitive, typing.Set[object] could also be used, to ignore the problem

There are many more cases of this issue. It would be very nice to be fixed :)

Wrong type hinting for bpy.props.EnumProperty

System Information

  • OS: Windows 7
  • Blender version: 2.80

Expected behavior
The items keyword argument of bpy.props.EnumProperty should be tuples.

Description about the bug
Currently it is defined as items: str.

No default values for bmesh.ops functions

Why are there no default values for bmesh.ops functions?
e.g.:
bmesh.ops.extrude_face_region:

  • fake-bpy-module: (bm, geom, edges_exclude, use_keep_orig, use_select_history)
  • blender console: (bmesh, geom=[], edges_exclude={}, use_keep_orig=False, use_select_history=False)

or bmesh.ops.translate:

  • fake-bpy-module: (bm, vec, space, verts)
  • blender console: (bmesh, vec=Vector(), space=Matrix(), verts=[])

AttributeError: module 'bpy.types' has no attribute 'VIEW3D_HT_header'

System Information

  • OS: Windows
  • Blender version: 2.8x

Expected behavior
I expect for this attribute to exist: https://github.com/blender/blender/blob/9385d887d17c529059d9f60008dc08fcec1d295f/release/scripts/startup/bl_ui/space_view3d.py#L7397-L7414

Description about the bug

python.exe
Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import bpy
>>> bpy.types.VIEW3D_HT_header
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'bpy.types' has no attribute 'VIEW3D_HT_header'

Additional comments [Optional]
I am not sure if I am using this module in an unintended way, but I simply tried to lint the following code: https://github.com/blender/blender/blob/a921a4daad437e8ef00adc1f7076449a7cf505e0/intern/cycles/blender/addon/ui.py#L2360-L2370

AttributeError: type object 'VIEW3D_HT_header' has no attribute 'append'

System Information

  • OS: Windows
  • Blender version: 2.8x
  • fake-bpy-module version: fake_bpy_module_2.82-20200620 (built from current master)

Expected behavior
I expect for this attribute to exist. Here is the code path for append:

  1. https://github.com/blender/blender/blob/9385d887d17c529059d9f60008dc08fcec1d295f/release/scripts/startup/bl_ui/space_view3d.py#L552-L554
  2. https://github.com/blender/blender/blob/d46273563e684bf8445369bd03752ceebf26e1ec/release/scripts/modules/bpy_types.py#L861-L862
  3. https://github.com/blender/blender/blob/d46273563e684bf8445369bd03752ceebf26e1ec/release/scripts/modules/bpy_types.py#L822-L831

Description about the bug

python.exe
Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import bpy
>>> bpy.types.VIEW3D_HT_header
<class 'bpy.types.VIEW3D_HT_header'>
>>> bpy.types.VIEW3D_HT_header.append() 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: type object 'VIEW3D_HT_header' has no attribute 'append'

Additional comments [Optional]
This is a follow-up of #32 .

I am still trying to lint the following code: https://github.com/blender/blender/blob/a921a4daad437e8ef00adc1f7076449a7cf505e0/intern/cycles/blender/addon/ui.py#L2360-L2370

Issues with bpy_prop_collection

The main issue I had with fake-bpy-module is that it generates typing.List[SomeType] instead of SomeType for Blender's instances of bpy_prop_collection and its variants. And it also does not generate class inheritance. So, as a result, we have these issues:

bpy.data.objects. -> further type hinting fails, as the generated type is typing.List[BlendDataObjects]

If I change it manually to BlendDataObjects, it works just fine.

Another problem arises due to lack of class inheritance:

mesh = bpy.data.meshes.new(name)( returns -> ID instead of bpy.types.Mesh)
bpy.data.objects.new(data=mesh) - marked as TypeError in IDE, as returned type of bpy.data.meshes.new() after fixing it itself to BlendDataMeshes is bpy.types.Mesh.

bpy.data.objects.new(data=mesh) would expect an ID class, but got Mesh instead now. TypeError again. I know we can't put bpy.types.Mesh explicitly in there, as object may be created trough a different ID data, e.g. lamp. So, my proposal would be either typing.Union[bpy.types.Mesh, bpy.types.Lamp, etc) or leaving it more implicit as ID, but fixing class inheritance for mesh to derive from ID as stated in Blender API docs. Either way the type becomes valid then.

Wrong typing syntax?

I looked at the generated fake modules to resolve the issue with some types being deduced incorrectly. It seems the generator tool inserts parentheses into class names of types which represent a container?

Quick example.

does not work:
class Action:
'''A collection of F-Curves for animation '''

fcurves: typing.List['FCurve'] = None

works now:
class Action:
'''A collection of F-Curves for animation '''

fcurves: typing.List[FCurve] = None

Is there any specific reason for this?

Usage instructions need to be improved

There are a number of important missing details on the usage instructions in the README.

Missing build step

The requirement to actually build the Blender project is not expressed. There should be a one-liner build step (e.g. on Windows, make.bat full) that should be included in the steps.

Missing dependencies

There are a couple of pip installations that need to be completed, namely:

pip install pathlib
pip install sphinx

Python Version specification

Running gen.py with Python 2.7.12 results in the following error:
image
It looks like the file is meant to be run on Python 3. Either this needs to be stated explicitly or, alternatively, it could be made backwards compatible by simply removing the pathlib dependency. It's only used in one spot in the script, and it just performs a trivial mkdir that could be performed with the builtin modules.

Thank you for the script! Lots more people would probably get into the Blender scripting if it was made easier to get this up and running. I would't mind helping out and making some guides for setting up these files in the various IDEs. Let me know if you'd be interested. Take care!

IndexError: tuple index out of range

By generation I get error

]$ blender --background --factory-startup -noaudio --python doc/python_api/sphinx_doc_gen.py
Traceback (most recent call last):
File "/home/ekkl/shared/bpy-fake/blender/release/scripts/modules/bpy/utils/init.py", line 94, in _test_import
mod = import(module_name)
File "/home/ekkl/shared/bpy-fake/blender/release/scripts/startup/nodeitems_builtins.py", line 162, in
NodeItem("NodeGroupInput", poll=group_input_output_item_poll),
File "/home/ekkl/shared/bpy-fake/blender/release/scripts/startup/nodeitems_builtins.py", line 35, in init
items = sorted(items, key=lambda item: item.label.lower())
File "/home/ekkl/shared/bpy-fake/blender/release/scripts/startup/nodeitems_builtins.py", line 35, in
items = sorted(items, key=lambda item: item.label.lower())
File "/home/ekkl/shared/bpy-fake/blender/release/scripts/modules/nodeitems_utils.py", line 62, in label
bl_rna = bpy.types.Node.bl_rna_get_subclass(self.nodetype)
AttributeError: type object 'Node' has no attribute 'bl_rna_get_subclass'
Traceback (most recent call last):
File "/home/ekkl/shared/bpy-fake/blender/release/scripts/modules/addon_utils.py", line 340, in enable
mod = import(module_name)
ModuleNotFoundError: No module named 'io_scene_3ds'
Traceback (most recent call last):
File "/home/ekkl/shared/bpy-fake/blender/release/scripts/modules/addon_utils.py", line 340, in enable
mod = import(module_name)
ModuleNotFoundError: No module named 'io_scene_fbx'
Traceback (most recent call last):
File "/home/ekkl/shared/bpy-fake/blender/release/scripts/modules/addon_utils.py", line 340, in enable
mod = import(module_name)
ModuleNotFoundError: No module named 'io_anim_bvh'
Traceback (most recent call last):
File "/home/ekkl/shared/bpy-fake/blender/release/scripts/modules/addon_utils.py", line 340, in enable
mod = import(module_name)
ModuleNotFoundError: No module named 'io_mesh_ply'
Traceback (most recent call last):
File "/home/ekkl/shared/bpy-fake/blender/release/scripts/modules/addon_utils.py", line 340, in enable
mod = import(module_name)
ModuleNotFoundError: No module named 'io_scene_obj'
Traceback (most recent call last):
File "/home/ekkl/shared/bpy-fake/blender/release/scripts/modules/addon_utils.py", line 340, in enable
mod = import(module_name)
ModuleNotFoundError: No module named 'io_scene_x3d'
Traceback (most recent call last):
File "/home/ekkl/shared/bpy-fake/blender/release/scripts/modules/addon_utils.py", line 340, in enable
mod = import(module_name)
ModuleNotFoundError: No module named 'io_mesh_stl'
Traceback (most recent call last):
File "/home/ekkl/shared/bpy-fake/blender/release/scripts/modules/addon_utils.py", line 340, in enable
mod = import(module_name)
ModuleNotFoundError: No module named 'io_mesh_uv_layout'
Traceback (most recent call last):
File "/home/ekkl/shared/bpy-fake/blender/release/scripts/modules/addon_utils.py", line 340, in enable
mod = import(module_name)
ModuleNotFoundError: No module named 'io_curve_svg'
Traceback (most recent call last):
File "/home/ekkl/shared/bpy-fake/blender/release/scripts/modules/addon_utils.py", line 340, in enable
mod = import(module_name)
ModuleNotFoundError: No module named 'cycles'
/home/ekkl/shared/bpy-fake/blender/doc/python_api/rst/bmesh.ops.rst
Traceback (most recent call last):
File "/home/ekkl/shared/bpy-fake/blender/doc/python_api/sphinx_doc_gen.py", line 2226, in
main()
File "/home/ekkl/shared/bpy-fake/blender/doc/python_api/sphinx_doc_gen.py", line 2148, in main
rna2sphinx(SPHINX_IN_TMP)
File "/home/ekkl/shared/bpy-fake/blender/doc/python_api/sphinx_doc_gen.py", line 2021, in rna2sphinx
pycontext2sphinx(basepath)
File "/home/ekkl/shared/bpy-fake/blender/doc/python_api/sphinx_doc_gen.py", line 1158, in pycontext2sphinx
write_contex_cls()
File "/home/ekkl/shared/bpy-fake/blender/doc/python_api/sphinx_doc_gen.py", line 1127, in write_contex_cls
structs, funcs, ops, props = rna_info_BuildRNAInfo_cache()
File "/home/ekkl/shared/bpy-fake/blender/doc/python_api/sphinx_doc_gen.py", line 74, in rna_info_BuildRNAInfo_cache
rna_info_BuildRNAInfo_cache.ret = rna_info.BuildRNAInfo()
File "/home/ekkl/shared/bpy-fake/blender/release/scripts/modules/rna_info.py", line 702, in BuildRNAInfo
prop.build()
File "/home/ekkl/shared/bpy-fake/blender/release/scripts/modules/rna_info.py", line 290, in build
if self.array_dimensions[1] != 0: # Multi-dimensional array, convert default flat one accordingly.
IndexError: tuple index out of range
Blender quit

And output dir is empty.
How can fix it?

bpy.types.Scene missing objects

Shouldn't the type bpy.types.Scene have an objects property to link objects to the scene?

e.g.,
def get_scene() -> bpy.types.Scene:
return bpy.context.scene

get_scene().objects.link(obj)

Integration with PyCharm

  • OS: Ubuntu 16.04
  • Blender version: 2.80
    (After execution: pip3.7 install fake-bpy-module-2.80)

When I try import bpy module in PyCharm I got:

Traceback (most recent call last):
File "/home/michal/Programs/blender-2.80/2.80/scripts/addons/Test1.py", line 6, in
import bpy
File "/usr/local/lib/python3.7/site-packages/bpy/init.py", line 3, in
from . import types
File "/usr/local/lib/python3.7/site-packages/bpy/types.py", line 55744
def prop_with_popover(self,
^
SyntaxError: non-default argument follows default argument

If I correct these by (adding default argument) I got the next one:

Traceback (most recent call last):
File "/home/michal/Programs/blender-2.80/2.80/scripts/addons/Test1.py", line 6, in
import bpy
File "/usr/local/lib/python3.7/site-packages/bpy/init.py", line 3, in
from . import types
File "/usr/local/lib/python3.7/site-packages/bpy/types.py", line 1737, in
class BlendData:
File "/usr/local/lib/python3.7/site-packages/bpy/types.py", line 1980, in BlendData
def batch_remove(self, ids=(id1, id2, ...)):
NameError: name 'id1' is not defined

Is it a version 'python vs blender' mismatch?

Regards,
Michal

Support Blender LTS versions (currently 2.83.1)

Description about the feature
Blender changed to a new release scheme, creating an "LTS" version of Blender (currently 2.83 LTS) with regular maintenance fixes. The most recent release is 2.83.1:
https://www.blender.org/press/blender-2-83-1-lts/

I am not sure if you intend to release fake-bpy-module for version "2.83.0", "2.83.1", ... or if you only want to have one version "2.83" and always try to stay up to date.

What is your idea here?

If you only want one version, then this Feature Request is simply a request for a version bump.

Non-default argument follows default argument

A SyntaxError occurs when I'm trying to import bpy module:
syntax
3rd parameter to template_list() function in the types.py is default-assigned but several further are not.
syntax2
Is this intended?

missing __all__ in __init__ files in premade modules

this way pycharm itellij can't autocomplete subdirs.
example:
when doing import bpy then bpy.ops can't be autocomplete, and also any other subdir or sub-subdir...

great feature and great README by the way!!! helped me a lot.

Module 'bgl' issue with vscode

i am using blender 2.8 to debug one script file with vscode and getting errors Module 'bgl' has no 'GL_INT' member
Module 'bgl' has no 'glGetIntegerv' member
Module 'bgl' has no 'GL_DEPTH_FUNC' member
Module 'bgl' has no 'GL_ALWAYS' member
i got an idea from blender chat forum(python) to use fake-bpy-module to avoid import issues.I followed instruction from the git website and update into settings.json file path "python.autoComplete.extraPaths": ["C:/Python/Python36/Lib/site-packages"] and site-packages folder in having the data (chekc the link) http://prntscr.com/of5kr2.

please assist me, what i am missing

Please mark generated code with py.typed for mypy type checking

As a developer, I like to use mypy to type check my Python code. This converts various runtime problems into much simpler compile time problems and saves me time.

For mypy to use the stubs generated by fake-bpy-module, the resulting bpy package needs to come with a py.typed marker file.

The good news is that a lot of the bpy.types already come with type annotations (yay!), and adding this file here is the only thing left to let mypy benefit from them.

Example

Note the (empty) py.typed file I manually added in here.

~/s/find_bad_motion_tracks (main|✚1) $ ls -l env/lib/python3.9/site-packages/bpy
total 5240
-rw-r--r--   1 johan  staff      279 30 Jul 15:07 __init__.py
drwxr-xr-x   8 johan  staff      256 30 Jul 15:07 __pycache__
drwxr-xr-x   8 johan  staff      256 30 Jul 15:07 app
-rw-r--r--   1 johan  staff     4881 30 Jul 15:07 context.py
-rw-r--r--   1 johan  staff     1116 30 Jul 15:07 msgbus.py
drwxr-xr-x  77 johan  staff     2464 30 Jul 15:07 ops
-rw-r--r--   1 johan  staff     3595 30 Jul 15:07 path.py
-rw-r--r--   1 johan  staff    21901 30 Jul 15:07 props.py
-rw-r--r--   1 johan  staff        0 30 Jul 16:38 py.typed    <--- PLEASE ADD THIS EMPTY MARKER FILE
-rw-r--r--   1 johan  staff  2634790 30 Jul 15:07 types.py
drwxr-xr-x   6 johan  staff      192 30 Jul 15:07 utils
~/s/find_bad_motion_tracks (main|✚1) $

Are you willing to contribute about this feature. (Yes/No)

Possibly.

Unresolved attribute references for Matrix class

empty = bpy.data.objects.new("Empty", None)
empty.matrix_basis.identity()
empty.matrix_parent_inverse.identity()
rot = empty.matrix_world.to_quaternion()
mx = empty.matrix_world.inverted()
transform_mx = empty.matrix_world @ empty.matrix_world.inverted()

Because matrices type set to typing.List[float] instead of Matrix, the code above shows "Unresolved reference" warnings in PyCharm

How to use this module on macOS

Just copy the premade module to the python library folder, and import bpy and got following errors:

Python 2.7.10 (default, Aug 17 2018, 19:45:58)
[GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.0.42)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import bpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/bpy/__init__.py", line 1, in <module>
    from . import types
  File "/Library/Python/2.7/site-packages/bpy/types.py", line 31
SyntaxError: Non-ASCII character '\xe2' in file /Library/Python/2.7/site-packages/bpy/types.py on line 32, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

Need your help.

As I can not import bpy, so that I can not use it's autocomplete function in Atom editor.

Integration with linters

Hello! Awesome module here 👏

I was wondering if this can be used together with linters such as flake8, so that it will report invalid usage of bpy calls.

Best

Fix for bpy.types intelliSense in PyCharm or better documentation

  • OS: Windows
  • Blender version: 2.9.3

I have both this package and bpy installed through pip.

Installing this package isn't enough to fix all bpy intelliSense in PyCharm.
Some modules like bpy.types have the issue of being too big for intelliSense to work, thus omitting them from intelliSense.

The fix for PyCharm -

Is to go to the PyCharm's idea.properties file and changing the value of idea.max.intellisense.filesize.
To a value that supports the size of the module.

It would be great to have this documented here or even better be able to do this automatically.

Object.name and bpy.data.materials.new are missing?

Hi,

first of all great package, really makes working with bpy in VS Code much more convenient. I played around with the pip version for 2.82 today and stumbled over two things that weren't found in the package.

The first is Object.name:

bpy.ops.mesh.primitive_cube_add()
current = bpy.context.object
current.name = "Cube" # No code completion or type here

And the other one was

mat = bpy.data.materials.new(name="Material") # Same here

Am I doing something wrong here or are they missing in the package for some reason?

Cheers
Michael

Operator class lacks filepath property

https://docs.blender.org/api/current/bpy.ops.import_mesh.html?highlight=operator%20filepath
https://docs.blender.org/api/current/bpy.ops.cachefile.html?highlight=operator%20filepath
https://docs.blender.org/api/current/bpy.types.Operator.html?highlight=operator%20filepath

class MyImport(Operator, ImportHelper):
    bl_idname = "Beh"
    bl_label = "Moh"
    bl_description = "Meh"
    filename_ext = ".muh"

    def execute(self: Operator, context: Context):
        return do_thing(self, context, self.filepath)

In this case in current "stubs" .filepath does not exist

Doesn't work (VS Code, Blender 2.8)

System Information

  • OS: Windows 10 1803
  • Blender 2.8
  • Editor: VS Code

Expected behavior
I guess in an ideal world it would work

Description about the bug
I followed the instructions, but the Python addon still can't find the bpy module.

Screenshots/Files
image

image

Assignment from no return Error (Blender 2.79)

System Information

  • OS: Windows10
  • Blender version: 2.79

Expected behavior
Those functions should return a proper type

Description about the bug

I would like to have no errors in this plugin I want to extend in Python

Screenshots/Files

image

Additional comments

Thanks a lot for this amazing project!

Add support for UPBGE

Description about the feature
The description about the feature. It is good to clear who will benefit with this feature.
For now, there is no clear option to get autocompletion support for UPBGE, which is a popular continuation of the obsolete BGE.

As such, it would help those who are new to UPBGE, if this project could be used to generate API stubs for the platform.

Are you willing to contribute about this feature. (Yes/No)
Yes, if I'm able.

Type annotations

Is it possible to extract type annotations from blender and add them to the python stubs?

OSX Check if packages are installed 2.79 py 3.7.8

Bl 2.79
OSX 10.11.6
VSC 1.47.3

I was looking into to this last night and got it working after a while. Perhaps you could add some info about OSX that if a second pyhton is installed the paths are different. IE this line pip install fake-bpy-module-<version> only works if you have that main python as your default. I dont know much about this subject, so perhaps this makes sense for more accustomed users. I simply installed 3.7.8 and left 2.7 on the system as well. There for when i do pythion --version it returns 2.7

How can i check if the modules/packages are installed correct. Where are they actually installed if you use PIP?

The generated file launch.py has a string bug.

System Information
Windows 10 x64

  • OS: [e.g. Windows]
  • Blender version: [e.g. 2.79]
    2.79

Expected behavior
The behavior you expect about the feature you reported.
It will start Blender failed.

Description about the bug
The description about the bug.
File launch.py generated by fake-pyb-module has a bug of a string. The original code looks like:
editor_address=f"http://localhost:{os.environ['EDITOR_PORT']}",

It must delete 'f'.

Screenshots/Files [Optional]
It is good to solve the bug if you attach the screenshots or .blend file.

Additional comments [Optional]

bpy.data completion missing

System Information

  • OS: Windows 10
  • Blender version: 2.8

Expected behavior
Bpy.data. gets autocompletion with objects, collections, scenes etc.

Description about the bug
bpy.data. gets no further autocompletion.

Mocked mathutils conflicts with real mathutils

System Information

  • OS: Windows 10
  • Blender version: 2.90

I've tried to install the real mathutils package, but pip prevented me, saying that the requirement is already satisfied. Since I use the Windows Store version of Python I couldn't actually look up if it was satisfied by one of these fake-bpy-modules, but I could install mathutils on an older Python version, where I don't have any fake-bpy-modules installed.
Either way, I don't see much use in mocking mathutils, if one can install the real thing.

Allow using strings as bpy_prop_collection indices

Description about the feature

When using bpy_prop_collection, PyCharm warns about lines like this:

bpy.data.worlds['WorldName']

It doesn't expect using a string as the index instead of an int or slice (Unexpected type(s):(str)Possible types:(int)(slice)), probably because bpy_prop_collection only exists for documentation purposes and thus has no __getitem__/__setitem__ methods.

I'm not sure how difficult it would be to append those methods after the modules are generated.

Operator types are not included

System Information

  • OS: Windows 7
  • Blender version: 2.80

Expected behavior
For example, bpy.types should have a TOPBAR_MT_file_export attribute.

Description about the bug
bpy.types do not have a TOPBAR_MT_file_export attribute.

Import error

System Information

  • OS: Mac
  • Blender version: 2.80

Expected behavior
Trying to import bpy

Description about the bug
Getting this error:

>>> import bpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/site-packages/bpy/__init__.py", line 3, in <module>
    from . import types
  File "/usr/local/lib/python3.6/site-packages/bpy/types.py", line 55744
    def prop_with_popover(self,
                         ^
SyntaxError: non-default argument follows default argument

Cant open it use the arg python

i want to try creating this on osx 10.11.6 using blender 2.78c
But i get a error for the arg --python
I get a list with all arguments i can use, the python argument is not there. Do you have any idea or solution to this?

Cannot find `node_shader_utils`

System Information

  • OS: Ubuntu 19.10
  • Blender version: 2.81

Description about the bug
I cannot import node_shader_utils like this:

from bpy_extras import node_shader_utils

It results in Cannot find reference 'node_shader_utils' in ....

Publish to PyPi

Description about the feature
It would be helpful if I could simply install the fake package via pip/pipenv.

Are you willing to contribute about this feature. (Yes/No)
Sure :-)

Screenshots [Optional]
Additional comments [Optional]

bpy.ops not autocomplete

System Information

  • OS: [e.g. Windows]
  • Blender version: [e.g. 2.79]

Expected behavior
The behavior you expect about the feature you reported.

Description about the bug
The description about the bug.
after pip install ....2.79, there is no bpy.ops autocomplete

Screenshots/Files [Optional]
It is good to solve the bug if you attach the screenshots or .blend file.

Additional comments [Optional]

__init__ functions are not generated

Using the 2.79 files on the repository, and I still get errors when constructing basic objects like Vectors and Quaternions in PyCharm. It complains of unexpected arguments.

image

After looking at the generated files, the cause is obvious: no __init__ functions are being generated for any types.

Issues with VS Code

This project works great in PyCharm (both 2.79 and 2.8), not so much in VS Code. In VS Code neither work, even after following the VS Code instructions exactly. Are there some steps that haven't been documented?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.