private void UpdateDrawable(GrasshopperData grasshopperData) { if (!grasshopperData.IsVisible) { return; } var definition = DefinitionManager.Definition(grasshopperData.Definition); if (definition == null) { return; } GrasshopperPlayer.Run(definition, grasshopperData, Document); var newDrawable = new CompoundDrawable { Color = GhDataSettings.Color, ColorSelected = GhDataSettings.Color, IsRenderMode = GhDataSettings.VisualStyle == GH_PreviewMode.Shaded }; GrasshopperPreview.GetPreview(definition, newDrawable); definition.Dispose(); _grasshopperData[grasshopperData.ObjectId] = newDrawable; }
public void Bake(List <_OdDb.ObjectId> ghDataIds, UI.BakeDialog bakeProperties) { DisableReactors(); var saveDoc = GhDrawingContext.LinkedDocument; GhDrawingContext.LinkedDocument = Document; using (var transaction = Document.Database.TransactionManager.StartTransaction()) { using (var form = new UI.ModalForm()) { foreach (var ghDataId in ghDataIds) { var ghData = transaction.GetObject(ghDataId, _OdDb.OpenMode.ForRead) as GrasshopperData; if (ghData == null) { continue; } var definition = DefinitionManager.Definition(ghData.Definition); if (definition == null) { continue; } foreach (var obj in definition.Objects.OfType <Components.BakeComponent>()) { if (!obj.Locked) { Components.BakeComponent.Expire(obj, bakeProperties); } } GrasshopperPlayer.Run(definition, ghData, Document); } } transaction.Commit(); } GhDrawingContext.LinkedDocument = saveDoc; EnableReactors(); }