MotionBuilder Forum
Welcome to Autodesk’s MotionBuilder Forums. Share your knowledge, ask questions, and explore popular MotionBuilder topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Merging files with filename

7 REPLIES 7
Reply
Message 1 of 8
trueroofpig
545 Views, 7 Replies

Merging files with filename

I'm trying to merge multiple files through script into a scene file. I need to perform actions on these objects after they are merged. Does anyone know if there is a way to determine what file objects came from after they are merged? Is there is a way to add a namespace or group of the filename to the merged objects?
7 REPLIES 7
Message 2 of 8
Anonymous
in reply to: trueroofpig

I'm not 100% sure I follow what your asking. You need to merge files but you want them to keep the original file name? I know how to merge multiple files in to a scene via a script.

#Import MB python module
from pyfbsdk import *

#Loads application
app = FBApplication()

#Merges file with current scene
app.FileMerge ()

As for adding NameSpace, I haven't looked in to it but I do that when I first prep the file so it come in with that already there.
Message 3 of 8
trueroofpig
in reply to: trueroofpig

Yeah I got that far. I need the object names themselves to contain the filename so I can afterward run a search and perform actions on only those objects that I merged. It sounds like preping the file beforehand is the best you can do.
Message 4 of 8
Anonymous
in reply to: trueroofpig

I'm sure there is a way, give us all time I'm sure someone will come up with a method. I'll see what I can't figure out. You may need to add an input pop up that let's the user define the file name that needs to be used. Then you can also have that added to the file. I know there is a sample script that allows you to select models with name containing substring.
Message 5 of 8
trueroofpig
in reply to: trueroofpig

Cool. Yeah the problem is if you have a bunch of objects in your current fbx scene then you merge another fbx scene, there is no way to distinguish the merged objects from the objects that were already in the file. You can get the filename from a user input but you would still have the problem of not knowing which objects to attach it to.

What you could do is create a temporary namespace for all of the objects in the scene, then merge the file, then look for all the objects without a namespace, then attach the file namespace to those objects, then remove the temporary namespace. Seems like that would work but would be slow.
Message 6 of 8
_KxL_
in reply to: trueroofpig

I can't see any ready to use method. The solution you have presented look ok for me, but I do not know why you what to remove temporary namespaces? Speed of this solution can be reasonable I think, if we can find a good method for find objects without namespace. So it depends if you are intrested only in model or in all kinds of components that can be merged? If only models, we can only check parent models, becouse it's childs will also have same namespace applied.

Hope this will help a little.
Message 7 of 8
trueroofpig
in reply to: trueroofpig

Thanks, thats a good idea. I am dealing with just models. If i could loop through just the root models it would be a lot faster and I could add a namespace to the merged models entire hierarchy. I think ill try that.
Message 8 of 8
CountZr0_1
in reply to: trueroofpig

trueroofpig is on the right track. The only way to distinguish is to tag the already existing objects. Besides namespace you could also use groups or sets.
-jason

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report