The naming scheme is object.parent_clear
-> OBJECT_OT_parent_clear
.
To find the source code you will usually find the declaration of the operator in the headerfile, somewhere in source/blender/editors/*
, in this case it is source/blender/editors/object/object_intern.h
The comment points to the source file source/blender/editors/object/object_relations.c
541 void OBJECT_OT_parent_clear(wmOperatorType *ot)
542 {
543 /* identifiers */
544 ot->name = "Clear Parent";
545 ot->description = "Clear the object's parenting";
546 ot->idname = "OBJECT_OT_parent_clear";
547
548 /* api callbacks */
549 ot->invoke = WM_menu_invoke;
550 ot->exec = parent_clear_exec;
551
552 ot->poll = ED_operator_object_active_editable;
553
554 /* flags */
555 ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
556
557 ot->prop = RNA_def_enum(ot->srna, "type", prop_clear_parent_types, CLEAR_PARENT_ALL, "Type", "");
558 }
The poll method checks for the right context. The exec method is located in the same file
523 /* note, poll should check for editable scene */
524 static int parent_clear_exec(bContext *C, wmOperator *op)
525 {
526 Main *bmain = CTX_data_main(C);
527 const int type = RNA_enum_get(op->ptr, "type");
528
529 CTX_DATA_BEGIN (C, Object *, ob, selected_editable_objects)
530 {
531 ED_object_parent_clear(ob, type);
532 }
533 CTX_DATA_END;
534
535 DAG_relations_tag_update(bmain);
536 WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
537 WM_event_add_notifier(C, NC_OBJECT | ND_PARENT, NULL);
538 return OPERATOR_FINISHED;
539 }
I would recommend an IDE like QTCreator to follow the symbols though you might use grep/search the files manually.
parent_clear
it seems to beED_object_parent_clear
, which is performing the operation in the end. But forduplicate_move_linked
for example? $\endgroup$duplicate_move_linked
is just two calls on forOBJECT_OT_duplicate
and one forTRANSFORM_OT_translate
see this page $\endgroup$context is incorrect
error: blender.stackexchange.com/questions/6101/… $\endgroup$