Page 1 of 1

pysideluxcoredemo "did not match C++ signature" [Solved]

Posted: Wed Dec 29, 2021 4:25 am
by opoppopopp
I use compiled binary from "luxcorerender-v2.6-win64-sdk.zip"
Other samples all works fine, only this one reports follow error:

Code: Select all

  File "\luxcorerender-v2.6-win64-sdk\samples\pysideluxcoredemo\pysideluxcoredemo.py", line 56, in __init__
    self.scene = pyluxcore.Scene(props.Get("scene.file").GetString(),
Boost.Python.ArgumentError: Python argument types in
    Scene.__init__(Scene, str, float)
did not match C++ signature:
    __init__(struct _object * __ptr64, class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)
    __init__(struct _object * __ptr64, class luxrays::Properties)
    __init__(struct _object * __ptr64, class luxrays::Properties, class luxrays::Properties * __ptr64)
    __init__(struct _object * __ptr64)

Re: pysideluxcoredemo "did not match C++ signature"

Posted: Wed Dec 29, 2021 3:17 pm
by Dade
This is a bug in pysideluxcoredemo: the code has not been updated to accomodate some recent change.

You have just to edit the following line:

Code: Select all

		self.scene = pyluxcore.Scene(props.Get("scene.file").GetString(),
			props.Get("images.scale", [1.0]).GetFloat())
in:

Code: Select all

		self.scene = pyluxcore.Scene(props.Get("scene.file").GetString())
and it will work.

Re: pysideluxcoredemo "did not match C++ signature"

Posted: Wed Dec 29, 2021 7:51 pm
by opoppopopp
Thanks, problem solved :D

Will I need to use the C++ API reference document for Python pyLuxcore ? seems the latest C++ document version is 2.1 ?
(Sorry I don't have enough C++ experience)

e.g. for this error, I have lookup the C++ document yesterday, and seeing all those constructor need that "imageScale" parameter.
static Scene * Create (const float imageScale=1.f)
static Scene * Create (const luxrays::Properties &props, const float imageScale=1.f)
static Scene * Create (const std::string &fileName, const float imageScale=1.f)
and header file luxcore.h, in 2.6 SDK seems altered as you said:
static Scene *Create (const luxrays::Properties *resizePolicyProps = nullptr);
static Scene *Create (const luxrays::Properties &props, const luxrays::Properties *resizePolicyProps = nullptr);
static Scene *Create (const std::string &fileName, const luxrays::Properties *resizePolicyProps = nullptr);

Re: pysideluxcoredemo "did not match C++ signature"

Posted: Wed Dec 29, 2021 10:17 pm
by Dade
opoppopopp wrote: Wed Dec 29, 2021 7:51 pm Will I need to use the C++ API reference document for Python pyLuxcore ? seems the latest C++ document version is 2.1 ?
(Sorry I don't have enough C++ experience)
Documentation is imbedded in C++ header source code (inside comments): https://github.com/LuxCoreRender/LuxCor ... ore.h#L790

It can be extracted with a tool called Doxygen however the comments should be pretty easy to read even without Doxygen.

Python API doesn't have a specific documentation but it, pretty much, matches one to one the C++ API.
opoppopopp wrote: Wed Dec 29, 2021 7:51 pm e.g. for this error, I have lookup the C++ document yesterday, and seeing all those constructor need that "imageScale" parameter.
static Scene * Create (const float imageScale=1.f)
static Scene * Create (const luxrays::Properties &props, const float imageScale=1.f)
static Scene * Create (const std::string &fileName, const float imageScale=1.f)
and header file luxcore.h, in 2.6 SDK seems altered as you said:
static Scene *Create (const luxrays::Properties *resizePolicyProps = nullptr);
static Scene *Create (const luxrays::Properties &props, const luxrays::Properties *resizePolicyProps = nullptr);
static Scene *Create (const std::string &fileName, const luxrays::Properties *resizePolicyProps = nullptr);
Yes, the API has changed since v2.1 (v2.1 is very old now). It has been extended to support this: viewtopic.php?f=5&t=3691

Re: pysideluxcoredemo "did not match C++ signature"

Posted: Mon Jan 03, 2022 6:27 pm
by opoppopopp
Dade wrote: Wed Dec 29, 2021 10:17 pm Documentation is imbedded in C++ header source code (inside comments): https://github.com/LuxCoreRender/LuxCor ... ore.h#L790
Python API doesn't have a specific documentation but it, pretty much, matches one to one the C++ API.
a humble question... ;)
I want to change path of output.
e.g. follow line in pyluxcoredemo.py

Code: Select all

session.GetFilm().Save()
this .Save() is equal to which one in the C++?
According to the C++ header file, seems Film Class don't have a "Save()" method instead of SaveOutput() SaveFilm() etc.

Re: pysideluxcoredemo "did not match C++ signature" [Solved]

Posted: Mon Jan 03, 2022 9:14 pm
by Dade
Python "Save()" is like C++/Python "SaveOutputs()". It is an old deprecated method replaced by the new one. You can define in the RenderConfig (or the .cfg) the list of outputs/AOVs to save.

You can use "SaveOutput()" (note the lack of "s") to explicitly define a file name to save.