protected override void OnPropertiesGUI() { var generator = (FaceColorsGenerator)target; var colorSource = generator.colorSource; generator.colorSource = (FaceColorsGenerator.ColorSource)EditorGUILayout.EnumPopup("Color Source", generator.colorSource); switch (colorSource) { case FaceColorsGenerator.ColorSource.Constant: generator.constantColor = EditorGUILayout.ColorField("Constant Color", generator.constantColor); break; case FaceColorsGenerator.ColorSource.RandomPerFace: InputSlotEditor.OnInspectorGUI(_serializedGenerator.FindProperty("topologyInputSlot")); generator.randomness = RandomnessDescriptorEditor.OnInspectorGUI(new GUIContent("Randomness"), generator.randomness); break; case FaceColorsGenerator.ColorSource.RandomPerGroup: InputSlotEditor.OnInspectorGUI(_serializedGenerator.FindProperty("faceGroupCollectionInputSlot")); InputSlotEditor.OnInspectorGUI(_serializedGenerator.FindProperty("faceGroupIndicesInputSlot")); generator.randomness = RandomnessDescriptorEditor.OnInspectorGUI(new GUIContent("Randomness"), generator.randomness); break; default: throw new System.NotImplementedException(); } }
protected override void OnPropertiesGUI() { var generator = (FaceEdgeColorsGenerator)target; var colorSource = generator.colorSource; generator.colorSource = (FaceEdgeColorsGenerator.ColorSource)EditorGUILayout.EnumPopup("Color Source", generator.colorSource); switch (colorSource) { case FaceEdgeColorsGenerator.ColorSource.Constant: generator.constantColor = EditorGUILayout.ColorField("Constant Color", generator.constantColor); break; case FaceEdgeColorsGenerator.ColorSource.FaceColor: InputSlotEditor.OnInspectorGUI(_serializedGenerator.FindProperty("topologyInputSlot")); InputSlotEditor.OnInspectorGUI(_serializedGenerator.FindProperty("faceColorsInputSlot")); generator.constantColor = EditorGUILayout.ColorField("Constant Color", generator.constantColor); generator.blendWeight = EditorGUILayout.Slider("Blend Weight", generator.blendWeight, 0f, 1f); break; default: throw new System.NotImplementedException(); } }
protected override void OnPropertiesGUI() { var generator = (TopologyRandomizerGenerator)target; InputSlotEditor.OnInspectorGUI(_serializedGenerator.FindProperty("surfaceInputSlot")); InputSlotEditor.OnInspectorGUI(_serializedGenerator.FindProperty("topologyInputSlot")); InputSlotEditor.OnInspectorGUI(_serializedGenerator.FindProperty("vertexPositionsInputSlot")); generator.passCount = EditorGUILayout.IntField("Passes", generator.passCount); generator.frequency = EditorGUILayout.Slider("Frequency", generator.frequency, 0f, 1f); generator.randomness = RandomnessDescriptorEditor.OnInspectorGUI(GUIContent.none, generator.randomness); generator.minVertexNeighbors = EditorGUILayout.IntSlider("Min Vertex Neighbors", generator.minVertexNeighbors, 2, 20); generator.maxVertexNeighbors = EditorGUILayout.IntSlider("Max Vertex Neighbors", generator.maxVertexNeighbors, 2, 20); generator.minFaceNeighbors = EditorGUILayout.IntSlider("Min Face Neighbors", generator.minFaceNeighbors, 2, 20); generator.maxFaceNeighbors = EditorGUILayout.IntSlider("Max Face Neighbors", generator.maxFaceNeighbors, 2, 20); if (generator.vertexPositionsInputSlot.source != null) { generator.lockBoundaryPositions = EditorGUILayout.Toggle("Lock Boundaries", generator.lockBoundaryPositions); generator.relaxForRegularityWeight = EditorGUILayout.Slider("Relax Regularity", generator.relaxForRegularityWeight, 0f, 1f); generator.relaxRelativePrecision = EditorGUILayout.Slider("Relax Precision", generator.relaxRelativePrecision, 0f, 1f); generator.repairRate = EditorGUILayout.Slider("Repair Rate", generator.repairRate, 0.1f, 1f); generator.maxRelaxIterations = EditorGUILayout.IntField("Relax Iterations", generator.maxRelaxIterations); generator.maxRepairIterations = EditorGUILayout.IntField("Repair Iterations", generator.maxRepairIterations); } }
protected override void OnPropertiesGUI() { if (_vertexAttributeGroupLabel == null) { _vertexAttributeGroupLabel = new GUIStyle(EditorStyles.boldLabel); _vertexAttributeGroupLabel.margin = EditorStyles.label.margin; _vertexAttributeGroupLabel.padding = EditorStyles.label.padding; } var generator = (MeshGenerator)target; var sourceType = generator.sourceType; generator.sourceType = (MeshGenerator.SourceType)EditorGUILayout.EnumPopup("Source Type", generator.sourceType); switch (sourceType) { case MeshGenerator.SourceType.InternalFaces: break; case MeshGenerator.SourceType.FaceGroupCollection: InputSlotEditor.OnInspectorGUI(_serializedGenerator.FindProperty("faceGroupCollectionInputSlot")); break; case MeshGenerator.SourceType.FaceGroup: InputSlotEditor.OnInspectorGUI(_serializedGenerator.FindProperty("faceGroupInputSlot")); break; default: throw new System.NotImplementedException(); } generator.triangulation = (MeshGenerator.Triangulation)EditorGUILayout.EnumPopup("Triangulation", generator.triangulation); generator.ringDepth = EditorGUILayout.IntSlider("Ring Depth", generator.ringDepth, 1, 4); generator.maxVerticesPerSubmesh = EditorGUILayout.IntSlider("Max Vertices Per Submesh", generator.maxVerticesPerSubmesh, 256, 65534); generator.vertexAttributes = (DynamicMesh.VertexAttributes)EditorGUILayout.MaskField("Vertex Attributes", (int)generator.vertexAttributes, vertexAttributeLabels); InputSlotEditor.OnInspectorGUI(_serializedGenerator.FindProperty("topologyInputSlot")); generator.UpdateVertexAttributeInputSlots(); ShowVertexAttributeUI <Vector3>(new GUIContent("Positions"), generator.ringVertexPositionsInputSlots, generator.centerVertexPositionsInputSlots); ShowVertexAttributeUI <Vector3>(new GUIContent("Normals"), generator.ringVertexNormalsInputSlots, generator.centerVertexNormalsInputSlots); ShowVertexAttributeUI <Color>(new GUIContent("Colors"), generator.ringVertexColorsInputSlots, generator.centerVertexColorsInputSlots); ShowVertexAttributeUI <Color32>(new GUIContent("Color32s"), generator.ringVertexColor32sInputSlots, generator.centerVertexColor32sInputSlots); ShowVertexAttributeUI <Vector2>(new GUIContent("UV1s"), generator.ringVertexUV1sInputSlots, generator.centerVertexUV1sInputSlots); ShowVertexAttributeUI <Vector2>(new GUIContent("UV2s"), generator.ringVertexUV2sInputSlots, generator.centerVertexUV2sInputSlots); ShowVertexAttributeUI <Vector2>(new GUIContent("UV3s"), generator.ringVertexUV3sInputSlots, generator.centerVertexUV3sInputSlots); ShowVertexAttributeUI <Vector2>(new GUIContent("UV4s"), generator.ringVertexUV4sInputSlots, generator.centerVertexUV4sInputSlots); ShowVertexAttributeUI <Vector4>(new GUIContent("Tangents"), generator.ringVertexTangentsInputSlots, generator.centerVertexTangentsInputSlots); generator.showMeshOutputs = EditorGUILayout.Toggle("Show Mesh Outputs", generator.showMeshOutputs); }
protected override void OnPropertiesGUI() { var generator = (FaceCentroidsGenerator)target; InputSlotEditor.OnInspectorGUI(_serializedGenerator.FindProperty("surfaceInputSlot")); InputSlotEditor.OnInspectorGUI(_serializedGenerator.FindProperty("topologyInputSlot")); InputSlotEditor.OnInspectorGUI(_serializedGenerator.FindProperty("vertexPositionsInputSlot")); var surface = generator.surfaceInputSlot.GetAsset <Surface>(); if (surface is SphericalSurface) { generator.flatten = EditorGUILayout.Toggle("Flatten", generator.flatten); } }
private void ShowVertexAttributeUI <TAttributeValue>(GUIContent label, InputSlot[] ringInputSlots, InputSlot[] centerInputSlots) { if (ringInputSlots.Length > 0) { if (ringInputSlots.Length + centerInputSlots.Length > 1) { GUILayout.Label(label, _vertexAttributeGroupLabel); EditorGUI.indentLevel += 1; for (int i = 0; i < ringInputSlots.Length; ++i) { InputSlotEditor.OnInspectorGUI(new GUIContent(string.Format("Ring {0}", i + 1)), ringInputSlots[i]); } if (centerInputSlots.Length > 0) { InputSlotEditor.OnInspectorGUI(new GUIContent("Center"), centerInputSlots[0]); } EditorGUI.indentLevel -= 1; } else if (ringInputSlots.Length == 1) { InputSlotEditor.OnInspectorGUI(label, ringInputSlots[0]); } } }