///////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Private private static void generateGeneralSettings() { // Pin Size { float value = HoudiniHost.prPinSize; bool changed = HoudiniGUI.floatField( "pin_size", "Pin Size", ref value, myUndoInfo, ref myUndoInfo.pinSize); if (changed) { HoudiniHost.prPinSize = value; HoudiniHost.repaint(); } } // Pin Colour { Color value = HoudiniHost.prPinColour; bool changed = HoudiniGUI.colourField( "pin_colour", "Pin Color", ref value, myUndoInfo, ref myUndoInfo.pinColour); if (changed) { HoudiniHost.prPinColour = value; HoudiniHost.repaint(); } } // Auto pin { bool value = HoudiniHost.prAutoPinInstances; bool changed = HoudiniGUI.toggle( "auto_pin_instances", "Auto Pin Instances", ref value, myUndoInfo, ref myUndoInfo.autoPinInstances); if (changed) { HoudiniHost.prAutoPinInstances = value; HoudiniHost.repaint(); } } HoudiniGUI.separator(); // Enable Support Warnings { bool value = HoudiniHost.prEnableSupportWarnings; bool changed = HoudiniGUI.toggle( "enable_support_warnings", "Enable Support Warnings", ref value, myUndoInfo, ref myUndoInfo.enableSupportWarnings); if (changed) { HoudiniHost.prEnableSupportWarnings = 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 private static void generateGeneralSettings() { // Pin Size { float value = HoudiniHost.prPinSize; bool changed = HoudiniGUI.floatField( "pin_size", "Pin Size", ref value, myUndoInfo, ref myUndoInfo.pinSize ); if ( changed ) { HoudiniHost.prPinSize = value; HoudiniHost.repaint(); } } // Pin Colour { Color value = HoudiniHost.prPinColour; bool changed = HoudiniGUI.colourField( "pin_colour", "Pin Color", ref value, myUndoInfo, ref myUndoInfo.pinColour ); if ( changed ) { HoudiniHost.prPinColour = value; HoudiniHost.repaint(); } } // Auto pin { bool value = HoudiniHost.prAutoPinInstances; bool changed = HoudiniGUI.toggle( "auto_pin_instances", "Auto Pin Instances", ref value, myUndoInfo, ref myUndoInfo.autoPinInstances ); if ( changed ) { HoudiniHost.prAutoPinInstances = value; HoudiniHost.repaint(); } } HoudiniGUI.separator(); // Enable Support Warnings { bool value = HoudiniHost.prEnableSupportWarnings; bool changed = HoudiniGUI.toggle( "enable_support_warnings", "Enable Support Warnings", ref value, myUndoInfo, ref myUndoInfo.enableSupportWarnings ); if ( changed ) HoudiniHost.prEnableSupportWarnings = value; } HoudiniGUI.separator(); // Auto Select Asset Root Node { bool value = HoudiniHost.prAutoSelectAssetRootNode; bool changed = HoudiniGUI.toggle( "auto_select_asset_root_node", "Auto Select Asset Root Node", ref value, myUndoInfo, ref myUndoInfo.autoSelectAssetRootNode ); if ( changed ) { HoudiniHost.prAutoSelectAssetRootNode = value; HoudiniHost.repaint(); } } HoudiniGUI.separator(); // Enable particles { bool value = HoudiniHost.prEnablePointsAsParticles; bool changed = HoudiniGUI.toggle( "enable_points_as_particles", "Create Points as Particles", ref value, myUndoInfo, ref myUndoInfo.enablePointsAsParticles ); if ( changed ) { HoudiniHost.prEnablePointsAsParticles = value; } } }