Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property panel not updating bug #383

Open
wants to merge 1 commit into
base: talos-3d
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1119,38 +1119,30 @@ public void onGameObjectSelectionChanged (GameObjectSelectionChanged event) {

if (event.get().size == 1) { //Only select gizmos if one is selected
selectGizmos(gameObjects);
} else {
} else if(event.get().size > 1){
unselectGizmos();
groupSelectionGizmo.setSelected(true);
showPropertyPanelForGameObjects(gameObjects);
}

// now for properties

if (gameObjects.size == 0) {
// we select the main container then
if (currentContainer instanceof Scene) {
Scene scene = (Scene) currentContainer;
selectPropertyHolder(PropertyWrapperProviders.getOrCreateHolder(scene));
} else if (currentContainer instanceof Prefab) {
Prefab prefab = (Prefab) currentContainer;
selectPropertyHolder(PropertyWrapperProviders.getOrCreateHolder(prefab));
}
} else {
mapEditorState.update(event);
}

public void showPropertyPanelForGameObjects(ObjectSet<GameObject> gameObjects) {
if (gameObjects.size == 1) {
selectPropertyHolder(PropertyWrapperProviders.getOrCreateHolder(gameObjects.first()));
} else {
} else if(gameObjects.size > 1){
ObjectSet<IPropertyHolder> tempList = new ObjectSet<>();
for (GameObject gameObject : gameObjects) {
tempList.add(PropertyWrapperProviders.getOrCreateHolder(gameObject));
}
selectPropertyHolder(PropertyWrapperProviders.getOrCreateHolder(new MultiPropertyHolder<>(tempList)));
if(aligningToolsPane.getParent() == null) {
if (aligningToolsPane.getParent() == null) {
groupSelectionGizmo.getViewportWidget().addActor(aligningToolsPane);
}
}
}

mapEditorState.update(event);
}

@EventHandler
Expand Down Expand Up @@ -1500,11 +1492,22 @@ public void performSelectionClear() {
Notifications.fireEvent(gameObjectSelectionChanged);
}

@EventHandler
public void onGameAssetOpened (GameAssetOpenEvent gameAssetOpenEvent) {
GameAsset<?> gameAsset = gameAssetOpenEvent.getGameAsset();
if (gameAsset.type == GameAssetType.SCENE) {
this.gameAsset = (GameAsset<Scene>) gameAsset;
@Override
protected void onGizmoTouch(Gizmo hitGizmo, float x, float y, int button) {
super.onGizmoTouch(hitGizmo, x, y, button);
showPropertyPanelForGameObjects(selection);
}

@Override
protected void onEmptyAreaTouch() {
super.onEmptyAreaTouch();

if (currentContainer instanceof Scene) {
Scene scene = (Scene) currentContainer;
selectPropertyHolder(PropertyWrapperProviders.getOrCreateHolder(scene));
} else if (currentContainer instanceof Prefab) {
Prefab prefab = (Prefab) currentContainer;
selectPropertyHolder(PropertyWrapperProviders.getOrCreateHolder(prefab));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ public void onMetaDataReloadedEvent (MetaDataReloadedEvent event) {
}

public void showPanel (IPropertyHolder target, Iterable<IPropertyProvider> propertyProviders) {
if (currentPropertyHolder != null && currentPropertyHolder.equals(target))
return;
providerSet.clear();
for(IPropertyProvider propertyProvider: propertyProviders) {
if(propertyProvider.getType() == null) continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ public boolean touchDown (InputEvent event, float x, float y, int pointer, int b
hitGizmo = hitGizmoGameObject(hitCords.x, hitCords.y, selection.first());

if (hitGizmo != null) {
hitGizmo.touchDown(hitCords.x, hitCords.y, button);
onGizmoTouch(hitGizmo, hitCords.x, hitCords.y, button);
}

event.stop();
Expand All @@ -469,7 +469,7 @@ public boolean touchDown (InputEvent event, float x, float y, int pointer, int b

hitGizmo = testGizmo;

hitGizmo.touchDown(hitCords.x, hitCords.y, button);
onGizmoTouch(hitGizmo, hitCords.x, hitCords.y, button);
event.stop();
return true;

Expand All @@ -489,11 +489,13 @@ public boolean touchDown (InputEvent event, float x, float y, int pointer, int b
selectGameObject(entityUnderMouse);

if (hitGizmo != null) {
hitGizmo.touchDown(hitCords.x, hitCords.y, button);
onGizmoTouch(hitGizmo, hitCords.x, hitCords.y, button);
}
getStage().setKeyboardFocus(ViewportWidget.this);
event.handle();
return true;
}else{
onEmptyAreaTouch();
}
}

Expand All @@ -513,7 +515,7 @@ public boolean touchDown (InputEvent event, float x, float y, int pointer, int b
selectGameObject(touchDownedGameObject);

if (hitGizmo != null) {
hitGizmo.touchDown(hitCords.x, hitCords.y, button);
onGizmoTouch(hitGizmo, hitCords.x, hitCords.y, button);
}
getStage().setKeyboardFocus(ViewportWidget.this);
event.handle();
Expand All @@ -524,11 +526,12 @@ public boolean touchDown (InputEvent event, float x, float y, int pointer, int b
if (canTouchGizmo(hitGizmo)) {

selectGameObject(hitGizmo.getGameObject());

hitGizmo.touchDown(hitCords.x, hitCords.y, button);
onGizmoTouch(hitGizmo, hitCords.x, hitCords.y, button);
getStage().setKeyboardFocus(ViewportWidget.this);
event.handle();
return true;
} else {
onEmptyAreaTouch();
}
}

Expand Down Expand Up @@ -1400,4 +1403,11 @@ public void moveSelectedObjectsByPixels (float x, float y) {
}
SceneUtils.componentBatchUpdated(selection.orderedItems().get(0).getGameObjectContainerRoot(), selection.orderedItems(), TransformComponent.class, false);
}

protected void onGizmoTouch(Gizmo hitGizmo, float x, float y, int button) {
hitGizmo.touchDown(x, y, button);
}

protected void onEmptyAreaTouch() {
}
}