commit
410b95ac41
|
|
@ -66,13 +66,15 @@ namespace UnityMcpBridge.Editor.Tools
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static object ExecuteItem(JObject @params)
|
private static object ExecuteItem(JObject @params)
|
||||||
{
|
{
|
||||||
string menuPath = @params["menu_path"]?.ToString();
|
// Try both naming conventions: snake_case and camelCase
|
||||||
|
string menuPath = @params["menu_path"]?.ToString() ?? @params["menuPath"]?.ToString();
|
||||||
|
|
||||||
// string alias = @params["alias"]?.ToString(); // TODO: Implement alias mapping based on refactor plan requirements.
|
// string alias = @params["alias"]?.ToString(); // TODO: Implement alias mapping based on refactor plan requirements.
|
||||||
// JObject parameters = @params["parameters"] as JObject; // TODO: Investigate parameter passing (often not directly supported by ExecuteMenuItem).
|
// JObject parameters = @params["parameters"] as JObject; // TODO: Investigate parameter passing (often not directly supported by ExecuteMenuItem).
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(menuPath))
|
if (string.IsNullOrWhiteSpace(menuPath))
|
||||||
{
|
{
|
||||||
return Response.Error("Required parameter 'menu_path' is missing or empty.");
|
return Response.Error("Required parameter 'menu_path' or 'menuPath' is missing or empty.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate against blacklist
|
// Validate against blacklist
|
||||||
|
|
|
||||||
|
|
@ -891,6 +891,29 @@ namespace UnityMcpBridge.Editor.Tools
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (properties["_Color"] is JArray colorArr) //Current Prevention for systems that use _Color instead of color
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
if (colorArr.Count >= 3)
|
||||||
|
{
|
||||||
|
Color newColor = new Color(
|
||||||
|
colorArr[0].ToObject<float>(),
|
||||||
|
colorArr[1].ToObject<float>(),
|
||||||
|
colorArr[2].ToObject<float>(),
|
||||||
|
colorArr.Count > 3 ? colorArr[3].ToObject<float>() : 1.0f
|
||||||
|
);
|
||||||
|
if (mat.HasProperty(propName) && mat.GetColor(propName) != newColor)
|
||||||
|
{
|
||||||
|
mat.SetColor(propName, newColor);
|
||||||
|
modified = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex) {
|
||||||
|
Debug.LogWarning(
|
||||||
|
$"Error parsing color property '{propName}': {ex.Message}"
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Example: Set float property
|
// Example: Set float property
|
||||||
if (properties["float"] is JObject floatProps)
|
if (properties["float"] is JObject floatProps)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue