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

Use this forum for general user support and related questions.
Post Reply
pro
Posts: 22
Joined: Wed Dec 12, 2018 7:48 am

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

Post by pro » Wed Feb 06, 2019 3:10 pm

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: 2506
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. » 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.
Attachments
2019-02-06_16-18-16.png
Support LuxCoreRender project with salts and bounties

pro
Posts: 22
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 » Wed Feb 06, 2019 3:34 pm

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