Age | Commit message (Collapse) | Author |
|
This is the convention for most parts of Blender Python API.
|
|
With the increased use of multi-character format units and keyword-only
arguments these are increasingly difficult to make sense of.
Split the string onto multiple lines, one per argument.
While verbose it's easier to understand and add new arguments.
|
|
No functional changes.
|
|
Also remove redundant NULL check.
|
|
Add the ability to get/set the selected text.
**Calling the new methods:**
- `bpy.data.texts["Text"].region_as_string()`
- `bpy.data.texts["Text"].region_from_string("Replacement")`
|
|
|
|
Python exceptions are now shown in the info editor,
this also resolves an old bug where errors were printed twice.
This was originally based on D9752 by @ShadowChaser although many
changes have been made from the original patch.
Details:
- BPy_errors_to_report no longer prints additional output.
- BKE_report_print_test was added so it's possible to check if calling
BKE_report also printed to the stdout.
- Callers to BPy_errors_to_report are responsible for ensuring output
is printed to the stdout/stderr.
- Python exceptions no longer add a trailing newline,
needed to avoid blank-space when displayed in the info-editor.
|
|
Off by one error placing text from an error.
|
|
Internally an empty string is used to access context member `__dir__`,
which caused `getattr(context, "")` to succeed returning None.
|
|
Add blank lines after file references to avoid them being interpreted as
doc-strings the following declarations.
|
|
Relying on checks for the assignment of return arguments isn't so
clear especially when there are multiple return arguments.
|
|
Python 3.10's syntax errors can specify a range.
Use this for text editor error selection.
|
|
Names filename/filepath/fn were used interchangeably.
|
|
This broke between 3.0 and 3.1, upgrading to Python 3.10 seems the
likely cause as this code didn't change.
|
|
Reduces noise in D9752, no functional change as PyErr_NormalizeException
doesn't do anything when there is no exception set.
|
|
See T85728
|
|
|
|
Currently only supports single image frames (no animation possible).
If quality slider is set to 100 then lossless compression will be used,
otherwise lossy compression is used.
Gives about 35% reduction of filesize save when re-saving splash screens with lossless
compression.
Also saves much faster, up to 15x faster than PNG with a better compression ratio as a plus.
Note, this is currently left disabled until we have WebP libs (see T95206)
For testing precompiled libs can be downloaded from Google:
https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html
Differential Revision: https://developer.blender.org/D1598
|
|
Reserve "filename" when only the name component is used.
|
|
Restore variable removed in [0], using an ifdef to avoid the warning.
[0]: c3ecfdf40b02f7d12775f1ded2f039d40f1470bb
|
|
Currently there is a "calc_face_normal" argument to mesh to bmesh
conversion, but vertex normals had always implicitly inherited whatever
dirty state the mesh input's vertex normals were in. Probably they were
most often assumed to not be dirty, but this was never really correct in
the general case.
Ever since the refactor to move vertex normals out of mesh vertices,
cfa53e0fbeed7178c7, the copying logic has been explicit: copy the
normals when they are not dirty. But it turns out that more control is
needed, and sometimes normals should be calculated for the resulting
BMesh.
This commit adds an option to the conversion to calculate vertex
normals, true by default. In almost all places except the decimate
and edge split modifiers, I just copied the value of the
"calc_face_normals" argument.
Differential Revision: https://developer.blender.org/D14406
|
|
Mainly -Wset-but-unused-variable.
Makes default compilation on macOS way less noisy.
Differential Revision: https://developer.blender.org/D14357
|
|
Remove outdated reference to "pydrivers.py", also document BPY_DECREF.
|
|
|
|
|
|
In practice users are unlikely to ever run into this error.
|
|
Missed in rB4430e8a00810ca8df2fa20029c4cb8078e8cdbe6
Reviewed By: mano-wii
Differential Revision: https://developer.blender.org/D14333
|
|
So far it was needed to declare a new RNA struct to `RNA_access.h` manually.
Since 9b298cf3dbec we generate a `RNA_prototypes.h` for RNA property
declarations. Now this also includes the RNA struct declarations, so they don't
have to be added manually anymore.
Differential Revision: https://developer.blender.org/D13862
Reviewed by: brecht, campbellbarton
|
|
Lets `makesrna` generate a `RNA_prototypes.h` header with declarations for all
RNA properties. This can be included in regular source files when needing to
reference RNA properties statically.
This solves an issue on MSVC with adding such declarations in functions, like
we used to do. See 800fc1736748. Removes any such declarations and the related
FIXME comments.
Reviewed By: campbellbarton, LazyDodo, brecht
Differential Revision: https://developer.blender.org/D13837
|
|
Also minor cleanup to txt_sel_to_buf:
- Use memcpy instead of strncpy as the strings don't contain nil bytes.
- Replace while loops with for loops.
|
|
Activating a gizmo used the windows eventstate which may have values
newer than the event used to activate the gizmo.
This meant transforms check for the key that activated transform
could be incorrect.
Support passing an event when calling operators to avoid this problem.
|
|
Thanks to Jacques Lucke for spotting.
|
|
This function was copied from txt_sel_to_buf, including unnecessary
complexity to support selection as well as checks for the cursor
which don't make sense when copying the whole buffer.
Use a simple loop to copy all text into the destination buffer.
|
|
Now it's possible for a C/RNA function to return a dynamic string,
The PROP_NEVER_NULL flag is also supported so a NULL string returns
None in Python.
|
|
|
|
Regression in 265d97556aa0f0f2a0e4dd7584e3b8573bbddd54.
Where iterating directly on a property group failed, e.g.:
`iter(group)`, tests missed this since only `group.keys()`
was checked.
|
|
|
|
Contributed by luzpaz.
Ref D14271, D14270
|
|
Avoid re-creating & freeing the depsgraph for every driver evaluation.
Now the depsgraph is kept in the name-space (matching self),
only re-created when the value changes.
In a contrived test-case with many drivers this gave ~15% overall
speedup for animation playback.
|
|
Missed decref in 686ab4c9401a90b22fb17e46c992eb513fe4f693 caused every
driver evaluation to create the BPy_StructRNA depsgraph without freeing
the previously allocated depsgraph.
|
|
|
|
Annotation tool is used as a general mark tool for many add-ons. To be able to detect when an annotation is done is very handy to integrate the annotation tool in add-ons and other studio workflows.
The new callback names are: `annotation_pre` and `annotation_post`
Both callbacks are exposed via the Python module `bpy.app.handlers`
Example use:
```
import bpy
def annotation_starts(gpd):
print("Annotation starts")
def annotation_done(gpd):
print("Annotation done")
bpy.app.handlers.annotation_pre.clear()
bpy.app.handlers.annotation_pre.append(annotation_starts)
bpy.app.handlers.annotation_post.clear()
bpy.app.handlers.annotation_post.append(annotation_done)
```
Note: The handlers are called for any annotation tool, including eraser.
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D14221
|
|
This patch adds edge selection support for UV editing (refer T76545).
Developed as a part of GSoC 2021 project - UV Editor Improvements.
Previously, selections in the UV editor always flushed down to vertices
and this caused multiple issues such as T76343, T78757 and T26676.
This patch fixes that by adding edge selection support for all UV
operators and adding support for flushing selections between vertices
and edges. Updating UV select modes is now done using a separate
operator, which also handles select mode flushing and undo for UV
select modes. Drawing edges (in UV edge mode) is also updated to match
the edit-mesh display in the 3D viewport.
Notes on technical changes made with this patch:
* MLOOPUV_EDGESEL flag is restored (was removed in rB9fa29fe7652a).
* Support for flushing selection between vertices and edges.
* Restored the BMLoopUV.select_edge boolean in the Python API.
* New operator to update UV select modes and flushing.
* UV select mode is now part of editmesh undo.
TODOs added with this patch:
* Edge support for shortest path operator (currently uses vertex path logic).
* Change default theme color instead of reducing contrast with edge-select.
* Proper UV element selections for Reveal Hidden operator.
Reviewed By: campbellbarton
Differential Revision: https://developer.blender.org/D12028
|
|
|
|
Since Python 3.10 is now supported on all platform,
bump the minimum version to reduce the number of Python versions that
need to be supported simultaneously.
Reviewed By: LazyDodo, sybren, mont29, brecht
Ref D13943
|
|
|
|
Instead of accessing the `CD_NORMAL` layer directly,
use the proper API for accessing mesh normals. Even if the
layer exists, the values might be incorrect due to a deformation.
Related to ef0e21f0ae71d, 969c4a45ce09100e, and T95839.
|
|
`blend_depth_test_get` --> `depth_test_get`
`depth_mask_set_get` --> `depth_mask_get`
Thanks to @SBCV for pointing out these inconsistencies.
|
|
`use_program_point_size` --> `program_point_size_set`.
|
|
|