Example #1
0
 public static GameObject[] GetCurvePrefabList(string strDir, string containFileName, bool bRecursively, int nMaxFile, out int nOutFindFile)
 {
     if (bRecursively)
     {
         ArrayList retArray = GetResourceFileRecursively <GameObject>(strDir, containFileName, nMaxFile, false, NgEnum.PREFAB_TYPE.All, out nOutFindFile);
         return(NgConvert.ToArray <GameObject>(retArray));
     }
     return(NgConvert.ToArray <GameObject>(GetResourceFiles <GameObject>(strDir, containFileName, nMaxFile, false, NgEnum.PREFAB_TYPE.All, out nOutFindFile)));
 }
Example #2
0
 public static Material[] GetMaterialList(string strDir, bool bRecursively, int nMaxFile, out int nOutFindFile)
 {
     if (bRecursively)
     {
         ArrayList retArray = GetResourceFileRecursively <Material>(strDir, null, nMaxFile, false, NgEnum.PREFAB_TYPE.All, out nOutFindFile);
         return(NgConvert.ToArray <Material>(retArray));
     }
     return(NgConvert.ToArray <Material>(GetResourceFiles <Material>(strDir, null, nMaxFile, false, NgEnum.PREFAB_TYPE.All, out nOutFindFile)));
 }
Example #3
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();
        }
    }
Example #4
0
    void UpdateLines()
    {
        bool bParticle = (IsLegacy() || IsShuriken());

        if ((bParticle == false) && (m_BaseTrans.GetComponent <MeshFilter>() == null || m_BaseTrans.GetComponent <MeshFilter>().mesh == null))
        {
            m_bWireframe = false;
            return;
        }

        ArrayList linesArray = new ArrayList();
        Mesh      mesh;

        if (bParticle)
        {
            mesh             = NgSerialized.GetParticleMesh(GetParticleComponent());
            m_bWorldParticle = NgSerialized.GetSimulationSpaceWorld(m_BaseTrans);
        }
        else
        {
            mesh = m_BaseTrans.GetComponent <MeshFilter>().mesh;
        }

        if (mesh != null)
        {
            Vector3[] vertices  = mesh.vertices;
            int[]     triangles = mesh.triangles;

            for (int i = 0; i < triangles.Length / 3; i++)
            {
                linesArray.Add(vertices[triangles[i * 3]]);
                linesArray.Add(vertices[triangles[i * 3 + 1]]);
                linesArray.Add(vertices[triangles[i * 3 + 2]]);
            }
            m_lines = NgConvert.ToArray <Vector3>(linesArray);
        }
    }
Example #5
0
    //=====================================================================================================================================
    public static GameObject[] GetPrefabList(string strDir, bool bIncludeMesh, bool bRecursively, int nMaxFile, out int nOutFindFile)
    {
        ArrayList retArray;
        int       nCount = 0;

        if (bRecursively)
        {
            retArray = GetResourceFileRecursively <GameObject>(strDir, null, nMaxFile, false, NgEnum.PREFAB_TYPE.All, out nOutFindFile);
        }
        else
        {
            retArray = GetResourceFiles <GameObject>(strDir, null, nMaxFile, false, NgEnum.PREFAB_TYPE.All, out nOutFindFile);
        }

        if (bIncludeMesh == false)
        {
            while (true)
            {
                if (retArray.Count <= nCount)
                {
                    break;
                }
                if (PrefabUtility.GetPrefabType((Object)retArray[nCount]) == PrefabType.ModelPrefab)
                {
//                  Debug.Log(((GameObject)retArray[nCount]).name);
                    retArray.RemoveAt(nCount);
                }
                else
                {
                    nCount++;
                }
            }
            nOutFindFile = retArray.Count;
        }

        return(NgConvert.ToArray <GameObject>(retArray));
    }
    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();
    }
Example #7
0
    protected override void LoadObjects()
    {
        ArrayList infoList = new ArrayList();

        m_CurveInfos     = null;
        m_ObjectContents = null;
        m_nObjectCount   = 0;
        m_nObjectIndex   = -1;

        if (m_nGroupCount <= 0)
        {
            return;
        }

        GameObject currentObj = m_CurveAniObjects[m_nProjectIndex];

        if (m_bOnlyCurve)
        {
            NcCurveAnimation curveAnis = currentObj.GetComponent <NcCurveAnimation>();
            if (curveAnis != null)
            {
                List <NcCurveAnimation.NcInfoCurve> curveInfoList = curveAnis.m_CurveInfoList;
                for (int n = 0; n < curveInfoList.Count; n++)
                {
                    curveInfoList[n].m_nTag = n;
                    if (m_nGroupIndex == 0)
                    {
                        infoList.Add(curveInfoList[n]);
                    }
                    else
                    {
                        if (m_nGroupIndex == curveInfoList[n].m_nSortGroup)                                     // 1, 2, 3
                        {
                            infoList.Add(curveInfoList[n]);
                        }
                    }
                }
            }
        }
        else
        {
            NcCurveAnimation[] curveAnis = currentObj.GetComponents <NcCurveAnimation>();
            foreach (NcCurveAnimation curveAni in curveAnis)
            {
                List <NcCurveAnimation.NcInfoCurve> curveInfoList = curveAni.m_CurveInfoList;
                for (int n = 0; n < curveInfoList.Count; n++)
                {
                    NcCurveAnimation.NcInfoCurve curveInfo = curveInfoList[n];
                    curveInfo.m_nTag = n;
                    // Add CurveInfo
                    if (m_bSaveDialog)
                    {
                        if (m_OriCurveInfo.m_ApplyType == curveInfo.m_ApplyType)
                        {
                            infoList.Add(curveInfo);
                        }
                    }
                    else
                    {
                        if (0 < m_nGroupIndex)
                        {
                            if (m_nGroupIndex - 1 == (int)curveInfo.m_ApplyType)
                            {
                                infoList.Add(curveInfo);
                            }
                        }
                        else
                        {
                            infoList.Add(curveInfo);
                        }
                    }
                }
            }
        }

        m_CurveInfos   = NgConvert.ToArray <NcCurveAnimation.NcInfoCurve>(infoList);
        m_nObjectCount = infoList.Count;

        // build contents
        string subDir = AssetDatabase.GetAssetPath(m_CurveAniObjects[m_nProjectIndex]);

        subDir = NgFile.PathSeparatorNormalize(subDir).Replace(m_LoadDirectory, "");

        m_ObjectContents = new GUIContent[m_nObjectCount];
        for (int n = 0; n < m_nObjectCount; n++)
        {
            if (m_ObjectContents[n] == null)
            {
                m_ObjectContents[n]         = new GUIContent();
                m_ObjectContents[n].text    = "";
                m_ObjectContents[n].tooltip = FXMakerTooltip.Tooltip(GetCurveInfo(m_CurveInfos[n], subDir));
            }
        }
        Debug.Log("m_nObjectCount " + m_nObjectCount);
    }
Example #8
0
    // Event -------------------------------------------------------------------------
    // Function ----------------------------------------------------------------------
    public bool SetWireframe(bool bWireframe, bool bTexture, bool bRoot)
    {
        if (m_BaseTrans == null || m_BaseTrans.renderer == null)
        {
            m_bWireframe = false;
            return(false);
        }

        m_bTexture   = bTexture;
        m_bWireframe = bWireframe;
        m_bRoot      = bRoot;
//		m_BaseTrans.renderer.enabled = m_bTexture;
//      if (bWireframe == false)
//      {
//          m_bWireframe = false;
//          return false;
//      }

        bool bParticle = (IsLegacy() || IsShuriken());

        if ((bParticle == false) && (m_BaseTrans.GetComponent <MeshFilter>() == null || m_BaseTrans.GetComponent <MeshFilter>().sharedMesh == null))
        {
            m_bWireframe = false;
            return(false);
        }

//      m_meshRenderer = GetComponent<MeshRenderer>();
//      if (!m_meshRenderer)
//          m_meshRenderer = gameObject.AddComponent<MeshRenderer>();
//      if (m_meshRenderer.material == null)
//      {
//          m_meshRenderer.material = new Material("Shader \"Lines/Background\" { Properties { _Color (\"Main Color\", Color) = (1,1,1,1) } SubShader { Pass {" + (m_ZWrite ? " ZWrite on " : " ZWrite off ") + (m_blend ? " Blend SrcAlpha OneMinusSrcAlpha" : " ") + (m_AWrite ? " Colormask RGBA " : " ") + "Lighting Off Offset 1, 1 Color[_Color] }}}");
// //           m_meshRenderer.material = FXMakerMain.inst.m_LineBackMaterial;
//      }
        if (m_lineMaterial == null)
        {
//          m_lineMaterial	= new Material("Shader \"Lines/Colored Blended\" { SubShader { Pass { Blend SrcAlpha OneMinusSrcAlpha BindChannels { Bind \"Color\",color } ZWrite On Cull Front Fog { Mode Off } } } }");
            m_lineMaterial                  = FXMakerMain.inst.m_LineColorMaterial;
            m_lineMaterial.hideFlags        = HideFlags.HideAndDontSave;
            m_lineMaterial.shader.hideFlags = HideFlags.HideAndDontSave;
        }

        ArrayList linesArray = new ArrayList();
        Mesh      mesh;

        if (bParticle)
        {
            mesh             = NgSerialized.GetParticleMesh(GetParticleComponent());
            m_bWorldParticle = NgSerialized.GetSimulationSpaceWorld(m_BaseTrans);
        }
        else
        {
            mesh = m_BaseTrans.GetComponent <MeshFilter>().sharedMesh;
        }

        if (mesh != null)
        {
            Vector3[] vertices  = mesh.vertices;
            int[]     triangles = mesh.triangles;

            for (int i = 0; i < triangles.Length / 3; i++)
            {
                linesArray.Add(vertices[triangles[i * 3]]);
                linesArray.Add(vertices[triangles[i * 3 + 1]]);
                linesArray.Add(vertices[triangles[i * 3 + 2]]);
            }
            m_lines = NgConvert.ToArray <Vector3>(linesArray);
        }
        return(m_bWireframe);
    }