ultimate-unreal-engine-mcp 0.1.13 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -120,20 +120,25 @@ export function registerEditorTools(server, bridge) {
|
|
|
120
120
|
property_name: z.string().describe('The UPROPERTY name to set (e.g., RoomID, RoomDoor, DoorCurve)'),
|
|
121
121
|
value: z.union([z.string(), z.number(), z.boolean()]).describe('The value to set — string for name/text/actor label/asset path, number for int/float, boolean for bool'),
|
|
122
122
|
value_type: z.enum(['bool', 'int', 'float', 'string', 'name', 'text', 'actor', 'asset']).describe('Type of the value'),
|
|
123
|
+
component_name: z.string().optional().describe('Optional subcomponent name (e.g. DoorMesh) to set the property on instead of the actor'),
|
|
123
124
|
}),
|
|
124
125
|
annotations: {
|
|
125
126
|
readOnlyHint: false,
|
|
126
127
|
destructiveHint: false,
|
|
127
128
|
},
|
|
128
129
|
}, withKnownIssues('ue_set_actor_property', async (args) => {
|
|
130
|
+
const payload = {
|
|
131
|
+
actor_label: args.actor_label,
|
|
132
|
+
property_name: args.property_name,
|
|
133
|
+
value: args.value,
|
|
134
|
+
value_type: args.value_type,
|
|
135
|
+
};
|
|
136
|
+
if (args.component_name) {
|
|
137
|
+
payload['component_name'] = args.component_name;
|
|
138
|
+
}
|
|
129
139
|
return sendOrDisconnect(_bridge, {
|
|
130
140
|
type: 'actor.setProperty',
|
|
131
|
-
payload
|
|
132
|
-
actor_label: args.actor_label,
|
|
133
|
-
property_name: args.property_name,
|
|
134
|
-
value: args.value,
|
|
135
|
-
value_type: args.value_type,
|
|
136
|
-
},
|
|
141
|
+
payload,
|
|
137
142
|
});
|
|
138
143
|
}));
|
|
139
144
|
// --------------------------------------------------------------------------
|
package/package.json
CHANGED
|
@@ -478,8 +478,35 @@ void RegisterActorCommands(FMCPCommandRouter& Router)
|
|
|
478
478
|
return;
|
|
479
479
|
}
|
|
480
480
|
|
|
481
|
-
//
|
|
482
|
-
|
|
481
|
+
// Optional component_name — if set, resolve property on the named component
|
|
482
|
+
// instead of the actor itself. Enables "DoorMesh" + "StaticMesh" patterns.
|
|
483
|
+
UObject* PropertyOwner = TargetActor;
|
|
484
|
+
FString ComponentName;
|
|
485
|
+
if (Payload->TryGetStringField(TEXT("component_name"), ComponentName) && !ComponentName.IsEmpty())
|
|
486
|
+
{
|
|
487
|
+
UActorComponent* Comp = TargetActor->FindComponentByClass<UActorComponent>();
|
|
488
|
+
// Search all components by their subobject name.
|
|
489
|
+
TInlineComponentArray<UActorComponent*> Components;
|
|
490
|
+
TargetActor->GetComponents(Components);
|
|
491
|
+
UActorComponent* FoundComp = nullptr;
|
|
492
|
+
for (UActorComponent* C : Components)
|
|
493
|
+
{
|
|
494
|
+
if (C && C->GetName() == ComponentName)
|
|
495
|
+
{
|
|
496
|
+
FoundComp = C;
|
|
497
|
+
break;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
if (!FoundComp)
|
|
501
|
+
{
|
|
502
|
+
SendResponse(BuildActorErrorResponse(CorrId, TEXT("component_not_found")) + TEXT("\n"));
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
PropertyOwner = FoundComp;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
// Find the UPROPERTY by name on the target object's class.
|
|
509
|
+
FProperty* Prop = PropertyOwner->GetClass()->FindPropertyByName(FName(*PropertyName));
|
|
483
510
|
if (!Prop)
|
|
484
511
|
{
|
|
485
512
|
SendResponse(BuildActorErrorResponse(CorrId, TEXT("property_not_found")) + TEXT("\n"));
|
|
@@ -487,7 +514,7 @@ void RegisterActorCommands(FMCPCommandRouter& Router)
|
|
|
487
514
|
}
|
|
488
515
|
|
|
489
516
|
TargetActor->Modify();
|
|
490
|
-
void* ValuePtr = Prop->ContainerPtrToValuePtr<void>(
|
|
517
|
+
void* ValuePtr = Prop->ContainerPtrToValuePtr<void>(PropertyOwner);
|
|
491
518
|
|
|
492
519
|
if (ValueType == TEXT("bool"))
|
|
493
520
|
{
|