apply_mograph_fields
Create and apply MoGraph fields in Cinema 4D to control object behavior with spherical, box, cylindrical, linear, radial, or noise field types.
Instructions
Create and apply a MoGraph Field.
Args:
field_type: Type of field (spherical, box, cylindrical, linear, radial, noise)
target: Optional target object to apply the field to
field_name: Optional name for the field
parameters: Optional parameters for the field (strength, falloff)Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| field_type | Yes | ||
| target | No | ||
| field_name | No | ||
| parameters | No |
Implementation Reference
- src/cinema4d_mcp/server.py:797-839 (handler)The 'apply_mograph_fields' tool is defined and registered as an MCP tool using the '@mcp.tool()' decorator. It handles creating and applying MoGraph fields in Cinema 4D by sending a command over a connection context.
@mcp.tool() async def apply_mograph_fields( field_type: str, target: Optional[str] = None, field_name: Optional[str] = None, parameters: Optional[Dict[str, Any]] = None, ctx: Context = None, ) -> str: """ Create and apply a MoGraph Field. Args: field_type: Type of field (spherical, box, cylindrical, linear, radial, noise) target: Optional target object to apply the field to field_name: Optional name for the field parameters: Optional parameters for the field (strength, falloff) """ async with c4d_connection_context() as connection: if not connection.connected: return "❌ Not connected to Cinema 4D" # Build the command with required parameters command = {"command": "apply_mograph_fields", "field_type": field_type} # Add optional parameters if target: command["target_name"] = target if field_name: command["field_name"] = field_name if parameters: command["parameters"] = parameters # Log the command for debugging logger.info(f"Sending apply_mograph_fields command: {command}") # Send the command to Cinema 4D response = send_to_c4d(connection, command) if "error" in response: logger.error(f"Error applying field: {response['error']}") return format_c4d_response(response, "apply_mograph_fields")