diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2010-04-12 07:06:49 +0400 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2010-04-12 07:06:49 +0400 |
commit | 7135edb75daca55f0ab5e3b601fd73d486c9d060 (patch) | |
tree | 84a99cbd70c98b7b686c00aeed79b69ad5df4d8a /source/blender | |
parent | 091f70e92d2160f0326ec75ed175fc206b2477b9 (diff) |
BGE: TexFace panel (from patch #21780 from Mitchell Stokes + some changes)
the patch exposes a rna property to get the active edit mode face. This is a hack.
However it's a small patch (a.k.a. easy to revert later if needed).
The official plan is to wait for BMesh before tackling it properly. Nevertheless TexFace panel is really important for BGE.
Missing: operators to copy the current parameters to other selected faces.
* note: what I changed from the original patch is the UI script. The pool wasn't defined and it was using tabs.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/makesrna/intern/rna_mesh.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index ce8001c8ecd..0c137504fe0 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -46,6 +46,8 @@ #include "BKE_mesh.h" #include "BKE_utildefines.h" +#include "ED_mesh.h" /* XXX Bad level call */ + #include "WM_api.h" #include "WM_types.h" @@ -458,6 +460,22 @@ static void rna_Mesh_active_uv_texture_index_range(PointerRNA *ptr, int *min, in *max= MAX2(0, *max); } +static PointerRNA rna_Mesh_active_mtface_get(PointerRNA *ptr) +{ + Mesh *me= (Mesh*)ptr->data; + EditMesh *em= BKE_mesh_get_editmesh(me); + MTFace *tf; + + if (em && EM_texFaceCheck(em)) + { + tf = EM_get_active_mtface(em, NULL, NULL, 1); + + return rna_pointer_inherit_refine(ptr, &RNA_MeshTextureFace, tf); + } + + return rna_pointer_inherit_refine(ptr, &RNA_MeshTextureFace, NULL); +} + static void rna_MeshTextureFace_uv1_get(PointerRNA *ptr, float *values) { MTFace *mtface= (MTFace*)ptr->data; @@ -1599,6 +1617,12 @@ static void rna_def_mesh_faces(BlenderRNA *brna, PropertyRNA *cprop) prop= RNA_def_property(srna, "active", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "act_face"); RNA_def_property_ui_text(prop, "Active Face", "The active face for this mesh"); + + prop= RNA_def_property(srna, "active_tface", PROP_POINTER, PROP_UNSIGNED); + RNA_def_property_struct_type(prop, "MeshTextureFace"); + RNA_def_property_pointer_funcs(prop, "rna_Mesh_active_mtface_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Active Texture Face", "Active Texture Face"); + RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); } |