From 17fd2304270b2ef619cceb980b9f49cb656a6d13 Mon Sep 17 00:00:00 2001 From: Isaac Date: Wed, 14 Aug 2024 22:48:16 -0400 Subject: updated Collada importer/exporter for SuperBMD --- blenxy_settings_stuff.py | 106 ----------------------------------------------- 1 file changed, 106 deletions(-) delete mode 100644 blenxy_settings_stuff.py (limited to 'blenxy_settings_stuff.py') diff --git a/blenxy_settings_stuff.py b/blenxy_settings_stuff.py deleted file mode 100644 index 9636522..0000000 --- a/blenxy_settings_stuff.py +++ /dev/null @@ -1,106 +0,0 @@ -import bpy - -# SMG1/2 was made with Autodesk Maya -# and Maya uses centimeters as default unit -# so supposedly SMG1/2 original units are in centimeters - -# however... - -# SuperBMD assumes everything is in meters so -# using the Mario.dae obtained from the Mario.bdl file -# in the template I will set 1 Galaxy Unit as 100 Meters -# this can be easily modified in the future in case -# I get how this unit thing works fully -# might open an issue on the SuperBMD repo to ask about it - -scene = bpy.context.scene - -print("Setting Galaxy Unit...") - -scene.unit_settings.scale_length = 100 -scene.unit_settings.system = 'METRIC' -bpy.ops.scene.units_length_preset_add(name="Galaxy Unit") -scene.unit_settings.system_rotation = 'DEGREES' -scene.unit_settings.use_separate = False - - -# scale grid to fit new length unit -# Reference used: -# https://blender.stackexchange.com/a/210749 - -print("\nScaling 3D View grid...") - -for area in bpy.context.screen.areas: - if (area.type == 'VIEW_3D'): - view_3d_area = area.spaces.active # declare to use later - area.spaces.active.grid_scale = 100 - area.spaces.active.grid_lines = 300 - area.spaces.active.show_axis_x = False - area.spaces.active.show_axis_y = False - area.spaces.active.show_axis_z = False - area.spaces.active.clip_start = 0.1 - area.spaces.active.clip_end = 10000 - break - - -# import Mario's model from DAE file included in the template -# get blenxy template location for that and select it -# but first delete all objects in scene so it is clean - -bpy.ops.object.select_all(action='SELECT') -bpy.ops.object.delete() - -print("\nImporting Mario's Model...") - -blenxy_path = bpy.utils.user_resource('SCRIPTS', "startup/bl_app_templates_user/blenxy/") -bpy.ops.wm.collada_import(filepath = blenxy_path + "Mario.dae") -Mario = bpy.data.objects.get("Mario") -Mario.select = True - - -# set a SMG axis for reference when doing models -# it is just a visual queue to get how the model will appear on game -# select a model --> create transform orientation --> modify its matrix - -# References used: -# https://blenderartists.org/t/how-to-set-transform-orientation-in-code/542536/4 -# for context incorrect bypass: -# https://blender.stackexchange.com/a/6105 - -print("\nSetting SMG Axis Reference...") - -Mario.select = True -override = bpy.context.copy() -override['area'] = area -bpy.ops.transform.create_orientation(override, name = "SMG Axis", use = True) -bpy.context.scene.orientations[-1].matrix = [ [1.0, 0.0, 0.0], [0.0, 0.0, 1.0], [0.0, -1.0, 0.0] ] - - -# set initial 3d viewport camera location -# just a rotation and a camera view distance change - -print("\nAdjusting 3D Viewport camera location...") - -# set rotation (quaternions) -view_3d_area.region_3d.view_rotation = (0.8001, 0.4619, 0.1913, 0.3314) -# set camera distance to origin -view_3d_area.region_3d.view_distance = 4 - - -# extra stuff to set >:] - -print("\nExtra stuff to set...") - -# set environment lightnning (material display suggestion) -bpy.context.scene.world.light_settings.use_environment_light = True - -# set framerate (SMG runs at 59.94 fps in THP videos) -# BTP animations do run (or at least ideally run) at an aproximate of 60fps -bpy.context.scene.render.fps = 60 -bpy.context.scene.render.fps_base = 1.001 - -# set start frame at 0 -bpy.data.scenes["Scene"].frame_start = 0 -bpy.data.scenes["Scene"].frame_current = 0 - -print("\nDone with the main settings!\n") -- cgit v1.2.3-70-g09d2