// RECRUSIVE SET ALL PO FLAGS
    public static void setFlagOfPO_toUpstream(AXParametricObject po, AXStaticEditorFlags flag)
    {
        po.axStaticEditorFlags = po.axStaticEditorFlags | flag;

        foreach (AXParameter input in po.getAllInputMeshParameters())
        {
            if (input.DependsOn != null && input.DependsOn.parametricObject.is3D())
            {
                setFlagOfPO_toUpstream(input.DependsOn.parametricObject, flag);
            }
        }
    }
Пример #2
0
        public static GameObject AddAXGameObjectTo(AXParametricObject po, GameObject ngo)
        {
            //GameObject obj = new GameObject(prefab.name);

            //GameObject ngo = GameObject.Instantiate(go);


            AXGameObject axgo = ngo.AddComponent <AXGameObject>();

            axgo.makerPO_GUID = po.Guid;


            // STATIC FLAGS
                        #if UNITY_EDITOR
            // *** Could temporarily remove the Lightmap static flag here to allow for Auto... http://forum.unity3d.com/threads/how-to-set-use-staticeditorflags-cant-seem-to-set-them-from-script.137024/
            // flags = flags & ~(StaticEditorFlags.LightmapStatic);

            AXStaticEditorFlags axflags = po.axStaticEditorFlags;
            if (!po.model.staticFlagsEnabled)
            {
                axflags = axflags & ~AXStaticEditorFlags.LightmapStatic;
            }
            StaticEditorFlags flags = (StaticEditorFlags)axflags;


            GameObjectUtility.SetStaticEditorFlags(ngo, flags);
                        #endif


            if (!string.IsNullOrEmpty(po.tag))
            {
                ngo.tag = po.tag;
            }
            ngo.layer = po.layer;

            po.copyComponentsFromPrototypeToGameObject(ngo);


            return(ngo);
        }
Пример #3
0
        public static GameObject createAXGameObject(string name, AXParametricObject po, string subItemAddress = "")
        {
            GameObject   obj  = new GameObject(name);
            AXGameObject axgo = obj.AddComponent <AXGameObject>();

            axgo.makerPO_GUID = po.Guid;


            // STATIC FLAGS
                        #if UNITY_EDITOR
            // *** Could temporarily remove the Lightmap static flag here to allow for Auto... http://forum.unity3d.com/threads/how-to-set-use-staticeditorflags-cant-seem-to-set-them-from-script.137024/
            // flags = flags & ~(StaticEditorFlags.LightmapStatic);

            AXStaticEditorFlags axflags = po.axStaticEditorFlags;
            if (!po.model.staticFlagsEnabled)
            {
                //var mask = ~AXStaticEditorFlags.LightmapStatic;
                //var newValue = originalValue & mask;
                axflags = axflags & ~AXStaticEditorFlags.LightmapStatic;
            }
            StaticEditorFlags flags = (StaticEditorFlags)axflags;


            GameObjectUtility.SetStaticEditorFlags(obj, flags);
                        #endif


            if (!string.IsNullOrEmpty(po.tag))
            {
                obj.tag = po.tag;
            }
            obj.layer = po.layer;

            //Debug.Log ("copying protos");
            po.copyComponentsFromPrototypeToGameObject(obj);


            return(obj);
        }