#70267 Retopology Overlay #104599
|
@ -748,8 +748,8 @@ typedef struct StructRNA *(*StructRegisterFunc)(struct Main *bmain,
|
||||||
StructValidateFunc validate,
|
StructValidateFunc validate,
|
||||||
StructCallbackFunc call,
|
StructCallbackFunc call,
|
||||||
StructFreeFunc free);
|
StructFreeFunc free);
|
||||||
|
/** Return true when `type` was successfully unregistered & freed. */
|
||||||
typedef void (*StructUnregisterFunc)(struct Main *bmain, struct StructRNA *type);
|
typedef bool (*StructUnregisterFunc)(struct Main *bmain, struct StructRNA *type);
|
||||||
typedef void **(*StructInstanceFunc)(PointerRNA *ptr);
|
typedef void **(*StructInstanceFunc)(PointerRNA *ptr);
|
||||||
|
|
||||||
typedef struct StructRNA StructRNA;
|
typedef struct StructRNA StructRNA;
|
||||||
|
|
|
@ -630,9 +630,10 @@ IDProperty **rna_PropertyGroup_idprops(PointerRNA *ptr)
|
||||||
return (IDProperty **)&ptr->data;
|
return (IDProperty **)&ptr->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rna_PropertyGroup_unregister(Main *UNUSED(bmain), StructRNA *type)
|
bool rna_PropertyGroup_unregister(Main *UNUSED(bmain), StructRNA *type)
|
||||||
{
|
{
|
||||||
RNA_struct_free(&BLENDER_RNA, type);
|
RNA_struct_free(&BLENDER_RNA, type);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
StructRNA *rna_PropertyGroup_register(Main *UNUSED(bmain),
|
StructRNA *rna_PropertyGroup_register(Main *UNUSED(bmain),
|
||||||
|
|
|
@ -255,12 +255,12 @@ static StructRNA *rna_KeyingSetInfo_refine(PointerRNA *ptr)
|
||||||
return (ksi->rna_ext.srna) ? ksi->rna_ext.srna : &RNA_KeyingSetInfo;
|
return (ksi->rna_ext.srna) ? ksi->rna_ext.srna : &RNA_KeyingSetInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_KeyingSetInfo_unregister(Main *bmain, StructRNA *type)
|
static bool rna_KeyingSetInfo_unregister(Main *bmain, StructRNA *type)
|
||||||
{
|
{
|
||||||
KeyingSetInfo *ksi = RNA_struct_blender_type_get(type);
|
KeyingSetInfo *ksi = RNA_struct_blender_type_get(type);
|
||||||
|
|
||||||
if (ksi == NULL) {
|
if (ksi == NULL) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* free RNA data referencing this */
|
/* free RNA data referencing this */
|
||||||
|
@ -271,6 +271,7 @@ static void rna_KeyingSetInfo_unregister(Main *bmain, StructRNA *type)
|
||||||
|
|
||||||
/* unlink Blender-side data */
|
/* unlink Blender-side data */
|
||||||
ANIM_keyingset_info_unregister(bmain, ksi);
|
ANIM_keyingset_info_unregister(bmain, ksi);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static StructRNA *rna_KeyingSetInfo_register(Main *bmain,
|
static StructRNA *rna_KeyingSetInfo_register(Main *bmain,
|
||||||
|
@ -281,6 +282,7 @@ static StructRNA *rna_KeyingSetInfo_register(Main *bmain,
|
||||||
StructCallbackFunc call,
|
StructCallbackFunc call,
|
||||||
StructFreeFunc free)
|
StructFreeFunc free)
|
||||||
{
|
{
|
||||||
|
const char *error_prefix = "Registering keying set info class:";
|
||||||
KeyingSetInfo dummyksi = {NULL};
|
KeyingSetInfo dummyksi = {NULL};
|
||||||
KeyingSetInfo *ksi;
|
KeyingSetInfo *ksi;
|
||||||
PointerRNA dummyptr = {NULL};
|
PointerRNA dummyptr = {NULL};
|
||||||
|
@ -299,7 +301,8 @@ static StructRNA *rna_KeyingSetInfo_register(Main *bmain,
|
||||||
if (strlen(identifier) >= sizeof(dummyksi.idname)) {
|
if (strlen(identifier) >= sizeof(dummyksi.idname)) {
|
||||||
BKE_reportf(reports,
|
BKE_reportf(reports,
|
||||||
RPT_ERROR,
|
RPT_ERROR,
|
||||||
"Registering keying set info class: '%s' is too long, maximum length is %d",
|
"%s '%s' is too long, maximum length is %d",
|
||||||
|
error_prefix,
|
||||||
identifier,
|
identifier,
|
||||||
(int)sizeof(dummyksi.idname));
|
(int)sizeof(dummyksi.idname));
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -307,8 +310,18 @@ static StructRNA *rna_KeyingSetInfo_register(Main *bmain,
|
||||||
|
|
||||||
/* check if we have registered this info before, and remove it */
|
/* check if we have registered this info before, and remove it */
|
||||||
ksi = ANIM_keyingset_info_find_name(dummyksi.idname);
|
ksi = ANIM_keyingset_info_find_name(dummyksi.idname);
|
||||||
if (ksi && ksi->rna_ext.srna) {
|
if (ksi) {
|
||||||
rna_KeyingSetInfo_unregister(bmain, ksi->rna_ext.srna);
|
StructRNA *srna = ksi->rna_ext.srna;
|
||||||
|
if (!(srna && rna_KeyingSetInfo_unregister(bmain, srna))) {
|
||||||
|
BKE_reportf(reports,
|
||||||
|
RPT_ERROR,
|
||||||
|
"%s '%s', bl_idname '%s' %s",
|
||||||
|
error_prefix,
|
||||||
|
identifier,
|
||||||
|
dummyksi.idname,
|
||||||
|
srna ? "is built-in" : "could not be unregistered");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create a new KeyingSetInfo type */
|
/* create a new KeyingSetInfo type */
|
||||||
|
|
|
@ -292,7 +292,7 @@ struct IDProperty **rna_ID_idprops(struct PointerRNA *ptr);
|
||||||
void rna_ID_fake_user_set(struct PointerRNA *ptr, bool value);
|
void rna_ID_fake_user_set(struct PointerRNA *ptr, bool value);
|
||||||
void **rna_ID_instance(PointerRNA *ptr);
|
void **rna_ID_instance(PointerRNA *ptr);
|
||||||
struct IDProperty **rna_PropertyGroup_idprops(struct PointerRNA *ptr);
|
struct IDProperty **rna_PropertyGroup_idprops(struct PointerRNA *ptr);
|
||||||
void rna_PropertyGroup_unregister(struct Main *bmain, struct StructRNA *type);
|
bool rna_PropertyGroup_unregister(struct Main *bmain, struct StructRNA *type);
|
||||||
struct StructRNA *rna_PropertyGroup_register(struct Main *bmain,
|
struct StructRNA *rna_PropertyGroup_register(struct Main *bmain,
|
||||||
struct ReportList *reports,
|
struct ReportList *reports,
|
||||||
void *data,
|
void *data,
|
||||||
|
|
|
@ -1046,12 +1046,12 @@ static bool rna_NodeTree_valid_socket_type(bNodeTreeType *ntreetype, bNodeSocket
|
||||||
return valid;
|
return valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_NodeTree_unregister(Main *UNUSED(bmain), StructRNA *type)
|
static bool rna_NodeTree_unregister(Main *UNUSED(bmain), StructRNA *type)
|
||||||
{
|
{
|
||||||
bNodeTreeType *nt = RNA_struct_blender_type_get(type);
|
bNodeTreeType *nt = RNA_struct_blender_type_get(type);
|
||||||
|
|
||||||
if (!nt) {
|
if (!nt) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RNA_struct_free_extension(type, &nt->rna_ext);
|
RNA_struct_free_extension(type, &nt->rna_ext);
|
||||||
|
@ -1061,6 +1061,7 @@ static void rna_NodeTree_unregister(Main *UNUSED(bmain), StructRNA *type)
|
||||||
|
|
||||||
/* update while blender is running */
|
/* update while blender is running */
|
||||||
WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
|
WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static StructRNA *rna_NodeTree_register(Main *bmain,
|
static StructRNA *rna_NodeTree_register(Main *bmain,
|
||||||
|
@ -1071,6 +1072,7 @@ static StructRNA *rna_NodeTree_register(Main *bmain,
|
||||||
StructCallbackFunc call,
|
StructCallbackFunc call,
|
||||||
StructFreeFunc free)
|
StructFreeFunc free)
|
||||||
{
|
{
|
||||||
|
const char *error_prefix = "Registering node tree class:";
|
||||||
bNodeTreeType *nt, dummynt;
|
bNodeTreeType *nt, dummynt;
|
||||||
bNodeTree dummyntree;
|
bNodeTree dummyntree;
|
||||||
PointerRNA dummyptr;
|
PointerRNA dummyptr;
|
||||||
|
@ -1090,7 +1092,8 @@ static StructRNA *rna_NodeTree_register(Main *bmain,
|
||||||
if (strlen(identifier) >= sizeof(dummynt.idname)) {
|
if (strlen(identifier) >= sizeof(dummynt.idname)) {
|
||||||
BKE_reportf(reports,
|
BKE_reportf(reports,
|
||||||
RPT_ERROR,
|
RPT_ERROR,
|
||||||
"Registering node tree class: '%s' is too long, maximum length is %d",
|
"%s '%s' is too long, maximum length is %d",
|
||||||
|
error_prefix,
|
||||||
identifier,
|
identifier,
|
||||||
(int)sizeof(dummynt.idname));
|
(int)sizeof(dummynt.idname));
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1099,7 +1102,16 @@ static StructRNA *rna_NodeTree_register(Main *bmain,
|
||||||
/* check if we have registered this tree type before, and remove it */
|
/* check if we have registered this tree type before, and remove it */
|
||||||
nt = ntreeTypeFind(dummynt.idname);
|
nt = ntreeTypeFind(dummynt.idname);
|
||||||
if (nt) {
|
if (nt) {
|
||||||
rna_NodeTree_unregister(bmain, nt->rna_ext.srna);
|
/* NOTE: unlike most types `nt->rna_ext.srna` doesn't need to be checked for NULL. */
|
||||||
|
if (!rna_NodeTree_unregister(bmain, nt->rna_ext.srna)) {
|
||||||
|
BKE_reportf(reports,
|
||||||
|
RPT_ERROR,
|
||||||
|
"%s '%s', bl_idname '%s' could not be unregistered",
|
||||||
|
error_prefix,
|
||||||
|
identifier,
|
||||||
|
dummynt.idname);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create a new node tree type */
|
/* create a new node tree type */
|
||||||
|
@ -1884,12 +1896,12 @@ static void rna_Node_is_registered_node_type_runtime(bContext *UNUSED(C),
|
||||||
RNA_parameter_set_lookup(parms, "result", &result);
|
RNA_parameter_set_lookup(parms, "result", &result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_Node_unregister(Main *UNUSED(bmain), StructRNA *type)
|
static bool rna_Node_unregister(Main *UNUSED(bmain), StructRNA *type)
|
||||||
{
|
{
|
||||||
bNodeType *nt = RNA_struct_blender_type_get(type);
|
bNodeType *nt = RNA_struct_blender_type_get(type);
|
||||||
|
|
||||||
if (!nt) {
|
if (!nt) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RNA_struct_free_extension(type, &nt->rna_ext);
|
RNA_struct_free_extension(type, &nt->rna_ext);
|
||||||
|
@ -1900,6 +1912,7 @@ static void rna_Node_unregister(Main *UNUSED(bmain), StructRNA *type)
|
||||||
|
|
||||||
/* update while blender is running */
|
/* update while blender is running */
|
||||||
WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
|
WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Generic internal registration function.
|
/* Generic internal registration function.
|
||||||
|
@ -1914,6 +1927,7 @@ static bNodeType *rna_Node_register_base(Main *bmain,
|
||||||
StructCallbackFunc call,
|
StructCallbackFunc call,
|
||||||
StructFreeFunc free)
|
StructFreeFunc free)
|
||||||
{
|
{
|
||||||
|
const char *error_prefix = "Registering node class:";
|
||||||
bNodeType *nt, dummynt;
|
bNodeType *nt, dummynt;
|
||||||
bNode dummynode;
|
bNode dummynode;
|
||||||
PointerRNA dummyptr;
|
PointerRNA dummyptr;
|
||||||
|
@ -1938,7 +1952,8 @@ static bNodeType *rna_Node_register_base(Main *bmain,
|
||||||
if (strlen(identifier) >= sizeof(dummynt.idname)) {
|
if (strlen(identifier) >= sizeof(dummynt.idname)) {
|
||||||
BKE_reportf(reports,
|
BKE_reportf(reports,
|
||||||
RPT_ERROR,
|
RPT_ERROR,
|
||||||
"Registering node class: '%s' is too long, maximum length is %d",
|
"%s '%s' is too long, maximum length is %d",
|
||||||
|
error_prefix,
|
||||||
identifier,
|
identifier,
|
||||||
(int)sizeof(dummynt.idname));
|
(int)sizeof(dummynt.idname));
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1947,7 +1962,16 @@ static bNodeType *rna_Node_register_base(Main *bmain,
|
||||||
/* check if we have registered this node type before, and remove it */
|
/* check if we have registered this node type before, and remove it */
|
||||||
nt = nodeTypeFind(dummynt.idname);
|
nt = nodeTypeFind(dummynt.idname);
|
||||||
if (nt) {
|
if (nt) {
|
||||||
rna_Node_unregister(bmain, nt->rna_ext.srna);
|
/* NOTE: unlike most types `nt->rna_ext.srna` doesn't need to be checked for NULL. */
|
||||||
|
if (!rna_Node_unregister(bmain, nt->rna_ext.srna)) {
|
||||||
|
BKE_reportf(reports,
|
||||||
|
RPT_ERROR,
|
||||||
|
"%s '%s', bl_idname '%s' could not be unregistered",
|
||||||
|
error_prefix,
|
||||||
|
identifier,
|
||||||
|
dummynt.idname);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create a new node type */
|
/* create a new node type */
|
||||||
|
@ -2725,11 +2749,11 @@ static void rna_NodeSocket_draw_color(bContext *C,
|
||||||
RNA_parameter_list_free(&list);
|
RNA_parameter_list_free(&list);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_NodeSocket_unregister(Main *UNUSED(bmain), StructRNA *type)
|
static bool rna_NodeSocket_unregister(Main *UNUSED(bmain), StructRNA *type)
|
||||||
{
|
{
|
||||||
bNodeSocketType *st = RNA_struct_blender_type_get(type);
|
bNodeSocketType *st = RNA_struct_blender_type_get(type);
|
||||||
if (!st) {
|
if (!st) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RNA_struct_free_extension(type, &st->ext_socket);
|
RNA_struct_free_extension(type, &st->ext_socket);
|
||||||
|
@ -2739,6 +2763,7 @@ static void rna_NodeSocket_unregister(Main *UNUSED(bmain), StructRNA *type)
|
||||||
|
|
||||||
/* update while blender is running */
|
/* update while blender is running */
|
||||||
WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
|
WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static StructRNA *rna_NodeSocket_register(Main *UNUSED(bmain),
|
static StructRNA *rna_NodeSocket_register(Main *UNUSED(bmain),
|
||||||
|
@ -3018,11 +3043,11 @@ static void rna_NodeSocketInterface_from_socket(bNodeTree *ntree,
|
||||||
RNA_parameter_list_free(&list);
|
RNA_parameter_list_free(&list);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_NodeSocketInterface_unregister(Main *UNUSED(bmain), StructRNA *type)
|
static bool rna_NodeSocketInterface_unregister(Main *UNUSED(bmain), StructRNA *type)
|
||||||
{
|
{
|
||||||
bNodeSocketType *st = RNA_struct_blender_type_get(type);
|
bNodeSocketType *st = RNA_struct_blender_type_get(type);
|
||||||
if (!st) {
|
if (!st) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RNA_struct_free_extension(type, &st->ext_interface);
|
RNA_struct_free_extension(type, &st->ext_interface);
|
||||||
|
@ -3031,6 +3056,7 @@ static void rna_NodeSocketInterface_unregister(Main *UNUSED(bmain), StructRNA *t
|
||||||
|
|
||||||
/* update while blender is running */
|
/* update while blender is running */
|
||||||
WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
|
WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static StructRNA *rna_NodeSocketInterface_register(Main *UNUSED(bmain),
|
static StructRNA *rna_NodeSocketInterface_register(Main *UNUSED(bmain),
|
||||||
|
|
|
@ -307,12 +307,12 @@ static void engine_update_render_passes(RenderEngine *engine,
|
||||||
|
|
||||||
/* RenderEngine registration */
|
/* RenderEngine registration */
|
||||||
|
|
||||||
static void rna_RenderEngine_unregister(Main *bmain, StructRNA *type)
|
static bool rna_RenderEngine_unregister(Main *bmain, StructRNA *type)
|
||||||
{
|
{
|
||||||
RenderEngineType *et = RNA_struct_blender_type_get(type);
|
RenderEngineType *et = RNA_struct_blender_type_get(type);
|
||||||
|
|
||||||
if (!et) {
|
if (!et) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Stop all renders in case we were using this one. */
|
/* Stop all renders in case we were using this one. */
|
||||||
|
@ -322,6 +322,7 @@ static void rna_RenderEngine_unregister(Main *bmain, StructRNA *type)
|
||||||
RNA_struct_free_extension(type, &et->rna_ext);
|
RNA_struct_free_extension(type, &et->rna_ext);
|
||||||
RNA_struct_free(&BLENDER_RNA, type);
|
RNA_struct_free(&BLENDER_RNA, type);
|
||||||
BLI_freelinkN(&R_engines, et);
|
BLI_freelinkN(&R_engines, et);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static StructRNA *rna_RenderEngine_register(Main *bmain,
|
static StructRNA *rna_RenderEngine_register(Main *bmain,
|
||||||
|
@ -332,6 +333,7 @@ static StructRNA *rna_RenderEngine_register(Main *bmain,
|
||||||
StructCallbackFunc call,
|
StructCallbackFunc call,
|
||||||
StructFreeFunc free)
|
StructFreeFunc free)
|
||||||
{
|
{
|
||||||
|
const char *error_prefix = "Registering render engine class:";
|
||||||
RenderEngineType *et, dummyet = {NULL};
|
RenderEngineType *et, dummyet = {NULL};
|
||||||
RenderEngine dummyengine = {NULL};
|
RenderEngine dummyengine = {NULL};
|
||||||
PointerRNA dummyptr;
|
PointerRNA dummyptr;
|
||||||
|
@ -350,19 +352,26 @@ static StructRNA *rna_RenderEngine_register(Main *bmain,
|
||||||
if (strlen(identifier) >= sizeof(dummyet.idname)) {
|
if (strlen(identifier) >= sizeof(dummyet.idname)) {
|
||||||
BKE_reportf(reports,
|
BKE_reportf(reports,
|
||||||
RPT_ERROR,
|
RPT_ERROR,
|
||||||
"Registering render engine class: '%s' is too long, maximum length is %d",
|
"%s '%s' is too long, maximum length is %d",
|
||||||
|
error_prefix,
|
||||||
identifier,
|
identifier,
|
||||||
(int)sizeof(dummyet.idname));
|
(int)sizeof(dummyet.idname));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check if we have registered this engine type before, and remove it */
|
/* Check if we have registered this engine type before, and remove it. */
|
||||||
for (et = R_engines.first; et; et = et->next) {
|
et = BLI_findstring(&R_engines, dummyet.idname, offsetof(RenderEngineType, idname));
|
||||||
if (STREQ(et->idname, dummyet.idname)) {
|
if (et) {
|
||||||
if (et->rna_ext.srna) {
|
StructRNA *srna = et->rna_ext.srna;
|
||||||
rna_RenderEngine_unregister(bmain, et->rna_ext.srna);
|
if (!(srna && rna_RenderEngine_unregister(bmain, srna))) {
|
||||||
}
|
BKE_reportf(reports,
|
||||||
break;
|
RPT_ERROR,
|
||||||
|
"%s '%s', bl_idname '%s' %s",
|
||||||
|
error_prefix,
|
||||||
|
identifier,
|
||||||
|
dummyet.idname,
|
||||||
|
srna ? "is built-in" : "could not be unregistered");
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -178,16 +178,16 @@ static void panel_type_clear_recursive(Panel *panel, const PanelType *type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_Panel_unregister(Main *bmain, StructRNA *type)
|
static bool rna_Panel_unregister(Main *bmain, StructRNA *type)
|
||||||
{
|
{
|
||||||
ARegionType *art;
|
ARegionType *art;
|
||||||
PanelType *pt = RNA_struct_blender_type_get(type);
|
PanelType *pt = RNA_struct_blender_type_get(type);
|
||||||
|
|
||||||
if (!pt) {
|
if (!pt) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
if (!(art = region_type_find(NULL, pt->space_type, pt->region_type))) {
|
if (!(art = region_type_find(NULL, pt->space_type, pt->region_type))) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RNA_struct_free_extension(type, &pt->rna_ext);
|
RNA_struct_free_extension(type, &pt->rna_ext);
|
||||||
|
@ -232,6 +232,7 @@ static void rna_Panel_unregister(Main *bmain, StructRNA *type)
|
||||||
|
|
||||||
/* update while blender is running */
|
/* update while blender is running */
|
||||||
WM_main_add_notifier(NC_WINDOW, NULL);
|
WM_main_add_notifier(NC_WINDOW, NULL);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static StructRNA *rna_Panel_register(Main *bmain,
|
static StructRNA *rna_Panel_register(Main *bmain,
|
||||||
|
@ -242,6 +243,7 @@ static StructRNA *rna_Panel_register(Main *bmain,
|
||||||
StructCallbackFunc call,
|
StructCallbackFunc call,
|
||||||
StructFreeFunc free)
|
StructFreeFunc free)
|
||||||
{
|
{
|
||||||
|
const char *error_prefix = "Registering panel class:";
|
||||||
ARegionType *art;
|
ARegionType *art;
|
||||||
PanelType *pt, *parent = NULL, dummypt = {NULL};
|
PanelType *pt, *parent = NULL, dummypt = {NULL};
|
||||||
Panel dummypanel = {NULL};
|
Panel dummypanel = {NULL};
|
||||||
|
@ -268,7 +270,8 @@ static StructRNA *rna_Panel_register(Main *bmain,
|
||||||
if (strlen(identifier) >= sizeof(dummypt.idname)) {
|
if (strlen(identifier) >= sizeof(dummypt.idname)) {
|
||||||
BKE_reportf(reports,
|
BKE_reportf(reports,
|
||||||
RPT_ERROR,
|
RPT_ERROR,
|
||||||
"Registering panel class: '%s' is too long, maximum length is %d",
|
"%s '%s' is too long, maximum length is %d",
|
||||||
|
error_prefix,
|
||||||
identifier,
|
identifier,
|
||||||
(int)sizeof(dummypt.idname));
|
(int)sizeof(dummypt.idname));
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -279,8 +282,7 @@ static StructRNA *rna_Panel_register(Main *bmain,
|
||||||
/* Use a fallback, otherwise an empty value will draw the panel in every category. */
|
/* Use a fallback, otherwise an empty value will draw the panel in every category. */
|
||||||
strcpy(dummypt.category, PNL_CATEGORY_FALLBACK);
|
strcpy(dummypt.category, PNL_CATEGORY_FALLBACK);
|
||||||
# ifndef NDEBUG
|
# ifndef NDEBUG
|
||||||
printf("Registering panel class: '%s' misses category, please update the script\n",
|
printf("%s '%s' misses category, please update the script\n", error_prefix, dummypt.idname);
|
||||||
dummypt.idname);
|
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -289,7 +291,8 @@ static StructRNA *rna_Panel_register(Main *bmain,
|
||||||
if ((1 << dummypt.space_type) & WM_TOOLSYSTEM_SPACE_MASK) {
|
if ((1 << dummypt.space_type) & WM_TOOLSYSTEM_SPACE_MASK) {
|
||||||
BKE_reportf(reports,
|
BKE_reportf(reports,
|
||||||
RPT_ERROR,
|
RPT_ERROR,
|
||||||
"Registering panel class: '%s' has category '%s' ",
|
"%s '%s' has category '%s' ",
|
||||||
|
error_prefix,
|
||||||
dummypt.idname,
|
dummypt.idname,
|
||||||
dummypt.category);
|
dummypt.category);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -305,8 +308,16 @@ static StructRNA *rna_Panel_register(Main *bmain,
|
||||||
for (pt = art->paneltypes.first; pt; pt = pt->next) {
|
for (pt = art->paneltypes.first; pt; pt = pt->next) {
|
||||||
if (STREQ(pt->idname, dummypt.idname)) {
|
if (STREQ(pt->idname, dummypt.idname)) {
|
||||||
PanelType *pt_next = pt->next;
|
PanelType *pt_next = pt->next;
|
||||||
if (pt->rna_ext.srna) {
|
StructRNA *srna = pt->rna_ext.srna;
|
||||||
rna_Panel_unregister(bmain, pt->rna_ext.srna);
|
if (srna) {
|
||||||
|
if (!rna_Panel_unregister(bmain, srna)) {
|
||||||
|
BKE_reportf(reports,
|
||||||
|
RPT_ERROR,
|
||||||
|
"%s '%s', bl_idname '%s' could not be unregistered",
|
||||||
|
error_prefix,
|
||||||
|
identifier,
|
||||||
|
dummypt.idname);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
BLI_freelinkN(&art->paneltypes, pt);
|
BLI_freelinkN(&art->paneltypes, pt);
|
||||||
|
@ -339,7 +350,8 @@ static StructRNA *rna_Panel_register(Main *bmain,
|
||||||
if (dummypt.parent_id[0] && !parent) {
|
if (dummypt.parent_id[0] && !parent) {
|
||||||
BKE_reportf(reports,
|
BKE_reportf(reports,
|
||||||
RPT_ERROR,
|
RPT_ERROR,
|
||||||
"Registering panel class: parent '%s' for '%s' not found",
|
"%s parent '%s' for '%s' not found",
|
||||||
|
error_prefix,
|
||||||
dummypt.parent_id,
|
dummypt.parent_id,
|
||||||
dummypt.idname);
|
dummypt.idname);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -647,12 +659,12 @@ static void uilist_filter_items(uiList *ui_list,
|
||||||
RNA_parameter_list_free(&list);
|
RNA_parameter_list_free(&list);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_UIList_unregister(Main *bmain, StructRNA *type)
|
static bool rna_UIList_unregister(Main *bmain, StructRNA *type)
|
||||||
{
|
{
|
||||||
uiListType *ult = RNA_struct_blender_type_get(type);
|
uiListType *ult = RNA_struct_blender_type_get(type);
|
||||||
|
|
||||||
if (!ult) {
|
if (!ult) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RNA_struct_free_extension(type, &ult->rna_ext);
|
RNA_struct_free_extension(type, &ult->rna_ext);
|
||||||
|
@ -662,6 +674,7 @@ static void rna_UIList_unregister(Main *bmain, StructRNA *type)
|
||||||
|
|
||||||
/* update while blender is running */
|
/* update while blender is running */
|
||||||
WM_main_add_notifier(NC_WINDOW, NULL);
|
WM_main_add_notifier(NC_WINDOW, NULL);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static StructRNA *rna_UIList_register(Main *bmain,
|
static StructRNA *rna_UIList_register(Main *bmain,
|
||||||
|
@ -672,6 +685,7 @@ static StructRNA *rna_UIList_register(Main *bmain,
|
||||||
StructCallbackFunc call,
|
StructCallbackFunc call,
|
||||||
StructFreeFunc free)
|
StructFreeFunc free)
|
||||||
{
|
{
|
||||||
|
const char *error_prefix = "Registering uilist class:";
|
||||||
uiListType *ult, dummyult = {NULL};
|
uiListType *ult, dummyult = {NULL};
|
||||||
uiList dummyuilist = {NULL};
|
uiList dummyuilist = {NULL};
|
||||||
PointerRNA dummyul_ptr;
|
PointerRNA dummyul_ptr;
|
||||||
|
@ -690,7 +704,8 @@ static StructRNA *rna_UIList_register(Main *bmain,
|
||||||
if (strlen(identifier) >= sizeof(dummyult.idname)) {
|
if (strlen(identifier) >= sizeof(dummyult.idname)) {
|
||||||
BKE_reportf(reports,
|
BKE_reportf(reports,
|
||||||
RPT_ERROR,
|
RPT_ERROR,
|
||||||
"Registering uilist class: '%s' is too long, maximum length is %d",
|
"%s '%s' is too long, maximum length is %d",
|
||||||
|
error_prefix,
|
||||||
identifier,
|
identifier,
|
||||||
(int)sizeof(dummyult.idname));
|
(int)sizeof(dummyult.idname));
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -698,8 +713,18 @@ static StructRNA *rna_UIList_register(Main *bmain,
|
||||||
|
|
||||||
/* Check if we have registered this UI-list type before, and remove it. */
|
/* Check if we have registered this UI-list type before, and remove it. */
|
||||||
ult = WM_uilisttype_find(dummyult.idname, true);
|
ult = WM_uilisttype_find(dummyult.idname, true);
|
||||||
if (ult && ult->rna_ext.srna) {
|
if (ult) {
|
||||||
rna_UIList_unregister(bmain, ult->rna_ext.srna);
|
StructRNA *srna = ult->rna_ext.srna;
|
||||||
|
if (!(srna && rna_UIList_unregister(bmain, srna))) {
|
||||||
|
BKE_reportf(reports,
|
||||||
|
RPT_ERROR,
|
||||||
|
"%s '%s', bl_idname '%s' %s",
|
||||||
|
error_prefix,
|
||||||
|
identifier,
|
||||||
|
dummyult.idname,
|
||||||
|
srna ? "is built-in" : "could not be unregistered");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!RNA_struct_available_or_report(reports, dummyult.idname)) {
|
if (!RNA_struct_available_or_report(reports, dummyult.idname)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -757,16 +782,16 @@ static void header_draw(const bContext *C, Header *hdr)
|
||||||
RNA_parameter_list_free(&list);
|
RNA_parameter_list_free(&list);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_Header_unregister(Main *UNUSED(bmain), StructRNA *type)
|
static bool rna_Header_unregister(Main *UNUSED(bmain), StructRNA *type)
|
||||||
{
|
{
|
||||||
ARegionType *art;
|
ARegionType *art;
|
||||||
HeaderType *ht = RNA_struct_blender_type_get(type);
|
HeaderType *ht = RNA_struct_blender_type_get(type);
|
||||||
|
|
||||||
if (!ht) {
|
if (!ht) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
if (!(art = region_type_find(NULL, ht->space_type, ht->region_type))) {
|
if (!(art = region_type_find(NULL, ht->space_type, ht->region_type))) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RNA_struct_free_extension(type, &ht->rna_ext);
|
RNA_struct_free_extension(type, &ht->rna_ext);
|
||||||
|
@ -776,6 +801,7 @@ static void rna_Header_unregister(Main *UNUSED(bmain), StructRNA *type)
|
||||||
|
|
||||||
/* update while blender is running */
|
/* update while blender is running */
|
||||||
WM_main_add_notifier(NC_WINDOW, NULL);
|
WM_main_add_notifier(NC_WINDOW, NULL);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static StructRNA *rna_Header_register(Main *bmain,
|
static StructRNA *rna_Header_register(Main *bmain,
|
||||||
|
@ -786,6 +812,7 @@ static StructRNA *rna_Header_register(Main *bmain,
|
||||||
StructCallbackFunc call,
|
StructCallbackFunc call,
|
||||||
StructFreeFunc free)
|
StructFreeFunc free)
|
||||||
{
|
{
|
||||||
|
const char *error_prefix = "Registering header class:";
|
||||||
ARegionType *art;
|
ARegionType *art;
|
||||||
HeaderType *ht, dummyht = {NULL};
|
HeaderType *ht, dummyht = {NULL};
|
||||||
Header dummyheader = {NULL};
|
Header dummyheader = {NULL};
|
||||||
|
@ -805,7 +832,8 @@ static StructRNA *rna_Header_register(Main *bmain,
|
||||||
if (strlen(identifier) >= sizeof(dummyht.idname)) {
|
if (strlen(identifier) >= sizeof(dummyht.idname)) {
|
||||||
BKE_reportf(reports,
|
BKE_reportf(reports,
|
||||||
RPT_ERROR,
|
RPT_ERROR,
|
||||||
"Registering header class: '%s' is too long, maximum length is %d",
|
"%s '%s' is too long, maximum length is %d",
|
||||||
|
error_prefix,
|
||||||
identifier,
|
identifier,
|
||||||
(int)sizeof(dummyht.idname));
|
(int)sizeof(dummyht.idname));
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -816,14 +844,21 @@ static StructRNA *rna_Header_register(Main *bmain,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check if we have registered this header type before, and remove it */
|
/* check if we have registered this header type before, and remove it */
|
||||||
for (ht = art->headertypes.first; ht; ht = ht->next) {
|
ht = BLI_findstring(&art->headertypes, dummyht.idname, offsetof(HeaderType, idname));
|
||||||
if (STREQ(ht->idname, dummyht.idname)) {
|
if (ht) {
|
||||||
if (ht->rna_ext.srna) {
|
StructRNA *srna = ht->rna_ext.srna;
|
||||||
rna_Header_unregister(bmain, ht->rna_ext.srna);
|
if (!(srna && rna_Header_unregister(bmain, srna))) {
|
||||||
}
|
BKE_reportf(reports,
|
||||||
break;
|
RPT_ERROR,
|
||||||
|
"%s '%s', bl_idname '%s' %s",
|
||||||
|
error_prefix,
|
||||||
|
identifier,
|
||||||
|
dummyht.idname,
|
||||||
|
srna ? "is built-in" : "could not be unregistered");
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!RNA_struct_available_or_report(reports, dummyht.idname)) {
|
if (!RNA_struct_available_or_report(reports, dummyht.idname)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -902,12 +937,12 @@ static void menu_draw(const bContext *C, Menu *menu)
|
||||||
RNA_parameter_list_free(&list);
|
RNA_parameter_list_free(&list);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_Menu_unregister(Main *UNUSED(bmain), StructRNA *type)
|
static bool rna_Menu_unregister(Main *UNUSED(bmain), StructRNA *type)
|
||||||
{
|
{
|
||||||
MenuType *mt = RNA_struct_blender_type_get(type);
|
MenuType *mt = RNA_struct_blender_type_get(type);
|
||||||
|
|
||||||
if (!mt) {
|
if (!mt) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RNA_struct_free_extension(type, &mt->rna_ext);
|
RNA_struct_free_extension(type, &mt->rna_ext);
|
||||||
|
@ -917,6 +952,7 @@ static void rna_Menu_unregister(Main *UNUSED(bmain), StructRNA *type)
|
||||||
|
|
||||||
/* update while blender is running */
|
/* update while blender is running */
|
||||||
WM_main_add_notifier(NC_WINDOW, NULL);
|
WM_main_add_notifier(NC_WINDOW, NULL);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static StructRNA *rna_Menu_register(Main *bmain,
|
static StructRNA *rna_Menu_register(Main *bmain,
|
||||||
|
@ -927,6 +963,7 @@ static StructRNA *rna_Menu_register(Main *bmain,
|
||||||
StructCallbackFunc call,
|
StructCallbackFunc call,
|
||||||
StructFreeFunc free)
|
StructFreeFunc free)
|
||||||
{
|
{
|
||||||
|
const char *error_prefix = "Registering menu class:";
|
||||||
MenuType *mt, dummymt = {NULL};
|
MenuType *mt, dummymt = {NULL};
|
||||||
Menu dummymenu = {NULL};
|
Menu dummymenu = {NULL};
|
||||||
PointerRNA dummymtr;
|
PointerRNA dummymtr;
|
||||||
|
@ -952,7 +989,8 @@ static StructRNA *rna_Menu_register(Main *bmain,
|
||||||
if (strlen(identifier) >= sizeof(dummymt.idname)) {
|
if (strlen(identifier) >= sizeof(dummymt.idname)) {
|
||||||
BKE_reportf(reports,
|
BKE_reportf(reports,
|
||||||
RPT_ERROR,
|
RPT_ERROR,
|
||||||
"Registering menu class: '%s' is too long, maximum length is %d",
|
"%s '%s' is too long, maximum length is %d",
|
||||||
|
error_prefix,
|
||||||
identifier,
|
identifier,
|
||||||
(int)sizeof(dummymt.idname));
|
(int)sizeof(dummymt.idname));
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -960,8 +998,18 @@ static StructRNA *rna_Menu_register(Main *bmain,
|
||||||
|
|
||||||
/* check if we have registered this menu type before, and remove it */
|
/* check if we have registered this menu type before, and remove it */
|
||||||
mt = WM_menutype_find(dummymt.idname, true);
|
mt = WM_menutype_find(dummymt.idname, true);
|
||||||
if (mt && mt->rna_ext.srna) {
|
if (mt) {
|
||||||
rna_Menu_unregister(bmain, mt->rna_ext.srna);
|
StructRNA *srna = mt->rna_ext.srna;
|
||||||
|
if (!(srna && rna_Menu_unregister(bmain, srna))) {
|
||||||
|
BKE_reportf(reports,
|
||||||
|
RPT_ERROR,
|
||||||
|
"%s '%s', bl_idname '%s' %s",
|
||||||
|
error_prefix,
|
||||||
|
identifier,
|
||||||
|
dummymt.idname,
|
||||||
|
srna ? "is built-in" : "could not be unregistered");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!RNA_struct_available_or_report(reports, dummymt.idname)) {
|
if (!RNA_struct_available_or_report(reports, dummymt.idname)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -792,12 +792,12 @@ static PointerRNA rna_Addon_preferences_get(PointerRNA *ptr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_AddonPref_unregister(Main *UNUSED(bmain), StructRNA *type)
|
static bool rna_AddonPref_unregister(Main *UNUSED(bmain), StructRNA *type)
|
||||||
{
|
{
|
||||||
bAddonPrefType *apt = RNA_struct_blender_type_get(type);
|
bAddonPrefType *apt = RNA_struct_blender_type_get(type);
|
||||||
|
|
||||||
if (!apt) {
|
if (!apt) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RNA_struct_free_extension(type, &apt->rna_ext);
|
RNA_struct_free_extension(type, &apt->rna_ext);
|
||||||
|
@ -807,6 +807,7 @@ static void rna_AddonPref_unregister(Main *UNUSED(bmain), StructRNA *type)
|
||||||
|
|
||||||
/* update while blender is running */
|
/* update while blender is running */
|
||||||
WM_main_add_notifier(NC_WINDOW, NULL);
|
WM_main_add_notifier(NC_WINDOW, NULL);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static StructRNA *rna_AddonPref_register(Main *bmain,
|
static StructRNA *rna_AddonPref_register(Main *bmain,
|
||||||
|
@ -817,6 +818,7 @@ static StructRNA *rna_AddonPref_register(Main *bmain,
|
||||||
StructCallbackFunc call,
|
StructCallbackFunc call,
|
||||||
StructFreeFunc free)
|
StructFreeFunc free)
|
||||||
{
|
{
|
||||||
|
const char *error_prefix = "Registering add-on preferences class:";
|
||||||
bAddonPrefType *apt, dummy_apt = {{'\0'}};
|
bAddonPrefType *apt, dummy_apt = {{'\0'}};
|
||||||
bAddon dummy_addon = {NULL};
|
bAddon dummy_addon = {NULL};
|
||||||
PointerRNA dummy_ptr;
|
PointerRNA dummy_ptr;
|
||||||
|
@ -834,7 +836,8 @@ static StructRNA *rna_AddonPref_register(Main *bmain,
|
||||||
if (strlen(identifier) >= sizeof(dummy_apt.idname)) {
|
if (strlen(identifier) >= sizeof(dummy_apt.idname)) {
|
||||||
BKE_reportf(reports,
|
BKE_reportf(reports,
|
||||||
RPT_ERROR,
|
RPT_ERROR,
|
||||||
"Registering add-on preferences class: '%s' is too long, maximum length is %d",
|
"%s '%s' is too long, maximum length is %d",
|
||||||
|
error_prefix,
|
||||||
identifier,
|
identifier,
|
||||||
(int)sizeof(dummy_apt.idname));
|
(int)sizeof(dummy_apt.idname));
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -842,8 +845,19 @@ static StructRNA *rna_AddonPref_register(Main *bmain,
|
||||||
|
|
||||||
/* Check if we have registered this add-on preference type before, and remove it. */
|
/* Check if we have registered this add-on preference type before, and remove it. */
|
||||||
apt = BKE_addon_pref_type_find(dummy_addon.module, true);
|
apt = BKE_addon_pref_type_find(dummy_addon.module, true);
|
||||||
if (apt && apt->rna_ext.srna) {
|
if (apt) {
|
||||||
rna_AddonPref_unregister(bmain, apt->rna_ext.srna);
|
StructRNA *srna = apt->rna_ext.srna;
|
||||||
|
if (!(srna && rna_AddonPref_unregister(bmain, srna))) {
|
||||||
|
BKE_reportf(reports,
|
||||||
|
RPT_ERROR,
|
||||||
|
"%s '%s', bl_idname '%s' %s",
|
||||||
|
error_prefix,
|
||||||
|
identifier,
|
||||||
|
dummy_apt.idname,
|
||||||
|
srna ? "is built-in" : "could not be unregistered");
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create a new add-on preference type. */
|
/* Create a new add-on preference type. */
|
||||||
|
|
|
@ -1111,12 +1111,12 @@ static IDProperty **rna_wmKeyConfigPref_idprops(PointerRNA *ptr)
|
||||||
return (IDProperty **)&ptr->data;
|
return (IDProperty **)&ptr->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_wmKeyConfigPref_unregister(Main *UNUSED(bmain), StructRNA *type)
|
static bool rna_wmKeyConfigPref_unregister(Main *UNUSED(bmain), StructRNA *type)
|
||||||
{
|
{
|
||||||
wmKeyConfigPrefType_Runtime *kpt_rt = RNA_struct_blender_type_get(type);
|
wmKeyConfigPrefType_Runtime *kpt_rt = RNA_struct_blender_type_get(type);
|
||||||
|
|
||||||
if (!kpt_rt) {
|
if (!kpt_rt) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RNA_struct_free_extension(type, &kpt_rt->rna_ext);
|
RNA_struct_free_extension(type, &kpt_rt->rna_ext);
|
||||||
|
@ -1127,6 +1127,7 @@ static void rna_wmKeyConfigPref_unregister(Main *UNUSED(bmain), StructRNA *type)
|
||||||
|
|
||||||
/* update while blender is running */
|
/* update while blender is running */
|
||||||
WM_main_add_notifier(NC_WINDOW, NULL);
|
WM_main_add_notifier(NC_WINDOW, NULL);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static StructRNA *rna_wmKeyConfigPref_register(Main *bmain,
|
static StructRNA *rna_wmKeyConfigPref_register(Main *bmain,
|
||||||
|
@ -1137,6 +1138,7 @@ static StructRNA *rna_wmKeyConfigPref_register(Main *bmain,
|
||||||
StructCallbackFunc call,
|
StructCallbackFunc call,
|
||||||
StructFreeFunc free)
|
StructFreeFunc free)
|
||||||
{
|
{
|
||||||
|
const char *error_prefix = "Registering key-config preferences class:";
|
||||||
wmKeyConfigPrefType_Runtime *kpt_rt, dummy_kpt_rt = {{'\0'}};
|
wmKeyConfigPrefType_Runtime *kpt_rt, dummy_kpt_rt = {{'\0'}};
|
||||||
wmKeyConfigPref dummy_kpt = {NULL};
|
wmKeyConfigPref dummy_kpt = {NULL};
|
||||||
PointerRNA dummy_ptr;
|
PointerRNA dummy_ptr;
|
||||||
|
@ -1154,7 +1156,8 @@ static StructRNA *rna_wmKeyConfigPref_register(Main *bmain,
|
||||||
if (strlen(identifier) >= sizeof(dummy_kpt_rt.idname)) {
|
if (strlen(identifier) >= sizeof(dummy_kpt_rt.idname)) {
|
||||||
BKE_reportf(reports,
|
BKE_reportf(reports,
|
||||||
RPT_ERROR,
|
RPT_ERROR,
|
||||||
"Registering key-config preferences class: '%s' is too long, maximum length is %d",
|
"%s '%s' is too long, maximum length is %d",
|
||||||
|
error_prefix,
|
||||||
identifier,
|
identifier,
|
||||||
(int)sizeof(dummy_kpt_rt.idname));
|
(int)sizeof(dummy_kpt_rt.idname));
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1162,8 +1165,18 @@ static StructRNA *rna_wmKeyConfigPref_register(Main *bmain,
|
||||||
|
|
||||||
/* check if we have registered this keyconf-prefs type before, and remove it */
|
/* check if we have registered this keyconf-prefs type before, and remove it */
|
||||||
kpt_rt = BKE_keyconfig_pref_type_find(dummy_kpt.idname, true);
|
kpt_rt = BKE_keyconfig_pref_type_find(dummy_kpt.idname, true);
|
||||||
if (kpt_rt && kpt_rt->rna_ext.srna) {
|
if (kpt_rt) {
|
||||||
rna_wmKeyConfigPref_unregister(bmain, kpt_rt->rna_ext.srna);
|
StructRNA *srna = kpt_rt->rna_ext.srna;
|
||||||
|
if (!(srna && rna_wmKeyConfigPref_unregister(bmain, srna))) {
|
||||||
|
BKE_reportf(reports,
|
||||||
|
RPT_ERROR,
|
||||||
|
"%s '%s', bl_idname '%s' %s",
|
||||||
|
error_prefix,
|
||||||
|
identifier,
|
||||||
|
dummy_kpt.idname,
|
||||||
|
srna ? "is built-in" : "could not be unregistered");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create a new keyconf-prefs type */
|
/* create a new keyconf-prefs type */
|
||||||
|
@ -1456,7 +1469,7 @@ static char *rna_operator_description_cb(bContext *C, wmOperatorType *ot, Pointe
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_Operator_unregister(struct Main *bmain, StructRNA *type);
|
static bool rna_Operator_unregister(struct Main *bmain, StructRNA *type);
|
||||||
|
|
||||||
/* bpy_operator_wrap.c */
|
/* bpy_operator_wrap.c */
|
||||||
|
|
||||||
|
@ -1471,6 +1484,7 @@ static StructRNA *rna_Operator_register(Main *bmain,
|
||||||
StructCallbackFunc call,
|
StructCallbackFunc call,
|
||||||
StructFreeFunc free)
|
StructFreeFunc free)
|
||||||
{
|
{
|
||||||
|
const char *error_prefix = "Registering operator class:";
|
||||||
wmOperatorType dummyot = {NULL};
|
wmOperatorType dummyot = {NULL};
|
||||||
wmOperator dummyop = {NULL};
|
wmOperator dummyop = {NULL};
|
||||||
PointerRNA dummyotr;
|
PointerRNA dummyotr;
|
||||||
|
@ -1506,8 +1520,18 @@ static StructRNA *rna_Operator_register(Main *bmain,
|
||||||
/* check if we have registered this operator type before, and remove it */
|
/* check if we have registered this operator type before, and remove it */
|
||||||
{
|
{
|
||||||
wmOperatorType *ot = WM_operatortype_find(dummyot.idname, true);
|
wmOperatorType *ot = WM_operatortype_find(dummyot.idname, true);
|
||||||
if (ot && ot->rna_ext.srna) {
|
if (ot) {
|
||||||
rna_Operator_unregister(bmain, ot->rna_ext.srna);
|
StructRNA *srna = ot->rna_ext.srna;
|
||||||
|
if (!(srna && rna_Operator_unregister(bmain, srna))) {
|
||||||
|
BKE_reportf(reports,
|
||||||
|
RPT_ERROR,
|
||||||
|
"%s '%s', bl_idname '%s' %s",
|
||||||
|
error_prefix,
|
||||||
|
identifier,
|
||||||
|
dummyot.idname,
|
||||||
|
srna ? "is built-in" : "could not be unregistered");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1580,14 +1604,14 @@ static StructRNA *rna_Operator_register(Main *bmain,
|
||||||
return dummyot.rna_ext.srna;
|
return dummyot.rna_ext.srna;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_Operator_unregister(struct Main *bmain, StructRNA *type)
|
static bool rna_Operator_unregister(struct Main *bmain, StructRNA *type)
|
||||||
{
|
{
|
||||||
const char *idname;
|
const char *idname;
|
||||||
wmOperatorType *ot = RNA_struct_blender_type_get(type);
|
wmOperatorType *ot = RNA_struct_blender_type_get(type);
|
||||||
wmWindowManager *wm;
|
wmWindowManager *wm;
|
||||||
|
|
||||||
if (!ot) {
|
if (!ot) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* update while blender is running */
|
/* update while blender is running */
|
||||||
|
@ -1609,6 +1633,7 @@ static void rna_Operator_unregister(struct Main *bmain, StructRNA *type)
|
||||||
RNA_struct_free(&BLENDER_RNA, type);
|
RNA_struct_free(&BLENDER_RNA, type);
|
||||||
|
|
||||||
MEM_freeN((void *)idname);
|
MEM_freeN((void *)idname);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void **rna_Operator_instance(PointerRNA *ptr)
|
static void **rna_Operator_instance(PointerRNA *ptr)
|
||||||
|
@ -1625,6 +1650,7 @@ static StructRNA *rna_MacroOperator_register(Main *bmain,
|
||||||
StructCallbackFunc call,
|
StructCallbackFunc call,
|
||||||
StructFreeFunc free)
|
StructFreeFunc free)
|
||||||
{
|
{
|
||||||
|
const char *error_prefix = "Registering operator macro class:";
|
||||||
wmOperatorType dummyot = {NULL};
|
wmOperatorType dummyot = {NULL};
|
||||||
wmOperator dummyop = {NULL};
|
wmOperator dummyop = {NULL};
|
||||||
PointerRNA dummyotr;
|
PointerRNA dummyotr;
|
||||||
|
@ -1664,8 +1690,18 @@ static StructRNA *rna_MacroOperator_register(Main *bmain,
|
||||||
/* check if we have registered this operator type before, and remove it */
|
/* check if we have registered this operator type before, and remove it */
|
||||||
{
|
{
|
||||||
wmOperatorType *ot = WM_operatortype_find(dummyot.idname, true);
|
wmOperatorType *ot = WM_operatortype_find(dummyot.idname, true);
|
||||||
if (ot && ot->rna_ext.srna) {
|
if (ot) {
|
||||||
rna_Operator_unregister(bmain, ot->rna_ext.srna);
|
StructRNA *srna = ot->rna_ext.srna;
|
||||||
|
if (!(srna && rna_Operator_unregister(bmain, srna))) {
|
||||||
|
BKE_reportf(reports,
|
||||||
|
RPT_ERROR,
|
||||||
|
"%s '%s', bl_idname '%s' %s",
|
||||||
|
error_prefix,
|
||||||
|
identifier,
|
||||||
|
dummyot.idname,
|
||||||
|
srna ? "is built-in" : "could not be unregistered");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -415,7 +415,7 @@ static PointerRNA rna_Gizmo_group_get(PointerRNA *ptr)
|
||||||
|
|
||||||
# ifdef WITH_PYTHON
|
# ifdef WITH_PYTHON
|
||||||
|
|
||||||
static void rna_Gizmo_unregister(struct Main *bmain, StructRNA *type);
|
static bool rna_Gizmo_unregister(struct Main *bmain, StructRNA *type);
|
||||||
void BPY_RNA_gizmo_wrapper(wmGizmoType *gzgt, void *userdata);
|
void BPY_RNA_gizmo_wrapper(wmGizmoType *gzgt, void *userdata);
|
||||||
|
|
||||||
static StructRNA *rna_Gizmo_register(Main *bmain,
|
static StructRNA *rna_Gizmo_register(Main *bmain,
|
||||||
|
@ -426,6 +426,7 @@ static StructRNA *rna_Gizmo_register(Main *bmain,
|
||||||
StructCallbackFunc call,
|
StructCallbackFunc call,
|
||||||
StructFreeFunc free)
|
StructFreeFunc free)
|
||||||
{
|
{
|
||||||
|
const char *error_prefix = "Registering gizmo class:";
|
||||||
struct {
|
struct {
|
||||||
char idname[MAX_NAME];
|
char idname[MAX_NAME];
|
||||||
} temp_buffers;
|
} temp_buffers;
|
||||||
|
@ -453,7 +454,8 @@ static StructRNA *rna_Gizmo_register(Main *bmain,
|
||||||
if (strlen(identifier) >= sizeof(temp_buffers.idname)) {
|
if (strlen(identifier) >= sizeof(temp_buffers.idname)) {
|
||||||
BKE_reportf(reports,
|
BKE_reportf(reports,
|
||||||
RPT_ERROR,
|
RPT_ERROR,
|
||||||
"Registering gizmo class: '%s' is too long, maximum length is %d",
|
"%s '%s' is too long, maximum length is %d",
|
||||||
|
error_prefix,
|
||||||
identifier,
|
identifier,
|
||||||
(int)sizeof(temp_buffers.idname));
|
(int)sizeof(temp_buffers.idname));
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -462,8 +464,18 @@ static StructRNA *rna_Gizmo_register(Main *bmain,
|
||||||
/* check if we have registered this gizmo type before, and remove it */
|
/* check if we have registered this gizmo type before, and remove it */
|
||||||
{
|
{
|
||||||
const wmGizmoType *gzt = WM_gizmotype_find(dummygt.idname, true);
|
const wmGizmoType *gzt = WM_gizmotype_find(dummygt.idname, true);
|
||||||
if (gzt && gzt->rna_ext.srna) {
|
if (gzt) {
|
||||||
rna_Gizmo_unregister(bmain, gzt->rna_ext.srna);
|
StructRNA *srna = gzt->rna_ext.srna;
|
||||||
|
if (!(srna && rna_Gizmo_unregister(bmain, srna))) {
|
||||||
|
BKE_reportf(reports,
|
||||||
|
RPT_ERROR,
|
||||||
|
"%s '%s', bl_idname '%s' %s",
|
||||||
|
error_prefix,
|
||||||
|
identifier,
|
||||||
|
dummygt.idname,
|
||||||
|
srna ? "is built-in" : "could not be unregistered");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!RNA_struct_available_or_report(reports, dummygt.idname)) {
|
if (!RNA_struct_available_or_report(reports, dummygt.idname)) {
|
||||||
|
@ -507,12 +519,12 @@ static StructRNA *rna_Gizmo_register(Main *bmain,
|
||||||
return dummygt.rna_ext.srna;
|
return dummygt.rna_ext.srna;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_Gizmo_unregister(struct Main *bmain, StructRNA *type)
|
static bool rna_Gizmo_unregister(struct Main *bmain, StructRNA *type)
|
||||||
{
|
{
|
||||||
wmGizmoType *gzt = RNA_struct_blender_type_get(type);
|
wmGizmoType *gzt = RNA_struct_blender_type_get(type);
|
||||||
|
|
||||||
if (!gzt) {
|
if (!gzt) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
WM_gizmotype_remove_ptr(NULL, bmain, gzt);
|
WM_gizmotype_remove_ptr(NULL, bmain, gzt);
|
||||||
|
@ -525,6 +537,7 @@ static void rna_Gizmo_unregister(struct Main *bmain, StructRNA *type)
|
||||||
WM_gizmotype_free_ptr(gzt);
|
WM_gizmotype_free_ptr(gzt);
|
||||||
|
|
||||||
WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
|
WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void **rna_Gizmo_instance(PointerRNA *ptr)
|
static void **rna_Gizmo_instance(PointerRNA *ptr)
|
||||||
|
@ -784,7 +797,7 @@ static void rna_gizmogroup_invoke_prepare_cb(const bContext *C,
|
||||||
}
|
}
|
||||||
|
|
||||||
void BPY_RNA_gizmogroup_wrapper(wmGizmoGroupType *gzgt, void *userdata);
|
void BPY_RNA_gizmogroup_wrapper(wmGizmoGroupType *gzgt, void *userdata);
|
||||||
static void rna_GizmoGroup_unregister(struct Main *bmain, StructRNA *type);
|
static bool rna_GizmoGroup_unregister(struct Main *bmain, StructRNA *type);
|
||||||
|
|
||||||
static StructRNA *rna_GizmoGroup_register(Main *bmain,
|
static StructRNA *rna_GizmoGroup_register(Main *bmain,
|
||||||
ReportList *reports,
|
ReportList *reports,
|
||||||
|
@ -794,6 +807,7 @@ static StructRNA *rna_GizmoGroup_register(Main *bmain,
|
||||||
StructCallbackFunc call,
|
StructCallbackFunc call,
|
||||||
StructFreeFunc free)
|
StructFreeFunc free)
|
||||||
{
|
{
|
||||||
|
const char *error_prefix = "Registering gizmogroup class:";
|
||||||
struct {
|
struct {
|
||||||
char name[MAX_NAME];
|
char name[MAX_NAME];
|
||||||
char idname[MAX_NAME];
|
char idname[MAX_NAME];
|
||||||
|
@ -824,7 +838,8 @@ static StructRNA *rna_GizmoGroup_register(Main *bmain,
|
||||||
if (strlen(identifier) >= sizeof(temp_buffers.idname)) {
|
if (strlen(identifier) >= sizeof(temp_buffers.idname)) {
|
||||||
BKE_reportf(reports,
|
BKE_reportf(reports,
|
||||||
RPT_ERROR,
|
RPT_ERROR,
|
||||||
"Registering gizmogroup class: '%s' is too long, maximum length is %d",
|
"%s '%s' is too long, maximum length is %d",
|
||||||
|
error_prefix,
|
||||||
identifier,
|
identifier,
|
||||||
(int)sizeof(temp_buffers.idname));
|
(int)sizeof(temp_buffers.idname));
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -838,15 +853,25 @@ static StructRNA *rna_GizmoGroup_register(Main *bmain,
|
||||||
|
|
||||||
wmGizmoMapType *gzmap_type = WM_gizmomaptype_ensure(&wmap_params);
|
wmGizmoMapType *gzmap_type = WM_gizmomaptype_ensure(&wmap_params);
|
||||||
if (gzmap_type == NULL) {
|
if (gzmap_type == NULL) {
|
||||||
BKE_report(reports, RPT_ERROR, "Area type does not support gizmos");
|
BKE_reportf(reports, RPT_ERROR, "%s area type does not support gizmos", error_prefix);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check if we have registered this gizmogroup type before, and remove it */
|
/* check if we have registered this gizmogroup type before, and remove it */
|
||||||
{
|
{
|
||||||
wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(dummywgt.idname, true);
|
wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(dummywgt.idname, true);
|
||||||
if (gzgt && gzgt->rna_ext.srna) {
|
if (gzgt) {
|
||||||
rna_GizmoGroup_unregister(bmain, gzgt->rna_ext.srna);
|
StructRNA *srna = gzgt->rna_ext.srna;
|
||||||
|
if (!(srna && rna_GizmoGroup_unregister(bmain, srna))) {
|
||||||
|
BKE_reportf(reports,
|
||||||
|
RPT_ERROR,
|
||||||
|
"%s '%s', bl_idname '%s' %s",
|
||||||
|
error_prefix,
|
||||||
|
identifier,
|
||||||
|
dummywgt.idname,
|
||||||
|
srna ? "is built-in" : "could not be unregistered");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!RNA_struct_available_or_report(reports, dummywgt.idname)) {
|
if (!RNA_struct_available_or_report(reports, dummywgt.idname)) {
|
||||||
|
@ -906,12 +931,12 @@ static StructRNA *rna_GizmoGroup_register(Main *bmain,
|
||||||
return dummywgt.rna_ext.srna;
|
return dummywgt.rna_ext.srna;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rna_GizmoGroup_unregister(struct Main *bmain, StructRNA *type)
|
static bool rna_GizmoGroup_unregister(struct Main *bmain, StructRNA *type)
|
||||||
{
|
{
|
||||||
wmGizmoGroupType *gzgt = RNA_struct_blender_type_get(type);
|
wmGizmoGroupType *gzgt = RNA_struct_blender_type_get(type);
|
||||||
|
|
||||||
if (!gzgt) {
|
if (!gzgt) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
WM_gizmo_group_type_remove_ptr(bmain, gzgt);
|
WM_gizmo_group_type_remove_ptr(bmain, gzgt);
|
||||||
|
@ -924,6 +949,7 @@ static void rna_GizmoGroup_unregister(struct Main *bmain, StructRNA *type)
|
||||||
WM_gizmo_group_type_free_ptr(gzgt);
|
WM_gizmo_group_type_free_ptr(gzgt);
|
||||||
|
|
||||||
WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
|
WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void **rna_GizmoGroup_instance(PointerRNA *ptr)
|
static void **rna_GizmoGroup_instance(PointerRNA *ptr)
|
||||||
|
|
Loading…
Reference in New Issue