public override void OnInspectorGUI() { if (myGeoAttributeManager == null) { return; } bool is_editable = true; // We can only build or do anything if we can link to our libraries. #if !(UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || (UNITY_METRO && UNITY_EDITOR)) is_editable = false; HoudiniGUI.help(HoudiniConstants.HAPI_UNSUPPORTED_PLATFORM_MSG, MessageType.Info); #else if (!is_editable) { HoudiniGUI.help("This mesh is not editable.", MessageType.Info); } #endif // !( UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || ( UNITY_METRO && UNITY_EDITOR ) ) bool gui_enable = GUI.enabled; GUI.enabled = is_editable; myAssetInput.prShowHoudiniControls = HoudiniGUI.foldout("Houdini Controls", myAssetInput.prShowHoudiniControls, true); if (myAssetInput.prShowHoudiniControls) { if (!myAssetInput.isPrefab()) { if (GUILayout.Button("Rebuild")) { myAssetInput.buildAll(); } if (GUILayout.Button("Recook")) { myAssetInput.buildClientSide(); } } } // Draw Help Pane myAssetInput.prShowHelp = HoudiniGUI.foldout("Asset Help", myAssetInput.prShowHelp, true); if (myAssetInput.prShowHelp) { drawHelpBox(myHelpText); } /////////////////////////////////////////////////////////////////////// // Draw Asset Settings // These don't affect the asset directly so they don't trigger rebuilds. myAssetInput.prShowAssetSettings = HoudiniGUI.foldout("Asset Settings", myAssetInput.prShowAssetSettings, true); if (myAssetInput.prShowAssetSettings) { // Enable Cooking Toggle createToggleForProperty( "enable_cooking", "Enable Cooking", "prEnableCooking", ref myUndoInfo.enableCooking, null, !HoudiniHost.isEnableCookingDefault()); HoudiniGUI.separator(); // Cooking Triggers Downstream Cooks Toggle createToggleForProperty( "cooking_triggers_downstream_cooks", "Cooking Triggers Downstream Cooks", "prCookingTriggersDownCooks", ref myUndoInfo.cookingTriggersDownCooks, null, !HoudiniHost.isCookingTriggersDownCooksDefault(), !myAssetInput.prEnableCooking, " (all cooking is disabled)"); HoudiniGUI.separator(); // Push Unity Transform To Houdini Engine Toggle createToggleForProperty( "push_unity_transform_to_houdini_engine", "Push Unity Transform To Houdini Engine", "prPushUnityTransformToHoudini", ref myUndoInfo.pushUnityTransformToHoudini, null, !HoudiniHost.isPushUnityTransformToHoudiniDefault()); // Transform Change Triggers Cooks Toggle createToggleForProperty( "transform_change_triggers_cooks", "Transform Change Triggers Cooks", "prTransformChangeTriggersCooks", ref myUndoInfo.transformChangeTriggersCooks, null, !HoudiniHost.isTransformChangeTriggersCooksDefault(), !myAssetInput.prEnableCooking, " (all cooking is disabled)"); } /////////////////////////////////////////////////////////////////////// // Draw Point Attributes myAssetInput.prShowAttributesTable = HoudiniGUI.foldout("Point Attributes", myAssetInput.prShowAttributesTable, true); if (myAssetInput.prShowAttributesTable) { // Draw Create Point Attributes Action Bar { string[] preset_labels = new string[] { "Create Point Attribute:", "Custom", "Color", "UV", "Normal", "Bool", "Int", "Float", "String" }; int[] preset_values = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8 }; GUIStyle style = new GUIStyle(EditorStyles.popup); style.fixedHeight = 18; style.margin.bottom = 6; int preset_selected = EditorGUILayout.IntPopup( 0, preset_labels, preset_values, style); if (preset_selected == 1) { myGeoAttributeManager.createAttribute(); myAssetInput.prHasAttributeChanges = true; } else if (preset_selected > 1) { HoudiniGeoAttribute.Preset preset = (HoudiniGeoAttribute.Preset)(preset_selected - 2); myGeoAttributeManager.createAttribute(preset); myAssetInput.prHasAttributeChanges = true; } } // Draw recook notice. string help_msg = "There are uncommitted attribute changes. Press 'Recook' when ready."; if (myAssetInput.prHasError) { help_msg += "\nError: " + myAssetInput.prErrorMsg; } if (myAssetInput.prHasAttributeChanges) { HoudiniGUI.help(help_msg, MessageType.Info); } else { HoudiniGUI.help("Ready", MessageType.Info); } HoudiniGUI.separator(); string[] type_labels = new string[] { "bool", "int", "float", "string" }; int[] type_values = new int[] { 0, 1, 2, 3 }; string[] tuple_labels = new string[] { "1", "2", "3", "4", "5" }; int[] tuple_values = new int[] { 1, 2, 3, 4, 5 }; // Draw table header. { EditorGUILayout.BeginHorizontal(); GUIStyle label_style = new GUIStyle(EditorStyles.label); label_style.padding.right = -5; label_style.margin.left = -5; label_style.border.right = -10; EditorGUILayout.LabelField("Name", GUILayout.MinWidth(100)); EditorGUILayout.LabelField("Type", GUILayout.Width(50)); EditorGUILayout.LabelField("Tuple", GUILayout.Width(50)); EditorGUILayout.LabelField("|", GUILayout.Width(8)); EditorGUILayout.LabelField("Min", GUILayout.Width(50)); EditorGUILayout.LabelField("Max", GUILayout.Width(50)); EditorGUILayout.LabelField("", GUILayout.Width(27)); EditorGUILayout.EndHorizontal(); } for (int i = 0; i < myGeoAttributeManager.prAttributes.Count; ++i) { HoudiniGeoAttribute attrib = myGeoAttributeManager.prAttributes[i]; EditorGUILayout.BeginHorizontal(); // Attribute Name string new_name = EditorGUILayout.TextField(attrib.prName, GUILayout.MinWidth(100)); if (new_name != attrib.prName) { attrib.prName = new_name; myAssetInput.prHasAttributeChanges = true; } // Attribute Type HoudiniGeoAttribute.Type new_attrib_type = (HoudiniGeoAttribute.Type)EditorGUILayout.IntPopup( (int)attrib.prType, type_labels, type_values, GUILayout.Width(50)); if (new_attrib_type != attrib.prType) { attrib.prType = new_attrib_type; myAssetInput.prHasAttributeChanges = true; } // Attribute Tuple Size int new_tuple_size = EditorGUILayout.IntPopup( attrib.prTupleSize, tuple_labels, tuple_values, GUILayout.Width(50)); if (new_tuple_size != attrib.prTupleSize) { attrib.prTupleSize = new_tuple_size; myAssetInput.prHasAttributeChanges = true; } EditorGUILayout.LabelField("|", GUILayout.Width(8)); // Range if (attrib.prType == HoudiniGeoAttribute.Type.STRING) { EditorGUILayout.LabelField("N/A", GUILayout.MinWidth(20)); } else { if (attrib.prType == HoudiniGeoAttribute.Type.BOOL || attrib.prType == HoudiniGeoAttribute.Type.INT) { attrib.prIntMin = EditorGUILayout.IntField("", attrib.prIntMin, GUILayout.Width(50)); } else if (attrib.prType == HoudiniGeoAttribute.Type.FLOAT) { attrib.prFloatMin = EditorGUILayout.FloatField("", attrib.prFloatMin, GUILayout.Width(50)); } if (attrib.prType == HoudiniGeoAttribute.Type.BOOL || attrib.prType == HoudiniGeoAttribute.Type.INT) { attrib.prIntMax = EditorGUILayout.IntField("", attrib.prIntMax, GUILayout.Width(50)); } else if (attrib.prType == HoudiniGeoAttribute.Type.FLOAT) { attrib.prFloatMax = EditorGUILayout.FloatField("", attrib.prFloatMax, GUILayout.Width(50)); } } EditorGUILayout.LabelField("|", GUILayout.Width(8)); GUIStyle label_style = new GUIStyle(EditorStyles.label); label_style.fontStyle = FontStyle.Bold; if (GUILayout.Button("X", label_style, GUILayout.Width(15), GUILayout.Height(15))) { myGeoAttributeManager.deleteAttribute(attrib.prName); myAssetInput.prHasAttributeChanges = true; } EditorGUILayout.EndHorizontal(); } { EditorGUILayout.BeginHorizontal(); GUIStyle label_style = new GUIStyle(EditorStyles.label); label_style.fontStyle = FontStyle.Normal; label_style.alignment = TextAnchor.MiddleRight; label_style.padding.left = 0; label_style.margin.left = 0; label_style.padding.right = 0; label_style.margin.right = 0; EditorGUILayout.LabelField("Delete Attribute", label_style, GUILayout.MinWidth(40)); label_style.fontStyle = FontStyle.Bold; label_style.padding.left = 0; label_style.margin.left = 6; label_style.padding.right = 5; label_style.margin.right = 5; EditorGUILayout.LabelField("↲", label_style, GUILayout.Width(10)); EditorGUILayout.EndHorizontal(); } } // Show Attributes Table GUI.enabled = gui_enable; }
public override void OnInspectorGUI() { bool gui_enable = GUI.enabled; // We can only build or do anything if we can link to our libraries. #if !(UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || (UNITY_METRO && UNITY_EDITOR)) HoudiniGUI.help(HoudiniConstants.HAPI_UNSUPPORTED_PLATFORM_MSG, MessageType.Info); GUI.enabled = false; #else if (!HoudiniHost.isInstallationOk()) { HoudiniGUI.help(HoudiniHost.getMissingEngineInstallHelpString(), MessageType.Info); GUI.enabled = false; } #endif // !( UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || ( UNITY_METRO && UNITY_EDITOR ) ) try { myDelayBuild = false; myParmChanges = false; /////////////////////////////////////////////////////////////////////// // Draw Game Object Controls if (HoudiniHost.isAssetValid(myAsset.prAssetId, myAsset.prAssetValidationId) && (myAsset.prTransformInputCount > 0 || myAsset.prGeoInputCount > 0) && myAsset.prAssetSubType != HAPI_AssetSubType.HAPI_ASSETSUBTYPE_CURVE && !myAsset.isPrefab()) { myAsset.prShowInputControls = HoudiniGUI.foldout("Inputs", myAsset.prShowInputControls, true); if (myAsset.prShowInputControls) { if (myAsset.prHAPIAssetType == HAPI_AssetType.HAPI_ASSETTYPE_OBJ) { for (int ii = 0; ii < myAsset.prTransformInputCount; ++ii) { myParmChanges |= setTransformInput(ii); } } if (myAsset.prUpStreamGeoObjects == null || myAsset.prUpStreamGeoAssets == null || myAsset.prUpStreamGeoObjects.Count <= 0 || myAsset.prUpStreamGeoAssets.Count <= 0) { return; } for (int input_index = 0; input_index < myAsset.prGeoInputCount; ++input_index) { bool join_last = false; bool no_label_toggle_last = true; HoudiniGUIParm geo_input = new HoudiniGUIParm( "geo_input_" + input_index, myAsset.prGeoInputNames[input_index]); Object obj = (Object)myAsset.prUpStreamGeoObjects[input_index]; myParmChanges |= HoudiniGUI.objectField( ref geo_input, ref obj, typeof(GameObject), ref join_last, ref no_label_toggle_last); if (myParmChanges || !myAsset.isGeoInputValid(input_index)) { if (!obj) { myAsset.removeGeoInput(input_index); myAsset.buildClientSide(); } else { GameObject new_obj = (GameObject)obj; myAsset.prUpStreamGeoObjects[input_index] = new_obj; // Select the asset component (if it exists). HoudiniAsset asset = new_obj.GetComponent <HoudiniAsset>(); // If we're selecting a specific object to input than try and // get the object id. Note that by getting the HAPI_ObjectControl // component we also cover the geo and part controls because // they all inherit from HAPI_ObjectControl. The user can therefore // drag any gameObject under the asset into another asset's // input and have it all work. int object_index = 0; HoudiniObjectControl obj_control = new_obj.GetComponent <HoudiniObjectControl>(); if (obj_control) { object_index = obj_control.prObjectId; asset = obj_control.prAsset; } if (asset == null) { myAsset.addGeoAsGeoInput(new_obj, input_index); myAsset.buildClientSide(); } else if (myAsset.prUpStreamGeoAssets[input_index] != asset) { if (myAsset == asset) { Debug.LogError("Can't connect an asset to itself!"); } else { myAsset.addAssetAsGeoInput(asset, object_index, input_index); myAsset.buildClientSide(); } } } } } // for } // if } // if // Draw Cook Log Pane myAsset.prShowCookLog = HoudiniGUI.foldout("Asset Cook Log", myAsset.prShowCookLog, true); if (myAsset.prShowCookLog) { drawCookLog(); } } catch (HoudiniError e) { Debug.LogError(e.ToString()); } GUI.enabled = gui_enable; }
public override void OnInspectorGUI() { base.OnInspectorGUI(); bool gui_enable = GUI.enabled; // We can only build or do anything if we can link to our libraries. #if !( HAPI_ENABLE_RUNTIME ) GUI.enabled = false; #else if (!HoudiniHost.isInstallationOk()) { GUI.enabled = false; } #endif // !( HAPI_ENABLE_RUNTIME ) /////////////////////////////////////////////////////////////////////// // Draw Game Object Controls myAsset.prShowHoudiniControls = HoudiniGUI.foldout("Houdini Controls", myAsset.prShowHoudiniControls, true); if (myAsset.prShowHoudiniControls) { if (GUILayout.Button("Rebuild")) { myGeoAttributeManagerGUI = null; myAsset.buildAll(); } if (GUILayout.Button("Recook")) { myAsset.buildClientSide(); } if (GUILayout.Button("Bake")) { myAsset.bakeAsset(); } } // Draw Help Pane myAsset.prShowHelp = HoudiniGUI.foldout("Asset Help", myAsset.prShowHelp, true); if (myAsset.prShowHelp) { drawHelpBox(myAsset.prAssetHelp); } /////////////////////////////////////////////////////////////////////// // Draw Asset Settings // These don't affect the asset directly so they don't trigger rebuilds. myAsset.prShowAssetSettings = HoudiniGUI.foldout("Asset Settings", myAsset.prShowAssetSettings, true); if (myAsset.prShowAssetSettings) { generateAssetSettings(); } /////////////////////////////////////////////////////////////////////// // Draw Baking Controls myAsset.prShowBakeOptions = HoudiniGUI.foldout("Bake Animations", myAssetOTL.prShowBakeOptions, true); if (myAsset.prShowBakeOptions) { generateAssetBakeControls(); } GUI.enabled = gui_enable; }
public override void OnInspectorGUI() { bool gui_enable = GUI.enabled; // We can only build or do anything if we can link to our libraries. #if !( HAPI_ENABLE_RUNTIME ) HoudiniGUI.help(HoudiniConstants.HAPI_UNSUPPORTED_PLATFORM_MSG, MessageType.Info); GUI.enabled = false; #else if (!HoudiniHost.isInstallationOk()) { HoudiniGUI.help(HoudiniHost.getMissingEngineInstallHelpString(), MessageType.Info); GUI.enabled = false; } #endif // !( HAPI_ENABLE_RUNTIME ) try { myDelayBuild = false; myParmChanges = false; /////////////////////////////////////////////////////////////////////// // Draw License/Logo Thingy #if ( HAPI_ENABLE_RUNTIME ) drawLicenseLogo(); #endif /////////////////////////////////////////////////////////////////////// // Draw Game Object Controls /*if ( HoudiniHost.isNodeValid( myAsset.prAssetId, myAsset.prNodeInfo.uniqueHoudiniNodeId ) && * ( myAsset.prTransformInputCount > 0 || myAsset.prGeoInputCount > 0 ) && * myAsset.prAssetSubType != HAPI_AssetSubType.HAPI_ASSETSUBTYPE_CURVE ) * { * myAsset.prShowInputControls = HoudiniGUI.foldout( "Inputs", myAsset.prShowInputControls, true ); * * if ( myAsset.prShowInputControls ) * { * if ( myAsset.prHAPIAssetType == HAPI_AssetType.HAPI_ASSETTYPE_OBJ ) * for ( int ii = 0; ii < myAsset.prTransformInputCount; ++ii ) * myParmChanges |= setTransformInput( ii ); * * if ( myAsset.prUpStreamGeoObjects == null || myAsset.prUpStreamGeoAssets == null || * myAsset.prUpStreamGeoObjects.Count <= 0 || myAsset.prUpStreamGeoAssets.Count <= 0 ) * myAsset.prGeoInputCount = 0; * * for ( int input_index = 0; input_index < myAsset.prGeoInputCount; ++input_index ) * { * bool join_last = false; * bool no_label_toggle_last = true; * * HoudiniGUIParm geo_input = new HoudiniGUIParm( * "geo_input_" + input_index, myAsset.prGeoInputNames[ input_index ] ); * Object obj = (Object) myAsset.prUpStreamGeoObjects[ input_index ]; * myParmChanges |= HoudiniGUI.objectField( * ref geo_input, ref obj, typeof( GameObject ), ref join_last, ref no_label_toggle_last ); * * if ( myParmChanges || !myAsset.isGeoInputValid( input_index ) ) * { * if ( !obj ) * { * myAsset.removeGeoInput( input_index ); * myAsset.buildClientSide(); * } * else * { * GameObject new_obj = (GameObject) obj; * myAsset.prUpStreamGeoObjects[ input_index ] = new_obj; * * // Select the asset component (if it exists). * HoudiniAsset asset = new_obj.GetComponent< HoudiniAsset >(); * * // If we're selecting a specific object to input than try and * // get the object id. Note that by getting the HAPI_ObjectControl * // component we also cover the geo and part controls because * // they all inherit from HAPI_ObjectControl. The user can therefore * // drag any gameObject under the asset into another asset's * // input and have it all work. * int object_index = 0; * HoudiniObjectControl obj_control = new_obj.GetComponent< HoudiniObjectControl >(); * if ( obj_control ) * { * object_index = obj_control.prObjectId; * asset = obj_control.prAsset; * } * * if ( asset == null ) * { * myAsset.addGeoAsGeoInput( new_obj, input_index ); * myAsset.buildClientSide(); * } * else if ( myAsset.prUpStreamGeoAssets[ input_index ] != asset ) * { * if ( myAsset == asset ) * Debug.LogError( "Can't connect an asset to itself!" ); * else * { * myAsset.addAssetAsGeoInput( asset, object_index, input_index ); * myAsset.buildClientSide(); * } * } * } * } * } // for * } // if * } // if */ // Draw Cook Log Pane myAsset.prShowCookLog = HoudiniGUI.foldout("Asset Cook Log", myAsset.prShowCookLog, true); if (myAsset.prShowCookLog) { drawCookLog(); } } catch (HoudiniError e) { Debug.LogError(e.ToString()); } GUI.enabled = gui_enable; }
public override void OnInspectorGUI() { base.OnInspectorGUI(); bool gui_enable = GUI.enabled; // We can only build or do anything if we can link to our libraries. #if !(UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || (UNITY_METRO && UNITY_EDITOR)) GUI.enabled = false; #else if (!HoudiniHost.isInstallationOk()) { GUI.enabled = false; } #endif // !( UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || ( UNITY_METRO && UNITY_EDITOR ) ) if (myAssetOTL.isPrefabInstance()) { myParentPrefabAsset = myAsset.getParentPrefabAsset(); } /////////////////////////////////////////////////////////////////////// // Draw Game Object Controls myAsset.prShowHoudiniControls = HoudiniGUI.foldout("Houdini Controls", myAsset.prShowHoudiniControls, true); if (myAsset.prShowHoudiniControls) { if (!myAsset.isPrefab()) { if (GUILayout.Button("Rebuild")) { myAsset.buildAll(); } if (GUILayout.Button("Recook")) { myAsset.buildClientSide(); } if (GUILayout.Button("Bake")) { myAsset.bakeAsset(); } } } // Draw Help Pane myAsset.prShowHelp = HoudiniGUI.foldout("Asset Help", myAsset.prShowHelp, true); if (myAsset.prShowHelp) { drawHelpBox(myAsset.prAssetHelp); } /////////////////////////////////////////////////////////////////////// // Draw Asset Settings // These don't affect the asset directly so they don't trigger rebuilds. myAsset.prShowAssetSettings = HoudiniGUI.foldout("Asset Settings", myAsset.prShowAssetSettings, true); if (myAsset.prShowAssetSettings) { generateAssetSettings(); } /////////////////////////////////////////////////////////////////////// // Draw Baking Controls if (!myAsset.isPrefab()) { myAsset.prShowBakeOptions = HoudiniGUI.foldout("Bake Animations", myAssetOTL.prShowBakeOptions, true); if (myAsset.prShowBakeOptions) { generateAssetBakeControls(); } } /////////////////////////////////////////////////////////////////////// // Draw Paint Tools #if !HAPI_PAINT_SUPPORT if (!myAsset.isPrefab()) { myAsset.prShowPaintTools = HoudiniGUI.foldout("Paint Tools", myAssetOTL.prShowPaintTools, true); if (myAsset.prShowPaintTools) { generatePaintToolGUI(); } } #endif // !HAPI_PAINT_SUPPORT GUI.enabled = gui_enable; }
public override void OnInspectorGUI() { bool gui_enable = GUI.enabled; // We can only build or do anything if we can link to our libraries. #if !( HAPI_ENABLE_RUNTIME ) HoudiniGUI.help(HoudiniConstants.HAPI_UNSUPPORTED_PLATFORM_MSG, MessageType.Info); GUI.enabled = false; #else if (!HoudiniHost.isInstallationOk()) { HoudiniGUI.help(HoudiniHost.getMissingEngineInstallHelpString(), MessageType.Info); GUI.enabled = false; } #endif // !( HAPI_ENABLE_RUNTIME ) try { myDelayBuild = false; myParmChanges = false; /////////////////////////////////////////////////////////////////////// // Draw License/Logo Thingy #if ( HAPI_ENABLE_RUNTIME ) drawLicenseLogo(); #endif /////////////////////////////////////////////////////////////////////// // Draw Game Object Controls if (HoudiniHost.isNodeValid(myAsset.prAssetId, myAsset.prNodeInfo.uniqueHoudiniNodeId) && (myAsset.prTransformInputCount > 0 || myAsset.prGeoInputCount > 0) && myAsset.prAssetType != HoudiniAsset.AssetType.TYPE_CURVE) { myAsset.prShowInputControls = HoudiniGUI.foldout("Inputs", myAsset.prShowInputControls, true); if (myAsset.prShowInputControls) { if (myAsset.prNodeInfo.type == HAPI_NodeType.HAPI_NODETYPE_OBJ) { for (int ii = 0; ii < myAsset.prTransformInputCount; ++ii) { myParmChanges |= setTransformInput(ii); } } if (myAsset.prUpStreamGeoObjects == null || myAsset.prUpStreamGeoAssets == null || myAsset.prUpStreamGeoObjects.Count <= 0 || myAsset.prUpStreamGeoAssets.Count <= 0) { myAsset.prGeoInputCount = 0; } for (int input_index = 0; input_index < myAsset.prGeoInputCount; ++input_index) { bool join_last = false; bool no_label_toggle_last = true; GameObject temp_obj = null; HoudiniGUIParm geo_input = new HoudiniGUIParm( "geo_input_" + input_index, myAsset.prGeoInputNames[input_index]); Object obj = (Object)myAsset.prUpStreamGeoObjects[input_index]; myParmChanges |= HoudiniGUI.objectField( ref geo_input, ref obj, typeof(GameObject), ref join_last, ref no_label_toggle_last, null, ref temp_obj); HoudiniGUIParm geo_input_transform_type = new HoudiniGUIParm( "geo_input_transform_type_" + input_index, "Keep world transform"); bool transform_type = myAsset.prGeoInputsTransformTypes[input_index] != 0; bool TransformTypeUpdate = HoudiniGUI.toggle(ref geo_input_transform_type, ref transform_type); bool need_build_client_side = false; if (myParmChanges || !myAsset.isGeoInputValid(input_index)) { if (!obj) { myAsset.removeGeoInput(input_index); //myAsset.buildClientSide(); need_build_client_side = true; } else { GameObject new_obj = (GameObject)obj; myAsset.prUpStreamGeoObjects[input_index] = new_obj; // Select the asset component (if it exists). HoudiniAsset asset = new_obj.GetComponent <HoudiniAsset>(); // If we're selecting a specific object to input than try and // get the object id. Note that by getting the HAPI_ObjectControl // component we also cover the geo and part controls because // they all inherit from HAPI_ObjectControl. The user can therefore // drag any gameObject under the asset into another asset's // input and have it all work. int object_index = 0; HoudiniObjectControl obj_control = new_obj.GetComponent <HoudiniObjectControl>(); if (obj_control) { object_index = obj_control.prObjectId; asset = obj_control.prAsset; } if (asset == null) { // Connecting a new game object myAsset.addGeoAsGeoInput(new_obj, input_index); myAsset.updateGeoInputTransformType(input_index, transform_type ? 1 : 0); need_build_client_side = true; //myAsset.buildClientSide(); } else if (myAsset.prUpStreamGeoAssets[input_index] != asset) { // Connecting a new asset if (myAsset == asset) { Debug.LogError("Can't connect an asset to itself!"); } else { myAsset.addAssetAsGeoInput(asset, object_index, input_index); myAsset.updateGeoInputTransformType(input_index, transform_type ? 1 : 0); need_build_client_side = true; //myAsset.buildClientSide(); } } } } if (TransformTypeUpdate) { myAsset.updateGeoInputTransformType(input_index, transform_type ? 1 : 0); need_build_client_side = true; } if (need_build_client_side) { myAsset.buildClientSide(); } } // for } // if } // if // Draw Cook Log Pane myAsset.prShowCookLog = HoudiniGUI.foldout("Asset Cook Log", myAsset.prShowCookLog, true); if (myAsset.prShowCookLog) { drawCookLog(); } } catch (HoudiniError e) { Debug.LogError(e.ToString()); } GUI.enabled = gui_enable; }
private void generateAssetInstanceControls() { HoudiniInstancerManager instancer_manager = myAssetOTL.gameObject.GetComponent <HoudiniInstancerManager>(); if (instancer_manager == null) { return; } List <HoudiniInstancerPersistentData> instancer_persistent_data = instancer_manager.prInstancerPersistentData; HoudiniInstancer[] instancers = myAssetOTL.gameObject.GetComponentsInChildren <HoudiniInstancer>(); foreach (HoudiniInstancer instancer in instancers) { HoudiniInstancerPersistentData persistent_data = null; for (int ii = 0; ii < instancer_persistent_data.Count; ii++) { HoudiniInstancerPersistentData data = instancer_persistent_data[ii]; if (data.instancerName == instancer.name) { persistent_data = data; break; } } if (persistent_data == null) { Debug.LogError("Can't find persistent data for instancer: " + instancer.name); continue; } Undo.RecordObject(persistent_data, "Houdini Instancer Change"); persistent_data.showInstancerGUI = HoudiniGUI.foldout( persistent_data.instancerName, persistent_data.showInstancerGUI, true); if (persistent_data.showInstancerGUI) { bool changed = false; { Vector3 dummy = new Vector3(); changed |= HoudiniGUI.floatField( "RotationOffset", "Rotation Offset", ref persistent_data.rotationalOffset, null, ref dummy); changed |= HoudiniGUI.floatField( "ScaleOffset", "Scale Offset", ref persistent_data.scaleOffset, null, ref dummy); List <string> unique_names = persistent_data.uniqueNames; for (int ii = 0; ii < unique_names.Count; ii++) { string instanced_name = unique_names[ii]; int base_index = persistent_data.baseIndex(ii); for (int jj = 0; jj < persistent_data.numObjsToInstantiate[ii]; jj++) { Object obj = (Object)persistent_data.objsToInstantiate[base_index + jj]; GUILayout.BeginHorizontal(); string label = ""; if (jj == 0) { label = instanced_name; } changed |= HoudiniGUI.objectField( "object_to_instantiate", label, ref obj, typeof(GameObject)); if (changed) { persistent_data.objsToInstantiate[base_index + jj] = (GameObject)obj; } if (GUILayout.Button("+")) { persistent_data.objsToInstantiate.Insert (base_index + jj, null); persistent_data.numObjsToInstantiate[ii]++; persistent_data.recalculateVariations[ii] = true; changed = true; break; } if (GUILayout.Button("-")) { if (persistent_data.numObjsToInstantiate[ii] == 1) { persistent_data.objsToInstantiate[base_index] = null; } else { persistent_data.objsToInstantiate.RemoveAt(base_index + jj); persistent_data.numObjsToInstantiate[ii]--; } persistent_data.recalculateVariations[ii] = true; changed = true; break; } GUILayout.EndHorizontal(); } } if (GUILayout.Button("Recalculate Variations")) { for (int ii = 0; ii < unique_names.Count; ii++) { persistent_data.recalculateVariations[ii] = true; } changed = true; } } if (instancer.hasOverriddenInstances()) { if (GUILayout.Button("UnPin All Instances")) { instancer.unPinAllInstances(); changed = true; } } if (changed) { HoudiniProgressBar progress_bar = new HoudiniProgressBar(); instancer.instanceObjects(progress_bar); progress_bar.clearProgressBar(); for (int ii = 0; ii < persistent_data.recalculateVariations.Count; ii++) { persistent_data.recalculateVariations[ii] = false; } } } EditorGUILayout.Separator(); } }
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; } }
public override void OnInspectorGUI() { if (myAssetMerger == null) { return; } bool is_editable = true; // We can only build or do anything if we can link to our libraries. #if !( HAPI_ENABLE_RUNTIME ) is_editable = false; HoudiniGUI.help(HoudiniConstants.HAPI_UNSUPPORTED_PLATFORM_MSG, MessageType.Info); #else if (!is_editable) { HoudiniGUI.help("This mesh is not editable.", MessageType.Info); } #endif // !( HAPI_ENABLE_RUNTIME ) bool gui_enable = GUI.enabled; GUI.enabled = is_editable; myAssetMerger.prShowInputSelection = HoudiniGUI.foldout("Houdini Input Selection", myAssetMerger.prShowInputSelection, true); if (myAssetMerger.prShowInputSelection) { bool changed = false; Object input_object = myAssetMerger.prInputObject as Object; GameObject temp_obj = null; HoudiniGUI.objectField( "input_object", "Input Object", ref input_object, typeof(GameObject), null, ref temp_obj); myAssetMerger.prInputObject = input_object as GameObject; bool input_layer_enable = myAssetMerger.prUseLayerMask; HoudiniGUIParm input_layer_enable_parm = new HoudiniGUIParm("input_layer_enable", ""); input_layer_enable_parm.joinNext = true; input_layer_enable_parm.labelNone = true; changed = HoudiniGUI.toggle(ref input_layer_enable_parm, ref input_layer_enable); if (changed) { myAssetMerger.prUseLayerMask = input_layer_enable; } LayerMask input_layer = myAssetMerger.prLayerMask; HoudiniGUIParm input_layer_parm = new HoudiniGUIParm("input_layer", "Layer"); input_layer_parm.disabled = !input_layer_enable; bool join_last = true; bool no_label_toggle_last = true; changed = HoudiniGUI.layerField(ref input_layer_parm, ref input_layer, ref join_last, ref no_label_toggle_last); if (changed) { myAssetMerger.prLayerMask = input_layer; } bool input_tag_enable = myAssetMerger.prUseTag; HoudiniGUIParm input_tag_enable_parm = new HoudiniGUIParm("input_tag_enable", ""); input_tag_enable_parm.joinNext = true; input_tag_enable_parm.labelNone = true; changed = HoudiniGUI.toggle(ref input_layer_enable_parm, ref input_tag_enable); if (changed) { myAssetMerger.prUseTag = input_tag_enable; } string input_tag = myAssetMerger.prTag; HoudiniGUIParm input_tag_parm = new HoudiniGUIParm("input_tag", "Tag"); input_tag_parm.disabled = !input_tag_enable; join_last = true; no_label_toggle_last = true; changed = HoudiniGUI.tagField(ref input_tag_parm, ref input_tag, ref join_last, ref no_label_toggle_last); if (changed) { myAssetMerger.prTag = input_tag; } } myAssetMerger.prShowHoudiniControls = HoudiniGUI.foldout("Houdini Controls", myAssetMerger.prShowHoudiniControls, true); if (myAssetMerger.prShowHoudiniControls) { if (GUILayout.Button("Recook")) { myAssetMerger.buildClientSide(); } } GUI.enabled = gui_enable; }