Merge branch 'master' into sculpt-dev
This commit is contained in:
commit
931a8da26c
|
@ -63,3 +63,19 @@ diff -Naur org/CMakeLists.txt external_osl/CMakeLists.txt
|
|||
|
||||
set (OSL_NO_DEFAULT_TEXTURESYSTEM OFF CACHE BOOL "Do not use create a raw OIIO::TextureSystem")
|
||||
if (OSL_NO_DEFAULT_TEXTURESYSTEM)
|
||||
diff --git a/src/liboslexec/llvm_util.cpp b/src/liboslexec/llvm_util.cpp
|
||||
index 445f6400..3d468de2 100644
|
||||
--- a/src/liboslexec/llvm_util.cpp
|
||||
+++ b/src/liboslexec/llvm_util.cpp
|
||||
@@ -3430,8 +3430,9 @@ LLVM_Util::call_function (llvm::Value *func, cspan<llvm::Value *> args)
|
||||
#endif
|
||||
//llvm_gen_debug_printf (std::string("start ") + std::string(name));
|
||||
#if OSL_LLVM_VERSION >= 110
|
||||
- OSL_DASSERT(llvm::isa<llvm::Function>(func));
|
||||
- llvm::Value *r = builder().CreateCall(llvm::cast<llvm::Function>(func), llvm::ArrayRef<llvm::Value *>(args.data(), args.size()));
|
||||
+ llvm::Value* r = builder().CreateCall(
|
||||
+ llvm::cast<llvm::FunctionType>(func->getType()->getPointerElementType()), func,
|
||||
+ llvm::ArrayRef<llvm::Value*>(args.data(), args.size()));
|
||||
#else
|
||||
llvm::Value *r = builder().CreateCall (func, llvm::ArrayRef<llvm::Value *>(args.data(), args.size()));
|
||||
#endif
|
||||
|
|
|
@ -821,6 +821,12 @@ class GreasePencilLayerMasksPanel:
|
|||
col2.menu("GPENCIL_MT_layer_mask_menu", icon='ADD', text="")
|
||||
col2.operator("gpencil.layer_mask_remove", icon='REMOVE', text="")
|
||||
|
||||
col2.separator()
|
||||
|
||||
sub = col2.column(align=True)
|
||||
sub.operator("gpencil.layer_mask_move", icon='TRIA_UP', text="").type = 'UP'
|
||||
sub.operator("gpencil.layer_mask_move", icon='TRIA_DOWN', text="").type = 'DOWN'
|
||||
|
||||
|
||||
class GreasePencilLayerRelationsPanel:
|
||||
|
||||
|
|
|
@ -550,6 +550,7 @@ geometry_node_categories = [
|
|||
NodeItem("ShaderNodeMath"),
|
||||
NodeItem("FunctionNodeBooleanMath"),
|
||||
NodeItem("FunctionNodeFloatCompare"),
|
||||
NodeItem("GeometryNodeSwitch"),
|
||||
]),
|
||||
GeometryNodeCategory("GEO_VECTOR", "Vector", items=[
|
||||
NodeItem("ShaderNodeSeparateXYZ"),
|
||||
|
|
|
@ -182,7 +182,7 @@ class GeometryComponent {
|
|||
|
||||
/**
|
||||
* Returns an "output attribute", which is essentially a mutable virtual array with some commonly
|
||||
* used convience features. The returned output attribute might be empty if requested attribute
|
||||
* used convince features. The returned output attribute might be empty if requested attribute
|
||||
* cannot exist on the geometry.
|
||||
*
|
||||
* The included convenience features are:
|
||||
|
|
|
@ -1413,6 +1413,7 @@ int ntreeTexExecTree(struct bNodeTree *ntree,
|
|||
#define GEO_NODE_ATTRIBUTE_MAP_RANGE 1040
|
||||
#define GEO_NODE_ATTRIBUTE_CLAMP 1041
|
||||
#define GEO_NODE_BOUNDING_BOX 1042
|
||||
#define GEO_NODE_SWITCH 1043
|
||||
|
||||
/** \} */
|
||||
|
||||
|
|
|
@ -4968,6 +4968,7 @@ static void registerGeometryNodes()
|
|||
register_node_type_geo_sample_texture();
|
||||
register_node_type_geo_subdivide();
|
||||
register_node_type_geo_subdivision_surface();
|
||||
register_node_type_geo_switch();
|
||||
register_node_type_geo_transform();
|
||||
register_node_type_geo_triangulate();
|
||||
register_node_type_geo_volume_to_mesh();
|
||||
|
|
|
@ -232,7 +232,7 @@ class Stack {
|
|||
{
|
||||
this->push_as(std::move(value));
|
||||
}
|
||||
/* This is similar to std::stack::emblace. */
|
||||
/* This is similar to `std::stack::emplace`. */
|
||||
template<typename... ForwardT> void push_as(ForwardT &&... value)
|
||||
{
|
||||
if (top_ == top_chunk_->capacity_end) {
|
||||
|
|
|
@ -443,7 +443,7 @@ class Vector {
|
|||
{
|
||||
this->append_as(std::move(value));
|
||||
}
|
||||
/* This is similar to std::vector::emblace_back. */
|
||||
/* This is similar to `std::vector::emplace_back`. */
|
||||
template<typename... ForwardValue> void append_as(ForwardValue &&... value)
|
||||
{
|
||||
this->ensure_space_for_one();
|
||||
|
|
|
@ -320,14 +320,44 @@ static int gizmo_button2d_cursor_get(wmGizmo *gz)
|
|||
return WM_CURSOR_DEFAULT;
|
||||
}
|
||||
|
||||
static void gizmo_button2d_bounds(bContext *C, wmGizmo *gz, rcti *r_bounding_box)
|
||||
static bool gizmo_button2d_bounds(bContext *C, wmGizmo *gz, rcti *r_bounding_box)
|
||||
{
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
float rad = CIRCLE_RESOLUTION * U.dpi_fac / 2.0f;
|
||||
r_bounding_box->xmin = gz->matrix_basis[3][0] + area->totrct.xmin - rad;
|
||||
r_bounding_box->ymin = gz->matrix_basis[3][1] + area->totrct.ymin - rad;
|
||||
r_bounding_box->xmax = r_bounding_box->xmin + rad;
|
||||
r_bounding_box->ymax = r_bounding_box->ymin + rad;
|
||||
const float *co = NULL;
|
||||
float matrix_final[4][4];
|
||||
float co_proj[3];
|
||||
WM_gizmo_calc_matrix_final(gz, matrix_final);
|
||||
|
||||
if (gz->parent_gzgroup->type->flag & WM_GIZMOGROUPTYPE_3D) {
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
if (ED_view3d_project_float_global(region, matrix_final[3], co_proj, V3D_PROJ_TEST_NOP) ==
|
||||
V3D_PROJ_RET_OK) {
|
||||
float matrix_final_no_offset[4][4];
|
||||
const RegionView3D *rv3d = region->regiondata;
|
||||
WM_gizmo_calc_matrix_final_no_offset(gz, matrix_final_no_offset);
|
||||
const float factor = ED_view3d_pixel_size_no_ui_scale(rv3d, matrix_final_no_offset[3]) /
|
||||
ED_view3d_pixel_size_no_ui_scale(rv3d, matrix_final[3]);
|
||||
/* It's possible (although unlikely) `matrix_final_no_offset` is behind the view.
|
||||
* `matrix_final` has already been projected so both can't be negative. */
|
||||
if (factor > 0.0f) {
|
||||
rad *= factor;
|
||||
}
|
||||
co = co_proj;
|
||||
}
|
||||
}
|
||||
else {
|
||||
co = matrix_final[3];
|
||||
}
|
||||
|
||||
if (co != NULL) {
|
||||
r_bounding_box->xmin = co[0] + area->totrct.xmin - rad;
|
||||
r_bounding_box->ymin = co[1] + area->totrct.ymin - rad;
|
||||
r_bounding_box->xmax = r_bounding_box->xmin + rad;
|
||||
r_bounding_box->ymax = r_bounding_box->ymin + rad;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void gizmo_button2d_free(wmGizmo *gz)
|
||||
|
|
|
@ -3745,3 +3745,51 @@ void GPENCIL_OT_layer_mask_remove(wmOperatorType *ot)
|
|||
ot->exec = gpencil_layer_mask_remove_exec;
|
||||
ot->poll = gpencil_active_layer_poll;
|
||||
}
|
||||
|
||||
static int gpencil_layer_mask_move_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
bGPdata *gpd = ED_gpencil_data_get_active(C);
|
||||
bGPDlayer *gpl = BKE_gpencil_layer_active_get(gpd);
|
||||
const int direction = RNA_enum_get(op->ptr, "type");
|
||||
|
||||
/* sanity checks */
|
||||
if (ELEM(NULL, gpd, gpl)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
if (gpl->act_mask > 0) {
|
||||
bGPDlayer_Mask *mask = BLI_findlink(&gpl->mask_layers, gpl->act_mask - 1);
|
||||
if (mask != NULL) {
|
||||
BLI_assert(ELEM(direction, -1, 0, 1)); /* we use value below */
|
||||
if (BLI_listbase_link_move(&gpl->mask_layers, mask, direction)) {
|
||||
gpl->act_mask += direction;
|
||||
DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
|
||||
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
void GPENCIL_OT_layer_mask_move(wmOperatorType *ot)
|
||||
{
|
||||
static const EnumPropertyItem slot_move[] = {
|
||||
{GP_LAYER_MOVE_UP, "UP", 0, "Up", ""},
|
||||
{GP_LAYER_MOVE_DOWN, "DOWN", 0, "Down", ""},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
};
|
||||
|
||||
/* identifiers */
|
||||
ot->name = "Move Grease Pencil Layer Mask";
|
||||
ot->idname = "GPENCIL_OT_layer_mask_move";
|
||||
ot->description = "Move the active Grease Pencil mask layer up/down in the list";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = gpencil_layer_mask_move_exec;
|
||||
ot->poll = gpencil_active_layer_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
ot->prop = RNA_def_enum(ot->srna, "type", slot_move, 0, "Type", "");
|
||||
}
|
||||
|
|
|
@ -3762,6 +3762,7 @@ static int gpencil_strokes_reproject_exec(bContext *C, wmOperator *op)
|
|||
const eGP_ReprojectModes mode = RNA_enum_get(op->ptr, "type");
|
||||
const bool keep_original = RNA_boolean_get(op->ptr, "keep_original");
|
||||
const bool is_curve_edit = (bool)GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd);
|
||||
const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd);
|
||||
|
||||
/* Init snap context for geometry projection. */
|
||||
SnapObjectContext *sctx = NULL;
|
||||
|
@ -3774,36 +3775,55 @@ static int gpencil_strokes_reproject_exec(bContext *C, wmOperator *op)
|
|||
int cfra_prv = INT_MIN;
|
||||
|
||||
/* Go through each editable + selected stroke, adjusting each of its points one by one... */
|
||||
GP_EDITABLE_STROKES_BEGIN (gpstroke_iter, C, gpl, gps) {
|
||||
bool curve_select = false;
|
||||
if (is_curve_edit && gps->editcurve != NULL) {
|
||||
curve_select = gps->editcurve->flag & GP_CURVE_SELECT;
|
||||
}
|
||||
CTX_DATA_BEGIN (C, bGPDlayer *, gpl, editable_gpencil_layers) {
|
||||
bGPDframe *init_gpf = (is_multiedit) ? gpl->frames.first : gpl->actframe;
|
||||
|
||||
if (gps->flag & GP_STROKE_SELECT || curve_select) {
|
||||
for (bGPDframe *gpf = init_gpf; gpf; gpf = gpf->next) {
|
||||
if ((gpf == gpl->actframe) || ((gpf->flag & GP_FRAME_SELECT) && (is_multiedit))) {
|
||||
if (gpf == NULL) {
|
||||
continue;
|
||||
}
|
||||
for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
|
||||
/* skip strokes that are invalid for current view */
|
||||
if (ED_gpencil_stroke_can_use(C, gps) == false) {
|
||||
continue;
|
||||
}
|
||||
bool curve_select = false;
|
||||
if (is_curve_edit && gps->editcurve != NULL) {
|
||||
curve_select = gps->editcurve->flag & GP_CURVE_SELECT;
|
||||
}
|
||||
|
||||
/* update frame to get the new location of objects */
|
||||
if ((mode == GP_REPROJECT_SURFACE) && (cfra_prv != gpf_->framenum)) {
|
||||
cfra_prv = gpf_->framenum;
|
||||
CFRA = gpf_->framenum;
|
||||
BKE_scene_graph_update_for_newframe(depsgraph);
|
||||
if (gps->flag & GP_STROKE_SELECT || curve_select) {
|
||||
|
||||
/* update frame to get the new location of objects */
|
||||
if ((mode == GP_REPROJECT_SURFACE) && (cfra_prv != gpf->framenum)) {
|
||||
cfra_prv = gpf->framenum;
|
||||
CFRA = gpf->framenum;
|
||||
BKE_scene_graph_update_for_newframe(depsgraph);
|
||||
}
|
||||
|
||||
ED_gpencil_stroke_reproject(depsgraph, &gsc, sctx, gpl, gpf, gps, mode, keep_original);
|
||||
|
||||
if (is_curve_edit && gps->editcurve != NULL) {
|
||||
BKE_gpencil_stroke_editcurve_update(gpd, gpl, gps);
|
||||
/* Update the selection from the stroke to the curve. */
|
||||
BKE_gpencil_editcurve_stroke_sync_selection(gpd, gps, gps->editcurve);
|
||||
|
||||
gps->flag |= GP_STROKE_NEEDS_CURVE_UPDATE;
|
||||
BKE_gpencil_stroke_geometry_update(gpd, gps);
|
||||
}
|
||||
|
||||
changed = true;
|
||||
/* If not multi-edit, exit loop. */
|
||||
if (!is_multiedit) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ED_gpencil_stroke_reproject(depsgraph, &gsc, sctx, gpl, gpf_, gps, mode, keep_original);
|
||||
|
||||
if (is_curve_edit && gps->editcurve != NULL) {
|
||||
BKE_gpencil_stroke_editcurve_update(gpd, gpl, gps);
|
||||
/* Update the selection from the stroke to the curve. */
|
||||
BKE_gpencil_editcurve_stroke_sync_selection(gpd, gps, gps->editcurve);
|
||||
|
||||
gps->flag |= GP_STROKE_NEEDS_CURVE_UPDATE;
|
||||
BKE_gpencil_stroke_geometry_update(gpd, gps);
|
||||
}
|
||||
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
GP_EDITABLE_STROKES_END(gpstroke_iter);
|
||||
CTX_DATA_END;
|
||||
|
||||
/* return frame state and DB to original state */
|
||||
CFRA = oldframe;
|
||||
|
@ -3832,7 +3852,8 @@ void GPENCIL_OT_reproject(wmOperatorType *ot)
|
|||
"VIEW",
|
||||
0,
|
||||
"View",
|
||||
"Reproject the strokes to end up on the same plane, as if drawn from the current viewpoint "
|
||||
"Reproject the strokes to end up on the same plane, as if drawn from the current "
|
||||
"viewpoint "
|
||||
"using 'Cursor' Stroke Placement"},
|
||||
{GP_REPROJECT_SURFACE,
|
||||
"SURFACE",
|
||||
|
@ -3851,7 +3872,8 @@ void GPENCIL_OT_reproject(wmOperatorType *ot)
|
|||
ot->name = "Reproject Strokes";
|
||||
ot->idname = "GPENCIL_OT_reproject";
|
||||
ot->description =
|
||||
"Reproject the selected strokes from the current viewpoint as if they had been newly drawn "
|
||||
"Reproject the selected strokes from the current viewpoint as if they had been newly "
|
||||
"drawn "
|
||||
"(e.g. to fix problems from accidental 3D cursor movement or accidental viewport changes, "
|
||||
"or for matching deforming geometry)";
|
||||
|
||||
|
@ -4208,7 +4230,8 @@ void GPENCIL_OT_stroke_subdivide(wmOperatorType *ot)
|
|||
ot->name = "Subdivide Stroke";
|
||||
ot->idname = "GPENCIL_OT_stroke_subdivide";
|
||||
ot->description =
|
||||
"Subdivide between continuous selected points of the stroke adding a point half way between "
|
||||
"Subdivide between continuous selected points of the stroke adding a point half way "
|
||||
"between "
|
||||
"them";
|
||||
|
||||
/* api callbacks */
|
||||
|
|
|
@ -421,6 +421,7 @@ void GPENCIL_OT_layer_duplicate_object(struct wmOperatorType *ot);
|
|||
|
||||
void GPENCIL_OT_layer_mask_add(struct wmOperatorType *ot);
|
||||
void GPENCIL_OT_layer_mask_remove(struct wmOperatorType *ot);
|
||||
void GPENCIL_OT_layer_mask_move(struct wmOperatorType *ot);
|
||||
|
||||
void GPENCIL_OT_hide(struct wmOperatorType *ot);
|
||||
void GPENCIL_OT_reveal(struct wmOperatorType *ot);
|
||||
|
|
|
@ -1435,34 +1435,31 @@ static void gpencil_interpolate_seq_ui(bContext *C, wmOperator *op)
|
|||
{
|
||||
uiLayout *layout = op->layout;
|
||||
uiLayout *col, *row;
|
||||
PointerRNA ptr;
|
||||
|
||||
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
|
||||
|
||||
const eGP_Interpolate_Type type = RNA_enum_get(op->ptr, "type");
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
uiLayoutSetPropDecorate(layout, false);
|
||||
row = uiLayoutRow(layout, true);
|
||||
uiItemR(row, &ptr, "step", 0, NULL, ICON_NONE);
|
||||
uiItemR(row, op->ptr, "step", 0, NULL, ICON_NONE);
|
||||
|
||||
row = uiLayoutRow(layout, true);
|
||||
uiItemR(row, &ptr, "layers", 0, NULL, ICON_NONE);
|
||||
uiItemR(row, op->ptr, "layers", 0, NULL, ICON_NONE);
|
||||
|
||||
if (CTX_data_mode_enum(C) == CTX_MODE_EDIT_GPENCIL) {
|
||||
row = uiLayoutRow(layout, true);
|
||||
uiItemR(row, &ptr, "interpolate_selected_only", 0, NULL, ICON_NONE);
|
||||
uiItemR(row, op->ptr, "interpolate_selected_only", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
row = uiLayoutRow(layout, true);
|
||||
uiItemR(row, &ptr, "flip", 0, NULL, ICON_NONE);
|
||||
uiItemR(row, op->ptr, "flip", 0, NULL, ICON_NONE);
|
||||
|
||||
col = uiLayoutColumn(layout, true);
|
||||
uiItemR(col, &ptr, "smooth_factor", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "smooth_steps", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, op->ptr, "smooth_factor", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, op->ptr, "smooth_steps", 0, NULL, ICON_NONE);
|
||||
|
||||
row = uiLayoutRow(layout, true);
|
||||
uiItemR(row, &ptr, "type", 0, NULL, ICON_NONE);
|
||||
uiItemR(row, op->ptr, "type", 0, NULL, ICON_NONE);
|
||||
|
||||
if (type == GP_IPO_CURVEMAP) {
|
||||
/* Get an RNA pointer to ToolSettings to give to the custom curve. */
|
||||
|
@ -1476,16 +1473,16 @@ static void gpencil_interpolate_seq_ui(bContext *C, wmOperator *op)
|
|||
}
|
||||
else if (type != GP_IPO_LINEAR) {
|
||||
row = uiLayoutRow(layout, false);
|
||||
uiItemR(row, &ptr, "easing", 0, NULL, ICON_NONE);
|
||||
uiItemR(row, op->ptr, "easing", 0, NULL, ICON_NONE);
|
||||
if (type == GP_IPO_BACK) {
|
||||
row = uiLayoutRow(layout, false);
|
||||
uiItemR(row, &ptr, "back", 0, NULL, ICON_NONE);
|
||||
uiItemR(row, op->ptr, "back", 0, NULL, ICON_NONE);
|
||||
}
|
||||
else if (type == GP_IPO_ELASTIC) {
|
||||
row = uiLayoutRow(layout, false);
|
||||
uiItemR(row, &ptr, "amplitude", 0, NULL, ICON_NONE);
|
||||
uiItemR(row, op->ptr, "amplitude", 0, NULL, ICON_NONE);
|
||||
row = uiLayoutRow(layout, false);
|
||||
uiItemR(row, &ptr, "period", 0, NULL, ICON_NONE);
|
||||
uiItemR(row, op->ptr, "period", 0, NULL, ICON_NONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -601,6 +601,7 @@ void ED_operatortypes_gpencil(void)
|
|||
|
||||
WM_operatortype_append(GPENCIL_OT_layer_mask_add);
|
||||
WM_operatortype_append(GPENCIL_OT_layer_mask_remove);
|
||||
WM_operatortype_append(GPENCIL_OT_layer_mask_move);
|
||||
|
||||
WM_operatortype_append(GPENCIL_OT_hide);
|
||||
WM_operatortype_append(GPENCIL_OT_reveal);
|
||||
|
|
|
@ -61,7 +61,7 @@ struct SnapObjectHitDepth {
|
|||
float no[3];
|
||||
int index;
|
||||
|
||||
struct Object *ob;
|
||||
struct Object *ob_eval;
|
||||
float obmat[4][4];
|
||||
|
||||
/* needed to tell which ray-cast this was part of,
|
||||
|
|
|
@ -1729,7 +1729,7 @@ struct Panel *UI_panel_add_instanced(const struct bContext *C,
|
|||
struct PointerRNA *custom_data);
|
||||
void UI_panels_free_instanced(const struct bContext *C, struct ARegion *region);
|
||||
|
||||
#define INSTANCED_PANEL_UNIQUE_STR_LEN 4
|
||||
#define INSTANCED_PANEL_UNIQUE_STR_LEN 16
|
||||
void UI_list_panel_unique_str(struct Panel *panel, char *r_name);
|
||||
|
||||
typedef void (*uiListPanelIDFromDataFunc)(void *data_link, char *r_idname);
|
||||
|
|
|
@ -1126,6 +1126,12 @@ static void ui_apply_but_NUM(bContext *C, uiBut *but, uiHandleButtonData *data)
|
|||
ui_but_value_set(but, data->value);
|
||||
}
|
||||
|
||||
/* If the value entered is the exact same, do not trigger an update. */
|
||||
if (data->value == data->startvalue) {
|
||||
data->cancel = true;
|
||||
return;
|
||||
}
|
||||
|
||||
ui_but_update_edited(but);
|
||||
ui_apply_but_func(C, but);
|
||||
|
||||
|
|
|
@ -1469,9 +1469,10 @@ ARegion *UI_tooltip_create_from_gizmo(bContext *C, wmGizmo *gz)
|
|||
*/
|
||||
if (gz->type->screen_bounds_get) {
|
||||
rcti bounds;
|
||||
gz->type->screen_bounds_get(C, gz, &bounds);
|
||||
init_position[0] = bounds.xmin;
|
||||
init_position[1] = bounds.ymin;
|
||||
if (gz->type->screen_bounds_get(C, gz, &bounds)) {
|
||||
init_position[0] = bounds.xmin;
|
||||
init_position[1] = bounds.ymin;
|
||||
}
|
||||
}
|
||||
|
||||
return ui_tooltip_create_with_data(C, data, init_position, NULL, aspect);
|
||||
|
|
|
@ -240,21 +240,17 @@ static void ui_alembic_export_settings(uiLayout *layout, PointerRNA *imfptr)
|
|||
|
||||
static void wm_alembic_export_draw(bContext *C, wmOperator *op)
|
||||
{
|
||||
PointerRNA ptr;
|
||||
|
||||
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
|
||||
|
||||
/* Conveniently set start and end frame to match the scene's frame range. */
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
|
||||
if (scene != NULL && RNA_boolean_get(&ptr, "init_scene_frame_range")) {
|
||||
RNA_int_set(&ptr, "start", SFRA);
|
||||
RNA_int_set(&ptr, "end", EFRA);
|
||||
if (scene != NULL && RNA_boolean_get(op->ptr, "init_scene_frame_range")) {
|
||||
RNA_int_set(op->ptr, "start", SFRA);
|
||||
RNA_int_set(op->ptr, "end", EFRA);
|
||||
|
||||
RNA_boolean_set(&ptr, "init_scene_frame_range", false);
|
||||
RNA_boolean_set(op->ptr, "init_scene_frame_range", false);
|
||||
}
|
||||
|
||||
ui_alembic_export_settings(op->layout, &ptr);
|
||||
ui_alembic_export_settings(op->layout, op->ptr);
|
||||
}
|
||||
|
||||
static bool wm_alembic_export_check(bContext *UNUSED(C), wmOperator *op)
|
||||
|
@ -595,10 +591,7 @@ static void ui_alembic_import_settings(uiLayout *layout, PointerRNA *imfptr)
|
|||
|
||||
static void wm_alembic_import_draw(bContext *UNUSED(C), wmOperator *op)
|
||||
{
|
||||
PointerRNA ptr;
|
||||
|
||||
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
|
||||
ui_alembic_import_settings(op->layout, &ptr);
|
||||
ui_alembic_import_settings(op->layout, op->ptr);
|
||||
}
|
||||
|
||||
/* op->invoke, opens fileselect if path property not set, otherwise executes */
|
||||
|
|
|
@ -402,10 +402,7 @@ static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
|
|||
|
||||
static void wm_collada_export_draw(bContext *UNUSED(C), wmOperator *op)
|
||||
{
|
||||
PointerRNA ptr;
|
||||
|
||||
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
|
||||
uiCollada_exportSettings(op->layout, &ptr);
|
||||
uiCollada_exportSettings(op->layout, op->ptr);
|
||||
}
|
||||
|
||||
static bool wm_collada_export_check(bContext *UNUSED(C), wmOperator *op)
|
||||
|
@ -799,10 +796,7 @@ static void uiCollada_importSettings(uiLayout *layout, PointerRNA *imfptr)
|
|||
|
||||
static void wm_collada_import_draw(bContext *UNUSED(C), wmOperator *op)
|
||||
{
|
||||
PointerRNA ptr;
|
||||
|
||||
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
|
||||
uiCollada_importSettings(op->layout, &ptr);
|
||||
uiCollada_importSettings(op->layout, op->ptr);
|
||||
}
|
||||
|
||||
void WM_OT_collada_import(wmOperatorType *ot)
|
||||
|
|
|
@ -217,11 +217,7 @@ static void ui_gpencil_export_svg_settings(uiLayout *layout, PointerRNA *imfptr)
|
|||
|
||||
static void wm_gpencil_export_svg_draw(bContext *UNUSED(C), wmOperator *op)
|
||||
{
|
||||
PointerRNA ptr;
|
||||
|
||||
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
|
||||
|
||||
ui_gpencil_export_svg_settings(op->layout, &ptr);
|
||||
ui_gpencil_export_svg_settings(op->layout, op->ptr);
|
||||
}
|
||||
|
||||
static bool wm_gpencil_export_svg_poll(bContext *C)
|
||||
|
@ -379,11 +375,7 @@ static void ui_gpencil_export_pdf_settings(uiLayout *layout, PointerRNA *imfptr)
|
|||
|
||||
static void wm_gpencil_export_pdf_draw(bContext *UNUSED(C), wmOperator *op)
|
||||
{
|
||||
PointerRNA ptr;
|
||||
|
||||
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
|
||||
|
||||
ui_gpencil_export_pdf_settings(op->layout, &ptr);
|
||||
ui_gpencil_export_pdf_settings(op->layout, op->ptr);
|
||||
}
|
||||
|
||||
static bool wm_gpencil_export_pdf_poll(bContext *C)
|
||||
|
|
|
@ -138,10 +138,7 @@ static void ui_gpencil_import_svg_settings(uiLayout *layout, PointerRNA *imfptr)
|
|||
|
||||
static void wm_gpencil_import_svg_draw(bContext *UNUSED(C), wmOperator *op)
|
||||
{
|
||||
PointerRNA ptr;
|
||||
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
|
||||
|
||||
ui_gpencil_import_svg_settings(op->layout, &ptr);
|
||||
ui_gpencil_import_svg_settings(op->layout, op->ptr);
|
||||
}
|
||||
|
||||
static bool wm_gpencil_import_svg_poll(bContext *C)
|
||||
|
|
|
@ -912,74 +912,72 @@ static void edbm_bevel_ui(bContext *C, wmOperator *op)
|
|||
{
|
||||
uiLayout *layout = op->layout;
|
||||
uiLayout *col, *row;
|
||||
PointerRNA ptr, toolsettings_ptr;
|
||||
PointerRNA toolsettings_ptr;
|
||||
|
||||
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
|
||||
|
||||
int profile_type = RNA_enum_get(&ptr, "profile_type");
|
||||
int offset_type = RNA_enum_get(&ptr, "offset_type");
|
||||
bool affect_type = RNA_enum_get(&ptr, "affect");
|
||||
int profile_type = RNA_enum_get(op->ptr, "profile_type");
|
||||
int offset_type = RNA_enum_get(op->ptr, "offset_type");
|
||||
bool affect_type = RNA_enum_get(op->ptr, "affect");
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
uiLayoutSetPropDecorate(layout, false);
|
||||
|
||||
row = uiLayoutRow(layout, false);
|
||||
uiItemR(row, &ptr, "affect", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
uiItemR(row, op->ptr, "affect", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
uiItemR(layout, &ptr, "offset_type", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, op->ptr, "offset_type", 0, NULL, ICON_NONE);
|
||||
|
||||
if (offset_type == BEVEL_AMT_PERCENT) {
|
||||
uiItemR(layout, &ptr, "offset_pct", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, op->ptr, "offset_pct", 0, NULL, ICON_NONE);
|
||||
}
|
||||
else {
|
||||
uiItemR(layout, &ptr, "offset", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, op->ptr, "offset", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
uiItemR(layout, &ptr, "segments", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, op->ptr, "segments", 0, NULL, ICON_NONE);
|
||||
if (ELEM(profile_type, BEVEL_PROFILE_SUPERELLIPSE, BEVEL_PROFILE_CUSTOM)) {
|
||||
uiItemR(layout,
|
||||
&ptr,
|
||||
op->ptr,
|
||||
"profile",
|
||||
UI_ITEM_R_SLIDER,
|
||||
(profile_type == BEVEL_PROFILE_SUPERELLIPSE) ? IFACE_("Shape") : IFACE_("Miter Shape"),
|
||||
ICON_NONE);
|
||||
}
|
||||
uiItemR(layout, &ptr, "material", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, op->ptr, "material", 0, NULL, ICON_NONE);
|
||||
|
||||
col = uiLayoutColumn(layout, true);
|
||||
uiItemR(col, &ptr, "harden_normals", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "clamp_overlap", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "loop_slide", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, op->ptr, "harden_normals", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, op->ptr, "clamp_overlap", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, op->ptr, "loop_slide", 0, NULL, ICON_NONE);
|
||||
|
||||
col = uiLayoutColumnWithHeading(layout, true, IFACE_("Mark"));
|
||||
uiLayoutSetActive(col, affect_type == BEVEL_AFFECT_EDGES);
|
||||
uiItemR(col, &ptr, "mark_seam", 0, IFACE_("Seams"), ICON_NONE);
|
||||
uiItemR(col, &ptr, "mark_sharp", 0, IFACE_("Sharp"), ICON_NONE);
|
||||
uiItemR(col, op->ptr, "mark_seam", 0, IFACE_("Seams"), ICON_NONE);
|
||||
uiItemR(col, op->ptr, "mark_sharp", 0, IFACE_("Sharp"), ICON_NONE);
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiLayoutSetActive(col, affect_type == BEVEL_AFFECT_EDGES);
|
||||
uiItemR(col, &ptr, "miter_outer", 0, IFACE_("Miter Outer"), ICON_NONE);
|
||||
uiItemR(col, &ptr, "miter_inner", 0, IFACE_("Inner"), ICON_NONE);
|
||||
if (RNA_enum_get(&ptr, "miter_inner") == BEVEL_MITER_ARC) {
|
||||
uiItemR(col, &ptr, "spread", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, op->ptr, "miter_outer", 0, IFACE_("Miter Outer"), ICON_NONE);
|
||||
uiItemR(col, op->ptr, "miter_inner", 0, IFACE_("Inner"), ICON_NONE);
|
||||
if (RNA_enum_get(op->ptr, "miter_inner") == BEVEL_MITER_ARC) {
|
||||
uiItemR(col, op->ptr, "spread", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiLayoutSetActive(col, affect_type == BEVEL_AFFECT_EDGES);
|
||||
uiItemR(col, &ptr, "vmesh_method", 0, IFACE_("Intersection Type"), ICON_NONE);
|
||||
uiItemR(col, op->ptr, "vmesh_method", 0, IFACE_("Intersection Type"), ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "face_strength_mode", 0, IFACE_("Face Strength"), ICON_NONE);
|
||||
uiItemR(layout, op->ptr, "face_strength_mode", 0, IFACE_("Face Strength"), ICON_NONE);
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
row = uiLayoutRow(layout, false);
|
||||
uiItemR(row, &ptr, "profile_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
uiItemR(row, op->ptr, "profile_type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
if (profile_type == BEVEL_PROFILE_CUSTOM) {
|
||||
/* Get an RNA pointer to ToolSettings to give to the curve profile template code. */
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
|
|
|
@ -468,6 +468,7 @@ void MESH_GGT_spin(struct wmGizmoGroupType *gzgt)
|
|||
|
||||
gzgt->poll = ED_gizmo_poll_or_unlink_delayed_from_tool;
|
||||
gzgt->setup = gizmo_mesh_spin_init_setup;
|
||||
gzgt->setup_keymap = WM_gizmogroup_setup_keymap_generic_maybe_drag;
|
||||
gzgt->refresh = gizmo_mesh_spin_init_refresh;
|
||||
gzgt->message_subscribe = gizmo_mesh_spin_init_message_subscribe;
|
||||
gzgt->draw_prepare = gizmo_mesh_spin_init_draw_prepare;
|
||||
|
|
|
@ -255,27 +255,24 @@ static void edbm_intersect_ui(bContext *UNUSED(C), wmOperator *op)
|
|||
{
|
||||
uiLayout *layout = op->layout;
|
||||
uiLayout *row;
|
||||
PointerRNA ptr;
|
||||
|
||||
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
|
||||
|
||||
bool use_exact = RNA_enum_get(&ptr, "solver") == ISECT_SOLVER_EXACT;
|
||||
bool use_exact = RNA_enum_get(op->ptr, "solver") == ISECT_SOLVER_EXACT;
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
uiLayoutSetPropDecorate(layout, false);
|
||||
row = uiLayoutRow(layout, false);
|
||||
uiItemR(row, &ptr, "mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
uiItemR(row, op->ptr, "mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
uiItemS(layout);
|
||||
row = uiLayoutRow(layout, false);
|
||||
uiItemR(row, &ptr, "separate_mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
uiItemR(row, op->ptr, "separate_mode", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
uiItemS(layout);
|
||||
|
||||
row = uiLayoutRow(layout, false);
|
||||
uiItemR(row, &ptr, "solver", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
uiItemR(row, op->ptr, "solver", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
uiItemS(layout);
|
||||
|
||||
if (!use_exact) {
|
||||
uiItemR(layout, &ptr, "threshold", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, op->ptr, "threshold", 0, NULL, ICON_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -421,27 +418,24 @@ static void edbm_intersect_boolean_ui(bContext *UNUSED(C), wmOperator *op)
|
|||
{
|
||||
uiLayout *layout = op->layout;
|
||||
uiLayout *row;
|
||||
PointerRNA ptr;
|
||||
|
||||
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
|
||||
|
||||
bool use_exact = RNA_enum_get(&ptr, "solver") == ISECT_SOLVER_EXACT;
|
||||
bool use_exact = RNA_enum_get(op->ptr, "solver") == ISECT_SOLVER_EXACT;
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
uiLayoutSetPropDecorate(layout, false);
|
||||
|
||||
row = uiLayoutRow(layout, false);
|
||||
uiItemR(row, &ptr, "operation", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
uiItemR(row, op->ptr, "operation", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
uiItemS(layout);
|
||||
|
||||
row = uiLayoutRow(layout, false);
|
||||
uiItemR(row, &ptr, "solver", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
uiItemR(row, op->ptr, "solver", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
uiItemS(layout);
|
||||
|
||||
uiItemR(layout, &ptr, "use_swap", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "use_self", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, op->ptr, "use_swap", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, op->ptr, "use_self", 0, NULL, ICON_NONE);
|
||||
if (!use_exact) {
|
||||
uiItemR(layout, &ptr, "threshold", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, op->ptr, "threshold", 0, NULL, ICON_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3694,20 +3694,18 @@ static const EnumPropertyItem *shape_itemf(bContext *C,
|
|||
static void edbm_blend_from_shape_ui(bContext *C, wmOperator *op)
|
||||
{
|
||||
uiLayout *layout = op->layout;
|
||||
PointerRNA ptr;
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
Mesh *me = obedit->data;
|
||||
PointerRNA ptr_key;
|
||||
|
||||
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
|
||||
RNA_id_pointer_create((ID *)me->key, &ptr_key);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
uiLayoutSetPropDecorate(layout, false);
|
||||
|
||||
uiItemPointerR(layout, &ptr, "shape", &ptr_key, "key_blocks", NULL, ICON_SHAPEKEY_DATA);
|
||||
uiItemR(layout, &ptr, "blend", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "add", 0, NULL, ICON_NONE);
|
||||
uiItemPointerR(layout, op->ptr, "shape", &ptr_key, "key_blocks", NULL, ICON_SHAPEKEY_DATA);
|
||||
uiItemR(layout, op->ptr, "blend", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, op->ptr, "add", 0, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
void MESH_OT_blend_from_shape(wmOperatorType *ot)
|
||||
|
@ -5614,25 +5612,22 @@ static bool edbm_decimate_check(bContext *UNUSED(C), wmOperator *UNUSED(op))
|
|||
static void edbm_decimate_ui(bContext *UNUSED(C), wmOperator *op)
|
||||
{
|
||||
uiLayout *layout = op->layout, *row, *col, *sub;
|
||||
PointerRNA ptr;
|
||||
|
||||
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
uiItemR(layout, &ptr, "ratio", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, op->ptr, "ratio", 0, NULL, ICON_NONE);
|
||||
|
||||
uiItemR(layout, &ptr, "use_vertex_group", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, op->ptr, "use_vertex_group", 0, NULL, ICON_NONE);
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiLayoutSetActive(col, RNA_boolean_get(&ptr, "use_vertex_group"));
|
||||
uiItemR(col, &ptr, "vertex_group_factor", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "invert_vertex_group", 0, NULL, ICON_NONE);
|
||||
uiLayoutSetActive(col, RNA_boolean_get(op->ptr, "use_vertex_group"));
|
||||
uiItemR(col, op->ptr, "vertex_group_factor", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, op->ptr, "invert_vertex_group", 0, NULL, ICON_NONE);
|
||||
|
||||
row = uiLayoutRowWithHeading(layout, true, IFACE_("Symmetry"));
|
||||
uiItemR(row, &ptr, "use_symmetry", 0, "", ICON_NONE);
|
||||
uiItemR(row, op->ptr, "use_symmetry", 0, "", ICON_NONE);
|
||||
sub = uiLayoutRow(row, true);
|
||||
uiLayoutSetActive(sub, RNA_boolean_get(&ptr, "use_symmetry"));
|
||||
uiItemR(sub, &ptr, "symmetry_axis", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
uiLayoutSetActive(sub, RNA_boolean_get(op->ptr, "use_symmetry"));
|
||||
uiItemR(sub, op->ptr, "symmetry_axis", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
}
|
||||
|
||||
void MESH_OT_decimate(wmOperatorType *ot)
|
||||
|
|
|
@ -3113,20 +3113,18 @@ static int object_convert_exec(bContext *C, wmOperator *op)
|
|||
static void object_convert_ui(bContext *UNUSED(C), wmOperator *op)
|
||||
{
|
||||
uiLayout *layout = op->layout;
|
||||
PointerRNA ptr;
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
|
||||
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
|
||||
uiItemR(layout, &ptr, "target", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "keep_original", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, op->ptr, "target", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, op->ptr, "keep_original", 0, NULL, ICON_NONE);
|
||||
|
||||
if (RNA_enum_get(&ptr, "target") == OB_GPENCIL) {
|
||||
uiItemR(layout, &ptr, "thickness", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "angle", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "offset", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "seams", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "faces", 0, NULL, ICON_NONE);
|
||||
if (RNA_enum_get(op->ptr, "target") == OB_GPENCIL) {
|
||||
uiItemR(layout, op->ptr, "thickness", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, op->ptr, "angle", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, op->ptr, "offset", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, op->ptr, "seams", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, op->ptr, "faces", 0, NULL, ICON_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1750,7 +1750,7 @@ static int modifier_copy_to_selected_invoke(bContext *C, wmOperator *op, const w
|
|||
{
|
||||
int retval;
|
||||
if (edit_modifier_invoke_properties_with_hover_no_active(C, op, event, &retval)) {
|
||||
return modifier_set_active_exec(C, op);
|
||||
return modifier_copy_to_selected_exec(C, op);
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
|
|
@ -213,9 +213,8 @@ static void screenshot_draw(bContext *UNUSED(C), wmOperator *op)
|
|||
uiTemplateImageSettings(layout, &ptr, false);
|
||||
|
||||
/* main draw call */
|
||||
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
|
||||
uiDefAutoButsRNA(
|
||||
layout, &ptr, screenshot_draw_check_prop, NULL, NULL, UI_BUT_LABEL_ALIGN_NONE, false);
|
||||
layout, op->ptr, screenshot_draw_check_prop, NULL, NULL, UI_BUT_LABEL_ALIGN_NONE, false);
|
||||
}
|
||||
|
||||
static bool screenshot_poll(bContext *C)
|
||||
|
|
|
@ -1484,12 +1484,11 @@ static void image_open_draw(bContext *UNUSED(C), wmOperator *op)
|
|||
uiLayout *layout = op->layout;
|
||||
ImageOpenData *iod = op->customdata;
|
||||
ImageFormatData *imf = &iod->im_format;
|
||||
PointerRNA imf_ptr, ptr;
|
||||
PointerRNA imf_ptr;
|
||||
|
||||
/* main draw call */
|
||||
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
|
||||
uiDefAutoButsRNA(
|
||||
layout, &ptr, image_open_draw_check_prop, NULL, NULL, UI_BUT_LABEL_ALIGN_NONE, false);
|
||||
layout, op->ptr, image_open_draw_check_prop, NULL, NULL, UI_BUT_LABEL_ALIGN_NONE, false);
|
||||
|
||||
/* image template */
|
||||
RNA_pointer_create(NULL, &RNA_ImageFormatSettings, imf, &imf_ptr);
|
||||
|
@ -2004,7 +2003,7 @@ static void image_save_as_draw(bContext *UNUSED(C), wmOperator *op)
|
|||
{
|
||||
uiLayout *layout = op->layout;
|
||||
ImageSaveData *isd = op->customdata;
|
||||
PointerRNA imf_ptr, ptr;
|
||||
PointerRNA imf_ptr;
|
||||
const bool is_multiview = RNA_boolean_get(op->ptr, "show_multiview");
|
||||
|
||||
/* image template */
|
||||
|
@ -2012,9 +2011,8 @@ static void image_save_as_draw(bContext *UNUSED(C), wmOperator *op)
|
|||
uiTemplateImageSettings(layout, &imf_ptr, false);
|
||||
|
||||
/* main draw call */
|
||||
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
|
||||
uiDefAutoButsRNA(
|
||||
layout, &ptr, image_save_as_draw_check_prop, NULL, NULL, UI_BUT_LABEL_ALIGN_NONE, false);
|
||||
layout, op->ptr, image_save_as_draw_check_prop, NULL, NULL, UI_BUT_LABEL_ALIGN_NONE, false);
|
||||
|
||||
/* multiview template */
|
||||
if (is_multiview) {
|
||||
|
@ -2616,33 +2614,30 @@ static void image_new_draw(bContext *UNUSED(C), wmOperator *op)
|
|||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = op->layout;
|
||||
PointerRNA ptr;
|
||||
#if 0
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
const bool is_multiview = (scene->r.scemode & R_MULTIVIEW) != 0;
|
||||
#endif
|
||||
|
||||
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
|
||||
|
||||
/* copy of WM_operator_props_dialog_popup() layout */
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
uiLayoutSetPropDecorate(layout, false);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiItemR(col, &ptr, "name", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "width", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "height", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "color", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "alpha", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "generated_type", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "float", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "tiled", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, op->ptr, "name", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, op->ptr, "width", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, op->ptr, "height", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, op->ptr, "color", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, op->ptr, "alpha", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, op->ptr, "generated_type", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, op->ptr, "float", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, op->ptr, "tiled", 0, NULL, ICON_NONE);
|
||||
|
||||
#if 0
|
||||
if (is_multiview) {
|
||||
uiItemL(col[0], "", ICON_NONE);
|
||||
uiItemR(col[1], &ptr, "use_stereo_3d", 0, NULL, ICON_NONE);
|
||||
uiItemR(col[1], op->ptr, "use_stereo_3d", 0, NULL, ICON_NONE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -3992,21 +3987,18 @@ static void tile_add_draw(bContext *UNUSED(C), wmOperator *op)
|
|||
{
|
||||
uiLayout *col;
|
||||
uiLayout *layout = op->layout;
|
||||
PointerRNA ptr;
|
||||
|
||||
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
|
||||
|
||||
uiLayoutSetPropSep(layout, true);
|
||||
uiLayoutSetPropDecorate(layout, false);
|
||||
|
||||
col = uiLayoutColumn(layout, false);
|
||||
uiItemR(col, &ptr, "number", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "count", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, &ptr, "label", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "fill", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, op->ptr, "number", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, op->ptr, "count", 0, NULL, ICON_NONE);
|
||||
uiItemR(col, op->ptr, "label", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, op->ptr, "fill", 0, NULL, ICON_NONE);
|
||||
|
||||
if (RNA_boolean_get(&ptr, "fill")) {
|
||||
draw_fill_tile(&ptr, layout);
|
||||
if (RNA_boolean_get(op->ptr, "fill")) {
|
||||
draw_fill_tile(op->ptr, layout);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4126,10 +4118,7 @@ static int tile_fill_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(e
|
|||
|
||||
static void tile_fill_draw(bContext *UNUSED(C), wmOperator *op)
|
||||
{
|
||||
PointerRNA ptr;
|
||||
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
|
||||
|
||||
draw_fill_tile(&ptr, op->layout);
|
||||
draw_fill_tile(op->ptr, op->layout);
|
||||
}
|
||||
|
||||
void IMAGE_OT_tile_fill(wmOperatorType *ot)
|
||||
|
|
|
@ -2749,7 +2749,11 @@ static void node_composit_buts_denoise(uiLayout *layout, bContext *UNUSED(C), Po
|
|||
#ifndef WITH_OPENIMAGEDENOISE
|
||||
uiItemL(layout, IFACE_("Disabled, built without OpenImageDenoise"), ICON_ERROR);
|
||||
#else
|
||||
if (!BLI_cpu_support_sse41()) {
|
||||
/* Always supported through Accelerate framework BNNS on macOS. */
|
||||
# ifndef __APPLE__
|
||||
if (!BLI_cpu_support_sse41())
|
||||
# endif
|
||||
{
|
||||
uiItemL(layout, IFACE_("Disabled, CPU with SSE4.1 is required"), ICON_ERROR);
|
||||
}
|
||||
#endif
|
||||
|
@ -3454,7 +3458,7 @@ static void std_node_socket_draw(
|
|||
|
||||
const bNodeTree *node_tree = (const bNodeTree *)node_ptr->owner_id;
|
||||
if (node_tree->type == NTREE_GEOMETRY) {
|
||||
node_geometry_add_attribute_search_button(node_tree, node, ptr, row);
|
||||
node_geometry_add_attribute_search_button(C, node_tree, node, ptr, row);
|
||||
}
|
||||
else {
|
||||
uiItemR(row, ptr, "default_value", DEFAULT_FLAGS, "", 0);
|
||||
|
|
|
@ -46,8 +46,8 @@ using blender::Set;
|
|||
using blender::StringRef;
|
||||
|
||||
struct AttributeSearchData {
|
||||
const bNodeTree &node_tree;
|
||||
const bNode &node;
|
||||
AvailableAttributeInfo &dummy_info_for_search;
|
||||
const NodeUIStorage &ui_storage;
|
||||
bNodeSocket &socket;
|
||||
};
|
||||
|
||||
|
@ -82,37 +82,31 @@ static bool attribute_search_item_add(uiSearchItems *items, const AvailableAttri
|
|||
items, search_item_text.c_str(), (void *)&item, ICON_NONE, UI_BUT_HAS_SEP_CHAR, 0);
|
||||
}
|
||||
|
||||
static void attribute_search_update_fn(
|
||||
const bContext *C, void *arg, const char *str, uiSearchItems *items, const bool is_first)
|
||||
static void attribute_search_update_fn(const bContext *UNUSED(C),
|
||||
void *arg,
|
||||
const char *str,
|
||||
uiSearchItems *items,
|
||||
const bool is_first)
|
||||
{
|
||||
AttributeSearchData *data = static_cast<AttributeSearchData *>(arg);
|
||||
NodeTreeUIStorage *tree_ui_storage = data->node_tree.ui_storage;
|
||||
if (tree_ui_storage == nullptr) {
|
||||
return;
|
||||
}
|
||||
const NodeUIStorage *ui_storage = BKE_node_tree_ui_storage_get_from_context(
|
||||
C, data->node_tree, data->node);
|
||||
if (ui_storage == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
const Set<AvailableAttributeInfo> &attribute_hints = ui_storage->attribute_hints;
|
||||
const Set<AvailableAttributeInfo> &attribute_hints = data->ui_storage.attribute_hints;
|
||||
|
||||
/* Any string may be valid, so add the current search string along with the hints. */
|
||||
if (str[0] != '\0') {
|
||||
/* Note that the attribute domain and data type are dummies, since
|
||||
* #AvailableAttributeInfo equality is only based on the string. */
|
||||
if (!attribute_hints.contains(AvailableAttributeInfo{str, ATTR_DOMAIN_AUTO, CD_PROP_BOOL})) {
|
||||
tree_ui_storage->dummy_info_for_search.name = std::string(str);
|
||||
UI_search_item_add(items, str, &tree_ui_storage->dummy_info_for_search, ICON_ADD, 0, 0);
|
||||
data->dummy_info_for_search.name = std::string(str);
|
||||
UI_search_item_add(items, str, &data->dummy_info_for_search, ICON_ADD, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if (str[0] == '\0' && !is_first) {
|
||||
/* Allow clearing the text field when the string is empty, but not on the first pass,
|
||||
* or opening an attribute field for the first time would show this search item. */
|
||||
tree_ui_storage->dummy_info_for_search.name = std::string(str);
|
||||
UI_search_item_add(items, str, &tree_ui_storage->dummy_info_for_search, ICON_X, 0, 0);
|
||||
data->dummy_info_for_search.name = std::string(str);
|
||||
UI_search_item_add(items, str, &data->dummy_info_for_search, ICON_X, 0, 0);
|
||||
}
|
||||
|
||||
/* Don't filter when the menu is first opened, but still run the search
|
||||
|
@ -148,11 +142,22 @@ static void attribute_search_exec_fn(bContext *UNUSED(C), void *data_v, void *it
|
|||
BLI_strncpy(value->value, item->name.c_str(), MAX_NAME);
|
||||
}
|
||||
|
||||
void node_geometry_add_attribute_search_button(const bNodeTree *node_tree,
|
||||
void node_geometry_add_attribute_search_button(const bContext *C,
|
||||
const bNodeTree *node_tree,
|
||||
const bNode *node,
|
||||
PointerRNA *socket_ptr,
|
||||
uiLayout *layout)
|
||||
{
|
||||
const NodeUIStorage *ui_storage = BKE_node_tree_ui_storage_get_from_context(
|
||||
C, *node_tree, *node);
|
||||
|
||||
if (ui_storage == nullptr) {
|
||||
uiItemR(layout, socket_ptr, "default_value", 0, "", 0);
|
||||
return;
|
||||
}
|
||||
|
||||
const NodeTreeUIStorage *tree_ui_storage = node_tree->ui_storage;
|
||||
|
||||
uiBlock *block = uiLayoutGetBlock(layout);
|
||||
uiBut *but = uiDefIconTextButR(block,
|
||||
UI_BTYPE_SEARCH_MENU,
|
||||
|
@ -172,8 +177,10 @@ void node_geometry_add_attribute_search_button(const bNodeTree *node_tree,
|
|||
0.0f,
|
||||
"");
|
||||
|
||||
AttributeSearchData *data = OBJECT_GUARDED_NEW(
|
||||
AttributeSearchData, {*node_tree, *node, *static_cast<bNodeSocket *>(socket_ptr->data)});
|
||||
AttributeSearchData *data = OBJECT_GUARDED_NEW(AttributeSearchData,
|
||||
{tree_ui_storage->dummy_info_for_search,
|
||||
*ui_storage,
|
||||
*static_cast<bNodeSocket *>(socket_ptr->data)});
|
||||
|
||||
UI_but_func_search_set_results_are_suggestions(but, true);
|
||||
UI_but_func_search_set_sep_string(but, MENU_SEP);
|
||||
|
|
|
@ -310,7 +310,8 @@ void NODE_OT_cryptomatte_layer_add(struct wmOperatorType *ot);
|
|||
void NODE_OT_cryptomatte_layer_remove(struct wmOperatorType *ot);
|
||||
|
||||
/* node_geometry_attribute_search.cc */
|
||||
void node_geometry_add_attribute_search_button(const struct bNodeTree *node_tree,
|
||||
void node_geometry_add_attribute_search_button(const struct bContext *C,
|
||||
const struct bNodeTree *node_tree,
|
||||
const struct bNode *node,
|
||||
struct PointerRNA *socket_ptr,
|
||||
struct uiLayout *layout);
|
||||
|
|
|
@ -846,7 +846,7 @@ static void ui_node_draw_input(
|
|||
case SOCK_STRING: {
|
||||
const bNodeTree *node_tree = (const bNodeTree *)nodeptr.owner_id;
|
||||
if (node_tree->type == NTREE_GEOMETRY) {
|
||||
node_geometry_add_attribute_search_button(node_tree, node, &inputptr, row);
|
||||
node_geometry_add_attribute_search_button(C, node_tree, node, &inputptr, row);
|
||||
}
|
||||
else {
|
||||
uiItemR(sub, &inputptr, "default_value", 0, "", ICON_NONE);
|
||||
|
|
|
@ -602,8 +602,8 @@ static uiBlock *merged_element_search_menu(bContext *C, ARegion *region, void *d
|
|||
NULL,
|
||||
merged_element_search_update_fn,
|
||||
data,
|
||||
NULL,
|
||||
false,
|
||||
NULL,
|
||||
merged_element_search_exec_fn,
|
||||
NULL);
|
||||
UI_but_flag_enable(but, UI_BUT_ACTIVATE_ON_INIT);
|
||||
|
|
|
@ -734,12 +734,11 @@ static void sequencer_add_draw(bContext *UNUSED(C), wmOperator *op)
|
|||
uiLayout *layout = op->layout;
|
||||
SequencerAddData *sad = op->customdata;
|
||||
ImageFormatData *imf = &sad->im_format;
|
||||
PointerRNA imf_ptr, ptr;
|
||||
PointerRNA imf_ptr;
|
||||
|
||||
/* Main draw call. */
|
||||
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
|
||||
uiDefAutoButsRNA(
|
||||
layout, &ptr, sequencer_add_draw_check_fn, NULL, NULL, UI_BUT_LABEL_ALIGN_NONE, false);
|
||||
layout, op->ptr, sequencer_add_draw_check_fn, NULL, NULL, UI_BUT_LABEL_ALIGN_NONE, false);
|
||||
|
||||
/* Image template. */
|
||||
RNA_pointer_create(NULL, &RNA_ImageFormatSettings, imf, &imf_ptr);
|
||||
|
|
|
@ -1491,19 +1491,16 @@ static void sequencer_split_ui(bContext *UNUSED(C), wmOperator *op)
|
|||
uiLayoutSetPropSep(layout, true);
|
||||
uiLayoutSetPropDecorate(layout, false);
|
||||
|
||||
PointerRNA ptr;
|
||||
RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
|
||||
|
||||
uiLayout *row = uiLayoutRow(layout, false);
|
||||
uiItemR(row, &ptr, "type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "frame", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, &ptr, "side", 0, NULL, ICON_NONE);
|
||||
uiItemR(row, op->ptr, "type", UI_ITEM_R_EXPAND, NULL, ICON_NONE);
|
||||
uiItemR(layout, op->ptr, "frame", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, op->ptr, "side", 0, NULL, ICON_NONE);
|
||||
|
||||
uiItemS(layout);
|
||||
|
||||
uiItemR(layout, &ptr, "use_cursor_position", 0, NULL, ICON_NONE);
|
||||
if (RNA_boolean_get(&ptr, "use_cursor_position")) {
|
||||
uiItemR(layout, &ptr, "channel", 0, NULL, ICON_NONE);
|
||||
uiItemR(layout, op->ptr, "use_cursor_position", 0, NULL, ICON_NONE);
|
||||
if (RNA_boolean_get(op->ptr, "use_cursor_position")) {
|
||||
uiItemR(layout, op->ptr, "channel", 0, NULL, ICON_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -372,7 +372,7 @@ static int gizmo_axis_cursor_get(wmGizmo *UNUSED(gz))
|
|||
return WM_CURSOR_DEFAULT;
|
||||
}
|
||||
|
||||
static void gizmo_axis_screen_bounds_get(bContext *C, wmGizmo *gz, rcti *r_bounding_box)
|
||||
static bool gizmo_axis_screen_bounds_get(bContext *C, wmGizmo *gz, rcti *r_bounding_box)
|
||||
{
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
const float rad = WIDGET_RADIUS;
|
||||
|
@ -380,6 +380,7 @@ static void gizmo_axis_screen_bounds_get(bContext *C, wmGizmo *gz, rcti *r_bound
|
|||
r_bounding_box->ymin = gz->matrix_basis[3][1] + area->totrct.ymin - rad;
|
||||
r_bounding_box->xmax = r_bounding_box->xmin + rad;
|
||||
r_bounding_box->ymax = r_bounding_box->ymin + rad;
|
||||
return true;
|
||||
}
|
||||
|
||||
void VIEW3D_GT_navigate_rotate(wmGizmoType *gzt)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1308,6 +1308,11 @@ typedef struct NodeGeometryMeshLine {
|
|||
uint8_t count_mode;
|
||||
} NodeGeometryMeshLine;
|
||||
|
||||
typedef struct NodeSwitch {
|
||||
/* NodeSwitch. */
|
||||
uint8_t input_type;
|
||||
} NodeSwitch;
|
||||
|
||||
/* script node mode */
|
||||
#define NODE_SCRIPT_INTERNAL 0
|
||||
#define NODE_SCRIPT_EXTERNAL 1
|
||||
|
|
|
@ -1911,7 +1911,7 @@ typedef struct SpaceSpreadsheet {
|
|||
/**
|
||||
* List of #SpreadsheetContext.
|
||||
* This is a path to the data that is displayed in the spreadsheet.
|
||||
* It can be set explicitely by an action of the user (e.g. clicking the preview icon in a
|
||||
* It can be set explicitly by an action of the user (e.g. clicking the preview icon in a
|
||||
* geometry node) or it can be derived from context automatically based on some heuristic.
|
||||
*/
|
||||
ListBase context_path;
|
||||
|
|
|
@ -65,6 +65,20 @@
|
|||
const EnumPropertyItem rna_enum_node_socket_in_out_items[] = {
|
||||
{SOCK_IN, "IN", 0, "Input", ""}, {SOCK_OUT, "OUT", 0, "Output", ""}, {0, NULL, 0, NULL, NULL}};
|
||||
|
||||
static const EnumPropertyItem node_socket_data_type_items[] = {
|
||||
{SOCK_FLOAT, "FLOAT", 0, "Float", ""},
|
||||
{SOCK_INT, "INT", 0, "Int", ""},
|
||||
{SOCK_BOOLEAN, "BOOLEAN", 0, "Boolean", ""},
|
||||
{SOCK_VECTOR, "VECTOR", 0, "Vector", ""},
|
||||
{SOCK_STRING, "STRING", 0, "String", ""},
|
||||
{SOCK_RGBA, "RGBA", 0, "Color", ""},
|
||||
{SOCK_OBJECT, "OBJECT", 0, "Object", ""},
|
||||
{SOCK_IMAGE, "IMAGE", 0, "Image", ""},
|
||||
{SOCK_GEOMETRY, "GEOMETRY", 0, "Geometry", ""},
|
||||
{SOCK_COLLECTION, "COLLECTION", 0, "Collection", ""},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
};
|
||||
|
||||
#ifndef RNA_RUNTIME
|
||||
static const EnumPropertyItem rna_enum_node_socket_display_shape_items[] = {
|
||||
{SOCK_DISPLAY_SHAPE_CIRCLE, "CIRCLE", 0, "Circle", ""},
|
||||
|
@ -1913,6 +1927,29 @@ static const EnumPropertyItem *itemf_function_check(
|
|||
return item_array;
|
||||
}
|
||||
|
||||
static bool switch_type_supported(const EnumPropertyItem *item)
|
||||
{
|
||||
return ELEM(item->value,
|
||||
SOCK_FLOAT,
|
||||
SOCK_INT,
|
||||
SOCK_BOOLEAN,
|
||||
SOCK_VECTOR,
|
||||
SOCK_STRING,
|
||||
SOCK_RGBA,
|
||||
SOCK_GEOMETRY,
|
||||
SOCK_OBJECT,
|
||||
SOCK_COLLECTION);
|
||||
}
|
||||
|
||||
static const EnumPropertyItem *rna_GeometryNodeSwitch_type_itemf(bContext *UNUSED(C),
|
||||
PointerRNA *UNUSED(ptr),
|
||||
PropertyRNA *UNUSED(prop),
|
||||
bool *r_free)
|
||||
{
|
||||
*r_free = true;
|
||||
return itemf_function_check(node_socket_data_type_items, switch_type_supported);
|
||||
}
|
||||
|
||||
static bool attribute_clamp_type_supported(const EnumPropertyItem *item)
|
||||
{
|
||||
return ELEM(item->value, CD_PROP_FLOAT, CD_PROP_FLOAT3, CD_PROP_INT32, CD_PROP_COLOR);
|
||||
|
@ -9630,6 +9667,19 @@ static void def_geo_mesh_line(StructRNA *srna)
|
|||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
|
||||
}
|
||||
|
||||
static void def_geo_switch(StructRNA *srna)
|
||||
{
|
||||
PropertyRNA *prop;
|
||||
|
||||
RNA_def_struct_sdna_from(srna, "NodeSwitch", "storage");
|
||||
prop = RNA_def_property(srna, "input_type", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "input_type");
|
||||
RNA_def_property_enum_items(prop, node_socket_data_type_items);
|
||||
RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_GeometryNodeSwitch_type_itemf");
|
||||
RNA_def_property_ui_text(prop, "Input Type", "");
|
||||
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
||||
static void rna_def_shader_node(BlenderRNA *brna)
|
||||
|
|
|
@ -84,7 +84,7 @@ const EnumPropertyItem rna_enum_object_mode_items[] = {
|
|||
{OB_MODE_PAINT_GPENCIL,
|
||||
"PAINT_GPENCIL",
|
||||
ICON_GREASEPENCIL,
|
||||
"Draw",
|
||||
"Draw Mode",
|
||||
"Paint Grease Pencil Strokes"},
|
||||
{OB_MODE_WEIGHT_GPENCIL,
|
||||
"WEIGHT_GPENCIL",
|
||||
|
|
|
@ -180,6 +180,7 @@ set(SRC
|
|||
geometry/nodes/node_geo_points_to_volume.cc
|
||||
geometry/nodes/node_geo_subdivide.cc
|
||||
geometry/nodes/node_geo_subdivision_surface.cc
|
||||
geometry/nodes/node_geo_switch.cc
|
||||
geometry/nodes/node_geo_transform.cc
|
||||
geometry/nodes/node_geo_triangulate.cc
|
||||
geometry/nodes/node_geo_volume_to_mesh.cc
|
||||
|
|
|
@ -69,6 +69,7 @@ void register_node_type_geo_points_to_volume(void);
|
|||
void register_node_type_geo_sample_texture(void);
|
||||
void register_node_type_geo_subdivide(void);
|
||||
void register_node_type_geo_subdivision_surface(void);
|
||||
void register_node_type_geo_switch(void);
|
||||
void register_node_type_geo_transform(void);
|
||||
void register_node_type_geo_triangulate(void);
|
||||
void register_node_type_geo_volume_to_mesh(void);
|
||||
|
|
|
@ -310,6 +310,7 @@ DefNode(GeometryNode, GEO_NODE_MESH_PRIMITIVE_GRID, 0, "MESH_PRIMITIVE_GRID", Me
|
|||
DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_MAP_RANGE, def_geo_attribute_map_range, "ATTRIBUTE_MAP_RANGE", AttributeMapRange, "Attribute Map Range", "")
|
||||
DefNode(GeometryNode, GEO_NODE_ATTRIBUTE_CLAMP, def_geo_attribute_clamp, "ATTRIBUTE_CLAMP", AttributeClamp, "Attribute Clamp", "")
|
||||
DefNode(GeometryNode, GEO_NODE_BOUNDING_BOX, 0, "BOUNDING_BOX", BoundBox, "Bounding Box", "")
|
||||
DefNode(GeometryNode, GEO_NODE_SWITCH, def_geo_switch, "SWITCH", Switch, "Switch", "")
|
||||
|
||||
/* undefine macros */
|
||||
#undef DefNode
|
||||
|
|
|
@ -0,0 +1,163 @@
|
|||
/*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "node_geometry_util.hh"
|
||||
|
||||
#include "UI_interface.h"
|
||||
#include "UI_resources.h"
|
||||
|
||||
static bNodeSocketTemplate geo_node_switch_in[] = {
|
||||
{SOCK_BOOLEAN, N_("Switch")},
|
||||
|
||||
{SOCK_FLOAT, N_("A"), 0.0, 0.0, 0.0, 0.0, -FLT_MAX, FLT_MAX},
|
||||
{SOCK_FLOAT, N_("B"), 0.0, 0.0, 0.0, 0.0, -FLT_MAX, FLT_MAX},
|
||||
{SOCK_INT, N_("A"), 0, 0, 0, 0, -100000, 100000},
|
||||
{SOCK_INT, N_("B"), 0, 0, 0, 0, -100000, 100000},
|
||||
{SOCK_BOOLEAN, N_("A")},
|
||||
{SOCK_BOOLEAN, N_("B")},
|
||||
{SOCK_VECTOR, N_("A"), 0.0, 0.0, 0.0, 0.0, -FLT_MAX, FLT_MAX},
|
||||
{SOCK_VECTOR, N_("B"), 0.0, 0.0, 0.0, 0.0, -FLT_MAX, FLT_MAX},
|
||||
{SOCK_RGBA, N_("A"), 0.8, 0.8, 0.8, 1.0},
|
||||
{SOCK_RGBA, N_("B"), 0.8, 0.8, 0.8, 1.0},
|
||||
{SOCK_STRING, N_("A")},
|
||||
{SOCK_STRING, N_("B")},
|
||||
{SOCK_GEOMETRY, N_("A")},
|
||||
{SOCK_GEOMETRY, N_("B")},
|
||||
{SOCK_OBJECT, N_("A")},
|
||||
{SOCK_OBJECT, N_("B")},
|
||||
{SOCK_COLLECTION, N_("A")},
|
||||
{SOCK_COLLECTION, N_("B")},
|
||||
{-1, ""},
|
||||
};
|
||||
|
||||
static bNodeSocketTemplate geo_node_switch_out[] = {
|
||||
{SOCK_FLOAT, N_("Output")},
|
||||
{SOCK_INT, N_("Output")},
|
||||
{SOCK_BOOLEAN, N_("Output")},
|
||||
{SOCK_VECTOR, N_("Output")},
|
||||
{SOCK_RGBA, N_("Output")},
|
||||
{SOCK_STRING, N_("Output")},
|
||||
{SOCK_GEOMETRY, N_("Output")},
|
||||
{SOCK_OBJECT, N_("Output")},
|
||||
{SOCK_COLLECTION, N_("Output")},
|
||||
{-1, ""},
|
||||
};
|
||||
|
||||
static void geo_node_switch_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
|
||||
{
|
||||
uiItemR(layout, ptr, "input_type", 0, "", ICON_NONE);
|
||||
}
|
||||
|
||||
static void geo_node_switch_init(bNodeTree *UNUSED(tree), bNode *node)
|
||||
{
|
||||
NodeSwitch *data = (NodeSwitch *)MEM_callocN(sizeof(NodeSwitch), __func__);
|
||||
data->input_type = SOCK_FLOAT;
|
||||
node->storage = data;
|
||||
}
|
||||
|
||||
namespace blender::nodes {
|
||||
|
||||
template<typename T>
|
||||
void output_input(GeoNodeExecParams ¶ms,
|
||||
const bool input,
|
||||
const StringRef input_suffix,
|
||||
const StringRef output_identifier)
|
||||
{
|
||||
if (input) {
|
||||
params.set_output(output_identifier, params.extract_input<T>("B" + input_suffix));
|
||||
}
|
||||
else {
|
||||
params.set_output(output_identifier, params.extract_input<T>("A" + input_suffix));
|
||||
}
|
||||
}
|
||||
|
||||
static void geo_node_switch_update(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
NodeSwitch *node_storage = (NodeSwitch *)node->storage;
|
||||
int index = 0;
|
||||
LISTBASE_FOREACH (bNodeSocket *, socket, &node->inputs) {
|
||||
nodeSetSocketAvailability(
|
||||
socket, index == 0 || socket->type == (eNodeSocketDatatype)node_storage->input_type);
|
||||
index++;
|
||||
}
|
||||
LISTBASE_FOREACH (bNodeSocket *, socket, &node->outputs) {
|
||||
nodeSetSocketAvailability(socket,
|
||||
socket->type == (eNodeSocketDatatype)node_storage->input_type);
|
||||
}
|
||||
}
|
||||
|
||||
static void geo_node_switch_exec(GeoNodeExecParams params)
|
||||
{
|
||||
const NodeSwitch &storage = *(const NodeSwitch *)params.node().storage;
|
||||
const bool input = params.extract_input<bool>("Switch");
|
||||
switch ((eNodeSocketDatatype)storage.input_type) {
|
||||
case SOCK_FLOAT: {
|
||||
output_input<float>(params, input, "", "Output");
|
||||
break;
|
||||
}
|
||||
case SOCK_INT: {
|
||||
output_input<int>(params, input, "_001", "Output_001");
|
||||
break;
|
||||
}
|
||||
case SOCK_BOOLEAN: {
|
||||
output_input<bool>(params, input, "_002", "Output_002");
|
||||
break;
|
||||
}
|
||||
case SOCK_VECTOR: {
|
||||
output_input<float3>(params, input, "_003", "Output_003");
|
||||
break;
|
||||
}
|
||||
case SOCK_RGBA: {
|
||||
output_input<Color4f>(params, input, "_004", "Output_004");
|
||||
break;
|
||||
}
|
||||
case SOCK_STRING: {
|
||||
output_input<std::string>(params, input, "_005", "Output_005");
|
||||
break;
|
||||
}
|
||||
case SOCK_GEOMETRY: {
|
||||
output_input<GeometrySet>(params, input, "_006", "Output_006");
|
||||
break;
|
||||
}
|
||||
case SOCK_OBJECT: {
|
||||
output_input<bke::PersistentObjectHandle>(params, input, "_007", "Output_007");
|
||||
break;
|
||||
}
|
||||
case SOCK_COLLECTION: {
|
||||
output_input<bke::PersistentCollectionHandle>(params, input, "_008", "Output_008");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
BLI_assert_unreachable();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace blender::nodes
|
||||
|
||||
void register_node_type_geo_switch()
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
geo_node_type_base(&ntype, GEO_NODE_SWITCH, "Switch", NODE_CLASS_GEOMETRY, 0);
|
||||
node_type_socket_templates(&ntype, geo_node_switch_in, geo_node_switch_out);
|
||||
node_type_init(&ntype, geo_node_switch_init);
|
||||
node_type_update(&ntype, blender::nodes::geo_node_switch_update);
|
||||
node_type_storage(&ntype, "NodeSwitch", node_free_standard_storage, node_copy_standard_storage);
|
||||
ntype.geometry_node_execute = blender::nodes::geo_node_switch_exec;
|
||||
ntype.draw_buttons = geo_node_switch_layout;
|
||||
nodeRegisterType(&ntype);
|
||||
}
|
|
@ -62,9 +62,9 @@ typedef void (*wmGizmoFnMatrixBasisGet)(const struct wmGizmo *, float[4][4]);
|
|||
typedef int (*wmGizmoFnInvoke)(struct bContext *, struct wmGizmo *, const struct wmEvent *);
|
||||
typedef void (*wmGizmoFnExit)(struct bContext *, struct wmGizmo *, const bool);
|
||||
typedef int (*wmGizmoFnCursorGet)(struct wmGizmo *);
|
||||
typedef void (*wmGizmoFnScreenBoundsGet)(struct bContext *,
|
||||
typedef bool (*wmGizmoFnScreenBoundsGet)(struct bContext *,
|
||||
struct wmGizmo *,
|
||||
rcti *r_bounding_box);
|
||||
rcti *r_bounding_box) ATTR_WARN_UNUSED_RESULT;
|
||||
typedef void (*wmGizmoFnSelectRefresh)(struct wmGizmo *);
|
||||
typedef void (*wmGizmoFnFree)(struct wmGizmo *);
|
||||
|
||||
|
|
|
@ -2595,6 +2595,15 @@ static int wm_handlers_do_gizmo_handler(bContext *C,
|
|||
ListBase *handlers,
|
||||
const bool do_debug_handler)
|
||||
{
|
||||
/* Drag events use the previous click location to highlight the gizmos,
|
||||
* Get the highlight again in case the user dragged off the gizmo. */
|
||||
const bool is_event_drag = ISTWEAK(event->type) || (event->val == KM_CLICK_DRAG);
|
||||
const bool is_event_modifier = ISKEYMODIFIER(event->type);
|
||||
/* Only keep the highlight if the gizmo becomes modal as result of event handling.
|
||||
* Without this check, even un-handled drag events will set the highlight if the drag
|
||||
* was initiated over a gizmo. */
|
||||
const bool restore_highlight_unless_activated = is_event_drag;
|
||||
|
||||
int action = WM_HANDLER_CONTINUE;
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
|
@ -2608,13 +2617,25 @@ static int wm_handlers_do_gizmo_handler(bContext *C,
|
|||
if (region->type->clip_gizmo_events_by_ui) {
|
||||
if (UI_region_block_find_mouse_over(region, &event->x, true)) {
|
||||
if (gz != NULL && event->type != EVT_GIZMO_UPDATE) {
|
||||
WM_tooltip_clear(C, CTX_wm_window(C));
|
||||
wm_gizmomap_highlight_set(gzmap, C, NULL, 0);
|
||||
if (restore_highlight_unless_activated == false) {
|
||||
WM_tooltip_clear(C, CTX_wm_window(C));
|
||||
wm_gizmomap_highlight_set(gzmap, C, NULL, 0);
|
||||
}
|
||||
}
|
||||
return action;
|
||||
}
|
||||
}
|
||||
|
||||
struct {
|
||||
wmGizmo *gz_modal;
|
||||
wmGizmo *gz;
|
||||
int part;
|
||||
} prev = {
|
||||
.gz_modal = wm_gizmomap_modal_get(gzmap),
|
||||
.gz = gz,
|
||||
.part = gz ? gz->highlight_part : 0,
|
||||
};
|
||||
|
||||
if (region->gizmo_map != handler->gizmo_map) {
|
||||
WM_gizmomap_tag_refresh(handler->gizmo_map);
|
||||
}
|
||||
|
@ -2622,16 +2643,11 @@ static int wm_handlers_do_gizmo_handler(bContext *C,
|
|||
wm_gizmomap_handler_context_gizmo(C, handler);
|
||||
wm_region_mouse_co(C, event);
|
||||
|
||||
/* Drag events use the previous click location to highlight the gizmos,
|
||||
* Get the highlight again in case the user dragged off the gizmo. */
|
||||
const bool is_event_drag = ISTWEAK(event->type) || (event->val == KM_CLICK_DRAG);
|
||||
const bool is_event_modifier = ISKEYMODIFIER(event->type);
|
||||
|
||||
bool handle_highlight = false;
|
||||
bool handle_keymap = false;
|
||||
|
||||
/* Handle gizmo highlighting. */
|
||||
if (!wm_gizmomap_modal_get(gzmap) &&
|
||||
if ((prev.gz_modal == NULL) &&
|
||||
((event->type == MOUSEMOVE) || is_event_modifier || is_event_drag)) {
|
||||
handle_highlight = true;
|
||||
if (is_event_modifier || is_event_drag) {
|
||||
|
@ -2642,14 +2658,15 @@ static int wm_handlers_do_gizmo_handler(bContext *C,
|
|||
handle_keymap = true;
|
||||
}
|
||||
|
||||
/* There is no need to handle this event when the key-map isn't being applied
|
||||
* since any change to the highlight will be restored to the previous value. */
|
||||
if (restore_highlight_unless_activated) {
|
||||
if ((handle_highlight == true) && (handle_keymap == false)) {
|
||||
return action;
|
||||
}
|
||||
}
|
||||
|
||||
if (handle_highlight) {
|
||||
struct {
|
||||
wmGizmo *gz;
|
||||
int part;
|
||||
} prev = {
|
||||
.gz = gz,
|
||||
.part = gz ? gz->highlight_part : 0,
|
||||
};
|
||||
int part = -1;
|
||||
gz = wm_gizmomap_highlight_find(gzmap, C, event, &part);
|
||||
|
||||
|
@ -2734,6 +2751,16 @@ static int wm_handlers_do_gizmo_handler(bContext *C,
|
|||
}
|
||||
}
|
||||
|
||||
if (handle_highlight) {
|
||||
if (restore_highlight_unless_activated) {
|
||||
/* Check handling the key-map didn't activate a gizmo. */
|
||||
wmGizmo *gz_modal = wm_gizmomap_modal_get(gzmap);
|
||||
if (!(gz_modal && (gz_modal != prev.gz_modal))) {
|
||||
wm_gizmomap_highlight_set(gzmap, C, prev.gz, prev.part);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (is_event_handle_all) {
|
||||
if (action == WM_HANDLER_CONTINUE) {
|
||||
action |= WM_HANDLER_BREAK | WM_HANDLER_MODAL;
|
||||
|
|
Loading…
Reference in New Issue