Merge with trunk r38663
authorMiika Hamalainen <blender@miikah.org>
Sun, 24 Jul 2011 18:01:20 +0000 (18:01 +0000)
committerMiika Hamalainen <blender@miikah.org>
Sun, 24 Jul 2011 18:01:20 +0000 (18:01 +0000)
1  2 
source/blender/editors/interface/interface_templates.c

index 85f8f93a4762c0d2a80e3c861c0da53a80053757,f388710d5b89d2ba1832aab466a109f34b16e7c1..3c29369c6ac5ace2f82fdb65e0ddce0256614ba5
@@@ -33,7 -33,6 +33,7 @@@
  
  #include "MEM_guardedalloc.h"
  
 +#include "DNA_dynamicpaint_types.h"
  #include "DNA_key_types.h"
  #include "DNA_scene_types.h"
  #include "DNA_userdef_types.h"
@@@ -44,7 -43,6 +44,7 @@@
  #include "BKE_animsys.h"
  #include "BKE_colortools.h"
  #include "BKE_context.h"
 +#include "BKE_dynamicpaint.h"
  #include "BKE_global.h"
  #include "BKE_library.h"
  #include "BKE_main.h"
@@@ -679,7 -677,7 +679,7 @@@ static int modifier_can_delete(Modifier
  static int modifier_is_simulation(ModifierData *md)
  {
        // Physic Tab
 -      if(ELEM6(md->type, eModifierType_Cloth, eModifierType_Collision, eModifierType_Fluidsim, eModifierType_Smoke, eModifierType_Softbody, eModifierType_Surface)) {
 +      if(ELEM7(md->type, eModifierType_Cloth, eModifierType_Collision, eModifierType_Fluidsim, eModifierType_Smoke, eModifierType_Softbody, eModifierType_Surface, eModifierType_DynamicPaint)) {
                return 1;
        }
        // Particle Tab
@@@ -743,7 -741,7 +743,7 @@@ static uiLayout *draw_modifier(uiLayou
                uiBlockBeginAlign(block);
                /* Softbody not allowed in this situation, enforce! */
                if ( ((md->type!=eModifierType_Softbody && md->type!=eModifierType_Collision) || !(ob->pd && ob->pd->deflect)) 
 -                      && (md->type!=eModifierType_Surface) ) 
 +                      && !ELEM(md->type, eModifierType_Surface, eModifierType_DynamicPaint) ) 
                {
                        uiItemR(row, &ptr, "show_render", 0, "", ICON_NONE);
                        uiItemR(row, &ptr, "show_viewport", 0, "", ICON_NONE);
                box= uiLayoutBox(column);
                row= uiLayoutRow(box, 0);
                
 -              if (!ELEM(md->type, eModifierType_Collision, eModifierType_Surface)) {
 +              if (!ELEM3(md->type, eModifierType_Collision, eModifierType_Surface, eModifierType_DynamicPaint)) {
                        /* only here obdata, the rest of modifiers is ob level */
                        uiBlockSetButLock(block, object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
                        
@@@ -853,7 -851,7 +853,7 @@@ uiLayout *uiTemplateModifier(uiLayout *
  
        /* verify we have valid data */
        if(!RNA_struct_is_a(ptr->type, &RNA_Modifier)) {
-               RNA_warning("uiTemplateModifier: expected modifier on object.\n");
+               RNA_warning("uiTemplateModifier: Expected modifier on object.\n");
                return NULL;
        }
  
        md= ptr->data;
  
        if(!ob || !(GS(ob->id.name) == ID_OB)) {
-               RNA_warning("uiTemplateModifier: expected modifier on object.\n");
+               RNA_warning("uiTemplateModifier: Expected modifier on object.\n");
                return NULL;
        }
        
@@@ -978,9 -976,6 +978,6 @@@ static uiLayout *draw_constraint(uiLayo
        block= uiLayoutGetBlock(box);
  
        /* Draw constraint header */
-       
-       /* rounded header */
-       // rb_col= (con->flag & CONSTRAINT_ACTIVE)?50:20; // UNUSED
  
        /* open/close */
        uiBlockSetEmboss(block, UI_EMBOSSN);
@@@ -1085,7 -1080,7 +1082,7 @@@ uiLayout *uiTemplateConstraint(uiLayou
  
        /* verify we have valid data */
        if(!RNA_struct_is_a(ptr->type, &RNA_Constraint)) {
-               RNA_warning("uiTemplateConstraint: expected constraint on object.\n");
+               RNA_warning("uiTemplateConstraint: Expected constraint on object.\n");
                return NULL;
        }
  
        con= ptr->data;
  
        if(!ob || !(GS(ob->id.name) == ID_OB)) {
-               RNA_warning("uiTemplateConstraint: expected constraint on object.\n");
+               RNA_warning("uiTemplateConstraint: Expected constraint on object.\n");
                return NULL;
        }
        
@@@ -1139,7 -1134,7 +1136,7 @@@ void uiTemplatePreview(uiLayout *layout
        PointerRNA texture_ptr;
  
        if(id && !ELEM4(GS(id->name), ID_MA, ID_TE, ID_WO, ID_LA)) {
-               RNA_warning("uiTemplatePreview: expected ID of type material, texture, lamp or world.\n");
+               RNA_warning("uiTemplatePreview: Expected ID of type material, texture, lamp or world.\n");
                return;
        }
  
@@@ -2027,13 -2022,6 +2024,13 @@@ static int list_item_icon_get(bContext 
        else if(RNA_struct_is_a(itemptr->type, &RNA_TextureSlot)) {
                id= RNA_pointer_get(itemptr, "texture").data;
        }
 +      else if(RNA_struct_is_a(itemptr->type, &RNA_DynamicPaintSurface)) {
 +              DynamicPaintSurface *surface= (DynamicPaintSurface*)itemptr->data;
 +
 +              if (surface->format == MOD_DPAINT_SURFACE_F_PTEX) return ICON_TEXTURE_SHADED;
 +              else if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX) return ICON_OUTLINER_DATA_MESH;
 +              else if (surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) return ICON_FILE_IMAGE;
 +      }
  
        /* get icon from ID */
        if(id) {
@@@ -2130,24 -2118,6 +2127,24 @@@ static void list_item_row(bContext *C, 
                //uiItemR(row, itemptr, "mute", 0, "", ICON_MUTE_IPO_OFF);
                uiBlockSetEmboss(block, UI_EMBOSS);
        }
 +      else if(itemptr->type == &RNA_DynamicPaintSurface) {
 +              char name_final[96];
 +              const char *enum_name;
 +              PropertyRNA *prop = RNA_struct_find_property(itemptr, "surface_type");
 +              DynamicPaintSurface *surface= (DynamicPaintSurface*)itemptr->data;
 +
 +              RNA_property_enum_name(C, itemptr, prop, RNA_property_enum_get(itemptr, prop), &enum_name);
 +
 +              sprintf(name_final, "%s (%s)",name,enum_name);
 +              uiItemL(sub, name_final, icon);
 +              if (dynamicPaint_surfaceHasColorPreview(surface)) {
 +                      uiBlockSetEmboss(block, UI_EMBOSSN);
 +                      uiDefIconButR(block, OPTION, 0, (surface->flags & MOD_DPAINT_PREVIEW) ? ICON_RESTRICT_VIEW_OFF : ICON_RESTRICT_VIEW_ON,
 +                              0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "show_preview", 0, 0, 0, 0, 0, NULL);
 +                      uiBlockSetEmboss(block, UI_EMBOSS);
 +              }
 +              uiDefButR(block, OPTION, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "is_active", i, 0, 0, 0, 0,  NULL);
 +      }
        else
                uiItemL(sub, name, icon); /* fails, backdrop LISTROW... */
  
@@@ -2198,14 -2168,14 +2195,14 @@@ void uiTemplateList(uiLayout *layout, b
        if(prop) {
                type= RNA_property_type(prop);
                if(type != PROP_COLLECTION) {
-                       RNA_warning("uiTemplateList: expected collection property.\n");
+                       RNA_warning("uiTemplateList: Expected collection property.\n");
                        return;
                }
        }
  
        activetype= RNA_property_type(activeprop);
        if(activetype != PROP_INT) {
-               RNA_warning("uiTemplateList: expected integer property.\n");
+               RNA_warning("uiTemplateList: Expected integer property.\n");
                return;
        }