Los rasgos , como habrás adivinado en publicaciones anteriores, es el sistema de secuencias de comandos en Armory. Si trabajó con el motor de origen, probablemente recuerde estos cubos rosas, allí se llamaban Entidades. Así es con nosotros, la esencia es la misma. En nuestro caso, los rasgos utilizados solo se pueden ver en el Esquema cambiando al modo de visualización de Datos huérfanos en Colecciones . Esto es extremadamente inconveniente porque no hay visualización en los guiones en la escena.
Tipos de rasgos
Traits :
Haxe - Haxe.
Wasm - . WebAssembly.
UI - .
Bundled - / Haxe.
Nodes - Logic Editor ( blueprints UE4).
(!) .
Fake User
Logic Editor traits - . , Blender . trait . , .
Traits Events
Trait :
Trait.notifyOnAdd() - trait.
Trait.notifyOnInit() - .
Trait.notifyOnRemove() - .
Trait.notifyOnUpdate() - .
Trait.notifyOnRender() - .
Trait.notifyOnRender2D() - 2D.
. , onInit . trait , Scene.active.notifyOnInit() - .
traits
Blender. @prop. var . Final , trait Haxe Reflection API, .
:
:
Int
Float
Boolean
String
:
:
package arm;
// See below ("Object data types")
import iron.object.CameraObject;
import iron.math.Vec2;
import iron.math.Vec3;
import iron.math.Vec4;
class MyTrait extends iron.Trait {
// Primitive data types
@prop
var intValue: Int = 40; // Type annotation possible, but not required
@prop
var floatValue = 3.14;
@prop
var stringValue = "Hello world!";
@prop
var booleanValue = true;
// Object data types
@prop
var objValue: iron.object.Object; // Needs type annotation to be recognized
@prop
var camObjValue: CameraObject; // Type can be imported (see above)...
@prop
var lightObjValue: iron.object.LightObject; // .. or not, both will work
@prop
var meshObjValue: iron.object.MeshObject;
@prop
var speakerObjValue: iron.object.SpeakerObject;
// Vector data types
@prop
var vector2DValue: Vec2 = new Vec2(0.2, 0.5); // Initialization possible...
@prop
var vector3DValue: Vec3; //... but not required
@prop
var vector4DValue = new Vec4(1, 2, 3, 4);
// Not visible in Blender, `@prop` is missing
var notVisibleValue = 0.0;
// ...
}
:
@prop:
@prop
, , .
traits sources/ arm. - , - . .
, Haxe package syntax traits. trait general.BoxBehavior - Sources/arm/general «BoxBehavior.hx»
, traits : «general.terrain.TerrainCollider» «TerrainCollider.hx» «Sources/arm/ general/terrain».
, Class .