I'm trying to make my own bpy.ops python function, like bpy.ops.hi() for example, or even bpy.someotherfunction().
I realize that the submodules are only "fakes" as it says in the ops.py file, and they all point to C++ functions, here's the class to create all bpy.something():
class BPyOps: """ Fake module like class. bpy.ops """ __slots__ = () def __getattr__(self, module): """ gets a bpy.ops submodule """ if module.startswith('__'): raise AttributeError(module) return BPyOpsSubMod(module) def __dir__(self): submodules = set() # add this classes functions for id_name in dir(self.__class__): if not id_name.startswith('__'): submodules.add(id_name) for id_name in op_dir(): id_split = id_name.split('_OT_', 1) if len(id_split) == 2: submodules.add(id_split.lower()) else: submodules.add(id_split) return list(submodules) def __repr__(self): return "<module like class 'bpy.ops'>"
so for now without even getting into submodules I'd like to first know how to make a custom bpy.something(),
it seems like all the module names are coming from op_dir(), which is defined in the beginning:
from _bpy import ops as ops_module # op_add = ops_module.add op_dir = ops_module.dir
but I can't seem to find "_bpy" anywhere, I tried doing a windows search in both the blender release folder and the source code, and I couldn't find it (yet).
SO I think the step to make a custom module is to edit _bpy.dir, but where is that ???? Is it in the blender source somewhere, or a compiled python file?