Ejemplo n.º 1
0
int BPy_Wrap_SetMapItem(IDProperty *prop, PyObject *key, PyObject *val)
{
    if (prop->type != IDP_GROUP) {
        PyErr_SetString(PyExc_TypeError, "unsubscriptable object");
        return -1;
    }

    if (val == NULL) { /* del idprop[key] */
        IDProperty *pkey = IDP_GetPropertyFromGroup(prop, _PyUnicode_AsString(key));
        if (pkey) {
            IDP_FreeFromGroup(prop, pkey);
            return 0;
        }
        else {
            PyErr_SetString(PyExc_KeyError, "property not found in group");
            return -1;
        }
    }
    else {
        bool ok;

        ok = BPy_IDProperty_Map_ValidateAndCreate(key, prop, val);
        if (ok == false) {
            return -1;
        }

        return 0;
    }
}
Ejemplo n.º 2
0
void BKE_ffmpeg_property_del(RenderData *rd, void *type, void *prop_)
{
	struct IDProperty *prop = (struct IDProperty *) prop_;
	IDProperty *group;
	
	if (!rd->ffcodecdata.properties) {
		return;
	}

	group = IDP_GetPropertyFromGroup(rd->ffcodecdata.properties, type);
	if (group && prop) {
		IDP_FreeFromGroup(group, prop);
	}
}
Ejemplo n.º 3
0
void IMB_metadata_set_field(struct IDProperty *metadata, const char *key, const char *value)
{
  BLI_assert(metadata);
  IDProperty *prop = IDP_GetPropertyFromGroup(metadata, key);

  if (prop != NULL && prop->type != IDP_STRING) {
    IDP_FreeFromGroup(metadata, prop);
    prop = NULL;
  }

  if (prop == NULL) {
    prop = IDP_NewString(value, key, METADATA_MAX_VALUE_LENGTH);
    IDP_AddToGroup(metadata, prop);
  }

  IDP_AssignString(prop, value, METADATA_MAX_VALUE_LENGTH);
}