Esempio n. 1
0
    public void init(HoudiniGeoControl geo_control)
    {
        init((HoudiniObjectControl)geo_control);

        prGeoId      = geo_control.prGeoId;
        prGeoName    = geo_control.prGeoName;
        prGeoType    = geo_control.prGeoType;
        prIsEditable = geo_control.prIsEditable;
        prIsDisplay  = geo_control.prIsDisplay;
    }
Esempio n. 2
0
	public void init( HoudiniGeoControl geo_control )
	{
		init( (HoudiniObjectControl) geo_control );

		prGeoId			= geo_control.prGeoId;
		prGeoName		= geo_control.prGeoName;
		prGeoType		= geo_control.prGeoType;
		prIsEditable	= geo_control.prIsEditable;
		prIsDisplay		= geo_control.prIsDisplay;
	}
    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // Private Methods

    private GameObject createGeo(int geo_id)
    {
        GameObject child = new GameObject("uninitialized_geo");

        child.transform.parent = gameObject.transform;
        child.isStatic         = gameObject.isStatic;

        // Need to reset position here because the assignment above will massage the child's
        // position in order to be in the same place it was in the global namespace.
        child.transform.localPosition = new Vector3();
        child.transform.localRotation = new Quaternion();
        child.transform.localScale    = new Vector3(1.0f, 1.0f, 1.0f);

        HoudiniGeoControl control = child.AddComponent <HoudiniGeoControl>();

        control.init(this);
        control.prGeoId         = geo_id;
        control.prObjectControl = this;

        return(child);
    }
Esempio n. 4
0
    public bool setNodeParameterIntoHost(int id)
    {
        HAPI_ParmInfo parm = findParm(id);

        var parm_input = myParmInputs[id];

        if (!parm_input.inputObject)
        {
            return(false);
        }

        // Create new input node.
        GameObject     input_object    = parm_input.inputObject;
        HoudiniControl houdini_control = input_object.GetComponent <HoudiniControl>();
        MeshFilter     mesh_filter     = input_object.GetComponent <MeshFilter>();

        if (houdini_control &&
            houdini_control.prAsset.gameObject.GetComponentInChildren <HoudiniGeoControl>())
        {
            if (!houdini_control.prAsset.isAssetValid())
            {
                houdini_control.prAsset.buildAll();
            }

            HoudiniGeoControl geo_control =
                houdini_control.prAsset.gameObject.GetComponentInChildren <HoudiniGeoControl>();
            parm_input.inputNodeId = geo_control.prNodeId;

            // Add ourselves to our input asset's downstream nodes so when it cooks we cook.
            houdini_control.prAsset.addDownstreamAsset(myControl.prAsset);
        }
        else if (houdini_control &&
                 input_object.GetComponent <HoudiniAssetCurve>())
        {
            if (!houdini_control.prAsset.isAssetValid())
            {
                houdini_control.prAsset.buildAll();
            }

            parm_input.inputNodeId = houdini_control.prNodeId;

            // Add ourselves to our input asset's downstream nodes so when it cooks we cook.
            houdini_control.prAsset.addDownstreamAsset(myControl.prAsset);
        }
        else if (mesh_filter && mesh_filter.sharedMesh)
        {
            // We need to remove spaces in the input name
            string inputName = input_object.name.Replace(' ', '_');

            parm_input.inputNodeId = HoudiniHost.createInputNode(inputName);
            Mesh mesh = mesh_filter.sharedMesh;
            HoudiniAssetUtility.setMesh(
                parm_input.inputNodeId, 0, parm_input.inputNodeId, ref mesh, null, null);

            // Set the asset transform from the source GameObject transform.
            HAPI_TransformEuler trans =
                HoudiniAssetUtility.getHapiTransform(input_object.transform.localToWorldMatrix);
            HAPI_NodeInfo input_node_info = HoudiniHost.getNodeInfo(parm_input.inputNodeId);
            HoudiniHost.setObjectTransform(input_node_info.parentId, ref trans);
        }
        else
        {
            return(false);
        }

        HAPI_NodeInfo node_info = HoudiniHost.getNodeInfo(parm_input.inputNodeId);

        parm_input.inputNodeUniqueId = node_info.uniqueHoudiniNodeId;

        // Assign node parm input.
        HoudiniHost.setParmNodeValue(prControl.prNodeId, parm.name, parm_input.inputNodeId);

        myParmInputs[id] = parm_input;

        return(true);
    }
Esempio n. 5
0
    public override void reset()
    {
        base.reset();

        // Please keep these in the same order and grouping as their declarations at the top.

        prPartId = -1;
        prPartName = "part_name";
        prMaterialId = -1;
        prVertexList = new int[ 1 ];
        myTransformChanged = false;

        myShowDisplayOptions = true;
        myShowPointGroup = false;
        mySelectedPointGroup = "";
        myShowPrimitiveGroup = false;
        mySelectedPrimitiveGroup = "";
        myShowPointNumbers = false;

        myShowIntermediateResultControls = false;
        myShowInfo = false;

        myGeoControl = null;
    }