private static void generateCurveSettings() { // Curve Primitive Type Default { int value = HoudiniHost.prCurvePrimitiveTypeDefault; string[] labels = { "Polygon", "NURBS", "Bezier" }; int[] values = { 0, 1, 2 }; bool changed = HoudiniGUI.dropdown( "curve_primitive_type_default", "Initial Type", ref value, labels, values, myUndoInfo, ref myUndoInfo.curvePrimitiveTypeDefault); if (changed) { HoudiniHost.prCurvePrimitiveTypeDefault = value; } } // Curve Method Default { int value = HoudiniHost.prCurveMethodDefault; string[] labels = { "CVs", "Breakpoints", "Freehand" }; int[] values = { 0, 1, 2 }; bool changed = HoudiniGUI.dropdown( "curve_method_default", "Initial Method", ref value, labels, values, myUndoInfo, ref myUndoInfo.curveMethodDefault); if (changed) { HoudiniHost.prCurveMethodDefault = value; } } }
protected bool generateAssetControl(int index, ref bool join_last, ref bool no_label_toggle_last) { if (myParms.prParms == null) { return(false); } if (myParms.prParms[index].invisible) { return(false); } bool changed = false; HAPI_ParmInfo[] parms = myParms.prParms; HAPI_ParmInfo parm = parms[index]; HAPI_ParmInfoStrings parm_strings = myParms.prParmInfoStrings[index]; int[] parm_int_values = myParms.prParmIntValues; float[] parm_float_values = myParms.prParmFloatValues; HoudiniGUIParm gui_parm = new HoudiniGUIParm(parm, parm_strings); /////////////////////////////////////////////////////////////////////// // Integer Parameter if (parm.type == HAPI_ParmType.HAPI_PARMTYPE_MULTIPARMLIST) { changed = HoudiniGUI.multiparmField( ref gui_parm, ref myDelayBuild, ref parm_int_values, ref join_last, ref no_label_toggle_last); } else if (parm.type == HAPI_ParmType.HAPI_PARMTYPE_INT) { if (parm.choiceCount > 0 && parm.choiceIndex >= 0) { // Draw popup (menu) field. List <string> labels = new List <string>(); List <int> values = new List <int>(); // Go through our choices. for (int i = 0; i < parm.choiceCount; ++i) { if (myParms.prParmChoiceLists[parm.choiceIndex + i].parentParmId != parm.id) { Debug.LogError("Parm choice parent parm id (" + myParms.prParmChoiceLists[parm.choiceIndex + i].parentParmId + ") not matching current parm id (" + parm.id + ")!\n" + "Choice index: " + (parm.choiceIndex + i) + ", " + "Choice count: " + parm.choiceCount); } labels.Add(myParms.prParmChoiceInfoStrings[parm.choiceIndex + i].label); values.Add(i); } changed = HoudiniGUI.dropdown( ref gui_parm, ref parm_int_values, labels.ToArray(), values.ToArray(), ref join_last, ref no_label_toggle_last, null, ref parm_int_values); } else { changed = HoudiniGUI.intField( ref gui_parm, ref myDelayBuild, ref parm_int_values, ref join_last, ref no_label_toggle_last, null, ref parm_int_values); } // if parm.choiceCount } // if parm.type is INT /////////////////////////////////////////////////////////////////////// // Float Parameter else if (parm.type == HAPI_ParmType.HAPI_PARMTYPE_FLOAT) { changed = HoudiniGUI.floatField( ref gui_parm, ref myDelayBuild, ref parm_float_values, ref join_last, ref no_label_toggle_last, null, ref parm_float_values); } // if parm.type is FLOAT /////////////////////////////////////////////////////////////////////// // String Parameter else if (parm.type == HAPI_ParmType.HAPI_PARMTYPE_STRING) { if (parm.choiceCount > 0 && parm.choiceIndex >= 0) { // Draw popup (menu) field. List <string> labels = new List <string>(); List <string> values = new List <string>(); // Go through our choices. for (int i = 0; i < parm.choiceCount; ++i) { if (myParms.prParmChoiceLists[parm.choiceIndex + i].parentParmId != parm.id) { Debug.LogError( "Parm choice parent parm id (" + myParms.prParmChoiceLists[parm.choiceIndex + i].parentParmId + ") not matching current parm id (" + parm.id + ")!\n" + "Choice index: " + (parm.choiceIndex + i) + ", " + "Choice count: " + parm.choiceCount); } labels.Add(myParms.prParmChoiceInfoStrings[parm.choiceIndex + i].label); values.Add(myParms.prParmChoiceInfoStrings[parm.choiceIndex + i].value); } string[] values_temp = myParms.getParmStrings(parm); gui_parm.valuesIndex = 0; // Since we're piping a de-handled temp array. changed = HoudiniGUI.dropdown( ref gui_parm, ref values_temp, labels.ToArray(), values.ToArray(), ref join_last, ref no_label_toggle_last, null, ref values_temp); if (changed) { myParms.setParmStrings(parm, values_temp); } } else { string[] values = myParms.getParmStrings(parm); // The given string array is only for this parm so we need to set the values index to 0. gui_parm.valuesIndex = 0; changed = HoudiniGUI.stringField( ref gui_parm, ref myDelayBuild, ref values, ref join_last, ref no_label_toggle_last, null, ref values); // Set the to be changed strings into the cache if (changed) { myParms.setParmStrings(parm, values); } } } /////////////////////////////////////////////////////////////////////// // File Path Field else if (parm.isPath()) { string[] path = myParms.getParmStrings(parm); if (parm.type == HAPI_ParmType.HAPI_PARMTYPE_PATH_FILE_GEO) { gui_parm.label += " (geo)"; } else if (parm.type == HAPI_ParmType.HAPI_PARMTYPE_PATH_FILE_IMAGE) { gui_parm.label += " (image)"; } // Asset ID might still be invalid here so don't fail if it is. // It is invalid if the asset didn't cook yet after a scene load. try { string file_pattern = parm.typeInfo; if (file_pattern != "") { gui_parm.label += " (" + file_pattern + ")"; } } catch {} HAPI_Permissions permissions = parm.permissions; if (permissions == HAPI_Permissions.HAPI_PERMISSIONS_READ_ONLY) { gui_parm.label += " (read-only)"; changed = HoudiniGUI.fileOpenField( ref gui_parm, ref myDelayBuild, ref path[0], ref join_last, ref no_label_toggle_last); } else { if (permissions == HAPI_Permissions.HAPI_PERMISSIONS_WRITE_ONLY) { gui_parm.label += " (write-only)"; } changed = HoudiniGUI.fileSaveField( ref gui_parm, ref myDelayBuild, ref path[0], ref join_last, ref no_label_toggle_last); } if (changed) { myParms.setParmStrings(parm, path); } } /////////////////////////////////////////////////////////////////////// // Node Path Field else if (parm.isNode()) { // Asset ID might still be invalid here so don't fail if it is. // It is invalid if the asset didn't cook yet after a scene load. try { string op_filter = parm.typeInfo; if (op_filter != "") { gui_parm.label += " (" + op_filter + ")"; } } catch {} HAPI_ParmInput parm_input = myParms.prParmInputs[parm.id]; UnityEngine.Object temp_object = parm_input.inputObject; GameObject undo_object = null; changed = HoudiniGUI.objectField( ref gui_parm, ref temp_object, typeof(GameObject), ref join_last, ref no_label_toggle_last, null, ref undo_object); if (changed) { parm_input.newInputObject = (GameObject)temp_object; myParms.prParmInputs[index] = parm_input; } } /////////////////////////////////////////////////////////////////////// // Toggle Parameter else if (parm.type == HAPI_ParmType.HAPI_PARMTYPE_TOGGLE) { changed = HoudiniGUI.toggle( ref gui_parm, ref parm_int_values, ref join_last, ref no_label_toggle_last, null, ref parm_int_values); } /////////////////////////////////////////////////////////////////////// // Color Parameter else if (parm.type == HAPI_ParmType.HAPI_PARMTYPE_COLOR) { changed = HoudiniGUI.colourField( ref gui_parm, ref myDelayBuild, ref parm_float_values, ref join_last, ref no_label_toggle_last, null, ref parm_float_values); } /////////////////////////////////////////////////////////////////////// // Button Parameter else if (parm.type == HAPI_ParmType.HAPI_PARMTYPE_BUTTON) { if (parm.choiceCount > 0 && parm.choiceIndex >= 0) { // Draw popup (menu) field. List <string> labels = new List <string>(); List <int> values = new List <int>(); // Go through our choices. for (int i = 0; i < parm.choiceCount; ++i) { if (myParms.prParmChoiceLists[parm.choiceIndex + i].parentParmId != parm.id) { Debug.LogError( "Parm choice parent parm id (" + myParms.prParmChoiceLists[parm.choiceIndex + i].parentParmId + ") not matching current parm id (" + parm.id + ")!\n" + "Choice index: " + (parm.choiceIndex + i) + ", " + "Choice count: " + parm.choiceCount); } labels.Add(myParms.prParmChoiceInfoStrings[parm.choiceIndex + i].label); values.Add(i); } changed = HoudiniGUI.dropdown( ref gui_parm, ref parm_int_values, labels.ToArray(), values.ToArray(), ref join_last, ref no_label_toggle_last, null, ref parm_int_values); } else { changed = HoudiniGUI.button(ref gui_parm, ref join_last, ref no_label_toggle_last); } } /////////////////////////////////////////////////////////////////////// // Label else if (parm.type == HAPI_ParmType.HAPI_PARMTYPE_LABEL) { HoudiniGUI.label(ref gui_parm, ref join_last, ref no_label_toggle_last); } /////////////////////////////////////////////////////////////////////// // Separator else if (parm.type == HAPI_ParmType.HAPI_PARMTYPE_SEPARATOR) { HoudiniGUI.separator(); } if (myAsset.hasProgressBarBeenUsed() && parm.id == myParms.prLastChangedParmId) { // TODO: Set the focus back to this control since the progress bar would have stolen it. } if (changed) { myParms.prLastChangedParmId = parm.id; } return(changed); }
private static void generateGeometrySettings() { // Paint Brush Rate { // Everything is opposite here because the higher the number the slower // the paint rate and we want the user to think the higher the number // the FASTER the rate - so we have to invert. float value = HoudiniHost.prPaintBrushRate; bool changed = HoudiniGUI.floatField( "paint_brush_rate", "Paint Brush Rate", ref value, 0.0f, 1.0f, myUndoInfo, ref myUndoInfo.paintBrushRate); if (changed) { HoudiniHost.prPaintBrushRate = value; HoudiniHost.repaint(); } } // Painting Mode Hot Key { KeyCode value = HoudiniHost.prPaintingModeHotKey; string[] labels = System.Enum.GetValues(typeof(KeyCode)) .Cast <KeyCode>() .Select(v => v.ToString()) .ToArray(); KeyCode[] values = System.Enum.GetValues(typeof(KeyCode)) .Cast <KeyCode>() .ToArray(); bool changed = HoudiniGUI.dropdown( "painting_mode_hot_key", "Painting Key", ref value, labels, values, myUndoInfo, ref myUndoInfo.paintingModeHotKey); if (changed) { HoudiniHost.prPaintingModeHotKey = (KeyCode)value; HoudiniHost.repaint(); } } // Painting Mode Colour { Color value = HoudiniHost.prPaintingModeColour; bool changed = HoudiniGUI.colourField( "painting_mode_colour", "Painting Mode", ref value, myUndoInfo, ref myUndoInfo.paintingModeColour); if (changed) { HoudiniHost.prPaintingModeColour = value; HoudiniHost.repaint(); } } // Painting Node Switch Hot Key { KeyCode value = HoudiniHost.prPaintingNodeSwitchHotKey; string[] labels = System.Enum.GetValues(typeof(KeyCode)) .Cast <KeyCode>() .Select(v => v.ToString()) .ToArray(); KeyCode[] values = System.Enum.GetValues(typeof(KeyCode)) .Cast <KeyCode>() .ToArray(); bool changed = HoudiniGUI.dropdown( "painting_node_switch_hot_key", "Node Switch Key", ref value, labels, values, myUndoInfo, ref myUndoInfo.paintingNodeSwitchHotKey); if (changed) { HoudiniHost.prPaintingNodeSwitchHotKey = (KeyCode)value; HoudiniHost.repaint(); } } // Painting Attribute Switch Hot Key { KeyCode value = HoudiniHost.prPaintingAttributeSwitchHotKey; string[] labels = System.Enum.GetValues(typeof(KeyCode)) .Cast <KeyCode>() .Select(v => v.ToString()) .ToArray(); KeyCode[] values = System.Enum.GetValues(typeof(KeyCode)) .Cast <KeyCode>() .ToArray(); bool changed = HoudiniGUI.dropdown( "painting_attribute_switch_hot_key", "Attr. Switch Key", ref value, labels, values, myUndoInfo, ref myUndoInfo.paintingAttributeSwitchHotKey); if (changed) { HoudiniHost.prPaintingAttributeSwitchHotKey = (KeyCode)value; HoudiniHost.repaint(); } } // Painting Value Change Hot Key { KeyCode value = HoudiniHost.prPaintingValueChangeHotKey; string[] labels = System.Enum.GetValues(typeof(KeyCode)) .Cast <KeyCode>() .Select(v => v.ToString()) .ToArray(); KeyCode[] values = System.Enum.GetValues(typeof(KeyCode)) .Cast <KeyCode>() .ToArray(); bool changed = HoudiniGUI.dropdown( "painting_value_change_hot_key", "Value Change Key", ref value, labels, values, myUndoInfo, ref myUndoInfo.paintingValueChangeHotKey); if (changed) { HoudiniHost.prPaintingValueChangeHotKey = (KeyCode)value; HoudiniHost.repaint(); } } // Painting Falloff Change Hot Key { KeyCode value = HoudiniHost.prPaintingFalloffChangeHotKey; string[] labels = System.Enum.GetValues(typeof(KeyCode)) .Cast <KeyCode>() .Select(v => v.ToString()) .ToArray(); KeyCode[] values = System.Enum.GetValues(typeof(KeyCode)) .Cast <KeyCode>() .ToArray(); bool changed = HoudiniGUI.dropdown( "painting_falloff_change_hot_key", "Falloff Change Key", ref value, labels, values, myUndoInfo, ref myUndoInfo.paintingFalloffChangeHotKey); if (changed) { HoudiniHost.prPaintingFalloffChangeHotKey = (KeyCode)value; HoudiniHost.repaint(); } } HoudiniGUI.separator(); // Adding Points Mode Hot Key { KeyCode value = HoudiniHost.prAddingPointsModeHotKey; string[] labels = System.Enum.GetValues(typeof(KeyCode)) .Cast <KeyCode>() .Select(v => v.ToString()) .ToArray(); KeyCode[] values = System.Enum.GetValues(typeof(KeyCode)) .Cast <KeyCode>() .ToArray(); bool changed = HoudiniGUI.dropdown( "adding_points_mode_hot_key", "Adding Points Key", ref value, labels, values, myUndoInfo, ref myUndoInfo.addingPointsModeHotKey); if (changed) { HoudiniHost.prAddingPointsModeHotKey = (KeyCode)value; HoudiniHost.repaint(); } } // Adding Points Mode Colour { Color value = HoudiniHost.prAddingPointsModeColour; bool changed = HoudiniGUI.colourField( "adding_ponits_mode_colour", "Adding Points Mode", ref value, myUndoInfo, ref myUndoInfo.addingPointsModeColour); if (changed) { HoudiniHost.prAddingPointsModeColour = value; HoudiniHost.repaint(); } } HoudiniGUI.separator(); // Editing Points Mode Hot Key { KeyCode value = HoudiniHost.prEditingPointsModeHotKey; string[] labels = System.Enum.GetValues(typeof(KeyCode)) .Cast <KeyCode>() .Select(v => v.ToString()) .ToArray(); KeyCode[] values = System.Enum.GetValues(typeof(KeyCode)) .Cast <KeyCode>() .ToArray(); bool changed = HoudiniGUI.dropdown( "editing_points_mode_hot_key", "Editing Points Key", ref value, labels, values, myUndoInfo, ref myUndoInfo.editingPointsModeHotKey); if (changed) { HoudiniHost.prEditingPointsModeHotKey = (KeyCode)value; HoudiniHost.repaint(); } } // Editing Points Mode Colour { Color value = HoudiniHost.prEditingPointsModeColour; bool changed = HoudiniGUI.colourField( "editing_ponits_mode_colour", "Editing Points Mode", ref value, myUndoInfo, ref myUndoInfo.editingPointsModeColour); if (changed) { HoudiniHost.prEditingPointsModeColour = value; HoudiniHost.repaint(); } } HoudiniGUI.separator(); // Wireframe Colour { Color value = HoudiniHost.prWireframeColour; bool changed = HoudiniGUI.colourField( "wireframe_colour", "Wireframe", ref value, myUndoInfo, ref myUndoInfo.wireframeColour); if (changed) { HoudiniHost.prWireframeColour = value; HoudiniHost.repaint(); } } // Guide Wireframe Colour { Color value = HoudiniHost.prGuideWireframeColour; bool changed = HoudiniGUI.colourField( "guide_wireframe_colour", "Guide Wireframe", ref value, myUndoInfo, ref myUndoInfo.guideWireframeColour); if (changed) { HoudiniHost.prGuideWireframeColour = value; HoudiniHost.repaint(); } } // Unselectable Guide Wireframe Colour { Color value = HoudiniHost.prUnselectableGuideWireframeColour; bool changed = HoudiniGUI.colourField( "unselectable_guide_wireframe_colour", "Unselectable Guide", ref value, myUndoInfo, ref myUndoInfo.unselectableGuideWireframeColour); if (changed) { HoudiniHost.prUnselectableGuideWireframeColour = value; HoudiniHost.repaint(); } } // Unselected Guide Wireframe Colour { Color value = HoudiniHost.prUnselectedGuideWireframeColour; bool changed = HoudiniGUI.colourField( "unselected_guide_wireframe_colour", "Unselected Guide", ref value, myUndoInfo, ref myUndoInfo.unselectedGuideWireframeColour); if (changed) { HoudiniHost.prUnselectedGuideWireframeColour = value; HoudiniHost.repaint(); } } // Selected Guide Wireframe Colour { Color value = HoudiniHost.prSelectedGuideWireframeColour; bool changed = HoudiniGUI.colourField( "selected_guide_wireframe_colour", "Selected Guide", ref value, myUndoInfo, ref myUndoInfo.selectedGuideWireframeColour); if (changed) { HoudiniHost.prSelectedGuideWireframeColour = value; HoudiniHost.repaint(); } } HoudiniGUI.separator(); // Guide Point Size { float value = HoudiniHost.prGuidePointSize; bool changed = HoudiniGUI.floatField( "guide_point_size", "Guide Point Size", ref value, 4.0f, 40.0f, myUndoInfo, ref myUndoInfo.guidePointSize); if (changed) { HoudiniHost.prGuidePointSize = value; HoudiniHost.repaint(); } } // Min. Distance For Point Selection { float value = HoudiniHost.prMinDistanceForPointSelection; bool changed = HoudiniGUI.floatField( "min_distance_for_point_selection", "Min. Distance For Point Selection", ref value, 1.0f, 20.0f, myUndoInfo, ref myUndoInfo.minDistanceForPointSelection); if (changed) { HoudiniHost.prMinDistanceForPointSelection = value; HoudiniHost.repaint(); } } // Guide Min. Distance For Mid Point Insertion { float value = HoudiniHost.prGuideMinDistanceForMidPointInsertion; bool changed = HoudiniGUI.floatField( "guide_min_distance_for_mid_point_insertion", "Guide Min. Distance For Mid Point Insertion", ref value, 1.0f, 20.0f, myUndoInfo, ref myUndoInfo.guideMinDistanceForMidPointInsertion); if (changed) { HoudiniHost.prGuideMinDistanceForMidPointInsertion = value; HoudiniHost.repaint(); } } HoudiniGUI.separator(); // Create Groups from Bool Attribute { bool value = HoudiniHost.prCreateGroupsFromBoolAttributes; bool changed = HoudiniGUI.toggle( "create_groups_from_bool_attributes", "Create Groups from Bool Attributes", ref value, myUndoInfo, ref myUndoInfo.createGroupsFromBoolAttributes); if (changed) { HoudiniHost.prCreateGroupsFromBoolAttributes = value; HoudiniHost.repaint(); } } }
private void generateMaterialSettings() { if (GUILayout.Button("Re-Render")) { HoudiniAssetUtility.reApplyMaterials(myAsset); } // Material Shader Type { HAPI_ShaderType value = myAsset.prMaterialShaderType; bool is_bold = myParentPrefabAsset && myParentPrefabAsset.prMaterialShaderType != value; string[] labels = { "OpenGL", "Houdini Mantra Renderer" }; HAPI_ShaderType[] values = { HAPI_ShaderType.HAPI_SHADER_OPENGL, HAPI_ShaderType.HAPI_SHADER_MANTRA }; bool changed = HoudiniGUI.dropdown( "material_renderer", "Material Renderer", ref value, is_bold, labels, values, myUndoInfo, ref myUndoInfo.materialShaderType); if (changed) { myAsset.prMaterialShaderType = (HAPI_ShaderType)value; HoudiniAssetUtility.reApplyMaterials(myAsset); } } // Render Resolution { bool delay_build = false; int[] values = new int[2]; values[0] = (int)myAsset.prRenderResolution[0]; values[1] = (int)myAsset.prRenderResolution[1]; int[] undo_values = new int[2]; undo_values[0] = (int)myUndoInfo.renderResolution[0]; undo_values[1] = (int)myUndoInfo.renderResolution[1]; HoudiniGUIParm gui_parm = new HoudiniGUIParm("render_resolution", "Render Resolution", 2); gui_parm.isBold = myParentPrefabAsset && (int)myParentPrefabAsset.prRenderResolution[0] != values[0] && (int)myParentPrefabAsset.prRenderResolution[1] != values[1]; bool changed = HoudiniGUI.intField( ref gui_parm, ref delay_build, ref values, myUndoInfo, ref undo_values); if (changed) { Vector2 new_resolution = new Vector2((float)values[0], (float)values[1]); myAsset.prRenderResolution = new_resolution; myUndoInfo.renderResolution = new_resolution; } } // Show Vertex Colours createToggleForProperty( "show_only_vertex_colours", "Show Only Vertex Colors", "prShowOnlyVertexColours", ref myUndoInfo.showOnlyVertexColours, () => HoudiniAssetUtility.reApplyMaterials(myAsset)); // Generate Tangents createToggleForProperty( "generate_tangents", "Generate Tangents", "prGenerateTangents", ref myUndoInfo.generateTangents, () => myAssetOTL.build( true, // reload_asset false, // unload_asset_first false, // serialization_recovery_only true, // force_reconnect false, // is_duplication myAsset.prCookingTriggersDownCooks, true // use_delay_for_progress_bar ), !HoudiniHost.isGenerateTangentsDefault()); }