16 if (!
object)
return nullptr;
17 const auto found =
object->find(
key);
18 return found ==
object->end() ? nullptr : &
found->second;
23 return entry ? entry->
getIf<std::string>() :
nullptr;
27 const auto* entry = field(
value,
key);
32 return std::isfinite(
output);
38 if (!readNumber(
value,
key, parsed,
true) || parsed < -100000.0 || parsed > 100000.0)
return false;
39 output =
static_cast<int>(parsed);
46 const auto* flag = entry->
getIf<
bool>();
47 if (!flag)
return false;
68 const std::string&
type) {
76 selection.
items.push_back(row);
85 "Biome target rejected the planned edit");
87 plan.operations.push_back(std::move(
operation).takeValue());
88 plan.summary = std::move(summary);
89 return eve::editing::applied<editing::CommandPlan>(std::move(plan));
95 auto registered = addCommand(
96 registry,
"biome.layer.create.v1",
"Create biome layer",
99 const std::string*
id = stringField(
request.payload,
"id");
100 const std::string*
spatial = stringField(
request.payload,
"spatial");
102 return eve::editing::failed<editing::CommandPlan>(editing::Status::Rejected,
104 "Biome layer create requires id and spatial asset");
105 const std::string*
name = stringField(
request.payload,
"name");
113 if (!readInt(
request.payload,
"priority",
layer.priority,
false) ||
115 return eve::editing::failed<editing::CommandPlan>(editing::Status::Rejected,
117 "Biome layer priority and density must be numbers");
121 if (!registered.ok())
return registered;
123 registered = addCommand(
124 registry,
"biome.asset.create.v1",
"Create biome asset",
127 const std::string*
layer = stringField(
request.payload,
"layer");
128 const std::string*
id = stringField(
request.payload,
"id");
129 const std::string* asset = stringField(
request.payload,
"asset");
130 if (!
biome || !
layer ||
layer->empty() || !
id ||
id->empty() || !asset || asset->empty())
131 return eve::editing::failed<editing::CommandPlan>(editing::Status::Rejected,
133 "Biome asset create requires layer, id and asset");
134 BiomeAssetValue entry;
136 entry.asset = *asset;
137 double weight = 1.0, minScale = 1.0, maxScale = 1.0;
139 !readNumber(
request.payload,
"minScale", minScale,
false) ||
140 !readNumber(
request.payload,
"maxScale", maxScale,
false) ||
141 !readBool(
request.payload,
"randomYaw", entry.randomYaw,
false))
142 return eve::editing::failed<editing::CommandPlan>(editing::Status::Rejected,
144 "Biome asset weight, scale and yaw must be valid");
145 entry.weight =
static_cast<float>(
weight);
146 entry.minScale =
static_cast<float>(minScale);
147 entry.maxScale =
static_cast<float>(maxScale);
151 if (!registered.ok())
return registered;
154 registry,
"biome.property.set.v1",
"Set biome property",
155 [](editing::IEditableTarget&
target,
const editing::CommandRequest&
request) {
157 auto*
properties =
static_cast<editing::IPropertyProvider*
>(
158 target.queryCapability(BiomeDocumentTarget::propertyCapabilityId()));
159 const std::string* item = stringField(
request.payload,
"item");
160 const std::string*
type = stringField(
request.payload,
"type");
161 const std::string*
path = stringField(
request.payload,
"path");
164 return eve::editing::failed<editing::CommandPlan>(editing::Status::Rejected,
165 editing::RuleId(
"biome.editing.property-payload"),
166 "Biome property requires item, type, path and value");
168 *
value, editing::PropertySetMode::Absolute),
169 editing::Value::Object{{
"item", *item}, {
"path", *
path}});
ActionParameterOperation operation
eve::action::ActionSpatialBinding spatial
const GltfImportRequest & request
std::map< std::string, PropertyRule > properties
const eve::script::BindingContractRegistry & registry
Move-only operation result carrying either a value or Status.
UUID-backed identifier adapter for legacy textual boundaries.
Revisioned BiomeRules asset.
IEditableTarget public API.
Lower-layer registration boundary implemented by an editor or runtime editing host.
Deterministic owning value tree shared by authoring hosts.
std::map< std::string, Value > Object
const T * getIf() const
Return an immediately borrowed typed value.
editing::Result< void > registerEditingCommands(editing::IEditingCommandRegistry ®istry)
Register Biome-owned planned commands with a generic editing host.
const Value * field(const Value &value, const char *key)
Borrow an optional object field.
StrongId< TargetIdTag > TargetId
StrongId< ObjectIdTag > ObjectId
std::function< Result< CommandPlan >(IEditableTarget &, const CommandRequest &)> EditingCommandPlanner
Side-effect-free planner invoked with the resolved target.
StrongId< StableIdTag > StableId
StrongId< CommandIdTag > CommandId
Result< double > numericValue(const Value &value)
Read an Integer or Number as an owning double without applying domain validation.
Stable authored biome layer referencing a spatial asset.
CommandRequest public API.
Domain-owned metadata for one planned editing command.
SelectionItem public API.
SelectionSnapshot public API.
std::vector< SelectionItem > items
std::optional< SelectionItem > primary