Changeset View
Changeset View
Standalone View
Standalone View
doc/python_api/rst/info_gotcha.rst
| Show First 20 Lines • Show All 139 Lines • ▼ Show 20 Lines | |||||
| Transform, Painting, Fly-Mode and File-Select are example of a modal operators. | Transform, Painting, Fly-Mode and File-Select are example of a modal operators. | ||||
| Writing modal operators takes more effort than a simple ``for`` loop | Writing modal operators takes more effort than a simple ``for`` loop | ||||
| that happens to redraw but is more flexible and integrates better with Blenders design. | that happens to redraw but is more flexible and integrates better with Blenders design. | ||||
| **Ok, Ok! I still want to draw from Python** | **Ok, Ok! I still want to draw from Python** | ||||
| If you insist - yes its possible, but scripts that use this hack wont be considered | If you insist - yes its possible, but scripts that use this hack won't be considered | ||||
| for inclusion in Blender and any issues with using it wont be considered bugs, | for inclusion in Blender and any issues with using it won't be considered bugs, | ||||
| this is also not guaranteed to work in future releases. | this is also not guaranteed to work in future releases. | ||||
| .. code-block:: python | .. code-block:: python | ||||
| bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1) | bpy.ops.wm.redraw_timer(type='DRAW_WIN_SWAP', iterations=1) | ||||
| Modes and Mesh Access | Modes and Mesh Access | ||||
| ▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Lines | |||||
| Exporting | Exporting | ||||
| --------- | --------- | ||||
| All 3 data types can be used for exporting, | All 3 data types can be used for exporting, | ||||
| the choice mostly depends on whether the target format supports ngons or not. | the choice mostly depends on whether the target format supports ngons or not. | ||||
| - Polygons are the most direct & efficient way to export providing they convert into the output format easily enough. | - Polygons are the most direct & efficient way to export providing they convert into the output format easily enough. | ||||
| - Tessfaces work well for exporting to formats which dont support ngons, | - Tessfaces work well for exporting to formats which don't support ngons, | ||||
| in fact this is the only place where their use is encouraged. | in fact this is the only place where their use is encouraged. | ||||
| - BMesh-Faces can work for exporting too but may not be necessary if polygons can be used | - BMesh-Faces can work for exporting too but may not be necessary if polygons can be used | ||||
| since using bmesh gives some overhead because its not the native storage format in object mode. | since using bmesh gives some overhead because its not the native storage format in object mode. | ||||
| Upgrading Importers from 2.62 | Upgrading Importers from 2.62 | ||||
| ----------------------------- | ----------------------------- | ||||
| ▲ Show 20 Lines • Show All 269 Lines • ▼ Show 20 Lines | |||||
| - Always use utf-8 encoding or convert to utf-8 where the input is unknown. | - Always use utf-8 encoding or convert to utf-8 where the input is unknown. | ||||
| - Avoid manipulating filepaths as strings directly, use ``os.path`` functions instead. | - Avoid manipulating filepaths as strings directly, use ``os.path`` functions instead. | ||||
| - Use ``os.fsencode()`` / ``os.fsdecode()`` instead of built in string decoding functions when operating on paths. | - Use ``os.fsencode()`` / ``os.fsdecode()`` instead of built in string decoding functions when operating on paths. | ||||
| - To print paths or to include them in the user interface use ``repr(path)`` first | - To print paths or to include them in the user interface use ``repr(path)`` first | ||||
| or ``"%r" % path`` with string formatting. | or ``"%r" % path`` with string formatting. | ||||
| .. note:: | .. note:: | ||||
| Sometimes it's preferrable to avoid string encoding issues by using bytes instead of Python strings, | Sometimes it's preferable to avoid string encoding issues by using bytes instead of Python strings, | ||||
| when reading some input its less trouble to read it as binary data | when reading some input its less trouble to read it as binary data | ||||
| though you will still need to decide how to treat any strings you want to use with Blender, | though you will still need to decide how to treat any strings you want to use with Blender, | ||||
| some importers do this. | some importers do this. | ||||
| Strange errors using 'threading' module | Strange errors using 'threading' module | ||||
| ======================================= | ======================================= | ||||
| ▲ Show 20 Lines • Show All 248 Lines • Show Last 20 Lines | |||||