Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support necessary export settings to import dynamic heads #38

Merged
merged 3 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,30 @@ class RbxAddonPreferences(AddonPreferences):
soft_max=10.0,
default=1.0, # default: min slope: 0.005, max frame step: 10.
)
add_leaf_bones: BoolProperty(
name="Add Leaf Bones",
description="Append a final bone to the end of each chain to specify last bone length (use this when you intend to edit the armature from exported data)",
default=True,
)
use_custom_props: BoolProperty(
name="Custom Properties",
description="Export Custom Properties",
default=True,
)

def draw(self, context):
self.layout.prop(self, "export_scale")
self.layout.label(text="Include")
include_box = self.layout.box()
include_box.prop(self, "use_custom_props")

self.layout.label(text="Transform")
transform_box = self.layout.box()
transform_box.prop(self, "export_scale")

self.layout.label(text="Armature")
armature_box = self.layout.box()
armature_box.prop(self, "add_leaf_bones")

self.layout.prop(self, "bake_anim", text="Bake Animation")
bake_anim_box = self.layout.box()
bake_anim_box.use_property_split = True
Expand Down
2 changes: 2 additions & 0 deletions lib/export_fbx.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ def export_fbx(scene, view_layer, target_object, exported_file_path, preferences
path_mode="COPY",
embed_textures=True,
use_active_collection=True,
add_leaf_bones=preferences.add_leaf_bones,
use_custom_props=preferences.use_custom_props,
)
finally:
# Return to the previous active LayerCollection
Expand Down
28 changes: 16 additions & 12 deletions lib/get_selected_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,21 @@ def get_selected_objects(context):
if area == current_area:
continue
if area.type == "OUTLINER" or area.type == "VIEW_3D":
# Temporary context override requires Blender version >= 3.2.0
with context.temp_override(area=area):
for selected_object in context.selected_ids:
# Avoid double-counting objects that are selected in multiple outliners
if selected_object in objects:
continue

# Avoid counting objects that can't be uploaded (Open Cloud servers require a mesh inside the asset)
if not (__is_uploadable_object(selected_object) or __contains_uploadable_object(selected_object)):
continue

objects.append(selected_object)
for region in area.regions:
if region.type == "WINDOW":
# Temporary context override requires Blender version >= 3.2.0
with context.temp_override(area=area, region=region):
for selected_object in context.selected_ids:
# Avoid double-counting objects that are selected in multiple outliners
if selected_object in objects:
continue

# Avoid counting objects that can't be uploaded (Open Cloud servers require a mesh inside the asset)
if not (
__is_uploadable_object(selected_object) or __contains_uploadable_object(selected_object)
):
continue

objects.append(selected_object)

return objects
Loading