Solved The console does not correctly recognize object properties

My program ran fine, but when I dragged the object properties to the console, it returned the wrong value.It's very confusing.
Please help me, thank you!
20200301085146.png

.h file
enum
{
    OBeamlampsGrid = 567678546,
    BEAM_LAMPS_GRID_PLANE = 1000,
    BEAM_LAMPS_GRID_PLANE_XZ = 0,
    BEAM_LAMPS_GRID_PLANE_ZY = 1,
    BEAM_LAMPS_GRID_PLANE_XY = 2,
    BEAM_LAMPS_BEAM_LENGTH = 1001,
    BEAM_LAMPS_ANGLE = 1002,
    BEAM_LAMPS_INTENSITY = 1003,
.....
.res file
CONTAINER OBeamlampsGrid {
    INCLUDE Obase;
    NAME OBeamlampsGrid;
    GROUP ID_OBJECTPROPERTIES {
        LONG BEAM_LAMPS_GRID_PLANE {
            CYCLE {
                BEAM_LAMPS_GRID_PLANE_XZ;
                BEAM_LAMPS_GRID_PLANE_ZY;
                BEAM_LAMPS_GRID_PLANE_XY;
            }
        }
        REAL BEAM_LAMPS_BEAM_LENGTH { DEFAULT 1500.0; CUSTOMGUI REALSLIDER; MIN 500.0; MAX 50000.0; MINSLIDER 500.0; STEP 100.0; UNIT METER; }
        REAL BEAM_LAMPS_ANGLE { DEFAULT 3.0; CUSTOMGUI REALSLIDER; MIN 3.0; MAX 35.0; MINSLIDER 1.0; MAXSLIDER 45.0; STEP 0.5; UNIT DEGREE; }
        REAL BEAM_LAMPS_INTENSITY { DEFAULT 1.0; CUSTOMGUI REALSLIDER; MIN 0.0; MINSLIDER 0.0; MAXSLIDER 100.0; STEP 1.0; UNIT PERCENT; }
...
.str file
STRINGTABLE OBeamlampsGrid {
    OBeamlampsGrid "Beam Lamps Grid";
    BEAM_LAMPS_GRID_PLANE "Plane";
        BEAM_LAMPS_GRID_PLANE_XZ "XZ";
        BEAM_LAMPS_GRID_PLANE_ZY "ZY";
        BEAM_LAMPS_GRID_PLANE_XY "XY";
    BEAM_LAMPS_BEAM_LENGTH "Beam Length";
    BEAM_LAMPS_ANGLE "Beam Angle";
    BEAM_LAMPS_INTENSITY "Beam Intensity";
...

hi,
I see you trying to see your properties active from your object or tag plugin. Well just try to delete your (symbolcache file) and restart c4d and it will be fix.
lol I is run into this all the time when making NodeData Plugins.
5ecb46fb-00fa-4221-84b8-faaacc0472c7-image.png

cheers

@Ashton_FCS_PluginDev

Thank you for your reply. I have tried the method you said, but it didn't work.
What's more surprising to me is that if I only use the ID of the property, such as xBeamlampsGrid[1001], I can identify it correctly

Hi,

I think the important question would be if your obejct's attributes do read out properly directly from C++, via ApplicationOutput() for example? Assuming you are actually on C++ as your tags state. If you are on Python you probably neglected to init your attributes via NodeData.InitAttr().

Cheers,
zipit

MAXON SDK Specialist
developers.maxon.net

@zipit said in The console does not correctly recognize object properties:

Hello, thank you for your reply.
I use C++, in the code, I implemented Init(), and my code can correctly identify the properties, the following two methods are no problem:

auto a = bc->GetFloat(BEAM_LAMPS_BEAM_LENGTH);
ApplicationOutput(maxon::String::FloatToString(a));

or

GeData ge;
node->GetParameter(BEAM_LAMPS_BEAM_LENGTH, ge, DESCFLAGS_GET::NONE);
ApplicationOutput(maxon::String::FloatToString(ge.GetFloat()));

@sean said in The console does not correctly recognize object properties:

I use C++, in the code, I implemented Init(), and my code can correctly identify the properties, the following two methods are no problem:

Hi,

jeah, that is what I assumed. Your title is a bit misleading then. It should be something like cannot interface the properties of a node linked to my C++ plugin from Python. Anyways, given the fact that the whole symbol thing tends to be a bit messy when it comes to Python, I would do the following two things:

  • Investigate what the Cinema Python interpreter thinks your plugin symbols imported into the c4d module should resolve too. So for example just type in c4d.BEAM_LAMPS_BEAM_LENGTH and check that it spits out the matching integer.
  • Iterate over the data container of node that is an instance of a node linked to your plugin and see what is actually in there. Given your screenshot above, where you draged your object into the console, something like the following (you can do that in the console if you dragged your object into it).
for cid, val in xBeamLampGrid.GetData():
    print cid, val

You should then report back if these points do what one would expect them to do or not.

Cheers
zipit

MAXON SDK Specialist
developers.maxon.net

@zipit

This plug-in has a twin plug-in that has some properties with the same name, and I suspect that the properties with the same name cause conflicts (even if the ids are different).I made the modification and it is normal now.

Thank you for your reply

Cheers