From 4d8e3b649ba8601acb17297ef5f671a097cb17b5 Mon Sep 17 00:00:00 2001 From: Antonio Vazquez Date: Tue, 22 Aug 2017 17:42:53 +0200 Subject: [PATCH 1/8] Fix T52483: Fill is incorrect for interpolated strokes The recalc flag must be enabled for new interpolated strokes. --- source/blender/editors/gpencil/gpencil_interpolate.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/gpencil/gpencil_interpolate.c b/source/blender/editors/gpencil/gpencil_interpolate.c index 59b5b41f114..4bcc9f7b811 100644 --- a/source/blender/editors/gpencil/gpencil_interpolate.c +++ b/source/blender/editors/gpencil/gpencil_interpolate.c @@ -284,7 +284,9 @@ static void gp_interpolate_set_points(bContext *C, tGPDinterpolate *tgpi) new_stroke = MEM_dupallocN(gps_from); new_stroke->points = MEM_dupallocN(gps_from->points); new_stroke->triangles = MEM_dupallocN(gps_from->triangles); - + new_stroke->tot_triangles = 0; + new_stroke->flag |= GP_STROKE_RECALC_CACHES; + if (valid) { /* if destination stroke is smaller, resize new_stroke to size of gps_to stroke */ if (gps_from->totpoints > gps_to->totpoints) { @@ -302,6 +304,7 @@ static void gp_interpolate_set_points(bContext *C, tGPDinterpolate *tgpi) new_stroke->points = MEM_recallocN(new_stroke->points, sizeof(*new_stroke->points)); new_stroke->tot_triangles = 0; new_stroke->triangles = MEM_recallocN(new_stroke->triangles, sizeof(*new_stroke->triangles)); + new_stroke->flag |= GP_STROKE_RECALC_CACHES; } /* add to strokes */ @@ -986,7 +989,9 @@ static int gpencil_interpolate_seq_exec(bContext *C, wmOperator *op) new_stroke = MEM_dupallocN(gps_from); new_stroke->points = MEM_dupallocN(gps_from->points); new_stroke->triangles = MEM_dupallocN(gps_from->triangles); - + new_stroke->tot_triangles = 0; + new_stroke->flag |= GP_STROKE_RECALC_CACHES; + /* if destination stroke is smaller, resize new_stroke to size of gps_to stroke */ if (gps_from->totpoints > gps_to->totpoints) { new_stroke->points = MEM_recallocN(new_stroke->points, sizeof(*new_stroke->points) * gps_to->totpoints); From f09dee5aed35ede00bdbaedba171ce24edf5e0b0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 23 Aug 2017 02:14:33 +1000 Subject: [PATCH 2/8] Fix error in PointerProperty argument list Regression in a7b3047 --- source/blender/python/intern/bpy_props.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index ade7bbe7452..9ef8f9aa046 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -2880,7 +2880,7 @@ PyObject *BPy_PointerProperty(PyObject *self, PyObject *args, PyObject *kw) PyObject *update_cb = NULL, *poll_cb = NULL; if (!PyArg_ParseTupleAndKeywords(args, kw, - "s#O|ssO!OOO:PointerProperty", + "s#O|ssO!OO:PointerProperty", (char **)kwlist, &id, &id_len, &type, &name, &description, &PySet_Type, &pyopts, From 980a8646d8d3b711da89794883294d6f90565f9c Mon Sep 17 00:00:00 2001 From: Thomas Beck Date: Tue, 22 Aug 2017 21:33:58 +0200 Subject: [PATCH 3/8] Fix T52466: Silence search for button_context menu type. We were showing "search for unknown menutype WM_MT_button_context" messages in terminal which were not helpful for users, so now they are disabled. To be backported to 2.79 --- source/blender/editors/interface/interface_handlers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 079b0b3a1c4..5834477cc59 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -7065,7 +7065,7 @@ static bool ui_but_menu(bContext *C, uiBut *but) } uiItemFullO(layout, "UI_OT_edittranslation_init", NULL, ICON_NONE, NULL, WM_OP_INVOKE_DEFAULT, 0); - mt = WM_menutype_find("WM_MT_button_context", false); + mt = WM_menutype_find("WM_MT_button_context", true); if (mt) { Menu menu = {NULL}; menu.layout = uiLayoutColumn(layout, false); From 8899ac1550648ea6942a581e3939aa70b00e4915 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 23 Aug 2017 12:43:05 +1000 Subject: [PATCH 4/8] GHash: BLI_ghash_reinsert_key utility function Useful when ghash keys are reallocated. --- source/blender/blenlib/BLI_ghash.h | 2 ++ source/blender/blenlib/intern/BLI_ghash.c | 34 +++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h index 26769f9fe09..b42a36a3567 100644 --- a/source/blender/blenlib/BLI_ghash.h +++ b/source/blender/blenlib/BLI_ghash.h @@ -90,6 +90,7 @@ void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfre void BLI_ghash_reserve(GHash *gh, const unsigned int nentries_reserve); void BLI_ghash_insert(GHash *gh, void *key, void *val); bool BLI_ghash_reinsert(GHash *gh, void *key, void *val, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp); +void *BLI_ghash_replace_key(GHash *gh, void *key); void *BLI_ghash_lookup(GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT; void *BLI_ghash_lookup_default(GHash *gh, const void *key, void *val_default) ATTR_WARN_UNUSED_RESULT; void **BLI_ghash_lookup_p(GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT; @@ -248,6 +249,7 @@ void BLI_gset_insert(GSet *gh, void *key); bool BLI_gset_add(GSet *gs, void *key); bool BLI_gset_ensure_p_ex(GSet *gs, const void *key, void ***r_key); bool BLI_gset_reinsert(GSet *gh, void *key, GSetKeyFreeFP keyfreefp); +void *BLI_gset_replace_key(GSet *gs, void *key); bool BLI_gset_haskey(GSet *gs, const void *key) ATTR_WARN_UNUSED_RESULT; bool BLI_gset_pop(GSet *gs, GSetIterState *state, void **r_key) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); bool BLI_gset_remove(GSet *gs, const void *key, GSetKeyFreeFP keyfreefp); diff --git a/source/blender/blenlib/intern/BLI_ghash.c b/source/blender/blenlib/intern/BLI_ghash.c index 69dee12c713..1b2a27e33d8 100644 --- a/source/blender/blenlib/intern/BLI_ghash.c +++ b/source/blender/blenlib/intern/BLI_ghash.c @@ -762,6 +762,28 @@ bool BLI_ghash_reinsert(GHash *gh, void *key, void *val, GHashKeyFreeFP keyfreef return ghash_insert_safe(gh, key, val, true, keyfreefp, valfreefp); } +/** + * Replaces the key of an item in the \a gh. + * + * Use when a key is re-allocated or it's memory location is changed. + * + * \returns The previous key or NULL if not found, the caller may free if it's needed. + */ +void *BLI_ghash_replace_key(GHash *gh, void *key) +{ + const unsigned int hash = ghash_keyhash(gh, key); + const unsigned int bucket_index = ghash_bucket_index(gh, hash); + GHashEntry *e = (GHashEntry *)ghash_lookup_entry_ex(gh, key, bucket_index); + if (e != NULL) { + void *key_prev = e->e.key; + e->e.key = key; + return key_prev; + } + else { + return NULL; + } +} + /** * Lookup the value of \a key in \a gh. * @@ -1434,6 +1456,18 @@ bool BLI_gset_reinsert(GSet *gs, void *key, GSetKeyFreeFP keyfreefp) return ghash_insert_safe_keyonly((GHash *)gs, key, true, keyfreefp); } +/** + * Replaces the key to the set if it's found. + * Matching #BLI_ghash_replace_key + * + * \returns The old key or NULL if not found. + */ +void *BLI_gset_replace_key(GSet *gs, void *key) +{ + return BLI_ghash_replace_key((GHash *)gs, key); +} + + bool BLI_gset_remove(GSet *gs, const void *key, GSetKeyFreeFP keyfreefp) { return BLI_ghash_remove((GHash *)gs, key, keyfreefp, NULL); From 4761dea573f6fa9a57150596098c17f723d3a49f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 23 Aug 2017 14:14:55 +1000 Subject: [PATCH 5/8] RNA: keep structs_map valid w/ ID duplicate & free --- source/blender/blenkernel/intern/node.c | 6 ++-- source/blender/makesrna/RNA_define.h | 4 +-- source/blender/makesrna/intern/rna_define.c | 34 +++++++++++++++------ 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 3836d154a7b..54afe76ec07 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -2235,7 +2235,7 @@ static void ntree_interface_type_create(bNodeTree *ntree) /* register a subtype of PropertyGroup */ srna = RNA_def_struct_ptr(&BLENDER_RNA, identifier, &RNA_PropertyGroup); RNA_def_struct_ui_text(srna, name, description); - RNA_def_struct_duplicate_pointers(srna); + RNA_def_struct_duplicate_pointers(&BLENDER_RNA, srna); /* associate the RNA type with the node tree */ ntree->interface_type = srna; @@ -2274,10 +2274,10 @@ StructRNA *ntreeInterfaceTypeGet(bNodeTree *ntree, int create) ntree_interface_identifier(ntree, base, identifier, sizeof(identifier), name, description); /* rename the RNA type */ - RNA_def_struct_free_pointers(srna); + RNA_def_struct_free_pointers(&BLENDER_RNA, srna); RNA_def_struct_identifier(&BLENDER_RNA, srna, identifier); RNA_def_struct_ui_text(srna, name, description); - RNA_def_struct_duplicate_pointers(srna); + RNA_def_struct_duplicate_pointers(&BLENDER_RNA, srna); } } else if (create) { diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h index b49cea0263b..42ffe774720 100644 --- a/source/blender/makesrna/RNA_define.h +++ b/source/blender/makesrna/RNA_define.h @@ -217,8 +217,8 @@ void RNA_enum_item_end(EnumPropertyItem **items, int *totitem); /* Memory management */ -void RNA_def_struct_duplicate_pointers(StructRNA *srna); -void RNA_def_struct_free_pointers(StructRNA *srna); +void RNA_def_struct_duplicate_pointers(BlenderRNA *brna, StructRNA *srna); +void RNA_def_struct_free_pointers(BlenderRNA *brna, StructRNA *srna); void RNA_def_func_duplicate_pointers(FunctionRNA *func); void RNA_def_func_free_pointers(FunctionRNA *func); void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA *prop); diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index b10a2b33317..cbe9684e821 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -156,7 +156,7 @@ static void rna_brna_structs_remove_and_free(BlenderRNA *brna, StructRNA *srna) } } - RNA_def_struct_free_pointers(srna); + RNA_def_struct_free_pointers(NULL, srna); if (srna->flag & STRUCT_RUNTIME) { rna_freelinkN(&brna->structs, srna); @@ -3313,21 +3313,37 @@ void RNA_enum_item_end(EnumPropertyItem **items, int *totitem) /* Memory management */ #ifdef RNA_RUNTIME -void RNA_def_struct_duplicate_pointers(StructRNA *srna) +void RNA_def_struct_duplicate_pointers(BlenderRNA *brna, StructRNA *srna) { - if (srna->identifier) srna->identifier = BLI_strdup(srna->identifier); - if (srna->name) srna->name = BLI_strdup(srna->name); - if (srna->description) srna->description = BLI_strdup(srna->description); + if (srna->identifier) { + srna->identifier = BLI_strdup(srna->identifier); + BLI_ghash_replace_key(brna->structs_map, (void *)srna->identifier); + } + if (srna->name) { + srna->name = BLI_strdup(srna->name); + } + if (srna->description) { + srna->description = BLI_strdup(srna->description); + } srna->flag |= STRUCT_FREE_POINTERS; } -void RNA_def_struct_free_pointers(StructRNA *srna) +void RNA_def_struct_free_pointers(BlenderRNA *brna, StructRNA *srna) { if (srna->flag & STRUCT_FREE_POINTERS) { - if (srna->identifier) MEM_freeN((void *)srna->identifier); - if (srna->name) MEM_freeN((void *)srna->name); - if (srna->description) MEM_freeN((void *)srna->description); + if (srna->identifier) { + if (brna != NULL) { + BLI_ghash_remove(brna->structs_map, (void *)srna->identifier, NULL, NULL); + } + MEM_freeN((void *)srna->identifier); + } + if (srna->name) { + MEM_freeN((void *)srna->name); + } + if (srna->description) { + MEM_freeN((void *)srna->description); + } } } From 1e60ac33949ae533857fc6a48ce5fbc2402dd060 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 23 Aug 2017 14:59:14 +1000 Subject: [PATCH 6/8] RNA: report error on struct naming collision Fixes T52463, error instead of crash. --- source/blender/makesrna/RNA_access.h | 2 ++ source/blender/makesrna/intern/rna_ID.c | 4 +++ source/blender/makesrna/intern/rna_access.c | 32 +++++++++++++++++ .../blender/makesrna/intern/rna_animation.c | 8 +++-- source/blender/makesrna/intern/rna_nodetree.c | 17 ++++++++-- source/blender/makesrna/intern/rna_render.c | 3 ++ source/blender/makesrna/intern/rna_ui.c | 18 ++++++++-- source/blender/makesrna/intern/rna_userdef.c | 9 ++--- source/blender/makesrna/intern/rna_wm.c | 34 +++++++++++-------- 9 files changed, 102 insertions(+), 25 deletions(-) diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index a1af3f98274..2a1554bcb8c 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -783,6 +783,8 @@ const struct ListBase *RNA_struct_type_functions(StructRNA *srna); char *RNA_struct_name_get_alloc(PointerRNA *ptr, char *fixedbuf, int fixedlen, int *r_len); +bool RNA_struct_available_or_report(struct ReportList *reports, const char *identifier); + /* Properties * * Access to struct properties. All this works with RNA pointers rather than diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index a74758a4f71..9d7dd7f424a 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -273,6 +273,10 @@ StructRNA *rna_PropertyGroup_register(Main *UNUSED(bmain), ReportList *reports, return NULL; } + if (!RNA_struct_available_or_report(reports, identifier)) { + return NULL; + } + return RNA_def_struct_ptr(&BLENDER_RNA, identifier, &RNA_PropertyGroup); /* XXX */ } diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 89348bb8f6c..15b535625df 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -814,6 +814,38 @@ char *RNA_struct_name_get_alloc(PointerRNA *ptr, char *fixedbuf, int fixedlen, i return NULL; } +bool RNA_struct_available_or_report(ReportList *reports, const char *identifier) +{ + const StructRNA *srna_exists = RNA_struct_find(identifier); + if (UNLIKELY(srna_exists != NULL)) { + /* Use comprehensive string construction since this is such a rare occurrence + * and information here may cut down time troubleshooting. */ + DynStr *dynstr = BLI_dynstr_new(); + BLI_dynstr_appendf(dynstr, "Type identifier '%s' is already in use: '", identifier); + BLI_dynstr_append(dynstr, srna_exists->identifier); + int i = 0; + if (srna_exists->base) { + for (const StructRNA *base = srna_exists->base; base; base = base->base) { + BLI_dynstr_append(dynstr, "("); + BLI_dynstr_append(dynstr, base->identifier); + i += 1; + } + while (i--) { + BLI_dynstr_append(dynstr, ")"); + } + } + BLI_dynstr_append(dynstr, "'."); + char *result = BLI_dynstr_get_cstring(dynstr); + BLI_dynstr_free(dynstr); + BKE_report(reports, RPT_ERROR, result); + MEM_freeN(result); + return false; + } + else { + return true; + } +} + /* Property Information */ const char *RNA_property_identifier(PropertyRNA *prop) diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index f271bccd326..b0a51fd8c73 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -270,9 +270,13 @@ static StructRNA *rna_KeyingSetInfo_register(Main *bmain, ReportList *reports, v /* check if we have registered this info before, and remove it */ ksi = ANIM_keyingset_info_find_name(dummyksi.idname); - if (ksi && ksi->ext.srna) + if (ksi && ksi->ext.srna) { rna_KeyingSetInfo_unregister(bmain, ksi->ext.srna); - + } + if (!RNA_struct_available_or_report(reports, identifier)) { + return NULL; + } + /* create a new KeyingSetInfo type */ ksi = MEM_callocN(sizeof(KeyingSetInfo), "python keying set info"); memcpy(ksi, &dummyksi, sizeof(KeyingSetInfo)); diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 00b881dabc7..f15605d0f83 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -630,9 +630,13 @@ static StructRNA *rna_NodeTree_register( /* check if we have registered this tree type before, and remove it */ nt = ntreeTypeFind(dummynt.idname); - if (nt) + if (nt) { rna_NodeTree_unregister(bmain, nt->ext.srna); - + } + if (!RNA_struct_available_or_report(reports, identifier)) { + return NULL; + } + /* create a new node tree type */ nt = MEM_callocN(sizeof(bNodeTreeType), "node tree type"); memcpy(nt, &dummynt, sizeof(dummynt)); @@ -1389,11 +1393,18 @@ static bNodeType *rna_Node_register_base(Main *bmain, ReportList *reports, Struc identifier, (int)sizeof(dummynt.idname)); return NULL; } + if (!RNA_struct_available_or_report(reports, identifier)) { + return NULL; + } /* check if we have registered this node type before, and remove it */ nt = nodeTypeFind(dummynt.idname); - if (nt) + if (nt) { rna_Node_unregister(bmain, nt->ext.srna); + } + if (!RNA_struct_available_or_report(reports, identifier)) { + return NULL; + } /* create a new node type */ nt = MEM_callocN(sizeof(bNodeType), "node type"); diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index a66c160ed1a..0c0484e633b 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -321,6 +321,9 @@ static StructRNA *rna_RenderEngine_register(Main *bmain, ReportList *reports, vo break; } } + if (!RNA_struct_available_or_report(reports, identifier)) { + return NULL; + } /* create a new engine type */ et = MEM_callocN(sizeof(RenderEngineType), "python render engine"); diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 64b41ac789f..0fc0739f860 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -229,6 +229,9 @@ static StructRNA *rna_Panel_register(Main *bmain, ReportList *reports, void *dat break; } } + if (!RNA_struct_available_or_report(reports, identifier)) { + return NULL; + } /* create a new panel type */ pt = MEM_callocN(sizeof(PanelType), "python buttons panel"); @@ -488,8 +491,12 @@ static StructRNA *rna_UIList_register(Main *bmain, ReportList *reports, void *da /* check if we have registered this uilist type before, and remove it */ ult = WM_uilisttype_find(dummyult.idname, true); - if (ult && ult->ext.srna) + if (ult && ult->ext.srna) { rna_UIList_unregister(bmain, ult->ext.srna); + } + if (!RNA_struct_available_or_report(reports, identifier)) { + return NULL; + } /* create a new menu type */ ult = MEM_callocN(sizeof(uiListType) + over_alloc, "python uilist"); @@ -592,6 +599,9 @@ static StructRNA *rna_Header_register(Main *bmain, ReportList *reports, void *da break; } } + if (!RNA_struct_available_or_report(reports, identifier)) { + return NULL; + } /* create a new header type */ ht = MEM_callocN(sizeof(HeaderType), "python buttons header"); @@ -712,8 +722,12 @@ static StructRNA *rna_Menu_register(Main *bmain, ReportList *reports, void *data /* check if we have registered this menu type before, and remove it */ mt = WM_menutype_find(dummymt.idname, true); - if (mt && mt->ext.srna) + if (mt && mt->ext.srna) { rna_Menu_unregister(bmain, mt->ext.srna); + } + if (!RNA_struct_available_or_report(reports, identifier)) { + return NULL; + } /* create a new menu type */ if (_menu_descr[0]) { diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 19a25b4df11..3ecacd11a5c 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -638,10 +638,11 @@ static StructRNA *rna_AddonPref_register(Main *bmain, ReportList *reports, void /* check if we have registered this header type before, and remove it */ apt = BKE_addon_pref_type_find(dummyaddon.module, true); - if (apt) { - if (apt->ext.srna) { - rna_AddonPref_unregister(bmain, apt->ext.srna); - } + if (apt && apt->ext.srna) { + rna_AddonPref_unregister(bmain, apt->ext.srna); + } + if (!RNA_struct_available_or_report(reports, identifier)) { + return NULL; } /* create a new header type */ diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 4aee03025f6..a7afc405048 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -1147,6 +1147,16 @@ static StructRNA *rna_Operator_register( if (validate(&dummyotr, data, have_function) != 0) return NULL; + /* check if we have registered this operator type before, and remove it */ + { + wmOperatorType *ot = WM_operatortype_find(dummyot.idname, true); + if (ot && ot->ext.srna) + rna_Operator_unregister(bmain, ot->ext.srna); + } + if (!RNA_struct_available_or_report(reports, identifier)) { + return NULL; + } + { /* convert foo.bar to FOO_OT_bar * allocate the description and the idname in 1 go */ @@ -1214,13 +1224,6 @@ static StructRNA *rna_Operator_register( } } - /* check if we have registered this operator type before, and remove it */ - { - wmOperatorType *ot = WM_operatortype_find(dummyot.idname, true); - if (ot && ot->ext.srna) - rna_Operator_unregister(bmain, ot->ext.srna); - } - /* XXX, this doubles up with the operator name [#29666] * for now just remove from dir(bpy.types) */ @@ -1323,6 +1326,16 @@ static StructRNA *rna_MacroOperator_register( return NULL; } + /* check if we have registered this operator type before, and remove it */ + { + wmOperatorType *ot = WM_operatortype_find(dummyot.idname, true); + if (ot && ot->ext.srna) + rna_Operator_unregister(bmain, ot->ext.srna); + } + if (!RNA_struct_available_or_report(reports, identifier)) { + return NULL; + } + { /* convert foo.bar to FOO_OT_bar * allocate the description and the idname in 1 go */ const uint idname_len = strlen(temp_buffers.idname) + 4; @@ -1349,13 +1362,6 @@ static StructRNA *rna_MacroOperator_register( dummyot.undo_group = ch; } - /* check if we have registered this operator type before, and remove it */ - { - wmOperatorType *ot = WM_operatortype_find(dummyot.idname, true); - if (ot && ot->ext.srna) - rna_Operator_unregister(bmain, ot->ext.srna); - } - /* XXX, this doubles up with the operator name [#29666] * for now just remove from dir(bpy.types) */ From 46b9f89f5e46109ea811ccf474acb09616e7c33b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 23 Aug 2017 15:36:39 +1000 Subject: [PATCH 7/8] Tests: fix incorrect check for hidden dir Copy-pasted mistake in tests and tools. --- build_files/cmake/cmake_consistency_check.py | 4 +--- build_files/cmake/project_info.py | 6 ++---- tests/check_deprecated.py | 6 ++---- tests/python/batch_import.py | 6 ++---- tests/python/bl_load_py_modules.py | 5 ++--- tests/python/bl_run_operators.py | 6 ++---- 6 files changed, 11 insertions(+), 22 deletions(-) diff --git a/build_files/cmake/cmake_consistency_check.py b/build_files/cmake/cmake_consistency_check.py index 3d06790758a..443657532de 100755 --- a/build_files/cmake/cmake_consistency_check.py +++ b/build_files/cmake/cmake_consistency_check.py @@ -61,10 +61,8 @@ def replace_line(f, i, text, keep_indent=True): def source_list(path, filename_check=None): for dirpath, dirnames, filenames in os.walk(path): - # skip '.git' - if dirpath.startswith("."): - continue + dirnames[:] = [d for d in dirnames if not d.startswith(".")] for filename in filenames: if filename_check is None or filename_check(filename): diff --git a/build_files/cmake/project_info.py b/build_files/cmake/project_info.py index 3ac4c4c9480..9b0905da030 100755 --- a/build_files/cmake/project_info.py +++ b/build_files/cmake/project_info.py @@ -84,10 +84,8 @@ def init(cmake_path): def source_list(path, filename_check=None): for dirpath, dirnames, filenames in os.walk(path): - - # skip '.svn' - if dirpath.startswith("."): - continue + # skip '.git' + dirnames[:] = [d for d in dirnames if not d.startswith(".")] for filename in filenames: filepath = join(dirpath, filename) diff --git a/tests/check_deprecated.py b/tests/check_deprecated.py index cf8f8e0cc35..6e07f8fdb31 100644 --- a/tests/check_deprecated.py +++ b/tests/check_deprecated.py @@ -53,10 +53,8 @@ def is_source_any(filename): def source_list(path, filename_check=None): for dirpath, dirnames, filenames in os.walk(path): - - # skip '.svn' - if dirpath.startswith("."): - continue + # skip '.git' + dirnames[:] = [d for d in dirnames if not d.startswith(".")] for filename in filenames: if filename_check is None or filename_check(filename): diff --git a/tests/python/batch_import.py b/tests/python/batch_import.py index bbe3a70327f..a6e2469349b 100644 --- a/tests/python/batch_import.py +++ b/tests/python/batch_import.py @@ -72,10 +72,8 @@ def batch_import( def file_generator(path): for dirpath, dirnames, filenames in os.walk(path): - - # skip '.svn' - if dirpath.startswith("."): - continue + # skip '.git' + dirnames[:] = [d for d in dirnames if not d.startswith(".")] for filename in filenames: if pattern_match(filename): diff --git a/tests/python/bl_load_py_modules.py b/tests/python/bl_load_py_modules.py index 2d8a908406f..39e7bd33d44 100644 --- a/tests/python/bl_load_py_modules.py +++ b/tests/python/bl_load_py_modules.py @@ -93,9 +93,8 @@ def addon_modules_sorted(): def source_list(path, filename_check=None): from os.path import join for dirpath, dirnames, filenames in os.walk(path): - # skip '.svn' - if dirpath.startswith("."): - continue + # skip '.git' + dirnames[:] = [d for d in dirnames if not d.startswith(".")] for filename in filenames: filepath = join(dirpath, filename) diff --git a/tests/python/bl_run_operators.py b/tests/python/bl_run_operators.py index 7d5f4127378..7b6b97e5ad1 100644 --- a/tests/python/bl_run_operators.py +++ b/tests/python/bl_run_operators.py @@ -100,10 +100,8 @@ def blend_list(mainpath): def file_list(path, filename_check=None): for dirpath, dirnames, filenames in os.walk(path): - - # skip '.svn' - if dirpath.startswith("."): - continue + # skip '.git' + dirnames[:] = [d for d in dirnames if not d.startswith(".")] for filename in filenames: filepath = join(dirpath, filename) From b8d77c44f112cae1e98308ff33ce055ea4fb46ff Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 23 Aug 2017 15:50:44 +1000 Subject: [PATCH 8/8] Cleanup: remove space from filenames --- ...on).py => DVD_(note_colon__this_changes_render_resolution).py} | 0 release/scripts/presets/ffmpeg/{h264 in MP4.py => h264_in_MP4.py} | 0 .../presets/ffmpeg/{h264 in Matroska.py => h264_in_Matroska.py} | 0 ...atroska for scrubbing.py => h264_in_Matroska_for_scrubbing.py} | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename release/scripts/presets/ffmpeg/{DVD (note_colon_ this changes render resolution).py => DVD_(note_colon__this_changes_render_resolution).py} (100%) rename release/scripts/presets/ffmpeg/{h264 in MP4.py => h264_in_MP4.py} (100%) rename release/scripts/presets/ffmpeg/{h264 in Matroska.py => h264_in_Matroska.py} (100%) rename release/scripts/presets/ffmpeg/{h264 in Matroska for scrubbing.py => h264_in_Matroska_for_scrubbing.py} (100%) diff --git a/release/scripts/presets/ffmpeg/DVD (note_colon_ this changes render resolution).py b/release/scripts/presets/ffmpeg/DVD_(note_colon__this_changes_render_resolution).py similarity index 100% rename from release/scripts/presets/ffmpeg/DVD (note_colon_ this changes render resolution).py rename to release/scripts/presets/ffmpeg/DVD_(note_colon__this_changes_render_resolution).py diff --git a/release/scripts/presets/ffmpeg/h264 in MP4.py b/release/scripts/presets/ffmpeg/h264_in_MP4.py similarity index 100% rename from release/scripts/presets/ffmpeg/h264 in MP4.py rename to release/scripts/presets/ffmpeg/h264_in_MP4.py diff --git a/release/scripts/presets/ffmpeg/h264 in Matroska.py b/release/scripts/presets/ffmpeg/h264_in_Matroska.py similarity index 100% rename from release/scripts/presets/ffmpeg/h264 in Matroska.py rename to release/scripts/presets/ffmpeg/h264_in_Matroska.py diff --git a/release/scripts/presets/ffmpeg/h264 in Matroska for scrubbing.py b/release/scripts/presets/ffmpeg/h264_in_Matroska_for_scrubbing.py similarity index 100% rename from release/scripts/presets/ffmpeg/h264 in Matroska for scrubbing.py rename to release/scripts/presets/ffmpeg/h264_in_Matroska_for_scrubbing.py