载入中...
搜索中...
未找到
ActionEditingCommands.cpp
浏览该文件的文档.
2
5
7namespace {
8
9const editing::Value* field(const editing::Value& value, const char* key) {
10 const auto* object = value.getIf<editing::Value::Object>();
11 if (!object) return nullptr;
12 const auto found = object->find(key);
13 return found == object->end() ? nullptr : &found->second;
14}
15
18 selection.channel = "asset";
21 item.target = editing::TargetId(target.targetId());
22 item.item = editing::StableId(target.targetId().value());
23 item.type = "action.timeline";
24 selection.items.push_back(item);
25 selection.primary = item;
26 return selection;
27}
28
29} // namespace
30
33 descriptor.id = editing::CommandId("action.property.set.v1");
34 descriptor.ownerModule = "action_editor";
35 descriptor.displayName = "Set action timeline property";
36 descriptor.category = "Action";
37 descriptor.automationAllowed = true;
38 return registry.registerPlannedCommand(
40 auto* properties = static_cast<editing::IPropertyProvider*>(
42 const editing::Value* pathValue = field(request.payload, "path");
43 const auto* path = pathValue ? pathValue->getIf<std::string>() : nullptr;
44 const editing::Value* value = field(request.payload, "value");
45 if (!properties || !path || !value)
46 return eve::editing::failed<editing::CommandPlan>(
47 editing::Status::Rejected, editing::RuleId("action.editing.property-payload"),
48 "Action property requires a property target, path and value");
49 auto operation = properties->makeSet(selectionFor(target), editing::PropertyPath(*path), *value,
51 if (!operation.ok())
52 return eve::editing::failed<editing::CommandPlan>(operation.code(),
53 editing::RuleId("action.editing.property-operation"),
54 "Action timeline target rejected the property value");
56 plan.operations.push_back(std::move(operation.value()));
57 plan.summary = editing::Value::Object{{"path", *path}};
58 return eve::editing::applied<editing::CommandPlan>(std::move(plan));
59 });
60}
61
62} // namespace eve::action_editor
LogicalId target
ActionParameterOperation operation
double value
UI-neutral transactional action timeline editor and preview model.
std::string descriptor
const GltfImportRequest & request
std::uint32_t key
std::map< std::string, PropertyRule > properties
std::string path
Definition PlayHost.cpp:110
bool found
Move-only operation result carrying either a value or Status.
Definition Result.h:155
UUID-backed identifier adapter for legacy textual boundaries.
Definition Identity.h:314
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.
UI-independent property access for an immutable selection snapshot.
Dotted property path (layout.size) compared and persisted as text.
Definition EditingIds.h:78
Deterministic owning value tree shared by authoring hosts.
std::map< std::string, Value > Object
const T * getIf() const
Return an immediately borrowed typed value.
static CapabilityId propertyCapabilityId()
Capability identity published by describe() for Inspector property editing.
editing::Result< void > registerEditingCommands(editing::IEditingCommandRegistry &registry)
Register Action-owned property commands with a generic editing host.
StrongId< TargetIdTag > TargetId
Definition EditingIds.h:57
StrongId< StableIdTag > StableId
Definition EditingIds.h:64
StrongId< CommandIdTag > CommandId
Definition EditingIds.h:58
CommandPlan public API.
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