简体   繁体   English

在PyDev Python编辑器中编程Blender

[英]Programing Blender in PyDev Python Editor

I am trying to create a 3D model, particularly a realistic 3d human model using a programing language where I would input a set of points/vertices that would connect to make the figure I want. 我正在尝试使用一种编程语言来创建3D模型,尤其是逼真的3D人体模型,在该语言中,我将输入一组点/顶点,这些点/顶点将相互连接以生成所需的图形。

I first tried using Java 3D but I only found it useful for creating basic shapes like cubes, and upon doing further research it did not seem to be a good tool make complex shapes that require meshes. 我最初尝试使用Java 3D,但我发现它只能用于创建基本形状(如立方体),并且在进行进一步研究后,它似乎并不是制作需要网格的复杂形状的好工具。

After doing some more research I saw that Blender is a good tool to create 3d models and it has the source code available that can be used to create python scripts. 经过更多研究后,我发现Blender是创建3d模型的好工具,并且它具有可用的源代码,可用于创建python脚本。 However it seems like these scripts can only run in blender itself and not through pyDev in Eclipse, which is what I would like to do so. 但是,似乎这些脚本只能在Blender本身中运行,而不能通过Eclipse中的pyDev运行,这就是我想要的。 Is there another way to be able to leverage the Blender code so that I can use it to programmatically create a 3D model by providing a data set? 还有另一种方法可以利用Blender代码,以便我可以通过提供数据集以编程方式创建3D模型吗? I read that Blender is coded in C, so is there a way achieve what I want in C, and if so does anyone know a good reference/tutorial that I could use to create 3D models leveraging existing Blender code? 我读到Blender是用C编码的,所以有什么方法可以实现我想要用C编写的代码,如果可以,有没有人知道我可以用来利用现有Blender代码创建3D模型的良好参考/教程?

While you can alter blender's source code to add features, it is often easier to use python scripts or addons. 尽管您可以更改Blender的源代码以添加功能,但使用python脚本或附加组件通常会更容易。 Blender's python API provides access to it's data. Blender的python API提供了对其数据的访问。

It is possible to remotely debug python scripts using pycharm or pydev (both are eclipse based). 可以使用pycharm或pydev(都是基于eclipse的)远程调试python脚本。 Some info is provided here and you can find several questions on using pycharm at blender.stackexchange . 这里提供了一些信息,您可以在blender.stackexchange上找到有关使用pycharm的几个问题。

You can also build blender as a python module which allows you to import the bpy module into any python interpreter and use blender's mesh tools without using it's gui. 您还可以将Blender构建为python模块 ,从而可以将bpy模块导入任何python解释器中,并使用Blender的网格工具,而无需使用它的gui。 You will need to build blender from source yourself to get this module. 您将需要从源代码自己构建Blender以获得此模块。

For extra performance you can use numpy, which has been included with blender for some time. 为了获得更高的性能,您可以使用numpy,它已在搅拌器中包含了一段时间。 You may also want to look at using cython to generate c-code from your python addon so it can be compiled into a binary python module, cube surfer is an example . 您可能还想看看如何使用cython从python插件中生成c代码,以便可以将其编译为二进制python模块, 例如cube surfer

As for your plan to generate human meshes, I would suggest looking at MakeHuman or ManuelbastioniLAB . 至于生成人网格的计划,建议您使用MakeHumanManuelbastioniLAB Both of these use a set of pre-built meshes and shape keys that can be interchanged based on a set of paramaters. 这两种方法都使用了一组预构建的网格和形状键,可以根据一组参数对其进行互换。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM