[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: how to get value of a property



On Sat, 12 Jul 2003, Vadim Berezniker wrote:
> Lars Clausen wrote:
>> On Mon, 07 Jul 2003, Vadim Berezniker wrote:
>>> I give up, I looked all over the place and still can't figure out how
>>> to get a property value from outside the object.
>>> The closest I found was object_get_prop_by_name(), but that function
>>> is not implemented anywhere ...
>> You want object_prop_by_name(), which is described in
>> lib/properties.h and
>> implemented in lib/propobjects.c.
>> -Lars
>>
> 
>      BoolProperty *prop = object_prop_by_name(obj_copy, "can_parent");
>      if(prop)
>        printf("val: %d\n", prop -> bool_data);
> 
> It always prints "0" regardless of what the actual value is.
> 
> I have defined the 'can_parent' property in the object that is being
> checked. I can toggle the property in the properties dialog, but
> trying to retrieve that property always returns 0 for the boolean
> value.

It's not something I've had to try before.  The props aren't actually
initialized with the value until the object's get_props function has been
called.  You'll need to feed that a GPtrArray of props, of course that can
be built from your return value.

Argh.  We really need to document this thing.

-Lars

-- 
Lars Clausen (http://shasta.cs.uiuc.edu/~lrclause)| HĂ„rdgrim of Numenor
"I do not agree with a word that you say, but I   |----------------------------
will defend to the death your right to say it."   | Where are we going, and
    --Evelyn Beatrice Hall paraphrasing Voltaire  | what's with the handbasket?



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] Mail converted by Mofo Magic and the Flying D

 
All trademarks and copyrights are the property of their respective owners.

Other Directory Sites: SeekWonder | Directory Owners Forum

GuideSMACK