diff --git a/docs/Slate_API.md b/docs/Slate_API.md index 0008d2b53..ad276b647 100644 --- a/docs/Slate_API.md +++ b/docs/Slate_API.md @@ -824,6 +824,31 @@ Check this example: https://github.com/20tab/UnrealEnginePython/blob/master/exam It shows even how to register new style sets. +## SPythonComboBox + +```python +from unreal_engine import SWindow, STextBlock, SPythonComboBox + +def generate_combo_box_widget(item): + return STextBlock(text=item) + +def get_current_item(): + return combo_box.get_selected_item() + +def on_selection_changed(item, index): + print ('New selection: %s, %s' % (item, index)) + +items = ['spam', 'ham', 'eggs'] +combo_box = SPythonComboBox(options_source=items, on_generate_widget=generate_combo_box_widget, content=STextBlock(text=get_current_item), on_selection_changed=on_selection_changed) +combo_box.set_selected_item(items[0]) + +SWindow(client_size=(300,30))( + combo_box +) +``` + +![SDetailView](screenshots/slate_SPythonComboBox.png) + ## SPythonListView ## SPythonTreeView diff --git a/docs/screenshots/slate_SPythonComboBox.png b/docs/screenshots/slate_SPythonComboBox.png new file mode 100644 index 000000000..70c1e2b80 Binary files /dev/null and b/docs/screenshots/slate_SPythonComboBox.png differ diff --git a/tutorials/SnippetsForStaticAndSkeletalMeshes.md b/tutorials/SnippetsForStaticAndSkeletalMeshes.md index d2d98f172..104c1ef93 100644 --- a/tutorials/SnippetsForStaticAndSkeletalMeshes.md +++ b/tutorials/SnippetsForStaticAndSkeletalMeshes.md @@ -97,7 +97,7 @@ def fix_pivot(static_mesh): raw_mesh.set_vertex_positions(updated_positions) # assign the mesh data to the first LOD (LODs are exposed in SourceModels array) - raw_mesh.save_to_static_mesh_source_model(new_static_mesh.SourceModels[0]) + raw_mesh.save_to_static_mesh_source_model(new_static_mesh.SourceModels[0].clone()) # rebuild the whole mesh new_static_mesh.static_mesh_build() # re-do the body setup (collisions and friends) @@ -171,7 +171,7 @@ def add_lods(static_mesh): raw_mesh.save_to_static_mesh_source_model(lod2) # assign the new LODs (leaving the first one untouched) - new_static_mesh.SourceModels = [new_static_mesh.SourceModels[0], lod1, lod2] + new_static_mesh.SourceModels = [new_static_mesh.SourceModels[0].clone(), lod1, lod2] # rebuild the whole mesh new_static_mesh.static_mesh_build() # re-do the body setup (collisions and friends)