Search in sources :

Example 21 with PropertyModelClass

use of net.drewke.tdme.tools.shared.model.PropertyModelClass in project tdme by andreasdr.

the class LevelEditorScreenController method onMapPropertiesSelectionChanged.

/**
	 * Event callback for map properties selection
	 * @param id
	 * @param event
	 */
public void onMapPropertiesSelectionChanged() {
    mapPropertyName.getController().setDisabled(true);
    mapPropertyName.getController().setValue(TEXT_EMPTY);
    mapPropertyValue.getController().setDisabled(true);
    mapPropertyValue.getController().setValue(TEXT_EMPTY);
    mapPropertySave.getController().setDisabled(true);
    mapPropertyRemove.getController().setDisabled(true);
    PropertyModelClass mapProperty = view.getLevel().getProperty(mapPropertiesListBox.getController().getValue().toString());
    if (mapProperty != null) {
        mapPropertyName.getController().setValue(value.set(mapProperty.getName()));
        mapPropertyValue.getController().setValue(value.set(mapProperty.getValue()));
        mapPropertyName.getController().setDisabled(false);
        mapPropertyValue.getController().setDisabled(false);
        mapPropertySave.getController().setDisabled(false);
        mapPropertyRemove.getController().setDisabled(false);
    }
}
Also used : PropertyModelClass(net.drewke.tdme.tools.shared.model.PropertyModelClass)

Example 22 with PropertyModelClass

use of net.drewke.tdme.tools.shared.model.PropertyModelClass in project tdme by andreasdr.

the class LevelEditorScreenController method setMapProperties.

/**
	 * Set up map properties
	 * @param map properties
	 */
public void setMapProperties(Iterable<PropertyModelClass> mapProperties, String selectedName) {
    //
    mapPropertyName.getController().setDisabled(true);
    mapPropertyValue.getController().setDisabled(true);
    mapPropertySave.getController().setDisabled(true);
    // map properties list box inner
    GUIParentNode mapPropertiesListBoxInnerNode = (GUIParentNode) (mapPropertiesListBox.getScreenNode().getNodeById(mapPropertiesListBox.getId() + "_inner"));
    // construct XML for sub nodes
    int idx = 1;
    String mapPropertiesListBoxSubNodesXML = "";
    mapPropertiesListBoxSubNodesXML += "<scrollarea-vertical id=\"" + mapPropertiesListBox.getId() + "_inner_scrollarea\" width=\"100%\" height=\"100%\">\n";
    for (PropertyModelClass mapProperty : mapProperties) {
        mapPropertiesListBoxSubNodesXML += "<selectbox-option text=\"" + GUIParser.escapeQuotes(mapProperty.getName()) + ": " + GUIParser.escapeQuotes(mapProperty.getValue()) + "\" value=\"" + GUIParser.escapeQuotes(mapProperty.getName()) + "\" " + (selectedName != null && mapProperty.getName().equals(selectedName) ? "selected=\"true\" " : "") + "/>\n";
    }
    mapPropertiesListBoxSubNodesXML += "</scrollarea-vertical>\n";
    // inject sub nodes
    try {
        mapPropertiesListBoxInnerNode.replaceSubNodes(mapPropertiesListBoxSubNodesXML, false);
    } catch (Exception e) {
        e.printStackTrace();
    }
    //
    onMapPropertiesSelectionChanged();
}
Also used : PropertyModelClass(net.drewke.tdme.tools.shared.model.PropertyModelClass) GUIParentNode(net.drewke.tdme.gui.nodes.GUIParentNode) MutableString(net.drewke.tdme.utils.MutableString)

Example 23 with PropertyModelClass

use of net.drewke.tdme.tools.shared.model.PropertyModelClass in project tdme by andreasdr.

the class LevelEditorView method setStandardObjectColorEffect.

/**
	 * Set standard object color effect
	 * @param object
	 */
private void setStandardObjectColorEffect(Entity object) {
    ObjectColor color = objectColors.get("none");
    object.getEffectColorAdd().set(color.colorAddR, color.colorAddG, color.colorAddB, 0.0f);
    object.getEffectColorMul().set(color.colorMulR, color.colorMulG, color.colorMulB, 1.0f);
    // color object
    LevelEditorObject levelEditorObject = level.getObjectById(object.getId());
    if (levelEditorObject == null)
        return;
    // try to get object color from object properties
    PropertyModelClass colorProperty = levelEditorObject.getProperty("object.color");
    // try to get object color from model properties
    if (colorProperty == null)
        colorProperty = levelEditorObject.getEntity().getProperty("object.color");
    // handle object color if we have any
    ObjectColor objectColor = colorProperty != null ? objectColors.get(colorProperty.getValue()) : null;
    if (objectColor != null) {
        object.getEffectColorAdd().set(object.getEffectColorAdd().getRed() + objectColor.colorAddR, object.getEffectColorAdd().getGreen() + objectColor.colorAddG, object.getEffectColorAdd().getBlue() + objectColor.colorAddB, 0.0f);
        object.getEffectColorMul().set(object.getEffectColorMul().getRed() * objectColor.colorMulR, object.getEffectColorMul().getGreen() * objectColor.colorMulG, object.getEffectColorMul().getBlue() * objectColor.colorMulB, 1.0f);
    }
}
Also used : PropertyModelClass(net.drewke.tdme.tools.shared.model.PropertyModelClass) LevelEditorObject(net.drewke.tdme.tools.shared.model.LevelEditorObject)

Aggregations

PropertyModelClass (net.drewke.tdme.tools.shared.model.PropertyModelClass)23 LevelEditorObject (net.drewke.tdme.tools.shared.model.LevelEditorObject)9 LevelEditorEntity (net.drewke.tdme.tools.shared.model.LevelEditorEntity)7 Entity (net.drewke.tdme.engine.Entity)6 FacesEntity (net.drewke.tdme.engine.model.FacesEntity)5 Vector3 (net.drewke.tdme.math.Vector3)5 BoundingVolume (net.drewke.tdme.engine.primitives.BoundingVolume)3 GUIParentNode (net.drewke.tdme.gui.nodes.GUIParentNode)3 MutableString (net.drewke.tdme.utils.MutableString)3 File (java.io.File)2 IOException (java.io.IOException)2 Object3D (net.drewke.tdme.engine.Object3D)2 Transformations (net.drewke.tdme.engine.Transformations)2 JSONArray (org.json.JSONArray)2 JSONObject (org.json.JSONObject)2 FileOutputStream (java.io.FileOutputStream)1 PrintStream (java.io.PrintStream)1 ObjectParticleSystemEntity (net.drewke.tdme.engine.ObjectParticleSystemEntity)1 PointsParticleSystemEntity (net.drewke.tdme.engine.PointsParticleSystemEntity)1 Rotation (net.drewke.tdme.engine.Rotation)1