From 24b012c978b4e51f5ef8efa28c82a7bf24dc902f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 7 Apr 2011 07:53:28 +0000 Subject: Sphinx RNA API changelog generator. - lists added and removed functions and properties. - lists renamed properties (does fuzzy comparison using min/max, description, type) - lists functions with arguments changed. Committed change log from 2.56 -> 2.57: http://www.blender.org/documentation/250PythonDoc/change_log.html --- doc/python_api/rst/change_log.rst | 698 +++++++++++++++++++++++++++++++++ doc/python_api/sphinx_changelog_gen.py | 370 +++++++++++++++++ doc/python_api/sphinx_doc_gen.py | 11 + 3 files changed, 1079 insertions(+) create mode 100644 doc/python_api/rst/change_log.rst create mode 100644 doc/python_api/sphinx_changelog_gen.py (limited to 'doc') diff --git a/doc/python_api/rst/change_log.rst b/doc/python_api/rst/change_log.rst new file mode 100644 index 00000000000..7035ef4311b --- /dev/null +++ b/doc/python_api/rst/change_log.rst @@ -0,0 +1,698 @@ +Blender API Change Log +********************** + +.. note, this document is auto generated by sphinx_changelog_gen.py + + +2.56 to 2.57 +============ +bpy.types.SplineBezierPoints +---------------------------- + +Function Arguments +^^^^^^^^^^^^^^^^^^ + +* :class:`bpy.types.SplineBezierPoints.friction` (count), *was (number)* + +bpy.types.RenderSettings +------------------------ + +Added +^^^^^ + +* :class:`bpy.types.RenderSettings.use_stamp_lens` + +Removed +^^^^^^^ + +* **use_backbuf** + +bpy.types.ActionPoseMarkers +--------------------------- + +Added +^^^^^ + +* :class:`bpy.types.ActionPoseMarkers.active` +* :class:`bpy.types.ActionPoseMarkers.active_index` + +bpy.types.SpaceImageEditor +-------------------------- + +Renamed +^^^^^^^ + +* **curves** -> :class:`bpy.types.SpaceImageEditor.curve` + +bpy.types.Scene +--------------- + +Removed +^^^^^^^ + +* **network_render** + +bpy.types.GameObjectSettings +---------------------------- + +Added +^^^^^ + +* :class:`bpy.types.GameObjectSettings.use_material_physics_fh` + +Removed +^^^^^^^ + +* **use_material_physics** + +bpy.types.SplinePoints +---------------------- + +Function Arguments +^^^^^^^^^^^^^^^^^^ + +* :class:`bpy.types.SplinePoints.use_material_physics` (count), *was (number)* + +bpy.types.Area +-------------- + +Added +^^^^^ + +* :class:`bpy.types.Area.height` +* :class:`bpy.types.Area.width` + +bpy.types.SolidifyModifier +-------------------------- + +Added +^^^^^ + +* :class:`bpy.types.SolidifyModifier.material_offset` +* :class:`bpy.types.SolidifyModifier.material_offset_rim` + +Removed +^^^^^^^ + +* **use_rim_material** + +bpy.types.UserPreferencesEdit +----------------------------- + +Removed +^^^^^^^ + +* **use_keyframe_insert_keyingset** + +bpy.types.MaterialTextureSlot +----------------------------- + +Added +^^^^^ + +* :class:`bpy.types.MaterialTextureSlot.bump_method` +* :class:`bpy.types.MaterialTextureSlot.bump_objectspace` + +Removed +^^^^^^^ + +* **use_old_bump** + +bpy.types.ExplodeModifier +------------------------- + +Added +^^^^^ + +* :class:`bpy.types.ExplodeModifier.particle_uv` +* :class:`bpy.types.ExplodeModifier.use_edge_cut` + +Removed +^^^^^^^ + +* **use_edge_split** + +bpy.types.Node +-------------- + +Added +^^^^^ + +* :class:`bpy.types.Node.label` + +bpy.types.RigidBodyJointConstraint +---------------------------------- + +Added +^^^^^ + +* :class:`bpy.types.RigidBodyJointConstraint.limit_angle_max_x` +* :class:`bpy.types.RigidBodyJointConstraint.limit_angle_max_y` +* :class:`bpy.types.RigidBodyJointConstraint.limit_angle_max_z` +* :class:`bpy.types.RigidBodyJointConstraint.limit_angle_min_x` +* :class:`bpy.types.RigidBodyJointConstraint.limit_angle_min_y` +* :class:`bpy.types.RigidBodyJointConstraint.limit_angle_min_z` +* :class:`bpy.types.RigidBodyJointConstraint.limit_max_x` +* :class:`bpy.types.RigidBodyJointConstraint.limit_max_y` +* :class:`bpy.types.RigidBodyJointConstraint.limit_max_z` +* :class:`bpy.types.RigidBodyJointConstraint.limit_min_x` +* :class:`bpy.types.RigidBodyJointConstraint.limit_min_y` +* :class:`bpy.types.RigidBodyJointConstraint.limit_min_z` + +Removed +^^^^^^^ + +* **limit_cone_max** +* **limit_cone_min** +* **limit_generic_max** +* **limit_generic_min** + +bpy.types.KeyMap +---------------- + +Renamed +^^^^^^^ + +* **items** -> :class:`bpy.types.KeyMap.keymap_items` + +bpy.types.SpaceNodeEditor +------------------------- + +Added +^^^^^ + +* :class:`bpy.types.SpaceNodeEditor.backdrop_channels` +* :class:`bpy.types.SpaceNodeEditor.backdrop_x` +* :class:`bpy.types.SpaceNodeEditor.backdrop_y` +* :class:`bpy.types.SpaceNodeEditor.backdrop_zoom` +* :class:`bpy.types.SpaceNodeEditor.use_auto_render` + +bpy.types.SPHFluidSettings +-------------------------- + +Added +^^^^^ + +* :class:`bpy.types.SPHFluidSettings.factor_density` +* :class:`bpy.types.SPHFluidSettings.factor_radius` +* :class:`bpy.types.SPHFluidSettings.factor_repulsion` +* :class:`bpy.types.SPHFluidSettings.factor_rest_length` +* :class:`bpy.types.SPHFluidSettings.factor_stiff_viscosity` +* :class:`bpy.types.SPHFluidSettings.plasticity` +* :class:`bpy.types.SPHFluidSettings.repulsion` +* :class:`bpy.types.SPHFluidSettings.spring_frames` +* :class:`bpy.types.SPHFluidSettings.stiff_viscosity` +* :class:`bpy.types.SPHFluidSettings.use_initial_rest_length` +* :class:`bpy.types.SPHFluidSettings.use_viscoelastic_springs` +* :class:`bpy.types.SPHFluidSettings.yield_ratio` + +Removed +^^^^^^^ + +* **stiffness_near** +* **viscosity_beta** + +Renamed +^^^^^^^ + +* **viscosity_omega** -> :class:`bpy.types.SPHFluidSettings.linear_viscosity` + +bpy.types.ConstraintActuator +---------------------------- + +Added +^^^^^ + +* :class:`bpy.types.ConstraintActuator.direction_axis_pos` +* :class:`bpy.types.ConstraintActuator.fh_force` + +Removed +^^^^^^^ + +* **spring** + +bpy.types.UILayout +------------------ + +Renamed +^^^^^^^ + +* **operator_enums** -> :class:`bpy.types.UILayout.operator_enum` + +bpy.types.SpaceDopeSheetEditor +------------------------------ + +Added +^^^^^ + +* :class:`bpy.types.SpaceDopeSheetEditor.show_pose_markers` + +bpy.types.ToolSettings +---------------------- + +Added +^^^^^ + +* :class:`bpy.types.ToolSettings.edge_path_live_unwrap` +* :class:`bpy.types.ToolSettings.proportional_size` +* :class:`bpy.types.ToolSettings.use_keyframe_insert_keyingset` + +bpy.types.EditBone +------------------ + +Added +^^^^^ + +* :class:`bpy.types.EditBone.bbone_x` +* :class:`bpy.types.EditBone.bbone_z` + +Function Arguments +^^^^^^^^^^^^^^^^^^ + +* :class:`bpy.types.EditBone.bbone_z` (self, matrix, scale, roll), *was (self, matrix)* + +bpy.types.ID +------------ + +Renamed +^^^^^^^ + +* **update** -> :class:`bpy.types.ID.update_tag` + +bpy.types.SpaceGraphEditor +-------------------------- + +Added +^^^^^ + +* :class:`bpy.types.SpaceGraphEditor.use_fancy_drawing` + +bpy.types.ParticleSystem +------------------------ + +Added +^^^^^ + +* :class:`bpy.types.ParticleSystem.child_seed` + +bpy.types.SpaceTimeline +----------------------- + +Removed +^^^^^^^ + +* **use_play_3d_editors** +* **use_play_animation_editors** +* **use_play_image_editors** +* **use_play_node_editors** +* **use_play_properties_editors** +* **use_play_sequence_editors** +* **use_play_top_left_3d_editor** + +bpy.types.Mesh +-------------- + +Added +^^^^^ + +* :class:`bpy.types.Mesh.validate` + +Renamed +^^^^^^^ + +* **show_extra_edge_angle** -> :class:`bpy.types.Mesh.show_extra_face_angle` + +Function Arguments +^^^^^^^^^^^^^^^^^^ + +* :class:`bpy.types.Mesh.show_extra_face_angle` (self, vertices, edges, faces), *was (self, verts, edges, faces)* + +bpy.types.EnumProperty +---------------------- + +Added +^^^^^ + +* :class:`bpy.types.EnumProperty.default_flag` + +Renamed +^^^^^^^ + +* **items** -> :class:`bpy.types.EnumProperty.enum_items` + +bpy.types.Screen +---------------- + +Added +^^^^^ + +* :class:`bpy.types.Screen.use_play_3d_editors` +* :class:`bpy.types.Screen.use_play_animation_editors` +* :class:`bpy.types.Screen.use_play_image_editors` +* :class:`bpy.types.Screen.use_play_node_editors` +* :class:`bpy.types.Screen.use_play_properties_editors` +* :class:`bpy.types.Screen.use_play_sequence_editors` +* :class:`bpy.types.Screen.use_play_top_left_3d_editor` + +bpy.types.MirrorModifier +------------------------ + +Added +^^^^^ + +* :class:`bpy.types.MirrorModifier.use_mirror_merge` + +bpy.types.Operator +------------------ + +Added +^^^^^ + +* :class:`bpy.types.Operator.cancel` + +bpy.types.Brush +--------------- + +Added +^^^^^ + +* :class:`bpy.types.Brush.height` +* :class:`bpy.types.Brush.use_fixed_texture` + +Renamed +^^^^^^^ + +* **imagepaint_tool** -> :class:`bpy.types.Brush.image_tool` +* **use_paint_texture** -> :class:`bpy.types.Brush.use_paint_image` +* **vertexpaint_tool** -> :class:`bpy.types.Brush.vertex_tool` + +bpy.types.Key +------------- + +Renamed +^^^^^^^ + +* **keys** -> :class:`bpy.types.Key.key_blocks` + +bpy.types.CompositorNodeBlur +---------------------------- + +Added +^^^^^ + +* :class:`bpy.types.CompositorNodeBlur.aspect_correction` + +bpy.types.SpaceTextEditor +------------------------- + +Added +^^^^^ + +* :class:`bpy.types.SpaceTextEditor.margin_column` +* :class:`bpy.types.SpaceTextEditor.show_margin` + +bpy.types.GPencilLayer +---------------------- + +Added +^^^^^ + +* :class:`bpy.types.GPencilLayer.show_x_ray` + +Removed +^^^^^^^ + +* **active** + +bpy.types.MarbleTexture +----------------------- + +Renamed +^^^^^^^ + +* **noisebasis_2** -> :class:`bpy.types.MarbleTexture.noise_basis_2` + +bpy.types.Particle +------------------ + +Removed +^^^^^^^ + +* **is_hair** + +Renamed +^^^^^^^ + +* **keys** -> :class:`bpy.types.Particle.hair_keys` +* **keys** -> :class:`bpy.types.Particle.particle_keys` + +bpy.types.Modifier +------------------ + +Added +^^^^^ + +* :class:`bpy.types.Modifier.use_apply_on_spline` + +bpy.types.Property +------------------ + +Added +^^^^^ + +* :class:`bpy.types.Property.is_enum_flag` + +bpy.types.SpaceProperties +------------------------- + +Added +^^^^^ + +* :class:`bpy.types.SpaceProperties.texture_context` + +Removed +^^^^^^^ + +* **show_brush_texture** + +bpy.types.VertexGroups +---------------------- + +Added +^^^^^ + +* :class:`bpy.types.VertexGroups.remove` + +Removed +^^^^^^^ + +* **assign** + +bpy.types.Material +------------------ + +Added +^^^^^ + +* :class:`bpy.types.Material.shadow_only_type` + +bpy.types.RenderLayer +--------------------- + +Function Arguments +^^^^^^^^^^^^^^^^^^ + +* :class:`bpy.types.RenderLayer.shadow_only_type` (filename, x, y), *was (filename)* + +bpy.types.Object +---------------- + +Added +^^^^^ + +* :class:`bpy.types.Object.is_modified` + +Renamed +^^^^^^^ + +* **create_dupli_list** -> :class:`bpy.types.Object.dupli_list_create` +* **create_mesh** -> :class:`bpy.types.Object.to_mesh` +* **free_dupli_list** -> :class:`bpy.types.Object.dupli_list_clear` + +bpy.types.NodeTree +------------------ + +Added +^^^^^ + +* :class:`bpy.types.NodeTree.inputs` +* :class:`bpy.types.NodeTree.outputs` + +bpy.types.DopeSheet +------------------- + +Added +^^^^^ + +* :class:`bpy.types.DopeSheet.filter_fcurve_name` +* :class:`bpy.types.DopeSheet.show_lattices` +* :class:`bpy.types.DopeSheet.show_only_matching_fcurves` + +bpy.types.ActionFCurves +----------------------- + +Function Arguments +^^^^^^^^^^^^^^^^^^ + +* :class:`bpy.types.ActionFCurves.show_only_matching_fcurves` (data_path, index, action_group), *was (data_path, array_index, action_group)* + +bpy.types.ShrinkwrapModifier +---------------------------- + +Added +^^^^^ + +* :class:`bpy.types.ShrinkwrapModifier.cull_face` + +Removed +^^^^^^^ + +* **use_cull_back_faces** +* **use_cull_front_faces** + +bpy.types.WindowManager +----------------------- + +Added +^^^^^ + +* :class:`bpy.types.WindowManager.addon_filter` +* :class:`bpy.types.WindowManager.addon_search` +* :class:`bpy.types.WindowManager.addon_support` +* :class:`bpy.types.WindowManager.event_timer_add` +* :class:`bpy.types.WindowManager.event_timer_remove` + +bpy.types.WoodTexture +--------------------- + +Renamed +^^^^^^^ + +* **noisebasis_2** -> :class:`bpy.types.WoodTexture.noise_basis_2` + +bpy.types.VertexGroup +--------------------- + +Added +^^^^^ + +* :class:`bpy.types.VertexGroup.add` +* :class:`bpy.types.VertexGroup.remove` +* :class:`bpy.types.VertexGroup.weight` + +bpy.types.FCurveKeyframePoints +------------------------------ + +Added +^^^^^ + +* :class:`bpy.types.FCurveKeyframePoints.insert` + +Function Arguments +^^^^^^^^^^^^^^^^^^ + +* :class:`bpy.types.FCurveKeyframePoints.insert` (count), *was (frame, value, replace, needed, fast)* + +bpy.types.ThemeView3D +--------------------- + +Added +^^^^^ + +* :class:`bpy.types.ThemeView3D.outline_width` + +bpy.types.Image +--------------- + +Added +^^^^^ + +* :class:`bpy.types.Image.pixels` + +bpy.types.Bone +-------------- + +Added +^^^^^ + +* :class:`bpy.types.Bone.bbone_x` +* :class:`bpy.types.Bone.bbone_z` + +bpy.types.InputKeyMapPanel +-------------------------- + +Removed +^^^^^^^ + +* **draw_entry** +* **draw_filtered** +* **draw_hierarchy** +* **draw_keymaps** +* **draw_km** +* **draw_kmi** +* **draw_kmi_properties** +* **indented_layout** + +bpy.types.ParticleSettings +-------------------------- + +Added +^^^^^ + +* :class:`bpy.types.ParticleSettings.active_texture` +* :class:`bpy.types.ParticleSettings.active_texture_index` +* :class:`bpy.types.ParticleSettings.child_parting_factor` +* :class:`bpy.types.ParticleSettings.child_parting_max` +* :class:`bpy.types.ParticleSettings.child_parting_min` +* :class:`bpy.types.ParticleSettings.color_maximum` +* :class:`bpy.types.ParticleSettings.create_long_hair_children` +* :class:`bpy.types.ParticleSettings.draw_color` +* :class:`bpy.types.ParticleSettings.effector_amount` +* :class:`bpy.types.ParticleSettings.grid_random` +* :class:`bpy.types.ParticleSettings.hair_length` +* :class:`bpy.types.ParticleSettings.hexagonal_grid` +* :class:`bpy.types.ParticleSettings.is_fluid` +* :class:`bpy.types.ParticleSettings.kink_amplitude_clump` +* :class:`bpy.types.ParticleSettings.kink_flat` +* :class:`bpy.types.ParticleSettings.texture_slots` +* :class:`bpy.types.ParticleSettings.timestep` +* :class:`bpy.types.ParticleSettings.use_advanced_hair` + +Removed +^^^^^^^ + +* **reaction_shape** +* **show_material_color** +* **use_animate_branching** +* **use_branching** +* **use_symmetric_branching** + +bpy.types.SceneGameData +----------------------- + +Added +^^^^^ + +* :class:`bpy.types.SceneGameData.show_mouse` + +bpy.types.MaterialPhysics +------------------------- + +Renamed +^^^^^^^ + +* **damping** -> :class:`bpy.types.MaterialPhysics.fh_damping` +* **distance** -> :class:`bpy.types.MaterialPhysics.fh_distance` +* **force** -> :class:`bpy.types.MaterialPhysics.fh_force` +* **use_normal_align** -> :class:`bpy.types.MaterialPhysics.use_fh_normal` + diff --git a/doc/python_api/sphinx_changelog_gen.py b/doc/python_api/sphinx_changelog_gen.py new file mode 100644 index 00000000000..4305157bd78 --- /dev/null +++ b/doc/python_api/sphinx_changelog_gen.py @@ -0,0 +1,370 @@ +# ##### BEGIN GPL LICENSE BLOCK ##### +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# ##### END GPL LICENSE BLOCK ##### + +# + +""" +Dump the python API into a text file so we can generate changelogs. + +output from this tool should be added into "doc/python_api/rst/change_log.rst" + +# dump api blender_version.py in CWD +blender --background --python intern/tools/rna_api_dump.py -- --dump + +# create changelog +blender --background --python intern/tools/rna_api_dump.py -- \ + --api_from blender_2_56_1.py \ + --api_to blender_2_57_0.py \ + --api_out changes.rst + + +# Api comparison can also run without blender +python intern/tools/rna_api_dump.py + --api_from blender_api_2_56_6.py \ + --api_to blender_api_2_57.py \ + --api_out changes.rst + +""" + +# format +''' +{"module.name": + {"parent.class": + {"basic_type", "member_name": ("Name", type, range, length, default, descr, f_args, f_arg_types, f_ret_types)}, ... + }, ... +} +''' + +api_names = "basic_type" "name", "type", "range", "length", "default", "descr", "f_args", "f_arg_types", "f_ret_types" + +API_BASIC_TYPE = 0 +API_F_ARGS = 7 + + +def api_dunp_fname(): + import bpy + return "blender_api_%s.py" % "_".join([str(i) for i in bpy.app.version]) + + +def api_dump(): + dump = {} + dump_module = dump["bpy.types"] = {} + + import rna_info + import inspect + + struct = rna_info.BuildRNAInfo()[0] + for struct_id, strict_info in sorted(struct.items()): + + struct_id_str = strict_info.identifier + + if rna_info.rna_id_ignore(struct_id_str): + continue + + for base in strict_info.get_bases(): + struct_id_str = base.identifier + "." + struct_id_str + + dump_class = dump_module[struct_id_str] = {} + + props = [(prop.identifier, prop) for prop in strict_info.properties] + for prop_id, prop in sorted(props): + # if prop.type == 'boolean': + # continue + prop_type = prop.type + prop_length = prop.array_length + prop_range = round(prop.min, 4), round(prop.max, 4) + prop_default = prop.default + if type(prop_default) is float: + prop_default = round(prop_default, 4) + + if prop_range[0] == -1 and prop_range[1] == -1: + prop_range = None + + dump_class[prop_id] = ( + "prop_rna", # basic_type + prop.name, # name + prop_type, # type + prop_range, # range + prop_length, # length + prop.default, # default + prop.description, # descr + Ellipsis, # f_args + Ellipsis, # f_arg_types + Ellipsis, # f_ret_types + ) + del props + + # python props, tricky since we dont know much about them. + for prop_id, attr in strict_info.get_py_properties(): + + dump_class[prop_id] = ( + "prop_py", # basic_type + Ellipsis, # name + Ellipsis, # type + Ellipsis, # range + Ellipsis, # length + Ellipsis, # default + attr.__doc__, # descr + Ellipsis, # f_args + Ellipsis, # f_arg_types + Ellipsis, # f_ret_types + ) + + # kludge func -> props + funcs = [(func.identifier, func) for func in strict_info.functions] + for func_id, func in funcs: + + func_ret_types = tuple([prop.type for prop in func.return_values]) + func_args_ids = tuple([prop.identifier for prop in func.args]) + func_args_type = tuple([prop.type for prop in func.args]) + + dump_class[func_id] = ( + "func_rna", # basic_type + Ellipsis, # name + Ellipsis, # type + Ellipsis, # range + Ellipsis, # length + Ellipsis, # default + func.description, # descr + func_args_ids, # f_args + func_args_type, # f_arg_types + func_ret_types, # f_ret_types + ) + del funcs + + # kludge func -> props + funcs = strict_info.get_py_functions() + for func_id, attr in funcs: + # arg_str = inspect.formatargspec(*inspect.getargspec(py_func)) + + func_args_ids = tuple(inspect.getargspec(attr).args) + + dump_class[func_id] = ( + "func_py", # basic_type + Ellipsis, # name + Ellipsis, # type + Ellipsis, # range + Ellipsis, # length + Ellipsis, # default + attr.__doc__, # descr + func_args_ids, # f_args + Ellipsis, # f_arg_types + Ellipsis, # f_ret_types + ) + del funcs + + import pprint + + filename = api_dunp_fname() + filehandle = open(filename, 'w') + tot = filehandle.write(pprint.pformat(dump, width=1)) + filehandle.close() + print("%s, %d bytes written" % (filename, tot)) + + +def compare_props(a, b, fuzz=0.75): + + # must be same basic_type, function != property + if a[0] != b[0]: + return False + + tot = 0 + totlen = 0 + for i in range(1, len(a)): + if not (Ellipsis is a[i] is b[i]): + tot += (a[i] == b[i]) + totlen += 1 + + return ((tot / totlen) >= fuzz) + + +def api_changelog(api_from, api_to, api_out): + + file_handle = open(api_from, 'r') + dict_from = eval(file_handle.read()) + file_handle.close() + + file_handle = open(api_to, 'r') + dict_to = eval(file_handle.read()) + file_handle.close() + + api_changes = [] + + # first work out what moved + for mod_id, mod_data in dict_to.items(): + mod_data_other = dict_from[mod_id] + for class_id, class_data in mod_data.items(): + class_data_other = mod_data_other.get(class_id) + if class_data_other is None: + # TODO, document new structs + continue + + # find the props which are not in either + set_props_new = set(class_data.keys()) + set_props_other = set(class_data_other.keys()) + set_props_shared = set_props_new & set_props_other + + props_moved = [] + props_new = [] + props_old = [] + func_args = [] + + set_props_old = set_props_other - set_props_shared + set_props_new = set_props_new - set_props_shared + + # first find settings which have been moved old -> new + for prop_id_old in set_props_old.copy(): + prop_data_other = class_data_other[prop_id_old] + for prop_id_new in set_props_new.copy(): + prop_data = class_data[prop_id_new] + if compare_props(prop_data_other, prop_data): + props_moved.append((prop_id_old, prop_id_new)) + + # remove + if prop_id_old in set_props_old: + set_props_old.remove(prop_id_old) + set_props_new.remove(prop_id_new) + + # func args + for prop_id in set_props_shared: + prop_data = class_data[prop_id] + prop_data_other = class_data_other[prop_id] + if prop_data[API_BASIC_TYPE] == prop_data_other[API_BASIC_TYPE]: + if prop_data[API_BASIC_TYPE].startswith("func"): + args_new = prop_data[API_F_ARGS] + args_old = prop_data_other[API_F_ARGS] + + if args_new != args_old: + func_args.append((prop_id, args_old, args_new)) + + + if props_moved or set_props_new or set_props_old or func_args: + props_moved.sort() + props_new[:] = sorted(set_props_new) + props_old[:] = sorted(set_props_old) + func_args.sort() + + api_changes.append((mod_id, class_id, props_moved, props_new, props_old, func_args)) + + # also document function argument changes + + + + + + fout = open(api_out, 'w') + fw = fout.write + # print(api_changes) + + # :class:`bpy_struct.id_data` + + def write_title(title, title_char): + fw("%s\n%s\n\n" % (title, title_char * len(title))) + + for mod_id, class_id, props_moved, props_new, props_old, func_args in api_changes: + class_name = class_id.split(".")[-1] + title = mod_id + "." + class_name + write_title(title, "-") + + if props_new: + write_title("Added", "^") + for prop_id in props_new: + fw("* :class:`%s.%s.%s`\n" % (mod_id, class_name, prop_id)) + fw("\n") + + if props_old: + write_title("Removed", "^") + for prop_id in props_old: + fw("* **%s**\n" % prop_id) # cant link to remvoed docs + fw("\n") + + if props_moved: + write_title("Renamed", "^") + for prop_id_old, prop_id in props_moved: + fw("* **%s** -> :class:`%s.%s.%s`\n" % (prop_id_old, mod_id, class_name, prop_id)) + fw("\n") + + if func_args: + write_title("Function Arguments", "^") + for func_id, args_old, args_new in func_args: + args_new = ", ".join(args_new) + args_old = ", ".join(args_old) + fw("* :class:`%s.%s.%s` (%s), *was (%s)*\n" % (mod_id, class_name, prop_id, args_new, args_old)) + fw("\n") + + fout.close() + + +def main(): + import sys + import os + + try: + import argparse + except: + print("Old Blender, just dumping") + api_dump() + return + + + argv = sys.argv + + if "--" not in argv: + argv = [] # as if no args are passed + else: + argv = argv[argv.index("--") + 1:] # get all args after "--" + + # When --help or no args are given, print this help + usage_text = "Run blender in background mode with this script: " + "blender --background --python %s -- [options]" % os.path.basename(__file__) + + epilog = "Run this before releases" + + parser = argparse.ArgumentParser(description=usage_text, epilog=epilog) + + parser.add_argument("--dump", dest="dump", action='store_true', + help="When set the api will be dumped into blender_version.py") + + parser.add_argument("--api_from", dest="api_from", metavar='FILE', + help="File to compare from (previous version)") + parser.add_argument("--api_to", dest="api_to", metavar='FILE', + help="File to compare from (current)") + parser.add_argument("--api_out", dest="api_out", metavar='FILE', + help="Output sphinx changelog") + + args = parser.parse_args(argv) # In this example we wont use the args + + if not argv: + parser.print_help() + return + + if args.dump: + api_dump() + else: + if args.api_from and args.api_to and args.api_out: + api_changelog(args.api_from, args.api_to, args.api_out) + else: + print("Error: --api_from/api_to/api_out args needed") + parser.print_help() + return + + print("batch job finished, exiting") + + +if __name__ == "__main__": + main() diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index fde275c7190..2ec665180c5 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -984,6 +984,15 @@ def rna2sphinx(BASEPATH): fw(" bge.render.rst\n\n") fw(" bge.events.rst\n\n") + # rna generated change log + fw("========\n") + fw("API Info\n") + fw("========\n") + fw("\n") + fw(".. toctree::\n") + fw(" :maxdepth: 1\n\n") + fw(" change_log.rst\n\n") + file.close() # internal modules @@ -1088,6 +1097,8 @@ def rna2sphinx(BASEPATH): shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bge.render.rst"), BASEPATH) shutil.copy2(os.path.join(BASEPATH, "..", "rst", "bge.events.rst"), BASEPATH) + shutil.copy2(os.path.join(BASEPATH, "..", "rst", "change_log.rst"), BASEPATH) + if 0: filepath = os.path.join(BASEPATH, "bpy.rst") file = open(filepath, "w") -- cgit v1.2.3