Macro Class

Macro System

Class

inc/real/code/r3maccl.h

Description

Macro recording system. Realsoft 3D records number of macro targets, such as "R3PrimLayer" for the geometric primitive layers. Instead of manipulating geometric objects directly via geom. prim layer object, one can call the methods through the macro system to record the calls to macros. Later these macros can be executed again by name. Macros can also be bound to a user interface objects, such as buttons, menus and keys.

Examples:

To call a method through the macro system:

    R3OBJ *macro, prims;

    // fetch the geom. primitive layer from te current project
    R3GetAttrs(currentlayer,
               R3T(R3LAYA_Prims, &prims),
               R3TAG_END);

    // call a a few primlayer methods through the macro system
    R3MAC_SNDMSGA(app, "R3PrimLayer", prims, R3OLAYM_LOCKEXCLUSIVE, NULL, R3MCTP_INT);
    R3MAC_SNDMSGA(app, "R3PrimLayer", prims, R3OLAYM_DELETESELECTION, NULL, R3MCTP_INT);
    R3MAC_SNDMSGA(app, "R3PrimLayer", prims, R3OLAYM_RELEASE, NULL, R3MCTP_INT);

The above code executes the layer method R3OLAYM_DELETESELECTION. If the user had enabled Macro Recording mode, then the above call also creates new current macro.

You can also create macros without actually executing them. To add new event to the current macro:


        // start creating new macro, this clears the current macro
        R3SetAttrs(macro, R3MCT_RecordMode, TRUE, R3TAG_END);

        // add new event to the current macro
        R3Do(macro, R3MCM_ADDMACEVENT,
             R3T(R3MCT_ObjName, "R3PrimLayer"), 
             R3T(R3MCT_ExecMth, R3OLAYM_DELETESELECTION),
             R3T(R3MCT_ExecParam, 0),    // p1 
             R3T(R3MCT_ExecType, R3MCTP_INT),
             R3T(R3MCT_ExecParam, 0),    // p2 
             R3T(R3MCT_ExecType, R3MCTP_INT),
             R3T(R3MCT_ExecParam, 0),    // p3 
             R3T(R3MCT_ExecType, R3MCTP_INT),
             R3TAG_END);

        // clear recording mode and set name for the recorded macro
        R3SetAttrs(macro,
                   R3T(R3MCT_RecordMode, FALSE),
                   R3T(R3MCT_MacroName, "my delete selection"),
                   R3TAG_END);