Even though it’s the final week, I couldn’t do too much due to other work kicking in, so I kept my idea super simple. It’s not super fancy. It’s not super efficient. But I got my Python code running in Blender to make and attach materials to a mesh after audio input!
Why Blender?
I simply just have more experience in it than in Maya or Processing. I couldn’t quite work out how to attach an external Python code to Processing that wasn’t a huge headache on my part. At least Blender comes with a scripting interface that made it easy to just transfer and live edit the code within the program. Not that I’ve ever had a need to use it before but it’s nice to break out that part of the UI for once
Issues with Blender
My first attempts with Blender were thwarted with importing issues. For some reason, Blender refused to recognize numpy within my environment. This probably had to do with the Numpy already packaged with Blender. But deleting that version and force attaching my environment did nothing to solve the issue.
Found Solutions
Update to the most recent Blender (2.9). Not sure why it didn’t work in 2.7, but it solved the issue with a few caveats. Blender lets you change the Python environment either by installing all the necessary packages into Blender’s own Python folder; or by hard linking (mklink) to the environment folder.
I had to use the hard linking method because the first method made Blender unable to recognize PyAudio for some reason. This means if I want to use a different Python environment in Blender I would have to hardlink to a new folder all over again. But that’s honestly not too terrible.
Another important note is that the external environment must have the same Python version that’s in Blender. For 2.9’s case, it’s 3.5.3.
Things to Note
Blender has its own Python package to use its internal commands. I haven’t looked too deeply into it yet, but if I want to keep using Blender for these purposes, I should see what I could potentially also mess with using audio input — even if only silly unrelated things.
For the Future
Is this general topic something worth pursuing? I think so at the very least. Finding more ways to simplify the animating process can only be beneficial to the community or even just myself really. If anything, it’s interesting to learn another programming language even if I’m currently awful at it. I think I can see myself pursuing more aspects of this idea in the upcoming terms.
Why Blender?
I simply just have more experience in it than in Maya or Processing. I couldn’t quite work out how to attach an external Python code to Processing that wasn’t a huge headache on my part. At least Blender comes with a scripting interface that made it easy to just transfer and live edit the code within the program. Not that I’ve ever had a need to use it before but it’s nice to break out that part of the UI for once
Issues with Blender
My first attempts with Blender were thwarted with importing issues. For some reason, Blender refused to recognize numpy within my environment. This probably had to do with the Numpy already packaged with Blender. But deleting that version and force attaching my environment did nothing to solve the issue.
Found Solutions
Update to the most recent Blender (2.9). Not sure why it didn’t work in 2.7, but it solved the issue with a few caveats. Blender lets you change the Python environment either by installing all the necessary packages into Blender’s own Python folder; or by hard linking (mklink) to the environment folder.
I had to use the hard linking method because the first method made Blender unable to recognize PyAudio for some reason. This means if I want to use a different Python environment in Blender I would have to hardlink to a new folder all over again. But that’s honestly not too terrible.
Another important note is that the external environment must have the same Python version that’s in Blender. For 2.9’s case, it’s 3.5.3.
Things to Note
Blender has its own Python package to use its internal commands. I haven’t looked too deeply into it yet, but if I want to keep using Blender for these purposes, I should see what I could potentially also mess with using audio input — even if only silly unrelated things.
For the Future
Is this general topic something worth pursuing? I think so at the very least. Finding more ways to simplify the animating process can only be beneficial to the community or even just myself really. If anything, it’s interesting to learn another programming language even if I’m currently awful at it. I think I can see myself pursuing more aspects of this idea in the upcoming terms.
Comments
Post a Comment