Skip to main content
Glama

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
NameRequiredDescriptionDefault
field_typeYes
targetNo
field_nameNo
parametersNo

Implementation Reference

  • 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")

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ttiimmaacc/cinema4d-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server