unreal.LandscapeTexturePatch¶
- class unreal.LandscapeTexturePatch(outer: Object | None = None, name: Name | str = 'None')¶
Bases:
LandscapePatchComponentLandscape 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 parentabsolute_rotation(bool): [Read-Write] If RelativeRotation should be considered relative to the world, rather than the parentabsolute_scale(bool): [Read-Write] If RelativeScale3D should be considered relative to the world, rather than the parentapply_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 componentasset_user_data_editor_only(Array[AssetUserData]): [Read-Write] Array of user data stored with the componentauto_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’s heightmap is combined with the previous state of the landscape.can_ever_affect_navigation(bool): [Read-Write] Whether this component can potentially influence navigationcomponent_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 classfalloff(float): [Read-Write] Distance (in unscaled world coordinates) across which to smoothly fall off the patch effects.falloff_mode(LandscapeTexturePatchFalloffMode): [Read-Write]height_alpha_settings(LandscapeTexturePatchAlphaSettings): [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.height_texture_channel(LandscapeTexturePatchTextureChannel): [Read-Write] Texture’s color channel used for the height. The texture’s Red channel is selected by default. The patch will not affect the landscape when no channel is selected. When the height source mode is InternalTexture or HeightEncoding is NativePackedHeight the texture channel cannot be customized (assumes RG channel)height_texture_uv_transform(LandscapeTexturePatchTextureTransform): [Read-Write]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 buildsis_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 reseton_component_deactivated(ActorComponentDeactivateSignature): [Read-Write] Called when the component has been deactivatedphysics_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 Componentpriority(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 parentrelative_rotation(Rotator): [Read-Write] Rotation of the component relative to its parentrelative_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 centerof 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] deprecated: Use HeightAlphaSettings.SetAlphaSourceMode() with ELandscapeTexturePatchAlphaSourceMode instead (use None or SourceTextureChannel for legacy behavior)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.weight_patches_alpha_settings(LandscapeTexturePatchAlphaSettings): [Read-Write] Default weight patches alpha settings. Defines the alpha mask settings for all weight patches within this texture patch. Alpha is only applied to weight patches with a valid source mode. Alpha settings can be overridden by individual weight patches.weight_patches_blend_mode(LandscapeTexturePatchBlendMode): [Read-Write] Determines how the patch’s weightmap layers are combined with the previous state of the landscape. Blend mode can be overriden by individual weight patcheszero_height_meaning(LandscapeTextureHeightPatchZeroHeightMeaning): [Read-Write] How 0 height is interpreted.
- clear_weight_patch_blend_mode_override(weightmap_layer_name) None¶
Clear Weight Patch Blend Mode Override
- Parameters:
weightmap_layer_name (Name)
- create_weight_patch(weightmap_layer_name, source_mode, alpha_source_mode) None¶
By default, the layer is added with source mode set to be a texture-backed render target.
- Parameters:
weightmap_layer_name (Name)
source_mode (LandscapeTexturePatchSourceMode)
alpha_source_mode (LandscapeTexturePatchAlphaSourceMode)
- get_blend_mode() LandscapeTexturePatchBlendMode¶
Get Blend Mode
- Return type:
- get_falloff_mode() LandscapeTexturePatchFalloffMode¶
Get Falloff Mode
- Return type:
- 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:
- get_height_alpha_render_target(mark_dirty=True) TextureRenderTarget2D¶
Gets the internal height alpha render target, if the height alpha source mode is set to Texture Backed Render Target
Things that should be set up if using the internal render target: - 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()
The alpha uses RenderTargetFormat RTF_R8 by default. The AlphaTextureChannel property defines the single color channel storing the Alpha data
- 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:
- get_height_alpha_source_mode() LandscapeTexturePatchAlphaSourceMode¶
Get Height Alpha Source Mode
- Return type:
- get_height_alpha_source_texture_channel() LandscapeTexturePatchTextureChannel¶
Get Height Alpha Source Texture Channel
- Return type:
- get_height_alpha_texture_transform() LandscapeTexturePatchTextureTransform¶
Get Height Alpha Texture Transform
- Return type:
- 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:
- get_height_source_mode() LandscapeTexturePatchSourceMode¶
Height related functions:
- Return type:
- get_height_texture_channel() LandscapeTexturePatchTextureChannel¶
Get Height Texture Channel
- Return type:
- get_height_texture_transform() LandscapeTexturePatchTextureTransform¶
Get Height Texture Transform
- Return type:
- 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.
- 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:
- 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:
- 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:
- get_weight_patch_alpha_render_target(weightmap_layer_name, mark_dirty=True) TextureRenderTarget2D¶
Gets the internal weight patch alpha render target, if the weight patch alpha source mode is set to Texture Backed Render Target Returns a reference to the default (shared) weightmap alpha render target unless the given weightmap patch overrides the default alpha settings
The alpha uses RenderTargetFormat RTF_R8 by default. The AlphaTextureChannel property defines the single color channel storing the Alpha data
- Parameters:
- Return type:
- get_weight_patch_alpha_source_mode(weightmap_layer_name) LandscapeTexturePatchAlphaSourceMode¶
Get Weight Patch Alpha Source Mode
- Parameters:
weightmap_layer_name (Name)
- Return type:
- get_weight_patch_alpha_texture_asset(weightmap_layer_name) Texture¶
Get Weight Patch Alpha Texture Asset
- get_weight_patch_alpha_texture_channel(weightmap_layer_name) LandscapeTexturePatchTextureChannel¶
Get Weight Patch Alpha Texture Channel
- Parameters:
weightmap_layer_name (Name)
- Return type:
- get_weight_patch_alpha_texture_transform(weightmap_layer_name) LandscapeTexturePatchTextureTransform¶
Get Weight Patch Alpha Texture Transform
- Parameters:
weightmap_layer_name (Name)
- Return type:
- get_weight_patch_render_target(weightmap_layer_name, mark_dirty=True) TextureRenderTarget2D¶
- Parameters:
- Return type:
- get_weight_patch_source_mode(weightmap_layer_name) LandscapeTexturePatchSourceMode¶
Get Weight Patch Source Mode
- Parameters:
weightmap_layer_name (Name)
- Return type:
- get_weight_patch_texture_channel(weightmap_layer_name) LandscapeTexturePatchTextureChannel¶
Get Weight Patch Texture Channel
- Parameters:
weightmap_layer_name (Name)
- Return type:
- get_weight_patch_texture_transform(weightmap_layer_name) LandscapeTexturePatchTextureTransform¶
Get Weight Patch Texture Transform
- Parameters:
weightmap_layer_name (Name)
- Return type:
- property height_encoding_settings: LandscapeTexturePatchEncodingSettings¶
[Read-Only] Encoding settings. Not relevant when using native packed height as the encoding.
- property height_texture_asset: Texture¶
[Read-Only] Texture used when source mode is set to a texture asset.
- Type:
(Texture)
- 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
- set_falloff_mode(falloff_mode_in) None¶
Set Falloff Mode
- Parameters:
falloff_mode_in (LandscapeTexturePatchFalloffMode)
- set_height_alpha_source_mode(new_mode, always_mark_dirty=True) None¶
Changes the source mode of the height patch alpha data. There are currently no API guarantees regarding the initialization of the new alpha 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 (LandscapeTexturePatchAlphaSourceMode)
always_mark_dirty (bool)
- set_height_alpha_texture_channel(texture_channel, always_mark_dirty=True) None¶
Sets the height alpha texture patch color channel
- Parameters:
texture_channel (LandscapeTexturePatchTextureChannel) – the color channel of the texture to use for the height alpha
always_mark_dirty (bool) – mark the package dirty when channel property changes
- set_height_alpha_texture_transform(texture_transform, always_mark_dirty=True) None¶
Sets the height alpha texture’s UV transform. Transform is applied relative UVSpace unless struct property bInWorldSpaceScale is true
- Parameters:
texture_transform (LandscapeTexturePatchTextureTransform) – the height alpha texture’s transform
always_mark_dirty (bool) – mark the package dirty when alpha transform changes
- 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_height_texture_channel(texture_channel, always_mark_dirty=True) None¶
Sets the height texture’s color channel. Texture channel is restricted when HeightSource is InternalData or HeightEncoding is NativePackedHeight (Assumes RG channels)
- Parameters:
texture_channel (LandscapeTexturePatchTextureChannel) – the color channel of the texture to use
always_mark_dirty (bool) – mark the package dirty when channel property changes
- set_height_texture_transform(texture_transform, always_mark_dirty=True) None¶
Sets the height texture’s UV transform. Transform is applied relative UVSpace unless struct property bInWorldSpaceScale is true
- Parameters:
texture_transform (LandscapeTexturePatchTextureTransform) – the height texture’s transform
always_mark_dirty (bool) – mark the package dirty when transform changes
- 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_weight_patch_alpha_source_mode(weightmap_layer_name, source_mode, override_alpha=True, always_mark_dirty=True) None¶
Sets the default weight patch alpha source mode for all weight patches or overrides the source for a specific weight patch
- Parameters:
weightmap_layer_name (Name) – weightmap layer name to set the alpha mode. Overrides a specific layer or sets default source mode when name is None
source_mode (LandscapeTexturePatchAlphaSourceMode) – the alpha source mode
override_alpha (bool) – sets the weightmap layer’s override flag. When false, the weightmap layer will fallback to the default source mode
always_mark_dirty (bool) – mark the package dirty when property changes
- set_weight_patch_alpha_texture_asset(weightmap_layer_name, texture, override_alpha=True, always_mark_dirty=True) None¶
Sets the default weight patch alpha texture asset for all weight patches or overrides the texture for a specific weight patch
- Parameters:
weightmap_layer_name (Name) – weightmap layer name to set the alpha texture. Overrides a specific layer or sets the default texture when name is None
texture (Texture) – the alpha texture the weightmap will use
override_alpha (bool) – sets the weightmap layer’s override flag. When false, the weightmap layer will fallback to the default alpha texture
always_mark_dirty (bool) – mark the package dirty when property changes
- set_weight_patch_alpha_texture_channel(weightmap_layer_name, texture_channel, override_alpha=True, always_mark_dirty=True) None¶
Sets the texture patch color channel for all weight patches or set the texture channel for a specific weight patch alpha override
- Parameters:
weightmap_layer_name (Name) – weightmap layer name to set the alpha texture channel. Overrides a specific layer or sets to the default texture channel when name is None
texture_channel (LandscapeTexturePatchTextureChannel) – the channel of the texture the alpha mask will use
override_alpha (bool) – sets the weightmap layer’s override flag. When false, the weightmap layer will fallback to the default alpha channel
always_mark_dirty (bool) – mark the package dirty when property changes
- set_weight_patch_alpha_texture_transform(weightmap_layer_name, texture_transform, always_mark_dirty=True) None¶
Sets the weight texture’s alpha UV transform. Transform is applied relative UVSpace unless struct property bInWorldSpaceScale is true
- Parameters:
weightmap_layer_name (Name) – weightmap layer name to set the texture transform
texture_transform (LandscapeTexturePatchTextureTransform) – the weight alpha texture’s transform
always_mark_dirty (bool) – mark the package dirty when alpha transform changes
- set_weight_patch_blend_mode_override(weightmap_layer_name, blend_mode) None¶
Set Weight Patch Blend Mode Override
- Parameters:
weightmap_layer_name (Name)
blend_mode (LandscapeTexturePatchBlendMode)
- set_weight_patch_source_mode(weightmap_layer_name, new_mode) None¶
Set Weight Patch Source Mode
- Parameters:
weightmap_layer_name (Name)
new_mode (LandscapeTexturePatchSourceMode)
- set_weight_patch_texture_asset(weightmap_layer_name, texture_in) None¶
Set Weight Patch Texture Asset
- set_weight_patch_texture_channel(weightmap_layer_name, texture_channel, always_mark_dirty=True) None¶
Sets the texture patch color channel specific weight patch
- Parameters:
weightmap_layer_name (Name) – weightmap layer name to set the texture channel
texture_channel (LandscapeTexturePatchTextureChannel) – the channel of the texture the weight patch will use
always_mark_dirty (bool) – mark the package dirty when property changes
- set_weight_patch_texture_transform(weightmap_layer_name, texture_transform, always_mark_dirty=True) None¶
Sets the weight texture’s UV transform. Transform is applied relative UVSpace unless struct property bInWorldSpaceScale is true
- Parameters:
weightmap_layer_name (Name) – weightmap layer name to set the texture transform
texture_transform (LandscapeTexturePatchTextureTransform) – the weight texture’s transform
always_mark_dirty (bool) – mark the package dirty when transform changes
- 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).