fix for a strange linking error where set_property() in source/blender/blenkernel...
authorCampbell Barton <ideasman42@gmail.com>
Tue, 18 Sep 2012 04:35:30 +0000 (04:35 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 18 Sep 2012 04:35:30 +0000 (04:35 +0000)
Give functions in property.c more unique names.

source/blender/blenkernel/BKE_property.h
source/blender/blenkernel/intern/object.c
source/blender/blenkernel/intern/property.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/versioning_legacy.c
source/blender/editors/object/object_edit.c
source/blender/editors/object/object_select.c
source/blender/editors/space_view3d/drawmesh.c
source/blender/editors/space_view3d/drawobject.c
source/blender/makesrna/intern/rna_property.c
source/gameengine/Converter/KX_ConvertProperties.cpp

index a29dc0e7be421ce30f0c22f568f8356f66f2736d..e0eb8c04b60ccfe288940e2e15c26a2ef3d9e810 100644 (file)
@@ -35,19 +35,18 @@ struct bProperty;
 struct ListBase;
 struct Object;
 
-void free_property(struct bProperty *prop);
-void free_properties(struct ListBase *lb);
-struct bProperty *copy_property(struct bProperty *prop);
-void copy_properties(struct ListBase *lbn, struct ListBase *lbo);
-void init_property(struct bProperty *prop);
-struct bProperty *new_property(int type);
-void unique_property(struct bProperty *first, struct  bProperty *prop, int force);
-struct bProperty *get_ob_property(struct Object *ob, const char *name);
-void set_ob_property(struct Object *ob, struct bProperty *propc);
-int compare_property(struct bProperty *prop, const char *str);
-void set_property(struct bProperty *prop, const char *str);
-void add_property(struct bProperty *prop, const char *str);
-void set_property_valstr(struct bProperty *prop, char *str);
-void cp_property(struct bProperty *prop1, struct bProperty *prop2);
+void              BKE_bproperty_free(struct bProperty *prop);
+void              BKE_bproperty_free_list(struct ListBase *lb);
+struct bProperty *BKE_bproperty_copy(struct bProperty *prop);
+void              BKE_bproperty_copy_list(struct ListBase *lbn, struct ListBase *lbo);
+void              BKE_bproperty_init(struct bProperty *prop);
+struct bProperty *BKE_bproperty_new(int type);
+void              BKE_bproperty_unique(struct bProperty *first, struct  bProperty *prop, int force);
+struct bProperty *BKE_bproperty_object_get(struct Object *ob, const char *name);
+void              BKE_bproperty_object_set(struct Object *ob, struct bProperty *propc);
+// int               BKE_bproperty_cmp(struct bProperty *prop, const char *str);
+void              BKE_bproperty_set(struct bProperty *prop, const char *str);
+void              BKE_bproperty_add(struct bProperty *prop, const char *str);
+void              BKE_bproperty_set_valstr(struct bProperty *prop, char *str);
        
 #endif
index a44b5e7691bcf0e251c7b75f2a95783b11d6e390..5be39414113c4308b9b011a392b684332d5b5652 100644 (file)
@@ -340,7 +340,7 @@ void BKE_object_free(Object *ob)
                BKE_pose_free(ob->pose);
        if (ob->mpath)
                animviz_free_motionpath(ob->mpath);
-       free_properties(&ob->prop);
+       BKE_bproperty_free_list(&ob->prop);
        BKE_object_free_modifiers(ob);
        
        free_sensors(&ob->sensors);
@@ -1147,7 +1147,7 @@ Object *BKE_object_copy(Object *ob)
        }
 
        obn->prop.first = obn->prop.last = NULL;
-       copy_properties(&obn->prop, &ob->prop);
+       BKE_bproperty_copy_list(&obn->prop, &ob->prop);
        
        copy_sensors(&obn->sensors, &ob->sensors);
        copy_controllers(&obn->controllers, &ob->controllers);
index 46ddce4b51bb365f78ef41f58f4822fbf36ae92d..8da4f11fed30703e730f532f3e1e1835ccabfb76 100644 (file)
 
 /** \file blender/blenkernel/intern/property.c
  *  \ingroup bke
+ *
+ * This module deals with bProperty only,
+ * they are used on blender objects in the game engine
+ * (where they get converted into C++ classes - CValue and subclasses)
  */
 
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <stddef.h>
@@ -45,7 +48,7 @@
 
 #include "BKE_property.h"
 
-void free_property(bProperty *prop)
+void BKE_bproperty_free(bProperty *prop)
 {
        
        if (prop->poin && prop->poin != &prop->data) MEM_freeN(prop->poin);
@@ -53,17 +56,17 @@ void free_property(bProperty *prop)
        
 }
 
-void free_properties(ListBase *lb)
+void BKE_bproperty_free_list(ListBase *lb)
 {
        bProperty *prop;
        
        while ( (prop = lb->first) ) {
                BLI_remlink(lb, prop);
-               free_property(prop);
+               BKE_bproperty_free(prop);
        }
 }
 
-bProperty *copy_property(bProperty *prop)
+bProperty *BKE_bproperty_copy(bProperty *prop)
 {
        bProperty *propn;
        
@@ -76,13 +79,13 @@ bProperty *copy_property(bProperty *prop)
        return propn;
 }
 
-void copy_properties(ListBase *lbn, ListBase *lbo)
+void BKE_bproperty_copy_list(ListBase *lbn, ListBase *lbo)
 {
        bProperty *prop, *propn;
-       free_properties(lbn); /* in case we are copying to an object with props */
+       BKE_bproperty_free_list(lbn); /* in case we are copying to an object with props */
        prop = lbo->first;
        while (prop) {
-               propn = copy_property(prop);
+               propn = BKE_bproperty_copy(prop);
                BLI_addtail(lbn, propn);
                prop = prop->next;
        }
@@ -90,7 +93,7 @@ void copy_properties(ListBase *lbn, ListBase *lbo)
        
 }
 
-void init_property(bProperty *prop)
+void BKE_bproperty_init(bProperty *prop)
 {
        /* also use when property changes type */
        
@@ -113,22 +116,22 @@ void init_property(bProperty *prop)
 }
 
 
-bProperty *new_property(int type)
+bProperty *BKE_bproperty_new(int type)
 {
        bProperty *prop;
 
        prop = MEM_callocN(sizeof(bProperty), "property");
        prop->type = type;
 
-       init_property(prop);
+       BKE_bproperty_init(prop);
        
        strcpy(prop->name, "prop");
 
        return prop;
 }
 
-/* used by unique_property() only */
-static bProperty *get_property__internal(bProperty *first, bProperty *self, const char *name)
+/* used by BKE_bproperty_unique() only */
+static bProperty *bproperty_get(bProperty *first, bProperty *self, const char *name)
 {
        bProperty *p;
        for (p = first; p; p = p->next) {
@@ -137,7 +140,7 @@ static bProperty *get_property__internal(bProperty *first, bProperty *self, cons
        }
        return NULL;
 }
-void unique_property(bProperty *first, bProperty *prop, int force)
+void BKE_bproperty_unique(bProperty *first, bProperty *prop, int force)
 {
        bProperty *p;
 
@@ -151,13 +154,13 @@ void unique_property(bProperty *first, bProperty *prop, int force)
 
        if (force) {
                /* change other names to make them unique */
-               while ((p = get_property__internal(first, prop, prop->name))) {
-                       unique_property(first, p, 0);
+               while ((p = bproperty_get(first, prop, prop->name))) {
+                       BKE_bproperty_unique(first, p, 0);
                }
        }
        else {
                /* change our own name until its unique */
-               if (get_property__internal(first, prop, prop->name)) {
+               if (bproperty_get(first, prop, prop->name)) {
                        /* there is a collision */
                        char new_name[sizeof(prop->name)];
                        char base_name[sizeof(prop->name)];
@@ -175,33 +178,34 @@ void unique_property(bProperty *first, bProperty *prop, int force)
                                BLI_snprintf(num, sizeof(num), "%d", i++);
                                BLI_strncpy(new_name, base_name, sizeof(prop->name) - strlen(num));
                                strcat(new_name, num);
-                       } while (get_property__internal(first, prop, new_name));
+                       } while (bproperty_get(first, prop, new_name));
 
                        BLI_strncpy(prop->name, new_name, sizeof(prop->name));
                }
        }
 }
 
-bProperty *get_ob_property(Object *ob, const char *name)
+bProperty *BKE_bproperty_object_get(Object *ob, const char *name)
 {
        return BLI_findstring(&ob->prop, name, offsetof(bProperty, name));
 }
 
-void set_ob_property(Object *ob, bProperty *propc)
+void BKE_bproperty_object_set(Object *ob, bProperty *propc)
 {
        bProperty *prop;
-       prop = get_ob_property(ob, propc->name);
+       prop = BKE_bproperty_object_get(ob, propc->name);
        if (prop) {
-               free_property(prop);
+               BKE_bproperty_free(prop);
                BLI_remlink(&ob->prop, prop);
        }
-       BLI_addtail(&ob->prop, copy_property(propc));
+       BLI_addtail(&ob->prop, BKE_bproperty_copy(propc));
 }
 
 /* negative: prop is smaller
  * positive: prop is larger
  */
-int compare_property(bProperty *prop, const char *str)
+#if 0  /* UNUSED */
+int BKE_bproperty_cmp(bProperty *prop, const char *str)
 {
 //     extern int Gdfra;               /* sector.c */
        float fvalue, ftest;
@@ -237,8 +241,9 @@ int compare_property(bProperty *prop, const char *str)
        
        return 0;
 }
+#endif
 
-void set_property(bProperty *prop, const char *str)
+void BKE_bproperty_set(bProperty *prop, const char *str)
 {
 //     extern int Gdfra;               /* sector.c */
 
@@ -262,7 +267,7 @@ void set_property(bProperty *prop, const char *str)
        
 }
 
-void add_property(bProperty *prop, const char *str)
+void BKE_bproperty_add(bProperty *prop, const char *str)
 {
 //     extern int Gdfra;               /* sector.c */
 
@@ -282,7 +287,7 @@ void add_property(bProperty *prop, const char *str)
 }
 
 /* reads value of property, sets it in chars in str */
-void set_property_valstr(bProperty *prop, char *str)
+void BKE_bproperty_set_valstr(bProperty *prop, char *str)
 {
 //     extern int Gdfra;               /* sector.c */
 
@@ -303,11 +308,13 @@ void set_property_valstr(bProperty *prop, char *str)
        }
 }
 
+#if 0   /* UNUSED */
 void cp_property(bProperty *prop1, bProperty *prop2)
 {
        char str[128];
 
-       set_property_valstr(prop2, str);
+       BKE_bproperty_set_valstr(prop2, str);
 
-       set_property(prop1, str);
+       BKE_bproperty_set(prop1, str);
 }
+#endif
index 9d39e751382dcb3aa262340a4c0b88a06917ee48..a24e125682633734af77cb15f65aa99bc15e9166 100644 (file)
 #include "BKE_paint.h"
 #include "BKE_particle.h"
 #include "BKE_pointcache.h"
-#include "BKE_property.h" // for get_ob_property
+#include "BKE_property.h" // for BKE_bproperty_object_get
 #include "BKE_report.h"
 #include "BKE_sca.h" // for init_actuator
 #include "BKE_scene.h"
@@ -7382,7 +7382,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
                        
                        for (ob= main->object.first; ob; ob= ob->id.next) {
                                if (ob->type == OB_FONT) {
-                                       prop = get_ob_property(ob, "Text");
+                                       prop = BKE_bproperty_object_get(ob, "Text");
                                        if (prop) {
                                                BKE_reportf_wrap(fd->reports, RPT_WARNING,
                                                                 "Game property name conflict in object: \"%s\".\nText objects reserve the "
index 1cc0d4180aba218e0aab4a063a64b65f1ceecf51..5f7252b65bfb5fe5cec3b69a30905232e1408dc5 100644 (file)
@@ -92,7 +92,7 @@
 #include "BKE_modifier.h"
 #include "BKE_particle.h"
 #include "BKE_pointcache.h"
-#include "BKE_property.h" // for get_ob_property
+#include "BKE_property.h" // for BKE_bproperty_object_get
 #include "BKE_scene.h"
 #include "BKE_sequencer.h"
 
@@ -945,7 +945,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *main)
                        while (act) {
                                if (act->type == ACT_IPO) {
                                        ia = act->data;
-                                       prop = get_ob_property(ob, ia->name);
+                                       prop = BKE_bproperty_object_get(ob, ia->name);
                                        if (prop) {
                                                ia->type = ACT_IPO_FROM_PROP;
                                        }
index aa885320b3774ceebf7418052336316e3dc88aff..f95a186990e26854e4716cc7c11e79ec8d47bb0a 100644 (file)
@@ -649,11 +649,11 @@ static void copymenu_properties(Scene *scene, View3D *v3d, Object *ob)
                for (base = FIRSTBASE; base; base = base->next) {
                        if ((base != BASACT) && (TESTBASELIB(v3d, base))) {
                                if (nr == 1) { /* replace */
-                                       copy_properties(&base->object->prop, &ob->prop);
+                                       BKE_bproperty_copy_list(&base->object->prop, &ob->prop);
                                }
                                else {
                                        for (prop = ob->prop.first; prop; prop = prop->next) {
-                                               set_ob_property(base->object, prop);
+                                               BKE_bproperty_object_set(base->object, prop);
                                        }
                                }
                        }
@@ -665,7 +665,7 @@ static void copymenu_properties(Scene *scene, View3D *v3d, Object *ob)
                if (prop) {
                        for (base = FIRSTBASE; base; base = base->next) {
                                if ((base != BASACT) && (TESTBASELIB(v3d, base))) {
-                                       set_ob_property(base->object, prop);
+                                       BKE_bproperty_object_set(base->object, prop);
                                }
                        }
                }
@@ -1585,7 +1585,7 @@ static int game_property_new(bContext *C, wmOperator *op)
        char name[MAX_NAME];
        int type = RNA_enum_get(op->ptr, "type");
 
-       prop = new_property(type);
+       prop = BKE_bproperty_new(type);
        BLI_addtail(&ob->prop, prop);
 
        RNA_string_get(op->ptr, "name", name);
@@ -1593,7 +1593,7 @@ static int game_property_new(bContext *C, wmOperator *op)
                BLI_strncpy(prop->name, name, sizeof(prop->name));
        }
 
-       unique_property(NULL, prop, 0); // make_unique_prop_names(prop->name);
+       BKE_bproperty_unique(NULL, prop, 0); // make_unique_prop_names(prop->name);
 
        WM_event_add_notifier(C, NC_LOGIC, NULL);
        return OPERATOR_FINISHED;
@@ -1631,7 +1631,7 @@ static int game_property_remove(bContext *C, wmOperator *op)
 
        if (prop) {
                BLI_remlink(&ob->prop, prop);
-               free_property(prop);
+               BKE_bproperty_free(prop);
 
                WM_event_add_notifier(C, NC_LOGIC, NULL);
                return OPERATOR_FINISHED;
@@ -1711,7 +1711,7 @@ static int game_property_copy_exec(bContext *C, wmOperator *op)
                        CTX_DATA_BEGIN(C, Object *, ob_iter, selected_editable_objects)
                        {
                                if (ob != ob_iter)
-                                       set_ob_property(ob_iter, prop);
+                                       BKE_bproperty_object_set(ob_iter, prop);
                        } CTX_DATA_END;
                }
        }
@@ -1721,12 +1721,12 @@ static int game_property_copy_exec(bContext *C, wmOperator *op)
                {
                        if (ob != ob_iter) {
                                if (type == COPY_PROPERTIES_REPLACE) {
-                                       copy_properties(&ob_iter->prop, &ob->prop);
+                                       BKE_bproperty_copy_list(&ob_iter->prop, &ob->prop);
                                }
                                else {
                                        /* merge - the default when calling with no argument */
                                        for (prop = ob->prop.first; prop; prop = prop->next) {
-                                               set_ob_property(ob_iter, prop);
+                                               BKE_bproperty_object_set(ob_iter, prop);
                                        }
                                }
                        }
@@ -1763,7 +1763,7 @@ static int game_property_clear_exec(bContext *C, wmOperator *UNUSED(op))
 {
        CTX_DATA_BEGIN(C, Object *, ob_iter, selected_editable_objects)
        {
-               free_properties(&ob_iter->prop);
+               BKE_bproperty_free_list(&ob_iter->prop);
        }
        CTX_DATA_END;
 
index 7eb8cc01db93a90dfc45a007ef9f98fc1ad07c38..ff7f33f61074c6d9a703aa04795fd7b2ea50d696 100644 (file)
@@ -723,7 +723,7 @@ static short objects_share_gameprop(Object *a, Object *b)
        /*make a copy of all its properties*/
 
        for (prop = a->prop.first; prop; prop = prop->next) {
-               if (get_ob_property(b, prop->name) )
+               if (BKE_bproperty_object_get(b, prop->name) )
                        return 1;
        }
        return 0;
index ca4f00be2d5e88288b5980606f50e2290f466ad2..3b704f6a111733764f0fa2b0838e3f71cde69f56 100644 (file)
@@ -638,7 +638,7 @@ static void draw_mesh_text(Scene *scene, Object *ob, int glsl)
        MLoopCol *mloopcol = me->mloopcol;  /* why does mcol exist? */
        MLoopCol *lcol;
 
-       bProperty *prop = get_ob_property(ob, "Text");
+       bProperty *prop = BKE_bproperty_object_get(ob, "Text");
        GPUVertexAttribs gattribs;
        int a, totpoly = me->totpoly;
 
@@ -732,7 +732,7 @@ static void draw_mesh_text(Scene *scene, Object *ob, int glsl)
                        /* The BM_FONT handling is in the gpu module, shared with the
                         * game engine, was duplicated previously */
 
-                       set_property_valstr(prop, string);
+                       BKE_bproperty_set_valstr(prop, string);
                        characters = strlen(string);
                        
                        if (!BKE_image_get_ibuf(mtpoly->tpage, NULL))
@@ -832,7 +832,7 @@ static void draw_mesh_textured_old(Scene *scene, View3D *v3d, RegionView3D *rv3d
        }
 
        /* draw game engine text hack */
-       if (get_ob_property(ob, "Text"))
+       if (BKE_bproperty_object_get(ob, "Text"))
                draw_mesh_text(scene, ob, 0);
 
        draw_textured_end();
index a51ec15bd86d549c04e5a636c9de42a969dce548..e88f49d4f5bc81ac2f560cb2eb9ab36f95e3c099 100644 (file)
@@ -3432,7 +3432,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
                        glFrontFace((ob->transflag & OB_NEG_SCALE) ? GL_CW : GL_CCW);
 
                        dm->drawFacesGLSL(dm, GPU_enable_material);
-//                     if (get_ob_property(ob, "Text"))
+//                     if (BKE_bproperty_object_get(ob, "Text"))
 // XXX                         draw_mesh_text(ob, 1);
                        GPU_disable_material();
 
index bf9f924489b299565448879c14a96daf7474b9e7..fc3697633a4c7068503640443e295827ba41bdc2 100644 (file)
@@ -89,7 +89,7 @@ static void rna_GameProperty_type_set(PointerRNA *ptr, int value)
 
        if (prop->type != value) {
                prop->type = value;
-               init_property(prop);
+               BKE_bproperty_init(prop);
        }
 }
 
@@ -97,7 +97,7 @@ static void rna_GameProperty_name_set(PointerRNA *ptr, const char *value)
 {
        bProperty *prop = (bProperty *)(ptr->data);
        BLI_strncpy_utf8(prop->name, value, sizeof(prop->name));
-       unique_property(NULL, prop, 1);
+       BKE_bproperty_unique(NULL, prop, 1);
 }
 
 
index fc14c9d21768d437ec3f30a4c1dfb96b75b3a842..a63f4c38fb68df666a6095ac10fa1095cf891590 100644 (file)
@@ -177,7 +177,7 @@ 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");
+       bProperty* prop = BKE_bproperty_object_get(object, "Text");
        if (!prop) return;
 
        Curve *curve = static_cast<Curve *>(object->data);