Skip to content

Commit 6a854a5

Browse files
committed
added priorities for property builders.
1 parent 7513d7f commit 6a854a5

File tree

6 files changed

+26
-6
lines changed

6 files changed

+26
-6
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ ext.applicationMainClass = "com.ss.editor.JfxApplication"
2828
ext.applicationVendor = "[email protected]"
2929
ext.applicationTitle = "jMonkeyBuilder"
3030
ext.jmeVersion = "v3.3.dev-SNAPSHOT"
31-
ext.jmbExtVersion = "develop-SNAPSHOT"
31+
ext.jmbExtVersion = "2.1.1"
3232
ext.jme3_xbuf_version = '0.9.1'
3333
ext.junitPlatformVersion = "1.0.0"
3434
ext.junitJupiterVersion = "5.0.0"
Binary file not shown.

src/main/java/com/ss/editor/ui/control/property/builder/PropertyBuilder.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,13 @@ public interface PropertyBuilder {
2626
@FxThread
2727
void buildFor(@NotNull Object object, @Nullable Object parent, @NotNull VBox container,
2828
@NotNull ChangeConsumer changeConsumer);
29+
30+
/**
31+
* Get the priority of this builder.
32+
*
33+
* @return the priority of this builder.
34+
*/
35+
default int getPriority() {
36+
return 0;
37+
}
2938
}

src/main/java/com/ss/editor/ui/control/property/builder/PropertyBuilderRegistry.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ private PropertyBuilderRegistry() {
5656
builders.add(ParticleInfluencerPropertyBuilder.getInstance());
5757
builders.add(EmitterShapePropertyBuilder.getInstance());
5858
builders.add(MaterialSettingsPropertyBuilder.getInstance());
59+
builders.sort((first, second) -> second.getPriority() - first.getPriority());
5960
}
6061

6162
/**
@@ -66,6 +67,7 @@ private PropertyBuilderRegistry() {
6667
@FromAnyThread
6768
public void register(@NotNull final PropertyBuilder builder) {
6869
builders.add(builder);
70+
builders.sort((first, second) -> second.getPriority() - first.getPriority());
6971
}
7072

7173
/**

src/main/java/com/ss/editor/ui/control/property/builder/impl/DefaultControlPropertyBuilder.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
*/
3434
public class DefaultControlPropertyBuilder extends EditableModelObjectPropertyBuilder {
3535

36+
public static final int PRIORITY = 0;
37+
3638
@NotNull
3739
private static final PropertyBuilder INSTANCE = new DefaultControlPropertyBuilder();
3840

@@ -238,4 +240,9 @@ private DefaultControlPropertyBuilder() {
238240

239241
return properties;
240242
}
243+
244+
@Override
245+
public int getPriority() {
246+
return PRIORITY;
247+
}
241248
}

src/main/java/com/ss/editor/ui/control/property/builder/impl/SpatialPropertyBuilder.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
*/
3636
public class SpatialPropertyBuilder extends AbstractPropertyBuilder<ModelChangeConsumer> {
3737

38+
public static final int PRIORITY = 1;
39+
3840
@NotNull
3941
private static final CullHint[] CULL_HINTS = CullHint.values();
4042

@@ -47,11 +49,6 @@ public class SpatialPropertyBuilder extends AbstractPropertyBuilder<ModelChangeC
4749
@NotNull
4850
private static final PropertyBuilder INSTANCE = new SpatialPropertyBuilder();
4951

50-
/**
51-
* Get the single instance.
52-
*
53-
* @return the single instance.
54-
*/
5552
@FromAnyThread
5653
public static @NotNull PropertyBuilder getInstance() {
5754
return INSTANCE;
@@ -268,4 +265,9 @@ private boolean isNeedSkip(@NotNull final String key) {
268265
private boolean canEditTransformation(@NotNull final Spatial spatial) {
269266
return !(spatial instanceof SceneNode || spatial instanceof SceneLayer);
270267
}
268+
269+
@Override
270+
public int getPriority() {
271+
return PRIORITY;
272+
}
271273
}

0 commit comments

Comments
 (0)