PyDoc: use complete sentences in comments for templates & examples

This commit is contained in:
Campbell Barton
2025-04-02 23:46:58 +00:00
parent d001e143a9
commit b2c57fd877
58 changed files with 181 additions and 179 deletions

View File

@@ -19,7 +19,7 @@ from bpy.types import Operator
class ExportSomeData(Operator, ExportHelper):
"""This appears in the tooltip of the operator and in the generated docs"""
bl_idname = "export_test.some_data" # important since its how bpy.ops.import_test.some_data is constructed
bl_idname = "export_test.some_data" # Important since its how bpy.ops.import_test.some_data is constructed.
bl_label = "Export Some Data"
# ExportHelper mix-in class uses this.
@@ -72,5 +72,5 @@ def unregister():
if __name__ == "__main__":
register()
# test call
# Test call.
bpy.ops.export_test.some_data('INVOKE_DEFAULT')

View File

@@ -7,7 +7,7 @@ def read_some_data(context, filepath, use_some_setting):
data = f.read()
f.close()
# would normally load the data here
# Would normally load the data here.
print(data)
return {'FINISHED'}
@@ -75,5 +75,5 @@ def unregister():
if __name__ == "__main__":
register()
# test call
# Test call.
bpy.ops.import_test.some_data('INVOKE_DEFAULT')

View File

@@ -33,7 +33,7 @@ def add_box(width, height, depth):
(4, 0, 3, 7),
]
# apply size
# Apply size.
for i, v in enumerate(verts):
verts[i] = v[0] * width, v[1] * depth, v[2] * height
@@ -87,7 +87,7 @@ class AddBox(bpy.types.Operator, AddObjectHelper):
bm.to_mesh(mesh)
mesh.update()
# add the mesh as an object into the scene with this utility module
# Add the mesh as an object into the scene with this utility module.
from bpy_extras import object_utils
object_utils.object_data_add(context, mesh, operator=self)
@@ -112,5 +112,5 @@ def unregister():
if __name__ == "__main__":
register()
# test call
# Test call.
bpy.ops.mesh.primitive_box_add()

View File

@@ -9,11 +9,11 @@ def main(context):
uv_layer = bm.loops.layers.uv.verify()
# adjust uv coordinates
# Adjust UV coordinates.
for face in bm.faces:
for loop in face.loops:
loop_uv = loop[uv_layer]
# use xy position of the vertex as a uv coordinate
# Use XY position of the vertex as a uv coordinate.
loop_uv.uv = loop.vert.co.xy
bmesh.update_edit_mesh(me)
@@ -52,5 +52,5 @@ def unregister():
if __name__ == "__main__":
register()
# test call
# Test call.
bpy.ops.uv.simple_operator()

View File

@@ -54,5 +54,5 @@ def unregister():
if __name__ == "__main__":
register()
# test call
# Test call.
bpy.ops.object.modal_operator('INVOKE_DEFAULT')

View File

@@ -14,7 +14,7 @@ class ModalTimerOperator(bpy.types.Operator):
return {'CANCELLED'}
if event.type == 'TIMER':
# change theme color, silly!
# Change theme color, silly!
color = context.preferences.themes[0].view_3d.space.gradients.high_gradient
color.s = 1.0
color.h += 0.01
@@ -50,5 +50,5 @@ def unregister():
if __name__ == "__main__":
register()
# test call
# Test call.
bpy.ops.wm.modal_timer_operator()

View File

@@ -38,5 +38,5 @@ def unregister():
if __name__ == "__main__":
register()
# test call
# Test call.
bpy.ops.object.simple_operator()

View File

@@ -48,7 +48,7 @@ class UIListPanelExample(bpy.types.Panel):
obj = context.object
# template_list now takes two new args.
# `template_list` now takes two new arguments.
# The first one is the identifier of the registered UIList to use (if you want only the default list,
# with no custom draw code, use "UI_UL_list").
layout.template_list("MATERIAL_UL_matslots_example", "", obj, "material_slots", obj, "active_material_index")