rename Mesh.uv_loop_layers --> uv_layers
authorCampbell Barton <ideasman42@gmail.com>
Sun, 22 Apr 2012 23:51:50 +0000 (23:51 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 22 Apr 2012 23:51:50 +0000 (23:51 +0000)
add filtering for document generator to support --partial bpy.types.SomeType

doc/python_api/rst/include__bmesh.rst
doc/python_api/rst/info_gotcha.rst
doc/python_api/sphinx_doc_gen.py
release/scripts/startup/bl_operators/mesh.py
release/scripts/startup/bl_operators/object.py
release/scripts/startup/bl_operators/uvcalc_follow_active.py
release/scripts/startup/bl_operators/uvcalc_lightmap.py
release/scripts/startup/bl_operators/uvcalc_smart_project.py
source/blender/makesrna/intern/rna_mesh.c
source/tests/bl_mesh_modifiers.py

index 24f113e7b50e60faf7384be8d392713e3420b65d..212ab4e4708466c3092375b79ca6b00ba0061758 100644 (file)
@@ -32,12 +32,11 @@ For an overview of BMesh data types and how they reference each other see:
 
 .. warning::
 
-   TODO Items Are
+   TODO items are...
 
    * add access to BMesh **walkers**
-   * add a way to re-tessellate an editmode bmesh.
-   * add deform vert custom-data access.
-
+   * add api for calling BMesh operators (unrelated to bpy.ops)
+   * add custom-data manipulation functions add/remove/rename.
 
 Example Script
 --------------
@@ -110,8 +109,8 @@ Here are some examples ...
    shape_lay = bm.verts.layers.shape["Key.001"]
 
    for vert in bm.verts:
-               shape = vert[shape_lay]
-        print("Vert Shape: %f, %f, %f" % (shape.x, shape.y, shape.z))
+       shape = vert[shape_lay]
+       print("Vert Shape: %f, %f, %f" % (shape.x, shape.y, shape.z))
 
 
 .. code-block:: python
@@ -125,7 +124,7 @@ Here are some examples ...
 
    for vert in bm.verts:
        dvert = vert[dvert_lay]
-               
+
        if group_index in dvert:
            print("Weight %f" % dvert[group_index])
        else:
index 25ef5175976fa90c5f899bf7ad127984d92ccbc2..eb312799b41a59a85d8e495942f8b9ef97a6c1d1 100644 (file)
@@ -132,6 +132,8 @@ write useful tools in python which are also fast to execute while in edit-mode.
 For the time being this limitation just has to be worked around but we're aware its frustrating needs to be addressed.
 
 
+.. _info_gotcha_mesh_faces:
+
 NGons and Tessellation Faces
 ============================
 
index 54a3868c0d7de74e8581922bbeca42fb8c8e0d5f..bfef94b35d7d79df486ad0c28e32c9178ead6537 100644 (file)
@@ -230,10 +230,10 @@ if not ARGS.partial:
 
 else:
     # can manually edit this too:
-    FILTER_BPY_OPS = ("import.scene", )  # allow
-    FILTER_BPY_TYPES = ("bpy_struct", "Operator", "ID")  # allow
+    #FILTER_BPY_OPS = ("import.scene", )  # allow
+    #FILTER_BPY_TYPES = ("bpy_struct", "Operator", "ID")  # allow
     EXCLUDE_INFO_DOCS = True
-    EXCLUDE_MODULES = (
+    EXCLUDE_MODULES = [
         "aud",
         "bge",
         "bge.constraints",
@@ -261,7 +261,7 @@ else:
         "mathutils",
         "mathutils.geometry",
         "mathutils.noise",
-    )
+        ]
 
     # ------
     # Filter
@@ -269,7 +269,18 @@ else:
     # TODO, support bpy.ops and bpy.types filtering
     import fnmatch
     m = None
-    EXCLUDE_MODULES = tuple([m for m in EXCLUDE_MODULES if not fnmatch.fnmatchcase(m, ARGS.partial)])
+    EXCLUDE_MODULES = [m for m in EXCLUDE_MODULES if not fnmatch.fnmatchcase(m, ARGS.partial)]
+
+    # special support for bpy.types.XXX
+    FILTER_BPY_OPS = tuple([m[8:] for m in ARGS.partial.split(":") if m.startswith("bpy.ops.")])
+    if FILTER_BPY_OPS:
+        EXCLUDE_MODULES.remove("bpy.ops")
+
+    FILTER_BPY_TYPES = tuple([m[10:] for m in ARGS.partial.split(":") if m.startswith("bpy.types.")])
+    if FILTER_BPY_TYPES:
+        EXCLUDE_MODULES.remove("bpy.types")
+
+    print(FILTER_BPY_TYPES)
 
     EXCLUDE_INFO_DOCS = (not fnmatch.fnmatchcase("info", ARGS.partial))
 
index a54de25dbc7b58ffe1af99dfe2126db4a69026df..4ed43a68e4811d02b5d5e4983132d8b16cc31094 100644 (file)
@@ -79,7 +79,7 @@ class MeshMirrorUV(Operator):
         polys = mesh.polygons
         loops = mesh.loops
         verts = mesh.vertices
-        uv_loops = mesh.uv_loop_layers.active.data
+        uv_loops = mesh.uv_layers.active.data
         nbr_polys = len(polys)
 
         mirror_pm = {}
index 4ade55c0af678872a0f0d2a36bedfe0d877f6629..8268d7a9514ff55f03545cf82b9fd89debbd2926 100644 (file)
@@ -489,7 +489,7 @@ class JoinUVs(Operator):
 
             # seems to be the fastest way to create an array
             uv_array = array.array('f', [0.0] * 2) * nbr_loops
-            mesh.uv_loop_layers.active.data.foreach_get("uv", uv_array)
+            mesh.uv_layers.active.data.foreach_get("uv", uv_array)
 
             objects = context.selected_editable_objects[:]
 
@@ -516,10 +516,10 @@ class JoinUVs(Operator):
                                                ),
                                            )
                             else:
-                                uv_other = mesh_other.uv_loop_layers.active
+                                uv_other = mesh_other.uv_layers.active
                                 if not uv_other:
                                     mesh_other.uv_textures.new()
-                                    uv_other = mesh_other.uv_loop_layers.active
+                                    uv_other = mesh_other.uv_layers.active
                                     if not uv_other:
                                         self.report({'ERROR'}, "Could not add "
                                                     "a new UV map tp object "
index 99ae5a3e436960a0bba9d6aa861e8596bc914e9b..d6f657683a58d65caf876ba63b1b959dc9c567ad 100644 (file)
@@ -59,7 +59,7 @@ def extend(obj, operator, EXTEND_MODE):
         vidx_source = face_source.vertices
         vidx_target = face_target.vertices
 
-        uv_layer = me.uv_loop_layers.active.data
+        uv_layer = me.uv_layers.active.data
         uvs_source = [uv_layer[i].uv for i in face_source.loop_indices]
         uvs_target = [uv_layer[i].uv for i in face_target.loop_indices]
 
index 417ae89218c7545984df914eab6fdcd4b457bff8..3bd0d6fa4ccbc7a62267fec41fae8d91f65befb2 100644 (file)
@@ -88,7 +88,7 @@ class prettyface(object):
             self.children = []
 
         else:  # blender face
-            uv_layer = data.id_data.uv_loop_layers.active.data
+            uv_layer = data.id_data.uv_layers.active.data
             self.uv = [uv_layer[i].uv for i in data.loop_indices]
 
             # cos = [v.co for v in data]
@@ -158,7 +158,7 @@ class prettyface(object):
                 I = [i for a, i in angles_co]
 
                 #~ fuv = f.uv
-                uv_layer = f.id_data.uv_loop_layers.active.data
+                uv_layer = f.id_data.uv_layers.active.data
                 fuv = [uv_layer[i].uv for i in f.loops]  # XXX25
 
                 if self.rot:
index bb3086f711be03d90580b898d072386eb755bba1..1e18825a155ea63a21267ad32488011e13b62645 100644 (file)
@@ -889,7 +889,7 @@ def main(context,
         if not me.uv_textures: # Mesh has no UV Coords, don't bother.
             me.uv_textures.new()
 
-        uv_layer = me.uv_loop_layers.active.data
+        uv_layer = me.uv_layers.active.data
         me_verts = list(me.vertices)
 
         if USER_ONLY_SELECTED_FACES:
index 78f621947356ac171c98c5f37ec9b0568a8026d1..d5e79ab971cb785a789d342239b6eb010857c511 100644 (file)
@@ -509,19 +509,19 @@ static void rna_CustomDataLayer_clone_set(PointerRNA *ptr, CustomData *data, int
        CustomData_set_layer_clone_index(data, type, n);
 }
 
-/* uv_loop_layers */
+/* uv_layers */
 
-DEFINE_CUSTOMDATA_LAYER_COLLECTION(uv_loop_layer, ldata, CD_MLOOPUV)
-DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_loop_layer, ldata, CD_MLOOPUV, active, MeshUVLoopLayer)
-DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_loop_layer, ldata, CD_MLOOPUV, clone, MeshUVLoopLayer)
-DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_loop_layer, ldata, CD_MLOOPUV, stencil, MeshUVLoopLayer)
-DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_loop_layer, ldata, CD_MLOOPUV, render, MeshUVLoopLayer)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION(uv_layer, ldata, CD_MLOOPUV)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_layer, ldata, CD_MLOOPUV, active, MeshUVLoopLayer)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_layer, ldata, CD_MLOOPUV, clone, MeshUVLoopLayer)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_layer, ldata, CD_MLOOPUV, stencil, MeshUVLoopLayer)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_layer, ldata, CD_MLOOPUV, render, MeshUVLoopLayer)
 
 /* MeshUVLoopLayer */
 
 static char *rna_MeshUVLoopLayer_path(PointerRNA *ptr)
 {
-       return BLI_sprintfN("uv_loop_layer[\"%s\"]", ((CustomDataLayer*)ptr->data)->name);
+       return BLI_sprintfN("uv_layers[\"%s\"]", ((CustomDataLayer*)ptr->data)->name);
 }
 
 static void rna_MeshUVLoopLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
@@ -1089,7 +1089,7 @@ static char *rna_FaceCustomData_data_path(PointerRNA *ptr, char *collection, int
 
 static char *rna_MeshUVLoop_path(PointerRNA *ptr)
 {
-       return rna_LoopCustomData_data_path(ptr, "uv_loop_layers", CD_MLOOPUV);
+       return rna_LoopCustomData_data_path(ptr, "uv_layers", CD_MLOOPUV);
 }
 
 static char *rna_MeshTextureFace_path(PointerRNA *ptr)
@@ -2291,7 +2291,7 @@ static void rna_def_loop_colors(BlenderRNA *brna, PropertyRNA *cprop)
        RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 }
 
-static void rna_def_uv_loop_layers(BlenderRNA *brna, PropertyRNA *cprop)
+static void rna_def_uv_layers(BlenderRNA *brna, PropertyRNA *cprop)
 {
        StructRNA *srna;
        PropertyRNA *prop;
@@ -2306,15 +2306,15 @@ static void rna_def_uv_loop_layers(BlenderRNA *brna, PropertyRNA *cprop)
 
        prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED);
        RNA_def_property_struct_type(prop, "MeshUVLoopLayer");
-       RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_loop_layer_active_get",
-                                      "rna_Mesh_uv_loop_layer_active_set", NULL, NULL);
+       RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_layer_active_get",
+                                      "rna_Mesh_uv_layer_active_set", NULL, NULL);
        RNA_def_property_flag(prop, PROP_EDITABLE);
        RNA_def_property_ui_text(prop, "Active UV loop layer", "Active UV loop layer");
        RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 
        prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
-       RNA_def_property_int_funcs(prop, "rna_Mesh_uv_loop_layer_active_index_get",
-                                  "rna_Mesh_uv_loop_layer_active_index_set", "rna_Mesh_uv_loop_layer_index_range");
+       RNA_def_property_int_funcs(prop, "rna_Mesh_uv_layer_active_index_get",
+                                  "rna_Mesh_uv_layer_active_index_set", "rna_Mesh_uv_layer_index_range");
        RNA_def_property_ui_text(prop, "Active UV loop layer Index", "Active UV loop layer index");
        RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
 }
@@ -2385,7 +2385,7 @@ static void rna_def_polygon_string_layers(BlenderRNA *brna, PropertyRNA *cprop)
        RNA_def_function_return(func, parm);
 }
 
-/* mesh.uv_layers */
+/* mesh.tessface_uv_layers */
 static void rna_def_tessface_uv_textures(BlenderRNA *brna, PropertyRNA *cprop)
 {
        StructRNA *srna;
@@ -2446,7 +2446,7 @@ static void rna_def_uv_textures(BlenderRNA *brna, PropertyRNA *cprop)
        RNA_def_function_return(func, parm);
 
 /*
-       func = RNA_def_function(srna, "remove", "rna_Mesh_uv_layers_remove");
+       func = RNA_def_function(srna, "remove", "rna_Mesh_uv_texture_layers_remove");
        RNA_def_function_ui_description(func, "Remove a vertex color layer");
        RNA_def_function_flag(func, FUNC_USE_REPORTS);
        parm = RNA_def_pointer(func, "layer", "Layer", "", "The layer to remove");
@@ -2519,36 +2519,36 @@ static void rna_def_mesh(BlenderRNA *brna)
                                 "Use another mesh for texture indices (vertex indices must be aligned)");
 
        /* UV loop layers */
-       prop = RNA_def_property(srna, "uv_loop_layers", PROP_COLLECTION, PROP_NONE);
+       prop = RNA_def_property(srna, "uv_layers", PROP_COLLECTION, PROP_NONE);
        RNA_def_property_collection_sdna(prop, NULL, "ldata.layers", "ldata.totlayer");
-       RNA_def_property_collection_funcs(prop, "rna_Mesh_uv_loop_layers_begin", NULL, NULL, NULL,
-                                         "rna_Mesh_uv_loop_layers_length", NULL, NULL, NULL);
+       RNA_def_property_collection_funcs(prop, "rna_Mesh_uv_layers_begin", NULL, NULL, NULL,
+                                         "rna_Mesh_uv_layers_length", NULL, NULL, NULL);
        RNA_def_property_struct_type(prop, "MeshUVLoopLayer");
        RNA_def_property_ui_text(prop, "UV Loop Layers", "All UV loop layers");
-       rna_def_uv_loop_layers(brna, prop);
+       rna_def_uv_layers(brna, prop);
 
-       prop = RNA_def_property(srna, "uv_loop_layer_clone", PROP_POINTER, PROP_UNSIGNED);
+       prop = RNA_def_property(srna, "uv_layer_clone", PROP_POINTER, PROP_UNSIGNED);
        RNA_def_property_struct_type(prop, "MeshUVLoopLayer");
-       RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_loop_layer_clone_get",
-                                      "rna_Mesh_uv_loop_layer_clone_set", NULL, NULL);
+       RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_layer_clone_get",
+                                      "rna_Mesh_uv_layer_clone_set", NULL, NULL);
        RNA_def_property_flag(prop, PROP_EDITABLE);
        RNA_def_property_ui_text(prop, "Clone UV loop layer", "UV loop layer to be used as cloning source");
 
-       prop = RNA_def_property(srna, "uv_loop_layer_clone_index", PROP_INT, PROP_UNSIGNED);
-       RNA_def_property_int_funcs(prop, "rna_Mesh_uv_loop_layer_clone_index_get",
-                                  "rna_Mesh_uv_loop_layer_clone_index_set", "rna_Mesh_uv_loop_layer_index_range");
+       prop = RNA_def_property(srna, "uv_layer_clone_index", PROP_INT, PROP_UNSIGNED);
+       RNA_def_property_int_funcs(prop, "rna_Mesh_uv_layer_clone_index_get",
+                                  "rna_Mesh_uv_layer_clone_index_set", "rna_Mesh_uv_layer_index_range");
        RNA_def_property_ui_text(prop, "Clone UV loop layer Index", "Clone UV loop layer index");
 
-       prop = RNA_def_property(srna, "uv_loop_layer_stencil", PROP_POINTER, PROP_UNSIGNED);
+       prop = RNA_def_property(srna, "uv_layer_stencil", PROP_POINTER, PROP_UNSIGNED);
        RNA_def_property_struct_type(prop, "MeshUVLoopLayer");
-       RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_loop_layer_stencil_get",
-                                      "rna_Mesh_uv_loop_layer_stencil_set", NULL, NULL);
+       RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_layer_stencil_get",
+                                      "rna_Mesh_uv_layer_stencil_set", NULL, NULL);
        RNA_def_property_flag(prop, PROP_EDITABLE);
        RNA_def_property_ui_text(prop, "Mask UV loop layer", "UV loop layer to mask the painted area");
 
-       prop = RNA_def_property(srna, "uv_loop_layer_stencil_index", PROP_INT, PROP_UNSIGNED);
-       RNA_def_property_int_funcs(prop, "rna_Mesh_uv_loop_layer_stencil_index_get",
-                                  "rna_Mesh_uv_loop_layer_stencil_index_set", "rna_Mesh_uv_loop_layer_index_range");
+       prop = RNA_def_property(srna, "uv_layer_stencil_index", PROP_INT, PROP_UNSIGNED);
+       RNA_def_property_int_funcs(prop, "rna_Mesh_uv_layer_stencil_index_get",
+                                  "rna_Mesh_uv_layer_stencil_index_set", "rna_Mesh_uv_layer_index_range");
        RNA_def_property_ui_text(prop, "Mask UV loop layer Index", "Mask UV loop layer index");
 
        /* Tessellated face UV maps - used by renderers */
index 0ab2213c0e137c2aea617cbf2c8a9689318538a8..390679800f60b6c8320245b39516b65fa30cd2b4 100644 (file)
@@ -260,7 +260,7 @@ def mesh_uv_add(obj):
     if IS_BMESH:
         # XXX, odd that we need to do this. until uvs and texface
         # are separated we will need to keep it
-        uv_loops = obj.data.uv_loop_layers[-1]
+        uv_loops = obj.data.uv_layers[-1]
         uv_list = uv_loops.data[:]
         for poly in obj.data.polygons:
             poly_uvs = mesh_bmesh_poly_elems(poly, uv_list)