Apending and Namespaces

In some applications, such as Maya and Motionbuilder that come to mind, there is the process of namespaces.

For anyone does not know about this, in the case you have an established naming convention such as for materials and images like: body, legs, dress, etc. and you have a good reason to keep that consistent for other production reasons, and you don’t want to create images and materials such as “character_name_legs”, and you then import multiple characters into a scene, you can have the option of automatically creating namespaces which would supply the name of the file (or one you provide on import) such as “character_name” and it automatically creates a prefix, “character_name_” before any of your objects or materials and images.

I can’t find anything about this, I wonder if there is an addon or script, or something I am missing?

Think about what namespaces are made for; you already explained it yourself.

My search on “blender rename object on import” gives me fro example:
(Solved) Rename Object After Import right here on BA.

Thanks for making that search.

That is part of the idea. (from what I can see and read - I am not a python scrip guru)

It originates in programing I think:

So think of namespaces as families of “Objects”. But in the Blender definition of what an Object is, not strictly importing, stl, or obj. And this use case has more to do with appending than anything.And also it has to be applicable to any asset such as Materials and Images.

And it is not renaming - exactly. You can remove a namespace and the original name is intact. (look at the Maya example). It is more of a prefix appendage to the name to separate it as a family. Now technically in Blender this might be that it has to be actually renamed. This is something I am not sure about.

The correlation to programing and scripts is that as your projects grow, especially working with teams, the need to keeps items of a similar class - and with the same names - separated. As well as easily identifiable. Not simply a .001 extension.

In my particular use case, we have a lot of objects of a particular class that we are required to export to a game engine with the same naming convention.

For example:

tool_name (file name/collection name)

-tool_jaw
-tool_wrist
-tool_base

and so on.

And materials and images with names such as:

Images:

tool_jaw_base_color
tool_jaw_metallic

Materials"

tool_jaw
tool_base

and so on

A name space could be applied on import for example:

tool_name_tool_jaw
tool_name_tool_jaw_metallic

Or it could be managed within Blender with an interface similar to the one for Maya.

Our use case is to bring more than one asset into a scene and render and/or animate without linking. Same assets we also send to the programmers for use in Unity. With dozens of files and literally thousands of images, this can be problematic to keep duplicates for multiple use cases.

And this is one way that namespaces can come in handy.

I was unable to find an add-on that does this. Seems like it would be possible to make one.

I know the concept of name spaces and as far as i know blender doesn’t have a name space system yet and both links to Maya and Unity say nothing about using those to import or export (just selecting by/using) in any way.
So i was trying to give you a possible (other) direction to look for.
What i was implying by what you wrote, was that you while importing assets wanna asign a namespace. And yes, a namespace system can asign an additional name and you can for example export objects by even different namespaces.

Now you are talking about exporting and asign a namespace and only then you are explain your use case…

Our use case is to bring more than one asset into a scene and render and/or animate without linking.

?? And with namespaces the solution would be what? (Well what’s the problem anyway?)

Same assets we also send to the programmers for use in Unity.

Idk what you use to export to unity, but the export-addon has also to respect the namespace.
I even don’t understand fully your problem and why it could be solved only by namespaces, i mean you have to follow some naming conventions while using namespaces and the addons have to be able and to be adjusted to use them in the way you want to name your objects (upper/lowercase-_+ instead of space etc.).

And naming conventions can’t be used to categories your object?
And group them or put them into collection (did’nt use them to much yet)?

Again a tip: maybe some renaming tool or batch import/export (ex. FBX-Bundle? batch export) (using groups / collections/ custom properties?) could do the trick.

Just a little clarification, that might help understand the original question.

To simplify. We have two use cases. One is to export to Unity or Unreal Engine. You don’t need to worry about namespaces there. Because you simply import the fbx and when you add that to the scene and/or make a prefab, Unity can handle objects of the same names across prefabs/game objects in a scene.

For example:

object_name1
part_name1
part_name2

object_name2
part_name1
part_name2

No problem. Unity can handle this. Image and material names are always under a folder hierarchy for that asset. Again no issues. Unity can handle it.

So we have months or even a years worth of work with multiple objects and images and materials set up in Blender and in Unity. No probs. Each new asset in a separate Blender file, and exported to Unity over time - months or years one at a time. That work flow is designed only to work with my programmers in Unity. No probs.

Now we decide to make a compilation render in Blender to show off what we have done - in Blender - using multiple assets in one scene.

Now these become:

object_name1
part_name1
part_name2

object_name2
part_name1.001
part_name2.002

Same with materials and images.

FYI both Maya and MotionBuilder also have options to apply namespaces in import, as well as manage them in a file.

Maya:

MotionBuilder (since .fbx in native it is considered merging)

So back to the simple question. Blender has name spaces or it doesn’t. My use case is not too dissimilar to using them in other apps. It is for this kind of scenario that namespaces exist, which is why I asked.

Anyone know of an addon?

(Don’t know why i wasn’t notified that there was an answer.)

The screenshot for maya shows that you can choose a namespace on import, which you wanna achieve (shown in your example). And the structuring of a name like:

  • object_name1.part_name1
  • object_name1.part_name2

is a possible implementation of a namespace.
This would be:

(An other example would be Internet URL’s like Apending and Namespaces - #5 by Richard_Culver. Or in programming in java: System.out.println(“Hello world.”))

A namespace system with this implementation could handle something like changing namespace for

So mabe we are just (what is the english saying?) talking at cross purposes or we have our wires crossed??

Hi there. i think i bump into some problem with this.

Surface deform might got broken when the original mesh name got renamed because there’s multiple object with same name. for example, i have object that targets “head_mesh”. then in the animation scene file, te targets broken because it still use “head_mesh” as target, but the object got renamed to “head_mesh.001”

This has to do more with a quick implementation of a feature which has to be improved than namespaces. That’s seems to be a problem sometimes in blender references are made by typing the name (and this seems to be stored as string), better would be no text input (only for search) and just selecting out of a given list. So if the name is changed the references in other parts aren’t. (For example in shader editor you can name new AOV outputs but they aren’t put into a AOV list and you have to put the names into Passes → Shader AOV by name and they are not selectable from the list, so wrong name: no reference.)

Could you unpack that a little more and explain your set up and workflow.

What do you mean by “animation scene file”?

You have not really explained how you got two objects with the same name.


Thanks for the replies!

Animation Scene File is a file that contains assets link files, that would be library overridden and being animated in the scene file. So whenever there’s an error, we would only edit certain asset files, then updates all Animation Scene Files across episodes.

For example, i have character named “Rina”, and it’s mesh originally has surface deform, connected to “head_facial_skinning_GEO”

If i use 2 same asset link, the second library override would still use the same target, which is “head_facial_skinning_GEO”, while the second link should use “head_facial_skinning_GEO.001”

this would occurs rather occasionally, but always occurs when i try to reload the link from “blender file” tab in outliner, after doing some edits.

Thanks.

image
Well, just quick question. How do we do asset linking in blender? because if i do the same like in Maya, it becomes like this. Usually we would use same object name in every asset, because well, in all my experiece i would never encounter any workflow/pipeline do otherwise

Without Namespaces or prefix, all asset in animation file becomes very messy. Only renaming the upper collection would not do justice, because the object’s below still got renamed. We would not add any naming prefixes in the asset, it would cause a lot of problems especially human errors.

In Maya, I always make some modules to process information about what assets has been linked in animation scene file, which heavily uses Namespaces to determine which asset is which, what type of asset, what objects contained in this asset etc. Then i can use these informaton to make quick asset LOD replace tools for example.

I’m not quite sure how we would done it in blender without Namespace and Prefix?

Thanks for the explanation. I figured it was linking but you did not specify.

Linking has other challenges for sure.

One thing to keep in mind is the way that Blender handles certain data. It keeps it around in the file until you close. This can explain the “reload link” issue because it reloads it and sees the other data block hanging around and has to rename the “new” one.

Just a small tip here. Reload by saving then closing and opening the scene for best results.

Regarding Namespaces, I don’t have a good answer now.