// ---------------------------------------------------------------------- void PropertiesWizardCompleteCreation(iCS_EditorObject module) { module.Fold(); Type classType = module.RuntimeType; if (!iCS_Types.IsStaticClass(classType)) { PropertiesWizardCreatePortIfNonExisting(module, "Target", classType, VSObjectType.InFixDataPort, (int)iCS_PortIndex.Target); } module.Fold(); }
// ---------------------------------------------------------------------- // OK public static void Fold(iCS_EditorObject node) { #if DEBUG Debug.Log("iCanScript: Fold => " + node.DisplayName); #endif if (!node.IsNode || node.DisplayOption == iCS_DisplayOptionEnum.Folded) { return; } var iStorage = node.IStorage; OpenTransaction(iStorage); try { SendStartRelayoutOfTree(iStorage); iStorage.AnimateGraph(null, _ => { node.Fold(); node.SetAsHighestLayoutPriority(); iStorage.ForcedRelayoutOfTree(); node.ClearLayoutPriority(); var visualEditor = iCS_EditorController.FindVisualEditor(); if (visualEditor != null) { visualEditor.SmartFocusOn(node); } } ); SendEndRelayoutOfTree(iStorage); } catch (System.Exception) { CancelTransaction(iStorage); return; } CloseTransaction(iStorage, "Fold " + node.DisplayName); }
// ---------------------------------------------------------------------- public static void PasteIntoGraph(iCS_MonoBehaviourImp sourceMonoBehaviour, iCS_EngineObject sourceRoot, iCS_IStorage iStorage, iCS_EditorObject parent, Vector2 globalPos) { if (!IsCreationAllowed()) { return; } OpenTransaction(iStorage); iCS_EditorObject pasted = null; try { iStorage.AnimateGraph(null, _ => { if (parent.IsFoldedInLayout || parent.IsIconizedInLayout) { parent.Unfold(); } iCS_IStorage srcIStorage = new iCS_IStorage(sourceMonoBehaviour); iCS_EditorObject srcRoot = srcIStorage.EditorObjects[sourceRoot.InstanceId]; pasted = iStorage.Copy(srcRoot, srcIStorage, parent, globalPos, iStorage); if (pasted != null) { if (pasted.IsUnfoldedInLayout) { pasted.Fold(); } iStorage.SelectedObject = pasted; iStorage.ForcedRelayoutOfTree(); } } ); } catch (System.Exception) { CancelTransaction(iStorage); return; } if (pasted != null) { SystemEvents.AnnounceVisualScriptElementAdded(pasted); } CloseTransaction(iStorage, "Add Prefab " + sourceRoot.RawName); }