protected void drawCookLog() { if (HoudiniGUI.button("get_cook_log", "Get Cook Log")) { myAsset.buildClientSide(); myLastCookLog = HoudiniHost.getStatusString( HAPI_StatusType.HAPI_STATUS_COOK_RESULT, HAPI_StatusVerbosity.HAPI_STATUSVERBOSITY_MESSAGES); } float width = (float)Screen.width - 60; myCookLogScrollPosition = EditorGUILayout.BeginScrollView( myCookLogScrollPosition, GUILayout.Height(200)); GUIStyle sel_label = new GUIStyle(GUI.skin.label); sel_label.stretchWidth = true; sel_label.wordWrap = true; float height = sel_label.CalcHeight( new GUIContent(myLastCookLog), width); EditorGUILayout.SelectableLabel( myLastCookLog, sel_label, GUILayout.Width(width), GUILayout.Height(height)); EditorGUILayout.EndScrollView(); }
private void generatePaintToolGUI() { foreach (HoudiniGeoControl geo_control in myAssetOTL.prEditPaintGeos) { if (HoudiniGUI.button(geo_control.prGeoName, geo_control.prGeoName)) { myAssetOTL.prActiveEditPaintGeo = geo_control; myGeoAttributeManager = geo_control.prGeoAttributeManager; myGeoAttributeManagerGUI = new HoudiniGeoAttributeManagerGUI(myGeoAttributeManager); } } }
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 generateAdvancedSettings() { if (!myEnableAdvancedSettings) { if (HoudiniGUI.button( "allow_advanced_settings", "Allow Editing of Advanced Settings")) { if (EditorUtility.DisplayDialog( "Careful!", "Changing these settings can cause the Houdini Engine plugin to stop working. " + "Are you sure you want to edit them?", "Yes", "No")) { myEnableAdvancedSettings = true; } } } else { if (HoudiniGUI.button( "disallow_advanced_settings", "Disallow Editing of Advanced Settings")) { myEnableAdvancedSettings = false; } } HoudiniGUI.separator(); bool gui_enabled = GUI.enabled; GUI.enabled = myEnableAdvancedSettings; // Collision Group Name { string value = HoudiniHost.prCollisionGroupName; bool changed = HoudiniGUI.stringField( "collision_group_name", "Colli. Grp.", ref value, myUndoInfo, ref myUndoInfo.collisionGroupName); if (changed) { HoudiniHost.prCollisionGroupName = value; } } // Rendered Collision Group Name { string value = HoudiniHost.prRenderedCollisionGroupName; bool changed = HoudiniGUI.stringField( "rendered_collision_group_name", "Rendered Colli. Grp.", ref value, myUndoInfo, ref myUndoInfo.renderedCollisionGroupName); if (changed) { HoudiniHost.prRenderedCollisionGroupName = value; } } HoudiniGUI.separator(); // Unity Material Attrib Name { string value = HoudiniHost.prUnityMaterialAttribName; bool changed = HoudiniGUI.stringField( "unity_material_attrib_name", "Unity Mat. Attrib.", ref value, myUndoInfo, ref myUndoInfo.unityMaterialAttribName); if (changed) { HoudiniHost.prUnityMaterialAttribName = value; } } // Unity Sub Material Name Attrib Name { string value = HoudiniHost.prUnitySubMaterialNameAttribName; bool changed = HoudiniGUI.stringField( "unity_sub_material_name_attrib_name", "Unity SubMat. Name Attrib.", ref value, myUndoInfo, ref myUndoInfo.unitySubMaterialNameAttribName); if (changed) { HoudiniHost.prUnitySubMaterialNameAttribName = value; } } // Unity Sub Material Index Attrib Name { string value = HoudiniHost.prUnitySubMaterialIndexAttribName; bool changed = HoudiniGUI.stringField( "unity_sub_material_index_attrib_name", "Unity SubMat. Index Attrib.", ref value, myUndoInfo, ref myUndoInfo.unitySubMaterialIndexAttribName); if (changed) { HoudiniHost.prUnitySubMaterialIndexAttribName = value; } } HoudiniGUI.separator(); // Unity Tag Attrib Name { string value = HoudiniHost.prUnityTagAttribName; bool changed = HoudiniGUI.stringField( "unity_tag_attrib_name", "Unity Tag Attrib.", ref value, myUndoInfo, ref myUndoInfo.unityTagAttribName); if (changed) { HoudiniHost.prUnityTagAttribName = value; } } GUI.enabled = gui_enabled; }
public override void OnInspectorGUI() { myPartControl.prShowDisplayOptions = HoudiniGUI.foldout("Display Options", myPartControl.prShowDisplayOptions, true); if (myPartControl.prShowDisplayOptions) { { if (HoudiniGUI.button("print_attribute_names", "Print Attribute Names")) { HoudiniAssetUtility.printAllAttributeNames( myPartControl.prAssetId, myPartControl.prObjectId, myPartControl.prGeoId, myPartControl.prPartId); } if (HoudiniGUI.button("print_group_info", "Print Group Info")) { HoudiniAssetUtility.printAllGroups( myPartControl.prAssetId, myPartControl.prObjectId, myPartControl.prGeoId, myPartControl.prPartId); } } { // Show Houdini Point Numbers bool value = myPartControl.prShowPointNumbers; bool undo_value = false; bool changed = HoudiniGUI.toggle( "show_point_numbers", "Show Houdini Point Numbers", ref value, null, ref undo_value); myPartControl.prShowPointNumbers = value; if (changed) { EditorUtility.SetDirty(myPartControl); } } } myPartControl.prShowIntermediateResultControls = HoudiniGUI.foldout("Intermediate Results", myPartControl.prShowIntermediateResultControls, true); if (myPartControl.prShowIntermediateResultControls) { bool gui_enabled = GUI.enabled; if (myPartControl.prGeoType != HAPI_GeoType.HAPI_GEOTYPE_INTERMEDIATE) { HoudiniGUI.help( "Only specially marked intermediate results geometries can be edited.", MessageType.Info); GUI.enabled = false; } if (GUILayout.Button("Update Intermediate Result")) { MeshFilter mesh_filter = myPartControl.gameObject.GetComponent <MeshFilter>(); Mesh shared_mesh = mesh_filter.sharedMesh; HoudiniPartControl part_control = myPartControl.gameObject.GetComponent <HoudiniPartControl>(); HoudiniAssetUtility.setMesh( myPartControl.prAsset.prAssetId, myPartControl.prObjectId, myPartControl.prGeoId, ref shared_mesh, part_control, null); myPartControl.prAsset.buildClientSide(); } if (GUILayout.Button("Clear Edits")) { HoudiniHost.revertGeo( myPartControl.prAsset.prAssetId, myPartControl.prObjectId, myPartControl.prGeoId); myPartControl.prAsset.buildClientSide(); } GUI.enabled = gui_enabled; } myPartControl.prShowInfo = HoudiniGUI.foldout("Info", myPartControl.prShowInfo, true); if (myPartControl.prShowInfo) { HoudiniGUI.help("Values here are for debugging only and should not be modified directly.", MessageType.Info); bool gui_enabled = GUI.enabled; GUI.enabled = false; DrawDefaultInspector(); GUI.enabled = gui_enabled; } }