use of net.drewke.tdme.tools.shared.model.PropertyModelClass in project tdme by andreasdr.
the class ModelViewerView method updateGUIElements.
/**
* Init GUI elements
*/
public void updateGUIElements() {
if (entity != null) {
modelViewerScreenController.setScreenCaption("Model Viewer - " + (entity.getEntityFileName() != null ? Tools.getFileName(entity.getEntityFileName()) : Tools.getFileName(entity.getFileName())));
PropertyModelClass preset = entity.getProperty("preset");
modelViewerScreenController.setEntityProperties(preset != null ? preset.getValue() : null, entity.getProperties(), null);
modelViewerScreenController.setEntityData(entity.getName(), entity.getDescription());
modelViewerScreenController.setPivot(entity.getPivot());
entityBoundingVolumeView.setBoundingVolumes(entity);
} else {
modelViewerScreenController.setScreenCaption("Model Viewer - no entity loaded");
modelViewerScreenController.unsetEntityProperties();
modelViewerScreenController.unsetEntityData();
modelViewerScreenController.unsetPivot();
entityBoundingVolumeView.unsetBoundingVolumes();
}
}
use of net.drewke.tdme.tools.shared.model.PropertyModelClass in project tdme by andreasdr.
the class ParticleSystemView method updateGUIElements.
/**
* Init GUI elements
*/
public void updateGUIElements() {
if (entity != null) {
particleSystemScreenController.setScreenCaption("Particle System - " + (entity.getEntityFileName() != null ? Tools.getFileName(entity.getEntityFileName()) : entity.getName()));
PropertyModelClass preset = entity.getProperty("preset");
particleSystemScreenController.setEntityProperties(preset != null ? preset.getValue() : null, entity.getProperties(), null);
particleSystemScreenController.setEntityData(entity.getName(), entity.getDescription());
entityBoundingVolumeView.setBoundingVolumes(entity);
} else {
particleSystemScreenController.setScreenCaption("Particle System - no entity loaded");
particleSystemScreenController.unsetEntityProperties();
particleSystemScreenController.unsetEntityData();
entityBoundingVolumeView.unsetBoundingVolumes();
}
}
use of net.drewke.tdme.tools.shared.model.PropertyModelClass in project tdme by andreasdr.
the class LevelEditorView method mapPropertyRemove.
/**
* Remove a map property from model properties
* @param name
* @return success
*/
public boolean mapPropertyRemove(String name) {
// try to remove property
int idx = level.getPropertyIndex(name);
if (idx != -1 && level.removeProperty(name) == true) {
// get property first at index that was removed
PropertyModelClass property = level.getPropertyByIndex(idx);
if (property == null) {
// if current index does not work, take current one -1
property = level.getPropertyByIndex(idx - 1);
}
// reload model properties
levelEditorScreenController.setMapProperties(level.getProperties(), property == null ? null : property.getName());
//
return true;
}
//
return false;
}
use of net.drewke.tdme.tools.shared.model.PropertyModelClass in project tdme by andreasdr.
the class LevelEditorView method objectPropertiesPreset.
/**
* Apply object property preset
* @param preset id
*/
public void objectPropertiesPreset(String presetId) {
if (selectedObjects.size() != 1)
return;
// handle single object
Entity selectedObject = selectedObjects.get(0);
LevelEditorObject levelEditorObject = level.getObjectById(selectedObject.getId());
if (levelEditorObject == null)
return;
// clear object properties
levelEditorObject.clearProperties();
// add object properties by preset if missing
ArrayList<PropertyModelClass> objectPropertyPresetVector = LevelPropertyPresets.getInstance().getObjectPropertiesPresets().get(presetId);
if (objectPropertyPresetVector != null) {
for (PropertyModelClass objectPropertyPreset : objectPropertyPresetVector) {
levelEditorObject.addProperty(objectPropertyPreset.getName(), objectPropertyPreset.getValue());
}
}
// update object properties to gui
levelEditorScreenController.setObjectProperties(presetId, levelEditorObject.getProperties(), null);
}
use of net.drewke.tdme.tools.shared.model.PropertyModelClass in project tdme by andreasdr.
the class LevelEditorView method colorObject.
/**
* Centers selected objects
*/
public void colorObject() {
// skip if no objects selected
if (selectedObjects.size() == 0)
return;
// color selected objects in blue
for (Entity selectedObject : selectedObjects) {
LevelEditorObject levelEditorObject = level.getObjectById(selectedObject.getId());
if (levelEditorObject == null)
continue;
String color = OBJECTCOLOR_NAMES[0];
PropertyModelClass colorProperty = levelEditorObject.getProperty("object.color");
if (colorProperty == null) {
levelEditorObject.addProperty("object.color", color);
} else {
// switch color
color = colorProperty.getValue();
for (int i = 0; i < OBJECTCOLOR_NAMES.length; i++) {
if (color.equalsIgnoreCase(OBJECTCOLOR_NAMES[i])) {
color = OBJECTCOLOR_NAMES[(i + 1) % OBJECTCOLOR_NAMES.length];
break;
}
}
// set up color in object properties
if (color.equals("none")) {
levelEditorObject.removeProperty("object.color");
} else {
levelEditorObject.updateProperty(colorProperty.getName(), "object.color", color);
}
}
setStandardObjectColorEffect(selectedObject);
setHighlightObjectColorEffect(selectedObject);
}
// set object properties if changed
if (selectedObjects.size() == 1) {
Entity selectedObject = selectedObjects.get(0);
if (selectedObject != null && selectedObject.getId().startsWith("leveleditor.") == false) {
LevelEditorObject levelEditorObject = level.getObjectById(selectedObject.getId());
PropertyModelClass preset = levelEditorObject.getProperty("preset");
levelEditorScreenController.setObjectProperties(preset != null ? preset.getValue() : "", levelEditorObject.getProperties(), null);
} else {
levelEditorScreenController.unsetObjectProperties();
}
} else if (selectedObjects.size() > 1) {
levelEditorScreenController.unsetObjectProperties();
}
}
Aggregations