forked from bartvdbraak/blender
readonly face normal option eg.
me.faces[0].normal
This commit is contained in:
parent
d0422dec35
commit
9dc819a56d
@ -130,12 +130,10 @@ def write(filename, scene, ob, \
|
||||
|
||||
|
||||
smooth = f.smooth
|
||||
# XXX need face normals
|
||||
"""
|
||||
if not smooth:
|
||||
normal = tuple(f.no)
|
||||
normal = tuple(f.normal)
|
||||
normal_key = rvec3d(normal)
|
||||
"""
|
||||
|
||||
if faceUV:
|
||||
uv = active_uv_layer[i]
|
||||
uv = uv.uv1, uv.uv2, uv.uv3, uv.uv4 # XXX - crufty :/
|
||||
@ -149,12 +147,10 @@ def write(filename, scene, ob, \
|
||||
pf= ply_faces[i]
|
||||
for j, vidx in enumerate(f_verts):
|
||||
v = mesh_verts[vidx]
|
||||
"""
|
||||
|
||||
if smooth:
|
||||
normal= tuple(v.no)
|
||||
normal= tuple(v.normal)
|
||||
normal_key = rvec3d(normal)
|
||||
"""
|
||||
normal_key = None # XXX
|
||||
|
||||
if faceUV:
|
||||
uvcoord= uv[j][0], 1.0-uv[j][1]
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
#include "BLI_editVert.h"
|
||||
#include "BLI_arithb.h"
|
||||
|
||||
#include "BKE_customdata.h"
|
||||
#include "BKE_depsgraph.h"
|
||||
@ -110,6 +111,17 @@ static void rna_MEdge_crease_set(PointerRNA *ptr, float value)
|
||||
medge->crease= (char)(CLAMPIS(value*255.0f, 0, 255));
|
||||
}
|
||||
|
||||
static void rna_MeshFace_normal_get(PointerRNA *ptr, float *values)
|
||||
{
|
||||
Mesh *me= (Mesh*)ptr->id.data;
|
||||
MFace *mface= (MFace*)ptr->data;
|
||||
|
||||
if(mface->v4)
|
||||
CalcNormFloat4(me->mvert[mface->v1].co, me->mvert[mface->v2].co, me->mvert[mface->v3].co, me->mvert[mface->v4].co, values);
|
||||
else
|
||||
CalcNormFloat(me->mvert[mface->v1].co, me->mvert[mface->v2].co, me->mvert[mface->v3].co, values);
|
||||
}
|
||||
|
||||
/* notice red and blue are swapped */
|
||||
static void rna_MeshColor_color1_get(PointerRNA *ptr, float *values)
|
||||
{
|
||||
@ -892,6 +904,13 @@ static void rna_def_mface(BlenderRNA *brna)
|
||||
prop= RNA_def_property(srna, "smooth", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_SMOOTH);
|
||||
RNA_def_property_ui_text(prop, "Smooth", "");
|
||||
|
||||
prop= RNA_def_property(srna, "normal", PROP_FLOAT, PROP_VECTOR);
|
||||
RNA_def_property_array(prop, 3);
|
||||
RNA_def_property_range(prop, -1.0f, 1.0f);
|
||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_float_funcs(prop, "rna_MeshFace_normal_get", NULL, NULL);
|
||||
RNA_def_property_ui_text(prop, "face normal", "local space unit length normal vector for this face");
|
||||
}
|
||||
|
||||
static void rna_def_mtface(BlenderRNA *brna)
|
||||
|
Loading…
Reference in New Issue
Block a user