themangosteen / lpy-lsystems-blender-addon

A Blender add-on for Lindenmayer systems (aka L-systems), based on the Boudon et al L-Py library.
GNU General Public License v3.0
29 stars 7 forks source link

Does it support Windows? #2

Open fengchen025 opened 5 years ago

fengchen025 commented 5 years ago

Hi,

I found your project was interesting and useful, especially for people who want to visualize their on l-system sequences.

In your "Readme.txt" file in the l-py file, you mentioned that the "cmake" file lists can only be applied under Linux. Is it possible to make some minor changes of it and then apply to Windows?

Thanks!

themangosteen commented 5 years ago

Hi, I am glad you found it useful! :) The project uses the L-Py library, which is based on C++ and Python; apart from this there is Blender. All of these work on Windows, too, so yes. The adaptations that have been made to the original L-Py code are only tested on Linux. CMake is used to build the L-Py library. The CMakeLists file can definitely be modified to work for a Windows system, however you would have to look into the details, unfortunately I can not provide support for Windows. Kind regards,

fengchen025 commented 5 years ago

Thanks! But if I use the original l-py instead of your adapted version, will it affect the blender add-on?

themangosteen commented 5 years ago

You need to use the adapted version.

The main changes are

You can try to redo these things but I recommend using the adapted version, and trying to make the changes required to make it work on Windows. Mostly it should just be the CMake build files, but as I said I can not help with Windows.

fengchen025 commented 5 years ago

Yeah I will take a look. Thank you so much.


From: Lemurni notifications@github.com Sent: Friday, March 29, 2019 12:56:41 PM To: lemurni/lpy-lsystems-blender-addon Cc: Feng Chen; Author Subject: Re: [lemurni/lpy-lsystems-blender-addon] Does it support Windows? (#2)

You need to use the adapted version.

The main changes are

You can try to redo these things but I recommend using the adapted version, and trying to make the changes required to make it work on Windows. Mostly it should just be the CMake build files, but as I said I can not help with Windows.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/lemurni/lpy-lsystems-blender-addon/issues/2#issuecomment-477987805, or mute the threadhttps://github.com/notifications/unsubscribe-auth/Antss5nnXtexeWw0tYtMn2OtokqdS6Ayks5vbg2JgaJpZM4cQsT5.

themangosteen commented 5 years ago

You're welcome, I hope everything works out well!

LittleCoinCoin commented 4 years ago

Hello there ! @fengchen025 Would you happen to have made any progress on the matter? (@themangosteen nice project indeed, well done! Your thesis is also very clear.)

If not progress were made, I'll try to put my solution here when I find one (since I absolutely need this add-on for my current project)

LittleCoinCoin commented 3 years ago

Hello there! It's been a few months but it was finally time for me to dig into this and I managed to compile for Windows :) I'll write a little tutoriel/demo text on how I did it soon.

themangosteen commented 3 years ago

Hello! I am so happy to hear that! L-Py by Boudon et al. is a wonderful library and I am glad if people can use it in diffrent framework and on different operating systems. A tutorial for Windows sounds wonderful! Thanks!

LittleCoinCoin commented 3 years ago

In the following I describe the steps I went through to build a x64 Release version of the lpy system library that is working with Blender 2.83.10 LTS. These steps should replace the README instructions for Windows machines. I will soon make a pull request in a new branch to add the source files with the modifications described from step 6 to 12. I will also include the library I managed to build (I guess it might directly work for some people). For the info, x86 or Debug version of the library do not seem to work with Blender 2.83.10 LTS (since it moved to x64 builds a few years ago) One warning: I am originally a Python kid so I am far from a “Compilation” Guru. The solution I suggest is the result of many errors that I solved as they were coming. So, there might be a better way to do all this but at least, I got it to work.

I used: • Visual Studio 2017 Community • Python 3.7.6 x64 (downloaded from: https://www.python.org/downloads/ ). The x64 version is needed to compile a x64 version of the LPY library which will be compatible with Blender >2.80. I originally had Python installed with Anaconda but I could not find all the directories I wanted so ended up installing this version separately. • Qt 5.14.2 (I downloaded the free trial to have all the libs and directories needed : https://www.qt.io/download ) • BoostPython 1.72 (downloaded from the official website: https://www.boost.org/users/download/ ) You either download the source or the prebuilt Windows binaries. I personally built the source for the sake of learning. These versions are a bit “old” because I started working on this a few months back, then stopped and got back to it recently. I guess it is possible to use more recent versions for all of them. But, at least be careful that the Python version you use (and therefore Boost Python) is compatible with your Blender version. Otherwise, you might successfully build the library just to realise that it does not work with Blender because of version issues…

  1. Create a new project from source code with Visual Studio
  2. Include the “src” folder from the lpy-lsystems-adapted-ade repo to the newly created project
  3. Let Visual Studio Create the solution. This might take some time.
  4. Exclude de files using the solution explorer window by right clicking the files’ names: a. interpretation.cpp & interpretation.h b. plot.cpp & plot.h c. export_interpretation.cpp d. export_plot.cpp
  5. Open the project properties (Menu “Project” > Properties): a. At the Top of the window, select: i. “Release” for the “Configuration” ii. “x64” for the “Platform” b. In the General panel: i. Target extension: .dll ii. Configuration Type: Dynamic Library (.dll) c. In VC++ Directories, Edit “Include Directories” to add: i. \Python\376_x64\include ii. \boost_1_72_0 iii. \Qt\5.14.2\msvc2017_64\include d. In Linker > General, edit “Additional Library Directories” to add: i. \Python\376_x64\tcl ii. \Python\376_x64\libs iii. \Python\376_x64\Lib iv. \Python\376_x64\DLLs v. \boost_1_72_0\stage\lib vi. \Qt\5.14.2\msvc2017_64\bin vii. \Qt\5.14.2\msvc2017_64\lib e. In Linker > Input, Edit “Additional Dependencies” to add: i. Qt5Core.lib
  6. In the file tools_config.h, uncomment the macro “TOOLS_MAKEDLL”
  7. In the file math_config.h, uncomment the macro “PGLMATH_MAKEDLL”
  8. In the file lpy_config.h, uncomment the macro “LPY_MAKEDLL”
  9. In the file util_maht.h comment the “rint” and “trunc” functions (they are only valid for x86 builds)
  10. In the file util_string.h, overload the “number” function with the “size_t” type (Basically copy paste on the other definitions and just change the type of the argument). Not doing it generated errors on x64 builds attempts.
  11. In the file lsystem.h use the macro LPY_NO_PLANTGL_INTERPRETATION to exclude the compilation of the code between lines 157 and 175 (basically add “#ifndef LPY_NO_PLANTGL_INTERPRETATION” at line 156 and “#endif” at line 176).
  12. Add the macro BOOST_PYTHON_STATIC_LIB before the “#include” directives in all the following .cpp files (I never managed to use the static boost libraries although there should be a way…but I got tired so I resorted to this): a. Axialtree b. consider c. Compilation d. Export_consider e. Export_debugger f. Export_lsyscontext g. Export_lsysoptions h. Export_lsysrule i. Export_lsystem j. Export_module k. Export_moduleclass l. Export_nodemodule m. Export_parser n. Export_patternmodule o. Export_patternstring p. Export_stringmatching q. lpy_axialtree r. lpy_parser s. lstringmatcher t. lsyscontext u. lsysrule v. lsystem w. lsystems_wrapper x. matching y. module z. moduleclass aa. modulevtable bb. nodemodule cc. paramproduction dd. patternmodule ee. patternstring
  13. Hit “Build Solution” in the Build menu
  14. Let it do its stuff (pray if you think it helps). I had a lot of warnings even for the version that worked fine in the end so just overlook those.
  15. Rename the generated .dll to “lpy.pyd”: this exact name is important! (The generated .dll should be available in the x64 folder at the root of your project).
  16. Check that “lpy.pyd” loads well with the Python you used for the compilation (just write “import lpy” in a script saved in a directory containing a copy of “lpy.pyd”)
  17. If you passed step 16 then copy “lpy.pyd” in \Blender_2.83.10_LTS\2.83\scripts\modules. Don’t forget to also include the lindenmaker add-on compatible with Blender >2.80 in the directory \Blender_2.83.10_LTS\2.83\scripts\addons\lindenmaker (see the pull requests to have the updated code)
  18. Have Fun! :-D
themangosteen commented 3 years ago

I have gladly merged the Windows build files by LittleCoinCoin. The above is in the Readme in the Windows directory. Thank you!

you651 commented 3 years ago

Thanks for this amazing add-on, It would be very helpful for beginners in this field. But I feel Its a cumbersome process as explained for the windows ,it would be of great help if you guys could make a tutorial video or a more explanatory text for this.

LittleCoinCoin commented 3 years ago

Hello, Sorry for the late answer. I understand the process to use the add-on can be rather frightening. It took me some time but I am currently preparing a Tutorial video about my recent research and that will include a section on how you can setup the L-Py add-on on a Windows machine. I was not thinking of showing how I built the DLL though; rather just showing that you can directly use the lpy.pyd that I built with Blender 2.83.X. Would that be alright? Or do anyone think a demonstration of the build is also necessary?

you651 commented 3 years ago

Glad that you responded :) That alone would be very useful I am currently working on my research and it would be of great help if you do it sooner, if you have time you can add full demonstration later. Kindly provide the link here also so that everyone stuck in this process can be benifitted. Thanks in advance!

BriacNaux commented 2 years ago

Hey, I want to install and use the add on on blender but i have some trouble to make every stop of readme files. (i am completely new to visual studio and python). I don't understand how you include the src folder in an existing project in vs 2017 and run a solution. I hope some one here will see this lol, Best regards (this project is amazing).

Owuraqu commented 1 year ago

Hello,

Sorry for the late answer. I understand the process to use the add-on can be rather frightening.

It took me some time but I am currently preparing a Tutorial video about my recent research and that will include a section on how you can setup the L-Py add-on on a Windows machine.

I was not thinking of showing how I built the DLL though; rather just showing that you can directly use the lpy.pyd that I built with Blender 2.83.X. Would that be alright? Or do anyone think a demonstration of the build is also necessary?

Please where can I find the tutorial video. I'm doing a research and the video tutorial would really help since following up with the text is really challenging. Also I'm using Blender 3.xxx and I don't know if the workflow has changed.

LittleCoinCoin commented 1 year ago

Hello, I am so sorry @BriacNaux @Owuraqu I'm only seeing your comments now. Unfortunately, I graduated, started a job, then started my PhD and I never found the time to actually make the video 😞 (believe me, it is a weight on my conscience)

Have you made progress? I am willing to help but I cannot spend 20-40h on making a clean video anytime soon...

If you can download exactly version 2.83 of Blender (https://download.blender.org/release/) I am pretty sure, you don't need to care about the visual studio stuff. You can just do step 17 with the dll I originally built (https://github.com/themangosteen/lpy-lsystems-blender-addon/tree/master/lpy-lsystems-adapted-windows/x64/Release).