Armory prefabs discussion


#1

In Blender there is no way to have a good prefab system, Blender does not allow two objects with the same child objects name.

A work around in logic nodes or code is to check the first letters of a child object name (String.startsWith() ), but that’s not great.

There is at least two main features for prefabs :

  • Visible as one object :
    Prefabs in Blender hierarchy would be represented as a simple object whose content would not be visible, unless you open original prefab file and edit it.
  • 3D prefab displayed with an thumbnail in Armory resource explorer when it will have one.

Should Armory make it’s own prefab system better suited for games instead of trying to use Blender work around ?


#2

I don’t know that it makes sense for Armory to have a resource viewer because it has to use Blender to identify and export resources. If Blender had this feature that would be another story, but it depends on being implement that in Blender itself.

I think that Armory should work with Blender and like Blender. If linked proxy objects are not working in Armory, then that is probably just something that needs to be fixed in Armory. Linked proxies work how you are imagining in all other respects right? Where is the failure point for them?


#3

There are add ons out there that actually can do this. In the new kitops add on you create an asset in it’s own blend file complete with children and even animation and the add on shows those pieces in thumbnails. When you insert it into your file it brings in all the parts and even has a predetermined method for Boolean operations on the specific mesh you are working on.

So if we could get a system that you create “prefabs” in a blend file and then in the master file be able to add them,. either in normal append like fashion or dynamically though code or nodes, it would solve a ton of issues. I think the 2 main ones are

  1. the prefab needs to bring in the parent object, all of its children and all of it code (node or haxe)
  2. multiple prefabs with the same name (at least as far as the code is concerned) need to be able to used mostly at run time.

for #2 would a tag like system fix this - where you are looking for a certain property of the object instead of the object itself. multiple objects can have the same property name (say destructible) set to a Boolean at the same time. So you would search from that property on all the objects in consideration instead of the name. therefore the name itself doesn’t matter much.


#4

You might be able to do that with Blender groups. All that would be required, if it isn’t already implemented, would be adding the list of groups that an object is in to the Armory export. That would satisfy any type of “tagging” requirements I think.

If there are addons for this then we should be able to learn from them and how they do it or just integrate Armory with them. That would be great to satisfy a little bit more of the “Game Engine like” UI. :+1:


#5

Here are a couple of examples to look for ideas:



Some of these are paid but I wonder if someone capable of working with this kind of code could ask for some help from these developers and pull off something amazing.


#6

I already tested proxy, they don’t work
1 ) you can only Link or Unlink one child object
2) Blender hierarchy see proxy content, so again Blender won’t accept proxy or prefabs with child object having the same name.

Groups have other use i think, i don’t know if it can used as tags with a name.

yes

Not necessary. In Unreal 4 or Unity, each prefab you drop on the 3D scene is a new instance of the prefab, in the hierarchy these prefabs copy can’t have the same name.
Because each object root node on the hierarchy has a unique name.

Armory need one like those resource explorer :sweat_smile:

About prefab Armory is stuck until it gets it’s own solution.


#7

OK, :thinking: if linked proxies don’t work, have you tried group instances? They don’t have visible children and you might be able to link the group from another blend and create a unique instance of that group in the blend that you are importing it to.

Nothing in blender is going to grab nodes or Haxe from other projects without some customization. :thinking: The closest thing that exists that does that, that I know of, is the modding setup I was working on, but that isn’t quite right in this instance because you have to compile mods separate from the game, and the point is that we want to be able include the contents of the other blend and compile it once in the blend that we are including it into.

This is a pretty difficult one to solve with the differences between the Blender and the “Game Engine” approach. I’m going to do some experimenting for a structure for a moddable game ( just because that is what I’m working on ) and I might find out a little bit of how we might be able to manage imports and other blends. There might be a different way that we are not thinking of that is different that the typical way to do it, but that can still satisfy our needs.


#8

When you append an object from another scene it pulls the material node in. Shouldn’t we be able to pull in at least the nodes. Right now when I append a item with a node tree on it, it shows up as having the trait it just doesn’t pull the actual nodetree with it and you have to reattached it. But it seems like it is within blenders structure to do so.


#9

Oh, that is a good point about the Material nodes. I didn’t think about that. We might be able to look at how it does that.


#10

Same problem, duplicate a group it’s child objects can’t have the same name as the other group child objects.
It’s the way Blender works.

Until we can make some object with hidden content in Blender hierarchy (child objects, traits, particles, animations, materials , sounds) ,prefabs won’t be possible.

I think Lubos is the most appropriate person to know if some solution could be possible or not.