2022-02-11 09:07:11 +11:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
* Copyright 2016 Blender Foundation. */
|
2017-04-21 21:14:11 +10:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup draw
|
2017-04-21 21:14:11 +10:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
struct GPUBatch;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct GPUMaterial;
|
2018-07-18 00:12:21 +02:00
|
|
|
struct GPUVertBuf;
|
2017-06-22 19:19:55 +02:00
|
|
|
struct ModifierData;
|
2018-05-09 11:14:27 +02:00
|
|
|
struct PTCacheEdit;
|
2019-01-28 21:08:24 +11:00
|
|
|
struct ParticleSystem;
|
2020-06-02 15:07:17 +02:00
|
|
|
struct TaskGraph;
|
2017-04-21 21:14:11 +10:00
|
|
|
|
|
|
|
|
struct Curve;
|
Curves: Rename "Hair" types, variables, and functions to "Curves"
Based on discussions from T95355 and T94193, the plan is to use
the name "Curves" to describe the data-block container for multiple
curves. Eventually this will replace the existing "Curve" data-block.
However, it will be a while before the curve data-block can be replaced
so in order to distinguish the two curve types in the UI, "Hair Curves"
will be used, but eventually changed back to "Curves".
This patch renames "hair-related" files, functions, types, and variable
names to this convention. A deep rename is preferred to keep code
consistent and to avoid any "hair" terminology from leaking, since the
new data-block is meant for all curve types, not just hair use cases.
The downside of this naming is that the difference between "Curve"
and "Curves" has become important. That was considered during
design discussons and deemed acceptable, especially given the
non-permanent nature of the somewhat common conflict.
Some points of interest:
- All DNA compatibility is lost, just like rBf59767ff9729.
- I renamed `ID_HA` to `ID_CV` so there is no complete mismatch.
- `hair_curves` is used where necessary to distinguish from the
existing "curves" plural.
- I didn't rename any of the cycles/rendering code function names,
since that is also used by the old hair particle system.
Differential Revision: https://developer.blender.org/D14007
2022-02-07 11:55:54 -06:00
|
|
|
struct Curves;
|
2017-04-21 21:14:11 +10:00
|
|
|
struct Lattice;
|
|
|
|
|
struct Mesh;
|
2020-03-17 16:27:08 +01:00
|
|
|
struct PointCloud;
|
|
|
|
|
struct Volume;
|
2020-03-20 12:19:44 +11:00
|
|
|
struct bGPdata;
|
2017-04-21 21:14:11 +10:00
|
|
|
|
2020-10-09 07:27:18 +02:00
|
|
|
#include "BKE_mesh_types.h"
|
|
|
|
|
|
2021-05-21 17:28:19 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2021-12-08 20:29:39 +11:00
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Expose via BKE callbacks
|
|
|
|
|
* \{ */
|
|
|
|
|
|
2020-10-09 07:25:43 +02:00
|
|
|
void DRW_curve_batch_cache_dirty_tag(struct Curve *cu, int mode);
|
2019-05-07 23:21:16 +02:00
|
|
|
void DRW_curve_batch_cache_validate(struct Curve *cu);
|
2017-04-21 21:14:11 +10:00
|
|
|
void DRW_curve_batch_cache_free(struct Curve *cu);
|
|
|
|
|
|
2020-10-09 07:27:18 +02:00
|
|
|
void DRW_mesh_batch_cache_dirty_tag(struct Mesh *me, eMeshBatchDirtyMode mode);
|
2022-01-11 15:42:07 +01:00
|
|
|
void DRW_mesh_batch_cache_validate(struct Object *object, struct Mesh *me);
|
2022-11-15 19:15:35 -06:00
|
|
|
void DRW_mesh_batch_cache_free(void *batch_cache);
|
2017-04-21 21:14:11 +10:00
|
|
|
|
2020-10-09 07:25:43 +02:00
|
|
|
void DRW_lattice_batch_cache_dirty_tag(struct Lattice *lt, int mode);
|
2019-05-07 23:21:16 +02:00
|
|
|
void DRW_lattice_batch_cache_validate(struct Lattice *lt);
|
2017-04-21 21:14:11 +10:00
|
|
|
void DRW_lattice_batch_cache_free(struct Lattice *lt);
|
|
|
|
|
|
2020-10-09 07:25:43 +02:00
|
|
|
void DRW_particle_batch_cache_dirty_tag(struct ParticleSystem *psys, int mode);
|
2017-05-09 16:23:47 +02:00
|
|
|
void DRW_particle_batch_cache_free(struct ParticleSystem *psys);
|
|
|
|
|
|
2018-08-23 10:14:29 -03:00
|
|
|
void DRW_gpencil_batch_cache_dirty_tag(struct bGPdata *gpd);
|
2018-07-31 10:22:19 +02:00
|
|
|
void DRW_gpencil_batch_cache_free(struct bGPdata *gpd);
|
|
|
|
|
|
Curves: Rename "Hair" types, variables, and functions to "Curves"
Based on discussions from T95355 and T94193, the plan is to use
the name "Curves" to describe the data-block container for multiple
curves. Eventually this will replace the existing "Curve" data-block.
However, it will be a while before the curve data-block can be replaced
so in order to distinguish the two curve types in the UI, "Hair Curves"
will be used, but eventually changed back to "Curves".
This patch renames "hair-related" files, functions, types, and variable
names to this convention. A deep rename is preferred to keep code
consistent and to avoid any "hair" terminology from leaking, since the
new data-block is meant for all curve types, not just hair use cases.
The downside of this naming is that the difference between "Curve"
and "Curves" has become important. That was considered during
design discussons and deemed acceptable, especially given the
non-permanent nature of the somewhat common conflict.
Some points of interest:
- All DNA compatibility is lost, just like rBf59767ff9729.
- I renamed `ID_HA` to `ID_CV` so there is no complete mismatch.
- `hair_curves` is used where necessary to distinguish from the
existing "curves" plural.
- I didn't rename any of the cycles/rendering code function names,
since that is also used by the old hair particle system.
Differential Revision: https://developer.blender.org/D14007
2022-02-07 11:55:54 -06:00
|
|
|
void DRW_curves_batch_cache_dirty_tag(struct Curves *curves, int mode);
|
|
|
|
|
void DRW_curves_batch_cache_validate(struct Curves *curves);
|
|
|
|
|
void DRW_curves_batch_cache_free(struct Curves *curves);
|
2020-03-17 16:27:08 +01:00
|
|
|
|
2020-10-09 07:25:43 +02:00
|
|
|
void DRW_pointcloud_batch_cache_dirty_tag(struct PointCloud *pointcloud, int mode);
|
2020-03-17 16:27:08 +01:00
|
|
|
void DRW_pointcloud_batch_cache_validate(struct PointCloud *pointcloud);
|
|
|
|
|
void DRW_pointcloud_batch_cache_free(struct PointCloud *pointcloud);
|
|
|
|
|
|
2020-10-09 07:25:43 +02:00
|
|
|
void DRW_volume_batch_cache_dirty_tag(struct Volume *volume, int mode);
|
2020-03-17 16:27:08 +01:00
|
|
|
void DRW_volume_batch_cache_validate(struct Volume *volume);
|
|
|
|
|
void DRW_volume_batch_cache_free(struct Volume *volume);
|
|
|
|
|
|
2021-12-08 20:29:39 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Garbage Collection
|
|
|
|
|
* \{ */
|
|
|
|
|
|
2019-04-19 02:22:22 +02:00
|
|
|
void DRW_batch_cache_free_old(struct Object *ob, int ctime);
|
|
|
|
|
|
2021-12-08 20:29:39 +11:00
|
|
|
/**
|
|
|
|
|
* Thread safety need to be assured by caller. Don't call this during drawing.
|
|
|
|
|
* \note For now this only free the shading batches / VBO if any cd layers is not needed anymore.
|
|
|
|
|
*/
|
2019-04-19 02:22:22 +02:00
|
|
|
void DRW_mesh_batch_cache_free_old(struct Mesh *me, int ctime);
|
EEVEE: support Curves attributes rendering
This adds support to render Curves attributes in EEVEE.
Each attribute is stored in a texture derived from a VBO. As the
shading group needs the textures to be valid upon creation, the
attributes are created and setup during its very creation, instead
of doing it lazily via create_requested which we cannot rely on
anyway as contrary to the mesh batch, we do cannot really tell if
attributes need to be updated or else via some `DRW_batch_requested`.
Since point attributes need refinement, and since attributes are all
cast to vec4/float4 to account for differences in type conversions
between Blender and OpenGL, the refinement shader for points is
used as is. The point attributes are stored for each subdivision level
in CurvesEvalFinalCache. Each subdivision level also keeps track of the
attributes already in use so they are properly updated when needed.
Some basic garbage collection was added similar to what is done
for meshes: if the attributes used over time have been different
from the currently used attributes for too long, then the buffers
are freed, ensuring that stale attributesare removed.
This adds `CurvesInfos` to the shader creation info, which stores
the scope in which the attributes are defined. Scopes are stored
as booleans, in an array indexed by attribute loading order which
is also the order in which the attributes were added to the material.
A mapping is necessary between the indices used for the scoping, and
the ones used in the Curves cache, as this may contain stale
attributes which have not been garbage collected yet.
Common utilities with the mesh code for handling requested
attributes were moved to a separate file.
Differential Revision: https://developer.blender.org/D14916
2022-05-24 05:02:57 +02:00
|
|
|
void DRW_curves_batch_cache_free_old(struct Curves *curves, int ctime);
|
2022-10-25 10:43:47 +02:00
|
|
|
void DRW_pointcloud_batch_cache_free_old(struct PointCloud *pointcloud, int ctime);
|
2019-04-19 02:22:22 +02:00
|
|
|
|
2021-12-08 20:29:39 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Generic
|
|
|
|
|
* \{ */
|
|
|
|
|
|
2022-01-07 11:38:08 +11:00
|
|
|
void DRW_vertbuf_create_wiredata(struct GPUVertBuf *vbo, int vert_len);
|
2020-03-17 16:27:08 +01:00
|
|
|
|
2021-12-08 20:29:39 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Curve
|
|
|
|
|
* \{ */
|
|
|
|
|
|
2020-12-18 16:06:26 +01:00
|
|
|
void DRW_curve_batch_cache_create_requested(struct Object *ob, const struct Scene *scene);
|
2018-12-13 01:26:07 +01:00
|
|
|
|
2020-01-28 16:39:33 +01:00
|
|
|
int DRW_curve_material_count_get(struct Curve *cu);
|
|
|
|
|
|
2018-12-13 01:26:07 +01:00
|
|
|
struct GPUBatch *DRW_curve_batch_cache_get_wire_edge(struct Curve *cu);
|
Geometry Nodes: viewport preview
This adds support for showing geometry passed to the Viewer in the 3d
viewport (instead of just in the spreadsheet). The "viewer geometry"
bypasses the group output. So it is not necessary to change the final
output of the node group to be able to see the intermediate geometry.
**Activation and deactivation of a viewer node**
* A viewer node is activated by clicking on it.
* Ctrl+shift+click on any node/socket connects it to the viewer and
makes it active.
* Ctrl+shift+click in empty space deactivates the active viewer.
* When the active viewer is not visible anymore (e.g. another object
is selected, or the current node group is exit), it is deactivated.
* Clicking on the icon in the header of the Viewer node toggles whether
its active or not.
**Pinning**
* The spreadsheet still allows pinning the active viewer as before.
When pinned, the spreadsheet still references the viewer node even
when it becomes inactive.
* The viewport does not support pinning at the moment. It always shows
the active viewer.
**Attribute**
* When a field is linked to the second input of the viewer node it is
displayed as an overlay in the viewport.
* When possible the correct domain for the attribute is determined
automatically. This does not work in all cases. It falls back to the
face corner domain on meshes and the point domain on curves. When
necessary, the domain can be picked manually.
* The spreadsheet now only shows the "Viewer" column for the domain
that is selected in the Viewer node.
* Instance attributes are visualized as a constant color per instance.
**Viewport Options**
* The attribute overlay opacity can be controlled with the "Viewer Node"
setting in the overlays popover.
* A viewport can be configured not to show intermediate viewer-geometry
by disabling the "Viewer Node" option in the "View" menu.
**Implementation Details**
* The "spreadsheet context path" was generalized to a "viewer path" that
is used in more places now.
* The viewer node itself determines the attribute domain, evaluates the
field and stores the result in a `.viewer` attribute.
* A new "viewer attribute' overlay displays the data from the `.viewer`
attribute.
* The ground truth for the active viewer node is stored in the workspace
now. Node editors, spreadsheets and viewports retrieve the active
viewer from there unless they are pinned.
* The depsgraph object iterator has a new "viewer path" setting. When set,
the viewed geometry of the corresponding object is part of the iterator
instead of the final evaluated geometry.
* To support the instance attribute overlay `DupliObject` was extended
to contain the information necessary for drawing the overlay.
* The ctrl+shift+click operator has been refactored so that it can make
existing links to viewers active again.
* The auto-domain-detection in the Viewer node works by checking the
"preferred domain" for every field input. If there is not exactly one
preferred domain, the fallback is used.
Known limitations:
* Loose edges of meshes don't have the attribute overlay. This could be
added separately if necessary.
* Some attributes are hard to visualize as a color directly. For example,
the values might have to be normalized or some should be drawn as arrays.
For now, we encourage users to build node groups that generate appropriate
viewer-geometry. We might include some of that functionality in future versions.
Support for displaying attribute values as text in the viewport is planned as well.
* There seems to be an issue with the attribute overlay for pointclouds on
nvidia gpus, to be investigated.
Differential Revision: https://developer.blender.org/D15954
2022-09-28 17:54:59 +02:00
|
|
|
struct GPUBatch *DRW_curve_batch_cache_get_wire_edge_viewer_attribute(struct Curve *cu);
|
2018-12-13 01:26:07 +01:00
|
|
|
struct GPUBatch *DRW_curve_batch_cache_get_normal_edge(struct Curve *cu);
|
2018-12-10 15:29:04 +01:00
|
|
|
struct GPUBatch *DRW_curve_batch_cache_get_edit_edges(struct Curve *cu);
|
2020-05-13 21:20:18 +02:00
|
|
|
struct GPUBatch *DRW_curve_batch_cache_get_edit_verts(struct Curve *cu);
|
2017-04-21 21:14:11 +10:00
|
|
|
|
2021-12-08 20:29:39 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Lattice
|
|
|
|
|
* \{ */
|
|
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
struct GPUBatch *DRW_lattice_batch_cache_get_all_edges(struct Lattice *lt,
|
|
|
|
|
bool use_weight,
|
2022-01-07 11:38:08 +11:00
|
|
|
int actdef);
|
2018-07-18 00:12:21 +02:00
|
|
|
struct GPUBatch *DRW_lattice_batch_cache_get_all_verts(struct Lattice *lt);
|
2018-12-10 15:29:04 +01:00
|
|
|
struct GPUBatch *DRW_lattice_batch_cache_get_edit_verts(struct Lattice *lt);
|
2017-04-21 21:14:11 +10:00
|
|
|
|
2021-12-08 20:29:39 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
2022-06-17 09:44:37 +02:00
|
|
|
/** \name Curves
|
2021-12-08 20:29:39 +11:00
|
|
|
* \{ */
|
|
|
|
|
|
Curves: Rename "Hair" types, variables, and functions to "Curves"
Based on discussions from T95355 and T94193, the plan is to use
the name "Curves" to describe the data-block container for multiple
curves. Eventually this will replace the existing "Curve" data-block.
However, it will be a while before the curve data-block can be replaced
so in order to distinguish the two curve types in the UI, "Hair Curves"
will be used, but eventually changed back to "Curves".
This patch renames "hair-related" files, functions, types, and variable
names to this convention. A deep rename is preferred to keep code
consistent and to avoid any "hair" terminology from leaking, since the
new data-block is meant for all curve types, not just hair use cases.
The downside of this naming is that the difference between "Curve"
and "Curves" has become important. That was considered during
design discussons and deemed acceptable, especially given the
non-permanent nature of the somewhat common conflict.
Some points of interest:
- All DNA compatibility is lost, just like rBf59767ff9729.
- I renamed `ID_HA` to `ID_CV` so there is no complete mismatch.
- `hair_curves` is used where necessary to distinguish from the
existing "curves" plural.
- I didn't rename any of the cycles/rendering code function names,
since that is also used by the old hair particle system.
Differential Revision: https://developer.blender.org/D14007
2022-02-07 11:55:54 -06:00
|
|
|
int DRW_curves_material_count_get(struct Curves *curves);
|
2020-03-17 16:27:08 +01:00
|
|
|
|
2022-07-07 08:06:30 -05:00
|
|
|
/**
|
|
|
|
|
* Provide GPU access to a specific evaluated attribute on curves.
|
|
|
|
|
*
|
|
|
|
|
* \return A pointer to location where the texture will be
|
|
|
|
|
* stored, which will be filled by #DRW_shgroup_curves_create_sub.
|
|
|
|
|
*/
|
2022-10-25 16:16:58 +02:00
|
|
|
struct GPUVertBuf **DRW_curves_texture_for_evaluated_attribute(struct Curves *curves,
|
2022-07-07 08:06:30 -05:00
|
|
|
const char *name,
|
|
|
|
|
bool *r_is_point_domain);
|
|
|
|
|
|
2022-06-17 09:44:37 +02:00
|
|
|
struct GPUBatch *DRW_curves_batch_cache_get_edit_points(struct Curves *curves);
|
2022-12-06 14:49:44 +01:00
|
|
|
struct GPUBatch *DRW_curves_batch_cache_get_edit_lines(struct Curves *curves);
|
2022-06-17 09:44:37 +02:00
|
|
|
|
|
|
|
|
void DRW_curves_batch_cache_create_requested(struct Object *ob);
|
|
|
|
|
|
2021-12-08 20:29:39 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name PointCloud
|
|
|
|
|
* \{ */
|
|
|
|
|
|
2020-03-17 16:27:08 +01:00
|
|
|
int DRW_pointcloud_material_count_get(struct PointCloud *pointcloud);
|
|
|
|
|
|
2022-10-25 10:43:47 +02:00
|
|
|
struct GPUVertBuf **DRW_pointcloud_evaluated_attribute(struct PointCloud *pointcloud,
|
|
|
|
|
const char *name);
|
2020-03-17 16:27:08 +01:00
|
|
|
struct GPUBatch *DRW_pointcloud_batch_cache_get_dots(struct Object *ob);
|
2022-10-25 10:43:47 +02:00
|
|
|
|
|
|
|
|
void DRW_pointcloud_batch_cache_create_requested(struct Object *ob);
|
2020-03-17 16:27:08 +01:00
|
|
|
|
2021-12-08 20:29:39 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Volume
|
|
|
|
|
* \{ */
|
|
|
|
|
|
2020-03-17 16:27:08 +01:00
|
|
|
int DRW_volume_material_count_get(struct Volume *volume);
|
|
|
|
|
|
|
|
|
|
struct GPUBatch *DRW_volume_batch_cache_get_wireframes_face(struct Volume *volume);
|
2020-09-29 12:39:41 +02:00
|
|
|
struct GPUBatch *DRW_volume_batch_cache_get_selection_surface(struct Volume *volume);
|
2020-03-17 16:27:08 +01:00
|
|
|
|
2021-12-08 20:29:39 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Mesh
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Can be called for any surface type. Mesh *me is the final mesh.
|
|
|
|
|
*/
|
2020-06-02 15:07:17 +02:00
|
|
|
void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph,
|
|
|
|
|
struct Object *ob,
|
2018-12-22 21:00:23 +01:00
|
|
|
struct Mesh *me,
|
2019-07-14 16:49:44 +02:00
|
|
|
const struct Scene *scene,
|
2022-01-07 11:38:08 +11:00
|
|
|
bool is_paint_mode,
|
|
|
|
|
bool use_hide);
|
2018-12-08 20:10:20 +01:00
|
|
|
|
2018-12-18 17:10:38 +01:00
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_all_verts(struct Mesh *me);
|
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_all_edges(struct Mesh *me);
|
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_loose_edges(struct Mesh *me);
|
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_edge_detection(struct Mesh *me, bool *r_is_manifold);
|
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_surface(struct Mesh *me);
|
2022-01-11 15:42:07 +01:00
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_surface_edges(struct Object *object, struct Mesh *me);
|
|
|
|
|
struct GPUBatch **DRW_mesh_batch_cache_get_surface_shaded(struct Object *object,
|
|
|
|
|
struct Mesh *me,
|
2018-12-16 15:17:31 +01:00
|
|
|
struct GPUMaterial **gpumat_array,
|
2020-01-17 16:05:19 +01:00
|
|
|
uint gpumat_array_len);
|
2022-09-28 14:51:23 -07:00
|
|
|
|
2022-01-11 15:42:07 +01:00
|
|
|
struct GPUBatch **DRW_mesh_batch_cache_get_surface_texpaint(struct Object *object,
|
|
|
|
|
struct Mesh *me);
|
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_surface_texpaint_single(struct Object *object,
|
|
|
|
|
struct Mesh *me);
|
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_surface_vertpaint(struct Object *object,
|
|
|
|
|
struct Mesh *me);
|
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_surface_sculpt(struct Object *object, struct Mesh *me);
|
2018-12-18 17:10:38 +01:00
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_surface_weights(struct Mesh *me);
|
2020-09-18 19:30:02 +02:00
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_sculpt_overlays(struct Mesh *me);
|
Geometry Nodes: viewport preview
This adds support for showing geometry passed to the Viewer in the 3d
viewport (instead of just in the spreadsheet). The "viewer geometry"
bypasses the group output. So it is not necessary to change the final
output of the node group to be able to see the intermediate geometry.
**Activation and deactivation of a viewer node**
* A viewer node is activated by clicking on it.
* Ctrl+shift+click on any node/socket connects it to the viewer and
makes it active.
* Ctrl+shift+click in empty space deactivates the active viewer.
* When the active viewer is not visible anymore (e.g. another object
is selected, or the current node group is exit), it is deactivated.
* Clicking on the icon in the header of the Viewer node toggles whether
its active or not.
**Pinning**
* The spreadsheet still allows pinning the active viewer as before.
When pinned, the spreadsheet still references the viewer node even
when it becomes inactive.
* The viewport does not support pinning at the moment. It always shows
the active viewer.
**Attribute**
* When a field is linked to the second input of the viewer node it is
displayed as an overlay in the viewport.
* When possible the correct domain for the attribute is determined
automatically. This does not work in all cases. It falls back to the
face corner domain on meshes and the point domain on curves. When
necessary, the domain can be picked manually.
* The spreadsheet now only shows the "Viewer" column for the domain
that is selected in the Viewer node.
* Instance attributes are visualized as a constant color per instance.
**Viewport Options**
* The attribute overlay opacity can be controlled with the "Viewer Node"
setting in the overlays popover.
* A viewport can be configured not to show intermediate viewer-geometry
by disabling the "Viewer Node" option in the "View" menu.
**Implementation Details**
* The "spreadsheet context path" was generalized to a "viewer path" that
is used in more places now.
* The viewer node itself determines the attribute domain, evaluates the
field and stores the result in a `.viewer` attribute.
* A new "viewer attribute' overlay displays the data from the `.viewer`
attribute.
* The ground truth for the active viewer node is stored in the workspace
now. Node editors, spreadsheets and viewports retrieve the active
viewer from there unless they are pinned.
* The depsgraph object iterator has a new "viewer path" setting. When set,
the viewed geometry of the corresponding object is part of the iterator
instead of the final evaluated geometry.
* To support the instance attribute overlay `DupliObject` was extended
to contain the information necessary for drawing the overlay.
* The ctrl+shift+click operator has been refactored so that it can make
existing links to viewers active again.
* The auto-domain-detection in the Viewer node works by checking the
"preferred domain" for every field input. If there is not exactly one
preferred domain, the fallback is used.
Known limitations:
* Loose edges of meshes don't have the attribute overlay. This could be
added separately if necessary.
* Some attributes are hard to visualize as a color directly. For example,
the values might have to be normalized or some should be drawn as arrays.
For now, we encourage users to build node groups that generate appropriate
viewer-geometry. We might include some of that functionality in future versions.
Support for displaying attribute values as text in the viewport is planned as well.
* There seems to be an issue with the attribute overlay for pointclouds on
nvidia gpus, to be investigated.
Differential Revision: https://developer.blender.org/D15954
2022-09-28 17:54:59 +02:00
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_surface_viewer_attribute(struct Mesh *me);
|
2021-12-08 20:29:39 +11:00
|
|
|
|
|
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Edit-Mesh Drawing
|
|
|
|
|
* \{ */
|
|
|
|
|
|
2018-12-10 15:29:04 +01:00
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_edit_triangles(struct Mesh *me);
|
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_edit_vertices(struct Mesh *me);
|
2019-02-04 01:13:51 +01:00
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_edit_edges(struct Mesh *me);
|
2022-12-17 12:47:43 +11:00
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_edit_vert_normals(struct Mesh *me);
|
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_edit_loop_normals(struct Mesh *me);
|
2018-12-10 15:29:04 +01:00
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_edit_facedots(struct Mesh *me);
|
2019-10-15 01:49:53 +02:00
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_edit_skin_roots(struct Mesh *me);
|
2021-12-08 20:29:39 +11:00
|
|
|
|
|
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Edit-mesh Selection
|
|
|
|
|
* \{ */
|
|
|
|
|
|
2018-12-22 23:57:12 +01:00
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_triangles_with_select_id(struct Mesh *me);
|
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_facedots_with_select_id(struct Mesh *me);
|
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_edges_with_select_id(struct Mesh *me);
|
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_verts_with_select_id(struct Mesh *me);
|
2021-12-08 20:29:39 +11:00
|
|
|
|
|
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Object Mode Wireframe Overlays
|
|
|
|
|
* \{ */
|
|
|
|
|
|
2018-12-07 05:03:01 +01:00
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_wireframes_face(struct Mesh *me);
|
2021-12-08 20:29:39 +11:00
|
|
|
|
|
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Edit-mesh UV Editor
|
|
|
|
|
* \{ */
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Creates the #GPUBatch for drawing the UV Stretching Area Overlay.
|
|
|
|
|
* Optional retrieves the total area or total uv area of the mesh.
|
|
|
|
|
*
|
|
|
|
|
* The `cache->tot_area` and cache->tot_uv_area` update are calculation are
|
|
|
|
|
* only valid after calling `DRW_mesh_batch_cache_create_requested`.
|
|
|
|
|
*/
|
2022-01-11 15:42:07 +01:00
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_edituv_faces_stretch_area(struct Object *object,
|
|
|
|
|
struct Mesh *me,
|
2019-09-27 16:40:18 +02:00
|
|
|
float **tot_area,
|
|
|
|
|
float **tot_uv_area);
|
2022-01-11 15:42:07 +01:00
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_edituv_faces_stretch_angle(struct Object *object,
|
|
|
|
|
struct Mesh *me);
|
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_edituv_faces(struct Object *object, struct Mesh *me);
|
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_edituv_edges(struct Object *object, struct Mesh *me);
|
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_edituv_verts(struct Object *object, struct Mesh *me);
|
|
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_edituv_facedots(struct Object *object, struct Mesh *me);
|
2021-12-08 20:29:39 +11:00
|
|
|
|
|
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name For Image UV Editor
|
|
|
|
|
* \{ */
|
|
|
|
|
|
2022-01-11 15:42:07 +01:00
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_uv_edges(struct Object *object, struct Mesh *me);
|
2019-04-18 08:00:59 +02:00
|
|
|
struct GPUBatch *DRW_mesh_batch_cache_get_edit_mesh_analysis(struct Mesh *me);
|
2017-04-21 21:14:11 +10:00
|
|
|
|
2021-12-08 20:29:39 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name For Direct Data Access
|
|
|
|
|
* \{ */
|
|
|
|
|
|
2020-06-19 17:02:55 +02:00
|
|
|
struct GPUVertBuf *DRW_mesh_batch_cache_pos_vertbuf_get(struct Mesh *me);
|
|
|
|
|
|
2022-01-11 15:42:07 +01:00
|
|
|
int DRW_mesh_material_count_get(const struct Object *object, const struct Mesh *me);
|
2020-01-28 16:39:33 +01:00
|
|
|
|
2018-09-05 17:02:00 +02:00
|
|
|
/* Edit mesh bitflags (is this the right place?) */
|
|
|
|
|
enum {
|
2019-02-04 01:13:51 +01:00
|
|
|
VFLAG_VERT_ACTIVE = 1 << 0,
|
|
|
|
|
VFLAG_VERT_SELECTED = 1 << 1,
|
2020-06-15 15:28:51 +10:00
|
|
|
VFLAG_VERT_SELECTED_BEZT_HANDLE = 1 << 2,
|
|
|
|
|
VFLAG_EDGE_ACTIVE = 1 << 3,
|
|
|
|
|
VFLAG_EDGE_SELECTED = 1 << 4,
|
|
|
|
|
VFLAG_EDGE_SEAM = 1 << 5,
|
|
|
|
|
VFLAG_EDGE_SHARP = 1 << 6,
|
|
|
|
|
VFLAG_EDGE_FREESTYLE = 1 << 7,
|
|
|
|
|
/* Beware to not go over 1 << 7 (it's a byte flag). */
|
2021-01-04 15:31:53 +01:00
|
|
|
/* NOTE: Grease pencil edit curve use another type of data format that allows for this value. */
|
|
|
|
|
VFLAG_VERT_GPENCIL_BEZT_HANDLE = 1 << 30,
|
2018-09-05 17:02:00 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum {
|
2019-02-04 01:13:51 +01:00
|
|
|
VFLAG_FACE_ACTIVE = 1 << 0,
|
|
|
|
|
VFLAG_FACE_SELECTED = 1 << 1,
|
|
|
|
|
VFLAG_FACE_FREESTYLE = 1 << 2,
|
|
|
|
|
VFLAG_VERT_UV_SELECT = 1 << 3,
|
|
|
|
|
VFLAG_VERT_UV_PINNED = 1 << 4,
|
|
|
|
|
VFLAG_EDGE_UV_SELECT = 1 << 5,
|
|
|
|
|
VFLAG_FACE_UV_ACTIVE = 1 << 6,
|
|
|
|
|
VFLAG_FACE_UV_SELECT = 1 << 7,
|
2020-06-15 15:28:51 +10:00
|
|
|
/* Beware to not go over 1 << 7 (it's a byte flag). */
|
2018-09-05 17:02:00 +02:00
|
|
|
};
|
|
|
|
|
|
2021-12-08 20:29:39 +11:00
|
|
|
/** \} */
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------- */
|
|
|
|
|
/** \name Particles
|
|
|
|
|
* \{ */
|
|
|
|
|
|
2018-07-18 00:12:21 +02:00
|
|
|
struct GPUBatch *DRW_particles_batch_cache_get_hair(struct Object *object,
|
2018-05-26 10:41:25 +02:00
|
|
|
struct ParticleSystem *psys,
|
|
|
|
|
struct ModifierData *md);
|
2018-07-18 00:12:21 +02:00
|
|
|
struct GPUBatch *DRW_particles_batch_cache_get_dots(struct Object *object,
|
2018-05-26 10:41:25 +02:00
|
|
|
struct ParticleSystem *psys);
|
2018-07-18 00:12:21 +02:00
|
|
|
struct GPUBatch *DRW_particles_batch_cache_get_edit_strands(struct Object *object,
|
2018-11-27 13:49:00 +01:00
|
|
|
struct ParticleSystem *psys,
|
|
|
|
|
struct PTCacheEdit *edit,
|
|
|
|
|
bool use_weight);
|
2018-07-18 00:12:21 +02:00
|
|
|
struct GPUBatch *DRW_particles_batch_cache_get_edit_inner_points(struct Object *object,
|
2018-05-26 10:41:25 +02:00
|
|
|
struct ParticleSystem *psys,
|
|
|
|
|
struct PTCacheEdit *edit);
|
2018-07-18 00:12:21 +02:00
|
|
|
struct GPUBatch *DRW_particles_batch_cache_get_edit_tip_points(struct Object *object,
|
2018-05-26 10:41:25 +02:00
|
|
|
struct ParticleSystem *psys,
|
|
|
|
|
struct PTCacheEdit *edit);
|
2021-12-08 20:29:39 +11:00
|
|
|
|
|
|
|
|
/** \} */
|
|
|
|
|
|
2021-05-21 17:28:19 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|