Repository: 4ian/GDevelop
File: newIDE/app/src/PropertiesEditor/PropertiesMapToSchema.js (JavaScript)

Code before:
        onUpdateProperty(instance, name, newValue);
      },
      getLabel,
      getDescription,
    };
  } else if (valueType === 'textarea') {
    return {
      name,
      valueType: 'textarea',
      getValue: (instance: Instance): string => {
        return getProperties(instance)
          .get(name)
          .getValue();
      },
      setValue: (instance: Instance, newValue: string) => {
        onUpdateProperty(instance, name, newValue);
      },
      getLabel,
      getDescription,
    };
  } else if(valueType ==='animationname')
    {
      function getChoices()
    {
      if(!object)
      { return [{value:"Object is not valid !", label:"Object is not valid !"}] }

      let animationArray = [];
      for(let i = 0; i < object.getConfiguration().getAnimationsCount(); i++ )
      {
          animationArray.push(object.getConfiguration().getAnimationName(i));
      }
        return animationArray.map(value => ({ value, label: value }));
   
    }
      return {
        name,
        valueType: 'string',
        getValue: (instance: Instance): string => {
          return getProperties(instance)
            .get(name)
            .getValue();
        },
        setValue: (instance: Instance, newValue: string) => {
          console.log(instance, name, newValue);
          onUpdateProperty(instance, name, newValue);
        },
        getLabel,
        getDescription,
        getChoices,
      }

Review comment (suggestion):
The editor should ensure it never happens.
If we only allow to define "AnimationName" properties in the "Behavior properties" tab here (and not in "Scene properties"):
![image](https://github.com/user-attachments/assets/099c544f-9d8d-4b86-b78e-0494f1d43319)

 There should always be an object when a behavior propeties values are edited. So, it should be fine to return an empty Array.

Code after:
        onUpdateProperty(instance, name, newValue);
      },
      getLabel,
      getDescription,
    };
  } else if (valueType === 'textarea') {
    return {
      name,
      valueType: 'textarea',
      getValue: (instance: Instance): string => {
        return getProperties(instance)
          .get(name)
          .getValue();
      },
      setValue: (instance: Instance, newValue: string) => {
        onUpdateProperty(instance, name, newValue);
      },
      getLabel,
      getDescription,
    };
  } else if (valueType === 'animationname') {
    return {
      getChoices: () => {
        if (!object) {
          return [];
        }
        const animationArray = mapFor(
          0,
          object.getConfiguration().getAnimationsCount(),
          i => {
            const animationName = object.getConfiguration().getAnimationName(i);
            if (animationName === '') {
              return null;
            }
            return {
              value: animationName,
              label: animationName,
            };
          }
        ).filter(Boolean);
        animationArray.push({ value: '', label: '(no animation)' });
        return animationArray;
      },
      name,
      valueType: 'string',
      getValue: (instance: Instance): string => {
        return getProperties(instance)
          .get(name)
          .getValue();
      },
      setValue: (instance: Instance, newValue: string) => {