|
@@ -1298,6 +1298,19 @@ extension PQStuckPointEditerController {
|
|
|
|
|
|
return stuckPoints
|
|
|
}
|
|
|
+
|
|
|
+ func clipPoint(clipCount:Int,oldPoints: Array<Float>) {
|
|
|
+ for i in finallyStuckPoints.count...clipCount {
|
|
|
+
|
|
|
+ if ((i % (oldPoints.count - 1)) != 0){
|
|
|
+ finallyStuckPoints.append(finallyStuckPoints[i-1] + oldPoints[i%(oldPoints.count - 1)] - oldPoints[(i-1)%(oldPoints.count - 1)])
|
|
|
+ }else {
|
|
|
+ finallyStuckPoints.append(finallyStuckPoints[i-1] + oldPoints[1] - oldPoints[0])
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
func dealParameter(model: createStickersModel) {
|
|
@@ -1335,20 +1348,8 @@ extension PQStuckPointEditerController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- for i in 0 ... clipNum {
|
|
|
-
|
|
|
- if(i < stuckPointsTemp.count){
|
|
|
- finallyStuckPoints.append(stuckPointsTemp[i])
|
|
|
- }else{
|
|
|
- let duration = (stuckPointsTemp.last ?? 0.0) - (stuckPointsTemp.first ?? 0.0)
|
|
|
- let index = i % stuckPointsTemp.count
|
|
|
- if((index + 1) < stuckPointsTemp.count){
|
|
|
- let a = duration * Float((i / stuckPointsTemp.count)) + stuckPointsTemp[index + 1]
|
|
|
- finallyStuckPoints.append(a)
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
+ finallyStuckPoints.append(stuckPointsTemp.first ?? 0.0)
|
|
|
+ clipPoint(clipCount:clipNum , oldPoints: stuckPointsTemp)
|
|
|
|
|
|
break
|
|
|
case .createStickersModelSpeed, .createStickersModelOnlyMusic:
|
|
@@ -1428,31 +1429,31 @@ extension PQStuckPointEditerController {
|
|
|
sticker.clipCount = LACount + LBCount
|
|
|
|
|
|
if sticker.clipCount == 0 { sticker.clipCount = 1 }
|
|
|
-
|
|
|
-
|
|
|
- var pointStartIndex:Int = 0
|
|
|
- if(lastPointIndex == nil){
|
|
|
- pointStartIndex = 0
|
|
|
- }else{
|
|
|
- pointStartIndex = (lastPointIndex ?? 0) + 1
|
|
|
- }
|
|
|
- for i in pointStartIndex ... (sticker.clipCount + pointStartIndex){
|
|
|
-
|
|
|
- if(i < stuckPointsTemp.count){
|
|
|
- BFLog(message: "直接添加值前:\(stuckPointsTemp[i])")
|
|
|
- finallyStuckPoints.append(stuckPointsTemp[i])
|
|
|
- BFLog(message: "直接添加值后:\(finallyStuckPoints.last ?? 0.0)")
|
|
|
- }else{
|
|
|
- let duration = (stuckPointsTemp.last ?? 0.0) - (stuckPointsTemp.first ?? 0.0)
|
|
|
- let index = i % stuckPointsTemp.count
|
|
|
- if((index + 1) < stuckPointsTemp.count){
|
|
|
- let a = duration * Float((i / stuckPointsTemp.count)) + stuckPointsTemp[index + 1]
|
|
|
- finallyStuckPoints.append(a)
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
+
|
|
|
+ if(stuckPointsTemp.count < 1){
|
|
|
+
|
|
|
+ BFLog(message: "卡点数据有错误!!!")
|
|
|
+ return
|
|
|
}
|
|
|
+
|
|
|
+ finallyStuckPoints.append(stuckPointsTemp.first ?? 0.0)
|
|
|
+
|
|
|
+ clipPoint(clipCount: sticker.clipCount , oldPoints: stuckPointsTemp)
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ BFLog(message: "finallyStuckPoints\(finallyStuckPoints)")
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
if useAssestDurationTemp < assetDuration {
|
|
|
|
|
@@ -1464,7 +1465,7 @@ extension PQStuckPointEditerController {
|
|
|
|
|
|
let lastAssetDuration = Float(CMTimeGetSeconds(asset.duration)) - useAssestDurationTemp
|
|
|
|
|
|
- lastPointIndex = (sticker.clipCount % stuckPointsTemp.count) ?? 0
|
|
|
+ lastPointIndex = (sticker.clipCount % stuckPointsTemp.count)
|
|
|
|
|
|
let a:Float = stuckPointsTemp[lastPointIndex ?? 0]
|
|
|
var b:Float = 0.0
|
|
@@ -1478,30 +1479,8 @@ extension PQStuckPointEditerController {
|
|
|
|
|
|
if tempSpeed >= 1 {
|
|
|
if needSpeed >= 0.4 * tempSpeed {
|
|
|
-
|
|
|
-
|
|
|
- var lastPointIndex = stuckPointsTemp.firstIndex(where: { (point) -> Bool in
|
|
|
- (point == (finallyStuckPoints.last ?? 0.0).truncatingRemainder(dividingBy: (stuckPointsTemp.last ?? 0)))
|
|
|
- })
|
|
|
- for i in ((lastPointIndex ?? 0) + 1) ... ((lastPointIndex ?? 0) + 1){
|
|
|
-
|
|
|
- if(i < stuckPointsTemp.count){
|
|
|
- BFLog(message: "直接添加值前:\(stuckPointsTemp[i])")
|
|
|
- finallyStuckPoints.append(stuckPointsTemp[i])
|
|
|
- sticker.clipCount = sticker.clipCount + 1
|
|
|
- BFLog(message: "直接添加值后:\(finallyStuckPoints.last ?? 0.0)")
|
|
|
- }else{
|
|
|
- let duration = (stuckPointsTemp.last ?? 0.0) - (stuckPointsTemp.first ?? 0.0)
|
|
|
- let index = i % stuckPointsTemp.count
|
|
|
- if((index + 1) < stuckPointsTemp.count){
|
|
|
- let a = duration * Float((i / stuckPointsTemp.count)) + stuckPointsTemp[index + 1]
|
|
|
- finallyStuckPoints.append(a)
|
|
|
- sticker.clipCount = sticker.clipCount + 1
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
|
|
|
}else{
|
|
|
BFLog(message: "条件不满足不用补位")
|
|
@@ -1509,28 +1488,7 @@ extension PQStuckPointEditerController {
|
|
|
} else {
|
|
|
if needSpeed >= 0.4 * tempSpeed && needSpeed >= 0.2 {
|
|
|
|
|
|
- var lastPointIndex = stuckPointsTemp.firstIndex(where: { (point) -> Bool in
|
|
|
- (point == (finallyStuckPoints.last ?? 0.0).truncatingRemainder(dividingBy: (stuckPointsTemp.last ?? 0)))
|
|
|
- })
|
|
|
- for i in ((lastPointIndex ?? 0) + 1) ... ((lastPointIndex ?? 0) + 1){
|
|
|
-
|
|
|
- if(i < stuckPointsTemp.count){
|
|
|
- BFLog(message: "直接添加值前:\(stuckPointsTemp[i])")
|
|
|
- finallyStuckPoints.append(stuckPointsTemp[i])
|
|
|
- sticker.clipCount = sticker.clipCount + 1
|
|
|
- BFLog(message: "直接添加值后:\(finallyStuckPoints.last ?? 0.0)")
|
|
|
- }else{
|
|
|
- let duration = (stuckPointsTemp.last ?? 0.0) - (stuckPointsTemp.first ?? 0.0)
|
|
|
- let index = i % stuckPointsTemp.count
|
|
|
- if((index + 1) < stuckPointsTemp.count){
|
|
|
- let a = duration * Float((i / stuckPointsTemp.count)) + stuckPointsTemp[index + 1]
|
|
|
- finallyStuckPoints.append(a)
|
|
|
- sticker.clipCount = sticker.clipCount + 1
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
}else{
|
|
|
BFLog(message: "条件不满足不用补位")
|
|
|
}
|