Area :: Header
Discover the Difference with
3ds Max 2015
Upgrade now and save
Discussion Groups

Python

Reply
Active Member
trueroofpig
Posts: 9
Registered: ‎01-21-2008

Merging files with filename

74 Views, 7 Replies
01-21-2008 06:53 PM
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?
Please use plain text.
Valued Contributor
Kdiaz01_1
Posts: 87
Registered: ‎03-06-2007

Re: Merging files with filename

01-21-2008 07:30 PM 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.
The way to get started is to quit talking and begin doing.
~Walt Disney
Please use plain text.
Active Member
trueroofpig
Posts: 9
Registered: ‎01-21-2008

Re: Merging files with filename

01-21-2008 09:40 PM 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.
Please use plain text.
Valued Contributor
Kdiaz01_1
Posts: 87
Registered: ‎03-06-2007

Re: Merging files with filename

01-22-2008 07:21 PM 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.
The way to get started is to quit talking and begin doing.
~Walt Disney
Please use plain text.
Active Member
trueroofpig
Posts: 9
Registered: ‎01-21-2008

Re: Merging files with filename

01-22-2008 08:42 PM 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.
Please use plain text.
Distinguished Contributor
_KxL_
Posts: 414
Registered: ‎08-23-2006

Re: Merging files with filename

01-22-2008 09:03 PM 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.
Please use plain text.
Active Member
trueroofpig
Posts: 9
Registered: ‎01-21-2008

Re: Merging files with filename

01-22-2008 10:40 PM 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.
Please use plain text.
Valued Contributor
CountZr0_1
Posts: 66
Registered: ‎08-22-2006

Re: Merging files with filename

01-23-2008 03:47 PM 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
Please use plain text.