Notifications
Clear all

[Closed] Keeping track of merged objects

Is there anyway to tell where a file has been merged from, say long after it has been merged?

I ask because i have have a tool that currently stores up to 8 objects, and then can place them as Xref objects or as Mesh objects on a given node. The way our current engine runs is that it is best to have instances if an identical object is already in the scene…so my script looks for existing copies before it places the objects.

The problem I run into is when objects are named the same or very similar. I have this problem solved with Xref objects by looking at the .filename of the objects and comparing them.

The problem i am running into is when placing as a mesh. I have, to my knowledge, really no way to compare the objects. I was thinking i could look at the location of the material…but then i would have to merge in the object first before i could check the material location, and this just seems like extra calculations for me that i’d rather not add.

Does anyone have any suggestions on how to proceed, or has anyone come across this problem before?

Thanks

3 Replies

If you use a callback on the way in, you could storethe value and retreive it later:

fn addOriginalDirectoryUserProp =
	(
	for obj in (getCurrentSelection()) do setUserProp obj "original_directory" sysInfo.currentdir
	)
	
callbacks.removeScripts id:#cbAddOriginalDirectoryUserProp
callbacks.addScript #filePostMerge "addOriginalDirectoryUserProp()" id:#cbAddOriginalDirectoryUserProp

Is that what you’re after?

I had thought of doing something like that…but we use userproperties in our engine, so if it doesn’t recognize something it could possibly crash the game. So unfortunately thats out. 🙁

Custom attribute then…