15 if (!
object)
return nullptr;
16 const auto found =
object->find(
key);
17 return found ==
object->end() ? nullptr : &
found->second;
22 return entry ? entry->
getIf<std::string>() :
nullptr;
28 if (
const auto* real = entry->
getIf<
double>()) {
30 return std::isfinite(
output);
32 if (
const auto* integer = entry->
getIf<std::int64_t>()) {
33 output =
static_cast<double>(*integer);
42 if (!readNumber(
value,
key, parsed,
true) || parsed < -100000.0 || parsed > 100000.0)
return false;
43 output =
static_cast<int>(parsed);
50 const auto* flag = entry->
getIf<
bool>();
51 if (!flag)
return false;
72 const std::string&
type) {
80 selection.
items.push_back(row);
89 "Biome target rejected the planned edit");
92 plan.
summary = std::move(summary);
93 return eve::editing::applied<editing::CommandPlan>(std::move(plan));
99 auto registered = addCommand(
100 registry,
"biome.layer.create.v1",
"Create biome layer",
103 const std::string*
id = stringField(
request.payload,
"id");
104 const std::string*
spatial = stringField(
request.payload,
"spatial");
106 return eve::editing::failed<editing::CommandPlan>(editing::Status::Rejected,
108 "Biome layer create requires id and spatial asset");
109 const std::string*
name = stringField(
request.payload,
"name");
116 double density = 1.0;
117 if (!readInt(
request.payload,
"priority",
layer.priority,
false) ||
118 !readNumber(
request.payload,
"density", density,
false))
119 return eve::editing::failed<editing::CommandPlan>(editing::Status::Rejected,
121 "Biome layer priority and density must be numbers");
122 layer.density =
static_cast<float>(density);
125 if (!registered.ok())
return registered;
127 registered = addCommand(
128 registry,
"biome.asset.create.v1",
"Create biome asset",
131 const std::string*
layer = stringField(
request.payload,
"layer");
132 const std::string*
id = stringField(
request.payload,
"id");
133 const std::string* asset = stringField(
request.payload,
"asset");
134 if (!
biome || !
layer ||
layer->empty() || !
id ||
id->empty() || !asset || asset->empty())
135 return eve::editing::failed<editing::CommandPlan>(editing::Status::Rejected,
137 "Biome asset create requires layer, id and asset");
138 BiomeAssetValue entry;
140 entry.asset = *asset;
141 double weight = 1.0, minScale = 1.0, maxScale = 1.0;
143 !readNumber(
request.payload,
"minScale", minScale,
false) ||
144 !readNumber(
request.payload,
"maxScale", maxScale,
false) ||
145 !readBool(
request.payload,
"randomYaw", entry.randomYaw,
false))
146 return eve::editing::failed<editing::CommandPlan>(editing::Status::Rejected,
148 "Biome asset weight, scale and yaw must be valid");
149 entry.weight =
static_cast<float>(
weight);
150 entry.minScale =
static_cast<float>(minScale);
151 entry.maxScale =
static_cast<float>(maxScale);
155 if (!registered.ok())
return registered;
158 registry,
"biome.property.set.v1",
"Set biome property",
159 [](editing::IEditableTarget&
target,
const editing::CommandRequest&
request) {
161 auto*
properties =
static_cast<editing::IPropertyProvider*
>(
162 target.queryCapability(BiomeDocumentTarget::propertyCapabilityId()));
163 const std::string* item = stringField(
request.payload,
"item");
164 const std::string*
type = stringField(
request.payload,
"type");
165 const std::string*
path = stringField(
request.payload,
"path");
168 return eve::editing::failed<editing::CommandPlan>(editing::Status::Rejected,
169 editing::RuleId(
"biome.editing.property-payload"),
170 "Biome property requires item, type, path and value");
172 *
value, editing::PropertySetMode::Absolute),
173 editing::Value::Object{{
"item", *item}, {
"path", *
path}});
ActionParameterOperation operation
eve::action::ActionSpatialBinding spatial
const GltfImportRequest & request
std::map< std::string, PropertyRule > properties
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.
virtual Result< void > registerPlannedCommand(EditingCommandDescriptor descriptor, EditingCommandPlanner planner)=0
Register or replace one domain-owned planned command.
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.
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
const EditorValue * field(const EditorValue &value, const char *name)
Stable authored biome layer referencing a spatial asset.
std::vector< DomainOperation > operations
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