types.vala 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660
  1. /*
  2. * Copyright (c) 2012-2026 Daniele Bartolini et al.
  3. * SPDX-License-Identifier: GPL-3.0-or-later
  4. */
  5. namespace Crown
  6. {
  7. const string OBJECT_TYPE_ACTOR = "actor";
  8. const string OBJECT_TYPE_ANIMATION_FRAME = "animation_frame";
  9. const string OBJECT_TYPE_ANIMATION_STATE_MACHINE = "animation_state_machine";
  10. const string OBJECT_TYPE_BLOOM = "bloom";
  11. const string OBJECT_TYPE_CAMERA = "camera";
  12. const string OBJECT_TYPE_COLLIDER = "collider";
  13. const string OBJECT_TYPE_FILE = "file";
  14. const string OBJECT_TYPE_FOG = "fog";
  15. const string OBJECT_TYPE_FONT = "font";
  16. const string OBJECT_TYPE_FONT_GLYPH = "font_glyph";
  17. const string OBJECT_TYPE_GLOBAL_LIGHTING = "global_lighting";
  18. const string OBJECT_TYPE_LEVEL = "level";
  19. const string OBJECT_TYPE_LIGHT = "light";
  20. const string OBJECT_TYPE_MATERIAL = "material";
  21. const string OBJECT_TYPE_MESH = "mesh";
  22. const string OBJECT_TYPE_MESH_ANIMATION = "mesh_animation";
  23. const string OBJECT_TYPE_MESH_BONE = "mesh_bone";
  24. const string OBJECT_TYPE_MESH_RENDERER = "mesh_renderer";
  25. const string OBJECT_TYPE_MESH_SKELETON = "mesh_skeleton";
  26. const string OBJECT_TYPE_MOVER = "mover";
  27. const string OBJECT_TYPE_NODE_ANIMATION = "node_animation";
  28. const string OBJECT_TYPE_NODE_TRANSITION = "node_transition";
  29. const string OBJECT_TYPE_SCRIPT = "script";
  30. const string OBJECT_TYPE_SOUND = "sound";
  31. const string OBJECT_TYPE_SOUND_SOURCE = "sound_source";
  32. const string OBJECT_TYPE_SPRITE = "sprite";
  33. const string OBJECT_TYPE_SPRITE_ANIMATION = "sprite_animation";
  34. const string OBJECT_TYPE_SPRITE_FRAME = "sprite_frame";
  35. const string OBJECT_TYPE_SPRITE_RENDERER = "sprite_renderer";
  36. const string OBJECT_TYPE_STATE_MACHINE = "state_machine";
  37. const string OBJECT_TYPE_STATE_MACHINE_NODE = "state_machine_node";
  38. const string OBJECT_TYPE_STATE_MACHINE_VARIABLE = "state_machine_variable";
  39. const string OBJECT_TYPE_TEXTURE = "texture";
  40. const string OBJECT_TYPE_TONEMAP = "tonemap";
  41. const string OBJECT_TYPE_TRANSFORM = "transform";
  42. const string OBJECT_TYPE_UNIT = "unit";
  43. // UI order reference table:
  44. //
  45. // spatial 500
  46. // rendering 1000
  47. // global_lighti 1001
  48. // camera 1100
  49. // light 1101
  50. // mesh 1102
  51. // sprite 1103
  52. // fog 1104
  53. // physics 2000
  54. // collider 2100
  55. // actor 2101
  56. // mover 2102
  57. // animation 3000
  58. // state_machine 3100
  59. // scripting 7000
  60. // lua_script 7100
  61. // post-processing 9000
  62. // bloom 9100
  63. // tonemap 9900
  64. public static void node_name_enum_callback(InputField enum_property, InputEnum combo, Project project)
  65. {
  66. try {
  67. string? path = ResourceId.path(OBJECT_TYPE_MESH, (string?)enum_property.union_value());
  68. Mesh mesh = Mesh.load_from_path(project, path);
  69. combo.clear();
  70. foreach (var node in mesh._nodes)
  71. combo.append(node, node);
  72. } catch (JsonSyntaxError e) {
  73. loge(e.message);
  74. }
  75. }
  76. public static void class_enum_callback(InputField property_enum, InputEnum combo, Project project)
  77. {
  78. try {
  79. string path = ResourceId.path("physics_config", "global");
  80. Hashtable global = SJSON.load_from_path(project.absolute_path(path));
  81. combo.clear();
  82. if (global.has_key("actors")) {
  83. Hashtable obj = (Hashtable)global["actors"];
  84. foreach (var e in obj)
  85. combo.append(e.key, e.key);
  86. }
  87. } catch (JsonSyntaxError e) {
  88. loge(e.message);
  89. }
  90. }
  91. public static void collision_filter_enum_callback(InputField property_enum, InputEnum combo, Project project)
  92. {
  93. try {
  94. string path = ResourceId.path("physics_config", "global");
  95. Hashtable global = SJSON.load_from_path(project.absolute_path(path));
  96. combo.clear();
  97. if (global.has_key("collision_filters")) {
  98. Hashtable obj = (Hashtable)global["collision_filters"];
  99. foreach (var e in obj)
  100. combo.append(e.key, e.key);
  101. }
  102. } catch (JsonSyntaxError e) {
  103. loge(e.message);
  104. }
  105. }
  106. public static void material_enum_callback(InputField property_enum, InputEnum combo, Project project)
  107. {
  108. try {
  109. string path = ResourceId.path("physics_config", "global");
  110. Hashtable global = SJSON.load_from_path(project.absolute_path(path));
  111. combo.clear();
  112. if (global.has_key("materials")) {
  113. Hashtable obj = (Hashtable)global["materials"];
  114. foreach (var e in obj)
  115. combo.append(e.key, e.key);
  116. }
  117. } catch (JsonSyntaxError e) {
  118. loge(e.message);
  119. }
  120. }
  121. public static void create_object_types(Database database)
  122. {
  123. PropertyDefinition[] properties;
  124. properties =
  125. {
  126. PropertyDefinition()
  127. {
  128. type = PropertyType.VECTOR3,
  129. name = "data.position",
  130. tooltip = "Local Position.",
  131. },
  132. PropertyDefinition()
  133. {
  134. type = PropertyType.QUATERNION,
  135. name = "data.rotation",
  136. tooltip = "Local Rotation.",
  137. },
  138. PropertyDefinition()
  139. {
  140. type = PropertyType.VECTOR3,
  141. name = "data.scale",
  142. min = VECTOR3_ZERO,
  143. deffault = VECTOR3_ONE,
  144. tooltip = "Local Scale.",
  145. },
  146. PropertyDefinition()
  147. {
  148. type = PropertyType.DOUBLE,
  149. name = "spawn_order",
  150. deffault = 0.0,
  151. hidden = true,
  152. not_serialized = true,
  153. },
  154. };
  155. database.create_object_type(OBJECT_TYPE_TRANSFORM
  156. , properties
  157. , 500
  158. , ObjectTypeFlags.UNIT_COMPONENT
  159. );
  160. properties =
  161. {
  162. PropertyDefinition()
  163. {
  164. type = PropertyType.RESOURCE,
  165. name = "data.mesh_resource",
  166. label = "Scene",
  167. resource_type = OBJECT_TYPE_MESH,
  168. deffault = "core/components/noop",
  169. tooltip = "Mesh resource where to read geometries from.",
  170. },
  171. PropertyDefinition()
  172. {
  173. type = PropertyType.STRING,
  174. name = "data.geometry_name",
  175. label = "Node",
  176. editor = PropertyEditorType.ENUM,
  177. enum_property = "data.mesh_resource",
  178. enum_callback = node_name_enum_callback,
  179. deffault = "Noop",
  180. tooltip = "Geometry to render.",
  181. },
  182. PropertyDefinition()
  183. {
  184. type = PropertyType.RESOURCE,
  185. name = "data.material",
  186. resource_type = OBJECT_TYPE_MATERIAL,
  187. deffault = "core/components/noop",
  188. tooltip = "Material used to render to the geometry.",
  189. },
  190. PropertyDefinition()
  191. {
  192. type = PropertyType.BOOL,
  193. name = "data.visible",
  194. deffault = true,
  195. tooltip = "Enable geometry rendering. If disabled it skips any rendering, for example shadow casting.",
  196. },
  197. PropertyDefinition()
  198. {
  199. type = PropertyType.BOOL,
  200. name = "data.cast_shadows",
  201. deffault = true,
  202. tooltip = "Enable geometry shadow rendering.",
  203. },
  204. PropertyDefinition()
  205. {
  206. type = PropertyType.DOUBLE,
  207. name = "spawn_order",
  208. deffault = 1.0,
  209. hidden = true,
  210. not_serialized = true,
  211. },
  212. };
  213. database.create_object_type(OBJECT_TYPE_MESH_RENDERER
  214. , properties
  215. , 1102
  216. , ObjectTypeFlags.UNIT_COMPONENT
  217. , OBJECT_TYPE_TRANSFORM
  218. );
  219. properties =
  220. {
  221. PropertyDefinition()
  222. {
  223. type = PropertyType.RESOURCE,
  224. name = "data.sprite_resource",
  225. label = "Sprite",
  226. resource_type = OBJECT_TYPE_SPRITE,
  227. deffault = "core/components/noop",
  228. tooltip = "Sprite resource containing frames.",
  229. },
  230. PropertyDefinition()
  231. {
  232. type = PropertyType.RESOURCE,
  233. name = "data.material",
  234. resource_type = OBJECT_TYPE_MATERIAL,
  235. deffault = "core/components/noop",
  236. tooltip = "Material used to render the sprite.",
  237. },
  238. PropertyDefinition()
  239. {
  240. type = PropertyType.DOUBLE,
  241. name = "data.layer",
  242. min = 0.0,
  243. max = 7.0,
  244. tooltip = "Sorting layer. Higher values makes the sprite appear in front.",
  245. },
  246. PropertyDefinition()
  247. {
  248. type = PropertyType.DOUBLE,
  249. name = "data.depth",
  250. min = 0.0,
  251. max = (double)uint32.MAX,
  252. tooltip = "Higher values make the sprite apper in front of other sprites in the same layer.",
  253. },
  254. PropertyDefinition()
  255. {
  256. type = PropertyType.BOOL,
  257. name = "data.visible",
  258. deffault = true,
  259. tooltip = "Enable sprite rendering.",
  260. },
  261. PropertyDefinition()
  262. {
  263. type = PropertyType.BOOL,
  264. name = "data.flip_x",
  265. tooltip = "Flips the sprite on the X axis.",
  266. },
  267. PropertyDefinition()
  268. {
  269. type = PropertyType.BOOL,
  270. name = "data.flip_y",
  271. tooltip = "Flips the sprite on the Y axis.",
  272. },
  273. PropertyDefinition()
  274. {
  275. type = PropertyType.DOUBLE,
  276. name = "spawn_order",
  277. deffault = 1.0,
  278. hidden = true,
  279. not_serialized = true,
  280. },
  281. };
  282. database.create_object_type(OBJECT_TYPE_SPRITE_RENDERER
  283. , properties
  284. , 1103
  285. , ObjectTypeFlags.UNIT_COMPONENT
  286. , OBJECT_TYPE_TRANSFORM
  287. );
  288. properties =
  289. {
  290. PropertyDefinition()
  291. {
  292. type = PropertyType.STRING,
  293. name = "data.type",
  294. editor = PropertyEditorType.ENUM,
  295. enum_values = { "directional", "omni", "spot" },
  296. deffault = "omni",
  297. tooltip = "Light type.",
  298. },
  299. PropertyDefinition()
  300. {
  301. type = PropertyType.DOUBLE,
  302. name = "data.range",
  303. min = 0.0,
  304. deffault = 15.0,
  305. tooltip = "Objects farther than this value won't be lit.",
  306. },
  307. PropertyDefinition()
  308. {
  309. type = PropertyType.DOUBLE,
  310. name = "data.intensity",
  311. min = 0.0,
  312. deffault = 500.0,
  313. tooltip = "Light intensity.",
  314. },
  315. PropertyDefinition()
  316. {
  317. type = PropertyType.DOUBLE,
  318. name = "data.spot_angle",
  319. editor = PropertyEditorType.ANGLE,
  320. min = 0.0,
  321. max = 90.0,
  322. deffault = MathUtils.rad(45.0),
  323. tooltip = "Angle of the light's outer cone (Spot only).",
  324. },
  325. PropertyDefinition()
  326. {
  327. type = PropertyType.VECTOR3,
  328. name = "data.color",
  329. editor = PropertyEditorType.COLOR,
  330. min = VECTOR3_ZERO,
  331. max = VECTOR3_ONE,
  332. deffault = VECTOR3_ONE,
  333. tooltip = "Light color.",
  334. },
  335. PropertyDefinition()
  336. {
  337. type = PropertyType.DOUBLE,
  338. name = "data.shadow_bias",
  339. min = 0.0,
  340. max = 1.0,
  341. deffault = 0.0004,
  342. tooltip = "Too low values increase shadow acne. Too high values cause peter-panning.",
  343. },
  344. PropertyDefinition()
  345. {
  346. type = PropertyType.BOOL,
  347. name = "data.cast_shadows",
  348. deffault = true,
  349. tooltip = "Enable shadow casting."
  350. },
  351. PropertyDefinition()
  352. {
  353. type = PropertyType.DOUBLE,
  354. name = "spawn_order",
  355. deffault = 1.0,
  356. hidden = true,
  357. not_serialized = true,
  358. },
  359. };
  360. database.create_object_type(OBJECT_TYPE_LIGHT
  361. , properties
  362. , 1101
  363. , ObjectTypeFlags.UNIT_COMPONENT
  364. , OBJECT_TYPE_TRANSFORM
  365. );
  366. properties =
  367. {
  368. PropertyDefinition()
  369. {
  370. type = PropertyType.STRING,
  371. name = "data.projection",
  372. editor = PropertyEditorType.ENUM,
  373. enum_values = { "orthographic", "perspective" },
  374. deffault = "perspective",
  375. tooltip = "Camera projection type.",
  376. },
  377. PropertyDefinition()
  378. {
  379. type = PropertyType.DOUBLE,
  380. name = "data.fov",
  381. label = "FOV",
  382. editor = PropertyEditorType.ANGLE,
  383. min = 0.0,
  384. max = 90.0,
  385. deffault = MathUtils.rad(45.0),
  386. tooltip = "Vertical Field of View.",
  387. },
  388. PropertyDefinition()
  389. {
  390. type = PropertyType.DOUBLE,
  391. name = "data.near_range",
  392. deffault = 0.1,
  393. tooltip = "Objects closer than this value will not be rendered.",
  394. },
  395. PropertyDefinition()
  396. {
  397. type = PropertyType.DOUBLE,
  398. name = "data.far_range",
  399. deffault = 1000.0,
  400. tooltip = "Objects farther than this value will not be rendered.",
  401. },
  402. PropertyDefinition()
  403. {
  404. type = PropertyType.DOUBLE,
  405. name = "spawn_order",
  406. deffault = 1.0,
  407. hidden = true,
  408. not_serialized = true,
  409. },
  410. };
  411. database.create_object_type(OBJECT_TYPE_CAMERA
  412. , properties
  413. , 1100
  414. , ObjectTypeFlags.UNIT_COMPONENT
  415. , OBJECT_TYPE_TRANSFORM
  416. );
  417. properties =
  418. {
  419. PropertyDefinition()
  420. {
  421. type = PropertyType.STRING,
  422. name = "data.source",
  423. editor = PropertyEditorType.ENUM,
  424. enum_values = { "mesh", "inline" },
  425. deffault = "mesh",
  426. tooltip = "Collider type. Inline let you specify the geometry manually.",
  427. },
  428. PropertyDefinition()
  429. {
  430. type = PropertyType.RESOURCE,
  431. name = "data.scene",
  432. resource_type = OBJECT_TYPE_MESH,
  433. deffault = "core/components/noop",
  434. tooltip = "Mesh resource where to read geometries from.",
  435. },
  436. PropertyDefinition()
  437. {
  438. type = PropertyType.STRING,
  439. name = "data.name",
  440. label = "Node",
  441. editor = PropertyEditorType.ENUM,
  442. enum_property = "data.scene",
  443. enum_callback = node_name_enum_callback,
  444. deffault = "Noop",
  445. tooltip = "Geometry to use as collider (Mesh only).",
  446. },
  447. PropertyDefinition()
  448. {
  449. type = PropertyType.STRING,
  450. name = "data.shape",
  451. editor = PropertyEditorType.ENUM,
  452. enum_values = { "sphere", "capsule", "box", "convex_hull", "mesh" },
  453. deffault = "box",
  454. tooltip = "Shape to use as collider (Inline only).",
  455. },
  456. PropertyDefinition()
  457. {
  458. type = PropertyType.VECTOR3,
  459. name = "data.collider_data.position",
  460. tooltip = "Shape's local position.",
  461. },
  462. PropertyDefinition()
  463. {
  464. type = PropertyType.QUATERNION,
  465. name = "data.collider_data.rotation",
  466. tooltip = "Shape's local rotation.",
  467. },
  468. PropertyDefinition()
  469. {
  470. type = PropertyType.VECTOR3,
  471. name = "data.collider_data.half_extents", // Box only.
  472. min = VECTOR3_ZERO,
  473. deffault = Vector3(0.5, 0.5, 0.5),
  474. tooltip = "Box radius.",
  475. },
  476. PropertyDefinition()
  477. {
  478. type = PropertyType.DOUBLE,
  479. name = "data.collider_data.radius", // Sphere and capsule only.
  480. min = 0.0,
  481. deffault = 0.5,
  482. tooltip = "Sphere or Capsule radius.",
  483. },
  484. PropertyDefinition()
  485. {
  486. type = PropertyType.DOUBLE,
  487. name = "data.collider_data.height", // Capsule only.
  488. min = 0.0,
  489. deffault = 1.0,
  490. tooltip = "Capsule height.",
  491. },
  492. PropertyDefinition()
  493. {
  494. type = PropertyType.DOUBLE,
  495. name = "spawn_order",
  496. deffault = 1.0,
  497. hidden = true,
  498. not_serialized = true,
  499. },
  500. };
  501. database.create_object_type(OBJECT_TYPE_COLLIDER
  502. , properties
  503. , 2100
  504. , ObjectTypeFlags.UNIT_COMPONENT
  505. , OBJECT_TYPE_TRANSFORM
  506. );
  507. properties =
  508. {
  509. PropertyDefinition()
  510. {
  511. type = PropertyType.RESOURCE,
  512. name = "_global_physics_config",
  513. deffault = "global",
  514. resource_type = "physics_config",
  515. hidden = true,
  516. not_serialized = true,
  517. },
  518. PropertyDefinition()
  519. {
  520. type = PropertyType.STRING,
  521. name = "data.class",
  522. editor = PropertyEditorType.ENUM,
  523. enum_property = "_global_physics_config",
  524. enum_callback = class_enum_callback,
  525. deffault = "static",
  526. tooltip = "Actor class.",
  527. },
  528. PropertyDefinition()
  529. {
  530. type = PropertyType.STRING,
  531. name = "data.collision_filter",
  532. editor = PropertyEditorType.ENUM,
  533. enum_property = "_global_physics_config",
  534. enum_callback = collision_filter_enum_callback,
  535. deffault = "default",
  536. tooltip = "Actor collision filter.",
  537. },
  538. PropertyDefinition()
  539. {
  540. type = PropertyType.STRING,
  541. name = "data.material",
  542. editor = PropertyEditorType.ENUM,
  543. enum_property = "_global_physics_config",
  544. enum_callback = material_enum_callback,
  545. deffault = "default",
  546. tooltip = "Actor physics material.",
  547. },
  548. PropertyDefinition()
  549. {
  550. type = PropertyType.DOUBLE,
  551. name = "data.mass",
  552. min = 0.0,
  553. deffault = 1.0,
  554. tooltip = "Actor physical mass.",
  555. },
  556. PropertyDefinition()
  557. {
  558. type = PropertyType.BOOL,
  559. name = "data.lock_translation_x",
  560. tooltip = "Prevent the actor from moving along the X axis.",
  561. },
  562. PropertyDefinition()
  563. {
  564. type = PropertyType.BOOL,
  565. name = "data.lock_translation_y",
  566. tooltip = "Prevent the actor from moving along the Y axis.",
  567. },
  568. PropertyDefinition()
  569. {
  570. type = PropertyType.BOOL,
  571. name = "data.lock_translation_z",
  572. tooltip = "Prevent the actor from moving along the Z axis.",
  573. },
  574. PropertyDefinition()
  575. {
  576. type = PropertyType.BOOL,
  577. name = "data.lock_rotation_x",
  578. tooltip = "Prevent the actor from rotating around the X axis.",
  579. },
  580. PropertyDefinition()
  581. {
  582. type = PropertyType.BOOL,
  583. name = "data.lock_rotation_y",
  584. tooltip = "Prevent the actor from rotating around the Y axis.",
  585. },
  586. PropertyDefinition()
  587. {
  588. type = PropertyType.BOOL,
  589. name = "data.lock_rotation_z",
  590. tooltip = "Prevent the actor from rotating around the Z axis.",
  591. },
  592. PropertyDefinition()
  593. {
  594. type = PropertyType.DOUBLE,
  595. name = "spawn_order",
  596. deffault = 2.0,
  597. hidden = true,
  598. not_serialized = true,
  599. },
  600. };
  601. database.create_object_type(OBJECT_TYPE_ACTOR
  602. , properties
  603. , 2101
  604. , ObjectTypeFlags.UNIT_COMPONENT
  605. , OBJECT_TYPE_TRANSFORM
  606. );
  607. properties =
  608. {
  609. PropertyDefinition()
  610. {
  611. type = PropertyType.RESOURCE,
  612. name = "data.script_resource",
  613. label = "Script",
  614. resource_type = "lua",
  615. deffault = "core/components/noop",
  616. tooltip = "Script.",
  617. },
  618. PropertyDefinition()
  619. {
  620. type = PropertyType.DOUBLE,
  621. name = "spawn_order",
  622. deffault = 1.0,
  623. hidden = true,
  624. not_serialized = true,
  625. },
  626. };
  627. database.create_object_type(OBJECT_TYPE_SCRIPT
  628. , properties
  629. , 7100
  630. , ObjectTypeFlags.UNIT_COMPONENT
  631. );
  632. properties =
  633. {
  634. PropertyDefinition()
  635. {
  636. type = PropertyType.RESOURCE,
  637. name = "data.state_machine_resource",
  638. label = "State Machine",
  639. resource_type = OBJECT_TYPE_STATE_MACHINE,
  640. deffault = "core/components/noop",
  641. tooltip = "State Machine.",
  642. },
  643. PropertyDefinition()
  644. {
  645. type = PropertyType.DOUBLE,
  646. name = "spawn_order",
  647. deffault = 3.0,
  648. hidden = true,
  649. not_serialized = true,
  650. },
  651. };
  652. database.create_object_type(OBJECT_TYPE_ANIMATION_STATE_MACHINE
  653. , properties
  654. , 3100
  655. , ObjectTypeFlags.UNIT_COMPONENT
  656. );
  657. properties =
  658. {
  659. PropertyDefinition()
  660. {
  661. type = PropertyType.STRING,
  662. name = "source",
  663. },
  664. };
  665. database.create_object_type(OBJECT_TYPE_SOUND, properties);
  666. properties =
  667. {
  668. PropertyDefinition()
  669. {
  670. type = PropertyType.VECTOR3,
  671. name = "position",
  672. tooltip = "Local position.",
  673. },
  674. PropertyDefinition()
  675. {
  676. type = PropertyType.QUATERNION,
  677. name = "rotation",
  678. tooltip = "Local rotation.",
  679. },
  680. PropertyDefinition()
  681. {
  682. type = PropertyType.RESOURCE,
  683. name = "name",
  684. resource_type = OBJECT_TYPE_SOUND,
  685. deffault = "",
  686. tooltip = "Sound resource to play.",
  687. },
  688. PropertyDefinition()
  689. {
  690. type = PropertyType.DOUBLE,
  691. name = "range",
  692. min = 0.0,
  693. deffault = 10.0,
  694. tooltip = "Listeners farther than this value will not hear the sound.",
  695. },
  696. PropertyDefinition()
  697. {
  698. type = PropertyType.DOUBLE,
  699. name = "volume",
  700. min = 0.0,
  701. max = 1.0,
  702. deffault = 1.0,
  703. tooltip = "Sound volume.",
  704. },
  705. PropertyDefinition()
  706. {
  707. type = PropertyType.BOOL,
  708. name = "loop",
  709. tooltip = "Restart playback at the end.",
  710. },
  711. PropertyDefinition()
  712. {
  713. type = PropertyType.STRING,
  714. name = "group",
  715. deffault = "music",
  716. tooltip = "Mixing group this sound belongs to.",
  717. },
  718. PropertyDefinition()
  719. {
  720. type = PropertyType.STRING,
  721. name = "editor.name",
  722. deffault = "sound",
  723. hidden = true,
  724. tooltip = "Instance name inside the level.",
  725. },
  726. };
  727. StringId64 sound_source_type = database.create_object_type(OBJECT_TYPE_SOUND_SOURCE, properties, 3.0);
  728. properties =
  729. {
  730. PropertyDefinition()
  731. {
  732. type = PropertyType.DOUBLE,
  733. name = "frame",
  734. min = 0.0
  735. },
  736. PropertyDefinition()
  737. {
  738. type = PropertyType.DOUBLE,
  739. name = "index",
  740. min = 0.0
  741. },
  742. };
  743. database.create_object_type(OBJECT_TYPE_ANIMATION_FRAME, properties);
  744. properties =
  745. {
  746. PropertyDefinition()
  747. {
  748. type = PropertyType.OBJECTS_SET,
  749. name = "frames",
  750. object_type = StringId64(OBJECT_TYPE_ANIMATION_FRAME),
  751. },
  752. PropertyDefinition()
  753. {
  754. type = PropertyType.DOUBLE,
  755. name = "frames_per_second",
  756. min = 0.0,
  757. tooltip = "Speed at which the animation will be played.",
  758. },
  759. };
  760. database.create_object_type(OBJECT_TYPE_SPRITE_ANIMATION, properties);
  761. properties =
  762. {
  763. PropertyDefinition()
  764. {
  765. type = PropertyType.DOUBLE,
  766. name = "index",
  767. min = 0.0,
  768. },
  769. PropertyDefinition()
  770. {
  771. type = PropertyType.STRING,
  772. name = "name",
  773. },
  774. PropertyDefinition()
  775. {
  776. type = PropertyType.VECTOR3,
  777. name = "pivot",
  778. },
  779. PropertyDefinition()
  780. {
  781. type = PropertyType.QUATERNION,
  782. name = "region",
  783. },
  784. };
  785. database.create_object_type(OBJECT_TYPE_SPRITE_FRAME, properties);
  786. properties =
  787. {
  788. PropertyDefinition()
  789. {
  790. type = PropertyType.OBJECTS_SET,
  791. name = "frames",
  792. object_type = StringId64(OBJECT_TYPE_SPRITE_FRAME),
  793. },
  794. PropertyDefinition()
  795. {
  796. type = PropertyType.DOUBLE,
  797. name = "width",
  798. min = 0.0
  799. },
  800. PropertyDefinition()
  801. {
  802. type = PropertyType.DOUBLE,
  803. name = "height",
  804. min = 0.0
  805. },
  806. };
  807. database.create_object_type(OBJECT_TYPE_SPRITE, properties);
  808. properties =
  809. {
  810. PropertyDefinition()
  811. {
  812. type = PropertyType.VECTOR3,
  813. name = "data.color",
  814. editor = PropertyEditorType.COLOR,
  815. min = VECTOR3_ZERO,
  816. max = VECTOR3_ONE,
  817. deffault = Vector3(0.83, 0.83, 0.83),
  818. tooltip = "Fog color.",
  819. },
  820. PropertyDefinition()
  821. {
  822. type = PropertyType.DOUBLE,
  823. name = "data.density",
  824. min = 0.0,
  825. deffault = 0.02,
  826. tooltip = "Fog density.",
  827. },
  828. PropertyDefinition()
  829. {
  830. type = PropertyType.DOUBLE,
  831. name = "data.range_min",
  832. min = 0.0,
  833. tooltip = "Distance from the camera where the fog starts.",
  834. },
  835. PropertyDefinition()
  836. {
  837. type = PropertyType.DOUBLE,
  838. name = "data.range_max",
  839. min = 0.0,
  840. deffault = 1000.0,
  841. tooltip = "Distance from the camera where the fog ends.",
  842. },
  843. PropertyDefinition()
  844. {
  845. type = PropertyType.DOUBLE,
  846. name = "data.sun_blend",
  847. min = 0.0,
  848. max = 1.0,
  849. tooltip = "Blend sun and fog colors.",
  850. },
  851. PropertyDefinition()
  852. {
  853. type = PropertyType.BOOL,
  854. name = "data.enabled",
  855. tooltip = "Enable fog effect.",
  856. },
  857. PropertyDefinition()
  858. {
  859. type = PropertyType.DOUBLE,
  860. name = "spawn_order",
  861. deffault = 0.0,
  862. hidden = true,
  863. not_serialized = true,
  864. },
  865. };
  866. database.create_object_type(OBJECT_TYPE_FOG
  867. , properties
  868. , 1104
  869. , ObjectTypeFlags.UNIT_COMPONENT
  870. );
  871. properties =
  872. {
  873. PropertyDefinition()
  874. {
  875. type = PropertyType.RESOURCE,
  876. name = "_global_physics_config",
  877. deffault = "global",
  878. resource_type = "physics_config",
  879. hidden = true,
  880. not_serialized = true,
  881. },
  882. PropertyDefinition()
  883. {
  884. type = PropertyType.DOUBLE,
  885. name = "data.height",
  886. min = 0.0,
  887. deffault = 1.80,
  888. tooltip = "Mover capsule height.",
  889. },
  890. PropertyDefinition()
  891. {
  892. type = PropertyType.DOUBLE,
  893. name = "data.radius",
  894. min = 0.0,
  895. deffault = 0.50,
  896. tooltip = "Mover capsule radius.",
  897. },
  898. PropertyDefinition()
  899. {
  900. type = PropertyType.DOUBLE,
  901. name = "data.max_slope_angle",
  902. editor = PropertyEditorType.ANGLE,
  903. min = 0.0,
  904. max = 90.0,
  905. deffault = MathUtils.rad(45.0f),
  906. tooltip = "Mover won't climb slopes steeper than this angle.",
  907. },
  908. PropertyDefinition()
  909. {
  910. type = PropertyType.STRING,
  911. name = "data.collision_filter",
  912. editor = PropertyEditorType.ENUM,
  913. enum_property = "_global_physics_config",
  914. enum_callback = collision_filter_enum_callback,
  915. deffault = "default",
  916. tooltip = "Mover collision filter.",
  917. },
  918. PropertyDefinition()
  919. {
  920. type = PropertyType.VECTOR3,
  921. name = "data.center",
  922. tooltip = "Capsule center relative to the local position.",
  923. },
  924. PropertyDefinition()
  925. {
  926. type = PropertyType.DOUBLE,
  927. name = "spawn_order",
  928. deffault = 2.0,
  929. hidden = true,
  930. not_serialized = true,
  931. },
  932. };
  933. database.create_object_type(OBJECT_TYPE_MOVER
  934. , properties
  935. , 2102
  936. , ObjectTypeFlags.UNIT_COMPONENT
  937. , OBJECT_TYPE_TRANSFORM
  938. );
  939. properties =
  940. {
  941. PropertyDefinition()
  942. {
  943. type = PropertyType.RESOURCE,
  944. name = "data.skydome_map",
  945. label = "Skydome Map",
  946. resource_type = OBJECT_TYPE_TEXTURE,
  947. deffault = "core/units/skydome/skydome",
  948. tooltip = "Texture to use as skydome.",
  949. },
  950. PropertyDefinition()
  951. {
  952. type = PropertyType.DOUBLE,
  953. name = "data.skydome_intensity",
  954. min = 0.0,
  955. deffault = 1.0,
  956. tooltip = "Skydome intensity multiplier.",
  957. },
  958. PropertyDefinition()
  959. {
  960. type = PropertyType.VECTOR3,
  961. name = "data.ambient_color",
  962. editor = PropertyEditorType.COLOR,
  963. min = VECTOR3_ZERO,
  964. max = VECTOR3_ONE,
  965. tooltip = "Ambient color applied to objects.",
  966. },
  967. PropertyDefinition()
  968. {
  969. type = PropertyType.DOUBLE,
  970. name = "spawn_order",
  971. deffault = 0.0,
  972. hidden = true,
  973. not_serialized = true,
  974. },
  975. };
  976. database.create_object_type(OBJECT_TYPE_GLOBAL_LIGHTING
  977. , properties
  978. , 1001
  979. , ObjectTypeFlags.UNIT_COMPONENT
  980. );
  981. properties =
  982. {
  983. PropertyDefinition()
  984. {
  985. type = PropertyType.BOOL,
  986. name = "data.enabled",
  987. deffault = true,
  988. tooltip = "Enable bloom effect.",
  989. },
  990. PropertyDefinition()
  991. {
  992. type = PropertyType.DOUBLE,
  993. name = "data.threshold",
  994. min = 0.0,
  995. hidden = true
  996. },
  997. PropertyDefinition()
  998. {
  999. type = PropertyType.DOUBLE,
  1000. name = "data.weight",
  1001. min = 0.0,
  1002. max = 1.0,
  1003. deffault = 0.05,
  1004. tooltip = "Bloom weight.",
  1005. },
  1006. PropertyDefinition()
  1007. {
  1008. type = PropertyType.DOUBLE,
  1009. name = "data.intensity",
  1010. min = 0.0,
  1011. max = 2.0,
  1012. deffault = 0.8,
  1013. tooltip = "Bloom intensity multiplier.",
  1014. },
  1015. PropertyDefinition()
  1016. {
  1017. type = PropertyType.DOUBLE,
  1018. name = "spawn_order",
  1019. deffault = 0.0,
  1020. hidden = true,
  1021. not_serialized = true,
  1022. },
  1023. };
  1024. database.create_object_type(OBJECT_TYPE_BLOOM
  1025. , properties
  1026. , 9100
  1027. , ObjectTypeFlags.UNIT_COMPONENT
  1028. );
  1029. properties =
  1030. {
  1031. PropertyDefinition()
  1032. {
  1033. type = PropertyType.STRING,
  1034. name = "data.type",
  1035. editor = PropertyEditorType.ENUM,
  1036. enum_values = { "gamma", "reinhard", "filmic", "aces" },
  1037. deffault = "reinhard",
  1038. tooltip = "Tonemapping operator. Gamma means no tonemapping is applied.",
  1039. },
  1040. PropertyDefinition()
  1041. {
  1042. type = PropertyType.DOUBLE,
  1043. name = "spawn_order",
  1044. deffault = 0.0,
  1045. hidden = true,
  1046. not_serialized = true,
  1047. },
  1048. };
  1049. database.create_object_type(OBJECT_TYPE_TONEMAP
  1050. , properties
  1051. , 9900
  1052. , ObjectTypeFlags.UNIT_COMPONENT
  1053. );
  1054. properties =
  1055. {
  1056. PropertyDefinition()
  1057. {
  1058. type = PropertyType.STRING,
  1059. name = "editor.name",
  1060. deffault = OBJECT_NAME_UNNAMED,
  1061. tooltip = "Instance name inside the level.",
  1062. },
  1063. PropertyDefinition()
  1064. {
  1065. type = PropertyType.RESOURCE,
  1066. name = "prefab",
  1067. resource_type = OBJECT_TYPE_UNIT,
  1068. deffault = null,
  1069. tooltip = "Unit prefab.",
  1070. },
  1071. PropertyDefinition()
  1072. {
  1073. type = PropertyType.OBJECTS_SET,
  1074. name = "children",
  1075. object_type = StringId64(OBJECT_TYPE_UNIT),
  1076. },
  1077. #if false
  1078. PropertyDefinition()
  1079. {
  1080. type = PropertyType.OBJECTS_SET,
  1081. name = "components",
  1082. },
  1083. PropertyDefinition()
  1084. {
  1085. type = PropertyType.OBJECTS_SET,
  1086. name = "deleted_components",
  1087. },
  1088. PropertyDefinition()
  1089. {
  1090. type = PropertyType.OBJECTS_SET,
  1091. name = "modified_components",
  1092. },
  1093. PropertyDefinition()
  1094. {
  1095. type = PropertyType.OBJECTS_SET,
  1096. name = "deleted_children",
  1097. },
  1098. PropertyDefinition()
  1099. {
  1100. type = PropertyType.OBJECTS_SET,
  1101. name = "modified_children",
  1102. },
  1103. #endif /* if false */
  1104. };
  1105. StringId64 unit_type = database.create_object_type(OBJECT_TYPE_UNIT, properties);
  1106. properties =
  1107. {
  1108. PropertyDefinition()
  1109. {
  1110. type = PropertyType.RESOURCE,
  1111. name = "source",
  1112. resource_type = OBJECT_TYPE_MESH,
  1113. },
  1114. };
  1115. database.create_object_type(OBJECT_TYPE_MESH, properties);
  1116. properties =
  1117. {
  1118. PropertyDefinition()
  1119. {
  1120. type = PropertyType.RESOURCE,
  1121. name = "name",
  1122. label = "Animation",
  1123. resource_type = OBJECT_TYPE_MESH_ANIMATION,
  1124. tooltip = "Animation to play.",
  1125. },
  1126. PropertyDefinition()
  1127. {
  1128. type = PropertyType.STRING,
  1129. name = "weight",
  1130. tooltip = "Expression to evaluate the animation weight.",
  1131. }
  1132. };
  1133. StringId64 node_animation_type = database.create_object_type(OBJECT_TYPE_NODE_ANIMATION, properties);
  1134. database.set_aspect(node_animation_type
  1135. , StringId64("name")
  1136. , (out name, database, id) => {
  1137. string? anim_name = database.get_resource(id, "name");
  1138. name = anim_name == null ? "(None)" : GLib.Path.get_basename(anim_name);
  1139. });
  1140. properties =
  1141. {
  1142. PropertyDefinition()
  1143. {
  1144. type = PropertyType.STRING,
  1145. name = "event",
  1146. tooltip = "Event that triggers this transition.",
  1147. },
  1148. PropertyDefinition()
  1149. {
  1150. type = PropertyType.STRING,
  1151. name = "mode",
  1152. editor = PropertyEditorType.ENUM,
  1153. enum_values = { "immediate", "wait_until_end" },
  1154. tooltip = "Enter the state immediately or wait until the animation ends.",
  1155. },
  1156. PropertyDefinition()
  1157. {
  1158. type = PropertyType.REFERENCE,
  1159. object_type = StringId64(OBJECT_TYPE_STATE_MACHINE_NODE),
  1160. name = "to",
  1161. tooltip = "Animation state to enter to.",
  1162. },
  1163. };
  1164. StringId64 node_transition_type = database.create_object_type(OBJECT_TYPE_NODE_TRANSITION, properties);
  1165. database.set_aspect(node_transition_type
  1166. , StringId64("name")
  1167. , (out name, database, id) => {
  1168. string node_name = "Unknown";
  1169. Guid to_node = database.get_reference(id, "to");
  1170. if (to_node != GUID_ZERO)
  1171. node_name = database.get_string(to_node, "name");
  1172. name = "To %s".printf(node_name);
  1173. });
  1174. properties =
  1175. {
  1176. PropertyDefinition()
  1177. {
  1178. type = PropertyType.STRING,
  1179. name = "name",
  1180. deffault = "New Node",
  1181. tooltip = "State name.",
  1182. },
  1183. PropertyDefinition()
  1184. {
  1185. type = PropertyType.OBJECTS_SET,
  1186. name = "animations",
  1187. object_type = node_animation_type,
  1188. },
  1189. PropertyDefinition()
  1190. {
  1191. type = PropertyType.BOOL,
  1192. name = "loop",
  1193. tooltip = "Restart the animation when it ends.",
  1194. },
  1195. PropertyDefinition()
  1196. {
  1197. type = PropertyType.STRING,
  1198. name = "speed",
  1199. tooltip = "Expression to evaluate the animation speed.",
  1200. },
  1201. PropertyDefinition()
  1202. {
  1203. type = PropertyType.OBJECTS_SET,
  1204. name = "transitions",
  1205. object_type = node_transition_type,
  1206. },
  1207. };
  1208. StringId64 state_machine_node_type = database.create_object_type(OBJECT_TYPE_STATE_MACHINE_NODE, properties);
  1209. properties =
  1210. {
  1211. PropertyDefinition()
  1212. {
  1213. type = PropertyType.STRING,
  1214. name = "name",
  1215. tooltip = "Variable name.",
  1216. },
  1217. PropertyDefinition()
  1218. {
  1219. type = PropertyType.DOUBLE,
  1220. name = "value",
  1221. tooltip = "Variable value.",
  1222. },
  1223. PropertyDefinition()
  1224. {
  1225. type = PropertyType.DOUBLE,
  1226. name = "min",
  1227. deffault = -1.0,
  1228. tooltip = "Minimum value.",
  1229. },
  1230. PropertyDefinition()
  1231. {
  1232. type = PropertyType.DOUBLE,
  1233. name = "max",
  1234. deffault = 1.0,
  1235. tooltip = "Maximum value.",
  1236. },
  1237. };
  1238. StringId64 state_machine_variable_type = database.create_object_type(OBJECT_TYPE_STATE_MACHINE_VARIABLE, properties);
  1239. properties =
  1240. {
  1241. PropertyDefinition()
  1242. {
  1243. type = PropertyType.REFERENCE,
  1244. object_type = StringId64(OBJECT_TYPE_STATE_MACHINE_NODE),
  1245. name = "initial_state",
  1246. tooltip = "Animation state to enter at the beginning.",
  1247. },
  1248. PropertyDefinition()
  1249. {
  1250. type = PropertyType.OBJECTS_SET,
  1251. name = "states",
  1252. object_type = state_machine_node_type,
  1253. },
  1254. PropertyDefinition()
  1255. {
  1256. type = PropertyType.OBJECTS_SET,
  1257. name = "variables",
  1258. object_type = state_machine_variable_type,
  1259. },
  1260. PropertyDefinition()
  1261. {
  1262. type = PropertyType.STRING,
  1263. name = "animation_type",
  1264. deffault = OBJECT_TYPE_SPRITE_ANIMATION,
  1265. hidden = true,
  1266. },
  1267. PropertyDefinition()
  1268. {
  1269. type = PropertyType.RESOURCE,
  1270. name = "skeleton_name",
  1271. resource_type = OBJECT_TYPE_MESH_SKELETON,
  1272. tooltip = "Animation skeleton to use.",
  1273. },
  1274. };
  1275. database.create_object_type(OBJECT_TYPE_STATE_MACHINE, properties);
  1276. properties =
  1277. {
  1278. PropertyDefinition()
  1279. {
  1280. type = PropertyType.DOUBLE,
  1281. name = "editor.camera.orthographic_size",
  1282. deffault = Vector3(20, -20, 20).length(),
  1283. },
  1284. PropertyDefinition()
  1285. {
  1286. type = PropertyType.VECTOR3,
  1287. name = "editor.camera.position",
  1288. deffault = Vector3(20, -20, 20),
  1289. },
  1290. PropertyDefinition()
  1291. {
  1292. type = PropertyType.QUATERNION,
  1293. name = "editor.camera.rotation",
  1294. deffault = Quaternion.look(Vector3(-20, 20, -20).normalize(), Vector3(0.0, 0.0, 1.0)),
  1295. },
  1296. PropertyDefinition()
  1297. {
  1298. type = PropertyType.DOUBLE,
  1299. name = "editor.camera.target_distance",
  1300. deffault = Vector3(20, -20, 20).length(),
  1301. },
  1302. PropertyDefinition()
  1303. {
  1304. type = PropertyType.DOUBLE,
  1305. name = "editor.camera.view_type",
  1306. deffault = (double)CameraViewType.PERSPECTIVE,
  1307. },
  1308. PropertyDefinition()
  1309. {
  1310. type = PropertyType.OBJECTS_SET,
  1311. name = "sounds",
  1312. object_type = sound_source_type,
  1313. },
  1314. PropertyDefinition()
  1315. {
  1316. type = PropertyType.OBJECTS_SET,
  1317. name = "units",
  1318. object_type = unit_type,
  1319. },
  1320. PropertyDefinition()
  1321. {
  1322. type = PropertyType.RESOURCE,
  1323. name = "skydome_unit",
  1324. resource_type = OBJECT_TYPE_UNIT,
  1325. deffault = "core/units/skydome/skydome",
  1326. },
  1327. };
  1328. database.create_object_type(OBJECT_TYPE_LEVEL, properties);
  1329. properties =
  1330. {
  1331. PropertyDefinition()
  1332. {
  1333. type = PropertyType.DOUBLE,
  1334. name = "cp",
  1335. min = 0.0,
  1336. },
  1337. PropertyDefinition()
  1338. {
  1339. type = PropertyType.DOUBLE,
  1340. name = "width",
  1341. min = 0.0,
  1342. },
  1343. PropertyDefinition()
  1344. {
  1345. type = PropertyType.DOUBLE,
  1346. name = "height",
  1347. min = 0.0,
  1348. },
  1349. PropertyDefinition()
  1350. {
  1351. type = PropertyType.DOUBLE,
  1352. name = "x",
  1353. min = 0.0,
  1354. },
  1355. PropertyDefinition()
  1356. {
  1357. type = PropertyType.DOUBLE,
  1358. name = "x_advance",
  1359. min = 0.0,
  1360. },
  1361. PropertyDefinition()
  1362. {
  1363. type = PropertyType.DOUBLE,
  1364. name = "x_offset",
  1365. min = 0.0,
  1366. },
  1367. PropertyDefinition()
  1368. {
  1369. type = PropertyType.DOUBLE,
  1370. name = "y",
  1371. min = 0.0,
  1372. },
  1373. PropertyDefinition()
  1374. {
  1375. type = PropertyType.DOUBLE,
  1376. name = "y_offset",
  1377. min = 0.0,
  1378. },
  1379. };
  1380. database.create_object_type(OBJECT_TYPE_FONT_GLYPH, properties);
  1381. properties =
  1382. {
  1383. PropertyDefinition()
  1384. {
  1385. type = PropertyType.OBJECTS_SET,
  1386. name = "glyphs",
  1387. object_type = StringId64(OBJECT_TYPE_FONT_GLYPH),
  1388. },
  1389. PropertyDefinition()
  1390. {
  1391. type = PropertyType.DOUBLE,
  1392. name = "font_size",
  1393. min = 0.0,
  1394. },
  1395. PropertyDefinition()
  1396. {
  1397. type = PropertyType.DOUBLE,
  1398. name = "size",
  1399. min = 0.0,
  1400. },
  1401. };
  1402. database.create_object_type(OBJECT_TYPE_FONT, properties);
  1403. properties =
  1404. {
  1405. PropertyDefinition()
  1406. {
  1407. type = PropertyType.STRING,
  1408. name = "source",
  1409. },
  1410. PropertyDefinition()
  1411. {
  1412. type = PropertyType.STRING,
  1413. name = "stack_name",
  1414. },
  1415. PropertyDefinition()
  1416. {
  1417. type = PropertyType.RESOURCE,
  1418. name = "target_skeleton",
  1419. resource_type = OBJECT_TYPE_MESH_SKELETON,
  1420. },
  1421. };
  1422. database.create_object_type(OBJECT_TYPE_MESH_ANIMATION, properties);
  1423. properties =
  1424. {
  1425. PropertyDefinition()
  1426. {
  1427. type = PropertyType.STRING,
  1428. name = "name",
  1429. },
  1430. PropertyDefinition()
  1431. {
  1432. type = PropertyType.OBJECTS_SET,
  1433. name = "children",
  1434. object_type = StringId64(OBJECT_TYPE_MESH_BONE),
  1435. },
  1436. };
  1437. database.create_object_type(OBJECT_TYPE_MESH_BONE, properties);
  1438. properties =
  1439. {
  1440. PropertyDefinition()
  1441. {
  1442. type = PropertyType.STRING,
  1443. name = "source",
  1444. },
  1445. PropertyDefinition()
  1446. {
  1447. type = PropertyType.OBJECTS_SET,
  1448. name = "skeleton",
  1449. object_type = StringId64(OBJECT_TYPE_MESH_BONE),
  1450. },
  1451. };
  1452. database.create_object_type(OBJECT_TYPE_MESH_SKELETON, properties);
  1453. properties =
  1454. {
  1455. PropertyDefinition()
  1456. {
  1457. type = PropertyType.STRING,
  1458. name = "source",
  1459. },
  1460. PropertyDefinition()
  1461. {
  1462. type = PropertyType.BOOL,
  1463. name = "generate_mips",
  1464. deffault = true,
  1465. not_serialized = true,
  1466. },
  1467. PropertyDefinition()
  1468. {
  1469. type = PropertyType.BOOL,
  1470. name = "normal_map",
  1471. not_serialized = true,
  1472. },
  1473. PropertyDefinition()
  1474. {
  1475. type = PropertyType.STRING,
  1476. name = "output.android.format",
  1477. editor = PropertyEditorType.ENUM,
  1478. enum_values = { "BC1", "BC2", "BC3", "BC4", "BC5", "PTC14", "RGB8", "RGBA8" },
  1479. deffault = "BC1",
  1480. },
  1481. PropertyDefinition()
  1482. {
  1483. type = PropertyType.BOOL,
  1484. name = "output.android.generate_mips",
  1485. deffault = true,
  1486. },
  1487. PropertyDefinition()
  1488. {
  1489. type = PropertyType.DOUBLE,
  1490. name = "output.android.mip_skip_smallest",
  1491. },
  1492. PropertyDefinition()
  1493. {
  1494. type = PropertyType.BOOL,
  1495. name = "output.android.normal_map",
  1496. },
  1497. PropertyDefinition()
  1498. {
  1499. type = PropertyType.BOOL,
  1500. name = "output.android.linear",
  1501. },
  1502. PropertyDefinition()
  1503. {
  1504. type = PropertyType.BOOL,
  1505. name = "output.android.premultiply_alpha",
  1506. },
  1507. PropertyDefinition()
  1508. {
  1509. type = PropertyType.STRING,
  1510. name = "output.html5.format",
  1511. editor = PropertyEditorType.ENUM,
  1512. enum_values = { "BC1", "BC2", "BC3", "BC4", "BC5", "PTC14", "RGB8", "RGBA8" },
  1513. deffault = "BC1",
  1514. },
  1515. PropertyDefinition()
  1516. {
  1517. type = PropertyType.BOOL,
  1518. name = "output.html5.generate_mips",
  1519. deffault = true,
  1520. },
  1521. PropertyDefinition()
  1522. {
  1523. type = PropertyType.DOUBLE,
  1524. name = "output.html5.mip_skip_smallest",
  1525. },
  1526. PropertyDefinition()
  1527. {
  1528. type = PropertyType.BOOL,
  1529. name = "output.html5.normal_map",
  1530. },
  1531. PropertyDefinition()
  1532. {
  1533. type = PropertyType.BOOL,
  1534. name = "output.html5.linear",
  1535. },
  1536. PropertyDefinition()
  1537. {
  1538. type = PropertyType.BOOL,
  1539. name = "output.html5.premultiply_alpha",
  1540. },
  1541. PropertyDefinition()
  1542. {
  1543. type = PropertyType.STRING,
  1544. name = "output.linux.format",
  1545. editor = PropertyEditorType.ENUM,
  1546. enum_values = { "BC1", "BC2", "BC3", "BC4", "BC5", "PTC14", "RGB8", "RGBA8" },
  1547. deffault = "BC1",
  1548. },
  1549. PropertyDefinition()
  1550. {
  1551. type = PropertyType.BOOL,
  1552. name = "output.linux.generate_mips",
  1553. deffault = true,
  1554. },
  1555. PropertyDefinition()
  1556. {
  1557. type = PropertyType.DOUBLE,
  1558. name = "output.linux.mip_skip_smallest",
  1559. },
  1560. PropertyDefinition()
  1561. {
  1562. type = PropertyType.BOOL,
  1563. name = "output.linux.normal_map",
  1564. },
  1565. PropertyDefinition()
  1566. {
  1567. type = PropertyType.BOOL,
  1568. name = "output.linux.linear",
  1569. },
  1570. PropertyDefinition()
  1571. {
  1572. type = PropertyType.BOOL,
  1573. name = "output.linux.premultiply_alpha",
  1574. },
  1575. PropertyDefinition()
  1576. {
  1577. type = PropertyType.STRING,
  1578. name = "output.windows.format",
  1579. editor = PropertyEditorType.ENUM,
  1580. enum_values = { "BC1", "BC2", "BC3", "BC4", "BC5", "PTC14", "RGB8", "RGBA8" },
  1581. deffault = "BC1",
  1582. },
  1583. PropertyDefinition()
  1584. {
  1585. type = PropertyType.BOOL,
  1586. name = "output.windows.generate_mips",
  1587. deffault = true,
  1588. },
  1589. PropertyDefinition()
  1590. {
  1591. type = PropertyType.DOUBLE,
  1592. name = "output.windows.mip_skip_smallest",
  1593. },
  1594. PropertyDefinition()
  1595. {
  1596. type = PropertyType.BOOL,
  1597. name = "output.windows.normal_map",
  1598. },
  1599. PropertyDefinition()
  1600. {
  1601. type = PropertyType.BOOL,
  1602. name = "output.windows.linear",
  1603. },
  1604. PropertyDefinition()
  1605. {
  1606. type = PropertyType.BOOL,
  1607. name = "output.windows.premultiply_alpha",
  1608. },
  1609. };
  1610. database.create_object_type(OBJECT_TYPE_TEXTURE, properties);
  1611. }
  1612. } /* namespace Crown */