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

Using the C++ OBJ importer and Fixing Issues with Importing when using a Non-standard colorspace #373

Closed
Changes from 4 commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
94ffa6e
Began working on Kaion, don't know if I'll continue on this
StandingPadAnimations Jan 21, 2023
30def43
Added first implementation of SimplePrep
StandingPadAnimations Jan 27, 2023
8dab314
Merge pull request #3 from StandingPadAnimations/dev
StandingPadAnimations Jan 27, 2023
54c80e5
Merge pull request #2 from StandingPadAnimations/simple-prep
StandingPadAnimations Jan 27, 2023
b404ecc
Added Kaion changes in bl_info
StandingPadAnimations Jan 27, 2023
e1582bc
Changed readme
StandingPadAnimations Jan 27, 2023
9d7466e
Added a script to create a release binary
StandingPadAnimations Jan 27, 2023
1b08e9f
updated gitignore
StandingPadAnimations Jan 27, 2023
c924327
Updated create_release
StandingPadAnimations Jan 27, 2023
f5f77f0
updated create_release
StandingPadAnimations Jan 27, 2023
004ba14
updated the addon_updater code
StandingPadAnimations Jan 27, 2023
1971f67
removed prep_scripts
StandingPadAnimations Jan 27, 2023
e9d38a9
Updated addon_updader
StandingPadAnimations Jan 28, 2023
9275f9b
updated readme
StandingPadAnimations Jan 28, 2023
543d78f
Fixed bug where MCprep will try to unregister removed panels
StandingPadAnimations Jan 28, 2023
5d2aceb
Began working on allowing users to select what panels they want to re…
StandingPadAnimations Jan 28, 2023
1c39c13
Bugs galore, this needs to be checked by another developer
StandingPadAnimations Jan 28, 2023
b9453d1
Soft shadows for EEVEE are now enabled when adding the sky
StandingPadAnimations Jan 31, 2023
42aa6ef
Merge pull request #6 from StandingPadAnimations/emission-option
StandingPadAnimations Feb 3, 2023
e7c74e8
Merge pull request #7 from StandingPadAnimations/emission-option
StandingPadAnimations Feb 3, 2023
5351dcc
Fixed another massive bug
StandingPadAnimations Feb 3, 2023
aa6f7e7
Merge pull request #8 from StandingPadAnimations/emission-option
StandingPadAnimations Feb 3, 2023
6396211
Merge pull request #10 from StandingPadAnimations/simple-prep
StandingPadAnimations Feb 3, 2023
76b3047
Merge pull request #9 from StandingPadAnimations/moon-lamp
StandingPadAnimations Feb 3, 2023
004cf15
updated version
StandingPadAnimations Feb 3, 2023
ca04e92
removed tracking
StandingPadAnimations Feb 3, 2023
653f69d
Removed loading of trackers
StandingPadAnimations Feb 3, 2023
bc29e57
fixed addon updater issue
StandingPadAnimations Feb 3, 2023
dcf5d67
updated readme
StandingPadAnimations Feb 3, 2023
ce0e0cf
removed unused imports
StandingPadAnimations Feb 6, 2023
e5d033c
Edited README
StandingPadAnimations Feb 8, 2023
67925f1
Made the process of removing panels more reliable
StandingPadAnimations Feb 8, 2023
de44559
Merge pull request #11 from StandingPadAnimations/simple-prep
StandingPadAnimations Feb 8, 2023
3ec067b
Replaced MCprep category with MCprep Kaion category
StandingPadAnimations Feb 8, 2023
8945931
updated version
StandingPadAnimations Feb 8, 2023
d2fc164
Added info on signed releases
StandingPadAnimations Feb 9, 2023
d838916
made GPG all caps
StandingPadAnimations Feb 9, 2023
3eec63d
Added extemely basic support for header info, but still some issues
StandingPadAnimations Feb 11, 2023
e72a66f
Got the file type to be detect correctly and move much of MCprep's OB…
StandingPadAnimations Feb 11, 2023
c86e371
Moved ObjHeaderOptions to conf.py
StandingPadAnimations Feb 11, 2023
12081db
Changed some stuff
StandingPadAnimations Feb 11, 2023
97cb0c2
UI now reflects the header
StandingPadAnimations Feb 11, 2023
cbef5eb
Saved OBJ header properties to OBJ and change UI based on that
StandingPadAnimations Feb 11, 2023
94c5183
Moved the ObjHeaderOptions class back to world_tools
StandingPadAnimations Feb 12, 2023
dc089f5
Added a helper class to util.py to handle the checking for compatibility
StandingPadAnimations Feb 12, 2023
74cdf79
Added a line to make sure Jmc2OBJ works can work with textureswap
StandingPadAnimations Feb 12, 2023
0b43aab
Merge pull request #13 from StandingPadAnimations/obj-metadata
StandingPadAnimations Feb 12, 2023
beb327c
Updated version
StandingPadAnimations Feb 12, 2023
9f1f39d
Fixed bug where an improper check occured
StandingPadAnimations Feb 12, 2023
fb707e0
fixed formatting
StandingPadAnimations Feb 12, 2023
0124672
Fixed UI bug due to a missing not keyword
StandingPadAnimations Feb 12, 2023
4ddbb5a
Fixed isTextureSwapCompatible function by checking to see if the key …
StandingPadAnimations Feb 12, 2023
d79ae9b
Removed use of conf.obj_header, removed trailing newlines from header…
StandingPadAnimations Feb 12, 2023
8885d98
Added the OBJ inspecting feature to readme
StandingPadAnimations Feb 12, 2023
7e710cc
Updated version
StandingPadAnimations Feb 12, 2023
acad35c
Merge pull request #14 from StandingPadAnimations/obj-metadata
StandingPadAnimations Feb 12, 2023
5f40b56
Added a docs folder
StandingPadAnimations Feb 15, 2023
b9d0c87
Added link to help page
StandingPadAnimations Feb 15, 2023
3430abc
MCprep now uses C++ importer in Blender 3.1 and above
StandingPadAnimations Feb 15, 2023
8667f76
Merge pull request #15 from StandingPadAnimations/support-all-color-m…
StandingPadAnimations Feb 15, 2023
caf6366
Merge pull request #16 from StandingPadAnimations/obj-metadata
StandingPadAnimations Feb 15, 2023
11c83a2
Updated version
StandingPadAnimations Feb 15, 2023
43c4d17
Added C++ OBJ importer to list of features
StandingPadAnimations Feb 15, 2023
443ef53
Fixed the root cause of the colorspace issue, fixed incorrect operato…
StandingPadAnimations Feb 15, 2023
1afc761
Added check for 3.5, which while in alpha will bring back use_split_g…
StandingPadAnimations Feb 16, 2023
c7dff7a
Merge pull request #17 from StandingPadAnimations/support-all-color-m…
StandingPadAnimations Feb 16, 2023
6d31dfb
Added a compilation step to creath_release.sh
StandingPadAnimations Feb 16, 2023
8f55686
updated version
StandingPadAnimations Feb 16, 2023
dae4f59
updated readme
StandingPadAnimations Feb 16, 2023
2dc76e1
removed print statement
StandingPadAnimations Feb 16, 2023
d233cbf
Merge pull request #18 from StandingPadAnimations/support-all-color-m…
StandingPadAnimations Feb 16, 2023
05af038
Added more details to the readme
StandingPadAnimations Feb 16, 2023
9e1fd1a
Merge pull request #19 from StandingPadAnimations/emission-option
StandingPadAnimations Feb 16, 2023
7ec353a
Updated version
StandingPadAnimations Feb 16, 2023
a528475
Moved beginning section to try-except block
StandingPadAnimations Feb 22, 2023
b052f1f
C++ now only supported for 3.5 for full feature parity
StandingPadAnimations Feb 23, 2023
5d0e421
Added the ability to "import" MTL files
StandingPadAnimations Mar 7, 2023
d13045e
Added backup for MTLs when editing their contents
StandingPadAnimations Mar 7, 2023
8b7535b
Merge pull request #21 from StandingPadAnimations/dev
StandingPadAnimations Mar 8, 2023
1808a6a
Merge pull request #22 from StandingPadAnimations/obj-metadata
StandingPadAnimations Mar 8, 2023
437749f
Merge branch 'master' into support-all-color-management
StandingPadAnimations Mar 8, 2023
08ecb9f
Revert "Merge branch 'master' into support-all-color-management"
StandingPadAnimations Mar 8, 2023
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
78 changes: 56 additions & 22 deletions MCprep_addon/world_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,34 @@ def execute(self, context):
obj_import_mem_msg = (
"Memory error during OBJ import, try exporting a smaller world")
try:
res = bpy.ops.import_scene.obj(
filepath=self.filepath, use_split_groups=True)
BLENDER_STANDARD = (
"Standard",
"Filmic",
"Filmic Log",
"Raw",
"False Color"
)
MTL = self.filepath.rsplit(".", 1)[0] + '.mtl'
LINES = None
if bpy.context.scene.view_settings.view_transform not in BLENDER_STANDARD:
with open(MTL, 'r') as mtl_file:
LINES = mtl_file.readlines()
for index, line in enumerate(LINES):
if line.startswith("map_d"):
LINES[index] = "# " + line
with open(MTL, 'w') as mtl_file:
mtl_file.writelines(LINES)
StandingPadAnimations marked this conversation as resolved.
Show resolved Hide resolved

res = None
if util.min_bv((3, 5)):
res = bpy.ops.wm.obj_import(
filepath=self.filepath, use_split_groups=True) # Returns functionality missing in 3.1 - 3.4
if util.min_bv((3, 1)):
StandingPadAnimations marked this conversation as resolved.
Show resolved Hide resolved
res = bpy.ops.wm.obj_import(
filepath=self.filepath)
StandingPadAnimations marked this conversation as resolved.
Show resolved Hide resolved
else:
res = bpy.ops.import_scene.obj(
filepath=self.filepath, use_split_groups=True)
except MemoryError as err:
print("Memory error during import OBJ:")
print(err)
Expand Down Expand Up @@ -394,6 +420,14 @@ def execute(self, context):

addon_prefs = util.get_user_preferences(context)
self.track_exporter = addon_prefs.MCprep_exporter_type # Soft detect.

if bpy.context.scene.view_settings.view_transform not in BLENDER_STANDARD:
for index, line in enumerate(LINES):
if line.startswith("# map_d"):
LINES[index] = line[2:] # remove # and the space
with open(MTL, 'w') as mtl_file:
mtl_file.writelines(LINES)
StandingPadAnimations marked this conversation as resolved.
Show resolved Hide resolved

return {'FINISHED'}

def obj_name_to_material(self, obj):
Expand Down Expand Up @@ -863,34 +897,34 @@ def create_dynamic_world(self, context, blendfile, wname):

# # update drivers, needed if time has changed vs import source
# if context.scene.world.node_tree.animation_data:
# # context.scene.world.node_tree.animation_data.drivers[0].update()
# drivers = context.scene.world.node_tree.animation_data.drivers[0]
# drivers.driver.variables[0].targets[0].id = time_obj
# # nope, still doesn't work.
# # context.scene.world.node_tree.animation_data.drivers[0].update()
# drivers = context.scene.world.node_tree.animation_data.drivers[0]
# drivers.driver.variables[0].targets[0].id = time_obj
# # nope, still doesn't work.

# if needed: create time object and setup drivers
# if not time_obj:
# conf.log("Creating time_obj")
# time_obj = bpy.data.objects.new('MCprep Time Control', None)
# util.obj_link_scene(time_obj, context)
# global time_obj_cache
# time_obj_cache = time_obj
# if hasattr(time_obj, "empty_draw_type"): # 2.7
# time_obj.empty_draw_type = 'SPHERE'
# else: # 2.8
# time_obj.empty_display_type = 'SPHERE'
# conf.log("Creating time_obj")
# time_obj = bpy.data.objects.new('MCprep Time Control', None)
# util.obj_link_scene(time_obj, context)
# global time_obj_cache
# time_obj_cache = time_obj
# if hasattr(time_obj, "empty_draw_type"): # 2.7
# time_obj.empty_draw_type = 'SPHERE'
# else: # 2.8
# time_obj.empty_display_type = 'SPHERE'

# first, get the driver
# if (not world.node_tree.animation_data
# or not world.node_tree.animation_data.drivers
# or not world.node_tree.animation_data.drivers[0].driver):
# conf.log("Could not get driver from imported dynamic world")
# self.report({'WARNING'}, "Could not update driver for dynamic world")
# driver = None
# or not world.node_tree.animation_data.drivers
# or not world.node_tree.animation_data.drivers[0].driver):
# conf.log("Could not get driver from imported dynamic world")
# self.report({'WARNING'}, "Could not update driver for dynamic world")
# driver = None
# else:
# driver = world.node_tree.animation_data.drivers[0].driver
# driver = world.node_tree.animation_data.drivers[0].driver
# if driver and driver.variables[0].targets[0].id_type == 'OBJECT':
# driver.variables[0].targets[0].id = time_obj
# driver.variables[0].targets[0].id = time_obj
# add driver to control obj's x rotation

return obj_list
Expand Down