载入中...
搜索中...
未找到
ActionEditingCommands.cpp
浏览该文件的文档.
2
6
8namespace {
9
10const editing::Value* field(const editing::Value& value, const char* key) {
11 const auto* object = value.getIf<editing::Value::Object>();
12 if (!object) return nullptr;
13 const auto found = object->find(key);
14 return found == object->end() ? nullptr : &found->second;
15}
16
19 selection.channel = "asset";
22 item.target = editing::TargetId(target.targetId());
23 item.item = editing::StableId(target.targetId().value());
24 item.type = "action.timeline";
25 selection.items.push_back(item);
26 selection.primary = item;
27 return selection;
28}
29
30editing::PropertySchema actionPropertyPayloadSchema() {
32 schema.typeId = "action.property.set.v1";
33 schema.version = 1;
34 {
37 path.displayNameKey = "Path";
39 schema.properties.push_back(std::move(path));
40 }
41 {
44 value.displayNameKey = "Value";
46 schema.properties.push_back(std::move(value));
47 }
48 return schema;
49}
50
51} // namespace
52
55 descriptor.id = editing::CommandId("action.property.set.v1");
56 descriptor.ownerModule = "action_editor";
57 descriptor.displayName = "Set action timeline property";
58 descriptor.category = "Action";
59 descriptor.automationAllowed = true;
60 descriptor.targetKinds = {"action", "action-timeline"};
61 descriptor.payloadSchema = actionPropertyPayloadSchema();
62 descriptor.panelCapability = "action.timeline";
63 descriptor.panelContext = "inspector";
64 return descriptor;
65}
66
68 return registry.registerPlannedCommand(
71 auto* properties = static_cast<editing::IPropertyProvider*>(
73 const editing::Value* pathValue = field(request.payload, "path");
74 const auto* path = pathValue ? pathValue->getIf<std::string>() : nullptr;
75 const editing::Value* value = field(request.payload, "value");
76 if (!properties || !path || !value)
77 return eve::editing::failed<editing::CommandPlan>(
78 editing::Status::Rejected, editing::RuleId("action.editing.property-payload"),
79 "Action property requires a property target, path and value");
80 auto operation = properties->makeSet(selectionFor(target), editing::PropertyPath(*path), *value,
82 if (!operation.ok())
83 return eve::editing::failed<editing::CommandPlan>(operation.code(),
84 editing::RuleId("action.editing.property-operation"),
85 "Action timeline target rejected the property value");
87 plan.operations.push_back(std::move(operation.value()));
88 plan.summary = editing::Value::Object{{"path", *path}};
89 return eve::editing::applied<editing::CommandPlan>(std::move(plan));
90 });
91}
92
93} // namespace eve::action_editor
LogicalId target
ActionParameterOperation operation
UI-neutral transactional action timeline editor and preview model.
std::string descriptor
SQObjectPtr key
Definition ECS.cpp:155
const GltfImportRequest & request
std::map< std::string, PropertyRule > properties
std::string path
Definition PlayHost.cpp:111
const eve::script::BindingContractRegistry & registry
Object::Ptr value
bool found
Move-only operation result carrying either a value or Status.
Definition Result.h:176
UUID-backed identifier adapter for legacy textual boundaries.
Definition Identity.h:313
IEditableTarget public API.
Lower-layer registration boundary implemented by an editor or runtime editing host.
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::EditingCommandDescriptor actionPropertySetCommandDescriptor()
Metadata for the Action property-set command (shared with EditorPackage).
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.
CommandRequest public API.
Domain-owned metadata for one planned editing command.
PropertyDescriptor public API.
EVENGINE_API_PLATFORM public API.
std::vector< PropertyDescriptor > properties
SelectionItem public API.
SelectionSnapshot public API.
std::vector< SelectionItem > items
std::optional< SelectionItem > primary