8,452
edits
Paradox-01 (talk | contribs) mNo edit summary |
Paradox-01 (talk | contribs) mNo edit summary |
||
Line 165: | Line 165: | ||
blender-with-libraries-3.1.0\blender-3.1.0\source\blender\windowmanager\intern\wm_window.c | blender-with-libraries-3.1.0\blender-3.1.0\source\blender\windowmanager\intern\wm_window.c | ||
By default only one file of dropped ones will be detected. | |||
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]. | |||
#include <windows.h> | |||
char processFile[255]; | char processFile[255]; | ||
Line 174: | Line 180: | ||
printf("drop file %s\n", stra->strings[a]); | printf("drop file %s\n", stra->strings[a]); | ||
strcpy(processFile, "notepad.exe " ); | strcpy(processFile, "C:\\Windows\\system32\\notepad.exe "); | ||
strcat(processFile, stra->strings[a] ); | strcat(processFile, stra->strings[a]); | ||
// Start the child process. | |||
CreateProcess( | |||
// visual studio create only successful code if "L" is used before the strings | |||
// don't use L with blender | |||
"C:\\Windows\\system32\\notepad.exe", // No module name (use command line) | |||
processFile, // Command line | |||
NULL, // Process handle not inheritable | |||
NULL, // Thread handle not inheritable | |||
FALSE, // Set handle inheritance to FALSE | |||
0, // No creation flags | |||
NULL, // Use parent's environment block | |||
NULL, // Use parent's starting directory | |||
&si, // Pointer to STARTUPINFO structure | |||
&pi); // Pointer to PROCESS_INFORMATION structure | |||
// Wait until child process exits. | |||
// (in our case this is exactly what we don't want) | |||
// WaitForSingleObject(pi.hProcess, INFINITE); | |||
// Close process and thread handles. | |||
CloseHandle(pi.hProcess); | |||
CloseHandle(pi.hThread); | |||
printf("file was processed"); | |||
... | ... | ||
} | } | ||
====Todo==== | |||
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 place alongside Blender | |||
3) research Blender import and let the exe decide what py script to use (for example ONCC*.oni -> import_ONCC.py) | |||
blender --background --python myscript.py | |||
https://blender.stackexchange.com/questions/1365/how-can-i-run-blender-from-command-line-or-a-python-script-without-opening-a-gui | |||
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. | |||
edits