UI: Rename Add File Node operator to Add Image as Node

`Add File Node` name is too generic. This operator only handles
opening images and movies as nodes, not script files or other kind of files as nodes.

Pull Request: https://projects.blender.org/blender/blender/pulls/122561
This commit is contained in:
Guillermo Venegas
2025-03-21 22:49:13 +01:00
committed by Hans Goudey
parent 01ddb320dd
commit 61783caa7f
5 changed files with 16 additions and 16 deletions

View File

@@ -650,7 +650,7 @@ class NODE_OT_viewer_shortcut_get(Operator):
class NODE_FH_image_node(FileHandler):
bl_idname = "NODE_FH_image_node"
bl_label = "Image node"
bl_import_operator = "node.add_file"
bl_import_operator = "node.add_image"
bl_file_extensions = ";".join((*bpy.path.extensions_image, *bpy.path.extensions_movie))
@classmethod

View File

@@ -690,10 +690,10 @@ void NODE_OT_add_collection(wmOperatorType *ot)
/** \} */
/* -------------------------------------------------------------------- */
/** \name Add File Node Operator
/** \name Add Image Node Operator
* \{ */
static bool node_add_file_poll(bContext *C)
static bool node_add_image_poll(bContext *C)
{
const SpaceNode *snode = CTX_wm_space_node(C);
return ED_operator_node_editable(C) &&
@@ -748,7 +748,7 @@ static wmOperatorStatus node_add_nodes_modal(bContext *C, wmOperator *op, const
return OPERATOR_RUNNING_MODAL;
}
static wmOperatorStatus node_add_file_exec(bContext *C, wmOperator *op)
static wmOperatorStatus node_add_image_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);
SpaceNode &snode = *CTX_wm_space_node(C);
@@ -850,7 +850,7 @@ static wmOperatorStatus node_add_file_exec(bContext *C, wmOperator *op)
return OPERATOR_RUNNING_MODAL;
}
static wmOperatorStatus node_add_file_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus node_add_image_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
ARegion *region = CTX_wm_region(C);
SpaceNode *snode = CTX_wm_space_node(C);
@@ -868,23 +868,23 @@ static wmOperatorStatus node_add_file_invoke(bContext *C, wmOperator *op, const
if (WM_operator_properties_id_lookup_is_set(op->ptr) ||
RNA_struct_property_is_set(op->ptr, "filepath"))
{
return node_add_file_exec(C, op);
return node_add_image_exec(C, op);
}
return WM_operator_filesel(C, op, event);
}
void NODE_OT_add_file(wmOperatorType *ot)
void NODE_OT_add_image(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Add File Node";
ot->description = "Add a file node to the current node editor";
ot->idname = "NODE_OT_add_file";
ot->name = "Add Image as Node";
ot->description = "Add a image/movie file as node to the current node editor";
ot->idname = "NODE_OT_add_image";
/* callbacks */
ot->exec = node_add_file_exec;
ot->exec = node_add_image_exec;
ot->modal = node_add_nodes_modal;
ot->invoke = node_add_file_invoke;
ot->poll = node_add_file_poll;
ot->invoke = node_add_image_invoke;
ot->poll = node_add_image_poll;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;

View File

@@ -294,7 +294,7 @@ void NODE_OT_add_group(wmOperatorType *ot);
void NODE_OT_add_group_asset(wmOperatorType *ot);
void NODE_OT_add_object(wmOperatorType *ot);
void NODE_OT_add_collection(wmOperatorType *ot);
void NODE_OT_add_file(wmOperatorType *ot);
void NODE_OT_add_image(wmOperatorType *ot);
void NODE_OT_add_mask(wmOperatorType *ot);
void NODE_OT_add_material(wmOperatorType *ot);
void NODE_OT_add_color(wmOperatorType *ot);

View File

@@ -82,7 +82,7 @@ void node_operatortypes()
WM_operatortype_append(NODE_OT_add_group_asset);
WM_operatortype_append(NODE_OT_add_object);
WM_operatortype_append(NODE_OT_add_collection);
WM_operatortype_append(NODE_OT_add_file);
WM_operatortype_append(NODE_OT_add_image);
WM_operatortype_append(NODE_OT_add_mask);
WM_operatortype_append(NODE_OT_add_material);
WM_operatortype_append(NODE_OT_add_color);

View File

@@ -930,7 +930,7 @@ static void node_dropboxes()
WM_drag_free_imported_drag_ID,
nullptr);
WM_dropbox_add(lb,
"NODE_OT_add_file",
"NODE_OT_add_image",
node_id_im_drop_poll,
node_id_im_drop_copy,
WM_drag_free_imported_drag_ID,