/**
  * This method loads the properties if they are available and defined for the structure.
  *
  * @param structure the structure we read the properties from
  * @param blenderContext the blender context
  * @return loaded properties or null if they are not available
  * @throws BlenderFileException an exception is thrown when the blend file is somehow corrupted
  */
 protected Properties loadProperties(Structure structure, BlenderContext blenderContext)
     throws BlenderFileException {
   Properties properties = null;
   Structure id = (Structure) structure.getFieldValue("ID");
   if (id != null) {
     Pointer pProperties = (Pointer) id.getFieldValue("properties");
     if (pProperties.isNotNull()) {
       Structure propertiesStructure = pProperties.fetchData().get(0);
       properties = new Properties();
       properties.load(propertiesStructure, blenderContext);
     }
   }
   return properties;
 }
 /**
  * The method applies properties to the given spatial. The Properties instance cannot be directly
  * applied because the end-user might not have the blender plugin jar file and thus receive
  * ClassNotFoundException. The values are set by name instead.
  *
  * @param spatial the spatial that is to have properties applied
  * @param properties the properties to be applied
  */
 public void applyProperties(Spatial spatial, Properties properties) {
   List<String> propertyNames = properties.getSubPropertiesNames();
   if (propertyNames != null && propertyNames.size() > 0) {
     for (String propertyName : propertyNames) {
       Object value = properties.findValue(propertyName);
       if (value instanceof Savable
           || value instanceof Boolean
           || value instanceof String
           || value instanceof Float
           || value instanceof Integer
           || value instanceof Long) {
         spatial.setUserData(propertyName, value);
       } else if (value instanceof Double) {
         spatial.setUserData(propertyName, ((Double) value).floatValue());
       } else if (value instanceof int[]) {
         spatial.setUserData(propertyName, Arrays.toString((int[]) value));
       } else if (value instanceof float[]) {
         spatial.setUserData(propertyName, Arrays.toString((float[]) value));
       } else if (value instanceof double[]) {
         spatial.setUserData(propertyName, Arrays.toString((double[]) value));
       }
     }
   }
 }