Example #1
0
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // 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.
        }
    }