private void DrawEditModeInfo() { float uiWidth = _editorUIRect.width * _infoPanelSettingsWidth; using (var verticalSpace = new GUILayout.VerticalScope(EditorStyles.helpBox, GUILayout.MaxWidth(uiWidth))) { // Attribute Selection and editing values DrawAttributeSelection(); DrawEditAttributeValues(); } using (var verticalSpace = new GUILayout.VerticalScope(EditorStyles.helpBox)) { // Tool Settings EditorGUI.BeginChangeCheck(); SerializedProperty showGeoProperty = HEU_EditorUtility.GetSerializedProperty(_toolsInfoSerializedObject, "_showOnlyEditGeometry"); if (showGeoProperty != null) { bool bOldValue = showGeoProperty.boolValue; EditorGUILayout.PropertyField(showGeoProperty, new GUIContent(_showOnlyEditGeoLabel, "Show only this edit node's geometry.")); if (bOldValue != showGeoProperty.boolValue) { UpdateShowOnlyEditGeometry(); } } HEU_EditorUtility.EditorDrawFloatProperty(_toolsInfoSerializedObject, "_editPointBoxSize", _pointSizeLabel, "Change size of the point box visualization."); HEU_EditorUtility.EditorDrawSerializedProperty(_toolsInfoSerializedObject, "_editPointBoxUnselectedColor", _unselectedPtColorLabel); HEU_EditorUtility.EditorDrawSerializedProperty(_toolsInfoSerializedObject, "_editPointBoxSelectedColor", _selectedPtColorLabel); EditorGUILayout.LabelField(_selectedPtsLabel + _editPointsSelectedIndices.Count); if (GUILayout.Button(_selectAllPtsLabel, GUILayout.Height(_buttonHeight))) { SelectAllPoints(); } if (EditorGUI.EndChangeCheck()) { GenerateEditPointBoxNewMesh(); } } }
private void DrawPaintModeInfo() { bool bFillInvoked = false; float uiWidth = _editorUIRect.width * _infoPanelSettingsWidth; using (var verticalSpace = new GUILayout.VerticalScope(EditorStyles.helpBox, GUILayout.MaxWidth(uiWidth))) { // Attribute Selection, and paint values DrawAttributeSelection(); DrawPaintAttributeValues(); } using (var verticalSpace = new GUILayout.VerticalScope(EditorStyles.helpBox)) { // Tool Settings HEU_EditorUtility.EditorDrawBoolProperty(_toolsInfoSerializedObject, "_liveUpdate", _cookOnMouseReleaseLabel, "Auto-cook on mouse release when painting."); HEU_EditorUtility.EditorDrawFloatProperty(_toolsInfoSerializedObject, "_paintBrushSize", _brushSizeLabel, "Change brush size via Shift + drag or Shift + mouse scroll."); HEU_EditorUtility.EditorDrawFloatProperty(_toolsInfoSerializedObject, "_paintBrushOpacity", _brushOpacityLabel, "Blending factor when merging source and destination colors."); HEU_EditorUtility.EditorDrawSerializedProperty(_toolsInfoSerializedObject, "_paintMergeMode", _brushMergeMode, "How paint color is applied to surface."); HEU_EditorUtility.EditorDrawSerializedProperty(_toolsInfoSerializedObject, "_brushHandleColor", _brushHandleColor, "Color of the brush handle in Scene."); bFillInvoked = GUILayout.Button(_paintFillLabel, GUILayout.Height(_buttonHeight)); } if (_selectedAttributesStore != null) { if (bFillInvoked) { HEU_ToolsInfo toolsInfo = _toolsInfoSerializedObject.targetObject as HEU_ToolsInfo; _selectedAttributesStore.FillAttribute(_selectedAttributeData, toolsInfo); _GUIChanged = true; } } }
private void DrawCurvesSection(HEU_HoudiniAsset asset, SerializedObject assetObject) { if (asset.GetEditableCurveCount() <= 0) { return; } GUIStyle buttonStyle = new GUIStyle(GUI.skin.button); buttonStyle.fontSize = 11; buttonStyle.alignment = TextAnchor.MiddleCenter; buttonStyle.fixedHeight = 24; buttonStyle.margin.left = 34; HEU_EditorUI.BeginSection(); { SerializedProperty showCurvesProperty = HEU_EditorUtility.GetSerializedProperty(assetObject, "_showCurvesSection"); if (showCurvesProperty != null) { showCurvesProperty.boolValue = HEU_EditorUI.DrawFoldOut(showCurvesProperty.boolValue, "CURVES"); if (showCurvesProperty.boolValue) { SerializedProperty curveEditorProperty = HEU_EditorUtility.GetSerializedProperty(assetObject, "_curveEditorEnabled"); if (curveEditorProperty != null) { EditorGUILayout.PropertyField(curveEditorProperty); } HEU_EditorUI.DrawHeadingLabel("Collision Settings"); EditorGUI.indentLevel++; string projectLabel = "Project Curves To "; List<HEU_Curve> curves = asset.GetCurves(); SerializedProperty curveCollisionProperty = HEU_EditorUtility.GetSerializedProperty(assetObject, "_curveDrawCollision"); if (curveCollisionProperty != null) { EditorGUILayout.PropertyField(curveCollisionProperty, new GUIContent("Collision Type")); if (curveCollisionProperty.enumValueIndex == (int)HEU_Curve.CurveDrawCollision.COLLIDERS) { HEU_EditorUtility.EditorDrawSerializedProperty(assetObject, "_curveDrawColliders", label: "Colliders"); projectLabel += "Colliders"; } else if (curveCollisionProperty.enumValueIndex == (int)HEU_Curve.CurveDrawCollision.LAYERMASK) { HEU_EditorUtility.EditorDrawSerializedProperty(assetObject, "_curveDrawLayerMask", label: "Layer Mask"); projectLabel += "Layer"; } HEU_EditorUI.DrawSeparator(); EditorGUI.indentLevel--; HEU_EditorUI.DrawHeadingLabel("Projection Settings"); EditorGUI.indentLevel++; HEU_EditorUtility.EditorDrawSerializedProperty(assetObject, "_curveProjectDirection", label: "Project Direction", tooltip: "The ray cast direction for projecting the curve points."); HEU_EditorUtility.EditorDrawFloatProperty(assetObject, "_curveProjectMaxDistance", label: "Project Max Distance", tooltip: "The maximum ray cast distance for projecting the curve points."); _projectCurvePointsButton.text = projectLabel; if (GUILayout.Button(_projectCurvePointsButton, buttonStyle, GUILayout.MaxWidth(180))) { SerializedProperty projectDirProperty = HEU_EditorUtility.GetSerializedProperty(assetObject, "_curveProjectDirection"); SerializedProperty maxDistanceProperty = HEU_EditorUtility.GetSerializedProperty(assetObject, "_curveProjectMaxDistance"); Vector3 projectDir = projectDirProperty != null ? projectDirProperty.vector3Value : Vector3.down; float maxDistance = maxDistanceProperty != null ? maxDistanceProperty.floatValue : 0; for (int i = 0; i < curves.Count; ++i) { curves[i].ProjectToColliders(asset, projectDir, maxDistance); } } } EditorGUI.indentLevel--; HEU_EditorUI.DrawSeparator(); for (int i = 0; i < curves.Count; ++i) { if (curves[i].Parameters != null) { DrawParameters(curves[i].Parameters, ref _curveParameterEditor); } } } } } HEU_EditorUI.EndSection(); HEU_EditorUI.DrawSeparator(); }
private void DrawPaintAttributeValues() { // Display the values as editable fields if (_selectedAttributeData == null) { return; } if(!_selectedAttributesStore.HasMeshForPainting()) { HEU_EditorUI.DrawWarningLabel(_noMeshForPainting); return; } SerializedProperty selectedToolsValuesProperty = null; if (_selectedAttributeData._attributeType == HEU_AttributeData.AttributeType.INT) { selectedToolsValuesProperty = HEU_EditorUtility.GetSerializedProperty(_toolsInfoSerializedObject, "_paintIntValue"); if (selectedToolsValuesProperty != null) { ResizeSerializedPropertyArray(selectedToolsValuesProperty, _selectedAttributeData._attributeInfo.tupleSize); HEU_EditorUtility.EditorDrawArrayProperty(selectedToolsValuesProperty, HEU_EditorUtility.EditorDrawIntProperty, _paintValuesLabel); } } else if (_selectedAttributeData._attributeType == HEU_AttributeData.AttributeType.FLOAT) { selectedToolsValuesProperty = HEU_EditorUtility.GetSerializedProperty(_toolsInfoSerializedObject, "_paintFloatValue"); if (selectedToolsValuesProperty != null) { ResizeSerializedPropertyArray(selectedToolsValuesProperty, _selectedAttributeData._attributeInfo.tupleSize); HEU_EditorUtility.EditorDrawArrayProperty(selectedToolsValuesProperty, HEU_EditorUtility.EditorDrawFloatProperty, _paintValuesLabel); } // Display paint color selector if this is a color attribute if (_selectedAttributeData.IsColorAttribute()) { Color color = Color.white; if (selectedToolsValuesProperty.arraySize >= 3) { color.r = selectedToolsValuesProperty.GetArrayElementAtIndex(0).floatValue; color.g = selectedToolsValuesProperty.GetArrayElementAtIndex(1).floatValue; color.b = selectedToolsValuesProperty.GetArrayElementAtIndex(2).floatValue; if (selectedToolsValuesProperty.arraySize >= 4) { color.a = selectedToolsValuesProperty.GetArrayElementAtIndex(3).floatValue; } } Color newColor = EditorGUILayout.ColorField(_paintColorLabel, color); if (color != newColor) { if (selectedToolsValuesProperty.arraySize >= 3) { selectedToolsValuesProperty.GetArrayElementAtIndex(0).floatValue = newColor.r; selectedToolsValuesProperty.GetArrayElementAtIndex(1).floatValue = newColor.g; selectedToolsValuesProperty.GetArrayElementAtIndex(2).floatValue = newColor.b; if (selectedToolsValuesProperty.arraySize >= 4) { selectedToolsValuesProperty.GetArrayElementAtIndex(3).floatValue = newColor.a; } } } } } else if (_selectedAttributeData._attributeType == HEU_AttributeData.AttributeType.STRING) { selectedToolsValuesProperty = HEU_EditorUtility.GetSerializedProperty(_toolsInfoSerializedObject, "_paintStringValue"); if (selectedToolsValuesProperty != null) { ResizeSerializedPropertyArray(selectedToolsValuesProperty, _selectedAttributeData._attributeInfo.tupleSize); HEU_EditorUtility.EditorDrawArrayProperty(selectedToolsValuesProperty, HEU_EditorUtility.EditorDrawTextProperty, _paintValuesLabel); } } if (!_selectedAttributeData.IsColorAttribute()) { HEU_EditorUtility.EditorDrawSerializedProperty(_toolsInfoSerializedObject, "_affectedAreaPaintColor", _affectedAreaColorLabel, "Color to show painted area."); } }