Merge branch 'master' into blender2.8

This commit is contained in:
2017-08-01 10:38:36 +10:00
42 changed files with 172 additions and 82 deletions

View File

@@ -137,7 +137,7 @@ struct Knot {
/* Initially point to contiguous memory, however we may re-assign */ /* Initially point to contiguous memory, however we may re-assign */
double *tan[2]; double *tan[2];
} Knot; };
struct KnotRemoveState { struct KnotRemoveState {
@@ -1102,7 +1102,7 @@ int curve_fit_cubic_to_points_refit_db(
uint **r_corner_index_array, uint *r_corner_index_len) uint **r_corner_index_array, uint *r_corner_index_len)
{ {
const uint knots_len = points_len; const uint knots_len = points_len;
struct Knot *knots = malloc(sizeof(Knot) * knots_len); struct Knot *knots = malloc(sizeof(struct Knot) * knots_len);
#ifndef USE_CORNER_DETECT #ifndef USE_CORNER_DETECT
(void)r_corner_index_array; (void)r_corner_index_array;

View File

@@ -341,7 +341,7 @@ static void make_duplis_group(const DupliContext *ctx)
} }
} }
const DupliGenerator gen_dupli_group = { static const DupliGenerator gen_dupli_group = {
OB_DUPLIGROUP, /* type */ OB_DUPLIGROUP, /* type */
make_duplis_group /* make_duplis */ make_duplis_group /* make_duplis */
}; };
@@ -419,7 +419,7 @@ static void make_duplis_frames(const DupliContext *ctx)
*ob = copyob; *ob = copyob;
} }
const DupliGenerator gen_dupli_frames = { static const DupliGenerator gen_dupli_frames = {
OB_DUPLIFRAMES, /* type */ OB_DUPLIFRAMES, /* type */
make_duplis_frames /* make_duplis */ make_duplis_frames /* make_duplis */
}; };
@@ -569,7 +569,7 @@ static void make_duplis_verts(const DupliContext *ctx)
vdd.dm->release(vdd.dm); vdd.dm->release(vdd.dm);
} }
const DupliGenerator gen_dupli_verts = { static const DupliGenerator gen_dupli_verts = {
OB_DUPLIVERTS, /* type */ OB_DUPLIVERTS, /* type */
make_duplis_verts /* make_duplis */ make_duplis_verts /* make_duplis */
}; };
@@ -682,7 +682,7 @@ static void make_duplis_font(const DupliContext *ctx)
MEM_freeN(chartransdata); MEM_freeN(chartransdata);
} }
const DupliGenerator gen_dupli_verts_font = { static const DupliGenerator gen_dupli_verts_font = {
OB_DUPLIVERTS, /* type */ OB_DUPLIVERTS, /* type */
make_duplis_font /* make_duplis */ make_duplis_font /* make_duplis */
}; };
@@ -845,7 +845,7 @@ static void make_duplis_faces(const DupliContext *ctx)
fdd.dm->release(fdd.dm); fdd.dm->release(fdd.dm);
} }
const DupliGenerator gen_dupli_faces = { static const DupliGenerator gen_dupli_faces = {
OB_DUPLIFACES, /* type */ OB_DUPLIFACES, /* type */
make_duplis_faces /* make_duplis */ make_duplis_faces /* make_duplis */
}; };
@@ -1167,7 +1167,7 @@ static void make_duplis_particles(const DupliContext *ctx)
} }
} }
const DupliGenerator gen_dupli_particles = { static const DupliGenerator gen_dupli_particles = {
OB_DUPLIPARTS, /* type */ OB_DUPLIPARTS, /* type */
make_duplis_particles /* make_duplis */ make_duplis_particles /* make_duplis */
}; };

View File

@@ -372,6 +372,13 @@ static size_t unit_as_string(char *str, int len_max, double value, int prec, con
value_conv = value / unit->scalar; value_conv = value / unit->scalar;
/* Adjust precision to expected number of significant digits.
* Note that here, we shall not have to worry about very big/small numbers, units are expected to replace
* 'scientific notation' in those cases. */
const int l10 = (value_conv == 0.0) ? 0 : (int)log10(fabs(value_conv));
prec -= l10 + (int)(l10 < 0);
CLAMP(prec, 0, 6);
/* Convert to a string */ /* Convert to a string */
len = BLI_snprintf_rlen(str, len_max, "%.*f", prec, value_conv); len = BLI_snprintf_rlen(str, len_max, "%.*f", prec, value_conv);

View File

@@ -2415,7 +2415,8 @@ static void bmesh_kernel_vert_separate__cleanup(BMesh *bm, LinkNode *edges_separ
/* don't visit again */ /* don't visit again */
n_prev->next = n_step->next; n_prev->next = n_step->next;
} }
} while ((n_prev = n_step), } while ((void)
(n_prev = n_step),
(n_step = n_step->next)); (n_step = n_step->next));
} while ((n_orig = n_orig->next) && n_orig->next); } while ((n_orig = n_orig->next) && n_orig->next);

View File

@@ -234,7 +234,7 @@ static bool nearly_parallel(const float d1[3], const float d2[3])
float ang; float ang;
ang = angle_v3v3(d1, d2); ang = angle_v3v3(d1, d2);
return (fabsf(ang) < BEVEL_EPSILON_ANG) || (fabsf(ang - M_PI) < BEVEL_EPSILON_ANG); return (fabsf(ang) < BEVEL_EPSILON_ANG) || (fabsf(ang - (float)M_PI) < BEVEL_EPSILON_ANG);
} }
/* Make a new BoundVert of the given kind, insert it at the end of the circular linked /* Make a new BoundVert of the given kind, insert it at the end of the circular linked

View File

@@ -246,4 +246,4 @@ void RenderLayersDepthProg::executePixelSampled(float output[4], float x, float
unsigned int offset = (iy * this->getWidth() + ix); unsigned int offset = (iy * this->getWidth() + ix);
output[0] = inputBuffer[offset]; output[0] = inputBuffer[offset];
} }
} }

View File

@@ -91,6 +91,11 @@ int main(int argc, char **argv)
} }
fprintf(fpout, "/* DataToC output of file <%s> */\n\n", argv[1]); fprintf(fpout, "/* DataToC output of file <%s> */\n\n", argv[1]);
/* Quiet 'missing-variable-declarations' warning. */
fprintf(fpout, "extern int datatoc_%s_size;\n", argv[1]);
fprintf(fpout, "extern char datatoc_%s[];\n\n", argv[1]);
fprintf(fpout, "int datatoc_%s_size = %d;\n", argv[1], (int)size); fprintf(fpout, "int datatoc_%s_size = %d;\n", argv[1], (int)size);
fprintf(fpout, "char datatoc_%s[] = {\n", argv[1]); fprintf(fpout, "char datatoc_%s[] = {\n", argv[1]);
while (size--) { while (size--) {

View File

@@ -52,6 +52,7 @@
#include "BKE_deform.h" #include "BKE_deform.h"
#include "RNA_access.h" #include "RNA_access.h"
#include "RNA_enum_types.h"
#include "ED_anim_api.h" #include "ED_anim_api.h"
#include "ED_keyframing.h" #include "ED_keyframing.h"

View File

@@ -1075,10 +1075,11 @@ short insert_keyframe(ReportList *reports, ID *id, bAction *act, const char grou
/* for Loc/Rot/Scale and also Color F-Curves, the color of the F-Curve in the Graph Editor, /* for Loc/Rot/Scale and also Color F-Curves, the color of the F-Curve in the Graph Editor,
* is determined by the array index for the F-Curve * is determined by the array index for the F-Curve
*/ */
if (ELEM(RNA_property_subtype(prop), PROP_TRANSLATION, PROP_XYZ, PROP_EULER, PROP_COLOR, PROP_COORDS)) { PropertySubType prop_subtype = RNA_property_subtype(prop);
if (ELEM(prop_subtype, PROP_TRANSLATION, PROP_XYZ, PROP_EULER, PROP_COLOR, PROP_COORDS)) {
fcu->color_mode = FCURVE_COLOR_AUTO_RGB; fcu->color_mode = FCURVE_COLOR_AUTO_RGB;
} }
else if (RNA_property_subtype(prop), PROP_QUATERNION) { else if (ELEM(prop_subtype, PROP_QUATERNION)) {
fcu->color_mode = FCURVE_COLOR_AUTO_YRGB; fcu->color_mode = FCURVE_COLOR_AUTO_YRGB;
} }
} }

View File

@@ -314,7 +314,7 @@ void ED_gplayer_frames_keytype_set(bGPDlayer *gpl, short type)
*/ */
/* globals for copy/paste data (like for other copy/paste buffers) */ /* globals for copy/paste data (like for other copy/paste buffers) */
ListBase gp_anim_copybuf = {NULL, NULL}; static ListBase gp_anim_copybuf = {NULL, NULL};
static int gp_anim_copy_firstframe = 999999999; static int gp_anim_copy_firstframe = 999999999;
static int gp_anim_copy_lastframe = -999999999; static int gp_anim_copy_lastframe = -999999999;
static int gp_anim_copy_cfra = 0; static int gp_anim_copy_cfra = 0;

View File

@@ -343,7 +343,7 @@ ListBase gp_strokes_copypastebuf = {NULL, NULL};
* This is needed to prevent dangling and unsafe pointers when pasting across datablocks, * This is needed to prevent dangling and unsafe pointers when pasting across datablocks,
* or after a color used by a stroke in the buffer gets deleted (via user action or undo). * or after a color used by a stroke in the buffer gets deleted (via user action or undo).
*/ */
GHash *gp_strokes_copypastebuf_colors = NULL; static GHash *gp_strokes_copypastebuf_colors = NULL;
/* Free copy/paste buffer data */ /* Free copy/paste buffer data */
void ED_gpencil_strokes_copybuf_free(void) void ED_gpencil_strokes_copybuf_free(void)

View File

@@ -2224,9 +2224,9 @@ void ui_but_string_get_ex(uiBut *but, char *str, const size_t maxlen, const int
ui_get_but_string_unit(but, str, maxlen, value, false, float_precision); ui_get_but_string_unit(but, str, maxlen, value, false, float_precision);
} }
else { else {
const int prec = (float_precision == -1) ? ui_but_calc_float_precision(but, value) : float_precision; int prec = (float_precision == -1) ? ui_but_calc_float_precision(but, value) : float_precision;
if (use_exp_float) { if (use_exp_float) {
const int l10 = (int)log10(fabs(value)); const int l10 = (value == 0.0f) ? 0 : (int)log10(fabs(value));
if (l10 < -6 || l10 > 12) { if (l10 < -6 || l10 > 12) {
BLI_snprintf(str, maxlen, "%.*g", prec, value); BLI_snprintf(str, maxlen, "%.*g", prec, value);
if (r_use_exp_float) { if (r_use_exp_float) {
@@ -2234,7 +2234,9 @@ void ui_but_string_get_ex(uiBut *but, char *str, const size_t maxlen, const int
} }
} }
else { else {
BLI_snprintf(str, maxlen, "%.*f", prec - l10 + (int)(l10 < 0), value); prec -= l10 + (int)(l10 < 0);
CLAMP(prec, 0, UI_PRECISION_FLOAT_MAX);
BLI_snprintf(str, maxlen, "%.*f", prec, value);
} }
} }
else { else {

View File

@@ -821,8 +821,6 @@ static int brush_uv_sculpt_tool_set_exec(bContext *C, wmOperator *op)
static void BRUSH_OT_uv_sculpt_tool_set(wmOperatorType *ot) static void BRUSH_OT_uv_sculpt_tool_set(wmOperatorType *ot)
{ {
/* from rna_scene.c */
extern EnumPropertyItem uv_sculpt_tool_items[];
/* identifiers */ /* identifiers */
ot->name = "UV Sculpt Tool Set"; ot->name = "UV Sculpt Tool Set";
ot->description = "Set the UV sculpt tool"; ot->description = "Set the UV sculpt tool";
@@ -836,7 +834,7 @@ static void BRUSH_OT_uv_sculpt_tool_set(wmOperatorType *ot)
ot->flag = 0; ot->flag = 0;
/* props */ /* props */
ot->prop = RNA_def_enum(ot->srna, "tool", uv_sculpt_tool_items, 0, "Tool", ""); ot->prop = RNA_def_enum(ot->srna, "tool", rna_enum_uv_sculpt_tool_items, 0, "Tool", "");
} }
/***** Stencil Control *****/ /***** Stencil Control *****/

View File

@@ -821,7 +821,7 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
#endif #endif
} }
const char *clip_context_dir[] = {"edit_movieclip", "edit_mask", NULL}; static const char *clip_context_dir[] = {"edit_movieclip", "edit_mask", NULL};
static int clip_context(const bContext *C, const char *member, bContextDataResult *result) static int clip_context(const bContext *C, const char *member, bContextDataResult *result)
{ {

View File

@@ -436,7 +436,7 @@ static void sequencer_dropboxes(void)
/* ************* end drop *********** */ /* ************* end drop *********** */
const char *sequencer_context_dir[] = {"edit_mask", NULL}; static const char *sequencer_context_dir[] = {"edit_mask", NULL};
static int sequencer_context(const bContext *C, const char *member, bContextDataResult *result) static int sequencer_context(const bContext *C, const char *member, bContextDataResult *result)
{ {

View File

@@ -808,7 +808,6 @@ static bool pchan_autoik_adjust(bPoseChannel *pchan, short chainlen)
/* change the chain-length of auto-ik */ /* change the chain-length of auto-ik */
void transform_autoik_update(TransInfo *t, short mode) void transform_autoik_update(TransInfo *t, short mode)
{ {
const short old_len = t->settings->autoik_chainlen;
short *chainlen = &t->settings->autoik_chainlen; short *chainlen = &t->settings->autoik_chainlen;
bPoseChannel *pchan; bPoseChannel *pchan;
@@ -819,12 +818,13 @@ void transform_autoik_update(TransInfo *t, short mode)
} }
else if (mode == -1) { else if (mode == -1) {
/* mode==-1 is from WHEELMOUSEUP... decreases len */ /* mode==-1 is from WHEELMOUSEUP... decreases len */
if (*chainlen > 0) (*chainlen)--; if (*chainlen > 0) {
} (*chainlen)--;
}
/* IK length did not change, skip any updates. */ else {
if (old_len == *chainlen) { /* IK length did not change, skip updates. */
return; return;
}
} }
/* sanity checks (don't assume t->poseobj is set, or that it is an armature) */ /* sanity checks (don't assume t->poseobj is set, or that it is an armature) */

View File

@@ -78,7 +78,7 @@ typedef struct {
static size_t gpu_buffer_size_from_type(DerivedMesh *dm, GPUBufferType type); static size_t gpu_buffer_size_from_type(DerivedMesh *dm, GPUBufferType type);
const GPUBufferTypeSettings gpu_buffer_type_settings[] = { static const GPUBufferTypeSettings gpu_buffer_type_settings[] = {
/* vertex */ /* vertex */
{GL_ARRAY_BUFFER, 3}, {GL_ARRAY_BUFFER, 3},
/* normal */ /* normal */

View File

@@ -115,6 +115,8 @@ extern EnumPropertyItem rna_enum_brush_image_tool_items[];
extern EnumPropertyItem rna_enum_gpencil_sculpt_brush_items[]; extern EnumPropertyItem rna_enum_gpencil_sculpt_brush_items[];
extern EnumPropertyItem rna_enum_uv_sculpt_tool_items[];
extern EnumPropertyItem rna_enum_axis_xy_items[]; extern EnumPropertyItem rna_enum_axis_xy_items[];
extern EnumPropertyItem rna_enum_axis_xyz_items[]; extern EnumPropertyItem rna_enum_axis_xyz_items[];

View File

@@ -144,6 +144,9 @@ set(GENSRC_CFLAGS)
if(CMAKE_COMPILER_IS_GNUCC OR (CMAKE_C_COMPILER_ID MATCHES "Clang")) if(CMAKE_COMPILER_IS_GNUCC OR (CMAKE_C_COMPILER_ID MATCHES "Clang"))
set(GENSRC_CFLAGS "-Wno-missing-prototypes") set(GENSRC_CFLAGS "-Wno-missing-prototypes")
endif() endif()
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
set(GENSRC_CFLAGS "${GENSRC_CFLAGS} -Wno-missing-variable-declarations")
endif()
if(GENSRC_CFLAGS) if(GENSRC_CFLAGS)
set_source_files_properties(${GENSRC} PROPERTIES COMPILE_FLAGS "${GENSRC_CFLAGS}") set_source_files_properties(${GENSRC} PROPERTIES COMPILE_FLAGS "${GENSRC_CFLAGS}")

View File

@@ -46,6 +46,7 @@
#include "RNA_access.h" #include "RNA_access.h"
#include "RNA_define.h" #include "RNA_define.h"
#include "RNA_types.h" #include "RNA_types.h"
#include "RNA_enum_types.h"
#include "rna_internal.h" #include "rna_internal.h"

View File

@@ -242,10 +242,10 @@ bNodeTreeType *rna_node_tree_type_from_enum(int value)
EnumPropertyItem *rna_node_tree_type_itemf(void *data, int (*poll)(void *data, bNodeTreeType *), bool *r_free) EnumPropertyItem *rna_node_tree_type_itemf(void *data, int (*poll)(void *data, bNodeTreeType *), bool *r_free)
{ {
EnumPropertyItem tmp = {0, "", 0, "", ""}; EnumPropertyItem tmp = {0};
EnumPropertyItem *item = NULL; EnumPropertyItem *item = NULL;
int totitem = 0, i = 0; int totitem = 0, i = 0;
NODE_TREE_TYPES_BEGIN (nt) NODE_TREE_TYPES_BEGIN (nt)
{ {
if (poll && !poll(data, nt)) { if (poll && !poll(data, nt)) {
@@ -265,9 +265,14 @@ EnumPropertyItem *rna_node_tree_type_itemf(void *data, int (*poll)(void *data, b
} }
NODE_TREE_TYPES_END; NODE_TREE_TYPES_END;
if (totitem == 0) {
*r_free = false;
return DummyRNA_NULL_items;
}
RNA_enum_item_end(&item, &totitem); RNA_enum_item_end(&item, &totitem);
*r_free = true; *r_free = true;
return item; return item;
} }
@@ -314,9 +319,9 @@ bNodeType *rna_node_type_from_enum(int value)
EnumPropertyItem *rna_node_type_itemf(void *data, int (*poll)(void *data, bNodeType *), bool *r_free) EnumPropertyItem *rna_node_type_itemf(void *data, int (*poll)(void *data, bNodeType *), bool *r_free)
{ {
EnumPropertyItem *item = NULL; EnumPropertyItem *item = NULL;
EnumPropertyItem tmp = {0, "", 0, "", ""}; EnumPropertyItem tmp = {0};
int totitem = 0, i = 0; int totitem = 0, i = 0;
NODE_TYPES_BEGIN(ntype) NODE_TYPES_BEGIN(ntype)
if (poll && !poll(data, ntype)) { if (poll && !poll(data, ntype)) {
++i; ++i;
@@ -333,9 +338,15 @@ EnumPropertyItem *rna_node_type_itemf(void *data, int (*poll)(void *data, bNodeT
++i; ++i;
NODE_TYPES_END NODE_TYPES_END
if (totitem == 0) {
*r_free = false;
return DummyRNA_NULL_items;
}
RNA_enum_item_end(&item, &totitem); RNA_enum_item_end(&item, &totitem);
*r_free = true; *r_free = true;
return item; return item;
} }
@@ -382,10 +393,10 @@ bNodeSocketType *rna_node_socket_type_from_enum(int value)
EnumPropertyItem *rna_node_socket_type_itemf(void *data, int (*poll)(void *data, bNodeSocketType *), bool *r_free) EnumPropertyItem *rna_node_socket_type_itemf(void *data, int (*poll)(void *data, bNodeSocketType *), bool *r_free)
{ {
EnumPropertyItem *item = NULL; EnumPropertyItem *item = NULL;
EnumPropertyItem tmp = {0, "", 0, "", ""}; EnumPropertyItem tmp = {0};
int totitem = 0, i = 0; int totitem = 0, i = 0;
StructRNA *srna; StructRNA *srna;
NODE_SOCKET_TYPES_BEGIN(stype) NODE_SOCKET_TYPES_BEGIN(stype)
if (poll && !poll(data, stype)) { if (poll && !poll(data, stype)) {
++i; ++i;
@@ -403,9 +414,15 @@ EnumPropertyItem *rna_node_socket_type_itemf(void *data, int (*poll)(void *data,
++i; ++i;
NODE_SOCKET_TYPES_END NODE_SOCKET_TYPES_END
if (totitem == 0) {
*r_free = false;
return DummyRNA_NULL_items;
}
RNA_enum_item_end(&item, &totitem); RNA_enum_item_end(&item, &totitem);
*r_free = true; *r_free = true;
return item; return item;
} }
@@ -414,25 +431,25 @@ static EnumPropertyItem *rna_node_static_type_itemf(bContext *UNUSED(C), Pointer
EnumPropertyItem *item = NULL; EnumPropertyItem *item = NULL;
EnumPropertyItem tmp; EnumPropertyItem tmp;
int totitem = 0; int totitem = 0;
/* hack, don't want to add include path to RNA just for this, since in the future RNA types /* hack, don't want to add include path to RNA just for this, since in the future RNA types
* for nodes should be defined locally at runtime anyway ... * for nodes should be defined locally at runtime anyway ...
*/ */
tmp.value = NODE_CUSTOM; tmp.value = NODE_CUSTOM;
tmp.identifier = "CUSTOM"; tmp.identifier = "CUSTOM";
tmp.name = "Custom"; tmp.name = "Custom";
tmp.description = "Custom Node"; tmp.description = "Custom Node";
tmp.icon = ICON_NONE; tmp.icon = ICON_NONE;
RNA_enum_item_add(&item, &totitem, &tmp); RNA_enum_item_add(&item, &totitem, &tmp);
tmp.value = NODE_UNDEFINED; tmp.value = NODE_UNDEFINED;
tmp.identifier = "UNDEFINED"; tmp.identifier = "UNDEFINED";
tmp.name = "UNDEFINED"; tmp.name = "UNDEFINED";
tmp.description = ""; tmp.description = "";
tmp.icon = ICON_NONE; tmp.icon = ICON_NONE;
RNA_enum_item_add(&item, &totitem, &tmp); RNA_enum_item_add(&item, &totitem, &tmp);
#define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \ #define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
if (STREQ(#Category, "Node")) { \ if (STREQ(#Category, "Node")) { \
tmp.value = ID; \ tmp.value = ID; \
@@ -444,7 +461,7 @@ static EnumPropertyItem *rna_node_static_type_itemf(bContext *UNUSED(C), Pointer
} }
#include "../../nodes/NOD_static_types.h" #include "../../nodes/NOD_static_types.h"
#undef DefNode #undef DefNode
if (RNA_struct_is_a(ptr->type, &RNA_ShaderNode)) { if (RNA_struct_is_a(ptr->type, &RNA_ShaderNode)) {
#define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \ #define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
if (STREQ(#Category, "ShaderNode")) { \ if (STREQ(#Category, "ShaderNode")) { \
@@ -472,7 +489,7 @@ static EnumPropertyItem *rna_node_static_type_itemf(bContext *UNUSED(C), Pointer
#include "../../nodes/NOD_static_types.h" #include "../../nodes/NOD_static_types.h"
#undef DefNode #undef DefNode
} }
if (RNA_struct_is_a(ptr->type, &RNA_TextureNode)) { if (RNA_struct_is_a(ptr->type, &RNA_TextureNode)) {
#define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \ #define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
if (STREQ(#Category, "TextureNode")) { \ if (STREQ(#Category, "TextureNode")) { \
@@ -489,7 +506,7 @@ static EnumPropertyItem *rna_node_static_type_itemf(bContext *UNUSED(C), Pointer
RNA_enum_item_end(&item, &totitem); RNA_enum_item_end(&item, &totitem);
*r_free = true; *r_free = true;
return item; return item;
} }
@@ -2633,9 +2650,9 @@ static void rna_Node_image_layer_update(Main *bmain, Scene *scene, PointerRNA *p
static EnumPropertyItem *renderresult_layers_add_enum(RenderLayer *rl) static EnumPropertyItem *renderresult_layers_add_enum(RenderLayer *rl)
{ {
EnumPropertyItem *item = NULL; EnumPropertyItem *item = NULL;
EnumPropertyItem tmp = {0, "", 0, "", ""}; EnumPropertyItem tmp = {0};
int i = 0, totitem = 0; int i = 0, totitem = 0;
while (rl) { while (rl) {
tmp.identifier = rl->name; tmp.identifier = rl->name;
/* little trick: using space char instead empty string makes the item selectable in the dropdown */ /* little trick: using space char instead empty string makes the item selectable in the dropdown */
@@ -2647,7 +2664,7 @@ static EnumPropertyItem *renderresult_layers_add_enum(RenderLayer *rl)
RNA_enum_item_add(&item, &totitem, &tmp); RNA_enum_item_add(&item, &totitem, &tmp);
rl = rl->next; rl = rl->next;
} }
RNA_enum_item_end(&item, &totitem); RNA_enum_item_end(&item, &totitem);
return item; return item;
@@ -2660,18 +2677,17 @@ static EnumPropertyItem *rna_Node_image_layer_itemf(bContext *UNUSED(C), Pointer
Image *ima = (Image *)node->id; Image *ima = (Image *)node->id;
EnumPropertyItem *item = NULL; EnumPropertyItem *item = NULL;
RenderLayer *rl; RenderLayer *rl;
if (ima && ima->rr) { if (ima == NULL || ima->rr == NULL) {
rl = ima->rr->layers.first; *r_free = false;
item = renderresult_layers_add_enum(rl); return DummyRNA_NULL_items;
} }
else {
int totitem = 0; rl = ima->rr->layers.first;
RNA_enum_item_end(&item, &totitem); item = renderresult_layers_add_enum(rl);
}
*r_free = true; *r_free = true;
return item; return item;
} }
@@ -2722,19 +2738,22 @@ static EnumPropertyItem *renderresult_views_add_enum(RenderView *rv)
} }
static EnumPropertyItem *rna_Node_image_view_itemf(bContext *UNUSED(C), PointerRNA *ptr, static EnumPropertyItem *rna_Node_image_view_itemf(bContext *UNUSED(C), PointerRNA *ptr,
PropertyRNA *UNUSED(prop), bool *free) PropertyRNA *UNUSED(prop), bool *r_free)
{ {
bNode *node = (bNode *)ptr->data; bNode *node = (bNode *)ptr->data;
Image *ima = (Image *)node->id; Image *ima = (Image *)node->id;
EnumPropertyItem *item = NULL; EnumPropertyItem *item = NULL;
RenderView *rv; RenderView *rv;
if (!ima || !(ima->rr)) return NULL; if (ima == NULL || ima->rr == NULL) {
*r_free = false;
return DummyRNA_NULL_items;
}
rv = ima->rr->views.first; rv = ima->rr->views.first;
item = renderresult_views_add_enum(rv); item = renderresult_views_add_enum(rv);
*free = true; *r_free = true;
return item; return item;
} }
@@ -2746,18 +2765,17 @@ static EnumPropertyItem *rna_Node_scene_layer_itemf(bContext *UNUSED(C), Pointer
Scene *sce = (Scene *)node->id; Scene *sce = (Scene *)node->id;
EnumPropertyItem *item = NULL; EnumPropertyItem *item = NULL;
RenderLayer *rl; RenderLayer *rl;
if (sce) { if (sce == NULL) {
rl = sce->r.layers.first; *r_free = false;
item = renderresult_layers_add_enum(rl); return DummyRNA_NULL_items;
} }
else {
int totitem = 0; rl = sce->r.layers.first;
RNA_enum_item_end(&item, &totitem); item = renderresult_layers_add_enum(rl);
}
*r_free = true; *r_free = true;
return item; return item;
} }
@@ -2774,7 +2792,7 @@ static EnumPropertyItem *rna_Node_channel_itemf(bContext *UNUSED(C), PointerRNA
{ {
bNode *node = (bNode *)ptr->data; bNode *node = (bNode *)ptr->data;
EnumPropertyItem *item = NULL; EnumPropertyItem *item = NULL;
EnumPropertyItem tmp = {0, "", 0, "", ""}; EnumPropertyItem tmp = {0};
int totitem = 0; int totitem = 0;
switch (node->custom1) { switch (node->custom1) {
@@ -2811,7 +2829,7 @@ static EnumPropertyItem *rna_Node_channel_itemf(bContext *UNUSED(C), PointerRNA
RNA_enum_item_add(&item, &totitem, &tmp); RNA_enum_item_add(&item, &totitem, &tmp);
break; break;
default: default:
break; return DummyRNA_NULL_items;
} }
RNA_enum_item_end(&item, &totitem); RNA_enum_item_end(&item, &totitem);

View File

@@ -99,13 +99,13 @@ EnumPropertyItem rna_enum_exr_codec_items[] = {
}; };
#endif #endif
EnumPropertyItem uv_sculpt_relaxation_items[] = { static EnumPropertyItem uv_sculpt_relaxation_items[] = {
{UV_SCULPT_TOOL_RELAX_LAPLACIAN, "LAPLACIAN", 0, "Laplacian", "Use Laplacian method for relaxation"}, {UV_SCULPT_TOOL_RELAX_LAPLACIAN, "LAPLACIAN", 0, "Laplacian", "Use Laplacian method for relaxation"},
{UV_SCULPT_TOOL_RELAX_HC, "HC", 0, "HC", "Use HC method for relaxation"}, {UV_SCULPT_TOOL_RELAX_HC, "HC", 0, "HC", "Use HC method for relaxation"},
{0, NULL, 0, NULL, NULL} {0, NULL, 0, NULL, NULL}
}; };
EnumPropertyItem uv_sculpt_tool_items[] = { EnumPropertyItem rna_enum_uv_sculpt_tool_items[] = {
{UV_SCULPT_TOOL_PINCH, "PINCH", 0, "Pinch", "Pinch UVs"}, {UV_SCULPT_TOOL_PINCH, "PINCH", 0, "Pinch", "Pinch UVs"},
{UV_SCULPT_TOOL_RELAX, "RELAX", 0, "Relax", "Relax UVs"}, {UV_SCULPT_TOOL_RELAX, "RELAX", 0, "Relax", "Relax UVs"},
{UV_SCULPT_TOOL_GRAB, "GRAB", 0, "Grab", "Grab UVs"}, {UV_SCULPT_TOOL_GRAB, "GRAB", 0, "Grab", "Grab UVs"},
@@ -3561,7 +3561,7 @@ static void rna_def_tool_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "uv_sculpt_tool", PROP_ENUM, PROP_NONE); prop = RNA_def_property(srna, "uv_sculpt_tool", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "uv_sculpt_tool"); RNA_def_property_enum_sdna(prop, NULL, "uv_sculpt_tool");
RNA_def_property_enum_items(prop, uv_sculpt_tool_items); RNA_def_property_enum_items(prop, rna_enum_uv_sculpt_tool_items);
RNA_def_property_ui_text(prop, "UV Sculpt Tools", "Select Tools for the UV sculpt brushes"); RNA_def_property_ui_text(prop, "UV Sculpt Tools", "Select Tools for the UV sculpt brushes");
prop = RNA_def_property(srna, "uv_relax_method", PROP_ENUM, PROP_NONE); prop = RNA_def_property(srna, "uv_relax_method", PROP_ENUM, PROP_NONE);

View File

@@ -28,6 +28,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "RNA_define.h" #include "RNA_define.h"
#include "RNA_enum_types.h"
#include "rna_internal.h" #include "rna_internal.h"
@@ -75,7 +76,7 @@ EnumPropertyItem rna_enum_gpencil_sculpt_brush_items[] = {
{ 0, NULL, 0, NULL, NULL } { 0, NULL, 0, NULL, NULL }
}; };
EnumPropertyItem rna_enum_gpencil_lockaxis_items[] = { static EnumPropertyItem rna_enum_gpencil_lockaxis_items[] = {
{ GP_LOCKAXIS_NONE, "GP_LOCKAXIS_NONE", 0, "None", "" }, { GP_LOCKAXIS_NONE, "GP_LOCKAXIS_NONE", 0, "None", "" },
{ GP_LOCKAXIS_X, "GP_LOCKAXIS_X", 0, "X", "Project strokes to plane locked to X" }, { GP_LOCKAXIS_X, "GP_LOCKAXIS_X", 0, "X", "Project strokes to plane locked to X" },
{ GP_LOCKAXIS_Y, "GP_LOCKAXIS_Y", 0, "Y", "Project strokes to plane locked to Y" }, { GP_LOCKAXIS_Y, "GP_LOCKAXIS_Y", 0, "Y", "Project strokes to plane locked to Y" },

View File

@@ -47,6 +47,8 @@
#include "BKE_particle.h" #include "BKE_particle.h"
#include "BKE_scene.h" #include "BKE_scene.h"
#ifdef _OPENMP #ifdef _OPENMP
# include "BKE_mesh.h" /* BKE_MESH_OMP_LIMIT */ # include "BKE_mesh.h" /* BKE_MESH_OMP_LIMIT */
#endif #endif

View File

@@ -40,7 +40,6 @@
#include "BLI_math.h" #include "BLI_math.h"
#include "BLI_utildefines.h" #include "BLI_utildefines.h"
#include "BKE_collision.h" #include "BKE_collision.h"
#include "BKE_cdderivedmesh.h" #include "BKE_cdderivedmesh.h"
#include "BKE_global.h" #include "BKE_global.h"
@@ -48,6 +47,8 @@
#include "BKE_pointcache.h" #include "BKE_pointcache.h"
#include "BKE_scene.h" #include "BKE_scene.h"
#include "MOD_modifiertypes.h"
static void initData(ModifierData *md) static void initData(ModifierData *md)
{ {
CollisionModifierData *collmd = (CollisionModifierData *) md; CollisionModifierData *collmd = (CollisionModifierData *) md;

View File

@@ -48,6 +48,8 @@
#include "DEG_depsgraph.h" #include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h" #include "DEG_depsgraph_build.h"
#include "MOD_modifiertypes.h"
static void initData(ModifierData *md) static void initData(ModifierData *md)
{ {
CurveModifierData *cmd = (CurveModifierData *) md; CurveModifierData *cmd = (CurveModifierData *) md;

View File

@@ -45,6 +45,7 @@
#include "DEG_depsgraph_build.h" #include "DEG_depsgraph_build.h"
#include "MOD_modifiertypes.h"
static void initData(ModifierData *md) static void initData(ModifierData *md)
{ {

View File

@@ -48,6 +48,7 @@
#include "DNA_object_types.h" #include "DNA_object_types.h"
#include "MOD_modifiertypes.h"
static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd) static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd)
{ {

View File

@@ -53,6 +53,7 @@
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
#include "MOD_modifiertypes.h"
static void initData(ModifierData *md) static void initData(ModifierData *md)
{ {

View File

@@ -47,6 +47,8 @@
#include "DEG_depsgraph_build.h" #include "DEG_depsgraph_build.h"
#include "MOD_fluidsim_util.h" #include "MOD_fluidsim_util.h"
#include "MOD_modifiertypes.h"
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
/* Fluidsim */ /* Fluidsim */

View File

@@ -52,6 +52,8 @@
#include "DEG_depsgraph_build.h" #include "DEG_depsgraph_build.h"
#include "MOD_modifiertypes.h"
#include "BLI_strict_flags.h" #include "BLI_strict_flags.h"
static void copyData(ModifierData *md, ModifierData *target) static void copyData(ModifierData *md, ModifierData *target)

View File

@@ -47,6 +47,8 @@
#include "DEG_depsgraph_build.h" #include "DEG_depsgraph_build.h"
#include "MOD_modifiertypes.h"
static void initData(ModifierData *md) static void initData(ModifierData *md)
{ {
MirrorModifierData *mmd = (MirrorModifierData *) md; MirrorModifierData *mmd = (MirrorModifierData *) md;

View File

@@ -46,6 +46,8 @@
#include "BKE_modifier.h" #include "BKE_modifier.h"
#include "BKE_subsurf.h" #include "BKE_subsurf.h"
#include "MOD_modifiertypes.h"
static void initData(ModifierData *md) static void initData(ModifierData *md)
{ {
MultiresModifierData *mmd = (MultiresModifierData *)md; MultiresModifierData *mmd = (MultiresModifierData *)md;

View File

@@ -44,6 +44,8 @@
#include "BKE_modifier.h" #include "BKE_modifier.h"
#include "BKE_ocean.h" #include "BKE_ocean.h"
#include "MOD_modifiertypes.h"
#ifdef WITH_OCEANSIM #ifdef WITH_OCEANSIM
static void init_cache_data(Object *ob, struct OceanModifierData *omd) static void init_cache_data(Object *ob, struct OceanModifierData *omd)
{ {

View File

@@ -53,6 +53,8 @@
#include "DEG_depsgraph_build.h" #include "DEG_depsgraph_build.h"
#include "MOD_modifiertypes.h"
static void initData(ModifierData *md) static void initData(ModifierData *md)
{ {
ParticleInstanceModifierData *pimd = (ParticleInstanceModifierData *) md; ParticleInstanceModifierData *pimd = (ParticleInstanceModifierData *) md;

View File

@@ -77,6 +77,8 @@
#include "BKE_mesh_mapping.h" #include "BKE_mesh_mapping.h"
#include "BKE_modifier.h" #include "BKE_modifier.h"
#include "MOD_modifiertypes.h"
#include "bmesh.h" #include "bmesh.h"
typedef struct { typedef struct {

View File

@@ -45,7 +45,6 @@
#include "BLI_utildefines.h" #include "BLI_utildefines.h"
#include "BKE_cdderivedmesh.h" #include "BKE_cdderivedmesh.h"
#include "BKE_layer.h" #include "BKE_layer.h"
#include "BKE_library.h" #include "BKE_library.h"
@@ -57,6 +56,8 @@
#include "DEG_depsgraph.h" #include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h" #include "DEG_depsgraph_build.h"
#include "MOD_modifiertypes.h"
static void initData(ModifierData *md) static void initData(ModifierData *md)
{ {
SmokeModifierData *smd = (SmokeModifierData *) md; SmokeModifierData *smd = (SmokeModifierData *) md;

View File

@@ -35,6 +35,8 @@
#include "bmesh.h" #include "bmesh.h"
#include "bmesh_tools.h" #include "bmesh_tools.h"
#include "MOD_modifiertypes.h"
static DerivedMesh *triangulate_dm(DerivedMesh *dm, const int quad_method, const int ngon_method) static DerivedMesh *triangulate_dm(DerivedMesh *dm, const int quad_method, const int ngon_method)
{ {
DerivedMesh *result; DerivedMesh *result;

View File

@@ -49,7 +49,9 @@
#include "DEG_depsgraph_build.h" #include "DEG_depsgraph_build.h"
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
#include "MOD_weightvg_util.h" #include "MOD_weightvg_util.h"
#include "MOD_modifiertypes.h"
/************************************** /**************************************
* Modifiers functions. * * Modifiers functions. *

View File

@@ -46,7 +46,9 @@
#include "DEG_depsgraph_build.h" #include "DEG_depsgraph_build.h"
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
#include "MOD_weightvg_util.h" #include "MOD_weightvg_util.h"
#include "MOD_modifiertypes.h"
/** /**

View File

@@ -50,7 +50,9 @@
#include "DEG_depsgraph_build.h" #include "DEG_depsgraph_build.h"
#include "MEM_guardedalloc.h" #include "MEM_guardedalloc.h"
#include "MOD_weightvg_util.h" #include "MOD_weightvg_util.h"
#include "MOD_modifiertypes.h"
//#define USE_TIMEIT //#define USE_TIMEIT

View File

@@ -809,9 +809,19 @@ static char *wm_prop_pystring_from_context(bContext *C, PointerRNA *ptr, Propert
} \ } \
} (void)0 } (void)0
#define CTX_TEST_SPACE_TYPE(space_data_type, member_full, dataptr_cmp) \
{ \
const char *ctx_member_full = member_full; \
if (space_data->spacetype == space_data_type && ptr->data == dataptr_cmp) { \
member_id = ctx_member_full; \
break; \
} \
} (void)0
switch (GS(((ID *)ptr->id.data)->name)) { switch (GS(((ID *)ptr->id.data)->name)) {
case ID_SCE: case ID_SCE:
{ {
CTX_TEST_PTR_DATA_TYPE(C, "active_gpencil_brush", RNA_GPencilBrush, ptr, CTX_data_active_gpencil_brush(C));
CTX_TEST_PTR_ID(C, "scene", ptr->id.data); CTX_TEST_PTR_ID(C, "scene", ptr->id.data);
break; break;
} }
@@ -846,10 +856,18 @@ static char *wm_prop_pystring_from_context(bContext *C, PointerRNA *ptr, Propert
{ {
CTX_TEST_PTR_ID(C, "screen", ptr->id.data); CTX_TEST_PTR_ID(C, "screen", ptr->id.data);
CTX_TEST_PTR_DATA_TYPE(C, "space_data", RNA_Space, ptr, CTX_wm_space_data(C)); SpaceLink *space_data = CTX_wm_space_data(C);
CTX_TEST_PTR_DATA_TYPE(C, "space_data", RNA_Space, ptr, space_data);
CTX_TEST_PTR_DATA_TYPE(C, "area", RNA_Area, ptr, CTX_wm_area(C)); CTX_TEST_PTR_DATA_TYPE(C, "area", RNA_Area, ptr, CTX_wm_area(C));
CTX_TEST_PTR_DATA_TYPE(C, "region", RNA_Region, ptr, CTX_wm_region(C)); CTX_TEST_PTR_DATA_TYPE(C, "region", RNA_Region, ptr, CTX_wm_region(C));
CTX_TEST_SPACE_TYPE(SPACE_IMAGE, "space_data.uv_editor", space_data);
CTX_TEST_SPACE_TYPE(SPACE_VIEW3D, "space_data.fx_settings", &(CTX_wm_view3d(C)->fx_settings));
CTX_TEST_SPACE_TYPE(SPACE_NLA, "space_data.dopesheet", CTX_wm_space_nla(C)->ads);
CTX_TEST_SPACE_TYPE(SPACE_IPO, "space_data.dopesheet", CTX_wm_space_graph(C)->ads);
CTX_TEST_SPACE_TYPE(SPACE_ACTION, "space_data.dopesheet", &(CTX_wm_space_action(C)->ads));
CTX_TEST_SPACE_TYPE(SPACE_FILE, "space_data.params", CTX_wm_space_file(C)->params);
break; break;
} }
} }
@@ -863,6 +881,7 @@ static char *wm_prop_pystring_from_context(bContext *C, PointerRNA *ptr, Propert
} }
#undef CTX_TEST_PTR_ID #undef CTX_TEST_PTR_ID
#undef CTX_TEST_PTR_ID_CAST #undef CTX_TEST_PTR_ID_CAST
#undef CTX_TEST_SPACE_TYPE
} }
return ret; return ret;