/// <summary> /// Activates the given <see cref="IGroundTruthGenerator"/>. /// <see cref="IGroundTruthGenerator.SetupMaterialProperties"/> will be called for all /// <see cref="MeshRenderer"/> instances under each object containing a <see cref="Labeling"/> component. /// </summary> /// <param name="generator">The generator to register</param> public void Activate(IGroundTruthGenerator generator) { m_ActiveGenerators.Add(generator); foreach (var label in m_RegisteredLabels) { RecursivelyInitializeGameObjects(label.gameObject, new MaterialPropertyBlock(), label, label.instanceId); } }
/// <summary> /// Activates the given <see cref="IGroundTruthGenerator"/>. <see cref="IGroundTruthGenerator.SetupMaterialProperties"/> /// will be called for all <see cref="MeshRenderer"/> instances under each object containing a <see cref="Labeling"/> component. /// </summary> /// <param name="generator">The generator to register</param> public void Activate(IGroundTruthGenerator generator) { m_ActiveGenerators.Add(generator); Entities.ForEach((Labeling labeling, ref GroundTruthInfo info) => { var gameObject = labeling.gameObject; InitGameObjectRecursive(gameObject, m_MaterialPropertyBlocks.Value, labeling, info.instanceId); }); }
/// <summary> /// Deactivates the given <see cref="IGroundTruthGenerator"/>. /// It will no longer receive calls when <see cref="Labeling"/> instances are created. /// </summary> /// <param name="generator">The generator to deactivate</param> /// <returns> /// True if the <see cref="generator"/> was successfully removed. /// False if <see cref="generator"/> was not active. /// </returns> public bool Deactivate(IGroundTruthGenerator generator) { return(m_ActiveGenerators.Remove(generator)); }