~ubuntu-branches/ubuntu/trusty/blender/trusty-proposed

« back to all changes in this revision

Viewing changes to source/blender/makesrna/intern/rna_material.c

  • Committer: Package Import Robot
  • Author(s): Matteo F. Vescovi
  • Date: 2013-08-14 10:43:49 UTC
  • mfrom: (14.2.19 sid)
  • Revision ID: package-import@ubuntu.com-20130814104349-t1d5mtwkphp12dyj
Tags: 2.68a-3
* Upload to unstable
* debian/: python3.3 Depends simplified
  - debian/control: python3.3 Depends dropped
    for blender-data package
  - 0001-blender_thumbnailer.patch refreshed
* debian/control: libavcodec b-dep versioning dropped

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 *  \ingroup RNA
25
25
 */
26
26
 
27
 
 
28
27
#include <float.h>
29
28
#include <stdlib.h>
30
29
 
 
30
#include "DNA_material_types.h"
 
31
#include "DNA_texture_types.h"
 
32
 
31
33
#include "RNA_define.h"
32
34
 
33
35
#include "rna_internal.h"
34
36
 
35
 
#include "DNA_material_types.h"
36
 
#include "DNA_texture_types.h"
37
 
 
38
37
#include "WM_api.h"
39
38
#include "WM_types.h"
40
39
 
83
82
#include "DNA_node_types.h"
84
83
#include "DNA_object_types.h"
85
84
 
 
85
#include "BKE_context.h"
86
86
#include "BKE_depsgraph.h"
87
87
#include "BKE_main.h"
88
88
#include "BKE_material.h"
97
97
        Material *ma = ptr->id.data;
98
98
 
99
99
        DAG_id_tag_update(&ma->id, 0);
100
 
        if (scene) {  /* can be NULL, see [#30025] */
101
 
                if (scene->gm.matmode == GAME_MAT_GLSL) {
102
 
                        WM_main_add_notifier(NC_MATERIAL | ND_SHADING_DRAW, ma);
103
 
                }
104
 
                else {
105
 
                        WM_main_add_notifier(NC_MATERIAL | ND_SHADING, ma);
106
 
                }
107
 
        }
 
100
        WM_main_add_notifier(NC_MATERIAL | ND_SHADING, ma);
108
101
}
109
102
 
110
103
static void rna_Material_update_previews(Main *bmain, Scene *scene, PointerRNA *ptr)
112
105
        Material *ma = ptr->id.data;
113
106
        
114
107
        if (ma->nodetree)
115
 
                ntreeClearPreview(ma->nodetree);
 
108
                BKE_node_preview_clear_tree(ma->nodetree);
116
109
                
117
 
        WM_main_add_notifier(NC_MATERIAL | ND_SHADING, ma);
 
110
        WM_main_add_notifier(NC_MATERIAL | ND_SHADING_PREVIEW, ma);
118
111
}
119
112
 
120
 
 
121
113
static void rna_Material_draw_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
122
114
{
123
115
        Material *ma = ptr->id.data;
274
266
        else ma->mode &= ~MA_RAMP_COL;
275
267
 
276
268
        if ((ma->mode & MA_RAMP_COL) && ma->ramp_col == NULL)
277
 
                ma->ramp_col = add_colorband(0);
 
269
                ma->ramp_col = add_colorband(false);
278
270
}
279
271
 
280
272
static void rna_Material_use_specular_ramp_set(PointerRNA *ptr, int value)
285
277
        else ma->mode &= ~MA_RAMP_SPEC;
286
278
 
287
279
        if ((ma->mode & MA_RAMP_SPEC) && ma->ramp_spec == NULL)
288
 
                ma->ramp_spec = add_colorband(0);
 
280
                ma->ramp_spec = add_colorband(false);
289
281
}
290
282
 
291
 
static void rna_Material_use_nodes_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 
283
static void rna_Material_use_nodes_update(bContext *C, PointerRNA *ptr)
292
284
{
293
285
        Material *ma = (Material *)ptr->data;
294
286
 
295
287
        if (ma->use_nodes && ma->nodetree == NULL)
296
 
                ED_node_shader_default(scene, &ma->id);
 
288
                ED_node_shader_default(C, &ma->id);
297
289
        
298
 
        rna_Material_update(bmain, scene, ptr);
 
290
        rna_Material_update(CTX_data_main(C), CTX_data_scene(C), ptr);
299
291
}
300
292
 
301
293
static EnumPropertyItem *rna_Material_texture_coordinates_itemf(bContext *UNUSED(C), PointerRNA *ptr,
1826
1818
        prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
1827
1819
        RNA_def_property_int_sdna(prop, NULL, "index");
1828
1820
        RNA_def_property_ui_text(prop, "Pass Index", "Index number for the IndexMA render pass");
1829
 
        RNA_def_property_update(prop, NC_OBJECT, NULL);
 
1821
        RNA_def_property_update(prop, NC_OBJECT, "rna_Material_update");
1830
1822
 
1831
1823
        /* flags */
1832
1824
        
2025
2017
        prop = RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
2026
2018
        RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1);
2027
2019
        RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
 
2020
        RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
2028
2021
        RNA_def_property_ui_text(prop, "Use Nodes", "Use shader nodes to render the material");
2029
2022
        RNA_def_property_update(prop, 0, "rna_Material_use_nodes_update");
2030
2023