From 279d64def710f90579c096ae43699daf742c73a5 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 8 Sep 2011 09:46:31 +0000 Subject: [PATCH 01/11] Fix #28545: User Preferences - System Tab - Reset All To Default Values on OpenGL Lights Added default direction to light. --- source/blender/makesrna/intern/rna_userdef.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 66c4e7245c4..4bc828cdc4f 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -1959,6 +1959,7 @@ static void rna_def_userdef_solidlight(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; + static float default_dir[3] = {0.f, 1.f, 0.f}; srna= RNA_def_struct(brna, "UserSolidLight", NULL); RNA_def_struct_sdna(srna, "SolidLight"); @@ -1972,6 +1973,7 @@ static void rna_def_userdef_solidlight(BlenderRNA *brna) prop= RNA_def_property(srna, "direction", PROP_FLOAT, PROP_DIRECTION); RNA_def_property_float_sdna(prop, NULL, "vec"); RNA_def_property_array(prop, 3); + RNA_def_property_float_array_default(prop, default_dir); RNA_def_property_ui_text(prop, "Direction", "The direction that the OpenGL light is shining"); RNA_def_property_update(prop, 0, "rna_UserDef_viewport_lights_update"); From 9e9fbd371ef2a6e074dabbda84513e4591c266a3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 8 Sep 2011 09:48:41 +0000 Subject: [PATCH 02/11] correct fix for #28558 --- release/scripts/modules/bpy_types.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index ef03951108f..b3127733c1e 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -356,10 +356,7 @@ class Mesh(bpy_types.ID): @property def edge_keys(self): - return list({edge_key - for face in self.faces - for edge_key in face.edge_keys - }) + return [ed.key for ed in self.edges] class MeshEdge(StructRNA): From 49547241d607d902e1a6a76e788580303cb65653 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 8 Sep 2011 10:15:27 +0000 Subject: [PATCH 03/11] correction to docs. --- doc/python_api/rst/info_tips_and_tricks.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/python_api/rst/info_tips_and_tricks.rst b/doc/python_api/rst/info_tips_and_tricks.rst index 00766508056..bd3ed196193 100644 --- a/doc/python_api/rst/info_tips_and_tricks.rst +++ b/doc/python_api/rst/info_tips_and_tricks.rst @@ -31,6 +31,7 @@ Blenders text editor is fine for small changes and writing tests but its not ful Editing a text file externally and having the same text open in blender does work but isn't that optimal so here are 2 ways you can easily use an external file from blender. +Using the following examples you'll still need textblock in blender to execute, but reference an external file rather then including it directly. Executing External Scripts -------------------------- @@ -163,7 +164,7 @@ In the middle of a script you may want to inspect some variables, run some funct .. code-block:: python import code - code.interact(locals=locals()) + code.interact(local=locals()) If you want to access both global and local variables do this... @@ -173,14 +174,14 @@ If you want to access both global and local variables do this... import code namespace = globals().copy() namespace.update(locals()) - code.interact(locals=namespace) + code.interact(local=namespace) The next example is an equivalent single line version of the script above which is easier to paste into you're code: .. code-block:: python - __import__('code').interact(locals={k: v for ns in (globals(), locals()) for k, v in ns.items()}) + __import__('code').interact(local={k: v for ns in (globals(), locals()) for k, v in ns.items()}) `code.interact` can be added at any line in the script and will pause the script an launch an interactive interpreter in the terminal, when you're done you can quit the interpreter and the script will continue execution. From 10ad5e8770c70572b34713404419c25389750753 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Thu, 8 Sep 2011 11:08:22 +0000 Subject: [PATCH 04/11] Vertex Weight UI: * Remove check for ob.type mesh, this is done on RNA Level and not needed here * Removed unnecessary row declaration --- .../startup/bl_ui/properties_data_modifier.py | 128 +++++++++--------- 1 file changed, 63 insertions(+), 65 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index c80823b0803..7d913788054 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -740,7 +740,6 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): @staticmethod def vertex_weight_mask(layout, ob, md): layout.label(text="Influence/Mask Options:") - row = layout.row() split = layout.split(percentage=0.4) split.label(text="Global Influence:") @@ -757,9 +756,11 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): split.template_ID(md, "mask_texture", new="texture.new") if md.mask_texture: split = layout.split() + col = split.column() col.label(text="Texture Coordinates:") col.prop(md, "mask_tex_mapping", text="") + col = split.column() col.label(text="Use Channel:") col.prop(md, "mask_tex_use_channel", text="") @@ -770,88 +771,85 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): layout.prop_search(md, "mask_tex_uv_layer", ob.data, "uv_textures") def VERTEX_WEIGHT_EDIT(self, layout, ob, md): - if ob.type == 'MESH': - split = layout.split() - col = split.column() - col.label(text="Vertex Group:") - col.prop_search(md, "vertex_group", ob, "vertex_groups", text="") + split = layout.split() + col = split.column() + col.label(text="Vertex Group:") + col.prop_search(md, "vertex_group", ob, "vertex_groups", text="") - col = split.column() - col.label(text="Default Weight:") - col.prop(md, "default_weight", text="") + col = split.column() + col.label(text="Default Weight:") + col.prop(md, "default_weight", text="") - layout.prop(md, "falloff_type") - if md.falloff_type == 'CURVE': - col = layout.column() - col.template_curve_mapping(md, "map_curve") + layout.prop(md, "falloff_type") + if md.falloff_type == 'CURVE': + col = layout.column() + col.template_curve_mapping(md, "map_curve") - split = layout.split(percentage=0.4) - split.prop(md, "use_add") - row = split.row() - row.active = md.use_add - row.prop(md, "add_threshold") + split = layout.split(percentage=0.4) + split.prop(md, "use_add") + row = split.row() + row.active = md.use_add + row.prop(md, "add_threshold") - split = layout.split(percentage=0.4) - split.prop(md, "use_remove") - row = split.row() - row.active = md.use_remove - row.prop(md, "remove_threshold") + split = layout.split(percentage=0.4) + split.prop(md, "use_remove") + row = split.row() + row.active = md.use_remove + row.prop(md, "remove_threshold") - # Common mask options… - layout.separator() - self.vertex_weight_mask(layout, ob, md) + # Common mask options + layout.separator() + self.vertex_weight_mask(layout, ob, md) def VERTEX_WEIGHT_MIX(self, layout, ob, md): - if ob.type == 'MESH': - split = layout.split() - col = split.column() - col.label(text="Vertex Group A:") - col.prop_search(md, "vertex_group_a", ob, "vertex_groups", text="") - col.label(text="Default Weight A:") - col.prop(md, "default_weight_a", text="") + split = layout.split() + + col = split.column() + col.label(text="Vertex Group A:") + col.prop_search(md, "vertex_group_a", ob, "vertex_groups", text="") + col.label(text="Default Weight A:") + col.prop(md, "default_weight_a", text="") - col.label(text="Mix Mode:") - col.prop(md, "mix_mode", text="") + col.label(text="Mix Mode:") + col.prop(md, "mix_mode", text="") - col = split.column() - col.label(text="Vertex Group B:") - col.prop_search(md, "vertex_group_b", ob, "vertex_groups", text="") - col.label(text="Default Weight B:") - col.prop(md, "default_weight_b", text="") + col = split.column() + col.label(text="Vertex Group B:") + col.prop_search(md, "vertex_group_b", ob, "vertex_groups", text="") + col.label(text="Default Weight B:") + col.prop(md, "default_weight_b", text="") - col.label(text="Mix Set:") - col.prop(md, "mix_set", text="") + col.label(text="Mix Set:") + col.prop(md, "mix_set", text="") - # Common mask options… - layout.separator() - self.vertex_weight_mask(layout, ob, md) + # Common mask options + layout.separator() + self.vertex_weight_mask(layout, ob, md) def VERTEX_WEIGHT_PROXIMITY(self, layout, ob, md): - if ob.type == 'MESH': - split = layout.split() - col = split.column() - col.label(text="Vertex Group:") - col.prop_search(md, "vertex_group", ob, "vertex_groups", text="") + split = layout.split() + + col = split.column() + col.label(text="Vertex Group:") + col.prop_search(md, "vertex_group", ob, "vertex_groups", text="") - col = split.column() - col.label(text="Target Object:") - col.prop(md, "target", text="") + col = split.column() + col.label(text="Target Object:") + col.prop(md, "target", text="") - row = layout.row() - row.prop(md, "proximity_mode", expand=True) - if md.proximity_mode == 'GEOMETRY': - row = layout.row() - row.prop(md, "proximity_geometry", expand=True) + layout.row().prop(md, "proximity_mode", expand=True) + if md.proximity_mode == 'GEOMETRY': + layout.row().prop(md, "proximity_geometry", expand=True) - row = layout.split() - row.prop(md, "min_dist") - row.prop(md, "max_dist") + row = layout.row() + row.prop(md, "min_dist") + row.prop(md, "max_dist") - layout.prop(md, "falloff_type") + layout.prop(md, "falloff_type") - # Common mask options… - layout.separator() - self.vertex_weight_mask(layout, ob, md) + # Common mask options + layout.separator() + self.vertex_weight_mask(layout, ob, md) if __name__ == "__main__": # only for live edit. bpy.utils.register_module(__name__) From d6363ee8258d2d6ad42432f6f6251ff2b1f8a82f Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Thu, 8 Sep 2011 11:12:25 +0000 Subject: [PATCH 05/11] Modifier UV Project UI: * Code cleanup. --- .../startup/bl_ui/properties_data_modifier.py | 41 +++++++++---------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index 7d913788054..8d4e3f153b1 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -608,32 +608,31 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): layout.label(text="Settings can be found inside the Physics context") def UV_PROJECT(self, layout, ob, md): - if ob.type == 'MESH': - split = layout.split() + split = layout.split() - col = split.column() - col.label(text="Image:") - col.prop(md, "image", text="") + col = split.column() + col.label(text="Image:") + col.prop(md, "image", text="") - col = split.column() - col.label(text="UV Layer:") - col.prop_search(md, "uv_layer", ob.data, "uv_textures", text="") + col = split.column() + col.label(text="UV Layer:") + col.prop_search(md, "uv_layer", ob.data, "uv_textures", text="") - split = layout.split() - col = split.column() - col.prop(md, "use_image_override") - col.prop(md, "projector_count", text="Projectors") - for proj in md.projectors: - col.prop(proj, "object", text="") + split = layout.split() + col = split.column() + col.prop(md, "use_image_override") + col.prop(md, "projector_count", text="Projectors") + for proj in md.projectors: + col.prop(proj, "object", text="") - col = split.column() - sub = col.column(align=True) - sub.prop(md, "aspect_x", text="Aspect X") - sub.prop(md, "aspect_y", text="Aspect Y") + col = split.column() + sub = col.column(align=True) + sub.prop(md, "aspect_x", text="Aspect X") + sub.prop(md, "aspect_y", text="Aspect Y") - sub = col.column(align=True) - sub.prop(md, "scale_x", text="Scale X") - sub.prop(md, "scale_y", text="Scale Y") + sub = col.column(align=True) + sub.prop(md, "scale_x", text="Scale X") + sub.prop(md, "scale_y", text="Scale Y") def WARP(self, layout, ob, md): use_falloff = (md.falloff_type != 'NONE') From 41703b851dfff378fbd0bd652d4c5ded55a07743 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 8 Sep 2011 12:53:01 +0000 Subject: [PATCH 06/11] Modifiers: put uv project and vertex weight modifiers in separate category, couldn't really think of a good name for it, suggestions welcome. --- source/blender/makesrna/intern/rna_modifier.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index d5c7002e07f..07967103a40 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -68,6 +68,7 @@ EnumPropertyItem modifier_type_items[] ={ {eModifierType_Screw, "SCREW", ICON_MOD_SCREW, "Screw", ""}, {eModifierType_Solidify, "SOLIDIFY", ICON_MOD_SOLIDIFY, "Solidify", ""}, {eModifierType_Subsurf, "SUBSURF", ICON_MOD_SUBSURF, "Subdivision Surface", ""}, + {0, "", 0, "Modify", ""}, {eModifierType_UVProject, "UV_PROJECT", ICON_MOD_UVPROJECT, "UV Project", ""}, {eModifierType_WeightVGEdit, "VERTEX_WEIGHT_EDIT", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Edit", ""}, {eModifierType_WeightVGMix, "VERTEX_WEIGHT_MIX", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Mix", ""}, From ff0a452a8a49a9bcd5a3fd9f96e240425e267aa6 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 8 Sep 2011 13:22:26 +0000 Subject: [PATCH 07/11] Fix #28310: import of key configuration with modal keymap not working. --- source/blender/windowmanager/intern/wm_keymap.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index 0e94ad72d35..854fa688ea4 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -47,6 +47,7 @@ #include "BKE_blender.h" #include "BKE_context.h" #include "BKE_idprop.h" +#include "BKE_global.h" #include "BKE_library.h" #include "BKE_main.h" #include "BKE_screen.h" @@ -680,6 +681,17 @@ wmKeyMap *WM_modalkeymap_add(wmKeyConfig *keyconf, const char *idname, EnumPrope wmKeyMap *km= WM_keymap_find(keyconf, idname, 0, 0); km->flag |= KEYMAP_MODAL; km->modal_items= items; + + if(!items) { + /* init modal items from default config */ + wmWindowManager *wm = G.main->wm.first; + wmKeyMap *defaultkm= WM_keymap_list_find(&wm->defaultconf->keymaps, km->idname, 0, 0); + + if(defaultkm) { + km->modal_items = defaultkm->modal_items; + km->poll = defaultkm->poll; + } + } return km; } From 899bd19c7150cb401e90c5c844d14fe6c7757ae2 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 8 Sep 2011 19:05:52 +0000 Subject: [PATCH 08/11] Forgot to add FFmpeg DLLs list to linuxcross config. --- build_files/scons/config/linuxcross-config.py | 1 + 1 file changed, 1 insertion(+) diff --git a/build_files/scons/config/linuxcross-config.py b/build_files/scons/config/linuxcross-config.py index 1bdf735f458..8057d478c31 100644 --- a/build_files/scons/config/linuxcross-config.py +++ b/build_files/scons/config/linuxcross-config.py @@ -127,6 +127,7 @@ WITH_BF_BINRELOC = False WITH_BF_FFMPEG = True # -DWITH_FFMPEG BF_FFMPEG = LIBDIR + '/ffmpeg' BF_FFMPEG_LIB = 'avformat-53 avcodec-53 avdevice-53 avutil-51 swscale-2' +BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-53.dll ${BF_FFMPEG_LIBPATH}/avcodec-53.dll ${BF_FFMPEG_LIBPATH}/avdevice-53.dll ${BF_FFMPEG_LIBPATH}/avutil-51.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll' BF_FFMPEG_INC = '${BF_FFMPEG}/include' BF_FFMPEG_LIBPATH = '${BF_FFMPEG}/lib' BF_FFMPEG_DLL = '${BF_FFMPEG_LIBPATH}/avformat-53.dll ${BF_FFMPEG_LIBPATH}/avcodec-53.dll ${BF_FFMPEG_LIBPATH}/avdevice-53.dll ${BF_FFMPEG_LIBPATH}/avutil-51.dll ${BF_FFMPEG_LIBPATH}/swscale-2.dll' From 4eb9b9e4f1b8aec1e939bd6ca5f60728d5902448 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 8 Sep 2011 23:59:47 +0000 Subject: [PATCH 09/11] bpy api - add new page for best-practice (so Thomas has something to point to when kicking devs for writing shoddy UI layouts) --- doc/python_api/rst/info_best_practice.rst | 65 +++++++++++++++++++++++ doc/python_api/rst/info_quickstart.rst | 46 ---------------- doc/python_api/sphinx_doc_gen.py | 1 + 3 files changed, 66 insertions(+), 46 deletions(-) create mode 100644 doc/python_api/rst/info_best_practice.rst diff --git a/doc/python_api/rst/info_best_practice.rst b/doc/python_api/rst/info_best_practice.rst new file mode 100644 index 00000000000..2fbc636613c --- /dev/null +++ b/doc/python_api/rst/info_best_practice.rst @@ -0,0 +1,65 @@ +************* +Best Practice +************* + + +TODO: Intro text + + +Style Conventions +================= + +For Blender 2.5 we have chosen to follow python suggested style guide to avoid mixing styles amongst our own scripts and make it easier to use python scripts from other projects. + +Using our style guide for your own scripts makes it easier if you eventually want to contribute them to blender. + +This style guide is known as pep8 and can be found `here `_ + +A brief listing of pep8 criteria. + +* camel caps for class names: MyClass + +* all lower case underscore separated module names: my_module + +* indentation of 4 spaces (no tabs) + +* spaces around operators. ``1 + 1``, not ``1+1`` + +* only use explicit imports, (no importing '*') + +* don't use single line: ``if val: body``, separate onto 2 lines instead. + + +As well as pep8 we have other conventions used for blender python scripts. + +* Use single quotes for enums, and double quotes for strings. + + Both are of course strings but in our internal API enums are unique items from a limited set. eg. + + .. code-block:: python + + bpy.context.scene.render.file_format = 'PNG' + bpy.context.scene.render.filepath = "//render_out" + +* pep8 also defines that lines should not exceed 79 characters, we felt this is too restrictive so this is optional per script. + +Periodically we run checks for pep8 compliance on blender scripts, for scripts to be included in this check add this line as a comment at the top of the script. + +``# `` + +To enable line length checks use this instead. + +``# `` + + +User Interface Layout +===================== + +TODO: Thomas + + +Script Efficiency +================= + +TODO: Campbell + diff --git a/doc/python_api/rst/info_quickstart.rst b/doc/python_api/rst/info_quickstart.rst index 751e5e1ec61..e7f2900b212 100644 --- a/doc/python_api/rst/info_quickstart.rst +++ b/doc/python_api/rst/info_quickstart.rst @@ -420,49 +420,3 @@ Using Low-Level Functions: fcu_z.keyframe_points[0].co = 10.0, 0.0 fcu_z.keyframe_points[1].co = 20.0, 1.0 - -Style Conventions -================= - -For Blender 2.5 we have chosen to follow python suggested style guide to avoid mixing styles amongst our own scripts and make it easier to use python scripts from other projects. - -Using our style guide for your own scripts makes it easier if you eventually want to contribute them to blender. - -This style guide is known as pep8 and can be found `here `_ - -A brief listing of pep8 criteria. - -* camel caps for class names: MyClass - -* all lower case underscore separated module names: my_module - -* indentation of 4 spaces (no tabs) - -* spaces around operators. ``1 + 1``, not ``1+1`` - -* only use explicit imports, (no importing '*') - -* don't use single line: ``if val: body``, separate onto 2 lines instead. - - -As well as pep8 we have other conventions used for blender python scripts. - -* Use single quotes for enums, and double quotes for strings. - - Both are of course strings but in our internal API enums are unique items from a limited set. eg. - - .. code-block:: python - - bpy.context.scene.render.file_format = 'PNG' - bpy.context.scene.render.filepath = "//render_out" - -* pep8 also defines that lines should not exceed 79 characters, we felt this is too restrictive so this is optional per script. - -Periodically we run checks for pep8 compliance on blender scripts, for scripts to be included in this check add this line as a comment at the top of the script. - -``# `` - -To enable line length checks use this instead. - -``# `` - diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index a7657fad432..ac2a498efc2 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -103,6 +103,7 @@ sphinx-build doc/python_api/sphinx-in doc/python_api/sphinx-out INFO_DOCS = ( ("info_quickstart.rst", "Blender/Python Quickstart: new to blender/scripting and want to get you're feet wet?"), ("info_overview.rst", "Blender/Python API Overview: a more complete explanation of python integration"), + ("info_best_practice.rst", "Best Practice: Conventions to follow for writing good scripts"), ("info_tips_and_tricks.rst", "Tips and Tricks: Hints to help you while writeing scripts for blender"), ("info_gotcha.rst", "Gotcha's: some of the problems you may come up against when writing scripts"), ) From ae7401751c126dfd0373d6f16b71d0311c1c2ea2 Mon Sep 17 00:00:00 2001 From: "Guillermo S. Romero" Date: Fri, 9 Sep 2011 00:46:00 +0000 Subject: [PATCH 10/11] SVN maintenance. --- source/blender/makesdna/DNA_modifier_types.h | 4 ++-- source/blender/modifiers/intern/MOD_weightvg_util.c | 2 +- source/blender/modifiers/intern/MOD_weightvg_util.h | 4 ++-- source/blender/modifiers/intern/MOD_weightvgedit.c | 10 +++++----- source/blender/modifiers/intern/MOD_weightvgmix.c | 12 ++++++------ .../blender/modifiers/intern/MOD_weightvgproximity.c | 10 +++++----- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 32a78cb823a..d09e56a5708 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -818,7 +818,7 @@ typedef struct WeightVGEditModifierData { int mask_tex_mapping; char mask_tex_uvlayer_name[32]; /* Name of the UV layer. */ - /* Padding… */ + /* Padding... */ int pad_i1; } WeightVGEditModifierData; @@ -863,7 +863,7 @@ typedef struct WeightVGMixModifierData { int mask_tex_mapping; /* How to map the texture! */ char mask_tex_uvlayer_name[32]; /* Name of the UV layer. */ - /* Padding… */ + /* Padding... */ int pad_i1; } WeightVGMixModifierData; diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.c b/source/blender/modifiers/intern/MOD_weightvg_util.c index 51465cc80b0..98615c70553 100644 --- a/source/blender/modifiers/intern/MOD_weightvg_util.c +++ b/source/blender/modifiers/intern/MOD_weightvg_util.c @@ -135,7 +135,7 @@ void weightvg_do_mask(int num, const int *indices, float *org_w, const float *ne MappingInfoModifierData t_map; float (*v_co)[3]; - /* Use new generic get_texture_coords, but do not modify our DNA struct for it… + /* Use new generic get_texture_coords, but do not modify our DNA struct for it... * XXX Why use a ModifierData stuff here ? Why not a simple, generic struct for parameters ? * What e.g. if a modifier wants to use several textures ? * Why use only v_co, and not MVert (or both) ? diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.h b/source/blender/modifiers/intern/MOD_weightvg_util.h index 00c63a3d5d5..ce3520f1900 100644 --- a/source/blender/modifiers/intern/MOD_weightvg_util.h +++ b/source/blender/modifiers/intern/MOD_weightvg_util.h @@ -44,7 +44,7 @@ struct Tex; /* * XXX I'd like to make modified weights visible in WeightPaint mode, - * but couldn't figure a way to do this… + * but couldn't figure a way to do this... * Maybe this will need changes in mesh_calc_modifiers (DerivedMesh.c)? * Or the WeightPaint mode code itself? */ @@ -53,7 +53,7 @@ struct Tex; * Util functions. * **************************************/ -/* We cannot divide by zero (what a surprise…). +/* We cannot divide by zero (what a surprise...). * So if -MOD_WEIGHTVGROUP_DIVMODE_ZEROFLOOR < weightf < MOD_WEIGHTVGROUP_DIVMODE_ZEROFLOOR, * we clamp weightf to this value (or its negative version). * Also used to avoid null power factor. diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c index 0b6b69b2b3c..fb6d4dc10e6 100644 --- a/source/blender/modifiers/intern/MOD_weightvgedit.c +++ b/source/blender/modifiers/intern/MOD_weightvgedit.c @@ -28,7 +28,7 @@ /* * XXX I'd like to make modified weights visible in WeightPaint mode, - * but couldn't figure a way to do this… + * but couldn't figure a way to do this... * Maybe this will need changes in mesh_calc_modifiers (DerivedMesh.c)? * Or the WeightPaint mode code itself? */ @@ -211,13 +211,13 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der if (defgrp_idx < 0) return dm; - /* XXX All this to avoid copying dm when not needed… However, it nearly doubles compute - * time! See scene 5 of the WeighVG test file… + /* XXX All this to avoid copying dm when not needed... However, it nearly doubles compute + * time! See scene 5 of the WeighVG test file... */ #if 0 /* Get actual dverts (ie vertex group data). */ dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT); - /* If no dverts, return unmodified data… */ + /* If no dverts, return unmodified data... */ if (dvert == NULL) return dm; @@ -231,7 +231,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der /* Create a copy of our dmesh, only if our affected cdata layer is the same as org mesh. */ if (dvert == CustomData_get_layer(&ob_m->vdata, CD_MDEFORMVERT)) { /* XXX Seems to create problems with weightpaint mode??? - * I'm missing something here, I guess… + * I'm missing something here, I guess... */ // DM_set_only_copy(dm, CD_MASK_MDEFORMVERT); /* Only copy defgroup layer. */ ret = CDDM_copy(dm); diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c index 8bfc56fc18f..f1422a342eb 100644 --- a/source/blender/modifiers/intern/MOD_weightvgmix.c +++ b/source/blender/modifiers/intern/MOD_weightvgmix.c @@ -28,7 +28,7 @@ /* * XXX I'd like to make modified weights visible in WeightPaint mode, - * but couldn't figure a way to do this… + * but couldn't figure a way to do this... * Maybe this will need changes in mesh_calc_modifiers (DerivedMesh.c)? * Or the WeightPaint mode code itself? */ @@ -62,7 +62,7 @@ static float mix_weight(float weight, float weight2, char mix_mode) #if 0 /* * XXX Don't know why, but the switch version takes many CPU time, - * and produces lag in realtime playback… + * and produces lag in realtime playback... */ switch (mix_mode) { @@ -258,13 +258,13 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der return dm; } - /* XXX All this to avoid copying dm when not needed… However, it nearly doubles compute - * time! See scene 5 of the WeighVG test file… + /* XXX All this to avoid copying dm when not needed... However, it nearly doubles compute + * time! See scene 5 of the WeighVG test file... */ #if 0 /* Get actual dverts (ie vertex group data). */ dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT); - /* If no dverts, return unmodified data… */ + /* If no dverts, return unmodified data... */ if (dvert == NULL) return dm; @@ -278,7 +278,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der /* Create a copy of our dmesh, only if our affected cdata layer is the same as org mesh. */ if (dvert == CustomData_get_layer(&ob_m->vdata, CD_MDEFORMVERT)) { /* XXX Seems to create problems with weightpaint mode??? - * I'm missing something here, I guess… + * I'm missing something here, I guess... */ // DM_set_only_copy(dm, CD_MASK_MDEFORMVERT); /* Only copy defgroup layer. */ ret = CDDM_copy(dm); diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c index 0dbf8a91d21..af3f71d6099 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.c +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c @@ -28,7 +28,7 @@ /* * XXX I'd like to make modified weights visible in WeightPaint mode, - * but couldn't figure a way to do this… + * but couldn't figure a way to do this... * Maybe this will need changes in mesh_calc_modifiers (DerivedMesh.c)? * Or the WeightPaint mode code itself? */ @@ -385,13 +385,13 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der if (defgrp_idx < 0) return dm; - /* XXX All this to avoid copying dm when not needed… However, it nearly doubles compute - * time! See scene 5 of the WeighVG test file… + /* XXX All this to avoid copying dm when not needed... However, it nearly doubles compute + * time! See scene 5 of the WeighVG test file... */ #if 0 /* Get actual dverts (ie vertex group data). */ dvert = dm->getVertDataArray(dm, CD_MDEFORMVERT); - /* If no dverts, return unmodified data… */ + /* If no dverts, return unmodified data... */ if (dvert == NULL) return dm; @@ -405,7 +405,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der /* Create a copy of our dmesh, only if our affected cdata layer is the same as org mesh. */ if (dvert == CustomData_get_layer(&ob_m->vdata, CD_MDEFORMVERT)) { /* XXX Seems to create problems with weightpaint mode??? - * I'm missing something here, I guess… + * I'm missing something here, I guess... */ // DM_set_only_copy(dm, CD_MASK_MDEFORMVERT); /* Only copy defgroup layer. */ ret = CDDM_copy(dm); From a59ba9a519c076aad17e00442e3fc0ad6bf26284 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 9 Sep 2011 01:29:53 +0000 Subject: [PATCH 11/11] - turn RNA_warning into a macro which includes the function name (was being written in manually but had incorrect func names in places). - add __func__ define to BLI_utildefines.h for MSVC. --- source/blender/blenlib/BLI_utildefines.h | 6 +++ .../editors/interface/interface_layout.c | 38 ++++++++--------- .../editors/interface/interface_templates.c | 42 ++++++++++--------- source/blender/makesrna/RNA_access.h | 6 ++- source/blender/makesrna/intern/rna_access.c | 3 +- source/blender/makesrna/intern/rna_ui_api.c | 2 +- source/blender/python/intern/bpy_rna.c | 24 +++++------ 7 files changed, 67 insertions(+), 54 deletions(-) diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index 1a1f7be2471..9a3b81e5776 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -176,6 +176,12 @@ /* useful for debugging */ #define AT __FILE__ ":" STRINGIFY(__LINE__) +/* so we can use __func__ everywhere */ +#if defined(_MSC_VER) +# define __func__ __FUNCTION__ +#endif + + /* UNUSED macro, for function argument */ #ifdef __GNUC__ # define UNUSED(x) UNUSED_ ## x __attribute__((__unused__)) diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 803da55cea6..3e3e6da188e 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -630,7 +630,7 @@ PointerRNA uiItemFullO(uiLayout *layout, const char *opname, const char *name, i if(!ot) { ui_item_disabled(layout, opname); - RNA_warning("uiItemFullO: unknown operator '%s'\n", opname); + RNA_warning("unknown operator '%s'", opname); return PointerRNA_NULL; } @@ -737,7 +737,7 @@ void uiItemsFullEnumO(uiLayout *layout, const char *opname, const char *propname if(!ot || !ot->srna) { ui_item_disabled(layout, opname); - RNA_warning("uiItemsFullEnumO: %s '%s'\n", ot ? "unknown operator" : "operator missing srna", opname); + RNA_warning("%s '%s'", ot ? "unknown operator" : "operator missing srna", opname); return; } @@ -815,7 +815,7 @@ void uiItemEnumO_value(uiLayout *layout, const char *name, int icon, const char /* pass */ } else { - RNA_warning("uiItemEnumO_value: %s.%s not found.\n", RNA_struct_identifier(ptr.type), propname); + RNA_warning("%s.%s not found.", RNA_struct_identifier(ptr.type), propname); return; } @@ -844,7 +844,7 @@ void uiItemEnumO_string(uiLayout *layout, const char *name, int icon, const char RNA_property_enum_items(layout->root->block->evil_C, &ptr, prop, &item, NULL, &free); if(item==NULL || RNA_enum_value_from_id(item, value_str, &value)==0) { if(free) MEM_freeN(item); - RNA_warning("uiItemEnumO_string: %s.%s, enum %s not found.\n", RNA_struct_identifier(ptr.type), propname, value_str); + RNA_warning("%s.%s, enum %s not found.", RNA_struct_identifier(ptr.type), propname, value_str); return; } @@ -852,7 +852,7 @@ void uiItemEnumO_string(uiLayout *layout, const char *name, int icon, const char MEM_freeN(item); } else { - RNA_warning("uiItemEnumO_string: %s.%s not found.\n", RNA_struct_identifier(ptr.type), propname); + RNA_warning("%s.%s not found.", RNA_struct_identifier(ptr.type), propname); return; } @@ -1059,7 +1059,7 @@ void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, int flag, if(!prop) { ui_item_disabled(layout, propname); - RNA_warning("uiItemR: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname); + RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname); return; } @@ -1072,7 +1072,7 @@ void uiItemEnumR(uiLayout *layout, const char *name, int icon, struct PointerRNA if(!prop || RNA_property_type(prop) != PROP_ENUM) { ui_item_disabled(layout, propname); - RNA_warning("uiItemEnumR: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname); + RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname); return; } @@ -1087,7 +1087,7 @@ void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *pr if(!prop || RNA_property_type(prop) != PROP_ENUM) { ui_item_disabled(layout, propname); - RNA_warning("uiItemEnumR_string: enum property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname); + RNA_warning("enum property not found: %s.%s", RNA_struct_identifier(ptr->type), propname); return; } @@ -1096,7 +1096,7 @@ void uiItemEnumR_string(uiLayout *layout, struct PointerRNA *ptr, const char *pr if(!RNA_enum_value_from_id(item, value, &ivalue)) { if(free) MEM_freeN(item); ui_item_disabled(layout, propname); - RNA_warning("uiItemEnumR: enum property value not found: %s\n", value); + RNA_warning("enum property value not found: %s", value); return; } @@ -1121,12 +1121,12 @@ void uiItemsEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propname if(!prop) { ui_item_disabled(layout, propname); - RNA_warning("uiItemsEnumR: enum property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname); + RNA_warning("enum property not found: %s.%s", RNA_struct_identifier(ptr->type), propname); return; } if(RNA_property_type(prop) != PROP_ENUM) { - RNA_warning("uiItemsEnumR: not an enum property: %s.%s\n", RNA_struct_identifier(ptr->type), propname); + RNA_warning("not an enum property: %s.%s", RNA_struct_identifier(ptr->type), propname); return; } else { @@ -1314,13 +1314,13 @@ void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propna prop= RNA_struct_find_property(ptr, propname); if(!prop) { - RNA_warning("uiItemPointerR: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname); + RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname); return; } type= RNA_property_type(prop); if(!ELEM(type, PROP_POINTER, PROP_STRING)) { - RNA_warning("uiItemPointerR: property %s must be a pointer or string.\n", propname); + RNA_warning("property %s must be a pointer or string.", propname); return; } @@ -1328,11 +1328,11 @@ void uiItemPointerR(uiLayout *layout, struct PointerRNA *ptr, const char *propna if(!searchprop) { - RNA_warning("uiItemPointerR: search collection property not found: %s.%s\n", RNA_struct_identifier(ptr->type), searchpropname); + RNA_warning("search collection property not found: %s.%s", RNA_struct_identifier(ptr->type), searchpropname); return; } else if (RNA_property_type(searchprop) != PROP_COLLECTION) { - RNA_warning("uiItemPointerR: search collection property is not a collection type: %s.%s\n", RNA_struct_identifier(ptr->type), searchpropname); + RNA_warning("search collection property is not a collection type: %s.%s", RNA_struct_identifier(ptr->type), searchpropname); return; } @@ -1417,7 +1417,7 @@ void uiItemM(uiLayout *layout, bContext *UNUSED(C), const char *menuname, const mt= WM_menutype_find(menuname, FALSE); if(mt==NULL) { - RNA_warning("uiItemM: not found %s\n", menuname); + RNA_warning("not found %s", menuname); return; } @@ -1537,12 +1537,12 @@ void uiItemMenuEnumO(uiLayout *layout, const char *opname, const char *propname, if(!ot) { ui_item_disabled(layout, opname); - RNA_warning("uiItemMenuEnumO: unknown operator '%s'\n", opname); + RNA_warning("unknown operator '%s'", opname); return; } if(!ot->srna) { ui_item_disabled(layout, opname); - RNA_warning("uiItemMenuEnumO: operator missing srna '%s'\n", opname); + RNA_warning("operator missing srna '%s'", opname); return; } @@ -1575,7 +1575,7 @@ void uiItemMenuEnumR(uiLayout *layout, struct PointerRNA *ptr, const char *propn prop= RNA_struct_find_property(ptr, propname); if(!prop) { ui_item_disabled(layout, propname); - RNA_warning("uiItemMenuEnumR: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname); + RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname); return; } diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index d2cee11c755..8c151712f95 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -245,7 +245,7 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) switch(event) { case UI_ID_BROWSE: case UI_ID_PIN: - RNA_warning("warning, id event %d shouldnt come here\n", event); + RNA_warning("warning, id event %d shouldnt come here", event); break; case UI_ID_OPEN: case UI_ID_ADD_NEW: @@ -488,7 +488,7 @@ static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, const prop= RNA_struct_find_property(ptr, propname); if(!prop || RNA_property_type(prop) != PROP_POINTER) { - RNA_warning("uiTemplateID: pointer property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname); + RNA_warning("pointer property not found: %s.%s", RNA_struct_identifier(ptr->type), propname); return; } @@ -549,11 +549,11 @@ void uiTemplateAnyID(uiLayout *layout, PointerRNA *ptr, const char *propname, co propType= RNA_struct_find_property(ptr, proptypename); if (!propID || RNA_property_type(propID) != PROP_POINTER) { - RNA_warning("uiTemplateAnyID: pointer property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname); + RNA_warning("pointer property not found: %s.%s", RNA_struct_identifier(ptr->type), propname); return; } if (!propType || RNA_property_type(propType) != PROP_ENUM) { - RNA_warning("uiTemplateAnyID: pointer-type property not found: %s.%s\n", RNA_struct_identifier(ptr->type), proptypename); + RNA_warning("pointer-type property not found: %s.%s", RNA_struct_identifier(ptr->type), proptypename); return; } @@ -592,7 +592,7 @@ void uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, const char *propna /* check that properties are valid */ propPath= RNA_struct_find_property(ptr, propname); if (!propPath || RNA_property_type(propPath) != PROP_STRING) { - RNA_warning("uiTemplatePathBuilder: path property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname); + RNA_warning("path property not found: %s.%s", RNA_struct_identifier(ptr->type), propname); return; } @@ -855,7 +855,7 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr) /* verify we have valid data */ if(!RNA_struct_is_a(ptr->type, &RNA_Modifier)) { - RNA_warning("uiTemplateModifier: Expected modifier on object.\n"); + RNA_warning("Expected modifier on object."); return NULL; } @@ -863,7 +863,7 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr) md= ptr->data; if(!ob || !(GS(ob->id.name) == ID_OB)) { - RNA_warning("uiTemplateModifier: Expected modifier on object.\n"); + RNA_warning("expected modifier on object."); return NULL; } @@ -1084,7 +1084,7 @@ uiLayout *uiTemplateConstraint(uiLayout *layout, PointerRNA *ptr) /* verify we have valid data */ if(!RNA_struct_is_a(ptr->type, &RNA_Constraint)) { - RNA_warning("uiTemplateConstraint: Expected constraint on object.\n"); + RNA_warning("Expected constraint on object."); return NULL; } @@ -1092,7 +1092,7 @@ uiLayout *uiTemplateConstraint(uiLayout *layout, PointerRNA *ptr) con= ptr->data; if(!ob || !(GS(ob->id.name) == ID_OB)) { - RNA_warning("uiTemplateConstraint: Expected constraint on object.\n"); + RNA_warning("Expected constraint on object."); return NULL; } @@ -1138,7 +1138,7 @@ void uiTemplatePreview(uiLayout *layout, ID *id, int show_buttons, ID *parent, M PointerRNA texture_ptr; if(id && !ELEM4(GS(id->name), ID_MA, ID_TE, ID_WO, ID_LA)) { - RNA_warning("uiTemplatePreview: Expected ID of type material, texture, lamp or world.\n"); + RNA_warning("expected ID of type material, texture, lamp or world."); return; } @@ -1844,12 +1844,14 @@ void uiTemplateCurveMapping(uiLayout *layout, PointerRNA *ptr, const char *propn PointerRNA cptr; if(!prop) { - RNA_warning("uiTemplateCurveMapping: curve property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname); + RNA_warning("curve property not found: %s.%s", + RNA_struct_identifier(ptr->type), propname); return; } if(RNA_property_type(prop) != PROP_POINTER) { - RNA_warning("uiTemplateCurveMapping: curve is not a pointer: %s.%s\n", RNA_struct_identifier(ptr->type), propname); + RNA_warning("curve is not a pointer: %s.%s", + RNA_struct_identifier(ptr->type), propname); return; } @@ -1879,7 +1881,7 @@ void uiTemplateColorWheel(uiLayout *layout, PointerRNA *ptr, const char *propnam float softmin, softmax, step, precision; if (!prop) { - RNA_warning("uiTemplateColorWheel: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname); + RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname); return; } @@ -1949,7 +1951,7 @@ void uiTemplateLayers(uiLayout *layout, PointerRNA *ptr, const char *propname, prop= RNA_struct_find_property(ptr, propname); if (!prop) { - RNA_warning("uiTemplateLayer: layers property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname); + RNA_warning("layers property not found: %s.%s", RNA_struct_identifier(ptr->type), propname); return; } @@ -1966,7 +1968,7 @@ void uiTemplateLayers(uiLayout *layout, PointerRNA *ptr, const char *propname, if(used_ptr && used_propname) { used_prop= RNA_struct_find_property(used_ptr, used_propname); if (!used_prop) { - RNA_warning("uiTemplateLayer: used layers property not found: %s.%s\n", RNA_struct_identifier(ptr->type), used_propname); + RNA_warning("used layers property not found: %s.%s", RNA_struct_identifier(ptr->type), used_propname); return; } @@ -2157,7 +2159,7 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char * pa= block->panel; if(!pa) { - RNA_warning("uiTemplateList: only works inside a panel.\n"); + RNA_warning("only works inside a panel."); return; } @@ -2167,28 +2169,28 @@ void uiTemplateList(uiLayout *layout, bContext *C, PointerRNA *ptr, const char * if(ptr->data) { prop= RNA_struct_find_property(ptr, propname); if(!prop) { - RNA_warning("uiTemplateList: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname); + RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname); return; } } activeprop= RNA_struct_find_property(activeptr, activepropname); if(!activeprop) { - RNA_warning("uiTemplateList: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), activepropname); + RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), activepropname); return; } if(prop) { type= RNA_property_type(prop); if(type != PROP_COLLECTION) { - RNA_warning("uiTemplateList: Expected collection property.\n"); + RNA_warning("uiExpected collection property."); return; } } activetype= RNA_property_type(activeprop); if(activetype != PROP_INT) { - RNA_warning("uiTemplateList: Expected integer property.\n"); + RNA_warning("expected integer property."); return; } diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 5da125bb440..7d013d01e72 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -974,7 +974,11 @@ int RNA_function_call_direct_va_lookup(struct bContext *C, struct ReportList *re short RNA_type_to_ID_code(StructRNA *type); StructRNA *ID_code_to_RNA_type(short idcode); -void RNA_warning(const char *format, ...) + +/* macro which inserts the function name */ +#define RNA_warning(format, args...) _RNA_warning("%s: " format "\n", __func__, ##args) + +void _RNA_warning(const char *format, ...) #ifdef __GNUC__ __attribute__ ((format (printf, 1, 2))) #endif diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index e7d0c5cdec2..ea23fea0c2c 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -5374,7 +5374,8 @@ int RNA_property_copy(PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, i return 0; } -void RNA_warning(const char *format, ...) +/* use RNA_warning macro which includes __func__ suffix */ +void _RNA_warning(const char *format, ...) { va_list args; diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index d4ac9880290..92c93f41dfc 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -46,7 +46,7 @@ static void rna_uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, int flag= 0; if(!prop) { - RNA_warning("rna_uiItemR: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname); + RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname); return; } diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 2212499d842..4c382efdda3 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -5443,7 +5443,7 @@ static PyObject* pyrna_srna_ExternalType(StructRNA *srna) if(bpy_types==NULL) { PyErr_Print(); PyErr_Clear(); - fprintf(stderr, "pyrna_srna_ExternalType: failed to find 'bpy_types' module\n"); + fprintf(stderr, "%s: failed to find 'bpy_types' module\n", __func__); return NULL; } bpy_types_dict= PyModule_GetDict(bpy_types); // borrow @@ -5457,18 +5457,18 @@ static PyObject* pyrna_srna_ExternalType(StructRNA *srna) PyObject *base_compare= pyrna_srna_PyBase(srna); //PyObject *slots= PyObject_GetAttrString(newclass, "__slots__"); // cant do this because it gets superclasses values! //PyObject *bases= PyObject_GetAttrString(newclass, "__bases__"); // can do this but faster not to. - PyObject *bases= ((PyTypeObject *)newclass)->tp_bases; - PyObject *slots= PyDict_GetItem(((PyTypeObject *)newclass)->tp_dict, bpy_intern_str___slots__); + PyObject *tp_bases= ((PyTypeObject *)newclass)->tp_bases; + PyObject *tp_slots= PyDict_GetItem(((PyTypeObject *)newclass)->tp_dict, bpy_intern_str___slots__); - if(slots==NULL) { - fprintf(stderr, "pyrna_srna_ExternalType: expected class '%s' to have __slots__ defined\n\nSee bpy_types.py\n", idname); + if(tp_slots==NULL) { + fprintf(stderr, "%s: expected class '%s' to have __slots__ defined\n\nSee bpy_types.py\n", __func__, idname); newclass= NULL; } - else if(PyTuple_GET_SIZE(bases)) { - PyObject *base= PyTuple_GET_ITEM(bases, 0); + else if(PyTuple_GET_SIZE(tp_bases)) { + PyObject *base= PyTuple_GET_ITEM(tp_bases, 0); if(base_compare != base) { - fprintf(stderr, "pyrna_srna_ExternalType: incorrect subclassing of SRNA '%s'\nSee bpy_types.py\n", idname); + fprintf(stderr, "%s: incorrect subclassing of SRNA '%s'\nSee bpy_types.py\n", __func__, idname); PyC_ObSpit("Expected! ", base_compare); newclass= NULL; } @@ -5538,7 +5538,7 @@ static PyObject* pyrna_srna_Subtype(StructRNA *srna) } else { /* this should not happen */ - printf("Error registering '%s'\n", idname); + printf("%s: error registering '%s'\n", __func__, idname); PyErr_Print(); PyErr_Clear(); } @@ -5581,7 +5581,7 @@ PyObject *pyrna_struct_CreatePyObject(PointerRNA *ptr) Py_DECREF(tp); /* srna owns, cant hold a ref */ } else { - fprintf(stderr, "Could not make type\n"); + fprintf(stderr, "%s: could not make type\n", __func__); pyrna= (BPy_StructRNA *) PyObject_GC_New(BPy_StructRNA, &pyrna_struct_Type); #ifdef USE_WEAKREFS pyrna->in_weakreflist= NULL; @@ -6231,10 +6231,10 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param #endif py_class= RNA_struct_py_type_get(ptr->type); - /* rare case. can happen when registering subclasses */ if(py_class==NULL) { - fprintf(stderr, "bpy_class_call(): unable to get python class for rna struct '%.200s'\n", RNA_struct_identifier(ptr->type)); + fprintf(stderr, "%s: unable to get python class for rna struct '%.200s'\n", + __func__, RNA_struct_identifier(ptr->type)); return -1; }