19,587
edits
Paradox-01 (talk | contribs) 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) |
||
(14 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
C:\Program Files\Blender Foundation | C:\Program Files\Blender Foundation | ||
where each bigger version gets its own folder | where each bigger version gets its own folder | ||
... | |||
Blender 3.1 | Blender 3.1 | ||
Blender 2.93 | Blender 2.93 | ||
Blender 2.83 | Blender 2.83 | ||
= | <span style="font-size: 32pt;">'''Blender horror reloaded'''</span> | ||
==Random session #1== | |||
===Script log=== | |||
Almost all actions in Blender get logged. You need to '''open the "info" window''' to see it. | Almost all actions in Blender get logged. You need to '''open the "info" window''' to see it. | ||
bpy.ops.mesh.primitive_cube_add(size=2, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1)) | bpy.ops.mesh.primitive_cube_add(size=2, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1)) | ||
===Python console=== | |||
Logged commands can be copied into the python console. Press enter key to execute. | Logged commands can be copied into the python console. Press enter key to execute. | ||
Line 23: | Line 24: | ||
You can translate file paths you get from Explorer's address bar by turning "\" into "\\". | You can translate file paths you get from Explorer's address bar by turning "\" into "\\". | ||
===Text editor window=== | |||
You can collected logged commands in a python file if you use the text editor. | You can collected logged commands in a python file if you use the text editor. | ||
Line 42: | Line 43: | ||
bpy.ops.mesh.primitive_cube_add(size=2, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1)) | bpy.ops.mesh.primitive_cube_add(size=2, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1)) | ||
===No drag and drop support=== | |||
Unbelievable, but after all these years drag and drop support is almost zero. | Unbelievable, but after all these years drag and drop support is almost zero. | ||
Line 114: | Line 115: | ||
# https://blender.stackexchange.com/questions/44382/blender-python-select-an-object-with-the-sequence-of-letters-in-a-name | # https://blender.stackexchange.com/questions/44382/blender-python-select-an-object-with-the-sequence-of-letters-in-a-name | ||
===Outliner=== | |||
When click the second icon (Display Mode) of the Outliner you can change the Layer View to Data API. This might be helpful for logging one or another command by toying around in properties. | When click the second icon (Display Mode) of the Outliner you can change the Layer View to Data API. This might be helpful for logging one or another command by toying around in properties. | ||
==Random session #2== | |||
===More Python=== | |||
Remember to ... Edit > Preferences | Remember to ... Edit > Preferences | ||
Line 124: | Line 125: | ||
===Python-generated UI=== | |||
Reading for later: | Reading for later: | ||
Line 138: | Line 139: | ||
[...] | [...] | ||
==Random session #3== | |||
===Dynamic context menus=== | |||
The idea is to give [[XML:File_types#BINA.2FOBJC|function objects (CJBO)]] a dynamic context menu, either by analyzing its given collection name and/or further tags/properties given to the object. | The idea is to give [[XML:File_types#BINA.2FOBJC|function objects (CJBO)]] a dynamic context menu, either by analyzing its given collection name and/or further tags/properties given to the object. | ||
Reading for later: | Reading for later: | ||
* https://docs.blender.org/manual/en/ | * 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 | ||
[...] | [...] | ||
== | ==Build Blender== | ||
https:// | https://developer.blender.org/docs/handbook/building_blender/ | ||
https:// | https://developer.blender.org/docs/handbook/building_blender/windows/ | ||
* https://www.youtube.com/watch?v=eCvuQHlKPEk | * https://www.youtube.com/watch?v=eCvuQHlKPEk | ||
Line 159: | Line 160: | ||
update files | update files | ||
make update | make update | ||
(re) | (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== | |||
cd C:\blender-git\blender | |||
make full nobuild | |||
In solution explorer open "CMakePredefinedTargets", right-click "INSTALL", click "build" ("Erstellen" in German). | |||
==Proof of concept== | |||
Unorthodox but could be effective. | |||
Blender, drag'n'drop event of an oni file -> | |||
context aware conversion manager.exe -> | |||
OniSplit.exe -> | |||
Blender continues to run, converted files get read by python scripts, these are chosen based on what four letter file prefix the oni file had | |||
For example this would greatly automate level modding. | |||
Objects would be tagged and placed on suitable layers. (CJBO management.) | |||
This could replace the outdated XSI workflow and its addon. | |||
===wm_window.c === | ===wm_window.c === | ||
blender- | C:\blender-git\blender\source\blender\windowmanager\intern\wm_window.c | ||
By default only one file of dropped ones will be detected. | By default only one file of dropped ones will be detected. | ||
Line 169: | 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:// | Therefore let's use [https://learn.microsoft.com/de-de/windows/win32/procthread/creating-processes CreateProcess]. | ||
#include <windows.h> | #include <windows.h> // CreateProcess | ||
#include "BPY_extern_run.h" // run py scripts | |||
char processFile[255]; | char processFile[255]; | ||
char fn[255]; // py file (the more python, the less C) | |||
STARTUPINFO si; | |||
PROCESS_INFORMATION pi; | |||
ZeroMemory( &si, sizeof(si) ); | |||
si.cb = sizeof(si); | |||
ZeroMemory( &pi, sizeof(pi) ); | |||
if (ddd->dataType == GHOST_kDragnDropTypeFilenames) { | if (ddd->dataType == GHOST_kDragnDropTypeFilenames) { | ||
GHOST_TStringArray *stra = ddd->data; | GHOST_TStringArray *stra = ddd->data; | ||
Line 199: | Line 234: | ||
// Wait until child process exits. | // Wait until child process exits. | ||
// | // wait for onisplit to convert files ? | ||
WaitForSingleObject(pi.hProcess, INFINITE); | |||
// Close process and thread handles. | // Close process and thread handles. | ||
Line 206: | Line 241: | ||
CloseHandle(pi.hThread); | CloseHandle(pi.hThread); | ||
printf("file was processed"); | strcpy(fn, "C:\\blender-git\\oni.py"); | ||
// 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 | |||
// https://developer.blender.org/docs/features/core/context/ | |||
bool ok; | |||
ok = BPY_run_filepath(C, fn, NULL); | |||
printf("file was processed\n"); | |||
... | ... | ||
} | } | ||
===Todo=== | |||
1) replace notepad with own exe (writing more code in C is a pain) | 1) replace notepad with own exe (writing more code in C is a pain) | ||
2) research path reading in C (get folder/file/extension) so own exe can use relative path when it is | 2) research path reading in C (get folder/file/extension) so own exe can use relative path when it is placed alongside Blender | ||
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> | |||
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. | ||
Long-term goals could be to include Delano's addon and provide a way to automate the updating of Blender with these extras. | Long-term goals could be to include Delano's addon and provide a way to automate the updating of Blender with these extras. | ||
==Notes for further customizations== | |||
* Catching getActive Events would be interesting. | |||
* '''[https://blender.stackexchange.com/questions/41533/how-to-remotely-run-a-python-script-in-an-existing-blender-instance Blender Server]''' | |||
* Globals are located in | |||
BKE_global.h | |||
The files close to main would need to be edited if Blender shall became a [https://www.youtube.com/watch?v=_i9HkIT0Atg single-instance application]. If started with hypothetical "singleInstance" arg, that would allow a permanent ''command line communication''. | |||
C:\blender-git\blender\source\creator | |||
creator_intern.h | |||
creator.c | |||
creator_args.c | |||
* Pipe communication. | |||
[[Category:Userspace]] |