Took me some time to figure out how to set the points color (“Cd”) attribute with data stored initially in custom points attributes. I kept trying to use the Color SOP node with a “point()” function in its R, G, B fields attempting to refer to the wanted attributes but it didn’t work for me, I also tried various loop setups iterating the geometry points, couldn’t get that to work either.. * I’m new to Houdini so the fact these approaches didn’t work for me doesn’t mean they can’t be used for this..
I finally managed to do this using a Point Wrangle node with the following VEX expression that sets the Cd (color) attribute’s vector components by referring to the 3 custom attributes “att_a”, “att_b” and “att_c” (see image below):
@Cd = set(@att_a,@att_b,@att_c);
What the Point Wrangler node does that I couldn’t achieve by writing expressions into the RGB fields of the Color node or by using loops is that it iterates all its input SOP’s points, and within its expression the attribute name i.e. “att_a” etc. automatically refers to that named attribute in the same point that is now being iterated over.
Note: The reason I need such a workflow in the first place is to generate geometric property masks for a Houdini asset, that will be available for the target shading system via vertex color input. * The Houdini point color attribute propagates to vertex color on output.
After setting the point color, I added an Attribute Delete SOP node to delete the no more necessary custom attributes:
Importing assets into a project is done using the import_asset_tasks() function which is a member of the unreal.AssetTools class.
A reference to the AssetTools class is created by calling the get_asset_tools() function which is a member of the unreal.AssetToolHelpers class.
The import_asset_tasks() function requires a list of unreal.AssetImportTask objects as an argument, each unreal.AssetImportTask object in the supplied list represents the import action of a single asset, and contains properties needed for the import operation.
Asset import properties are set using the set_editor_property() function which is called through the AssetImportTask object.
Available asset import properties are listed here: https://api.unrealengine.com/INT/PythonAPI/class/AssetImportTask.html
In the following example a specified texture file is imported into the project and stored in the Content(Game) > Textures folder.
* If the folder doesn’t exist it will be created.
The following example imports all the JPG files from folder: D:\ into the project, stores the new assets in Content(Game)\Textures folder and saves them:
from os import listdir
from os.path import isfile, join
dir = "D:\\"
files = [f for f in listdir(dir) if isfile(join(dir, f)) and f[-3:]=='jpg']
AssetTools = unreal.AssetToolsHelpers.get_asset_tools()
import_tasks = 
for f in files:
print join(dir, f)
AssetImportTask = unreal.AssetImportTask()
AssetImportTask.set_editor_property('filename', join(dir, f))
* note that when copying and pasting a script from this example, the indentation may not be pasted correctly.