Skip to content

Commit 42bf2df

Browse files
author
whiteblXK
committed
OBD v3 should be available only for outfits with frame groups, changed extra name for exporting obd files, version 0.5.1
1 parent e6ce1a8 commit 42bf2df

10 files changed

Lines changed: 104 additions & 64 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
### 0.5.1
2+
3+
Features:
4+
5+
* Better extra name for exporting OBD
6+
7+
Bug Fixes:
8+
9+
* Client without frame groups will not be able to use new OBD v3
10+
111
### 0.5.0
212

313
Features:

locale/en_US/strings.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,9 @@ spriteCannotBeReplaced=Sprite 0 cannot be replaced.
432432
accessDenied=You don't have the permission to save in selected folder. Please select another folder.
433433
folderNotExistOrCannotBeRead=The specified folder does not exist or cannot be read.
434434
selectAClientFolder=Select a folder containing the asset files.
435+
cannotImportThingFrameGroup=Cannot import thing into client without frame groups.
436+
cannotReplaceThingFrameGroup=Cannot replace thing in client without frame groups.
437+
435438

436439
# Licence
437440
licence=THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\

locale/es_ES/strings.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,8 @@ spriteCannotBeReplaced=Sprite 0 no puede ser reemplazado.
432432
accessDenied=No tienes permiso para guardar en la carpeta seleccionada. Por favor seleccione otra carpeta.
433433
folderNotExistOrCannotBeRead=El carpeta que eligio no existe o no se puede leer.
434434
selectAClientFolder=Seleccione un carpeta que contenga archivos del cliente.
435+
cannotImportThingFrameGroup=No se puede importar algo en el cliente sin grupos de marcos.
436+
cannotReplaceThingFrameGroup=No se puede reemplazar algo en el cliente sin grupos de marcos.
435437

436438
# Licence
437439
licence=THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\

locale/pt_BR/strings.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,8 @@ spriteCannotBeReplaced=Sprite 0 cannot be replaced.
432432
accessDenied=Você não tem permissão para salvar na pasta selecionada. Por favor, selecione outra pasta.
433433
folderNotExistOrCannotBeRead=A pasta especificada não existe ou não pode ser lida.
434434
selectAClientFolder=Selecione uma pasta contendo os arquivos do cliente.
435+
cannotImportThingFrameGroup=Não é possível importar coisas para o cliente sem grupos de quadros.
436+
cannotReplaceThingFrameGroup=Não é possível substituir coisa no cliente sem grupos de quadros.
435437

436438
# Licence
437439
licence=THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n\

src/ObjectBuilder-app.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<id>com.mignari.ObjectBuilder</id>
55
<filename>ObjectBuilder</filename>
66
<name>Object Builder</name>
7-
<versionNumber>0.5.0</versionNumber>
8-
<versionLabel>0.5.0</versionLabel>
7+
<versionNumber>0.5.1</versionNumber>
8+
<versionLabel>0.5.1</versionLabel>
99
<copyright>
1010
<![CDATA[Copyright (c) 2014-2021 <a href="https://github.com/Mignari/ObjectBuilder/graphs/contributors">Contributors</a>]]>
1111
</copyright>

src/ObjectBuilder.mxml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,16 +1181,16 @@ THE SOFTWARE.
11811181
var queue:FileQueueHelper = new FileQueueHelper();
11821182
queue.parent = this;
11831183
queue.addEventListener(Event.COMPLETE, completeHandler);
1184-
var changeName:Boolean = (fileName.indexOf("_") == -1);
11851184
1186-
var versionName:String = "";
1185+
var extra:String = "";
11871186
if(format == OTFormat.OBD)
1188-
versionName = "-v" + obdVersion.toString().substring(0, 1);
1187+
extra = "-" + clientVersion.toString() + "-v" + obdVersion.toString().substring(0, 1);
11891188
11901189
var length:uint = things.length;
11911190
for (var i:uint = 0; i < length; i++) {
11921191
var id:uint = things[i].id;
1193-
var name:String = !changeName ? fileName : (name = fileName + "_" + id) + versionName;
1192+
var name:String = fileName + "_" + id.toString() + extra.replace(" ", "").replace(".", "");
1193+
11941194
queue.addFile(id, name, format, directory);
11951195
}
11961196
queue.start();
@@ -1830,6 +1830,7 @@ THE SOFTWARE.
18301830
window.version = version;
18311831
window.transparentBackground = _settings.exportWithTransparentBackground;
18321832
window.jpegQuality = _settings.jpegQuality;
1833+
window.obdV3 = thingData.category == ThingCategory.OUTFIT && _clientInfo.frameGroups;
18331834
window.addEventListener(Event.CLOSE, windowCloseHandler);
18341835
window.open(this);
18351836

src/ObjectBuilderWorker.as

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,9 @@ package
508508
if(thingData)
509509
{
510510
_things.dispatchEvent(new ProgressEvent(ProgressEvent.CONVERT, ProgressBarID.CONVERT, thingType.id, _things.outfitsCount));
511-
thingData.convertFrameGroups(improvedAnimations, frameGroups);
511+
512+
if(frameGroups)
513+
thingData.convertFrameGroups(improvedAnimations);
512514
}
513515
}
514516
}
@@ -777,6 +779,7 @@ package
777779
throw new NullArgumentError("list");
778780
}
779781

782+
var denyIds:Dictionary = new Dictionary();
780783
var length:uint = list.length;
781784
if (length == 0) return;
782785

@@ -787,7 +790,16 @@ package
787790
var spritesIds:Vector.<uint> = new Vector.<uint>();
788791
for (var i:uint = 0; i < length; i++) {
789792
var thingData:ThingData = list[i];
790-
thingData.convertFrameGroups(_improvedAnimations, _frameGroups);
793+
794+
if(!_frameGroups && thingData.obdVersion == OBDVersions.OBD_VERSION_3)
795+
{
796+
denyIds[i] = true;
797+
Log.error(Resources.getString("cannotReplaceThingFrameGroup"));
798+
continue;
799+
}
800+
801+
if(_frameGroups)
802+
thingData.convertFrameGroups(_improvedAnimations);
791803

792804
var thing:ThingType = thingData.thing;
793805
for (var groupType:uint = FrameGroupType.DEFAULT; groupType <= FrameGroupType.WALKING; groupType++)
@@ -821,12 +833,19 @@ package
821833
//============================================================================
822834
// Replace things
823835

824-
var thingsToReplace:Vector.<ThingType> = new Vector.<ThingType>(length, true);
825-
var thingsIds:Vector.<uint> = new Vector.<uint>(length, true);
836+
var thingsToReplace:Vector.<ThingType> = new Vector.<ThingType>();
837+
var thingsIds:Vector.<uint> = new Vector.<uint>();
826838
for (i = 0; i < length; i++) {
827-
thingsToReplace[i] = list[i].thing;
828-
thingsIds[i] = list[i].id;
839+
if(!denyIds[i])
840+
{
841+
thingsToReplace[thingsToReplace.length] = list[i].thing;
842+
thingsIds[thingsIds.length] = list[i].id;
843+
}
829844
}
845+
846+
if(thingsToReplace.length == 0)
847+
return;
848+
830849
result = _things.replaceThings(thingsToReplace);
831850
if (!result.done) {
832851
Log.error(result.message);
@@ -906,6 +925,7 @@ package
906925
throw new NullArgumentError("list");
907926
}
908927

928+
var denyIds:Dictionary = new Dictionary();
909929
var length:uint = list.length;
910930
if (length == 0) return;
911931

@@ -916,7 +936,15 @@ package
916936
var spritesIds:Vector.<uint> = new Vector.<uint>();
917937
for (var i:uint = 0; i < length; i++) {
918938
var thingData:ThingData = list[i];
919-
thingData.convertFrameGroups(_improvedAnimations, _frameGroups);
939+
if(!_frameGroups && thingData.obdVersion == OBDVersions.OBD_VERSION_3)
940+
{
941+
denyIds[i] = true;
942+
Log.error(Resources.getString("cannotImportThingFrameGroup"));
943+
continue;
944+
}
945+
946+
if(_frameGroups)
947+
thingData.convertFrameGroups(_improvedAnimations);
920948

921949
var thing:ThingType = thingData.thing;
922950
for (var groupType:uint = FrameGroupType.DEFAULT; groupType <= FrameGroupType.WALKING; groupType++)
@@ -950,10 +978,15 @@ package
950978
//============================================================================
951979
// Add things
952980

953-
var thingsToAdd:Vector.<ThingType> = new Vector.<ThingType>(length, true);
981+
var thingsToAdd:Vector.<ThingType> = new Vector.<ThingType>();
954982
for (i = 0; i < length; i++) {
955-
thingsToAdd[i] = list[i].thing;
983+
if(!denyIds[i])
984+
thingsToAdd[thingsToAdd.length] = list[i].thing;
956985
}
986+
987+
if(thingsToAdd.length == 0)
988+
return;
989+
957990
result = _things.addThings(thingsToAdd);
958991
if (!result.done) {
959992
Log.error(result.message);

src/otlib/components/ExportWindow.mxml

Lines changed: 27 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ THE SOFTWARE.
3030
height="270"
3131
fontSize="11"
3232
title="@Resource(key='export', bundle='strings')"
33-
preinitialize="preinitializeHandler(event)">
33+
preinitialize="preinitializeHandler(event)"
34+
creationComplete="creationCompleteHandler(event)">
3435

3536
<fx:Metadata>
3637
[ResourceBundle("strings")]
@@ -45,16 +46,16 @@ THE SOFTWARE.
4546
<![CDATA[
4647
import com.mignari.skins.PixeledBorderContainerSkin;
4748
import com.mignari.utils.DialogDetail;
48-
49+
4950
import mx.collections.ArrayCollection;
5051
import mx.events.FlexEvent;
51-
52+
5253
import spark.events.IndexChangeEvent;
5354
import spark.events.TextOperationEvent;
54-
55+
5556
import nail.image.ImageFormat;
5657
import nail.utils.isNullOrEmpty;
57-
58+
5859
import otlib.core.Version;
5960
import otlib.core.VersionStorage;
6061
import otlib.events.FileTextInputEvent;
@@ -71,8 +72,12 @@ THE SOFTWARE.
7172
[Bindable]
7273
public var jpegQuality:Number = 100;
7374
75+
[Bindable]
76+
public var obdV3:Boolean = false;
77+
7478
[Bindable]
7579
private var _versionCollection:ArrayCollection;
80+
private var _obdVersionCollection:ArrayCollection;
7681
private var _fileName:String;
7782
private var _fileNameChanged:Boolean;
7883
private var _directory:File;
@@ -83,7 +88,7 @@ THE SOFTWARE.
8388
private var _enableObdFormatChanged:Boolean;
8489
private var _version:Version;
8590
private var _versionChanged:Boolean;
86-
private var _obdVersion:uint = OBDVersions.OBD_VERSION_3;
91+
private var _obdVersion:uint;
8792
private var _obdVersionChanged:Boolean;
8893
private var _detail:uint;
8994
@@ -151,7 +156,6 @@ THE SOFTWARE.
151156
{
152157
if (_obdVersion != value) {
153158
_obdVersion = value;
154-
_obdVersionChanged = true;
155159
invalidateProperties();
156160
}
157161
}
@@ -199,17 +203,6 @@ THE SOFTWARE.
199203
_versionChanged = false;
200204
check();
201205
}
202-
203-
if (_obdVersionChanged) {
204-
if (_obdVersion == OBDVersions.OBD_VERSION_3)
205-
obdVersionDropDownList.selectedIndex = 0;
206-
else if (_obdVersion == OBDVersions.OBD_VERSION_2)
207-
obdVersionDropDownList.selectedIndex = 1;
208-
else if (_obdVersion == OBDVersions.OBD_VERSION_1)
209-
obdVersionDropDownList.selectedIndex = 2;
210-
211-
_obdVersionChanged = false;
212-
}
213206
}
214207
215208
//--------------------------------------
@@ -255,6 +248,19 @@ THE SOFTWARE.
255248
_versionCollection = new ArrayCollection( VersionStorage.getInstance().getList() );
256249
}
257250
251+
protected function creationCompleteHandler(event:FlexEvent):void
252+
{
253+
_obdVersionCollection = new ArrayCollection();
254+
if(obdV3)
255+
_obdVersionCollection.addItem({label: "v3", version: OBDVersions.OBD_VERSION_3});
256+
257+
_obdVersionCollection.addItem({label: "v2", version: OBDVersions.OBD_VERSION_2});
258+
_obdVersionCollection.addItem({label: "v1", version: OBDVersions.OBD_VERSION_1});
259+
260+
obdVersionDropDownList.dataProvider = _obdVersionCollection;
261+
obdVersion = obdV3 ? OBDVersions.OBD_VERSION_3 : OBDVersions.OBD_VERSION_2;
262+
}
263+
258264
protected function nameTextInputChangeHandler(event:TextOperationEvent):void
259265
{
260266
fileName = nameTextInput.text;
@@ -290,12 +296,9 @@ THE SOFTWARE.
290296
291297
protected function obdVersionDropDownListChangeHandler(event:IndexChangeEvent):void
292298
{
293-
if (obdVersionDropDownList.selectedIndex == 0)
294-
obdVersion = OBDVersions.OBD_VERSION_3;
295-
else if (obdVersionDropDownList.selectedIndex == 1)
296-
obdVersion = OBDVersions.OBD_VERSION_2;
297-
else if (obdVersionDropDownList.selectedIndex == 2)
298-
obdVersion = OBDVersions.OBD_VERSION_1;
299+
obdVersion = obdVersionDropDownList.selectedItem.version;
300+
301+
trace(obdVersion);
299302
}
300303
301304
protected function confirmButtonClickHandler(event:MouseEvent):void
@@ -419,13 +422,6 @@ THE SOFTWARE.
419422
requireSelection="true"
420423
enabled="{obdFormatRadioButton.selected}"
421424
change="obdVersionDropDownListChangeHandler(event)">
422-
<s:dataProvider>
423-
<s:ArrayList>
424-
<fx:String>3</fx:String>
425-
<fx:String>2</fx:String>
426-
<fx:String>1</fx:String>
427-
</s:ArrayList>
428-
</s:dataProvider>
429425
</s:DropDownList>
430426
</s:NavigatorContent>
431427
</mx:ViewStack>

src/otlib/things/ThingData.as

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -569,29 +569,16 @@ package otlib.things
569569
this.m_sprites = spritesGroup;
570570
}
571571

572-
public function convertFrameGroups(improvedAnimations:Boolean, frameGroups:Boolean):void
572+
public function convertFrameGroups(improvedAnimations:Boolean):void
573573
{
574574
if(this.m_thing.animateAlways || this.category != ThingCategory.OUTFIT)
575575
return;
576576

577-
if(frameGroups)
578-
{
579-
if(this.m_thing.frameGroups.length > 1)
580-
return;
581-
582-
this.m_thing.addFrameGroupState(improvedAnimations);
583-
this.addFrameGroupSprites();
584-
}
585-
else
586-
{
587-
if(this.m_thing.frameGroups.length < 2)
588-
return;
589-
590-
//TODO remove frame groups
591-
//this.m_thing.removeFrameGroupState(improvedAnimations);
592-
//this.removeFrameGroupSprites();
593-
}
577+
if(this.m_thing.frameGroups.length > 1)
578+
return;
594579

580+
this.m_thing.addFrameGroupState(improvedAnimations);
581+
this.addFrameGroupSprites();
595582
return;
596583
}
597584

src/otlib/things/ThingTypeStorage.as

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,9 @@ package otlib.things
734734

735735
for (var i:uint = 0; i < length; i++) {
736736
var thing:ThingType = things[i];
737+
if(!thing)
738+
continue;
739+
737740
var added:ChangeResult = internalAddThing(thing, thing.category, CHANGE_RESULT_HELPER);
738741
if (!added.done) {
739742
var message:String = Resources.getString(
@@ -798,6 +801,9 @@ package otlib.things
798801

799802
for (var i:uint = 0; i < length; i++) {
800803
var thing:ThingType = things[i];
804+
if(!thing)
805+
continue;
806+
801807
var replaced:ChangeResult = internalReplaceThing(thing,
802808
thing.category,
803809
thing.id,

0 commit comments

Comments
 (0)