Skip to content

Commit

Permalink
Merge pull request KhronosGroup#957 from KhronosGroup/fix_956_use_sel…
Browse files Browse the repository at this point in the history
…ected_rename

Fix KhronosGroup#956 Rename export_selected to use_selected
  • Loading branch information
emackey authored Mar 4, 2020
2 parents 73d9e3c + 3f24551 commit cfff7c2
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions addons/io_scene_gltf2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,12 +215,19 @@ def __init__(self):
default=False
)

# keep it for compatibility (for now)
export_selected: BoolProperty(
name='Selected Objects',
description='Export selected objects only',
default=False
)

use_selected: BoolProperty(
name='Selected Objects',
description='Export selected objects only',
default=False
)

export_extras: BoolProperty(
name='Custom Properties',
description='Export custom properties as glTF extras',
Expand Down Expand Up @@ -345,7 +352,13 @@ def invoke(self, context, event):
if settings:
try:
for (k, v) in settings.items():
setattr(self, k, v)
if k == "export_selected": # Back compatibility for export_selected --> use_selected
setattr(self, "use_selected", v)
del settings[k]
settings["use_selected"] = v
print("export_selected is now renamed use_selected, and will be deleted in a few release")
else:
setattr(self, k, v)
self.will_save_settings = True

except (AttributeError, TypeError):
Expand Down Expand Up @@ -417,7 +430,15 @@ def execute(self, context):
export_settings['gltf_materials'] = self.export_materials
export_settings['gltf_colors'] = self.export_colors
export_settings['gltf_cameras'] = self.export_cameras
export_settings['gltf_selected'] = self.export_selected

# compatibility after renaming export_selected to use_selected
if self.export_selected is True:
self.report({"WARNING"}, "export_selected is now renamed use_selected, and will be deleted in a few release")
export_settings['gltf_selected'] = self.export_selected
else:
export_settings['gltf_selected'] = self.use_selected

# export_settings['gltf_selected'] = self.use_selected This can be uncomment when removing compatibility of export_selected
export_settings['gltf_layers'] = True # self.export_layers
export_settings['gltf_extras'] = self.export_extras
export_settings['gltf_yup'] = self.export_yup
Expand Down Expand Up @@ -535,7 +556,7 @@ def draw(self, context):
sfile = context.space_data
operator = sfile.active_operator

layout.prop(operator, 'export_selected')
layout.prop(operator, 'use_selected')
layout.prop(operator, 'export_extras')
layout.prop(operator, 'export_cameras')
layout.prop(operator, 'export_lights')
Expand Down

0 comments on commit cfff7c2

Please sign in to comment.