def execute(self, context): startLog(self) objlist = context.selected_objects if self.complete: roots = list( set([sUtils.getRoot(obj) for obj in context.selected_objects])) if None in roots: roots.remove(None) objlist = [ elem for sublist in [sUtils.getChildren(root) for root in roots] for elem in sublist ] objnames = [o.name for o in bpy.data.objects] for obj in objlist: if "::" in obj.name: if nUtils.namesAreExplicit({obj.name.split("::")[-1]}, objnames): nUtils.removeNamespace(obj) else: log( "Cannot remove namespace from " + obj.name + ". Name wouldn't be explicit", "ERROR") else: nUtils.addNamespace(obj) endLog() return {'FINISHED'}
def execute(self, context): startLog(self) objlist = context.selected_objects if self.complete: roots = list(set([selectionUtils.getRoot(obj) for obj in context.selected_objects])) if None in roots: roots.remove(None) objlist = [elem for sublist in [selectionUtils.getChildren(root) for root in roots] for elem in sublist] objnames = [o.name for o in bpy.data.objects] for obj in objlist: if "::" in obj.name: if namingUtils.namesAreExplicit({obj.name.split("::")[-1]}, objnames): namingUtils.removeNamespace(obj) else: log("Cannot remove namespace from " + obj.name + ". Name wouldn't be explicit", "ERROR") else: namingUtils.addNamespace(obj) endLog() return {'FINISHED'}