From 30521a822ee16b0945370543267f155b710c594b Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 26 Jan 2013 21:22:47 +0000 Subject: Support state:loadDefaultState. git-svn-id: http://svn.drobilla.net/lad/trunk/lilv@5007 a436a847-0d15-0410-975c-d299462d15a1 --- NEWS | 4 +++- src/state.c | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index c5624c2..e79a665 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,8 @@ lilv (0.15.0) unstable; * Add lilv_world_ask() for simply checking if a statement exists * Add lilv_nodes_merge() * Make lilv_plugin_get_port_by_designation() return a const pointer + * Make state loading functions fall back to lv2:default for port values, + so a plugin description can be loaded as default state. * Support atom:supports in lilv_port_supports_event() * Add va_list variant of lilv_plugin_get_num_ports_of_class() * Fix several plugin functions that failed to load data if called first @@ -12,7 +14,7 @@ lilv (0.15.0) unstable; * lilvmm.hpp: Add several missing methods * Update to waf 1.7.8 and autowaf r90 (install docs to versioned directory) - -- David Robillard Sun, 13 Jan 2013 19:32:49 -0500 + -- David Robillard Sat, 26 Jan 2013 16:17:52 -0500 lilv (0.14.4) stable; diff --git a/src/state.c b/src/state.c index 5b7b64b..081aaf0 100644 --- a/src/state.c +++ b/src/state.c @@ -494,6 +494,9 @@ new_state_from_model(LilvWorld* world, const SordNode* label = get1(model, port, world->uris.rdfs_label); const SordNode* symbol = get1(model, port, world->uris.lv2_symbol); const SordNode* value = get1(model, port, world->uris.pset_value); + if (!value) { + value = get1(model, port, world->uris.lv2_default); + } if (!symbol) { LILV_ERRORF("State `%s' port missing symbol.\n", sord_node_get_string(node)); -- cgit v1.2.1