public void Start() { //Debug.Log( "ExampleScript: Start" ); parmIndex = 0; parmNames = null; myAsset = null; parmName = ""; parmSize = 0; parmType = HoudiniAssetAccessor.ParmType.INVALID; parmIntValue = null; parmFloatValue = null; parmStringValue = null; // If the game object has a HAPI_Asset component then get // the parameters for this asset and set the selected // parameter to be the asset's first parameter myAsset = HoudiniAssetAccessor.getAssetAccessor(gameObject); if (myAsset != null) { Debug.Log("Asset name: " + myAsset.prName); parmNames = myAsset.getParameters(); setSelectedParameter(); } }
// Set the currently selected parameter and retrieve its values public void setSelectedParameter() { try { if (!hasAsset()) { return; } parmName = parmNames[parmIndex]; parmSize = myAsset.getParmSize(parmName); parmType = myAsset.getParmType(parmName); parmIntValue = null; parmFloatValue = null; parmStringValue = null; if (parmType == HoudiniAssetAccessor.ParmType.INT) { parmIntValue = new int[parmSize]; for (int i = 0; i < parmSize; i++) { parmIntValue[i] = myAsset.getParmIntValue(parmName, i); } } else if (parmType == HoudiniAssetAccessor.ParmType.FLOAT) { parmFloatValue = new float[parmSize]; for (int i = 0; i < parmSize; i++) { parmFloatValue[i] = myAsset.getParmFloatValue(parmName, i); } } else if (parmType == HoudiniAssetAccessor.ParmType.STRING) { parmStringValue = new string[parmSize]; for (int i = 0; i < parmSize; i++) { parmStringValue[i] = myAsset.getParmStringValue(parmName, i); } } } catch (HoudiniError err) { Debug.LogError(err.ToString()); } }
public void Start() { //Debug.Log( "ExampleScript: Start" ); parmIndex = 0; parmNames = null; myAsset = null; parmName = ""; parmSize = 0; parmType = HoudiniAssetAccessor.ParmType.INVALID; parmIntValue = null; parmFloatValue = null; parmStringValue = null; // If the game object has a HAPI_Asset component then get // the parameters for this asset and set the selected // parameter to be the asset's first parameter myAsset = HoudiniAssetAccessor.getAssetAccessor( gameObject ); if ( myAsset != null ) { Debug.Log( "Asset name: " + myAsset.prName ); parmNames = myAsset.getParameters(); setSelectedParameter(); } }
// Set the currently selected parameter and retrieve its values public void setSelectedParameter() { try { if ( !hasAsset() ) return; parmName = parmNames[ parmIndex ]; parmSize = myAsset.getParmSize( parmName ); parmType = myAsset.getParmType( parmName ); parmIntValue = null; parmFloatValue = null; parmStringValue = null; if ( parmType == HoudiniAssetAccessor.ParmType.INT ) { parmIntValue = new int[ parmSize ]; for ( int i = 0; i < parmSize; i++ ) { parmIntValue[ i ] = myAsset.getParmIntValue( parmName, i ); } } else if ( parmType == HoudiniAssetAccessor.ParmType.FLOAT ) { parmFloatValue = new float[ parmSize ]; for ( int i = 0; i < parmSize; i++ ) { parmFloatValue[ i ] = myAsset.getParmFloatValue( parmName, i ); } } else if ( parmType == HoudiniAssetAccessor.ParmType.STRING ) { parmStringValue = new string[ parmSize ]; for ( int i = 0; i < parmSize; i++ ) { parmStringValue[ i ] = myAsset.getParmStringValue( parmName, i ); } } } catch ( HoudiniError err ) { Debug.LogError( err.ToString() ); } }