From 6b7af1d9abee868b42b5f51eeabdfce048c87821 Mon Sep 17 00:00:00 2001 From: Torsten Kammer <2102135+cochrane@users.noreply.github.com> Date: Thu, 2 May 2024 23:16:56 +0200 Subject: [PATCH] Get rid of some @objc tags --- GLLara/GLLModel.swift | 8 ++------ GLLara/GLLModelBone.swift | 4 ++-- GLLara/GLLModelGltf.swift | 4 ++-- GLLara/GLLModelMesh.swift | 2 +- GLLara/GLLModelMeshObj.swift | 4 ++-- GLLara/GLLModelObj.swift | 4 ++-- GLLara/GLLModelXNALara.swift | 10 +++++----- 7 files changed, 16 insertions(+), 20 deletions(-) diff --git a/GLLara/GLLModel.swift b/GLLara/GLLModel.swift index 651860a..a97c860 100644 --- a/GLLara/GLLModel.swift +++ b/GLLara/GLLModel.swift @@ -80,12 +80,8 @@ enum GLLModelLoadingErrorCode: Int { @objc var baseURL: URL! = nil @objc var parameters: GLLModelParams! = nil - @objc var hasBones: Bool { - return bones.count > 0 - } - - @objc var rootBones: [GLLModelBone] { - return bones.filter({ bone in bone.parent == nil } as (GLLModelBone)->Bool) + var hasBones: Bool { + return bones.count > 1 } @objc var cameraTargetNames: [GLLCameraTargetDescription] { diff --git a/GLLara/GLLModelBone.swift b/GLLara/GLLModelBone.swift index bb8a98f..232402d 100644 --- a/GLLara/GLLModelBone.swift +++ b/GLLara/GLLModelBone.swift @@ -62,7 +62,7 @@ import Foundation } // Export - @objc func writeASCII() -> String { + func writeASCII() -> String { var result = "" result.append("\(name)\n") @@ -72,7 +72,7 @@ import Foundation return result } - @objc func writeBinary() -> Data { + func writeBinary() -> Data { let stream = TROutDataStream() stream.appendPascalString(name) diff --git a/GLLara/GLLModelGltf.swift b/GLLara/GLLModelGltf.swift index 8437e96..336d975 100644 --- a/GLLara/GLLModelGltf.swift +++ b/GLLara/GLLModelGltf.swift @@ -510,7 +510,7 @@ extension Data { class GLLModelGltf: GLLModel { - @objc convenience init(url: URL, isBinary: Bool = false) throws { + convenience init(url: URL, isBinary: Bool = false) throws { let data = try Data(contentsOf: url, options: .mappedIfSafe) if (isBinary) { @@ -795,7 +795,7 @@ class GLLModelGltf: GLLModel { self.meshes.append(modelMesh) } - @objc init(jsonData: Data, baseUrl: URL, binaryData: Data? = nil) throws { + init(jsonData: Data, baseUrl: URL, binaryData: Data? = nil) throws { let decoder = JSONDecoder() let document = try decoder.decode(GltfDocument.self, from: jsonData) diff --git a/GLLara/GLLModelMesh.swift b/GLLara/GLLModelMesh.swift index 95f0176..3ec06b0 100644 --- a/GLLara/GLLModelMesh.swift +++ b/GLLara/GLLModelMesh.swift @@ -15,7 +15,7 @@ import simd */ @objc class GLLModelMesh: NSObject { // For subclasses - @objc init(asPartOfModel model: GLLModel) { + init(asPartOfModel model: GLLModel) { super.init() self.model = model } diff --git a/GLLara/GLLModelMeshObj.swift b/GLLara/GLLModelMeshObj.swift index 68be767..c5b7830 100644 --- a/GLLara/GLLModelMeshObj.swift +++ b/GLLara/GLLModelMeshObj.swift @@ -8,8 +8,8 @@ import Foundation -@objc class GLLModelMeshObj: GLLModelMesh { - @objc init(asPartOfModel model: GLLModel, fileVertexAccessors: GLLVertexAttribAccessorSet, countOfVertices: Int, elementData: Data, textures: [String: GLLTextureAssignment], renderParameterValues: [String: AnyObject]) throws { +class GLLModelMeshObj: GLLModelMesh { + init(asPartOfModel model: GLLModel, fileVertexAccessors: GLLVertexAttribAccessorSet, countOfVertices: Int, elementData: Data, textures: [String: GLLTextureAssignment], renderParameterValues: [String: AnyObject]) throws { super.init(asPartOfModel: model) countOfUVLayers = 1 diff --git a/GLLara/GLLModelObj.swift b/GLLara/GLLModelObj.swift index 46c67a2..28f092a 100644 --- a/GLLara/GLLModelObj.swift +++ b/GLLara/GLLModelObj.swift @@ -15,8 +15,8 @@ import Metal * every material used. XNALara-specific extensions and simplifications are * supported, too. */ -@objc class GLLModelObj: GLLModel { - @objc init(contentsOf url: URL) throws { +class GLLModelObj: GLLModel { + init(contentsOf url: URL) throws { file = try ObjFile(from: url) materialFiles = try file.materialLibraries.map { try MtlFile(from: $0) } diff --git a/GLLara/GLLModelXNALara.swift b/GLLara/GLLModelXNALara.swift index d3f5a90..ea28b5c 100644 --- a/GLLara/GLLModelXNALara.swift +++ b/GLLara/GLLModelXNALara.swift @@ -8,13 +8,13 @@ import Foundation -@objc class GLLModelXNALara: GLLModel { - @objc convenience init(binaryFromFile file: URL!, parent: GLLModel!) throws { +class GLLModelXNALara: GLLModel { + convenience init(binaryFromFile file: URL!, parent: GLLModel!) throws { let data = try Data(contentsOf: file, options: .mappedIfSafe) try self.init(binaryFrom: data, baseURL: file, parent: parent) } - @objc init(binaryFrom data: Data!, baseURL: URL!, parent: GLLModel?) throws { + init(binaryFrom data: Data!, baseURL: URL!, parent: GLLModel?) throws { super.init() guard data.count >= 2 else { @@ -136,13 +136,13 @@ import Foundation // Ignore the trailing data. XNALara writes some metadata there that varies depending on the version, but doesn't seem to be actually necessary for anything (famous last words…?) } - @objc convenience init(ASCIIFromFile file: URL!, parent: GLLModel?) throws { + convenience init(ASCIIFromFile file: URL!, parent: GLLModel?) throws { var encoding: String.Encoding = .utf8 let source = try String(contentsOf: file, usedEncoding: &encoding) try self.init(asciiFrom: source, baseURL: file, parent: parent) } - @objc init(asciiFrom string: String, baseURL: URL, parent: GLLModel?) throws { + init(asciiFrom string: String, baseURL: URL, parent: GLLModel?) throws { super.init() self.baseURL = baseURL