implementation mismatch in bmesh python #38150

Closed
opened 2014-01-10 09:24:51 +01:00 by Alexander N. · 26 comments
Member

System Information
windows 8.1 64bit,

Blender Version
Broken: all (2.65, 2.67, 2.69, blender-2.69-18a1e17-win64-vc12.zip)

Short description of error
there are names of methods flipped
e.g.
bmesh.types.BMLayerCollection.items() gives values of the collection
and
bmesh.types.BMLayerCollection.values() gives key-value-tuples of the collection

Exact steps for others to reproduce the error

  1. open attached blend file
  2. open console window, to watch print-outputs
  3. start script

when i call items(), i get description and result of values():

.. method:: values()

   Return the values of collection
   (matching pythons dict.values() functionality).

   :return: the members of this collection.
   :rtype: list
item: <BMLayerItem object at 0x000000C0B2E268A0>

when i call values(), i get description and result of items():

.. method:: items()

   Return the identifiers of collection members
   (matching pythons dict.items() functionality).

   :return: (key, value) pairs for each member of this collection.
   :rtype: list of tuples
value: ('col_test', <BMLayerItem object at 0x000000C0B2E26900>)

issue_-_implementation_mismatch_in_bmesh.blend

**System Information** windows 8.1 64bit, **Blender Version** Broken: all (2.65, 2.67, 2.69, blender-2.69-18a1e17-win64-vc12.zip) **Short description of error** there are names of methods flipped e.g. bmesh.types.BMLayerCollection.items() gives values of the collection and bmesh.types.BMLayerCollection.values() gives key-value-tuples of the collection **Exact steps for others to reproduce the error** 1. open attached blend file 2. open console window, to watch print-outputs 3. start script when i call items(), i get description and result of values(): ``` .. method:: values() Return the values of collection (matching pythons dict.values() functionality). :return: the members of this collection. :rtype: list item: <BMLayerItem object at 0x000000C0B2E268A0> ``` when i call values(), i get description and result of items(): ``` .. method:: items() Return the identifiers of collection members (matching pythons dict.items() functionality). :return: (key, value) pairs for each member of this collection. :rtype: list of tuples value: ('col_test', <BMLayerItem object at 0x000000C0B2E26900>) ``` [issue_-_implementation_mismatch_in_bmesh.blend](https://archive.blender.org/developer/F65735/issue_-_implementation_mismatch_in_bmesh.blend)
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Author
Member

Added subscriber: @beta-tester

Added subscriber: @beta-tester

This issue was referenced by blender/blender-addons-contrib@ee15db9db5

This issue was referenced by blender/blender-addons-contrib@ee15db9db595ca47412664e3cb291dc23b73b0a4

This issue was referenced by blender/blender@ee15db9db5

This issue was referenced by blender/blender@ee15db9db595ca47412664e3cb291dc23b73b0a4

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Closed by commit blender/blender@ee15db9db5.

Closed by commit blender/blender@ee15db9db5.
Author
Member

Changed status from 'Resolved' to: 'Open'

Changed status from 'Resolved' to: 'Open'
Author
Member

the doc part is now corrected with the last commit,
BUT still the functionallitiy is incorrect!

items() gives me as result a list of values. but i expect a list of key-value pairs as result, like when i call dict.items()
in values() gives me as result a list of key-value pairs, expect is a list of values as result, like dict.values()

it looks like all BMLayerCollection shows the same behavior maybe the link from C/CPP-method to Python-method is swapped

BTW: BMesh.verts.layers.bevel_weight, i did not find a way how to create that layer in the UI.

further, i found out, that the doc of bmesh.types.BMDeformVert is swapped too, but the functionality of the method items() and values() behind is ok.

maybe there are more missmatches in BMesh to review...
issue_-_implementation_mismatch_in_bmesh_v1.blend

the __doc__ part is now corrected with the last commit, **BUT still the functionallitiy is incorrect!** items() gives me as result a list of values. but i expect a list of key-value pairs as result, like when i call dict.items() in values() gives me as result a list of key-value pairs, expect is a list of values as result, like dict.values() it looks like all BMLayerCollection shows the same behavior maybe the link from C/CPP-method to Python-method is swapped BTW: **BMesh.verts.layers.bevel_weight**, i did not find a way how to create that layer in the UI. **further, i found out, that the __doc__ of bmesh.types.BMDeformVert is swapped too**, but the functionality of the method items() and values() behind is ok. maybe there are more missmatches in BMesh to review... [issue_-_implementation_mismatch_in_bmesh_v1.blend](https://archive.blender.org/developer/F66552/issue_-_implementation_mismatch_in_bmesh_v1.blend)

This issue was referenced by blender/blender-addons-contrib@c2508b6e1b

This issue was referenced by blender/blender-addons-contrib@c2508b6e1b8f330419762dd0badc3059a8d1f448

This issue was referenced by blender/blender@c2508b6e1b

This issue was referenced by blender/blender@c2508b6e1b8f330419762dd0badc3059a8d1f448

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Closed by commit blender/blender@c2508b6e1b.

Closed by commit blender/blender@c2508b6e1b.
Author
Member

Changed status from 'Resolved' to: 'Open'

Changed status from 'Resolved' to: 'Open'
Author
Member

no, not fully fixed yet, "the doc of bmesh.types.BMDeformVert is swapped too" issue is still present.
bmesh.types.BMDeformVert.items.doc shows doc of values()
bmesh.types.BMDeformVert.values.doc shows doc of items()

no, not fully fixed yet, "the __doc__ of bmesh.types.BMDeformVert is swapped too" issue is still present. bmesh.types.BMDeformVert.items.__doc__ shows doc of values() bmesh.types.BMDeformVert.values.__doc__ shows doc of items()

Added subscriber: @ThomasDinges

Added subscriber: @ThomasDinges
Campbell Barton was assigned by Sergey Sharybin 2014-01-17 12:39:15 +01:00

Added subscriber: @Sergey

Added subscriber: @Sergey

This issue was referenced by blender/blender-addons-contrib@18db6c58ec

This issue was referenced by blender/blender-addons-contrib@18db6c58ec6b7a37eed58a532cbe2f51f1e5f073

This issue was referenced by blender/blender@18db6c58ec

This issue was referenced by blender/blender@18db6c58ec6b7a37eed58a532cbe2f51f1e5f073

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Closed by commit blender/blender@18db6c58ec.

Closed by commit blender/blender@18db6c58ec.
Author
Member

i scare about to tell you, but i think there was a mistake in that commit blender/blender@18db6c58ec (by accident, a good code line was turning to a bad one)

[blender.git] / source / blender / python / bmesh / bmesh_py_types.c
1387: PyDoc_STRVAR(bpy_bmvert_calc_edgeangle_doc,
1388: -".. method:: calc
edgeangle()\n"
1388: +".. method:: calc
vert_angle()\n"

i scare about to tell you, but i think there was a mistake in that commit blender/blender@18db6c58ec (by accident, a good code line was turning to a bad one) [blender.git] / source / blender / python / bmesh / bmesh_py_types.c 1387: PyDoc_STRVAR(bpy_bmvert_calc_**edge**_angle_doc, 1388: -".. method:: calc_**edge**_angle()\n" 1388: +".. method:: calc_**vert**_angle()\n"
Author
Member

Changed status from 'Resolved' to: 'Open'

Changed status from 'Resolved' to: 'Open'
Author
Member

i get more and more confused with this report...

on the API reference page of 2.69.10
http://www.blender.org/documentation/blender_python_api_2_69_10/bmesh.types.html?highlight=calc_edge_angle#bmesh.types.BMVert.calc_edge_angle

the function is called "calc_edge_angle".

in blender itself, i get this (i tested now with 'blender-2.69-97aab5a-win64-vc12.zip'):
with "print(dir(bmv))"
[..., 'calc_shell_factor', 'calc_vert_angle', 'co', 'copy_from', 'copy_from_face_interp', 'copy_from_vert_interp', 'hide', 'hide_set', 'index', 'is_boundary', 'is_manifold', 'is_valid', 'is_wire', 'link_edges', 'link_faces', 'link_loops', 'normal', 'normal_update', 'select', 'select_set', 'tag']

(no such function is available, but calc_vert_angle)

and "print(bmv.calc_vert_angle.doc)" gives me:

.. method:: calc_vert_angle()

   Return the angle between this vert's two connected edges.

   :return: Angle between edges in radians.
   :rtype: float

what is the correct name/doc/functionality now - 'calc_edge_angle' or 'calc_vert_angle' ?

sorry, that i am such a pendant smart-ass - it is not my intention to waste so much developing time of you - really.

issue_-_implementation_mismatch_in_bmesh_v2.blend

i get more and more confused with this report... on the API reference page of 2.69.10 http://www.blender.org/documentation/blender_python_api_2_69_10/bmesh.types.html?highlight=calc_edge_angle#bmesh.types.BMVert.calc_edge_angle the function is called "calc_edge_angle". in blender itself, i get this (i tested now with 'blender-2.69-97aab5a-win64-vc12.zip'): with "print(dir(bmv))" [..., 'calc_shell_factor', '***calc_vert_angle***', 'co', 'copy_from', 'copy_from_face_interp', 'copy_from_vert_interp', 'hide', 'hide_set', 'index', 'is_boundary', 'is_manifold', 'is_valid', 'is_wire', 'link_edges', 'link_faces', 'link_loops', 'normal', 'normal_update', 'select', 'select_set', 'tag'] (no such function is available, but ***calc_vert_angle***) and "print(bmv.calc_vert_angle.__doc__)" gives me: ``` .. method:: calc_vert_angle() Return the angle between this vert's two connected edges. :return: Angle between edges in radians. :rtype: float ``` what is the correct name/doc/functionality now - 'calc_edge_angle' or 'calc_vert_angle' ? sorry, that i am such a pendant smart-ass - it is not my intention to waste so much developing time of you - really. [issue_-_implementation_mismatch_in_bmesh_v2.blend](https://archive.blender.org/developer/F75424/issue_-_implementation_mismatch_in_bmesh_v2.blend)

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'

Added subscriber: @brecht

Added subscriber: @brecht

It's calc_vert_angle, the python API docs are just outdated, they are updated regularly but not every day.

It's `calc_vert_angle`, the python API docs are just outdated, they are updated regularly but not every day.
Sign in to join this conversation.
No Milestone
No project
No Assignees
7 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#38150
No description provided.