diff --git a/README.md b/README.md index 286679e..d15f140 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ RPG GPT. Short experience # Important Building Steps and Contribution Notes Every time you checkin/clone the project, you have to unzip art.blend... If this is annoying to you, make a git hook +When editing Exporter.py in either the blender editor, or in a text editor in the repo, you have to continually make sure blender's internal version of the script doesn't go out of date with the actual script on disk, by either saving consistently from blender to disk if you're editing from blender, or by reloading from disk in the blend file before each commit. + Be very cautious about committing a change to any large asset files, i.e the art.blend and png files. Every time you do so, even if you change one little thing like moving the player somewhere, you copy the entire file in git lfs, ballooning the storage usage of the git project on the remote. So just try to minimize edits to those big files. You must clone with git lfs is, and download git lfs files in this repository. If you don't know what that is, google it diff --git a/art/Exporter.py b/art/Exporter.py index 5a9735a..30399cf 100644 --- a/art/Exporter.py +++ b/art/Exporter.py @@ -109,7 +109,7 @@ def ensure_tex_saved_and_get_name(o) -> str: if img_obj.packed_file: img_obj.save(filepath=bpy.path.abspath(save_to)) else: - assert img_obj.filepath != "", f"{img_obj.filepath} in mesh {mesh_name} Isn't there but should be, as it has no packed image" + assert img_obj.filepath != "", f"filepath '{img_obj.filepath}' in mesh {mesh_name} Isn't there but should be, as it has no packed image" old_path = bpy.path.abspath(img_obj.filepath) if not is_file_in_project(old_path): print(f"Image {image_filename} has filepath {img_obj.filepath}, outside of the current directory. So we're copying it baby. Hoo-rah!") @@ -123,11 +123,12 @@ def ensure_tex_saved_and_get_name(o) -> str: return image_filename -def object_in_level(o): - return o.users_collection[0].name == "Level" or (o.users_collection[0] in D.collections["Level"].children_recursive) -# meshes can either be Meshes, or Armatures. Armatures contain all mesh data to draw it, and any anims it has +def object_in_collection(o, collection): + """Probably only works for root level collections""" + return o.users_collection[0].name == collection or (o.users_collection[0] in D.collections[collection].children_recursive) +# meshes can either be Meshes, or Armatures. Armatures contain all mesh data to draw it, and any anims it has for o in D.objects: if o.hide_get(): continue if o.type == "MESH": @@ -135,7 +136,7 @@ for o in D.objects: mesh_object = o o = o.parent object_transform_info = (mesh_name, mapping @ o.location, o.rotation_euler, o.scale) - if object_in_level(o): + if object_in_collection(o, "Level") or object_in_collection(o, "PlacedEntities"): assert False, "Cannot put armatures in the level. The level is for static placed meshes. For dynamic entities, you put them outside of the level collection, their entity kind is encoded, and the game code decides how to draw them" else: pass @@ -289,20 +290,20 @@ for o in D.objects: object_transform_info = (mesh_name, mapping @ o.location, o.rotation_euler, o.scale) - if object_in_level(o) and mesh_name == "CollisionCube": + if object_in_collection(o, "Level") and mesh_name == "CollisionCube": collision_cubes.append((o.location, o.dimensions)) else: - if object_in_level(o): + if object_in_collection(o, "Level"): print(f"Object {o.name} has mesh name {o.to_mesh().name}") assert(o.rotation_euler.order == 'XYZ') level_object_data.append(object_transform_info) - else: + elif object_in_collection(o, "PlacedEntities"): placed_entities.append((o.name,) + object_transform_info) if mesh_name in saved_meshes: continue saved_meshes.add(mesh_name) - print(f"Mesh name {mesh_name} in level {object_in_level(o)} collections {o.users_collection}") + print(f"""Mesh name {mesh_name} in level {object_in_collection(o, "Level")} collections {o.users_collection}""") image_filename = ensure_tex_saved_and_get_name(o) assert(mesh_name != LEVEL_EXPORT_NAME) diff --git a/art/Shotgun.png b/art/Shotgun.png new file mode 100644 index 0000000..2e7ffeb --- /dev/null +++ b/art/Shotgun.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f502b54b94ed8ea5905bfbb40d19c797b6a49341d585d8811ea84b85e265c057 +size 11561 diff --git a/art/art.zip b/art/art.zip index bf28791..bec9d48 100644 Binary files a/art/art.zip and b/art/art.zip differ