Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-01-27 03:49:13 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-01-27 03:49:13 +0400
commit556912792ad3c37c294256a558c96b39f264e7b5 (patch)
tree9b6ee8cf1ad92ee89c04f27a89be11599c5b40c0 /source/blender/makesrna
parent9251d628db0abe599d927d79170025d8545c8ace (diff)
parentc84383301c5a2582e95259a7e4468a23a3566401 (diff)
Merged changes in the trunk up to revision 54110.
Conflicts resolved: source/blender/blenfont/SConscript source/blender/blenkernel/intern/subsurf_ccg.c source/blender/makesdna/intern/makesdna.c source/blender/makesrna/intern/rna_scene.c
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/RNA_access.h3
-rw-r--r--source/blender/makesrna/RNA_define.h2
-rw-r--r--source/blender/makesrna/RNA_enum_types.h6
-rw-r--r--source/blender/makesrna/RNA_types.h13
-rw-r--r--source/blender/makesrna/SConscript6
-rw-r--r--source/blender/makesrna/intern/CMakeLists.txt8
-rw-r--r--source/blender/makesrna/intern/SConscript6
-rw-r--r--source/blender/makesrna/intern/makesrna.c28
-rw-r--r--source/blender/makesrna/intern/rna_access.c27
-rw-r--r--source/blender/makesrna/intern/rna_action.c2
-rw-r--r--source/blender/makesrna/intern/rna_brush.c18
-rw-r--r--source/blender/makesrna/intern/rna_color.c2
-rw-r--r--source/blender/makesrna/intern/rna_define.c31
-rw-r--r--source/blender/makesrna/intern/rna_image.c65
-rw-r--r--source/blender/makesrna/intern/rna_internal.h1
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c87
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c5
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c167
-rw-r--r--source/blender/makesrna/intern/rna_nla.c2
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c3
-rw-r--r--source/blender/makesrna/intern/rna_object.c41
-rw-r--r--source/blender/makesrna/intern/rna_object_force.c2
-rw-r--r--source/blender/makesrna/intern/rna_particle.c14
-rw-r--r--source/blender/makesrna/intern/rna_rigidbody.c1008
-rw-r--r--source/blender/makesrna/intern/rna_rna.c30
-rw-r--r--source/blender/makesrna/intern/rna_scene.c24
-rw-r--r--source/blender/makesrna/intern/rna_scene_api.c4
-rw-r--r--source/blender/makesrna/intern/rna_sculpt_paint.c43
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c11
-rw-r--r--source/blender/makesrna/intern/rna_space.c72
-rw-r--r--source/blender/makesrna/intern/rna_texture.c6
-rw-r--r--source/blender/makesrna/intern/rna_texture_api.c2
-rw-r--r--source/blender/makesrna/intern/rna_ui.c6
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c32
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c35
-rw-r--r--source/blender/makesrna/intern/rna_wm.c11
36 files changed, 1662 insertions, 161 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index af182c467be..821b429e75c 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -92,6 +92,7 @@ extern StructRNA RNA_BoolProperty;
extern StructRNA RNA_Brush;
extern StructRNA RNA_BrushTextureSlot;
extern StructRNA RNA_BuildModifier;
+extern StructRNA RNA_MeshCacheModifier;
extern StructRNA RNA_Camera;
extern StructRNA RNA_CastModifier;
extern StructRNA RNA_ChildOfConstraint;
@@ -466,6 +467,8 @@ extern StructRNA RNA_RenderLayer;
extern StructRNA RNA_RenderPass;
extern StructRNA RNA_RenderResult;
extern StructRNA RNA_RenderSettings;
+extern StructRNA RNA_RigidBodyWorld;
+extern StructRNA RNA_RigidBodyObject;
extern StructRNA RNA_RigidBodyJointConstraint;
extern StructRNA RNA_SPHFluidSettings;
extern StructRNA RNA_Scene;
diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h
index 463e0e04679..cd6d74c3488 100644
--- a/source/blender/makesrna/RNA_define.h
+++ b/source/blender/makesrna/RNA_define.h
@@ -87,7 +87,7 @@ PropertyRNA *RNA_def_string(StructOrFunctionRNA *cont, const char *identifier, c
PropertyRNA *RNA_def_string_file_path(StructOrFunctionRNA *cont, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description);
PropertyRNA *RNA_def_string_dir_path(StructOrFunctionRNA *cont, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description);
PropertyRNA *RNA_def_string_file_name(StructOrFunctionRNA *cont, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description);
-PropertyRNA *RNA_def_string_translate(StructOrFunctionRNA *cont, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description);
+PropertyRNA *RNA_def_string_py_translate(StructOrFunctionRNA *cont, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description);
PropertyRNA *RNA_def_enum(StructOrFunctionRNA *cont, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description);
PropertyRNA *RNA_def_enum_flag(StructOrFunctionRNA *cont, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description);
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h
index a8df3b9dfdd..8038f97ec54 100644
--- a/source/blender/makesrna/RNA_enum_types.h
+++ b/source/blender/makesrna/RNA_enum_types.h
@@ -102,6 +102,12 @@ extern EnumPropertyItem object_type_items[];
extern EnumPropertyItem object_type_curve_items[];
+extern EnumPropertyItem rigidbody_ob_type_items[];
+extern EnumPropertyItem rigidbody_ob_shape_items[];
+extern EnumPropertyItem rigidbody_con_type_items[];
+
+extern EnumPropertyItem object_axis_items[];
+
extern EnumPropertyItem controller_type_items[];
extern EnumPropertyItem keymap_propvalue_items[];
diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h
index c76f9824c73..5f34fad09c6 100644
--- a/source/blender/makesrna/RNA_types.h
+++ b/source/blender/makesrna/RNA_types.h
@@ -110,10 +110,9 @@ typedef enum PropertySubType {
PROP_FILEPATH = 1,
PROP_DIRPATH = 2,
PROP_FILENAME = 3,
- PROP_BYTESTRING = 4, /* a string which should be represented as bytes
- * in python, still NULL terminated though. */
- PROP_TRANSLATE = 5, /* a string which should be translated */
- PROP_PASSWORD = 6, /* a string which should not be displayed in UI */
+ PROP_BYTESTRING = 4, /* a string which should be represented as bytes in python, still NULL terminated though. */
+ /* 5 was used by "PROP_TRANSLATE" sub-type, which is now a flag. */
+ PROP_PASSWORD = 6, /* a string which should not be displayed in UI */
/* numbers */
PROP_UNSIGNED = 13,
@@ -144,6 +143,7 @@ typedef enum PropertySubType {
} PropertySubType;
/* Make sure enums are updated with thses */
+/* HIGHEST FLAG IN USE: 1 << 29 */
typedef enum PropertyFlag {
/* editable means the property is editable in the user
* interface, properties are editable by default except
@@ -200,6 +200,11 @@ typedef enum PropertyFlag {
*/
PROP_ENUM_FLAG = (1 << 21),
+ /* A string which should be translated when converting from py string to RNA prop.
+ * Should only be used in some functions' properties (currently only "text" one of funcs in UI API).
+ */
+ PROP_STRING_PY_TRANSLATE = (1 << 28),
+
/* need context for update function */
PROP_CONTEXT_UPDATE = (1 << 22),
PROP_CONTEXT_PROPERTY_UPDATE = (1 << 22) | (1 << 27),
diff --git a/source/blender/makesrna/SConscript b/source/blender/makesrna/SConscript
index 464939dc879..f3beee8bc14 100644
--- a/source/blender/makesrna/SConscript
+++ b/source/blender/makesrna/SConscript
@@ -38,6 +38,8 @@ incs += ' ../render/extern/include #/intern/cycles/blender'
incs += ' ../nodes'
incs += ' #/extern/glew/include'
incs += ' #/intern/smoke/extern'
+incs += ' ../rigidbody'
+
incs += ' ../bmesh'
defs = []
@@ -45,6 +47,10 @@ defs = []
if env['WITH_BF_SMOKE']:
defs.append('WITH_SMOKE')
+if env['WITH_BF_BULLET']:
+ defs.append('WITH_BULLET')
+ incs += ' ../../rigidbody'
+
if env['WITH_BF_OPENEXR']:
defs.append('WITH_OPENEXR')
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index a8b9b779ff8..2fb1f0bf6b4 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -70,6 +70,7 @@ set(DEFSRC
rna_pose.c
rna_property.c
rna_render.c
+ rna_rigidbody.c
rna_rna.c
rna_scene.c
rna_screen.c
@@ -243,6 +244,13 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
+if(WITH_BULLET)
+ list(APPEND INC
+ ../../rigidbody
+ )
+ add_definitions(-DWITH_BULLET)
+endif()
+
# Build makesrna executable
blender_include_dirs(
.
diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript
index 11562d729df..e159b9fd8eb 100644
--- a/source/blender/makesrna/intern/SConscript
+++ b/source/blender/makesrna/intern/SConscript
@@ -67,7 +67,11 @@ incs += ' #/intern/smoke/extern'
if env['WITH_BF_SMOKE']:
defs.append('WITH_SMOKE')
-
+
+if env['WITH_BF_BULLET']:
+ defs.append('WITH_BULLET')
+ incs += ' ../../rigidbody'
+
if env['WITH_BF_OPENEXR']:
defs.append('WITH_OPENEXR')
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index 0992153560f..b4bf241815d 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -2444,7 +2444,6 @@ static const char *rna_property_subtypename(PropertySubType type)
case PROP_FILENAME: return "PROP_FILENAME";
case PROP_DIRPATH: return "PROP_DIRPATH";
case PROP_BYTESTRING: return "PROP_BYTESTRING";
- case PROP_TRANSLATE: return "PROP_TRANSLATE";
case PROP_UNSIGNED: return "PROP_UNSIGNED";
case PROP_PERCENTAGE: return "PROP_PERCENTAGE";
case PROP_FACTOR: return "PROP_FACTOR";
@@ -2466,7 +2465,8 @@ static const char *rna_property_subtypename(PropertySubType type)
case PROP_LAYER: return "PROP_LAYER";
case PROP_LAYER_MEMBER: return "PROP_LAYER_MEMBER";
case PROP_PASSWORD: return "PROP_PASSWORD";
- default: {
+ default:
+ {
/* in case we don't have a type preset that includes the subtype */
if (RNA_SUBTYPE_UNIT(type)) {
return rna_property_subtypename(type & ~RNA_SUBTYPE_UNIT(type));
@@ -3262,6 +3262,7 @@ static RNAProcessItem PROCESS_ITEMS[] = {
{"rna_pose.c", "rna_pose_api.c", RNA_def_pose},
{"rna_property.c", NULL, RNA_def_gameproperty},
{"rna_render.c", NULL, RNA_def_render},
+ {"rna_rigidbody.c", NULL, RNA_def_rigidbody},
{"rna_scene.c", "rna_scene_api.c", RNA_def_scene},
{"rna_screen.c", NULL, RNA_def_screen},
{"rna_sculpt_paint.c", NULL, RNA_def_sculpt_paint},
@@ -3547,8 +3548,27 @@ static const char *cpp_classes = ""
"#define COLLECTION_PROPERTY_LOOKUP_STRING_FALSE(sname, identifier) \\\n"
" inline static int sname##_##identifier##_lookup_string_wrap(PointerRNA *ptr, const char *key, PointerRNA *r_ptr) \\\n"
" { \\\n"
-" memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
-" return 0; \\\n"
+" CollectionPropertyIterator iter; \\\n"
+" int found = 0; \\\n"
+" PropertyRNA *item_name_prop = RNA_struct_name_property(ptr->type); \\\n"
+" sname##_##identifier##_begin(&iter, ptr); \\\n"
+" while (iter.valid && !found) { \\\n"
+" char name_fixed[32]; \\\n"
+" const char *name; \\\n"
+" int name_length; \\\n"
+" name = RNA_property_string_get_alloc(&iter.ptr, item_name_prop, name_fixed, sizeof(name_fixed), &name_length); \\\n"
+" if (!strncmp(name, key, name_length)) { \\\n"
+" *r_ptr = iter.ptr; \\\n"
+" found = 1; \\\n"
+" } \\\n"
+" if (name_fixed != name) \\\n"
+" MEM_freeN((void *) name); \\\n"
+" sname##_##identifier##_next(&iter); \\\n"
+" } \\\n"
+" sname##_##identifier##_end(&iter); \\\n"
+" if (!found) \\\n"
+" memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
+" return found; \\\n"
" } \n"
"#define COLLECTION_PROPERTY_LOOKUP_STRING_TRUE(sname, identifier) \\\n"
" inline static int sname##_##identifier##_lookup_string_wrap(PointerRNA *ptr, const char *key, PointerRNA *r_ptr) \\\n"
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 59bcb1506af..aecc114f328 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -1505,7 +1505,7 @@ int RNA_property_path_from_ID_check(PointerRNA *ptr, PropertyRNA *prop)
static void rna_property_update(bContext *C, Main *bmain, Scene *scene, PointerRNA *ptr, PropertyRNA *prop)
{
- int is_rna = (prop->magic == RNA_MAGIC);
+ const bool is_rna = (prop->magic == RNA_MAGIC);
prop = rna_ensure_property(prop);
if (is_rna) {
@@ -1585,19 +1585,19 @@ static ListBase rna_updates_cache = {NULL, NULL};
void RNA_property_update_cache_add(PointerRNA *ptr, PropertyRNA *prop)
{
+ const bool is_rna = (prop->magic == RNA_MAGIC);
tRnaUpdateCacheElem *uce = NULL;
UpdateFunc fn = NULL;
LinkData *ld;
- short is_rna = (prop->magic == RNA_MAGIC);
/* sanity check */
- if (ELEM(NULL, ptr, prop))
+ if (NULL == ptr)
return;
prop = rna_ensure_property(prop);
/* we can only handle update calls with no context args for now (makes animsys updates easier) */
- if ((is_rna == 0) || (prop->update == NULL) || (prop->flag & PROP_CONTEXT_UPDATE))
+ if ((is_rna == false) || (prop->update == NULL) || (prop->flag & PROP_CONTEXT_UPDATE))
return;
fn = prop->update;
@@ -4210,11 +4210,11 @@ char *RNA_path_from_ID_to_struct(PointerRNA *ptr)
char *RNA_path_from_ID_to_property(PointerRNA *ptr, PropertyRNA *prop)
{
- int is_rna = (prop->magic == RNA_MAGIC);
+ const bool is_rna = (prop->magic == RNA_MAGIC);
const char *propname;
char *ptrpath, *path;
- if (!ptr->id.data || !ptr->data || !prop)
+ if (!ptr->id.data || !ptr->data)
return NULL;
/* path from ID to the struct holding this property */
@@ -6097,7 +6097,8 @@ int RNA_property_equals(PointerRNA *a, PointerRNA *b, PropertyRNA *prop)
/* get and set the default values as appropriate for the various types */
switch (RNA_property_type(prop)) {
- case PROP_BOOLEAN: {
+ case PROP_BOOLEAN:
+ {
if (len) {
int fixed_a[16], fixed_b[16];
int *array_a, *array_b;
@@ -6122,7 +6123,8 @@ int RNA_property_equals(PointerRNA *a, PointerRNA *b, PropertyRNA *prop)
}
}
- case PROP_INT: {
+ case PROP_INT:
+ {
if (len) {
int fixed_a[16], fixed_b[16];
int *array_a, *array_b;
@@ -6147,7 +6149,8 @@ int RNA_property_equals(PointerRNA *a, PointerRNA *b, PropertyRNA *prop)
}
}
- case PROP_FLOAT: {
+ case PROP_FLOAT:
+ {
if (len) {
float fixed_a[16], fixed_b[16];
float *array_a, *array_b;
@@ -6172,12 +6175,14 @@ int RNA_property_equals(PointerRNA *a, PointerRNA *b, PropertyRNA *prop)
}
}
- case PROP_ENUM: {
+ case PROP_ENUM:
+ {
int value = RNA_property_enum_get(a, prop);
return value == RNA_property_enum_get(b, prop);
}
- case PROP_STRING: {
+ case PROP_STRING:
+ {
char fixed_a[128], fixed_b[128];
int len_a, len_b;
char *value_a = RNA_property_string_get_alloc(a, prop, fixed_a, sizeof(fixed_a), &len_a);
diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c
index 06c01012e19..da8aa15cf2e 100644
--- a/source/blender/makesrna/intern/rna_action.c
+++ b/source/blender/makesrna/intern/rna_action.c
@@ -39,6 +39,8 @@
#include "MEM_guardedalloc.h"
+#include "BLI_utildefines.h"
+
#include "BKE_action.h"
#include "WM_types.h"
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 3d5106b0cef..4fb26f2b007 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -429,6 +429,13 @@ static void rna_def_brush_texture_slot(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}
};
+ static EnumPropertyItem prop_tex_paint_map_mode_items[] = {
+ {MTEX_MAP_MODE_VIEW, "VIEW_PLANE", 0, "View Plane", ""},
+ {MTEX_MAP_MODE_TILED, "TILED", 0, "Tiled", ""},
+ {MTEX_MAP_MODE_3D, "3D", 0, "3D", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
srna = RNA_def_struct(brna, "BrushTextureSlot", "TextureSlot");
RNA_def_struct_sdna(srna, "MTex");
RNA_def_struct_ui_text(srna, "Brush Texture Slot", "Texture slot for textures in a Brush datablock");
@@ -444,6 +451,12 @@ static void rna_def_brush_texture_slot(BlenderRNA *brna)
RNA_def_property_enum_items(prop, prop_map_mode_items);
RNA_def_property_ui_text(prop, "Mode", "");
RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
+
+ prop = RNA_def_property(srna, "tex_paint_map_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "brush_map_mode");
+ RNA_def_property_enum_items(prop, prop_tex_paint_map_mode_items);
+ RNA_def_property_ui_text(prop, "Mode", "");
+ RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
}
static void rna_def_sculpt_capabilities(BlenderRNA *brna)
@@ -855,11 +868,6 @@ static void rna_def_brush(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_RESTORE_MESH);
RNA_def_property_ui_text(prop, "Restore Mesh", "Allow a single dot to be carefully positioned");
RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_fixed_texture", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_FIXED_TEX);
- RNA_def_property_ui_text(prop, "Fixed Texture", "Keep texture origin in fixed position");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
/* only for projection paint, TODO, other paint modes */
prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c
index bc4194ebffb..f32f28e8143 100644
--- a/source/blender/makesrna/intern/rna_color.c
+++ b/source/blender/makesrna/intern/rna_color.c
@@ -886,7 +886,7 @@ static void rna_def_histogram(BlenderRNA *brna)
prop = RNA_def_property(srna, "show_line", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", HISTO_FLAG_LINE);
- RNA_def_property_ui_text(prop, "Show Line", "Display lines rather then filled shapes");
+ RNA_def_property_ui_text(prop, "Show Line", "Display lines rather than filled shapes");
RNA_def_property_ui_icon(prop, ICON_IPO, 0);
}
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index b94d7eb691f..4e6c3748230 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -1210,6 +1210,15 @@ void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
prop->flag |= PROP_ICONS_CONSECUTIVE;
}
+/**
+ * The values hare are a little confusing:
+ *
+ * \param step For floats this is (step / 100), why /100? - nobody knows.
+ * for int's, whole values are used.
+ *
+ * \param precision The number of zeros to show
+ * (as a whole number - common range is 1 - 6), see PRECISION_FLOAT_MAX
+ */
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
{
StructRNA *srna = DefRNA.laststruct;
@@ -1230,6 +1239,21 @@ void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double
fprop->softmax = (float)max;
fprop->step = (float)step;
fprop->precision = (int)precision;
+#if 0 /* handy but annoying */
+ if (DefRNA.preprocess) {
+ /* check we're not over PRECISION_FLOAT_MAX */
+ if (fprop->precision > 6) {
+ fprintf(stderr, "%s: \"%s.%s\", precision value over maximum.\n",
+ __func__, srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ }
+ else if (fprop->precision < 1) {
+ fprintf(stderr, "%s: \"%s.%s\", precision value under minimum.\n",
+ __func__, srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ }
+ }
+#endif
break;
}
default:
@@ -2534,13 +2558,14 @@ PropertyRNA *RNA_def_string_file_name(StructOrFunctionRNA *cont_, const char *id
return prop;
}
-PropertyRNA *RNA_def_string_translate(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value,
- int maxlen, const char *ui_name, const char *ui_description)
+PropertyRNA *RNA_def_string_py_translate(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value,
+ int maxlen, const char *ui_name, const char *ui_description)
{
ContainerRNA *cont = cont_;
PropertyRNA *prop;
- prop = RNA_def_property(cont, identifier, PROP_STRING, PROP_TRANSLATE);
+ prop = RNA_def_property(cont, identifier, PROP_STRING, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_STRING_PY_TRANSLATE);
if (maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen);
if (default_value) RNA_def_property_string_default(prop, default_value);
RNA_def_property_ui_text(prop, ui_name, ui_description);
diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c
index 5d37f67fa93..72e27ba9240 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -88,11 +88,15 @@ static int rna_Image_dirty_get(PointerRNA *ptr)
return 0;
}
-static void rna_Image_source_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_Image_source_set(PointerRNA *ptr, int value)
{
Image *ima = ptr->id.data;
- BKE_image_signal(ima, NULL, IMA_SIGNAL_SRC_CHANGE);
- DAG_id_tag_update(&ima->id, 0);
+
+ if (value != ima->source) {
+ ima->source = value;
+ BKE_image_signal(ima, NULL, IMA_SIGNAL_SRC_CHANGE);
+ DAG_id_tag_update(&ima->id, 0);
+ }
}
static void rna_Image_fields_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
@@ -377,6 +381,38 @@ static void rna_Image_pixels_set(PointerRNA *ptr, const float *values)
BKE_image_release_ibuf(ima, ibuf, lock);
}
+static int rna_Image_channels_get(PointerRNA *ptr)
+{
+ Image *im = (Image *)ptr->data;
+ ImBuf *ibuf;
+ void *lock;
+ int channels = 0;
+
+ ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
+ if (ibuf)
+ channels = ibuf->channels;
+
+ BKE_image_release_ibuf(im, ibuf, lock);
+
+ return channels;
+}
+
+static int rna_Image_is_float_get(PointerRNA *ptr)
+{
+ Image *im = (Image *)ptr->data;
+ ImBuf *ibuf;
+ void *lock;
+ int is_float = FALSE;
+
+ ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
+ if (ibuf)
+ is_float = ibuf->rect_float != NULL;
+
+ BKE_image_release_ibuf(im, ibuf, lock);
+
+ return is_float;
+}
+
#else
static void rna_def_imageuser(BlenderRNA *brna)
@@ -395,6 +431,11 @@ static void rna_def_imageuser(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_ImageUser_update");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ prop = RNA_def_property(srna, "frame_current", PROP_INT, PROP_TIME);
+ RNA_def_property_int_sdna(prop, NULL, "framenr");
+ RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
+ RNA_def_property_ui_text(prop, "Current Frame", "Current frame number in image sequence or movie");
+
/* animation */
prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "cycl", 0);
@@ -490,9 +531,9 @@ static void rna_def_image(BlenderRNA *brna)
prop = RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, image_source_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Image_source_itemf");
+ RNA_def_property_enum_funcs(prop, NULL, "rna_Image_source_set", "rna_Image_source_itemf");
RNA_def_property_ui_text(prop, "Source", "Where the image comes from");
- RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_source_update");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);
prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, prop_type_items);
@@ -664,6 +705,10 @@ static void rna_def_image(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Duration", "Duration (in frames) of the image (1 when not a video/sequence)");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ /* NOTE about pixels/channels/is_floa:
+ * this properties describes how image is stored internally (inside of ImBuf),
+ * not how it was saved to disk or how it'll be saved on disk
+ */
prop = RNA_def_property(srna, "pixels", PROP_FLOAT, PROP_NONE);
RNA_def_property_flag(prop, PROP_DYNAMIC);
RNA_def_property_multi_array(prop, 1, NULL);
@@ -671,6 +716,16 @@ static void rna_def_image(BlenderRNA *brna)
RNA_def_property_dynamic_array_funcs(prop, "rna_Image_pixels_get_length");
RNA_def_property_float_funcs(prop, "rna_Image_pixels_get", "rna_Image_pixels_set", NULL);
+ prop = RNA_def_property(srna, "channels", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop, "rna_Image_channels_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Channels", "Number of channels in pixels buffer");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "is_float", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_Image_is_float_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Is Float", "True if this image is stored in float buffer");
+
prop = RNA_def_property(srna, "colorspace_settings", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "colorspace_settings");
RNA_def_property_struct_type(prop, "ColorManagedInputColorspaceSettings");
diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h
index 636be933ced..99dd0a860d2 100644
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@ -167,6 +167,7 @@ void RNA_def_packedfile(struct BlenderRNA *brna);
void RNA_def_particle(struct BlenderRNA *brna);
void RNA_def_pose(struct BlenderRNA *brna);
void RNA_def_render(struct BlenderRNA *brna);
+void RNA_def_rigidbody(struct BlenderRNA *brna);
void RNA_def_rna(struct BlenderRNA *brna);
void RNA_def_scene(struct BlenderRNA *brna);
void RNA_def_screen(struct BlenderRNA *brna);
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index 90cc8100718..6d182ed17f0 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -108,11 +108,11 @@ static Camera *rna_Main_cameras_new(Main *UNUSED(bmain), const char *name)
id_us_min(id);
return (Camera *)id;
}
-static void rna_Main_cameras_remove(Main *bmain, ReportList *reports, PointerRNA *camera_ptr)
+static void rna_Main_cameras_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *camera_ptr)
{
Camera *camera = camera_ptr->data;
if (ID_REAL_USERS(camera) <= 0) {
- BKE_libblock_free(&bmain->camera, camera);
+ BKE_libblock_free(&G.main->camera, camera);
RNA_POINTER_INVALIDATE(camera_ptr);
}
else {
@@ -201,12 +201,12 @@ static Object *rna_Main_objects_new(Main *UNUSED(bmain), ReportList *reports, co
return ob;
}
-static void rna_Main_objects_remove(Main *bmain, ReportList *reports, PointerRNA *object_ptr)
+static void rna_Main_objects_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *object_ptr)
{
Object *object = object_ptr->data;
if (ID_REAL_USERS(object) <= 0) {
BKE_object_unlink(object); /* needed or ID pointers to this are not cleared */
- BKE_libblock_free(&bmain->object, object);
+ BKE_libblock_free(&G.main->object, object);
RNA_POINTER_INVALIDATE(object_ptr);
}
else {
@@ -221,11 +221,11 @@ static Material *rna_Main_materials_new(Main *UNUSED(bmain), const char *name)
id_us_min(id);
return (Material *)id;
}
-static void rna_Main_materials_remove(Main *bmain, ReportList *reports, PointerRNA *material_ptr)
+static void rna_Main_materials_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *material_ptr)
{
Material *material = material_ptr->data;
if (ID_REAL_USERS(material) <= 0) {
- BKE_libblock_free(&bmain->mat, material);
+ BKE_libblock_free(&G.main->mat, material);
RNA_POINTER_INVALIDATE(material_ptr);
}
else {
@@ -241,11 +241,11 @@ static bNodeTree *rna_Main_nodetree_new(Main *UNUSED(bmain), const char *name, i
id_us_min(&tree->id);
return tree;
}
-static void rna_Main_nodetree_remove(Main *bmain, ReportList *reports, PointerRNA *tree_ptr)
+static void rna_Main_nodetree_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *tree_ptr)
{
bNodeTree *tree = tree_ptr->data;
if (ID_REAL_USERS(tree) <= 0) {
- BKE_libblock_free(&bmain->nodetree, tree);
+ BKE_libblock_free(&G.main->nodetree, tree);
RNA_POINTER_INVALIDATE(tree_ptr);
}
else {
@@ -260,11 +260,12 @@ static Mesh *rna_Main_meshes_new(Main *UNUSED(bmain), const char *name)
id_us_min(&me->id);
return me;
}
-static void rna_Main_meshes_remove(Main *bmain, ReportList *reports, PointerRNA *mesh_ptr)
+static void rna_Main_meshes_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *mesh_ptr)
{
Mesh *mesh = mesh_ptr->data;
+
if (ID_REAL_USERS(mesh) <= 0) {
- BKE_libblock_free(&bmain->mesh, mesh);
+ BKE_libblock_free(&G.main->mesh, mesh);
RNA_POINTER_INVALIDATE(mesh_ptr);
}
else {
@@ -280,11 +281,11 @@ static Lamp *rna_Main_lamps_new(Main *UNUSED(bmain), const char *name, int type)
id_us_min(&lamp->id);
return lamp;
}
-static void rna_Main_lamps_remove(Main *bmain, ReportList *reports, PointerRNA *lamp_ptr)
+static void rna_Main_lamps_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *lamp_ptr)
{
Lamp *lamp = lamp_ptr->data;
if (ID_REAL_USERS(lamp) <= 0) {
- BKE_libblock_free(&bmain->lamp, lamp);
+ BKE_libblock_free(&G.main->lamp, lamp);
RNA_POINTER_INVALIDATE(lamp_ptr);
}
else {
@@ -314,11 +315,11 @@ static Image *rna_Main_images_load(Main *UNUSED(bmain), ReportList *reports, con
return ima;
}
-static void rna_Main_images_remove(Main *bmain, ReportList *reports, PointerRNA *image_ptr)
+static void rna_Main_images_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *image_ptr)
{
Image *image = image_ptr->data;
if (ID_REAL_USERS(image) <= 0) {
- BKE_libblock_free(&bmain->image, image);
+ BKE_libblock_free(&G.main->image, image);
RNA_POINTER_INVALIDATE(image_ptr);
}
else {
@@ -333,11 +334,11 @@ static Lattice *rna_Main_lattices_new(Main *UNUSED(bmain), const char *name)
id_us_min(&lt->id);
return lt;
}
-static void rna_Main_lattices_remove(Main *bmain, ReportList *reports, PointerRNA *lt_ptr)
+static void rna_Main_lattices_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *lt_ptr)
{
Lattice *lt = lt_ptr->data;
if (ID_REAL_USERS(lt) <= 0) {
- BKE_libblock_free(&bmain->latt, lt);
+ BKE_libblock_free(&G.main->latt, lt);
RNA_POINTER_INVALIDATE(lt_ptr);
}
else {
@@ -352,11 +353,11 @@ static Curve *rna_Main_curves_new(Main *UNUSED(bmain), const char *name, int typ
id_us_min(&cu->id);
return cu;
}
-static void rna_Main_curves_remove(Main *bmain, ReportList *reports, PointerRNA *cu_ptr)
+static void rna_Main_curves_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *cu_ptr)
{
Curve *cu = cu_ptr->data;
if (ID_REAL_USERS(cu) <= 0) {
- BKE_libblock_free(&bmain->curve, cu);
+ BKE_libblock_free(&G.main->curve, cu);
RNA_POINTER_INVALIDATE(cu_ptr);
}
else {
@@ -371,11 +372,11 @@ static MetaBall *rna_Main_metaballs_new(Main *UNUSED(bmain), const char *name)
id_us_min(&mb->id);
return mb;
}
-static void rna_Main_metaballs_remove(Main *bmain, ReportList *reports, PointerRNA *mb_ptr)
+static void rna_Main_metaballs_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *mb_ptr)
{
MetaBall *mb = mb_ptr->data;
if (ID_REAL_USERS(mb) <= 0) {
- BKE_libblock_free(&bmain->mball, mb);
+ BKE_libblock_free(&G.main->mball, mb);
RNA_POINTER_INVALIDATE(mb_ptr);
}
else {
@@ -418,11 +419,11 @@ static Tex *rna_Main_textures_new(Main *UNUSED(bmain), const char *name, int typ
id_us_min(&tex->id);
return tex;
}
-static void rna_Main_textures_remove(Main *bmain, ReportList *reports, PointerRNA *tex_ptr)
+static void rna_Main_textures_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *tex_ptr)
{
Tex *tex = tex_ptr->data;
if (ID_REAL_USERS(tex) <= 0) {
- BKE_libblock_free(&bmain->tex, tex);
+ BKE_libblock_free(&G.main->tex, tex);
RNA_POINTER_INVALIDATE(tex_ptr);
}
else {
@@ -437,11 +438,11 @@ static Brush *rna_Main_brushes_new(Main *UNUSED(bmain), const char *name)
id_us_min(&brush->id);
return brush;
}
-static void rna_Main_brushes_remove(Main *bmain, ReportList *reports, PointerRNA *brush_ptr)
+static void rna_Main_brushes_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *brush_ptr)
{
Brush *brush = brush_ptr->data;
if (ID_REAL_USERS(brush) <= 0) {
- BKE_libblock_free(&bmain->brush, brush);
+ BKE_libblock_free(&G.main->brush, brush);
RNA_POINTER_INVALIDATE(brush_ptr);
}
else {
@@ -456,11 +457,11 @@ static World *rna_Main_worlds_new(Main *UNUSED(bmain), const char *name)
id_us_min(&world->id);
return world;
}
-static void rna_Main_worlds_remove(Main *bmain, ReportList *reports, PointerRNA *world_ptr)
+static void rna_Main_worlds_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *world_ptr)
{
Group *world = world_ptr->data;
if (ID_REAL_USERS(world) <= 0) {
- BKE_libblock_free(&bmain->world, world);
+ BKE_libblock_free(&G.main->world, world);
RNA_POINTER_INVALIDATE(world_ptr);
}
else {
@@ -473,11 +474,11 @@ static Group *rna_Main_groups_new(Main *UNUSED(bmain), const char *name)
{
return add_group(name);
}
-static void rna_Main_groups_remove(Main *bmain, PointerRNA *group_ptr)
+static void rna_Main_groups_remove(Main *UNUSED(bmain), PointerRNA *group_ptr)
{
Group *group = group_ptr->data;
BKE_group_unlink(group);
- BKE_libblock_free(&bmain->group, group);
+ BKE_libblock_free(&G.main->group, group);
RNA_POINTER_INVALIDATE(group_ptr);
}
@@ -487,11 +488,11 @@ static Speaker *rna_Main_speakers_new(Main *UNUSED(bmain), const char *name)
id_us_min(&speaker->id);
return speaker;
}
-static void rna_Main_speakers_remove(Main *bmain, ReportList *reports, PointerRNA *speaker_ptr)
+static void rna_Main_speakers_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *speaker_ptr)
{
Speaker *speaker = speaker_ptr->data;
if (ID_REAL_USERS(speaker) <= 0) {
- BKE_libblock_free(&bmain->speaker, speaker);
+ BKE_libblock_free(&G.main->speaker, speaker);
RNA_POINTER_INVALIDATE(speaker_ptr);
}
else {
@@ -504,11 +505,11 @@ static Text *rna_Main_texts_new(Main *UNUSED(bmain), const char *name)
{
return BKE_text_add(name);
}
-static void rna_Main_texts_remove(Main *bmain, PointerRNA *text_ptr)
+static void rna_Main_texts_remove(Main *UNUSED(bmain), PointerRNA *text_ptr)
{
Text *text = text_ptr->data;
- BKE_text_unlink(bmain, text);
- BKE_libblock_free(&bmain->text, text);
+ BKE_text_unlink(G.main, text);
+ BKE_libblock_free(&G.main->text, text);
RNA_POINTER_INVALIDATE(text_ptr);
}
@@ -532,11 +533,11 @@ static bArmature *rna_Main_armatures_new(Main *UNUSED(bmain), const char *name)
id_us_min(&arm->id);
return arm;
}
-static void rna_Main_armatures_remove(Main *bmain, ReportList *reports, PointerRNA *arm_ptr)
+static void rna_Main_armatures_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *arm_ptr)
{
bArmature *arm = arm_ptr->data;
if (ID_REAL_USERS(arm) <= 0) {
- BKE_libblock_free(&bmain->armature, arm);
+ BKE_libblock_free(&G.main->armature, arm);
RNA_POINTER_INVALIDATE(arm_ptr);
}
else {
@@ -552,11 +553,11 @@ static bAction *rna_Main_actions_new(Main *UNUSED(bmain), const char *name)
act->id.flag &= ~LIB_FAKEUSER;
return act;
}
-static void rna_Main_actions_remove(Main *bmain, ReportList *reports, PointerRNA *act_ptr)
+static void rna_Main_actions_remove(Main *UNUSED(bmain), ReportList *reports, PointerRNA *act_ptr)
{
bAction *act = act_ptr->data;
if (ID_REAL_USERS(act) <= 0) {
- BKE_libblock_free(&bmain->action, act);
+ BKE_libblock_free(&G.main->action, act);
RNA_POINTER_INVALIDATE(act_ptr);
}
else {
@@ -598,11 +599,11 @@ static MovieClip *rna_Main_movieclip_load(Main *UNUSED(bmain), ReportList *repor
return clip;
}
-static void rna_Main_movieclips_remove(Main *bmain, PointerRNA *clip_ptr)
+static void rna_Main_movieclips_remove(Main *UNUSED(bmain), PointerRNA *clip_ptr)
{
MovieClip *clip = clip_ptr->data;
- BKE_movieclip_unlink(bmain, clip);
- BKE_libblock_free(&bmain->movieclip, clip);
+ BKE_movieclip_unlink(G.main, clip);
+ BKE_libblock_free(&G.main->movieclip, clip);
RNA_POINTER_INVALIDATE(clip_ptr);
}
@@ -615,11 +616,11 @@ static Mask *rna_Main_mask_new(Main *UNUSED(bmain), const char *name)
return mask;
}
-static void rna_Main_masks_remove(Main *bmain, PointerRNA *mask_ptr)
+static void rna_Main_masks_remove(Main *UNUSED(bmain), PointerRNA *mask_ptr)
{
Mask *mask = mask_ptr->data;
- BKE_mask_free(bmain, mask);
- BKE_libblock_free(&bmain->mask, mask);
+ BKE_mask_free(G.main, mask);
+ BKE_libblock_free(&G.main->mask, mask);
RNA_POINTER_INVALIDATE(mask_ptr);
}
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index 8c8b7b4f637..60625cb0e0b 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -2921,11 +2921,6 @@ static void rna_def_mesh(BlenderRNA *brna)
"Display selected edges using highlights in the 3D view and UV editor");
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
- prop = RNA_def_property(srna, "show_all_edges", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_ALLEDGES);
- RNA_def_property_ui_text(prop, "All Edges", "Display all edges for wireframe in all view modes in the 3D view");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
prop = RNA_def_property(srna, "show_faces", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAWFACES);
RNA_def_property_ui_text(prop, "Draw Faces", "Display all faces as shades in the 3D view and UV editor");
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 7a576c88677..21ab11271c4 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -58,6 +58,7 @@
EnumPropertyItem modifier_type_items[] = {
{0, "", 0, N_("Modify"), ""},
+ {eModifierType_MeshCache, "MESH_CACHE", ICON_MOD_MESHDEFORM, "Mesh Cache", ""},
{eModifierType_UVProject, "UV_PROJECT", ICON_MOD_UVPROJECT, "UV Project", ""},
{eModifierType_UVWarp, "UV_WARP", ICON_MOD_UVPROJECT, "UV Warp", ""},
{eModifierType_WeightVGEdit, "VERTEX_WEIGHT_EDIT", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Edit", ""},
@@ -219,6 +220,8 @@ static StructRNA *rna_Modifier_refine(struct PointerRNA *ptr)
return &RNA_TriangulateModifier;
case eModifierType_UVWarp:
return &RNA_UVWarpModifier;
+ case eModifierType_MeshCache:
+ return &RNA_MeshCacheModifier;
/* Default */
case eModifierType_None:
case eModifierType_ShapeKey:
@@ -1666,7 +1669,7 @@ static void rna_def_modifier_displace(BlenderRNA *brna)
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_DisplaceModifier_vgroup_set");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
- prop = RNA_def_property(srna, "mid_level", PROP_FLOAT, PROP_DISTANCE);
+ prop = RNA_def_property(srna, "mid_level", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "midlevel");
RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
RNA_def_property_ui_range(prop, 0, 1, 10, 3);
@@ -1840,18 +1843,23 @@ static void rna_def_modifier_laplaciansmooth(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_PRESERVE_VOLUME);
RNA_def_property_ui_text(prop, "Preserve Volume", "Apply volume preservation after smooth");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_normalized", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_NORMALIZED);
+ RNA_def_property_ui_text(prop, "Normalized", "Improve and stabilize the enhanced shape");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "lambda_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "lambda");
RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0000001, 1000.0, 0.0000001, 8);
+ RNA_def_property_ui_range(prop, -1000.0, 1000.0, 5, 3);
RNA_def_property_ui_text(prop, "Lambda Factor", "Smooth factor effect");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "lambda_border", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "lambda_border");
RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0000001, 1000.0, 0.0000001, 8);
+ RNA_def_property_ui_range(prop, -1000.0, 1000.0, 5, 3);
RNA_def_property_ui_text(prop, "Lambda Border", "Lambda factor in border");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
@@ -3473,6 +3481,158 @@ static void rna_def_modifier_triangulate(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
+static void rna_def_modifier_meshcache(BlenderRNA *brna)
+{
+ static EnumPropertyItem prop_format_type_items[] = {
+ {MOD_MESHCACHE_TYPE_MDD, "MDD", 0, "MDD ", ""},
+ {MOD_MESHCACHE_TYPE_PC2, "PC2", 0, "PC2", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem prop_deform_mode_items[] = {
+ {MOD_MESHCACHE_DEFORM_OVERWRITE, "OVERWRITE", 0, "Overwrite",
+ "Replace vertex coords with cached values"},
+ {MOD_MESHCACHE_DEFORM_INTEGRATE, "INTEGRATE", 0, "Integrate",
+ "Integrate deformation from this modifiers input with the mesh-cache coords (useful for shape keys)"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem prop_interpolation_type_items[] = {
+ {MOD_MESHCACHE_INTERP_NONE, "NONE", 0, "None ", ""},
+ {MOD_MESHCACHE_INTERP_LINEAR, "LINEAR", 0, "Linear", ""},
+ /* for cardinal we'd need to read 4x cache's */
+ // {MOD_MESHCACHE_INTERP_CARDINAL, "CARDINAL", 0, "Cardinal", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem prop_time_type_items[] = {
+ /* use 'eval_frame' */
+ {MOD_MESHCACHE_TIME_FRAME, "FRAME", 0, "Frame", "Control playback using a frame-number "
+ "(ignoring time FPS and start frame from the file)"},
+ /* use 'eval_time' */
+ {MOD_MESHCACHE_TIME_SECONDS, "TIME", 0, "Time", "Control playback using time in seconds"},
+ /* use 'eval_factor' */
+ {MOD_MESHCACHE_TIME_FACTOR, "FACTOR", 0, "Factor", "Control playback using a value between [0, 1]"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem prop_time_play_items[] = {
+ {MOD_MESHCACHE_PLAY_CFEA, "SCENE", 0, "Scene", "Use the time from the scene"},
+ {MOD_MESHCACHE_PLAY_EVAL, "CUSTOM", 0, "Custom", "Use the modifier's own time evaluation"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ static EnumPropertyItem prop_flip_axis_flag_items[] = {
+ {(1 << 0), "X", 0, "X", ""},
+ {(1 << 1), "Y", 0, "Y", ""},
+ {(1 << 2), "Z", 0, "Z", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "MeshCacheModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Cache Modifier", "Cache Mesh");
+ RNA_def_struct_sdna(srna, "MeshCacheModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_MESHDEFORM); /* XXX, needs own icon */
+
+ prop = RNA_def_property(srna, "cache_format", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, prop_format_type_items);
+ RNA_def_property_ui_text(prop, "Format", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "interp");
+ RNA_def_property_enum_items(prop, prop_interpolation_type_items);
+ RNA_def_property_ui_text(prop, "Interpolation", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "time_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "time_mode");
+ RNA_def_property_enum_items(prop, prop_time_type_items);
+ RNA_def_property_ui_text(prop, "Time Mode", "Method to control playback time");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "play_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "play_mode");
+ RNA_def_property_enum_items(prop, prop_time_play_items);
+ RNA_def_property_ui_text(prop, "Time Mode", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "deform_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "deform_mode");
+ RNA_def_property_enum_items(prop, prop_deform_mode_items);
+ RNA_def_property_ui_text(prop, "Deform Mode", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_ui_text(prop, "File Path", "Path to external displacements file");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "factor");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Influence", "Influence of the deformation");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ /* -------------------------------------------------------------------- */
+ /* Axis Conversion */
+ prop = RNA_def_property(srna, "forward_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "forward_axis");
+ RNA_def_property_enum_items(prop, object_axis_items);
+ RNA_def_property_ui_text(prop, "Forward", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "up_axis");
+ RNA_def_property_enum_items(prop, object_axis_items);
+ RNA_def_property_ui_text(prop, "Up", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "flip_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "flip_axis");
+ RNA_def_property_enum_items(prop, prop_flip_axis_flag_items);
+ RNA_def_property_flag(prop, PROP_ENUM_FLAG);
+ RNA_def_property_ui_text(prop, "Flip Axis", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ /* -------------------------------------------------------------------- */
+ /* For Scene time */
+ prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "frame_start");
+ RNA_def_property_range(prop, -MAXFRAME, MAXFRAME);
+ RNA_def_property_ui_text(prop, "Frame Start", "Add this to the start frame");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "frame_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "frame_scale");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Frame Scale", "Evaluation time in seconds");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ /* -------------------------------------------------------------------- */
+ /* eval values depend on 'time_mode' */
+ prop = RNA_def_property(srna, "eval_frame", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "eval_frame");
+ RNA_def_property_range(prop, MINFRAME, MAXFRAME);
+ RNA_def_property_ui_text(prop, "Evaluation Frame", "The frame to evaluate (starting at 0)");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "eval_time", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "eval_time");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_text(prop, "Evaluation Time", "Evaluation time in seconds");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "eval_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "eval_factor");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Evaluation Factor", "Evaluation time in seconds");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+}
+
void RNA_def_modifier(BlenderRNA *brna)
{
StructRNA *srna;
@@ -3582,6 +3742,7 @@ void RNA_def_modifier(BlenderRNA *brna)
rna_def_modifier_skin(brna);
rna_def_modifier_laplaciansmooth(brna);
rna_def_modifier_triangulate(brna);
+ rna_def_modifier_meshcache(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c
index 574f06e9107..2b7f6a182a0 100644
--- a/source/blender/makesrna/intern/rna_nla.c
+++ b/source/blender/makesrna/intern/rna_nla.c
@@ -115,7 +115,7 @@ static void rna_NlaStrip_start_frame_set(PointerRNA *ptr, float value)
if (data->prev->type == NLASTRIP_TYPE_TRANSITION) {
CLAMP(value, data->prev->start + NLASTRIP_MIN_LEN_THRESH, data->end - NLASTRIP_MIN_LEN_THRESH);
- /* readjust the transition to stick to the endpoints of the action-clips */
+ /* re-adjust the transition to stick to the endpoints of the action-clips */
data->prev->end = value;
}
else {
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index eecdf13813c..fe5b6e15f44 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -2537,7 +2537,8 @@ static void def_cmp_dilate_erode(StructRNA *srna)
prop = RNA_def_property(srna, "distance", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "custom2");
- RNA_def_property_range(prop, -100, 100);
+ RNA_def_property_range(prop, -5000, 5000);
+ RNA_def_property_ui_range(prop, -100, 100, 0, 0);
RNA_def_property_ui_text(prop, "Distance", "Distance to grow/shrink (number of iterations)");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index a617c78019f..47b775801f6 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -156,6 +156,15 @@ EnumPropertyItem object_type_curve_items[] = {
{0, NULL, 0, NULL, NULL}
};
+EnumPropertyItem object_axis_items[] = {
+ {OB_POSX, "POS_X", 0, "+X", ""},
+ {OB_POSY, "POS_Y", 0, "+Y", ""},
+ {OB_POSZ, "POS_Z", 0, "+Z", ""},
+ {OB_NEGX, "NEG_X", 0, "-X", ""},
+ {OB_NEGY, "NEG_Y", 0, "-Y", ""},
+ {OB_NEGZ, "NEG_Z", 0, "-Z", ""},
+ {0, NULL, 0, NULL, NULL}
+};
#ifdef RNA_RUNTIME
@@ -2002,16 +2011,6 @@ static void rna_def_object(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
-
- static EnumPropertyItem track_items[] = {
- {OB_POSX, "POS_X", 0, "+X", ""},
- {OB_POSY, "POS_Y", 0, "+Y", ""},
- {OB_POSZ, "POS_Z", 0, "+Z", ""},
- {OB_NEGX, "NEG_X", 0, "-X", ""},
- {OB_NEGY, "NEG_Y", 0, "-Y", ""},
- {OB_NEGZ, "NEG_Z", 0, "-Z", ""},
- {0, NULL, 0, NULL, NULL}
- };
static EnumPropertyItem up_items[] = {
{OB_POSX, "X", 0, "X", ""},
@@ -2142,7 +2141,7 @@ static void rna_def_object(BlenderRNA *brna)
* since some other tools still refer to this */
prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "trackflag");
- RNA_def_property_enum_items(prop, track_items);
+ RNA_def_property_enum_items(prop, object_axis_items);
RNA_def_property_ui_text(prop, "Track Axis",
"Axis that points in 'forward' direction (applies to DupliFrame when "
"parent 'Follow' is enabled)");
@@ -2429,6 +2428,17 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Particle Systems", "Particle systems emitted from the object");
rna_def_object_particle_systems(brna, prop);
+
+ prop = RNA_def_property(srna, "rigid_body", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "rigidbody_object");
+ RNA_def_property_struct_type(prop, "RigidBodyObject");
+ RNA_def_property_ui_text(prop, "Rigid Body Settings", "Settings for rigid body simulation");
+
+ prop = RNA_def_property(srna, "rigid_body_constraint", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "rigidbody_constraint");
+ RNA_def_property_struct_type(prop, "RigidBodyConstraint");
+ RNA_def_property_ui_text(prop, "Rigid Body Constraint", "Constraint constraining rigid bodies");
+
/* restrict */
prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_VIEW);
@@ -2557,7 +2567,7 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
prop = RNA_def_property(srna, "show_bounds", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_BOUNDBOX);
+ RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWBOUNDOX);
RNA_def_property_ui_text(prop, "Draw Bounds", "Display the object's bounds");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
@@ -2586,7 +2596,12 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWWIRE);
RNA_def_property_ui_text(prop, "Draw Wire", "Add the object's wireframe over solid drawing");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
+
+ prop = RNA_def_property(srna, "show_all_edges", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAW_ALL_EDGES);
+ RNA_def_property_ui_text(prop, "Draw All Edges", "Display all edges for mesh objects");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
prop = RNA_def_property(srna, "show_transparent", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWTRANSP);
RNA_def_property_ui_text(prop, "Draw Transparent",
diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c
index 0c2944b3966..873ea49824c 100644
--- a/source/blender/makesrna/intern/rna_object_force.c
+++ b/source/blender/makesrna/intern/rna_object_force.c
@@ -1182,7 +1182,7 @@ static void rna_def_field(BlenderRNA *brna)
prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "f_strength");
- RNA_def_property_range(prop, -1000.0f, 1000.0f);
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
RNA_def_property_ui_text(prop, "Strength", "Strength of force field");
RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index 4a520cdc729..bd3e4e6862d 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -349,14 +349,17 @@ static void rna_ParticleSystem_co_hair(ParticleSystem *particlesystem, Object *o
/*strands key loop data stored in cache + step->co*/
if (path_nbr) {
if (step >= 0 && step <= path_nbr) {
- if (step <= max_k)
+ if (step <= max_k) {
copy_v3_v3(n_co, (cache + step)->co);
+ mul_m4_v3(particlesystem->imat, n_co);
+ mul_m4_v3(object->obmat, n_co);
+ }
}
}
}
-static void rna_ParticleSystem_uv_on_emitter(ParticleSystem *particlesystem, ParticleSystemModifierData *modifier, ParticleData *particle, int particle_no,
+static void rna_ParticleSystem_uv_on_emitter(ParticleSystem *particlesystem, ParticleSystemModifierData *modifier, ParticleData *particle, int particle_no, int uv_no,
float n_uv[2])
{
ParticleSettings *part = 0;
@@ -395,7 +398,7 @@ static void rna_ParticleSystem_uv_on_emitter(ParticleSystem *particlesystem, Par
if (n_uv && ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME)) {
if (num != DMCACHE_NOTFOUND) {
MFace *mface = modifier->dm->getTessFaceData(modifier->dm, num, CD_MFACE);
- MTFace *mtface = (MTFace *)CustomData_get_layer_n(&modifier->dm->faceData, CD_MTFACE, 0);
+ MTFace *mtface = (MTFace *)CustomData_get_layer_n(&modifier->dm->faceData, CD_MTFACE, uv_no);
mtface += num;
psys_interpolate_uvs(mtface, mface->v4, particle->fuv, n_uv);
@@ -1246,10 +1249,10 @@ static void rna_def_particle_hair_key(BlenderRNA *brna)
RNA_def_property_float_funcs(prop, "rna_ParticleHairKey_location_object_get",
"rna_ParticleHairKey_location_object_set", NULL);
- prop = RNA_def_property(srna, "co_hair_space", PROP_FLOAT, PROP_TRANSLATION);
+ prop = RNA_def_property(srna, "co_local", PROP_FLOAT, PROP_TRANSLATION);
RNA_def_property_float_sdna(prop, NULL, "co");
RNA_def_property_ui_text(prop, "Location",
- "Location of the hair key in its internal coordinate system, "
+ "Location of the hair key in its local coordinate system, "
"relative to the emitting face");
/* Aided co func */
@@ -3362,6 +3365,7 @@ static void rna_def_particle_system(BlenderRNA *brna)
prop = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier");
prop = RNA_def_pointer(func, "particle", "Particle", "", "Particle");
prop = RNA_def_int(func, "particle_no", 0, INT_MIN, INT_MAX, "Particle no", "", INT_MIN, INT_MAX);
+ prop = RNA_def_int(func, "uv_no", 0, INT_MIN, INT_MAX, "UV no", "", INT_MIN, INT_MAX);
prop = RNA_def_property(func, "uv", PROP_FLOAT, PROP_COORDS);
RNA_def_property_array(prop, 2);
RNA_def_property_flag(prop, PROP_THICK_WRAP);
diff --git a/source/blender/makesrna/intern/rna_rigidbody.c b/source/blender/makesrna/intern/rna_rigidbody.c
new file mode 100644
index 00000000000..c1eb3b9b000
--- /dev/null
+++ b/source/blender/makesrna/intern/rna_rigidbody.c
@@ -0,0 +1,1008 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor(s): Blender Foundation 2013, Joshua Leung, Sergej Reich
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file rna_rigidbody.c
+ * \ingroup rna
+ * \brief RNA property definitions for Rigid Body datatypes
+ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "RNA_define.h"
+
+#include "rna_internal.h"
+
+#include "DNA_group_types.h"
+#include "DNA_object_types.h"
+#include "DNA_rigidbody_types.h"
+#include "DNA_scene_types.h"
+
+#include "BLI_utildefines.h"
+#include "BLI_math.h"
+
+#include "WM_types.h"
+
+/* roles of objects in RigidBody Sims */
+EnumPropertyItem rigidbody_ob_type_items[] = {
+ {RBO_TYPE_ACTIVE, "ACTIVE", 0, "Active", "Object is directly controlled by simulation results"},
+ {RBO_TYPE_PASSIVE, "PASSIVE", 0, "Passive", "Object is directly controlled by animation system"},
+ {0, NULL, 0, NULL, NULL}};
+
+/* collision shapes of objects in rigid body sim */
+EnumPropertyItem rigidbody_ob_shape_items[] = {
+ {RB_SHAPE_BOX, "BOX", ICON_MESH_CUBE, "Box", "Box-like shapes (i.e. cubes), including planes (i.e. ground planes)"},
+ {RB_SHAPE_SPHERE, "SPHERE", ICON_MESH_UVSPHERE, "Sphere", ""},
+ {RB_SHAPE_CAPSULE, "CAPSULE", ICON_OUTLINER_OB_META, "Capsule", ""},
+ {RB_SHAPE_CYLINDER, "CYLINDER", ICON_MESH_CYLINDER, "Cylinder", ""},
+ {RB_SHAPE_CONE, "CONE", ICON_MESH_CONE, "Cone", ""},
+ {RB_SHAPE_CONVEXH, "CONVEX_HULL", ICON_MESH_ICOSPHERE, "Convex Hull", "A mesh-like surface encompassing (i.e. shrinkwrap over) all verts. Best results with fewer vertices"},
+ {RB_SHAPE_TRIMESH, "MESH", ICON_MESH_MONKEY, "Mesh", "Mesh consisting of triangles only, allowing for more detailed interactions than convex hulls"},
+ {0, NULL, 0, NULL, NULL}};
+
+/* collision shapes of constraints in rigid body sim */
+EnumPropertyItem rigidbody_con_type_items[] = {
+ {RBC_TYPE_FIXED, "FIXED", ICON_FORCE_FORCE, "Fixed", "Glues rigid bodies together"},
+ {RBC_TYPE_POINT, "POINT", ICON_FORCE_FORCE, "Point", "Constrains rigid bodies to move aound common pivot point"},
+ {RBC_TYPE_HINGE, "HINGE", ICON_FORCE_FORCE, "Hinge", "Restricts rigid body rotation to one axis"},
+ {RBC_TYPE_SLIDER, "SLIDER", ICON_FORCE_FORCE, "Slider", "Restricts rigid boddy translation to one axis"},
+ {RBC_TYPE_PISTON, "PISTON", ICON_FORCE_FORCE, "Piston", "Restricts rigid boddy translation and rotation to one axis"},
+ {RBC_TYPE_6DOF, "GENERIC", ICON_FORCE_FORCE, "Generic", "Restricts translation and rotation to specified axes"},
+ {RBC_TYPE_6DOF_SPRING, "GENERIC_SPRING", ICON_FORCE_FORCE, "Generic Spring", "Restricts translation and rotation to specified axes with springs"},
+ {0, NULL, 0, NULL, NULL}};
+
+
+#ifdef RNA_RUNTIME
+
+#ifdef WITH_BULLET
+# include "RBI_api.h"
+#endif
+
+#include "BKE_depsgraph.h"
+#include "BKE_rigidbody.h"
+
+#define RB_FLAG_SET(dest, value, flag) { \
+ if (value) \
+ dest |= flag; \
+ else \
+ dest &= ~flag; \
+}
+
+
+/* ******************************** */
+
+static void rna_RigidBodyWorld_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ RigidBodyWorld *rbw = (RigidBodyWorld *)ptr->data;
+
+ BKE_rigidbody_cache_reset(rbw);
+}
+
+static char *rna_RigidBodyWorld_path(PointerRNA *ptr)
+{
+ return BLI_sprintfN("rigidbody_world");
+}
+
+static void rna_RigidBodyWorld_num_solver_iterations_set(PointerRNA *ptr, int value)
+{
+ RigidBodyWorld *rbw = (RigidBodyWorld *)ptr->data;
+
+ rbw->num_solver_iterations = value;
+
+#ifdef WITH_BULLET
+ if (rbw->physics_world) {
+ RB_dworld_set_solver_iterations(rbw->physics_world, value);
+ }
+#endif
+}
+
+static void rna_RigidBodyWorld_split_impulse_set(PointerRNA *ptr, int value)
+{
+ RigidBodyWorld *rbw = (RigidBodyWorld *)ptr->data;
+
+ RB_FLAG_SET(rbw->flag, value, RBW_FLAG_USE_SPLIT_IMPULSE);
+
+#ifdef WITH_BULLET
+ if (rbw->physics_world) {
+ RB_dworld_set_split_impulse(rbw->physics_world, value);
+ }
+#endif
+}
+
+/* ******************************** */
+
+static void rna_RigidBodyOb_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ RigidBodyWorld *rbw = scene->rigidbody_world;
+
+ BKE_rigidbody_cache_reset(rbw);
+}
+
+static void rna_RigidBodyOb_shape_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ RigidBodyWorld *rbw = scene->rigidbody_world;
+ RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+
+ BKE_rigidbody_cache_reset(rbw);
+ if (rbo->physics_shape)
+ rbo->flag |= RBO_FLAG_NEEDS_RESHAPE;
+}
+
+static char *rna_RigidBodyOb_path(PointerRNA *ptr)
+{
+ /* NOTE: this hardcoded path should work as long as only Objects have this */
+ return BLI_sprintfN("rigid_body");
+}
+
+static void rna_RigidBodyOb_type_set(PointerRNA *ptr, int value)
+{
+ RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+
+ rbo->type = value;
+ rbo->flag |= RBO_FLAG_NEEDS_VALIDATE;
+
+#ifdef WITH_BULLET
+ /* do physics sim updates */
+ if (rbo->physics_object) {
+ RB_body_set_mass(rbo->physics_object, RBO_GET_MASS(rbo));
+ }
+#endif
+}
+
+static void rna_RigidBodyOb_disabled_set(PointerRNA *ptr, int value)
+{
+ RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+
+ RB_FLAG_SET(rbo->flag, !value, RBO_FLAG_DISABLED);
+
+#ifdef WITH_BULLET
+ /* update kinematic state if necessary - only needed for active bodies */
+ if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
+ RB_body_set_mass(rbo->physics_object, RBO_GET_MASS(rbo));
+ RB_body_set_kinematic_state(rbo->physics_object, !value);
+ rbo->flag |= RBO_FLAG_NEEDS_VALIDATE;
+ }
+#endif
+}
+
+static void rna_RigidBodyOb_shape_set(PointerRNA *ptr, int value)
+{
+ RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+ Object *ob = (Object *)ptr->id.data;
+
+ rbo->shape = value;
+
+ /* force creation of new collision shape reflecting this */
+ BKE_rigidbody_validate_sim_shape(ob, TRUE);
+
+#ifdef WITH_BULLET
+ /* now tell RB sim about it */
+ if (rbo->physics_object && rbo->physics_shape) {
+ RB_body_set_collision_shape(rbo->physics_object, rbo->physics_shape);
+ }
+#endif
+}
+
+
+static void rna_RigidBodyOb_mass_set(PointerRNA *ptr, float value)
+{
+ RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+
+ rbo->mass = value;
+
+#ifdef WITH_BULLET
+ /* only active bodies need mass update */
+ if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
+ RB_body_set_mass(rbo->physics_object, RBO_GET_MASS(rbo));
+ }
+#endif
+}
+
+static void rna_RigidBodyOb_friction_set(PointerRNA *ptr, float value)
+{
+ RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+
+ rbo->friction = value;
+
+#ifdef WITH_BULLET
+ if (rbo->physics_object) {
+ RB_body_set_friction(rbo->physics_object, value);
+ }
+#endif
+}
+
+static void rna_RigidBodyOb_restitution_set(PointerRNA *ptr, float value)
+{
+ RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+
+ rbo->restitution = value;
+#ifdef WITH_BULLET
+ if (rbo->physics_object) {
+ RB_body_set_restitution(rbo->physics_object, value);
+ }
+#endif
+}
+
+static void rna_RigidBodyOb_collision_margin_set(PointerRNA *ptr, float value)
+{
+ RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+
+ rbo->margin = value;
+
+#ifdef WITH_BULLET
+ if (rbo->physics_shape) {
+ RB_shape_set_margin(rbo->physics_shape, RBO_GET_MARGIN(rbo));
+ }
+#endif
+}
+
+static void rna_RigidBodyOb_kinematic_state_set(PointerRNA *ptr, int value)
+{
+ RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+
+ RB_FLAG_SET(rbo->flag, value, RBO_FLAG_KINEMATIC);
+
+#ifdef WITH_BULLET
+ /* update kinematic state if necessary */
+ if (rbo->physics_object) {
+ RB_body_set_mass(rbo->physics_object, RBO_GET_MASS(rbo));
+ RB_body_set_kinematic_state(rbo->physics_object, value);
+ rbo->flag |= RBO_FLAG_NEEDS_VALIDATE;
+ }
+#endif
+}
+
+static void rna_RigidBodyOb_activation_state_set(PointerRNA *ptr, int value)
+{
+ RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+
+ RB_FLAG_SET(rbo->flag, value, RBO_FLAG_USE_DEACTIVATION);
+
+#ifdef WITH_BULLET
+ /* update activation state if necessary - only active bodies can be deactivated */
+ if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
+ RB_body_set_activation_state(rbo->physics_object, value);
+ }
+#endif
+}
+
+static void rna_RigidBodyOb_linear_sleepThresh_set(PointerRNA *ptr, float value)
+{
+ RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+
+ rbo->lin_sleep_thresh = value;
+
+#ifdef WITH_BULLET
+ /* only active bodies need sleep threshold update */
+ if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
+ RB_body_set_linear_sleep_thresh(rbo->physics_object, value);
+ }
+#endif
+}
+
+static void rna_RigidBodyOb_angular_sleepThresh_set(PointerRNA *ptr, float value)
+{
+ RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+
+ rbo->ang_sleep_thresh = value;
+
+#ifdef WITH_BULLET
+ /* only active bodies need sleep threshold update */
+ if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
+ RB_body_set_angular_sleep_thresh(rbo->physics_object, value);
+ }
+#endif
+}
+
+static void rna_RigidBodyOb_linear_damping_set(PointerRNA *ptr, float value)
+{
+ RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+
+ rbo->lin_damping = value;
+
+#ifdef WITH_BULLET
+ /* only active bodies need damping update */
+ if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
+ RB_body_set_linear_damping(rbo->physics_object, value);
+ }
+#endif
+}
+
+static void rna_RigidBodyOb_angular_damping_set(PointerRNA *ptr, float value)
+{
+ RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+
+ rbo->ang_damping = value;
+
+#ifdef WITH_BULLET
+ /* only active bodies need damping update */
+ if ((rbo->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
+ RB_body_set_angular_damping(rbo->physics_object, value);
+ }
+#endif
+}
+
+static char *rna_RigidBodyCon_path(PointerRNA *ptr)
+{
+ /* NOTE: this hardcoded path should work as long as only Objects have this */
+ return BLI_sprintfN("rigid_body_constraint");
+}
+
+static void rna_RigidBodyCon_type_set(PointerRNA *ptr, int value)
+{
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+
+ rbc->type = value;
+ rbc->flag |= RBC_FLAG_NEEDS_VALIDATE;
+}
+
+static void rna_RigidBodyCon_enabled_set(PointerRNA *ptr, int value)
+{
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+
+ RB_FLAG_SET(rbc->flag, value, RBC_FLAG_ENABLED);
+
+#ifdef WITH_BULLET
+ if (rbc->physics_constraint) {
+ RB_constraint_set_enabled(rbc->physics_constraint, value);
+ }
+#endif
+}
+
+static void rna_RigidBodyCon_disable_collisions_set(PointerRNA *ptr, int value)
+{
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+
+ RB_FLAG_SET(rbc->flag, value, RBC_FLAG_DISABLE_COLLISIONS);
+
+ rbc->flag |= RBC_FLAG_NEEDS_VALIDATE;
+}
+
+static void rna_RigidBodyCon_use_breaking_set(PointerRNA *ptr, int value)
+{
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+
+ if (value) {
+ rbc->flag |= RBC_FLAG_USE_BREAKING;
+#ifdef WITH_BULLET
+ if (rbc->physics_constraint) {
+ RB_constraint_set_breaking_threshold(rbc->physics_constraint, rbc->breaking_threshold);
+ }
+#endif
+ }
+ else {
+ rbc->flag &= ~RBC_FLAG_USE_BREAKING;
+#ifdef WITH_BULLET
+ if (rbc->physics_constraint) {
+ RB_constraint_set_breaking_threshold(rbc->physics_constraint, FLT_MAX);
+ }
+#endif
+ }
+}
+
+static void rna_RigidBodyCon_breaking_threshold_set(PointerRNA *ptr, float value)
+{
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+
+ rbc->breaking_threshold = value;
+
+#ifdef WITH_BULLET
+ if (rbc->physics_constraint && (rbc->flag & RBC_FLAG_USE_BREAKING)) {
+ RB_constraint_set_breaking_threshold(rbc->physics_constraint, value);
+ }
+#endif
+}
+
+static void rna_RigidBodyCon_override_solver_iterations_set(PointerRNA *ptr, int value)
+{
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+
+ if (value) {
+ rbc->flag |= RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS;
+#ifdef WITH_BULLET
+ if (rbc->physics_constraint) {
+ RB_constraint_set_solver_iterations(rbc->physics_constraint, rbc->num_solver_iterations);
+ }
+#endif
+ }
+ else {
+ rbc->flag &= ~RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS;
+#ifdef WITH_BULLET
+ if (rbc->physics_constraint) {
+ RB_constraint_set_solver_iterations(rbc->physics_constraint, -1);
+ }
+#endif
+ }
+}
+
+static void rna_RigidBodyCon_num_solver_iterations_set(PointerRNA *ptr, int value)
+{
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+
+ rbc->num_solver_iterations = value;
+
+#ifdef WITH_BULLET
+ if (rbc->physics_constraint && (rbc->flag & RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS)) {
+ RB_constraint_set_solver_iterations(rbc->physics_constraint, value);
+ }
+#endif
+}
+
+static void rna_RigidBodyCon_spring_stiffness_x_set(PointerRNA *ptr, float value)
+{
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+
+ rbc->spring_stiffness_x = value;
+
+#ifdef WITH_BULLET
+ if (rbc->physics_constraint && rbc->type == RBC_TYPE_6DOF_SPRING && (rbc->flag & RBC_FLAG_USE_SPRING_X)) {
+ RB_constraint_set_stiffness_6dof_spring(rbc->physics_constraint, RB_LIMIT_LIN_X, value);
+ }
+#endif
+}
+
+static void rna_RigidBodyCon_spring_stiffness_y_set(PointerRNA *ptr, float value)
+{
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+
+ rbc->spring_stiffness_y = value;
+
+#ifdef WITH_BULLET
+ if (rbc->physics_constraint && rbc->type == RBC_TYPE_6DOF_SPRING && (rbc->flag & RBC_FLAG_USE_SPRING_Y)) {
+ RB_constraint_set_stiffness_6dof_spring(rbc->physics_constraint, RB_LIMIT_LIN_Y, value);
+ }
+#endif
+}
+
+static void rna_RigidBodyCon_spring_stiffness_z_set(PointerRNA *ptr, float value)
+{
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+
+ rbc->spring_stiffness_z = value;
+
+#ifdef WITH_BULLET
+ if (rbc->physics_constraint && rbc->type == RBC_TYPE_6DOF_SPRING && (rbc->flag & RBC_FLAG_USE_SPRING_Z)) {
+ RB_constraint_set_stiffness_6dof_spring(rbc->physics_constraint, RB_LIMIT_LIN_Z, value);
+ }
+#endif
+}
+
+static void rna_RigidBodyCon_spring_damping_x_set(PointerRNA *ptr, float value)
+{
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+
+ rbc->spring_damping_x = value;
+
+#ifdef WITH_BULLET
+ if (rbc->physics_constraint && rbc->type == RBC_TYPE_6DOF_SPRING && (rbc->flag & RBC_FLAG_USE_SPRING_X)) {
+ RB_constraint_set_damping_6dof_spring(rbc->physics_constraint, RB_LIMIT_LIN_X, value);
+ }
+#endif
+}
+
+static void rna_RigidBodyCon_spring_damping_y_set(PointerRNA *ptr, float value)
+{
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+
+ rbc->spring_damping_y = value;
+#ifdef WITH_BULLET
+ if (rbc->physics_constraint && rbc->type == RBC_TYPE_6DOF_SPRING && (rbc->flag & RBC_FLAG_USE_SPRING_Y)) {
+ RB_constraint_set_damping_6dof_spring(rbc->physics_constraint, RB_LIMIT_LIN_Y, value);
+ }
+#endif
+}
+
+static void rna_RigidBodyCon_spring_damping_z_set(PointerRNA *ptr, float value)
+{
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+
+ rbc->spring_damping_z = value;
+#ifdef WITH_BULLET
+ if (rbc->physics_constraint && rbc->type == RBC_TYPE_6DOF_SPRING && (rbc->flag & RBC_FLAG_USE_SPRING_Z)) {
+ RB_constraint_set_damping_6dof_spring(rbc->physics_constraint, RB_LIMIT_LIN_Z, value);
+ }
+#endif
+}
+
+#else
+
+static void rna_def_rigidbody_world(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "RigidBodyWorld", NULL);
+ RNA_def_struct_sdna(srna, "RigidBodyWorld");
+ RNA_def_struct_ui_text(srna, "Rigid Body World", "Self-contained rigid body simulation environment and settings");
+ RNA_def_struct_path_func(srna, "rna_RigidBodyWorld_path");
+
+ /* groups */
+ prop = RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Group");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_ui_text(prop, "Group", "Group containing objects participating in this simulation");
+ RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_reset");
+
+ prop = RNA_def_property(srna, "constraints", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Group");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_ui_text(prop, "Constraints", "Group containing rigid body constraint objects");
+ RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_reset");
+
+ /* booleans */
+ prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", RBW_FLAG_MUTED);
+ RNA_def_property_ui_text(prop, "Enabled", "Simulation will be evaluated");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ /* time scale */
+ prop = RNA_def_property(srna, "time_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "time_scale");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Time Scale", "Changes the speed of the simulation");
+ RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_reset");
+
+ /* timestep */
+ prop = RNA_def_property(srna, "steps_per_second", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "steps_per_second");
+ RNA_def_property_range(prop, 1, SHRT_MAX);
+ RNA_def_property_ui_range(prop, 60, 1000, 1, 0);
+ RNA_def_property_int_default(prop, 60);
+ RNA_def_property_ui_text(prop, "Steps Per Second", "Number of simulation steps taken per second (higher values are more accurate but slower)");
+ RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_reset");
+
+ /* constraint solver iterations */
+ prop = RNA_def_property(srna, "num_solver_iterations", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "num_solver_iterations");
+ RNA_def_property_range(prop, 1, 1000);
+ RNA_def_property_ui_range(prop, 10, 100, 1, 0);
+ RNA_def_property_int_default(prop, 10);
+ RNA_def_property_int_funcs(prop, NULL, "rna_RigidBodyWorld_num_solver_iterations_set", NULL);
+ RNA_def_property_ui_text(prop, "Solver Iterations", "Number of constraint solver iterations made per simulation step (higher values are more accurate but slower)");
+ RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_reset");
+
+ /* split impulse */
+ prop = RNA_def_property(srna, "use_split_impulse", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBW_FLAG_USE_SPLIT_IMPULSE);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyWorld_split_impulse_set");
+ RNA_def_property_ui_text(prop, "Split Impulse", "Reduces extra velocity that can build up when objects collide (lowers simulation stabilty a litte so use only when necessary)");
+ RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_reset");
+
+ /* cache */
+ prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "pointcache");
+ RNA_def_property_ui_text(prop, "Point Cache", "");
+
+ /* effector weights */
+ prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "EffectorWeights");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Effector Weights", "");
+}
+
+static void rna_def_rigidbody_object(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+
+ srna = RNA_def_struct(brna, "RigidBodyObject", NULL);
+ RNA_def_struct_sdna(srna, "RigidBodyOb");
+ RNA_def_struct_ui_text(srna, "Rigid Body Object", "Settings for object participating in Rigid Body Simulation");
+ RNA_def_struct_path_func(srna, "rna_RigidBodyOb_path");
+
+ /* Enums */
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, rigidbody_ob_type_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_RigidBodyOb_type_set", NULL);
+ RNA_def_property_ui_text(prop, "Type", "Role of object in Rigid Body Simulations");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ /* booleans */
+ prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", RBO_FLAG_DISABLED);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyOb_disabled_set");
+ RNA_def_property_ui_text(prop, "Enabled", "Rigid Body actively participated in the simulation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "collision_shape", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "shape");
+ RNA_def_property_enum_items(prop, rigidbody_ob_shape_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_RigidBodyOb_shape_set", NULL);
+ RNA_def_property_ui_text(prop, "Collision Shape", "Collision Shape of object in Rigid Body Simulations");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "kinematic", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBO_FLAG_KINEMATIC);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyOb_kinematic_state_set");
+ RNA_def_property_ui_text(prop, "Kinematic", "Allows rigid body to be controlled by the animation system");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ /* Physics Parameters */
+ prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_UNIT_MASS);
+ RNA_def_property_float_sdna(prop, NULL, "mass");
+ RNA_def_property_range(prop, 0.001f, FLT_MAX); // range must always be positive (and non-zero)
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_mass_set", NULL);
+ RNA_def_property_ui_text(prop, "Mass", "How much the object 'weighs' irrespective of gravity");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ /* Dynamics Parameters - Activation */
+ // TODO: define and figure out how to implement these
+
+ /* Dynamics Parameters - Deactivation */
+ prop = RNA_def_property(srna, "use_deactivation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBO_FLAG_USE_DEACTIVATION);
+ RNA_def_property_boolean_default(prop, TRUE);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyOb_activation_state_set");
+ RNA_def_property_ui_text(prop, "Enable Deactivation", "Enables deactivation of resting rigid bodies (increases performance and stability but can cause glitches)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "start_deactivated", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBO_FLAG_START_DEACTIVATED);
+ RNA_def_property_ui_text(prop, "Start Deactivated", "Deactivates rigid body at the start of the simulation");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "deactivate_linear_velocity", PROP_FLOAT, PROP_UNIT_VELOCITY);
+ RNA_def_property_float_sdna(prop, NULL, "lin_sleep_thresh");
+ RNA_def_property_range(prop, FLT_MIN, FLT_MAX); // range must always be positive (and non-zero)
+ RNA_def_property_float_default(prop, 0.4f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_linear_sleepThresh_set", NULL);
+ RNA_def_property_ui_text(prop, "Linear Velocity Deactivation Threshold", "Linear Velocity below which simulation stops simulating object");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "deactivate_angular_velocity", PROP_FLOAT, PROP_UNIT_VELOCITY);
+ RNA_def_property_float_sdna(prop, NULL, "ang_sleep_thresh");
+ RNA_def_property_range(prop, FLT_MIN, FLT_MAX); // range must always be positive (and non-zero)
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_angular_sleepThresh_set", NULL);
+ RNA_def_property_ui_text(prop, "Angular Velocity Deactivation Threshold", "Angular Velocity below which simulation stops simulating object");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ /* Dynamics Parameters - Damping Parameters */
+ prop = RNA_def_property(srna, "linear_damping", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "lin_damping");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_float_default(prop, 0.04f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_linear_damping_set", NULL);
+ RNA_def_property_ui_text(prop, "Linear Damping", "Amount of linear velocity that is lost over time");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "angular_damping", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "ang_damping");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_float_default(prop, 0.1f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_angular_damping_set", NULL);
+ RNA_def_property_ui_text(prop, "Angular Damping", "Amount of angular velocity that is lost over time");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ /* Collision Parameters - Surface Parameters */
+ prop = RNA_def_property(srna, "friction", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "friction");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 3);
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_friction_set", NULL);
+ RNA_def_property_ui_text(prop, "Friction", "Resistance of object to movement");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "restitution", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "restitution");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 3);
+ RNA_def_property_float_default(prop, 0.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_restitution_set", NULL);
+ RNA_def_property_ui_text(prop, "Restitution", "Tendency of object to bounce after colliding with another (0 = stays still, 1 = perfectly elastic)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ /* Collision Parameters - Sensitivity */
+ prop = RNA_def_property(srna, "use_margin", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBO_FLAG_USE_MARGIN);
+ RNA_def_property_boolean_default(prop, FALSE);
+ RNA_def_property_ui_text(prop, "Collision Margin", "Use custom collision margin (some shapes will have a visible gap around them)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_shape_reset");
+
+ prop = RNA_def_property(srna, "collision_margin", PROP_FLOAT, PROP_UNIT_LENGTH);
+ RNA_def_property_float_sdna(prop, NULL, "margin");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01, 3);
+ RNA_def_property_float_default(prop, 0.04f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_collision_margin_set", NULL);
+ RNA_def_property_ui_text(prop, "Collision Margin", "Threshold of distance near surface where collisions are still considered (best results when non-zero)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_shape_reset");
+
+ prop = RNA_def_property(srna, "collision_groups", PROP_BOOLEAN, PROP_LAYER_MEMBER);
+ RNA_def_property_boolean_sdna(prop, NULL, "col_groups", 1);
+ RNA_def_property_array(prop, 20);
+ RNA_def_property_ui_text(prop, "Collison Groups", "Collision Groups Rigid Body belongs to");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+ RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
+}
+
+static void rna_def_rigidbody_constraint(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "RigidBodyConstraint", NULL);
+ RNA_def_struct_sdna(srna, "RigidBodyCon");
+ RNA_def_struct_ui_text(srna, "Rigid Body Constraint", "Constraint influencing Objects inside Rigid Body Simulation");
+ RNA_def_struct_path_func(srna, "rna_RigidBodyCon_path");
+
+ /* Enums */
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, rigidbody_con_type_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_RigidBodyCon_type_set", NULL);
+ RNA_def_property_ui_text(prop, "Type", "Type of Rigid Body Constraint");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_ENABLED);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_enabled_set");
+ RNA_def_property_ui_text(prop, "Enabled", "Enable this constraint");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "disable_collisions", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_DISABLE_COLLISIONS);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_disable_collisions_set");
+ RNA_def_property_ui_text(prop, "Disable Collisions", "Disables collisions between constrained ridid bodies");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "object1", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "ob1");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Object 1", "First Rigid Body Object to be constrained");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "object2", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "ob2");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Object 2", "Second Rigid Body Object to be constrained");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ /* Breaking Threshold */
+ prop = RNA_def_property(srna, "use_breaking", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_BREAKING);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_use_breaking_set");
+ RNA_def_property_ui_text(prop, "Breakable", "Constraint can be broaken if it receives an impulse above the threshold");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "breaking_threshold", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "breaking_threshold");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 1000.0f, 100.0, 2);
+ RNA_def_property_float_default(prop, 10.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_breaking_threshold_set", NULL);
+ RNA_def_property_ui_text(prop, "Breaking Threshold", "Impulse threshold that must be reached for the constraint to break");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ /* Solver Iterations */
+ prop = RNA_def_property(srna, "override_solver_iterations", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_override_solver_iterations_set");
+ RNA_def_property_ui_text(prop, "Override Solver Iterations", "Overrides the number of solver iterations for this constraint");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "num_solver_iterations", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "num_solver_iterations");
+ RNA_def_property_range(prop, 1, 1000);
+ RNA_def_property_ui_range(prop, 1, 100, 1, 0);
+ RNA_def_property_int_default(prop, 10);
+ RNA_def_property_int_funcs(prop, NULL, "rna_RigidBodyCon_num_solver_iterations_set", NULL);
+ RNA_def_property_ui_text(prop, "Solver Iterations", "Number of constraint solver iterations made per simulation step (higher values are more accurate but slower)");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ /* Limits */
+ prop = RNA_def_property(srna, "use_limit_lin_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_LIN_X);
+ RNA_def_property_ui_text(prop, "X Axis", "Limits translation on x axis");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "use_limit_lin_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_LIN_Y);
+ RNA_def_property_ui_text(prop, "Y Axis", "Limits translation on y axis");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "use_limit_lin_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_LIN_Z);
+ RNA_def_property_ui_text(prop, "Z Axis", "Limits translation on z axis");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "use_limit_ang_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_ANG_X);
+ RNA_def_property_ui_text(prop, "X Angle", "Limits rotation around x axis");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "use_limit_ang_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_ANG_Y);
+ RNA_def_property_ui_text(prop, "Y Angle", "Limits rotation around y axis");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "use_limit_ang_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_ANG_Z);
+ RNA_def_property_ui_text(prop, "Z Angle", "Limits rotation around z axis");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "use_spring_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_SPRING_X);
+ RNA_def_property_ui_text(prop, "X Spring", "Enables spring on X axis");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "use_spring_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_SPRING_Y);
+ RNA_def_property_ui_text(prop, "Y Spring", "Enables spring on Y axis");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "use_spring_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_SPRING_Z);
+ RNA_def_property_ui_text(prop, "Z Spring", "Enables spring on Z axis");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "limit_lin_x_lower", PROP_FLOAT, PROP_UNIT_LENGTH);
+ RNA_def_property_float_sdna(prop, NULL, "limit_lin_x_lower");
+ RNA_def_property_float_default(prop, -1.0f);
+ RNA_def_property_ui_text(prop, "Lower X Limit", "Lower limit of x axis translation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "limit_lin_x_upper", PROP_FLOAT, PROP_UNIT_LENGTH);
+ RNA_def_property_float_sdna(prop, NULL, "limit_lin_x_upper");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Upper X Limit", "Upper limit of x axis translation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "limit_lin_y_lower", PROP_FLOAT, PROP_UNIT_LENGTH);
+ RNA_def_property_float_sdna(prop, NULL, "limit_lin_y_lower");
+ RNA_def_property_float_default(prop, -1.0f);
+ RNA_def_property_ui_text(prop, "Lower Y Limit", "Lower limit of y axis translation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "limit_lin_y_upper", PROP_FLOAT, PROP_UNIT_LENGTH);
+ RNA_def_property_float_sdna(prop, NULL, "limit_lin_y_upper");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Upper Y Limit", "Upper limit of y axis translation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "limit_lin_z_lower", PROP_FLOAT, PROP_UNIT_LENGTH);
+ RNA_def_property_float_sdna(prop, NULL, "limit_lin_z_lower");
+ RNA_def_property_float_default(prop, -1.0f);
+ RNA_def_property_ui_text(prop, "Lower Z Limit", "Lower limit of z axis translation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "limit_lin_z_upper", PROP_FLOAT, PROP_UNIT_LENGTH);
+ RNA_def_property_float_sdna(prop, NULL, "limit_lin_z_upper");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Upper Z Limit", "Upper limit of z axis translation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "limit_ang_x_lower", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "limit_ang_x_lower");
+ RNA_def_property_range(prop, -M_PI * 2, M_PI * 2);
+ RNA_def_property_float_default(prop, -M_PI_4);
+ RNA_def_property_ui_text(prop, "Lower X Angle Limit", "Lower limit of x axis rotation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "limit_ang_x_upper", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "limit_ang_x_upper");
+ RNA_def_property_range(prop, -M_PI * 2, M_PI * 2);
+ RNA_def_property_float_default(prop, M_PI_4);
+ RNA_def_property_ui_text(prop, "Upper X Angle Limit", "Upper limit of x axis rotation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "limit_ang_y_lower", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "limit_ang_y_lower");
+ RNA_def_property_range(prop, -M_PI * 2, M_PI * 2);
+ RNA_def_property_float_default(prop, -M_PI_4);
+ RNA_def_property_ui_text(prop, "Lower Y Angle Limit", "Lower limit of y axis rotation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "limit_ang_y_upper", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "limit_ang_y_upper");
+ RNA_def_property_range(prop, -M_PI * 2, M_PI * 2);
+ RNA_def_property_float_default(prop, M_PI_4);
+ RNA_def_property_ui_text(prop, "Upper Y Angle Limit", "Upper limit of y axis rotation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "limit_ang_z_lower", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "limit_ang_z_lower");
+ RNA_def_property_range(prop, -M_PI * 2, M_PI * 2);
+ RNA_def_property_float_default(prop, -M_PI_4);
+ RNA_def_property_ui_text(prop, "Lower Z Angle Limit", "Lower limit of z axis rotation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "limit_ang_z_upper", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "limit_ang_z_upper");
+ RNA_def_property_range(prop, -M_PI * 2, M_PI * 2);
+ RNA_def_property_float_default(prop, M_PI_4);
+ RNA_def_property_ui_text(prop, "Upper Z Angle Limit", "Upper limit of z axis rotation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "spring_stiffness_x", PROP_FLOAT, PROP_UNIT_LENGTH);
+ RNA_def_property_float_sdna(prop, NULL, "spring_stiffness_x");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
+ RNA_def_property_float_default(prop, 10.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_stiffness_x_set", NULL);
+ RNA_def_property_ui_text(prop, "X Axis Stiffness", "Stiffness on the X axis");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "spring_stiffness_y", PROP_FLOAT, PROP_UNIT_LENGTH);
+ RNA_def_property_float_sdna(prop, NULL, "spring_stiffness_y");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
+ RNA_def_property_float_default(prop, 10.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_stiffness_y_set", NULL);
+ RNA_def_property_ui_text(prop, "Y Axis Stiffness", "Stiffness on the Y axis");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "spring_stiffness_z", PROP_FLOAT, PROP_UNIT_LENGTH);
+ RNA_def_property_float_sdna(prop, NULL, "spring_stiffness_z");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
+ RNA_def_property_float_default(prop, 10.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_stiffness_z_set", NULL);
+ RNA_def_property_ui_text(prop, "Z Axis Stiffness", "Stiffness on the Z axis");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "spring_damping_x", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "spring_damping_x");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_damping_x_set", NULL);
+ RNA_def_property_ui_text(prop, "Damping X", "Damping on the X axis");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "spring_damping_y", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "spring_damping_y");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_damping_y_set", NULL);
+ RNA_def_property_ui_text(prop, "Damping Y", "Damping on the Y axis");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "spring_damping_z", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "spring_damping_z");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_damping_z_set", NULL);
+ RNA_def_property_ui_text(prop, "Damping Z", "Damping on the Z axis");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+}
+
+void RNA_def_rigidbody(BlenderRNA *brna)
+{
+ rna_def_rigidbody_world(brna);
+ rna_def_rigidbody_object(brna);
+ rna_def_rigidbody_constraint(brna);
+}
+
+
+#endif
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index 3f03445635f..b5b3897ed46 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -31,6 +31,7 @@
#include "RNA_access.h"
#include "RNA_define.h"
+#include "RNA_enum_types.h"
#include "rna_internal.h"
@@ -45,6 +46,9 @@ EnumPropertyItem property_type_items[] = {
{0, NULL, 0, NULL, NULL}
};
+/* XXX Keep in sync with bpy_props.c's property_subtype_xxx_items ???
+ * Currently it is not...
+ */
EnumPropertyItem property_subtype_items[] = {
{PROP_NONE, "NONE", 0, "None", ""},
@@ -52,7 +56,7 @@ EnumPropertyItem property_subtype_items[] = {
{PROP_FILEPATH, "FILEPATH", 0, "File Path", ""},
{PROP_DIRPATH, "DIRPATH", 0, "Directory Path", ""},
{PROP_FILENAME, "FILENAME", 0, "File Name", ""},
- {PROP_TRANSLATE, "TRANSLATE", 0, "Translate", ""},
+ {PROP_PASSWORD, "PASSWORD", 0, "Password", "A string that is displayed hidden ('********')"},
/* numbers */
{PROP_UNSIGNED, "UNSIGNED", 0, "Unsigned", ""},
@@ -522,6 +526,13 @@ static int rna_Property_unit_get(PointerRNA *ptr)
return RNA_SUBTYPE_UNIT(prop->subtype);
}
+static int rna_Property_icon_get(PointerRNA *ptr)
+{
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return prop->icon;
+}
+
static int rna_Property_readonly_get(PointerRNA *ptr)
{
PropertyRNA *prop = (PropertyRNA *)ptr->data;
@@ -880,6 +891,11 @@ static int rna_EnumPropertyItem_value_get(PointerRNA *ptr)
return ((EnumPropertyItem *)ptr->data)->value;
}
+static int rna_EnumPropertyItem_icon_get(PointerRNA *ptr)
+{
+ return ((EnumPropertyItem *)ptr->data)->icon;
+}
+
static PointerRNA rna_PointerProperty_fixed_type_get(PointerRNA *ptr)
{
PropertyRNA *prop = (PropertyRNA *)ptr->data;
@@ -1131,6 +1147,12 @@ static void rna_def_property(BlenderRNA *brna)
RNA_def_property_enum_funcs(prop, "rna_Property_unit_get", NULL, NULL);
RNA_def_property_ui_text(prop, "Unit", "Type of units for this property");
+ prop = RNA_def_property(srna, "icon", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_enum_items(prop, icon_items);
+ RNA_def_property_enum_funcs(prop, "rna_Property_icon_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Icon", "Icon of the item");
+
prop = RNA_def_property(srna, "is_readonly", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Property_readonly_get", NULL);
@@ -1408,6 +1430,12 @@ static void rna_def_enum_property(BlenderRNA *brna, StructRNA *srna)
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_int_funcs(prop, "rna_EnumPropertyItem_value_get", NULL, NULL);
RNA_def_property_ui_text(prop, "Value", "Value of the item");
+
+ prop = RNA_def_property(srna, "icon", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_enum_items(prop, icon_items);
+ RNA_def_property_enum_funcs(prop, "rna_EnumPropertyItem_icon_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Icon", "Icon of the item");
}
static void rna_def_pointer_property(StructRNA *srna, PropertyType type)
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index f4059bc5846..96bd0fb327e 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -35,6 +35,7 @@
#include "DNA_group_types.h"
#include "DNA_modifier_types.h"
#include "DNA_particle_types.h"
+#include "DNA_rigidbody_types.h"
#include "DNA_scene_types.h"
#include "DNA_userdef_types.h"
#include "DNA_world_types.h"
@@ -412,7 +413,7 @@ static void rna_Scene_object_unlink(Scene *scene, ReportList *reports, Object *o
scene->basact = NULL;
}
- BLI_remlink(&scene->base, base);
+ BKE_scene_base_unlink(scene, base);
MEM_freeN(base);
ob->id.us--;
@@ -1427,6 +1428,11 @@ static void rna_UnifiedPaintSettings_unprojected_radius_set(PointerRNA *ptr, flo
ups->unprojected_radius = value;
}
+static char *rna_UnifiedPaintSettings_path(PointerRNA *ptr)
+{
+ return BLI_strdup("tool_settings.unified_paint_settings");
+}
+
/* note: without this, when Multi-Paint is activated/deactivated, the colors
* will not change right away when multiple bones are selected, this function
* is not for general use and only for the few cases where changing scene
@@ -1456,6 +1462,11 @@ static void rna_SceneSequencer_update(Main *UNUSED(bmain), Scene *UNUSED(scene),
BKE_sequencer_preprocessed_cache_cleanup();
}
+static char *rna_ToolSettings_path(PointerRNA *ptr)
+{
+ return BLI_strdup("tool_settings");
+}
+
#ifdef WITH_FREESTYLE
static PointerRNA rna_FreestyleLineSet_linestyle_get(PointerRNA *ptr)
{
@@ -1576,6 +1587,7 @@ static void rna_def_tool_settings(BlenderRNA *brna)
};
srna = RNA_def_struct(brna, "ToolSettings", NULL);
+ RNA_def_struct_path_func(srna, "rna_ToolSettings_path");
RNA_def_struct_ui_text(srna, "Tool Settings", "");
prop = RNA_def_property(srna, "sculpt", PROP_POINTER, PROP_NONE);
@@ -1892,6 +1904,7 @@ static void rna_def_unified_paint_settings(BlenderRNA *brna)
PropertyRNA *prop;
srna = RNA_def_struct(brna, "UnifiedPaintSettings", NULL);
+ RNA_def_struct_path_func(srna, "rna_UnifiedPaintSettings_path");
RNA_def_struct_ui_text(srna, "Unified Paint Settings", "Overrides for some of the active brush's settings");
/* high-level flags to enable or disable unified paint settings */
@@ -4202,7 +4215,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_UNSIGNED);
RNA_def_property_float_sdna(prop, NULL, "blurfac");
- RNA_def_property_ui_range(prop, 0.01f, 2.0f, 1, 0);
+ RNA_def_property_ui_range(prop, 0.01f, 2.0f, 1, 1);
RNA_def_property_ui_text(prop, "Shutter", "Time taken in frames between shutter open and close");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
@@ -5059,6 +5072,13 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET, NULL);
rna_def_scene_keying_sets_all(brna, prop);
+ /* Rigid Body Simulation */
+ prop = RNA_def_property(srna, "rigidbody_world", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "rigidbody_world");
+ RNA_def_property_struct_type(prop, "RigidBodyWorld");
+ RNA_def_property_ui_text(prop, "Rigid Body World", "");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
/* Tool Settings */
prop = RNA_def_property(srna, "tool_settings", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c
index 9b5a858a581..e877367790e 100644
--- a/source/blender/makesrna/intern/rna_scene_api.c
+++ b/source/blender/makesrna/intern/rna_scene_api.c
@@ -101,6 +101,7 @@ static void rna_Scene_collada_export(
int selected,
int include_children,
int include_armatures,
+ int include_shapekeys,
int deform_bones_only,
int active_uv_only,
@@ -113,7 +114,7 @@ static void rna_Scene_collada_export(
int second_life)
{
collada_export(scene, filepath, apply_modifiers, export_mesh_type, selected,
- include_children, include_armatures, deform_bones_only,
+ include_children, include_armatures, include_shapekeys, deform_bones_only,
active_uv_only, include_uv_textures, include_material_textures,
use_texture_copies, use_object_instantiation, sort_by_name, second_life);
}
@@ -149,6 +150,7 @@ void RNA_api_scene(StructRNA *srna)
parm = RNA_def_boolean(func, "selected", 0, "Selection Only", "Export only selected elements");
parm = RNA_def_boolean(func, "include_children", 0, "Include Children", "Export all children of selected objects (even if not selected)");
parm = RNA_def_boolean(func, "include_armatures", 0, "Include Armatures", "Export related armatures (even if not selected)");
+ parm = RNA_def_boolean(func, "include_shapekeys", 0, "Include Shape Keys", "Export all Shape Keys from Mesh Objects");
parm = RNA_def_boolean(func, "deform_bones_only", 0, "Deform Bones only", "Only export deforming bones with armatures");
parm = RNA_def_boolean(func, "active_uv_only", 0, "Active UV Layer only", "Export only the active UV Layer");
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index cc1895541df..08bac1da7a7 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -190,6 +190,11 @@ static int rna_ParticleEdit_hair_get(PointerRNA *ptr)
return 0;
}
+static char *rna_ParticleEdit_path(PointerRNA *ptr)
+{
+ return BLI_strdup("tool_settings.particle_edit");
+}
+
static int rna_Brush_mode_poll(PointerRNA *ptr, PointerRNA value)
{
Scene *scene = (Scene *)ptr->id.data;
@@ -242,6 +247,38 @@ static void rna_Sculpt_ShowDiffuseColor_update(Main *UNUSED(bmain), Scene *scene
}
}
+static char *rna_Sculpt_path(PointerRNA *ptr)
+{
+ return BLI_strdup("tool_settings.sculpt");
+}
+
+static char *rna_VertexPaint_path(PointerRNA *ptr)
+{
+ Scene *scene = (Scene *)ptr->id.data;
+ ToolSettings *ts = scene->toolsettings;
+ if (ptr->data == ts->vpaint) {
+ return BLI_strdup("tool_settings.vertex_paint");
+ }
+ else {
+ return BLI_strdup("tool_settings.weight_paint");
+ }
+}
+
+static char *rna_ImagePaintSettings_path(PointerRNA *ptr)
+{
+ return BLI_strdup("tool_settings.image_paint");
+}
+
+static char *rna_UvSculpt_path(PointerRNA *ptr)
+{
+ return BLI_strdup("tool_settings.uv_sculpt");
+}
+
+static char *rna_ParticleBrush_path(PointerRNA *ptr)
+{
+ return BLI_strdup("tool_settings.particle_edit.brush");
+}
+
#else
static void rna_def_paint(BlenderRNA *brna)
@@ -283,6 +320,7 @@ static void rna_def_sculpt(BlenderRNA *brna)
PropertyRNA *prop;
srna = RNA_def_struct(brna, "Sculpt", "Paint");
+ RNA_def_struct_path_func(srna, "rna_Sculpt_path");
RNA_def_struct_ui_text(srna, "Sculpt", "");
prop = RNA_def_property(srna, "radial_symmetry", PROP_INT, PROP_XYZ);
@@ -368,6 +406,7 @@ static void rna_def_uv_sculpt(BlenderRNA *brna)
StructRNA *srna;
srna = RNA_def_struct(brna, "UvSculpt", "Paint");
+ RNA_def_struct_path_func(srna, "rna_UvSculpt_path");
RNA_def_struct_ui_text(srna, "UV Sculpting", "");
}
@@ -380,6 +419,7 @@ static void rna_def_vertex_paint(BlenderRNA *brna)
srna = RNA_def_struct(brna, "VertexPaint", "Paint");
RNA_def_struct_sdna(srna, "VPaint");
+ RNA_def_struct_path_func(srna, "rna_VertexPaint_path");
RNA_def_struct_ui_text(srna, "Vertex Paint", "Properties of vertex and weight paint mode");
/* vertex paint only */
@@ -408,6 +448,7 @@ static void rna_def_image_paint(BlenderRNA *brna)
srna = RNA_def_struct(brna, "ImagePaint", "Paint");
RNA_def_struct_sdna(srna, "ImagePaintSettings");
+ RNA_def_struct_path_func(srna, "rna_ImagePaintSettings_path");
RNA_def_struct_ui_text(srna, "Image Paint", "Properties of image and texture painting mode");
/* booleans */
@@ -492,6 +533,7 @@ static void rna_def_particle_edit(BlenderRNA *brna)
srna = RNA_def_struct(brna, "ParticleEdit", NULL);
RNA_def_struct_sdna(srna, "ParticleEditSettings");
+ RNA_def_struct_path_func(srna, "rna_ParticleEdit_path");
RNA_def_struct_ui_text(srna, "Particle Edit", "Properties of particle editing mode");
prop = RNA_def_property(srna, "tool", PROP_ENUM, PROP_NONE);
@@ -587,6 +629,7 @@ static void rna_def_particle_edit(BlenderRNA *brna)
srna = RNA_def_struct(brna, "ParticleBrush", NULL);
RNA_def_struct_sdna(srna, "ParticleBrushData");
+ RNA_def_struct_path_func(srna, "rna_ParticleBrush_path");
RNA_def_struct_ui_text(srna, "Particle Brush", "Particle editing brush");
prop = RNA_def_property(srna, "size", PROP_INT, PROP_DISTANCE);
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index a41551fc8da..f7daf6a3b06 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -40,6 +40,8 @@
#include "DNA_sequence_types.h"
#include "DNA_movieclip_types.h"
+#include "BLI_math.h"
+
#include "BKE_animsys.h"
#include "BKE_global.h"
#include "BKE_sequencer.h"
@@ -48,7 +50,6 @@
#include "MEM_guardedalloc.h"
#include "WM_types.h"
-#include "BLI_math.h"
#include "BLF_translation.h"
@@ -2058,13 +2059,13 @@ static void rna_def_transform(StructRNA *srna)
prop = RNA_def_property(srna, "scale_start_x", PROP_FLOAT, PROP_UNSIGNED);
RNA_def_property_float_sdna(prop, NULL, "ScalexIni");
RNA_def_property_ui_text(prop, "Scale X", "");
- RNA_def_property_ui_range(prop, 0, 10, 3, 10);
+ RNA_def_property_ui_range(prop, 0, 10, 3, 6);
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
prop = RNA_def_property(srna, "scale_start_y", PROP_FLOAT, PROP_UNSIGNED);
RNA_def_property_float_sdna(prop, NULL, "ScaleyIni");
RNA_def_property_ui_text(prop, "Scale Y", "");
- RNA_def_property_ui_range(prop, 0, 10, 3, 10);
+ RNA_def_property_ui_range(prop, 0, 10, 3, 6);
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
prop = RNA_def_property(srna, "use_uniform_scale", PROP_BOOLEAN, PROP_NONE);
@@ -2075,13 +2076,13 @@ static void rna_def_transform(StructRNA *srna)
prop = RNA_def_property(srna, "translate_start_x", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "xIni");
RNA_def_property_ui_text(prop, "Translate X", "");
- RNA_def_property_ui_range(prop, -500.0f, 500.0f, 3, 10);
+ RNA_def_property_ui_range(prop, -500.0f, 500.0f, 3, 6);
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
prop = RNA_def_property(srna, "translate_start_y", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "yIni");
RNA_def_property_ui_text(prop, "Translate Y", "");
- RNA_def_property_ui_range(prop, -500.0f, 500.0f, 3, 10);
+ RNA_def_property_ui_range(prop, -500.0f, 500.0f, 3, 6);
RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
prop = RNA_def_property(srna, "rotation_start", PROP_FLOAT, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 7fa3aae8ede..cccdf3258d2 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -41,6 +41,7 @@
#include "DNA_action_types.h"
#include "DNA_key_types.h"
+#include "DNA_material_types.h"
#include "DNA_node_types.h"
#include "DNA_object_types.h"
#include "DNA_space_types.h"
@@ -144,6 +145,7 @@ EnumPropertyItem clip_editor_mode_items[] = {
#include "BKE_paint.h"
#include "BKE_scene.h"
#include "BKE_screen.h"
+#include "BKE_icons.h"
#include "ED_image.h"
#include "ED_node.h"
@@ -152,6 +154,8 @@ EnumPropertyItem clip_editor_mode_items[] = {
#include "ED_sequencer.h"
#include "ED_clip.h"
+#include "GPU_material.h"
+
#include "IMB_imbuf_types.h"
static StructRNA *rna_Space_refine(struct PointerRNA *ptr)
@@ -376,6 +380,31 @@ static void rna_SpaceView3D_viewport_shade_update(Main *UNUSED(bmain), Scene *UN
}
}
+static void rna_SpaceView3D_matcap_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ View3D *v3d = (View3D *)(ptr->data);
+
+ if (v3d->defmaterial) {
+ Material *ma = v3d->defmaterial;
+
+ if (ma->preview)
+ BKE_previewimg_free(&ma->preview);
+
+ if (ma->gpumaterial.first)
+ GPU_material_free(ma);
+
+ WM_main_add_notifier(NC_MATERIAL | ND_SHADING_DRAW, ma);
+ }
+}
+
+static void rna_SpaceView3D_matcap_enable(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+{
+ View3D *v3d = (View3D *)(ptr->data);
+
+ if (v3d->matcap_icon == 0)
+ v3d->matcap_icon = ICON_MATCAP_01;
+}
+
static void rna_SpaceView3D_pivot_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
if (U.uiflag & USER_LOCKAROUND) {
@@ -482,8 +511,9 @@ static void rna_RegionView3D_view_rotation_set(PointerRNA *ptr, const float *val
static void rna_RegionView3D_view_matrix_set(PointerRNA *ptr, const float *values)
{
RegionView3D *rv3d = (RegionView3D *)(ptr->data);
- negate_v3_v3(rv3d->ofs, values);
- ED_view3d_from_m4((float (*)[4])values, rv3d->ofs, rv3d->viewquat, &rv3d->dist);
+ float mat[4][4];
+ invert_m4_m4(mat, (float (*)[4])values);
+ ED_view3d_from_m4(mat, rv3d->ofs, rv3d->viewquat, &rv3d->dist);
}
/* api call */
@@ -1463,6 +1493,7 @@ static void rna_def_backgroundImages(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_ui_description(func, "Remove all background images");
}
+
static void rna_def_space_view3d(BlenderRNA *brna)
{
StructRNA *srna;
@@ -1499,6 +1530,27 @@ static void rna_def_space_view3d(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}
};
+ static EnumPropertyItem view3d_matcap_items[] = {
+ {ICON_MATCAP_01, "01", ICON_MATCAP_01, "", ""},
+ {ICON_MATCAP_02, "02", ICON_MATCAP_02, "", ""},
+ {ICON_MATCAP_03, "03", ICON_MATCAP_03, "", ""},
+ {ICON_MATCAP_04, "04", ICON_MATCAP_04, "", ""},
+ {ICON_MATCAP_05, "05", ICON_MATCAP_05, "", ""},
+ {ICON_MATCAP_06, "06", ICON_MATCAP_06, "", ""},
+ {ICON_MATCAP_07, "07", ICON_MATCAP_07, "", ""},
+ {ICON_MATCAP_08, "08", ICON_MATCAP_08, "", ""},
+ {ICON_MATCAP_09, "09", ICON_MATCAP_09, "", ""},
+ {ICON_MATCAP_10, "10", ICON_MATCAP_10, "", ""},
+ {ICON_MATCAP_11, "11", ICON_MATCAP_11, "", ""},
+ {ICON_MATCAP_12, "12", ICON_MATCAP_12, "", ""},
+ {ICON_MATCAP_13, "13", ICON_MATCAP_13, "", ""},
+ {ICON_MATCAP_14, "14", ICON_MATCAP_14, "", ""},
+ {ICON_MATCAP_15, "15", ICON_MATCAP_15, "", ""},
+ {ICON_MATCAP_16, "16", ICON_MATCAP_16, "", ""},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+
srna = RNA_def_struct(brna, "SpaceView3D", "Space");
RNA_def_struct_sdna(srna, "View3D");
RNA_def_struct_ui_text(srna, "3D View Space", "3D View space data");
@@ -1819,6 +1871,17 @@ static void rna_def_space_view3d(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Show 3D Marker Names", "Show names for reconstructed tracks objects");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+ prop = RNA_def_property(srna, "use_matcap", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SOLID_MATCAP);
+ RNA_def_property_ui_text(prop, "Matcap", "Active Objects draw images mapped on normals, enhancing Solid Draw Mode");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_SpaceView3D_matcap_enable");
+
+ prop = RNA_def_property(srna, "matcap_icon", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "matcap_icon");
+ RNA_def_property_enum_items(prop, view3d_matcap_items);
+ RNA_def_property_ui_text(prop, "Matcap", "Image to use for Material Capture, active objects only");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_SpaceView3D_matcap_update");
+
/* region */
srna = RNA_def_struct(brna, "RegionView3D", NULL);
@@ -2699,6 +2762,11 @@ static void rna_def_space_time(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_DYNAMICPAINT);
RNA_def_property_ui_text(prop, "Dynamic Paint", "Show the active object's Dynamic Paint cache");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, NULL);
+
+ prop = RNA_def_property(srna, "cache_rigidbody", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_RIGIDBODY);
+ RNA_def_property_ui_text(prop, "Rigid Body", "Show the active object's Rigid Body cache");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, NULL);
}
static void rna_def_console_line(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c
index 2ab448c9188..fc67ae27387 100644
--- a/source/blender/makesrna/intern/rna_texture.c
+++ b/source/blender/makesrna/intern/rna_texture.c
@@ -44,6 +44,8 @@
#include "DNA_particle_types.h"
#include "DNA_scene_types.h" /* MAXFRAME only */
+#include "BLI_utildefines.h"
+
#include "BKE_node.h"
#include "WM_api.h"
@@ -563,7 +565,7 @@ static void rna_def_colormapping(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.01, 5);
+ RNA_def_property_range(prop, 0.0, 5);
RNA_def_property_ui_text(prop, "Contrast", "Adjust the contrast of the texture");
RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
@@ -1978,7 +1980,7 @@ static void rna_def_texture(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Texture_update");
prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.01, 5);
+ RNA_def_property_range(prop, 0.0, 5);
RNA_def_property_ui_text(prop, "Contrast", "Adjust the contrast of the texture");
RNA_def_property_update(prop, 0, "rna_Texture_update");
diff --git a/source/blender/makesrna/intern/rna_texture_api.c b/source/blender/makesrna/intern/rna_texture_api.c
index 5be9d3a0dec..218fda361fa 100644
--- a/source/blender/makesrna/intern/rna_texture_api.c
+++ b/source/blender/makesrna/intern/rna_texture_api.c
@@ -71,7 +71,7 @@ static void clear_envmap(struct EnvMap *env, bContext *C)
static void texture_evaluate(struct Tex *tex, float value[3], float color_r[4])
{
TexResult texres = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
- multitex_ext(tex, value, NULL, NULL, 1, &texres);
+ multitex_ext(tex, value, NULL, NULL, 1, &texres, NULL);
color_r[0] = texres.tr;
color_r[1] = texres.tg;
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c
index 00124a82dd1..fad93ea9054 100644
--- a/source/blender/makesrna/intern/rna_ui.c
+++ b/source/blender/makesrna/intern/rna_ui.c
@@ -813,9 +813,6 @@ static void rna_def_panel(BlenderRNA *brna)
"class name is \"OBJECT_PT_hello\", and bl_idname is not set by the "
"script, then bl_idname = \"OBJECT_PT_hello\"");
- /* panel's label indeed doesn't need PROP_TRANSLATE flag: translation of label happens in runtime
- * when drawing panel and having this flag set will make runtime switching of language much more tricky
- * because label will be stored translated */
prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "type->label");
RNA_def_property_flag(prop, PROP_REGISTER);
@@ -992,9 +989,6 @@ static void rna_def_menu(BlenderRNA *brna)
"class name is \"OBJECT_MT_hello\", and bl_idname is not set by the "
"script, then bl_idname = \"OBJECT_MT_hello\")");
- /* menu's label indeed doesn't need PROP_TRANSLATE flag: translation of label happens in runtime
- * when drawing panel and having this flag set will make runtime switching of language much more tricky
- * because label will be stored translated */
prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "type->label");
RNA_def_property_flag(prop, PROP_REGISTER);
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index 366d0dc1fd9..787a5d6487e 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -42,6 +42,17 @@
#include "rna_internal.h"
+#define DEF_ICON_BLANK_SKIP
+#define DEF_ICON(name) {ICON_##name, (#name), 0, (#name), ""},
+#define DEF_VICO(name) {VICO_##name, (#name), 0, (#name), ""},
+EnumPropertyItem icon_items[] = {
+#include "UI_icons.h"
+ {0, NULL, 0, NULL, NULL}
+};
+#undef DEF_ICON_BLANK_SKIP
+#undef DEF_ICON
+#undef DEF_VICO
+
#ifdef RNA_RUNTIME
static void rna_uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, const char *name, int icon,
@@ -181,22 +192,11 @@ static int rna_ui_get_enum_icon(bContext *C, PointerRNA *ptr, const char *propna
#else
-#define DEF_ICON_BLANK_SKIP
-#define DEF_ICON(name) {ICON_##name, (#name), 0, (#name), ""},
-#define DEF_VICO(name) {VICO_##name, (#name), 0, (#name), ""},
-EnumPropertyItem icon_items[] = {
-#include "UI_icons.h"
- {0, NULL, 0, NULL, NULL}
-};
-#undef DEF_ICON_BLANK_SKIP
-#undef DEF_ICON
-#undef DEF_VICO
-
static void api_ui_item_common(FunctionRNA *func)
{
PropertyRNA *prop;
- RNA_def_string_translate(func, "text", "", 0, "", "Override automatic text of the item");
+ RNA_def_string_py_translate(func, "text", "", 0, "", "Override automatic text of the item");
prop = RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, icon_items);
@@ -466,7 +466,7 @@ void RNA_api_ui_layout(StructRNA *srna)
parm = RNA_def_string(func, "type_property", "", 0, "",
"Identifier of property in data giving the type of the ID-blocks to use");
RNA_def_property_flag(parm, PROP_REQUIRED);
- RNA_def_string_translate(func, "text", "", 0, "", "Custom label to display in UI");
+ RNA_def_string_py_translate(func, "text", "", 0, "", "Custom label to display in UI");
func = RNA_def_function(srna, "template_path_builder", "uiTemplatePathBuilder");
parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
@@ -475,7 +475,7 @@ void RNA_api_ui_layout(StructRNA *srna)
RNA_def_property_flag(parm, PROP_REQUIRED);
parm = RNA_def_pointer(func, "root", "ID", "", "ID-block from which path is evaluated from");
RNA_def_property_flag(parm, PROP_REQUIRED | PROP_RNAPTR);
- RNA_def_string_translate(func, "text", "", 0, "", "Custom label to display in UI");
+ RNA_def_string_py_translate(func, "text", "", 0, "", "Custom label to display in UI");
func = RNA_def_function(srna, "template_modifier", "uiTemplateModifier");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
@@ -512,6 +512,10 @@ void RNA_api_ui_layout(StructRNA *srna)
api_ui_item_rna_common(func);
RNA_def_boolean(func, "expand", 0, "", "Expand button to show more detail");
+ func = RNA_def_function(srna, "template_icon_view", "uiTemplateIconView");
+ RNA_def_function_ui_description(func, "Enum. Large widget showing Icon previews");
+ api_ui_item_rna_common(func);
+
func = RNA_def_function(srna, "template_histogram", "uiTemplateHistogram");
RNA_def_function_ui_description(func, "Item. A histogramm widget to analyze imaga data");
api_ui_item_rna_common(func);
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index f53b67c0e92..8ebf83532de 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -325,6 +325,11 @@ static void rna_userdef_addon_remove(ReportList *reports, PointerRNA *bext_ptr)
return;
}
+ if (bext->prop) {
+ IDP_FreeProperty(bext->prop);
+ MEM_freeN(bext->prop);
+ }
+
BLI_freelinkN(&U.addons, bext);
RNA_POINTER_INVALIDATE(bext_ptr);
}
@@ -603,22 +608,14 @@ static void rna_def_userdef_theme_ui_style(BlenderRNA *brna)
RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
RNA_def_struct_ui_text(srna, "Style", "Theme settings for style sets");
- /* (not used yet) */
-#if 0
- prop = RNA_def_property(srna, "panelzoom", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.5, 2.0);
- RNA_def_property_ui_text(prop, "Panel Zoom", "Default zoom level for panel areas");
-#endif
- /* (not used yet) */
-#if 0
- prop = RNA_def_property(srna, "group_label", PROP_POINTER, PROP_NONE);
+ prop = RNA_def_property(srna, "panel_title", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "grouplabel");
+ RNA_def_property_pointer_sdna(prop, NULL, "paneltitle");
RNA_def_property_struct_type(prop, "ThemeFontStyle");
- RNA_def_property_ui_text(prop, "Group Label Font", "");
+ RNA_def_property_ui_text(prop, "Panel Title Font", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
-#endif
+
prop = RNA_def_property(srna, "widget_label", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
RNA_def_property_pointer_sdna(prop, NULL, "widgetlabel");
@@ -1893,6 +1890,18 @@ static void rna_def_userdef_theme_space_node(BlenderRNA *brna)
RNA_def_property_array(prop, 4);
RNA_def_property_ui_text(prop, "Frame Node", "");
RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "matte_node", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "syntaxs");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Matte Node", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "distor_node", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "syntaxd");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Distort Node", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
prop = RNA_def_property(srna, "noodle_curving", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "noodle_curving");
@@ -3325,7 +3334,7 @@ static void rna_def_userdef_system(BlenderRNA *brna)
prop = RNA_def_property(srna, "dpi", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "dpi");
- RNA_def_property_range(prop, 48, 128);
+ RNA_def_property_range(prop, 48, 144);
RNA_def_property_ui_text(prop, "DPI", "Font size and resolution for display");
RNA_def_property_update(prop, 0, "rna_userdef_dpi_update");
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index f416d3403ad..0c1c5d8f64a 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -853,8 +853,11 @@ static void rna_Operator_unregister(struct Main *bmain, StructRNA *type)
/* update while blender is running */
wm = bmain->wm.first;
- if (wm)
+ if (wm) {
WM_operator_stack_clear(wm);
+
+ WM_operator_handlers_clear(wm, ot);
+ }
WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
RNA_struct_free_extension(type, &ot->ext);
@@ -1330,9 +1333,6 @@ static void rna_def_operator(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_REGISTER | PROP_NEVER_CLAMP);
RNA_def_struct_name_property(srna, prop);
- /* operator's label indeed doesn't need PROP_TRANSLATE flag: translation of label happens in runtime
- * when drawing panel and having this flag set will make runtime switching of language much more tricky
- * because label will be stored translated */
prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "type->name");
RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
@@ -1397,9 +1397,6 @@ static void rna_def_macro_operator(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_REGISTER | PROP_NEVER_CLAMP);
RNA_def_struct_name_property(srna, prop);
- /* menu's label indeed doesn't need PROP_TRANSLATE flag: translation of label happens in runtime
- * when drawing panel and having this flag set will make runtime switching of language much more tricky
- * because label will be stored translated */
prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "type->name");
RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */