void CreateSpriteThumb(GameObject createPrefab, string pathTexture) { string filename = NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.TEMPPREVIEWTEXTURE), NgAsset.GetPrefabThumbFilename(createPrefab)); if (AssetDatabase.CopyAsset(pathTexture, filename)) { NgAsset.CaptureResize(filename); } }
protected virtual void LoadGroups() { // Load Group if (0 < m_nProjectCount) { string[] groupFolderStrings = NgAsset.GetFolderList(NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.PROJECTS), m_ProjectFolerContents[m_nProjectIndex].text), null, null, 0, out m_nGroupCount); m_GroupFolderContents = NgConvert.StringsToContents(groupFolderStrings); } }
public static void EndSaveBackThumb() { string filename = m_SaveBackThumbFilename; FXMakerMain.inst.GetFXMakerControls().ResumeTimeScale(); NgAsset.CaptureRectSave(GetThumbCaptureRect(), FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.TEMPPREVIEWTEXTURE), filename); // gameObject.active = true; // LoadTool(""); }
// Property ------------------------------------------------------------------------- // Control Function ----------------------------------------------------------------- void ReimportTextures(string assetPath, bool bRecursively, TextureWrapMode wrapMode, FilterMode filterMode, int anisoLevel, int maxTextureSize, TextureImporterFormat textureFormat) { int nOutFindFile; NgAsset.ObjectNode[] objNodes = NgAsset.GetTexturePathList("Assets/" + assetPath, bRecursively, 0, out nOutFindFile); for (int n = 0; n < objNodes.Length; n++) { ReimportTexture(objNodes[n].m_AssetPath, wrapMode, filterMode, anisoLevel, maxTextureSize, textureFormat); } }
// Property ------------------------------------------------------------------------- // Control Function ----------------------------------------------------------------- void ResizePrefabs(string assetPath, bool bRecursively) { int nOutFindFile; NgAsset.ObjectNode[] objNodes = NgAsset.GetPrefabList("Assets/" + assetPath, false, bRecursively, 0, false, NgEnum.PREFAB_TYPE.All, out nOutFindFile); for (int n = 0; n < objNodes.Length; n++) { ResizePrefab(objNodes[n].m_AssetPath); } }
public static IEnumerator EndSaveEffectThumbCoroutine() { yield return(new WaitForEndOfFrame()); string filename = NgAsset.GetPrefabThumbFilename(FXMakerMain.inst.GetOriginalEffectPrefab()); FXMakerMain.inst.GetFXMakerControls().ResumeTimeScale(); NgAsset.CaptureRectSave(GetThumbCaptureRect(), FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.TEMPPREVIEWTEXTURE), filename); FXMakerMain.inst.SaveTool(""); FXMakerMain.inst.SetActiveTool(1); }
// Effect Capture --------------------------------------------------------------------------------------------- public static void StartSaveEffectThumb() { // gameObject.active = false; FXMakerMain.inst.GetComponent <FXMakerBackground>().enabled = false; FXMakerMain.inst.GetComponent <FXMakerEffect>().enabled = false; // FXMakerMain.inst.GetComponentInChildren<FXMakerGizmo>().enabled = false; NgAsset.CaptureRectPreprocess(FXMakerLayout.m_fScreenShotEffectZoomRate); FXMakerMain.inst.GetFXMakerControls().SetTimeScale(0); FXMakerMain.inst.StartThumbCapture(); }
// background俊 荤侩瞪 府家胶 格废 备己窍扁 void LoadResourceFolder() { for (int n = 0; n < m_CloneTypeCount; n++) { string strDir = NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.BACKGROUNDRESOURCES), m_ResourceSubDir[n]); int nFileCount = 0; m_ClonePrefabs[n] = NgAsset.GetPrefabList(strDir, false, true, FXMakerLayout.m_nMaxResourceListCount, out nFileCount); m_CloneContents[n] = new GUIContent[m_ClonePrefabs[n].Length]; } BuildResourceContents(); }
public static IEnumerator EndSaveBackThumbCoroutine() { yield return(new WaitForEndOfFrame()); string filename = m_SaveBackThumbFilename; FXMakerMain.inst.GetFXMakerControls().ResumeTimeScale(); NgAsset.CaptureRectSave(GetThumbCaptureRect(), FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.TEMPPREVIEWTEXTURE), filename); // gameObject.active = true; // LoadTool(""); FXMakerMain.inst.SetActiveTool(0); }
void CreatePrefab(NgAsset.ObjectNode modelNode) { string targetPath = NgFile.CombinePath("Assets/" + m_tarPrefabPath, NgFile.GetFilename(modelNode.m_AssetPath) + ".prefab"); GameObject loadPrefab = NgAsset.LoadPrefab(targetPath); if (loadPrefab != null) { // 있으면 pass return; } PrefabUtility.CreatePrefab(targetPath, (GameObject)modelNode.m_Object); AssetDatabase.SaveAssets(); EditorApplication.SaveAssets(); }
void NewPrefab() { if (m_bGroupFoler == false || m_GroupFolerContents[m_nGroupIndex].text != "") { SaveProject(); if (m_CurrentBackgroundInfo != null) { DestroyImmediate(m_CurrentBackgroundInfo.gameObject); } string createPath = NgAsset.CreateDefaultUniquePrefab(m_DefaultBackgroundPrefab, NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.BACKGROUNDPREFABS), NgFile.CombinePath(m_GroupFolerContents[m_nGroupIndex].text, "NewBackground.prefab"))); SaveProject(); SelectToolbar(m_nGroupIndex, createPath); } }
bool LoadGroup(int nProjectIndex, int nGroupIndex, string groupName) { if (m_nProjectCount <= nProjectIndex) { nProjectIndex = m_nProjectCount - 1; } m_nProjectIndex = nProjectIndex; // load Group if (0 <= m_nProjectIndex && m_nProjectIndex < m_nProjectCount) { string[] groupFolderStrings = NgAsset.GetFolderList(NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.PROJECTS), m_ProjectFolerContents[m_nProjectIndex].text), null, null, FXMakerOption.inst.m_nMinBottomToolbarCount, out m_nGroupCount); m_GroupFolderContents = NgConvert.StringsToContents(groupFolderStrings); if (m_GroupFolderContents != null) { for (int n = 0; n < m_GroupFolderContents.Length; n++) { if (groupName != "" && m_GroupFolderContents[n].text == groupName) { nGroupIndex = n; } if (m_GroupFolderContents[n].text == null) { m_GroupFolderContents[n].tooltip = FXMakerTooltip.GetHsToolEffect("EMPTYGROUP_HOVER", NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.PROJECTS), m_ProjectFolerContents[m_nProjectIndex].text)); } else { if (IsReadOnlyFolder(m_ProjectFolerContents[m_nProjectIndex].text) || IsReadOnlyFolder(m_GroupFolderContents[n].text)) { m_GroupFolderContents[n].tooltip = FXMakerTooltip.GetHsToolEffect("GROUP_HOVER", NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.PROJECTS), m_ProjectFolerContents[m_nProjectIndex].text, m_GroupFolderContents[n].text) + "\n" + FXMakerTooltip.GetHsToolMessage("FOLDER_READONLY", "")); } else { m_GroupFolderContents[n].tooltip = FXMakerTooltip.GetHsToolEffect("GROUP_HOVER", NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.PROJECTS), m_ProjectFolerContents[m_nProjectIndex].text, m_GroupFolderContents[n].text)); } } } } SetGroupIndex(nGroupIndex); LoadEffectFolder(""); return(true); } else { m_nGroupCount = 0; SetGroupIndex(-1); return(false); } }
void CreatePrefab(NgAsset.ObjectNode modelNode) { string targetPath = NgFile.CombinePath("Assets/" + m_tarPrefabPath, NgFile.GetFilename(modelNode.m_AssetPath) + ".prefab"); GameObject loadPrefab = NgAsset.LoadPrefab(targetPath); if (loadPrefab != null) { // 있으면 pass return; } PrefabUtility.CreatePrefab(targetPath, (GameObject)modelNode.m_Object); AssetDatabase.SaveAssets(); AssetDatabase.SaveAssets(); }
public static string CloneEffectPrefab(GameObject srcPrefab) { string createPath = NgAsset.ClonePrefab(srcPrefab); NgUtil.LogMessage("CloneEffectPrefab() - " + createPath); // copy preview image if (createPath != "") { string srcFile = NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.TEMPPREVIEWTEXTURE), NgAsset.GetPrefabThumbFilename(srcPrefab)); string tarFile = NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.TEMPPREVIEWTEXTURE), NgAsset.GetPrefabThumbFilename(createPath)); AssetDatabase.CopyAsset(srcFile, tarFile); AssetDatabaseRefresh(); } return(createPath); }
public static void DeleteEffectPrefab(GameObject tarPrefab) { // delete preview image string filename = NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.TEMPPREVIEWTEXTURE), NgAsset.GetPrefabThumbFilename(tarPrefab)); NgUtil.LogMessage("DeleteEffectPrefab() - delete preview - " + filename); AssetDatabase.MoveAssetToTrash(filename); // AssetDatabase.DeleteAsset(filename); // check clipboard FXMakerClipboard.inst.CheckDeletePrefab(tarPrefab); // delete prefab NgAsset.DeletePrefab(tarPrefab); AssetDatabaseRefresh(); AssetDatabaseSaveAssets(); }
public void LoadProject() { NgUtil.LogDevelop("LoadProject - FxmBackMain"); // group 弃歹甸 捞抚 阂矾坷扁 if (m_bGroupFoler) { string[] groupFolerStrings = NgAsset.GetFolderList(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.BACKGROUNDPREFABS), null, null, FXMakerOption.inst.m_nMinTopToolbarCount, out m_nGroupCount); m_GroupFolerContents = NgConvert.StringsToContents(groupFolerStrings); for (int n = 0; n < m_GroupFolerContents.Length; n++) { if (m_GroupFolerContents[n].text == null) { m_GroupFolerContents[n].tooltip = FXMakerTooltip.GetHsToolBackground("EMPTYGROUP_HOVER", FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.BACKGROUNDPREFABS)); } else { m_GroupFolerContents[n].tooltip = FXMakerTooltip.GetHsToolBackground("GROUP_HOVER", m_GroupFolerContents[n].text); } } } else { m_GroupFolerContents = new GUIContent[1]; m_GroupFolerContents[0] = new GUIContent("", ""); m_nGroupCount = 1; } // 固府 沥狼等 府家胶 肺靛 LoadResourceFolder(); // 捞傈 急琶沥焊 贸府 int nGroupIndex = 0; int nBackgroundIndex = 0; if (FXMakerLayout.m_bDevelopPrefs == false) { nGroupIndex = UnityEditor.EditorPrefs.GetInt("FXMakerBackground.m_nGroupIndex", 0); nBackgroundIndex = UnityEditor.EditorPrefs.GetInt("FXMakerBackground.m_nBackgroundIndex", 0); } SelectToolbar(nGroupIndex, nBackgroundIndex); // default Background if (m_CurrentBackgroundInfo == null) { SelectToolbar(0, 0); } }
// ------------------------------------------------------------------------------------------- void FindCurrentTextureMaterials(Material currentMat) { m_nCurrentTextureMaterialIndex = -1; m_CurrentTextureMaterials = null; m_CurrentTextureMaterialContents = null; if (currentMat.mainTexture == null) { return; } string texPath = AssetDatabase.GetAssetPath(currentMat.mainTexture); if (texPath == "") { return; } int nMaterialCount = 0; Material[] materialObjects = NgAsset.GetMaterialList(NgFile.TrimFilenameExt(texPath), true, FXMakerLayout.m_nMaxMaterialListCount, out nMaterialCount); ArrayList matList = new ArrayList(); // find foreach (Material mat in materialObjects) { // ������ ǥ�� if (mat.mainTexture == currentMat.mainTexture) { if (mat == currentMat) { // Debug.Log("if (mat == currentMat)----------------------"); m_nCurrentTextureMaterialIndex = matList.Count; } matList.Add(mat); } m_CurrentTextureMaterials = NgConvert.ToArray <Material>(matList); m_CurrentTextureMaterialContents = new GUIContent[m_CurrentTextureMaterials.Length]; // build content BuildCurrentTextureContents(); } }
void BuildNewShaderContents() { CancelInvoke("BuildNewShaderContents"); if (enabled == false) { return; } if (m_NewShaderMaterials == null || m_NewShaderMaterials.Length <= 0) { return; } int nNotLoadPreviewCount = 0; int nCount = 0; foreach (Material mat in m_NewShaderMaterials) { if (m_NewShaderMaterialContents[nCount] == null) { m_NewShaderMaterialContents[nCount] = new GUIContent(); m_NewShaderMaterialContents[nCount].text = mat.name; m_NewShaderMaterialContents[nCount].tooltip = FXMakerTooltip.Tooltip(mat.name + "\n" + (mat.shader != null ? mat.shader.name : "Not Selected")); } if (m_NewShaderMaterialContents[nCount].image == null) { m_NewShaderMaterialContents[nCount].image = NgAsset.GetAssetPreview(mat); if (m_NewShaderMaterialContents[nCount].image != null) { m_NewShaderMaterialContents[nCount].tooltip += FXMakerTooltip.AddPopupPreview(m_NewShaderMaterialContents[nCount].image); } } if (m_NewShaderMaterialContents[nCount].image == null) { nNotLoadPreviewCount++; } nCount++; } if (0 < nNotLoadPreviewCount) { Invoke("BuildNewShaderContents", FXMakerLayout.m_fReloadPreviewTime); } }
void SaveCurrentObjectToPrefabFile() { if (m_nProjectIndex < 0) return; if (FXMakerEffect.inst.m_DefaultEmptyPrefab == null) { Debug.LogError("FXMakerMain.m_DefaultEmptyPrefab is null"); return; } string dstPath = NgFile.CombinePath(m_LoadDirectory, m_SaveFilename + ".prefab"); dstPath = NgAsset.CreateDefaultUniquePrefab(FXMakerEffect.inst.m_DefaultEmptyPrefab, dstPath); GameObject newPrefab = NgAsset.LoadPrefab(dstPath); PrefabUtility.ReplacePrefab(m_SelectedTransform.gameObject, newPrefab); FXMakerAsset.AssetDatabaseSaveAssets(); }
// BackgroundFolder郴狼 prefab list客 捞抚备己窍扁, selectPrefabPath甫 瘤沥且 版快 BackgroundIndex 府畔 int LoadBackgroundFolder(string selectPrefabPath) { // Debug.Log(selectPrefabPath); NgUtil.ClearObjects(m_BackgroundPrefabs); m_nBackgroundCount = 0; // load Group if (0 < m_nGroupCount) { // load Background Folder string loaddir = NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.BACKGROUNDPREFABS), m_GroupFolerContents[m_nGroupIndex].text); // Debug.Log(loaddir); m_BackgroundPrefabs = NgAsset.GetPrefabList(loaddir, false, true, 0, out m_nBackgroundCount); m_BackgroundContents = new GUIContent[Mathf.Max(m_nBackgroundCount, FXMakerOption.inst.m_nMinBottomToolbarCount)]; for (int n = 0; n < m_BackgroundPrefabs.Length; n++) { GUIContent econ = new GUIContent(); econ.image = FXMakerMain.inst.GetPrefabThumbTexture(m_BackgroundPrefabs[n]); econ.text = m_BackgroundPrefabs[n].name; econ.tooltip = FXMakerTooltip.GetHsToolBackground("BACKGROUND_HOVER", m_BackgroundPrefabs[n].name); m_BackgroundContents[n] = econ; } for (int n = m_BackgroundPrefabs.Length; n < FXMakerOption.inst.m_nMinBottomToolbarCount; n++) { GUIContent econ = new GUIContent(); econ.image = null; econ.text = ""; econ.tooltip = FXMakerTooltip.GetHsToolBackground("EMPTYBACKGROUND_HOVER", ""); m_BackgroundContents[n] = econ; } // select prefab if (selectPrefabPath != "") { return(NgAsset.FindPathIndex(loaddir, selectPrefabPath, "prefab")); } } else { } return(-1); }
// ---------------------------------------------------------------------------------------------------------- protected override void LoadProjects() { string loaddir = FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.PROJECTS); m_LoadDirectory = NgFile.PathSeparatorNormalize(loaddir); m_CurveAniObjects = NgAsset.GetCurvePrefabList(m_LoadDirectory, m_NcInfoCurve_FileKeyword, true, FXMakerLayout.m_nMaxPrefabListCount, out m_nProjectCount); Debug.Log(m_nProjectCount); // Load FileName string[] folderStrings = new string[m_nProjectCount]; if (0 < m_nProjectCount) { for (int n = 0; n < m_nProjectCount; n++) { folderStrings[n] = m_CurveAniObjects[n].name.Replace("NcInfoCurve_", ""); } } m_ProjectFolerContents = NgConvert.StringsToContents(folderStrings); }
public void ShowBackground(bool bShow) { for (int nIndex = 0; nIndex < m_ReferenceObjects.Length; nIndex++) { int nChildIndex = FXMakerBackground.m_CloneTypeCount + nIndex; // 기존 것 삭제 if (m_ChildObjects[nChildIndex] != null) { Object.DestroyImmediate(m_ChildObjects[nChildIndex]); m_ChildObjects[nChildIndex] = null; } if (bShow && m_ReferenceObjects[nIndex] != null) { m_ChildObjects[nChildIndex] = NgAsset.LoadPrefab(m_ReferenceObjects[nIndex], gameObject); m_ChildObjects[nChildIndex].name = m_ChildObjects[nChildIndex].name.Replace("(Clone)", ""); NgObject.SetActiveRecursively(m_ChildObjects[nChildIndex], true); } } }
void AddObjects(string loaddir) { m_LoadDirectory = NgFile.PathSeparatorNormalize(loaddir); // if (m_bSelectMeshDialog) // m_PrefabObjects = NgAsset.GetMeshList(m_LoadDirectory, true, FXMakerLayout.m_nMaxPrefabListCount, out m_nObjectCount); // else m_PrefabObjects = NgAsset.GetPrefabList(m_LoadDirectory, false, true, FXMakerLayout.m_nMaxPrefabListCount, out m_nObjectCount); if (m_bSelectMeshDialog) m_ObjectNodes = NgAsset.GetMeshList(m_LoadDirectory, true, FXMakerLayout.m_nMaxPrefabListCount, out m_nObjectCount); else m_ObjectNodes = NgAsset.GetPrefabList(m_LoadDirectory, false, true, FXMakerLayout.m_nMaxPrefabListCount, (m_LoadPrefabType == NgEnum.PREFAB_TYPE.All ? true : false), m_LoadPrefabType, out m_nObjectCount); m_ObjectContents = new GUIContent[m_nObjectCount]; // Current Select if (m_AddGameObject != null) { for (int n=0; n < m_nObjectCount; n++) if (m_ObjectNodes[n].m_AssetPath == AssetDatabase.GetAssetPath(m_AddPrefabObject)) m_nObjectIndex = n; } BuildContents(); }
public void SetCurrentEffectPrefab(GameObject setPrefab, GameObject effectRoot, bool bUpdateOnlyPrefab) { if (m_bApplicationQuit) { return; } if (IsStartTooMain() || setPrefab == null) { return; } m_OriginalEffectPrefab = setPrefab; if (bUpdateOnlyPrefab) { return; } NsEffectManager.PreloadResource(setPrefab); m_OriginalEffectObject = NgAsset.LoadPrefab(setPrefab, effectRoot); m_OriginalEffectObject.name = m_OriginalEffectObject.name.Replace("(Clone)", "(Original)"); NgObject.SetActiveRecursively(m_OriginalEffectObject, false); if (IsLoadingProject() == false) { FXMakerAsset.SetPingObject(m_OriginalEffectObject); } // EffectHierarchy if (GetFXMakerHierarchy() != null) { GetFXMakerHierarchy().ShowHierarchy(m_OriginalEffectObject); } // Create ShowObject CreateCurrentInstanceEffect(true); }
void SaveCurveAniToPrefabFile() { if (m_nProjectIndex < 0) { return; } if (m_DefaultSavePrefab == null) { Debug.LogError("FxmFolderPopup_NcCurveAnimation.m_DefaultSavePrefab is null"); return; } string dstPath = NgFile.CombinePath(m_LoadDirectory, m_NcCurveAni_FileKeyword + m_SaveFilename + ".prefab"); dstPath = NgAsset.CreateDefaultUniquePrefab(m_DefaultSavePrefab, dstPath); GameObject newPrefab = NgAsset.LoadPrefab(dstPath); NcCurveAnimation newCom = newPrefab.AddComponent <NcCurveAnimation>(); m_CurrentCurveAnimation.CopyTo(newCom, false); FXMakerAsset.AssetDatabaseSaveAssets(); }
void SetCurrentBackgroundInfo(GameObject setPrefab) { // clear current NgObject.RemoveAllChildObject(m_CurrentBackgroundRoot, true); if (m_CurrentBackgroundInfo != null) { DestroyImmediate(m_CurrentBackgroundInfo.gameObject); } if (setPrefab != null) { GameObject obj = NgAsset.LoadPrefab(setPrefab, m_CurrentBackgroundRoot); obj.name = obj.name.Replace("(Clone)", "(Original)"); m_CurrentBackgroundInfo = obj.GetComponent <FxmInfoBackground>(); m_CurrentBackgroundInfo.SetActive(); if (FXMakerMain.inst.IsLoadingProject() == false) { FXMakerAsset.SetPingObject(setPrefab, m_CurrentBackgroundInfo); } FXMakerMain.inst.GetFXMakerMouse().UpdateCamera(); } }
void AddObjects(string loaddir) { m_LoadDirectory = NgFile.PathSeparatorNormalize(loaddir); m_CurveAniObjects = NgAsset.GetCurvePrefabList(m_LoadDirectory, "", true, FXMakerLayout.m_nMaxPrefabListCount, out m_nObjectCount); ArrayList curveAnis = new ArrayList(); foreach (GameObject obj in m_CurveAniObjects) { if (obj.GetComponent <NcCurveAnimation>() != null && obj.name.Contains(FxmFolderPopup_NcInfoCurve.m_NcInfoCurve_FileKeyword) == false) { curveAnis.Add(obj); } } m_CurveAniObjects = NgConvert.ToArray <GameObject>(curveAnis); if (m_CurveAniObjects == null) { m_CurveAniObjects = new GameObject[0]; } m_nObjectCount = m_CurveAniObjects.Length; m_ObjectContents = new GUIContent[m_nObjectCount]; // Current Select if (m_SelCurveAniObject != null) { for (int n = 0; n < m_nObjectCount; n++) { if (m_CurveAniObjects[n] == m_SelCurveAniObject) { m_nObjectIndex = n; } } } BuildContents(); }
// Prefab --------------------------------------------------------------------------------------------------------------- public static string CopyEffectPrefab(GameObject srcPrefab, string tarPath, bool bCutCopy) { NgUtil.LogMessage("CopyPrefab() - tarPath : " + tarPath); bool bCopy = false; string errstr = "err"; string srcPath = AssetDatabase.GetAssetPath(srcPrefab); tarPath = NgFile.CombinePath(tarPath, NgFile.GetFilenameExt(srcPath)); tarPath = AssetDatabase.GenerateUniqueAssetPath(tarPath); NgUtil.LogDevelop("CopyEffectPrefab() - tarPath : " + tarPath); // tarPath = AssetDatabase.ValidateMoveAsset(srcPath, tarPath); NgUtil.LogDevelop("CopyEffectPrefab() - src : " + srcPath); NgUtil.LogDevelop("CopyEffectPrefab() - tar : " + tarPath); if (bCutCopy) { errstr = AssetDatabase.MoveAsset(srcPath, tarPath); } else { bCopy = AssetDatabase.CopyAsset(srcPath, tarPath); } // copy preview image if (errstr == "" || bCopy == true) { string srcFile = NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.TEMPPREVIEWTEXTURE), NgAsset.GetPrefabThumbFilename(srcPrefab)); string tarFile = NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.TEMPPREVIEWTEXTURE), NgAsset.GetPrefabThumbFilename(tarPath)); if (bCutCopy) { AssetDatabase.MoveAsset(srcFile, tarFile); } else { AssetDatabase.CopyAsset(srcFile, tarFile); } } else { Debug.LogWarning("CopyEffectPrefab() - CopyPreview : Faild"); } AssetDatabaseRefresh(); AssetDatabaseSaveAssets(); return(tarPath); }
void LoadScriptList() { int nScriptCount; int nFindFolderCount; int nCount = 0; string scriptDir = FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.SCRIPTS); // load folder string[] groupStrings = NgAsset.GetFolderList(scriptDir, null, "Hide", 0, out nFindFolderCount); m_GroupContents = NgConvert.StringsToContents(groupStrings); if (m_nGroupIndex < 0 || m_GroupContents.Length <= m_nGroupIndex) { m_nGroupIndex = 0; } if (m_GroupContents.Length == 0) { m_nGroupIndex = -1; } // load file if (m_GroupContents[m_nGroupIndex].text == "Unity") { List <string> addList = new List <string>(); // add UnityComponent addList.Add("MeshFilter"); addList.Add("MeshRenderer"); addList.Add(""); addList.Add("ParticleSystem"); addList.Add("ParticleSystemRenderer"); addList.Add("TrailRenderer"); addList.Add("LineRenderer"); addList.Add(""); addList.Add("EllipsoidParticleEmitter"); addList.Add("MeshParticleEmitter"); addList.Add("ParticleAnimator"); addList.Add("ParticleRenderer"); addList.Add(""); addList.Add("Rigidbody"); addList.Add("BoxCollider"); addList.Add("SphereCollider"); addList.Add("CapsuleCollider"); addList.Add("MeshCollider"); addList.Add("WorldParticleCollider"); addList.Add(""); addList.Add("Animation"); addList.Add("AudioSource"); m_ScriptScrings = new string[addList.Count]; m_ScriptContents = new GUIContent[addList.Count]; for (int n = 0; n < addList.Count; n++) { m_ScriptContents[n] = GetHelpContentScript(addList[n]); m_ScriptScrings[n] = addList[n]; } } else { string dir = (m_nGroupIndex < 0 ? scriptDir : NgFile.CombinePath(scriptDir, m_GroupContents[m_nGroupIndex].text + "/")); string[] scriptScrings = NgAsset.GetFileList(dir, 0, out nScriptCount); m_ScriptScrings = new string[scriptScrings.Length]; m_ScriptContents = new GUIContent[scriptScrings.Length]; for (int n = 0; n < scriptScrings.Length; n++) { // if (scriptScrings[n].Contains("Behaviour.")) // continue; string ext = Path.GetExtension(scriptScrings[n]); ext = ext.ToLower(); if (ext == ".cs" || ext == ".js") { m_ScriptContents[nCount] = GetHelpContentScript(NgFile.TrimFileExt(scriptScrings[n])); m_ScriptScrings[nCount] = NgFile.TrimFileExt(scriptScrings[n]); nCount++; } } m_ScriptScrings = NgConvert.ResizeArray(m_ScriptScrings, nCount); m_ScriptContents = NgConvert.ResizeArray(m_ScriptContents, nCount); } }
public void LoadProject(string defaultEffectPath) { // Debug.Log(defaultEffectPath); NgUtil.LogDevelop("LoadProject - FXMakerMain"); // clear current FXMakerMain.inst.ClearCurrentEffectObject(m_CurrentEffectRoot, true); // load Project string[] projectFolerStrings = NgAsset.GetFolderList(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.PROJECTS), null, null, FXMakerOption.inst.m_nMinTopToolbarCount, out m_nProjectCount); m_ProjectFolerContents = NgConvert.StringsToContents(projectFolerStrings); for (int n = 0; n < m_ProjectFolerContents.Length; n++) { if (m_ProjectFolerContents[n].text == null) { m_ProjectFolerContents[n].tooltip = FXMakerTooltip.GetHsToolEffect("EMPTYPROJECT_HOVER", FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.PROJECTS)); } else { if (IsReadOnlyFolder(m_ProjectFolerContents[n].text)) { m_ProjectFolerContents[n].tooltip = FXMakerTooltip.GetHsToolEffect("PROJECT_HOVER", NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.PROJECTS), m_ProjectFolerContents[n].text) + "\n" + FXMakerTooltip.GetHsToolMessage("FOLDER_READONLY", "")); } else { m_ProjectFolerContents[n].tooltip = FXMakerTooltip.GetHsToolEffect("PROJECT_HOVER", NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.PROJECTS), m_ProjectFolerContents[n].text)); } } } int nProjectIndex = -1; int nGroupIndex = 0; int nEffectIndex = 0; // 捞傈 急琶沥焊 贸府 if (FXMakerLayout.m_bDevelopPrefs == false) { nProjectIndex = UnityEditor.EditorPrefs.GetInt("FXMakerEffect.m_nProjectIndex", nProjectIndex); nGroupIndex = UnityEditor.EditorPrefs.GetInt("FXMakerEffect.m_nGroupIndex", nGroupIndex); nEffectIndex = UnityEditor.EditorPrefs.GetInt("FXMakerEffect.m_nEffectIndex", nEffectIndex); m_nScrollColumn = UnityEditor.EditorPrefs.GetInt("FXMakerEffect.m_nScrollColumn", m_nScrollColumn); } // defaultEffectPath if (defaultEffectPath != null && defaultEffectPath != "") { string projectPath = defaultEffectPath.Replace(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.PROJECTS), ""); string projectName = NgFile.GetSplit(projectPath, 1); string groupName = NgFile.GetSplit(projectPath, 2); for (nProjectIndex = 0; nProjectIndex < m_ProjectFolerContents.Length; nProjectIndex++) { if (m_ProjectFolerContents[nProjectIndex].text == projectName) { break; } } SelectToolbar(nProjectIndex, groupName, defaultEffectPath); } else { // Search DefaultDir if (nProjectIndex < 0) { for (nProjectIndex = 0; nProjectIndex < m_ProjectFolerContents.Length; nProjectIndex++) { if (m_ProjectFolerContents[nProjectIndex].text == m_DefaultProjectName) { break; } } } SelectToolbar(nProjectIndex, nGroupIndex, nEffectIndex); } }
void ThumbPrefab() { FXMakerCapture.StartSaveBackThumb(NgAsset.GetPrefabThumbFilename(m_BackgroundPrefabs[m_nBackgroundIndex])); }