Changeset View
Changeset View
Standalone View
Standalone View
source/blender/python/intern/bpy.c
| Context not available. | |||||
| # include "BPy_Freestyle.h" | # include "BPy_Freestyle.h" | ||||
| #endif | #endif | ||||
| #include "UI_interface_icons.h" | |||||
| PyObject *bpy_package_py = NULL; | PyObject *bpy_package_py = NULL; | ||||
| //#if 0 | |||||
| PyDoc_STRVAR(bpy_load_icons_doc, | |||||
| ".. function:: load_icon(path = """")\n" | |||||
campbellbarton: incorrect string escaping | |||||
rebellionUnsubmitted Not Done Inline Actionssorry but i can't see the error... can you be more specific please?? rebellion: sorry but i can't see the error... can you be more specific please?? | |||||
| "\n" | |||||
| " Load a icon from a file and add it to icon enumerator.\n" | |||||
| "\n" | |||||
| " :arg path: Path to file, should be a *.png file 16x16.\n" | |||||
| " :type absolute: string\n" | |||||
| " :return: icon_value, None if fail.\n" | |||||
| " :rtype: int\n" | |||||
| ); | |||||
| static PyObject *bpy_load_icons(PyObject *UNUSED(self), PyObject *args) | |||||
| { | |||||
| const char *filePath; | |||||
| int icon_value; | |||||
| filePath = _PyUnicode_AsString(args); | |||||
| if(!filePath){ | |||||
| PyErr_SetString(PyExc_TypeError, "expected a string"); | |||||
| return NULL; | |||||
| } | |||||
| printf("\n ",filePath); | |||||
| icon_value = UI_load_addonsIcon(filePath); | |||||
| if(icon_value == -1){ | |||||
| PyErr_SetString(PyExc_TypeError, "invalid icon"); | |||||
| return NULL; | |||||
| } | |||||
| return Py_BuildValue("i", icon_value); | |||||
| } | |||||
| //#endif | |||||
| PyDoc_STRVAR(bpy_script_paths_doc, | PyDoc_STRVAR(bpy_script_paths_doc, | ||||
| ".. function:: script_paths()\n" | ".. function:: script_paths()\n" | ||||
| "\n" | "\n" | ||||
| Context not available. | |||||
| " :return: (system, user) strings will be empty when not found.\n" | " :return: (system, user) strings will be empty when not found.\n" | ||||
| " :rtype: tuple of strings\n" | " :rtype: tuple of strings\n" | ||||
| ); | ); | ||||
| static PyObject *bpy_script_paths(PyObject *UNUSED(self)) | static PyObject *bpy_script_paths(PyObject *UNUSED(self)) | ||||
| { | { | ||||
| PyObject *ret = PyTuple_New(2); | PyObject *ret = PyTuple_New(2); | ||||
| Context not available. | |||||
| return value_escape; | return value_escape; | ||||
| } | } | ||||
| static PyMethodDef meth_bpy_load_icons = | |||||
| {"load_icon", (PyCFunction)bpy_load_icons, METH_O, bpy_load_icons_doc}; | |||||
| static PyMethodDef meth_bpy_script_paths = | static PyMethodDef meth_bpy_script_paths = | ||||
| {"script_paths", (PyCFunction)bpy_script_paths, METH_NOARGS, bpy_script_paths_doc}; | {"script_paths", (PyCFunction)bpy_script_paths, METH_NOARGS, bpy_script_paths_doc}; | ||||
| static PyMethodDef meth_bpy_blend_paths = | static PyMethodDef meth_bpy_blend_paths = | ||||
| Context not available. | |||||
| /* ops is now a python module that does the conversion from SOME_OT_foo -> some.foo */ | /* ops is now a python module that does the conversion from SOME_OT_foo -> some.foo */ | ||||
| PyModule_AddObject(mod, "ops", BPY_operator_module()); | PyModule_AddObject(mod, "ops", BPY_operator_module()); | ||||
| PyModule_AddObject(mod, "app", BPY_app_struct()); | PyModule_AddObject(mod, "app", BPY_app_struct()); | ||||
| PyModule_AddObject(mod, "_utils_units", BPY_utils_units()); | PyModule_AddObject(mod, "_utils_units", BPY_utils_units()); | ||||
| /* bpy context */ | /* bpy context */ | ||||
| RNA_pointer_create(NULL, &RNA_Context, (void *)BPy_GetContext(), &ctx_ptr); | RNA_pointer_create(NULL, &RNA_Context, (void *)BPy_GetContext(), &ctx_ptr); | ||||
| Context not available. | |||||
| PyModule_AddObject(mod, meth_bpy_user_resource.ml_name, (PyObject *)PyCFunction_New(&meth_bpy_user_resource, NULL)); | PyModule_AddObject(mod, meth_bpy_user_resource.ml_name, (PyObject *)PyCFunction_New(&meth_bpy_user_resource, NULL)); | ||||
| PyModule_AddObject(mod, meth_bpy_resource_path.ml_name, (PyObject *)PyCFunction_New(&meth_bpy_resource_path, NULL)); | PyModule_AddObject(mod, meth_bpy_resource_path.ml_name, (PyObject *)PyCFunction_New(&meth_bpy_resource_path, NULL)); | ||||
| PyModule_AddObject(mod, meth_bpy_escape_identifier.ml_name, (PyObject *)PyCFunction_New(&meth_bpy_escape_identifier, NULL)); | PyModule_AddObject(mod, meth_bpy_escape_identifier.ml_name, (PyObject *)PyCFunction_New(&meth_bpy_escape_identifier, NULL)); | ||||
| PyModule_AddObject(mod, meth_bpy_load_icons.ml_name, (PyObject *)PyCFunction_New(&meth_bpy_load_icons, NULL)); | |||||
| /* register funcs (bpy_rna.c) */ | /* register funcs (bpy_rna.c) */ | ||||
| PyModule_AddObject(mod, meth_bpy_register_class.ml_name, (PyObject *)PyCFunction_New(&meth_bpy_register_class, NULL)); | PyModule_AddObject(mod, meth_bpy_register_class.ml_name, (PyObject *)PyCFunction_New(&meth_bpy_register_class, NULL)); | ||||
| PyModule_AddObject(mod, meth_bpy_unregister_class.ml_name, (PyObject *)PyCFunction_New(&meth_bpy_unregister_class, NULL)); | PyModule_AddObject(mod, meth_bpy_unregister_class.ml_name, (PyObject *)PyCFunction_New(&meth_bpy_unregister_class, NULL)); | ||||
| Context not available. | |||||
incorrect string escaping