more edits to r43145,

- remove redundant check in new prop operator which is covered by operators poll func.
- use get_ob_property to get the object prop in BL_ConvertTextProperty() rather then looping for it.
This commit is contained in:
Campbell Barton 2012-01-05 06:34:14 +00:00
parent cda279b525
commit 890c97ca40
2 changed files with 60 additions and 70 deletions

@ -1943,15 +1943,13 @@ static int game_property_new(bContext *C, wmOperator *op)
char name[32];
int type= RNA_enum_get(op->ptr, "type");
if(!ob)
return OPERATOR_CANCELLED;
prop= new_property(type);
BLI_addtail(&ob->prop, prop);
RNA_string_get(op->ptr, "name", name);
if(BLI_strnlen(name, 32) > 0)
if (name[0] != '\0') {
BLI_strncpy(prop->name, name, sizeof(prop->name));
}
unique_property(NULL, prop, 0); // make_unique_prop_names(prop->name);

@ -56,6 +56,9 @@
#include "BLI_winstuff.h"
#endif
extern "C" {
#include "BKE_property.h"
}
/* prototype */
void BL_ConvertTextProperty(Object* object, KX_FontObject* fontobj,SCA_TimeEventManager* timemgr,SCA_IScene* scene, bool isInActiveLayer);
@ -174,21 +177,12 @@ void BL_ConvertTextProperty(Object* object, KX_FontObject* fontobj,SCA_TimeEvent
{
CValue* tprop = fontobj->GetProperty("Text");
if(!tprop) return;
bProperty* prop = get_ob_property(object, "Text");
if(!prop) return;
Curve *curve = static_cast<Curve *>(object->data);
STR_String str = curve->str;
bProperty* prop = (bProperty*)object->prop.first;
CValue* propval;
while(prop)
{
if (strcmp(prop->name, "Text")!=0) {
prop = prop->next;
continue;
}
propval = NULL;
CValue* propval = NULL;
switch(prop->type) {
case GPROP_BOOL:
@ -243,10 +237,8 @@ void BL_ConvertTextProperty(Object* object, KX_FontObject* fontobj,SCA_TimeEvent
}
}
if (propval)
if (propval) {
propval->Release();
prop = prop->next;
}
}