Dumping all scene parameters + all objects from BlendLuxCore and use them in LuxCore

Use this forum for general user support and related questions.
Forum rules
Please upload a testscene that allows developers to reproduce the problem, and attach some images.
Post Reply
pro
Posts: 23
Joined: Wed Dec 12, 2018 7:48 am

Dumping all scene parameters + all objects from BlendLuxCore and use them in LuxCore

Post by pro »

Hi,
I would like to dump all the necessary variables and scene objects from BlendLuxCore to recreate the same scene directly in LuxCore (I want to develop only C++ part but prototype scenes/camera positions inside Blender). I would need to automatically generate .cfg and .scn files with all necessary objects (meshes etc.) exported and linked inside .cfg/.scn. I guess the only supported type for meshes in LuxCore is ".ply"? What I did so far was setting these lines in the BlendLuxCore\export\__init__.py inside create_session() function. This gives me many parameters that are passed from BlendLuxCore to LuxCore:

Code: Select all

        f = open("scene_description.txt", "w")
        f.write(self.camera_cache.props.ToString())
        f.write(world_props.ToString())
        f.write(scene_props.ToString())
        f.write(config_props.ToString())
        f.write(halt_props.ToString())
        f.close()
Now I'm facing the problem that in "scene_description.txt" there are many references given without "physical" files (as LuxCore probably needs them). How could I export all the needed mesh objects and reference/link them in exported configuration file.
A practical description of what I want to achieve is also presented below: when dumping variables in textfile, only Blender references are given for meshes as:

scene.objects.Mesh_Plane__001_2236770689416000.material = "Surface_ground_2236777733064"
scene.objects.Mesh_Plane__001_2236770689416000.shape = "Mesh-Mesh_Plane__001_2236770689416000"
scene.objects.Mesh_Plane__001_2236770689416000.camerainvisible = 0

How to export meshes as .ply (or are there also other supported types in C++ core) and also other objects accessible inside Blender, and link them in "scene_description.txt, so I will be able to render the same scene without using Blender?

Thank you very much for your valuable time and your answer!
User avatar
B.Y.O.B.
Developer
Developer
Posts: 4146
Joined: Mon Dec 04, 2017 10:08 pm
Location: Germany
Contact:

Re: Dumping all scene parameters + all objects from BlendLuxCore and use them in LuxCore

Post by B.Y.O.B. »

The filesaver engine was written for exactly this purpose.
You can enable it in the config settings.
For your purpose you should switch the mode from binary to text.
You will get PLY meshes, cfg and scn. The cfg file can be loaded into luxcoreui directly.
Attachments
2019-02-06_16-18-16.png
pro
Posts: 23
Joined: Wed Dec 12, 2018 7:48 am

Re: Dumping all scene parameters + all objects from BlendLuxCore and use them in LuxCore

Post by pro »

B.Y.O.B. wrote: Wed Feb 06, 2019 3:19 pm The filesaver engine was written for exactly this purpose.
You can enable it in the config settings.
For your purpose you should switch the mode from binary to text.
You will get PLY meshes, cfg and scn. The cfg file can be loaded into luxcoreui directly.
Thank you, that's great :D
Post Reply