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
    Commented Sep 12, 2018 at 20:26
  • $\begingroup$ Yes with python. Sorry. Should have mentioned that. $\endgroup$
    – tintwotin
    Commented Sep 12, 2018 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
    Commented Sep 13, 2018 at 10:11

2 Answers 2

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
    Commented Sep 13, 2018 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
    Commented Oct 3, 2020 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$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .