Age | Commit message (Collapse) | Author |
|
Use a shorter/simpler license convention, stops the header taking so
much space.
Follow the SPDX license specification: https://spdx.org/licenses
- C/C++/objc/objc++
- Python
- Shell Scripts
- CMake, GNUmakefile
While most of the source tree has been included
- `./extern/` was left out.
- `./intern/cycles` & `./intern/atomic` are also excluded because they
use different header conventions.
doc/license/SPDX-license-identifiers.txt has been added to list SPDX all
used identifiers.
See P2788 for the script that automated these edits.
Reviewed By: brecht, mont29, sergey
Ref D14069
|
|
Previously, macros were ifdefed using the cmake option `WITH_INTERNATIONAL`
However, the is unnecessary as withen the functions themselves have checks for building without internationalization.
This also means that many `add_definitions(-DWITH_INTERNATIONAL)` are also unnecessary.
Reviewed By: mont29, LazyDodo
Differential Revision: https://developer.blender.org/D13929
|
|
|
|
As described in T91186, this commit moves mesh vertex normals into a
contiguous array of float vectors in a custom data layer, how face
normals are currently stored.
The main interface is documented in `BKE_mesh.h`. Vertex and face
normals are now calculated on-demand and cached, retrieved with an
"ensure" function. Since the logical state of a mesh is now "has
normals when necessary", they can be retrieved from a `const` mesh.
The goal is to use on-demand calculation for all derived data, but
leave room for eager calculation for performance purposes (modifier
evaluation is threaded, but viewport data generation is not).
**Benefits**
This moves us closer to a SoA approach rather than the current AoS
paradigm. Accessing a contiguous `float3` is much more efficient than
retrieving data from a larger struct. The memory requirements for
accessing only normals or vertex locations are smaller, and at the
cost of more memory usage for just normals, they now don't have to
be converted between float and short, which also simplifies code
In the future, the remaining items can be removed from `MVert`,
leaving only `float3`, which has similar benefits (see T93602).
Removing the combination of derived and original data makes it
conceptually simpler to only calculate normals when necessary.
This is especially important now that we have more opportunities
for temporary meshes in geometry nodes.
**Performance**
In addition to the theoretical future performance improvements by
making `MVert == float3`, I've done some basic performance testing
on this patch directly. The data is fairly rough, but it gives an idea
about where things stand generally.
- Mesh line primitive 4m Verts: 1.16x faster (36 -> 31 ms),
showing that accessing just `MVert` is now more efficient.
- Spring Splash Screen: 1.03-1.06 -> 1.06-1.11 FPS, a very slight
change that at least shows there is no regression.
- Sprite Fright Snail Smoosh: 3.30-3.40 -> 3.42-3.50 FPS, a small
but observable speedup.
- Set Position Node with Scaled Normal: 1.36x faster (53 -> 39 ms),
shows that using normals in geometry nodes is faster.
- Normal Calculation 1.6m Vert Cube: 1.19x faster (25 -> 21 ms),
shows that calculating normals is slightly faster now.
- File Size of 1.6m Vert Cube: 1.03x smaller (214.7 -> 208.4 MB),
Normals are not saved in files, which can help with large meshes.
As for memory usage, it may be slightly more in some cases, but
I didn't observe any difference in the production files I tested.
**Tests**
Some modifiers and cycles test results need to be updated with this
commit, for two reasons:
- The subdivision surface modifier is not responsible for calculating
normals anymore. In master, the modifier creates different normals
than the result of the `Mesh` normal calculation, so this is a bug
fix.
- There are small differences in the results of some modifiers that
use normals because they are not converted to and from `short`
anymore.
**Future improvements**
- Remove `ModifierTypeInfo::dependsOnNormals`. Code in each modifier
already retrieves normals if they are needed anyway.
- Copy normals as part of a better CoW system for attributes.
- Make more areas use lazy instead of eager normal calculation.
- Remove `BKE_mesh_normals_tag_dirty` in more places since that is
now the default state of a new mesh.
- Possibly apply a similar change to derived face corner normals.
Differential Revision: https://developer.blender.org/D12770
|
|
After disconnecting hair on an object, if you then hide the particle system, and try connecting the hair again, the operator is cancelled due to `remap_hair_emitter` returning `false` because `target_psmd->mesh_final` is NULL, but `connect_hair` will still strip the `PSYS_GLOBAL_HAIR` flag, which will cause the hair in the hidden particle system to be positioned incorrectly. The correct behavior is to strip the flag only if `remap_hair_emitter` succeeds.
Differential Revision: https://developer.blender.org/D13703
|
|
Fixes a bug introduced in rB5dedb39d447b. `mesh_original` is not set if the
mesh has no generative modifiers, in which case we can use `mesh_final`, which
would seem to be consistent with the rest of the particle code. An alternative
approach would be to make sure that `mesh_original` is always set in
`deformVerts`.
Differential Revision: https://developer.blender.org/D13754
|
|
|
|
Take the Use Modifier Stack setting into account when connecting hair, and
fix wrong results results when using deforming modifiers also.
Differential Revision: https://developer.blender.org/D13704
|
|
Ref T92709
|
|
|
|
When adding certain customdata layers (namely UVs, vertex colors and
sculpt vertex colors), the user does not get notified the specific limit
has been hit (blender just silently does nothing).
Now inform the user [decided to not do this in poll() since it could get
messy once operators are extended to operate on all selected objects, so
left this as a visible error in execute() -- or from python].
Maniphest Tasks: T92318
Differential Revision: https://developer.blender.org/D13147
|
|
Properties Editor
Similar to rBf9308a585ecd, use `psys_get_current` if we cant get the
active psys from context (which is only defined for the Properties
Editor). Other solution would be to define a "particle_system" context
member in other editors, but for now, stick with the simplest solution.
thx @mano-wii for additional input
Maniphest Tasks: T92402
Differential Revision: https://developer.blender.org/D13000
|
|
|
|
Before this patch attempting to remove a particle modifier programmatically
through Python would fail, because it deleted the modifier associated with
the currently active particle system instead of the one passed as an argument
to `bpy.types.ObjectModifiers.remove()`.
This fix adds an additional argument for the particle system to
`object_remove_particle_system`. This allows to specify which particle system
and its associated modifier shall be removed. In case of
`particle_system_remove_exec` it will remain the currently active particle
system, whereas `object_remove_particle_system` passes the particle system
of the modifier. Hence, the correct modifier will be removed.
Reviewed By: mont29
Differential Revision: https://developer.blender.org/D12234
|
|
Also hyphenate 'mouse-move' use doxy sections in render_update.c &
move function comment from the header to the source.
|
|
|
|
Followup to rB3834dc2f7b38 (where getting the proper particle system was
fixed for the Adjust Last Operation panel in the Properties Editor). But
since this operator can also be called from the 3DView, get a current
particle system there as well.
Without this, _all_ particle systems would be copied when executing from
the 3DView (which was never really intended [operator description uses
singular] -- it just happens to use `copy_particle_systems_to_object`
internally as well -- same as the `Copy Active/All to Selected Objects`
operators)).
ref. T83317
Maniphest Tasks: T83317
Differential Revision: https://developer.blender.org/D12033
|
|
Use C comments for plain text.
|
|
Also use doxy style function reference `#` prefix chars when
referencing identifiers.
|
|
Also resolve a warning from the previous commit. The next blocker to
using const is `BKE_mesh_wrapper_ensure_mdata`.
|
|
|
|
|
|
|
|
|
|
It is more appropriate that `depths` is freed in `ED_view3d_depths_free`.
|
|
The depth cache (located in `RegionView3D::depths`) is used for quick
and simple occlusion testing in:
- particle selection,
- "Draw Curve" operator and
- "Interactive Light Track to Cursor" operator,
However, keeping a texture buffer in cache is not a recommended practice.
For displays with high resolution like 8k this represents something
around 132MB.
Also, currently, each call to `ED_view3d_depth_override` invalidates
the depth cache. So that depth is never reused in multiple calls from
an operator (this was not the case in blender 2.79).
This commit allows to create a depth cache and release it in the same
operator. Thus, the buffer is kept in cache for a short time, freeing
up space.
No functional changes.
|
|
When projecting into screen space Z value isn't always needed.
Add 2D projection functions, renaming them to avoid accidents
happening again.
- Add GPU_matrix_project_2fv
- Add ED_view3d_project_v2
- Rename ED_view3d_project to ED_view3d_project_v3
- Use the 2D versions of these functions when the Z value isn't used.
|
|
operator
This is only used when the preset is set to 'Custom', make that clear in
the tooltip and disable editing the value if another preset is used.
Issue came up in T88155.
Maniphest Tasks: T88155
Differential Revision: https://developer.blender.org/D11210
|
|
The check to include particle edit mode in the object-mode drop-down
didn't match the poll function to edit particle edit mode.
Share the check between both functions.
|
|
Now `ED_view3d_backbuf_depth_validate`, `ED_view3d_draw_depth` and
`ED_view3d_draw_depth_gpencil` are unified in `ED_view3d_depth_override`.
This new function replaces `ED_view3d_autodist_init`.
Also, since `ED_view3d_depth_update` depends on the render context, and
changing the context is a slow operation, that function also was removed,
and the depth buffer cached is now updated inside the new unified drawing
function when the "bool update_cache" parameter is true.
Finally `V3D_INVALID_BACKBUF` flag has been renamed and moved to
`runtime.flag`.
Differential revision: https://developer.blender.org/D10678
|
|
|
|
|
|
|
|
Undo/redo was crashing & asserting.
There ware two bugs:
- Entering particle system edit-mode requires an evaluated depsgraph.
- The active object could get out of sync when undo/redo
moves between different modes.
The new test 'view3d_mesh_particle_edit_mode_simple'
in `tests/ui_simulate/test_undo.py` exposes both issues.
|
|
Following the naming conventions defined in T56648, where in this
instance there were still a few remaining uses of the old term.
Differential Revision: https://developer.blender.org/D9817
|
|
|
|
Remove redundant headers using
`./source/tools/utils_maintenance/code_clean.py`
Reviewed By: jmonteath
Ref D10364
|
|
|
|
Move `eUndoStepDir` to `BKE_undo_system.h` and use its values
everywhere.
Note that this also introduce the `STEP_INVALID` value in that enum.
Finally, kept the matching struct members in some lower-level readfile
code as an `int` to avoid having to include `BKE_undo_system.h` in a lot
of unrelated files.
|
|
|
|
In two cases the percentage property was actually used incorrectly, as
pointed out in T82070. The range was [0, 1], but the properties were still
displayed as percentages.
There is a preference to control whether to display factors or
percentages, so it usually doesn't make sense to manually define
properties as percentages.
Resolves T82070
Differential Revision: https://developer.blender.org/D9344
|
|
Comment blocks not conforming to convention.
|
|
The hair mirroring code seems to expect that hair is emitted from faces.
The PE_mirror_x contains the following expression: mirrorfaces[pa->num * 2].
This only makes sense when pa->num is a face index.
The simplest short term solution is to disable the mirror operator when
the particles haven't been emitted from faces.
Diffferential Revision: https://developer.blender.org/D10002
|
|
We will soon need more options here, sinmpler and cleaner to use a
bitflag then.
|
|
Rename it to mark it is only for `encode` callbacks, fix `encode`
callback of text undo to early fail in case it gets a NULL context, add
an assert to `BKE_undosys_step_push_with_type` that context is not NULL
when undotype requires a valid one.
Note that in practice this should not change anything, currently it
seems that we always get a valid context in
`BKE_undosys_step_push_with_type`?
|
|
Remove DNA headers, using forward declarations where possible.
Also removed duplicate header, header including it's self
and unnecessary inclusion of libc system headers from BKE header.
|
|
duplicated particle system
When particle settings are duplicated along with the particle system,
this means a change in relations, was missing
'DEG_relations_tag_update'.
Maniphest Tasks: T83640
Differential Revision: https://developer.blender.org/D9823
|
|
|
|
The issue was that the same point cache was read by multiple
threads at the same time (the same object was evaluated for
render and for the viewport).
Both threads incremented PTCacheMem->cur which lead to the crash.
The fix is to remove the PTCacheMem->cur and store it on the
stack instead. This way every thread has its own cur.
Reviewers: brecht
Differential Revision: https://developer.blender.org/D9606
|
|
In cases where "Allow" is followed by an infinitive, a noun needs
to directly follow it. But it makes more sense to follow it with a
gerund instead.
|