Exemplo n.º 1
0
		/// <summary>
		/// Draw asset options for given asset.
		/// </summary>
		/// <param name="asset">The HDA asset</param>
		/// <param name="assetObject">Serialized HDA asset object</param>
		private void DrawAssetOptions(HEU_HoudiniAsset asset, SerializedObject assetObject)
		{
			HEU_EditorUI.BeginSection();
			{
				SerializedProperty showHDAOptionsProperty = assetObject.FindProperty("_showHDAOptions");

				showHDAOptionsProperty.boolValue = HEU_EditorUI.DrawFoldOut(showHDAOptionsProperty.boolValue, "ASSET OPTIONS");
				if (showHDAOptionsProperty.boolValue)
				{
					EditorGUI.indentLevel++;
					HEU_EditorUI.DrawPropertyField(assetObject, "_autoCookOnParameterChange", "Auto-Cook On Parameter Change");
					HEU_EditorUI.DrawPropertyField(assetObject, "_pushTransformToHoudini", "Push Transform To Houdini");
					HEU_EditorUI.DrawPropertyField(assetObject, "_transformChangeTriggersCooks", "Transform Change Triggers Cooks");
					HEU_EditorUI.DrawPropertyField(assetObject, "_cookingTriggersDownCooks", "Cooking Triggers Downstream Cooks");
					HEU_EditorUI.DrawPropertyField(assetObject, "_generateUVs", "Generate UVs");
					HEU_EditorUI.DrawPropertyField(assetObject, "_generateTangents", "Generate Tangents");
					HEU_EditorUI.DrawPropertyField(assetObject, "_ignoreNonDisplayNodes", "Ignore NonDisplay Nodes");

					if (asset.NumAttributeStores() > 0)
					{
						HEU_EditorUI.DrawPropertyField(assetObject, "_editableNodesToolsEnabled", "Enable Editable Node Tools");
					}

					if (asset.NumHandles() > 0)
					{
						HEU_EditorUI.DrawPropertyField(assetObject, "_handlesEnabled", "Enable Handles");
					}

					EditorGUI.indentLevel--;
				}
			}
			HEU_EditorUI.EndSection();

			HEU_EditorUI.DrawSeparator();
		}
Exemplo n.º 2
0
		/// <summary>
		/// Draw asset options for given asset.
		/// </summary>
		/// <param name="asset">The HDA asset</param>
		/// <param name="assetObject">Serialized HDA asset object</param>
		private void DrawAssetOptions(HEU_HoudiniAsset asset, SerializedObject assetObject)
		{
			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 showHDAOptionsProperty = assetObject.FindProperty("_showHDAOptions");

				showHDAOptionsProperty.boolValue = HEU_EditorUI.DrawFoldOut(showHDAOptionsProperty.boolValue, "ASSET OPTIONS");
				if (showHDAOptionsProperty.boolValue)
				{
					EditorGUI.indentLevel++;
					HEU_EditorUI.DrawPropertyField(assetObject, "_autoCookOnParameterChange", "Auto-Cook On Parameter Change");
					HEU_EditorUI.DrawPropertyField(assetObject, "_pushTransformToHoudini", "Push Transform To Houdini");
					HEU_EditorUI.DrawPropertyField(assetObject, "_transformChangeTriggersCooks", "Transform Change Triggers Cooks");
					HEU_EditorUI.DrawPropertyField(assetObject, "_cookingTriggersDownCooks", "Cooking Triggers Downstream Cooks");
					HEU_EditorUI.DrawPropertyField(assetObject, "_generateUVs", "Generate UVs");
					HEU_EditorUI.DrawPropertyField(assetObject, "_generateTangents", "Generate Tangents");
					HEU_EditorUI.DrawPropertyField(assetObject, "_generateNormals", "Generate Normals");
					HEU_EditorUI.DrawPropertyField(assetObject, "_generateMeshUsingPoints", "Generate Mesh Using Points");
					HEU_EditorUI.DrawPropertyField(assetObject, "_useLODGroups", "Use LOD Groups");
					HEU_EditorUI.DrawPropertyField(assetObject, "_ignoreNonDisplayNodes", "Ignore NonDisplay Nodes");

					if (asset.NumAttributeStores() > 0)
					{
						HEU_EditorUI.DrawPropertyField(assetObject, "_editableNodesToolsEnabled", "Enable Editable Node Tools");
					}

					if (asset.NumHandles() > 0)
					{
						HEU_EditorUI.DrawPropertyField(assetObject, "_handlesEnabled", "Enable Handles");
					}

					EditorGUILayout.Space();

					if(GUILayout.Button(_resetMaterialOverridesButton, buttonStyle, GUILayout.MaxWidth(180)))
					{
						asset.ResetMaterialOverrides();
					}

					EditorGUI.indentLevel--;
				}
			}
			HEU_EditorUI.EndSection();

			HEU_EditorUI.DrawSeparator();
		}
Exemplo n.º 3
0
		/// <summary>
		/// Draw asset options for given asset.
		/// </summary>
		/// <param name="asset">The HDA asset</param>
		/// <param name="assetObject">Serialized HDA asset object</param>
		private void DrawAssetOptions(HEU_HoudiniAsset asset, SerializedObject assetObject)
		{
			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 showHDAOptionsProperty = assetObject.FindProperty("_showHDAOptions");

				showHDAOptionsProperty.boolValue = HEU_EditorUI.DrawFoldOut(showHDAOptionsProperty.boolValue, "ASSET OPTIONS");
				if (showHDAOptionsProperty.boolValue)
				{
					EditorGUI.indentLevel++;
					HEU_EditorUI.DrawPropertyField(assetObject, "_autoCookOnParameterChange", "Auto-Cook On Parameter Change", "Automatically cook when a parameter changes. If off, must use Recook to cook.");
					HEU_EditorUI.DrawPropertyField(assetObject, "_pushTransformToHoudini", "Push Transform To Houdini", "Send the asset's transform to Houdini and apply to object.");
					HEU_EditorUI.DrawPropertyField(assetObject, "_transformChangeTriggersCooks", "Transform Change Triggers Cooks", "Changing the transform (e.g. moving) the asset in Unity will invoke cook in Houdini.");
					HEU_EditorUI.DrawPropertyField(assetObject, "_cookingTriggersDownCooks", "Cooking Triggers Downstream Cooks", "Cooking this asset will trigger dependent assets' to also cook.");
					HEU_EditorUI.DrawPropertyField(assetObject, "_generateUVs", "Generate UVs", "Force Unity to generate UVs for output geometry.");
					HEU_EditorUI.DrawPropertyField(assetObject, "_generateTangents", "Generate Tangents", "Generate tangents in Unity for output geometry.");
					HEU_EditorUI.DrawPropertyField(assetObject, "_generateNormals", "Generate Normals", "Generate normals in Unity for output geometry.");
					HEU_EditorUI.DrawPropertyField(assetObject, "_generateMeshUsingPoints", "Generate Mesh Using Points", "Use point attributes instead of vertex attributes for geometry. Ignores vertex attributes.");
					HEU_EditorUI.DrawPropertyField(assetObject, "_useLODGroups", "Use LOD Groups", "Automatically create Unity LOD group if found.");
					HEU_EditorUI.DrawPropertyField(assetObject, "_ignoreNonDisplayNodes", "Ignore NonDisplay Nodes", "Only display node geometry will be created.");
					HEU_EditorUI.DrawPropertyField(assetObject, "_splitGeosByGroup", "Split Geos By Group", "Split geometry into separate gameobjects by group. Deprecated feature and only recommended for simple use cases.");

					if (asset.NumAttributeStores() > 0)
					{
						HEU_EditorUI.DrawPropertyField(assetObject, "_editableNodesToolsEnabled", "Enable Editable Node Tools", "Displays Editable Node Tools and generates the node's geometry, if asset has editable nodes.");
					}

					if (asset.NumHandles() > 0)
					{
						HEU_EditorUI.DrawPropertyField(assetObject, "_handlesEnabled", "Enable Handles", "Creates Houdini Handles if asset has them.");
					}

					EditorGUILayout.Space();

					using (var hs = new EditorGUILayout.HorizontalScope())
					{
						if (GUILayout.Button(_savePresetButton, buttonStyle, GUILayout.MaxWidth(160)))
						{
							string fileName = asset.AssetName;
							string filePattern = "preset";
							string newPath = EditorUtility.SaveFilePanel("Save HDA preset", "", fileName + "." + filePattern, filePattern);
							if (newPath != null && !string.IsNullOrEmpty(newPath))
							{
								HEU_AssetPresetUtility.SaveAssetPresetToFile(asset, newPath);
							}
						}

						if (GUILayout.Button(_loadPresetButton, buttonStyle, GUILayout.MaxWidth(160)))
						{
							string fileName = asset.AssetName;
							string filePattern = "preset";
							string newPath = EditorUtility.OpenFilePanel("Load HDA preset", "", filePattern);
							if (newPath != null && !string.IsNullOrEmpty(newPath))
							{
								HEU_AssetPresetUtility.LoadPresetFileIntoAssetAndCook(asset, newPath);
							}
						}
					}

					EditorGUILayout.Space();

					if(GUILayout.Button(_resetMaterialOverridesButton, buttonStyle, GUILayout.MaxWidth(160)))
					{
						asset.ResetMaterialOverrides();
					}

					EditorGUI.indentLevel--;
				}
			}
			HEU_EditorUI.EndSection();

			HEU_EditorUI.DrawSeparator();
		}
	private static bool DrawBakeSection(HEU_HoudiniAssetRoot assetRoot, 
	    SerializedObject assetRootSerializedObject,
	    HEU_HoudiniAsset asset, SerializedObject assetObject,
	    ref HEU_HoudiniAsset.AssetBuildAction pendingBuildAction)
	{
	    bool bSkipAutoCook = false;

	    HEU_EditorUI.BeginSection();
	    {
		SerializedProperty showBakeProperty = assetObject.FindProperty("_showBakeSection");

		showBakeProperty.boolValue = HEU_EditorUI.DrawFoldOut(showBakeProperty.boolValue, "BAKE");
		if (showBakeProperty.boolValue)
		{
		    // Bake -> New Instance, New Prefab, Existing instance or prefab

		    using (var hs = new EditorGUILayout.HorizontalScope(_mainBoxStyle))
		    {
			if (GUILayout.Button(_bakegameobjectContent, _mainButtonStyle))
			{
			    asset.BakeToNewStandalone();
			}

			GUILayout.Space(_mainButtonSeparatorDistance);

			if (GUILayout.Button(_bakeprefabContent, _mainButtonStyle))
			{
			    asset.BakeToNewPrefab();
			}
		    }

		    using (var vs = new EditorGUILayout.VerticalScope(_mainBoxStyle))
		    {
			if (GUILayout.Button(_removeheContent, _mainButtonStyle))
			{
			    pendingBuildAction = HEU_HoudiniAsset.AssetBuildAction.STRIP_HEDATA;
			    bSkipAutoCook = true;
			}
		    }

		    using (var hs2 = new EditorGUILayout.VerticalScope(_mainBoxStyle))
		    {
			if (GUILayout.Button(_bakeandreplaceContent, _mainCentredButtonStyle))
			{
			    if (assetRoot._bakeTargets == null || assetRoot._bakeTargets.Count == 0)
			    {
				// No bake target means user probably forgot to set one. So complain!
				HEU_EditorUtility.DisplayDialog("No Bake Targets", "Bake Update requires atleast one valid GameObject.\n\nDrag a GameObject or Prefab onto the Drag and drop GameObjects / Prefabs field!", "OK");
			    }
			    else
			    {
				int numTargets = assetRoot._bakeTargets.Count;
				for (int i = 0; i < numTargets; ++i)
				{
				    GameObject bakeGO = assetRoot._bakeTargets[i];
				    if (bakeGO != null)
				    {
					if (HEU_EditorUtility.IsPrefabAsset(bakeGO))
					{
					    // Prefab asset means its the source prefab, and not an instance of it
					    asset.BakeToExistingPrefab(bakeGO);
					}
					else
					{
					    // This is for all standalone (including prefab instances)
					    asset.BakeToExistingStandalone(bakeGO);
					}
				    }
				    else
				    {
					Debug.LogWarning("Unable to bake to null target at index " + i);
				    }
				}
			    }
			}

			using (var hs = new EditorGUILayout.VerticalScope(_mainButtonSetStyle))
			{
			    SerializedProperty bakeTargetsProp = assetRootSerializedObject.FindProperty("_bakeTargets");
			    if (bakeTargetsProp != null)
			    {
				EditorGUILayout.PropertyField(bakeTargetsProp, _dragAndDropField, true);
			    }
			}

			HEU_EditorUI.BeginSimpleSection("Bake Update");
			HEU_EditorUI.DrawPropertyField(assetObject, "_bakeUpdateKeepPreviousTransformValues", "Keep Previous Transform Values", "Copy previous transform values when doing a Bake Update.");
			HEU_EditorUI.EndSimpleSection();
		    }
		}
	    }
	    HEU_EditorUI.EndSection();

	    HEU_EditorUI.DrawSeparator();

	    return bSkipAutoCook;
	}