sideeffects / HoudiniEngineForUnreal

Houdini Engine Plugin for Unreal Engine.
http://www.sidefx.com/unreal
Other
1.3k stars 368 forks source link

Foliage Type can't support many foliagetypes use one staticmesh #276

Open cgTD123 opened 7 months ago

cgTD123 commented 7 months ago

In 5.0,I changed the code like this, UFoliageType* FoliageType = InstancedFoliageActor->GetLocalFoliageTypeForSource(BakedStaticMesh);

      //support much foliagetype use one staticmesh
      UFoliageType_InstancedStaticMesh* FoliageSMC = Cast<UFoliageType_InstancedStaticMesh>(InOutputObject.OutputObject);
      if (IsValid(FoliageSMC))
      {
          FoliageType = Cast<UFoliageType>(FoliageSMC);
      }

then,in this way,it can support one staticmesh,but many FoliageType,This is for One foliage,many Material.

but now,the data change to Map,Can't support one staticmesh many Foliage Type,and hard to custom by myself Hope this problem can be solved. UFoliageType * FoliageType = nullptr; if (FoliageMap.Contains(BakedStaticMesh)) { // Re-use FoliageType already created/ used on this export. FoliageType = FoliageMap[BakedStaticMesh]; } else { FHoudiniPackageParams Params = InstancerPackageParams; Params.ObjectName.Empty();

        // We need to create a new FoliageType for this Static Mesh
        // TODO: Add foliage default settings
        FoliageType = FHoudiniFoliageTools::CreateFoliageType(Params, InOutputIndex, BakedStaticMesh);
        FoliageMap.Add(BakedStaticMesh, FoliageType);