unreal.LandscapeTexturePatch

class unreal.LandscapeTexturePatch(outer: Object | None = None, name: Name | str = 'None')

Bases: LandscapePatchComponent

Landscape Texture Patch

C++ Source:

  • Plugin: LandscapePatch

  • Module: LandscapePatch

  • File: LandscapeTexturePatch.h

Editor Properties: (see get_editor_property/set_editor_property)

  • absolute_location (bool): [Read-Write] If RelativeLocation should be considered relative to the world, rather than the parent

  • absolute_rotation (bool): [Read-Write] If RelativeRotation should be considered relative to the world, rather than the parent

  • absolute_scale (bool): [Read-Write] If RelativeScale3D should be considered relative to the world, rather than the parent

  • apply_component_z_scale (bool): [Read-Write] Whether to apply the patch Z scale to the height stored in the patch.

  • asset_user_data (Array[AssetUserData]): [Read-Write] Array of user data stored with the component

  • asset_user_data_editor_only (Array[AssetUserData]): [Read-Write] Array of user data stored with the component

  • auto_activate (bool): [Read-Write] Whether the component is activated at creation or must be explicitly activated.

  • base_resolution_off_landscape (bool): [Read-Write] When initializing from landscape, set resolution based off of the landscape (and a multiplier).

  • blend_mode (LandscapeTexturePatchBlendMode): [Read-Write] Determines how the patch is combined with the previous state of the landscape.

  • can_ever_affect_navigation (bool): [Read-Write] Whether this component can potentially influence navigation

  • component_tags (Array[Name]): [Read-Write] Array of tags that can be used for grouping and categorizing. Can also be accessed from scripting.

  • detail_mode (DetailMode): [Read-Write] Set the required detail level of this component. It will be deleted or made invisible if the world’s detail level is higher, based on platform and scalability settings. For example, a detail mode of High may prevent this component from loading on mobile platforms.

  • detail_panel_height_source_mode (LandscapeTexturePatchSourceMode): [Read-Write] How the heightmap of the patch is stored.

  • detail_panel_layer_guid (str): [Read-Only]

  • detail_panel_layer_name (str): [Read-Write] Name of the edit layer to which the patch is bound. Options are determined by the set Landscape pointer.

  • editable_when_inherited (bool): [Read-Write] True if this component can be modified when it was inherited from a parent actor class

  • falloff (float): [Read-Write] Distance (in unscaled world coordinates) across which to smoothly fall off the patch effects.

  • falloff_mode (LandscapeTexturePatchFalloffMode): [Read-Write]

  • height_encoding (LandscapeTextureHeightPatchEncoding): [Read-Write] How the values stored in the patch represent the height. Not customizable for Internal Texture source mode, which always uses native packed height.

  • height_encoding_settings (LandscapeTexturePatchEncodingSettings): [Read-Write] Encoding settings. Not relevant when using native packed height as the encoding.

  • height_internal_data (LandscapeHeightTextureBackedRenderTarget): [Read-Only] Not directly settable via detail panel- for display/debugging purposes only.

  • height_render_target_format (TextureRenderTargetFormat): [Read-Write]

  • height_source_mode (LandscapeTexturePatchSourceMode): [Read-Write] How the heightmap of the patch is stored. This is the property that is actually used, and it will agree with DetailPanelHeightSourceMode at all times except when user is changing the latter via the detail panel.

  • height_texture_asset (Texture): [Read-Write] Texture used when source mode is set to a texture asset.

  • hidden_in_game (bool): [Read-Write] Whether to hide the primitive in game, if the primitive is Visible.

  • init_texture_size_x (int32): [Read-Write] Texture width to use when reinitializing using Reinitialize Weights or ReinitializeHeight, if not basing resolution off landscape.

  • init_texture_size_y (int32): [Read-Write] Texture height to use when reinitializing using Reinitialize Weights or ReinitializeHeight, if not basing resolution off landscape.

  • is_editor_only (bool): [Read-Write] If true, the component will be excluded from non-editor builds

  • is_enabled (bool): [Read-Write] When false, patch does not affect the landscape. Useful for temporarily disabling the patch.

  • landscape (Landscape): [Read-Write]

  • mobility (ComponentMobility): [Read-Write] How often this component is allowed to move, used to make various optimizations. Only safe to set in constructor.

  • on_component_activated (ActorComponentActivatedSignature): [Read-Write] Called when the component has been activated, with parameter indicating if it was from a reset

  • on_component_deactivated (ActorComponentDeactivateSignature): [Read-Write] Called when the component has been deactivated

  • physics_volume_changed_delegate (PhysicsVolumeChanged): [Read-Write] Delegate that will be called when PhysicsVolume has been changed *

  • primary_component_tick (ActorComponentTickFunction): [Read-Write] Main tick function for the Component

  • priority (double): [Read-Write] Value that determines the patch ordering relative to other patches.

  • priority_initialization (LandscapePatchPriorityInitialization): [Read-Write] How to initialize the patch priority when a patch is first created.

  • relative_location (Vector): [Read-Write] Location of the component relative to its parent

  • relative_rotation (Rotator): [Read-Write] Rotation of the component relative to its parent

  • relative_scale3d (Vector): [Read-Write] Non-uniform scaling of the component relative to its parent. Note that scaling is always applied in local space (no shearing etc)

  • replicate_using_registered_sub_object_list (bool): [Read-Write] When true the replication system will only replicate the registered subobjects list When false the replication system will instead call the virtual ReplicateSubObjects() function where the subobjects need to be manually replicated.

  • replicates (bool): [Read-Write] Is this component currently replicating? Should the network code consider it for replication? Owning Actor must be replicating first!

  • resolution_multiplier (float): [Read-Write] Multiplier to apply to landscape resolution when initializing patch resolution. A value greater than 1.0 will use higher resolution than the landscape (perhaps useful for slightly more accurate results while not aligned to landscape), and a value less that 1.0 will use lower.

  • resolution_x (int32): [Read-Write]

  • resolution_y (int32): [Read-Write]

  • should_update_physics_volume (bool): [Read-Write] Whether or not the cached PhysicsVolume this component overlaps should be updated when the component is moved. see: GetPhysicsVolume()

  • unscaled_patch_coverage (Vector2D): [Read-Write] At scale 1.0, the X and Y of the region affected by the height patch. This corresponds to the distance from the center

    of the first pixel to the center of the last pixel in the patch texture in the X and Y directions.

  • use_attach_parent_bound (bool): [Read-Write] If true, this component uses its parents bounds when attached. This can be a significant optimization with many components attached together.

  • use_texture_alpha_for_height (bool): [Read-Write] When true, texture alpha channel will be used when applying the patch. Note that the source data needs to have an alpha channel for this to have an effect.

  • visible (bool): [Read-Write] Whether to completely draw the primitive; if false, the primitive is not drawn, does not cast a shadow.

  • weight_patches (Array[LandscapeWeightPatchTextureInfo]): [Read-Write] Weight patches. Note that manipulating these in the blueprint editor will not reliably update instances that are already placed into the world, due to current limitations in how change detection is done for such arrays. Specifically, existing instances that are actually not customized are very likely to be erroneously be treated as having customized their version of the array, causing the blueprint changes to not be pushed to those instances when they otherwise would be for most other properties.

  • zero_height_meaning (LandscapeTextureHeightPatchZeroHeightMeaning): [Read-Write] How 0 height is interpreted.

add_weight_patch(weightmap_layer_name, source_mode, use_alpha_channel) None

By default, the layer is added with source mode set to be a texture-backed render target.

Parameters:
clear_weight_patch_blend_mode_override(weightmap_layer_name) None

Clear Weight Patch Blend Mode Override

Parameters:

weightmap_layer_name (Name)

disable_all_weight_patches() None

Sets the source mode of all weight patches to “None”.

get_all_weight_patch_layer_names() Array[Name]

Get All Weight Patch Layer Names

Return type:

Array[Name]

get_blend_mode() LandscapeTexturePatchBlendMode

Get Blend Mode

Return type:

LandscapeTexturePatchBlendMode

get_falloff() float

Get Falloff

Return type:

float

get_falloff_mode() LandscapeTexturePatchFalloffMode

Get Falloff Mode

Return type:

LandscapeTexturePatchFalloffMode

get_full_unscaled_world_size() Vector2D

When using an internal texture, gives size in unscaled world coordinates of the patch in the world, based off of UnscaledCoverage and texture resolution (i.e., adds a half-pixel around UnscaledCoverage). Does not reflect the resolution of any used texture assets (if the source mode is texture asset for the height/weight patches).

Return type:

Vector2D

get_height_render_target(mark_dirty=True) TextureRenderTarget2D

Gets the internal height render target, if source mode is set to Texture Backed Render Target.

Things that should be set up if using the internal render target: - SetHeightSourceMode should have been called with TextureBackedRenderTarget. - An appropriate texture size should have been set with SetResolution. If the patch extent has already

been set, you can base your resolution on the extent and the resolution of the landscape by using GetInitResolutionFromLandscape().

  • SetHeightRenderTargetFormat should have been called with a desired format. In particular, if using

an alpha channel, the format should have an alpha channel (and SetUseAlphaChannelForHeight should have been called with “true”).

In addition, you may need to call SetHeightEncodingMode, SetHeightEncodingSettings, and SetZeroHeightMeaning based on how you want the data you write to be interpreted. This part is not specific to using an internal render target, since you are likely to need to do that with a TextureAsset source mode as well.

Parameters:

mark_dirty (bool) – If true, marks the containing package as dirty, since the render target is presumably being written to. Can be set to false if the render target is not being written to.

Return type:

TextureRenderTarget2D

get_height_source_mode() LandscapeTexturePatchSourceMode

Height related functions:

Return type:

LandscapeTexturePatchSourceMode

get_init_resolution_from_landscape(resolution_multiplier=1.000000) Vector2D or None

Given the landscape resolution, current patch coverage, and a landscape resolution multiplier, gives the needed resolution of the landscape patch. I.e., figures out the number of pixels in the landcape that would be in a region of such size, and then uses the resolution multiplier to give a result.

Parameters:

resolution_multiplier (float)

Returns:

true if successful (may fail if landscape is not set, for instance)

resolution_out (Vector2D):

Return type:

Vector2D or None

get_patch_to_world_transform() Transform

Gets the transform from patch to world. The transform is based off of the component transform, but with rotation changed to align to the landscape, only using the yaw to rotate it relative to the landscape.

Return type:

Transform

get_resolution() Vector2D

Gets the size (in pixels) of the internal textures used by the patch. Does not reflect the resolution of any used texture assets (if the source mode is texture asset).

Return type:

Vector2D

get_unscaled_coverage() Vector2D

Gives size in unscaled world coordinates (ie before applying patch transform) of the patch as measured between the centers of the outermost pixels. This is the range across which bilinear interpolation always has correct values, so the area outside this center portion in the texture does not affect the landscape.

Return type:

Vector2D

get_weight_patch_render_target(weightmap_layer_name, mark_dirty=True) TextureRenderTarget2D
Parameters:
  • weightmap_layer_name (Name)

  • mark_dirty (bool) – If true, marks the containing package as dirty, since the render target is presumably being written to. Can be set to false if the render target is not being written to.

Return type:

TextureRenderTarget2D

get_weight_patch_source_mode(weightmap_layer_name) LandscapeTexturePatchSourceMode

Get Weight Patch Source Mode

Parameters:

weightmap_layer_name (Name)

Return type:

LandscapeTexturePatchSourceMode

get_weight_patch_texture_asset(weightmap_layer_name) Texture

Get Weight Patch Texture Asset

Parameters:

weightmap_layer_name (Name)

Return type:

Texture

property height_encoding_settings: LandscapeTexturePatchEncodingSettings

[Read-Only] Encoding settings. Not relevant when using native packed height as the encoding.

Type:

(LandscapeTexturePatchEncodingSettings)

property height_texture_asset: Texture

[Read-Only] Texture used when source mode is set to a texture asset.

Type:

(Texture)

remove_all_weight_patches() None

Remove All Weight Patches

remove_weight_patch(weightmap_layer_name) None

Remove Weight Patch

Parameters:

weightmap_layer_name (Name)

reset_height_encoding_mode(encoding_mode) None

Just like SetSourceEncodingMode, but resets ZeroInEncoding, WorldSpaceEncodingScale, and height render target format to mode-specific defaults.

Parameters:

encoding_mode (LandscapeTextureHeightPatchEncoding)

set_blend_mode(blend_mode_in) None

Determines how the height patch is blended into the existing terrain.

Parameters:

blend_mode_in (LandscapeTexturePatchBlendMode)

set_edit_visibility_layer(weightmap_layer_name, edit_visibility_layer) None

Set Edit Visibility Layer

Parameters:
  • weightmap_layer_name (Name)

  • edit_visibility_layer (bool)

set_falloff(falloff_in) None

Set Falloff

Parameters:

falloff_in (float)

set_falloff_mode(falloff_mode_in) None

Set Falloff Mode

Parameters:

falloff_mode_in (LandscapeTexturePatchFalloffMode)

set_height_encoding_mode(encoding_mode) None

Set the height encoding mode for the patch, which determines how stored values in the patch are translated into heights when applying to landscape.

Parameters:

encoding_mode (LandscapeTextureHeightPatchEncoding)

set_height_encoding_settings(settings) None

Set settings that determine how values in the patch are translated into heights. This is only used if the encoding mode is not NativePackedHeight, where values are expected to be already in the same space as the landscape heightmap.

Parameters:

settings (LandscapeTexturePatchEncodingSettings)

set_height_render_target_format(format) None

Set Height Render Target Format

Parameters:

format (TextureRenderTargetFormat)

set_height_source_mode(new_mode) None

Changes source mode. There are currently no API guarantees regarding the initialization of the new source data. E.g. when first switching to use an internal render target, the data in that render target may not be initialized.

Parameters:

new_mode (LandscapeTexturePatchSourceMode)

set_height_texture_asset(texture_in) None

Sets the texture used for height when the height source mode is set to texture asset. Note that virtual textures are not supported.

Parameters:

texture_in (Texture)

set_resolution(resolution_in) None

Sets the resolution of the currently used internal texture or render target. Has no effect if the source mode is set to an external texture asset.

Parameters:

resolution_in (Vector2D)

set_unscaled_coverage(coverage) None

Set the patch coverage (see GetUnscaledCoverage for description).

Parameters:

coverage (Vector2D)

set_use_alpha_channel_for_height(use) None

Determines whether the height patch alpha channel is used for blending into the existing values. Note that the source data needs to have an alpha channel in this case. How the alpha channel is used depends on the patch blend mode (see SetBlendMode).

Parameters:

use (bool)

set_use_alpha_channel_for_weight_patch(weightmap_layer_name, use_alpha_channel) None

Set Use Alpha Channel for Weight Patch

Parameters:
  • weightmap_layer_name (Name)

  • use_alpha_channel (bool)

set_weight_patch_blend_mode_override(weightmap_layer_name, blend_mode) None

Set Weight Patch Blend Mode Override

Parameters:
set_weight_patch_source_mode(weightmap_layer_name, new_mode) None

Set Weight Patch Source Mode

Parameters:
set_weight_patch_texture_asset(weightmap_layer_name, texture_in) None

Set Weight Patch Texture Asset

Parameters:
set_zero_height_meaning(zero_height_meaning_in) None

Set how zero height is interpreted, see comments in ELandscapeTextureHeightPatchZeroHeightMeaning.

Parameters:

zero_height_meaning_in (LandscapeTextureHeightPatchZeroHeightMeaning)

snap_to_landscape() None

Adjusts patch rotation to be aligned to a 90 degree increment relative to the landscape, adjusts UnscaledPatchCoverage such that it becomes a multiple of landscape quad size, and adjusts patch location so that the boundaries of the covered area lie on the nearest landscape vertices. Note that this doesn’t adjust the resolution of the texture that the patch uses, so landscape vertices within the inside of the patch may still not always align with texture patch pixel centers (if the resolutions aren’t multiples of each other).