コード例 #1
0
	public void SyncFromParameters(HEU_SessionBase session, HEU_HoudiniAsset parentAsset)
	{
	    HAPI_NodeInfo geoNodeInfo = new HAPI_NodeInfo();
	    if (!session.GetNodeInfo(_geoID, ref geoNodeInfo))
	    {
		return;
	    }

	    if (_parameters != null)
	    {
		_parameters.CleanUp();
	    }
	    else
	    {
		_parameters = ScriptableObject.CreateInstance<HEU_Parameters>();
	    }

	    string geoNodeName = HEU_SessionManager.GetString(geoNodeInfo.nameSH, session);
	    _parameters._uiLabel = geoNodeName.ToUpper() + " PARAMETERS";

	    bool bResult = _parameters.Initialize(session, _geoID, ref geoNodeInfo, null, null, parentAsset);
	    if (!bResult)
	    {
		Debug.LogWarningFormat("Parameter generate failed for geo node {0}.", geoNodeInfo.id);
		_parameters.CleanUp();
		return;
	    }

	    _points.Clear();
	    string pointList = _parameters.GetStringFromParameter(HEU_Defines.CURVE_COORDS_PARAM);
	    if (!string.IsNullOrEmpty(pointList))
	    {
		string[] pointSplit = pointList.Split(' ');
		foreach (string str in pointSplit)
		{
		    string[] vecSplit = str.Split(',');
		    if (vecSplit.Length == 3)
		    {
			_points.Add(new Vector3(-System.Convert.ToSingle(vecSplit[0], System.Globalization.CultureInfo.InvariantCulture),
				System.Convert.ToSingle(vecSplit[1], System.Globalization.CultureInfo.InvariantCulture),
				System.Convert.ToSingle(vecSplit[2], System.Globalization.CultureInfo.InvariantCulture)));
		    }
		}
	    }

	    // Since we just reset / created new our parameters and sync'd, we also need to 
	    // get the preset from Houdini session
	    if (!HEU_EditorUtility.IsEditorPlaying() && IsEditable())
	    {
		DownloadPresetData(session);
	    }
	}