33import com .jme3 .asset .AssetManager ;
44import com .jme3 .material .Material ;
55import com .jme3 .material .MaterialDef ;
6+ import com .jme3 .renderer .queue .RenderQueue ;
67import com .ss .editor .FileExtensions ;
78import com .ss .editor .Messages ;
89import com .ss .editor .manager .ResourceManager ;
2324import java .nio .file .Files ;
2425import java .nio .file .Path ;
2526
27+ import javafx .collections .FXCollections ;
2628import javafx .collections .ObservableList ;
2729import javafx .event .Event ;
2830import javafx .event .EventHandler ;
@@ -62,6 +64,8 @@ public class MaterialFileEditor extends AbstractFileEditor<StackPane> {
6264
6365 private static final ResourceManager RESOURCE_MANAGER = ResourceManager .getInstance ();
6466
67+ private static final RenderQueue .Bucket [] BUCKETS = RenderQueue .Bucket .values ();
68+
6569 private static final Insets SMALL_OFFSET = new Insets (0 , 0 , 0 , 3 );
6670 private static final Insets BIG_OFFSET = new Insets (0 , 0 , 0 , 6 );
6771
@@ -120,6 +124,11 @@ public class MaterialFileEditor extends AbstractFileEditor<StackPane> {
120124 */
121125 private ToggleButton lightButton ;
122126
127+ /**
128+ * Выпадающий список с выбором RenderQueue.Bucket.
129+ */
130+ private ComboBox <RenderQueue .Bucket > bucketComboBox ;
131+
123132 /**
124133 * Список доступных типов материалов.
125134 */
@@ -378,6 +387,13 @@ protected boolean needToolbar() {
378387 return true ;
379388 }
380389
390+ /**
391+ * @return выпадающий список с выбором RenderQueue.Bucket.
392+ */
393+ private ComboBox <RenderQueue .Bucket > getBucketComboBox () {
394+ return bucketComboBox ;
395+ }
396+
381397 @ Override
382398 protected void createToolbar (final HBox container ) {
383399
@@ -405,13 +421,23 @@ protected void createToolbar(final HBox container) {
405421 materialDefinitionBox .setId (CSSIds .MATERIAL_FILE_EDITOR_TOOLBAR_BOX );
406422 materialDefinitionBox .getSelectionModel ().selectedItemProperty ().addListener ((observable , oldValue , newValue ) -> changeType (newValue ));
407423
424+ final Label bucketLabel = new Label (Messages .MATERIAL_FILE_EDITOR_BUCKET_TYPE_LABEL + ":" );
425+ bucketLabel .setId (CSSIds .MATERIAL_FILE_EDITOR_TOOLBAR_LABEL );
426+
427+ bucketComboBox = new ComboBox <>(FXCollections .observableArrayList (BUCKETS ));
428+ bucketComboBox .setId (CSSIds .MATERIAL_FILE_EDITOR_TOOLBAR_SMALL_BOX );
429+ bucketComboBox .getSelectionModel ().select (RenderQueue .Bucket .Inherit );
430+ bucketComboBox .getSelectionModel ().selectedItemProperty ().addListener ((observable , oldValue , newValue ) -> changeBucketType (newValue ));
431+
408432 FXUtils .addToPane (createSaveAction (), container );
409433 FXUtils .addToPane (cubeButton , container );
410434 FXUtils .addToPane (sphereButton , container );
411435 FXUtils .addToPane (planeButton , container );
412436 FXUtils .addToPane (lightButton , container );
413437 FXUtils .addToPane (materialDefinitionLabel , container );
414438 FXUtils .addToPane (materialDefinitionBox , container );
439+ FXUtils .addToPane (bucketLabel , container );
440+ FXUtils .addToPane (bucketComboBox , container );
415441
416442 FXUtils .addClassTo (cubeButton , CSSClasses .TOOLBAR_BUTTON );
417443 FXUtils .addClassTo (cubeButton , CSSClasses .FILE_EDITOR_TOOLBAR_BUTTON );
@@ -423,12 +449,24 @@ protected void createToolbar(final HBox container) {
423449 FXUtils .addClassTo (lightButton , CSSClasses .FILE_EDITOR_TOOLBAR_BUTTON );
424450 FXUtils .addClassTo (materialDefinitionLabel , CSSClasses .MAIN_FONT_13 );
425451 FXUtils .addClassTo (materialDefinitionBox , CSSClasses .MAIN_FONT_13 );
452+ FXUtils .addClassTo (bucketLabel , CSSClasses .MAIN_FONT_13 );
453+ FXUtils .addClassTo (bucketComboBox , CSSClasses .MAIN_FONT_13 );
426454
427455 HBox .setMargin (cubeButton , SMALL_OFFSET );
428456 HBox .setMargin (sphereButton , SMALL_OFFSET );
429457 HBox .setMargin (planeButton , SMALL_OFFSET );
430458 HBox .setMargin (lightButton , BIG_OFFSET );
431459 HBox .setMargin (materialDefinitionLabel , BIG_OFFSET );
460+ HBox .setMargin (bucketLabel , BIG_OFFSET );
461+ }
462+
463+ /**
464+ * Обработка смны Bucket типа.
465+ */
466+ private void changeBucketType (final RenderQueue .Bucket newValue ) {
467+
468+ final MaterialEditorState editorState = getEditorState ();
469+ editorState .changeBucketType (newValue );
432470 }
433471
434472 /**
0 commit comments