face

Used for operations concerning a single face of a polygon mesh.


xshade
shape
face

List of Methods

flip Flips the orientation of the normals
get_face_uv Returns the face UV
get_vertex_color Returns the vertex color of the face
remove Deletes the face
set_face_uv Sets the face UV
set_vertex_color Sets the vertex color of the face

List of Properties

active The selection state
active_order The order in which it was selected
distance_uv List of distance UV coordinates
has_uv Whether it has UV coordinates or not
normals The face normals
number_of_vertices The number of vertices composing the face
parameter_uv List of parameter UV coordinates
shading_normals The normals of automatically set faces
sub_surface_index Sub-surface object index
vertex_indices Tuple of vertex numbers composing the face




Used after getting a face of the selected object with a method such as xshade.scene().active_shape().face(0).

Method Details

flip

Flips the orientation of the normals.

xshade.scene().active_shape().face(0).flip()

get_face_uv

Returns the face UV.
Arguments :
  int : the index of the UV layer
Arguments :
  int : the index of the vertex that forms the face

#Output the vertex UV of UV1 (distance correction) number 1
print xshade.scene().active_shape().face(0).get_face_uv(0,1)

get_vertex_color

Returns the vertex color of the face.
Arguments :
  int : the index of the vertex color layer
Arguments :
  int : the index of the vertex that forms the face

#Output the vertex color of vertex 0 of the first vertex color layer
print xshade.scene().active_shape().face(0).get_vertex_color(0,0)

remove

Deletes the face.

xshade.scene().active_shape().face(0).remove()

set_face_uv

Sets the face UV.
Arguments :
  int : the index of the UV layer
Arguments :
  int : the index of the vertex that forms the face
Arguments :
  float2 : the UV value

#Set UV coordinates [0.5, 0.5] to vertex 0 of UV1 (distance correction)
xshade.scene().active_shape().face(0).set_face_uv(0,0, [0.5, 0.5])

set_vertex_color

Sets the vertex color of the face.
Arguments :
  int : the index of the vertex color layer
Arguments :
  int : the index of the vertex that forms the face
Arguments :
  float4 : vertex color (RGBA)

#Set vertex 0 to grey (0.5, 0.5, 0.5, 1.0) on the first vertex color layer
xshade.scene().active_shape().face(0).set_vertex_color(0,0, [0.5, 0.5, 0.5, 1.0])

Property Details

active

The selection state.

  • Get
  • Set

Type :
  bool
If the Figure Window or object is not updated after setting this value, the change will not be reflected immediately.

#Select face 0 and update the object
xshade.scene().active_shape().face(0).active = True
xshade.scene().active_shape().update()

active_order

The order in which it was selected.

  • Get
  • Set

Type :
  int

print xshade.scene().active_shape().face(0).active_order

distance_uv

List of distance UV coordinates.

  • Get
  • Set

Type :
  float2 : Tuple/list of two float values for each vertex
The list of distance UV coordinates assigned to the vertices of the face.
If the polygon mesh was generated via conversion from a curved surface, the normalized distances of the u-v orientation of the original curved surface are set as the default values.

print xshade.scene().active_shape().face(0).distance_uv

has_uv

Whether it has UV coordinates or not.

  • Get
  • Set

Type :
  bool

print xshade.scene().active_shape().face(0).has_uv

normals

The face normals

  • Get
  • Set

Type :
  float3 : tuple of normals of the vertices forming the face
If not set, returns an empty tuple.
By setting an array of normals of the same number as the number of vertices that compose the face, afterwards this can be called using this method.
Normal values can be anything, or values set automatically with polygon_mesh setup_normalcan be gotten with shading_normals or vertex normal.

#Set and output the normals of face 0
#Set the normal of the selected object
xshade.scene().active_shape().setup_normal()
#Get the tuple of vertex numbers the compose face 0
nface = 0
v_index = xshade.scene().active_shape().face(nface).vertex_indices
#Combine the normals of each vertex that composes the face into an array
nl_normals = []
for i in v_index:
	nl_normals.append(xshade.scene().active_shape().vertex(i).normal)
#Set the array of normals to face 0
xshade.scene().active_shape().face(nface).normals = nl_normals
#Output the set values to confirm
print xshade.scene().active_shape().face(nface).normals

number_of_vertices

The number of vertices composing the face.

  • Get
  • Set

Type :
  int

print xshade.scene().active_shape().face(0).number_of_vertices

parameter_uv

List of parameter UV coordinates.

  • Get
  • Set

Type :
  float2 : Tuple/list of two float values for each vertex
The list of parameter UV coordinates assigned to the vertices of the face.
If the polygon mesh was generated via conversion from a curved surface, the u-v parameter values of the original curved surface are set as the default values.

print xshade.scene().active_shape().face(0).parameter_uv

shading_normals

The normals of automatically set faces

  • Get

Type :
  float3 : tuple of normals of the vertices forming the face
Returns the normal vector calculated with polygon_mesh setup_normal.
If the normal vector's value has been set explicitly, returns the same value as normals.

#Set and output the normals of the face
xshade.scene().active_shape().setup_normal()
for i in range(xshade.scene().active_shape().number_of_faces):
	print xshade.scene().active_shape().face(i).shading_normals

sub_surface_index

Sub-surface object index.

  • Get
  • Set

Type :
  int
The surface attributes of the sub-object specified by the index value are assigned to this face.
The default value is -1, the state of no value assigned.

print xshade.scene().active_shape().face(0).sub_surface_index

vertex_indices

Tuple of vertex numbers composing the face.

  • Get
  • Set

Type :
  int tuple

print xshade.scene().active_shape().face(0).vertex_indices