World Preferences Container



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 17/04/2010 at 10:53, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R10+ 
    Platform:   Windows  ; Mac  ;  Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    Howdy,

    I need to get the color from these world preferences:

    In R9.0 through R9.6, those are available with GetWorldContainer().GetVector() and passing either WPREF_ACTIVEPOLYBOX_COL or WPREF_ACTIVEPOLYCHILDBOX_COL as a parameter. This is done in a MessageData() polling for EVMSG_CHANGE, and then storing the colors in global variables for quicker access later when the Draw() function is called for my joint object.

    But from R10 through R11.5, those defines are no where to be found in the api.

    I've been getting around this by adding a couple of custom defines in my own header:

    // defines for compatibility
    #define CD_WPREF_ACTIVEPOLYBOX_COL                    10052 // VECTOR
    #define CD_WPREF_ACTIVEPOLYCHILDBOX_COL               10053 // VECTOR

    ...which are simply copied from R9 and renamed, and that seems to work, I'm guessing because those containers are still active. But I'm wondering if it is OK to do that and if that could cause any problems?

    Adios,
    Cactus Dan



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 17/04/2010 at 11:41, xxxxxxxx wrote:

    See if Get- and SetViewColor(VIEWCOLOR_ACTIVEPOLYGON)
    and Get- and SetViewColor(VIEWCOLOR_INACTIVEPOLYGON)
    can get you there.

    Based on my findings off Background color
    https://plugincafe.maxon.net/topic/3160/2540_script-not-working-in-r10

    Cheers
    Lennart



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 17/04/2010 at 11:51, xxxxxxxx wrote:

    Maybe its the
    VIEWCOLOR_ACTIVECHILDBOX
    VIEWCOLOR_ACTIVEPOLYBOX
    VIEWCOLOR_ACTIVEPOLYCHILDBOX

    Cheers
    Lennart



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 17/04/2010 at 12:32, xxxxxxxx wrote:

    Howdy,

    OK thanks, I see those in the R10+ ge_prepass.h file, but the R10 and R11 SDK documentation explanation of the GetViewColor() function refers you to the COLOR_Constants enum in the c4d_colors.h file. Only the R11.5 SDK documentation explanation of the GetViewColor() function refers you to ge_prepass.h file.

    The main reason I asked the original question, is that all of my plugins are compiled in R9.x, and luckily so far, are still compatible through R11.5, with the exception being the 64bit MacOS version which I have to re-compile in R11.0 on the Mac. But recently, someone reported a frequent crash in R11.5 on Windows XP 64, even when the plugin wasn't being used in the scene, and that could possibly be caused by something in the MessageData() because that is constantly polling for the EVMSG_CHANGE core message. The only function there that gets called even when nothing from the plugin is used in the scene, is the one to get those preference colors and store them in the global variable. So, I'm wondering if that R9 method of getting those colors is still safe to do when the plugin is installed in R11.5.

    Adios,
    Cactus Dan



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 19/04/2010 at 02:22, xxxxxxxx wrote:

    For viewport colors please use VIEWCOLOR_xxx defines.

    VIEWCOLOR_ACTIVEPOLYBOX
    VIEWCOLOR_ACTIVEPOLYCHILDBOX

    Example:

      
    Bool MenuTest::Execute(BaseDocument *doc)  
    {  
      SetViewColor(VIEWCOLOR_ACTIVEPOLYBOX, Vector(1,0,0));  
      
      SpecialEventAdd(MSG_UPDATE_PREFERENCE_DLG, 0, (VULONG)NULL); //updates the preference dialog  
      
      EventAdd(); //updates the other managers  
      
      return TRUE;  
    }  
    

    Make sure to include lib_prefs.h for MSG_UPDATE_PREFERENCE_DLG.

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 19/04/2010 at 07:34, xxxxxxxx wrote:

    Howdy,

    Thanks Matthias.

    Actually, I only need to get those colors to use with bd->SetPen() in my joint object's drawing function, and was curious if the method I was using to stay backward compatible with R9 could be the source of an intermittent crash in R11.5 WindowsXP 64?

    I'm going to change that to use the GetViewColor() and add that to my R10 compatibility library anyway, just to be safe.

    Adios,
    Cactus Dan


Log in to reply