Table of Contents

Class ShapeElement

Namespace
Vintagestory.API.Common
Assembly
VintagestoryAPI.dll

A shape element built from JSON data within the model.

[JsonObject(MemberSerialization.OptIn)]
public class ShapeElement
Inheritance
ShapeElement
Inherited Members
Extension Methods

Fields

AttachmentPoints

The attachment points for this shape.

[JsonProperty]
public AttachmentPoint[] AttachmentPoints

Field Value

AttachmentPoint[]

Children

The child shapes of this shape element

[JsonProperty]
public ShapeElement[] Children

Field Value

ShapeElement[]

ClimateColorMap

[JsonProperty]
public string ClimateColorMap

Field Value

string

Color

For entity animations

public int Color

Field Value

int

DamageEffect

public float DamageEffect

Field Value

float

DisableRandomDrawOffset

Set this to true to disable randomDrawOffset and randomRotations on this specific element (e.g. used for the ice element of Coopers Reeds in Ice)

[JsonProperty]
public bool DisableRandomDrawOffset

Field Value

bool

Faces

The faces of the shape element by name (will normally be null except during object deserialization: use FacesResolved instead!)

[JsonProperty]
[Obsolete("Use FacesResolved instead")]
public Dictionary<string, ShapeElementFace> Faces

Field Value

Dictionary<string, ShapeElementFace>

FacesResolved

An array holding the faces of this shape element in BlockFacing order: North, East, South, West, Up, Down. May be null if not present or not enabled.

public ShapeElementFace[] FacesResolved

Field Value

ShapeElementFace[]

From

[JsonProperty]
public double[] From

Field Value

double[]

GradientShade

[JsonProperty]
public bool GradientShade

Field Value

bool

JointId

The id of the joint attached to the parent element.

public int JointId

Field Value

int

Logger

A static reference to the logger (null on a server) - we don't want to hold a reference to the platform or api in every ShapeElement

public static ILogger Logger

Field Value

ILogger

Name

The name of the ShapeElement

[JsonProperty]
public string Name

Field Value

string

ParentElement

The parent element reference for this shape.

public ShapeElement ParentElement

Field Value

ShapeElement

RenderPass

[JsonProperty]
public short RenderPass

Field Value

short

RotationOrigin

The origin point for rotation.

[JsonProperty]
public double[] RotationOrigin

Field Value

double[]

RotationX

The forward vertical rotation of the shape element.

[JsonProperty]
public double RotationX

Field Value

double

RotationY

The forward vertical rotation of the shape element.

[JsonProperty]
public double RotationY

Field Value

double

RotationZ

The left/right tilt of the shape element

[JsonProperty]
public double RotationZ

Field Value

double

ScaleX

How far away are the left/right sides of the shape from the center

[JsonProperty]
public double ScaleX

Field Value

double

ScaleY

How far away are the top/bottom sides of the shape from the center

[JsonProperty]
public double ScaleY

Field Value

double

ScaleZ

How far away are the front/back sides of the shape from the center.

[JsonProperty]
public double ScaleZ

Field Value

double

SeasonColorMap

[JsonProperty]
public string SeasonColorMap

Field Value

string

Shade

Whether or not the shape element is shaded.

[JsonProperty]
public bool Shade

Field Value

bool

StepParentName

The "remote" parent for this element

[JsonProperty]
public string StepParentName

Field Value

string

To

[JsonProperty]
public double[] To

Field Value

double[]

ZOffset

[JsonProperty]
public short ZOffset

Field Value

short

inverseModelTransform

public float[] inverseModelTransform

Field Value

float[]

locationForLogging

public static object locationForLogging

Field Value

object

Methods

CacheInverseTransformMatrix()

public void CacheInverseTransformMatrix()

CacheInverseTransformMatrixRecursive()

public void CacheInverseTransformMatrixRecursive()

Clone()

public ShapeElement Clone()

Returns

ShapeElement

GetInverseModelMatrix()

Returns the full inverse model matrix (includes all parent transforms)

public float[] GetInverseModelMatrix()

Returns

float[]

GetLocalTransformMatrix(int, float[], ElementPose)

public float[] GetLocalTransformMatrix(int animVersion, float[] output = null, ElementPose tf = null)

Parameters

animVersion int
output float[]
tf ElementPose

Returns

float[]

GetParentPath()

Walks the element tree and collects all parents, starting with the root element

public List<ShapeElement> GetParentPath()

Returns

List<ShapeElement>

SetJointIdRecursive(int)

public void SetJointIdRecursive(int jointId)

Parameters

jointId int

WalkRecursive(Action<ShapeElement>)

public void WalkRecursive(Action<ShapeElement> onElem)

Parameters

onElem Action<ShapeElement>