unreal.WaveFunctionCollapseModel

class unreal.WaveFunctionCollapseModel(outer=None, name='None')

Bases: unreal.DataAsset

A Model of WFC constraints. This data asset should contain all necessary data to allow for a WFC solve of an arbitrary grid size.

C++ Source:

  • Plugin: WaveFunctionCollapse

  • Module: WaveFunctionCollapse

  • File: WaveFunctionCollapseModel.h

Editor Properties: (see get_editor_property/set_editor_property)

  • constraints (Map(WaveFunctionCollapseOption, WaveFunctionCollapseAdjacencyToOptionsMap)): [Read-Write] Constraints

  • spawn_exclusion (Array(SoftObjectPath)): [Read-Write] Spawn Exclusion

  • tile_size (float): [Read-Write] Tile Size: Grid Tile Size in cm^3

add_constraint(key_option, adjacency, adjacent_option) None

Create a constraint

Parameters
build_initial_tile() WaveFunctionCollapseTile

Builds the initial tile which adds every unique option in a model to its RemainingOptions array and calculates its entropy

Return type

WaveFunctionCollapseTile

property constraints

[Read-Write] Constraints

Type

(Map(WaveFunctionCollapseOption, WaveFunctionCollapseAdjacencyToOptionsMap))

get_constraint_count() int32

Get the total count of constraints in this model

Return type

int32

get_option_contribution(option) int32

Get the contribution value of an option

Parameters

option (WaveFunctionCollapseOption) –

Return type

int32

get_option_weight(option) float

Get the weight value of an option

Parameters

option (WaveFunctionCollapseOption) –

Return type

float

get_options(key_option, adjacency) WaveFunctionCollapseOptions

Get all options for a given key option in a given adjacency

Parameters
Return type

WaveFunctionCollapseOptions

set_all_contributions(contribution) None

Set the contribution values of key objects to a given value

Parameters

contribution (int32) –

set_all_weights(weight) None

Set the weights of key objects to a given value

Parameters

weight (float) –

set_option_contribution(option, contribution) None

Set the contribution value of a key object to a given value

Parameters
set_weights_from_contributions() None

Set the weights of key objects based on their contribution values

property spawn_exclusion

[Read-Write] Spawn Exclusion

Type

(Array(SoftObjectPath))

swap_meshes(source_to_target_mesh_map) None

Swap meshes in the model with other meshes based on a map. This is useful when working with template meshes that need to be swapped.

Parameters

source_to_target_mesh_map (Map(StaticMesh, StaticMesh)) –

property tile_size

[Read-Write] Tile Size: Grid Tile Size in cm^3

Type

(float)