Skip to content

Commit

Permalink
Trigger re-render after compile
Browse files Browse the repository at this point in the history
closes #8
  • Loading branch information
finnvoor committed Nov 12, 2024
1 parent 08ebf21 commit f3f0fc3
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Config.xcconfig
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
MARKETING_VERSION = 0.0.2
CURRENT_PROJECT_VERSION = 2
MARKETING_VERSION = 0.0.4
CURRENT_PROJECT_VERSION = 4
4 changes: 4 additions & 0 deletions Plugin/Extensions/PROAPIAccessing+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ extension PROAPIAccessing {
api(for: FxParameterRetrievalAPI_v6.self) as! FxParameterRetrievalAPI_v6
}

var parameterSettingAPI: FxParameterSettingAPI_v6 {
api(for: FxParameterSettingAPI_v6.self) as! FxParameterSettingAPI_v6
}

var timingAPI: FxTimingAPI_v4 {
api(for: FxTimingAPI_v4.self) as! FxTimingAPI_v4
}
Expand Down
25 changes: 23 additions & 2 deletions Plugin/Generators/SwiftUIViewGenerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,19 @@ import SwiftUIFX
apiManager.parameterCreationAPI.addPushButton(
withName: "Compile",
parameterID: 2,
selector: #selector(SwiftUIViewGenerator.compile),
selector: #selector(SwiftUIViewGenerator.updateAndCompile),
parameterFlags: FxParameterFlags(kFxParameterFlag_DEFAULT)
)

apiManager.parameterCreationAPI.addIntSlider(
withName: "Update",
parameterID: 3,
defaultValue: 0,
parameterMin: Int32.min,
parameterMax: Int32.max,
sliderMin: Int32.min,
sliderMax: Int32.max,
delta: 1,
parameterFlags: FxParameterFlags(kFxParameterFlag_DEFAULT)
)
}
Expand Down Expand Up @@ -88,7 +100,16 @@ extension SwiftUIViewGenerator {
}

extension SwiftUIViewGenerator {
@objc func compile() {
@objc func updateAndCompile() {
apiManager.parameterSettingAPI.setIntValue(
Int32.random(in: Int32.min...Int32.max),
toParameter: 3,
at: .zero
)
compile()
}

func compile() {
var packagePath: NSString = ""
apiManager.parameterRetrievalAPI.getStringParameterValue(&packagePath, fromParameter: 1)
let package = URL(filePath: packagePath as String)
Expand Down

0 comments on commit f3f0fc3

Please sign in to comment.