/// <summary> /// Refreshes the Generator /// </summary> /// <param name="forceUpdate">true to force a refresh of all modules</param> public void Refresh(bool forceUpdate = false) { if (!IsInitialized) { return; } if (mNeedSort) { doSortModules(); } CGModule firstChanged = null; for (int i = 0; i < Modules.Count; i++) { if (forceUpdate && Modules[i] is IOnRequestProcessing) { Modules[i].Dirty = true; // Dirty state will be resetted to false, but last data will be deleted - forcing a recalculation } if (!(Modules[i] is INoProcessing) && (Modules[i].Dirty || (forceUpdate && !(Modules[i] is IOnRequestProcessing)))) { Modules[i].checkOnStateChangedINTERNAL(); if (Modules[i].IsInitialized && Modules[i].IsConfigured) { if (firstChanged == null) { #if UNITY_EDITOR || CURVY_DEBUG DEBUG_ExecutionTime.Start(); #endif firstChanged = Modules[i]; } //Debug.Log("Refresh " + Modules[i].ModuleName); Modules[i].doRefresh(); //Debug.Log("Updated " + Modules[i].ModuleName); } //else //{ //Debug.Log("Early OUT at "+Modules[i].ModuleName); //break; //} } } if (firstChanged != null) { #if UNITY_EDITOR || CURVY_DEBUG DEBUG_ExecutionTime.Stop(); if (!Application.isPlaying) { EditorUtility.UnloadUnusedAssetsImmediate(); } #endif OnRefreshEvent(new CurvyCGEventArgs(this, firstChanged)); } }
public Component Create(CGModule module, string context) { var spl = CurvySpline.Create(); spl.transform.position = Vector3.zero; spl.Closed = true; spl.Add(new Vector3(0, 0, 0), new Vector3(5, 0, 10), new Vector3(-5, 0, 10)); return(spl); }
public Component Create(CGModule module, string context) { var spl = CurvySpline.Create(); spl.transform.position = Vector3.zero; spl.RestrictTo2D = true; spl.Closed = true; spl.Orientation = CurvyOrientation.None; spl.gameObject.AddComponent <CSCircle>().Refresh(); return(spl); }
public void Destroy(CGModule module, Component obj, string context, bool kill) { if (obj != null) { #if UNITY_EDITOR if (!Application.isPlaying) { Undo.DestroyObjectImmediate(obj.gameObject); } else #endif GameObject.Destroy(obj); } }
public static void DestroyResource(CGModule module, string resName, Component obj, string context, bool kill) { if (Loader.Count == 0) { getLoaders(); } if (Loader.ContainsKey(resName)) { var loader = Loader[resName]; loader.Destroy(module, obj, context, kill); } else { Debug.LogError("CGResourceHandler: Missing Loader for resource '" + resName + "'"); } }
public static Component CreateResource(CGModule module, string resName, string context) { if (Loader.Count == 0) { getLoaders(); } if (Loader.ContainsKey(resName)) { var loader = Loader[resName]; return(loader.Create(module, context)); } else { Debug.LogError("CGResourceHandler: Missing Loader for resource '" + resName + "'"); return(null); } }
public void Destroy(CGModule module, Component obj, string context, bool kill) { if (obj != null) { if (kill) { if (Application.isPlaying) { GameObject.Destroy(obj.gameObject); } else { GameObject.DestroyImmediate(obj.gameObject); } } else { module.Generator.PoolManager.GetPrefabPool(context).Push(obj.gameObject); } } }
public void Destroy(CGModule module, Component obj, string context, bool kill) { if (obj != null) { if (kill) { if (Application.isPlaying) { GameObject.Destroy(obj.gameObject); } else { GameObject.DestroyImmediate(obj.gameObject); } } else { obj.StripComponents(typeof(CGMeshResource), typeof(MeshFilter), typeof(MeshRenderer)); module.Generator.PoolManager.GetComponentPool <CGMeshResource>().Push(obj); } } }
public void setINTERNAL(CurvyGenerator generator, string moduleName, string slotName) { m_Module = generator.GetModule(moduleName); m_SlotName = slotName; mSlot = null; }
/*! \cond PRIVATE */ public void setINTERNAL(CGModule module, string slotName) { m_Module = module; m_SlotName = slotName; mSlot = null; }
public CGDataReference(CGModule module, string slotName) { setINTERNAL(module, slotName); }
public Component Create(CGModule module, string context) { var go = module.Generator.PoolManager.GetPrefabPool(context).Pop(); return(go.transform); }
public Component Create(CGModule module, string context) { var cmp = module.Generator.PoolManager.GetComponentPool <CGMeshResource>().Pop(); return(cmp); }
public bool IsUsing(CGModule module) { return(ModuleID == module.UniqueID || TargetModuleID == module.UniqueID); }
public CGDataReference(CurvyGenerator generator, string moduleName, string slotName) { m_Module = generator.GetModule(moduleName); m_SlotName = slotName; }
public CGDataReference(CGModule module, string slotName) { m_Module = module; m_SlotName = slotName; }