Comments (10)
You probably need to set the include dir to the Animation Nodes header and import using a path relative to the Animation Nodes module.
See the Cython section of the developer guide for extensions:
https://docs.animation-nodes.com/developer_guide/extensions/introduction/#cython
from animation_nodes.
You probably need to set the include dir to the Animation Nodes header and import using a path relative to the Animation Nodes module.
See the Cython section of the developer guide for extensions: https://docs.animation-nodes.com/developer_guide/extensions/introduction/#cython
Thanks Omar!Will try!
from animation_nodes.
Hi Omar,
I was not able to complie correctly, please take a look and many thanks.
from setuptools import setup, Extension
from Cython.Build import cythonize
from Cython.Distutils import build_ext
import sys
user_name = 'UPC'
mypath01=r'C:\Users\UPC\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons'
if not(mypath01 in sys.path):
sys.path.append(mypath01)
import animation_nodes
extensions = [
Extension(
"my_wiggle_falloff",["my_wiggle_falloff.pyx"],
"include_dirs", ["C:/Users/UPC/Documents/Downloads/animation_nodes_headers"],
),
]
setup(name='my_wiggle_falloff',
ext_modules=cythonize(extensions),
)
You probably need to set the include dir to the Animation Nodes header and import using a path relative to the Animation Nodes module.
See the Cython section of the developer guide for extensions: https://docs.animation-nodes.com/developer_guide/extensions/introduction/#cythonThanks Omar!Will try!
Hi Omar,
I was not able to complie correctly, please take a look and many thanks.
from setuptools import setup, Extension
from Cython.Build import cythonize
from Cython.Distutils import build_ext
import sys
user_name = 'UPC'
mypath01=r'C:\Users\UPC\AppData\Roaming\Blender Foundation\Blender\2.93\scripts\addons'
if not(mypath01 in sys.path):
sys.path.append(mypath01)
import animation_nodes
extensions = [
Extension(
"my_wiggle_falloff",["my_wiggle_falloff.pyx"],
"include_dirs", ["C:/Users/UPC/Documents/Downloads/animation_nodes_headers"],
),
]
setup(name='my_wiggle_falloff',
ext_modules=cythonize(extensions),
)
from animation_nodes.
Can you provide a more complete version of what you are trying to do so that I can test it locally?
It is unclear to me why you import animation_nodes in the setup file here.
from animation_nodes.
Can you provide a more complete version of what you are trying to do so that I can test it locally? It is unclear to me why you import animation_nodes in the setup file here.
setup.py
is as below:
from setuptools import setup, Extension
from Cython.Build import cythonize
from Cython.Distutils import build_ext
extensions = [
Extension(
"my_wiggle_falloff",["my_wiggle_falloff.pyx"],
"include_dirs", ["C:/Users/UPC/Documents/Downloads/animation_nodes_headers"],
),
]
setup(name='my_wiggle_falloff',
ext_modules=cythonize(extensions),
)
my_wiggle_off.pyx
is below:
import bpy
from bpy.props import *
from ... base_types import AnimationNode
from ... data_structures cimport BaseFalloff
from ... algorithms.perlin_noise cimport perlinNoise1D
class WiggleFalloffNode():
def execute(self, seed, evolution, speed, offset, amplitude, octaves, persistance):
evolution *= max(speed, 0) / 10
return WiggleFalloff(seed, evolution, offset, amplitude, octaves, persistance)
cdef class WiggleFalloff(BaseFalloff):
cdef:
double evolution
double offset, amplitude
double persistance
int octaves
def __cinit__(self, float seed, float evolution,
float offset, float amplitude,
int octaves, float persistance):
self.evolution = seed * 341312 + evolution
self.amplitude = amplitude
self.persistance = persistance
self.offset = offset
self.octaves = min(max(octaves, 0), 100)
self.clamped = False
self.dataType = "NONE"
cdef float evaluate(self, void *object, Py_ssize_t index):
cdef double x = self.evolution + index * 1127
cdef double noise = perlinNoise1D(x, self.persistance, self.octaves)
return <float>(self.amplitude * noise + self.offset)
from animation_nodes.
You should probably set the include path in the cythonize function as follows:
from Cython.Build import cythonize
from Cython.Distutils import build_ext
from setuptools import setup, Extension
extensions = [
Extension(
"my_wiggle_falloff", ["my_wiggle_falloff.pyx"]
),
]
setup(
name = "my_wiggle_falloff",
ext_modules = cythonize(extensions,
include_path = ["/path/to/animation_nodes_headers", "."],
compiler_directives = {"language_level" : "3"}),
)
And use absolute imports relative to the animation_nodes
module as follows:
from animation_nodes.data_structures cimport BaseFalloff
from animation_nodes.algorithms.perlin_noise cimport perlinNoise1D
from animation_nodes.
animation_nodes.
It worked well now. Thanks a lot Omar! Your supports are always great!
from animation_nodes.
Hi Omar, although the compilation is ok, when call my_wiggle_falloff, it will generate below errors:animation_nodes.data_structures.meshes,mesh_data.Mesh size changed ,may indicate binary incompatibility, expect 88 from c header, got 80 from pyobject. not sure why?
from animation_nodes.
This likely means that your headers are older/newer than your compiled files. Make sure both the headers and the compiled objects are of the same version.
from animation_nodes.
This likely means that your headers are older/newer than your compiled files. Make sure both the headers and the compiled objects are of the same version.
Thanks Omar again.
from animation_nodes.
Related Issues (20)
- Strange Behavior of Distribute Matrices (or Bug in Transform Vector?) HOT 1
- Error please help HOT 3
- Console Error when using Get Custom Attribute Node on a Mesh Input. HOT 1
- Not opening for Mac HOT 6
- Viewer does not show box with information HOT 2
- Bmesh Mesh node is not working HOT 1
- No animation nodes for 2.92 HOT 1
- Animation_Nodes nodes show up in Serpens3 when using shift+a search HOT 2
- how can i import my own .py file and use this in the script node?
- Python Version Mismatch blender 3.6.0
- running animation nodes on Blender 4.0 throw an error HOT 5
- Animation Nodes for Blender 4.0a HOT 2
- Does not work with blender 3.6 HOT 3
- Every socket in Animation Nodes appears pink in Blender 4.0 and 4.1 HOT 2
- How I can build version for future versions of blender? WINDOWS
- Unable to Use Animation Nodes Plugin with Blender 3.6.5
- ImportError: dlopen(.../implementations.cpython-310-darwin.so, 2): Symbol not found: ___chkstk_darwin HOT 7
- Unable to Build .ZIP File HOT 4
- Python version mismatch, Blender 4.1a HOT 2
- Windows compile error: LINK : fatal error LNK1181: cannot open input file 'FastNoiseSIMD_windows.lib' HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from animation_nodes.