nutti / fake-bpy-module

Fake Blender Python API module collection for the code completion.
MIT License
1.35k stars 96 forks source link

Missing Cycles Package #101

Closed lembn closed 2 years ago

lembn commented 2 years ago

I recently discovered that Cycles types are generated at runtime, so aren't available for static typing. As such information about the cycles package is missing from the documentation also. For example, the following import is not recognised by the IDE but executes successfully in Blender's Python environment.:

from cycles.properties import CyclesPreferences, CyclesRenderSettings

Since the entire cycles module is undocumented, I found these types using dir() on the module and its sub-packages in Blender's interactive Python environment until I got to what I needed.

I am willing to contribute more to the addition of this feature but would like some guidance on how to start since this package can't be generated from codebase analysis as it only exists at runtime.

nutti commented 2 years ago

@lembn

Sorry for late reply.

fake-bpy-module parses the Python API document and output fake module. So, we need to add manually the module like this if you include undocumented Python API.

nutti commented 2 years ago

@lembn

Is there any update about this issue? If you are still trying this issue, I will support.

lembn commented 2 years ago

Sorry for my inactivity recently. I've been quite busy so haven't got round to checking out the solution but will get onto it soon.

nutti commented 2 years ago

@lembn

Thanks. I will wait for your contribution.

nutti commented 2 years ago

I think latest Blender does not create documents of bpy.types.CyclesRenderSettings. So, it seems this feature seems invalid for the latest Blender. What do you think?

nutti commented 2 years ago

I found that cycle package can be found at 3.2/scripts/addons/cycles. (Sorry for forgetting that cycle package is just an add-on)

You can add this path to your auto completion system. I think this workaround will realize the thing you want. In my environment, this works fine and autocomplete the code in cycle modules.

We also do not want add the code to generate the fake module, because cycle is the addon. Please try the above workaround instead.

lembn commented 2 years ago

Nice catch! Thanks for sorting that out.

Sorry for my unresponsiveness. I kept getting carried away with work and never had time to look into the solution but I really appreciate your diligent research and will use the addon package in the future.

Thanks