Ejemplo n.º 1
0
		static internal void HideFlagsSet(this Object obj, HideFlags flags, bool value)
		{
			if (value)
				AddHideFlags(obj, flags);
			else
				RemoveHideFlags(obj, flags);
		}
Ejemplo n.º 2
0
	public MapBrush(string name, GameObject parent, GetOffsetDelegate getOffset, HideFlags flag)
	{
		root = new GameObject(name);
		root.transform.parent = parent.transform;
		this.parent = root;
		this.GetOffset = getOffset;
		//this.mat = new Material(Shader.Find("Transparent/Diffuse"));
		Material mat = new Material("Shader \"Alpha Additive\" {" +
			"Properties { _Color (\"Main Color\", Color) = (1,1,1,0) }" +
			"SubShader {" +
			"	Tags { \"Queue\" = \"Transparent +2001\" }" +
			"	Pass {" +
				"  Blend  One OneMinusSrcAlpha " +// "ZTest Off" +
				"    ZWrite Off Cull Off Fog { Mode Off } " +
			"		Material { Diffuse [_Color] Ambient [_Color] }" +
			"		Lighting On" +
			"		SetTexture [_Dummy] { combine primary double, primary }" +
			"	}" +
			"}" +
			"}");
		this.mat = mat;
		this.mat.color = new Color(1, 1, 1, 1f);

		subObjs = new List<GameObject>();
		size = 1;

		IsShowing = false;
		enabledCount = 1;

		SetBrushSize(size, flag);

	}
Ejemplo n.º 3
0
 private void SetHideFlags(HideFlags flag)
 {
     foreach (var item in spawnedEnemys)
     {
         item.hideFlags = flag;
     }
 }
        private void OnGUI()
        {
            _removeParent = (Transform)EditorGUILayout.ObjectField("Select object", _removeParent, typeof(Transform), true);

            _hideFlags = (HideFlags)EditorGUILayout.EnumPopup("Set hide flag", _hideFlags);

            if (GUILayout.Button("Look for hidden objects")) {
                if (_removeParent) {
                    Transform[] childTransforms = _removeParent.GetComponentsInChildren<Transform>();

                    _deleteList = new List<Transform>(childTransforms.Where(
                        t => (t.gameObject.hideFlags & _hideFlags) == _hideFlags));
                } else {
                    IEnumerable<GameObject> gos = Resources.FindObjectsOfTypeAll<GameObject>().Where(
                        go => ((go.hideFlags & _hideFlags) == _hideFlags) && go.transform.parent == null);
                    _deleteList = new List<Transform>();
                    foreach (GameObject go in gos) {
                        _deleteList.Add(go.transform);
                    }
                }
            }
            if (_deleteList == null || _deleteList.Count <= 0) {
                return;
            }

            GUILayout.BeginHorizontal();
            GUILayout.Label("Regex", GUILayout.Width(40f));
            _filter = GUILayout.TextField(_filter);
            _includePrefabs = EditorGUILayout.Toggle("Include prefabs", _includePrefabs);
            GUILayout.EndHorizontal();
            Color oldColor = GUI.color;
            GUI.color = Color.red;
            if (GUILayout.Button("Destroy all")) {
                for (int i = 0; i < _deleteList.Count; i++) {
                    if (ValidItem(_deleteList[i])) {
                        DestroyImmediate(_deleteList[i].gameObject);
                    }
                }
            }

            GUI.color = oldColor;
            _scrollPos = GUILayout.BeginScrollView(_scrollPos, false, true);
            for (int i = 0; i < _deleteList.Count; i++) {
                if (!ValidItem(_deleteList[i])) {
                    continue;
                }
                GUILayout.BeginHorizontal();
                EditorGUILayout.ObjectField("", _deleteList[i], typeof(Transform), true);

                GUILayout.Label(PrefabUtility.GetPrefabType(_deleteList[i]).ToString());
                if (GUILayout.Button("Destroy")) {
                    DestroyImmediate(_deleteList[i].gameObject);
                }

                GUILayout.EndHorizontal();
            }
            GUILayout.EndScrollView();
            _deleteList.RemoveAll(t => !t);
        }
 private static void SetHideflagsRecursive(GameObject go, HideFlags flags)
 {
     foreach(Transform child in go.transform)
     {
         SetHideflagsRecursive(child.gameObject, flags);
     }
     go.hideFlags = flags;
 }
 HideFlags HideFlagsButton(string aTitle, HideFlags aFlags, HideFlags aValue)
 {
     if(GUILayout.Toggle((aFlags & aValue) > 0, aTitle, "Button"))
         aFlags |= aValue;
     else
         aFlags &= ~aValue;
     return aFlags;
 }
Ejemplo n.º 7
0
	public void SetBrushSize(int size,HideFlags flag)
	{
		this.size = size;
		enabledCount = GetSubCount(size);
		if (subObjs.Count < enabledCount)
		{
			ResizeTo(enabledCount, flag);
		}
	}
 public void CopyFrom( MeshRenderer from )
 {
     sharedMaterials = from.sharedMaterials;
     materials = from.materials;
     sortingOrder = from.sortingOrder;
     sortingLayerID = from.sortingLayerID;
     hideFlags = from.hideFlags;
     enabled = from.enabled;
     sprite = null;
     texture = from.material.GetTexture( "_MainTex" ) as Texture2D;
     color = from.material.color;
 }
 public void CopyFrom( SpriteRenderer from )
 {
     sharedMaterials = from.sharedMaterials;
     materials = from.materials;
     sortingOrder = from.sortingOrder;
     sortingLayerID = from.sortingLayerID;
     hideFlags = from.hideFlags;
     enabled = from.enabled;
     sprite = from.sprite;
     texture = from.sprite.texture;
     color = from.color;
 }
Ejemplo n.º 10
0
 public static void SetEditModeHideFlags()
 {
     #if UNITY_5
     #if SHOW_HIERARCHY_EDIT_MODE
     hideFlags = HideFlags.DontSaveInEditor;
     #else
     hideFlags = HideFlags.HideInHierarchy | HideFlags.DontSaveInEditor;
     #endif
     #else
     hideFlags = HideFlags.HideInHierarchy | HideFlags.DontSave;
     #endif
 }
    public static void SetGameObjectHideFlagsRecursively(GameObject go, HideFlags flags)
    {
        Stack <Transform> S = new Stack <Transform>();

        S.Push(go.transform);

        while (S.Count > 0)
        {
            var curr = S.Pop();
            curr.gameObject.hideFlags = flags;
            for (int i = 0; i < curr.childCount; i++)
            {
                S.Push(curr.GetChild(i));
            }
        }
    }
    private void SetChildFlags(Transform t, HideFlags flags)
    {
        Queue <Transform> q = new Queue <Transform>();

        q.Enqueue(t);
        for (int i = 0; i < t.childCount; i++)
        {
            Transform c = t.GetChild(i);
            q.Enqueue(c);
            SetChildFlags(c, flags);
        }
        while (q.Count > 0)
        {
            q.Dequeue().gameObject.hideFlags = flags;
        }
    }
Ejemplo n.º 13
0
        public static void Postfix(ref UnityEngine.Object __result, ref HideFlags __state)
        {
            if ((__state & HideFlags.HideInInspector) == HideFlags.HideInInspector)
            {
                __result.hideFlags &= ~(HideFlags.HideAndDontSave | HideFlags.HideInInspector);

                /*if (__result is GameObject obj)
                 * {
                 *  foreach (Component comp in obj.GetComponents(typeof(Component)))
                 *  {
                 *      if (!(comp is Transform) && !(comp is Rigidbody)) obj.ReplaceComponent(comp.GetType(), comp.GetType());
                 *  }
                 * }*/
                (__result as GameObject)?.SetActive(true);
            }
        }
Ejemplo n.º 14
0
        private static GameObject Create(string name, string objPath, HideFlags hideFlags = HideFlags.HideInHierarchy, string shaderName = "Diffuse")
        {
            GameObject gameObject = PrefabLoader.Instantiate <GameObject>(objPath);

            if (gameObject == null)
            {
                throw new AgXUnity.Exception("Unable to load renderer: " + objPath);
            }

            gameObject.name = name;

            gameObject.hideFlags = hideFlags;
            Utils.SetMaterial(gameObject, shaderName);

            return(gameObject);
        }
Ejemplo n.º 15
0
    internal static bool HasFlagChild(this List <GameObject> list, HideFlags flag)
    {
        //var has = false;

        /*foreach (var child in list)
         * {
         *  child.ForeachChild2(child2 =>
         *  {
         *      has = child2.GetFlag(flag);
         *      return !has;
         *  });
         *  if (has) break;
         * }*/

        return(list.Any(item => item.HasFlagChild(flag)));
    }
Ejemplo n.º 16
0
        static Material CreateShapesMaterial(Shader shader, HideFlags hideFlags, params string[] keywords)
        {
            Material mat = new Material(shader)
            {
                hideFlags = hideFlags, enableInstancing = USE_INSTANCING
            };

            if (keywords != null)
            {
                foreach (string keyword in keywords)
                {
                    mat.EnableKeyword(keyword);
                }
            }
            ApplyDefaultGlobalProperties(mat);
            return(mat);
        }
Ejemplo n.º 17
0
        public static Texture2D CreateCompatibleTexture(this ImageData imageData, HideFlags hideFlags)
        {
            Assert.IsTrue(StreamingImageSequenceConstants.READ_STATUS_SUCCESS == imageData.ReadStatus);

            TextureFormat textureFormat
                = (imageData.Format == StreamingImageSequenceConstants.IMAGE_FORMAT_BGRA32)
            ? TextureFormat.BGRA32
            : TextureFormat.RGBA32;

            Texture2D tex = new Texture2D(imageData.Width, imageData.Height, textureFormat, false, false)
            {
                filterMode = FilterMode.Bilinear,
                hideFlags  = hideFlags
            };

            return(tex);
        }
Ejemplo n.º 18
0
        //ルートオブジェクト作成
        void CreateRootObject()
        {
            //不可視のオブジェクトとして作成(子オブジェクトにもしない。プレハブ化できなくなるから)
            string     name     = "text: " + text;
            HideFlags  hideFlag = (isDebugMode) ? HideFlags.DontSave : HideFlags.HideAndDontSave;
            GameObject go;

#if UNITY_EDITOR
            go = UnityEditor.EditorUtility.CreateGameObjectWithHideFlags(name, hideFlag);
#else
            go           = new GameObject(name);
            go.hideFlags = hideFlag;
#endif
            go.layer  = this.gameObject.layer;
            childRoot = go.transform;
            SyncTransform();
        }
Ejemplo n.º 19
0
        protected void HideInHierarchy(bool hide)
        {
#if UNITY_EDITOR
            HideFlags flagsToUse = hide ? HideFlags.HideInHierarchy : HideFlags.None;

            if (hideChildren)
            {
                DisablePickingChildren();
                CreatePickingMesh();

                foreach (Transform child in transform)
                {
                    child.hideFlags = flagsToUse;
                }
            }
#endif
        }
Ejemplo n.º 20
0
 public void In(
     [FriendlyName("AnimationClip", "A container variable for animation data.")] AnimationClip animationClip,
     [FriendlyName("Length", "Animation length in seconds. (Read Only)")] out float length,
     [FriendlyName("Frame Rate", "Frame rate at which keyframes are sampled. (Read Only) \n\nThis is the frame rate that was used in the animation program you used to create the animation or model.")] out float frameRate,
     [FriendlyName("Wrap Mode", "The default wrap mode used in the animation state.")] out WrapMode wrapMode,
     [FriendlyName("Local Bounds", "AABB of this Animation Clip in local space of Animation component that it is attached too. \n\nIt is precomputed on import for imported models/animations based on the meshes that this animation clip affects. This bounding box is specific to the mesh(es) that this clip is attached to during import, i.e. this means that it is calculated based on the file that is part of and on the 'Model' file if you're using Model@Animation notation.")] out Bounds localBounds,
     [FriendlyName("Name", "The name of the object. \n\nComponents share the same name with the game object and all attached components.")] out string name,
     [FriendlyName("Hide Flags", "Should the object be hidden, saved with the scene or modifiable by the user?")] out HideFlags hideFlags
     )
 {
     length      = animationClip.length;
     frameRate   = animationClip.frameRate;
     wrapMode    = animationClip.wrapMode;
     localBounds = animationClip.localBounds;
     name        = animationClip.name;
     hideFlags   = animationClip.hideFlags;
 }
        void ShowMaterials(bool show)
        {
            HideFlags hideFlags = HideFlags.HideInInspector;

            if (show)
            {
                hideFlags = HideFlags.None;
            }

            Material[] materials = m_SpriteShapeController.spriteShapeRenderer.sharedMaterials;

            foreach (Material material in materials)
            {
                material.hideFlags = hideFlags;
                EditorUtility.SetDirty(material);
            }
        }
        internal void Clear(CameraUpdate update)
        {
            if (this.LastAddress == IntPtr.Zero)
            {
                return;
            }

            this.LastAddress  = IntPtr.Zero;
            this.LastSkeleton = IntPtr.Zero;
            this.LastFormId   = 0;
            this.LastFlags    = HideFlags.None;
            this.LastRaceId   = 0;

            this.CameraMain.Cull.Clear();
            this.SetFirstPersonSkeleton(null, update.GameCameraState.Id == TESCameraStates.FirstPerson, false);
            this.ClearHelmet();
        }
 public void Toggle(string componentName, bool visible)
 {
     (
         from c in this._components.Values
         where c.name == componentName
         select c).Apply <ApexComponentMaster.ComponentInfo>((ApexComponentMaster.ComponentInfo c) => {
         c.isVisible        = visible;
         HideFlags hideFlag = c.component.hideFlags;
         if (visible)
         {
             this.RemoveHidden(c);
             c.component.hideFlags = hideFlag & (HideFlags.HideInHierarchy | HideFlags.DontSaveInEditor | HideFlags.NotEditable | HideFlags.DontSaveInBuild | HideFlags.DontUnloadUnusedAsset | HideFlags.DontSave | HideFlags.HideAndDontSave);
             return;
         }
         this.AddHidden(c);
         c.component.hideFlags = hideFlag | HideFlags.HideInInspector;
     });
 }
Ejemplo n.º 24
0
        /// <summary>
        /// Attaches ShadowsCameraEvents to <paramref name="camera"/>.
        /// </summary>
        /// <param name="camera">
        /// The camera to attach the ShadowsCameraEvents component.
        /// </param>
        /// <param name="hideFlags">
        /// <see cref="HideFlags"/> to apply to <paramref name="camera"/>.
        /// </param>
        public void UpdateCameraEvents(Camera camera, HideFlags hideFlags)
        {
            NoShadowsCamera noShadowsCamera = camera.GetComponent <NoShadowsCamera>();

            if (noShadowsCamera != null)
            {
                return;
            }

            ShadowsCameraEvents cameraEvents = camera.GetComponent <ShadowsCameraEvents>();

            if (cameraEvents == null)
            {
                cameraEvents = camera.gameObject.AddComponent <ShadowsCameraEvents>();
            }

            cameraEvents.hideFlags = hideFlags;
        }
Ejemplo n.º 25
0
        void SetVisState(ChildVis newState)
        {
            HideFlags flag = HideFlags.None;

            // nameHelper = new NameHelper (this);
            childCount         = GetChildCount();
            _childrenVisbility = newState;
            if (transform.childCount == 0)
            {
                _childrenVisbility = ChildVis.SHOW;
            }

            if (newState == ChildVis.HIDE && updateName)
            {
                flag = HideFlags.HideInHierarchy;

                name = name.SetTag("【" + childCount + "】");
                // nameHelper.RemoveTag();
            }
            if (applyToKnownOnly)

            {
                for (int i = 0; i < objectsToHide.Count; i++)
                {
                    if (objectsToHide[i] != null)
                    {
                        objectsToHide[i].hideFlags = flag;
                    }
                }
            }
            else
            {
                for (int i = 0; i < transform.childCount; i++)
                {
                    transform.GetChild(i).hideFlags = flag;
                }
            }

            //  if (onStateChanged != null) onStateChanged.Invoke(_childrenVisbility);
            if (meshRenderer != null)
            {
                meshRenderer.enabled = (newState == ChildVis.HIDE);
            }
        }
Ejemplo n.º 26
0
        static void CreateRuntimeSingleton()
        {
            Debug.Assert(_instance == null); // This function assumes that theres no current instance

            // Create new instance and track it
            GameObject singleton = new GameObject();

            _instance      = singleton.AddComponent <T>();
            singleton.name = string.Format("+{0} (Singleton)", typeof(T).Name);

            // KGC - 141117 - Allowing more control over singleton instances from concrete class

            // Default values
            HideFlags tempHideFlags = defaultHideFlags;
            bool      tempSetDontDestroyOnLoadWhenSpawning = defaultSetDontDestroyOnLoadWhenSpawning;

            // Grab case-specific values
            ISingletonBehavior iSingleton = _instance as ISingletonBehavior;

            if (iSingleton != null) // If concrete class implements the singleton interface
            {
                tempHideFlags = iSingleton.HideFlagsToSetWhenSpawning;
                tempSetDontDestroyOnLoadWhenSpawning = iSingleton.SetDontDestroyOnLoadWhenSpawning;
            }

            // Apply values
            singleton.hideFlags = tempHideFlags;
            if (tempSetDontDestroyOnLoadWhenSpawning)
            {
                DontDestroyOnLoad(singleton);
            }

            if (DEBUG_ENABLED)
            {
                Debug.LogFormat(
                    singleton,
                    "[Singleton] An instance of {0} is needed in the scene, so '{1}' was created with DontDestroyOnLoad: {0} and HideFlags: {1}.",
                    typeof(T),
                    singleton,
                    tempSetDontDestroyOnLoadWhenSpawning,
                    tempHideFlags
                    );
            }
        }
        public static Texture2D CreateCompatibleTexture(this ImageData imageData, HideFlags hideFlags)
        {
            Assert.IsTrue(StreamingImageSequenceConstants.READ_STATUS_SUCCESS == imageData.ReadStatus);

#if UNITY_STANDALONE_OSX
            const TextureFormat TEXTURE_FORMAT = TextureFormat.RGBA32;
#elif UNITY_STANDALONE_WIN
            const TextureFormat TEXTURE_FORMAT = TextureFormat.BGRA32;
#endif

            int       length = imageData.Width * imageData.Height * 4;
            Texture2D tex    = new Texture2D(imageData.Width, imageData.Height, TEXTURE_FORMAT, false, false)
            {
                filterMode = FilterMode.Bilinear,
                hideFlags  = hideFlags
            };

            return(tex);
        }
Ejemplo n.º 28
0
    //-------------------------------- FLAG ----------------------------

    internal static void SetDeepFlag(this GameObject go, HideFlags flag, bool value, bool includeMe = true,
                                     bool recursive = true)
    {
        if (includeMe)
        {
            go.xSetFlag(flag, value);
        }
        foreach (Transform t in go.transform)
        {
            if (recursive)
            {
                SetDeepFlag(t.gameObject, flag, value);
            }
            else
            {
                t.gameObject.xSetFlag(flag, value);
            }
        }
    }
Ejemplo n.º 29
0
 public static void xSetFlag(this Object go, HideFlags flag, bool value, string undoName = null)
 {
     if (go == null)
     {
         return;
     }
     if (!string.IsNullOrEmpty(undoName))
     {
         Undo.RecordObject(go, undoName);
     }
     if (value)
     {
         go.hideFlags |= flag;
     }
     else
     {
         go.hideFlags &= ~flag;
     }
 }
Ejemplo n.º 30
0
        private void InitializeHelmet(NiAVObject root, List <NiAVObject> calculated)
        {
            this.LastFlags |= HideFlags.Helmet;

            var rootNode = root.As <NiNode>();

            if (rootNode == null)
            {
                return;
            }

            var ls = calculated ?? this.GetHelmetNodes(rootNode);

            foreach (var x in ls)
            {
                this.CameraMain.Cull.AddDisable(x);
                this.LastHelmet.Add(x);
            }
        }
Ejemplo n.º 31
0
    private static int get_hideFlags(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            UnityEngine.Object @object   = (UnityEngine.Object)obj;
            HideFlags          hideFlags = @object.hideFlags;
            ToLua.Push(L, hideFlags);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index hideFlags on a nil value");
        }
        return(result);
    }
Ejemplo n.º 32
0
    private static int set_hideFlags(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            UnityEngine.Object @object   = (UnityEngine.Object)obj;
            HideFlags          hideFlags = (HideFlags)((int)ToLua.CheckObject(L, 2, typeof(HideFlags)));
            @object.hideFlags = hideFlags;
            result            = 0;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.Message : "attempt to index hideFlags on a nil value");
        }
        return(result);
    }
        private void UpdateContainerFlags(ChiselModel model, ModelState modelState)
        {
            const HideFlags GameObjectHideFlags = HideFlags.NotEditable;
            const HideFlags TransformHideFlags  = HideFlags.NotEditable;// | HideFlags.HideInInspector;

            var gameObject = modelState.containerGameObject;
            var transform  = modelState.containerTransform;

            if (gameObject.name != GeneratedContainerName)
            {
                gameObject.name = GeneratedContainerName;
            }

            // Make sure we're always a child of the model
            if (transform.parent != modelState.modelTransform)
            {
                transform.SetParent(modelState.modelTransform, false);
                transform.localPosition = Vector3.zero;
                transform.localRotation = Quaternion.identity;
                transform.localScale    = Vector3.one;
            }

            if (gameObject.layer != modelState.layer)
            {
                gameObject.layer = modelState.layer;
            }
            if (gameObject.hideFlags != GameObjectHideFlags)
            {
                gameObject.hideFlags = GameObjectHideFlags;
            }
            if (transform.hideFlags != TransformHideFlags)
            {
                transform.hideFlags = TransformHideFlags;
            }

#if UNITY_EDITOR
            var prevStaticFlags = UnityEditor.GameObjectUtility.GetStaticEditorFlags(gameObject);
            if (prevStaticFlags != modelState.staticFlags)
            {
                UnityEditor.GameObjectUtility.SetStaticEditorFlags(gameObject, modelState.staticFlags);
            }
#endif
        }
Ejemplo n.º 34
0
 public void In(
     [FriendlyName("AudioClip", "A container variable for audio data.")] AudioClip audioClip,
     [FriendlyName("Length", "The length of the audio clip in seconds.")] out float length,
     [FriendlyName("Samples", "The length of the audio clip in samples.")] out int samples,
     [FriendlyName("Channels", "Channels in audio clip.")] out int channels,
     [FriendlyName("Frequency", "Sample frequency.")] out int frequency,
     [FriendlyName("Is Ready", "Is a streamed audio clip ready to play? \n\nIf the AudioClip is downloading from a web site, this returns if enough data has been downloaded so playback should be able to start without interruptions. For AudioClips not associated with a web stream, this value always returns true.")] out bool isReadyToPlay,
     [FriendlyName("Name", "The name of the object. \n\nComponents share the same name with the game object and all attached components.")] out string name,
     [FriendlyName("Hide Flags", "Should the object be hidden, saved with the scene or modifiable by the user?")] out HideFlags hideFlags
     )
 {
     length        = audioClip.length;
     samples       = audioClip.samples;
     channels      = audioClip.channels;
     frequency     = audioClip.frequency;
     isReadyToPlay = audioClip.isReadyToPlay;
     name          = audioClip.name;
     hideFlags     = audioClip.hideFlags;
 }
Ejemplo n.º 35
0
    public static void SetHideFlags(this GameObject go, HideFlags value, bool includeChildren = true, bool includeComponent = false)
    {
        go.hideFlags = value;
        if (includeComponent)
        {
            foreach (var comp in go.GetComponents <Component>())
            {
                comp.hideFlags = value;
            }
        }

        if (includeChildren)
        {
            for (int i = 0; i < go.transform.childCount; i++)
            {
                go.transform.GetChild(i).gameObject.SetHideFlags(value, true, includeComponent);
            }
        }
    }
        public void ToggleAll()
        {
            bool flag = !this._components.Values.Any <ApexComponentMaster.ComponentInfo>((ApexComponentMaster.ComponentInfo c) => c.isVisible);

            if (!flag)
            {
                this._hiddenComponents = 2147483647 >> (31 - this._components.Values.Count & 31);
            }
            else
            {
                this._hiddenComponents = 0;
            }
            foreach (ApexComponentMaster.ComponentInfo value in this._components.Values)
            {
                value.isVisible = flag;
                HideFlags hideFlag = value.component.hideFlags;
                value.component.hideFlags = (flag ? hideFlag & (HideFlags.HideInHierarchy | HideFlags.DontSaveInEditor | HideFlags.NotEditable | HideFlags.DontSaveInBuild | HideFlags.DontUnloadUnusedAsset | HideFlags.DontSave | HideFlags.HideAndDontSave) : hideFlag | HideFlags.HideInInspector);
            }
        }
        public static void SetHasLightmapUVs(UnityEngine.Mesh sharedMesh, bool haveLightmapUVs)
        {
            HideFlags hideFlags    = sharedMesh.hideFlags;
            HideFlags newHideFlags = hideFlags;

            if (!haveLightmapUVs)
            {
                newHideFlags &= ~HideFlags.NotEditable;
            }
            else
            {
                newHideFlags |= HideFlags.NotEditable;
            }

            if (newHideFlags == hideFlags)
            {
                return;
            }
            sharedMesh.hideFlags = newHideFlags;
        }
Ejemplo n.º 38
0
        internal void SetHideFlags(HideFlags hideFlags)
        {
            ObjectUtils.hideFlags = hideFlags;

            foreach (var manager in Resources.FindObjectsOfTypeAll <InputManager>())
            {
                manager.gameObject.hideFlags = hideFlags;
            }

            EditingContextManager.instance.gameObject.hideFlags = hideFlags;

            foreach (var child in GetComponentsInChildren <Transform>(true))
            {
                child.gameObject.hideFlags = hideFlags;
            }

#if UNITY_EDITOR
            EditorApplication.DirtyHierarchyWindowSorting(); // Otherwise objects aren't shown/hidden in hierarchy window
#endif
        }
 void OnGUI()
 {
     GUILayout.BeginHorizontal();
     if (GUILayout.Button("find top level"))
     {
         FindObjects();
     }
     if (GUILayout.Button("find ALL object"))
     {
         FindObjectsAll();
     }
     GUILayout.EndHorizontal();
     scrollPos = GUILayout.BeginScrollView(scrollPos);
     for (int i = 0; i < m_Objects.Count; i++)
     {
         GameObject O = m_Objects[i];
         if (O == null)
         {
             continue;
         }
         GUILayout.BeginHorizontal();
         EditorGUILayout.ObjectField(O.name, O, typeof(GameObject), true);
         HideFlags flags = O.hideFlags;
         flags       = HideFlagsButton("HideInHierarchy", flags, HideFlags.HideInHierarchy);
         flags       = HideFlagsButton("HideInInspector", flags, HideFlags.HideInInspector);
         flags       = HideFlagsButton("DontSave", flags, HideFlags.DontSave);
         flags       = HideFlagsButton("NotEditable", flags, HideFlags.NotEditable);
         O.hideFlags = flags;
         GUILayout.Label("" + ((int)flags), GUILayout.Width(20));
         GUILayout.Space(20);
         if (GUILayout.Button("DELETE"))
         {
             DestroyImmediate(O);
             FindObjects();
             GUIUtility.ExitGUI();
         }
         GUILayout.Space(20);
         GUILayout.EndHorizontal();
     }
     GUILayout.EndScrollView();
 }
Ejemplo n.º 40
0
        private void ToggleComponentVisibility <T>(bool visible) where T : Component
        {
            Dialog dialog = this.target as Dialog;

            if (dialog == null)
            {
                return;
            }

            Component behaviour = dialog.GetComponent <T>();
            HideFlags hideFlags = behaviour.hideFlags;

            if (visible)
            {
                behaviour.hideFlags &= ~HideFlags.HideInInspector;
            }
            else
            {
                behaviour.hideFlags |= HideFlags.HideInInspector;
            }
        }
Ejemplo n.º 41
0
 /// <summary>
 /// <para>Creates a game object with HideFlags and specified components.</para>
 /// </summary>
 /// <param name="name"></param>
 /// <param name="flags"></param>
 /// <param name="components"></param>
 public static GameObject CreateGameObjectWithHideFlags(string name, HideFlags flags, params Type[] components)
 {
     GameObject obj2 = Internal_CreateGameObjectWithHideFlags(name, flags);
     obj2.AddComponent(typeof(Transform));
     foreach (Type type in components)
     {
         obj2.AddComponent(type);
     }
     return obj2;
 }
 public static void SetHideFlagsRecursively(this GameObject go, HideFlags flags)
 {
     go.hideFlags = flags;
     foreach (Transform t in go.transform)
     t.gameObject.SetHideFlagsRecursively(flags);
 }
Ejemplo n.º 43
0
 public void SetHideFlags(HideFlags flags)
 {
     this.internalWebView.hideFlags = flags;
 }
Ejemplo n.º 44
0
            public static GameObject CreateGameObjectWithHideFlags(string name, HideFlags hideFlags)
            {
                if (VerifyBinding("EditorUtility.CreateGameObjectWithHideFlags", _Bindings._EditorUtility_CreateGameObjectWithHideFlags)) {
                    return _Bindings._EditorUtility_CreateGameObjectWithHideFlags(name, hideFlags);
                }

                var go = new GameObject(name);
                go.hideFlags = hideFlags;
                return go;
            }
Ejemplo n.º 45
0
 public GameObjectState(GameObject gameObject)
 {
     this.gameObject = gameObject;
     this.active = gameObject.active;
     if (gameObject.GetComponent<Renderer>() != null)
         this.render = gameObject.renderer.enabled;
     this.hideFlags = gameObject.hideFlags;
 }
Ejemplo n.º 46
0
		static internal void RemoveHideFlags(this Object obj, HideFlags flags)
		{
			obj.hideFlags = obj.hideFlags & ~flags;
		}
	public void SetHideFlags(HideFlags hideFlags)
	{
		foreach (var cell in cells)
		{
			foreach (var edgeCollider2D in cell.EdgeCollider2Ds)
			{
				if (edgeCollider2D != null)
				{
					edgeCollider2D.hideFlags = hideFlags;
				}
			}
		}
	}
Ejemplo n.º 48
0
 /// <summary>
 ///   <para>Creates a game object with HideFlags and specified components.</para>
 /// </summary>
 /// <param name="name"></param>
 /// <param name="flags"></param>
 /// <param name="components"></param>
 public static GameObject CreateGameObjectWithHideFlags(string name, HideFlags flags, params System.Type[] components)
 {
   GameObject objectWithHideFlags = EditorUtility.Internal_CreateGameObjectWithHideFlags(name, flags);
   objectWithHideFlags.AddComponent(typeof (Transform));
   foreach (System.Type component in components)
     objectWithHideFlags.AddComponent(component);
   return objectWithHideFlags;
 }
	public void SetHideFlags(HideFlags hideFlags)
	{
		foreach (var cell in cells)
		{
			if (cell.PolygonCollider2D != null)
			{
				cell.PolygonCollider2D.hideFlags = hideFlags;
			}
		}
	}
Ejemplo n.º 50
0
	//public void SetDirty()
	//{
	//	isDirty = true;
	//	//Draw();

	//}

	public void SetBrushSize(int size, HideFlags flag)
	{
		brush.SetBrushSize(size, flag);
		if (data != null)
		{
			brush.Update(data);
		}
	}
Ejemplo n.º 51
0
	void SetHideFlags(GameObject root, HideFlags flag)
	{
		Transform[] ts = root.GetComponentsInChildren<Transform>(true);
		foreach (Transform t in ts)
		{
			t.gameObject.hideFlags = flag;
		}
	}
Ejemplo n.º 52
0
		public static GameObject CreateGameObjectWithHideFlags(string name, HideFlags flags, params Type[] components)
		{
			GameObject gameObject = EditorUtility.Internal_CreateGameObjectWithHideFlags(name, flags);
			gameObject.AddComponent(typeof(Transform));
			for (int i = 0; i < components.Length; i++)
			{
				Type componentType = components[i];
				gameObject.AddComponent(componentType);
			}
			return gameObject;
		}
Ejemplo n.º 53
0
	GameObject CreateOne(string name, HideFlags flag)
	{
		GameObject obj = GameObject.CreatePrimitive(PrimitiveType.Cube);
		obj.transform.parent = parent.transform;
		obj.name = name;
		obj.GetComponent<Renderer>().sharedMaterial = mat;
		obj.hideFlags = flag;
		return obj;
	}
Ejemplo n.º 54
0
	void ResizeTo(int count, HideFlags flag)
	{
		while (subObjs.Count < count)
		{
			subObjs.Add(CreateOne("brush_" + subObjs.Count, flag));
		}
	}
Ejemplo n.º 55
0
 internal static extern GameObject Internal_CreateGameObjectWithHideFlags(string name, HideFlags flags);
Ejemplo n.º 56
0
		static bool HasFlag (this UnityEngine.Object o, HideFlags flagToCheck) {
			return (o.hideFlags & flagToCheck) == flagToCheck;
		}
Ejemplo n.º 57
0
 public override void Init(HideFlags newHideFlag = HideFlags.None)
 {
     description();
 }
Ejemplo n.º 58
0
		static internal void AddHideFlags(this Object obj, HideFlags flags)
		{
			obj.hideFlags = obj.hideFlags | flags;
		}
Ejemplo n.º 59
0
        public virtual void SetHideStateChildrenNonNodes(HideFlags hideFlags)
        {
            for (int i = transform.childCount - 1; i >= 0; i--)
            {
                if (!transform.GetChild(i).GetComponent<Node>())
                {
                    transform.GetChild(i).hideFlags = hideFlags;
                }

                if(transform.GetChild(i).GetComponent<NodeGroup>())
                {
                    transform.GetChild(i).GetComponent<NodeGroup>().SetHideStateChildrenNonNodes(hideFlags);
                }
            }
        }
 public static void SetHideflagsRecursive(this MonoBehaviour mono, HideFlags flags)
 {
     var go = mono.gameObject;
     SetHideflagsRecursive(go, flags);
 }