|
| 1 | +import unreal |
| 2 | +import sys |
| 3 | + |
| 4 | +asset_path = sys.argv[1] |
| 5 | +asset_property = sys.argv[2] |
| 6 | +asset_value = sys.argv[3] |
| 7 | +is_texture = sys.argv[4] |
| 8 | +in_scene = sys.argv[5] |
| 9 | +asset_class = sys.argv[6] |
| 10 | +method = sys.argv[7] |
| 11 | + |
| 12 | +world = unreal.EditorLevelLibrary.get_editor_world |
| 13 | + |
| 14 | +if is_texture == "1": |
| 15 | + # Load texture |
| 16 | + value = unreal.EditorAssetLibrary.load_asset(asset_value) |
| 17 | +else: |
| 18 | + value = asset_value |
| 19 | + |
| 20 | +if in_scene == "0": |
| 21 | + # print(in_scene) |
| 22 | + # Asset to be loaded from Editor Content |
| 23 | + # from that, get the class default object ( the actual template for the blueprint ) |
| 24 | + blueprint_generated = unreal.EditorAssetLibrary.load_blueprint_class(asset_path) |
| 25 | + my_act = unreal.get_default_object(blueprint_generated) |
| 26 | + |
| 27 | + |
| 28 | +if in_scene == "1": |
| 29 | + lst_actors = unreal.EditorLevelLibrary.get_all_level_actors() |
| 30 | + for act in lst_actors: |
| 31 | + act_label = act.get_actor_label() |
| 32 | + if asset_class in act_label: |
| 33 | + my_act = act |
| 34 | + |
| 35 | + |
| 36 | +if asset_property != "/": |
| 37 | + my_act.set_editor_property(asset_property,value) |
| 38 | + |
| 39 | +if method == "import_tile": |
| 40 | + my_act.import_tile(my_act) |
| 41 | + |
| 42 | +if method == "match_landscape_size": |
| 43 | + my_act.match_landscape_size(my_act) |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + # print('tets') |
| 48 | + # if(len(method) == 0): |
| 49 | + # print(method) |
| 50 | + |
| 51 | + |
| 52 | + |
| 53 | + # Asset to be loaded from Scene |
| 54 | + # print(asset_path) |
| 55 | + # asset = unreal.find_object(None, asset_path) |
| 56 | + # print (type(asset)) |
| 57 | + # blueprint_class_default = unreal.get_default_object(asset) |
| 58 | + # print (type(blueprint_class_default)) |
| 59 | + # print(dir(blueprint_class_default)) |
| 60 | + # blueprint_class_default.set_editor_property('height_map',value) |
| 61 | + |
| 62 | + # m = unreal.find_object("EarthLandscapeClip") |
| 63 | + # m = unreal.load_object(Blueprint, asset_path) |
| 64 | + # act = unreal.load_class(Class, ' + asset_class + ') |
| 65 | + # print(act) |
| 66 | + |
| 67 | + |
| 68 | + |
| 69 | + |
| 70 | +# # set or get properties |
| 71 | +# blueprint_class_default.set_editor_property(asset_property, value) |
| 72 | +# unreal.EditorAssetLibrary.save_asset(asset_path) |
0 commit comments