Beispiel #1
0
 public override void OnMainGUI(EditorGuiBase gui)
 {
     if (bPublic)
     {
         value = gui.silder("value of " + label, value, 0f, 1f);
     }
 }
Beispiel #2
0
 public override void OnGUI(EditorGuiBase gui)
 {
     label = gui.textField("name", label);
     scale = gui.silder("scale", scale, 0f, 10f);
     bias  = gui.silder("bias", bias, -5f, 5f);
     curve = gui.curve("curve", curve);
 }
Beispiel #3
0
 public override void OnMainGUI(EditorGuiBase gui)
 {
     bShowInMain = gui.foldout(bShowInMain, label);
     if (bShowInMain)
     {
         doTextureGUI(gui);
     }
 }
Beispiel #4
0
 public override void OnGUI(EditorGuiBase gui)
 {
     label      = gui.textField("name", label);
     scale      = gui.silder("scale", scale, 0f, 10f);
     bias       = gui.silder("bias", bias, -5f, 5f);
     normalType = (NormalType)gui.enumPopup("normal type", normalType);
     height     = gui.floatField("height", height);
 }
Beispiel #5
0
 public override void OnWindowGUI(EditorGuiBase gui)
 {
     gui.labelField("lerp", Color.green);
     if (operatorType == TernaryOperatorType.Lerp)
     {
         gui.labelField("o = a*(1-s) + b*s", Color.green);
     }
 }
Beispiel #6
0
 public override void OnGUI(EditorGuiBase gui)
 {
     label = gui.textField("name", label);
     scale = gui.silder("scale", scale, 0f, 10f);
     bias  = gui.silder("bias", bias, -5f, 5f);
     //treeIndex = gui.layoutIntField("tree index", treeIndex);
     //texture = (Texture2D)EditorGUILayout.ObjectField("Texture", texture, typeof(Texture2D), true);
     doTreeGUI(gui, false);
     density = gui.floatField("density", density);
 }
Beispiel #7
0
 public override void OnGUI(EditorGuiBase gui)
 {
     label      = gui.textField("name", label);
     scale      = gui.silder("scale", scale, 0f, 10f);
     bias       = gui.silder("bias", bias, -5f, 5f);
     paintOrder = gui.intField("paint order", paintOrder);
     //texture = (Texture2D)EditorGUILayout.ObjectField("Texture", texture, typeof(Texture2D), true);
     //texturePath = gui.getAssetPath(texture);
     doTextureGUI(gui);
 }
Beispiel #8
0
 public override void OnGUI(EditorGuiBase gui)
 {
     label = gui.textField("name", label);
     scale = gui.silder("scale", scale, 0f, 10f);
     bias  = gui.silder("bias", bias, -5f, 5f);
     //grassIndex = gui.layoutIntField("grass index", grassIndex);
     texture     = (Texture2D)gui.objectField(texture, typeof(Texture2D), true);
     texturePath = gui.getAssetPath(texture);
     doTextureGUI(gui);
 }
Beispiel #9
0
 public override void OnGUI(EditorGuiBase gui)
 {
     label       = gui.textField("name", label);
     scale       = gui.silder("scale", scale, 0f, 10f);
     bias        = gui.silder("bias", bias, -5f, 5f);
     localSeed   = gui.intField("local seed", localSeed);
     size        = gui.floatField("size", size);
     octaveCount = gui.intSlider("octaveCount", octaveCount, 1, (int)Mathf.Log(size, 2) + 2);
     curve       = gui.curve("curve", curve);
 }
Beispiel #10
0
 public override void OnWindowGUI(EditorGuiBase gui)
 {
     Vector3[] points = new Vector3[41];
     for (int i = 0; i < 41; i++)
     {
         float x0 = i / 40.0f;
         float y0 = curve.Evaluate(x0);
         points[i].Set(x0 * 128, 128 + 12 - y0 * 120, 0);
     }
 }
Beispiel #11
0
 public override void OnMainGUI(EditorGuiBase gui)
 {
     //grassIndex = gui.layoutIntField("index of " + label, grassIndex);
     //texture = (Texture2D)EditorGUILayout.ObjectField("Texture", texture, typeof(Texture2D), true);
     //texturePath = gui.getAssetPath(texture);
     bShowInMain = gui.foldout(bShowInMain, label);
     if (bShowInMain)
     {
         doTextureGUI(gui);
     }
 }
Beispiel #12
0
 public override void OnMainGUI(EditorGuiBase gui)
 {
     //treeIndex = gui.layoutIntField("index of " + label, treeIndex);
     //texture = (Texture2D)EditorGUILayout.ObjectField(name, texture, typeof(Texture2D), true);
     bShowInMain = gui.foldout(bShowInMain, label);
     if (bShowInMain)
     {
         doTreeGUI(gui, true);
         gui.beginH();
         {
             //EditorGUILayout.LabelField("", GUILayout.Width(10));
             gui.labelField("", 10);
             density = gui.floatField("density of " + label, density);
         }
         gui.endH();
     }
 }
Beispiel #13
0
 private void doTreeGUI(EditorGuiBase gui, bool bIndent)
 {
     gui.beginH();
     {
         if (bIndent)
         {
             gui.labelField("", 10);
         }
         gui.beginV();
         {
             gui.labelField("tree");
             objTree = (GameObject)gui.objectField(objTree, typeof(GameObject), true);
             gui.minMaxSlider("size(" + minSize.ToString("0.00") + "~" + maxSize.ToString("0.00") + ")", ref minSize, ref maxSize, 0.3f, 3f);
         }
         gui.endV();
     }
     gui.endH();
     treePath = gui.getAssetPath(objTree);
 }
Beispiel #14
0
 public override void OnWindowGUI(EditorGuiBase gui)
 {
     if (operatorType == BinaryOperatorType.Add)
     {
         gui.labelField("o = a + b", Color.green);
     }
     else if (operatorType == BinaryOperatorType.Sub)
     {
         gui.labelField("o = a - b", Color.green);
     }
     else if (operatorType == BinaryOperatorType.Mul)
     {
         gui.labelField("o = a * b", Color.green);
     }
     else if (operatorType == BinaryOperatorType.Max)
     {
         gui.labelField("o = max(a,b)", Color.green);
     }
 }
Beispiel #15
0
    public Rect Draw(EditorGuiBase gui)
    {
        rect.x = rect.x < 0 ? 0 : rect.x;
        rect.y = rect.y < 0 ? 0 : rect.y;

        GUI.WindowFunction fun = delegate(int id)
        {
            if (Event.current.type == EventType.MouseDrag)
            {
            }
            else if (Event.current.type == EventType.MouseDown)
            {
                funSelect(node.value.guid);
                bNeedUpdate = true;
            }
            GUI.Label(new Rect(0, 0, rect.width, 16), node.value.label);
            if (node.value.getNodeType() != NodeType.HeightOutput && GUI.Button(new Rect(rect.width - 16, 0, 16, 16), "X"))
            {
                funDelete(node.value.guid);
            }
            GUI.Box(new Rect(2, 16 + 2, rect.width - 4, rect.height - 16 - 4), tex);
            GUI.DragWindow();

            node.value.OnWindowGUI(gui);
        };

        rect = GUI.Window(winID, rect, fun, "");
        pos  = rect.min;

        if (hasOutput())
        {
            GUI.DrawTexture(new Rect(rect.x - 14, rect.center.y - 9, 14, 18), texPort);
            GUI.Label(new Rect(rect.x - 14, rect.center.y - 9, 14, 18), "o");
        }
        for (int i = 0; i < getInputNum(); i++)
        {
            GUI.DrawTexture(getInputPortRect(i), texPort);
            GUI.Label(getInputPortRect(i), node.value.getInputName(i));
        }

        return(rect);
    }
Beispiel #16
0
 private void doTextureGUI(EditorGuiBase gui)
 {
     gui.beginH();
     {
         gui.labelField("", 10);
         gui.labelField("texture", 64);
         gui.labelField("");
     }
     gui.endH();
     gui.beginH();
     {
         gui.labelField("", 10);
         texture     = (Texture2D)gui.objectField(texture, typeof(Texture2D), true, 64, 64);
         texturePath = gui.getAssetPath(texture);
         gui.beginV();
         {
             gui.space();
             gui.space();
             gui.beginH();
             {
                 gui.labelField("min size:", 60);
                 minSize = gui.floatField("", minSize);
             }
             gui.endH();
             gui.beginH();
             {
                 gui.labelField("max size:", 60);
                 maxSize = gui.floatField("", maxSize);
             }
             gui.endH();
             gui.beginH();
             {
                 gui.labelField("billboard:", 60);
                 bBillboard = gui.toggle("", bBillboard);
             }
             gui.endH();
         }
         gui.endV();
     }
     gui.endH();
 }
Beispiel #17
0
 private void doTextureGUI(EditorGuiBase gui)
 {
     gui.beginH();
     {
         gui.labelField("", 10);
         gui.labelField("texture", 64);
         gui.labelField("normal", 64);
         gui.labelField("size", -1);
     }
     gui.endH();
     gui.beginH();
     {
         gui.labelField("", 10);
         texture     = (Texture2D)gui.objectField(texture, typeof(Texture2D), true, 64, 64);
         texturePath = gui.getAssetPath(texture);
         normal      = (Texture2D)gui.objectField(normal, typeof(Texture2D), true, 64, 64);
         normalPath  = gui.getAssetPath(normal);
         gui.beginV();
         {
             gui.space();
             gui.space();
             gui.beginH();
             {
                 gui.labelField("size x:", 40);
                 texSizeX = gui.intField("", texSizeX);
             }
             gui.endH();
             gui.beginH();
             {
                 gui.labelField("size y:", 40);
                 texSizeY = gui.intField("", texSizeY);
             }
             gui.endH();
         }
         gui.endV();
     }
     gui.endH();
 }
Beispiel #18
0
 public override void OnWindowGUI(EditorGuiBase gui)
 {
     gui.labelField("erosion", Color.green);
 }
Beispiel #19
0
 public override void OnWindowGUI(EditorGuiBase gui)
 {
     gui.labelField("Const_Value", Color.green);
 }
Beispiel #20
0
 public override void OnWindowGUI(EditorGuiBase gui)
 {
     string[] ss = { "normal.x", "normal.y", "normal.z" };
     gui.labelField(ss[(int)normalType], Color.green);
 }
Beispiel #21
0
 public virtual void OnMainGUI(EditorGuiBase gui)
 {
 }
Beispiel #22
0
 public override void OnWindowGUI(EditorGuiBase gui)
 {
     gui.labelField("texture:" + paintOrder.ToString(), Color.green);
 }
Beispiel #23
0
 public override void OnWindowGUI(EditorGuiBase gui)
 {
     gui.labelField("height output", Color.green);
 }
Beispiel #24
0
 public override void OnWindowGUI(EditorGuiBase gui)
 {
     //GUIStyle style = new GUIStyle(); style.normal.textColor = Color.green;
     gui.labelField("grass", Color.green);
 }
Beispiel #25
0
 public override void OnWindowGUI(EditorGuiBase gui)
 {
     gui.labelField("perlin noise", Color.green);
 }
Beispiel #26
0
 public override void OnMainGUI(EditorGuiBase gui)
 {
     scale = gui.silder("scale for output", scale, 0f, 10f);
 }
Beispiel #27
0
 public override void OnGUI(EditorGuiBase gui)
 {
     label   = gui.textField("name", label);
     value   = gui.silder("value", value, 0f, 1f);
     bPublic = gui.toggle("public", bPublic);
 }
Beispiel #28
0
 public abstract void OnGUI(EditorGuiBase gui);
Beispiel #29
0
    public void DrawProperty(EditorGuiBase gui)
    {
        NodeBase newNode = null;

        if (node.value.getNodeType() == NodeType.Generator)
        {
            GeneratorType newType = (GeneratorType)gui.enumPopup("Generator Type", generateType);
            if (newType != generateType)
            {
                newNode = NodeBase.createNewGenerate(newType);
            }
            generateType = newType;
        }
        else if (node.value.getNodeType() == NodeType.UnaryOperator)
        {
            UnaryOperatorType newType = (UnaryOperatorType)gui.enumPopup("Operator Type", unaryOperatorType);
            if (newType != unaryOperatorType)
            {
                newNode = NodeBase.createNewUnaryOperator(newType);
            }
            //    string oldGuid = node.value.guid;
            //    string oldName = node.value.label;
            //    node = new NodeWrapper(NodeBase.createNewUnaryOperator(newType));
            //    node.value.label = oldName;
            //    node.value.guid = oldGuid;
            //}
            unaryOperatorType = newType;
        }
        else if (node.value.getNodeType() == NodeType.BinaryOperator)
        {
            BinaryOperatorType newType = (BinaryOperatorType)gui.enumPopup("Operator Type", binaryOperatorType);
            if (newType != binaryOperatorType)
            {
                ((NodeBinaryOperator)node.value).operatorType = newType;
            }
            binaryOperatorType = newType;
        }
        if (newNode != null)
        {
            newNode.copy(node.value);
            node = new NodeWrapper(newNode);
        }
        node.value.OnGUI(gui);

        int newHashCode = node.value.GetHashCode();

        if (newHashCode != oldHash || bNeedUpdate)
        {
            bNeedUpdate  = false;
            float[,] cls = node.value.update(0, 0, 0, 128, 128);
            //node.value.getPreview();
            int w = 128;
            tex = new Texture2D(w, w);
            Color[] colors = new Color[w * w];
            for (int i = 0; i < w; i++)
            {
                for (int j = 0; j < w; j++)
                {
                    colors[j * w + i].a = 1;
                    colors[j * w + i].r = cls[i, j];
                    colors[j * w + i].g = cls[i, j];
                    colors[j * w + i].b = cls[i, j];
                }
            }
            tex.SetPixels(colors);
            tex.Apply();
        }
        oldHash = newHashCode;
    }
Beispiel #30
0
 public override void OnWindowGUI(EditorGuiBase gui)
 {
     //GUIStyle style = new GUIStyle(); style.normal.textColor = Color.green;
     gui.labelField("tree:" + treeIndex.ToString(), Color.green);
 }