Amazingly useful course, thanks so much. I really feel like I am learning a valuable skill that has very little resources anywhere on youtube or anything.
I have a question. Unless Python does something BP can’t (which I doubt since the Python API is just a wrapper for the C++ code, as mentioned in the video for module 10). Are there any contexts in which we prefer using python scripts over BP or vise versa? Let’s take the function getStaticMeshData() from module 6 as an example:
def get_SM_data():
static_meshes = get_asset_class('StaticMesh')
for mesh in static_meshes:
lod_group_info = mesh.get_editor_property('lod_group')
print (lod_group_info)
if lod_group_info == 'None':
if mesh.get_num_lods() == 1:
mesh.set_editor_property('lod_group', 'LargeProp')
We can achieve the exact same thing on an Editor Utility Widget here:
In having reconstructed the python code in the Editor Utility Widget, I am able to somewhat answer my own question. The BP code involved much more debugging due to any lack of documentation on how to implement this sort of thing. For example, the BP node GetEditorProperty returns a wildcard and when I initially attempted to Print String I was getting an error because it wanted to return a Name instead of string, so I figured out I had to use the type conversion node. The python code definitely makes editor scripting easier largely thanks to the documentation that makes implementation intuitive. On the other hand the BP code is more easily called from within the editor, makes use of both the event system and UMG so we can design the tools with buttons and text etc.
Hoping to hear from others their thoughts on this.