简体   繁体   English

如何在搅拌机中将多个网格节点附加到一个对象?

[英]How to attach multiple mesh nodes to one object in blender?

I try to import 3d objects from one game (IGI 2: Covert Strike) into blender. 我尝试将一个游戏(IGI 2:隐蔽打击)中的3d对象导入搅拌器。 Ingame format have a one common vertex buffer, where are stored all vertices from multiple meshes. 游戏内格式具有一个公共的顶点缓冲区,其中存储了来自多个网格的所有顶点。 Also have list of structs used to declare meshes, range of used vertices (from common buffer) and position of this mesh relatively to main object. 还具有用于声明网格的结构列表,使用的顶点范围(来自公共缓冲区)以及此网格相对于主要对象的位置。

If I import full vertex boofer into one mesh i see that: 如果将完整的顶点缓冲添加到一个网格中,我会看到:

http://prntscr.com/n32e0v http://prntscr.com/n32e0v

This is a human model. 这是一个人体模型。 Head are here indide :) 头在这里indide :)

http://prntscr.com/n32fcw http://prntscr.com/n32fcw

Well I want to separate meshes and attach those to one object. 好吧,我想分离网格并将其附加到一个对象上。 But function 但是功能

bpy.data.objects.new(name, mesh) #create object

accepts only one mesh. 仅接受一个网格。

Is there other way to add multiple mesh nodes to one object? 还有其他方法可以将多个网格节点添加到一个对象吗?

May be is posible to create one object per mesh and attach those to one main object? 可能为每个网格创建一个对象并将那些对象附加到一个主要对象上?

But how later add a common skeleton to all this objects? 但是,后来又如何为所有这些对象添加一个通用骨架呢?

First off, you may consider asking this question in Blender SE too, as there is a lot of expertise about Blender in there, so they may be able to give more possible solutions to your problem. 首先,您可能也考虑在Blender SE中问这个问题,因为那里有关于Blender的很多专业知识,因此他们可能能够为您的问题提供更多可能的解决方案。

In any case, I don't think there is any way to have one Blender object hold more than one mesh. 无论如何,我认为没有任何方法可以使一个Blender对象容纳多个网格。 You can however group multiple objects under one parent object, something like this (Blender 2.79b): 但是,您可以将多个对象归为一个父对象,如下所示(Blender 2.79b):

import bpy

# Make parent (empty object)
parent_object = bpy.data.objects.new('parent_object', None)
bpy.context.scene.objects.link(parent_object)
# Make multiple children
for i in range(4):
    # Make child object (mesh object)
    mesh_data = bpy.data.meshes.new('mesh_data_' + str(i + 1))
    mesh_object = bpy.data.objects.new('mesh_object_' + str(i + 1), mesh_data)
    # Set the parent
    mesh_object.parent = parent_object
    bpy.context.scene.objects.link(mesh_object)
bpy.context.scene.update()

And you will get a hierarchy like this: 这样您将获得一个层次结构:

对象层次

Note: There are some upcoming changes to the API in 2.8, see How do I create a new object using Python in Blender 2.80? 注意:即将在2.8中对API进行一些更改,请参阅如何在Blender 2.80中使用Python创建新对象? .

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

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