MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / CreateActor

Method CreateActor

Source/Engine/Level/SceneObjectsFactory.cpp:360–429  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

358}
359
360Actor* SceneObjectsFactory::CreateActor(int32 typeId, const Guid& id)
361{
362 // [Deprecated: 18.07.2019 expires 18.07.2020]
363
364 // Convert deprecated typeId into actor type name
365 StringAnsiView typeName;
366 switch (typeId)
367 {
368#define CASE(type, typeId) case typeId: typeName = type; break;
369 CASE("FlaxEngine.StaticModel", 1);
370 CASE("FlaxEngine.Camera", 2);
371 CASE("FlaxEngine.EmptyActor", 3);
372 CASE("FlaxEngine.DirectionalLight", 4);
373 CASE("FlaxEngine.PointLight", 5);
374 CASE("FlaxEngine.Skybox", 6);
375 CASE("FlaxEngine.EnvironmentProbe", 7);
376 CASE("FlaxEngine.BoxBrush", 8);
377 CASE("FlaxEngine.Scene", 9);
378 CASE("FlaxEngine.Sky", 10);
379 CASE("FlaxEngine.RigidBody", 11);
380 CASE("FlaxEngine.SpotLight", 12);
381 CASE("FlaxEngine.PostFxVolume", 13);
382 CASE("FlaxEngine.BoxCollider", 14);
383 CASE("FlaxEngine.SphereCollider", 15);
384 CASE("FlaxEngine.CapsuleCollider", 16);
385 CASE("FlaxEngine.CharacterController", 17);
386 CASE("FlaxEngine.FixedJoint", 18);
387 CASE("FlaxEngine.DistanceJoint", 19);
388 CASE("FlaxEngine.HingeJoint", 20);
389 CASE("FlaxEngine.SliderJoint", 21);
390 CASE("FlaxEngine.SphericalJoint", 22);
391 CASE("FlaxEngine.D6Joint", 23);
392 CASE("FlaxEngine.MeshCollider", 24);
393 CASE("FlaxEngine.SkyLight", 25);
394 CASE("FlaxEngine.ExponentialHeightFog", 26);
395 CASE("FlaxEngine.TextRender", 27);
396 CASE("FlaxEngine.AudioSource", 28);
397 CASE("FlaxEngine.AudioListener", 29);
398 CASE("FlaxEngine.AnimatedModel", 30);
399 CASE("FlaxEngine.BoneSocket", 31);
400 CASE("FlaxEngine.Decal", 32);
401 CASE("FlaxEngine.UICanvas", 33);
402 CASE("FlaxEngine.UIControl", 34);
403 CASE("FlaxEngine.Terrain", 35);
404 CASE("FlaxEngine.Foliage", 36);
405 CASE("FlaxEngine.NavMeshBoundsVolume", 37);
406 CASE("FlaxEngine.NavLink", 38);
407 CASE("FlaxEngine.ParticleEffect", 39);
408#undef CASE
409 default:
410 LOG(Warning, "Unknown actor type id \'{0}\'", typeId);
411 return nullptr;
412 }
413
414 const ScriptingTypeHandle type = Scripting::FindScriptingType(typeName);
415 if (type)
416 {
417 const ScriptingObjectSpawnParams params(id, type);

Callers

nothing calls this directly

Calls 7

FindScriptingTypeFunction · 0.85
StringClass · 0.50
SpawnMethod · 0.45
GetTypeMethod · 0.45
ToStringMethod · 0.45
GetMethod · 0.45
LengthMethod · 0.45

Tested by

no test coverage detected