PyAPI: Better error msg when re-using internal node id #111799

Merged
YimingWu merged 2 commits from vitorboschi/blender:feature/improve_python_error into main 2023-09-02 04:41:15 +02:00
1 changed files with 6 additions and 6 deletions
Showing only changes of commit 7368859ea8 - Show all commits

View File

@ -1561,12 +1561,12 @@ static bool rna_Node_is_registered_node_type(StructRNA *type)
return (RNA_struct_blender_type_get(type) != nullptr);
}
static bool rna_Node_is_internal(bNodeType *nt)
static bool rna_Node_is_builtin(bNodeType *nt)
{
BLI_assert(nt);
/* `nt->rna_ext.data` is the python object. If it's nullptr then it's an
* internally registered node. */
/* `nt->rna_ext.data` is the python object. If it's nullptr then it's a
* builtin node. */
return nt->rna_ext.data == nullptr;
}
@ -1583,7 +1583,7 @@ static bool rna_Node_unregister(Main * /*bmain*/, StructRNA *type)
{
bNodeType *nt = static_cast<bNodeType *>(RNA_struct_blender_type_get(type));
if (!nt || rna_Node_is_internal(nt)) {
if (!nt || rna_Node_is_builtin(nt)) {
return false;
}
@ -1646,10 +1646,10 @@ static bNodeType *rna_Node_register_base(Main *bmain,
nt = nodeTypeFind(dummy_nt.idname);
if (nt) {
/* If it's an internal node, we cannot proceed. */
if (rna_Node_is_internal(nt)) {
if (rna_Node_is_builtin(nt)) {
BKE_reportf(reports,
RPT_ERROR,
"%s '%s', bl_idname '%s' is an internal node",
"%s '%s', bl_idname '%s' is a builtin node",
error_prefix,
identifier,
dummy_nt.idname);