Skip to content

Commit 182136f

Browse files
authored
Merge pull request #357 from Unity-Technologies/fix_label_config_editor_indexing
Fixed an indexing issue with the Id Label Config editor
2 parents e61c5e6 + 05f8c96 commit 182136f

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

TestProjects/PerceptionURP/Assets/Tests/Editor/PerceptionCameraEditorUrpTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ public IEnumerator MissingRendererFeature_ProducesLogError()
4242
gameObject.SetActive(false);
4343
gameObject.AddComponent<Camera>();
4444
gameObject.AddComponent<UniversalAdditionalCameraData>();
45-
4645
var perceptionCamera = gameObject.AddComponent<PerceptionCamera>();
4746
gameObject.SetActive(true);
4847
LogAssert.Expect(LogType.Error, "GroundTruthRendererFeature must be present on the ScriptableRenderer associated with the camera. The ScriptableRenderer can be accessed through Edit -> Project Settings... -> Graphics -> Scriptable Render Pipeline Settings -> Renderer List.");

com.unity.perception/CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1212
### Known Issues
1313

1414
### Added
15-
User can now choose the base folder location to store their generated data.
1615

17-
Added 'projection' field in the capture.sensor metadata. Values are either "perspective" or "orthographic"
16+
The user can now choose the base folder location to store their generated datasets.
17+
18+
Added a `projection` field in the capture.sensor metadata. Values are either "perspective" or "orthographic".
1819

1920
### Changed
2021

@@ -26,6 +27,8 @@ Changed the JSON serialization key of Normal Sampler's standard deviation proper
2627

2728
### Fixed
2829

30+
Fixed an indexing issue with the IdLabelConfig editor. When a new label was added to an empty Id Label Config with Auto Assign IDs enabled, the starting id (0 or 1) was ignored and the new label would always have an id of 0.
31+
2932
## [0.8.0-preview.4] - 2021-07-05
3033

3134
### Upgrade Notes

com.unity.perception/Editor/GroundTruth/IdLabelConfigEditor.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,16 +149,24 @@ void BindItem(VisualElement e, int i)
149149
protected override IdLabelEntry CreateLabelEntryFromLabelString(SerializedProperty serializedArray,
150150
string labelToAdd)
151151
{
152-
int maxLabel = Int32.MinValue;
152+
var maxLabel = int.MinValue;
153153
if (serializedArray.arraySize == 0)
154154
maxLabel = -1;
155155

156-
for (int i = 0; i < serializedArray.arraySize; i++)
156+
for (var i = 0; i < serializedArray.arraySize; i++)
157157
{
158158
var item = serializedArray.GetArrayElementAtIndex(i);
159159
maxLabel = math.max(maxLabel, item.FindPropertyRelative(nameof(IdLabelEntry.id)).intValue);
160160
}
161161

162+
if (maxLabel == -1)
163+
{
164+
var startingLabelId =
165+
(StartingLabelId) serializedObject.FindProperty(nameof(IdLabelConfig.startingLabelId)).enumValueIndex;
166+
if (startingLabelId == StartingLabelId.One)
167+
maxLabel = 0;
168+
}
169+
162170
return new IdLabelEntry
163171
{
164172
id = maxLabel + 1,

com.unity.perception/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,4 @@
2525
"path": "Samples~/Human Pose Labeling and Randomization"
2626
}
2727
]
28-
}
28+
}

0 commit comments

Comments
 (0)