Skip to content

Commit

Permalink
Several fixes thanks to @vincentfretin
Browse files Browse the repository at this point in the history
  • Loading branch information
GottfriedHofmann committed Oct 8, 2024
1 parent 7e455ef commit cf994da
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 24 deletions.
35 changes: 18 additions & 17 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
{
"python.autoComplete.extraPaths": [
"./fake_bpy_modules_3.3-20221006"
],
"python.formatting.provider": "autopep8",
"python.formatting.autopep8Args": [
"--exclude=models", "--max-line-length", "120", "--experimental"
],
"python.analysis.extraPaths": [
"./fake_bpy_modules_3.3-20221006"
],
"editor.defaultFormatter": "ms-python.autopep8",
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "file",
"autopep8.args": [
"--exclude=models", "--max-line-length", "120", "--experimental"
],
{
"python.autoComplete.extraPaths": [
"./fake_bpy_modules_3.3-20221006"
],
"python.formatting.provider": "autopep8",
"python.formatting.autopep8Args": [
"--exclude=models", "--max-line-length", "120", "--experimental"
],
"python.analysis.extraPaths": [
"./fake_bpy_modules_3.3-20221006"
],
"editor.defaultFormatter": "ms-python.autopep8",
"editor.formatOnSave": true,
"editor.formatOnSaveMode": "file",
"autopep8.args": [
"--exclude=models", "--max-line-length", "120", "--experimental"
],
"cmake.configureOnOpen": false,
}
14 changes: 7 additions & 7 deletions addons/io_hubs_addon/components/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -718,13 +718,13 @@ def create_uv_layouts(self, context, mesh_objs):
# bpy.ops.uv.lightmap_pack()
bpy.ops.uv.smart_project(island_margin=LIGHTMAP_UV_ISLAND_MARGIN)
bpy.ops.object.mode_set(mode='OBJECT')
# Deselct the objects again to return without changing the scene
# Deselect the objects again to return without changing the scene
for obj in mesh_objs:
obj.select_set(False)
# Update the view layer so all parts take notice of the changed UV layout
bpy.context.view_layer.update()

return{'FINISHED'}
return {'FINISHED'}

def execute(self, context):
# Check selected objects
Expand All @@ -745,20 +745,20 @@ def execute(self, context):
# materials = []
# Dictionary that stores which object has which materials so we can group them later
material_object_associations = {}
for obj in mesh_objs:
# Iterate over a copy of mesh_objs because we are modifying it further down
for obj in list(mesh_objs):
if len(obj.material_slots) >= 1:
# TODO: Make more efficient
for slot in obj.material_slots:
if slot.material is not None:
mat = slot.material
if mat not in material_object_associations:
# materials.append(mat)
material_object_associations[mat] = []
material_object_associations[mat].append(obj)
else:
# an object without materials should not be selected when running the bake operator
print("Object " + obj.name + " does not have material slots, removing from set")
obj.select_set(False)
print("Object " + obj.name + " does not have material slots, removing from list of objects that will be unwrapped.")
# obj.select_set(False)
mesh_objs.remove(obj)

print(material_object_associations.items())
Expand Down Expand Up @@ -839,7 +839,7 @@ def execute(self, context):
return {'FINISHED'}

def invoke(self, context, event):
# needed to get the dialoge with the intensity
# needed to get the dialog with the intensity
return context.window_manager.invoke_props_dialog(self)

def setup_moz_lightmap_nodes(self, node_tree):
Expand Down

0 comments on commit cf994da

Please sign in to comment.