1
$\begingroup$

I'm creating a game, and my intention is to create a code that can run in the Standalone-Player, since I want a way to distribute it to him. Aafter creating my codes all related to the BPY module, I realized that when running in the "Standalone-Player" the code doesn't work, due to the lack of BPY support at runtime. A research showed me that it's very unlikely to use it in a "trivial" way with the "Standalone-Player".

My problem arises with the listing of some "resources" of the file itself, and I can't find a way to access it through the BGE module.

e.g. A way to list all scenes in the file that are not yet activated:

(since bge.logic.getSceneList() only returns scenes that are already active)

        # CONFIG VIDEO
        # call its asigned before as a scene actuator 
        # c = python controller

    if str(mo.hitObject) == 'Config_BT3':
        # OPEN OVERLAY CONFIG -> VIDEO
        VID = bpy.data.scenes['Main_MENU_VIDEO_CONFIG'] # <-- **HERE IS THE DEAL**
        #Assing Scene to Load and Call him
        call.scene = VID.name 
        c.activate(call) 
$\endgroup$
1
  • $\begingroup$ UPBGE +0.3 can run BPY realtime, entirely. $\endgroup$
    – RPaladin
    Commented Jan 4, 2022 at 19:16

1 Answer 1

0
$\begingroup$

bge.types.KX_Scene objects are created on runtime and represent active scenes. Inactive scenes aren't loaded into memory beforehand and therefore aren't available to the BGE until loaded in using the Scene actuator or bge.logic.AddScene(). The code in these that loads scenes is implemented within the BGE source and is not accessible via the Python API. You will just have to maintain a list of valid scene names and manage them manually.

If you really need a list of the resources, you could have the data stored by the BPY API before you export out your application. You can make a short script that maintains a .txt or .json that represents the static data you want to have about your game.

Another possible option is switching to UPBGE, which IIRC allows for use of bpy data.

$\endgroup$

You must log in to answer this question.

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