ToolCore.hx 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469
  1. package atomic;
  2. // enum PlatformID
  3. typedef PlatformID = Int;
  4. //Atomic Haxe Definitions
  5. extern class ToolCore {
  6. // enum PlatformID
  7. public static var PLATFORMID_UNDEFINED:PlatformID;
  8. public static var PLATFORMID_WINDOWS:PlatformID;
  9. public static var PLATFORMID_MAC:PlatformID;
  10. public static var PLATFORMID_ANDROID:PlatformID;
  11. public static var PLATFORMID_IOS:PlatformID;
  12. public static var PLATFORMID_WEB:PlatformID;
  13. public static var PROJECTFILE_VERSION: Int;
  14. }
  15. //----------------------------------------------------
  16. // MODULE: ToolCore
  17. //----------------------------------------------------
  18. @:native("Atomic.ToolEnvironment")
  19. extern class ToolEnvironment extends AObject {
  20. var rootSourceDir: String;
  21. var rootBuildDir: String;
  22. var editorBinary: String;
  23. var playerBinary: String;
  24. var toolBinary: String;
  25. var coreDataDir: String;
  26. var playerDataDir: String;
  27. var editorDataDir: String;
  28. var deploymentDataDir: String;
  29. var projectTemplatesDir: String;
  30. var examplesDir: String;
  31. var devConfigFilename: String;
  32. function new();
  33. function initFromPackage(): Bool;
  34. function initFromJSON(?atomicTool: Bool): Bool;
  35. // Root source and build directories for development source tree builds
  36. function setRootSourceDir(sourceDir: String): Void;
  37. function setRootBuildDir(buildDir: String, ?setBinaryPaths: Bool): Void;
  38. function getRootSourceDir(): String;
  39. function getRootBuildDir(): String;
  40. // Binaries
  41. function getEditorBinary(): String;
  42. function getPlayerBinary(): String;
  43. function getToolBinary(): String;
  44. // Resource directories
  45. function getCoreDataDir(): String;
  46. function getPlayerDataDir(): String;
  47. function getEditorDataDir(): String;
  48. // Data directories
  49. function getDeploymentDataDir(): String;
  50. function getProjectTemplatesDir(): String;
  51. function getExamplesDir(): String;
  52. function getDevConfigFilename(): String;
  53. function dump(): Void;
  54. }
  55. @:native("Atomic.ToolSystem")
  56. extern class ToolSystem extends AObject {
  57. var project: Project;
  58. var dataPath: String;
  59. var currentPlatform: Platform;
  60. function new();
  61. function loadProject(fullpath: String): Bool;
  62. function getProject(): Project;
  63. function closeProject(): Void;
  64. function getDataPath(): String;
  65. function setDataPath(path: String): Void;
  66. function registerPlatform(platform: Platform): Void;
  67. function getPlatformByID(platform: PlatformID): Platform;
  68. function getPlatformByName(name: String): Platform;
  69. function setCurrentPlatform(platform: PlatformID): Void;
  70. function getCurrentPlatform(): Platform;
  71. function setCLI(): Void;
  72. function isCLI(): Bool;
  73. }
  74. @:native("Atomic.Project")
  75. extern class Project extends AObject {
  76. var resourcePath: String;
  77. var componentsPath: String;
  78. var scriptsPath: String;
  79. var modulesPath: String;
  80. var projectPath: String;
  81. var projectFilePath: String;
  82. var userPrefsFullPath: String;
  83. var buildSettingsFullPath: String;
  84. var version: String;
  85. // Construct.
  86. function new();
  87. function load(fullpath: String): Bool;
  88. function save(fullpath: String): Void;
  89. // Paths
  90. function getResourcePath(): String;
  91. function setResourcePath(resourcePath: String): Void;
  92. function getComponentsPath(): String;
  93. function getScriptsPath(): String;
  94. function getModulesPath(): String;
  95. function isComponentsDirOrFile(fullPath: String): Bool;
  96. function isScriptsDirOrFile(fullPath: String): Bool;
  97. function isModulesDirOrFile(fullPath: String): Bool;
  98. function addPlatform(platformID: PlatformID): Void;
  99. function containsPlatform(platformID: PlatformID): Bool;
  100. function removePlatform(platformID: PlatformID): Void;
  101. function isDirty(): Bool;
  102. function setDirty(): Void;
  103. function getProjectPath(): String;
  104. function getProjectFilePath(): String;
  105. function getUserPrefsFullPath(): String;
  106. function getBuildSettingsFullPath(): String;
  107. function getVersion(): String;
  108. function setVersion(version: String): Void;
  109. function saveBuildSettings(): Void;
  110. function loadBuildSettings(): Bool;
  111. function saveUserPrefs(): Void;
  112. function loadUserPrefs(): Bool;
  113. }
  114. @:native("Atomic.ProjectFile")
  115. extern class ProjectFile extends AObject {
  116. // Construct.
  117. function new();
  118. function save(project: Project): Void;
  119. function load(project: Project): Bool;
  120. function writeNewProject(fullpath: String): Void;
  121. }
  122. @:native("Atomic.Platform")
  123. extern class Platform extends AObject {
  124. var name: String;
  125. var platformID: PlatformID;
  126. function new();
  127. function getName(): String;
  128. function getPlatformID(): PlatformID;
  129. }
  130. @:native("Atomic.PlatformMac")
  131. extern class PlatformMac extends Platform {
  132. function new();
  133. @:overload(function(): String{})
  134. override function getName(): String;
  135. @:overload(function(): PlatformID{})
  136. override function getPlatformID(): PlatformID;
  137. }
  138. @:native("Atomic.PlatformWeb")
  139. extern class PlatformWeb extends Platform {
  140. function new();
  141. @:overload(function(): String{})
  142. override function getName(): String;
  143. @:overload(function(): PlatformID{})
  144. override function getPlatformID(): PlatformID;
  145. }
  146. @:native("Atomic.PlatformWindows")
  147. extern class PlatformWindows extends Platform {
  148. function new();
  149. @:overload(function(): String{})
  150. override function getName(): String;
  151. @:overload(function(): PlatformID{})
  152. override function getPlatformID(): PlatformID;
  153. }
  154. @:native("Atomic.Command")
  155. extern class Command extends AObject {
  156. function new();
  157. function parse(command: String): Bool;
  158. function run(): Void;
  159. function finished(): Void;
  160. function error(errorMsg: String): Void;
  161. function cancel(): Void;
  162. function requiresProjectLoad(): Bool;
  163. function requiresLicenseValidation(): Bool;
  164. }
  165. @:native("Atomic.PlayCmd")
  166. extern class PlayCmd extends Command {
  167. function new();
  168. @:overload(function(): Void{})
  169. override function run(): Void;
  170. }
  171. @:native("Atomic.OpenAssetImporter")
  172. extern class OpenAssetImporter extends AObject {
  173. var errorMessage: String;
  174. var importNode: Atomic.Node;
  175. var startTime: Float;
  176. var endTime: Float;
  177. var scale: Float;
  178. var exportAnimations: Bool;
  179. var verboseLog: Bool;
  180. function new();
  181. function load(assetPath: String): Bool;
  182. function getErrorMessage(): String;
  183. function exportModel(outName: String, ?animName: String, ?animationOnly: Bool): Bool;
  184. function setImportNode(node: Atomic.Node): Void;
  185. function setStartTime(startTime: Float): Void;
  186. function setEndTime(endTime: Float): Void;
  187. function setScale(scale: Float): Void;
  188. function setExportAnimations(exportAnimations: Bool): Void;
  189. function setVerboseLog(verboseLog: Bool): Void;
  190. }
  191. @:native("Atomic.Asset")
  192. extern class Asset extends AObject {
  193. var guid: String;
  194. var name: String;
  195. var path: String;
  196. var extension: String;
  197. var relativePath: String;
  198. var cachePath: String;
  199. var importerType: String;
  200. var importerTypeName: String;
  201. var importer: AssetImporter;
  202. var parent: Asset;
  203. var dirty: Bool;
  204. var fileTimestamp: Int;
  205. var dotAssetFilename: String;
  206. // Construct.
  207. function new();
  208. function import(): Bool;
  209. function preload(): Bool;
  210. function setPath(path: String): Bool;
  211. function getGUID(): String;
  212. function getName(): String;
  213. function getPath(): String;
  214. function getExtension(): String;
  215. // Get the path relative to project
  216. function getRelativePath(): String;
  217. function getCachePath(): String;
  218. function getImporterType(): String;
  219. function getImporterTypeName(): String;
  220. function getImporter(): AssetImporter;
  221. function postImportError(message: String): Void;
  222. function getParent(): Asset;
  223. function setDirty(dirty: Bool): Void;
  224. function isDirty(): Bool;
  225. // Get the last timestamp as seen by the AssetDatabase
  226. function getFileTimestamp(): Int;
  227. // Sets the time stamp to the asset files current time
  228. function updateFileTimestamp(): Void;
  229. function getDotAssetFilename(): String;
  230. function isFolder(): Bool;
  231. function load(): Bool;
  232. function save(): Bool;
  233. }
  234. @:native("Atomic.AssetDatabase")
  235. extern class AssetDatabase extends AObject {
  236. var cachePath: String;
  237. // Construct.
  238. function new();
  239. function getAssetByGUID(guid: String): Asset;
  240. function getAssetByPath(path: String): Asset;
  241. function getAssetByCachePath(cachePath: String): Asset;
  242. function generateAssetGUID(): String;
  243. function registerGUID(guid: String): Void;
  244. function getCachePath(): String;
  245. function deleteAsset(asset: Asset): Void;
  246. function scan(): Void;
  247. function getDotAssetFilename(path: String): String;
  248. }
  249. @:native("Atomic.AssetImporter")
  250. extern class AssetImporter extends AObject {
  251. var asset: Asset;
  252. // Construct.
  253. function new(asset: Asset);
  254. function setDefaults(): Void;
  255. function preload(): Bool;
  256. function getAsset(): Asset;
  257. function requiresCacheFile(): Bool;
  258. }
  259. @:native("Atomic.AudioImporter")
  260. extern class AudioImporter extends AssetImporter {
  261. // Construct.
  262. function new(asset: Asset);
  263. @:overload(function(): Void{})
  264. override function setDefaults(): Void;
  265. }
  266. @:native("Atomic.JavascriptImporter")
  267. extern class JavascriptImporter extends AssetImporter {
  268. // Construct.
  269. function new(asset: Asset);
  270. @:overload(function(): Void{})
  271. override function setDefaults(): Void;
  272. function isComponentFile(): Bool;
  273. }
  274. @:native("Atomic.MaterialImporter")
  275. extern class MaterialImporter extends AssetImporter {
  276. // Construct.
  277. function new(asset: Asset);
  278. @:overload(function(): Void{})
  279. override function setDefaults(): Void;
  280. function saveMaterial(): Void;
  281. }
  282. @:native("Atomic.AnimationImportInfo")
  283. extern class AnimationImportInfo extends AObject {
  284. var name: String;
  285. var startTime: Float;
  286. var endTime: Float;
  287. function new();
  288. function getName(): String;
  289. function getStartTime(): Float;
  290. function getEndTime(): Float;
  291. function setName(name: String): Void;
  292. function setStartTime(time: Float): Void;
  293. function setEndTime(time: Float): Void;
  294. }
  295. @:native("Atomic.ModelImporter")
  296. extern class ModelImporter extends AssetImporter {
  297. var scale: Float;
  298. var importAnimations: Bool;
  299. var animationCount: Int;
  300. // Construct.
  301. function new(asset: Asset);
  302. @:overload(function(): Void{})
  303. override function setDefaults(): Void;
  304. function getScale(): Float;
  305. function setScale(scale: Float): Void;
  306. function getImportAnimations(): Bool;
  307. function setImportAnimations(importAnimations: Bool): Void;
  308. function getAnimationCount(): Int;
  309. function setAnimationCount(count: Int): Void;
  310. function getAnimationInfo(index: Int): AnimationImportInfo;
  311. }
  312. @:native("Atomic.PrefabImporter")
  313. extern class PrefabImporter extends AssetImporter {
  314. // Construct.
  315. function new(asset: Asset);
  316. @:overload(function(): Void{})
  317. override function setDefaults(): Void;
  318. @:overload(function(): Bool{})
  319. override function preload(): Bool;
  320. }
  321. @:native("Atomic.TextureImporter")
  322. extern class TextureImporter extends AssetImporter {
  323. // Construct.
  324. function new(asset: Asset);
  325. @:overload(function(): Void{})
  326. override function setDefaults(): Void;
  327. }
  328. @:native("Atomic.LicenseSystem")
  329. extern class LicenseSystem extends AObject {
  330. var key: String;
  331. var email: String;
  332. // Construct.
  333. function new();
  334. function initialize(): Void;
  335. function licenseWindows(): Bool;
  336. function licenseMac(): Bool;
  337. function licenseAndroid(): Bool;
  338. function licenseIOS(): Bool;
  339. function licenseHTML5(): Bool;
  340. function licenseModule3D(): Bool;
  341. // Returns whether there are any platform licenses available
  342. function isStandardLicense(): Bool;
  343. // Returns true if request to deactivate is made
  344. function deactivate(): Bool;
  345. function resetLicense(): Void;
  346. function loadLicense(): Bool;
  347. // Basic key validation
  348. function validateKey(key: String): Bool;
  349. // Activate on server
  350. function requestServerActivation(key: String): Void;
  351. function getKey(): String;
  352. function generateMachineID(): String;
  353. function getEmail(): String;
  354. function licenseAgreementConfirmed(): Void;
  355. }