SetIsDifferentCacheDirty() private method

private SetIsDifferentCacheDirty ( ) : void
return void
Example #1
0
        bool ContributeGISettings()
        {
            if (isPreset)
            {
                EditorGUILayout.Toggle(Styles.contributeGI, true);
                return(true);
            }

            bool contributeGI = (m_StaticEditorFlags.intValue & (int)StaticEditorFlags.ContributeGI) != 0;
            bool mixedValue   = (m_StaticEditorFlags.hasMultipleDifferentValuesBitwise & (int)StaticEditorFlags.ContributeGI) != 0;

            EditorGUI.showMixedValue = mixedValue;

            EditorGUI.BeginChangeCheck();
            contributeGI = EditorGUILayout.Toggle(Styles.contributeGI, contributeGI);

            if (EditorGUI.EndChangeCheck())
            {
                SceneModeUtility.SetStaticFlags(m_GameObjectsSerializedObject.targetObjects, (int)StaticEditorFlags.ContributeGI, contributeGI);
                m_GameObjectsSerializedObject.SetIsDifferentCacheDirty();
                m_GameObjectsSerializedObject.Update();
            }

            EditorGUI.showMixedValue = false;

            return(contributeGI && !mixedValue);
        }
 internal virtual void OnForceReloadInspector()
 {
     if (m_SerializedObject != null)
     {
         m_SerializedObject.SetIsDifferentCacheDirty();
         InternalSetTargets(m_SerializedObject.targetObjects);
     }
 }
Example #3
0
 // Reload SerializedObject because flags etc might have changed.
 internal virtual void OnForceReloadInspector()
 {
     if (m_SerializedObject != null)
     {
         m_SerializedObject.SetIsDifferentCacheDirty();
         // Need to make sure internal target list PPtr have been updated from a native memory
         // When assets are reloaded they are destroyed and recreated and the managed list does not get updated
         // The m_SerializedObject is a native object thus its targetObjects is a native memory PPtr list which have the new PPtr ids.
         InternalSetTargets(m_SerializedObject.targetObjects);
     }
 }
Example #4
0
        public static void DoImportBitmapFont(string fntPatn)
        {
            if (!IsFnt(fntPatn)) return;

            TextAsset fnt = AssetDatabase.LoadMainAssetAtPath(fntPatn) as TextAsset;
            string text = fnt.text;
            FntParse parse = FntParse.GetFntParse(ref text);
            if (parse == null) return;

            string fntName = Path.GetFileNameWithoutExtension(fntPatn);
            string rootPath = Path.GetDirectoryName(fntPatn);
            string fontPath = string.Format("{0}/{1}.fontsettings", rootPath, fntName);
            string texPath = string.Format("{0}/{1}", rootPath, parse.textureName);

            Font font = AssetDatabase.LoadMainAssetAtPath(fontPath) as Font;
            if (font == null)
            {
                font = new Font();
                AssetDatabase.CreateAsset(font, fontPath);
                font.material = new Material(Shader.Find("UI/Default"));
                font.material.name = "Font Material";
                AssetDatabase.AddObjectToAsset(font.material, font);
            }

            SerializedObject so = new SerializedObject(font);
            so.Update();
            so.FindProperty("m_FontSize").floatValue = parse.fontSize;
            so.FindProperty("m_LineSpacing").floatValue = parse.lineHeight;
            UpdateKernings(so, parse.kernings);
            so.ApplyModifiedProperties();
            so.SetIsDifferentCacheDirty();

            Texture2D texture = AssetDatabase.LoadMainAssetAtPath(texPath) as Texture2D;
            if (texture == null)
            {
                Debug.LogErrorFormat(fnt, "{0}: not found '{1}'.", typeof(BFImporter), texPath);
                return;
            }

            TextureImporter texImporter = AssetImporter.GetAtPath(texPath) as TextureImporter;
            texImporter.textureType = TextureImporterType.GUI;
            texImporter.mipmapEnabled = false;
            texImporter.SaveAndReimport();

            font.material.mainTexture = texture;
            font.material.mainTexture.name = "Font Texture";

            font.characterInfo = parse.charInfos;

            AssetDatabase.SaveAssets();
        }
	void addSelectedObjects(){
		MB2_MeshBakerRoot mom = (MB2_MeshBakerRoot) target;
		if (mom == null){
			Debug.LogError("Must select a target MeshBaker to add objects to");
			return;
		}
		List<GameObject> newMomObjs = GetFilteredList();
		
		MB_EditorUtil.RegisterUndo(mom, "Add Objects");
		List<GameObject> momObjs = mom.GetObjectsToCombine();
		int numAdded = 0;
		for (int i = 0; i < newMomObjs.Count;i++){
			if (!momObjs.Contains(newMomObjs[i])){
				momObjs.Add(newMomObjs[i]);
				numAdded++;
			}
		}
		SerializedObject so = new SerializedObject(mom);
		so.SetIsDifferentCacheDirty();
		
		if (numAdded == 0){
			Debug.LogWarning("Added 0 objects. Make sure some or all objects are selected in the hierarchy view. Also check ths 'Only Static Objects', 'Using Material' and 'Using Shader' settings");
		} else {
			Debug.Log("Added " + numAdded + " objects to " + mom.name);
		}
	}