Resource file interpreted incorrectly



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

    On 24/10/2011 at 08:52, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   12 
    Platform:      
    Language(s) :     C++  ;

    ---------
    Hy there,

    here is another annoying problem, I very often run into.

    Here is an excerpt of a resource file:

    LONG NM_SPACE    { CYCLE { NM_SPACE_TANGENT; NM_SPACE_OBJECT; NM_SPACE_WORLD; } }
             LONG NM_ENCODE { CYCLE { NM_ENCODE_TO_NORMAL_MAP_RANGE; NM_ENCODE_NONE; } }
             LONG NM_OUTPUT_FORMAT_MAPPING { CYCLE { NM_8BIT_RGB; NM_16BIT_RGB; NM_32BIT_RGB; } }

    Now, somehow I end up with 3 Drop-Down boxes, but the "NM_ENCODE" and the "NM_OUTPUT_FORMAT_MAPPING" have *both* the values of the NM_OUTPUT_FORMAT_MAPPING!

    The String for the NM_ENCODE is correctly "Encode", but the values of the Drop-Box are the values of the following Box ...

    What can I do to fix this?

    Could the problem be the formatting of my Headerfile? I have seen that style in another file, but now I am not really sure if this could be the source:

    NM_SOMETHING_ELSE = 0,
    NM_SPACE,
          NM_SPACE_TANGENT = 0,
          NM_SPACE_OBJECT,
          NM_SPACE_WORLD,
    NM_OUTPUT_FORMAT_MAPPING,
          NM_8BIT_RGB = 0,
          NM_16BIT_RGB,
          NM_32BIT_RGB,
     
    NM_CAGE_ENABLE,
    NM_CAGE_OFFSET,
    NM_ENCODE,
          NM_ENCODE_TO_NORMAL_MAP_RANGE = 0,
          NM_ENCODE_NONE,
    ...

    Do I have to go through with the numbering?

    Thank you,
    maxx



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

    On 24/10/2011 at 08:57, xxxxxxxx wrote:

    Please post the entries in the resource string and header files.

    cheers,
    Matthias



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

    On 24/10/2011 at 09:01, xxxxxxxx wrote:

    Here they are, note, they are work in progress ... just to mention ;)

    CONTAINER NormalMapper
    {
    NAME NormalMapper;

    GROUP NMID_OPTIONS
    {

    BUTTON NM_INITIALIZE {}
         BUTTON NM_DO_MAPPING {}
        
         GROUP NMID_REFERENCES {
             DEFAULT 1;
             LINK NM_HIGH_RES_OBJECT {}
             LINK NM_LO_RES_OBJECT {}
             LINK NM_UWV_TAG {}
             LINK NM_TEXTURE_TAG {}
         }

    GROUP NMID_MAPPING_OPTIONS
         {
             DEFAULT 1;
             LONG NM_SAMPLES_PER_TEXEL {MIN 1.0;}
             LONG NM_NUMBER_OF_FILTER_PASSES {MIN 1.0;}

    LONG NM_FILTER {CYCLE{
                  NM_F_NONE;
                     NM_F_GAUSS_5x5;
                  NM_F_DILATE_5x5;
                  NM_F_DIFX_3x3;
                  NM_F_DIFY_3x3;
                  NM_F_SMOOTH_I_3x3;
                  NM_F_BLUR_I_3x3;
                  NM_F_BLUR_II_3x3;
                  NM_F_SHARPEN_I_3x3;
                  NM_F_SHARPEN_II_3x3;
                  NM_F_EDGE_ENHANCE_I_3x3;
                  NM_F_EDGE_ENHANCE_II_3x3;
                  NM_F_EDGE_ENHANCE_III_3x3;
                  NM_F_FIND_EDGE_I_3x3;
                  NM_F_FIND_EDGE_II_3x3;
                  NM_F_FIND_EDGE_III_3x3;
                  NM_F_EMBOSS_3x3;
              }}

    LONG NM_SPECIAL_FILTER {CYCLE{
                  NM_SF_NONE;
                  NM_SF_DILATE;
                  NM_SF_ERODE;
              }}
            
             REAL NM_NORMAL_OFFSET {}
             REAL NM_COL_DETECTION_LENGTH {MIN 1.0;}
             REAL NM_VIRTUAL_SIDE_LENGTH {MIN 1.0;}

    }

    GROUP NMID_CAGE_OPTIONS
         {
              DEFAULT 1;
              BOOL NM_CAGE_ENABLE {}
              REAL NM_CAGE_OFFSET {MIN 1.0;}
         }

    GROUP NMID_EXTRA_CHANNELS
         {
              DEFAULT 1;
              BOOL NM_CREATE_HEIGHT_MAP {}
              BOOL NM_BAKE_AO_INTO_HEIGHTMAP {}
              FILENAME NM_AO_MAP {}
         }

    GROUP NMID_OUTPUT_OPTIONS
         {
             DEFAULT 1;
             LONG NM_TEXTURE_WIDTH {MIN 1;}
             LONG NM_TEXTURE_HEIGHT {MIN 1;}
             LONG NM_SPACE    { CYCLE { NM_SPACE_TANGENT; NM_SPACE_OBJECT; NM_SPACE_WORLD; } }
             LONG NM_ENCODE { CYCLE { NM_ENCODE_TO_NORMAL_MAP_RANGE; NM_ENCODE_NONE; } }
             LONG NM_OUTPUT_FORMAT_MAPPING { CYCLE { NM_8BIT_RGB; NM_16BIT_RGB; NM_32BIT_RGB; } }
         
             FILENAME NM_FILENAME {}
             BOOL NM_SAVE_INCREMENTAL {}
             BOOL NM_CREATE_MATERIAL {}
         
         }
    }

    GROUP NMID_CONVERTER
    {
          DEFAULT 1;
          FILENAME NM_CONVERT_SOURCE_MAP {}
          FILENAME NM_CONVERT_TARGET_MAP {}
          LONG NM_OUTPUT_FORMAT_CONVERT { CYCLE { NM_8BIT_RGB;NM_16BIT_RGB; NM_32BIT_RGB; } }
          SEPARATOR {LINE;}
          LONG NM_FILTER_C {CYCLE{
                  NM_F_NONE;
                     NM_F_GAUSS_5x5;
                  NM_F_DILATE_5x5;
                  NM_F_DIFX_3x3;
                  NM_F_DIFY_3x3;
                  NM_F_SMOOTH_I_3x3;
                  NM_F_BLUR_I_3x3;
                  NM_F_BLUR_II_3x3;
                  NM_F_SHARPEN_I_3x3;
                  NM_F_SHARPEN_II_3x3;
                  NM_F_EDGE_ENHANCE_I_3x3;
                  NM_F_EDGE_ENHANCE_II_3x3;
                  NM_F_EDGE_ENHANCE_III_3x3;
                  NM_F_FIND_EDGE_I_3x3;
                  NM_F_FIND_EDGE_II_3x3;
                  NM_F_FIND_EDGE_III_3x3;
                  NM_F_EMBOSS_3x3;
              }}
              BUTTON NM_APPLY_FILTER {}
              BUTTON NM_NORMALIZE {}
    }
    }

    --------------------------------------------------------------------------------------------------------------------
    #ifndef _NORMALMAPPER_H_
    #define _NORMALMAPPER_H_

    enum
    {
      NM_DO_MAPPING = 2000,
      NM_UWV_TAG,
      NM_TEXTURE_TAG,
      NM_LO_RES_OBJECT,
      NM_HIGH_RES_OBJECT,
      NM_INITIALIZE,
      NM_VIRTUAL_SIDE_LENGTH,
      NM_COL_DETECTION_LENGTH,
      NM_NORMAL_OFFSET,
      NM_TEXTURE_WIDTH,
      NM_TEXTURE_HEIGHT,
      NMID_REFERENCES,
      NMID_OPTIONS,
      NMID_MAPPING_OPTIONS,
      NMID_OUTPUT_OPTIONS,
      NMID_CAGE_OPTIONS,
      NM_SPACE,
          NM_SPACE_TANGENT = 0,
          NM_SPACE_OBJECT,
          NM_SPACE_WORLD,
      NM_OUTPUT_FORMAT_MAPPING,
          NM_8BIT_RGB = 0,
          NM_16BIT_RGB,
          NM_32BIT_RGB,
     
      NM_CAGE_ENABLE,
      NM_CAGE_OFFSET,
      NM_ENCODE,
          NM_ENCODE_TO_NORMAL_MAP_RANGE = 0,
          NM_ENCODE_NONE,
      NM_FILENAME,
      NM_SAVE_INCREMENTAL,
      NM_CREATE_MATERIAL,
      NMID_CONVERTER,
      NM_SOURCE_MAP,
      NM_SAVE_AS,
      NMID_EXTRA_CHANNELS,
      NM_CREATE_HEIGHT_MAP,
      NM_BAKE_AO_INTO_HEIGHTMAP,
      NM_AO_MAP,
      NM_SAMPLES_PER_TEXEL,
      NM_DOUBLE_SIZE_INTERNAL_RENDER,
      NM_FILTER,
          NM_F_NONE = 0,
          NM_F_GAUSS_5x5,
          NM_F_DILATE_5x5,
          NM_F_DIFX_3x3,
          NM_F_DIFY_3x3,
          NM_F_SMOOTH_I_3x3,
          NM_F_BLUR_I_3x3,
          NM_F_BLUR_II_3x3,
          NM_F_SHARPEN_I_3x3,
          NM_F_SHARPEN_II_3x3,
          NM_F_EDGE_ENHANCE_I_3x3,
          NM_F_EDGE_ENHANCE_II_3x3,
          NM_F_EDGE_ENHANCE_III_3x3,
          NM_F_FIND_EDGE_I_3x3,
          NM_F_FIND_EDGE_II_3x3,
          NM_F_FIND_EDGE_III_3x3,
          NM_F_EMBOSS_3x3,

    NM_FILTER_C,
      NM_APPLY_FILTER,
      NM_CONVERT_SOURCE_MAP,
      NM_CONVERT_TARGET_MAP,

    NM_SPECIAL_FILTER,
          NM_SF_NONE = 0,
          NM_SF_DILATE,
          NM_SF_ERODE,

    NM_NORMALIZE,
      NM_NUMBER_OF_FILTER_PASSES,
      NM_OUTPUT_FORMAT_CONVERT,

    //////////////////////////////////////////////////////////////////////////
     
      _NORMALMAPPER_END_
    };

    #endif

    -----------------------------------------------------------------------------------------------------------------

    STRINGTABLE NormalMapper
    {
      NormalMapper            "NormalMapper";
      NM_DO_MAPPING            "Bake";
      NM_TEXTURE_TAG            "Texture Tag";
      NM_LO_RES_OBJECT        "Low-Res Object";
      NM_HIGH_RES_OBJECT        "High-Res Object";
      NM_UWV_TAG                "Low-Res UVW Tag";
      NM_INITIALIZE            "DEBUG";
      NM_VIRTUAL_SIDE_LENGTH  "Virtual Side Length";
      NM_NORMAL_OFFSET        "Normal Offset";
      NM_COL_DETECTION_LENGTH "Collision Detction Length";
      NM_TEXTURE_WIDTH        "Texture Width";
      NM_TEXTURE_HEIGHT        "Texture Height";
      NMID_REFERENCES            "References";
      NMID_OPTIONS            "Options";
      NMID_MAPPING_OPTIONS    "Mapping";
      NMID_OUTPUT_OPTIONS        "Output";
      NM_SPACE                "Space";
      NM_SPACE_TANGENT        "Tangent";
      NM_SPACE_OBJECT            "Object";
      NM_SPACE_WORLD            "World";
      NM_OUTPUT_FORMAT_MAPPING "Format";
      NM_8BIT_RGB             "8-Bit RGB";
      NM_16BIT_RGB            "16-Bit RGB";
      NM_32BIT_RGB            "32-Bit RGB";
      NM_ENCODE                "Encoding";
      NM_ENCODE_TO_NORMAL_MAP_RANGE "NormalMap";
      NM_ENCODE_NONE            "None";
      NM_CAGE_ENABLE            "Enable Cage";
      NM_CAGE_OFFSET            "Cage Offset";
      NM_FILENAME                "Output Filename";
      NM_SAVE_INCREMENTAL        "Save Incremental";
      NM_CREATE_MATERIAL        "Create Material on Bake";
      NMID_CONVERTER            "Converter";
      NM_SOURCE_MAP            "Source Map";
      NM_SAVE_AS                "Save As";
      NM_ACTION                "Convert Action";
      NMID_EXTRA_CHANNELS        "Extra Channels";
      NM_CREATE_HEIGHT_MAP    "Create Height-Map";
      NM_BAKE_AO_INTO_HEIGHTMAP    "Bake AO into NormalMap";
      NM_AO_MAP                "AO-Map Filename";
      NM_SAMPLES_PER_TEXEL    "Samples per Texel";
      NM_FILTER_ENABLE_BOX        "Enable Box-Filter";
      NM_FILTER_BOX_WINDOW_SIZE  "Box Window Size";
        NM_FILTER_ENABLE_BOX        "Enable Box Filter";
      NM_DILATION_FILTER_PASSES    "Dilation Filter Passes";
      NM_DOUBLE_SIZE_INTERNAL_RENDER    "Double Sized (internal) Render";
      NM_SAMPLES_PER_TEXEL    "Samples Per Texel";
      NMID_CAGE_OPTIONS        "Cage";
      NM_FILTER                "Filter";
      NM_F_NONE                "None";
      NM_F_GAUSS_5x5            "Gauss 5x5";
      NM_F_DILATE_5x5            "Dilate 5x5";
      NM_F_DIFX_3x3            "Diff. X";
      NM_F_DIFY_3x3            "Diff. Y";
      NM_F_SMOOTH_I_3x3        "Smooth I";
      NM_F_BLUR_I_3x3            "Blur I";
      NM_F_BLUR_II_3x3        "Blur II";
      NM_F_BLUR_III_3x3        "Blur III";
      NM_F_SHARPEN_I_3x3        "Sharpen I";
      NM_F_SHARPEN_II_3x3        "Shapren II";
      NM_F_EDGE_ENHANCE_I_3x3 "Edge Enhance I";
      NM_F_EDGE_ENHANCE_II_3x3 "Edge Enhance II";
      NM_F_EDGE_ENHANCE_III_3x3 "Edge Enhance III";
      NM_F_FIND_EDGE_I_3x3    "Find Edge I";
      NM_F_FIND_EDGE_II_3x3    "Find Edge II";
      NM_F_FIND_EDGE_III_3x3    "Find Edge III";
      NM_F_EMBOSS_3x3            "Emboss";
      NM_FILTER_C                "Filter";
      NM_APPLY_FILTER            "Apply Filter";
      NM_CONVERT_SOURCE_MAP    "Source Image";
      NM_CONVERT_TARGET_MAP    "Save Image As";
      NM_NORMALIZE            "Normalize";
      NM_OUTPUT_FORMAT_CONVERT "Output Format";
      NM_SPECIAL_FILTER        "Contour Filter";
      NM_SF_NONE                "None";
      NM_SF_DILATE            "Dilate";
      NM_SF_ERODE                "Erode";
      NM_NUMBER_OF_FILTER_PASSES "Number of Filter Passes";
    }



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

    On 24/10/2011 at 11:11, xxxxxxxx wrote:

    My immediate reaction is that the style used in the header file is liable to cause problems somewhere. If I understand correctly the use of enum in C++, then some of your symbols are going to have the same value. For example, the following symbols all have the value 3:

    NM_OUTPUT_FORMAT_MAPPING,
        NM_CAGE_ENABLE,
        NM_SAVE_INCREMENTAL,
        NM_NORMALIZE,

    This is because you reset the number to zero at several points (which doesn't matter for the CYCLE drop-downs) but then you let the incremental numbering just carry on into the rest of the symbols. You might get away with this but IMO it's far better to number the symbols explicitly. The compiler will warn you about duplicated values if you do that, it won't with the way you're doing it.

    You could try renumbering them all manually and see if it fixes the problem.



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

    On 25/10/2011 at 10:23, xxxxxxxx wrote:

    Hy spedler,

    thanx for the hint, I did a through numbering now, with good results ;)

    So, never stop numbering ...

    Cheers ,
    maxx



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

    On 26/10/2011 at 01:06, xxxxxxxx wrote:

    As spedler pointed out, explicit numbering is the best way.  Whenever you set a value in an enum, the unset values following it take increments of that value. You ended up with:

    NM_SOMETHING_ELSE = 0,
    NM_SPACE = 1,
          NM_SPACE_TANGENT = 0,
          NM_SPACE_OBJECT = 1,
          NM_SPACE_WORLD = 2,
    NM_OUTPUT_FORMAT_MAPPING = 3,
          NM_8BIT_RGB = 0,
          NM_16BIT_RGB = 1,
          NM_32BIT_RGB = 2,

    NM_CAGE_ENABLE = 3,
    NM_CAGE_OFFSET = 4,
    NM_ENCODE = 5,
          NM_ENCODE_TO_NORMAL_MAP_RANGE = 0,
          NM_ENCODE_NONE = 1,

    For Description IDs, I always start at either 1000 or 2000 and make every one explicit.  This way you can avoid these type of auto-errors.


Log in to reply