void create_scalebbox(worldptr world) { vfeptr thisvfe; evfptr thisevf; fveptr thisfve; ; /* scalebbox_obj is a global object that gets copied when primary */ /* world objects get picked, so that they can be scaled. */ scalebbox_obj = create_cube(environment_world,100.0,100.0,100.0); scalebbox_obj->drawtechnique = draw_scalebbox_technique; scalebbox_obj->selectechnique = set_scalebbox_selectable; set_object_name(scalebbox_obj,"Scalebbox"); add_property((featureptr) scalebbox_obj, transparent_prop); add_property((featureptr) scalebbox_obj, noshadow_prop); add_property((featureptr) scalebbox_obj, sectioninvisible_prop); add_property((featureptr) scalebbox_obj, selectinvisible_prop); add_property((featureptr) scalebbox_obj, pickedinvisible_prop); add_property((featureptr) scalebbox_obj, scalebbox_prop); del_property((featureptr) scalebbox_obj, visible_prop); thisvfe = First_obj_vfe(scalebbox_obj); while (thisvfe != Nil) { add_property((featureptr) thisvfe, scalebbox_prop); thisvfe = thisvfe->next; } thisevf = First_obj_evf(scalebbox_obj); while (thisevf != Nil) { add_property((featureptr) thisevf, scalebbox_prop); thisevf = thisevf->next; } thisfve = First_obj_fve(scalebbox_obj); while (thisfve != Nil) { add_property((featureptr) thisfve, scalebbox_prop); thisfve = thisfve->next; } }
/* Add a property to an object (user, channel, proxy, acetables) EXTEND_STR : allocate memory for val and free it when the property is deleted EXTEND_JSON : put the given "json" object on the properties. This object is free'ed using json_free when the property is deleted EXTEND_POINTER : add a private pointer as property (must be private. see EXTEND_PUBLIC) EXTEND_ISPUBLIC : The property is added to the json tree sent with get_json_object_* EXTEND_ISPRIVATE : The property is not shown in get_json_object_* */ extend *add_property(extend **entry, char *key, void *val, EXTEND_TYPE etype, EXTEND_PUBLIC visibility) { extend *new_property = NULL, *eTmp; if (strlen(key) > EXTEND_KEY_LENGTH) { return NULL; } /* Delete older property with this key (if any) */ del_property(entry, key); eTmp = *entry; new_property = xmalloc(sizeof(*new_property)); /* The key cannot be longer than EXTEND_KEY_LENGTH */ strcpy(new_property->key, key); switch(etype) { case EXTEND_STR: new_property->val = xstrdup(val); strcpy(new_property->val, val); break; case EXTEND_POINTER: default: /* a pointer must be a private property */ visibility = EXTEND_ISPRIVATE; case EXTEND_JSON: /* /!\ the JSON tree (val) is free'ed when this property is removed */ new_property->val = val; break; } new_property->next = eTmp; new_property->type = etype; new_property->visibility = visibility; *entry = new_property; return new_property; }