@@ -103,8 +103,7 @@ public EditAnimationDialog(Skin skin, SpriteActor p, AnimationDesc e) {
103
103
Param .Type .BOOLEAN , true , "true" );
104
104
dispose = InputPanelFactory .createInputPanel (skin , "Dispose When Played" , "Dispose de animation after playing" ,
105
105
Param .Type .BOOLEAN , true , "false" );
106
-
107
-
106
+
108
107
((SelectBox <String >) repeat .getField ()).addListener (new ChangeListener () {
109
108
110
109
@ Override
@@ -146,14 +145,14 @@ public void changed(ChangeEvent event, Actor actor) {
146
145
});
147
146
148
147
setInfoWidget (spriteWidget );
149
-
148
+
150
149
init (p , e , new InputPanel [] { source , localizable , atlas , id , repeat , speed , count , in , out , sound , preload ,
151
150
dispose });
152
-
151
+
153
152
addSources ();
154
-
153
+
155
154
// call modelToInputs again to set the correct source
156
- if ( e != null )
155
+ if ( e != null )
157
156
modelToInputs ();
158
157
159
158
setVisible (count , false );
@@ -172,13 +171,15 @@ public void changed(ChangeEvent event, Actor actor) {
172
171
source .setText (e .source );
173
172
} else {
174
173
// If the actor has some animation, set the same source.
175
- HashMap <String , AnimationDesc > animations = ((AnimationRenderer )p .getRenderer ()).getAnimations ();
176
- if (animations .size () > 0 ) {
174
+ HashMap <String , AnimationDesc > animations = ((AnimationRenderer ) p .getRenderer ()).getAnimations ();
175
+ if (animations .size () > 0 ) {
177
176
source .setText (animations .values ().iterator ().next ().source );
177
+ } else {
178
+ // set the background source it atlas type
179
+ if (p .getRenderer () instanceof AtlasRenderer && p .getScene ().getBackgroundAtlas () != null )
180
+ source .setText (p .getScene ().getBackgroundAtlas ());
178
181
}
179
182
}
180
-
181
-
182
183
183
184
if (source .getText () != null && !source .getText ().isEmpty ()) {
184
185
setSource ();
@@ -397,7 +398,7 @@ protected void ok() {
397
398
protected void inputsToModel (boolean create ) {
398
399
399
400
String sourceStr = source .getText ();
400
- AnimationRenderer renderer = (AnimationRenderer )parent .getRenderer ();
401
+ AnimationRenderer renderer = (AnimationRenderer ) parent .getRenderer ();
401
402
402
403
if (create ) {
403
404
@@ -423,8 +424,8 @@ protected void inputsToModel(boolean create) {
423
424
} else {
424
425
HashMap <String , AnimationDesc > animations = renderer .getAnimations ();
425
426
animations .remove (e .id );
426
-
427
- if (e .id .equals (renderer .getInitAnimation ()))
427
+
428
+ if (e .id .equals (renderer .getInitAnimation ()))
428
429
renderer .setInitAnimation (null );
429
430
}
430
431
@@ -439,14 +440,14 @@ protected void inputsToModel(boolean create) {
439
440
e .outD = Param .parseVector2 (out .getText ());
440
441
e .duration = Float .parseFloat (speed .getText ());
441
442
442
- ((AnimationRenderer )parent .getRenderer ()).addAnimation (e );
443
+ ((AnimationRenderer ) parent .getRenderer ()).addAnimation (e );
443
444
444
445
if (renderer instanceof ImageRenderer && Boolean .parseBoolean (localizable .getText ()) && e .source != null
445
446
&& e .source .length () > 0 ) {
446
447
e .source = I18N .PREFIX + e .source ;
447
448
}
448
-
449
- if (renderer .getInitAnimation () == null )
449
+
450
+ if (renderer .getInitAnimation () == null )
450
451
renderer .setInitAnimation (e .id );
451
452
452
453
// TODO UNDO OP
0 commit comments