[Bf-committers] relative and absolute paths proposal

Bassam Kurdali bkurdali at freefactory.org
Mon Dec 7 20:55:11 CET 2009


Please be patient with me for mailing the committers list.

Working here on projects with others (and occasionaly just alone) one of
the frequent irritations is accidentally saving with absolute paths and
having to fix- it is almost always easy to fix, so not a 'big deal', but
still. Making relative paths the default would help, but I think it's
possible to get rid of the option entirely while keeping the
functionality of both:

For each reference file store the entire (absolute) path to the file
(blend, image, movie, etc..). But also store the file path of the main
blend file:
reference file path = 'theirpath'
main blend file path = 'mypath'

That way you have both absolute data and relative data.(you can get
relative by comparing the two)

 If the file has not been saved yet, just store 'theirpath', and set a
flag to check and save 'mypath' on file save.

On retrieving files (on file open) first check the 'mypath' and compare
it to the current path, there are two possible outcomes:

1- current path is the same as 'mypath', in this case 'absolute' or
'relative' is the same thing, just open the file if it is there.

2- current path is different from 'mypath': then do the following
checks:

a-look for the reference file at the 'absolute' location. If it's there,
then that means just the main file was moved. if it's not there:

b-look for the reference file at the 'relative' location (which can be
gotten from comparing the mypath and theirpath strings), if it works,
that means the entire project has been moved. If it fails:

c- then we really can't find the file, and the user gets an error or
warning that a reference was lost.

addendum: it's probably possible to do smarter things, this is just an
idea.
cheers
Bassam






More information about the Bf-committers mailing list