KatsBits Community

Game Editing => General Content Creation => Topic started by: silicone_milk on November 08, 2012, 11:47:38 PM

Title: Blender Symlink
Post by: silicone_milk on November 08, 2012, 11:47:38 PM
Hey hey. It's been a while. I'm still alive and kickin.

I wrote a batch file last night after thinking how cool symlinks are in linux and how it would be nice to have them in Windows. Turns out, they DO exist in Windows (7). Excellent stuff.

What are symlinks and why should you care?
 - Symlinks are basically references to files. Think of them as a more advanced shortcut. The difference between a shortcut and a symlink is that applications such as photoshop see symlinks as if they were the actual physical file.
 - Symlinks essentially let you make copies of a file which are actually just pointers to the real file. A file in C:/images/awesome could be a symlink pointing to the actual file which really resides in C:/images/some_other_folder
 - You can have more than one symlink per file. This is amazing for organizing textures/reference photos for things like that image of the worn out yellow brick wall with broken plaster. Now you could have a symlink in a folder called yellow, brick, walls, plaster, dirty_broken and that picture will appear in any of them.

Yes, Adobe Bridge can let you tag images and search through images based on tags. I found that it performed slowly when I still had it installed. Not only that, it costs money which is not something everybody is willing to pay for.

However, symlinks are a bit of a pain in the ass to make as you would typically do it in the command line, one file at a time. I wrote a batch file which lets you select multiple files, right click, and Send To the batch file which will then prompt you for a target folder.

I think it would be an interesting project to extend on this idea and have a built in symlink plugin which will allow you to specify multiple folders during the Save As... process which will then create links in each folder and save the original to the default save folder.

I wanted to know two things first though:
 - Does anything like this exist already?
 - Do any of you see any use for this?
Title: Re: Blender Symlink
Post by: kat on November 09, 2012, 01:35:38 AM
Interesting, sounds more akin to Mac 'Aliases'? And yes there's definitely some potential there, especially where one would otherwise be duplicating assets across multiple project folders (twelve character models all using the same 'eye' texture for example). How does Blender 'see'/'treat' the files? If you symlinked a jpg for example is that file actually seen as a 'jpg' and loaded into the app as such?

What happens if you wanted to texture paint over a file that happened to be a symlink?
Title: Re: Blender Symlink
Post by: silicone_milk on November 09, 2012, 01:47:33 AM
I don't know. I haven't touched a mac in at least a decade.

I haven't checked on Blender, but it should be treating symlinks as regular files. The symlinks will have the app load the file they point to. Same jpg image across multiple project folders is an excellent use-case. However, since symlinks are pointers to a file, editing the original image will cause all symlinks to load that edited original image. (This could be quite handy for mass changes where you want to change a skin texture to a different color across several projects at once?)

The file loaded in the texture painter would be the original file. The symlink, when opened, just dishes up the file it points to.

I'll have to check this out in Blender when I get home from work.
Title: Re: Blender Symlink
Post by: kat on November 09, 2012, 02:31:16 AM
Blender does have the "Append" feature to do something similar (same?). However, I've only ever used it to bring in Blender data (meshes, armatures etc.), never used it on image data or other 'external' (to Blender) material.
Title: Re: Blender Symlink
Post by: silicone_milk on November 10, 2012, 01:38:05 AM
Possibly. Do you know if the Append feature actually duplicates the mesh/blender data into your current project or does it merely reference it?

ie. if you use Append in 2 or more projects and alter the original file that's being appended to these projects, do ALL of the projects update with the latest version of the file?

The main use I see for using this would be in categorizing reference material to search through reams of content with ease.
Title: Re: Blender Symlink
Post by: kat on November 10, 2012, 02:45:00 AM
1) Append loads in a physical copy of the originating data, creating a completely new and independent instance of the parent - this means it can be edited and changed without affecting the original.
2) A Link creates a reference to the original file, the original stays put and is brought in as a dependent datablock - changes in this context will change the original (and vice versa).
Title: Re: Blender Symlink
Post by: silicone_milk on November 12, 2012, 09:14:11 PM
It sounds to me like you can think of a Symlink as the Blender Link option then :)

Title: Re: Blender Symlink
Post by: silicone_milk on April 08, 2013, 11:19:44 PM
Finally got around to writing a C# program that lets you grab multiple files at once and choose a target folder which will make symlinks for every file you've selected in that targeted folder.

It's already been super useful in helping organize my many photo folders  8)