forked from bartvdbraak/blender
add macro OB_TYPE_SUPPORT_MATERIAL, type checks were being done inline, some comparing range, some using ELEM#(), once was missing metaball check.
This commit is contained in:
parent
75621eeff9
commit
3b996ac1b3
@ -1649,7 +1649,7 @@ void object_make_proxy(Object *ob, Object *target, Object *gob)
|
||||
if(ob->matbits) MEM_freeN(ob->matbits);
|
||||
ob->mat = NULL;
|
||||
ob->matbits= NULL;
|
||||
if ((target->totcol) && (target->mat) && ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL)) { //XXX OB_SUPPORT_MATERIAL
|
||||
if ((target->totcol) && (target->mat) && OB_TYPE_SUPPORT_MATERIAL(ob->type)) {
|
||||
int i;
|
||||
ob->colbits = target->colbits;
|
||||
|
||||
|
@ -1368,7 +1368,7 @@ static void UNUSED_FUNCTION(copy_attr_menu)(Main *bmain, Scene *scene, View3D *v
|
||||
strcat (str, "|Object Constraints%x22");
|
||||
strcat (str, "|NLA Strips%x26");
|
||||
|
||||
// XXX if (OB_SUPPORT_MATERIAL(ob)) {
|
||||
// XXX if (OB_TYPE_SUPPORT_MATERIAL(ob->type)) {
|
||||
// strcat(str, "|Texture Space%x17");
|
||||
// }
|
||||
|
||||
|
@ -1243,9 +1243,11 @@ static int allow_make_links_data(int ev, Object *ob, Object *obt)
|
||||
return 1;
|
||||
break;
|
||||
case MAKE_LINKS_MATERIALS:
|
||||
if (ELEM5(ob->type, OB_MESH, OB_CURVE, OB_FONT, OB_SURF, OB_MBALL) &&
|
||||
ELEM5(obt->type, OB_MESH, OB_CURVE, OB_FONT, OB_SURF, OB_MBALL))
|
||||
if (OB_TYPE_SUPPORT_MATERIAL(ob->type) &&
|
||||
OB_TYPE_SUPPORT_MATERIAL(obt->type))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case MAKE_LINKS_ANIMDATA:
|
||||
case MAKE_LINKS_DUPLIGROUP:
|
||||
|
@ -344,7 +344,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
|
||||
/* copy over object color, in case material uses it */
|
||||
copy_v4_v4(base->object->col, sp->col);
|
||||
|
||||
if(ELEM4(base->object->type, OB_MESH, OB_CURVE, OB_SURF, OB_MBALL)) {
|
||||
if(OB_TYPE_SUPPORT_MATERIAL(base->object->type)) {
|
||||
/* don't use assign_material, it changed mat->id.us, which shows in the UI */
|
||||
Material ***matar= give_matarar(base->object);
|
||||
int actcol= MAX2(base->object->actcol > 0, 1) - 1;
|
||||
|
@ -234,7 +234,7 @@ static int buttons_context_path_material(ButsContextPath *path, int for_texture)
|
||||
else if(buttons_context_path_object(path)) {
|
||||
ob= path->ptr[path->len-1].data;
|
||||
|
||||
if(ob && ob->type && (ob->type<OB_LAMP)) {
|
||||
if(ob && OB_TYPE_SUPPORT_MATERIAL(ob->type)) {
|
||||
ma= give_current_material(ob, ob->actcol);
|
||||
RNA_id_pointer_create(&ma->id, &path->ptr[path->len]);
|
||||
path->len++;
|
||||
@ -721,7 +721,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
|
||||
if(ptr) {
|
||||
Object *ob= ptr->data;
|
||||
|
||||
if(ob && ob->type && (ob->type<OB_LAMP) && ob->totcol) {
|
||||
if(ob && OB_TYPE_SUPPORT_MATERIAL(ob->type) && ob->totcol) {
|
||||
/* a valid actcol isn't ensured [#27526] */
|
||||
int matnr= ob->actcol-1;
|
||||
if(matnr < 0) matnr= 0;
|
||||
|
@ -895,9 +895,12 @@ static void v3d_transform_butsR(uiLayout *layout, PointerRNA *ptr)
|
||||
|
||||
if (ptr->type == &RNA_Object) {
|
||||
Object *ob = ptr->data;
|
||||
if (ELEM5(ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL))
|
||||
/* dimensions and material support just happen to be the same checks
|
||||
* later we may want to add dimensions for lattice, armature etc too */
|
||||
if (OB_TYPE_SUPPORT_MATERIAL(ob->type)) {
|
||||
uiItemR(layout, ptr, "dimensions", 0, "Dimensions", ICON_NONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void v3d_posearmature_buts(uiLayout *layout, Object *ob)
|
||||
|
@ -321,6 +321,9 @@ typedef struct DupliObject {
|
||||
/* 23 and 24 are for life and sector (old file compat.) */
|
||||
#define OB_ARMATURE 25
|
||||
|
||||
/* check if the object type supports materials */
|
||||
#define OB_TYPE_SUPPORT_MATERIAL(_type) ((_type) >= OB_MESH && (_type) <= OB_MBALL)
|
||||
|
||||
/* partype: first 4 bits: type */
|
||||
#define PARTYPE 15
|
||||
#define PAROBJECT 0
|
||||
|
@ -4359,9 +4359,9 @@ static void finalize_render_object(Render *re, ObjectRen *obr, int timeoffset)
|
||||
/* Database */
|
||||
/* ------------------------------------------------------------------------- */
|
||||
|
||||
static int render_object_type(int type)
|
||||
static int render_object_type(short type)
|
||||
{
|
||||
return ELEM5(type, OB_FONT, OB_CURVE, OB_SURF, OB_MESH, OB_MBALL);
|
||||
return OB_TYPE_SUPPORT_MATERIAL(type);
|
||||
}
|
||||
|
||||
static void find_dupli_instances(Render *re, ObjectRen *obr)
|
||||
|
Loading…
Reference in New Issue
Block a user