File tree Expand file tree Collapse file tree 4 files changed +34
-6
lines changed
photon-core/src/main/java/org/photonvision/vision Expand file tree Collapse file tree 4 files changed +34
-6
lines changed Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ public AdvancedPipelineSettings() {
80
80
81
81
// 3d settings
82
82
public boolean solvePNPEnabled = false ;
83
- public TargetModel targetModel = TargetModel .k2020HighGoalOuter ;
83
+ @ SuppressSettingCopy public TargetModel targetModel = TargetModel .k2020HighGoalOuter ;
84
84
85
85
// Corner detection settings
86
86
public CornerDetectionPipe .DetectionStrategy cornerDetectionStrategy =
Original file line number Diff line number Diff line change 37
37
})
38
38
public class CVPipelineSettings implements Cloneable {
39
39
public int pipelineIndex = 0 ;
40
- public PipelineType pipelineType = PipelineType .DriverMode ;
40
+ @ SuppressSettingCopy public PipelineType pipelineType = PipelineType .DriverMode ;
41
41
public ImageRotationMode inputImageRotationMode = ImageRotationMode .DEG_0 ;
42
42
public String pipelineNickname = "New Pipeline" ;
43
43
public boolean cameraAutoExposure = false ;
Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (C) Photon Vision.
3
+ *
4
+ * This program is free software: you can redistribute it and/or modify
5
+ * it under the terms of the GNU General Public License as published by
6
+ * the Free Software Foundation, either version 3 of the License, or
7
+ * (at your option) any later version.
8
+ *
9
+ * This program is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ * GNU General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU General Public License
15
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
16
+ */
17
+
18
+ package org .photonvision .vision .pipeline ;
19
+
20
+ import java .lang .annotation .ElementType ;
21
+ import java .lang .annotation .Retention ;
22
+ import java .lang .annotation .RetentionPolicy ;
23
+ import java .lang .annotation .Target ;
24
+
25
+ @ Target (ElementType .FIELD )
26
+ @ Retention (RetentionPolicy .RUNTIME )
27
+ /** This annotation is used to suppress copying the settings from one pipeline to the next */
28
+ public @interface SuppressSettingCopy {}
Original file line number Diff line number Diff line change @@ -518,6 +518,10 @@ public void changePipelineType(int newType) {
518
518
// Copy all fields from AdvancedPipelineSettings/its superclasses from old to new
519
519
try {
520
520
for (Field field : getAllFields (AdvancedPipelineSettings .class )) {
521
+ if (field .isAnnotationPresent (SuppressSettingCopy .class )) {
522
+ // Skip fields that are annotated with SuppressSettingCopy
523
+ continue ;
524
+ }
521
525
Object value = field .get (oldSettings );
522
526
logger .debug ("setting " + field .getName () + " to " + value );
523
527
field .set (newSettings , value );
@@ -528,10 +532,6 @@ public void changePipelineType(int newType) {
528
532
529
533
logger .info ("Adding new pipe of type " + type + " at idx " + idx );
530
534
531
- // type gets overritten by reflction hackery above
532
- newSettings .pipelineIndex = idx ;
533
- newSettings .pipelineType = type ;
534
-
535
535
userPipelineSettings .set (idx , newSettings );
536
536
537
537
setPipelineInternal (idx );
You can’t perform that action at this time.
0 commit comments