User:Paradox-01/Blender/Research: Difference between revisions

m
link fix; not sure if this addon is gone in Blender 4.2, but the docs page for it sure is
mNo edit summary
m (link fix; not sure if this addon is gone in Blender 4.2, but the docs page for it sure is)
 
(5 intermediate revisions by 2 users not shown)
Line 145: Line 145:
Reading for later:
Reading for later:


* https://docs.blender.org/manual/en/latest/addons/interface/context_menu.html
* https://docs.blender.org/manual/en/4.1/addons/interface/context_menu.html#dynamic-context-menu
* https://blenderartists.org/t/context-sensitive-menu-in-blender/515689
* https://blenderartists.org/t/context-sensitive-menu-in-blender/515689


Line 151: Line 151:


==Build Blender==
==Build Blender==
  https://wiki.blender.org/wiki/Building_Blender
  https://developer.blender.org/docs/handbook/building_blender/
  https://wiki.blender.org/wiki/Building_Blender/Windows
  https://developer.blender.org/docs/handbook/building_blender/windows/


* https://www.youtube.com/watch?v=eCvuQHlKPEk
* https://www.youtube.com/watch?v=eCvuQHlKPEk
Line 162: Line 162:
(re)build, the first build takes a couple of good minutes, further builds take about a minute
(re)build, the first build takes a couple of good minutes, further builds take about a minute
  make
  make
Final executable will be saved to
C:\blender-git\build_windows_Full_x64_vc17_Release\bin\Debug
If there is not enough disk space this fails almost silently. (Progress visible in CMD will simply stop.)


==Build Blender with Visual Studio==
==Build Blender with Visual Studio==
Line 190: Line 195:
system(processFile); could be used but then Blender hangs until the child has process finished.
system(processFile); could be used but then Blender hangs until the child has process finished.


Therefore let's use [https://docs.microsoft.com/de-de/windows/win32/procthread/creating-processes CreateProcess].
Therefore let's use [https://learn.microsoft.com/de-de/windows/win32/procthread/creating-processes CreateProcess].


  #include <windows.h> // CreateProcess
  #include <windows.h> // CreateProcess
Line 239: Line 244:
             // C (context) looks like some crazy voodoo, this shouldn't even work right now, but it does
             // C (context) looks like some crazy voodoo, this shouldn't even work right now, but it does
             // for Blender specific stuff a context is needed otherwise the program will crash
             // for Blender specific stuff a context is needed otherwise the program will crash
             // https://wiki.blender.org/wiki/Source/Architecture/Context
             // https://developer.blender.org/docs/features/core/context/
             bool ok;
             bool ok;
             ok = BPY_run_filepath(C, fn, NULL);
             ok = BPY_run_filepath(C, fn, NULL);
Line 252: Line 257:
2) research path reading in C (get folder/file/extension) so own exe can use relative path when it is placed alongside Blender
2) research path reading in C (get folder/file/extension) so own exe can use relative path when it is placed alongside Blender


3) research Blender import and let the exe decide what py script to use (for example ONCC*.oni -> import_ONCC.py)
3) '''Looks like [https://stackoverflow.com/questions/36360876/how-do-i-run-a-python-script-using-an-already-running-blender Blender cannot accept new inputs?]''' <span style="font-size:16pt;">ರ_ರ .................. (ノಠ益ಠ)ノ彡┻━┻</span>
<s>blender --background --python myscript.py</s>
https://blender.stackexchange.com/questions/1365/how-can-i-run-blender-from-command-line-or-a-python-script-without-opening-a-gui
 
:: Edit: Then again ... '''Looks like [https://stackoverflow.com/questions/36360876/how-do-i-run-a-python-script-using-an-already-running-blender Blender cannot accept new inputs?]''' <span style="font-size:16pt;">ರ_ರ .................. (ノಠ益ಠ)ノ彡┻━┻</span>


::: '''That would mean we either have to bite the sour apple and write much more C <s>or do less with a workaround</s>.'''
This means some part of the analysis has to be done in C.


4) Deciding how to distribute this Blender variant.
4) Deciding how to distribute this Blender variant.
Line 278: Line 279:


* Pipe communication.
* Pipe communication.
[[Category:Userspace]]