BLI: refactor IndexMask for better performance and memory usage #104629
|
@ -331,7 +331,7 @@ static void apply_selection_operation_at_index(GMutableSpan selection,
|
|||
selection_typed[index] = false;
|
||||
break;
|
||||
case SEL_OP_XOR:
|
||||
selection_typed[index] ^= selection_typed[index];
|
||||
selection_typed[index] = !selection_typed[index];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -1924,31 +1924,40 @@ void EDBM_project_snap_verts(
|
|||
|
||||
ED_view3d_init_mats_rv3d(obedit, region->regiondata);
|
||||
|
||||
struct SnapObjectContext *snap_context = ED_transform_snap_object_context_create(
|
||||
CTX_data_scene(C), 0);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
struct SnapObjectContext *snap_context = ED_transform_snap_object_context_create(scene, 0);
|
||||
|
||||
eSnapTargetOP target_op = SCE_SNAP_TARGET_NOT_ACTIVE;
|
||||
const int snap_flag = scene->toolsettings->snap_flag;
|
||||
|
||||
SET_FLAG_FROM_TEST(
|
||||
target_op, !(snap_flag & SCE_SNAP_TO_INCLUDE_EDITED), SCE_SNAP_TARGET_NOT_EDITED);
|
||||
SET_FLAG_FROM_TEST(
|
||||
target_op, !(snap_flag & SCE_SNAP_TO_INCLUDE_NONEDITED), SCE_SNAP_TARGET_NOT_NONEDITED);
|
||||
SET_FLAG_FROM_TEST(
|
||||
target_op, (snap_flag & SCE_SNAP_TO_ONLY_SELECTABLE), SCE_SNAP_TARGET_ONLY_SELECTABLE);
|
||||
|
||||
BM_ITER_MESH (eve, &iter, em->bm, BM_VERTS_OF_MESH) {
|
||||
if (BM_elem_flag_test(eve, BM_ELEM_SELECT)) {
|
||||
float mval[2], co_proj[3];
|
||||
if (ED_view3d_project_float_object(region, eve->co, mval, V3D_PROJ_TEST_NOP) ==
|
||||
V3D_PROJ_RET_OK) {
|
||||
if (ED_transform_snap_object_project_view3d(
|
||||
snap_context,
|
||||
depsgraph,
|
||||
region,
|
||||
CTX_wm_view3d(C),
|
||||
SCE_SNAP_MODE_FACE_RAYCAST,
|
||||
&(const struct SnapObjectParams){
|
||||
.snap_target_select = SCE_SNAP_TARGET_NOT_ACTIVE,
|
||||
.edit_mode_type = SNAP_GEOM_FINAL,
|
||||
.use_occlusion_test = true,
|
||||
},
|
||||
NULL,
|
||||
mval,
|
||||
NULL,
|
||||
NULL,
|
||||
co_proj,
|
||||
NULL)) {
|
||||
if (ED_transform_snap_object_project_view3d(snap_context,
|
||||
depsgraph,
|
||||
region,
|
||||
CTX_wm_view3d(C),
|
||||
SCE_SNAP_MODE_FACE_RAYCAST,
|
||||
&(const struct SnapObjectParams){
|
||||
.snap_target_select = target_op,
|
||||
.edit_mode_type = SNAP_GEOM_FINAL,
|
||||
.use_occlusion_test = true,
|
||||
},
|
||||
NULL,
|
||||
mval,
|
||||
NULL,
|
||||
NULL,
|
||||
co_proj,
|
||||
NULL)) {
|
||||
mul_v3_m4v3(eve->co, obedit->world_to_object, co_proj);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -211,6 +211,12 @@ typedef enum {
|
|||
HLP_TRACKBALL = 6,
|
||||
} eTHelpline;
|
||||
|
||||
typedef enum {
|
||||
O_DEFAULT = 0,
|
||||
O_SCENE,
|
||||
O_SET,
|
||||
} eTOType;
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
@ -607,11 +613,7 @@ typedef struct TransInfo {
|
|||
float matrix[3][3];
|
||||
} orient[3];
|
||||
|
||||
enum {
|
||||
O_DEFAULT = 0,
|
||||
O_SCENE,
|
||||
O_SET,
|
||||
} orient_curr;
|
||||
eTOType orient_curr;
|
||||
|
||||
/**
|
||||
* All values from `TransInfo.orient[].type` converted into a flag
|
||||
|
|
|
@ -1165,6 +1165,7 @@ void setNearestAxis(TransInfo *t)
|
|||
|
||||
if (mode_prev != t->con.mode) {
|
||||
projection_matrix_calc(t, t->con.pmtx);
|
||||
transform_gizmo_3d_model_from_constraint_and_mode_set(t);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2730,7 +2730,7 @@ void transform_gizmo_3d_model_from_constraint_and_mode_set(TransInfo *t)
|
|||
|
||||
int axis_idx = -1;
|
||||
if (t->mode == TFM_TRACKBALL) {
|
||||
axis_idx = MAN_AXIS_ROT_T;
|
||||
/* Pass. Do not display gizmo. */
|
||||
}
|
||||
else if (ELEM(t->mode, TFM_TRANSLATION, TFM_ROTATION, TFM_RESIZE)) {
|
||||
const int axis_map[3][7] = {
|
||||
|
@ -2776,15 +2776,17 @@ void transform_gizmo_3d_model_from_constraint_and_mode_set(TransInfo *t)
|
|||
wmGizmo *gizmo_modal_current = WM_gizmomap_get_modal(t->region->gizmo_map);
|
||||
if (axis_idx != -1) {
|
||||
RegionView3D *rv3d = static_cast<RegionView3D *>(t->region->regiondata);
|
||||
bool update_orientation = !(equals_v3v3(rv3d->twmat[0], t->spacemtx[0]) &&
|
||||
equals_v3v3(rv3d->twmat[1], t->spacemtx[1]) &&
|
||||
equals_v3v3(rv3d->twmat[2], t->spacemtx[2]));
|
||||
float(*mat_cmp)[3] = t->orient[t->orient_curr != O_DEFAULT ? t->orient_curr : O_SCENE].matrix;
|
||||
|
||||
bool update_orientation = !(equals_v3v3(rv3d->twmat[0], mat_cmp[0]) &&
|
||||
equals_v3v3(rv3d->twmat[1], mat_cmp[1]) &&
|
||||
equals_v3v3(rv3d->twmat[2], mat_cmp[2]));
|
||||
|
||||
GizmoGroup *ggd = static_cast<GizmoGroup *>(gzgroup_xform->customdata);
|
||||
wmGizmo *gizmo_expected = ggd->gizmos[axis_idx];
|
||||
if (update_orientation || gizmo_modal_current != gizmo_expected) {
|
||||
if (update_orientation) {
|
||||
copy_m4_m3(rv3d->twmat, t->spacemtx);
|
||||
copy_m4_m3(rv3d->twmat, mat_cmp);
|
||||
copy_v3_v3(rv3d->twmat[3], t->center_global);
|
||||
}
|
||||
|
||||
|
|
|
@ -127,6 +127,8 @@ list(APPEND LIB
|
|||
${BOOST_LIBRARIES}
|
||||
${BOOST_PYTHON_LIBRARIES}
|
||||
${PYTHON_LIBRARIES}
|
||||
${USD_LIBRARIES}
|
||||
${TBB_LIBRARIES}
|
||||
)
|
||||
|
||||
if(WITH_OPENVDB)
|
||||
|
@ -141,27 +143,6 @@ endif()
|
|||
|
||||
blender_add_lib(bf_usd "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
|
||||
|
||||
if(WIN32)
|
||||
set_property(TARGET bf_usd APPEND_STRING PROPERTY INTERFACE_LINK_OPTIONS "$<$<CONFIG:Debug>:/WHOLEARCHIVE:${USD_DEBUG_LIB}>")
|
||||
set_property(TARGET bf_usd APPEND_STRING PROPERTY INTERFACE_LINK_OPTIONS "$<$<CONFIG:Release>:/WHOLEARCHIVE:${USD_RELEASE_LIB}>")
|
||||
set_property(TARGET bf_usd APPEND_STRING PROPERTY INTERFACE_LINK_OPTIONS "$<$<CONFIG:RelWithDebInfo>:/WHOLEARCHIVE:${USD_RELEASE_LIB}>")
|
||||
set_property(TARGET bf_usd APPEND_STRING PROPERTY INTERFACE_LINK_OPTIONS "$<$<CONFIG:MinSizeRel>:/WHOLEARCHIVE:${USD_RELEASE_LIB}>")
|
||||
endif()
|
||||
|
||||
# Source:
|
||||
# https://github.com/PixarAnimationStudios/USD/blob/master/BUILDING.md#linking-whole-archives
|
||||
if(WIN32)
|
||||
target_link_libraries(bf_usd INTERFACE ${USD_LIBRARIES})
|
||||
elseif(APPLE)
|
||||
target_link_libraries(bf_usd INTERFACE -Wl,-force_load ${USD_LIBRARIES})
|
||||
elseif(UNIX)
|
||||
target_link_libraries(bf_usd INTERFACE "-Wl,--whole-archive ${USD_LIBRARIES} -Wl,--no-whole-archive ${TBB_LIBRARIES}")
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown how to link USD with your compiler ${CMAKE_CXX_COMPILER_ID}")
|
||||
endif()
|
||||
|
||||
target_link_libraries(bf_usd INTERFACE ${TBB_LIBRARIES})
|
||||
|
||||
if(WITH_GTESTS)
|
||||
set(TEST_SRC
|
||||
tests/usd_stage_creation_test.cc
|
||||
|
|
Loading…
Reference in New Issue