mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
Merge branch 'blender-v5.0-release'
This commit is contained in:
commit
864a02556e
5 changed files with 46 additions and 3 deletions
|
|
@ -610,6 +610,12 @@ static wmOperatorStatus paste_from_file(bContext *C, ReportList *reports, const
|
|||
|
||||
static wmOperatorStatus paste_from_file_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
if (op->flag & OP_IS_INVOKE) {
|
||||
if (!WM_operator_poll_or_report_error(C, op->type, op->reports)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
}
|
||||
|
||||
std::string filepath = RNA_string_get(op->ptr, "filepath");
|
||||
wmOperatorStatus retval = paste_from_file(C, op->reports, filepath.c_str());
|
||||
return retval;
|
||||
|
|
|
|||
|
|
@ -699,8 +699,11 @@ bool ED_operator_editfont(bContext *C)
|
|||
{
|
||||
Object *obedit = CTX_data_edit_object(C);
|
||||
if (obedit && obedit->type == OB_FONT) {
|
||||
return nullptr != ((Curve *)obedit->data)->editfont;
|
||||
if (((Curve *)obedit->data)->editfont) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
CTX_wm_operator_poll_msg_set(C, "expected an active edit-font object");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -982,6 +982,21 @@ void WM_operator_handlers_clear(wmWindowManager *wm, wmOperatorType *ot);
|
|||
|
||||
bool WM_operator_poll(bContext *C, wmOperatorType *ot);
|
||||
bool WM_operator_poll_context(bContext *C, wmOperatorType *ot, blender::wm::OpCallContext context);
|
||||
|
||||
/**
|
||||
* Check poll succeeds or returns false & report an error.
|
||||
*
|
||||
* This can be used from #wmOperatorType::exec for operators that use the file-selector.
|
||||
* It's needed in this case because the context can be changed once the file-selector
|
||||
* has been activated.
|
||||
*
|
||||
* \return true or false & report an error.
|
||||
*
|
||||
* \note It's best practice that `ot->poll` sets the "poll message",
|
||||
* otherwise a generic (unhelpful) error will be used.
|
||||
*/
|
||||
bool WM_operator_poll_or_report_error(bContext *C, wmOperatorType *ot, ReportList *reports);
|
||||
|
||||
/**
|
||||
* For running operators with frozen context (modal handlers, menus).
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1112,6 +1112,26 @@ bool WM_operator_poll(bContext *C, wmOperatorType *ot)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool WM_operator_poll_or_report_error(bContext *C, wmOperatorType *ot, ReportList *reports)
|
||||
{
|
||||
CTX_wm_operator_poll_msg_clear(C);
|
||||
if (WM_operator_poll(C, ot)) {
|
||||
return true;
|
||||
}
|
||||
bool msg_free = false;
|
||||
const char *msg = CTX_wm_operator_poll_msg_get(C, &msg_free);
|
||||
CTX_wm_operator_poll_msg_clear(C);
|
||||
BKE_reportf(reports,
|
||||
RPT_ERROR,
|
||||
"Invalid context: \"%s\", %s",
|
||||
CTX_IFACE_(ot->translation_context, ot->name),
|
||||
msg ? msg : IFACE_("poll failed"));
|
||||
if (msg_free) {
|
||||
MEM_freeN(msg);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool WM_operator_poll_context(bContext *C, wmOperatorType *ot, blender::wm::OpCallContext context)
|
||||
{
|
||||
/* Sets up the new context and calls #wm_operator_invoke() with poll_only. */
|
||||
|
|
|
|||
|
|
@ -127,8 +127,7 @@ def ctx_editmode_mesh_extra():
|
|||
bpy.ops.wm.read_factory_settings(use_empty=False)
|
||||
bpy.ops.object.vertex_group_add()
|
||||
bpy.ops.object.shape_key_add(from_mix=False) # Basis Key
|
||||
shape_key = bpy.ops.object.shape_key_add(from_mix=True)
|
||||
shape_key.value = 0.0
|
||||
bpy.ops.object.shape_key_add(from_mix=True)
|
||||
bpy.ops.mesh.uv_texture_add()
|
||||
bpy.ops.object.material_slot_add()
|
||||
# editmode last!
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue