3DCoat Core API
The 3DCoat API documentation.
|
General I/O access. More...
#include <CoreAPI.h>
Static Public Member Functions | |
static const char * | installPath () |
the 3DCoat installation path | |
static const char * | dataPath () |
the 3DCoat data path | |
static const char * | documents (const char *path) |
convert the relative path to the path in documents, if the path is absolute, just return the original path | |
static bool | fileExists (const char *path) |
check if file exists | |
static void | copyFile (const char *src, const char *dest) |
copy the file from src to dest. If the src or dest is relative, it is relative to the documents folder. This function works correctly with relative paths, so it is recommended over the standard copy files routine. | |
static void | copyFolder (const char *src, const char *dest) |
copy the whole folder from src to dest. If the src or dest is relative, it is relative to the documents folder. This function works correctly with relative paths, so it is recommended over the standard copy folder routine. | |
static void | removeFile (const char *filename) |
remove the file. If the filename is relative, it is relative to the documents folder. If the path is in install folder, the corresponding file in documents will be removed. Files in the install folder can't be removed. | |
static void | removeFolder (const char *folder) |
remove the folder. If the folder is relative, it is relative to the documents folder. If the path is in install folder, the corresponding folder in documents will be removed. | |
static std::string | toFullPathInDataFolder (const char *path) |
convert the relative path to full path in documents folder. If the path is full and placed in the install folder, it will be converted to path in documents. | |
static void | toFullPathInDataFolder (str *path) |
static std::string | toFullPathInInstallFolder (const char *path) |
convert the relative path to the full path in the install folder. If the path is full, it remains untouched. | |
static void | toFullPathInInstallFolder (str *path) |
static std::string | convertToWritablePath (const char *path) |
If the path is relative or points into some file in the install folder, it will be converted to the path in documents folder. | |
static void | convertToWritablePath (str *path) |
static std::string | convertToWritablePathIfFileExists (const char *path) |
If the path is relative or points into some file in the install folder, it will be converted to the path in documents folder. If the does not exist in the documents folder, but exists in the install folder, the resulting path will be in the install folder. | |
static void | convertToWritablePathIfFileExists (str *path) |
static std::string | getExtension (const char *filepath) |
get the file extension (without .) | |
static std::string | getFileName (const char *filepath) |
get the file name from the path | |
static std::string | getFilePath (const char *filepath) |
get the file path without the filename | |
static std::string | getFileNameWithoutExtension (const char *filepath) |
remove the file extension from the filename | |
static std::string | strFromFile (const char *filename) |
read string from file. | |
static void | strToFile (const char *text, const char *filename) |
write the string to file | |
static size_t | getFileSize (const char *filename) |
get the file size | |
static vec2 | cursorPos () |
returns the current cursor position | |
static vec2 | snappedCursorPos () |
returns the snapped cursor position | |
static rect | wholeScreen () |
get the whole screen rectangle | |
static rect | workArea () |
get the work area rectangle | |
static void | progressBar (float stage, float max_stage, const char *message) |
Show the progress bar. | |
static void | progressBarInWindowHeader (float stage, float max_stage, const char *message) |
Show the progress bar only in the 3DCoat's window header. | |
static void | setWindowTitle (const char *text, float seconds) |
Override the 3DCoat's window title for some amount of time. | |
static void | step (int count=1) |
perform rendering cycles | |
static void | exec (const char *command, const char *arguments=nullptr) |
execute command. It may be exe file, URL, batch command | |
static const char * | execAndWait (const char *command, const char *arguments=nullptr) |
execute and wait till finished, the console output will be returned as string | |
static void | updateCoatPyi (const char *folderOrFile) |
update the .pyi file for the given folder or py file | |
static void | ListFiles (const char *folder, const char *mask, coat::list< coat::str > &result, bool recursive=true) |
list files in the folder | |
static std::vector< std::string > | ListFiles (const char *folder, const char *mask, bool recursive=true) |
list files in the folder | |
static void | ListFolders (const char *startFolder, coat::list< coat::str > &result) |
list folders within the folder, non-recursive, just plain list | |
static std::vector< std::string > | ListFolders (const char *startFolder) |
list folders within the folder, non-recursive, just plain list | |
static const char * | supportedImagesFormats () |
returns the currently supported mesh export formats | |
static const char * | supportedMeshesFormats () |
returns the list of supported images formats | |
static bool | openFileDialog (const char *extensions, str &fileName) |
show the file dialog | |
static std::string | openFileDialog (const char *extensions) |
static bool | openFilesDialog (const char *extensions, list< str > &fileNames) |
open multiple files dialog | |
static std::vector< std::string > | openFilesDialog (const char *extensions) |
open multiple files dialog | |
static bool | saveFileDialog (const char *extensions, str &fileName) |
show the save file dialog | |
static std::string | saveFileDialog (const char *extensions) |
static const char * | currentSceneFilepath () |
returns the current scene filename, empty if the scene was not saved/opened | |
static void | pipInstall (const char *requirements) |
install one or multiple python packages | |
static void | pipUninstall (const char *requirements) |
static std::string | pythonPath () |
get the python libraries folder | |
static void | showPythonConsole () |
Show the python console, clear it and pop up. | |
static void | executeScript (const char *path) |
execute python (.py file) or angelscript (c++ like), or CoreAPI (native C++) script | |
static void | installRequirements (const char *path_to_requirements_txt) |
Install all the requirements for the python script execution. | |
static std::string | toJson (const pybind11::object &obj, const char *filename="") |
Store the object to the file or string as json. | |
static void | fromJsonFile (pybind11::object &obj, const char *filename) |
Restore the object from the json file. | |
static void | restoreObjectFormJsonString (pybind11::object &obj, const char *data) |
Restore the object from the json string. | |
static void | createRedistributablePackageFromFolder (const char *folder, const char *package_name, const char *excluded_folders_names="", const char *excluded_extensions="") |
Create the 3dcpack file from the folder placed in Documents. | |
static void | download (const char *url, std::function< void(const char *, const char *)> report_success) |
download the file from the url | |
static int | getDownloadProgress () |
returns the overall download progress | |
static void | post_request (const char *url, const char *data, const char *headers, const std::function< void(const char *)> &report_success=nullptr, const std::function< void(const char *)> &report_error=nullptr) |
send the post request to the url | |
static void | get_request (const char *url, const char *headers, const std::function< void(const char *)> &report_success=nullptr, const std::function< void(const char *)> &report_error=nullptr) |
send the get request to the url | |
static std::vector< std::string > | listBlenderInstallFolders () |
list the blender install folders | |
static void | saveScreenshot (const char *filename, int x=0, int y=0, int width=0, int height=0) |
save the screenshot to the file | |
static void | removeBackground (const char *image1, const char *image2, const char *result) |
General I/O access.
|
static |
If the path is relative or points into some file in the install folder, it will be converted to the path in documents folder.
path | the path (full or relative) |
|
static |
If the path is relative or points into some file in the install folder, it will be converted to the path in documents folder. If the does not exist in the documents folder, but exists in the install folder, the resulting path will be in the install folder.
path | the path (full or relative) |
|
static |
copy the file from src to dest. If the src or dest is relative, it is relative to the documents folder. This function works correctly with relative paths, so it is recommended over the standard copy files routine.
src | the source filename |
dest | the destination filename |
|
static |
copy the whole folder from src to dest. If the src or dest is relative, it is relative to the documents folder. This function works correctly with relative paths, so it is recommended over the standard copy folder routine.
src | the source folder |
dest | the destination folder |
|
static |
Create the 3dcpack file from the folder placed in Documents.
folder | the folder to pack, it should be relative to the 3DCoat's Documents folder |
package_name | the package name, the extension is .3dcpack |
excluded_folders_names | the folders names to be excluded from the package, separated by semicolon |
excluded_extensions | the file extensions to be excluded from the package, separated by semicolon |
|
static |
returns the current cursor position
|
static |
|
static |
convert the relative path to the path in documents, if the path is absolute, just return the original path
path | the relative or absolute path |
|
static |
download the file from the url
url | the url |
report_success | the callback that gives you the source URL and the filename of the downloaded file |
|
static |
execute command. It may be exe file, URL, batch command
command | the command to execute |
arguments | optional command line arguments |
|
static |
execute and wait till finished, the console output will be returned as string
command | the command to execute |
arguments | optional arguments |
|
static |
execute python (.py file) or angelscript (c++ like), or CoreAPI (native C++) script
path | the full or relative path to the script file |
|
static |
check if file exists
path | the path may be full or relative. If it is relative, the documents will be checked first, the the install folder will be checked for file. |
|
static |
Restore the object from the json file.
obj | the object to restore |
filename | the path to the json file, full or relative |
|
static |
send the get request to the url
url | the url |
headers | the headers of the request, separated by |
report_success | the callback that gives you the response if the request was successful |
report_error | the callback that gives you the response if the request was failed |
|
static |
returns the overall download progress
|
static |
get the file extension (without .)
filepath | the file path - full or relative |
|
static |
get the file name from the path
filepath | the full or relative path |
|
static |
remove the file extension from the filename
filepath | the file name |
|
static |
get the file path without the filename
filepath | the filepath |
|
static |
get the file size
filename | the filename, relative or full |
|
static |
the 3DCoat installation path
|
static |
Install all the requirements for the python script execution.
path_to_requirements_txt | te full or relative path to the requirements.txt |
|
static |
list the blender install folders
|
static |
list files in the folder
folder | the start folder. It may be absolute or relative to 3DCoat documents/install folder. |
mask | the seek mask (wildcards) |
recursive | set true if recursive |
|
static |
list files in the folder
folder | the start folder. It may be absolute or relative to 3DCoat documents/install folder. |
mask | the seek mask (wildcards) |
result | the files list |
recursive | set true if recursive |
|
static |
list folders within the folder, non-recursive, just plain list
startFolder | the start folder |
|
static |
list folders within the folder, non-recursive, just plain list
startFolder | the start folder |
result | the resulting list |
|
static |
show the file dialog
extensions | the list of supported extensions like *.txt;*.dat; etc... |
fileName | the resulting filename |
|
static |
open multiple files dialog
extensions | the list of supported extensions like *.txt;*.dat; etc... |
open multiple files dialog
extensions | the list of supported extensions like *.txt;*.dat; etc... |
fileNames | the resulting filename |
|
static |
install one or multiple python packages
requirements | the list of packages to install, this is all what you write after "pip install" |
|
static |
send the post request to the url
url | the url |
data | the body of the request |
headers | the headers of the request, separated by |
report_success | the callback that gives you the response if the request was successful |
report_error | the callback that gives you the response if the request was failed |
|
static |
Show the progress bar.
stage | the current stage |
max_stage | the maximal stage |
message | the text to display |
|
static |
Show the progress bar only in the 3DCoat's window header.
stage | the current stage |
max_stage | the maximal stage |
message | the text to display |
|
static |
get the python libraries folder
|
static |
remove the file. If the filename is relative, it is relative to the documents folder. If the path is in install folder, the corresponding file in documents will be removed. Files in the install folder can't be removed.
filename | the file path |
|
static |
remove the folder. If the folder is relative, it is relative to the documents folder. If the path is in install folder, the corresponding folder in documents will be removed.
folder | the path to the folder |
|
static |
Restore the object from the json string.
obj | the object to restore |
data | the json string |
|
static |
show the save file dialog
extensions | extensions the list of supported extensions like *.txt;*.dat; etc... |
fileName | the resulting filename |
|
static |
save the screenshot to the file
filename | the filename |
x | the x coordinate of the screenshot |
y | the y coordinate of the screenshot |
width | the width of the screenshot, if 0 all to the right will be captured |
height | the height of the screenshot, if 0 all to the bottom will be captured |
|
static |
Override the 3DCoat's window title for some amount of time.
text | the text to show |
seconds | the seconds to stay in title |
|
static |
returns the snapped cursor position
|
static |
|
static |
read string from file.
filename | The path. If it is relative, it is relative to the documents folder. If there is no file, it will be taken from the install folder. |
|
static |
write the string to file
text | the text to save |
filename | The path. If it is relative, it is relative to the documents folder. |
|
static |
returns the currently supported mesh export formats
|
static |
returns the list of supported images formats
|
static |
convert the relative path to full path in documents folder. If the path is full and placed in the install folder, it will be converted to path in documents.
path | the path |
|
static |
convert the relative path to the full path in the install folder. If the path is full, it remains untouched.
path | the relative path |
|
static |
Store the object to the file or string as json.
obj | the python object reference |
filename | the filename to save, if empty, the string will be returned |
|
static |
update the .pyi file for the given folder or py file
folderOrFile | the full or relative path to the folder or py file |
|
static |
get the whole screen rectangle
|
static |
get the work area rectangle