From 8b9e1707a140f04414ef64fe83069d4d03254a79 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 31 Aug 2017 13:24:32 +0200 Subject: [PATCH 1/6] Cycles: Fix typo in comment --- intern/cycles/bvh/bvh_build.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/intern/cycles/bvh/bvh_build.cpp b/intern/cycles/bvh/bvh_build.cpp index d7098806569..649ce52da05 100644 --- a/intern/cycles/bvh/bvh_build.cpp +++ b/intern/cycles/bvh/bvh_build.cpp @@ -673,7 +673,7 @@ BVHNode* BVHBuild::build_node(const BVHObjectBinning& range, int level) return create_leaf_node(range, references); } } - /* Check whether unaligned split is better than the regulat one. */ + /* Check whether unaligned split is better than the regular one. */ if(unalignedSplitSAH < splitSAH) { do_unalinged_split = true; } From 018137f76248ab85bbe2057ca5d67c55a559247b Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 31 Aug 2017 14:47:49 +0200 Subject: [PATCH 2/6] Cycles: Cleanup, indentation and trailing whitespace --- intern/cycles/kernel/kernel_light.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/intern/cycles/kernel/kernel_light.h b/intern/cycles/kernel/kernel_light.h index d03cfa92319..e481468ea18 100644 --- a/intern/cycles/kernel/kernel_light.h +++ b/intern/cycles/kernel/kernel_light.h @@ -959,7 +959,7 @@ ccl_device_forceinline void triangle_light_sample(KernelGlobals *kg, int prim, i const float3 C_ = safe_normalize(q * A + sqrtf(temp) * U); - /* Finally, select a random point along the edge of the new triangle + /* Finally, select a random point along the edge of the new triangle * That point on the spherical triangle is the sampled ray direction */ const float z = 1.0f - randv * (1.0f - dot(C_, B)); ls->D = z * B + safe_sqrtf(1.0f - z*z) * safe_normalize(C_ - dot(C_, B) * B); @@ -967,11 +967,11 @@ ccl_device_forceinline void triangle_light_sample(KernelGlobals *kg, int prim, i /* calculate intersection with the planar triangle */ ray_triangle_intersect(P, ls->D, FLT_MAX, #if defined(__KERNEL_SSE2__) && defined(__KERNEL_SSE__) - (ssef*)V, + (ssef*)V, #else - V[0], V[1], V[2], + V[0], V[1], V[2], #endif - &ls->u, &ls->v, &ls->t); + &ls->u, &ls->v, &ls->t); ls->P = P + ls->D * ls->t; /* pdf_triangles is calculated over triangle area, but we're sampling over solid angle */ From 636baa598a5698d84eca89d17c67a74092cef4d0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 31 Aug 2017 23:32:21 +1000 Subject: [PATCH 3/6] RNA: Limit which classes struct-map contains Only add subclasses of: Menu, Panel, Header, UIList, Operator This helps avoid unnecessary naming collisions, See T52599 for details --- source/blender/makesrna/RNA_types.h | 2 + source/blender/makesrna/intern/rna_ID.c | 4 -- source/blender/makesrna/intern/rna_access.c | 4 ++ .../blender/makesrna/intern/rna_animation.c | 3 -- source/blender/makesrna/intern/rna_define.c | 49 +++++++++++++------ .../makesrna/intern/rna_internal_types.h | 2 + source/blender/makesrna/intern/rna_nodetree.c | 6 --- source/blender/makesrna/intern/rna_render.c | 3 -- source/blender/makesrna/intern/rna_rna.c | 10 +++- source/blender/makesrna/intern/rna_ui.c | 5 +- source/blender/makesrna/intern/rna_userdef.c | 3 -- source/blender/makesrna/intern/rna_wm.c | 2 +- .../blender/python/intern/bpy_operator_wrap.c | 2 +- source/blender/python/intern/bpy_rna.c | 10 +--- 14 files changed, 58 insertions(+), 47 deletions(-) diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index ecd7f3211bb..e119c49401e 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -436,6 +436,8 @@ typedef enum StructFlag { STRUCT_NO_IDPROPERTIES = (1 << 6), /* Menus and Panels don't need properties */ STRUCT_NO_DATABLOCK_IDPROPERTIES = (1 << 7), /* e.g. for Operator */ STRUCT_CONTAINS_DATABLOCK_IDPROPERTIES = (1 << 8), /* for PropertyGroup which contains pointers to datablocks */ + STRUCT_PUBLIC_NAMESPACE = (1 << 9), /* Added to type-map #BlenderRNA.structs_map */ + STRUCT_PUBLIC_NAMESPACE_INHERIT = (1 << 10), /* All subtypes are added too. */ } StructFlag; typedef int (*StructValidateFunc)(struct PointerRNA *ptr, void *data, int *have_function); diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 9d7dd7f424a..a74758a4f71 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -273,10 +273,6 @@ 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 15b535625df..6f2cfbdb6bd 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -89,6 +89,7 @@ void RNA_init(void) } } } + BLI_assert(srna->flag & STRUCT_PUBLIC_NAMESPACE); BLI_ghash_insert(BLENDER_RNA.structs_map, (void *)srna->identifier, srna); BLENDER_RNA.structs_len += 1; } @@ -814,6 +815,9 @@ char *RNA_struct_name_get_alloc(PointerRNA *ptr, char *fixedbuf, int fixedlen, i return NULL; } +/** + * Use when registering structs with the #STRUCT_PUBLIC_NAMESPACE flag. + */ bool RNA_struct_available_or_report(ReportList *reports, const char *identifier) { const StructRNA *srna_exists = RNA_struct_find(identifier); diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index cc3c140c5c6..d9f673acf89 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -273,9 +273,6 @@ static StructRNA *rna_KeyingSetInfo_register(Main *bmain, ReportList *reports, v if (ksi && ksi->ext.srna) { rna_KeyingSetInfo_unregister(bmain, ksi->ext.srna); } - if (!RNA_struct_available_or_report(reports, dummyksi.idname)) { - return NULL; - } /* create a new KeyingSetInfo type */ ksi = MEM_callocN(sizeof(KeyingSetInfo), "python keying set info"); diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index cbe9684e821..2a6a3d06b15 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -142,7 +142,9 @@ static void rna_brna_structs_add(BlenderRNA *brna, StructRNA *srna) /* This exception is only needed for pre-processing. * otherwise we don't allow empty names. */ - if (srna->identifier[0] != '\0') { + if ((srna->flag & STRUCT_PUBLIC_NAMESPACE) && + (srna->identifier[0] != '\0')) + { BLI_ghash_insert(brna->structs_map, (void *)srna->identifier, srna); } } @@ -150,7 +152,7 @@ static void rna_brna_structs_add(BlenderRNA *brna, StructRNA *srna) #ifdef RNA_RUNTIME static void rna_brna_structs_remove_and_free(BlenderRNA *brna, StructRNA *srna) { - if (brna->structs_map) { + if ((srna->flag & STRUCT_PUBLIC_NAMESPACE) && brna->structs_map) { if (srna->identifier[0] != '\0') { BLI_ghash_remove(brna->structs_map, (void *)srna->identifier, NULL, NULL); } @@ -763,12 +765,19 @@ StructRNA *RNA_def_struct_ptr(BlenderRNA *brna, const char *identifier, StructRN BLI_listbase_clear(&srna->functions); srna->py_type = NULL; + srna->base = srnafrom; + if (DefRNA.preprocess) { - srna->base = srnafrom; dsfrom = rna_find_def_struct(srnafrom); } - else - srna->base = srnafrom; + else { + if (srnafrom->flag & STRUCT_PUBLIC_NAMESPACE_INHERIT) { + srna->flag |= STRUCT_PUBLIC_NAMESPACE | STRUCT_PUBLIC_NAMESPACE_INHERIT; + } + else { + srna->flag &= ~(STRUCT_PUBLIC_NAMESPACE | STRUCT_PUBLIC_NAMESPACE_INHERIT); + } + } } srna->identifier = identifier; @@ -780,6 +789,10 @@ StructRNA *RNA_def_struct_ptr(BlenderRNA *brna, const char *identifier, StructRN if (!srnafrom) srna->icon = ICON_DOT; + if (DefRNA.preprocess) { + srna->flag |= STRUCT_PUBLIC_NAMESPACE; + } + rna_brna_structs_add(brna, srna); if (DefRNA.preprocess) { @@ -1001,12 +1014,14 @@ void RNA_def_struct_identifier(BlenderRNA *brna, StructRNA *srna, const char *id } /* Operator registration may set twice, see: operator_properties_init */ - if (identifier != srna->identifier) { - if (srna->identifier[0] != '\0') { - BLI_ghash_remove(brna->structs_map, (void *)srna->identifier, NULL, NULL); - } - if (identifier[0] != '\0') { - BLI_ghash_insert(brna->structs_map, (void *)identifier, srna); + if (srna->flag & STRUCT_PUBLIC_NAMESPACE) { + if (identifier != srna->identifier) { + if (srna->identifier[0] != '\0') { + BLI_ghash_remove(brna->structs_map, (void *)srna->identifier, NULL, NULL); + } + if (identifier[0] != '\0') { + BLI_ghash_insert(brna->structs_map, (void *)identifier, srna); + } } } @@ -3316,8 +3331,10 @@ void RNA_enum_item_end(EnumPropertyItem **items, int *totitem) void RNA_def_struct_duplicate_pointers(BlenderRNA *brna, StructRNA *srna) { if (srna->identifier) { - srna->identifier = BLI_strdup(srna->identifier); - BLI_ghash_replace_key(brna->structs_map, (void *)srna->identifier); + if (srna->flag & STRUCT_PUBLIC_NAMESPACE) { + 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); @@ -3333,8 +3350,10 @@ void RNA_def_struct_free_pointers(BlenderRNA *brna, StructRNA *srna) { if (srna->flag & STRUCT_FREE_POINTERS) { if (srna->identifier) { - if (brna != NULL) { - BLI_ghash_remove(brna->structs_map, (void *)srna->identifier, NULL, NULL); + if (srna->flag & STRUCT_PUBLIC_NAMESPACE) { + if (brna != NULL) { + BLI_ghash_remove(brna->structs_map, (void *)srna->identifier, NULL, NULL); + } } MEM_freeN((void *)srna->identifier); } diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h index b52f6c78f3a..a470c807091 100644 --- a/source/blender/makesrna/intern/rna_internal_types.h +++ b/source/blender/makesrna/intern/rna_internal_types.h @@ -413,6 +413,8 @@ struct StructRNA { struct BlenderRNA { ListBase structs; + /* A map of structs: {StructRNA.identifier -> StructRNA} + * These are ensured to have unique names (with STRUCT_PUBLIC_NAMESPACE enabled). */ struct GHash *structs_map; /* Needed because types with an empty identifier aren't included in 'structs_map'. */ unsigned int structs_len; diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 1c7d7816f0f..4de91a1c57c 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -633,9 +633,6 @@ static StructRNA *rna_NodeTree_register( if (nt) { rna_NodeTree_unregister(bmain, nt->ext.srna); } - if (!RNA_struct_available_or_report(reports, dummynt.idname)) { - return NULL; - } /* create a new node tree type */ nt = MEM_callocN(sizeof(bNodeTreeType), "node tree type"); @@ -1399,9 +1396,6 @@ static bNodeType *rna_Node_register_base(Main *bmain, ReportList *reports, Struc if (nt) { rna_Node_unregister(bmain, nt->ext.srna); } - if (!RNA_struct_available_or_report(reports, dummynt.idname)) { - 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 360b8831f8c..a66c160ed1a 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -321,9 +321,6 @@ static StructRNA *rna_RenderEngine_register(Main *bmain, ReportList *reports, vo break; } } - if (!RNA_struct_available_or_report(reports, dummyet.idname)) { - return NULL; - } /* create a new engine type */ et = MEM_callocN(sizeof(RenderEngineType), "python render engine"); diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index bbd0fe2486e..b50ac7a61ef 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -983,10 +983,18 @@ static int rna_Function_use_self_type_get(PointerRNA *ptr) /* Blender RNA */ +static int rna_struct_is_publc(CollectionPropertyIterator *UNUSED(iter), void *data) +{ + StructRNA *srna = data; + + return !(srna->flag & STRUCT_PUBLIC_NAMESPACE); +} + + static void rna_BlenderRNA_structs_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { BlenderRNA *brna = ptr->data; - rna_iterator_listbase_begin(iter, &brna->structs, NULL); + rna_iterator_listbase_begin(iter, &brna->structs, rna_struct_is_publc); } /* optional, for faster lookups */ diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 84e446ef330..0e8f47e59ef 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -949,6 +949,7 @@ static void rna_def_panel(BlenderRNA *brna) RNA_def_struct_refine_func(srna, "rna_Panel_refine"); RNA_def_struct_register_funcs(srna, "rna_Panel_register", "rna_Panel_unregister", NULL); RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_DEFAULT_BPYRNA); + RNA_def_struct_flag(srna, STRUCT_PUBLIC_NAMESPACE_INHERIT); /* poll */ func = RNA_def_function(srna, "poll", NULL); @@ -1051,7 +1052,7 @@ static void rna_def_uilist(BlenderRNA *brna) RNA_def_struct_refine_func(srna, "rna_UIList_refine"); RNA_def_struct_register_funcs(srna, "rna_UIList_register", "rna_UIList_unregister", NULL); RNA_def_struct_idprops_func(srna, "rna_UIList_idprops"); - RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES); + RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES | STRUCT_PUBLIC_NAMESPACE_INHERIT); /* Registration */ prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE); @@ -1173,6 +1174,7 @@ static void rna_def_header(BlenderRNA *brna) RNA_def_struct_sdna(srna, "Header"); RNA_def_struct_refine_func(srna, "rna_Header_refine"); RNA_def_struct_register_funcs(srna, "rna_Header_register", "rna_Header_unregister", NULL); + RNA_def_struct_flag(srna, STRUCT_PUBLIC_NAMESPACE_INHERIT); /* draw */ func = RNA_def_function(srna, "draw", NULL); @@ -1220,6 +1222,7 @@ static void rna_def_menu(BlenderRNA *brna) RNA_def_struct_refine_func(srna, "rna_Menu_refine"); RNA_def_struct_register_funcs(srna, "rna_Menu_register", "rna_Menu_unregister", NULL); RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_DEFAULT_BPYRNA); + RNA_def_struct_flag(srna, STRUCT_PUBLIC_NAMESPACE_INHERIT); /* poll */ func = RNA_def_function(srna, "poll", NULL); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 3ecacd11a5c..358d790e555 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -641,9 +641,6 @@ static StructRNA *rna_AddonPref_register(Main *bmain, ReportList *reports, void 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 */ apt = MEM_mallocN(sizeof(bAddonPrefType), "addonpreftype"); diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index cb6aebddfba..678d3dd2f08 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -1546,7 +1546,7 @@ static void rna_def_operator(BlenderRNA *brna) RNA_def_struct_ui_text(srna, "Operator Properties", "Input properties of an Operator"); RNA_def_struct_refine_func(srna, "rna_OperatorProperties_refine"); RNA_def_struct_idprops_func(srna, "rna_OperatorProperties_idprops"); - RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES); + RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES | STRUCT_PUBLIC_NAMESPACE_INHERIT); } static void rna_def_macro_operator(BlenderRNA *brna) diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c index 9d57adca946..3afde45195c 100644 --- a/source/blender/python/intern/bpy_operator_wrap.c +++ b/source/blender/python/intern/bpy_operator_wrap.c @@ -53,7 +53,7 @@ static void operator_properties_init(wmOperatorType *ot) * * Note the 'no_struct_map' function is used since the actual struct name is already used by the operator. */ - RNA_def_struct_identifier_no_struct_map(ot->srna, ot->idname); + RNA_def_struct_identifier(&BLENDER_RNA, ot->srna, ot->idname); if (pyrna_deferred_register_class(ot->srna, py_class) != 0) { PyErr_Print(); /* failed to register operator props */ diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index afc082db3d5..dfd643319e5 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -6927,15 +6927,7 @@ static PyObject *pyrna_basetype_dir(BPy_BaseTypeRNA *self) RNA_PROP_BEGIN (&self->ptr, itemptr, self->prop) { StructRNA *srna = itemptr.data; - StructRNA *srna_base = RNA_struct_base(itemptr.data); - /* skip own operators, these double up [#29666] */ - if (srna_base == &RNA_Operator) { - /* do nothing */ - } - else { - /* add to python list */ - PyList_APPEND(ret, PyUnicode_FromString(RNA_struct_identifier(srna))); - } + PyList_APPEND(ret, PyUnicode_FromString(RNA_struct_identifier(srna))); } RNA_PROP_END; From 44e10a5c66c271dfcd1074b4d82d2d838ec88cae Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Thu, 31 Aug 2017 16:06:08 +0200 Subject: [PATCH 4/6] Increase max/min frame range to over a million For some specific pipelines (e.g., holographic rendering) you can easily need over a million frames (1k * 1k view angles). It seems a corner case, but there is no real reason not to allow users doing that. That said we do loose subframe precision in the highest frame range. Which can affect motionblur. The current maximum sub-frame precision we have is 16. While the previous limit of 500k frames has a precision of 32. Thanks to Campbell Barton for the help here. To be backported to 2.79 --- source/blender/makesdna/DNA_scene_types.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index de516dc0f1f..34d6aae9717 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -1934,16 +1934,18 @@ extern const char *RE_engine_id_CYCLES; /* **************** SCENE ********************* */ /* note that much higher maxframes give imprecise sub-frames, see: T46859 */ +/* Current precision is 16 for the sub-frames closer to MAXFRAME. */ + /* for general use */ -#define MAXFRAME 500000 -#define MAXFRAMEF 500000.0f +#define MAXFRAME 1048574 +#define MAXFRAMEF 1048574.0f #define MINFRAME 0 #define MINFRAMEF 0.0f /* (minimum frame number for current-frame) */ -#define MINAFRAME -500000 -#define MINAFRAMEF -500000.0f +#define MINAFRAME -1048574 +#define MINAFRAMEF -1048574.0f /* depricate this! */ #define TESTBASE(v3d, base) ( \ From 217fddcb8ebe5ee6d3e311bb757d113b517850e6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 1 Sep 2017 00:57:36 +1000 Subject: [PATCH 5/6] Cleanup: strict naming conventions --- .../startup/bl_ui/properties_data_armature.py | 6 ++--- .../bl_ui/properties_grease_pencil_common.py | 22 +++++++++---------- release/scripts/startup/bl_ui/space_image.py | 8 +++---- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_data_armature.py b/release/scripts/startup/bl_ui/properties_data_armature.py index ae52ab916f1..6a13e2ddd44 100644 --- a/release/scripts/startup/bl_ui/properties_data_armature.py +++ b/release/scripts/startup/bl_ui/properties_data_armature.py @@ -96,7 +96,7 @@ class DATA_PT_display(ArmatureButtonsPanel, Panel): col.prop(arm, "use_deform_delay", text="Delay Refresh") -class DATA_PT_bone_group_specials(Menu): +class DATA_MT_bone_group_specials(Menu): bl_label = "Bone Group Specials" def draw(self, context): @@ -130,7 +130,7 @@ class DATA_PT_bone_groups(ArmatureButtonsPanel, Panel): col.active = (ob.proxy is None) col.operator("pose.group_add", icon='ZOOMIN', text="") col.operator("pose.group_remove", icon='ZOOMOUT', text="") - col.menu("DATA_PT_bone_group_specials", icon='DOWNARROW_HLT', text="") + col.menu("DATA_MT_bone_group_specials", icon='DOWNARROW_HLT', text="") if group: col.separator() col.operator("pose.group_move", icon='TRIA_UP', text="").direction = 'UP' @@ -337,7 +337,7 @@ classes = ( DATA_PT_context_arm, DATA_PT_skeleton, DATA_PT_display, - DATA_PT_bone_group_specials, + DATA_MT_bone_group_specials, DATA_PT_bone_groups, DATA_PT_pose_library, DATA_PT_ghost, diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py index 52835a00796..3795abff93c 100644 --- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py +++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py @@ -463,7 +463,7 @@ class GreasePencilBrushCurvesPanel: ############################### -class GPENCIL_PIE_tool_palette(Menu): +class GPENCIL_MT_pie_tool_palette(Menu): """A pie menu for quick access to Grease Pencil tools""" bl_label = "Grease Pencil Tools" @@ -487,7 +487,7 @@ class GPENCIL_PIE_tool_palette(Menu): # E - "Settings" Palette is included here too, since it needs to be in a stable position... if gpd and gpd.layers.active: col.separator() - col.operator("wm.call_menu_pie", text="Settings...", icon='SCRIPTWIN').name = "GPENCIL_PIE_settings_palette" + col.operator("wm.call_menu_pie", text="Settings...", icon='SCRIPTWIN').name = "GPENCIL_MT_pie_settings_palette" # Editing tools if gpd: @@ -525,13 +525,13 @@ class GPENCIL_PIE_tool_palette(Menu): col.operator("gpencil.delete", icon='X', text="Delete...") # SE - More Tools - pie.operator("wm.call_menu_pie", text="More...").name = "GPENCIL_PIE_tools_more" + pie.operator("wm.call_menu_pie", text="More...").name = "GPENCIL_MT_pie_tools_more" else: # Toggle Edit Mode pie.operator("gpencil.editmode_toggle", text="Enable Stroke Editing", icon='EDIT') -class GPENCIL_PIE_settings_palette(Menu): +class GPENCIL_MT_pie_settings_palette(Menu): """A pie menu for quick access to Grease Pencil settings""" bl_label = "Grease Pencil Settings" @@ -614,7 +614,7 @@ class GPENCIL_PIE_settings_palette(Menu): col.prop(gpd, "show_stroke_direction", text="Show drawing direction") -class GPENCIL_PIE_tools_more(Menu): +class GPENCIL_MT_pie_tools_more(Menu): """A pie menu for accessing more Grease Pencil tools""" bl_label = "More Grease Pencil Tools" @@ -643,10 +643,10 @@ class GPENCIL_PIE_tools_more(Menu): pie.operator("transform.tosphere", icon='MOD_MULTIRES') pie.operator("gpencil.convert", icon='OUTLINER_OB_CURVE', text="Convert...") - pie.operator("wm.call_menu_pie", text="Back to Main Palette...").name = "GPENCIL_PIE_tool_palette" + pie.operator("wm.call_menu_pie", text="Back to Main Palette...").name = "GPENCIL_MT_pie_tool_palette" -class GPENCIL_PIE_sculpt(Menu): +class GPENCIL_MT_pie_sculpt(Menu): """A pie menu for accessing Grease Pencil stroke sculpting settings""" bl_label = "Grease Pencil Sculpt" @@ -1158,10 +1158,10 @@ class GreasePencilToolsPanel: classes = ( - GPENCIL_PIE_tool_palette, - GPENCIL_PIE_settings_palette, - GPENCIL_PIE_tools_more, - GPENCIL_PIE_sculpt, + GPENCIL_MT_pie_tool_palette, + GPENCIL_MT_pie_settings_palette, + GPENCIL_MT_pie_tools_more, + GPENCIL_MT_pie_sculpt, GPENCIL_MT_snap, GPENCIL_MT_gpencil_edit_specials, GPENCIL_UL_brush, diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index f070161f3da..340a6c807df 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -1086,7 +1086,7 @@ class IMAGE_PT_tools_paint_options(BrushButtonsPanel, Panel): col.prop(ups, "use_unified_color", text="Color") -class IMAGE_UV_sculpt_curve(Panel): +class IMAGE_PT_uv_sculpt_curve(Panel): bl_space_type = 'IMAGE_EDITOR' bl_region_type = 'TOOLS' bl_label = "UV Sculpt Curve" @@ -1117,7 +1117,7 @@ class IMAGE_UV_sculpt_curve(Panel): row.operator("brush.curve_preset", icon='NOCURVE', text="").shape = 'MAX' -class IMAGE_UV_sculpt(Panel, ImagePaintPanel): +class IMAGE_PT_uv_sculpt(Panel, ImagePaintPanel): bl_space_type = 'IMAGE_EDITOR' bl_region_type = 'TOOLS' bl_category = "Tools" @@ -1370,8 +1370,8 @@ classes = ( IMAGE_PT_tools_imagepaint_symmetry, IMAGE_PT_tools_brush_appearance, IMAGE_PT_tools_paint_options, - IMAGE_UV_sculpt, - IMAGE_UV_sculpt_curve, + IMAGE_PT_uv_sculpt, + IMAGE_PT_uv_sculpt_curve, IMAGE_PT_view_histogram, IMAGE_PT_view_waveform, IMAGE_PT_view_vectorscope, From 0bbae3f3f6593614e2056518f534c42a30a47ebd Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 1 Sep 2017 00:58:18 +1000 Subject: [PATCH 6/6] RNA: strict naming for types in bpy.types Blender scripts already do this, some addons will need updating. --- source/blender/makesrna/RNA_access.h | 1 + source/blender/makesrna/intern/rna_access.c | 40 +++++++++++++++++++++ source/blender/makesrna/intern/rna_ui.c | 12 +++++++ 3 files changed, 53 insertions(+) diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 2a1554bcb8c..f83608fa24b 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -784,6 +784,7 @@ 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); +bool RNA_struct_bl_idname_ok_or_report(struct ReportList *reports, const char *identifier, const char *sep); /* Properties * diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 6f2cfbdb6bd..09d2d91a51c 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -850,6 +850,46 @@ bool RNA_struct_available_or_report(ReportList *reports, const char *identifier) } } +bool RNA_struct_bl_idname_ok_or_report(ReportList *reports, const char *identifier, const char *sep) +{ + const int len_sep = strlen(sep); + const int len_id = strlen(identifier); + const char *p = strstr(identifier, sep); + if (p == NULL || p == identifier || p + len_sep >= identifier + len_id) { + BKE_reportf(reports, RPT_ERROR, "'%s' doesn't contain '%s' with prefix & suffix", identifier, sep); + return false; + } + + const char *c, *start, *end, *last; + start = identifier; + end = p; + last = end - 1; + for (c = start; c != end; c++) { + if (((*c >= 'A' && *c <= 'Z') || + ((c != start) && (*c >= '0' && *c <= '9')) || + ((c != start) && (c != last) && (*c == '_'))) == 0) + { + BKE_reportf(reports, RPT_ERROR, "'%s' doesn't have upper case alpha-numeric prefix", identifier); + return false; + } + } + + start = p + len_sep; + end = identifier + len_id; + last = end - 1; + for (c = start; c != end; c++) { + if (((*c >= 'A' && *c <= 'Z') || + (*c >= 'a' && *c <= 'z') || + (*c >= '0' && *c <= '9') || + ((c != start) && (c != last) && (*c == '_'))) == 0) + { + BKE_reportf(reports, RPT_ERROR, "'%s' doesn't have an alpha-numeric suffix", identifier); + return false; + } + } + return true; +} + /* Property Information */ const char *RNA_property_identifier(PropertyRNA *prop) diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 0e8f47e59ef..12af5dc8287 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -232,6 +232,9 @@ static StructRNA *rna_Panel_register(Main *bmain, ReportList *reports, void *dat if (!RNA_struct_available_or_report(reports, dummypt.idname)) { return NULL; } + if (!RNA_struct_bl_idname_ok_or_report(reports, dummypt.idname, "_PT_")) { + return NULL; + } /* create a new panel type */ pt = MEM_callocN(sizeof(PanelType), "python buttons panel"); @@ -497,6 +500,9 @@ static StructRNA *rna_UIList_register(Main *bmain, ReportList *reports, void *da if (!RNA_struct_available_or_report(reports, dummyult.idname)) { return NULL; } + if (!RNA_struct_bl_idname_ok_or_report(reports, dummyult.idname, "_UL_")) { + return NULL; + } /* create a new menu type */ ult = MEM_callocN(sizeof(uiListType) + over_alloc, "python uilist"); @@ -602,6 +608,9 @@ static StructRNA *rna_Header_register(Main *bmain, ReportList *reports, void *da if (!RNA_struct_available_or_report(reports, dummyht.idname)) { return NULL; } + if (!RNA_struct_bl_idname_ok_or_report(reports, dummyht.idname, "_HT_")) { + return NULL; + } /* create a new header type */ ht = MEM_callocN(sizeof(HeaderType), "python buttons header"); @@ -728,6 +737,9 @@ static StructRNA *rna_Menu_register(Main *bmain, ReportList *reports, void *data if (!RNA_struct_available_or_report(reports, dummymt.idname)) { return NULL; } + if (!RNA_struct_bl_idname_ok_or_report(reports, dummymt.idname, "_MT_")) { + return NULL; + } /* create a new menu type */ if (_menu_descr[0]) {