WIP: Brush assets project #106303
|
@ -825,7 +825,7 @@ static void create_mesh(Scene *scene,
|
|||
const blender::OffsetIndices faces = b_mesh.faces();
|
||||
const blender::Span<int> corner_verts = b_mesh.corner_verts();
|
||||
const blender::bke::AttributeAccessor b_attributes = b_mesh.attributes();
|
||||
const blender::bke::MeshNormalDomain normals_domain = b_mesh.normals_domain();
|
||||
const blender::bke::MeshNormalDomain normals_domain = b_mesh.normals_domain(true);
|
||||
int numfaces = (!subdivision) ? b_mesh.corner_tris().size() : faces.size();
|
||||
|
||||
bool use_loop_normals = normals_domain == blender::bke::MeshNormalDomain::Corner &&
|
||||
|
|
|
@ -198,7 +198,7 @@ void normals_calc_verts(const Span<float3> vert_positions,
|
|||
/** \name Mesh Normal Calculation
|
||||
* \{ */
|
||||
|
||||
blender::bke::MeshNormalDomain Mesh::normals_domain() const
|
||||
blender::bke::MeshNormalDomain Mesh::normals_domain(const bool support_sharp_face) const
|
||||
{
|
||||
using namespace blender;
|
||||
using namespace blender::bke;
|
||||
|
@ -227,7 +227,7 @@ blender::bke::MeshNormalDomain Mesh::normals_domain() const
|
|||
}
|
||||
|
||||
if (edge_mix == array_utils::BooleanMix::AllFalse &&
|
||||
face_mix == array_utils::BooleanMix::AllFalse)
|
||||
(face_mix == array_utils::BooleanMix::AllFalse || support_sharp_face))
|
||||
{
|
||||
return MeshNormalDomain::Point;
|
||||
}
|
||||
|
|
|
@ -171,7 +171,7 @@ struct CurvesConstraintSolver {
|
|||
}
|
||||
};
|
||||
|
||||
} // namespace blender::ed::sculpt_paint
|
||||
bool curves_sculpt_poll(bContext *C);
|
||||
bool curves_sculpt_poll_view3d(bContext *C);
|
||||
|
||||
bool CURVES_SCULPT_mode_poll(bContext *C);
|
||||
bool CURVES_SCULPT_mode_poll_view3d(bContext *C);
|
||||
} // namespace blender::ed::sculpt_paint
|
||||
|
|
|
@ -57,19 +57,21 @@
|
|||
#include "GPU_matrix.h"
|
||||
#include "GPU_state.h"
|
||||
|
||||
namespace blender::ed::sculpt_paint {
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Poll Functions
|
||||
* \{ */
|
||||
|
||||
bool CURVES_SCULPT_mode_poll(bContext *C)
|
||||
bool curves_sculpt_poll(bContext *C)
|
||||
{
|
||||
const Object *ob = CTX_data_active_object(C);
|
||||
return ob && ob->mode & OB_MODE_SCULPT_CURVES;
|
||||
}
|
||||
|
||||
bool CURVES_SCULPT_mode_poll_view3d(bContext *C)
|
||||
bool curves_sculpt_poll_view3d(bContext *C)
|
||||
{
|
||||
if (!CURVES_SCULPT_mode_poll(C)) {
|
||||
if (!curves_sculpt_poll(C)) {
|
||||
return false;
|
||||
}
|
||||
if (CTX_wm_region_view3d(C) == nullptr) {
|
||||
|
@ -80,10 +82,6 @@ bool CURVES_SCULPT_mode_poll_view3d(bContext *C)
|
|||
|
||||
/** \} */
|
||||
|
||||
namespace blender::ed::sculpt_paint {
|
||||
|
||||
using blender::bke::CurvesGeometry;
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Brush Stroke Operator
|
||||
* \{ */
|
||||
|
@ -301,7 +299,7 @@ static void curves_sculptmode_enter(bContext *C)
|
|||
copy_v3_v3_uchar(paint->paint_cursor_col, PAINT_CURSOR_SCULPT_CURVES);
|
||||
paint->paint_cursor_col[3] = 128;
|
||||
|
||||
ED_paint_cursor_start(&curves_sculpt->paint, CURVES_SCULPT_mode_poll_view3d);
|
||||
ED_paint_cursor_start(&curves_sculpt->paint, curves_sculpt_poll_view3d);
|
||||
paint_init_pivot(ob, scene);
|
||||
|
||||
/* Necessary to change the object mode on the evaluated object. */
|
||||
|
@ -1201,7 +1199,7 @@ static void SCULPT_CURVES_OT_brush_asset_select(wmOperatorType *ot)
|
|||
ot->idname = "SCULPT_CURVES_OT_brush_asset_select";
|
||||
|
||||
ot->exec = brush_asset_select_exec;
|
||||
ot->poll = CURVES_SCULPT_mode_poll;
|
||||
ot->poll = curves_sculpt_poll;
|
||||
|
||||
ot->prop = RNA_def_string(
|
||||
ot->srna, "name", nullptr, MAX_NAME, "Brush Name", "Name of the brush asset to select");
|
||||
|
|
|
@ -1600,7 +1600,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
|
|||
|
||||
/* Curves Sculpt mode. */
|
||||
keymap = WM_keymap_ensure(keyconf, "Sculpt Curves", SPACE_EMPTY, RGN_TYPE_WINDOW);
|
||||
keymap->poll = CURVES_SCULPT_mode_poll;
|
||||
keymap->poll = curves_sculpt_poll;
|
||||
|
||||
/* sculpt expand. */
|
||||
expand::modal_keymap(keyconf);
|
||||
|
|
|
@ -379,8 +379,11 @@ typedef struct Mesh {
|
|||
* When possible, it's preferred to use face normals over vertex normals and vertex normals over
|
||||
* face corner normals, since there is a 2-4x performance cost increase for each more complex
|
||||
* domain.
|
||||
*
|
||||
* Optionally the consumer of the mesh can indicate that they support the sharp_face attribute
|
||||
* natively, to avoid using corner normals in some cases.
|
||||
*/
|
||||
blender::bke::MeshNormalDomain normals_domain() const;
|
||||
blender::bke::MeshNormalDomain normals_domain(const bool support_sharp_face = false) const;
|
||||
/**
|
||||
* Normal direction of polygons, defined by positions and the winding direction of face corners.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue