0
$\begingroup$

I'm working on render engine which need to select binary executable file for working engine properly but I would like to include that binary executable file inside my addon (e.g.: <my_addon\bin\engine.exe>) and post relative path to that exe file via addon istelf not as "Select path to exe file"-like method. By default for selecting path to exe file is works like this on my addon:

exe_bin_dir: bpy.props.StringProperty(name="",
                                             description="",
                                             default=util.switchpath(tempfile.gettempdir())+'/',

There is "util.switchpath" not by default, it does mean it takes "switchpath" defined operator from inside "util.py" file and pin here.

So, my question is how to code for make default path to my addon like for example:

exe_bin_dir: bpy.props.StringProperty(name="",
                                         description="",
                                         default="./<my_addon/bin/engine.exe>"

What am I must overwrite here on three dots?

"default=..."
$\endgroup$
9
  • $\begingroup$ Why would the render engine be an exe file? $\endgroup$
    – TheLabCat
    Commented Feb 24, 2023 at 17:13
  • $\begingroup$ The addon itself is an exporter which export scene and then it will open with that executable file as command line method. Otherwise the addon itself cannot do the job without the exe file. $\endgroup$ Commented Feb 24, 2023 at 17:28
  • $\begingroup$ You didn’t explain why the render engine needs to be a separate executable file. $\endgroup$
    – TheLabCat
    Commented Feb 24, 2023 at 18:17
  • $\begingroup$ The engine is not exe file. The engine itself binary exe file which has core inside it pre-compiled. My addon is exporter and render scenes via exporter as geometries and naterials and finally render it inside Blender by using that exe file command-line mode. $\endgroup$ Commented Feb 24, 2023 at 19:13
  • $\begingroup$ What engine are you using that you only have access to as an executable? $\endgroup$
    – TheLabCat
    Commented Feb 24, 2023 at 19:30

1 Answer 1

0
$\begingroup$

I solved my problem with this method:

curentDirectory = os.path.abspath(os.path.dirname(__file__))


class EngineRenderSettings(bpy.types.PropertyGroup):

exe_bin_dir: bpy.props.StringProperty(name="",
                                         description="",
                                         default=os.path.join(os.path.dirname(curentDirectory), 'bin'),
                                         subtype='DIR_PATH')
$\endgroup$

You must log in to answer this question.

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