From 42bf2dfa911a1b3cb222974c87722d635fd1cea5 Mon Sep 17 00:00:00 2001 From: whiteblXK Date: Wed, 24 Mar 2021 19:00:17 +0100 Subject: [PATCH] OBD v3 should be available only for outfits with frame groups, changed extra name for exporting obd files, version 0.5.1 --- CHANGELOG.md | 10 +++++ locale/en_US/strings.properties | 3 ++ locale/es_ES/strings.properties | 2 + locale/pt_BR/strings.properties | 2 + src/ObjectBuilder-app.xml | 4 +- src/ObjectBuilder.mxml | 9 ++-- src/ObjectBuilderWorker.as | 51 ++++++++++++++++++---- src/otlib/components/ExportWindow.mxml | 58 ++++++++++++-------------- src/otlib/things/ThingData.as | 23 +++------- src/otlib/things/ThingTypeStorage.as | 6 +++ 10 files changed, 104 insertions(+), 64 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65ebeb8..b59a7bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +### 0.5.1 + +Features: + +* Better extra name for exporting OBD + +Bug Fixes: + +* Client without frame groups will not be able to use new OBD v3 + ### 0.5.0 Features: diff --git a/locale/en_US/strings.properties b/locale/en_US/strings.properties index 04ea7c8..3a9b484 100644 --- a/locale/en_US/strings.properties +++ b/locale/en_US/strings.properties @@ -432,6 +432,9 @@ spriteCannotBeReplaced=Sprite 0 cannot be replaced. accessDenied=You don't have the permission to save in selected folder. Please select another folder. folderNotExistOrCannotBeRead=The specified folder does not exist or cannot be read. selectAClientFolder=Select a folder containing the asset files. +cannotImportThingFrameGroup=Cannot import thing into client without frame groups. +cannotReplaceThingFrameGroup=Cannot replace thing in client without frame groups. + # Licence licence=THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\ diff --git a/locale/es_ES/strings.properties b/locale/es_ES/strings.properties index 5cfb322..747dad5 100644 --- a/locale/es_ES/strings.properties +++ b/locale/es_ES/strings.properties @@ -432,6 +432,8 @@ spriteCannotBeReplaced=Sprite 0 no puede ser reemplazado. accessDenied=No tienes permiso para guardar en la carpeta seleccionada. Por favor seleccione otra carpeta. folderNotExistOrCannotBeRead=El carpeta que eligio no existe o no se puede leer. selectAClientFolder=Seleccione un carpeta que contenga archivos del cliente. +cannotImportThingFrameGroup=No se puede importar algo en el cliente sin grupos de marcos. +cannotReplaceThingFrameGroup=No se puede reemplazar algo en el cliente sin grupos de marcos. # Licence licence=THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\ diff --git a/locale/pt_BR/strings.properties b/locale/pt_BR/strings.properties index 02aa97c..73c0cfa 100644 --- a/locale/pt_BR/strings.properties +++ b/locale/pt_BR/strings.properties @@ -432,6 +432,8 @@ spriteCannotBeReplaced=Sprite 0 cannot be replaced. accessDenied=Você não tem permissão para salvar na pasta selecionada. Por favor, selecione outra pasta. folderNotExistOrCannotBeRead=A pasta especificada não existe ou não pode ser lida. selectAClientFolder=Selecione uma pasta contendo os arquivos do cliente. +cannotImportThingFrameGroup=Não é possível importar coisas para o cliente sem grupos de quadros. +cannotReplaceThingFrameGroup=Não é possível substituir coisa no cliente sem grupos de quadros. # Licence licence=THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\ diff --git a/src/ObjectBuilder-app.xml b/src/ObjectBuilder-app.xml index 1a4f7cc..8a4d23f 100644 --- a/src/ObjectBuilder-app.xml +++ b/src/ObjectBuilder-app.xml @@ -4,8 +4,8 @@ com.mignari.ObjectBuilder ObjectBuilder Object Builder - 0.5.0 - 0.5.0 + 0.5.1 + 0.5.1 Contributors]]> diff --git a/src/ObjectBuilder.mxml b/src/ObjectBuilder.mxml index 49cf1c9..80afd73 100644 --- a/src/ObjectBuilder.mxml +++ b/src/ObjectBuilder.mxml @@ -1181,16 +1181,16 @@ THE SOFTWARE. var queue:FileQueueHelper = new FileQueueHelper(); queue.parent = this; queue.addEventListener(Event.COMPLETE, completeHandler); - var changeName:Boolean = (fileName.indexOf("_") == -1); - var versionName:String = ""; + var extra:String = ""; if(format == OTFormat.OBD) - versionName = "-v" + obdVersion.toString().substring(0, 1); + extra = "-" + clientVersion.toString() + "-v" + obdVersion.toString().substring(0, 1); var length:uint = things.length; for (var i:uint = 0; i < length; i++) { var id:uint = things[i].id; - var name:String = !changeName ? fileName : (name = fileName + "_" + id) + versionName; + var name:String = fileName + "_" + id.toString() + extra.replace(" ", "").replace(".", ""); + queue.addFile(id, name, format, directory); } queue.start(); @@ -1830,6 +1830,7 @@ THE SOFTWARE. window.version = version; window.transparentBackground = _settings.exportWithTransparentBackground; window.jpegQuality = _settings.jpegQuality; + window.obdV3 = thingData.category == ThingCategory.OUTFIT && _clientInfo.frameGroups; window.addEventListener(Event.CLOSE, windowCloseHandler); window.open(this); diff --git a/src/ObjectBuilderWorker.as b/src/ObjectBuilderWorker.as index f126276..c3077e4 100644 --- a/src/ObjectBuilderWorker.as +++ b/src/ObjectBuilderWorker.as @@ -508,7 +508,9 @@ package if(thingData) { _things.dispatchEvent(new ProgressEvent(ProgressEvent.CONVERT, ProgressBarID.CONVERT, thingType.id, _things.outfitsCount)); - thingData.convertFrameGroups(improvedAnimations, frameGroups); + + if(frameGroups) + thingData.convertFrameGroups(improvedAnimations); } } } @@ -777,6 +779,7 @@ package throw new NullArgumentError("list"); } + var denyIds:Dictionary = new Dictionary(); var length:uint = list.length; if (length == 0) return; @@ -787,7 +790,16 @@ package var spritesIds:Vector. = new Vector.(); for (var i:uint = 0; i < length; i++) { var thingData:ThingData = list[i]; - thingData.convertFrameGroups(_improvedAnimations, _frameGroups); + + if(!_frameGroups && thingData.obdVersion == OBDVersions.OBD_VERSION_3) + { + denyIds[i] = true; + Log.error(Resources.getString("cannotReplaceThingFrameGroup")); + continue; + } + + if(_frameGroups) + thingData.convertFrameGroups(_improvedAnimations); var thing:ThingType = thingData.thing; for (var groupType:uint = FrameGroupType.DEFAULT; groupType <= FrameGroupType.WALKING; groupType++) @@ -821,12 +833,19 @@ package //============================================================================ // Replace things - var thingsToReplace:Vector. = new Vector.(length, true); - var thingsIds:Vector. = new Vector.(length, true); + var thingsToReplace:Vector. = new Vector.(); + var thingsIds:Vector. = new Vector.(); for (i = 0; i < length; i++) { - thingsToReplace[i] = list[i].thing; - thingsIds[i] = list[i].id; + if(!denyIds[i]) + { + thingsToReplace[thingsToReplace.length] = list[i].thing; + thingsIds[thingsIds.length] = list[i].id; + } } + + if(thingsToReplace.length == 0) + return; + result = _things.replaceThings(thingsToReplace); if (!result.done) { Log.error(result.message); @@ -906,6 +925,7 @@ package throw new NullArgumentError("list"); } + var denyIds:Dictionary = new Dictionary(); var length:uint = list.length; if (length == 0) return; @@ -916,7 +936,15 @@ package var spritesIds:Vector. = new Vector.(); for (var i:uint = 0; i < length; i++) { var thingData:ThingData = list[i]; - thingData.convertFrameGroups(_improvedAnimations, _frameGroups); + if(!_frameGroups && thingData.obdVersion == OBDVersions.OBD_VERSION_3) + { + denyIds[i] = true; + Log.error(Resources.getString("cannotImportThingFrameGroup")); + continue; + } + + if(_frameGroups) + thingData.convertFrameGroups(_improvedAnimations); var thing:ThingType = thingData.thing; for (var groupType:uint = FrameGroupType.DEFAULT; groupType <= FrameGroupType.WALKING; groupType++) @@ -950,10 +978,15 @@ package //============================================================================ // Add things - var thingsToAdd:Vector. = new Vector.(length, true); + var thingsToAdd:Vector. = new Vector.(); for (i = 0; i < length; i++) { - thingsToAdd[i] = list[i].thing; + if(!denyIds[i]) + thingsToAdd[thingsToAdd.length] = list[i].thing; } + + if(thingsToAdd.length == 0) + return; + result = _things.addThings(thingsToAdd); if (!result.done) { Log.error(result.message); diff --git a/src/otlib/components/ExportWindow.mxml b/src/otlib/components/ExportWindow.mxml index fb0f845..d2143f3 100644 --- a/src/otlib/components/ExportWindow.mxml +++ b/src/otlib/components/ExportWindow.mxml @@ -30,7 +30,8 @@ THE SOFTWARE. height="270" fontSize="11" title="@Resource(key='export', bundle='strings')" - preinitialize="preinitializeHandler(event)"> + preinitialize="preinitializeHandler(event)" + creationComplete="creationCompleteHandler(event)"> [ResourceBundle("strings")] @@ -45,16 +46,16 @@ THE SOFTWARE. - - - 3 - 2 - 1 - - diff --git a/src/otlib/things/ThingData.as b/src/otlib/things/ThingData.as index 94fe3cf..b453471 100644 --- a/src/otlib/things/ThingData.as +++ b/src/otlib/things/ThingData.as @@ -569,29 +569,16 @@ package otlib.things this.m_sprites = spritesGroup; } - public function convertFrameGroups(improvedAnimations:Boolean, frameGroups:Boolean):void + public function convertFrameGroups(improvedAnimations:Boolean):void { if(this.m_thing.animateAlways || this.category != ThingCategory.OUTFIT) return; - if(frameGroups) - { - if(this.m_thing.frameGroups.length > 1) - return; - - this.m_thing.addFrameGroupState(improvedAnimations); - this.addFrameGroupSprites(); - } - else - { - if(this.m_thing.frameGroups.length < 2) - return; - - //TODO remove frame groups - //this.m_thing.removeFrameGroupState(improvedAnimations); - //this.removeFrameGroupSprites(); - } + if(this.m_thing.frameGroups.length > 1) + return; + this.m_thing.addFrameGroupState(improvedAnimations); + this.addFrameGroupSprites(); return; } diff --git a/src/otlib/things/ThingTypeStorage.as b/src/otlib/things/ThingTypeStorage.as index 59eb09b..37b0f5c 100644 --- a/src/otlib/things/ThingTypeStorage.as +++ b/src/otlib/things/ThingTypeStorage.as @@ -734,6 +734,9 @@ package otlib.things for (var i:uint = 0; i < length; i++) { var thing:ThingType = things[i]; + if(!thing) + continue; + var added:ChangeResult = internalAddThing(thing, thing.category, CHANGE_RESULT_HELPER); if (!added.done) { var message:String = Resources.getString( @@ -798,6 +801,9 @@ package otlib.things for (var i:uint = 0; i < length; i++) { var thing:ThingType = things[i]; + if(!thing) + continue; + var replaced:ChangeResult = internalReplaceThing(thing, thing.category, thing.id,