|
|
|
Tell us what you think of the site.
|
Autodesk Media & Entertainment User Community
|
Autodesk® 3ds Max®
|
|
Autodesk® Maya®
|
|
Autodesk® Softimage®
|
|
Autodesk® MotionBuilder®
|
|
Autodesk® Mudbox™
|
|
Autodesk® ImageModeler™
|
|
Autodesk® Sketchbook® Pro
|
|
Autodesk® Smoke on Mac®
|
|
Autodesk® Entertainment Creation Suite Ultimate®
|
| 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?
|
|
|
|
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.
The way to get started is to quit talking and begin doing.
~Walt Disney
|
|
|
|
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.
|
|
|
|
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.
The way to get started is to quit talking and begin doing.
~Walt Disney
|
|
|
|
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.
|
|
|
|
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.
|
|
|
|
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.
|
|
|
|
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
|
|
|
|
|
|