/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // Public

    public override void OnEnable()
    {
        myAssetInput             = target as HoudiniAssetInput;
        myGeoAttributeManager    = myAssetInput.prGeoAttributeManager;
        myGeoAttributeManagerGUI = new HoudiniGeoAttributeManagerGUI(myGeoAttributeManager);

        base.OnEnable();
    }
Exemplo n.º 2
0
	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	// Public

	public override void OnEnable()
	{
		myAssetInput = target as HoudiniAssetInput;
		myGeoAttributeManager = myAssetInput.prGeoAttributeManager;
		myGeoAttributeManagerGUI = new HoudiniGeoAttributeManagerGUI( myGeoAttributeManager );

		base.OnEnable();
	}
 private void generatePaintToolGUI()
 {
     foreach (HoudiniGeoControl geo_control in myAssetOTL.prEditPaintGeos)
     {
         if (HoudiniGUI.button(geo_control.prGeoName, geo_control.prGeoName))
         {
             myAssetOTL.prActiveEditPaintGeo = geo_control;
             myGeoAttributeManager           = geo_control.prGeoAttributeManager;
             myGeoAttributeManagerGUI        = new HoudiniGeoAttributeManagerGUI(myGeoAttributeManager);
         }
     }
 }
Exemplo n.º 4
0
    public override void OnSceneGUI()
    {
        base.OnSceneGUI();

        // If no active attribute manager is set yet, set it.
        if (myAssetOTL.prEditPaintGeos.Count > 0 && myGeoAttributeManagerGUI == null)
        {
            myGeoAttributeManager    = myAssetOTL.prActiveAttributeManager;
            myGeoAttributeManagerGUI = new HoudiniGeoAttributeManagerGUI(myGeoAttributeManager);
        }

        // If we have an active attribute manager then go ahead and draw its Scene GUI.
        if (myGeoAttributeManagerGUI != null)
        {
            // First, get the current active paint geo index, then call the manager's
            // OnSceneGUI function to draw the GUI and get back the new active paint
            // geo index.
            int current_active_edit_paint_geo_index =
                myAssetOTL.prEditPaintGeos.FindIndex(
                    delegate(HoudiniGeoControl g) {
                return(System.Object.ReferenceEquals(
                           g.prGeoAttributeManager, myAssetOTL.prActiveAttributeManager));
            });
            int new_active_edit_paint_geo_index =
                myGeoAttributeManagerGUI.OnSceneGUI(
                    "Intermediate Result",
                    current_active_edit_paint_geo_index,
                    myAssetOTL.prEditPaintGeos.ConvertAll <string>(x => x.prGeoName).ToArray());

            // If the new active paint geo index is different than the old one we need to
            // switch attribute managers.
            if (new_active_edit_paint_geo_index != current_active_edit_paint_geo_index)
            {
                // Save the current mode on the current attribute manager and restore
                // its mode to NONE so that it properly hides its geometry.
                HoudiniGeoAttributeManager.Mode current_mode =
                    myAssetOTL.prActiveAttributeManager.prCurrentMode;
                myAssetOTL.prActiveAttributeManager.changeMode(
                    HoudiniGeoAttributeManager.Mode.NONE);

                // Switch to the new attribute manager.
                myAssetOTL.prActiveAttributeManager =
                    myAssetOTL.prEditPaintGeos[new_active_edit_paint_geo_index].prGeoAttributeManager;

                // Change the new attribute manager's mode to the previous attribute manager's mode.
                // This is important so that we have a smooth transition between attribute managers
                // and so that the new attribute manager's geo is unhidden.
                myAssetOTL.prActiveAttributeManager.changeMode(current_mode);

                // Update our local attribute manager pointer with the new attribute manager
                // and create a new attribute manager GUI for it.
                myGeoAttributeManager    = myAssetOTL.prActiveAttributeManager;
                myGeoAttributeManagerGUI = new HoudiniGeoAttributeManagerGUI(myGeoAttributeManager);
            }

            // If the value has changed (something was painted) and we have live updates enabled,
            // apply the modification on the mesh itself and cook the asset.
            if (myGeoAttributeManager != null &&
                myGeoAttributeManager.prHasChanged &&
                myGeoAttributeManager.prLiveUpdates)
            {
                myGeoAttributeManager.prHasChanged = false;

                HoudiniPartControl part_control =
                    myAssetOTL
                    .prEditPaintGeos[new_active_edit_paint_geo_index]
                    .prParts[0]
                    .GetComponent <HoudiniPartControl>();
                Mesh mesh = part_control.GetComponent <MeshFilter>().sharedMesh;
                HoudiniAssetUtility.setMesh(
                    part_control.prAssetId, part_control.prObjectId, part_control.prGeoId,
                    ref mesh, part_control, myGeoAttributeManager);
                myAssetOTL.buildClientSide();
            }
        }

        handlesOnSceneGUI();
    }
Exemplo n.º 5
0
	public override void OnSceneGUI()
	{
		base.OnSceneGUI();

		// If no active attribute manager is set yet, set it.
		if ( myAssetOTL.prEditPaintGeos.Count > 0 && myGeoAttributeManagerGUI == null )
		{
			myGeoAttributeManager = myAssetOTL.prActiveAttributeManager;
			myGeoAttributeManagerGUI = new HoudiniGeoAttributeManagerGUI( myGeoAttributeManager );
		}

		// If we have an active attribute manager then go ahead and draw its Scene GUI.
		if ( myGeoAttributeManagerGUI != null )
		{
			// First, get the current active paint geo index, then call the manager's
			// OnSceneGUI function to draw the GUI and get back the new active paint
			// geo index.
			int current_active_edit_paint_geo_index =
				myAssetOTL.prEditPaintGeos.FindIndex(
					delegate ( HoudiniGeoControl g ) {
						return System.Object.ReferenceEquals(
							g.prGeoAttributeManager, myAssetOTL.prActiveAttributeManager ); } );
			int new_active_edit_paint_geo_index =
				myGeoAttributeManagerGUI.OnSceneGUI(
					"Intermediate Result",
					current_active_edit_paint_geo_index,
					myAssetOTL.prEditPaintGeos.ConvertAll< string >( x => x.prGeoName ).ToArray() );

			// If the new active paint geo index is different than the old one we need to
			// switch attribute managers.
			if ( new_active_edit_paint_geo_index != current_active_edit_paint_geo_index )
			{
				// Save the current mode on the current attribute manager and restore
				// its mode to NONE so that it properly hides its geometry.
				HoudiniGeoAttributeManager.Mode current_mode =
					myAssetOTL.prActiveAttributeManager.prCurrentMode;
				myAssetOTL.prActiveAttributeManager.changeMode(
					HoudiniGeoAttributeManager.Mode.NONE );

				// Switch to the new attribute manager.
				myAssetOTL.prActiveAttributeManager =
					myAssetOTL.prEditPaintGeos[ new_active_edit_paint_geo_index ].prGeoAttributeManager;

				// Change the new attribute manager's mode to the previous attribute manager's mode.
				// This is important so that we have a smooth transition between attribute managers
				// and so that the new attribute manager's geo is unhidden.
				myAssetOTL.prActiveAttributeManager.changeMode( current_mode );

				// Update our local attribute manager pointer with the new attribute manager
				// and create a new attribute manager GUI for it.
				myGeoAttributeManager = myAssetOTL.prActiveAttributeManager; 
				myGeoAttributeManagerGUI = new HoudiniGeoAttributeManagerGUI( myGeoAttributeManager );
			}

			// If the value has changed (something was painted) and we have live updates enabled,
			// apply the modification on the mesh itself and cook the asset.
			if ( myGeoAttributeManager != null &&
				myGeoAttributeManager.prHasChanged &&
				myGeoAttributeManager.prLiveUpdates )
			{
				myGeoAttributeManager.prHasChanged = false;

				HoudiniPartControl part_control =
					myAssetOTL
						.prEditPaintGeos[ new_active_edit_paint_geo_index ]
						.prParts[ 0 ]
						.GetComponent< HoudiniPartControl >();
				Mesh mesh = part_control.GetComponent< MeshFilter >().sharedMesh;
				HoudiniAssetUtility.setMesh(
					part_control.prAssetId, part_control.prObjectId, part_control.prGeoId,
					ref mesh, part_control, myGeoAttributeManager );
				myAssetOTL.buildClientSide();
			}
		}

		handlesOnSceneGUI();
	}