Fundamentos do arsenal. Traços

Traços , como você deve ter adivinhado em posts anteriores, é o sistema de script no Armory. Se você trabalhou com o mecanismo de código-fonte, provavelmente se lembra daqueles cubos rosa - eram chamados de entidades. Assim é conosco, a essência é a mesma. Em nosso caso, as características usadas só podem ser visualizadas no Outliner, alternando para a visualização Dados Órfãos nas Coleções . Isso é extremamente inconveniente porque não há exibição visual nos scripts da cena.





Tipos de traços





As características são divididas em vários tipos:





  • Haxe - escrever scripts do zero em Haxe.





  • Wasm - consulte WebAssembly .





  • UI - funciona pela interface do usuário.





  • Scripts Haxe empacotados - prontos / empacotados.





  • 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









    • iron.object.Object





    • iron.object.CameraObject





    • iron.object.LightObject





    • iron.object.MeshObject





    • iron.object.SpeakerObject





  • :





    • iron.math.Vec2





    • iron.math.Vec3





    • iron.math.Vec4





:





 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 .





  1. Armory Engine.





  2. Armory





  3. Wasm no Armory Engine












All Articles