I'm trying to speed up some erosion simulations (simulating 10's of thousands of raindrops) I have in python but I cannot get Blender to even import a cython created module. I've created a super simple example in hopes of figuring it out but haven't yet. Any Cython advice is welcome! I'm working with the 2.83 LTS version, using/compiling with python version 3.7.4, and I am using easycython to build my cython files.
I tried Dr. Sybren's answer but to no avail - Here's the python code:
bl_info = {
"name": "Test",
"description": "",
"author": "Zach Eastin",
"version": (0, 5, 1),
"blender": (2, 83, 0),
"location": "View 3D > Properties Panel",
"support": "COMMUNITY",
"category": "Mesh"
}
import bpy
from os.path import dirname,join
import sys
fpath = join( dirname(__file__),"simple.pyd" )
if fpath not in sys.path:
sys.path.append(fpath)
# import simple
from . simple import f
class MyClassName(bpy.types.Operator):
bl_idname = "my_operator.my_class_name"
bl_label = "My Class Name"
bl_description = "Description that shows in blender tooltips"
bl_options = {"REGISTER"}
def execute(self, context):
# print("Cy:",simple.f(3,4))
print("Cy:", f(3, 4))
return {"FINISHED"}
class PanelClassName(bpy.types.Panel):
bl_idname = "panelname"
bl_label = "Panelname"
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
def draw(self, context):
layout = self.layout
layout.operator("my_operator.my_class_name")
clss = [
MyClassName,
PanelClassName
]
def register():
for cls in clss :
bpy.utils.register_class(cls)
def unregister():
for cls in clss :
bpy.utils.unregister_class(cls)
if __name__ == "__main__":
register()
And then my Cython code
def f(int x, int y):
return x*y
Really any help would be sooo appreciated! Thanks in advance!
fpath = join( dirname(__file__) )
instead of the actual pyd file and still nothing $\endgroup$. simple
in your import statement is invalid syntax. What platform are you running this on? $\endgroup$