3
$\begingroup$

Is it possible to force uncheck with python the "Relative Path" checkbox in the filebrowser?

$\endgroup$
3
  • $\begingroup$ What do you mean by "force" uncheck? Do you want to write a script that does that? $\endgroup$
    – WhatAMesh
    Sep 12 '18 at 20:26
  • $\begingroup$ Yes with python. Sorry. Should have mentioned that. $\endgroup$
    – tintwotin
    Sep 12 '18 at 20:27
  • $\begingroup$ May be easier after the fact File > External Data > Make All Paths Absolute Than resetting the default of operators such as bpy.ops.image.open(relative_path=False) $\endgroup$
    – batFINGER
    Sep 13 '18 at 10:11
2
$\begingroup$

You need not reinvent the wheel, you can use functions from menu File -> External data -> make all paths relative (absolute). The python code of this comands are:

bpy.ops.file.make_paths_relative()

bpy.ops.file.make_paths_absolute()
$\endgroup$
2
  • $\begingroup$ Thanks. It works well, however using this command causes an error when installing. $\endgroup$
    – tintwotin
    Sep 13 '18 at 6:12
  • $\begingroup$ Accidental relative path when picking a file breaks Python's Pathlib module handling (especially if it is run as a callback) if your prop is a an actual file path chooser therefor this answer is totally useless. It does not answer the original question. $\endgroup$
    – yarun can
    Oct 3 '20 at 2:06
2
$\begingroup$

You can ensure that the path is absolute(which was what I needed to know back in the day) this way:

    import bpy, os
    path = bpy.context.scene.sequence_editor.active_strip.filepath
    path = (os.path.realpath(bpy.path.abspath(path)))
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.