///////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Private Methods private void createAndInitCurve(int node_id, int object_id, int geo_id, bool editable) { if (prParmsNeedInit) { prParms.prEditable = editable; if (prAsset.prPresetsMap.contains(getFullControlNameAndPath())) { HoudiniPresetMap map = prAsset.prPresetsMap; byte[] preset = map.get(getFullControlNameAndPath()); HoudiniHost.setPreset(prNodeId, preset); // Unfortunately, we need to build everything again because we just changed // the parameters on our geo node. if (prAsset) { prAsset.buildClientSide(); } // The asset build will get the new parameter values of the asset, not our // geo node parameter values. We must get them ourselves. prParms.getParameterValues(); } } HoudiniCurve curve = gameObject.GetComponent <HoudiniCurve>(); if (curve == null) { curve = gameObject.AddComponent <HoudiniCurve>(); curve.prControl = this; curve.prParms = prParms; curve.prEditable = editable; curve.prCurrentMode = HoudiniCurve.Mode.NONE; } try { curve.syncPointsWithParm(); curve.createObject(object_id, geo_id); HoudiniHost.repaint(); } catch (HoudiniError) { // Per-object errors are not re-thrown so that the rest of the asset has a chance to load. } }
private void changeModes( ref bool add_points_mode, ref bool edit_points_mode, HoudiniCurve.Mode mode ) { switch ( mode ) { case HoudiniCurve.Mode.NONE: { add_points_mode = false; edit_points_mode = false; break; } case HoudiniCurve.Mode.ADD: { add_points_mode = true; edit_points_mode = false; break; } case HoudiniCurve.Mode.EDIT: { add_points_mode = false; edit_points_mode = true; break; } default: Debug.LogError( "Invalid mode?" ); break; } }