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
path: root/source
diff options
context:
space:
mode:
authorJoseph Eagar <joeedh@gmail.com>2010-09-07 09:47:34 +0400
committerJoseph Eagar <joeedh@gmail.com>2010-09-07 09:47:34 +0400
commit82432d0d99f2101ee2ceba86bdc49669b5fa306f (patch)
treeada47d0a65cb7614ead93fcdbb3421e5398ff3dc /source
parent859c5a42f0fe8b9bec0d3ddce1612942942619a7 (diff)
parent8a320974f1b3e6004db3b3ad64f97742f878cbee (diff)
merge from trunk at r31523
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_constraint.h1
-rw-r--r--source/blender/blenkernel/BKE_customdata.h2
-rw-r--r--source/blender/blenkernel/BKE_fcurve.h1
-rw-r--r--source/blender/blenkernel/BKE_material.h7
-rw-r--r--source/blender/blenkernel/BKE_mball.h1
-rw-r--r--source/blender/blenkernel/BKE_particle.h3
-rw-r--r--source/blender/blenkernel/BKE_sequencer.h2
-rw-r--r--source/blender/blenkernel/BKE_texture.h1
-rw-r--r--source/blender/blenkernel/intern/anim.c6
-rw-r--r--source/blender/blenkernel/intern/blender.c16
-rw-r--r--source/blender/blenkernel/intern/boids.c1
-rw-r--r--source/blender/blenkernel/intern/constraint.c11
-rw-r--r--source/blender/blenkernel/intern/context.c2
-rw-r--r--source/blender/blenkernel/intern/customdata.c4
-rw-r--r--source/blender/blenkernel/intern/fmodifier.c7
-rw-r--r--source/blender/blenkernel/intern/font.c6
-rw-r--r--source/blender/blenkernel/intern/image.c8
-rw-r--r--source/blender/blenkernel/intern/library.c14
-rw-r--r--source/blender/blenkernel/intern/material.c86
-rw-r--r--source/blender/blenkernel/intern/mball.c49
-rw-r--r--source/blender/blenkernel/intern/object.c2
-rw-r--r--source/blender/blenkernel/intern/packedFile.c2
-rw-r--r--source/blender/blenkernel/intern/particle.c59
-rw-r--r--source/blender/blenkernel/intern/particle_system.c73
-rw-r--r--source/blender/blenkernel/intern/report.c2
-rw-r--r--source/blender/blenkernel/intern/sca.c19
-rw-r--r--source/blender/blenkernel/intern/sequencer.c2
-rw-r--r--source/blender/blenkernel/intern/sound.c2
-rw-r--r--source/blender/blenkernel/intern/texture.c43
-rw-r--r--source/blender/blenlib/BLI_math_color.h6
-rw-r--r--source/blender/blenlib/BLI_math_vector.h6
-rw-r--r--source/blender/blenlib/BLI_rect.h3
-rwxr-xr-xsource/blender/blenlib/BLI_sparsemap.h73
-rw-r--r--source/blender/blenlib/BLI_string.h3
-rw-r--r--source/blender/blenlib/intern/math_color.c34
-rw-r--r--source/blender/blenlib/intern/math_vector.c6
-rw-r--r--source/blender/blenlib/intern/rct.c20
-rw-r--r--source/blender/blenlib/intern/string.c111
-rw-r--r--source/blender/blenloader/BLO_readfile.h13
-rw-r--r--source/blender/blenloader/intern/readblenentry.c9
-rw-r--r--source/blender/blenloader/intern/readfile.c4
-rw-r--r--source/blender/collada/CMakeLists.txt4
-rw-r--r--source/blender/collada/DocumentExporter.cpp18
-rw-r--r--source/blender/collada/SConscript5
-rw-r--r--source/blender/editors/animation/anim_draw.c1
-rw-r--r--source/blender/editors/animation/anim_ops.c2
-rw-r--r--source/blender/editors/animation/fmodifier_ui.c2
-rw-r--r--source/blender/editors/armature/armature_ops.c2
-rw-r--r--source/blender/editors/armature/editarmature.c15
-rw-r--r--source/blender/editors/armature/poselib.c12
-rw-r--r--source/blender/editors/curve/curve_intern.h4
-rw-r--r--source/blender/editors/curve/curve_ops.c4
-rw-r--r--source/blender/editors/curve/editcurve.c40
-rw-r--r--source/blender/editors/gpencil/drawgpencil.c48
-rw-r--r--source/blender/editors/gpencil/gpencil_ops.c3
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c32
-rw-r--r--source/blender/editors/include/ED_gpencil.h2
-rw-r--r--source/blender/editors/include/ED_mesh.h97
-rw-r--r--source/blender/editors/include/ED_view3d.h7
-rw-r--r--source/blender/editors/include/UI_icons.h10
-rw-r--r--source/blender/editors/include/UI_interface.h8
-rw-r--r--source/blender/editors/interface/interface.c10
-rw-r--r--source/blender/editors/interface/interface_handlers.c41
-rw-r--r--source/blender/editors/interface/interface_intern.h2
-rw-r--r--source/blender/editors/interface/interface_templates.c87
-rw-r--r--source/blender/editors/interface/interface_widgets.c14
-rw-r--r--source/blender/editors/interface/resources.c4
-rw-r--r--source/blender/editors/mesh/editbmesh_add.c6
-rw-r--r--source/blender/editors/mesh/loopcut.c2
-rw-r--r--source/blender/editors/mesh/mesh_data.c83
-rw-r--r--source/blender/editors/mesh/mesh_intern.h2
-rw-r--r--source/blender/editors/mesh/mesh_ops.c2
-rw-r--r--source/blender/editors/metaball/mball_edit.c51
-rw-r--r--source/blender/editors/object/object_add.c16
-rw-r--r--source/blender/editors/object/object_modifier.c24
-rw-r--r--source/blender/editors/object/object_relations.c2
-rw-r--r--source/blender/editors/object/object_vgroup.c2
-rw-r--r--source/blender/editors/physics/particle_edit.c7
-rw-r--r--source/blender/editors/render/render_opengl.c16
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c2
-rw-r--r--source/blender/editors/space_buttons/space_buttons.c2
-rw-r--r--source/blender/editors/space_file/Makefile2
-rw-r--r--source/blender/editors/space_file/file_draw.c7
-rw-r--r--source/blender/editors/space_image/image_ops.c6
-rw-r--r--source/blender/editors/space_image/space_image.c2
-rw-r--r--source/blender/editors/space_logic/logic_window.c2
-rw-r--r--source/blender/editors/space_node/drawnode.c20
-rw-r--r--source/blender/editors/space_outliner/outliner.c58
-rw-r--r--source/blender/editors/space_time/space_time.c8
-rw-r--r--source/blender/editors/space_view3d/drawobject.c21
-rw-r--r--source/blender/editors/space_view3d/drawvolume.c2
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c58
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c160
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c53
-rw-r--r--source/blender/editors/space_view3d/view3d_intern.h4
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c6
-rw-r--r--source/blender/editors/transform/SConscript2
-rw-r--r--source/blender/editors/transform/transform.c6
-rw-r--r--source/blender/editors/transform/transform_ops.c6
-rw-r--r--source/blender/editors/util/undo.c2
-rw-r--r--source/blender/gpu/intern/gpu_buffers.c3
-rw-r--r--source/blender/gpu/intern/gpu_draw.c2
-rw-r--r--source/blender/imbuf/intern/cineon/cineon_dpx.c2
-rw-r--r--source/blender/imbuf/intern/scaling.c2
-rw-r--r--source/blender/imbuf/intern/thumbs_blend.c2
-rw-r--r--source/blender/makesdna/DNA_node_types.h1
-rw-r--r--source/blender/makesdna/DNA_object_types.h2
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h2
-rw-r--r--source/blender/makesdna/DNA_view3d_types.h4
-rw-r--r--source/blender/makesdna/intern/SConscript2
-rw-r--r--source/blender/makesdna/intern/makesdna.c2
-rw-r--r--source/blender/makesrna/RNA_access.h2
-rw-r--r--source/blender/makesrna/RNA_define.h1
-rw-r--r--source/blender/makesrna/RNA_types.h8
-rw-r--r--source/blender/makesrna/intern/SConscript4
-rw-r--r--source/blender/makesrna/intern/makesrna.c60
-rw-r--r--source/blender/makesrna/intern/rna_ID.c27
-rw-r--r--source/blender/makesrna/intern/rna_access.c54
-rw-r--r--source/blender/makesrna/intern/rna_action.c14
-rw-r--r--source/blender/makesrna/intern/rna_action_api.c24
-rw-r--r--source/blender/makesrna/intern/rna_animation.c29
-rw-r--r--source/blender/makesrna/intern/rna_armature.c8
-rw-r--r--source/blender/makesrna/intern/rna_cloth.c6
-rw-r--r--source/blender/makesrna/intern/rna_color.c3
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c2
-rw-r--r--source/blender/makesrna/intern/rna_context.c8
-rw-r--r--source/blender/makesrna/intern/rna_curve.c25
-rw-r--r--source/blender/makesrna/intern/rna_define.c13
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c31
-rw-r--r--source/blender/makesrna/intern/rna_image.c2
-rw-r--r--source/blender/makesrna/intern/rna_internal.h6
-rw-r--r--source/blender/makesrna/intern/rna_lamp.c4
-rw-r--r--source/blender/makesrna/intern/rna_main.c8
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c52
-rw-r--r--source/blender/makesrna/intern/rna_material.c93
-rw-r--r--source/blender/makesrna/intern/rna_material_api.c85
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c186
-rw-r--r--source/blender/makesrna/intern/rna_mesh_api.c33
-rw-r--r--source/blender/makesrna/intern/rna_meta.c91
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c31
-rw-r--r--source/blender/makesrna/intern/rna_object.c163
-rw-r--r--source/blender/makesrna/intern/rna_object_api.c40
-rw-r--r--source/blender/makesrna/intern/rna_object_force.c32
-rw-r--r--source/blender/makesrna/intern/rna_pose.c67
-rw-r--r--source/blender/makesrna/intern/rna_render.c24
-rw-r--r--source/blender/makesrna/intern/rna_rna.c12
-rw-r--r--source/blender/makesrna/intern/rna_scene.c171
-rw-r--r--source/blender/makesrna/intern/rna_scene_api.c46
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c2
-rw-r--r--source/blender/makesrna/intern/rna_space.c6
-rw-r--r--source/blender/makesrna/intern/rna_ui.c19
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c12
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c8
-rw-r--r--source/blender/makesrna/intern/rna_wm.c161
-rw-r--r--source/blender/makesrna/intern/rna_wm_api.c73
-rw-r--r--source/blender/makesrna/intern/rna_world.c4
-rw-r--r--source/blender/makesrna/rna_cleanup/rna_properties.txt35
-rwxr-xr-xsource/blender/makesrna/rna_cleanup/rna_update.sh2
-rw-r--r--source/blender/modifiers/SConscript2
-rw-r--r--source/blender/modifiers/intern/MOD_screw.c2
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c15
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_crop.c7
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_displace.c30
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_rotate.c5
-rw-r--r--source/blender/python/SConscript2
-rw-r--r--source/blender/python/doc/epy/Geometry.py2
-rw-r--r--source/blender/python/doc/epy/IDProp.py2
-rw-r--r--source/blender/python/doc/examples/mathutils.Euler.py2
-rw-r--r--source/blender/python/doc/examples/mathutils.Matrix.py2
-rw-r--r--source/blender/python/doc/examples/mathutils.Quaternion.py2
-rw-r--r--source/blender/python/doc/examples/mathutils.py2
-rw-r--r--source/blender/python/doc/sphinx_doc_gen.py18
-rwxr-xr-xsource/blender/python/doc/sphinx_doc_gen.sh13
-rw-r--r--source/blender/python/generic/CMakeLists.txt2
-rw-r--r--source/blender/python/generic/IDProp.c39
-rw-r--r--source/blender/python/generic/bpy_internal_import.c7
-rw-r--r--source/blender/python/generic/mathutils_euler.c2
-rw-r--r--source/blender/python/generic/mathutils_matrix.c1
-rw-r--r--source/blender/python/generic/mathutils_vector.c65
-rw-r--r--source/blender/python/generic/py_capi_utils.c271
-rw-r--r--source/blender/python/generic/py_capi_utils.h41
-rw-r--r--source/blender/python/intern/bpy.h2
-rw-r--r--source/blender/python/intern/bpy_array.c41
-rw-r--r--source/blender/python/intern/bpy_interface.c1
-rw-r--r--source/blender/python/intern/bpy_operator.c41
-rw-r--r--source/blender/python/intern/bpy_props.c20
-rw-r--r--source/blender/python/intern/bpy_rna.c482
-rw-r--r--source/blender/python/intern/bpy_rna.h11
-rw-r--r--source/blender/python/intern/bpy_util.c201
-rw-r--r--source/blender/python/intern/bpy_util.h13
-rw-r--r--source/blender/quicktime/quicktime_import.h2
-rw-r--r--source/blender/render/CMakeLists.txt2
-rw-r--r--source/blender/render/intern/source/imagetexture.c2
-rw-r--r--source/blender/render/intern/source/pipeline.c23
-rw-r--r--source/blender/windowmanager/WM_api.h4
-rw-r--r--source/blender/windowmanager/WM_types.h1
-rw-r--r--source/blender/windowmanager/intern/wm.c4
-rw-r--r--source/blender/windowmanager/intern/wm_cursors.c2
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c2
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c10
-rw-r--r--source/blender/windowmanager/intern/wm_files.c6
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c6
-rw-r--r--source/blenderplayer/CMakeLists.txt24
-rw-r--r--source/blenderplayer/bad_level_call_stubs/CMakeLists.txt1
-rw-r--r--source/blenderplayer/bad_level_call_stubs/SConscript3
-rw-r--r--source/blenderplayer/bad_level_call_stubs/stubs.c13
-rw-r--r--source/creator/CMakeLists.txt145
-rw-r--r--source/creator/creator.c11
-rw-r--r--source/gameengine/Converter/BL_BlenderDataConversion.cpp10
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsController.cpp16
-rw-r--r--source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp2
-rw-r--r--source/kernel/gen_system/GEN_HashedPtr.cpp2
212 files changed, 3560 insertions, 1724 deletions
diff --git a/source/blender/blenkernel/BKE_constraint.h b/source/blender/blenkernel/BKE_constraint.h
index 64e9636cae7..d6e0075df1e 100644
--- a/source/blender/blenkernel/BKE_constraint.h
+++ b/source/blender/blenkernel/BKE_constraint.h
@@ -136,7 +136,6 @@ struct bConstraint *add_ob_constraint(struct Object *ob, const char *name, short
struct bConstraint *add_pose_constraint(struct Object *ob, struct bPoseChannel *pchan, const char *name, short type);
int remove_constraint(ListBase *list, struct bConstraint *con);
-int remove_constraint_index(ListBase *list, int index);
void remove_constraints_type(ListBase *list, short type, short last_only);
/* Constraints + Proxies function prototypes */
diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h
index ae38d4b4a41..7e59aa5ac8e 100644
--- a/source/blender/blenkernel/BKE_customdata.h
+++ b/source/blender/blenkernel/BKE_customdata.h
@@ -117,7 +117,7 @@ void *CustomData_add_layer(struct CustomData *data, int type, int alloctype,
void *layer, int totelem);
/*same as above but accepts a name */
void *CustomData_add_layer_named(struct CustomData *data, int type, int alloctype,
- void *layer, int totelem, char *name);
+ void *layer, int totelem, const char *name);
/* frees the active or first data layer with the give type.
* returns 1 on succes, 0 if no layer with the given type is found
diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h
index 6de0c55af3b..95e0cfc3a91 100644
--- a/source/blender/blenkernel/BKE_fcurve.h
+++ b/source/blender/blenkernel/BKE_fcurve.h
@@ -161,7 +161,6 @@ struct FModifier *add_fmodifier(ListBase *modifiers, int type);
struct FModifier *copy_fmodifier(struct FModifier *src);
void copy_fmodifiers(ListBase *dst, ListBase *src);
int remove_fmodifier(ListBase *modifiers, struct FModifier *fcm);
-int remove_fmodifier_index(ListBase *modifiers, int index);
void free_fmodifiers(ListBase *modifiers);
struct FModifier *find_active_fmodifier(ListBase *modifiers);
diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h
index a220153523e..40d98394a8e 100644
--- a/source/blender/blenkernel/BKE_material.h
+++ b/source/blender/blenkernel/BKE_material.h
@@ -57,6 +57,9 @@ void automatname(struct Material *);
struct Material ***give_matarar(struct Object *ob);
short *give_totcolp(struct Object *ob);
+struct Material ***give_matarar_id(struct ID *id); /* same but for ID's */
+short *give_totcolp_id(struct ID *id);
+
struct Material *give_current_material(struct Object *ob, int act);
struct ID *material_from(struct Object *ob, int act);
void assign_material(struct Object *ob, struct Material *ma, int act);
@@ -67,6 +70,10 @@ int find_material_index(struct Object *ob, struct Material *ma);
int object_add_material_slot(struct Object *ob);
int object_remove_material_slot(struct Object *ob);
+/* rna api */
+void material_append_id(struct ID *id, struct Material *ma);
+struct Material *material_pop_id(struct ID *id, int index);
+
/* rendering */
void init_render_material(struct Material *, int, float *);
diff --git a/source/blender/blenkernel/BKE_mball.h b/source/blender/blenkernel/BKE_mball.h
index 8d7d205e847..7fa4fc1a05e 100644
--- a/source/blender/blenkernel/BKE_mball.h
+++ b/source/blender/blenkernel/BKE_mball.h
@@ -162,6 +162,7 @@ void free_mball(struct MetaBall *mb);
struct MetaBall *add_mball(char *name);
struct MetaBall *copy_mball(struct MetaBall *mb);
void make_local_mball(struct MetaBall *mb);
+struct MetaElem *add_metaball_element(struct MetaBall *mb, const int type);
void tex_space_mball(struct Object *ob);
float *make_orco_mball(struct Object *ob, struct ListBase *dispbase);
void copy_mball_properties(struct Scene *scene, struct Object *active_object);
diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h
index fcef00ae9b3..1416e1280cf 100644
--- a/source/blender/blenkernel/BKE_particle.h
+++ b/source/blender/blenkernel/BKE_particle.h
@@ -253,6 +253,7 @@ ParticleThread *psys_threads_create(struct ParticleSimulationData *sim);
void psys_threads_free(ParticleThread *threads);
void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3], float zvec[3], float center[3]);
+void psys_apply_hair_lattice(struct Scene *scene, struct Object *ob, struct ParticleSystem *psys);
/* particle_system.c */
struct ParticleSystem *psys_get_target_system(struct Object *ob, struct ParticleTarget *pt);
@@ -282,6 +283,8 @@ void psys_mat_hair_to_object(struct Object *ob, struct DerivedMesh *dm, short fr
void psys_mat_hair_to_global(struct Object *ob, struct DerivedMesh *dm, short from, struct ParticleData *pa, float hairmat[][4]);
void psys_mat_hair_to_orco(struct Object *ob, struct DerivedMesh *dm, short from, struct ParticleData *pa, float hairmat[][4]);
+float psys_get_dietime_from_cache(struct PointCache *cache, int index);
+
void psys_free_pdd(struct ParticleSystem *psys);
float *psys_cache_vgroup(struct DerivedMesh *dm, struct ParticleSystem *psys, int vgroup);
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h
index a9fb45c6e14..0766012b4a5 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -276,7 +276,7 @@ struct Sequence *sequencer_add_sound_strip(struct bContext *C, ListBase *seqbase
struct Sequence *sequencer_add_movie_strip(struct bContext *C, ListBase *seqbasep, struct SeqLoadInfo *seq_load);
/* view3d draw callback, run when not in background view */
-typedef struct ImBuf *(*SequencerDrawView)(struct Scene *, int, int, int);
+typedef struct ImBuf *(*SequencerDrawView)(struct Scene *, int, int, unsigned int, int);
extern SequencerDrawView sequencer_view3d_cb;
/* copy/paste */
diff --git a/source/blender/blenkernel/BKE_texture.h b/source/blender/blenkernel/BKE_texture.h
index 380672dae04..99bb8db44ed 100644
--- a/source/blender/blenkernel/BKE_texture.h
+++ b/source/blender/blenkernel/BKE_texture.h
@@ -70,6 +70,7 @@ struct Tex *add_texture(const char *name);
void tex_set_type(struct Tex *tex, int type);
void default_mtex(struct MTex *mtex);
struct MTex *add_mtex(void);
+struct MTex *add_mtex_id(struct ID *id, int slot);
struct Tex *copy_texture(struct Tex *tex);
void make_local_texture(struct Tex *tex);
void autotexname(struct Tex *tex);
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index 5d8a57f46f5..167ceab23eb 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -1284,6 +1284,12 @@ static void new_particle_duplilist(ListBase *lb, ID *id, Scene *scene, Object *p
size = psys_get_child_size(psys, cpa, ctime, 0);
}
+ /* some hair paths might be non-existent so they can't be used for duplication */
+ if(hair &&
+ ((a < totpart && psys->pathcache[a]->steps < 0) ||
+ (a >= totpart && psys->childcache[a-totpart]->steps < 0)))
+ continue;
+
if(part->ren_as==PART_DRAW_GR) {
/* for groups, pick the object based on settings */
if(part->draw&PART_DRAW_RAND_GR)
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index 95e9d419f44..0f2218b8766 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -231,7 +231,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, char *filename)
curscene= bfd->curscene;
if(curscene==NULL) curscene= bfd->main->scene.first;
/* and we enforce curscene to be in current screen */
- curscreen->scene= curscene;
+ if(curscreen) curscreen->scene= curscene; /* can run in bgmode */
/* clear_global will free G.main, here we can still restore pointers */
lib_link_screen_restore(bfd->main, curscreen, curscene);
@@ -460,13 +460,16 @@ static UndoElem *curundo= NULL;
static int read_undosave(bContext *C, UndoElem *uel)
{
- char scestr[FILE_MAXDIR+FILE_MAXFILE];
+ char scestr[FILE_MAXDIR+FILE_MAXFILE]; /* we should eventually just use G.main->name */
+ char mainstr[FILE_MAXDIR+FILE_MAXFILE];
int success=0, fileflags;
/* This is needed so undoing/redoing doesnt crash with threaded previews going */
WM_jobs_stop_all(CTX_wm_manager(C));
strcpy(scestr, G.sce); /* temporal store */
+ strcpy(mainstr, G.main->name); /* temporal store */
+
fileflags= G.fileflags;
G.fileflags |= G_FILE_NO_UI;
@@ -476,7 +479,8 @@ static int read_undosave(bContext *C, UndoElem *uel)
success= BKE_read_file_from_memfile(C, &uel->memfile, NULL);
/* restore */
- strcpy(G.sce, scestr);
+ strcpy(G.sce, scestr); /* restore */
+ strcpy(G.main->name, mainstr); /* restore */
G.fileflags= fileflags;
if(success)
@@ -641,7 +645,11 @@ void BKE_undo_number(bContext *C, int nr)
/* go back to the last occurance of name in stack */
void BKE_undo_name(bContext *C, const char *name)
{
- UndoElem *uel= BLI_findstring(&undobase, name, offsetof(UndoElem, name));
+ UndoElem *uel;
+
+ for(uel= undobase.last; uel; uel= uel->prev)
+ if(strcmp(name, uel->name)==0)
+ break;
if(uel && uel->prev) {
curundo= uel->prev;
diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c
index 7ae65d0113a..54ffda6c0a9 100644
--- a/source/blender/blenkernel/intern/boids.c
+++ b/source/blender/blenkernel/intern/boids.c
@@ -910,6 +910,7 @@ void boid_brain(BoidBrainData *bbd, int p, ParticleData *pa)
if(bpa->data.health <= 0.0f) {
pa->alive = PARS_DYING;
+ pa->dietime = bbd->cfra;
return;
}
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index dbf32c4224f..fd8bd67e8f4 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -3989,17 +3989,6 @@ int remove_constraint (ListBase *list, bConstraint *con)
return 0;
}
-/* Remove the nth constraint from the given constraint stack */
-int remove_constraint_index (ListBase *list, int index)
-{
- bConstraint *con= BLI_findlink(list, index);
-
- if (con)
- return remove_constraint(list, con);
- else
- return 0;
-}
-
/* Remove all the constraints of the specified type from the given constraint stack */
void remove_constraints_type (ListBase *list, short type, short last_only)
{
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index 24dcb4c5846..7928424e47c 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -701,7 +701,7 @@ Main *CTX_data_main(const bContext *C)
{
Main *bmain;
- if(ctx_data_pointer_verify(C, "main", (void*)&bmain))
+ if(ctx_data_pointer_verify(C, "blend_data", (void*)&bmain))
return bmain;
else
return C->data.main;
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index d029573b2e9..b067001cb98 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -1443,7 +1443,7 @@ static CustomDataLayer *customData_add_layer__internal(CustomData *data,
data->layers[index].flag = flag;
data->layers[index].data = newlayerdata;
- if(name) {
+ if(name || (name=typeInfo->defaultname)) {
strcpy(data->layers[index].name, name);
CustomData_set_layer_unique_name(data, index);
}
@@ -1485,7 +1485,7 @@ void *CustomData_add_layer(CustomData *data, int type, int alloctype,
/*same as above but accepts a name*/
void *CustomData_add_layer_named(CustomData *data, int type, int alloctype,
- void *layerdata, int totelem, char *name)
+ void *layerdata, int totelem, const char *name)
{
CustomDataLayer *layer;
diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c
index f054f2e8738..1642fadf33d 100644
--- a/source/blender/blenkernel/intern/fmodifier.c
+++ b/source/blender/blenkernel/intern/fmodifier.c
@@ -1087,13 +1087,6 @@ int remove_fmodifier (ListBase *modifiers, FModifier *fcm)
}
}
-/* Remove and free the nth F-Modifier from the given stack */
-int remove_fmodifier_index (ListBase *modifiers, int index)
-{
- FModifier *fcm= BLI_findlink(modifiers, index);
- return remove_fmodifier(modifiers, fcm);
-}
-
/* Remove all of a given F-Curve's modifiers */
void free_fmodifiers (ListBase *modifiers)
{
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index 39b74be3d40..501de668000 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -266,12 +266,10 @@ void free_ttfont(void)
{
struct TmpFont *tf;
- tf= ttfdata.first;
- while(tf) {
- freePackedFile(tf->pf);
+ for(tf= ttfdata.first; tf; tf= tf->next) {
+ if(tf->pf) freePackedFile(tf->pf); /* NULL when the font file can't be found on disk */
tf->pf= NULL;
tf->vfont= NULL;
- tf= tf->next;
}
BLI_freelistN(&ttfdata);
}
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index d2612e90945..0e282aa6449 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -1979,8 +1979,14 @@ static ImBuf *image_get_ibuf_threadsafe(Image *ima, ImageUser *iuser, int *frame
ibuf= image_get_ibuf(ima, 0, frame);
/* XXX temp stuff? */
- if(ima->lastframe != frame)
+ if(ima->lastframe != frame) {
ima->tpageflag |= IMA_TPAGE_REFRESH;
+ if(ibuf) {
+ /* without this the image name only updates
+ * on first load which is quite confusing */
+ BLI_strncpy(ima->name, ibuf->name, sizeof(ima->name));
+ }
+ }
ima->lastframe = frame;
}
else if(ima->type==IMA_TYPE_MULTILAYER) {
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 26be4114db0..687b212ec2e 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -1185,8 +1185,15 @@ int new_id(ListBase *lb, ID *id, const char *tname)
* easier to assign each time then to check if its needed */
name[sizeof(name)-1]= 0;
- if(name[0] == '\0')
+ if(name[0] == '\0') {
+ /* disallow empty names */
strcpy(name, ID_FALLBACK_NAME);
+ }
+ else {
+ /* disallow non utf8 chars,
+ * the interface checks for this but new ID's based on file names dont */
+ BLI_utf8_invalid_strip(name, strlen(name));
+ }
result = check_for_dupid(lb, id, name);
strcpy(id->name+2, name);
@@ -1377,8 +1384,9 @@ void text_idbutton(struct ID *id, char *text)
text[4]= 0;
}
}
- else
- strcpy(text, "");
+ else {
+ text[0]= '\0';
+}
}
void rename_id(ID *id, char *name)
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 9774e97f69b..7e52f746ebc 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -434,6 +434,90 @@ short *give_totcolp(Object *ob)
return NULL;
}
+/* same as above but for ID's */
+Material ***give_matarar_id(ID *id)
+{
+ switch(GS(id->name)) {
+ case ID_ME:
+ return &(((Mesh *)id)->mat);
+ break;
+ case ID_CU:
+ return &(((Curve *)id)->mat);
+ break;
+ case ID_MB:
+ return &(((Curve *)id)->mat);
+ break;
+ }
+ return NULL;
+}
+
+short *give_totcolp_id(ID *id)
+{
+ switch(GS(id->name)) {
+ case ID_ME:
+ return &(((Mesh *)id)->totcol);
+ break;
+ case ID_CU:
+ return &(((Curve *)id)->totcol);
+ break;
+ case ID_MB:
+ return &(((Curve *)id)->totcol);
+ break;
+ }
+ return NULL;
+}
+
+void material_append_id(ID *id, Material *ma)
+{
+ Material ***matar;
+ if((matar= give_matarar_id(id))) {
+ short *totcol= give_totcolp_id(id);
+ Material **mat= MEM_callocN(sizeof(void *) * ((*totcol) + 1), "newmatar");
+ if(*totcol) memcpy(mat, *matar, sizeof(void *) * (*totcol));
+ if(*matar) MEM_freeN(*matar);
+
+ *matar= mat;
+ (*matar)[(*totcol)++]= ma;
+
+ id_us_plus((ID *)ma);
+ test_object_materials(id);
+ }
+}
+
+Material *material_pop_id(ID *id, int index)
+{
+ Material *ret= NULL;
+ Material ***matar;
+ if((matar= give_matarar_id(id))) {
+ short *totcol= give_totcolp_id(id);
+ if(index >= 0 && index < (*totcol)) {
+ ret= (*matar)[index];
+ if(*totcol <= 1) {
+ *totcol= 0;
+ MEM_freeN(*matar);
+ *matar= NULL;
+ }
+ else {
+ Material **mat;
+
+ if(index + 1 != (*totcol))
+ memmove((*matar), (*matar) + 1, (*totcol) - (index + 1));
+
+ (*totcol)--;
+
+ mat= MEM_callocN(sizeof(void *) * (*totcol), "newmatar");
+ memcpy(mat, *matar, sizeof(void *) * (*totcol));
+ MEM_freeN(*matar);
+
+ *matar= mat;
+ test_object_materials(id);
+ }
+ }
+ }
+
+ return ret;
+}
+
Material *give_current_material(Object *ob, int act)
{
Material ***matarar, *ma;
@@ -453,7 +537,7 @@ Material *give_current_material(Object *ob, int act)
}
else { /* in data */
- /* check for inconsistancy */
+ /* check for inconsistency */
if(*totcolp < ob->totcol)
ob->totcol= *totcolp;
if(act>ob->totcol) act= ob->totcol;
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index e35d8bce886..e6f38e04d76 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -176,6 +176,55 @@ void make_local_mball(MetaBall *mb)
}
}
}
+
+/* most simple meta-element adding function
+ * dont do context menipulation here (rna uses) */
+MetaElem *add_metaball_element(MetaBall *mb, const int type)
+{
+ MetaElem *ml= MEM_callocN(sizeof(MetaElem), "metaelem");
+
+ unit_qt(ml->quat);
+
+ ml->rad= 2.0;
+ ml->s= 2.0;
+ ml->flag= MB_SCALE_RAD;
+
+ switch(type) {
+ case MB_BALL:
+ ml->type = MB_BALL;
+ ml->expx= ml->expy= ml->expz= 1.0;
+
+ break;
+ case MB_TUBE:
+ ml->type = MB_TUBE;
+ ml->expx= ml->expy= ml->expz= 1.0;
+
+ break;
+ case MB_PLANE:
+ ml->type = MB_PLANE;
+ ml->expx= ml->expy= ml->expz= 1.0;
+
+ break;
+ case MB_ELIPSOID:
+ ml->type = MB_ELIPSOID;
+ ml->expx= 1.2f;
+ ml->expy= 0.8f;
+ ml->expz= 1.0;
+
+ break;
+ case MB_CUBE:
+ ml->type = MB_CUBE;
+ ml->expx= ml->expy= ml->expz= 1.0;
+
+ break;
+ default:
+ break;
+ }
+
+ BLI_addtail(&mb->elems, ml);
+
+ return ml;
+}
/** Compute bounding box of all MetaElems/MetaBalls.
*
* Bounding box is computed from polygonized surface. Object *ob is
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 2649d95dd88..20c4a8030af 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -2564,7 +2564,7 @@ void object_handle_update(Scene *scene, Object *ob)
while(psys) {
if(psys_check_enabled(ob, psys)) {
/* check use of dupli objects here */
- if(psys->part && psys->part->draw_as == PART_DRAW_REND &&
+ if(psys->part && (psys->part->draw_as == PART_DRAW_REND || G.rendering) &&
((psys->part->ren_as == PART_DRAW_OB && psys->part->dup_ob)
|| (psys->part->ren_as == PART_DRAW_GR && psys->part->dup_group)))
ob->transflag |= OB_DUPLIPARTS;
diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c
index b01f570898e..919a724d1ec 100644
--- a/source/blender/blenkernel/intern/packedFile.c
+++ b/source/blender/blenkernel/intern/packedFile.c
@@ -220,7 +220,7 @@ void packAll(Main *bmain, ReportList *reports)
ima->packedfile = newPackedFile(reports, ima->name);
for(vf=bmain->vfont.first; vf; vf=vf->id.next)
- if(vf->packedfile == NULL && vf->id.lib==NULL)
+ if(vf->packedfile == NULL && vf->id.lib==NULL && strcmp(vf->name, "<builtin>") != 0)
vf->packedfile = newPackedFile(reports, vf->name);
for(sound=bmain->sound.first; sound; sound=sound->id.next)
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 993eefcb6f9..dbc598071f9 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -710,6 +710,10 @@ void psys_render_set(Object *ob, ParticleSystem *psys, float viewmat[][4], float
data->timeoffset= timeoffset;
psys->renderdata= data;
+
+ /* Hair can and has to be recalculated if everything isn't displayed. */
+ if(psys->part->disp != 100 && psys->part->type == PART_HAIR)
+ psys->recalc |= PSYS_RECALC_RESET;
}
void psys_render_restore(Object *ob, ParticleSystem *psys)
@@ -1118,6 +1122,24 @@ static int get_pointcache_times_for_particle(PointCache *cache, int index, float
return ret == 2;
}
+
+float psys_get_dietime_from_cache(PointCache *cache, int index) {
+ PTCacheMem *pm;
+ int dietime = 10000000; /* some max value so that we can default to pa->time+lifetime */
+
+ for(pm=cache->mem_cache.last; pm; pm=pm->prev) {
+ if(pm->index_array) {
+ if(pm->index_array[index])
+ return (float)pm->frame;
+ }
+ else {
+ return (float)pm->frame;
+ }
+ }
+
+ return (float)dietime;
+}
+
static void init_particle_interpolation(Object *ob, ParticleSystem *psys, ParticleData *pa, ParticleInterpolationData *pind)
{
@@ -2010,6 +2032,10 @@ void precalc_guides(ParticleSimulationData *sim, ListBase *effectors)
LOOP_PARTICLES {
psys_particle_on_emitter(sim->psmd,sim->psys->part->from,pa->num,pa->num_dmcache,pa->fuv,pa->foffset,state.co,0,0,0,0,0);
+
+ mul_m4_v3(sim->ob->obmat, state.co);
+ mul_mat3_m4_v3(sim->ob->obmat, state.vel);
+
pd_point_from_particle(sim, pa, &state, &point);
for(eff = effectors->first; eff; eff=eff->next) {
@@ -3165,7 +3191,7 @@ void psys_cache_edit_paths(Scene *scene, Object *ob, PTCacheEdit *edit, float cf
/* at the moment this is only used for weight painting.
* will need to move out of this check if its used elsewhere. */
- t2 = birthtime + ((float)(k+1)/(float)steps) * (dietime - birthtime);
+ t2 = birthtime + ((float)k/(float)steps) * (dietime - birthtime);
while (pind.hkey[1]->time < t2) pind.hkey[1]++;
pind.hkey[0] = pind.hkey[1] - 1;
@@ -4424,3 +4450,34 @@ void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3]
VECADDFAC(center, center, yvec, bb->offset[1]);
}
+
+void psys_apply_hair_lattice(Scene *scene, Object *ob, ParticleSystem *psys) {
+ ParticleSimulationData sim = {scene, ob, psys, psys_get_modifier(ob, psys)};
+
+ psys->lattice = psys_get_lattice(&sim);
+
+ if(psys->lattice) {
+ ParticleData *pa = psys->particles;
+ HairKey *hkey;
+ int p, h;
+ float hairmat[4][4], imat[4][4];
+
+ for(p=0; p<psys->totpart; p++, pa++) {
+ psys_mat_hair_to_global(sim.ob, sim.psmd->dm, psys->part->from, pa, hairmat);
+ invert_m4_m4(imat, hairmat);
+
+ hkey = pa->hair;
+ for(h=0; h<pa->totkey; h++, hkey++) {
+ mul_m4_v3(hairmat, hkey->co);
+ calc_latt_deform(psys->lattice, hkey->co, 1.0f);
+ mul_m4_v3(imat, hkey->co);
+ }
+ }
+
+ end_latt_deform(psys->lattice);
+ psys->lattice= NULL;
+
+ /* protect the applied shape */
+ psys->flag |= PSYS_EDITED;
+ }
+}
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index 2b43ce1ea36..955de554e00 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -106,20 +106,26 @@
/* Reacting to system events */
/************************************************/
-static int get_current_display_percentage(ParticleSystem *psys)
+static int particles_are_dynamic(ParticleSystem *psys) {
+ if(psys->pointcache->flag & PTCACHE_BAKED)
+ return 0;
+
+ if(psys->part->type == PART_HAIR)
+ return psys->flag & PSYS_HAIR_DYNAMICS;
+ else
+ return ELEM3(psys->part->phystype, PART_PHYS_NEWTON, PART_PHYS_BOIDS, PART_PHYS_FLUID);
+}
+int psys_get_current_display_percentage(ParticleSystem *psys)
{
ParticleSettings *part=psys->part;
- if(psys->renderdata || (part->child_nbr && part->childtype)
- || (psys->pointcache->flag & PTCACHE_BAKING))
+ if((psys->renderdata && !particles_are_dynamic(psys)) /* non-dynamic particles can be rendered fully */
+ || (part->child_nbr && part->childtype) /* display percentage applies to children */
+ || (psys->pointcache->flag & PTCACHE_BAKING)) /* baking is always done with full amount */
return 100;
- if(part->phystype==PART_PHYS_KEYED){
return psys->part->disp;
}
- else
- return psys->part->disp;
-}
void psys_reset(ParticleSystem *psys, int mode)
{
@@ -1568,8 +1574,6 @@ void initialize_particle(ParticleSimulationData *sim, ParticleData *pa, int p)
psys_get_texture(sim,ma,pa,&ptex,MAP_PA_INIT);
}
- pa->lifetime= part->lifetime*ptex.life;
-
if(part->type==PART_HAIR)
pa->time= 0.0f;
//else if(part->type==PART_REACTOR && (part->flag&PART_REACT_STA_END)==0)
@@ -1584,25 +1588,6 @@ void initialize_particle(ParticleSimulationData *sim, ParticleData *pa, int p)
pa->time= part->sta + (part->end - part->sta)*ptex.time;
}
-
- if(part->type==PART_HAIR){
- pa->lifetime=100.0f;
- }
- else{
-#if 0 // XXX old animation system
- icu=find_ipocurve(psys->part->ipo,PART_EMIT_LIFE);
- if(icu){
- calc_icu(icu,100*ptex.time);
- pa->lifetime*=icu->curval;
- }
-#endif // XXX old animation system
-
- if(part->randlife!=0.0)
- pa->lifetime*= 1.0f - part->randlife * BLI_frand();
- }
-
- pa->dietime= pa->time+pa->lifetime;
-
if(part->type!=PART_HAIR && part->distr!=PART_DISTR_GRID && part->from != PART_FROM_VERT){
if(ptex.exist < BLI_frand())
pa->flag |= PARS_UNEXIST;
@@ -1695,6 +1680,7 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime,
part=psys->part;
ptex.ivel=1.0;
+ ptex.life=1.0;
/* we need to get every random even if they're not used so that they don't effect eachother */
r_vel[0] = 2.0f * (PSYS_FRAND(p + 10) - 0.5f);
@@ -1752,7 +1738,7 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime,
psys_particle_on_emitter(sim->psmd, part->from,pa->num, pa->num_dmcache, pa->fuv,pa->foffset,loc,nor,0,0,0,0);
/* get possible textural influence */
- psys_get_texture(sim, give_current_material(sim->ob,part->omat), pa, &ptex, MAP_PA_IVEL);
+ psys_get_texture(sim, give_current_material(sim->ob,part->omat), pa, &ptex, MAP_PA_IVEL|MAP_PA_LIFE);
//if(vg_vel && pa->num != -1)
// ptex.ivel*=psys_particle_value_from_verts(sim->psmd->dm,part->from,pa,vg_vel);
@@ -1975,8 +1961,25 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime,
}
}
+
+ if(part->type == PART_HAIR){
+ pa->lifetime = 100.0f;
+ }
+ else{
+ pa->lifetime = part->lifetime*ptex.life;
+
+ if(part->randlife != 0.0)
+ pa->lifetime *= 1.0f - part->randlife * PSYS_FRAND(p + 21);
+ }
+
pa->dietime = pa->time + pa->lifetime;
+ if(sim->psys->pointcache && sim->psys->pointcache->flag & PTCACHE_BAKED &&
+ sim->psys->pointcache->mem_cache.first) {
+ float dietime = psys_get_dietime_from_cache(sim->psys->pointcache, p);
+ pa->dietime = MIN2(pa->dietime, dietime);
+ }
+
if(pa->time > cfra)
pa->alive = PARS_UNBORN;
else if(pa->dietime <= cfra)
@@ -3052,7 +3055,7 @@ static void deflect_particle(ParticleSimulationData *sim, int p, float dfra, flo
/* Stickness to surface */
normalize_v3(nor_vec);
- madd_v3_v3fl(pa->state.vel, nor_vec, -pd->pdef_stickness);
+ madd_v3_v3fl(pa->state.vel, col.nor, -pd->pdef_stickness);
}
col.t = dt;
@@ -3250,7 +3253,7 @@ static void hair_step(ParticleSimulationData *sim, float cfra)
ParticleSystem *psys = sim->psys;
/* ParticleSettings *part = psys->part; */
PARTICLE_P;
- float disp = (float)get_current_display_percentage(psys)/100.0f;
+ float disp = (float)psys_get_current_display_percentage(psys)/100.0f;
BLI_srandom(psys->seed);
@@ -3518,7 +3521,7 @@ static void cached_step(ParticleSimulationData *sim, float cfra)
psys_update_effectors(sim);
- disp= (float)get_current_display_percentage(psys)/100.0f;
+ disp= (float)psys_get_current_display_percentage(psys)/100.0f;
LOOP_PARTICLES {
pa->size = part->size;
@@ -3785,7 +3788,7 @@ static void system_step(ParticleSimulationData *sim, float cfra)
/* 3. do dynamics */
/* set particles to be not calculated TODO: can't work with pointcache */
- disp= (float)get_current_display_percentage(psys)/100.0f;
+ disp= (float)psys_get_current_display_percentage(psys)/100.0f;
BLI_srandom(psys->seed);
LOOP_PARTICLES {
@@ -4035,6 +4038,10 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
{
PARTICLE_P;
+ /* Particles without dynamics haven't been reset yet because they don't use pointcache */
+ if(psys->recalc & PSYS_RECALC_RESET)
+ psys_reset(psys, PSYS_RESET_ALL);
+
if(emit_particles(&sim, NULL, cfra)) {
free_keyed_keys(psys);
distribute_particles(&sim, part->from);
diff --git a/source/blender/blenkernel/intern/report.c b/source/blender/blenkernel/intern/report.c
index 173c6c136f2..3773757f5d5 100644
--- a/source/blender/blenkernel/intern/report.c
+++ b/source/blender/blenkernel/intern/report.c
@@ -273,4 +273,4 @@ Report *BKE_reports_last_displayable(ReportList *reports)
}
return NULL;
-} \ No newline at end of file
+}
diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c
index f5ca7ee3cef..9589b1e4f98 100644
--- a/source/blender/blenkernel/intern/sca.c
+++ b/source/blender/blenkernel/intern/sca.c
@@ -572,9 +572,22 @@ void set_sca_new_poins_ob(Object *ob)
bObjectActuator *oa= act->data;
ID_NEW(oa->reference);
}
- else if(act->type==ACT_SCENE) {
- bSceneActuator *sca= act->data;
- ID_NEW(sca->camera);
+ else if(act->type==ACT_MESSAGE) {
+ bMessageActuator *ma= act->data;
+ ID_NEW(ma->toObject);
+ }
+ else if(act->type==ACT_PARENT) {
+ bParentActuator *para = act->data;
+ ID_NEW(para->ob);
+ }
+ else if(act->type==ACT_ARMATURE) {
+ bArmatureActuator *aa = act->data;
+ ID_NEW(aa->target);
+ ID_NEW(aa->subtarget);
+ }
+ else if(act->type==ACT_PROPERTY) {
+ bPropertyActuator *pa= act->data;
+ ID_NEW(pa->ob);
}
}
act= act->next;
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index b20bb111cb4..b6bb5c3a51b 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -1852,7 +1852,7 @@ static ImBuf * seq_render_scene_strip_impl(
if(sequencer_view3d_cb && BLI_thread_is_main() && doseq_gl && (seq->scene == scene || have_seq==0) && seq->scene->camera) {
/* opengl offscreen render */
scene_update_for_newframe(bmain, seq->scene, seq->scene->lay);
- ibuf= sequencer_view3d_cb(seq->scene, seqrectx, seqrecty,
+ ibuf= sequencer_view3d_cb(seq->scene, seqrectx, seqrecty, IB_rect,
scene->r.seq_prev_type);
}
else {
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index dd0135cfefc..8f3b82643e0 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -383,7 +383,7 @@ void sound_move_scene_sound(struct Scene *scene, void* handle, int startframe, i
void sound_start_play_scene(struct Scene *scene)
{
scene->sound_scene_handle = AUD_play(scene->sound_scene, 1);
- AUD_setLoop(scene->sound_scene_handle, -1, 0);
+ AUD_setLoop(scene->sound_scene_handle, -1);
}
void sound_play_scene(struct Scene *scene)
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 9075c64d286..77416f4dd12 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -689,6 +689,49 @@ MTex *add_mtex()
return mtex;
}
+/* slot -1 for first free ID */
+MTex *add_mtex_id(ID *id, int slot)
+{
+ MTex **mtex_ar;
+ short act;
+
+ give_active_mtex(id, &mtex_ar, &act);
+
+ if(mtex_ar==NULL) {
+ return NULL;
+ }
+
+ if(slot==-1) {
+ /* find first free */
+ int i;
+ for (i= 0; i < MAX_MTEX; i++) {
+ if (!mtex_ar[i]) {
+ slot= i;
+ break;
+ }
+ }
+ if(slot == -1) {
+ return NULL;
+ }
+ }
+ else {
+ /* make sure slot is valid */
+ if(slot < 0 || slot >= MAX_MTEX) {
+ return NULL;
+ }
+ }
+
+ if (mtex_ar[slot]) {
+ id_us_min((ID *)mtex_ar[slot]->tex);
+ MEM_freeN(mtex_ar[slot]);
+ mtex_ar[slot]= NULL;
+ }
+
+ mtex_ar[slot]= add_mtex();
+
+ return mtex_ar[slot];
+}
+
/* ------------------------------------------------------------------------- */
Tex *copy_texture(Tex *tex)
diff --git a/source/blender/blenlib/BLI_math_color.h b/source/blender/blenlib/BLI_math_color.h
index 72724c1c0f7..d3f1a842e45 100644
--- a/source/blender/blenlib/BLI_math_color.h
+++ b/source/blender/blenlib/BLI_math_color.h
@@ -76,6 +76,12 @@ float linearrgb_to_srgb(float c);
void srgb_to_linearrgb_v3_v3(float *col_to, float *col_from);
void linearrgb_to_srgb_v3_v3(float *col_to, float *col_from);
+/* rgba buffer convenience functions */
+void srgb_to_linearrgb_rgba_buf(float *col, int tot);
+void linearrgb_to_srgb_rgba_buf(float *col, int tot);
+void srgb_to_linearrgb_rgba_rgba_buf(float *col_to, float *col_from, int tot);
+void linearrgb_to_srgb_rgba_rgba_buf(float *col_to, float *col_from, int tot);
+
/************************** Other *************************/
int constrain_rgb(float *r, float *g, float *b);
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h
index 2030ea63855..0749e657f08 100644
--- a/source/blender/blenlib/BLI_math_vector.h
+++ b/source/blender/blenlib/BLI_math_vector.h
@@ -153,9 +153,9 @@ void bisect_v3_v3v3v3(float r[3], float a[3], float b[3], float c[3]);
/*********************************** Other ***********************************/
-void print_v2(char *str, float a[2]);
-void print_v3(char *str, float a[3]);
-void print_v4(char *str, float a[4]);
+void print_v2(const char *str, const float a[2]);
+void print_v3(const char *str, const float a[3]);
+void print_v4(const char *str, const float a[4]);
MINLINE void normal_short_to_float_v3(float r[3], const short n[3]);
MINLINE void normal_float_to_short_v3(short r[3], const float n[3]);
diff --git a/source/blender/blenlib/BLI_rect.h b/source/blender/blenlib/BLI_rect.h
index 0b886c17309..13b12fc4e1e 100644
--- a/source/blender/blenlib/BLI_rect.h
+++ b/source/blender/blenlib/BLI_rect.h
@@ -60,7 +60,10 @@ int BLI_isect_rctf(struct rctf *src1, struct rctf *src2, struct rctf *dest);
int BLI_isect_rcti(struct rcti *src1, struct rcti *src2, struct rcti *dest);
void BLI_union_rctf(struct rctf *rcta, struct rctf *rctb);
void BLI_union_rcti(struct rcti *rcti1, struct rcti *rcti2);
+void BLI_copy_rcti_rctf(struct rcti *tar, const struct rctf *src);
+void print_rctf(const char *str, struct rctf *rect);
+void print_rcti(const char *str, struct rcti *rect);
#ifdef __cplusplus
}
diff --git a/source/blender/blenlib/BLI_sparsemap.h b/source/blender/blenlib/BLI_sparsemap.h
new file mode 100755
index 00000000000..0c892997dd4
--- /dev/null
+++ b/source/blender/blenlib/BLI_sparsemap.h
@@ -0,0 +1,73 @@
+#if 0
+/**
+ * $Id:
+ *
+ * ***** 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.
+ *
+ * The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
+ * All rights reserved.
+ *
+ * Contributor(s): Joseph Eagar (original author)
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include "BLI_math_inline.h"
+
+typedef struct SparseMap {
+ int max;
+ int blocksize;
+ void **blocks;
+ int totblock;
+} SparseMap;
+
+MALWAYS_INLINE SparseMap *BLI_sparsemap_new(int blocksize, char *name)
+{
+ SparseMap *sm = MEM_callocN(sizeof(SparseMap), name);
+
+ sm->blocksize = blocksize;
+ return sm;
+}
+
+MALWAYS_INLINE void BLI_sparsemap_free(SparseMap *sm)
+{
+ if (sm->blocks)
+ MEM_freeN(sm->blocks);
+
+ MEM_freeN(sm);
+}
+
+MALWAYS_INLINE void BLI_sparsemap_set(SparseMap *sm, int index, void *ptr)
+{
+ if (index >= sm->max || (sm->blocks && !sm->blocks[index/sm->blocksize])) {
+ int totblock = MAX2((index+1)/sm->blocksize, 2);
+ void *blocks = MEM_callocN(sizeof(void*)*totblock);
+
+ if (sm->blocks)
+ memcpy(blocks, sm->blocks, sizeof(void*)*sm->totblock);
+ sm->totblock = totblock;
+ MEM_freeN(sm->blocks);
+ sm->blocks = blocks;
+ }
+
+ if (!sm->blocks[index/sm->blocksize]) {
+ sm->blocks[index/sm->blocksize] = MEM_mallocN(sizeof(void*)*sm->blocksize);
+ }
+
+ sm->blocks[index/sm->blocksize] = ptr;
+}
+#endif
diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h
index 39123a438df..ccb10190816 100644
--- a/source/blender/blenlib/BLI_string.h
+++ b/source/blender/blenlib/BLI_string.h
@@ -132,6 +132,9 @@ size_t BLI_strnlen(const char *str, size_t maxlen);
void BLI_timestr(double _time, char *str); /* time var is global */
+int BLI_utf8_invalid_byte(const char *str, int length);
+int BLI_utf8_invalid_strip(char *str, int length);
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c
index 396f2c52058..693fd885b50 100644
--- a/source/blender/blenlib/intern/math_color.c
+++ b/source/blender/blenlib/intern/math_color.c
@@ -372,6 +372,40 @@ void linearrgb_to_srgb_v3_v3(float *col_to, float *col_from)
col_to[2] = linearrgb_to_srgb(col_from[2]);
}
+/* todo, should these be moved elsewhere?, they dont belong in imbuf */
+void srgb_to_linearrgb_rgba_buf(float *col, int tot)
+{
+ while(tot--) {
+ srgb_to_linearrgb_v3_v3(col, col);
+ col += 4;
+ }
+}
+
+void linearrgb_to_srgb_rgba_buf(float *col, int tot)
+{
+ while(tot--) {
+ linearrgb_to_srgb_v3_v3(col, col);
+ col += 4;
+ }
+}
+
+void srgb_to_linearrgb_rgba_rgba_buf(float *col_to, float *col_from, int tot)
+{
+ while(tot--) {
+ srgb_to_linearrgb_v3_v3(col_to, col_from);
+ col_to += 4;
+ col_from += 4;
+ }
+}
+
+void linearrgb_to_srgb_rgba_rgba_buf(float *col_to, float *col_from, int tot)
+{
+ while(tot--) {
+ linearrgb_to_srgb_v3_v3(col_to, col_from);
+ col_to += 4;
+ col_from += 4;
+ }
+}
void minmax_rgb(short c[])
{
diff --git a/source/blender/blenlib/intern/math_vector.c b/source/blender/blenlib/intern/math_vector.c
index b1cea9ab3c4..6d908ddb1cd 100644
--- a/source/blender/blenlib/intern/math_vector.c
+++ b/source/blender/blenlib/intern/math_vector.c
@@ -298,17 +298,17 @@ void ortho_basis_v3v3_v3(float *v1, float *v2, float *v)
/*********************************** Other ***********************************/
-void print_v2(char *str, float v[2])
+void print_v2(const char *str, const float v[2])
{
printf("%s: %.3f %.3f\n", str, v[0], v[1]);
}
-void print_v3(char *str, float v[3])
+void print_v3(const char *str, const float v[3])
{
printf("%s: %.3f %.3f %.3f\n", str, v[0], v[1], v[2]);
}
-void print_v4(char *str, float v[4])
+void print_v4(const char *str, const float v[4])
{
printf("%s: %.3f %.3f %.3f %.3f\n", str, v[0], v[1], v[2], v[3]);
}
diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c
index 5466acdba9f..aa424c1c2bb 100644
--- a/source/blender/blenlib/intern/rct.c
+++ b/source/blender/blenlib/intern/rct.c
@@ -36,6 +36,8 @@
*/
#include "DNA_vec_types.h"
+#include <stdio.h>
+#include <math.h>
int BLI_rcti_is_empty(rcti * rect)
{
@@ -222,3 +224,21 @@ int BLI_isect_rcti(rcti *src1, rcti *src2, rcti *dest)
return 0;
}
}
+
+void BLI_copy_rcti_rctf(rcti *tar, const rctf *src)
+{
+ tar->xmin= floor(src->xmin + 0.5);
+ tar->xmax= floor((src->xmax - src->xmin) + 0.5);
+ tar->ymin= floor(src->ymin + 0.5);
+ tar->ymax= floor((src->ymax - src->ymin) + 0.5);
+}
+
+void print_rctf(const char *str, rctf *rect)
+{
+ printf("%s: xmin %.3f, xmax %.3f, ymin %.3f, ymax %.3f\n", str, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
+}
+
+void print_rcti(const char *str, rcti *rect)
+{
+ printf("%s: xmin %d, xmax %d, ymin %d, ymax %d\n", str, rect->xmin, rect->xmax, rect->ymin, rect->ymax);
+}
diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c
index c344d8c0711..76193ba9a13 100644
--- a/source/blender/blenlib/intern/string.c
+++ b/source/blender/blenlib/intern/string.c
@@ -348,3 +348,114 @@ size_t BLI_strnlen(const char *str, size_t maxlen)
const char *end = memchr(str, '\0', maxlen);
return end ? (size_t) (end - str) : maxlen;
}
+
+/* from libswish3, originally called u8_isvalid(),
+ * modified to return the index of the bad character (byte index not utf).
+ * http://svn.swish-e.org/libswish3/trunk/src/libswish3/utf8.c r3044 - campbell */
+
+/* based on the valid_utf8 routine from the PCRE library by Philip Hazel
+
+ length is in bytes, since without knowing whether the string is valid
+ it's hard to know how many characters there are! */
+
+static const char trailingBytesForUTF8[256] = {
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
+ 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,4,4,4,4,5,5,5,5
+};
+
+int BLI_utf8_invalid_byte(const char *str, int length)
+{
+ const unsigned char *p, *pend = (unsigned char*)str + length;
+ unsigned char c;
+ int ab;
+
+ for (p = (unsigned char*)str; p < pend; p++) {
+ c = *p;
+ if (c < 128)
+ continue;
+ if ((c & 0xc0) != 0xc0)
+ goto utf8_error;
+ ab = trailingBytesForUTF8[c];
+ if (length < ab)
+ goto utf8_error;
+ length -= ab;
+
+ p++;
+ /* Check top bits in the second byte */
+ if ((*p & 0xc0) != 0x80)
+ goto utf8_error;
+
+ /* Check for overlong sequences for each different length */
+ switch (ab) {
+ /* Check for xx00 000x */
+ case 1:
+ if ((c & 0x3e) == 0) goto utf8_error;
+ continue; /* We know there aren't any more bytes to check */
+
+ /* Check for 1110 0000, xx0x xxxx */
+ case 2:
+ if (c == 0xe0 && (*p & 0x20) == 0) goto utf8_error;
+ break;
+
+ /* Check for 1111 0000, xx00 xxxx */
+ case 3:
+ if (c == 0xf0 && (*p & 0x30) == 0) goto utf8_error;
+ break;
+
+ /* Check for 1111 1000, xx00 0xxx */
+ case 4:
+ if (c == 0xf8 && (*p & 0x38) == 0) goto utf8_error;
+ break;
+
+ /* Check for leading 0xfe or 0xff,
+ and then for 1111 1100, xx00 00xx */
+ case 5:
+ if (c == 0xfe || c == 0xff ||
+ (c == 0xfc && (*p & 0x3c) == 0)) goto utf8_error;
+ break;
+ }
+
+ /* Check for valid bytes after the 2nd, if any; all must start 10 */
+ while (--ab > 0) {
+ if ((*(p+1) & 0xc0) != 0x80) goto utf8_error;
+ p++; /* do this after so we get usable offset - campbell */
+ }
+ }
+
+ return -1;
+
+utf8_error:
+
+ return (int)((char *)p - (char *)str) - 1;
+}
+
+int BLI_utf8_invalid_strip(char *str, int length)
+{
+ int bad_char, tot= 0;
+
+ while((bad_char= BLI_utf8_invalid_byte(str, length)) != -1) {
+ str += bad_char;
+ length -= bad_char;
+
+ if(length == 0) {
+ /* last character bad, strip it */
+ *str= '\0';
+ tot++;
+ break;
+ }
+ else {
+ /* strip, keep looking */
+ memmove(str, str + 1, length);
+ tot++;
+ }
+ }
+
+ return tot;
+}
+
diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h
index eeced13b57b..719a3c065ae 100644
--- a/source/blender/blenloader/BLO_readfile.h
+++ b/source/blender/blenloader/BLO_readfile.h
@@ -123,6 +123,19 @@ BLO_blendhandle_from_file(
char *file);
/**
+ * Open a blendhandle from memory.
+ *
+ * @param mem The data to load from.
+ * @param memsize The size of the data.
+ * @return A handle on success, or NULL on failure.
+ */
+
+ BlendHandle*
+BLO_blendhandle_from_memory(
+ void *mem,
+ int memsize);
+
+/**
* Gets the names of all the datablocks in a file
* of a certain type (ie. All the scene names in
* a file).
diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c
index d66d802c8ee..da441214b37 100644
--- a/source/blender/blenloader/intern/readblenentry.c
+++ b/source/blender/blenloader/intern/readblenentry.c
@@ -76,6 +76,15 @@ BlendHandle *BLO_blendhandle_from_file(char *file)
return bh;
}
+BlendHandle *BLO_blendhandle_from_memory(void *mem, int memsize)
+{
+ BlendHandle *bh;
+
+ bh= (BlendHandle*)blo_openblendermemory(mem, memsize, NULL);
+
+ return bh;
+}
+
void BLO_blendhandle_print_sizes(BlendHandle *bh, void *fp)
{
FileData *fd= (FileData*) bh;
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 44cc6b5c1d9..cb051433087 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5258,7 +5258,9 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
direct_link_gpencil(fd, v3d->gpd);
}
v3d->localvd= newdataadr(fd, v3d->localvd);
- v3d->afterdraw.first= v3d->afterdraw.last= NULL;
+ v3d->afterdraw_transp.first= v3d->afterdraw_transp.last= NULL;
+ v3d->afterdraw_xray.first= v3d->afterdraw_xray.last= NULL;
+ v3d->afterdraw_xraytransp.first= v3d->afterdraw_xraytransp.last= NULL;
v3d->properties_storage= NULL;
view3d_split_250(v3d, &sl->regionbase);
diff --git a/source/blender/collada/CMakeLists.txt b/source/blender/collada/CMakeLists.txt
index 420650a6ff7..a72ecc4be6c 100644
--- a/source/blender/collada/CMakeLists.txt
+++ b/source/blender/collada/CMakeLists.txt
@@ -61,4 +61,8 @@ SET(INC
ENDIF(APPLE)
+IF(WITH_BUILDINFO)
+ ADD_DEFINITIONS(-DNAN_BUILDINFO)
+ENDIF(WITH_BUILDINFO)
+
BLENDERLIB(bf_collada "${SRC}" "${INC}")
diff --git a/source/blender/collada/DocumentExporter.cpp b/source/blender/collada/DocumentExporter.cpp
index ca3aada80c0..5c059a4e9c9 100644
--- a/source/blender/collada/DocumentExporter.cpp
+++ b/source/blender/collada/DocumentExporter.cpp
@@ -48,10 +48,14 @@ extern "C"
#include "BLI_path_util.h"
#include "BLI_fileops.h"
#include "ED_keyframing.h"
+#ifdef NAN_BUILDINFO
+extern char build_rev[];
+#endif
}
#include "MEM_guardedalloc.h"
+#include "BKE_blender.h" // version info
#include "BKE_scene.h"
#include "BKE_global.h"
#include "BKE_main.h"
@@ -1719,11 +1723,7 @@ public:
// most widespread de-facto standard.
texture.setProfileName("FCOLLADA");
texture.setChildElementName("bump");
-#ifdef WIN32 // currently, Windows builds are using revision 746 of OpenCollada while Linux and Mac are using an older revision 721
ep.addExtraTechniqueColorOrTexture(COLLADASW::ColorOrTexture(texture));
-#else
- ep.setExtraTechniqueColorOrTexture(COLLADASW::ColorOrTexture(texture));
-#endif
}
}
// performs the actual writing
@@ -2536,6 +2536,15 @@ void DocumentExporter::exportCurrentScene(Scene *sce, const char* filename)
// XXX ask blender devs about this?
asset.setUnit("decimetre", 0.1);
asset.setUpAxisType(COLLADASW::Asset::Z_UP);
+ // TODO: need an Author field in userpref
+ asset.getContributor().mAuthor = "Blender User";
+#ifdef NAN_BUILDINFO
+ char version_buf[128];
+ sprintf(version_buf, "Blender %d.%02d.%d r%s", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION, build_rev);
+ asset.getContributor().mAuthoringTool = version_buf;
+#else
+ asset.getContributor().mAuthoringTool = "Blender 2.5x";
+#endif
asset.add();
// <library_cameras>
@@ -2596,4 +2605,3 @@ NOTES:
* AnimationExporter::sample_animation enables all curves on armature, this is undesirable for a user
*/
-
diff --git a/source/blender/collada/SConscript b/source/blender/collada/SConscript
index 91c3a381272..a473d31e1de 100644
--- a/source/blender/collada/SConscript
+++ b/source/blender/collada/SConscript
@@ -28,6 +28,7 @@
Import ('env')
sources = env.Glob('*.cpp')
+defs = []
# relative paths to include dirs, space-separated, string
if env['OURPLATFORM']=='darwin':
@@ -35,5 +36,7 @@ if env['OURPLATFORM']=='darwin':
else:
incs = '../blenlib ../blenkernel ../windowmanager ../makesdna ../makesrna ../editors/include ../../../intern/guardedalloc [OPENCOLLADA]/COLLADAStreamWriter/include [OPENCOLLADA]/COLLADABaseUtils/include [OPENCOLLADA]/COLLADAFramework/include [OPENCOLLADA]/COLLADASaxFrameworkLoader/include '.replace('[OPENCOLLADA]', env['BF_OPENCOLLADA_INC'])
-env.BlenderLib ('bf_collada', sources, Split(incs), [], libtype='core', priority=200 )
+if env['BF_BUILDINFO']:
+ defs.append('NAN_BUILDINFO')
+env.BlenderLib ('bf_collada', sources, Split(incs), defs, libtype='core', priority=200 )
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index f5f50e10bcb..b564780f6c0 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -25,6 +25,7 @@
*
* ***** END GPL LICENSE BLOCK *****
*/
+#include "BLO_sys_types.h"
#include "DNA_anim_types.h"
#include "DNA_object_types.h"
diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c
index 9570fd64433..9b9c9435518 100644
--- a/source/blender/editors/animation/anim_ops.c
+++ b/source/blender/editors/animation/anim_ops.c
@@ -29,6 +29,8 @@
#include <stdlib.h>
#include <math.h>
+#include "BLO_sys_types.h"
+
#include "DNA_anim_types.h"
#include "DNA_scene_types.h"
diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c
index 191316711f4..35e6cb66d45 100644
--- a/source/blender/editors/animation/fmodifier_ui.c
+++ b/source/blender/editors/animation/fmodifier_ui.c
@@ -583,7 +583,7 @@ static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, sho
uiItemR(col, &ptr, "use_frame_end", 0, NULL, 0);
subcol = uiLayoutColumn(col, 1);
- uiLayoutSetActive(subcol, RNA_boolean_get(&ptr, "use_end_frame"));
+ uiLayoutSetActive(subcol, RNA_boolean_get(&ptr, "use_frame_end"));
uiItemR(subcol, &ptr, "frame_end", 0, NULL, 0);
}
diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c
index d5bd09cc8f1..908aa5bb432 100644
--- a/source/blender/editors/armature/armature_ops.c
+++ b/source/blender/editors/armature/armature_ops.c
@@ -29,7 +29,7 @@
#include <stdlib.h>
#include <math.h>
-
+#include "BLO_sys_types.h"
#include "BLI_math.h"
#include "BLI_blenlib.h"
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index c0f84064aba..1c25b12c917 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -5460,6 +5460,8 @@ void ED_armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep)
/* do entire dbase - objects */
for (ob= G.main->object.first; ob; ob= ob->id.next) {
+ ModifierData *md;
+
/* we have the object using the armature */
if (arm==ob->data) {
Object *cob;
@@ -5509,6 +5511,19 @@ void ED_armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep)
}
}
+ /* fix modifiers that might be using this name */
+ for (md= ob->modifiers.first; md; md= md->next) {
+ if (md->type == eModifierType_Hook) {
+ HookModifierData *hmd = (HookModifierData *)md;
+
+ /* uses armature, so may use the affected bone name */
+ if (hmd->object && (hmd->object->data == arm)) {
+ if (!strcmp(hmd->subtarget, oldname))
+ BLI_strncpy(hmd->subtarget, newname, MAXBONENAME);
+ }
+ }
+ }
+
/* Fix animation data attached to this object */
// TODO: should we be using the database wide version instead (since drivers may break)
if (ob->adt) {
diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c
index b0b5aedaa70..6fe584c7f98 100644
--- a/source/blender/editors/armature/poselib.c
+++ b/source/blender/editors/armature/poselib.c
@@ -278,8 +278,16 @@ static void poselib_add_menu_invoke__replacemenu (bContext *C, uiLayout *layout,
uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT);
/* add each marker to this menu */
- for (marker= act->markers.first; marker; marker= marker->next)
- uiItemIntO(layout, marker->name, ICON_ARMATURE_DATA, "POSELIB_OT_pose_add", "frame", marker->frame);
+ for (marker= act->markers.first; marker; marker= marker->next) {
+ PointerRNA props_ptr;
+
+ props_ptr = uiItemFullO(layout, "POSELIB_OT_pose_add",
+ marker->name, ICON_ARMATURE_DATA, NULL,
+ WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
+
+ RNA_int_set(&props_ptr, "frame", marker->frame);
+ RNA_string_set(&props_ptr, "name", marker->name);
+}
}
static int poselib_add_menu_invoke (bContext *C, wmOperator *op, wmEvent *evt)
diff --git a/source/blender/editors/curve/curve_intern.h b/source/blender/editors/curve/curve_intern.h
index 10c1bd84262..2567494ddf3 100644
--- a/source/blender/editors/curve/curve_intern.h
+++ b/source/blender/editors/curve/curve_intern.h
@@ -97,9 +97,9 @@ void CURVE_OT_primitive_nurbs_path_add(struct wmOperatorType *ot);
void SURFACE_OT_primitive_nurbs_surface_curve_add(struct wmOperatorType *ot);
void SURFACE_OT_primitive_nurbs_surface_circle_add(struct wmOperatorType *ot);
void SURFACE_OT_primitive_nurbs_surface_surface_add(struct wmOperatorType *ot);
-void SURFACE_OT_primitive_nurbs_surface_tube_add(struct wmOperatorType *ot);
+void SURFACE_OT_primitive_nurbs_surface_cylinder_add(struct wmOperatorType *ot);
void SURFACE_OT_primitive_nurbs_surface_sphere_add(struct wmOperatorType *ot);
-void SURFACE_OT_primitive_nurbs_surface_donut_add(struct wmOperatorType *ot);
+void SURFACE_OT_primitive_nurbs_surface_torus_add(struct wmOperatorType *ot);
void CURVE_OT_de_select_first(struct wmOperatorType *ot);
void CURVE_OT_de_select_last(struct wmOperatorType *ot);
diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c
index b5b6ee4e6da..89c19d93b0f 100644
--- a/source/blender/editors/curve/curve_ops.c
+++ b/source/blender/editors/curve/curve_ops.c
@@ -105,9 +105,9 @@ void ED_operatortypes_curve(void)
WM_operatortype_append(SURFACE_OT_primitive_nurbs_surface_curve_add);
WM_operatortype_append(SURFACE_OT_primitive_nurbs_surface_circle_add);
WM_operatortype_append(SURFACE_OT_primitive_nurbs_surface_surface_add);
- WM_operatortype_append(SURFACE_OT_primitive_nurbs_surface_tube_add);
+ WM_operatortype_append(SURFACE_OT_primitive_nurbs_surface_cylinder_add);
WM_operatortype_append(SURFACE_OT_primitive_nurbs_surface_sphere_add);
- WM_operatortype_append(SURFACE_OT_primitive_nurbs_surface_donut_add);
+ WM_operatortype_append(SURFACE_OT_primitive_nurbs_surface_torus_add);
WM_operatortype_append(CURVE_OT_smooth);
WM_operatortype_append(CURVE_OT_smooth_radius);
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 8af659c62e3..4564b90880f 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -1804,7 +1804,7 @@ void CURVE_OT_switch_direction(wmOperatorType *ot)
/****************** set weight operator *******************/
-static int set_weight_exec(bContext *C, wmOperator *op)
+static int set_goal_weight_exec(bContext *C, wmOperator *op)
{
Object *obedit= CTX_data_edit_object(C);
ListBase *editnurb= curve_get_editcurve(obedit);
@@ -1842,7 +1842,7 @@ void CURVE_OT_spline_weight_set(wmOperatorType *ot)
ot->idname= "CURVE_OT_spline_weight_set";
/* api callbacks */
- ot->exec= set_weight_exec;
+ ot->exec= set_goal_weight_exec;
ot->invoke= WM_operator_props_popup;
ot->poll= ED_operator_editsurfcurve;
@@ -4109,7 +4109,7 @@ void CURVE_OT_spin(wmOperatorType *ot)
/* flags */
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
- RNA_def_float_vector(ot->srna, "center", 3, NULL, -FLT_MAX, FLT_MAX, "Center", "Center in global view space", -FLT_MAX, FLT_MAX);
+ RNA_def_float_vector_xyz(ot->srna, "center", 3, NULL, -FLT_MAX, FLT_MAX, "Center", "Center in global view space", -FLT_MAX, FLT_MAX);
RNA_def_float_vector(ot->srna, "axis", 3, NULL, -1.0f, 1.0f, "Axis", "Axis in global view space", -FLT_MAX, FLT_MAX);
}
@@ -4278,7 +4278,7 @@ void CURVE_OT_vertex_add(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- RNA_def_float_vector(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "Location to add new vertex at.", -1e4, 1e4);
+ RNA_def_float_vector_xyz(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "Location to add new vertex at.", -1e4, 1e4);
}
/***************** extrude operator **********************/
@@ -5867,13 +5867,13 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname)
makeknots(nu, 2);
}
break;
- case CU_PRIM_TUBE: /* tube */
+ case CU_PRIM_TUBE: /* Cylinder */
if( cutype==CU_NURBS ) {
Curve *cu= (Curve*)obedit->data;
if(newname) {
- rename_id((ID *)obedit, "SurfTube");
- rename_id((ID *)obedit->data, "SurfTube");
+ rename_id((ID *)obedit, "SurfCylinder");
+ rename_id((ID *)obedit->data, "SurfCylinder");
}
nu= add_nurbs_primitive(C, mat, CU_NURBS|CU_PRIM_CIRCLE, 0); /* circle */
@@ -5949,7 +5949,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname)
BLI_remlink(editnurb, nu);
}
break;
- case CU_PRIM_DONUT: /* donut */
+ case CU_PRIM_DONUT: /* torus */
if( cutype==CU_NURBS ) {
float tmp_cent[3] = {0.f, 0.f, 0.f};
float tmp_vec[3] = {0.f, 0.f, 0.f};
@@ -6235,21 +6235,21 @@ void SURFACE_OT_primitive_nurbs_surface_surface_add(wmOperatorType *ot)
ED_object_add_generic_props(ot, TRUE);
}
-static int add_primitive_nurbs_surface_tube_exec(bContext *C, wmOperator *op)
+static int add_primitive_nurbs_surface_cylinder_exec(bContext *C, wmOperator *op)
{
return surf_prim_add(C, op, CU_PRIM_TUBE|CU_NURBS);
}
-void SURFACE_OT_primitive_nurbs_surface_tube_add(wmOperatorType *ot)
+void SURFACE_OT_primitive_nurbs_surface_cylinder_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Surface Tube";
- ot->description= "Construct a Nurbs surface Tube";
- ot->idname= "SURFACE_OT_primitive_nurbs_surface_tube_add";
+ ot->name= "Add Surface Cylinder";
+ ot->description= "Construct a Nurbs surface Cylinder";
+ ot->idname= "SURFACE_OT_primitive_nurbs_surface_cylinder_add";
/* api callbacks */
ot->invoke= ED_object_add_generic_invoke;
- ot->exec= add_primitive_nurbs_surface_tube_exec;
+ ot->exec= add_primitive_nurbs_surface_cylinder_exec;
ot->poll= ED_operator_scene_editable;
/* flags */
@@ -6281,21 +6281,21 @@ void SURFACE_OT_primitive_nurbs_surface_sphere_add(wmOperatorType *ot)
ED_object_add_generic_props(ot, TRUE);
}
-static int add_primitive_nurbs_surface_donut_exec(bContext *C, wmOperator *op)
+static int add_primitive_nurbs_surface_torus_exec(bContext *C, wmOperator *op)
{
return surf_prim_add(C, op, CU_PRIM_DONUT|CU_NURBS);
}
-void SURFACE_OT_primitive_nurbs_surface_donut_add(wmOperatorType *ot)
+void SURFACE_OT_primitive_nurbs_surface_torus_add(wmOperatorType *ot)
{
/* identifiers */
- ot->name= "Add Surface Donut";
- ot->description= "Construct a Nurbs surface Donut";
- ot->idname= "SURFACE_OT_primitive_nurbs_surface_donut_add";
+ ot->name= "Add Surface Torus";
+ ot->description= "Construct a Nurbs surface Torus";
+ ot->idname= "SURFACE_OT_primitive_nurbs_surface_torus_add";
/* api callbacks */
ot->invoke= ED_object_add_generic_invoke;
- ot->exec= add_primitive_nurbs_surface_donut_exec;
+ ot->exec= add_primitive_nurbs_surface_torus_exec;
ot->poll= ED_operator_scene_editable;
/* flags */
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 284dac7a0ae..4b8c58a5308 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -32,6 +32,7 @@
#include <math.h>
#include <float.h>
+#include "BLO_sys_types.h"
#include "IMB_imbuf_types.h"
@@ -42,6 +43,7 @@
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
+#include "DNA_view3d_types.h"
#include "BKE_context.h"
#include "BKE_global.h"
@@ -56,6 +58,7 @@
#include "ED_gpencil.h"
#include "ED_sequencer.h"
+#include "ED_view3d.h"
#include "gpencil_intern.h"
@@ -164,8 +167,8 @@ static void gp_draw_stroke_point (bGPDspoint *points, short thickness, short sfl
co[1]= (points->y * winy) + offsy;
}
else {
- co[0]= (points->x / 100 * winx);
- co[1]= (points->y / 100 * winy);
+ co[0]= (points->x / 100 * winx) + offsx;
+ co[1]= (points->y / 100 * winy) + offsy;
}
/* if thickness is less than GP_DRAWTHICKNESS_SPECIAL, simple dot looks ok
@@ -265,8 +268,8 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness,
glVertex2f(x, y);
}
else {
- const float x= (pt->x / 100 * winx);
- const float y= (pt->y / 100 * winy);
+ const float x= (pt->x / 100 * winx) + offsx;
+ const float y= (pt->y / 100 * winy) + offsy;
glVertex2f(x, y);
}
@@ -305,10 +308,10 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness,
s1[1]= (pt2->y * winy) + offsy;
}
else {
- s0[0]= (pt1->x / 100 * winx);
- s0[1]= (pt1->y / 100 * winy);
- s1[0]= (pt2->x / 100 * winx);
- s1[1]= (pt2->y / 100 * winy);
+ s0[0]= (pt1->x / 100 * winx) + offsx;
+ s0[1]= (pt1->y / 100 * winy) + offsy;
+ s1[0]= (pt2->x / 100 * winx) + offsx;
+ s1[1]= (pt2->y / 100 * winy) + offsy;
}
/* calculate gradient and normal - 'angle'=(ny/nx) */
@@ -453,8 +456,8 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness,
glVertex2f(x, y);
}
else {
- const float x= (float)(pt->x / 100 * winx);
- const float y= (float)(pt->y / 100 * winy);
+ const float x= (float)(pt->x / 100 * winx) + offsx;
+ const float y= (float)(pt->y / 100 * winy) + offsy;
glVertex2f(x, y);
}
@@ -732,25 +735,44 @@ void draw_gpencil_view2d (bContext *C, short onlyv2d)
/* draw grease-pencil sketches to specified 3d-view assuming that matrices are already set correctly
* Note: this gets called twice - first time with only3d=1 to draw 3d-strokes, second time with only3d=0 for screen-aligned strokes
*/
-void draw_gpencil_view3d_ext (Scene *scene, ARegion *ar, short only3d)
+
+void draw_gpencil_view3d_ext (Scene *scene, View3D *v3d, ARegion *ar, short only3d)
{
bGPdata *gpd;
int dflag = 0;
+ rcti rect;
+ RegionView3D *rv3d= ar->regiondata;
/* check that we have grease-pencil stuff to draw */
gpd= gpencil_data_get_active_v3d(scene); // XXX
if(gpd == NULL) return;
+ /* when rendering to the offscreen buffer we dont want to
+ * deal with the camera border, otherwise map the coords to the camera border. */
+ if(rv3d->persp == RV3D_CAMOB && !(G.f & G_RENDER_OGL)) {
+ rctf rectf;
+ view3d_calc_camera_border(scene, ar, rv3d, v3d, &rectf);
+ BLI_copy_rcti_rctf(&rect, &rectf);
+ }
+ else {
+ rect.xmin= 0;
+ rect.ymin= 0;
+ rect.xmax= ar->winx;
+ rect.ymax= ar->winy;
+ }
+
/* draw it! */
if (only3d) dflag |= (GP_DRAWDATA_ONLY3D|GP_DRAWDATA_NOSTATUS);
- gp_draw_data(gpd, 0, 0, ar->winx, ar->winy, CFRA, dflag);
+
+ gp_draw_data(gpd, rect.xmin, rect.ymin, rect.xmax, rect.ymax, CFRA, dflag);
}
void draw_gpencil_view3d (bContext *C, short only3d)
{
ARegion *ar= CTX_wm_region(C);
+ View3D *v3d= CTX_wm_view3d(C);
Scene *scene= CTX_data_scene(C);
- draw_gpencil_view3d_ext(scene, ar, only3d);
+ draw_gpencil_view3d_ext(scene, v3d, ar, only3d);
}
/* ************************************************** */
diff --git a/source/blender/editors/gpencil/gpencil_ops.c b/source/blender/editors/gpencil/gpencil_ops.c
index d9bd43cc851..b6b2675e6c8 100644
--- a/source/blender/editors/gpencil/gpencil_ops.c
+++ b/source/blender/editors/gpencil/gpencil_ops.c
@@ -29,8 +29,9 @@
#include <stddef.h>
#include <stdio.h>
-#include "BLI_blenlib.h"
+#include "BLO_sys_types.h"
+#include "BLI_blenlib.h"
#include "WM_api.h"
#include "WM_types.h"
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index cfa7af99d2a..f218ccd89f1 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -68,6 +68,9 @@ typedef struct tGPsdata {
ScrArea *sa; /* area where painting originated */
ARegion *ar; /* region where painting originated */
View2D *v2d; /* needed for GP_STROKE_2DSPACE */
+ rctf *subrect; /* for using the camera rect within the 3d view */
+ rctf subrect_data;
+
#if 0 // XXX review this 2d image stuff...
ImBuf *ibuf; /* needed for GP_STROKE_2DIMAGE */
@@ -271,9 +274,15 @@ static void gp_stroke_convertcoords (tGPsdata *p, short mval[], float out[], flo
/* 2d - relative to screen (viewport area) */
else {
+ if(p->subrect == NULL) { /* normal 3D view */
out[0] = (float)(mval[0]) / (float)(p->ar->winx) * 100;
out[1] = (float)(mval[1]) / (float)(p->ar->winy) * 100;
}
+ else { /* camera view, use subrect */
+ out[0]= ((mval[0] - p->subrect->xmin) / ((p->subrect->xmax - p->subrect->xmin))) * 100;
+ out[1]= ((mval[1] - p->subrect->ymin) / ((p->subrect->ymax - p->subrect->ymin))) * 100;
+}
+ }
}
/* add current stroke-point to buffer (returns whether point was successfully added) */
@@ -704,9 +713,15 @@ static void gp_stroke_eraser_dostroke (tGPsdata *p, int mval[], int mvalo[], sho
}
#endif
else {
+ if(p->subrect == NULL) { /* normal 3D view */
x0= (int)(gps->points->x / 100 * p->ar->winx);
y0= (int)(gps->points->y / 100 * p->ar->winy);
}
+ else { /* camera view, use subrect */
+ x0= (int)((gps->points->x / 100) * (p->subrect->xmax - p->subrect->xmin)) + p->subrect->xmin;
+ y0= (int)((gps->points->y / 100) * (p->subrect->ymax - p->subrect->ymin)) + p->subrect->ymin;
+ }
+ }
/* do boundbox check first */
if (BLI_in_rcti(rect, x0, y0)) {
@@ -761,11 +776,19 @@ static void gp_stroke_eraser_dostroke (tGPsdata *p, int mval[], int mvalo[], sho
}
#endif
else {
+ if(p->subrect == NULL) { /* normal 3D view */
x0= (int)(pt1->x / 100 * p->ar->winx);
y0= (int)(pt1->y / 100 * p->ar->winy);
x1= (int)(pt2->x / 100 * p->ar->winx);
y1= (int)(pt2->y / 100 * p->ar->winy);
}
+ else { /* camera view, use subrect */
+ x0= (int)((pt1->x / 100) * (p->subrect->xmax - p->subrect->xmin)) + p->subrect->xmin;
+ y0= (int)((pt1->y / 100) * (p->subrect->ymax - p->subrect->ymin)) + p->subrect->ymin;
+ x1= (int)((pt2->x / 100) * (p->subrect->xmax - p->subrect->xmin)) + p->subrect->xmin;
+ y1= (int)((pt2->y / 100) * (p->subrect->ymax - p->subrect->ymin)) + p->subrect->ymin;
+ }
+ }
/* check that point segment of the boundbox of the eraser stroke */
if (BLI_in_rcti(rect, x0, y0) || BLI_in_rcti(rect, x1, y1)) {
@@ -849,7 +872,8 @@ static tGPsdata *gp_session_initpaint (bContext *C)
/* supported views first */
case SPACE_VIEW3D:
{
- //View3D *v3d= curarea->spacedata.first;
+ View3D *v3d= curarea->spacedata.first;
+ RegionView3D *rv3d= ar->regiondata;
/* set current area
* - must verify that region data is 3D-view (and not something else)
@@ -864,6 +888,12 @@ static tGPsdata *gp_session_initpaint (bContext *C)
return p;
}
+ /* for camera view set the subrect */
+ if(rv3d->persp == RV3D_CAMOB) {
+ view3d_calc_camera_border(p->scene, p->ar, NULL, v3d, &p->subrect_data);
+ p->subrect= &p->subrect_data;
+ }
+
#if 0 // XXX will this sort of antiquated stuff be restored?
/* check that gpencil data is allowed to be drawn */
if ((v3d->flag2 & V3D_DISPGP)==0) {
diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h
index 0003cea8147..6c5a0cc3bf3 100644
--- a/source/blender/editors/include/ED_gpencil.h
+++ b/source/blender/editors/include/ED_gpencil.h
@@ -72,7 +72,7 @@ void ED_operatortypes_gpencil(void);
void draw_gpencil_2dimage(struct bContext *C, struct ImBuf *ibuf);
void draw_gpencil_view2d(struct bContext *C, short onlyv2d);
void draw_gpencil_view3d(struct bContext *C, short only3d);
-void draw_gpencil_view3d_ext(struct Scene *scene, struct ARegion *ar, short only3d);
+void draw_gpencil_view3d_ext(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, short only3d);
void gpencil_panel_standard(const struct bContext *C, struct Panel *pa);
diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h
index ff7ce874303..c898b8b99c3 100644
--- a/source/blender/editors/include/ED_mesh.h
+++ b/source/blender/editors/include/ED_mesh.h
@@ -194,85 +194,9 @@ void ED_keymap_mesh(struct wmKeyConfig *keyconf);
void ED_spacetypes_init(void);
void ED_keymap_mesh(struct wmKeyConfig *keyconf);
-
-struct EditMesh *make_editMesh(struct Scene *scene, struct Object *ob);
-void load_editMesh(struct Scene *scene, struct Object *ob, struct EditMesh *em);
-void remake_editMesh(struct Scene *scene, struct Object *ob);
-void free_editMesh(struct EditMesh *em);
-
-void recalc_editnormals(struct EditMesh *em);
-
-void EM_init_index_arrays(struct EditMesh *em, int forVert, int forEdge, int forFace);
-void EM_free_index_arrays(void);
-struct EditVert *EM_get_vert_for_index(int index);
-struct EditEdge *EM_get_edge_for_index(int index);
-struct EditFace *EM_get_face_for_index(int index);
-int EM_texFaceCheck(struct EditMesh *em);
-int EM_vertColorCheck(struct EditMesh *em);
-
-void undo_push_mesh(struct bContext *C, char *name);
-
-
-/* editmesh_lib.c */
-
-struct EditFace *EM_get_actFace(struct EditMesh *em, int sloppy);
-void EM_set_actFace(struct EditMesh *em, struct EditFace *efa);
-float EM_face_area(struct EditFace *efa);
-void EM_add_data_layer(struct EditMesh *em, struct CustomData *data, int type);
-
-void EM_select_edge(struct EditEdge *eed, int sel);
-void EM_select_face(struct EditFace *efa, int sel);
-void EM_select_face_fgon(struct EditMesh *em, struct EditFace *efa, int val);
-void EM_select_swap(struct EditMesh *em);
-void EM_toggle_select_all(struct EditMesh *em);
-void EM_select_all(struct EditMesh *em);
-void EM_deselect_all(struct EditMesh *em);
-void EM_selectmode_flush(struct EditMesh *em);
-void EM_deselect_flush(struct EditMesh *em);
-void EM_selectmode_set(struct EditMesh *em);
-void EM_select_flush(struct EditMesh *em);
-void EM_convertsel(struct EditMesh *em, short oldmode, short selectmode);
-void EM_validate_selections(struct EditMesh *em);
-void EM_selectmode_to_scene(struct Scene *scene, struct Object *obedit);
-
- /* exported to transform */
-int EM_get_actSelection(struct EditMesh *em, struct EditSelection *ese);
-void EM_editselection_normal(float *normal, struct EditSelection *ese);
-void EM_editselection_plane(float *plane, struct EditSelection *ese);
-void EM_editselection_center(float *center, struct EditSelection *ese);
-
-struct UvVertMap *EM_make_uv_vert_map(struct EditMesh *em, int selected, int do_face_idx_array, float *limit);
-struct UvMapVert *EM_get_uv_map_vert(struct UvVertMap *vmap, unsigned int v);
-void EM_free_uv_vert_map(struct UvVertMap *vmap);
-
-void EM_make_hq_normals(struct EditMesh *em);
-void EM_solidify(struct EditMesh *em, float dist);
-
-int EM_deselect_nth(struct EditMesh *em, int nth);
-
-/* editmesh_mods.c */
+/* bmesh_mods.c */
extern unsigned int bm_vertoffs, bm_solidoffs, bm_wireoffs;
-void EM_cache_x_mirror_vert(struct Object *ob, struct EditMesh *em);
-int mouse_mesh(struct bContext *C, short mval[2], short extend);
-int EM_check_backbuf(unsigned int index);
-int EM_mask_init_backbuf_border(struct ViewContext *vc, short mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax);
-void EM_free_backbuf(void);
-int EM_init_backbuf_border(struct ViewContext *vc, short xmin, short ymin, short xmax, short ymax);
-int EM_init_backbuf_circle(struct ViewContext *vc, short xs, short ys, short rads);
-
-void EM_hide_mesh(struct EditMesh *em, int swap);
-void EM_reveal_mesh(struct EditMesh *em);
-
-void EM_automerge(struct Scene *scene, struct Object *obedit, int update);
-
-/* editface.c */
-struct MTFace *EM_get_active_mtface(struct EditMesh *em, struct EditFace **act_efa, struct MCol **mcol, int sloppy);
-int face_select(struct bContext *C, struct Object *ob, short mval[2], int extend);
-void face_borderselect(struct bContext *C, struct Object *ob, struct rcti *rect, int select, int extend);
-void selectall_tface(struct Object *ob, int action);
-void select_linked_tfaces(struct bContext *C, struct Object *ob, short mval[2], int mode);
-int minmax_tface(struct Scene *sce, float *min, float *max);
/* object_vgroup.c */
@@ -306,25 +230,20 @@ struct BMVert *EDBM_findnearestvert(struct ViewContext *vc, int *dist, short sel
struct BMEdge *EDBM_findnearestedge(struct ViewContext *vc, int *dist);
struct BMFace *EDBM_findnearestface(struct ViewContext *vc, int *dist);
-/*needed by edge slide*/
-struct EditVert *editedge_getOtherVert(struct EditEdge *eed, struct EditVert *eve);
-struct EditVert *editedge_getSharedVert(struct EditEdge *eed, struct EditEdge *eed2);
-int editedge_containsVert(struct EditEdge *eed, struct EditVert *eve);
-int editface_containsVert(struct EditFace *efa, struct EditVert *eve);
-int editface_containsEdge(struct EditFace *efa, struct EditEdge *eed);
-short sharesFace(struct EditMesh *em, struct EditEdge *e1, struct EditEdge *e2);
-
/* mesh_data.c */
+// void ED_mesh_geometry_add(struct Mesh *mesh, struct ReportList *reports, int verts, int edges, int faces);
+void ED_mesh_faces_add(struct Mesh *mesh, struct ReportList *reports, int count);
+void ED_mesh_edges_add(struct Mesh *mesh, struct ReportList *reports, int count);
+void ED_mesh_vertices_add(struct Mesh *mesh, struct ReportList *reports, int count);
-void ED_mesh_geometry_add(struct Mesh *mesh, struct ReportList *reports, int verts, int edges, int faces);
void ED_mesh_transform(struct Mesh *me, float *mat);
void ED_mesh_calc_normals(struct Mesh *me);
-void ED_mesh_material_add(struct Mesh *me, struct Material *ma);
+void ED_mesh_material_link(struct Mesh *me, struct Material *ma);
void ED_mesh_update(struct Mesh *mesh, struct bContext *C, int calc_edges);
-int ED_mesh_uv_texture_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me);
+int ED_mesh_uv_texture_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me, const char *name, int active_set);
int ED_mesh_uv_texture_remove(struct bContext *C, struct Object *ob, struct Mesh *me);
-int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me);
+int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me, const char *name, int active_set);
int ED_mesh_color_remove(struct bContext *C, struct Object *ob, struct Mesh *me);
#endif /* ED_MESH_H */
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 471ce965d4c..bd4791055e2 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -104,13 +104,14 @@ void viewline(struct ARegion *ar, struct View3D *v3d, float mval[2], float ray_s
void viewray(struct ARegion *ar, struct View3D *v3d, float mval[2], float ray_start[3], float ray_normal[3]);
int get_view3d_cliprange(struct View3D *v3d, struct RegionView3D *rv3d, float *clipsta, float *clipend);
-int get_view3d_viewplane(struct View3D *v3d, struct RegionView3D *rv3d, int winxi, int winyi, rctf *viewplane, float *clipsta, float *clipend, float *pixsize);
+int get_view3d_viewplane(struct View3D *v3d, struct RegionView3D *rv3d, int winxi, int winyi, struct rctf *viewplane, float *clipsta, float *clipend, float *pixsize);
int get_view3d_ortho(struct View3D *v3d, struct RegionView3D *rv3d);
void view3d_get_object_project_mat(struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]);
/* computes screen x/y in vec */
void view3d_project_float(struct ARegion *a, float *vec, float *adr, float mat[4][4]);
/* computes z, as well as x and y */
void view3d_project_float_v3(struct ARegion *a, float *vec, float *adr, float mat[4][4]);
+void view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, struct RegionView3D *rv3d, struct View3D *v3d, struct rctf *viewborder_r);
/* drawobject.c itterators */
void mesh_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct BMVert *eve, int x, int y, int index), void *userData, int clipVerts);
@@ -165,8 +166,8 @@ int ED_view3d_context_activate(struct bContext *C);
void ED_view3d_draw_offscreen(struct Scene *scene, struct View3D *v3d, struct ARegion *ar,
int winx, int winy, float viewmat[][4], float winmat[][4]);
-struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, int sizex, int sizey);
-struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height, int drawtype);
+struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, int sizex, int sizey, unsigned int flag);
+struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height, unsigned int flag, int drawtype);
void view3d_clipping_local(struct RegionView3D *rv3d, float mat[][4]);
diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h
index 6a139b124a6..3e8420df7eb 100644
--- a/source/blender/editors/include/UI_icons.h
+++ b/source/blender/editors/include/UI_icons.h
@@ -345,8 +345,8 @@ DEF_ICON(ICON_MESH_UVSPHERE)
DEF_ICON(ICON_MESH_ICOSPHERE)
DEF_ICON(ICON_MESH_GRID)
DEF_ICON(ICON_MESH_MONKEY)
-DEF_ICON(ICON_MESH_TUBE)
-DEF_ICON(ICON_MESH_DONUT)
+DEF_ICON(ICON_MESH_CYLINDER)
+DEF_ICON(ICON_MESH_TORUS)
DEF_ICON(ICON_MESH_CONE)
DEF_ICON(ICON_BLANK610)
DEF_ICON(ICON_BLANK611)
@@ -362,16 +362,16 @@ DEF_ICON(ICON_META_PLANE)
DEF_ICON(ICON_META_CUBE)
DEF_ICON(ICON_META_BALL)
DEF_ICON(ICON_META_ELLIPSOID)
-DEF_ICON(ICON_META_TUBE)
+DEF_ICON(ICON_META_CAPSULE)
DEF_ICON(ICON_BLANK625)
/* PRIMITIVES */
DEF_ICON(ICON_SURFACE_NCURVE)
DEF_ICON(ICON_SURFACE_NCIRCLE)
DEF_ICON(ICON_SURFACE_NSURFACE)
-DEF_ICON(ICON_SURFACE_NTUBE)
+DEF_ICON(ICON_SURFACE_NCYLINDER)
DEF_ICON(ICON_SURFACE_NSPHERE)
-DEF_ICON(ICON_SURFACE_NDONUT)
+DEF_ICON(ICON_SURFACE_NTORUS)
DEF_ICON(ICON_BLANK636)
DEF_ICON(ICON_BLANK637)
DEF_ICON(ICON_BLANK638)
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index b126c6235d5..40985a918d4 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -135,7 +135,7 @@ typedef struct uiLayout uiLayout;
#define UI_MAKE_RIGHT 8192
/* button align flag, for drawing groups together */
-#define UI_BUT_ALIGN (15<<14)
+#define UI_BUT_ALIGN (UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_LEFT|UI_BUT_ALIGN_RIGHT|UI_BUT_ALIGN_DOWN)
#define UI_BUT_ALIGN_TOP (1<<14)
#define UI_BUT_ALIGN_LEFT (1<<15)
#define UI_BUT_ALIGN_RIGHT (1<<16)
@@ -151,9 +151,10 @@ typedef struct uiLayout uiLayout;
#define UI_BUT_UNDO (1<<25)
#define UI_BUT_IMMEDIATE (1<<26)
#define UI_BUT_NO_TOOLTIP (1<<27)
+#define UI_BUT_NO_UTF8 (1<<28)
-#define UI_BUT_VEC_SIZE_LOCK (1<<28) /* used to flag if color hsv-circle should keep luminance */
-#define UI_BUT_COLOR_CUBIC (1<<29) /* cubic saturation for the color wheel */
+#define UI_BUT_VEC_SIZE_LOCK (1<<29) /* used to flag if color hsv-circle should keep luminance */
+#define UI_BUT_COLOR_CUBIC (1<<30) /* cubic saturation for the color wheel */
#define UI_PANEL_WIDTH 340
#define UI_COMPACT_PANEL_WIDTH 160
@@ -687,7 +688,6 @@ void uiTemplateWaveform(uiLayout *layout, struct PointerRNA *ptr, char *propname
void uiTemplateVectorscope(uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand);
void uiTemplateCurveMapping(uiLayout *layout, struct PointerRNA *ptr, char *propname, int type, int levels, int brush);
void uiTemplateColorWheel(uiLayout *layout, struct PointerRNA *ptr, char *propname, int value_slider, int lock, int lock_luminosity, int cubic);
-void uiTemplateTriColorSet(uiLayout *layout, struct PointerRNA *ptr, char *propname);
void uiTemplateLayers(uiLayout *layout, struct PointerRNA *ptr, char *propname,
PointerRNA *used_ptr, char *used_propname, int active_layer);
void uiTemplateImage(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, char *propname, struct PointerRNA *userptr, int compact);
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 4c86b9480d4..021dcc940e6 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -1765,9 +1765,11 @@ static void ui_free_but(const bContext *C, uiBut *but)
}
if(but->func_argN) MEM_freeN(but->func_argN);
if(but->active) {
- /* XXX solve later, buttons should be free-able without context? */
+ /* XXX solve later, buttons should be free-able without context ideally,
+ however they may have open tooltips or popup windows, which need to
+ be closed using a context pointer */
if(C)
- ui_button_active_cancel(C, but);
+ ui_button_active_free(C, but);
else
if(but->active)
MEM_freeN(but->active);
@@ -2528,8 +2530,10 @@ uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, char *str, short x1,
}
}
}
- else
+ else {
+ printf("ui_def_but_rna: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname);
str= (char*)propname;
+ }
/* now create button */
but= ui_def_but(block, type, retval, str, x1, y1, x2, y2, NULL, min, max, a1, a2, tip);
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index 9d99409a741..9b3b194d74b 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -242,6 +242,20 @@ static int ui_is_a_warp_but(uiBut *but)
return FALSE;
}
+/* file selectors are exempt from utf-8 checks */
+static int ui_is_utf8_but(uiBut *but)
+{
+ if (but->rnaprop) {
+ int subtype= RNA_property_subtype(but->rnaprop);
+
+ if(ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
+ return TRUE;
+ }
+ }
+
+ return !(but->flag & UI_BUT_NO_UTF8);
+}
+
/* ********************** button apply/revert ************************/
static ListBase UIAfterFuncs = {NULL, NULL};
@@ -1572,6 +1586,15 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data)
static void ui_textedit_end(bContext *C, uiBut *but, uiHandleButtonData *data)
{
if(but) {
+ if(ui_is_utf8_but(but)) {
+ int strip= BLI_utf8_invalid_strip(but->editstr, strlen(but->editstr));
+ /* not a file?, strip non utf-8 chars */
+ if(strip) {
+ /* wont happen often so isnt that annoying to keep it here for a while */
+ printf("invalid utf8 - stripped chars %d\n", strip);
+ }
+ }
+
if(data->searchbox) {
if(data->cancel==0)
ui_searchbox_apply(but, data->searchbox);
@@ -4777,7 +4800,7 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA
button_activate_state(C, but, BUTTON_STATE_WAIT_FLASH);
}
-static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *but, int mousemove)
+static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *but, int mousemove, int onfree)
{
uiBlock *block= but->block;
uiBut *bt;
@@ -4787,6 +4810,7 @@ static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *b
button_activate_state(C, but, BUTTON_STATE_EXIT);
/* apply the button action or value */
+ if(!onfree)
ui_apply_button(C, block, but, data, 0);
/* if this button is in a menu, this will set the button return
@@ -4802,7 +4826,7 @@ static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *b
}
}
- if(!data->cancel) {
+ if(!onfree && !data->cancel) {
/* autokey & undo push */
ui_apply_autokey_undo(C, but);
@@ -4835,6 +4859,7 @@ static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *b
but->active= NULL;
but->flag &= ~(UI_ACTIVE|UI_SELECT);
but->flag |= UI_BUT_LAST_ACTIVE;
+ if(!onfree)
ui_check_but(but);
/* adds empty mousemove in queue for re-init handler, in case mouse is
@@ -4844,7 +4869,7 @@ static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *b
WM_event_add_mousemove(C);
}
-void ui_button_active_cancel(const bContext *C, uiBut *but)
+void ui_button_active_free(const bContext *C, uiBut *but)
{
uiHandleButtonData *data;
@@ -4854,7 +4879,7 @@ void ui_button_active_cancel(const bContext *C, uiBut *but)
if(but->active) {
data= but->active;
data->cancel= 1;
- button_activate_exit((bContext*)C, data, but, 0);
+ button_activate_exit((bContext*)C, data, but, 0, 1);
}
}
@@ -4920,7 +4945,7 @@ static void ui_handle_button_activate(bContext *C, ARegion *ar, uiBut *but, uiBu
if(oldbut) {
data= oldbut->active;
data->cancel= 1;
- button_activate_exit(C, data, oldbut, 0);
+ button_activate_exit(C, data, oldbut, 0, 0);
}
button_activate_init(C, ar, but, type);
@@ -5078,7 +5103,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but)
postbut= data->postbut;
posttype= data->posttype;
- button_activate_exit(C, data, but, (postbut == NULL));
+ button_activate_exit(C, data, but, (postbut == NULL), 0);
/* for jumping to the next button with tab while text editing */
if(postbut)
@@ -5182,7 +5207,7 @@ static void ui_handle_button_return_submenu(bContext *C, wmEvent *event, uiBut *
if(menu->menuretval != UI_RETURN_OK)
data->cancel= 1;
- button_activate_exit(C, data, but, 1);
+ button_activate_exit(C, data, but, 1, 0);
}
else if(menu->menuretval == UI_RETURN_OUT) {
if(event->type==MOUSEMOVE && ui_mouse_inside_button(data->region, but, event->x, event->y)) {
@@ -5196,7 +5221,7 @@ static void ui_handle_button_return_submenu(bContext *C, wmEvent *event, uiBut *
}
else {
data->cancel= 1;
- button_activate_exit(C, data, but, 1);
+ button_activate_exit(C, data, but, 1, 0);
}
}
}
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index cb8130573fe..84d6605651b 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -456,7 +456,7 @@ void ui_draw_but_IMAGE(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rct
/* interface_handlers.c */
extern void ui_button_activate_do(struct bContext *C, struct ARegion *ar, uiBut *but);
-extern void ui_button_active_cancel(const struct bContext *C, uiBut *but);
+extern void ui_button_active_free(const struct bContext *C, uiBut *but);
extern int ui_button_is_active(struct ARegion *ar);
/* interface_widgets.c */
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 4b522c9ddcb..45ebc9bf136 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -69,68 +69,6 @@ void uiTemplateHeader(uiLayout *layout, bContext *C, int menus)
else ED_area_header_switchbutton(C, block, 0);
}
-/********************** DopeSheet Filter Template *************************/
-
-void uiTemplateDopeSheetFilter(uiLayout *layout, bContext *C, PointerRNA *ptr)
-{
- Main *mainptr= CTX_data_main(C);
- ScrArea *sa= CTX_wm_area(C);
- uiLayout *row= layout;
- short nlaActive= ((sa) && (sa->spacetype==SPACE_NLA));
-
- /* most 'generic' filtering options */
- row= uiLayoutRow(layout, 1);
-
- uiItemR(row, ptr, "show_only_selected", 0, "", 0);
- uiItemR(row, ptr, "show_hidden", 0, "", 0);
-
- /* object-level filtering options */
- row= uiLayoutRow(layout, 1);
- uiItemR(row, ptr, "show_transforms", 0, "", 0);
-
- if (nlaActive)
- uiItemR(row, ptr, "show_missing_nla", 0, "", 0);
-
- /* datatype based - only available datatypes are shown */
- row= uiLayoutRow(layout, 1);
-
- uiItemR(row, ptr, "show_scenes", 0, "", 0);
- uiItemR(row, ptr, "show_worlds", 0, "", 0);
- uiItemR(row, ptr, "show_nodes", 0, "", 0);
-
- if (mainptr && mainptr->mesh.first)
- uiItemR(row, ptr, "show_meshes", 0, "", 0);
- if (mainptr && mainptr->key.first)
- uiItemR(row, ptr, "show_shapekeys", 0, "", 0);
- if (mainptr && mainptr->mat.first)
- uiItemR(row, ptr, "show_materials", 0, "", 0);
- if (mainptr && mainptr->lamp.first)
- uiItemR(row, ptr, "show_lamps", 0, "", 0);
- if (mainptr && mainptr->tex.first)
- uiItemR(row, ptr, "show_textures", 0, "", 0);
- if (mainptr && mainptr->camera.first)
- uiItemR(row, ptr, "show_cameras", 0, "", 0);
- if (mainptr && mainptr->curve.first)
- uiItemR(row, ptr, "show_curves", 0, "", 0);
- if (mainptr && mainptr->mball.first)
- uiItemR(row, ptr, "show_metaballs", 0, "", 0);
- if (mainptr && mainptr->armature.first)
- uiItemR(row, ptr, "show_armatures", 0, "", 0);
- if (mainptr && mainptr->particle.first)
- uiItemR(row, ptr, "show_particles", 0, "", 0);
-
- /* group-based filtering (only when groups are available */
- if (mainptr && mainptr->group.first) {
- row= uiLayoutRow(layout, 1);
-
- uiItemR(row, ptr, "show_only_group_objects", 0, "", 0);
-
- /* if enabled, show the group selection field too */
- if (RNA_boolean_get(ptr, "show_only_group_objects"))
- uiItemR(row, ptr, "filter_group", 0, "", 0);
- }
-}
-
/********************** Search Callbacks *************************/
typedef struct TemplateID {
@@ -1884,31 +1822,6 @@ void uiTemplateColorWheel(uiLayout *layout, PointerRNA *ptr, char *propname, int
uiDefButR(block, HSVCUBE, 0, "", WHEEL_SIZE+6, 0, 14, WHEEL_SIZE, ptr, propname, -1, softmin, softmax, 9, 0, "");
}
-
-/********************* TriColor (ThemeWireColorSet) Template ************************/
-
-void uiTemplateTriColorSet(uiLayout *layout, PointerRNA *ptr, char *propname)
-{
- PropertyRNA *prop= RNA_struct_find_property(ptr, propname);
- uiLayout *row;
- PointerRNA csPtr;
-
- if (!prop) {
- printf("uiTemplateTriColorSet: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname);
- return;
- }
-
- /* we lay out the data in a row as 3 color swatches */
- row= uiLayoutRow(layout, 1);
-
- /* nselected, selected, active color swatches */
- csPtr= RNA_property_pointer_get(ptr, prop);
-
- uiItemR(row, &csPtr, "normal", 0, "", 0);
- uiItemR(row, &csPtr, "select", 0, "", 0);
- uiItemR(row, &csPtr, "active", 0, "", 0);
-}
-
/********************* Layer Buttons Template ************************/
static void handle_layer_buttons(bContext *C, void *arg1, void *arg2)
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 6b7d88d3c28..539be96c4ce 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1638,6 +1638,10 @@ void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
float centx, centy, radius;
float rgb[3], hsv[3], hsvo[3], col[3], colcent[3];
int a, tot= 32;
+ int color_profile = but->block->color_profile;
+
+ if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA)
+ color_profile = BLI_PR_NONE;
radstep= 2.0f*M_PI/(float)tot;
centx= (float)(rect->xmin + rect->xmax)/2;
@@ -1656,7 +1660,10 @@ void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect)
/* exception: if 'lock' is set
* lock the value of the color wheel to 1.
* Useful for color correction tools where you're only interested in hue. */
- if (but->flag & UI_BUT_COLOR_LOCK) hsv[2] = 1.f;
+ if (but->flag & UI_BUT_COLOR_LOCK)
+ hsv[2] = 1.f;
+ else if (color_profile)
+ hsv[2] = linearrgb_to_srgb(hsv[2]);
hsv_to_rgb(0.f, 0.f, hsv[2], colcent, colcent+1, colcent+2);
@@ -1884,11 +1891,8 @@ static void ui_draw_but_HSV_v(uiBut *but, rcti *rect)
float rgb[3], hsv[3], v, range;
int color_profile = but->block->color_profile;
- if (but->rnaprop) {
- if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) {
+ if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA)
color_profile = BLI_PR_NONE;
- }
- }
ui_get_but_vectorf(but, rgb);
rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2);
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 227f3a4de1d..1661cf73d53 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1006,6 +1006,10 @@ void init_userdef_do_versions(void)
strcpy(U.tempdir, tmp?tmp:"/tmp/");
}
+ if (U.autokey_mode == 0) {
+ /* 'add/replace' but not on */
+ U.autokey_mode = 2;
+ }
if (U.savetime <= 0) {
U.savetime = 1;
// XXX error("startup.blend is buggy, please consider removing it.\n");
diff --git a/source/blender/editors/mesh/editbmesh_add.c b/source/blender/editors/mesh/editbmesh_add.c
index 20bd2d3d82b..9a9a49b25e0 100644
--- a/source/blender/editors/mesh/editbmesh_add.c
+++ b/source/blender/editors/mesh/editbmesh_add.c
@@ -284,7 +284,7 @@ void MESH_OT_primitive_circle_add(wmOperatorType *ot)
ED_object_add_generic_props(ot, TRUE);
}
-static int add_primitive_tube_exec(bContext *C, wmOperator *op)
+static int add_primitive_cylinder_exec(bContext *C, wmOperator *op)
{
Object *obedit;
Mesh *me;
@@ -310,7 +310,7 @@ static int add_primitive_tube_exec(bContext *C, wmOperator *op)
make_prim_finish(C, &state, enter_editmode);
}
-void MESH_OT_primitive_tube_add(wmOperatorType *ot)
+void MESH_OT_primitive_cylinder_add(wmOperatorType *ot)
{
/* identifiers */
ot->name= "Add Tube";
@@ -319,7 +319,7 @@ void MESH_OT_primitive_tube_add(wmOperatorType *ot)
/* api callbacks */
ot->invoke= ED_object_add_generic_invoke;
- ot->exec= add_primitive_tube_exec;
+ ot->exec= add_primitive_cylinder_exec;
ot->poll= ED_operator_scene_editable;
/* flags */
diff --git a/source/blender/editors/mesh/loopcut.c b/source/blender/editors/mesh/loopcut.c
index 68ef56ad3ab..282ed48a476 100644
--- a/source/blender/editors/mesh/loopcut.c
+++ b/source/blender/editors/mesh/loopcut.c
@@ -292,6 +292,8 @@ static void ringsel_finish(bContext *C, wmOperator *op)
em->selectmode &= ~SCE_SELECT_FACE;
CTX_data_tool_settings(C)->selectmode= em->selectmode;
EDBM_selectmode_set(em);
+
+ WM_event_add_notifier(C, NC_SCENE|ND_TOOLSETTINGS, CTX_data_scene(C));
}
WM_event_add_notifier(C, NC_GEOM|ND_SELECT|ND_DATA, lcd->ob->data);
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index 80dc5331cf8..8e95356f748 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -163,7 +163,7 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la
}
}
-int ED_mesh_uv_texture_add(bContext *C, Scene *scene, Object *ob, Mesh *me)
+int ED_mesh_uv_texture_add(bContext *C, Scene *scene, Object *ob, Mesh *me, const char *name, int active_set)
{
BMEditMesh *em;
int layernum;
@@ -173,22 +173,26 @@ int ED_mesh_uv_texture_add(bContext *C, Scene *scene, Object *ob, Mesh *me)
layernum= CustomData_number_of_layers(&em->bm->pdata, CD_MTEXPOLY);
if(layernum >= MAX_MTFACE)
- return OPERATOR_CANCELLED;
+ return 0;
- BM_add_data_layer(em->bm, &em->bm->pdata, MAX_MTFACE);
- CustomData_set_layer_active(&em->bm->pdata, MAX_MTFACE, layernum);
+ BM_add_data_layer(em->bm, &em->bm->pdata, CD_MTEXPOLY);
+ CustomData_set_layer_active(&em->bm->pdata, CD_MTEXPOLY, layernum);
+ if(active_set || layernum==0)
+ CustomData_set_layer_active(&em->bm->pdata, CD_MTEXPOLY, layernum);
}
else {
layernum= CustomData_number_of_layers(&me->pdata, MAX_MTFACE);
if(layernum >= MAX_MTFACE)
- return OPERATOR_CANCELLED;
+ return 0;
if(me->mtface)
- CustomData_add_layer(&me->pdata, MAX_MTFACE, CD_DUPLICATE, me->mtpoly, me->totpoly);
+ CustomData_add_layer_named(&me->pdata, CD_MTEXPOLY, CD_DUPLICATE, me->mtpoly, me->totpoly, name);
else
- CustomData_add_layer(&me->pdata, MAX_MTFACE, CD_DEFAULT, NULL, me->totpoly);
+ CustomData_add_layer_named(&me->pdata, CD_MTEXPOLY, CD_DEFAULT, NULL, me->totpoly, name);
+
+ if(active_set || layernum==0)
+ CustomData_set_layer_active(&me->pdata, CD_MTEXPOLY, layernum);
- CustomData_set_layer_active(&me->pdata, MAX_MTFACE, layernum);
mesh_update_customdata_pointers(me);
}
@@ -216,7 +220,7 @@ int ED_mesh_uv_texture_remove(bContext *C, Object *ob, Mesh *me)
return 1;
}
-int ED_mesh_color_add(bContext *C, Scene *scene, Object *ob, Mesh *me)
+int ED_mesh_color_add(bContext *C, Scene *scene, Object *ob, Mesh *me, const char *name, int active_set)
{
BMEditMesh *em;
MLoopCol *mcol;
@@ -231,6 +235,10 @@ int ED_mesh_color_add(bContext *C, Scene *scene, Object *ob, Mesh *me)
BM_add_data_layer(em->bm, &em->bm->pdata, CD_MLOOPCOL);
CustomData_set_layer_active(&em->bm->ldata, CD_MLOOPCOL, layernum);
+
+ if(active_set || layernum==0)
+ CustomData_set_layer_active(&em->bm->ldata, CD_MLOOPCOL, layernum);
+
}
else {
layernum= CustomData_number_of_layers(&me->ldata, CD_MLOOPCOL);
@@ -240,11 +248,13 @@ int ED_mesh_color_add(bContext *C, Scene *scene, Object *ob, Mesh *me)
mcol= me->mloopcol;
if(me->mloopcol)
- CustomData_add_layer(&me->ldata, CD_MLOOPCOL, CD_DUPLICATE, me->mloopcol, me->totloop);
+ CustomData_add_layer_named(&me->ldata, CD_MLOOPCOL, CD_DUPLICATE, me->mloopcol, me->totloop, name);
else
- CustomData_add_layer(&me->ldata, CD_MLOOPCOL, CD_DEFAULT, NULL, me->totloop);
+ CustomData_add_layer_named(&me->ldata, CD_MLOOPCOL, CD_DEFAULT, NULL, me->totloop, name);
+
+ if(active_set || layernum==0)
+ CustomData_set_layer_active(&me->ldata, CD_MLOOPCOL, layernum);
- CustomData_set_layer_active(&me->ldata, CD_MLOOPCOL, layernum);
mesh_update_customdata_pointers(me);
/*BMESH_TODO
@@ -292,7 +302,7 @@ static int uv_texture_add_exec(bContext *C, wmOperator *op)
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
Mesh *me= ob->data;
- if(!ED_mesh_uv_texture_add(C, scene, ob, me))
+ if(!ED_mesh_uv_texture_add(C, scene, ob, me, NULL, TRUE))
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
@@ -426,7 +436,7 @@ static int vertex_color_add_exec(bContext *C, wmOperator *op)
Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
Mesh *me= ob->data;
- if(!ED_mesh_color_add(C, scene, ob, me))
+ if(!ED_mesh_color_add(C, scene, ob, me, NULL, TRUE))
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
@@ -721,6 +731,7 @@ static void mesh_add_faces(Mesh *mesh, int len)
mesh->totface= totface;
}
+/*
void ED_mesh_geometry_add(Mesh *mesh, ReportList *reports, int verts, int edges, int faces)
{
if(mesh->edit_btmesh) {
@@ -735,33 +746,39 @@ void ED_mesh_geometry_add(Mesh *mesh, ReportList *reports, int verts, int edges,
if(faces)
mesh_add_faces(mesh, faces);
}
+*/
-void ED_mesh_calc_normals(Mesh *me)
+void ED_mesh_faces_add(Mesh *mesh, ReportList *reports, int count)
{
- mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL);
+ if(mesh->edit_btmesh) {
+ BKE_report(reports, RPT_ERROR, "Can't add faces in edit mode.");
+ return;
}
-void ED_mesh_material_add(Mesh *me, Material *ma)
-{
- int i;
- int totcol = me->totcol + 1;
- Material **mat;
+ mesh_add_faces(mesh, count);
+}
- /* don't add if mesh already has it */
- for(i = 0; i < me->totcol; i++)
- if(me->mat[i] == ma)
+void ED_mesh_edges_add(Mesh *mesh, ReportList *reports, int count)
+{
+ if(mesh->edit_btmesh) {
+ BKE_report(reports, RPT_ERROR, "Can't add edges in edit mode.");
return;
+ }
- mat= MEM_callocN(sizeof(void*)*totcol, "newmatar");
-
- if(me->totcol) memcpy(mat, me->mat, sizeof(void*) * me->totcol);
- if(me->mat) MEM_freeN(me->mat);
+ mesh_add_edges(mesh, count);
+}
- me->mat = mat;
- me->mat[me->totcol++] = ma;
- if(ma)
- ma->id.us++;
+void ED_mesh_vertices_add(Mesh *mesh, ReportList *reports, int count)
+{
+ if(mesh->edit_btmesh) {
+ BKE_report(reports, RPT_ERROR, "Can't add vertices in edit mode.");
+ return;
+ }
- test_object_materials((ID*)me);
+ mesh_add_verts(mesh, count);
}
+void ED_mesh_calc_normals(Mesh *me)
+{
+ mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL);
+}
diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h
index 271cd8a8524..28c72121d2f 100644
--- a/source/blender/editors/mesh/mesh_intern.h
+++ b/source/blender/editors/mesh/mesh_intern.h
@@ -127,7 +127,7 @@ void MESH_OT_separate(struct wmOperatorType *ot);
void MESH_OT_primitive_plane_add(struct wmOperatorType *ot);
void MESH_OT_primitive_cube_add(struct wmOperatorType *ot);
void MESH_OT_primitive_circle_add(struct wmOperatorType *ot);
-void MESH_OT_primitive_tube_add(struct wmOperatorType *ot);
+void MESH_OT_primitive_cylinder_add(struct wmOperatorType *ot);
void MESH_OT_primitive_cone_add(struct wmOperatorType *ot);
void MESH_OT_primitive_grid_add(struct wmOperatorType *ot);
void MESH_OT_primitive_monkey_add(struct wmOperatorType *ot);
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index 648e4f04302..621f20144b5 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -75,7 +75,7 @@ void ED_operatortypes_mesh(void)
WM_operatortype_append(MESH_OT_primitive_plane_add);
WM_operatortype_append(MESH_OT_primitive_cube_add);
WM_operatortype_append(MESH_OT_primitive_circle_add);
- WM_operatortype_append(MESH_OT_primitive_tube_add);
+ WM_operatortype_append(MESH_OT_primitive_cylinder_add);
WM_operatortype_append(MESH_OT_primitive_cone_add);
WM_operatortype_append(MESH_OT_primitive_grid_add);
WM_operatortype_append(MESH_OT_primitive_monkey_add);
diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c
index d097caac63d..62ebe84e078 100644
--- a/source/blender/editors/metaball/mball_edit.c
+++ b/source/blender/editors/metaball/mball_edit.c
@@ -45,6 +45,7 @@
#include "BKE_depsgraph.h"
#include "BKE_context.h"
+#include "BKE_mball.h"
#include "ED_screen.h"
#include "ED_view3d.h"
@@ -103,53 +104,11 @@ MetaElem *add_metaball_primitive(bContext *C, float mat[4][4], int type, int new
ml= ml->next;
}
- ml= MEM_callocN(sizeof(MetaElem), "metaelem");
-
- ml->x= mat[3][0];
- ml->y= mat[3][1];
- ml->z= mat[3][2];
- ml->quat[0]= 1.0;
- ml->quat[1]= 0.0;
- ml->quat[2]= 0.0;
- ml->quat[3]= 0.0;
- ml->rad= 2.0;
- ml->s= 2.0;
- ml->flag= SELECT | MB_SCALE_RAD;
-
- switch(type) {
- case MB_BALL:
- ml->type = MB_BALL;
- ml->expx= ml->expy= ml->expz= 1.0;
-
- break;
- case MB_TUBE:
- ml->type = MB_TUBE;
- ml->expx= ml->expy= ml->expz= 1.0;
-
- break;
- case MB_PLANE:
- ml->type = MB_PLANE;
- ml->expx= ml->expy= ml->expz= 1.0;
-
- break;
- case MB_ELIPSOID:
- ml->type = MB_ELIPSOID;
- ml->expx= 1.2f;
- ml->expy= 0.8f;
- ml->expz= 1.0;
-
- break;
- case MB_CUBE:
- ml->type = MB_CUBE;
- ml->expx= ml->expy= ml->expz= 1.0;
-
- break;
- default:
- break;
- }
-
+ ml= add_metaball_element(mball, type);
+ copy_v3_v3(&ml->x, mat[3]);
+
+ ml->flag |= SELECT;
mball->lastelem= ml;
-
return ml;
}
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index e60f9db79f6..e4b71368315 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -176,7 +176,7 @@ void ED_object_add_generic_props(wmOperatorType *ot, int do_editmode)
RNA_def_property_flag(prop, PROP_HIDDEN);
}
- RNA_def_float_vector(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "Location for the newly added object.", -FLT_MAX, FLT_MAX);
+ RNA_def_float_vector_xyz(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "Location for the newly added object.", -FLT_MAX, FLT_MAX);
RNA_def_float_rotation(ot->srna, "rotation", 3, NULL, -FLT_MAX, FLT_MAX, "Rotation", "Rotation for the newly added object", -FLT_MAX, FLT_MAX);
prop = RNA_def_boolean_layer_member(ot->srna, "layers", 20, NULL, "Layer", "");
@@ -256,7 +256,9 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc, floa
if(v3d && v3d->localvd)
*layer |= v3d->lay;
- if (RNA_property_is_set(op->ptr, "view_align"))
+ if(RNA_property_is_set(op->ptr, "rotation"))
+ view_align = FALSE;
+ else if (RNA_property_is_set(op->ptr, "view_align"))
view_align = RNA_boolean_get(op->ptr, "view_align");
else
view_align = U.flag & USER_ADD_VIEWALIGNED;
@@ -303,6 +305,8 @@ Object *ED_object_add_type(bContext *C, int type, float *loc, float *rot, int en
if(enter_editmode)
ED_object_enter_editmode(C, EM_IGNORE_LAYER);
+ WM_event_add_notifier(C, NC_SCENE|ND_LAYER_CONTENT, scene);
+
return ob;
}
@@ -491,7 +495,7 @@ void OBJECT_OT_camera_add(wmOperatorType *ot)
static EnumPropertyItem prop_metaball_types[]= {
{MB_BALL, "MBALL_BALL", ICON_META_BALL, "Meta Ball", ""},
- {MB_TUBE, "MBALL_TUBE", ICON_META_TUBE, "Meta Tube", ""},
+ {MB_TUBE, "MBALL_CAPSULE", ICON_META_CAPSULE, "Meta Capsule", ""},
{MB_PLANE, "MBALL_PLANE", ICON_META_PLANE, "Meta Plane", ""},
{MB_CUBE, "MBALL_CUBE", ICON_META_CUBE, "Meta Cube", ""},
{MB_ELIPSOID, "MBALL_ELLIPSOID", ICON_META_ELLIPSOID, "Meta Ellipsoid", ""},
@@ -501,7 +505,6 @@ static EnumPropertyItem prop_metaball_types[]= {
static int object_metaball_add_exec(bContext *C, wmOperator *op)
{
Object *obedit= CTX_data_edit_object(C);
- MetaBall *mball;
MetaElem *elem;
int newob= 0;
int enter_editmode;
@@ -523,8 +526,6 @@ static int object_metaball_add_exec(bContext *C, wmOperator *op)
ED_object_new_primitive_matrix(C, obedit, loc, rot, mat);
elem= (MetaElem*)add_metaball_primitive(C, mat, RNA_enum_get(op->ptr, "type"), newob);
- mball= (MetaBall*)obedit->data;
- BLI_addtail(mball->editelems, elem);
/* userdef */
if (newob && !enter_editmode) {
@@ -826,7 +827,8 @@ static int object_delete_exec(bContext *C, wmOperator *op)
DAG_scene_sort(bmain, scene);
DAG_ids_flush_update(bmain, 0);
- WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, CTX_data_scene(C));
+ WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene);
+ WM_event_add_notifier(C, NC_SCENE|ND_LAYER_CONTENT, scene);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 8bbfce4dd99..4d70ae34e52 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -142,6 +142,7 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *sc
int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Object *ob, ModifierData *md)
{
ModifierData *obmd;
+ int sort_depsgraph = 0;
/* It seems on rapid delete it is possible to
* get called twice on same modifier, so make
@@ -174,13 +175,13 @@ int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Ob
if(ob->pd)
ob->pd->deflect= 0;
- DAG_scene_sort(bmain, scene);
+ sort_depsgraph = 1;
}
else if(md->type == eModifierType_Surface) {
if(ob->pd && ob->pd->shape == PFIELD_SHAPE_SURFACE)
ob->pd->shape = PFIELD_SHAPE_PLANE;
- DAG_scene_sort(bmain, scene);
+ sort_depsgraph = 1;
}
else if(md->type == eModifierType_Smoke) {
ob->dt = OB_TEXTURE;
@@ -197,6 +198,10 @@ int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Ob
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
+ /* sorting has to be done after the update so that dynamic systems can react properly */
+ if(sort_depsgraph)
+ DAG_scene_sort(bmain, scene);
+
return 1;
}
@@ -464,6 +469,21 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob,
BKE_report(reports, RPT_ERROR, "Cannot apply modifier for this object type");
return 0;
}
+
+ /* lattice modifier can be applied to particle system too */
+ if(ob->particlesystem.first) {
+
+ ParticleSystem *psys = ob->particlesystem.first;
+
+ for(; psys; psys=psys->next) {
+
+ if(psys->part->type != PART_HAIR)
+ continue;
+
+ psys_apply_hair_lattice(scene, ob, psys);
+ }
+ }
+
return 1;
}
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 76330477418..d23ea57e0e7 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -1106,6 +1106,8 @@ static int move_to_layer_exec(bContext *C, wmOperator *op)
/* warning, active object may be hidden now */
WM_event_add_notifier(C, NC_SCENE|NC_OBJECT|ND_DRAW, scene); /* is NC_SCENE needed ? */
+ WM_event_add_notifier(C, NC_SCENE|ND_LAYER_CONTENT, scene);
+
DAG_scene_sort(bmain, scene);
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index 43de351e4c1..3cc0be8d640 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -85,7 +85,7 @@ bDeformGroup *ED_vgroup_add_name(Object *ob, char *name)
{
bDeformGroup *defgroup;
- if(!ob)
+ if(!ob || !ELEM(ob->type, OB_MESH, OB_LATTICE))
return NULL;
defgroup = MEM_callocN(sizeof(bDeformGroup), "add deformGroup");
diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c
index d3f9926cf8c..eaadd3e7d83 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -4151,6 +4151,13 @@ static int clear_edited_exec(bContext *C, wmOperator *op)
DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
}
}
+ else { /* some operation might have protected hair from editing so let's clear the flag */
+ psys->recalc |= PSYS_RECALC_RESET;
+ psys->flag &= ~PSYS_GLOBAL_HAIR;
+ psys->flag &= ~PSYS_EDITED;
+ WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_EDITED, ob);
+ DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
+ }
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c
index c0e6ea66bc4..7833f93b3b5 100644
--- a/source/blender/editors/render/render_opengl.c
+++ b/source/blender/editors/render/render_opengl.c
@@ -116,6 +116,17 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
rr= RE_AcquireResultRead(oglrender->re);
+ /* note on color management:
+ * looked into how best to deal with color management here and found heres how it should work.
+ *
+ * OpenGL materials etc are color corrected, so a float buffer from the graphics card is
+ * color corrected, without running any conversion functions.
+ *
+ * With color correction disabled blender expects the rr->rectf to be non-color managed so
+ * just do a direct copy from the byte array to the rectf with no conversion too.
+ * notice IMB_float_from_rect has the profile set so no conversion is done.
+ */
+
if(view_context) {
GPU_offscreen_bind(oglrender->ofs); /* bind */
@@ -133,11 +144,8 @@ static void screen_opengl_render_apply(OGLRender *oglrender)
GPU_offscreen_unbind(oglrender->ofs); /* unbind */
}
else {
- ImBuf *ibuf_view= ED_view3d_draw_offscreen_imbuf_simple(scene, oglrender->sizex, oglrender->sizey, OB_SOLID);
- IMB_float_from_rect(ibuf_view);
-
+ ImBuf *ibuf_view= ED_view3d_draw_offscreen_imbuf_simple(scene, oglrender->sizex, oglrender->sizey, IB_rectfloat, OB_SOLID);
memcpy(rr->rectf, ibuf_view->rect_float, sizeof(float) * 4 * oglrender->sizex * oglrender->sizey);
-
IMB_freeImBuf(ibuf_view);
}
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 7e922076f4b..dd5a7d60fbd 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -5531,7 +5531,7 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op)
if(w > maxsize) w= maxsize;
if(h > maxsize) h= maxsize;
- ibuf= ED_view3d_draw_offscreen_imbuf(CTX_data_scene(C), CTX_wm_view3d(C), CTX_wm_region(C), w, h);
+ ibuf= ED_view3d_draw_offscreen_imbuf(CTX_data_scene(C), CTX_wm_view3d(C), CTX_wm_region(C), w, h, IB_rect);
image= BKE_add_image_imbuf(ibuf);
if(image) {
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index 9d34b827ff9..0b6e752574b 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -350,10 +350,12 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn)
ED_area_tag_redraw(sa);
break;
}
+ break;
/* Listener for preview render, when doing an global undo. */
case NC_WINDOW:
ED_area_tag_redraw(sa);
sbuts->preview= 1;
+ break;
}
if(wmn->data == ND_KEYS)
diff --git a/source/blender/editors/space_file/Makefile b/source/blender/editors/space_file/Makefile
index 1fc27795f08..4597ffa3f6b 100644
--- a/source/blender/editors/space_file/Makefile
+++ b/source/blender/editors/space_file/Makefile
@@ -73,4 +73,4 @@ endif
ifeq ($(WITH_HDR), true)
CPPFLAGS += -DWITH_HDR
-endif \ No newline at end of file
+endif
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index f25fab45c7c..5f435aa0cbe 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -118,7 +118,7 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
const int separator = 4;
/* Additional locals. */
- char name[20];
+ char name[32];
int loadbutton;
int fnumbuttons;
int min_x = 10;
@@ -177,11 +177,14 @@ void file_draw_buttons(const bContext *C, ARegion *ar)
params->dir, 0.0, (float)FILE_MAX-1, 0, 0,
"File path.");
uiButSetCompleteFunc(but, autocomplete_directory, NULL);
+ uiButSetFlag(but, UI_BUT_NO_UTF8);
+
but = uiDefBut(block, TEX, B_FS_FILENAME, "",
min_x, line2_y, line2_w-chan_offs, btn_h,
params->file, 0.0, (float)FILE_MAXFILE-1, 0, 0,
"File name.");
uiButSetCompleteFunc(but, autocomplete_file, NULL);
+ uiButSetFlag(but, UI_BUT_NO_UTF8);
}
/* Filename number increment / decrement buttons. */
@@ -541,6 +544,7 @@ void file_draw_list(const bContext *C, ARegion *ar)
uiBut *but = uiDefBut(block, TEX, 1, "", spos, sy-layout->tile_h-3,
but_width, layout->textheight*2, sfile->params->renameedit, 1.0f, (float)sizeof(sfile->params->renameedit),0,0,"");
uiButSetRenameFunc(but, renamebutton_cb, file);
+ uiButSetFlag(but, UI_BUT_NO_UTF8); /* allow non utf8 names */
if ( 0 == uiButActiveOnly(C, block, but)) {
file->flags &= ~EDITING;
}
@@ -628,4 +632,3 @@ void file_draw_list(const bContext *C, ARegion *ar)
}
-
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 818a6181626..3b335487557 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -1304,7 +1304,7 @@ static int pack_test(bContext *C, wmOperator *op)
return 0;
if(ima->source==IMA_SRC_SEQUENCE || ima->source==IMA_SRC_MOVIE) {
- BKE_report(op->reports, RPT_ERROR, "Can't pack movie or image sequence.");
+ BKE_report(op->reports, RPT_ERROR, "Packing movies or image sequences not supported.");
return 0;
}
@@ -1481,7 +1481,7 @@ static int unpack_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
if(ima->source==IMA_SRC_SEQUENCE || ima->source==IMA_SRC_MOVIE) {
- BKE_report(op->reports, RPT_ERROR, "Can't unpack movie or image sequence.");
+ BKE_report(op->reports, RPT_ERROR, "Unpacking movies or image sequences not supported.");
return OPERATOR_CANCELLED;
}
@@ -1506,7 +1506,7 @@ static int unpack_invoke(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_CANCELLED;
if(ima->source==IMA_SRC_SEQUENCE || ima->source==IMA_SRC_MOVIE) {
- BKE_report(op->reports, RPT_ERROR, "Can't unpack movie or image sequence.");
+ BKE_report(op->reports, RPT_ERROR, "Unpacking movies or image sequences not supported.");
return OPERATOR_CANCELLED;
}
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 32e8be83bc5..60b43844034 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -954,7 +954,7 @@ void ED_spacetype_image(void)
/* regions: statistics/scope buttons */
art= MEM_callocN(sizeof(ARegionType), "spacetype image region");
art->regionid = RGN_TYPE_PREVIEW;
- art->minsizex= 220; // XXX
+ art->prefsizex= 220; // XXX
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_FRAMES;
art->listener= image_scope_area_listener;
art->init= image_scope_area_init;
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c
index 8a703c510c4..4b778e80b0e 100644
--- a/source/blender/editors/space_logic/logic_window.c
+++ b/source/blender/editors/space_logic/logic_window.c
@@ -3666,7 +3666,7 @@ static void draw_actuator_action(uiLayout *layout, PointerRNA *ptr)
uiItemR(row, ptr, "use_continue_last_frame", 0, NULL, 0);
row= uiLayoutRow(layout, 0);
- if((RNA_enum_get(ptr, "mode") == ACT_ACTION_FROM_PROP))
+ if((RNA_enum_get(ptr, "play_mode") == ACT_ACTION_FROM_PROP))
uiItemPointerR(row, ptr, "property", &settings_ptr, "properties", NULL, 0);
else {
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index c1b888fcf83..f865c30dc45 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -553,7 +553,7 @@ static void node_composit_buts_dblur(uiLayout *layout, bContext *C, PointerRNA *
uiLayout *col;
uiItemR(layout, ptr, "iterations", 0, NULL, 0);
- uiItemR(layout, ptr, "wrap", 0, NULL, 0);
+ uiItemR(layout, ptr, "use_wrap", 0, NULL, 0);
col= uiLayoutColumn(layout, 1);
uiItemL(col, "Center:", 0);
@@ -601,9 +601,9 @@ static void node_composit_buts_defocus(uiLayout *layout, bContext *C, PointerRNA
uiItemR(layout, ptr, "threshold", 0, NULL, 0);
col = uiLayoutColumn(layout, 0);
- uiItemR(col, ptr, "preview", 0, NULL, 0);
+ uiItemR(col, ptr, "use_preview", 0, NULL, 0);
sub = uiLayoutColumn(col, 0);
- uiLayoutSetActive(sub, RNA_boolean_get(ptr, "preview"));
+ uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_preview"));
uiItemR(sub, ptr, "samples", 0, NULL, 0);
col = uiLayoutColumn(layout, 0);
@@ -707,13 +707,21 @@ static void node_composit_buts_crop(uiLayout *layout, bContext *C, PointerRNA *p
uiLayout *col;
uiItemR(layout, ptr, "use_crop_size", 0, NULL, 0);
+ uiItemR(layout, ptr, "relative", 0, NULL, 0);
col= uiLayoutColumn(layout, 1);
+ if (RNA_boolean_get(ptr, "relative")){
+ uiItemR(col, ptr, "rel_min_x", 0, "Left", 0);
+ uiItemR(col, ptr, "rel_max_x", 0, "Right", 0);
+ uiItemR(col, ptr, "rel_min_y", 0, "Up", 0);
+ uiItemR(col, ptr, "rel_max_y", 0, "Down", 0);
+ } else {
uiItemR(col, ptr, "min_x", 0, "Left", 0);
uiItemR(col, ptr, "max_x", 0, "Right", 0);
uiItemR(col, ptr, "min_y", 0, "Up", 0);
uiItemR(col, ptr, "max_y", 0, "Down", 0);
}
+}
static void node_composit_buts_splitviewer(uiLayout *layout, bContext *C, PointerRNA *ptr)
{
@@ -760,9 +768,9 @@ static void node_composit_buts_hue_sat(uiLayout *layout, bContext *C, PointerRNA
uiLayout *col;
col =uiLayoutColumn(layout, 0);
- uiItemR(col, ptr, "hue", UI_ITEM_R_SLIDER, NULL, 0);
- uiItemR(col, ptr, "sat", UI_ITEM_R_SLIDER, NULL, 0);
- uiItemR(col, ptr, "val", UI_ITEM_R_SLIDER, NULL, 0);
+ uiItemR(col, ptr, "color_hue", UI_ITEM_R_SLIDER, NULL, 0);
+ uiItemR(col, ptr, "color_saturation", UI_ITEM_R_SLIDER, NULL, 0);
+ uiItemR(col, ptr, "color_value", UI_ITEM_R_SLIDER, NULL, 0);
}
static void node_composit_buts_dilateerode(uiLayout *layout, bContext *C, PointerRNA *ptr)
diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c
index 3865fd213b4..2f32c54a1a5 100644
--- a/source/blender/editors/space_outliner/outliner.c
+++ b/source/blender/editors/space_outliner/outliner.c
@@ -102,6 +102,8 @@
#define OL_H 19
#define OL_X 18
+#define OL_Y_OFFSET 2
+
#define OL_TOG_RESTRICT_VIEWX 54
#define OL_TOG_RESTRICT_SELECTX 36
#define OL_TOG_RESTRICT_RENDERX 18
@@ -2402,7 +2404,7 @@ static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, Spa
return 1;
}
/* name and first icon */
- else if(mval[0]>te->xs && mval[0]<te->xend) {
+ else if(mval[0]>te->xs+OL_X && mval[0]<te->xend) {
/* always makes active object */
if(tselem->type!=TSE_SEQUENCE && tselem->type!=TSE_SEQ_STRIP && tselem->type!=TSE_SEQUENCE_DUP)
@@ -2498,7 +2500,7 @@ static int outliner_item_activate(bContext *C, wmOperator *op, wmEvent *event)
int row;
/* get row number - 100 here is just a dummy value since we don't need the column */
- UI_view2d_listview_view_to_cell(&ar->v2d, 1000, OL_H, 0.0f, 0.0f,
+ UI_view2d_listview_view_to_cell(&ar->v2d, 1000, OL_H, 0.0f, OL_Y_OFFSET,
fmval[0], fmval[1], NULL, &row);
/* select relevant row */
@@ -2599,7 +2601,7 @@ static int do_outliner_item_rename(bContext *C, ARegion *ar, SpaceOops *soops, T
TreeStoreElem *tselem= TREESTORE(te);
/* name and first icon */
- if(mval[0]>te->xs && mval[0]<te->xend) {
+ if(mval[0]>te->xs+OL_X && mval[0]<te->xend) {
/* can't rename rna datablocks entries */
if(ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM))
@@ -4711,13 +4713,13 @@ static void outliner_draw_struct_marks(ARegion *ar, SpaceOops *soops, ListBase *
/* selection status */
if((tselem->flag & TSE_CLOSED)==0)
if(tselem->type == TSE_RNA_STRUCT)
- glRecti(0, *starty+1, (int)ar->v2d.cur.xmax, *starty+OL_H-1);
+ glRecti(0, *starty+1, (int)ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, *starty+OL_H-1);
*starty-= OL_H;
if((tselem->flag & TSE_CLOSED)==0) {
outliner_draw_struct_marks(ar, soops, &te->subtree, starty);
if(tselem->type == TSE_RNA_STRUCT)
- fdrawline(0, (float)*starty+OL_H-1, ar->v2d.cur.xmax, (float)*starty+OL_H-1);
+ fdrawline(0, (float)*starty+OL_H, ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, (float)*starty+OL_H);
}
}
}
@@ -4752,24 +4754,24 @@ static void outliner_draw_tree(bContext *C, uiBlock *block, Scene *scene, ARegio
/* struct marks */
UI_ThemeColorShadeAlpha(TH_BACK, -15, -200);
//UI_ThemeColorShade(TH_BACK, -20);
- starty= (int)ar->v2d.tot.ymax-OL_H;
+ starty= (int)ar->v2d.tot.ymax-OL_H-OL_Y_OFFSET;
outliner_draw_struct_marks(ar, soops, &soops->tree, &starty);
}
/* always draw selection fill before hierarchy */
UI_GetThemeColor3fv(TH_BACK, col);
glColor3f(col[0]+0.06f, col[1]+0.08f, col[2]+0.10f);
- starty= (int)ar->v2d.tot.ymax-OL_H;
+ starty= (int)ar->v2d.tot.ymax-OL_H-OL_Y_OFFSET;
outliner_draw_selection(ar, soops, &soops->tree, &starty);
// grey hierarchy lines
UI_ThemeColorBlend(TH_BACK, TH_TEXT, 0.2f);
- starty= (int)ar->v2d.tot.ymax-OL_H/2;
+ starty= (int)ar->v2d.tot.ymax-OL_H/2-OL_Y_OFFSET;
startx= 6;
outliner_draw_hierarchy(soops, &soops->tree, startx, &starty);
// items themselves
- starty= (int)ar->v2d.tot.ymax-OL_H;
+ starty= (int)ar->v2d.tot.ymax-OL_H-OL_Y_OFFSET;
startx= 0;
for(te= soops->tree.first; te; te= te->next) {
outliner_draw_tree_element(C, block, scene, ar, soops, te, startx, &starty);
@@ -4783,10 +4785,10 @@ static void outliner_back(ARegion *ar, SpaceOops *soops)
UI_ThemeColorShade(TH_BACK, 6);
ystart= (int)ar->v2d.tot.ymax;
- ystart= OL_H*(ystart/(OL_H));
+ ystart= OL_H*(ystart/(OL_H))-OL_Y_OFFSET;
while(ystart+2*OL_H > ar->v2d.cur.ymin) {
- glRecti(0, ystart, (int)ar->v2d.cur.xmax, ystart+OL_H);
+ glRecti(0, ystart, (int)ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, ystart+OL_H);
ystart-= 2*OL_H;
}
}
@@ -4797,11 +4799,11 @@ static void outliner_draw_restrictcols(ARegion *ar, SpaceOops *soops)
/* background underneath */
UI_ThemeColor(TH_BACK);
- glRecti((int)ar->v2d.cur.xmax-OL_TOGW, (int)ar->v2d.cur.ymin, (int)ar->v2d.cur.xmax, (int)ar->v2d.cur.ymax);
+ glRecti((int)ar->v2d.cur.xmax-OL_TOGW, (int)ar->v2d.cur.ymin-V2D_SCROLL_HEIGHT-1, (int)ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, (int)ar->v2d.cur.ymax);
UI_ThemeColorShade(TH_BACK, 6);
ystart= (int)ar->v2d.tot.ymax;
- ystart= OL_H*(ystart/(OL_H));
+ ystart= OL_H*(ystart/(OL_H))-OL_Y_OFFSET;
while(ystart+2*OL_H > ar->v2d.cur.ymin) {
glRecti((int)ar->v2d.cur.xmax-OL_TOGW, ystart, (int)ar->v2d.cur.xmax, ystart+OL_H);
@@ -4814,19 +4816,19 @@ static void outliner_draw_restrictcols(ARegion *ar, SpaceOops *soops)
fdrawline(ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX,
ar->v2d.cur.ymax,
ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX,
- ar->v2d.cur.ymin);
+ ar->v2d.cur.ymin - V2D_SCROLL_HEIGHT);
/* render */
fdrawline(ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX,
ar->v2d.cur.ymax,
ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX,
- ar->v2d.cur.ymin);
+ ar->v2d.cur.ymin - V2D_SCROLL_HEIGHT);
/* render */
fdrawline(ar->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX,
ar->v2d.cur.ymax,
ar->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX,
- ar->v2d.cur.ymin);
+ ar->v2d.cur.ymin - V2D_SCROLL_HEIGHT);
}
static void restrictbutton_view_cb(bContext *C, void *poin, void *poin2)
@@ -5216,18 +5218,21 @@ static void outliner_draw_rnacols(ARegion *ar, SpaceOops *soops, int sizex)
{
View2D *v2d= &ar->v2d;
+ float miny = v2d->cur.ymin-V2D_SCROLL_HEIGHT;
+ if(miny<v2d->tot.ymin) miny = v2d->tot.ymin;
+
UI_ThemeColorShadeAlpha(TH_BACK, -15, -200);
/* draw column separator lines */
fdrawline((float)sizex,
v2d->cur.ymax,
(float)sizex,
- v2d->cur.ymin);
+ miny);
fdrawline((float)sizex+OL_RNA_COL_SIZEX,
v2d->cur.ymax,
(float)sizex+OL_RNA_COL_SIZEX,
- v2d->cur.ymin);
+ miny);
}
static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, SpaceOops *soops, int sizex, ListBase *lb)
@@ -5531,7 +5536,7 @@ static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, Spa
uiBut *bt;
TreeElement *te;
TreeStoreElem *tselem;
- int dx, len;
+ int spx, dx, len;
for(te= lb->first; te; te= te->next) {
tselem= TREESTORE(te);
@@ -5552,8 +5557,10 @@ static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, Spa
dx= (int)UI_GetStringWidth(te->name);
if(dx<100) dx= 100;
+ spx=te->xs+2*OL_X-4;
+ if(spx+dx+10>ar->v2d.cur.xmax) dx = ar->v2d.cur.xmax-spx-10;
- bt= uiDefBut(block, TEX, OL_NAMEBUTTON, "", (short)te->xs+2*OL_X-4, (short)te->ys, dx+10, OL_H-1, te->name, 1.0, (float)len-1, 0, 0, "");
+ bt= uiDefBut(block, TEX, OL_NAMEBUTTON, "", spx, (short)te->ys, dx+10, OL_H-1, te->name, 1.0, (float)len-1, 0, 0, "");
uiButSetRenameFunc(bt, namebutton_cb, tselem);
/* returns false if button got removed */
@@ -5614,20 +5621,20 @@ void draw_outliner(const bContext *C)
/* tweak to display last line (when list bigger than window) */
sizey += V2D_SCROLL_HEIGHT;
+ /* adds vertical offset */
+ sizey += OL_Y_OFFSET;
+
/* update size of tot-rect (extents of data/viewable area) */
UI_view2d_totRect_set(v2d, sizex, sizey);
/* set matrix for 2d-view controls */
UI_view2d_view_ortho(C, v2d);
- /* draw outliner stuff (background and hierachy lines) */
+ /* draw outliner stuff (background, hierachy lines and names) */
outliner_back(ar, soops);
block= uiBeginBlock(C, ar, "outliner buttons", UI_EMBOSS);
outliner_draw_tree((bContext *)C, block, scene, ar, soops);
- /* draw icons and names */
- outliner_buttons(C, block, ar, soops, &soops->tree);
-
if(ELEM(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF)) {
/* draw rna buttons */
outliner_draw_rnacols(ar, soops, sizex_rna);
@@ -5642,6 +5649,9 @@ void draw_outliner(const bContext *C)
outliner_draw_restrictbuts(block, scene, ar, soops, &soops->tree);
}
+ /* draw edit buttons if nessecery */
+ outliner_buttons(C, block, ar, soops, &soops->tree);
+
uiEndBlock(C, block);
uiDrawBlock(C, block);
diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c
index d65422ce327..a3c20ee3341 100644
--- a/source/blender/editors/space_time/space_time.c
+++ b/source/blender/editors/space_time/space_time.c
@@ -509,11 +509,16 @@ static void time_main_area_listener(ARegion *ar, wmNotifier *wmn)
break;
case NC_SCENE:
+ switch (wmn->data) {
+ case ND_FRAME:
+ case ND_FRAME_RANGE:
+ case ND_KEYINGSET:
+ case ND_RENDER_OPTIONS:
ED_region_tag_redraw(ar);
break;
-
}
}
+}
/* ************************ header time area region *********************** */
@@ -540,6 +545,7 @@ static void time_header_area_listener(ARegion *ar, wmNotifier *wmn)
case NC_SCENE:
switch (wmn->data) {
case ND_FRAME:
+ case ND_FRAME_RANGE:
case ND_KEYINGSET:
case ND_RENDER_OPTIONS:
ED_region_tag_redraw(ar);
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index b6983a8c26f..b26b2af5166 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -903,7 +903,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
if(drawcone && !v3d->transp) {
/* in this case we need to draw delayed */
- add_view3d_after(v3d, base, V3D_TRANSP, flag);
+ add_view3d_after(&v3d->afterdraw_transp, base, flag);
return;
}
@@ -2968,7 +2968,20 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
}
/* GPU_begin_object_materials checked if this is needed */
- if(do_alpha_pass) add_view3d_after(v3d, base, V3D_TRANSP, flag);
+ if(do_alpha_pass) {
+ if(ob->dtx & OB_DRAWXRAY) {
+ add_view3d_after(&v3d->afterdraw_xraytransp, base, flag);
+ }
+ else {
+ add_view3d_after(&v3d->afterdraw_transp, base, flag);
+ }
+ }
+ else if(ob->dtx & OB_DRAWXRAY && ob->dtx & OB_DRAWTRANSP) {
+ /* special case xray+transp when alpha is 1.0, without this the object vanishes */
+ if(v3d->xray == 0 && v3d->transp == 0) {
+ add_view3d_after(&v3d->afterdraw_xray, base, flag);
+ }
+ }
return retval;
}
@@ -3561,7 +3574,7 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix
add_v3_v3v3(pdd->vd, bb_center, xvec);
add_v3_v3(pdd->vd, yvec); pdd->vd+=3;
- sub_v3_v3v3(pdd->vd, bb_center, vec);
+ sub_v3_v3v3(pdd->vd, bb_center, xvec);
add_v3_v3(pdd->vd, yvec); pdd->vd+=3;
sub_v3_v3v3(pdd->vd, bb_center, xvec);
@@ -5737,7 +5750,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
if(!(ob->mode & OB_MODE_PARTICLE_EDIT)) {
/* xray and transp are set when it is drawing the 2nd/3rd pass */
if(!v3d->xray && !v3d->transp && (ob->dtx & OB_DRAWXRAY) && !(ob->dtx & OB_DRAWTRANSP)) {
- add_view3d_after(v3d, base, V3D_XRAY, flag);
+ add_view3d_after(&v3d->afterdraw_xray, base, flag);
return;
}
}
diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c
index 65786901868..f8cd34cf849 100644
--- a/source/blender/editors/space_view3d/drawvolume.c
+++ b/source/blender/editors/space_view3d/drawvolume.c
@@ -116,6 +116,7 @@ static void tend ( void )
{
gettimeofday ( &_tend,&tz );
}
+ #if 0
static double tval()
{
double t1, t2;
@@ -124,6 +125,7 @@ static double tval()
return t2-t1;
}
#endif
+#endif
struct GPUTexture;
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index ac845ec7ea3..8fbe764c633 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -270,7 +270,6 @@ static void view3d_free(SpaceLink *sl)
if(vd->localvd) MEM_freeN(vd->localvd);
if(vd->properties_storage) MEM_freeN(vd->properties_storage);
-
}
@@ -410,7 +409,6 @@ static int view3d_mat_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
static int view3d_ima_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
{
- if( ED_view3d_give_base_under_cursor(C, event->mval) ) {
if(drag->type==WM_DRAG_ID) {
ID *id= (ID *)drag->poin;
if( GS(id->name)==ID_IM )
@@ -420,6 +418,22 @@ static int view3d_ima_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
if(ELEM(drag->icon, 0, ICON_FILE_IMAGE)) /* rule might not work? */
return 1;
}
+ return 0;
+ }
+
+
+static int view3d_ima_bg_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
+{
+ if( ED_view3d_give_base_under_cursor(C, event->mval) ) {
+ return 0;
+}
+ return view3d_ima_drop_poll(C, drag, event);
+}
+
+static int view3d_ima_ob_drop_poll(bContext *C, wmDrag *drag, wmEvent *event)
+{
+ if( ED_view3d_give_base_under_cursor(C, event->mval) ) {
+ return view3d_ima_drop_poll(C, drag, event);
}
return 0;
}
@@ -462,7 +476,8 @@ static void view3d_dropboxes(void)
WM_dropbox_add(lb, "OBJECT_OT_add_named_cursor", view3d_ob_drop_poll, view3d_ob_drop_copy);
WM_dropbox_add(lb, "OBJECT_OT_drop_named_material", view3d_mat_drop_poll, view3d_id_drop_copy);
- WM_dropbox_add(lb, "MESH_OT_drop_named_image", view3d_ima_drop_poll, view3d_id_path_drop_copy);
+ WM_dropbox_add(lb, "MESH_OT_drop_named_image", view3d_ima_ob_drop_poll, view3d_id_path_drop_copy);
+ WM_dropbox_add(lb, "VIEW3D_OT_add_background_image", view3d_ima_bg_drop_poll, view3d_id_path_drop_copy);
}
@@ -514,6 +529,37 @@ static void *view3d_main_area_duplicate(void *poin)
return NULL;
}
+static void view3d_recalc_used_layers(ARegion *ar, wmNotifier *wmn)
+{
+ wmWindow *win= wmn->wm->winactive;
+ ScrArea *sa;
+
+ if (!win) return;
+
+ sa= win->screen->areabase.first;
+
+ while(sa) {
+ if(sa->spacetype == SPACE_VIEW3D)
+ if(BLI_findindex(&sa->regionbase, ar) >= 0) {
+ View3D *v3d= sa->spacedata.first;
+ Scene *scene= wmn->reference;
+ Base *base;
+
+ v3d->lay_used= 0;
+ base= scene->base.first;
+ while(base) {
+ v3d->lay_used|= base->lay;
+
+ base= base->next;
+ }
+
+ break;
+ }
+
+ sa= sa->next;
+ }
+}
+
static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
{
/* context changes */
@@ -537,6 +583,10 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
break;
case NC_SCENE:
switch(wmn->data) {
+ case ND_LAYER_CONTENT:
+ view3d_recalc_used_layers(ar, wmn);
+ ED_region_tag_redraw(ar);
+ break;
case ND_FRAME:
case ND_TRANSFORM:
case ND_OB_ACTIVE:
@@ -678,6 +728,7 @@ static void view3d_header_area_listener(ARegion *ar, wmNotifier *wmn)
case ND_MODE:
case ND_LAYER:
case ND_TOOLSETTINGS:
+ case ND_LAYER_CONTENT:
ED_region_tag_redraw(ar);
break;
}
@@ -729,6 +780,7 @@ static void view3d_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
case ND_OB_SELECT:
case ND_MODE:
case ND_LAYER:
+ case ND_LAYER_CONTENT:
ED_region_tag_redraw(ar);
break;
}
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index d56b2c35773..0dc505e0146 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -865,7 +865,7 @@ static void view3d_get_viewborder_size(Scene *scene, ARegion *ar, float size_r[2
}
}
-void calc_viewborder(Scene *scene, ARegion *ar, RegionView3D *rv3d, View3D *v3d, rctf *viewborder_r)
+void view3d_calc_camera_border(Scene *scene, ARegion *ar, RegionView3D *rv3d, View3D *v3d, rctf *viewborder_r)
{
float zoomfac, size[2];
float dx= 0.0f, dy= 0.0f;
@@ -991,7 +991,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
if(v3d->camera->type==OB_CAMERA)
ca = v3d->camera->data;
- calc_viewborder(scene, ar, rv3d, v3d, &viewborder);
+ view3d_calc_camera_border(scene, ar, rv3d, v3d, &viewborder);
/* the offsets */
x1= viewborder.xmin;
y1= viewborder.ymin;
@@ -1328,7 +1328,7 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d)
if(rv3d->persp==RV3D_CAMOB) {
rctf vb;
- calc_viewborder(scene, ar, rv3d, v3d, &vb);
+ view3d_calc_camera_border(scene, ar, rv3d, v3d, &vb);
x1= vb.xmin;
y1= vb.ymin;
@@ -1422,64 +1422,77 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d)
typedef struct View3DAfter {
struct View3DAfter *next, *prev;
struct Base *base;
- int type, flag;
+ int flag;
} View3DAfter;
/* temp storage of Objects that need to be drawn as last */
-void add_view3d_after(View3D *v3d, Base *base, int type, int flag)
+void add_view3d_after(ListBase *lb, Base *base, int flag)
{
View3DAfter *v3da= MEM_callocN(sizeof(View3DAfter), "View 3d after");
-
- BLI_addtail(&v3d->afterdraw, v3da);
+ BLI_addtail(lb, v3da);
v3da->base= base;
- v3da->type= type;
v3da->flag= flag;
}
+/* disables write in zbuffer and draws it over */
+static void view3d_draw_transp(Scene *scene, ARegion *ar, View3D *v3d)
+{
+ View3DAfter *v3da, *next;
+
+ glDepthMask(0);
+ v3d->transp= TRUE;
+
+ for(v3da= v3d->afterdraw_transp.first; v3da; v3da= next) {
+ next= v3da->next;
+ draw_object(scene, ar, v3d, v3da->base, v3da->flag);
+ BLI_remlink(&v3d->afterdraw_transp, v3da);
+ MEM_freeN(v3da);
+ }
+ v3d->transp= FALSE;
+
+ glDepthMask(1);
+
+}
+
/* clears zbuffer and draws it over */
static void view3d_draw_xray(Scene *scene, ARegion *ar, View3D *v3d, int clear)
{
View3DAfter *v3da, *next;
- int doit= 0;
- for(v3da= v3d->afterdraw.first; v3da; v3da= v3da->next)
- if(v3da->type==V3D_XRAY) doit= 1;
+ if(clear && v3d->zbuf)
+ glClear(GL_DEPTH_BUFFER_BIT);
- if(doit) {
- if(clear && v3d->zbuf) glClear(GL_DEPTH_BUFFER_BIT);
v3d->xray= TRUE;
-
- for(v3da= v3d->afterdraw.first; v3da; v3da= next) {
+ for(v3da= v3d->afterdraw_xray.first; v3da; v3da= next) {
next= v3da->next;
- if(v3da->type==V3D_XRAY) {
draw_object(scene, ar, v3d, v3da->base, v3da->flag);
- BLI_remlink(&v3d->afterdraw, v3da);
+ BLI_remlink(&v3d->afterdraw_xray, v3da);
MEM_freeN(v3da);
}
- }
v3d->xray= FALSE;
}
-}
-/* disables write in zbuffer and draws it over */
-static void view3d_draw_transp(Scene *scene, ARegion *ar, View3D *v3d)
+
+/* clears zbuffer and draws it over */
+static void view3d_draw_xraytransp(Scene *scene, ARegion *ar, View3D *v3d, int clear)
{
View3DAfter *v3da, *next;
- glDepthMask(0);
+ if(clear && v3d->zbuf)
+ glClear(GL_DEPTH_BUFFER_BIT);
+
+ v3d->xray= TRUE;
v3d->transp= TRUE;
- for(v3da= v3d->afterdraw.first; v3da; v3da= next) {
+ for(v3da= v3d->afterdraw_xraytransp.first; v3da; v3da= next) {
next= v3da->next;
- if(v3da->type==V3D_TRANSP) {
draw_object(scene, ar, v3d, v3da->base, v3da->flag);
- BLI_remlink(&v3d->afterdraw, v3da);
+ BLI_remlink(&v3d->afterdraw_xraytransp, v3da);
MEM_freeN(v3da);
}
- }
+
v3d->transp= FALSE;
-
- glDepthMask(1);
+ v3d->xray= FALSE;
}
@@ -1675,7 +1688,7 @@ void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d)
v3d->zbuf= TRUE;
glEnable(GL_DEPTH_TEST);
- draw_gpencil_view3d_ext(scene, ar, 1);
+ draw_gpencil_view3d_ext(scene, v3d, ar, 1);
v3d->zbuf= zbuf;
@@ -1743,39 +1756,57 @@ void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (* func)(void *))
}
/* this isnt that nice, draw xray objects as if they are normal */
- if (v3d->afterdraw.first) {
+ if ( v3d->afterdraw_transp.first ||
+ v3d->afterdraw_xray.first ||
+ v3d->afterdraw_xraytransp.first
+ ) {
View3DAfter *v3da, *next;
- int num = 0;
int mask_orig;
+
v3d->xray= TRUE;
/* transp materials can change the depth mask, see #21388 */
glGetIntegerv(GL_DEPTH_WRITEMASK, &mask_orig);
+
+ if(v3d->afterdraw_xray.first || v3d->afterdraw_xraytransp.first) {
glDepthFunc(GL_ALWAYS); /* always write into the depth bufer, overwriting front z values */
- for(v3da= v3d->afterdraw.first; v3da; v3da= next) {
+ for(v3da= v3d->afterdraw_xray.first; v3da; v3da= next) {
next= v3da->next;
- if(v3da->type==V3D_XRAY) {
draw_object(scene, ar, v3d, v3da->base, 0);
- num++;
}
- /* dont remove this time */
+ glDepthFunc(GL_LEQUAL); /* Now write the depth buffer normally */
}
+
+ /* draw 3 passes, transp/xray/xraytransp */
v3d->xray= FALSE;
+ v3d->transp= TRUE;
+ for(v3da= v3d->afterdraw_transp.first; v3da; v3da= next) {
+ next= v3da->next;
+ draw_object(scene, ar, v3d, v3da->base, 0);
+ BLI_remlink(&v3d->afterdraw_transp, v3da);
+ MEM_freeN(v3da);
+ }
- glDepthFunc(GL_LEQUAL); /* Now write the depth buffer normally */
- for(v3da= v3d->afterdraw.first; v3da; v3da= next) {
+ v3d->xray= TRUE;
+ v3d->transp= FALSE;
+ for(v3da= v3d->afterdraw_xray.first; v3da; v3da= next) {
next= v3da->next;
- if(v3da->type==V3D_XRAY) {
- v3d->xray= TRUE; v3d->transp= FALSE;
- } else if (v3da->type==V3D_TRANSP) {
- v3d->xray= FALSE; v3d->transp= TRUE;
+ draw_object(scene, ar, v3d, v3da->base, 0);
+ BLI_remlink(&v3d->afterdraw_xray, v3da);
+ MEM_freeN(v3da);
}
- draw_object(scene, ar, v3d, v3da->base, 0); /* Draw Xray or Transp objects normally */
- BLI_remlink(&v3d->afterdraw, v3da);
+ v3d->xray= TRUE;
+ v3d->transp= TRUE;
+ for(v3da= v3d->afterdraw_xraytransp.first; v3da; v3da= next) {
+ next= v3da->next;
+ draw_object(scene, ar, v3d, v3da->base, 0);
+ BLI_remlink(&v3d->afterdraw_xraytransp, v3da);
MEM_freeN(v3da);
}
+
+
v3d->xray= FALSE;
v3d->transp= FALSE;
@@ -1979,14 +2010,22 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
Base *base;
float backcol[3];
int bwinx, bwiny;
+ rcti brect;
glPushMatrix();
/* set temporary new size */
bwinx= ar->winx;
bwiny= ar->winy;
+ brect= ar->winrct;
+
ar->winx= winx;
ar->winy= winy;
+ ar->winrct.xmin= 0;
+ ar->winrct.ymin= 0;
+ ar->winrct.xmax= winx;
+ ar->winrct.ymax= winy;
+
/* set flags */
G.f |= G_RENDER_OGL;
@@ -2045,8 +2084,9 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
}
/* transp and X-ray afterdraw stuff */
- view3d_draw_transp(scene, ar, v3d);
- view3d_draw_xray(scene, ar, v3d, 1); // clears zbuffer if it is used!
+ if(v3d->afterdraw_transp.first) view3d_draw_transp(scene, ar, v3d);
+ if(v3d->afterdraw_xray.first) view3d_draw_xray(scene, ar, v3d, 1); // clears zbuffer if it is used!
+ if(v3d->afterdraw_xraytransp.first) view3d_draw_xraytransp(scene, ar, v3d, 1);
/* cleanup */
if(v3d->zbuf) {
@@ -2055,12 +2095,12 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
}
/* draw grease-pencil stuff */
- draw_gpencil_view3d_ext(scene, ar, 1);
+ draw_gpencil_view3d_ext(scene, v3d, ar, 1);
ED_region_pixelspace(ar);
/* draw grease-pencil stuff - needed to get paint-buffer shown too (since it's 2D) */
- draw_gpencil_view3d_ext(scene, ar, 0);
+ draw_gpencil_view3d_ext(scene, v3d, ar, 0);
/* freeing the images again here could be done after the operator runs, leaving for now */
GPU_free_images_anim();
@@ -2068,6 +2108,7 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
/* restore size */
ar->winx= bwinx;
ar->winy= bwiny;
+ ar->winrct = brect;
glPopMatrix();
@@ -2077,7 +2118,7 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
}
/* utility func for ED_view3d_draw_offscreen */
-ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, int sizex, int sizey)
+ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, int sizex, int sizey, unsigned int flag)
{
RegionView3D *rv3d= ar->regiondata;
ImBuf *ibuf;
@@ -2105,7 +2146,11 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in
}
/* read in pixels & stamp */
- ibuf= IMB_allocImBuf(sizex, sizey, 24, IB_rect, 0);
+ ibuf= IMB_allocImBuf(sizex, sizey, 32, flag, 0);
+
+ if(ibuf->rect_float)
+ glReadPixels(0, 0, sizex, sizey, GL_RGBA, GL_FLOAT, ibuf->rect_float);
+ else if(ibuf->rect)
glReadPixels(0, 0, sizex, sizey, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
//if((scene->r.stamp & R_STAMP_ALL) && (scene->r.stamp & R_STAMP_DRAW))
@@ -2115,11 +2160,14 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in
GPU_offscreen_unbind(ofs);
GPU_offscreen_free(ofs);
+ if(ibuf->rect_float && ibuf->rect)
+ IMB_rect_from_float(ibuf);
+
return ibuf;
}
/* creates own 3d views, used by the sequencer */
-ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height, int drawtype)
+ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height, unsigned int flag, int drawtype)
{
View3D v3d;
ARegion ar;
@@ -2154,7 +2202,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height
mul_m4_m4m4(rv3d.persmat, rv3d.viewmat, rv3d.winmat);
invert_m4_m4(rv3d.persinv, rv3d.viewinv);
- return ED_view3d_draw_offscreen_imbuf(scene, &v3d, &ar, width, height);
+ return ED_view3d_draw_offscreen_imbuf(scene, &v3d, &ar, width, height, flag);
// seq_view3d_cb(scene, cfra, render_size, seqrectx, seqrecty);
}
@@ -2323,13 +2371,8 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
/* Transp and X-ray afterdraw stuff for sets is done later */
}
- /* extra service in layerbuttons, showing used layers */
- v3d->lay_used = 0;
-
/* then draw not selected and the duplis, but skip editmode object */
for(base= scene->base.first; base; base= base->next) {
- v3d->lay_used |= base->lay;
-
if(v3d->lay & base->lay) {
/* dupli drawing */
@@ -2363,8 +2406,9 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
// REEB_draw();
/* Transp and X-ray afterdraw stuff */
- view3d_draw_transp(scene, ar, v3d);
- view3d_draw_xray(scene, ar, v3d, 1); // clears zbuffer if it is used!
+ if(v3d->afterdraw_transp.first) view3d_draw_transp(scene, ar, v3d);
+ if(v3d->afterdraw_xray.first) view3d_draw_xray(scene, ar, v3d, 1); // clears zbuffer if it is used!
+ if(v3d->afterdraw_xraytransp.first) view3d_draw_xraytransp(scene, ar, v3d, 1);
ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 3dfa62215ed..6d09da2dbcf 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -42,6 +42,8 @@
#include "BLI_rand.h"
#include "BKE_context.h"
+#include "BKE_image.h"
+#include "BKE_library.h"
#include "BKE_object.h"
#include "BKE_paint.h"
#include "BKE_report.h"
@@ -1605,7 +1607,7 @@ static int render_border_exec(bContext *C, wmOperator *op)
rect.ymax= RNA_int_get(op->ptr, "ymax");
/* calculate range */
- calc_viewborder(scene, ar, rv3d, v3d, &vb);
+ view3d_calc_camera_border(scene, ar, rv3d, v3d, &vb);
scene->r.border.xmin= ((float)rect.xmin-vb.xmin)/(vb.xmax-vb.xmin);
scene->r.border.ymin= ((float)rect.ymin-vb.ymin)/(vb.ymax-vb.ymin);
@@ -2200,7 +2202,7 @@ void VIEW3D_OT_view_persportho(wmOperatorType *ot)
/* ******************** add background image operator **************** */
-static int add_background_image_exec(bContext *C, wmOperator *op)
+static BGpic *add_background_image(bContext *C)
{
View3D *v3d= CTX_wm_view3d(C);
@@ -2213,14 +2215,51 @@ static int add_background_image_exec(bContext *C, wmOperator *op)
BLI_addtail(&v3d->bgpicbase, bgpic);
- //ED_region_tag_redraw(v3d);
+ return bgpic;
+}
+
+static int add_background_image_exec(bContext *C, wmOperator *op)
+{
+ add_background_image(C);
return OPERATOR_FINISHED;
}
static int add_background_image_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- return add_background_image_exec(C, op);
+ Scene *scene= CTX_data_scene(C);
+ View3D *v3d= CTX_wm_view3d(C);
+ Image *ima= NULL;
+ BGpic *bgpic;
+ char name[32];
+
+ /* check input variables */
+ if(RNA_property_is_set(op->ptr, "filepath")) {
+ char path[FILE_MAX];
+
+ RNA_string_get(op->ptr, "filepath", path);
+ ima= BKE_add_image_file(path, scene ? scene->r.cfra : 1);
+}
+ else if(RNA_property_is_set(op->ptr, "name")) {
+ RNA_string_get(op->ptr, "name", name);
+ ima= (Image *)find_id("IM", name);
+ }
+
+ bgpic = add_background_image(C);
+
+ if (ima) {
+ bgpic->ima = ima;
+
+ if(ima->id.us==0) id_us_plus(&ima->id);
+ else id_lib_extern(&ima->id);
+
+ if (!(v3d->flag & V3D_DISPBGPICS))
+ v3d->flag |= V3D_DISPBGPICS;
+ }
+
+ WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, v3d);
+
+ return OPERATOR_FINISHED;
}
void VIEW3D_OT_add_background_image(wmOperatorType *ot)
@@ -2237,8 +2276,13 @@ void VIEW3D_OT_add_background_image(wmOperatorType *ot)
/* flags */
ot->flag = 0;
+
+ /* properties */
+ RNA_def_string(ot->srna, "name", "Image", 24, "Name", "Image name to assign.");
+ RNA_def_string(ot->srna, "filepath", "Path", FILE_MAX, "Filepath", "Path to image file");
}
+
/* ***** remove image operator ******* */
static int remove_background_image_exec(bContext *C, wmOperator *op)
{
@@ -2274,6 +2318,7 @@ void VIEW3D_OT_remove_background_image(wmOperatorType *ot)
RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "Background image index to remove ", 0, INT_MAX);
}
+
/* ********************* set clipping operator ****************** */
static void calc_clipping_plane(float clip[6][4], BoundBox *clipbb)
diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h
index 173d8256269..7a45a43ddd4 100644
--- a/source/blender/editors/space_view3d/view3d_intern.h
+++ b/source/blender/editors/space_view3d/view3d_intern.h
@@ -56,6 +56,7 @@ struct bMotionPath;
#define V3D_XRAY 1
#define V3D_TRANSP 2
+#define V3D_XRAYTRANSP 4
#define V3D_SELECT_MOUSE 1
@@ -125,8 +126,7 @@ void draw_depth(Scene *scene, struct ARegion *ar, View3D *v3d, int (* func)(void
void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d);
void view3d_clr_clipping(void);
void view3d_set_clipping(RegionView3D *rv3d);
-void add_view3d_after(View3D *v3d, Base *base, int type, int flag);
-void calc_viewborder(Scene *scene, struct ARegion *ar, struct RegionView3D *rv3d, View3D *v3d, rctf *viewborder_r);
+void add_view3d_after(ListBase *lb, Base *base, int flag);
void circf(float x, float y, float rad);
void circ(float x, float y, float rad);
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 04a4167175c..64289f9bd0a 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -403,6 +403,10 @@ static int view3d_setcameratoview_exec(bContext *C, wmOperator *op)
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d= CTX_wm_region_view3d(C);
+ copy_qt_qt(rv3d->lviewquat, rv3d->viewquat);
+ rv3d->lview= rv3d->view;
+ rv3d->lpersp= rv3d->persp;
+
setcameratoview3d(v3d, rv3d, v3d->camera);
rv3d->persp = RV3D_CAMOB;
@@ -1805,7 +1809,7 @@ static int game_engine_exec(bContext *C, wmOperator *op)
if(rv3d->persp==RV3D_CAMOB && startscene->gm.framing.type == SCE_GAMEFRAMING_BARS && startscene->gm.stereoflag != STEREO_DOME) { /* Letterbox */
rctf cam_framef;
- calc_viewborder(startscene, ar, rv3d, CTX_wm_view3d(C), &cam_framef);
+ view3d_calc_camera_border(startscene, ar, rv3d, CTX_wm_view3d(C), &cam_framef);
cam_frame.xmin = cam_framef.xmin + ar->winrct.xmin;
cam_frame.xmax = cam_framef.xmax + ar->winrct.xmin;
cam_frame.ymin = cam_framef.ymin + ar->winrct.ymin;
diff --git a/source/blender/editors/transform/SConscript b/source/blender/editors/transform/SConscript
index 9e5244f8577..173eb8ce31d 100644
--- a/source/blender/editors/transform/SConscript
+++ b/source/blender/editors/transform/SConscript
@@ -8,4 +8,4 @@ incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
incs += ' ../../render/extern/include'
incs += ' ../../gpu ../../makesrna ../../bmesh'
-env.BlenderLib ( 'bf_editors_transform', sources, Split(incs), [], libtype=['core'], priority=[40] ) \ No newline at end of file
+env.BlenderLib ( 'bf_editors_transform', sources, Split(incs), [], libtype=['core'], priority=[40] )
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 8c08b71eacd..08ae8ff10a1 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -3524,7 +3524,7 @@ void initTilt(TransInfo *t)
t->num.increment = t->snap[1];
- t->flag |= T_NO_CONSTRAINT;
+ t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT;
}
@@ -4134,7 +4134,7 @@ void initBoneEnvelope(TransInfo *t)
t->num.increment = t->snap[1];
- t->flag |= T_NO_CONSTRAINT;
+ t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT;
}
int BoneEnvelope(TransInfo *t, short mval[2])
@@ -5229,7 +5229,7 @@ void initBoneRoll(TransInfo *t)
t->num.increment = 1.0f;
- t->flag |= T_NO_CONSTRAINT;
+ t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT;
}
int BoneRoll(TransInfo *t, short mval[2])
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index 4cecc41ae5f..b2d6fe4ea34 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -465,7 +465,7 @@ void TRANSFORM_OT_translate(struct wmOperatorType *ot)
ot->cancel = transform_cancel;
ot->poll = ED_operator_areaactive;
- RNA_def_float_vector(ot->srna, "value", 3, NULL, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX);
+ RNA_def_float_vector_xyz(ot->srna, "value", 3, NULL, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX);
Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_ALIGN_SNAP);
}
@@ -851,7 +851,7 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
km = WM_keymap_add_item(keymap, OP_MIRROR, MKEY, KM_PRESS, KM_CTRL, 0);
km = WM_keymap_add_item(keymap, "WM_OT_context_toggle", TABKEY, KM_PRESS, KM_SHIFT, 0);
- RNA_string_set(km->ptr, "data_path", "tool_settings.snap");
+ RNA_string_set(km->ptr, "data_path", "tool_settings.use_snap");
km = WM_keymap_add_item(keymap, "TRANSFORM_OT_snap_type", TABKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
@@ -929,7 +929,7 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
km = WM_keymap_add_item(keymap, "TRANSFORM_OT_mirror", MKEY, KM_PRESS, KM_CTRL, 0);
km = WM_keymap_add_item(keymap, "WM_OT_context_toggle", TABKEY, KM_PRESS, KM_SHIFT, 0);
- RNA_string_set(km->ptr, "data_path", "tool_settings.snap");
+ RNA_string_set(km->ptr, "data_path", "tool_settings.use_snap");
break;
default:
break;
diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c
index 283e2b49f0d..e5128ea784a 100644
--- a/source/blender/editors/util/undo.c
+++ b/source/blender/editors/util/undo.c
@@ -163,6 +163,8 @@ static int ed_undo_step(bContext *C, int step, const char *undoname)
BKE_undo_name(C, undoname);
else
BKE_undo_step(C, step);
+
+ WM_event_add_notifier(C, NC_SCENE|ND_LAYER_CONTENT, CTX_data_scene(C));
}
}
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index 46b520be61e..524c05fdc73 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -148,6 +148,9 @@ void GPU_buffer_pool_free(GPUBufferPool *pool)
MEM_freeN(pool->buffers);
MEM_freeN(pool);
+ /* if we are releasing the global pool, stop keeping a reference to it */
+ if (pool == globalPool)
+ globalPool = NULL;
}
void GPU_buffer_pool_free_unused(GPUBufferPool *pool)
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c
index 3bf1880cf69..d14070a4c24 100644
--- a/source/blender/gpu/intern/gpu_draw.c
+++ b/source/blender/gpu/intern/gpu_draw.c
@@ -861,7 +861,7 @@ void GPU_free_images_anim(void)
if(G.main)
for(ima=G.main->image.first; ima; ima=ima->id.next)
- if(ELEM(ima->type, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE))
+ if(ELEM(ima->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE))
GPU_free_image(ima);
}
diff --git a/source/blender/imbuf/intern/cineon/cineon_dpx.c b/source/blender/imbuf/intern/cineon/cineon_dpx.c
index aa1b8ca3447..a9b229536cb 100644
--- a/source/blender/imbuf/intern/cineon/cineon_dpx.c
+++ b/source/blender/imbuf/intern/cineon/cineon_dpx.c
@@ -53,7 +53,7 @@ static void cineon_conversion_parameters(LogImageByteConversionParameters *param
params->blackPoint = 95;
params->whitePoint = 685;
- params->gamma = 1.7f;
+ params->gamma = 1.0f;
params->doLogarithm = 0;
}
diff --git a/source/blender/imbuf/intern/scaling.c b/source/blender/imbuf/intern/scaling.c
index f26eec51b03..0b8dea01ada 100644
--- a/source/blender/imbuf/intern/scaling.c
+++ b/source/blender/imbuf/intern/scaling.c
@@ -960,7 +960,7 @@ static struct ImBuf *scaledowny(struct ImBuf *ibuf, int newy)
}
if (ibuf->rect_float) {
do_float = 1;
- _newrectf = MEM_mallocN(newy * ibuf->x * sizeof(float) * 4, "scaldownyf");
+ _newrectf = MEM_mallocN(newy * ibuf->x * sizeof(float) * 4, "scaledownyf");
if (_newrectf==NULL) {
if (_newrect) MEM_freeN(_newrect);
return(ibuf);
diff --git a/source/blender/imbuf/intern/thumbs_blend.c b/source/blender/imbuf/intern/thumbs_blend.c
index cb27b1a647f..2fef230f1c2 100644
--- a/source/blender/imbuf/intern/thumbs_blend.c
+++ b/source/blender/imbuf/intern/thumbs_blend.c
@@ -97,7 +97,7 @@ static ImBuf *loadblend_thumb(gzFile gzfile)
/* length */
bhead[1] -= sizeof(int) * 2;
- /* inconsistant image size, quit early */
+ /* inconsistent image size, quit early */
if(bhead[1] != size[0] * size[1] * sizeof(int))
return NULL;
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index e3ac90bf881..fe422bfa689 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -255,6 +255,7 @@ typedef struct NodeChroma {
typedef struct NodeTwoXYs {
short x1, x2, y1, y2;
+ float fac_x1, fac_x2, fac_y1, fac_y2;
} NodeTwoXYs;
typedef struct NodeTwoFloats {
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 096fd319a17..1d3a2c1059c 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -402,6 +402,7 @@ extern Object workob;
#define OB_BOUND_POLYH 4
#define OB_BOUND_POLYT 5
#define OB_BOUND_DYN_MESH 6
+#define OB_BOUND_CAPSULE 7
/* **************** BASE ********************* */
@@ -564,4 +565,3 @@ typedef enum ObjectMode {
#endif
-
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 97dd99c5abe..153b6acd525 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -380,6 +380,8 @@ typedef struct UserDef {
float sculpt_paint_overlay_col[3];
int pad3;
+
+ char author[80]; /* author name for file formats supporting it */
} UserDef;
extern UserDef U; /* from blenkernel blender.c */
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index c5516a3bff5..520fc56162c 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -185,7 +185,9 @@ typedef struct View3D {
unsigned int customdata_mask;
/* afterdraw, for xray & transparent */
- struct ListBase afterdraw;
+ struct ListBase afterdraw_transp;
+ struct ListBase afterdraw_xray;
+ struct ListBase afterdraw_xraytransp;
/* drawflags, denoting state */
short zbuf, transp, xray;
diff --git a/source/blender/makesdna/intern/SConscript b/source/blender/makesdna/intern/SConscript
index 897e7c3702b..ac897eaed14 100644
--- a/source/blender/makesdna/intern/SConscript
+++ b/source/blender/makesdna/intern/SConscript
@@ -51,7 +51,7 @@ if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
targetdir = '#' + targetdir
#root_build_dir = "#"
-makesdna = makesdna_tool.Program (target = targetdir, source = source_files, LIBS=['bf_guardedalloc', 'bf_blenlib'])
+makesdna = makesdna_tool.Program (target = targetdir, source = source_files, LIBS=['bf_intern_guardedalloc', 'bf_blenlib'])
dna_dict = dna.Dictionary()
dna.Depends ('dna.c', makesdna)
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index 4133afffeed..7a2d659755a 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -972,6 +972,8 @@ int make_structDNA(char *baseDirectory, FILE *file)
dna_write(file, str, 4);
len= nr_names;
dna_write(file, &len, 4);
+ printf("LEEEN %d\n", len);
+
/* calculate size of datablock with strings */
cp= names[nr_names-1];
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 43697ec5d9e..e454dda0ae6 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -276,7 +276,7 @@ extern StructRNA RNA_LimitScaleConstraint;
extern StructRNA RNA_LockedTrackConstraint;
extern StructRNA RNA_Macro;
extern StructRNA RNA_MagicTexture;
-extern StructRNA RNA_Main;
+extern StructRNA RNA_BlendData;
extern StructRNA RNA_MarbleTexture;
extern StructRNA RNA_MaskModifier;
extern StructRNA RNA_Material;
diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h
index f6ae5dcdbbd..6422950b5e4 100644
--- a/source/blender/makesrna/RNA_define.h
+++ b/source/blender/makesrna/RNA_define.h
@@ -90,6 +90,7 @@ void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc);
PropertyRNA *RNA_def_float(StructOrFunctionRNA *cont, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax);
PropertyRNA *RNA_def_float_vector(StructOrFunctionRNA *cont, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax);
+PropertyRNA *RNA_def_float_vector_xyz(StructOrFunctionRNA *cont, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax);
PropertyRNA *RNA_def_float_color(StructOrFunctionRNA *cont, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax);
PropertyRNA *RNA_def_float_matrix(StructOrFunctionRNA *cont, const char *identifier, int rows, int columns, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax);
PropertyRNA *RNA_def_float_rotation(StructOrFunctionRNA *cont, const char *identifier, int len, const float *default_value,
diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h
index 887069d6c00..5caae56010f 100644
--- a/source/blender/makesrna/RNA_types.h
+++ b/source/blender/makesrna/RNA_types.h
@@ -22,6 +22,8 @@
* ***** END GPL LICENSE BLOCK *****
*/
+#include "BLO_sys_types.h"
+
#ifndef RNA_TYPES
#define RNA_TYPES
@@ -265,6 +267,12 @@ typedef struct ParameterIterator {
int valid;
} ParameterIterator;
+/* mainly to avoid confusing casts */
+typedef struct ParameterDynAlloc {
+ intptr_t array_tot; /* important, this breaks when set to an int */
+ void *array;
+} ParameterDynAlloc;
+
/* Function */
typedef enum FunctionFlag {
diff --git a/source/blender/makesrna/intern/SConscript b/source/blender/makesrna/intern/SConscript
index cdb9cdd3126..88b29e10d1d 100644
--- a/source/blender/makesrna/intern/SConscript
+++ b/source/blender/makesrna/intern/SConscript
@@ -138,9 +138,9 @@ if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
targetpath = '#' + targetpath
if env['OURPLATFORM'] == 'linux2' and root_build_dir[0]==os.sep:
- makesrna = makesrna_tool.Program (target = targetpath, source = source_files, LIBS=['bf_guardedalloc', 'bf_dna', 'bf_blenlib'])
+ makesrna = makesrna_tool.Program (target = targetpath, source = source_files, LIBS=['bf_intern_guardedalloc', 'bf_dna', 'bf_blenlib'])
else:
- makesrna = makesrna_tool.Program (target = targetpath, source = source_files, LIBS=['bf_guardedalloc', 'bf_dna', 'bf_blenlib'])
+ makesrna = makesrna_tool.Program (target = targetpath, source = source_files, LIBS=['bf_intern_guardedalloc', 'bf_dna', 'bf_blenlib'])
rna_dict = rna.Dictionary()
rna.Depends (generated_files, makesrna)
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index af0faf5a165..68414eae3f8 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -49,6 +49,7 @@
static int replace_if_different(char *tmpfile)
{
+ // return 0; // use for testing had edited rna
#define REN_IF_DIFF \
remove(orgfile); \
@@ -1412,10 +1413,12 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
fprintf(f, "\n{\n");
/* variable definitions */
- if((func->flag & FUNC_NO_SELF)==0) {
- if(func->flag & FUNC_USE_SELF_ID)
+
+ if(func->flag & FUNC_USE_SELF_ID) {
fprintf(f, "\tstruct ID *_selfid;\n");
+ }
+ if((func->flag & FUNC_NO_SELF)==0) {
if(dsrna->dnaname) fprintf(f, "\tstruct %s *_self;\n", dsrna->dnaname);
else fprintf(f, "\tstruct %s *_self;\n", srna->identifier);
}
@@ -1441,11 +1444,11 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
else
ptrstr= pout ? "*" : "";
- fprintf(f, "\t%s%s %s%s;\n", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), ptrstr, dparm->prop->identifier);
-
/* for dynamic parameters we pass an additional int for the length of the parameter */
if (flag & PROP_DYNAMIC)
fprintf(f, "\tint %s%s_len;\n", pout ? "*" : "", dparm->prop->identifier);
+
+ fprintf(f, "\t%s%s %s%s;\n", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), ptrstr, dparm->prop->identifier);
}
fprintf(f, "\tchar *_data");
@@ -1454,10 +1457,11 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
fprintf(f, "\t\n");
/* assign self */
- if((func->flag & FUNC_NO_SELF)==0) {
- if(func->flag & FUNC_USE_SELF_ID)
+ if(func->flag & FUNC_USE_SELF_ID) {
fprintf(f, "\t_selfid= (struct ID*)_ptr->id.data;\n");
+ }
+ if((func->flag & FUNC_NO_SELF)==0) {
if(dsrna->dnaname) fprintf(f, "\t_self= (struct %s *)_ptr->data;\n", dsrna->dnaname);
else fprintf(f, "\t_self= (struct %s *)_ptr->data;\n", srna->identifier);
}
@@ -1474,6 +1478,7 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
if(dparm->prop==func->c_ret)
fprintf(f, "\t_retdata= _data;\n");
else {
+ char *data_str;
if (cptr || (flag & PROP_DYNAMIC)) {
ptrstr= "**";
valstr= "*";
@@ -1491,16 +1496,20 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
valstr= "*";
}
+ /* this must be kept in sync with RNA_parameter_length_get_data, we could just call the function directly, but this is faster */
+ if (flag & PROP_DYNAMIC) {
+ fprintf(f, "\t%s_len= %s((int *)_data);\n", dparm->prop->identifier, pout ? "" : "*");
+ data_str= "(&(((char *)_data)[sizeof(void *)]))";
+ }
+ else {
+ data_str= "_data";
+ }
fprintf(f, "\t%s= ", dparm->prop->identifier);
if (!pout)
fprintf(f, "%s", valstr);
- fprintf(f, "((%s%s%s)_data);\n", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), ptrstr);
-
- /* this must be kept in sync with RNA_parameter_length_get_data, we could just call the function directly, but this is faster */
- if (flag & PROP_DYNAMIC)
- fprintf(f, "\t%s_len= %s((int *)(_data+%d));\n", dparm->prop->identifier, pout ? "" : "*", rna_parameter_size(dparm->prop));
+ fprintf(f, "((%s%s%s)%s);\n", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), ptrstr, data_str);
}
if(dparm->next)
@@ -1515,10 +1524,13 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
first= 1;
- if((func->flag & FUNC_NO_SELF)==0) {
- if(func->flag & FUNC_USE_SELF_ID)
- fprintf(f, "_selfid, ");
+ if(func->flag & FUNC_USE_SELF_ID) {
+ fprintf(f, "_selfid");
+ first= 0;
+ }
+ if((func->flag & FUNC_NO_SELF)==0) {
+ if(!first) fprintf(f, ", ");
fprintf(f, "_self");
first= 0;
}
@@ -1543,10 +1555,10 @@ static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA
if(!first) fprintf(f, ", ");
first= 0;
- fprintf(f, "%s", dparm->prop->identifier);
-
if (dparm->prop->flag & PROP_DYNAMIC)
- fprintf(f, ", %s_len", dparm->prop->identifier);
+ fprintf(f, "%s_len, %s", dparm->prop->identifier, dparm->prop->identifier);
+ else
+ fprintf(f, "%s", dparm->prop->identifier);
}
fprintf(f, ");\n");
@@ -1820,10 +1832,13 @@ static void rna_generate_static_parameter_prototypes(BlenderRNA *brna, StructRNA
first= 1;
/* self, context and reports parameters */
+ if(func->flag & FUNC_USE_SELF_ID) {
+ fprintf(f, "struct ID *_selfid");
+ first= 0;
+ }
+
if((func->flag & FUNC_NO_SELF)==0) {
- if(func->flag & FUNC_USE_SELF_ID)
- fprintf(f, "struct ID *_selfid, ");
-
+ if(!first) fprintf(f, ", ");
if(dsrna->dnaname) fprintf(f, "struct %s *_self", dsrna->dnaname);
else fprintf(f, "struct %s *_self", srna->identifier);
first= 0;
@@ -1863,13 +1878,14 @@ static void rna_generate_static_parameter_prototypes(BlenderRNA *brna, StructRNA
if(!first) fprintf(f, ", ");
first= 0;
+ if (flag & PROP_DYNAMIC)
+ fprintf(f, "int %s%s_len, ", pout ? "*" : "", dparm->prop->identifier);
+
if(!(flag & PROP_DYNAMIC) && dparm->prop->arraydimension)
fprintf(f, "%s%s %s[%d]", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), dparm->prop->identifier, dparm->prop->totarraylength);
else
fprintf(f, "%s%s %s%s", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop), ptrstr, dparm->prop->identifier);
- if (flag & PROP_DYNAMIC)
- fprintf(f, ", int %s%s_len", pout ? "*" : "", dparm->prop->identifier);
}
fprintf(f, ");\n");
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index a8b7fb1540b..b9ef92cdca1 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -71,6 +71,7 @@ EnumPropertyItem id_type_items[] = {
#include "BKE_idprop.h"
#include "BKE_library.h"
#include "BKE_animsys.h"
+#include "BKE_material.h"
/* name functions that ignore the first two ID characters */
void rna_ID_name_get(PointerRNA *ptr, char *value)
@@ -331,6 +332,31 @@ static void rna_def_ID_properties(BlenderRNA *brna)
RNA_def_struct_name_property(srna, prop);
}
+
+static void rna_def_ID_materials(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ /* for mesh/mball/curve materials */
+ srna= RNA_def_struct(brna, "IDMaterials", NULL);
+ RNA_def_struct_sdna(srna, "ID");
+ RNA_def_struct_ui_text(srna, "ID Materials", "Collection of materials");
+
+ func= RNA_def_function(srna, "append", "material_append_id");
+ RNA_def_function_ui_description(func, "Add a new material to Mesh.");
+ parm= RNA_def_pointer(func, "material", "Material", "", "Material to add.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+
+ func= RNA_def_function(srna, "pop", "material_pop_id");
+ RNA_def_function_ui_description(func, "Add a new material to Mesh.");
+ parm= RNA_def_int(func, "index", 0, 0, INT_MAX, "", "Frame number to set.", 0, INT_MAX);
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_pointer(func, "material", "Material", "", "Material to add.");
+ RNA_def_function_return(func, parm);
+}
+
static void rna_def_ID(BlenderRNA *brna)
{
StructRNA *srna;
@@ -422,6 +448,7 @@ void RNA_def_ID(BlenderRNA *brna)
rna_def_ID(brna);
rna_def_ID_properties(brna);
+ rna_def_ID_materials(brna);
rna_def_library(brna);
}
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index 73af75ca960..2d39cac8c6d 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -95,7 +95,7 @@ PointerRNA PointerRNA_NULL = {{0}, 0, 0};
void RNA_main_pointer_create(struct Main *main, PointerRNA *r_ptr)
{
r_ptr->id.data= NULL;
- r_ptr->type= &RNA_Main;
+ r_ptr->type= &RNA_BlendData;
r_ptr->data= main;
}
@@ -732,7 +732,7 @@ char RNA_property_array_item_char(PropertyRNA *prop, int index)
/* get string to use for array index */
if ((index < 4) && ELEM(subtype, PROP_QUATERNION, PROP_AXISANGLE))
return quatitem[index];
- else if((index < 4) && ELEM6(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ, PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION))
+ else if((index < 4) && ELEM7(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ, PROP_XYZ_LENGTH, PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION))
return vectoritem[index];
else if ((index < 4) && ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA))
return coloritem[index];
@@ -2949,7 +2949,7 @@ int RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr,
PropertyRNA *prop;
PointerRNA curptr, nextptr;
char fixedbuf[256], *token;
- int type, len, intkey;
+ int type, intkey;
prop= NULL;
curptr= *ptr;
@@ -2993,22 +2993,23 @@ int RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr,
case PROP_POINTER:
nextptr= RNA_property_pointer_get(&curptr, prop);
- if(nextptr.data)
+ if(nextptr.data) {
curptr= nextptr;
+ prop= NULL; /* now we have a PointerRNA, the prop is our parent so forget it */
+ }
else
return 0;
break;
case PROP_COLLECTION:
if(*path) {
+ if(*path == '[') {
/* resolve the lookup with [] brackets */
token= rna_path_token(&path, fixedbuf, sizeof(fixedbuf), 1);
if(!token)
return 0;
- len= strlen(token);
-
/* check for "" to see if it is a string */
if(rna_token_strip_quotes(token)) {
RNA_property_collection_lookup_string(&curptr, prop, token+1, &nextptr);
@@ -3019,11 +3020,25 @@ int RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr,
RNA_property_collection_lookup_int(&curptr, prop, intkey, &nextptr);
}
- if(token != fixedbuf)
+ if(token != fixedbuf) {
MEM_freeN(token);
+ }
+ }
+ else {
+ PointerRNA c_ptr;
+
+ /* ensure we quit on invalid values */
+ nextptr.data = NULL;
- if(nextptr.data)
+ if(RNA_property_collection_type_get(&curptr, prop, &c_ptr)) {
+ nextptr= c_ptr;
+ }
+ }
+
+ if(nextptr.data) {
curptr= nextptr;
+ prop= NULL; /* now we have a PointerRNA, the prop is our parent so forget it */
+ }
else
return 0;
}
@@ -3824,7 +3839,14 @@ ParameterList *RNA_parameter_list_create(ParameterList *parms, PointerRNA *ptr,
for(parm= func->cont.properties.first; parm; parm= parm->next) {
size= rna_parameter_size(parm);
- if(!(parm->flag & PROP_REQUIRED)) {
+ /* set length to 0, these need to be set later, see bpy_array.c's py_to_array */
+ if (parm->flag & PROP_DYNAMIC) {
+ ParameterDynAlloc *data_alloc= data;
+ data_alloc->array_tot= 0;
+ data_alloc->array= NULL;
+ }
+
+ if(!(parm->flag & PROP_REQUIRED) && !(parm->flag & PROP_DYNAMIC)) {
switch(parm->type) {
case PROP_BOOLEAN:
if(parm->arraydimension) memcpy(data, &((BooleanPropertyRNA*)parm)->defaultarray, size);
@@ -3853,10 +3875,6 @@ ParameterList *RNA_parameter_list_create(ParameterList *parms, PointerRNA *ptr,
}
}
- /* set length to 0 */
- if (parm->flag & PROP_DYNAMIC)
- *((int *)(((char *)data) + size))= 0;
-
data= ((char*)data) + rna_parameter_size_alloc(parm);
}
@@ -3874,9 +3892,9 @@ void RNA_parameter_list_free(ParameterList *parms)
BLI_freelistN((ListBase*)((char*)parms->data+tot));
else if (parm->flag & PROP_DYNAMIC) {
/* for dynamic arrays and strings, data is a pointer to an array */
- char *array= *(char**)((char*)parms->data+tot);
- if(array)
- MEM_freeN(array);
+ ParameterDynAlloc *data_alloc= (void *)(((char *)parms->data) + tot);
+ if(data_alloc->array)
+ MEM_freeN(data_alloc->array);
}
tot+= rna_parameter_size_alloc(parm);
@@ -4038,12 +4056,12 @@ void RNA_parameter_length_set(ParameterList *parms, PropertyRNA *parm, int lengt
int RNA_parameter_length_get_data(ParameterList *parms, PropertyRNA *parm, void *data)
{
- return *((int *)(((char *)data) + rna_parameter_size(parm)));
+ return *((int *)((char *)data));
}
void RNA_parameter_length_set_data(ParameterList *parms, PropertyRNA *parm, void *data, int length)
{
- *((int *)(((char *)data) + rna_parameter_size(parm)))= length;
+ *((int *)data)= length;
}
int RNA_function_call(bContext *C, ReportList *reports, PointerRNA *ptr, FunctionRNA *func, ParameterList *parms)
diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c
index 623717e469f..42ddf340f12 100644
--- a/source/blender/makesrna/intern/rna_action.c
+++ b/source/blender/makesrna/intern/rna_action.c
@@ -59,7 +59,7 @@ static void rna_ActionGroup_channels_next(CollectionPropertyIterator *iter)
iter->valid= (internal->link != NULL);
}
-static bActionGroup *rna_Action_groups_add(bAction *act, char name[])
+static bActionGroup *rna_Action_groups_new(bAction *act, char name[])
{
return action_groups_add_new(act, name);
}
@@ -149,6 +149,11 @@ static void rna_Action_pose_markers_remove(bAction *act, ReportList *reports, Ti
MEM_freeN(marker);
}
+static void rna_Action_frame_range_get(PointerRNA *ptr,float *values)
+{
+ calc_action_range(ptr->id.data, values, values+1, 1);
+}
+
#else
static void rna_def_dopesheet(BlenderRNA *brna)
@@ -361,7 +366,7 @@ static void rna_def_action_groups(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_struct_sdna(srna, "bAction");
RNA_def_struct_ui_text(srna, "Action Groups", "Collection of action groups");
- func= RNA_def_function(srna, "add", "rna_Action_groups_add");
+ func= RNA_def_function(srna, "new", "rna_Action_groups_new");
RNA_def_function_ui_description(func, "Add a keyframe to the curve.");
parm= RNA_def_string(func, "name", "Group", 0, "", "New name for the action group.");
RNA_def_property_flag(parm, PROP_REQUIRED);
@@ -393,6 +398,7 @@ static void rna_def_action_fcurves(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_ui_description(func, "Add a keyframe to the curve.");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
parm= RNA_def_string(func, "data_path", "", 0, "Data Path", "FCurve data path to use.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
parm= RNA_def_int(func, "array_index", 0, 0, INT_MAX, "Index", "Array index.", 0, INT_MAX);
parm= RNA_def_string(func, "action_group", "", 0, "Action Group", "Acton group to add this fcurve into.");
@@ -463,6 +469,10 @@ static void rna_def_action(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Pose Markers", "Markers specific to this Action, for labeling poses");
rna_def_action_pose_markers(brna, prop);
+ prop= RNA_def_float_vector(srna, "frame_range" , 2 , NULL , 0, 0, "Frame Range" , "The final frame range of all fcurves within this action" , 0 , 0);
+ RNA_def_property_float_funcs(prop, "rna_Action_frame_range_get" , NULL, NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
RNA_api_action(srna);
}
diff --git a/source/blender/makesrna/intern/rna_action_api.c b/source/blender/makesrna/intern/rna_action_api.c
index 0304ef2b0bd..3d661f50115 100644
--- a/source/blender/makesrna/intern/rna_action_api.c
+++ b/source/blender/makesrna/intern/rna_action_api.c
@@ -40,35 +40,11 @@
#include "DNA_anim_types.h"
#include "DNA_curve_types.h"
-/* return frame range of all curves (min, max) or (0, 1) if there are no keys */
-void rna_Action_get_frame_range(bAction *act, int **frame_range, int *length_r)
-{
- int *ret;
- float start, end;
-
- calc_action_range(act, &start, &end, 1);
-
- *length_r= 2;
- ret= MEM_callocN(*length_r * sizeof(int), "rna_Action_get_frame_range");
-
- ret[0]= (int)start;
- ret[1]= (int)end;
-
- *frame_range= ret;
-}
-
#else
void RNA_api_action(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
- func= RNA_def_function(srna, "get_frame_range", "rna_Action_get_frame_range");
- RNA_def_function_ui_description(func, "Get action frame range as a (min, max) tuple.");
- parm= RNA_def_int_array(func, "frame_range", 1, NULL, 0, 0, "", "Action frame range.", 0, 0);
- RNA_def_property_flag(parm, PROP_DYNAMIC);
- RNA_def_function_output(func, parm);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c
index 87a002db828..92f146770c2 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -528,7 +528,6 @@ static void rna_def_keyingset_path(BlenderRNA *brna)
}
-
/* keyingset.paths */
static void rna_def_keyingset_paths(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -537,6 +536,8 @@ static void rna_def_keyingset_paths(BlenderRNA *brna, PropertyRNA *cprop)
FunctionRNA *func;
PropertyRNA *parm;
+ PropertyRNA *prop;
+
RNA_def_property_srna(cprop, "KeyingSetPaths");
srna= RNA_def_struct(brna, "KeyingSetPaths", NULL);
RNA_def_struct_sdna(srna, "KeyingSet");
@@ -569,13 +570,25 @@ static void rna_def_keyingset_paths(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
/* path to remove */
parm= RNA_def_pointer(func, "path", "KeyingSetPath", "Path", "");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
/* Remove All Paths */
func= RNA_def_function(srna, "clear", "rna_KeyingSet_paths_clear");
RNA_def_function_ui_description(func, "Remove all the paths from the Keying Set.");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
+
+ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "KeyingSetPath");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_editable_func(prop, "rna_KeyingSet_active_ksPath_editable");
+ RNA_def_property_pointer_funcs(prop, "rna_KeyingSet_active_ksPath_get", "rna_KeyingSet_active_ksPath_set", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
+
+ prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "active_path");
+ RNA_def_property_int_funcs(prop, "rna_KeyingSet_active_ksPath_index_get", "rna_KeyingSet_active_ksPath_index_set", "rna_KeyingSet_active_ksPath_index_range");
+ RNA_def_property_ui_text(prop, "Active Path Index", "Current Keying Set index");
}
static void rna_def_keyingset(BlenderRNA *brna)
@@ -605,18 +618,6 @@ static void rna_def_keyingset(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Paths", "Keying Set Paths to define settings that get keyframed together");
rna_def_keyingset_paths(brna, prop);
- prop= RNA_def_property(srna, "active_path", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "KeyingSetPath");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_editable_func(prop, "rna_KeyingSet_active_ksPath_editable");
- RNA_def_property_pointer_funcs(prop, "rna_KeyingSet_active_ksPath_get", "rna_KeyingSet_active_ksPath_set", NULL, NULL);
- RNA_def_property_ui_text(prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
-
- prop= RNA_def_property(srna, "active_path_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "active_path");
- RNA_def_property_int_funcs(prop, "rna_KeyingSet_active_ksPath_index_get", "rna_KeyingSet_active_ksPath_index_set", "rna_KeyingSet_active_ksPath_index_range");
- RNA_def_property_ui_text(prop, "Active Path Index", "Current Keying Set index");
-
/* Flags */
prop= RNA_def_property(srna, "is_path_absolute", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c
index 8b21fd2c80a..f2abe690218 100644
--- a/source/blender/makesrna/intern/rna_armature.c
+++ b/source/blender/makesrna/intern/rna_armature.c
@@ -108,6 +108,12 @@ void rna_Armature_edit_bone_remove(bArmature *arm, ReportList *reports, EditBone
BKE_reportf(reports, RPT_ERROR, "Armature '%s' not in editmode, cant remove an editbone.", arm->id.name+2);
return;
}
+
+ if(BLI_findindex(arm->edbo, ebone) == -1) {
+ BKE_reportf(reports, RPT_ERROR, "Armature '%s' doesn't contain bone '%s'.", arm->id.name+2, ebone->name);
+ return;
+ }
+
ED_armature_edit_bone_remove(arm, ebone);
}
@@ -712,7 +718,7 @@ static void rna_def_armature_edit_bones(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_ui_description(func, "Remove an existing bone from the armature");
/* target to remove*/
parm= RNA_def_pointer(func, "bone", "EditBone", "", "EditBone to remove");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
static void rna_def_armature(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c
index e40bbcbbf50..71e95248512 100644
--- a/source/blender/makesrna/intern/rna_cloth.c
+++ b/source/blender/makesrna/intern/rna_cloth.c
@@ -253,7 +253,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Mass", "Mass of cloth material");
RNA_def_property_update(prop, 0, "rna_cloth_update");
- prop= RNA_def_property(srna, "mass_vertex_group", PROP_STRING, PROP_NONE);
+ prop= RNA_def_property(srna, "vertex_group_mass", PROP_STRING, PROP_NONE);
RNA_def_property_string_funcs(prop, "rna_ClothSettings_mass_vgroup_get", "rna_ClothSettings_mass_vgroup_length", "rna_ClothSettings_mass_vgroup_set");
RNA_def_property_ui_text(prop, "Mass Vertex Group", "Vertex Group for pinning of vertices");
RNA_def_property_update(prop, 0, "rna_cloth_update");
@@ -316,7 +316,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Structural Stiffness Maximum", "Maximum structural stiffness value");
RNA_def_property_update(prop, 0, "rna_cloth_update");
- prop= RNA_def_property(srna, "structural_stiffness_vertex_group", PROP_STRING, PROP_NONE);
+ prop= RNA_def_property(srna, "vertex_group_structural_stiffness", PROP_STRING, PROP_NONE);
RNA_def_property_string_funcs(prop, "rna_ClothSettings_struct_vgroup_get", "rna_ClothSettings_struct_vgroup_length", "rna_ClothSettings_struct_vgroup_set");
RNA_def_property_ui_text(prop, "Structural Stiffness Vertex Group", "Vertex group for fine control over structural stiffness");
RNA_def_property_update(prop, 0, "rna_cloth_update");
@@ -334,7 +334,7 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Bending Stiffness Maximum", "Maximum bending stiffness value");
RNA_def_property_update(prop, 0, "rna_cloth_update");
- prop= RNA_def_property(srna, "bending_vertex_group", PROP_STRING, PROP_NONE);
+ prop= RNA_def_property(srna, "vertex_group_bending", PROP_STRING, PROP_NONE);
RNA_def_property_string_funcs(prop, "rna_ClothSettings_bend_vgroup_get", "rna_ClothSettings_bend_vgroup_length", "rna_ClothSettings_bend_vgroup_set");
RNA_def_property_ui_text(prop, "Bending Stiffness Vertex Group", "Vertex group for fine control over bending stiffness");
RNA_def_property_update(prop, 0, "rna_cloth_update");
diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c
index ba3f2b09a20..89f3e459105 100644
--- a/source/blender/makesrna/intern/rna_color.c
+++ b/source/blender/makesrna/intern/rna_color.c
@@ -465,9 +465,8 @@ static void rna_def_color_ramp_element_api(BlenderRNA *brna, PropertyRNA *cprop)
func = RNA_def_function(srna, "remove", "rna_ColorRampElement_remove");
RNA_def_function_ui_description(func, "Delete element from ColorRamp");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
- //parm= RNA_def_int(func, "index", 0, 0, 31, "Index", "Element to delete.", 0, 31);
parm= RNA_def_pointer(func, "element", "ColorRampElement", "", "Element to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
static void rna_def_color_ramp(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index a58807902d8..cf5db930898 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -1941,7 +1941,7 @@ void RNA_def_constraint(BlenderRNA *brna)
/* flags */
prop= RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_OFF);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_OFF);
RNA_def_property_ui_text(prop, "Enabled", "Enable/Disable Constraint");
prop= RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_context.c b/source/blender/makesrna/intern/rna_context.c
index 6cc93d088ad..ebe0e363b26 100644
--- a/source/blender/makesrna/intern/rna_context.c
+++ b/source/blender/makesrna/intern/rna_context.c
@@ -93,7 +93,7 @@ static PointerRNA rna_Context_region_data_get(PointerRNA *ptr)
static PointerRNA rna_Context_main_get(PointerRNA *ptr)
{
bContext *C= (bContext*)ptr->data;
- return rna_pointer_inherit_refine(ptr, &RNA_Main, CTX_data_main(C));
+ return rna_pointer_inherit_refine(ptr, &RNA_BlendData, CTX_data_main(C));
}
static PointerRNA rna_Context_scene_get(PointerRNA *ptr)
@@ -151,7 +151,7 @@ void RNA_def_context(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "bContext");
/* WM */
- prop= RNA_def_property(srna, "manager", PROP_POINTER, PROP_NONE);
+ prop= RNA_def_property(srna, "window_manager", PROP_POINTER, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_struct_type(prop, "WindowManager");
RNA_def_property_pointer_funcs(prop, "rna_Context_manager_get", NULL, NULL, NULL);
@@ -187,9 +187,9 @@ void RNA_def_context(BlenderRNA *brna)
RNA_def_property_pointer_funcs(prop, "rna_Context_region_data_get", NULL, NULL, NULL);
/* Data */
- prop= RNA_def_property(srna, "main", PROP_POINTER, PROP_NONE);
+ prop= RNA_def_property(srna, "blend_data", PROP_POINTER, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "Main");
+ RNA_def_property_struct_type(prop, "BlendData");
RNA_def_property_pointer_funcs(prop, "rna_Context_main_get", NULL, NULL, NULL);
prop= RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index cfca29aaa83..e28212470c3 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -356,6 +356,18 @@ static void rna_Curve_resolution_v_update_data(Main *bmain, Scene *scene, Pointe
rna_Curve_update_data(bmain, scene, ptr);
}
+static float rna_Curve_offset_get(PointerRNA *ptr)
+{
+ Curve *cu= (Curve*)ptr->id.data;
+ return cu->width - 1.0f;
+}
+
+static void rna_Curve_offset_set(PointerRNA *ptr, float value)
+{
+ Curve *cu= (Curve*)ptr->id.data;
+ cu->width= 1.0f + value;
+}
+
/* name functions that ignore the first two ID characters */
void rna_Curve_body_get(PointerRNA *ptr, char *value)
{
@@ -482,7 +494,6 @@ static Nurb *rna_Curve_spline_new(Curve *cu, int type)
static void rna_Curve_spline_remove(Curve *cu, ReportList *reports, Nurb *nu)
{
- /* todo, check we're in the list */
int found= 0;
ListBase *nurbs= BKE_curve_nurbs(cu);
@@ -986,7 +997,7 @@ static void rna_def_curve_spline_points(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_ui_description(func, "Remove a spline from a curve.");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
parm= RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
*/
}
@@ -1013,7 +1024,7 @@ static void rna_def_curve_spline_bezpoints(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_ui_description(func, "Remove a spline from a curve.");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
parm= RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
*/
}
@@ -1042,7 +1053,7 @@ static void rna_def_curve_splines(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_ui_description(func, "Remove a spline from a curve.");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
parm= RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Object");
@@ -1110,8 +1121,9 @@ static void rna_def_curve(BlenderRNA *brna)
prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "width");
- RNA_def_property_ui_range(prop, 0, 2.0, 0.1, 3);
- RNA_def_property_ui_text(prop, "Width", "Scale the original width (1.0) based on given factor");
+ RNA_def_property_ui_range(prop, -1.0, 1.0, 0.1, 3);
+ RNA_def_property_float_funcs(prop, "rna_Curve_offset_get", "rna_Curve_offset_set", NULL);
+ RNA_def_property_ui_text(prop, "Offset", "Offset the curve to adjust the width of a text");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
prop= RNA_def_property(srna, "extrude", PROP_FLOAT, PROP_NONE);
@@ -1249,6 +1261,7 @@ static void rna_def_curve(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
RNA_def_property_struct_type(prop, "Material");
RNA_def_property_ui_text(prop, "Materials", "");
+ RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
}
static void rna_def_curve_nurb(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index 43bf40d3965..750b1eef2a9 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -2201,6 +2201,17 @@ PropertyRNA *RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identi
return prop;
}
+PropertyRNA *RNA_def_float_vector_xyz(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value,
+ float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
+{
+ PropertyRNA *prop;
+
+ prop= RNA_def_float_vector(cont_, identifier, len, default_value, hardmin, hardmax, ui_name, ui_description, softmin, softmax);
+ prop->subtype = PROP_XYZ_LENGTH;
+
+ return prop;
+}
+
PropertyRNA *RNA_def_float_color(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value,
float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
{
@@ -2514,7 +2525,7 @@ int rna_parameter_size_alloc(PropertyRNA *parm)
int size = rna_parameter_size(parm);
if (parm->flag & PROP_DYNAMIC)
- size+= sizeof(int);
+ size+= sizeof(((ParameterDynAlloc *)NULL)->array_tot);
return size;
}
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index b37e5f91538..aa377f063e1 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -385,9 +385,13 @@ DriverVar *rna_Driver_new_variable(ChannelDriver *driver)
return driver_add_new_variable(driver);
}
-void rna_Driver_remove_variable(ChannelDriver *driver, DriverVar *dvar)
+void rna_Driver_remove_variable(ChannelDriver *driver, ReportList *reports, DriverVar *dvar)
{
- /* call the API function for this */
+ if(BLI_findindex(&driver->variables, dvar) == -1) {
+ BKE_report(reports, RPT_ERROR, "Variable does not exist in this driver.");
+ return;
+ }
+
driver_free_variable(driver, dvar);
}
@@ -410,9 +414,13 @@ static FModifier *rna_FCurve_modifiers_new(FCurve *fcu, int type)
return add_fmodifier(&fcu->modifiers, type);
}
-static int rna_FCurve_modifiers_remove(FCurve *fcu, int index)
+static void rna_FCurve_modifiers_remove(FCurve *fcu, ReportList *reports, FModifier *fcm)
{
- return remove_fmodifier_index(&fcu->modifiers, index);
+ if(BLI_findindex(&fcu->modifiers, fcm) == -1) {
+ BKE_reportf(reports, RPT_ERROR, "FCurveModifier '%s' not found in fcurve.", fcm->name);
+ return;
+}
+ remove_fmodifier(&fcu->modifiers, fcm);
}
static void rna_FModifier_active_set(PointerRNA *ptr, int value)
@@ -1095,9 +1103,10 @@ static void rna_def_channeldriver_variables(BlenderRNA *brna, PropertyRNA *cprop
/* remove variable */
func= RNA_def_function(srna, "remove", "rna_Driver_remove_variable");
RNA_def_function_ui_description(func, "Remove an existing variable from the driver.");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
/* target to remove */
- parm= RNA_def_pointer(func, "var", "DriverVariable", "", "Variable to remove from the driver.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_pointer(func, "variable", "DriverVariable", "", "Variable to remove from the driver.");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
static void rna_def_channeldriver(BlenderRNA *brna)
@@ -1282,13 +1291,11 @@ static void rna_def_fcurve_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_property_flag(parm, PROP_REQUIRED);
func= RNA_def_function(srna, "remove", "rna_FCurve_modifiers_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a modifier from this fcurve.");
- /* return type */
- parm= RNA_def_boolean(func, "success", 0, "Success", "Removed the constraint successfully.");
- RNA_def_function_return(func, parm);
- /* object to add */
- parm= RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "", 0, INT_MAX);
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ /* modifier to remove */
+ parm= RNA_def_pointer(func, "modifier", "FModifier", "", "Removed modifier.");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
/* fcurve.keyframe_points */
diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c
index bd121724413..7dffa4aec74 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -254,7 +254,7 @@ static void rna_def_imageuser(BlenderRNA *brna)
prop= RNA_def_property(srna, "fields_per_frame", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "fie_ima");
- RNA_def_property_range(prop, -MAXFRAMEF, MAXFRAMEF);
+ RNA_def_property_range(prop, 1, MAXFRAMEF);
RNA_def_property_ui_text(prop, "Fields per Frame", "The number of fields per rendered frame (2 fields is 1 image)");
RNA_def_property_update(prop, 0, "rna_ImageUser_update");
diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h
index 669fc5d3871..401f9de92d4 100644
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@ -182,7 +182,7 @@ void rna_def_animviz_common(struct StructRNA *srna);
void rna_def_motionpath_common(struct StructRNA *srna);
void rna_def_texmat_common(struct StructRNA *srna, const char *texspace_editable);
-void rna_def_mtex_common(struct StructRNA *srna, const char *begin, const char *activeget, const char *activeset, const char *structname, const char *update);
+void rna_def_mtex_common(struct BlenderRNA *brna, struct StructRNA *srna, const char *begin, const char *activeget, const char *activeset, const char *structname, const char *structname_slots, const char *update);
void rna_def_render_layer_common(struct StructRNA *srna, int scene);
void rna_ID_name_get(struct PointerRNA *ptr, char *value);
@@ -352,6 +352,10 @@ PointerRNA rna_pointer_inherit_refine(struct PointerRNA *ptr, struct StructRNA *
int rna_parameter_size(struct PropertyRNA *parm);
int rna_parameter_size_alloc(struct PropertyRNA *parm);
+// XXX, these should not need to be defined here~!
+struct MTex *rna_mtex_texture_slots_add(struct ID *self, struct ReportList *reports);
+struct MTex *rna_mtex_texture_slots_create(struct ID *self, struct ReportList *reports, int index);
+void rna_mtex_texture_slots_clear(struct ID *self, struct ReportList *reports, int index);
#endif /* RNA_INTERNAL_H */
diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c
index c6660450914..fb7bb4a9194 100644
--- a/source/blender/makesrna/intern/rna_lamp.c
+++ b/source/blender/makesrna/intern/rna_lamp.c
@@ -386,8 +386,8 @@ static void rna_def_lamp(BlenderRNA *brna)
rna_def_animdata_common(srna);
/* textures */
- rna_def_mtex_common(srna, "rna_Lamp_mtex_begin", "rna_Lamp_active_texture_get",
- "rna_Lamp_active_texture_set", "LampTextureSlot", "rna_Lamp_update");
+ rna_def_mtex_common(brna, srna, "rna_Lamp_mtex_begin", "rna_Lamp_active_texture_get",
+ "rna_Lamp_active_texture_set", "LampTextureSlot", "LampTextureSlots", "rna_Lamp_update");
}
static void rna_def_lamp_falloff(StructRNA *srna)
diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c
index 6e44b02834e..99758b8f0fe 100644
--- a/source/blender/makesrna/intern/rna_main.c
+++ b/source/blender/makesrna/intern/rna_main.c
@@ -147,13 +147,11 @@ static void rna_Main_camera_begin(CollectionPropertyIterator *iter, PointerRNA *
rna_iterator_listbase_begin(iter, &bmain->camera, NULL);
}
-#if 0
static void rna_Main_key_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
Main *bmain= (Main*)ptr->data;
rna_iterator_listbase_begin(iter, &bmain->key, NULL);
}
-#endif
static void rna_Main_world_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
@@ -292,7 +290,7 @@ void RNA_def_main(BlenderRNA *brna)
{"brushes", "Brush", "rna_Main_brush_begin", "Brushes", "Brush datablocks.", RNA_def_main_brushes},
{"worlds", "World", "rna_Main_world_begin", "Worlds", "World datablocks.", RNA_def_main_worlds},
{"groups", "Group", "rna_Main_group_begin", "Groups", "Group datablocks.", RNA_def_main_groups},
-/* {"keys", "Key", "rna_Main_key_begin", "Keys", "Key datablocks.", NULL}, */
+ {"shape_keys", "Key", "rna_Main_key_begin", "Keys", "Key datablocks.", NULL},
{"scripts", "ID", "rna_Main_script_begin", "Scripts", "Script datablocks (DEPRECATED).", NULL},
{"texts", "Text", "rna_Main_text_begin", "Texts", "Text datablocks.", RNA_def_main_texts},
{"sounds", "Sound", "rna_Main_sound_begin", "Sounds", "Sound datablocks.", RNA_def_main_sounds},
@@ -304,8 +302,8 @@ void RNA_def_main(BlenderRNA *brna)
int i;
- srna= RNA_def_struct(brna, "Main", NULL);
- RNA_def_struct_ui_text(srna, "Main", "Main data structure representing a .blend file and all its datablocks");
+ srna= RNA_def_struct(brna, "BlendData", NULL);
+ RNA_def_struct_ui_text(srna, "Blendfile Data", "Main data structure representing a .blend file and all its datablocks");
RNA_def_struct_ui_icon(srna, ICON_BLENDER);
prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index c850afc22ae..4ba9b7dd367 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -348,9 +348,10 @@ void rna_Main_fonts_remove(Main *bmain, ReportList *reports, VFont *vfont)
/* XXX python now has invalid pointer? */
}
-Tex *rna_Main_textures_new(Main *bmain, char* name)
+Tex *rna_Main_textures_new(Main *bmain, char* name, int type)
{
Tex *tex= add_texture(name);
+ tex_set_type(tex, type);
tex->id.us--;
return tex;
}
@@ -517,7 +518,7 @@ void RNA_def_main_cameras(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a camera from the current blendfile.");
parm= RNA_def_pointer(func, "camera", "Camera", "", "Camera to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_scenes(BlenderRNA *brna, PropertyRNA *cprop)
@@ -540,10 +541,9 @@ void RNA_def_main_scenes(BlenderRNA *brna, PropertyRNA *cprop)
func= RNA_def_function(srna, "remove", "rna_Main_scenes_remove");
RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
- parm= RNA_def_pointer(func, "scene", "Scene", "", "Scene to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
RNA_def_function_ui_description(func, "Remove a scene from the current blendfile.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_pointer(func, "scene", "Scene", "", "Scene to remove.");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop)
@@ -569,10 +569,10 @@ void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_return(func, parm);
func= RNA_def_function(srna, "remove", "rna_Main_objects_remove");
+ RNA_def_function_ui_description(func, "Remove a object from the current blendfile.");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
parm= RNA_def_pointer(func, "object", "Object", "", "Object to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
- RNA_def_function_ui_description(func, "Remove a object from the current blendfile.");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop)
@@ -597,7 +597,7 @@ void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a material from the current blendfile.");
parm= RNA_def_pointer(func, "material", "Material", "", "Material to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_node_groups(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -628,7 +628,7 @@ void RNA_def_main_node_groups(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a node tree from the current blendfile.");
parm= RNA_def_pointer(func, "tree", "NodeTree", "", "Node tree to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
#endif
}
void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop)
@@ -653,7 +653,7 @@ void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a mesh from the current blendfile.");
parm= RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_lamps(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -677,7 +677,7 @@ void RNA_def_main_lamps(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a lamp from the current blendfile.");
parm= RNA_def_pointer(func, "lamp", "Lamp", "", "Lamp to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_libraries(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -726,7 +726,7 @@ void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove an image from the current blendfile.");
parm= RNA_def_pointer(func, "image", "Image", "", "Image to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop)
@@ -751,7 +751,7 @@ void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a lattice from the current blendfile.");
parm= RNA_def_pointer(func, "lattice", "Lattice", "", "Lattice to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_curves(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -767,7 +767,7 @@ void RNA_def_main_curves(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_ui_description(func, "Add a new curve to the main database");
parm= RNA_def_string(func, "name", "Curve", 0, "", "New name for the datablock.");
RNA_def_property_flag(parm, PROP_REQUIRED);
- parm= RNA_def_enum(func, "type", object_type_curve_items, 0, "Type", "The type of curve object to add");
+ parm= RNA_def_enum(func, "type", object_type_curve_items, 0, "Type", "The type of curve to add");
RNA_def_property_flag(parm, PROP_REQUIRED);
/* return type */
parm= RNA_def_pointer(func, "curve", "Curve", "", "New curve datablock.");
@@ -777,7 +777,7 @@ void RNA_def_main_curves(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a curve from the current blendfile.");
parm= RNA_def_pointer(func, "curve", "Curve", "", "Curve to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -801,7 +801,7 @@ void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a metaball from the current blendfile.");
parm= RNA_def_pointer(func, "metaball", "MetaBall", "", "MetaBall to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -826,7 +826,7 @@ void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a font from the current blendfile.");
parm= RNA_def_pointer(func, "vfont", "VectorFont", "", "Font to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -842,6 +842,8 @@ void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_ui_description(func, "Add a new texture to the main database");
parm= RNA_def_string(func, "name", "Texture", 0, "", "New name for the datablock.");
RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_enum(func, "type", texture_type_items, 0, "Type", "The type of texture to add");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
/* return type */
parm= RNA_def_pointer(func, "texture", "Texture", "", "New texture datablock.");
RNA_def_function_return(func, parm);
@@ -850,7 +852,7 @@ void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a texture from the current blendfile.");
parm= RNA_def_pointer(func, "texture", "Texture", "", "Texture to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_brushes(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -874,7 +876,7 @@ void RNA_def_main_brushes(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a brush from the current blendfile.");
parm= RNA_def_pointer(func, "brush", "Brush", "", "Brush to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop)
@@ -899,7 +901,7 @@ void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a world from the current blendfile.");
parm= RNA_def_pointer(func, "world", "World", "", "World to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_groups(BlenderRNA *brna, PropertyRNA *cprop)
@@ -924,7 +926,7 @@ void RNA_def_main_groups(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a group from the current blendfile.");
parm= RNA_def_pointer(func, "group", "Group", "", "Group to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_texts(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -948,7 +950,7 @@ void RNA_def_main_texts(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a text from the current blendfile.");
parm= RNA_def_pointer(func, "text", "Text", "", "Text to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
/* load func */
func= RNA_def_function(srna, "load", "rna_Main_texts_load");
@@ -986,7 +988,7 @@ void RNA_def_main_armatures(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a armature from the current blendfile.");
parm= RNA_def_pointer(func, "armature", "Armature", "", "Armature to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -1010,7 +1012,7 @@ void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a action from the current blendfile.");
parm= RNA_def_pointer(func, "action", "Action", "", "Action to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop)
{
@@ -1034,7 +1036,7 @@ void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_function_ui_description(func, "Remove a particle settings instance from the current blendfile.");
parm= RNA_def_pointer(func, "particle", "ParticleSettings", "", "Particle Settings to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop)
{
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 46a89ccce40..a3cd4e2fbde 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -276,6 +276,54 @@ static EnumPropertyItem *rna_Material_texture_coordinates_itemf(bContext *C, Poi
return item;
}
+MTex *rna_mtex_texture_slots_add(ID *self_id, ReportList *reports)
+{
+ MTex *mtex= add_mtex_id(self_id, -1);
+ if (mtex == NULL) {
+ BKE_reportf(reports, RPT_ERROR, "maximum number of textures added %d", MAX_MTEX);
+ return NULL;
+ }
+
+ return mtex;
+}
+
+MTex *rna_mtex_texture_slots_create(ID *self_id, ReportList *reports, int index)
+{
+ MTex *mtex;
+
+ if(index < 0 || index >= MAX_MTEX) {
+ BKE_reportf(reports, RPT_ERROR, "index %d is invalid", index);
+ return NULL;
+ }
+
+ mtex= add_mtex_id(self_id, index);
+
+ return mtex;
+}
+
+void rna_mtex_texture_slots_clear(ID *self_id, ReportList *reports, int index)
+{
+ MTex **mtex_ar;
+ short act;
+
+ give_active_mtex(self_id, &mtex_ar, &act);
+
+ if (mtex_ar == NULL) {
+ BKE_report(reports, RPT_ERROR, "mtex not found for this type");
+ return;
+ }
+
+ if(index < 0 || index >= MAX_MTEX) {
+ BKE_reportf(reports, RPT_ERROR, "index %d is invalid", index);
+ return;
+ }
+
+ if(mtex_ar[index]) {
+ id_us_min((ID *)mtex_ar[index]->tex);
+ MEM_freeN(mtex_ar[index]);
+ mtex_ar[index]= NULL;
+ }
+}
#else
@@ -571,7 +619,7 @@ static void rna_def_material_mtex(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Reflection", "Causes the texture to affect the reflected light's brightness");
RNA_def_property_update(prop, NC_TEXTURE, NULL);
- prop= RNA_def_property(srna, "color_emission_factor", PROP_FLOAT, PROP_NONE);
+ prop= RNA_def_property(srna, "emission_color_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "colemitfac");
RNA_def_property_ui_range(prop, 0, 1, 10, 3);
RNA_def_property_ui_text(prop, "Emission Color Factor", "Amount texture affects emission color");
@@ -1741,8 +1789,8 @@ void RNA_def_material(BlenderRNA *brna)
/* common */
rna_def_animdata_common(srna);
- rna_def_mtex_common(srna, "rna_Material_mtex_begin", "rna_Material_active_texture_get",
- "rna_Material_active_texture_set", "MaterialTextureSlot", "rna_Material_update");
+ rna_def_mtex_common(brna, srna, "rna_Material_mtex_begin", "rna_Material_active_texture_get",
+ "rna_Material_active_texture_set", "MaterialTextureSlot", "MaterialTextureSlots", "rna_Material_update");
/* only material has this one */
prop= RNA_def_property(srna, "use_textures", PROP_BOOLEAN, PROP_NONE);
@@ -1768,7 +1816,43 @@ void RNA_def_material(BlenderRNA *brna)
RNA_api_material(srna);
}
-void rna_def_mtex_common(StructRNA *srna, const char *begin, const char *activeget, const char *activeset, const char *structname, const char *update)
+
+/* curve.splines */
+static void rna_def_texture_slots(BlenderRNA *brna, PropertyRNA *cprop, const char *structname, const char *structname_slots)
+{
+ StructRNA *srna;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, structname_slots);
+ srna= RNA_def_struct(brna, structname_slots, NULL);
+ RNA_def_struct_sdna(srna, "ID");
+ RNA_def_struct_ui_text(srna, "Texture Slots", "Collection of texture slots");
+
+ /* functions */
+ func= RNA_def_function(srna, "add", "rna_mtex_texture_slots_add");
+ RNA_def_function_ui_description(func, "Add a number of points to this spline.");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID|FUNC_NO_SELF|FUNC_USE_REPORTS);
+ parm= RNA_def_pointer(func, "mtex", structname, "", "The newly initialized mtex.");
+ RNA_def_function_return(func, parm);
+
+ func= RNA_def_function(srna, "create", "rna_mtex_texture_slots_create");
+ RNA_def_function_ui_description(func, "Add a number of points to this spline.");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID|FUNC_NO_SELF|FUNC_USE_REPORTS);
+ parm= RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Slot index to initialize.", 0, INT_MAX);
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_pointer(func, "mtex", structname, "", "The newly initialized mtex.");
+ RNA_def_function_return(func, parm);
+
+ func= RNA_def_function(srna, "clear", "rna_mtex_texture_slots_clear");
+ RNA_def_function_ui_description(func, "Add a number of points to this spline.");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID|FUNC_NO_SELF|FUNC_USE_REPORTS);
+ parm= RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Slot index to clar.", 0, INT_MAX);
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+}
+
+void rna_def_mtex_common(BlenderRNA *brna, StructRNA *srna, const char *begin, const char *activeget, const char *activeset, const char *structname, const char *structname_slots, const char *update)
{
PropertyRNA *prop;
@@ -1777,6 +1861,7 @@ void rna_def_mtex_common(StructRNA *srna, const char *begin, const char *activeg
RNA_def_property_struct_type(prop, structname);
RNA_def_property_collection_funcs(prop, begin, "rna_iterator_array_next", "rna_iterator_array_end", "rna_iterator_array_dereference_get", 0, 0, 0);
RNA_def_property_ui_text(prop, "Textures", "Texture slots defining the mapping and influence of textures");
+ rna_def_texture_slots(brna, prop, structname, structname_slots);
prop= RNA_def_property(srna, "active_texture", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "Texture");
diff --git a/source/blender/makesrna/intern/rna_material_api.c b/source/blender/makesrna/intern/rna_material_api.c
index d271b3b374c..22eb537f24a 100644
--- a/source/blender/makesrna/intern/rna_material_api.c
+++ b/source/blender/makesrna/intern/rna_material_api.c
@@ -35,93 +35,12 @@
#ifdef RNA_RUNTIME
-#include "BKE_material.h"
-#include "BKE_texture.h"
-
-/*
- Adds material to the first free texture slot.
- If all slots are busy, replaces the first.
-*/
-static void rna_Material_add_texture(Material *ma, Tex *tex, int texco, int mapto)
-{
- int i;
- MTex *mtex;
- int slot= -1;
-
- for (i= 0; i < MAX_MTEX; i++) {
- if (!ma->mtex[i]) {
- slot= i;
- break;
- }
- }
-
- if (slot == -1)
- slot= 0;
-
- if (ma->mtex[slot]) {
- ma->mtex[slot]->tex->id.us--;
- }
- else {
- ma->mtex[slot]= add_mtex();
- }
-
- mtex= ma->mtex[slot];
-
- mtex->tex= tex;
- if (tex)
- id_us_plus(&tex->id);
-
- mtex->texco= texco;
- mtex->mapto= mapto;
-}
-
#else
void RNA_api_material(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
-
- /* copied from rna_def_material_mtex (rna_material.c) */
- static EnumPropertyItem prop_texture_coordinates_items[] = {
- {TEXCO_GLOB, "GLOBAL", 0, "Global", "Uses global coordinates for the texture coordinates"},
- {TEXCO_OBJECT, "OBJECT", 0, "Object", "Uses linked object's coordinates for texture coordinates"},
- {TEXCO_UV, "UV", 0, "UV", "Uses UV coordinates for texture coordinates"},
- {TEXCO_ORCO, "ORCO", 0, "Generated", "Uses the original undeformed coordinates of the object"},
- {TEXCO_STRAND, "STRAND", 0, "Strand", "Uses normalized strand texture coordinate (1D)"},
- {TEXCO_STICKY, "STICKY", 0, "Sticky", "Uses mesh's sticky coordinates for the texture coordinates"},
- {TEXCO_WINDOW, "WINDOW", 0, "Window", "Uses screen coordinates as texture coordinates"},
- {TEXCO_NORM, "NORMAL", 0, "Normal", "Uses normal vector as texture coordinates"},
- {TEXCO_REFL, "REFLECTION", 0, "Reflection", "Uses reflection vector as texture coordinates"},
- {TEXCO_STRESS, "STRESS", 0, "Stress", "Uses the difference of edge lengths compared to original coordinates of the mesh"},
- {TEXCO_TANGENT, "TANGENT", 0, "Tangent", "Uses the optional tangent vector as texture coordinates"},
-
- {0, NULL, 0, NULL, NULL}};
-
- static EnumPropertyItem prop_texture_mapto_items[] = {
- {MAP_COL, "COLOR", 0, "Color", "Causes the texture to affect basic color of the material"},
- {MAP_NORM, "NORMAL", 0, "Normal", "Causes the texture to affect the rendered normal"},
- {MAP_COLSPEC, "SPECULAR_COLOR", 0, "Specularity Color", "Causes the texture to affect the specularity color"},
- {MAP_COLMIR, "MIRROR", 0, "Mirror", "Causes the texture to affect the mirror color"},
- {MAP_REF, "REFLECTION", 0, "Reflection", "Causes the texture to affect the value of the materials reflectivity"},
- {MAP_SPEC, "SPECULARITY", 0, "Specularity", "Causes the texture to affect the value of specularity"},
- {MAP_EMIT, "EMIT", 0, "Emit", "Causes the texture to affect the emit value"},
- {MAP_ALPHA, "ALPHA", 0, "Alpha", "Causes the texture to affect the alpha value"},
- {MAP_HAR, "HARDNESS", 0, "Hardness", "Causes the texture to affect the hardness value"},
- {MAP_RAYMIRR, "RAY_MIRROR", 0, "Ray-Mirror", "Causes the texture to affect the ray-mirror value"},
- {MAP_TRANSLU, "TRANSLUCENCY", 0, "Translucency", "Causes the texture to affect the translucency value"},
- {MAP_AMB, "AMBIENT", 0, "Ambient", "Causes the texture to affect the value of ambient"},
- {MAP_DISPLACE, "DISPLACEMENT", 0, "Displacement", "Let the texture displace the surface"},
- {MAP_WARP, "WARP", 0, "Warp", "Let the texture warp texture coordinates of next channels"},
- {0, NULL, 0, NULL, NULL}};
-
- func= RNA_def_function(srna, "add_texture", "rna_Material_add_texture");
- RNA_def_function_ui_description(func, "Add a texture to material's free texture slot.");
- parm= RNA_def_pointer(func, "texture", "Texture", "Texture", "Texture to add.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
- parm= RNA_def_enum(func, "texture_coords", prop_texture_coordinates_items, TEXCO_UV, "", "Source of texture coordinate information."); /* optional */
- parm= RNA_def_enum(func, "map_to", prop_texture_mapto_items, MAP_COL, "", "Controls which material property the texture affects."); /* optional */
- RNA_def_property_flag(parm, PROP_ENUM_FLAG);
+ // FunctionRNA *func;
+ // PropertyRNA *parm;
}
#endif
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index 3758f0ad101..af109a688c1 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -993,6 +993,34 @@ static int rna_Mesh_tot_face_get(PointerRNA *ptr)
return me->edit_btmesh ? me->edit_btmesh->bm->totfacesel : 0;
}
+static CustomDataLayer *rna_Mesh_vertex_color_new(struct Mesh *me, struct bContext *C, char *name)
+{
+ CustomData *ldata;
+ CustomDataLayer *cdl= NULL;
+ int index;
+
+ if(ED_mesh_color_add(C, NULL, NULL, me, name, FALSE)) {
+ ldata= rna_mesh_ldata(me);
+ index= CustomData_get_named_layer_index(ldata, CD_MLOOPCOL, name);
+ cdl= (index == -1)? NULL: &ldata->layers[index];
+ }
+ return cdl;
+}
+
+static CustomDataLayer *rna_Mesh_uv_texture_new(struct Mesh *me, struct bContext *C, char *name)
+{
+ CustomData *pdata;
+ CustomDataLayer *cdl= NULL;
+ int index;
+
+ if(ED_mesh_uv_texture_add(C, NULL, NULL, me, name, FALSE)) {
+ pdata= rna_mesh_pdata(me);
+ index= CustomData_get_named_layer_index(pdata, CD_MTEXPOLY, name);
+ cdl= (index == -1)? NULL: &pdata->layers[index];
+ }
+ return cdl;
+}
+
#else
static void rna_def_mvert_group(BlenderRNA *brna)
@@ -1522,13 +1550,52 @@ void rna_def_texmat_common(StructRNA *srna, const char *texspace_editable)
/* scene.objects */
+/* mesh.vertices */
+static void rna_def_mesh_vertices(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+// PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "MeshVertices");
+ srna= RNA_def_struct(brna, "MeshVertices", NULL);
+ RNA_def_struct_sdna(srna, "Mesh");
+ RNA_def_struct_ui_text(srna, "Mesh Vertices", "Collection of mesh vertices");
+
+ func= RNA_def_function(srna, "add", "ED_mesh_vertices_add");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm= RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of vertices to add.", 0, INT_MAX);
+}
+
+/* mesh.edges */
+static void rna_def_mesh_edges(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+// PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "MeshEdges");
+ srna= RNA_def_struct(brna, "MeshEdges", NULL);
+ RNA_def_struct_sdna(srna, "Mesh");
+ RNA_def_struct_ui_text(srna, "Mesh Edges", "Collection of mesh edges");
+
+ func= RNA_def_function(srna, "add", "ED_mesh_edges_add");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm= RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of vertices to add.", 0, INT_MAX);
+}
+
+/* mesh.faces */
static void rna_def_mesh_faces(BlenderRNA *brna, PropertyRNA *cprop)
{
StructRNA *srna;
PropertyRNA *prop;
-// FunctionRNA *func;
-// PropertyRNA *parm;
+ FunctionRNA *func;
+ PropertyRNA *parm;
RNA_def_property_srna(cprop, "MeshFaces");
srna= RNA_def_struct(brna, "MeshFaces", NULL);
@@ -1538,8 +1605,93 @@ static void rna_def_mesh_faces(BlenderRNA *brna, PropertyRNA *cprop)
prop= RNA_def_property(srna, "active", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "act_face");
RNA_def_property_ui_text(prop, "Active Face", "The active face for this mesh");
+
+ func= RNA_def_function(srna, "add", "ED_mesh_faces_add");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm= RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of vertices to add.", 0, INT_MAX);
}
+/* mesh.vertex_colors */
+static void rna_def_vertex_colors(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "VertexColors");
+ srna= RNA_def_struct(brna, "VertexColors", NULL);
+ RNA_def_struct_sdna(srna, "Mesh");
+ RNA_def_struct_ui_text(srna, "Vertex Colors", "Collection of vertex colors");
+
+ func= RNA_def_function(srna, "new", "rna_Mesh_vertex_color_new");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ RNA_def_function_ui_description(func, "Add a vertex color layer to Mesh.");
+ parm= RNA_def_string(func, "name", "UVTex", 0, "", "UV Texture name.");
+ parm= RNA_def_pointer(func, "layer", "MeshColorLayer", "", "The newly created layer.");
+ RNA_def_function_return(func, parm);
+
+/*
+ func= RNA_def_function(srna, "remove", "rna_Mesh_vertex_color_remove");
+ RNA_def_function_ui_description(func, "Remove a vertex color layer.");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm= RNA_def_pointer(func, "layer", "Layer", "", "The layer to remove.");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
+*/
+ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED);
+ RNA_def_property_struct_type(prop, "MeshColorLayer");
+ RNA_def_property_pointer_funcs(prop, "rna_Mesh_active_vertex_color_get", "rna_Mesh_active_vertex_color_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Active Vertex Color Layer", "Active vertex color layer");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop, "rna_Mesh_active_vertex_color_index_get", "rna_Mesh_active_vertex_color_index_set", "rna_Mesh_active_vertex_color_index_range");
+ RNA_def_property_ui_text(prop, "Active Vertex Color Index", "Active vertex color index");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+}
+
+/* mesh.uv_layers */
+static void rna_def_uv_textures(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "UVTextures");
+ srna= RNA_def_struct(brna, "UVTextures", NULL);
+ RNA_def_struct_sdna(srna, "Mesh");
+ RNA_def_struct_ui_text(srna, "UV Textures", "Collection of uv textures");
+
+ func= RNA_def_function(srna, "new", "rna_Mesh_uv_texture_new");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ RNA_def_function_ui_description(func, "Add a UV texture layer to Mesh.");
+ parm= RNA_def_string(func, "name", "UVTex", 0, "", "UV Texture name.");
+ parm= RNA_def_pointer(func, "layer", "MeshTextureFaceLayer", "", "The newly created layer.");
+ RNA_def_function_return(func, parm);
+
+/*
+ func= RNA_def_function(srna, "remove", "rna_Mesh_uv_layers_remove");
+ RNA_def_function_ui_description(func, "Remove a vertex color layer.");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm= RNA_def_pointer(func, "layer", "Layer", "", "The layer to remove.");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
+*/
+ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED);
+ RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
+ RNA_def_property_pointer_funcs(prop, "rna_Mesh_active_uv_texture_get", "rna_Mesh_active_uv_texture_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Active UV Texture", "Active UV texture");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop, "rna_Mesh_active_uv_texture_index_get", "rna_Mesh_active_uv_texture_index_set", "rna_Mesh_active_uv_texture_index_range");
+ RNA_def_property_ui_text(prop, "Active UV Texture Index", "Active UV texture index");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+}
static void rna_def_mesh(BlenderRNA *brna)
{
@@ -1554,11 +1706,13 @@ static void rna_def_mesh(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "mvert", "totvert");
RNA_def_property_struct_type(prop, "MeshVertex");
RNA_def_property_ui_text(prop, "Vertices", "Vertices of the mesh");
+ rna_def_mesh_vertices(brna, prop);
prop= RNA_def_property(srna, "edges", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "medge", "totedge");
RNA_def_property_struct_type(prop, "MeshEdge");
RNA_def_property_ui_text(prop, "Edges", "Edges of the mesh");
+ rna_def_mesh_edges(brna, prop);
prop= RNA_def_property(srna, "faces", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "mface", "totface");
@@ -1583,18 +1737,7 @@ static void rna_def_mesh(BlenderRNA *brna)
RNA_def_property_collection_funcs(prop, "rna_Mesh_uv_textures_begin", 0, 0, 0, "rna_Mesh_uv_textures_length", 0, 0);
RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
RNA_def_property_ui_text(prop, "UV Textures", "");
-
- prop= RNA_def_property(srna, "active_uv_texture", PROP_POINTER, PROP_UNSIGNED);
- RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
- RNA_def_property_pointer_funcs(prop, "rna_Mesh_active_uv_texture_get", "rna_Mesh_active_uv_texture_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Active UV Texture", "Active UV texture");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- prop= RNA_def_property(srna, "active_uv_texture_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_Mesh_active_uv_texture_index_get", "rna_Mesh_active_uv_texture_index_set", "rna_Mesh_active_uv_texture_index_range");
- RNA_def_property_ui_text(prop, "Active UV Texture Index", "Active UV texture index");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+ rna_def_uv_textures(brna, prop);
prop= RNA_def_property(srna, "uv_texture_clone", PROP_POINTER, PROP_UNSIGNED);
RNA_def_property_struct_type(prop, "MeshTextureFaceLayer");
@@ -1623,18 +1766,7 @@ static void rna_def_mesh(BlenderRNA *brna)
RNA_def_property_collection_funcs(prop, "rna_Mesh_vertex_colors_begin", 0, 0, 0, "rna_Mesh_vertex_colors_length", 0, 0);
RNA_def_property_struct_type(prop, "MeshColorLayer");
RNA_def_property_ui_text(prop, "Vertex Colors", "");
-
- prop= RNA_def_property(srna, "active_vertex_color", PROP_POINTER, PROP_UNSIGNED);
- RNA_def_property_struct_type(prop, "MeshColorLayer");
- RNA_def_property_pointer_funcs(prop, "rna_Mesh_active_vertex_color_get", "rna_Mesh_active_vertex_color_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Active Vertex Color Layer", "Active vertex color layer");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- prop= RNA_def_property(srna, "active_vertex_color_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_Mesh_active_vertex_color_index_get", "rna_Mesh_active_vertex_color_index_set", "rna_Mesh_active_vertex_color_index_range");
- RNA_def_property_ui_text(prop, "Active Vertex Color Index", "Active vertex color index");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+ rna_def_vertex_colors(brna, prop);
prop= RNA_def_property(srna, "layers_float", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer");
@@ -1696,7 +1828,7 @@ static void rna_def_mesh(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space rotation");
RNA_def_property_editable_func(prop, texspace_editable);
RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");*/
-
+
/* Mesh Draw Options for Edit Mode*/
prop= RNA_def_property(srna, "show_edges", PROP_BOOLEAN, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c
index d011ddd27ce..220a66d089a 100644
--- a/source/blender/makesrna/intern/rna_mesh_api.c
+++ b/source/blender/makesrna/intern/rna_mesh_api.c
@@ -37,15 +37,6 @@
#ifdef RNA_RUNTIME
-static void rna_Mesh_uv_texture_add(struct Mesh *me, struct bContext *C)
-{
- ED_mesh_uv_texture_add(C, NULL, NULL, me);
-}
-
-static void rna_Mesh_vertex_color_add(struct Mesh *me, struct bContext *C)
-{
- ED_mesh_color_add(C, NULL, NULL, me);
-}
#else
@@ -59,36 +50,12 @@ void RNA_api_mesh(StructRNA *srna)
parm= RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix.", 0.0f, 0.0f);
RNA_def_property_flag(parm, PROP_REQUIRED);
- func= RNA_def_function(srna, "add_geometry", "ED_mesh_geometry_add");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm= RNA_def_int(func, "vertices", 0, 0, INT_MAX, "Number", "Number of vertices to add.", 0, INT_MAX);
- RNA_def_property_flag(parm, PROP_REQUIRED);
- parm= RNA_def_int(func, "edges", 0, 0, INT_MAX, "Number", "Number of edges to add.", 0, INT_MAX);
- RNA_def_property_flag(parm, PROP_REQUIRED);
- parm= RNA_def_int(func, "faces", 0, 0, INT_MAX, "Number", "Number of faces to add.", 0, INT_MAX);
- RNA_def_property_flag(parm, PROP_REQUIRED);
-
- func= RNA_def_function(srna, "add_uv_texture", "rna_Mesh_uv_texture_add");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- RNA_def_function_ui_description(func, "Add a UV texture layer to Mesh.");
-
- func= RNA_def_function(srna, "add_vertex_color", "rna_Mesh_vertex_color_add");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- RNA_def_function_ui_description(func, "Add a vertex color layer to Mesh.");
-
func= RNA_def_function(srna, "calc_normals", "ED_mesh_calc_normals");
RNA_def_function_ui_description(func, "Calculate vertex normals.");
func= RNA_def_function(srna, "update", "ED_mesh_update");
RNA_def_boolean(func, "calc_edges", 0, "Calculate Edges", "Force recalculation of edges.");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
-
- func= RNA_def_function(srna, "add_material", "ED_mesh_material_add");
- RNA_def_function_ui_description(func, "Add a new material to Mesh.");
- parm= RNA_def_pointer(func, "material", "Material", "", "Material to add.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
-
-
}
#endif
diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c
index 0de8455bdb7..0f2c74d962e 100644
--- a/source/blender/makesrna/intern/rna_meta.c
+++ b/source/blender/makesrna/intern/rna_meta.c
@@ -35,6 +35,8 @@
#include "BLI_math.h"
+#include "MEM_guardedalloc.h"
+
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
@@ -89,6 +91,8 @@ static void rna_MetaBall_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
MetaBall *mb= ptr->id.data;
Object *ob;
+ /* cheating way for importers to avoid slow updates */
+ if(mb->id.us > 0) {
for(ob=bmain->object.first; ob; ob= ob->id.next)
if(ob->data == mb)
copy_mball_properties(scene, ob);
@@ -96,21 +100,57 @@ static void rna_MetaBall_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
DAG_id_flush_update(&mb->id, OB_RECALC_DATA);
WM_main_add_notifier(NC_GEOM|ND_DATA, mb);
}
+}
-#else
+static MetaElem *rna_MetaBall_elements_new(MetaBall *mb, int type)
+{
+ MetaElem *ml= add_metaball_element(mb, type);
-static void rna_def_metaelement(BlenderRNA *brna)
+ /* cheating way for importers to avoid slow updates */
+ if(mb->id.us > 0) {
+ DAG_id_flush_update(&mb->id, OB_RECALC_DATA);
+ WM_main_add_notifier(NC_GEOM|ND_DATA, &mb->id);
+ }
+
+ return ml;
+}
+
+static void rna_MetaBall_elements_remove(MetaBall *mb, ReportList *reports, MetaElem *ml)
{
- StructRNA *srna;
- PropertyRNA *prop;
- static EnumPropertyItem prop_type_items[] = {
+ int found= 0;
+
+ found= BLI_remlink_safe(&mb->elems, ml);
+
+ if(!found) {
+ BKE_reportf(reports, RPT_ERROR, "MetaBall \"%s\" does not contain spline given", mb->id.name+2);
+ return;
+ }
+
+ MEM_freeN(ml);
+ /* invalidate pointer!, no can do */
+
+ /* cheating way for importers to avoid slow updates */
+ if(mb->id.us > 0) {
+ DAG_id_flush_update(&mb->id, OB_RECALC_DATA);
+ WM_main_add_notifier(NC_GEOM|ND_DATA, &mb->id);
+ }
+}
+
+#else
+
+static EnumPropertyItem metaelem_type_items[] = {
{MB_BALL, "BALL", ICON_META_BALL, "Ball", ""},
- {MB_TUBE, "TUBE", ICON_META_TUBE, "Tube", ""},
+ {MB_TUBE, "CAPSULE", ICON_META_CAPSULE, "Capsule", ""},
{MB_PLANE, "PLANE", ICON_META_PLANE, "Plane", ""},
{MB_ELIPSOID, "ELLIPSOID", ICON_META_ELLIPSOID, "Ellipsoid", ""}, // NOTE: typo at original definition!
{MB_CUBE, "CUBE", ICON_META_CUBE, "Cube", ""},
{0, NULL, 0, NULL, NULL}};
+static void rna_def_metaelement(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
srna= RNA_def_struct(brna, "MetaElement", NULL);
RNA_def_struct_sdna(srna, "MetaElem");
RNA_def_struct_ui_text(srna, "Meta Element", "Blobby element in a MetaBall datablock");
@@ -118,7 +158,7 @@ static void rna_def_metaelement(BlenderRNA *brna)
/* enums */
prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_type_items);
+ RNA_def_property_enum_items(prop, metaelem_type_items);
RNA_def_property_ui_text(prop, "Type", "Metaball types");
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
@@ -176,6 +216,37 @@ static void rna_def_metaelement(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
}
+/* mball.elements */
+static void rna_def_metaball_elements(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "MetaBallElements");
+ srna= RNA_def_struct(brna, "MetaBallElements", NULL);
+ RNA_def_struct_sdna(srna, "MetaBall");
+ RNA_def_struct_ui_text(srna, "Meta Elements", "Collection of metaball elements");
+
+ func= RNA_def_function(srna, "new", "rna_MetaBall_elements_new");
+ RNA_def_function_ui_description(func, "Add a new spline to the curve.");
+ parm= RNA_def_enum(func, "type", metaelem_type_items, MB_BALL, "", "type for the new meta element.");
+ parm= RNA_def_pointer(func, "element", "MetaElement", "", "The newly created metaelement.");
+ RNA_def_function_return(func, parm);
+
+ func= RNA_def_function(srna, "remove", "rna_MetaBall_elements_remove");
+ RNA_def_function_ui_description(func, "Remove a spline from a curve.");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm= RNA_def_pointer(func, "element", "MetaElement", "", "The element to remove.");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
+
+ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "lastelem");
+ RNA_def_property_ui_text(prop, "Active Element", "Last selected element");
+}
+
static void rna_def_metaball(BlenderRNA *brna)
{
StructRNA *srna;
@@ -195,11 +266,8 @@ static void rna_def_metaball(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "elems", NULL);
RNA_def_property_struct_type(prop, "MetaElement");
RNA_def_property_ui_text(prop, "Elements", "Meta elements");
+ rna_def_metaball_elements(brna, prop);
- prop= RNA_def_property(srna, "active_element", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "lastelem");
- RNA_def_property_ui_text(prop, "Last selected element.", "Last selected element");
-
/* enums */
prop= RNA_def_property(srna, "update_method", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "flag");
@@ -257,6 +325,7 @@ static void rna_def_metaball(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
RNA_def_property_struct_type(prop, "Material");
RNA_def_property_ui_text(prop, "Materials", "");
+ RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
/* anim */
rna_def_animdata_common(srna);
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 0fb79de8c65..47a9f8e7537 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -1057,7 +1057,7 @@ static void def_cmp_image(StructRNA *srna)
prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "frames");
- RNA_def_property_range(prop, 1, MAXFRAMEF);
+ RNA_def_property_range(prop, 0, MAXFRAMEF);
RNA_def_property_ui_text(prop, "Frames", "Number of images used in animation");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
@@ -1638,6 +1638,11 @@ static void def_cmp_crop(StructRNA *srna)
RNA_def_property_ui_text(prop, "Crop Image Size", "Whether to crop the size of the input image");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "relative", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom2", 1);
+ RNA_def_property_ui_text(prop, "Relative", "Use relative values to crop image");
+ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+
RNA_def_struct_sdna_from(srna, "NodeTwoXYs", "storage");
prop = RNA_def_property(srna, "min_x", PROP_INT, PROP_NONE);
@@ -1663,6 +1668,30 @@ static void def_cmp_crop(StructRNA *srna)
RNA_def_property_range(prop, 0, 10000);
RNA_def_property_ui_text(prop, "Y2", "");
RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "rel_min_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "fac_x1");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "X1", "");
+ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "rel_max_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "fac_x2");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "X2", "");
+ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "rel_min_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "fac_y1");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Y1", "");
+ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "rel_max_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "fac_y2");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Y2", "");
+ RNA_def_property_update(prop, NC_NODE|NA_EDITED, "rna_Node_update");
}
static void def_cmp_dblur(StructRNA *srna)
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index e61044776ca..cf4d554ac4d 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -43,6 +43,9 @@
#include "BKE_tessmesh.h"
+#include "BLO_sys_types.h" /* needed for intptr_t used in ED_mesh.h */
+#include "ED_mesh.h"
+
#include "WM_api.h"
#include "WM_types.h"
//bleh
@@ -75,6 +78,7 @@ static EnumPropertyItem collision_bounds_items[] = {
{OB_BOUND_CONE, "CONE", 0, "Cone", ""},
{OB_BOUND_POLYT, "CONVEX_HULL", 0, "Convex Hull", ""},
{OB_BOUND_POLYH, "TRIANGLE_MESH", 0, "Triangle Mesh", ""},
+ {OB_BOUND_CAPSULE, "CAPSULE", 0, "Capsule", ""},
//{OB_DYN_MESH, "DYNAMIC_MESH", 0, "Dynamic Mesh", ""},
{0, NULL, 0, NULL, NULL}};
@@ -256,6 +260,8 @@ static void rna_Object_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
rna_Object_layer_update__internal(bmain, scene, base, ob);
ob->lay= base->lay;
+
+ WM_main_add_notifier(NC_SCENE|ND_LAYER_CONTENT, scene);
}
static void rna_Base_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
@@ -265,6 +271,8 @@ static void rna_Base_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
rna_Object_layer_update__internal(bmain, scene, base, ob);
ob->lay= base->lay;
+
+ WM_main_add_notifier(NC_SCENE|ND_LAYER_CONTENT, scene);
}
static int rna_Object_data_editable(PointerRNA *ptr)
@@ -379,6 +387,7 @@ static EnumPropertyItem *rna_Object_collision_bounds_itemf(bContext *C, PointerR
RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_CYLINDER);
RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_SPHERE);
RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_BOX);
+ RNA_enum_items_add_value(&item, &totitem, collision_bounds_items, OB_BOUND_CAPSULE);
}
RNA_enum_item_end(&item, &totitem);
@@ -1016,23 +1025,24 @@ static void rna_Object_active_constraint_set(PointerRNA *ptr, PointerRNA value)
constraints_set_active(&ob->constraints, (bConstraint *)value.data);
}
-static bConstraint *rna_Object_constraint_new(Object *object, int type)
+static bConstraint *rna_Object_constraints_new(Object *object, int type)
{
WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT|NA_ADDED, object);
return add_ob_constraint(object, NULL, type);
}
-static int rna_Object_constraint_remove(Object *object, int index)
+static void rna_Object_constraints_remove(Object *object, ReportList *reports, bConstraint *con)
{
- int ok = remove_constraint_index(&object->constraints, index);
- if(ok) {
+ if(BLI_findindex(&object->constraints, con) == -1) {
+ BKE_reportf(reports, RPT_ERROR, "Constraint '%s' not found in object '%s'.", con->name, object->id.name+2);
+ return;
+ }
+
+ remove_constraint(&object->constraints, con);
ED_object_constraint_set_active(object, NULL);
WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT, object);
}
- return ok;
-}
-
static ModifierData *rna_Object_modifier_new(Object *object, bContext *C, ReportList *reports, char *name, int type)
{
return ED_object_modifier_add(reports, CTX_data_main(C), CTX_data_scene(C), object, name, type);
@@ -1056,6 +1066,12 @@ static void rna_Object_boundbox_get(PointerRNA *ptr, float *values)
}
+static void rna_Object_add_vertex_to_group(Object *ob, int index_len, int *index, bDeformGroup *def, float weight, int assignmode)
+{
+ while(index_len--)
+ ED_vgroup_vert_add(ob, def, *index++, weight, assignmode);
+}
+
/* generic poll functions */
int rna_Lattice_object_poll(PointerRNA *ptr, PointerRNA value)
{
@@ -1382,26 +1398,24 @@ static void rna_def_object_constraints(BlenderRNA *brna, PropertyRNA *cprop)
/* Constraint collection */
- func= RNA_def_function(srna, "new", "rna_Object_constraint_new");
+ func= RNA_def_function(srna, "new", "rna_Object_constraints_new");
RNA_def_function_ui_description(func, "Add a new constraint to this object");
- /* return type */
- parm= RNA_def_pointer(func, "constraint", "Constraint", "", "New constraint.");
- RNA_def_function_return(func, parm);
/* object to add */
parm= RNA_def_enum(func, "type", constraint_type_items, 1, "", "Constraint type to add.");
RNA_def_property_flag(parm, PROP_REQUIRED);
-
- func= RNA_def_function(srna, "remove", "rna_Object_constraint_remove");
- RNA_def_function_ui_description(func, "Remove a constraint from this object.");
/* return type */
- parm= RNA_def_boolean(func, "success", 0, "Success", "Removed the constraint successfully.");
+ parm= RNA_def_pointer(func, "constraint", "Constraint", "", "New constraint.");
RNA_def_function_return(func, parm);
- /* object to add */
- parm= RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "", 0, INT_MAX);
- RNA_def_property_flag(parm, PROP_REQUIRED);
+
+ func= RNA_def_function(srna, "remove", "rna_Object_constraints_remove");
+ RNA_def_function_ui_description(func, "Remove a constraint from this object.");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ /* constraint to remove */
+ parm= RNA_def_pointer(func, "constraint", "Constraint", "", "Removed constraint.");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
-/* armature.bones.* */
+/* object.modifiers */
static void rna_def_object_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
{
StructRNA *srna;
@@ -1446,9 +1460,93 @@ static void rna_def_object_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_ui_description(func, "Remove an existing modifier from the object.");
/* target to remove*/
parm= RNA_def_pointer(func, "modifier", "Modifier", "", "Modifier to remove.");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
+}
+
+/* object.particle_systems */
+static void rna_def_object_particle_systems(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+
+ PropertyRNA *prop;
+
+ // FunctionRNA *func;
+ // PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "ParticleSystems");
+ srna= RNA_def_struct(brna, "ParticleSystems", NULL);
+ RNA_def_struct_sdna(srna, "Object");
+ RNA_def_struct_ui_text(srna, "Particle Systems", "Collection of particle systems");
+
+ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ParticleSystem");
+ RNA_def_property_pointer_funcs(prop, "rna_Object_active_particle_system_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Particle System", "Active particle system being displayed");
+ RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
+
+ prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop, "rna_Object_active_particle_system_index_get", "rna_Object_active_particle_system_index_set", "rna_Object_active_particle_system_index_range");
+ RNA_def_property_ui_text(prop, "Active Particle System Index", "Index of active particle system slot");
+ RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_particle_update");
+}
+
+
+/* object.vertex_groups */
+static void rna_def_object_vertex_groups(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ static EnumPropertyItem assign_mode_items[] = {
+ {WEIGHT_REPLACE, "REPLACE", 0, "Replace", "Replace"},
+ {WEIGHT_ADD, "ADD", 0, "Add", "Add"},
+ {WEIGHT_SUBTRACT, "SUBTRACT", 0, "Subtract", "Subtract"},
+ {0, NULL, 0, NULL, NULL}
+ };
+
+ StructRNA *srna;
+
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "VertexGroups");
+ srna= RNA_def_struct(brna, "VertexGroups", NULL);
+ RNA_def_struct_sdna(srna, "Object");
+ RNA_def_struct_ui_text(srna, "Vertex Groups", "Collection of vertex groups");
+
+ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "VertexGroup");
+ RNA_def_property_pointer_funcs(prop, "rna_Object_active_vertex_group_get", "rna_Object_active_vertex_group_set", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Vertex Group", "Vertex groups of the object");
+ RNA_def_property_update(prop, NC_GEOM|ND_DATA, "rna_Object_internal_update_data");
+
+ prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "actdef");
+ RNA_def_property_int_funcs(prop, "rna_Object_active_vertex_group_index_get", "rna_Object_active_vertex_group_index_set", "rna_Object_active_vertex_group_index_range");
+ RNA_def_property_ui_text(prop, "Active Vertex Group Index", "Active index in vertex group array");
+ RNA_def_property_update(prop, NC_GEOM|ND_DATA, "rna_Object_internal_update_data");
+
+ /* vertex groups */ // add_vertex_group
+ func= RNA_def_function(srna, "new", "ED_vgroup_add_name");
+ RNA_def_function_ui_description(func, "Add vertex group to object.");
+ parm= RNA_def_string(func, "name", "Group", 0, "", "Vertex group name."); /* optional */
+ parm= RNA_def_pointer(func, "group", "VertexGroup", "", "New vertex group.");
+ RNA_def_function_return(func, parm);
+
+ func= RNA_def_function(srna, "assign", "rna_Object_add_vertex_to_group");
+ RNA_def_function_ui_description(func, "Add vertex to a vertex group.");
+ /* TODO, see how array size of 0 works, this shouldnt be used */
+ parm= RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "Index List.", 0, 0);
+ RNA_def_property_flag(parm, PROP_DYNAMIC);
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_pointer(func, "group", "VertexGroup", "", "Vertex group to add vertex to.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_float(func, "weight", 0, 0.0f, 1.0f, "", "Vertex weight.", 0.0f, 1.0f);
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_enum(func, "type", assign_mode_items, 0, "", "Vertex assign mode.");
RNA_def_property_flag(parm, PROP_REQUIRED);
}
+
static void rna_def_object(BlenderRNA *brna)
{
StructRNA *srna;
@@ -1506,6 +1604,7 @@ static void rna_def_object(BlenderRNA *brna)
{OB_BOUND_CYLINDER, "CYLINDER", 0, "Cylinder", ""},
{OB_BOUND_CONE, "CONE", 0, "Cone", ""},
{OB_BOUND_POLYH, "POLYHEDRON", 0, "Polyhedron", ""},
+ {OB_BOUND_CAPSULE, "CAPSULE", 0, "Capsule", ""},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem dupli_items[] = {
@@ -1798,18 +1897,7 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "defbase", NULL);
RNA_def_property_struct_type(prop, "VertexGroup");
RNA_def_property_ui_text(prop, "Vertex Groups", "Vertex groups of the object");
-
- prop= RNA_def_property(srna, "active_vertex_group", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "VertexGroup");
- RNA_def_property_pointer_funcs(prop, "rna_Object_active_vertex_group_get", "rna_Object_active_vertex_group_set", NULL, NULL);
- RNA_def_property_ui_text(prop, "Active Vertex Group", "Vertex groups of the object");
- RNA_def_property_update(prop, NC_GEOM|ND_DATA, "rna_Object_internal_update_data");
-
- prop= RNA_def_property(srna, "active_vertex_group_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "actdef");
- RNA_def_property_int_funcs(prop, "rna_Object_active_vertex_group_index_get", "rna_Object_active_vertex_group_index_set", "rna_Object_active_vertex_group_index_range");
- RNA_def_property_ui_text(prop, "Active Vertex Group Index", "Active index in vertex group array");
- RNA_def_property_update(prop, NC_GEOM|ND_DATA, "rna_Object_internal_update_data");
+ rna_def_object_vertex_groups(brna, prop);
/* empty */
prop= RNA_def_property(srna, "empty_draw_type", PROP_ENUM, PROP_NONE);
@@ -1858,17 +1946,7 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "particlesystem", NULL);
RNA_def_property_struct_type(prop, "ParticleSystem");
RNA_def_property_ui_text(prop, "Particle Systems", "Particle systems emitted from the object");
-
- prop= RNA_def_property(srna, "active_particle_system", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "ParticleSystem");
- RNA_def_property_pointer_funcs(prop, "rna_Object_active_particle_system_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Active Particle System", "Active particle system being displayed");
- RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
-
- prop= RNA_def_property(srna, "active_particle_system_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_Object_active_particle_system_index_get", "rna_Object_active_particle_system_index_set", "rna_Object_active_particle_system_index_range");
- RNA_def_property_ui_text(prop, "Active Particle System Index", "Index of active particle system slot");
- RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_particle_update");
+ rna_def_object_particle_systems(brna, prop);
/* restrict */
prop= RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
@@ -2159,4 +2237,3 @@ void RNA_def_object(BlenderRNA *brna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index 17e6630a48a..d48e714ea23 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -35,9 +35,9 @@
#include "DNA_object_types.h"
-#include "BLO_sys_types.h" /* needed for intptr_t used in ED_mesh.h */
+// #include "BLO_sys_types.h" /* needed for intptr_t used in ED_mesh.h */
-#include "ED_mesh.h"
+// #include "ED_mesh.h"
#ifdef RNA_RUNTIME
@@ -261,17 +261,6 @@ static void rna_Object_free_duplilist(Object *ob, ReportList *reports)
}
}
-static bDeformGroup *rna_Object_add_vertex_group(Object *ob, char *group_name)
-{
- return ED_vgroup_add_name(ob, group_name);
-}
-
-static void rna_Object_add_vertex_to_group(Object *ob, int vertex_index, bDeformGroup *def, float weight, int assignmode)
-{
- /* creates dverts if needed */
- ED_vgroup_vert_add(ob, def, vertex_index, weight, assignmode);
-}
-
/* copied from old API Object.makeDisplayList (Object.c)
* use _ suffix because this exists for internal rna */
static void rna_Object_update(Object *ob, Scene *sce, int object, int data, int time)
@@ -433,13 +422,6 @@ void RNA_api_object(StructRNA *srna)
{0, NULL, 0, NULL, NULL}
};
- static EnumPropertyItem assign_mode_items[] = {
- {WEIGHT_REPLACE, "REPLACE", 0, "Replace", "Replace"}, /* TODO: more meaningful descriptions */
- {WEIGHT_ADD, "ADD", 0, "Add", "Add"},
- {WEIGHT_SUBTRACT, "SUBTRACT", 0, "Subtract", "Subtract"},
- {0, NULL, 0, NULL, NULL}
- };
-
/* mesh */
func= RNA_def_function(srna, "create_mesh", "rna_Object_create_mesh");
RNA_def_function_ui_description(func, "Create a Mesh datablock with modifiers applied.");
@@ -464,24 +446,6 @@ void RNA_api_object(StructRNA *srna)
RNA_def_function_ui_description(func, "Free the list of dupli objects.");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
- /* vertex groups */
- func= RNA_def_function(srna, "add_vertex_group", "rna_Object_add_vertex_group");
- RNA_def_function_ui_description(func, "Add vertex group to object.");
- parm= RNA_def_string(func, "name", "Group", 0, "", "Vertex group name."); /* optional */
- parm= RNA_def_pointer(func, "group", "VertexGroup", "", "New vertex group.");
- RNA_def_function_return(func, parm);
-
- func= RNA_def_function(srna, "add_vertex_to_group", "rna_Object_add_vertex_to_group");
- RNA_def_function_ui_description(func, "Add vertex to a vertex group.");
- parm= RNA_def_int(func, "vertex_index", 0, 0, 0, "", "Vertex index.", 0, 0);
- RNA_def_property_flag(parm, PROP_REQUIRED);
- parm= RNA_def_pointer(func, "group", "VertexGroup", "", "Vertex group to add vertex to.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
- parm= RNA_def_float(func, "weight", 0, 0.0f, 1.0f, "", "Vertex weight.", 0.0f, 1.0f);
- RNA_def_property_flag(parm, PROP_REQUIRED);
- parm= RNA_def_enum(func, "type", assign_mode_items, 0, "", "Vertex assign mode.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
-
/* Armature */
func= RNA_def_function(srna, "find_armature", "rna_Object_find_armature");
RNA_def_function_ui_description(func, "Find armature influencing this object as a parent or via a modifier.");
diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c
index 1eadd0e7676..3a8f66a3773 100644
--- a/source/blender/makesrna/intern/rna_object_force.c
+++ b/source/blender/makesrna/intern/rna_object_force.c
@@ -695,6 +695,26 @@ static EnumPropertyItem *rna_Effector_shape_itemf(bContext *C, PointerRNA *ptr,
#else
+/* ptcache.point_caches */
+static void rna_def_ptcache_point_caches(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ // FunctionRNA *func;
+ // PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "PointCaches");
+ srna= RNA_def_struct(brna, "PointCaches", NULL);
+ RNA_def_struct_sdna(srna, "PointCache");
+ RNA_def_struct_ui_text(srna, "Point Caches", "Collection of point caches");
+
+ prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop, "rna_Cache_active_point_cache_index_get", "rna_Cache_active_point_cache_index_set", "rna_Cache_active_point_cache_index_range");
+ RNA_def_property_ui_text(prop, "Active Point Cache Index", "");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_change");
+}
+
static void rna_def_pointcache(BlenderRNA *brna)
{
StructRNA *srna;
@@ -785,11 +805,7 @@ static void rna_def_pointcache(BlenderRNA *brna)
RNA_def_property_collection_funcs(prop, "rna_Cache_list_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0);
RNA_def_property_struct_type(prop, "PointCache");
RNA_def_property_ui_text(prop, "Point Cache List", "Point cache list");
-
- prop= RNA_def_property(srna, "active_point_cache_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_Cache_active_point_cache_index_get", "rna_Cache_active_point_cache_index_set", "rna_Cache_active_point_cache_index_range");
- RNA_def_property_ui_text(prop, "Active Point Cache Index", "");
- RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_change");
+ rna_def_ptcache_point_caches(brna, prop);
}
static void rna_def_collision(BlenderRNA *brna)
@@ -1458,7 +1474,7 @@ static void rna_def_softbody(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Mass", "General Mass value");
RNA_def_property_update(prop, 0, "rna_softbody_update");
- prop= RNA_def_property(srna, "mass_vertex_group", PROP_STRING, PROP_NONE);
+ prop= RNA_def_property(srna, "vertex_group_mass", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "namedVG_Mass");
RNA_def_property_ui_text(prop, "Mass Vertex Group", "Control point mass values");
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SoftBodySettings_mass_vgroup_set");
@@ -1479,7 +1495,7 @@ static void rna_def_softbody(BlenderRNA *brna)
/* Goal */
- prop= RNA_def_property(srna, "goal_vertex_group", PROP_STRING, PROP_NONE);
+ prop= RNA_def_property(srna, "vertex_group_goal", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "vertgroup");
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* not impossible .. but not supported yet */
RNA_def_property_string_funcs(prop, "rna_SoftBodySettings_goal_vgroup_get", "rna_SoftBodySettings_goal_vgroup_length", "rna_SoftBodySettings_goal_vgroup_set");
@@ -1565,7 +1581,7 @@ static void rna_def_softbody(BlenderRNA *brna)
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Shear", "Shear Stiffness");
- prop= RNA_def_property(srna, "spring_vertex_group", PROP_STRING, PROP_NONE);
+ prop= RNA_def_property(srna, "vertex_group_spring", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "namedVG_Spring_K");
RNA_def_property_ui_text(prop, "Spring Vertex Group", "Control point spring strength values");
RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SoftBodySettings_spring_vgroup_set");
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c
index ce797f21494..edd661760a0 100644
--- a/source/blender/makesrna/intern/rna_pose.c
+++ b/source/blender/makesrna/intern/rna_pose.c
@@ -62,6 +62,8 @@
#include "MEM_guardedalloc.h"
+#include "WM_api.h"
+
#include "RNA_access.h"
static void rna_Pose_update(Main *bmain, Scene *scene, PointerRNA *ptr)
@@ -442,12 +444,17 @@ static bConstraint *rna_PoseChannel_constraints_new(bPoseChannel *pchan, int typ
return add_pose_constraint(NULL, pchan, NULL, type);
}
-static int rna_PoseChannel_constraints_remove(bPoseChannel *pchan, int index)
+static void rna_PoseChannel_constraints_remove(ID *id, bPoseChannel *pchan, ReportList *reports, bConstraint *con)
{
+ if(BLI_findindex(&pchan->constraints, con) == -1) {
+ BKE_reportf(reports, RPT_ERROR, "Constraint '%s' not found in pose bone '%s'.", con->name, pchan->name);
+ return;
+ }
+
// TODO
- //ED_object_constraint_set_active(object, NULL);
- //WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT, object);
- return remove_constraint_index(&pchan->constraints, index);
+ //ED_object_constraint_set_active(id, NULL);
+ WM_main_add_notifier(NC_OBJECT|ND_CONSTRAINT, id);
+ remove_constraint(&pchan->constraints, con);
}
static int rna_PoseChannel_proxy_editable(PointerRNA *ptr)
@@ -652,12 +659,10 @@ static void rna_def_pose_channel_constraints(BlenderRNA *brna, PropertyRNA *cpro
func= RNA_def_function(srna, "remove", "rna_PoseChannel_constraints_remove");
RNA_def_function_ui_description(func, "Remove a constraint from this object.");
- /* return type */
- parm= RNA_def_boolean(func, "success", 0, "Success", "Removed the constraint successfully.");
- RNA_def_function_return(func, parm);
- /* object to add */
- parm= RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "", 0, INT_MAX);
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_function_flag(func, FUNC_USE_REPORTS|FUNC_USE_SELF_ID); /* ID needed for refresh */
+ /* constraint to remove */
+ parm= RNA_def_pointer(func, "constraint", "Constraint", "", "Removed constraint.");
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
static void rna_def_pose_channel(BlenderRNA *brna)
@@ -1135,6 +1140,34 @@ static void rna_def_pose_ikparam(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "IK Solver", "IK solver for which these parameters are defined, 0 for Legacy, 1 for iTaSC");
}
+/* pose.bone_groups */
+static void rna_def_bone_groups(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+// FunctionRNA *func;
+// PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BoneGroups");
+ srna= RNA_def_struct(brna, "BoneGroups", NULL);
+ RNA_def_struct_sdna(srna, "bPose");
+ RNA_def_struct_ui_text(srna, "Bone Groups", "Collection of bone groups");
+
+ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "BoneGroup");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_pointer_funcs(prop, "rna_Pose_active_bone_group_get", "rna_Pose_active_bone_group_set", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Bone Group", "Active bone group for this pose");
+ RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
+
+ prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "active_group");
+ RNA_def_property_int_funcs(prop, "rna_Pose_active_bone_group_index_get", "rna_Pose_active_bone_group_index_set", "rna_Pose_active_bone_group_index_range");
+ RNA_def_property_ui_text(prop, "Active Bone Group Index", "Active index in bone groups array");
+ RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
+}
+
static void rna_def_pose(BlenderRNA *brna)
{
StructRNA *srna;
@@ -1156,20 +1189,8 @@ static void rna_def_pose(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "agroups", NULL);
RNA_def_property_struct_type(prop, "BoneGroup");
RNA_def_property_ui_text(prop, "Bone Groups", "Groups of the bones");
+ rna_def_bone_groups(brna, prop);
- prop= RNA_def_property(srna, "active_bone_group", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "BoneGroup");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_pointer_funcs(prop, "rna_Pose_active_bone_group_get", "rna_Pose_active_bone_group_set", NULL, NULL);
- RNA_def_property_ui_text(prop, "Active Bone Group", "Active bone group for this pose");
- RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
-
- prop= RNA_def_property(srna, "active_bone_group_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "active_group");
- RNA_def_property_int_funcs(prop, "rna_Pose_active_bone_group_index_get", "rna_Pose_active_bone_group_index_set", "rna_Pose_active_bone_group_index_range");
- RNA_def_property_ui_text(prop, "Active Bone Group Index", "Active index in bone groups array");
- RNA_def_property_update(prop, NC_OBJECT|ND_POSE, "rna_Pose_update");
-
/* ik solvers */
prop= RNA_def_property(srna, "ik_solver", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "iksolver");
diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c
index e4a89ed3121..e6b86ae8766 100644
--- a/source/blender/makesrna/intern/rna_render.c
+++ b/source/blender/makesrna/intern/rna_render.c
@@ -291,8 +291,8 @@ static void rna_def_render_engine(BlenderRNA *brna)
static void rna_def_render_result(BlenderRNA *brna)
{
StructRNA *srna;
- PropertyRNA *prop;
FunctionRNA *func;
+ PropertyRNA *parm;
srna= RNA_def_struct(brna, "RenderResult", NULL);
RNA_def_struct_ui_text(srna, "Render Result", "Result of rendering, including all layers and passes");
@@ -300,22 +300,22 @@ static void rna_def_render_result(BlenderRNA *brna)
func= RNA_def_function(srna, "load_from_file", "RE_result_load_from_file");
RNA_def_function_ui_description(func, "Copies the pixels of this render result from an image file.");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
- prop= RNA_def_string(func, "filename", "", 0, "Filename", "Filename to load into this render tile, must be no smaller then the render result");
- RNA_def_property_flag(prop, PROP_REQUIRED);
+ parm= RNA_def_string_file_name(func, "filename", "", FILE_MAX, "File Name", "Filename to load into this render tile, must be no smaller then the render result");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
RNA_define_verify_sdna(0);
- prop= RNA_def_property(srna, "resolution_x", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "rectx");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ parm= RNA_def_property(srna, "resolution_x", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(parm, NULL, "rectx");
+ RNA_def_property_clear_flag(parm, PROP_EDITABLE);
- prop= RNA_def_property(srna, "resolution_y", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "recty");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ parm= RNA_def_property(srna, "resolution_y", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(parm, NULL, "recty");
+ RNA_def_property_clear_flag(parm, PROP_EDITABLE);
- prop= RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "RenderLayer");
- RNA_def_property_collection_funcs(prop, "rna_RenderResult_layers_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0);
+ parm= RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(parm, "RenderLayer");
+ RNA_def_property_collection_funcs(parm, "rna_RenderResult_layers_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0);
RNA_define_verify_sdna(1);
}
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index 4bfd0e4fd41..81b0df1d840 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -493,6 +493,13 @@ static int rna_Property_registered_optional_get(PointerRNA *ptr)
return prop->flag & PROP_REGISTER_OPTIONAL;
}
+static int rna_Property_runtime_get(PointerRNA *ptr)
+{
+ PropertyRNA *prop= (PropertyRNA*)ptr->data;
+ return prop->flag & PROP_RUNTIME;
+}
+
+
static int rna_BoolProperty_default_get(PointerRNA *ptr)
{
PropertyRNA *prop= (PropertyRNA*)ptr->data;
@@ -1018,6 +1025,11 @@ static void rna_def_property(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_boolean_funcs(prop, "rna_Property_registered_optional_get", NULL);
RNA_def_property_ui_text(prop, "Registered Optionally", "Property is optionally registered as part of type registration");
+
+ prop= RNA_def_property(srna, "is_runtime", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Property_runtime_get", NULL);
+ RNA_def_property_ui_text(prop, "Read Only", "Property is editable through RNA");
}
static void rna_def_function(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 8b3ff3a3904..82fcedd4ac7 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -166,6 +166,7 @@ EnumPropertyItem image_type_items[] = {
#include "BKE_mesh.h"
#include "BKE_sound.h"
#include "BKE_screen.h"
+#include "BKE_animsys.h"
#include "BLI_threads.h"
#include "BLI_editVert.h"
@@ -214,6 +215,8 @@ static Base *rna_Scene_object_link(Scene *scene, bContext *C, ReportList *report
/* slows down importers too much, run scene.update() */
/* DAG_scene_sort(G.main, scene); */
+ WM_main_add_notifier(NC_SCENE|ND_OB_ACTIVE, scene);
+
return base;
}
@@ -646,6 +649,22 @@ static void rna_RenderSettings_active_layer_index_range(PointerRNA *ptr, int *mi
*max= MAX2(0, *max);
}
+static PointerRNA rna_RenderSettings_active_layer_get(PointerRNA *ptr)
+{
+ RenderData *rd= (RenderData*)ptr->data;
+ SceneRenderLayer *srl = BLI_findlink(&rd->layers, rd->actlay);
+
+ return rna_pointer_inherit_refine(ptr, &RNA_SceneRenderLayer, srl);
+}
+
+static void rna_RenderSettings_active_layer_set(PointerRNA *ptr, PointerRNA value)
+{
+ RenderData *rd= (RenderData*)ptr->data;
+ SceneRenderLayer *srl= (SceneRenderLayer*)value.data;
+
+ rd->actlay = BLI_findindex(&rd->layers, srl);
+}
+
static void rna_RenderSettings_engine_set(PointerRNA *ptr, int value)
{
RenderData *rd= (RenderData*)ptr->data;
@@ -922,6 +941,33 @@ static void rna_TimeLine_remove(Scene *scene, ReportList *reports, TimeMarker *m
MEM_freeN(marker);
}
+static KeyingSet *rna_Scene_keying_set_new(Scene *sce, ReportList *reports,
+ char name[], int absolute, int insertkey_needed, int insertkey_visual)
+{
+ KeyingSet *ks= NULL;
+ short flag=0, keyingflag=0;
+
+ /* validate flags */
+ if (absolute)
+ flag |= KEYINGSET_ABSOLUTE;
+ if (insertkey_needed)
+ keyingflag |= INSERTKEY_NEEDED;
+ if (insertkey_visual)
+ keyingflag |= INSERTKEY_MATRIX;
+
+ /* call the API func, and set the active keyingset index */
+ ks= BKE_keyingset_add(&sce->keyingsets, name, flag, keyingflag);
+
+ if (ks) {
+ sce->active_keyingset= BLI_countlist(&sce->keyingsets);
+ return ks;
+ }
+ else {
+ BKE_report(reports, RPT_ERROR, "Keying Set could not be added.");
+ return NULL;
+ }
+}
+
#else
static void rna_def_transform_orientation(BlenderRNA *brna)
@@ -1812,6 +1858,35 @@ static void rna_def_scene_render_layer(BlenderRNA *brna)
rna_def_render_layer_common(srna, 1);
}
+/* curve.splines */
+static void rna_def_render_layers(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ // FunctionRNA *func;
+ // PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "RenderLayers");
+ srna= RNA_def_struct(brna, "RenderLayers", NULL);
+ RNA_def_struct_sdna(srna, "RenderData");
+ RNA_def_struct_ui_text(srna, "Render Layers", "Collection of render layers");
+
+ prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "actlay");
+ RNA_def_property_int_funcs(prop, "rna_RenderSettings_active_layer_index_get", "rna_RenderSettings_active_layer_index_set", "rna_RenderSettings_active_layer_index_range");
+ RNA_def_property_ui_text(prop, "Active Layer Index", "Active index in render layer array");
+ RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+
+ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_UNSIGNED);
+ RNA_def_property_struct_type(prop, "SceneRenderLayer");
+ RNA_def_property_pointer_funcs(prop, "rna_RenderSettings_active_layer_get", "rna_RenderSettings_active_layer_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Active Render Layer", "Active Render Layer");
+ RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
+
+}
+
static void rna_def_scene_render_data(BlenderRNA *brna)
{
StructRNA *srna;
@@ -2752,18 +2827,14 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
RNA_def_property_collection_sdna(prop, NULL, "layers", NULL);
RNA_def_property_struct_type(prop, "SceneRenderLayer");
RNA_def_property_ui_text(prop, "Render Layers", "");
+ rna_def_render_layers(brna, prop);
+
prop= RNA_def_property(srna, "use_single_layer", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_SINGLE_LAYER);
RNA_def_property_ui_text(prop, "Single Layer", "Only render the active layer");
RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
- prop= RNA_def_property(srna, "active_layer_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "actlay");
- RNA_def_property_int_funcs(prop, "rna_RenderSettings_active_layer_index_get", "rna_RenderSettings_active_layer_index_set", "rna_RenderSettings_active_layer_index_range");
- RNA_def_property_ui_text(prop, "Active Layer Index", "Active index in render layer array");
- RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
-
/* engine */
prop= RNA_def_property(srna, "engine", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, engine_items);
@@ -2891,7 +2962,7 @@ static void rna_def_timeline_markers(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_struct_sdna(srna, "Scene");
RNA_def_struct_ui_text(srna, "Timeline Markers", "Collection of timeline markers");
- func= RNA_def_function(srna, "add", "rna_TimeLine_add");
+ func= RNA_def_function(srna, "new", "rna_TimeLine_add");
RNA_def_function_ui_description(func, "Add a keyframe to the curve.");
parm= RNA_def_string(func, "name", "Marker", 0, "", "New name for the marker (not unique).");
RNA_def_property_flag(parm, PROP_REQUIRED);
@@ -2907,6 +2978,75 @@ static void rna_def_timeline_markers(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
+/* scene.keying_sets */
+static void rna_def_scene_keying_sets(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "KeyingSets");
+ srna= RNA_def_struct(brna, "KeyingSets", NULL);
+ RNA_def_struct_sdna(srna, "Scene");
+ RNA_def_struct_ui_text(srna, "Keying Sets", "Scene keying sets");
+
+ /* Add Keying Set */
+ func= RNA_def_function(srna, "new", "rna_Scene_keying_set_new");
+ RNA_def_function_ui_description(func, "Add a new Keying Set to Scene.");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ /* returns the new KeyingSet */
+ parm= RNA_def_pointer(func, "keyingset", "KeyingSet", "", "Newly created Keying Set.");
+ RNA_def_function_return(func, parm);
+ /* name */
+ RNA_def_string(func, "name", "KeyingSet", 64, "Name", "Name of Keying Set");
+ /* flags */
+ RNA_def_boolean(func, "absolute", 1, "Absolute", "Keying Set defines specific paths/settings to be keyframed (i.e. is not reliant on context info)");
+ /* keying flags */
+ RNA_def_boolean(func, "insertkey_needed", 0, "Insert Keyframes - Only Needed", "Only insert keyframes where they're needed in the relevant F-Curves.");
+ RNA_def_boolean(func, "insertkey_visual", 0, "Insert Keyframes - Visual", "Insert keyframes based on 'visual transforms'.");
+
+ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "KeyingSet");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_pointer_funcs(prop, "rna_Scene_active_keying_set_get", "rna_Scene_active_keying_set_set", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
+ RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
+
+ prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "active_keyingset");
+ RNA_def_property_int_funcs(prop, "rna_Scene_active_keying_set_index_get", "rna_Scene_active_keying_set_index_set", NULL);
+ RNA_def_property_ui_text(prop, "Active Keying Set Index", "Current Keying Set index (negative for 'builtin' and positive for 'absolute')");
+ RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
+}
+
+static void rna_def_scene_keying_sets_all(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ RNA_def_property_srna(cprop, "KeyingSetsAll");
+ srna= RNA_def_struct(brna, "KeyingSetsAll", NULL);
+ RNA_def_struct_sdna(srna, "Scene");
+ RNA_def_struct_ui_text(srna, "Keying Sets All", "All available keying sets");
+
+ /* NOTE: no add/remove available here, without screwing up this amalgamated list... */
+
+ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "KeyingSet");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_pointer_funcs(prop, "rna_Scene_active_keying_set_get", "rna_Scene_active_keying_set_set", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
+ RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
+
+ prop= RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "active_keyingset");
+ RNA_def_property_int_funcs(prop, "rna_Scene_active_keying_set_index_get", "rna_Scene_active_keying_set_index_set", NULL);
+ RNA_def_property_ui_text(prop, "Active Keying Set Index", "Current Keying Set index (negative for 'builtin' and positive for 'absolute')");
+ RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
+}
+
void RNA_def_scene(BlenderRNA *brna)
{
StructRNA *srna;
@@ -3091,25 +3231,14 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "KeyingSet");
RNA_def_property_ui_text(prop, "Absolute Keying Sets", "Absolute Keying Sets for this Scene");
RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
+ rna_def_scene_keying_sets(brna, prop);
prop= RNA_def_property(srna, "keying_sets_all", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_funcs(prop, "rna_Scene_all_keyingsets_begin", "rna_Scene_all_keyingsets_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", 0, 0, 0);
RNA_def_property_struct_type(prop, "KeyingSet");
- RNA_def_property_ui_text(prop, "All Keying Sets", "All Keying Sets available for use (builtins and Absolute Keying Sets for this Scene)");
- RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
-
- prop= RNA_def_property(srna, "active_keying_set", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "KeyingSet");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_pointer_funcs(prop, "rna_Scene_active_keying_set_get", "rna_Scene_active_keying_set_set", NULL, NULL);
- RNA_def_property_ui_text(prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
- RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
-
- prop= RNA_def_property(srna, "active_keying_set_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "active_keyingset");
- RNA_def_property_int_funcs(prop, "rna_Scene_active_keying_set_index_get", "rna_Scene_active_keying_set_index_set", NULL);
- RNA_def_property_ui_text(prop, "Active Keying Set Index", "Current Keying Set index (negative for 'builtin' and positive for 'absolute')");
+ RNA_def_property_ui_text(prop, "All Keying Sets", "All Keying Sets available for use (Builtins and Absolute Keying Sets for this Scene)");
RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL);
+ rna_def_scene_keying_sets_all(brna, prop);
/* Tool Settings */
prop= RNA_def_property(srna, "tool_settings", PROP_POINTER, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c
index 498bd148508..f6a6453c703 100644
--- a/source/blender/makesrna/intern/rna_scene_api.c
+++ b/source/blender/makesrna/intern/rna_scene_api.c
@@ -47,7 +47,7 @@
-static void rna_Scene_set_frame(Scene *scene, int frame, float subframe)
+static void rna_Scene_frame_set(Scene *scene, int frame, float subframe)
{
scene->r.cfra= frame;
scene->r.subframe= subframe;
@@ -63,33 +63,6 @@ static void rna_Scene_update_tagged(Scene *scene)
scene_update_tagged(G.main, scene);
}
-static KeyingSet *rna_Scene_add_keying_set(Scene *sce, ReportList *reports,
- char name[], int absolute, int insertkey_needed, int insertkey_visual)
-{
- KeyingSet *ks= NULL;
- short flag=0, keyingflag=0;
-
- /* validate flags */
- if (absolute)
- flag |= KEYINGSET_ABSOLUTE;
- if (insertkey_needed)
- keyingflag |= INSERTKEY_NEEDED;
- if (insertkey_visual)
- keyingflag |= INSERTKEY_MATRIX;
-
- /* call the API func, and set the active keyingset index */
- ks= BKE_keyingset_add(&sce->keyingsets, name, flag, keyingflag);
-
- if (ks) {
- sce->active_keyingset= BLI_countlist(&sce->keyingsets);
- return ks;
- }
- else {
- BKE_report(reports, RPT_ERROR, "Keying Set could not be added.");
- return NULL;
- }
-}
-
static void rna_SceneRender_get_frame_path(RenderData *rd, int frame, char *name)
{
if(BKE_imtype_is_movie(rd->imtype))
@@ -105,7 +78,7 @@ void RNA_api_scene(StructRNA *srna)
FunctionRNA *func;
PropertyRNA *parm;
- func= RNA_def_function(srna, "set_frame", "rna_Scene_set_frame");
+ func= RNA_def_function(srna, "frame_set", "rna_Scene_frame_set");
RNA_def_function_ui_description(func, "Set scene frame updating all objects immediately.");
parm= RNA_def_int(func, "frame", 0, MINAFRAME, MAXFRAME, "", "Frame number to set.", MINAFRAME, MAXFRAME);
RNA_def_property_flag(parm, PROP_REQUIRED);
@@ -113,21 +86,6 @@ void RNA_api_scene(StructRNA *srna)
func= RNA_def_function(srna, "update", "rna_Scene_update_tagged");
RNA_def_function_ui_description(func, "Update data tagged to be updated from previous access to data or operators.");
-
- /* Add Keying Set */
- func= RNA_def_function(srna, "add_keying_set", "rna_Scene_add_keying_set");
- RNA_def_function_ui_description(func, "Add a new Keying Set to Scene.");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- /* returns the new KeyingSet */
- parm= RNA_def_pointer(func, "keyingset", "KeyingSet", "", "Newly created Keying Set.");
- RNA_def_function_return(func, parm);
- /* name */
- RNA_def_string(func, "name", "KeyingSet", 64, "Name", "Name of Keying Set");
- /* flags */
- RNA_def_boolean(func, "absolute", 1, "Absolute", "Keying Set defines specific paths/settings to be keyframed (i.e. is not reliant on context info)");
- /* keying flags */
- RNA_def_boolean(func, "use_insertkey_needed", 0, "Insert Keyframes - Only Needed", "Only insert keyframes where they're needed in the relevant F-Curves.");
- RNA_def_boolean(func, "use_insertkey_visual", 0, "Insert Keyframes - Visual", "Insert keyframes based on 'visual transforms'.");
}
void RNA_api_scene_render(StructRNA *srna)
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index d3207f14e24..3593efaa743 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -1336,7 +1336,7 @@ static void rna_def_plugin(BlenderRNA *brna)
RNA_def_struct_ui_text(srna, "Plugin Sequence", "Sequence strip applying an effect, loaded from an external plugin");
RNA_def_struct_sdna_from(srna, "PluginSeq", "plugin");
- prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH);
+ prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILENAME);
RNA_def_property_string_sdna(prop, NULL, "name");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Filename", "");
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index f74621e8419..780cc31edea 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -2047,12 +2047,12 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Title", "Title for the file browser");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- prop= RNA_def_property(srna, "directory", PROP_STRING, PROP_NONE);
+ prop= RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH);
RNA_def_property_string_sdna(prop, NULL, "dir");
RNA_def_property_ui_text(prop, "Directory", "Directory displayed in the file browser");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
- prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_NONE);
+ prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILENAME);
RNA_def_property_string_sdna(prop, NULL, "file");
RNA_def_property_ui_text(prop, "File Name", "Active file in the file browser");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS, NULL);
@@ -2070,7 +2070,7 @@ static void rna_def_fileselect_params(BlenderRNA *brna)
prop= RNA_def_property(srna, "show_hidden", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", FILE_HIDE_DOT);
- RNA_def_property_ui_text(prop, "Hide Dot Files", "Hide hidden dot files");
+ RNA_def_property_ui_text(prop, "Show Hidden", "Show hidden dot files");
RNA_def_property_update(prop, NC_SPACE|ND_SPACE_FILE_PARAMS , NULL);
prop= RNA_def_property(srna, "sort_method", PROP_ENUM, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c
index a659ff7c260..f2c33f354c2 100644
--- a/source/blender/makesrna/intern/rna_ui.c
+++ b/source/blender/makesrna/intern/rna_ui.c
@@ -583,6 +583,11 @@ static void rna_def_panel(BlenderRNA *brna)
PropertyRNA *parm;
FunctionRNA *func;
+ static EnumPropertyItem panel_flag_items[] = {
+ {PNL_DEFAULT_CLOSED, "DEFAULT_CLOSED", 0, "Default Closed", "Defines if the panel has to be open or collapsed at the time of its creation."},
+ {PNL_NO_HEADER, "HIDE_HEADER", 0, "Show Header", "If set to True, the panel shows a header, which contains a clickable arrow to collapse the panel and the label (see bl_label)."},
+ {0, NULL, 0, NULL, NULL}};
+
srna= RNA_def_struct(brna, "Panel", NULL);
RNA_def_struct_ui_text(srna, "Panel", "Panel containing UI elements");
RNA_def_struct_sdna(srna, "Panel");
@@ -646,15 +651,11 @@ static void rna_def_panel(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); /* should this be optional? - Campbell */
RNA_def_property_ui_text(prop, "Context", "The context in which the panel belongs to. (TODO: explain the possible combinations bl_context/bl_region_type/bl_space_type)");
- prop= RNA_def_property(srna, "bl_default_closed", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "type->flag", PNL_DEFAULT_CLOSED);
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
- RNA_def_property_ui_text(prop, "Default closed", "Defines if the panel has to be open or collapsed at the time of its creation. Note that once the panel has been created with bl_default_closed = True, at reload (F8) it stays open.");
-
- prop= RNA_def_property(srna, "bl_show_header", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "type->flag", PNL_NO_HEADER);
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
- RNA_def_property_ui_text(prop, "Show Header", "If set to True, the panel shows a header, which contains a clickable arrow to collapse the panel and the label (see bl_label).");
+ prop= RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type->flag");
+ RNA_def_property_enum_items(prop, panel_flag_items);
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL|PROP_ENUM_FLAG);
+ RNA_def_property_ui_text(prop, "Options", "Options for this panel type");
}
static void rna_def_header(BlenderRNA *brna)
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index 720666a6180..973de2ae92b 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -182,7 +182,7 @@ void RNA_api_ui_layout(StructRNA *srna)
RNA_def_property_flag(parm, PROP_REQUIRED);
api_ui_item_common(func);
- func= RNA_def_function(srna, "prop_object", "uiItemPointerR");
+ func= RNA_def_function(srna, "prop_search", "uiItemPointerR");
api_ui_item_rna_common(func);
parm= RNA_def_pointer(func, "search_data", "AnyType", "", "Data from which to take collection to search in.");
RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
@@ -259,7 +259,7 @@ void RNA_api_ui_layout(StructRNA *srna)
RNA_def_function_ui_description(func, "Item. Inserts empty space into the layout between items.");
/* context */
- func= RNA_def_function(srna, "set_context_pointer", "uiLayoutSetContextPointer");
+ func= RNA_def_function(srna, "context_pointer_set", "uiLayoutSetContextPointer");
parm= RNA_def_string(func, "name", "", 0, "Name", "Name of entry in the context.");
RNA_def_property_flag(parm, PROP_REQUIRED);
parm= RNA_def_pointer(func, "data", "AnyType", "", "Pointer to put in context.");
@@ -270,11 +270,6 @@ void RNA_api_ui_layout(StructRNA *srna)
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
RNA_def_boolean(func, "menus", 1, "", "The header has menus, and should show menu expander.");
- func= RNA_def_function(srna, "template_dopesheet_filter", "uiTemplateDopeSheetFilter");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- parm= RNA_def_pointer(func, "dopesheet", "DopeSheet", "", "DopeSheet settings holding filter options.");
- RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
-
func= RNA_def_function(srna, "template_ID", "uiTemplateID");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
api_ui_item_rna_common(func);
@@ -377,9 +372,6 @@ void RNA_api_ui_layout(StructRNA *srna)
RNA_def_boolean(func, "lock_luminosity", 0, "", "Keep the color at its original vector length");
RNA_def_boolean(func, "cubic", 1, "", "Cubic saturation for picking values close to white");
- func= RNA_def_function(srna, "template_triColorSet", "uiTemplateTriColorSet");
- api_ui_item_rna_common(func);
-
func= RNA_def_function(srna, "template_image_layers", "uiTemplateImageLayers");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
parm= RNA_def_pointer(func, "image", "Image", "", "");
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index b2b22cf2f50..1e6d656d7ce 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -2386,6 +2386,11 @@ static void rna_def_userdef_system(BlenderRNA *brna)
RNA_def_property_range(prop, 32, 32768);
RNA_def_property_ui_text(prop, "Scrollback", "Maximum number of lines to store for the console buffer");
+ prop= RNA_def_property(srna, "author", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "author");
+ RNA_def_property_string_maxlength(prop, 80);
+ RNA_def_property_ui_text(prop, "Author", "Name that will be used in exported files when format supports such feature");
+
/* Language Selection */
prop= RNA_def_property(srna, "language", PROP_ENUM, PROP_NONE);
@@ -2797,7 +2802,7 @@ void rna_def_userdef_addon_collection(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_function_flag(func, FUNC_NO_SELF);
RNA_def_function_ui_description(func, "Remove addon.");
parm= RNA_def_pointer(func, "addon", "Addon", "", "Addon to remove.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL);
}
void RNA_def_userdef(BlenderRNA *brna)
@@ -2886,4 +2891,3 @@ void RNA_def_userdef(BlenderRNA *brna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index 67b8ca057c8..1cfc80a1730 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -612,6 +612,33 @@ static int rna_wmKeyMapItem_name_length(PointerRNA *ptr)
return 0;
}
+static void rna_wmClipboard_get(PointerRNA *ptr, char *value)
+{
+ char *pbuf;
+
+ pbuf= WM_clipboard_text_get(FALSE);
+ strcpy(value, pbuf);
+
+ MEM_freeN(pbuf);
+}
+
+static int rna_wmClipboard_length(PointerRNA *ptr)
+{
+ char *clipboard;
+ int length;
+
+ clipboard = WM_clipboard_text_get(FALSE);
+ length = (clipboard?strlen(clipboard):0);
+ MEM_freeN(clipboard);
+
+ return length;
+}
+
+static void rna_wmClipboard_set(PointerRNA *ptr, const char *value)
+{
+ WM_clipboard_text_set((void *) value, FALSE);
+}
+
#ifndef DISABLE_PYTHON
static void rna_Operator_unregister(const bContext *C, StructRNA *type)
{
@@ -901,7 +928,7 @@ static StructRNA* rna_MacroOperator_refine(PointerRNA *opr)
return (op->type && op->type->ext.srna)? op->type->ext.srna: &RNA_Macro;
}
-static wmKeyMapItem *rna_KeyMap_add_item(wmKeyMap *km, ReportList *reports, char *idname, int type, int value, int any, int shift, int ctrl, int alt, int oskey, int keymodifier)
+static wmKeyMapItem *rna_KeyMap_item_new(wmKeyMap *km, ReportList *reports, char *idname, int type, int value, int any, int shift, int ctrl, int alt, int oskey, int keymodifier)
{
// wmWindowManager *wm = CTX_wm_manager(C);
int modifier= 0;
@@ -922,7 +949,7 @@ static wmKeyMapItem *rna_KeyMap_add_item(wmKeyMap *km, ReportList *reports, char
return WM_keymap_add_item(km, idname, type, value, modifier, keymodifier);
}
-static wmKeyMapItem *rna_KeyMap_add_modal_item(wmKeyMap *km, bContext *C, ReportList *reports, char* propvalue_str, int type, int value, int any, int shift, int ctrl, int alt, int oskey, int keymodifier)
+static wmKeyMapItem *rna_KeyMap_item_new_modal(wmKeyMap *km, bContext *C, ReportList *reports, char* propvalue_str, int type, int value, int any, int shift, int ctrl, int alt, int oskey, int keymodifier)
{
wmWindowManager *wm = CTX_wm_manager(C);
int modifier= 0;
@@ -961,6 +988,30 @@ static wmKeyMapItem *rna_KeyMap_add_modal_item(wmKeyMap *km, bContext *C, Report
return WM_modalkeymap_add_item(km, type, value, modifier, keymodifier, propvalue);
}
+static wmKeyMap *rna_keymap_new(wmKeyConfig *keyconf, char *idname, int spaceid, int regionid, int modal)
+{
+ if (modal == 0) {
+ return WM_keymap_find(keyconf, idname, spaceid, regionid);
+ } else {
+ return WM_modalkeymap_add(keyconf, idname, NULL); /* items will be lazy init */
+ }
+}
+
+static wmKeyMap *rna_keymap_find(wmKeyConfig *keyconf, char *idname, int spaceid, int regionid)
+{
+ return WM_keymap_list_find(&keyconf->keymaps, idname, spaceid, regionid);
+}
+
+static wmKeyMap *rna_keymap_find_modal(wmKeyConfig *keyconf, char *idname)
+{
+ wmOperatorType *ot = WM_operatortype_find(idname, 0);
+
+ if (!ot)
+ return NULL;
+ else
+ return ot->modalkeymap;
+}
+
#else /* RNA_RUNTIME */
static void rna_def_operator(BlenderRNA *brna)
@@ -1237,6 +1288,43 @@ static void rna_def_window(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Window_screen_update");
}
+/* curve.splines */
+static void rna_def_wm_keyconfigs(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "KeyConfigurations");
+ srna= RNA_def_struct(brna, "KeyConfigurations", NULL);
+ RNA_def_struct_sdna(srna, "wmWindowManager");
+ RNA_def_struct_ui_text(srna, "KeyConfigs", "Collection of KeyConfigs");
+
+ prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "KeyConfig");
+ RNA_def_property_pointer_funcs(prop, "rna_WindowManager_active_keyconfig_get", "rna_WindowManager_active_keyconfig_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Active KeyConfig", "Active wm KeyConfig");
+
+ prop= RNA_def_property(srna, "default", PROP_POINTER, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "defaultconf");
+ RNA_def_property_struct_type(prop, "KeyConfig");
+ RNA_def_property_ui_text(prop, "Default Key Configuration", "");
+
+ /* funcs */
+ func= RNA_def_function(srna, "new", "WM_keyconfig_new_user"); // add_keyconfig
+ parm= RNA_def_string(func, "name", "", 0, "Name", "");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_pointer(func, "keyconfig", "KeyConfig", "Key Configuration", "Added key configuration.");
+ RNA_def_function_return(func, parm);
+
+ func= RNA_def_function(srna, "remove", "WM_keyconfig_remove"); // remove_keyconfig
+ parm= RNA_def_pointer(func, "keyconfig", "KeyConfig", "Key Configuration", "Removed key configuration.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+}
+
static void rna_def_windowmanager(BlenderRNA *brna)
{
StructRNA *srna;
@@ -1258,17 +1346,11 @@ static void rna_def_windowmanager(BlenderRNA *brna)
prop= RNA_def_property(srna, "keyconfigs", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "KeyConfig");
RNA_def_property_ui_text(prop, "Key Configurations", "Registered key configurations");
+ rna_def_wm_keyconfigs(brna, prop);
- prop= RNA_def_property(srna, "active_keyconfig", PROP_POINTER, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "KeyConfig");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_pointer_funcs(prop, "rna_WindowManager_active_keyconfig_get", "rna_WindowManager_active_keyconfig_set", 0, NULL);
- RNA_def_property_ui_text(prop, "Active Key Configuration", "");
-
- prop= RNA_def_property(srna, "default_keyconfig", PROP_POINTER, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "defaultconf");
- RNA_def_property_struct_type(prop, "KeyConfig");
- RNA_def_property_ui_text(prop, "Default Key Configuration", "");
+ prop= RNA_def_property(srna, "clipboard", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop, "rna_wmClipboard_get", "rna_wmClipboard_length", "rna_wmClipboard_set");
+ RNA_def_property_ui_text(prop, "Text Clipboard", "");
RNA_api_wm(srna);
}
@@ -1287,7 +1369,7 @@ static void rna_def_keymap_items(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_struct_sdna(srna, "wmKeyMap");
RNA_def_struct_ui_text(srna, "KeyMap Items", "Collection of keymap items");
- func= RNA_def_function(srna, "add", "rna_KeyMap_add_item");
+ func= RNA_def_function(srna, "new", "rna_KeyMap_item_new");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
parm= RNA_def_string(func, "idname", "", 0, "Operator Identifier", "");
RNA_def_property_flag(parm, PROP_REQUIRED);
@@ -1304,7 +1386,7 @@ static void rna_def_keymap_items(BlenderRNA *brna, PropertyRNA *cprop)
parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Added key map item.");
RNA_def_function_return(func, parm);
- func= RNA_def_function(srna, "add_modal", "rna_KeyMap_add_modal_item");
+ func= RNA_def_function(srna, "new_modal", "rna_KeyMap_item_new_modal");
RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
parm= RNA_def_string(func, "propvalue", "", 0, "Property Value", "");
RNA_def_property_flag(parm, PROP_REQUIRED);
@@ -1321,6 +1403,56 @@ static void rna_def_keymap_items(BlenderRNA *brna, PropertyRNA *cprop)
parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Added key map item.");
RNA_def_function_return(func, parm);
+ func= RNA_def_function(srna, "remove", "WM_keymap_remove_item");
+ parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+
+ func= RNA_def_function(srna, "from_id", "WM_keymap_item_find_id");
+ parm= RNA_def_property(func, "id", PROP_INT, PROP_NONE);
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_property_ui_text(parm, "id", "ID of the item");
+ parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
+ RNA_def_function_return(func, parm);
+
+}
+
+static void rna_def_wm_keymaps(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ //PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+
+ RNA_def_property_srna(cprop, "KeyMaps");
+ srna= RNA_def_struct(brna, "KeyMaps", NULL);
+ RNA_def_struct_sdna(srna, "wmKeyConfig");
+ RNA_def_struct_ui_text(srna, "Key Maps", "Collection of keymaps");
+
+ func= RNA_def_function(srna, "new", "rna_keymap_new"); // add_keymap
+ parm= RNA_def_string(func, "name", "", 0, "Name", "");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_enum(func, "space_type", space_type_items, SPACE_EMPTY, "Space Type", "");
+ RNA_def_enum(func, "region_type", region_type_items, RGN_TYPE_WINDOW, "Region Type", "");
+ RNA_def_boolean(func, "modal", 0, "Modal", "");
+ parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Added key map.");
+ RNA_def_function_return(func, parm);
+
+ func= RNA_def_function(srna, "find", "rna_keymap_find"); // find_keymap
+ parm= RNA_def_string(func, "name", "", 0, "Name", "");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_enum(func, "space_type", space_type_items, SPACE_EMPTY, "Space Type", "");
+ RNA_def_enum(func, "region_type", region_type_items, RGN_TYPE_WINDOW, "Region Type", "");
+ parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map.");
+ RNA_def_function_return(func, parm);
+
+ func= RNA_def_function(srna, "find_modal", "rna_keymap_find_modal"); // find_keymap_modal
+ parm= RNA_def_string(func, "name", "", 0, "Operator Name", "");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map.");
+ RNA_def_function_return(func, parm);
+
}
static void rna_def_keyconfig(BlenderRNA *brna)
@@ -1351,6 +1483,7 @@ static void rna_def_keyconfig(BlenderRNA *brna)
prop= RNA_def_property(srna, "keymaps", PROP_COLLECTION, PROP_NONE);
RNA_def_property_struct_type(prop, "KeyMap");
RNA_def_property_ui_text(prop, "Key Maps", "Key maps configured as part of this configuration");
+ rna_def_wm_keymaps(brna, prop);
prop= RNA_def_property(srna, "is_user_defined", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYCONF_USER);
diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c
index a4999e71fcf..6eb9bfeb4c0 100644
--- a/source/blender/makesrna/intern/rna_wm_api.c
+++ b/source/blender/makesrna/intern/rna_wm_api.c
@@ -39,31 +39,6 @@
#include "BKE_context.h"
-
-static wmKeyMap *rna_keymap_add(wmKeyConfig *keyconf, char *idname, int spaceid, int regionid, int modal)
-{
- if (modal == 0) {
- return WM_keymap_find(keyconf, idname, spaceid, regionid);
- } else {
- return WM_modalkeymap_add(keyconf, idname, NULL); /* items will be lazy init */
- }
-}
-
-static wmKeyMap *rna_keymap_find(wmKeyConfig *keyconf, char *idname, int spaceid, int regionid)
-{
- return WM_keymap_list_find(&keyconf->keymaps, idname, spaceid, regionid);
-}
-
-static wmKeyMap *rna_keymap_find_modal(wmKeyConfig *keyconf, char *idname)
-{
- wmOperatorType *ot = WM_operatortype_find(idname, 0);
-
- if (!ot)
- return NULL;
- else
- return ot->modalkeymap;
-}
-
static wmKeyMap *rna_keymap_active(wmKeyMap *km, bContext *C)
{
wmWindowManager *wm = CTX_wm_manager(C);
@@ -132,16 +107,6 @@ void RNA_api_wm(StructRNA *srna)
RNA_def_function_ui_description(func, "Show up the file selector.");
rna_generic_op_invoke(func, 0);
- func= RNA_def_function(srna, "add_keyconfig", "WM_keyconfig_add_user");
- parm= RNA_def_string(func, "name", "", 0, "Name", "");
- RNA_def_property_flag(parm, PROP_REQUIRED);
- parm= RNA_def_pointer(func, "keyconfig", "KeyConfig", "Key Configuration", "Added key configuration.");
- RNA_def_function_return(func, parm);
-
- func= RNA_def_function(srna, "remove_keyconfig", "WM_keyconfig_remove");
- parm= RNA_def_pointer(func, "keyconfig", "KeyConfig", "Key Configuration", "Removed key configuration.");
- RNA_def_property_flag(parm, PROP_REQUIRED);
-
func= RNA_def_function(srna, "add_modal_handler", "rna_event_add_modal_handler");
RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_USE_CONTEXT);
parm= RNA_def_pointer(func, "operator", "Operator", "", "Operator to call.");
@@ -259,31 +224,8 @@ void RNA_api_macro(StructRNA *srna)
void RNA_api_keyconfig(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
-
- func= RNA_def_function(srna, "add_keymap", "rna_keymap_add");
- parm= RNA_def_string(func, "name", "", 0, "Name", "");
- RNA_def_property_flag(parm, PROP_REQUIRED);
- RNA_def_enum(func, "space_type", space_type_items, SPACE_EMPTY, "Space Type", "");
- RNA_def_enum(func, "region_type", region_type_items, RGN_TYPE_WINDOW, "Region Type", "");
- RNA_def_boolean(func, "modal", 0, "Modal", "");
- parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Added key map.");
- RNA_def_function_return(func, parm);
-
- func= RNA_def_function(srna, "find_keymap", "rna_keymap_find");
- parm= RNA_def_string(func, "name", "", 0, "Name", "");
- RNA_def_property_flag(parm, PROP_REQUIRED);
- RNA_def_enum(func, "space_type", space_type_items, SPACE_EMPTY, "Space Type", "");
- RNA_def_enum(func, "region_type", region_type_items, RGN_TYPE_WINDOW, "Region Type", "");
- parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map.");
- RNA_def_function_return(func, parm);
-
- func= RNA_def_function(srna, "find_keymap_modal", "rna_keymap_find_modal");
- parm= RNA_def_string(func, "name", "", 0, "Operator Name", "");
- RNA_def_property_flag(parm, PROP_REQUIRED);
- parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map.");
- RNA_def_function_return(func, parm);
+ // FunctionRNA *func;
+ // PropertyRNA *parm;
}
void RNA_api_keymap(StructRNA *srna)
@@ -296,17 +238,6 @@ void RNA_api_keymap(StructRNA *srna)
parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Active key map.");
RNA_def_function_return(func, parm);
- func= RNA_def_function(srna, "remove_item", "WM_keymap_remove_item");
- parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
- RNA_def_property_flag(parm, PROP_REQUIRED);
-
- func= RNA_def_function(srna, "item_from_id", "WM_keymap_item_find_id");
- parm= RNA_def_property(func, "id", PROP_INT, PROP_NONE);
- RNA_def_property_flag(parm, PROP_REQUIRED);
- RNA_def_property_ui_text(parm, "id", "ID of the item");
- parm= RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
- RNA_def_function_return(func, parm);
-
func= RNA_def_function(srna, "copy_to_user", "WM_keymap_copy_to_user");
parm= RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "User editable key map.");
RNA_def_function_return(func, parm);
diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c
index 907042e7453..ecf253acbce 100644
--- a/source/blender/makesrna/intern/rna_world.c
+++ b/source/blender/makesrna/intern/rna_world.c
@@ -469,8 +469,8 @@ void RNA_def_world(BlenderRNA *brna)
RNA_def_struct_ui_icon(srna, ICON_WORLD_DATA);
rna_def_animdata_common(srna);
- rna_def_mtex_common(srna, "rna_World_mtex_begin", "rna_World_active_texture_get",
- "rna_World_active_texture_set", "WorldTextureSlot", "rna_World_update");
+ rna_def_mtex_common(brna, srna, "rna_World_mtex_begin", "rna_World_active_texture_get",
+ "rna_World_active_texture_set", "WorldTextureSlot", "WorldTextureSlots", "rna_World_update");
/* colors */
prop= RNA_def_property(srna, "horizon_color", PROP_FLOAT, PROP_COLOR);
diff --git a/source/blender/makesrna/rna_cleanup/rna_properties.txt b/source/blender/makesrna/rna_cleanup/rna_properties.txt
index b319ce15ba1..92adbf4373e 100644
--- a/source/blender/makesrna/rna_cleanup/rna_properties.txt
+++ b/source/blender/makesrna/rna_cleanup/rna_properties.txt
@@ -313,6 +313,7 @@
#+ * BoneGroup.color_set -> color_set: enum "Custom color set to use"
#+ * BoneGroup.colors -> colors: pointer, "(read-only) Copy of the colors associated with the groups color set"
#+ * BoneGroup.name -> name: string "NO DESCRIPTION"
+#BoneGroups.active -> active: pointer "Active bone group for this pose"
#+ * ClothCollisionSettings.collision_quality -> collision_quality: int "How many collision iterations should be done. (higher is better quality but slower)"
#ClothCollisionSettings.distance_min -> distance_min: float "Minimum distance between collision objects before collision response takes in"
#+ * ClothCollisionSettings.friction -> friction: float "Friction force if a collision happened. (higher = less movement)"
@@ -620,7 +621,7 @@
#+ * CurveMapping.curves -> curves: collection, "(read-only)"
#CurveMapping.use_clip -> use_clip: boolean "Force the curve view to fit a defined boundary"
#+ * CurveMapping.white_level -> white_level: float[3] "For RGB curves, the color that white is mapped to"
-#TODO MOVE TO COLLECTION * CurveSplines.active -> active: pointer "Active curve spline"
+#+ * CurveSplines.active -> active: pointer "Active curve spline"
#DopeSheet.filter_group -> filter_group: pointer "Group that included Object should be a member of"
#DopeSheet.show_armatures -> show_armatures: boolean "Include visualization of Armature related Animation data"
#DopeSheet.show_cameras -> show_cameras: boolean "Include visualization of Camera related Animation data"
@@ -1430,9 +1431,7 @@
#ID|Material.use_vertex_color_light -> use_vertex_color_light: boolean "Add vertex colors as additional lighting"
#ID|Material.use_vertex_color_paint -> use_vertex_color_paint: boolean "Replaces object base color with vertex colors (multiplies with texture face face assigned textures)"
#+ * ID|Material.volume -> volume: pointer, "(read-only) Volume settings for the material"
-#+ * ID|Mesh.active_uv_texture -> active_uv_texture: pointer "Active UV texture"
#+ * ID|Mesh.active_uv_texture_index -> active_uv_texture_index: int "Active UV texture index"
-#+ * ID|Mesh.active_vertex_color -> active_vertex_color: pointer "Active vertex color layer"
#+ * ID|Mesh.active_vertex_color_index -> active_vertex_color_index: int "Active vertex color index"
#+ * ID|Mesh.animation_data -> animation_data: pointer, "(read-only) Animation data for this datablock"
#ID|Mesh.auto_smooth_angle -> auto_smooth_angle: int "Defines maximum angle between face normals that Auto Smooth will operate on"
@@ -1476,7 +1475,6 @@
#+ * ID|Mesh.uv_textures -> uv_textures: collection, "(read-only)"
#+ * ID|Mesh.vertex_colors -> vertex_colors: collection, "(read-only)"
#ID|Mesh.vertices -> vertices: collection, "(read-only) Vertices of the mesh"
-#TODO MOVE TO ELEMENTS * ID|MetaBall.active_element -> active_element: pointer, "(read-only) Last selected element"
#+ * ID|MetaBall.animation_data -> animation_data: pointer, "(read-only) Animation data for this datablock"
#+ * ID|MetaBall.elements -> elements: collection, "(read-only) Meta elements"
#+ * ID|MetaBall.materials -> materials: collection, "(read-only)"
@@ -1722,7 +1720,6 @@
#ID|ParticleSettings.use_whole_group -> use_whole_group: boolean "Use whole group at once"
#+ * ID|ParticleSettings.userjit -> userjit: int "Emission locations / face (0 = automatic)"
#+ * ID|ParticleSettings.virtual_parents -> virtual_parents: float "Relative amount of virtual parents"
-#+ * ID|Scene.active_keying_set -> active_keying_set: pointer "Active Keying Set used to insert/delete keyframes"
#+ * ID|Scene.active_keying_set_index -> active_keying_set_index: int "Current Keying Set index (negative for builtin and positive for absolute)"
#+ * ID|Scene.animation_data -> animation_data: pointer, "(read-only) Animation data for this datablock"
#ID|Scene.audio_distance_model -> audio_distance_model: enum "Distance model for distance attenuation calculation"
@@ -1896,8 +1893,6 @@
#ID|Texture|WoodTexture.wood_type -> wood_type: enum "NO DESCRIPTION"
#+ * ID|VectorFont.filepath -> filepath: string, "(read-only)"
#+ * ID|VectorFont.packed_file -> packed_file: pointer, "(read-only)"
-#TODO, move into collectin * ID|WindowManager.active_keyconfig -> active_keyconfig: pointer "NO DESCRIPTION"
-#+ * ID|WindowManager.default_keyconfig -> default_keyconfig: pointer, "(read-only)"
#+ * ID|WindowManager.keyconfigs -> keyconfigs: collection, "(read-only) Registered key configurations"
#+ * ID|WindowManager.operators -> operators: collection, "(read-only) Operator registry"
#+ * ID|WindowManager.windows -> windows: collection, "(read-only) Open windows"
@@ -1941,6 +1936,8 @@
#KeyConfig.is_user_defined -> is_user_defined: boolean, "(read-only) Indicates that a keyconfig was defined by the user"
#+ * KeyConfig.keymaps -> keymaps: collection, "(read-only) Key maps configured as part of this configuration"
#+ * KeyConfig.name -> name: string "Name of the key configuration"
+#KeyConfigurations.active -> active: pointer "Active wm KeyConfig"
+#KeyConfigurations.default -> default: pointer, "(read-only)"
#KeyMap.is_modal -> is_modal: boolean, "(read-only) Indicates that a keymap is used for translate modal events for an operator"
#KeyMap.is_user_defined -> is_user_defined: boolean "Keymap is defined by the user"
#+ * KeyMap.items -> items: collection, "(read-only) Items in the keymap, linking an operator to an input event"
@@ -1975,7 +1972,6 @@
#+ * Keyframe.select_left_handle -> select_left_handle: boolean "Handle 1 selection status"
#+ * Keyframe.select_right_handle -> select_right_handle: boolean "Handle 2 selection status"
#+ * Keyframe.type -> type: enum "The type of keyframe"
-#TODO MOVE TO COLLECTION * KeyingSet.active_path -> active_path: pointer "Active Keying Set used to insert/delete keyframes"
#+ * KeyingSet.active_path_index -> active_path_index: int "Current Keying Set index"
#KeyingSet.is_path_absolute -> is_path_absolute: boolean, "(read-only) Keying Set defines specific paths/settings to be keyframed (i.e. is not reliant on context info)"
#+ * KeyingSet.name -> name: string "NO DESCRIPTION"
@@ -1999,6 +1995,8 @@
#KeyingSetPath.use_insertkey_needed -> use_insertkey_needed: boolean "Only insert keyframes where theyre needed in the relevant F-Curves"
#KeyingSetPath.use_insertkey_visual -> use_insertkey_visual: boolean "Insert keyframes based on visual transforms"
#KeyingSetPath.use_insertkey_xyz_to_rgb -> use_insertkey_xyz_to_rgb: boolean "Color for newly added transformation F-Curves (Location, Rotation, Scale) and also Color is based on the transform axis"
+#KeyingSetPaths.active -> active: pointer "Active Keying Set used to insert/delete keyframes"
+#KeyingSets.active -> active: pointer "Active Keying Set used to insert/delete keyframes"
#+ * LampSkySettings.atmosphere_distance_factor -> atmosphere_distance_factor: float "Multiplier to convert blender units to physical distance"
#+ * LampSkySettings.atmosphere_extinction -> atmosphere_extinction: float "Extinction scattering contribution factor"
#+ * LampSkySettings.atmosphere_inscattering -> atmosphere_inscattering: float "Scatter contribution factor"
@@ -2063,13 +2061,13 @@
#MaterialHalo.line_count -> line_count: int "Sets the number of star shaped lines rendered over the halo"
#MaterialHalo.ring_count -> ring_count: int "Sets the number of rings rendered over the halo"
#+ * MaterialHalo.seed -> seed: int "Randomizes ring dimension and line location"
-#MaterialHalo.show_shaded -> show_shaded: boolean "Lets halo receive light and shadows from external objects"
#+ * MaterialHalo.size -> size: float "Sets the dimension of the halo"
#MaterialHalo.star_tip_count -> star_tip_count: int "Sets the number of points on the star shaped halo"
#MaterialHalo.use_extreme_alpha -> use_extreme_alpha: boolean "Uses extreme alpha"
#MaterialHalo.use_flare_mode -> use_flare_mode: boolean "Renders halo as a lensflare"
#MaterialHalo.use_lines -> use_lines: boolean "Renders star shaped lines over halo"
#MaterialHalo.use_ring -> use_ring: boolean "Renders rings over halo"
+#MaterialHalo.use_shaded -> use_shaded: boolean "Lets halo receive light and shadows from external objects"
#MaterialHalo.use_soft -> use_soft: boolean "Softens the edges of halos at intersections with other geometry"
#MaterialHalo.use_star -> use_star: boolean "Renders halo as a star"
#MaterialHalo.use_texture -> use_texture: boolean "Gives halo a texture"
@@ -2219,6 +2217,7 @@
#+ * MeshVertex.index -> index: int, "(read-only) Index number of the vertex"
#+ * MeshVertex.normal -> normal: float[3] "Vertex Normal"
#+ * MeshVertex.select -> select: boolean "NO DESCRIPTION"
+#MetaBallElements.active -> active: pointer, "(read-only) Last selected element"
#MetaElement.co -> co: float[3] "NO DESCRIPTION"
#+ * MetaElement.hide -> hide: boolean "Hide element"
#+ * MetaElement.radius -> radius: float "NO DESCRIPTION"
@@ -2393,10 +2392,10 @@
#+ * Modifier|SmokeModifier.flow_settings -> flow_settings: pointer, "(read-only)"
#Modifier|SmokeModifier.smoke_type -> smoke_type: enum "NO DESCRIPTION"
#+ * Modifier|SmoothModifier.factor -> factor: float "NO DESCRIPTION"
-#Modifier|SmoothModifier.ise_x -> ise_x: boolean "NO DESCRIPTION"
-#Modifier|SmoothModifier.ise_y -> ise_y: boolean "NO DESCRIPTION"
-#Modifier|SmoothModifier.ise_z -> ise_z: boolean "NO DESCRIPTION"
#Modifier|SmoothModifier.iterations -> iterations: int "NO DESCRIPTION"
+#Modifier|SmoothModifier.use_x -> use_x: boolean "NO DESCRIPTION"
+#Modifier|SmoothModifier.use_y -> use_y: boolean "NO DESCRIPTION"
+#Modifier|SmoothModifier.use_z -> use_z: boolean "NO DESCRIPTION"
#+ * Modifier|SmoothModifier.vertex_group -> vertex_group: string "Vertex group name"
#+ * Modifier|SoftBodyModifier.point_cache -> point_cache: pointer, "(read-only)"
#+ * Modifier|SoftBodyModifier.settings -> settings: pointer, "(read-only)"
@@ -2880,7 +2879,6 @@
#+ * PointDensity.turbulence_strength -> turbulence_strength: float "NO DESCRIPTION"
#PointDensity.use_turbulence -> use_turbulence: boolean "Add directed noise to the density at render-time"
#PointDensity.vertex_cache_space -> vertex_cache_space: enum "Co-ordinate system to cache vertices in"
-#+ * Pose.active_bone_group -> active_bone_group: pointer "Active bone group for this pose"
#+ * Pose.active_bone_group_index -> active_bone_group_index: int "Active index in bone groups array"
#+ * Pose.animation_visualisation -> animation_visualisation: pointer, "(read-only) Animation data for this datablock"
#+ * Pose.bone_groups -> bone_groups: collection, "(read-only) Groups of the bones"
@@ -3067,9 +3065,6 @@
#+ * RenderSettings.edge_color -> edge_color: float[3] "NO DESCRIPTION"
#+ * RenderSettings.edge_threshold -> edge_threshold: int "Threshold for drawing outlines on geometry edges"
#+ * RenderSettings.engine -> engine: enum "Engine to use for rendering"
-#RenderSettings.exr_codec -> exr_codec: enum "Codec settings for OpenEXR"
-#RenderSettings.exr_preview -> exr_preview: boolean "When rendering animations, save JPG preview images in same directory"
-#RenderSettings.exr_zbuf -> exr_zbuf: boolean "Save the z-depth per pixel (32 bit unsigned int zbuffer)"
#+ * RenderSettings.field_order -> field_order: enum "Order of video fields. Select which lines get rendered first, to create smooth motion for TV output"
#+ * RenderSettings.file_extension -> file_extension: string, "(read-only) The file extension used for saving renders"
#+ * RenderSettings.file_format -> file_format: enum "File format to save the rendered images as"
@@ -3080,9 +3075,6 @@
#+ * RenderSettings.fps_base -> fps_base: float "Framerate base"
#RenderSettings.has_multiple_engines -> has_multiple_engines: boolean, "(read-only) More than one rendering engine is available"
#+ * RenderSettings.is_movie_format -> is_movie_format: boolean, "(read-only) When true the format is a movie"
-#RenderSettings.jpeg2k_depth -> jpeg2k_depth: enum "Bit depth per channel"
-#RenderSettings.jpeg2k_preset -> jpeg2k_preset: enum "Use a DCI Standard preset for saving jpeg2000"
-#RenderSettings.jpeg2k_ycc -> jpeg2k_ycc: boolean "Save luminance-chrominance-chrominance channels instead of RGB colors"
#+ * RenderSettings.layers -> layers: collection, "(read-only)"
#+ * RenderSettings.motion_blur_samples -> motion_blur_samples: int "Number of scene samples to take with motion blur"
#+ * RenderSettings.motion_blur_shutter -> motion_blur_shutter: float "Time taken in frames between shutter open and close"
@@ -3121,7 +3113,6 @@
#RenderSettings.use_crop_to_border -> use_crop_to_border: boolean "Crop the rendered frame to the defined border size"
#RenderSettings.use_edge_enhance -> use_edge_enhance: boolean "Create a toon outline around the edges of geometry"
#+ * RenderSettings.use_envmaps -> use_envmaps: boolean "Calculate environment maps while rendering"
-#RenderSettings.use_exr_half -> use_exr_half: boolean "Use 16 bit floats instead of 32 bit floats per channel"
#RenderSettings.use_fields -> use_fields: boolean "Render image to two fields per frame, for interlaced TV output"
#RenderSettings.use_fields_still -> use_fields_still: boolean "Disable the time difference between fields"
#+ * RenderSettings.use_file_extension -> use_file_extension: boolean "Add the file format extensions to the rendered file name (eg: filename + .jpg)"
@@ -3544,7 +3535,7 @@
#SmokeDomainSettings.collision_extents -> collision_extents: enum "Selects which domain border will be treated as collision object."
#SmokeDomainSettings.collision_group -> collision_group: pointer "Limit collisions to this group"
#+ * SmokeDomainSettings.dissolve_speed -> dissolve_speed: int "Dissolve Speed"
-#+ * SmokeDomainSettings.eff_group -> eff_group: pointer "Limit effectors to this group"
+#SmokeDomainSettings.effector_group -> effector_group: pointer "Limit effectors to this group"
#+ * SmokeDomainSettings.effector_weights -> effector_weights: pointer, "(read-only)"
#+ * SmokeDomainSettings.fluid_group -> fluid_group: pointer "Limit fluid objects to this group"
#+ * SmokeDomainSettings.noise_type -> noise_type: enum "Noise method which is used for creating the high resolution"
@@ -4406,6 +4397,7 @@
+ * UILayout.active -> show_active: boolean "NO DESCRIPTION"
+ * UILayout.enabled -> show_enabled: boolean "When false, this (sub)layout is greyed out."
#+ * UVProjector.object -> object: pointer "Object to use as projector transform"
+#UVTextures.active -> active: pointer "Active UV texture"
#+ * UnitSettings.rotation_units -> rotation_units: enum "Unit to use for displaying/editing rotation values"
#+ * UnitSettings.scale_length -> scale_length: float "Scale to use when converting between blender units and dimensions"
#+ * UnitSettings.system -> system: enum "The unit system to use for button display"
@@ -4562,6 +4554,7 @@
#+ * ValueNodeSocket.name -> name: string, "(read-only) Socket name"
#+ * VectorNodeSocket.default_value -> default_value: float[3] "Default value of the socket when no link is attached"
#+ * VectorNodeSocket.name -> name: string, "(read-only) Socket name"
+#VertexColors.active -> active: pointer "Active vertex color layer"
#+ * VertexGroup.index -> index: int, "(read-only) Index number of the vertex group"
#+ * VertexGroup.name -> name: string "Vertex group name"
#+ * VertexGroupElement.group -> group: int, "(read-only)"
diff --git a/source/blender/makesrna/rna_cleanup/rna_update.sh b/source/blender/makesrna/rna_cleanup/rna_update.sh
index 04d4bbcb0e4..a4d686cc482 100755
--- a/source/blender/makesrna/rna_cleanup/rna_update.sh
+++ b/source/blender/makesrna/rna_cleanup/rna_update.sh
@@ -10,4 +10,4 @@ mv out_work_merged_work.txt rna_properties.txt # overwrite
mv out_work_lost_work.txt rna_properties_lost.txt
cat rna_properties.txt | grep -v "^#" > rna_properties_edits.txt
./rna_cleaner.py rna_properties.txt
-echo "Updated: rna_properties.txt rna_properties_edits.txt rna_properties_lost.txt " \ No newline at end of file
+echo "Updated: rna_properties.txt rna_properties_edits.txt rna_properties_lost.txt "
diff --git a/source/blender/modifiers/SConscript b/source/blender/modifiers/SConscript
index 1722ca276f7..7a810af28a2 100644
--- a/source/blender/modifiers/SConscript
+++ b/source/blender/modifiers/SConscript
@@ -15,6 +15,6 @@ defs = []
if env['BF_NO_ELBEEM']:
defs.append('DISABLE_ELBEEM')
-env.BlenderLib ( libname = 'modifiers', sources = sources,
+env.BlenderLib ( libname = 'bf_modifiers', sources = sources,
includes = Split(incs), defines=defs,
libtype=['core','player'], priority = [165, 20] )
diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c
index 783bad15c70..7cec359fd33 100644
--- a/source/blender/modifiers/intern/MOD_screw.c
+++ b/source/blender/modifiers/intern/MOD_screw.c
@@ -436,7 +436,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
vc= vert_connect;
for (i=0; i < totvert; i++, vc++) {
int v_best=-1, ed_loop_closed=0; /* vert and vert new */
- int ed_loop_flip;
+ int ed_loop_flip= 0; /* compiler complains if not initialized, but it should be initialized below */
float fl= -1.0f;
ScrewVertIter lt_iter;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c b/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c
index 43c6c6d791e..33f5680eaa9 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c
@@ -43,15 +43,24 @@ static bNodeSocketType cmp_node_colorbalance_out[]={
{-1,0,""}
};
+/* this function implements ASC-CDL according to the spec at http://www.asctech.org/
+ Slope
+ S = in * slope
+ Offset
+ O = S + offset
+ = (in * slope) + offset
+ Power
+ out = Clamp(O) ^ power
+ = Clamp((in * slope) + offset) ^ power
+ */
DO_INLINE float colorbalance_cdl(float in, float offset, float power, float slope)
{
float x = in * slope + offset;
/* prevent NaN */
- if (x < 0.f) x = 0.f;
+ CLAMP(x, 0.0, 1.0);
- //powf(in * slope + offset, power)
- return powf(x, 1.f/power);
+ return powf(x, power);
}
/* note: lift_lgg is just 2-lift, gamma_inv is 1.0/gamma */
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_crop.c b/source/blender/nodes/intern/CMP_nodes/CMP_crop.c
index c2edb3dd52f..4585a9ab9a2 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_crop.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_crop.c
@@ -50,6 +50,13 @@ static void node_composit_exec_crop(void *data, bNode *node, bNodeStack **in, bN
float *srcfp, *outfp;
rcti outputrect;
+ if(node->custom2) {
+ ntxy->x1= cbuf->x* ntxy->fac_x1;
+ ntxy->x2= cbuf->x* ntxy->fac_x2;
+ ntxy->y1= cbuf->y* ntxy->fac_y1;
+ ntxy->y2= cbuf->y* ntxy->fac_y2;
+ }
+
/* check input image size */
if(cbuf->x <= ntxy->x1 + 1)
ntxy->x1= cbuf->x - 1;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_displace.c b/source/blender/nodes/intern/CMP_nodes/CMP_displace.c
index 6fe6dcd8440..7d64d4e719c 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_displace.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_displace.c
@@ -48,7 +48,7 @@ static bNodeSocketType cmp_node_displace_out[]= {
* in order to take effect */
#define DISPLACE_EPSILON 0.01
-static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float *veccol, float *xscale, float *yscale)
+static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float *veccol, CompBuf *xbuf, CompBuf *ybuf, float *xscale, float *yscale)
{
ImBuf *ibuf;
int x, y;
@@ -56,6 +56,7 @@ static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float
float d_dx, d_dy;
float dxt, dyt;
float u, v;
+ float xs, ys;
float vec[3], vecdx[3], vecdy[3];
float col[3];
@@ -66,8 +67,20 @@ static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float
for(x=0; x < stackbuf->x; x++) {
/* calc pixel coordinates */
qd_getPixel(vecbuf, x-vecbuf->xof, y-vecbuf->yof, vec);
- p_dx = vec[0] * xscale[0];
- p_dy = vec[1] * yscale[0];
+
+ if (xbuf)
+ qd_getPixel(xbuf, x-xbuf->xof, y-xbuf->yof, &xs);
+ else
+ xs = xscale[0];
+
+ if (ybuf)
+ qd_getPixel(ybuf, x-ybuf->xof, y-ybuf->yof, &ys);
+ else
+ ys = yscale[0];
+
+
+ p_dx = vec[0] * xs;
+ p_dy = vec[1] * ys;
/* if no displacement, then just copy this pixel */
if (p_dx < DISPLACE_EPSILON && p_dy < DISPLACE_EPSILON) {
@@ -84,8 +97,8 @@ static void do_displace(CompBuf *stackbuf, CompBuf *cbuf, CompBuf *vecbuf, float
/* calc derivatives */
qd_getPixel(vecbuf, x-vecbuf->xof+1, y-vecbuf->yof, vecdx);
qd_getPixel(vecbuf, x-vecbuf->xof, y-vecbuf->yof+1, vecdy);
- d_dx = vecdx[0] * xscale[0];
- d_dy = vecdy[0] * yscale[0];
+ d_dx = vecdx[0] * xs;
+ d_dy = vecdy[0] * ys;
/* clamp derivatives to minimum displacement distance in UV space */
dxt = MAX2(p_dx - d_dx, DISPLACE_EPSILON)/(float)stackbuf->x;
@@ -132,13 +145,18 @@ static void node_composit_exec_displace(void *data, bNode *node, bNodeStack **in
if(in[0]->data && in[1]->data) {
CompBuf *cbuf= in[0]->data;
CompBuf *vecbuf= in[1]->data;
+ CompBuf *xbuf= in[2]->data;
+ CompBuf *ybuf= in[3]->data;
CompBuf *stackbuf;
cbuf= typecheck_compbuf(cbuf, CB_RGBA);
vecbuf= typecheck_compbuf(vecbuf, CB_VEC3);
+ xbuf= typecheck_compbuf(xbuf, CB_VAL);
+ ybuf= typecheck_compbuf(ybuf, CB_VAL);
+
stackbuf= alloc_compbuf(cbuf->x, cbuf->y, CB_RGBA, 1); /* allocs */
- do_displace(stackbuf, cbuf, vecbuf, in[1]->vec, in[2]->vec, in[3]->vec);
+ do_displace(stackbuf, cbuf, vecbuf, in[1]->vec, xbuf, ybuf, in[2]->vec, in[3]->vec);
out[0]->data= stackbuf;
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c b/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c
index 4103981af46..ccb1d8abfd9 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_rotate.c
@@ -71,7 +71,7 @@ static void node_composit_exec_rotate(void *data, bNode *node, bNodeStack **in,
ibuf=IMB_allocImBuf(cbuf->x, cbuf->y, 32, 0, 0);
obuf=IMB_allocImBuf(stackbuf->x, stackbuf->y, 32, 0, 0);
- if(ibuf){
+ if(ibuf && obuf){
ibuf->rect_float=cbuf->rect;
obuf->rect_float=stackbuf->rect;
@@ -103,6 +103,9 @@ static void node_composit_exec_rotate(void *data, bNode *node, bNodeStack **in,
centx= (float)cbuf->xof; centy= (float)cbuf->yof;
stackbuf->xof= (int)( c*centx + s*centy);
stackbuf->yof= (int)(-s*centx + c*centy);
+
+ IMB_freeImBuf(ibuf);
+ IMB_freeImBuf(obuf);
}
/* pass on output and free */
diff --git a/source/blender/python/SConscript b/source/blender/python/SConscript
index f062f64249c..097f69155d5 100644
--- a/source/blender/python/SConscript
+++ b/source/blender/python/SConscript
@@ -21,4 +21,4 @@ env.BlenderLib( libname = 'bf_python', sources = Split(sources), includes = Spli
# generic
sources = env.Glob('generic/*.c')
-env.BlenderLib( libname = 'bf_gen_python', sources = Split(sources), includes = Split(incs), defines = defs, libtype = ['core','player'], priority = [362,165]) # ketsji is 360
+env.BlenderLib( libname = 'bf_python_ext', sources = Split(sources), includes = Split(incs), defines = defs, libtype = ['core','player'], priority = [362,165]) # ketsji is 360
diff --git a/source/blender/python/doc/epy/Geometry.py b/source/blender/python/doc/epy/Geometry.py
index f8752a135c3..d0c4dfdfd8d 100644
--- a/source/blender/python/doc/epy/Geometry.py
+++ b/source/blender/python/doc/epy/Geometry.py
@@ -186,4 +186,4 @@ def BezierInterp(vec_knot_1, vec_handle_1, vec_handle_2, vec_knot_2, resolution)
@note: any vector size is supported, the largest dimension from the input will be used for all returned vectors/
@rtype: list
@return: a list of vectors the size of resolution including the start and end points (vec_knot_1 and vec_knot_2)
- """ \ No newline at end of file
+ """
diff --git a/source/blender/python/doc/epy/IDProp.py b/source/blender/python/doc/epy/IDProp.py
index 01d5136cd70..1fc26d7f65b 100644
--- a/source/blender/python/doc/epy/IDProp.py
+++ b/source/blender/python/doc/epy/IDProp.py
@@ -129,4 +129,4 @@ class IDArray:
def __len__():
pass
- \ No newline at end of file
+
diff --git a/source/blender/python/doc/examples/mathutils.Euler.py b/source/blender/python/doc/examples/mathutils.Euler.py
index f8294ce5545..bc7702c1d53 100644
--- a/source/blender/python/doc/examples/mathutils.Euler.py
+++ b/source/blender/python/doc/examples/mathutils.Euler.py
@@ -1,3 +1,3 @@
import mathutils
-# todo \ No newline at end of file
+# todo
diff --git a/source/blender/python/doc/examples/mathutils.Matrix.py b/source/blender/python/doc/examples/mathutils.Matrix.py
index f8294ce5545..bc7702c1d53 100644
--- a/source/blender/python/doc/examples/mathutils.Matrix.py
+++ b/source/blender/python/doc/examples/mathutils.Matrix.py
@@ -1,3 +1,3 @@
import mathutils
-# todo \ No newline at end of file
+# todo
diff --git a/source/blender/python/doc/examples/mathutils.Quaternion.py b/source/blender/python/doc/examples/mathutils.Quaternion.py
index f8294ce5545..bc7702c1d53 100644
--- a/source/blender/python/doc/examples/mathutils.Quaternion.py
+++ b/source/blender/python/doc/examples/mathutils.Quaternion.py
@@ -1,3 +1,3 @@
import mathutils
-# todo \ No newline at end of file
+# todo
diff --git a/source/blender/python/doc/examples/mathutils.py b/source/blender/python/doc/examples/mathutils.py
index 0b30a0f4505..02f69515f21 100644
--- a/source/blender/python/doc/examples/mathutils.py
+++ b/source/blender/python/doc/examples/mathutils.py
@@ -15,4 +15,4 @@ quat2 = mat3.to_quat()
angle = quat1.difference(quat2)
-print(angle) \ No newline at end of file
+print(angle)
diff --git a/source/blender/python/doc/sphinx_doc_gen.py b/source/blender/python/doc/sphinx_doc_gen.py
index 06d1a9021b8..6cc5049d29b 100644
--- a/source/blender/python/doc/sphinx_doc_gen.py
+++ b/source/blender/python/doc/sphinx_doc_gen.py
@@ -307,6 +307,9 @@ def rna2sphinx(BASEPATH):
if bpy.app.build_revision != "Unknown":
version_string = version_string + " r" + bpy.app.build_revision
+ # for use with files
+ version_string_fp = "_".join(str(v) for v in bpy.app.version)
+
fw("project = 'Blender'\n")
# fw("master_doc = 'index'\n")
fw("copyright = u'Blender Foundation'\n")
@@ -336,7 +339,7 @@ def rna2sphinx(BASEPATH):
fw("\n")
fw("An introduction to Blender and Python can be found at <http://wiki.blender.org/index.php/Dev:2.5/Py/API/Intro>\n")
fw("\n")
- fw("`A PDF version of this document is also available <blender_python_reference_250.pdf>`__\n")
+ fw("`A PDF version of this document is also available <blender_python_reference_%s.pdf>`__\n" % version_string_fp)
fw("\n")
fw(".. warning:: The Python API in Blender is **UNSTABLE**, It should only be used for testing, any script written now may break in future releases.\n")
fw(" \n")
@@ -440,7 +443,7 @@ def rna2sphinx(BASEPATH):
fw("\n")
fw(" Access to blenders internal data\n")
fw("\n")
- fw(" :type: :class:`bpy.types.Main`\n")
+ fw(" :type: :class:`bpy.types.BlendData`\n")
file.close()
EXAMPLE_SET_USED.add("bpy.data")
@@ -650,6 +653,10 @@ def rna2sphinx(BASEPATH):
if lines:
fw(".. rubric:: Inherited Properties\n\n")
+
+ fw(".. hlist::\n")
+ fw(" :columns: 2\n\n")
+
for line in lines:
fw(line)
fw("\n")
@@ -671,6 +678,10 @@ def rna2sphinx(BASEPATH):
if lines:
fw(".. rubric:: Inherited Functions\n\n")
+
+ fw(".. hlist::\n")
+ fw(" :columns: 2\n\n")
+
for line in lines:
fw(line)
fw("\n")
@@ -682,6 +693,9 @@ def rna2sphinx(BASEPATH):
# use this otherwise it gets in the index for a normal heading.
fw(".. rubric:: References\n\n")
+ fw(".. hlist::\n")
+ fw(" :columns: 2\n\n")
+
for ref in struct.references:
ref_split = ref.split(".")
if len(ref_split) > 2:
diff --git a/source/blender/python/doc/sphinx_doc_gen.sh b/source/blender/python/doc/sphinx_doc_gen.sh
index 4f5f55af2bd..989424ba7eb 100755
--- a/source/blender/python/doc/sphinx_doc_gen.sh
+++ b/source/blender/python/doc/sphinx_doc_gen.sh
@@ -5,7 +5,12 @@
BLENDER="./blender.bin"
SSH_HOST="ideasman42@emo.blender.org"
-SSH_UPLOAD="/data/www/vhosts/www.blender.org/documentation/250PythonDoc"
+SSH_UPLOAD="/data/www/vhosts/www.blender.org/documentation" # blender_python_api_VERSION, added after
+
+# sed string from hell, 'Blender 2.53 (sub 1) Build' --> '2_53_1'
+# "_".join(str(v) for v in bpy.app.version)
+BLENDER_VERSION=`$BLENDER --version | cut -f2-4 -d" " | sed 's/(//g' | sed 's/)//g' | sed 's/ sub /./g' | sed 's/\./_/g'`
+SSH_UPLOAD_FULL=$SSH_UPLOAD/"blender_python_api_"$BLENDER_VERSION
# dont delete existing docs, now partial updates are used for quick builds.
$BLENDER --background --python ./source/blender/python/doc/sphinx_doc_gen.py
@@ -13,12 +18,12 @@ $BLENDER --background --python ./source/blender/python/doc/sphinx_doc_gen.py
# html
sphinx-build source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out
cp source/blender/python/doc/sphinx-out/contents.html source/blender/python/doc/sphinx-out/index.html
-ssh ideasman42@emo.blender.org 'rm -rf '$SSH_UPLOAD'/*'
-rsync --progress -avze "ssh -p 22" /b/source/blender/python/doc/sphinx-out/* $SSH_HOST:$SSH_UPLOAD/
+ssh ideasman42@emo.blender.org 'rm -rf '$SSH_UPLOAD_FULL'/*'
+rsync --progress -avze "ssh -p 22" /b/source/blender/python/doc/sphinx-out/* $SSH_HOST:$SSH_UPLOAD_FULL/
# pdf
sphinx-build -b latex source/blender/python/doc/sphinx-in source/blender/python/doc/sphinx-out
cd source/blender/python/doc/sphinx-out
make
cd ../../../../../
-rsync --progress -avze "ssh -p 22" source/blender/python/doc/sphinx-out/contents.pdf $SSH_HOST:$SSH_UPLOAD/blender_python_reference_250.pdf
+rsync --progress -avze "ssh -p 22" source/blender/python/doc/sphinx-out/contents.pdf $SSH_HOST:$SSH_UPLOAD_FULL/blender_python_reference_$BLENDER_VERSION.pdf
diff --git a/source/blender/python/generic/CMakeLists.txt b/source/blender/python/generic/CMakeLists.txt
index b6985458d0c..1a91abfbec8 100644
--- a/source/blender/python/generic/CMakeLists.txt
+++ b/source/blender/python/generic/CMakeLists.txt
@@ -31,4 +31,4 @@ SET(INC
${PYTHON_INC}
)
-BLENDERLIB(bf_gen_python "${SRC}" "${INC}")
+BLENDERLIB(bf_python_ext "${SRC}" "${INC}")
diff --git a/source/blender/python/generic/IDProp.c b/source/blender/python/generic/IDProp.c
index ba563f9fcbf..73e60a384a3 100644
--- a/source/blender/python/generic/IDProp.c
+++ b/source/blender/python/generic/IDProp.c
@@ -27,6 +27,15 @@
#include "IDProp.h"
#include "MEM_guardedalloc.h"
+#define USE_STRING_COERCE
+
+#ifdef USE_STRING_COERCE
+#include "py_capi_utils.h"
+#endif
+
+PyObject * PyC_UnicodeFromByte(const char *str);
+const char * PuC_UnicodeAsByte(PyObject *py_str, PyObject **coerce); /* coerce must be NULL */
+
/*** Function to wrap ID properties ***/
PyObject *BPy_Wrap_IDProperty(ID *id, IDProperty *prop, IDProperty *parent);
@@ -46,7 +55,11 @@ PyObject *BPy_IDGroup_WrapData( ID *id, IDProperty *prop )
{
switch ( prop->type ) {
case IDP_STRING:
+#ifdef USE_STRING_COERCE
+ return PyC_UnicodeFromByte(prop->data.pointer);
+#else
return PyUnicode_FromString( prop->data.pointer );
+#endif
case IDP_INT:
return PyLong_FromLong( (long)prop->data.val );
case IDP_FLOAT:
@@ -105,10 +118,25 @@ int BPy_IDGroup_SetData(BPy_IDProperty *self, IDProperty *prop, PyObject *value)
PyErr_SetString(PyExc_TypeError, "expected a string!");
return -1;
}
+#ifdef USE_STRING_COERCE
+ {
+ int alloc_len;
+ PyObject *value_coerce= NULL;
+
+ st= (char *)PuC_UnicodeAsByte(value, &value_coerce);
+ alloc_len= strlen(st) + 1;
st = _PyUnicode_AsString(value);
+ IDP_ResizeArray(prop, alloc_len);
+ memcpy(prop->data.pointer, st, alloc_len);
+ Py_XDECREF(value_coerce);
+ }
+#else
+ st = _PyUnicode_AsString(value);
IDP_ResizeArray(prop, strlen(st)+1);
strcpy(prop->data.pointer, st);
+#endif
+
return 0;
}
@@ -281,8 +309,15 @@ char *BPy_IDProperty_Map_ValidateAndCreate(char *name, IDProperty *group, PyObje
val.i = (int) PyLong_AsSsize_t(ob);
prop = IDP_New(IDP_INT, val, name);
} else if (PyUnicode_Check(ob)) {
+#ifdef USE_STRING_COERCE
+ PyObject *value_coerce= NULL;
+ val.str = (char *)PuC_UnicodeAsByte(ob, &value_coerce);
+ prop = IDP_New(IDP_STRING, val, name);
+ Py_XDECREF(value_coerce);
+#else
val.str = _PyUnicode_AsString(ob);
prop = IDP_New(IDP_STRING, val, name);
+#endif
} else if (PySequence_Check(ob)) {
PyObject *item;
int i;
@@ -432,7 +467,11 @@ static PyObject *BPy_IDGroup_MapDataToPy(IDProperty *prop)
{
switch (prop->type) {
case IDP_STRING:
+#ifdef USE_STRING_COERCE
+ return PyC_UnicodeFromByte(prop->data.pointer);
+#else
return PyUnicode_FromString(prop->data.pointer);
+#endif
break;
case IDP_FLOAT:
return PyFloat_FromDouble(*((float*)&prop->data.val));
diff --git a/source/blender/python/generic/bpy_internal_import.c b/source/blender/python/generic/bpy_internal_import.c
index 5240daf76cb..9e47021afb2 100644
--- a/source/blender/python/generic/bpy_internal_import.c
+++ b/source/blender/python/generic/bpy_internal_import.c
@@ -35,6 +35,7 @@
#include "BKE_global.h" /* grr, only for G.sce */
#include "BLI_listbase.h"
#include "BLI_path_util.h"
+#include "BLI_string.h"
#include <stddef.h>
static Main *bpy_import_main= NULL;
@@ -61,6 +62,12 @@ void bpy_import_main_set(struct Main *maggie)
void bpy_text_filename_get(char *fn, Text *text)
{
sprintf(fn, "%s/%s", text->id.lib ? text->id.lib->filepath : G.sce, text->id.name+2);
+
+ /* XXX, this is a bug in python's Py_CompileString()!
+ the string encoding should not be required to be utf-8
+ reported: http://bugs.python.org/msg115202
+ */
+ BLI_utf8_invalid_strip(fn, strlen(fn));
}
PyObject *bpy_text_import( Text *text )
diff --git a/source/blender/python/generic/mathutils_euler.c b/source/blender/python/generic/mathutils_euler.c
index b36eb7803f1..84845002ce8 100644
--- a/source/blender/python/generic/mathutils_euler.c
+++ b/source/blender/python/generic/mathutils_euler.c
@@ -250,7 +250,7 @@ static PyObject *Euler_Rotate(EulerObject * self, PyObject *args)
PyErr_SetString(PyExc_TypeError, "euler.rotate(): expected angle (float) and axis (x,y,z)");
return NULL;
}
- if(ELEM3(*axis, 'X', 'Y', 'Z') && axis[1]=='\0'){
+ if(!(ELEM3(*axis, 'X', 'Y', 'Z') && axis[1]=='\0')){
PyErr_SetString(PyExc_TypeError, "euler.rotate(): expected axis to be 'X', 'Y' or 'Z'");
return NULL;
}
diff --git a/source/blender/python/generic/mathutils_matrix.c b/source/blender/python/generic/mathutils_matrix.c
index 24239e1f541..3b8c7d3122a 100644
--- a/source/blender/python/generic/mathutils_matrix.c
+++ b/source/blender/python/generic/mathutils_matrix.c
@@ -1526,7 +1526,6 @@ static PyObject *Matrix_mul(PyObject * m1, PyObject * m2)
return NULL;
}
else /* if(mat1) { */ {
-
if(VectorObject_Check(m2)) { /* MATRIX*VECTOR */
return column_vector_multiplication(mat1, (VectorObject *)m2); /* vector update done inside the function */
}
diff --git a/source/blender/python/generic/mathutils_vector.c b/source/blender/python/generic/mathutils_vector.c
index 75a695526fc..424ee546245 100644
--- a/source/blender/python/generic/mathutils_vector.c
+++ b/source/blender/python/generic/mathutils_vector.c
@@ -39,7 +39,7 @@
#define SWIZZLE_VALID_AXIS 0x4
#define SWIZZLE_AXIS 0x3
-static PyObject *row_vector_multiplication(VectorObject* vec, MatrixObject * mat); /* utility func */
+static int row_vector_multiplication(float rvec[4], VectorObject* vec, MatrixObject * mat); /* utility func */
static PyObject *Vector_ToTupleExt(VectorObject *self, int ndigits);
//----------------------------------mathutils.Vector() ------------------
@@ -1003,6 +1003,10 @@ static PyObject *Vector_mul(PyObject * v1, PyObject * v2)
}
/*swap so vec1 is always the vector */
+ /* note: it would seem from this code that the matrix multiplication below
+ * is communicative. however the matrix class will always handle the
+ * (matrix * vector) case so we can ignore it here.
+ * This is NOT so for Quaternions: TODO, check if communicative (vec * quat) is correct */
if (vec2) {
vec1= vec2;
v2= v1;
@@ -1010,7 +1014,10 @@ static PyObject *Vector_mul(PyObject * v1, PyObject * v2)
if (MatrixObject_Check(v2)) {
/* VEC * MATRIX */
- return row_vector_multiplication(vec1, (MatrixObject*)v2);
+ float tvec[4];
+ if(row_vector_multiplication(tvec, vec1, (MatrixObject*)v2) == -1)
+ return NULL;
+ return newVectorObject(tvec, vec1->size, Py_NEW, NULL);
} else if (QuaternionObject_Check(v2)) {
/* VEC * QUAT */
QuaternionObject *quat2 = (QuaternionObject*)v2;
@@ -1056,43 +1063,21 @@ static PyObject *Vector_imul(PyObject * v1, PyObject * v2)
/* only support vec*=float and vec*=mat
vec*=vec result is a float so that wont work */
if (MatrixObject_Check(v2)) {
- float vecCopy[4];
- int x,y, size = vec->size;
- MatrixObject *mat= (MatrixObject*)v2;
-
- if(!BaseMath_ReadCallback(mat))
+ float tvec[4];
+ if(row_vector_multiplication(tvec, vec, (MatrixObject*)v2) == -1)
return NULL;
- if(mat->colSize != size){
- if(mat->rowSize == 4 && vec->size != 3){
- PyErr_SetString(PyExc_AttributeError, "vector * matrix: matrix column size and the vector size must be the same");
- return NULL;
- } else {
- vecCopy[3] = 1.0f;
- }
- }
-
- for(i = 0; i < size; i++){
- vecCopy[i] = vec->vec[i];
- }
-
- size = MIN2(size, mat->colSize);
-
- /*muliplication*/
- for(x = 0, i = 0; x < size; x++, i++) {
- double dot = 0.0f;
- for(y = 0; y < mat->rowSize; y++) {
- dot += mat->matrix[y][x] * vecCopy[y];
+ i= vec->size - 1;
+ do {
+ vec->vec[i] = tvec[i];
+ } while(i--);
}
- vec->vec[i] = (float)dot;
- }
- }
else if (((scalar= PyFloat_AsDouble(v2)) == -1.0 && PyErr_Occurred())==0) { /* VEC*=FLOAT */
-
- for(i = 0; i < vec->size; i++) {
+ i= vec->size - 1;
+ do {
vec->vec[i] *= scalar;
+ } while(i--);
}
- }
else {
PyErr_SetString(PyExc_TypeError, "Vector multiplication: arguments not acceptable for this operation\n");
return NULL;
@@ -1992,37 +1977,37 @@ if len(unique) != len(items):
// [2][5][8]
// [3][6][9]
//vector/matrix multiplication IS NOT COMMUTATIVE!!!!
-static PyObject *row_vector_multiplication(VectorObject* vec, MatrixObject * mat)
+static int row_vector_multiplication(float rvec[4], VectorObject* vec, MatrixObject * mat)
{
- float vecNew[4], vecCopy[4];
+ float vecCopy[4];
double dot = 0.0f;
int x, y, z = 0, vec_size = vec->size;
if(mat->colSize != vec_size){
if(mat->colSize == 4 && vec_size != 3){
PyErr_SetString(PyExc_AttributeError, "vector * matrix: matrix column size and the vector size must be the same");
- return NULL;
+ return -1;
}else{
vecCopy[3] = 1.0f;
}
}
if(!BaseMath_ReadCallback(vec) || !BaseMath_ReadCallback(mat))
- return NULL;
+ return -1;
for(x = 0; x < vec_size; x++){
vecCopy[x] = vec->vec[x];
}
- vecNew[3] = 1.0f;
+ rvec[3] = 1.0f;
//muliplication
for(x = 0; x < mat->rowSize; x++) {
for(y = 0; y < mat->colSize; y++) {
dot += mat->matrix[x][y] * vecCopy[y];
}
- vecNew[z++] = (float)dot;
+ rvec[z++] = (float)dot;
dot = 0.0f;
}
- return newVectorObject(vecNew, vec_size, Py_NEW, NULL);
+ return 0;
}
/*----------------------------Vector.negate() -------------------- */
diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c
new file mode 100644
index 00000000000..ad109528a8c
--- /dev/null
+++ b/source/blender/python/generic/py_capi_utils.c
@@ -0,0 +1,271 @@
+/**
+ * $Id$
+ *
+ * ***** 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.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+*/
+
+#include <Python.h>
+#include "py_capi_utils.h"
+
+/* for debugging */
+void PyC_ObSpit(char *name, PyObject *var) {
+ fprintf(stderr, "<%s> : ", name);
+ if (var==NULL) {
+ fprintf(stderr, "<NIL>");
+ }
+ else {
+ PyObject_Print(var, stderr, 0);
+ fprintf(stderr, " ref:%d ", (int)var->ob_refcnt);
+ fprintf(stderr, " ptr:%p", (void *)var);
+
+ fprintf(stderr, " type:");
+ if(Py_TYPE(var))
+ fprintf(stderr, "%s", Py_TYPE(var)->tp_name);
+ else
+ fprintf(stderr, "<NIL>");
+ }
+ fprintf(stderr, "\n");
+}
+
+void PyC_LineSpit(void) {
+ const char *filename;
+ int lineno;
+
+ PyErr_Clear();
+ PyC_FileAndNum(&filename, &lineno);
+
+ fprintf(stderr, "%s:%d\n", filename, lineno);
+}
+
+void PyC_FileAndNum(const char **filename, int *lineno)
+{
+ PyObject *getframe, *frame;
+ PyObject *f_lineno= NULL, *co_filename= NULL;
+
+ if (filename) *filename= NULL;
+ if (lineno) *lineno = -1;
+
+ getframe = PySys_GetObject("_getframe"); // borrowed
+ if (getframe==NULL) {
+ PyErr_Clear();
+ return;
+ }
+
+ frame = PyObject_CallObject(getframe, NULL);
+ if (frame==NULL) {
+ PyErr_Clear();
+ return;
+ }
+
+ /* when executing a script */
+ if (filename) {
+ co_filename= PyC_Object_GetAttrStringArgs(frame, 1, "f_code", "co_filename");
+ if (co_filename==NULL) {
+ PyErr_SetString(PyExc_SystemError, "Could not access sys._getframe().f_code.co_filename");
+ Py_DECREF(frame);
+ return;
+ }
+
+ *filename = _PyUnicode_AsString(co_filename);
+ Py_DECREF(co_filename);
+ }
+
+ /* when executing a module */
+ if(filename && *filename == NULL) {
+ /* try an alternative method to get the filename - module based
+ * references below are all borrowed (double checked) */
+ PyObject *mod_name= PyDict_GetItemString(PyEval_GetGlobals(), "__name__");
+ if(mod_name) {
+ PyObject *mod= PyDict_GetItem(PyImport_GetModuleDict(), mod_name);
+ if(mod) {
+ *filename= PyModule_GetFilename(mod);
+ }
+
+ /* unlikely, fallback */
+ if(*filename == NULL) {
+ *filename= _PyUnicode_AsString(mod_name);
+ }
+ }
+ }
+
+
+ if (lineno) {
+ f_lineno= PyObject_GetAttrString(frame, "f_lineno");
+ if (f_lineno==NULL) {
+ PyErr_SetString(PyExc_SystemError, "Could not access sys._getframe().f_lineno");
+ Py_DECREF(frame);
+ return;
+ }
+
+ *lineno = (int)PyLong_AsSsize_t(f_lineno);
+ Py_DECREF(f_lineno);
+ }
+
+ Py_DECREF(frame);
+}
+
+/* Would be nice if python had this built in */
+PyObject *PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...)
+{
+ Py_ssize_t i;
+ PyObject *item= o;
+ char *attr;
+
+ va_list vargs;
+
+ va_start(vargs, n);
+ for (i=0; i<n; i++) {
+ attr = va_arg(vargs, char *);
+ item = PyObject_GetAttrString(item, attr);
+
+ if (item)
+ Py_DECREF(item);
+ else /* python will set the error value here */
+ break;
+
+ }
+ va_end(vargs);
+
+ Py_XINCREF(item); /* final value has is increfed, to match PyObject_GetAttrString */
+ return item;
+}
+
+/* returns the exception string as a new PyUnicode object, depends on external StringIO module */
+PyObject *PyC_ExceptionBuffer(void)
+{
+ PyObject *stdout_backup = PySys_GetObject("stdout"); /* borrowed */
+ PyObject *stderr_backup = PySys_GetObject("stderr"); /* borrowed */
+ PyObject *string_io = NULL;
+ PyObject *string_io_buf = NULL;
+ PyObject *string_io_mod= NULL;
+ PyObject *string_io_getvalue= NULL;
+
+ PyObject *error_type, *error_value, *error_traceback;
+
+ if (!PyErr_Occurred())
+ return NULL;
+
+ PyErr_Fetch(&error_type, &error_value, &error_traceback);
+
+ PyErr_Clear();
+
+ /* import io
+ * string_io = io.StringIO()
+ */
+
+ if(! (string_io_mod= PyImport_ImportModule("io")) ) {
+ goto error_cleanup;
+ } else if (! (string_io = PyObject_CallMethod(string_io_mod, "StringIO", NULL))) {
+ goto error_cleanup;
+ } else if (! (string_io_getvalue= PyObject_GetAttrString(string_io, "getvalue"))) {
+ goto error_cleanup;
+ }
+
+ Py_INCREF(stdout_backup); // since these were borrowed we dont want them freed when replaced.
+ Py_INCREF(stderr_backup);
+
+ PySys_SetObject("stdout", string_io); // both of these are free'd when restoring
+ PySys_SetObject("stderr", string_io);
+
+ PyErr_Restore(error_type, error_value, error_traceback);
+ PyErr_Print(); /* print the error */
+ PyErr_Clear();
+
+ string_io_buf = PyObject_CallObject(string_io_getvalue, NULL);
+
+ PySys_SetObject("stdout", stdout_backup);
+ PySys_SetObject("stderr", stderr_backup);
+
+ Py_DECREF(stdout_backup); /* now sys owns the ref again */
+ Py_DECREF(stderr_backup);
+
+ Py_DECREF(string_io_mod);
+ Py_DECREF(string_io_getvalue);
+ Py_DECREF(string_io); /* free the original reference */
+
+ PyErr_Clear();
+ return string_io_buf;
+
+
+error_cleanup:
+ /* could not import the module so print the error and close */
+ Py_XDECREF(string_io_mod);
+ Py_XDECREF(string_io);
+
+ PyErr_Restore(error_type, error_value, error_traceback);
+ PyErr_Print(); /* print the error */
+ PyErr_Clear();
+
+ return NULL;
+}
+
+
+/* string conversion, escape non-unicode chars, coerce must be set to NULL */
+const char *PuC_UnicodeAsByte(PyObject *py_str, PyObject **coerce)
+{
+ char *result;
+
+ result= _PyUnicode_AsString(py_str);
+
+ if(result) {
+ /* 99% of the time this is enough but we better support non unicode
+ * chars since blender doesnt limit this */
+ return result;
+ }
+ else {
+ /* mostly copied from fileio.c's, fileio_init */
+ PyObject *stringobj;
+ PyObject *u;
+
+ PyErr_Clear();
+
+ u= PyUnicode_FromObject(py_str); /* coerce into unicode */
+
+ if (u == NULL)
+ return NULL;
+
+ stringobj= PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(u), PyUnicode_GET_SIZE(u), "surrogateescape");
+ Py_DECREF(u);
+ if (stringobj == NULL)
+ return NULL;
+ if (!PyBytes_Check(stringobj)) { /* this seems wrong but it works fine */
+ // printf("encoder failed to return bytes\n");
+ Py_DECREF(stringobj);
+ return NULL;
+ }
+ *coerce= stringobj;
+
+ return PyBytes_AS_STRING(stringobj);
+ }
+}
+
+PyObject *PyC_UnicodeFromByte(const char *str)
+{
+ PyObject *result= PyUnicode_FromString(str);
+ if(result) {
+ /* 99% of the time this is enough but we better support non unicode
+ * chars since blender doesnt limit this */
+ return result;
+ }
+ else {
+ PyErr_Clear();
+ result= PyUnicode_DecodeUTF8(str, strlen(str), "surrogateescape");
+ return result;
+ }
+}
diff --git a/source/blender/python/generic/py_capi_utils.h b/source/blender/python/generic/py_capi_utils.h
new file mode 100644
index 00000000000..180159ebddb
--- /dev/null
+++ b/source/blender/python/generic/py_capi_utils.h
@@ -0,0 +1,41 @@
+/**
+ * $Id$
+ *
+ * ***** 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): Campbell Barton
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef PY_CAPI_UTILS_H
+#define PY_CAPI_UTILS_H
+
+struct PyObject;
+
+void PyC_ObSpit(char *name, PyObject *var);
+void PyC_LineSpit(void);
+PyObject * PyC_ExceptionBuffer(void);
+PyObject * PyC_Object_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...);
+void PyC_FileAndNum(const char **filename, int *lineno);
+int PyC_AsArray(void *array, PyObject *value, int length, PyTypeObject *type, char *error_prefix);
+
+/* follow http://www.python.org/dev/peps/pep-0383/ */
+PyObject * PyC_UnicodeFromByte(const char *str);
+const char * PuC_UnicodeAsByte(PyObject *py_str, PyObject **coerce); /* coerce must be NULL */
+
+#endif // PY_CAPI_UTILS_H
diff --git a/source/blender/python/intern/bpy.h b/source/blender/python/intern/bpy.h
index 114d0f9a43d..76eef6ea4b9 100644
--- a/source/blender/python/intern/bpy.h
+++ b/source/blender/python/intern/bpy.h
@@ -22,4 +22,4 @@
* ***** END GPL LICENSE BLOCK ***** */
void BPy_init_modules( void );
- \ No newline at end of file
+
diff --git a/source/blender/python/intern/bpy_array.c b/source/blender/python/intern/bpy_array.c
index 9ceba4ae004..1afd54b3607 100644
--- a/source/blender/python/intern/bpy_array.c
+++ b/source/blender/python/intern/bpy_array.c
@@ -24,6 +24,7 @@
#include "bpy_rna.h"
#include "BKE_global.h"
+#include "MEM_guardedalloc.h"
#define MAX_ARRAY_DIMENSION 10
@@ -144,8 +145,9 @@ static int validate_array_length(PyObject *rvalue, PointerRNA *ptr, PropertyRNA
return 0;
}
#else
- PyErr_Format(PyExc_ValueError, "%s %s.%s: array length cannot be changed to %d", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), tot);
- return 0;
+ *totitem= tot;
+ return 1;
+
#endif
}
@@ -248,22 +250,25 @@ static int py_to_array(PyObject *py, PointerRNA *ptr, PropertyRNA *prop, Paramet
}
if (totitem) {
- if (!param_data || RNA_property_flag(prop) & PROP_DYNAMIC)
- data= PyMem_MALLOC(item_size * totitem);
- else
+ /* note: this code is confusing */
+ if(param_data && RNA_property_flag(prop) & PROP_DYNAMIC) {
+ /* not freeing allocated mem, RNA_parameter_list_free() will do this */
+ ParameterDynAlloc *param_alloc= (ParameterDynAlloc *)param_data;
+ param_alloc->array_tot= (int)totitem;
+ param_alloc->array= MEM_callocN(item_size * totitem, "py_to_array dyn"); /* freeing param list will free */
+
+ data= param_alloc->array;
+ }
+ else if (param_data) {
data= param_data;
+ }
+ else {
+ data= PyMem_MALLOC(item_size * totitem);
+ }
copy_values(py, ptr, prop, 0, data, item_size, NULL, convert_item, NULL);
- if (param_data) {
- if (RNA_property_flag(prop) & PROP_DYNAMIC) {
- /* not freeing allocated mem, RNA_parameter_list_free will do this */
- *(char**)param_data= data;
-
- RNA_parameter_length_set_data(parms, prop, param_data, totitem);
- }
- }
- else {
+ if (param_data==NULL) {
/* NULL can only pass through in case RNA property arraylength is 0 (impossible?) */
rna_set_array(ptr, prop, data);
PyMem_FREE(data);
@@ -452,10 +457,10 @@ static PyObject *pyrna_py_from_array_internal(PointerRNA *ptr, PropertyRNA *prop
}
#endif
-PyObject *pyrna_py_from_array_index(BPy_PropertyRNA *self, PointerRNA *ptr, PropertyRNA *prop, int index)
+PyObject *pyrna_py_from_array_index(BPy_PropertyArrayRNA *self, PointerRNA *ptr, PropertyRNA *prop, int index)
{
int totdim, arraydim, arrayoffset, dimsize[MAX_ARRAY_DIMENSION], i, len;
- BPy_PropertyRNA *ret= NULL;
+ BPy_PropertyArrayRNA *ret= NULL;
arraydim= self ? self->arraydim : 0;
arrayoffset = self ? self->arrayoffset : 0;
@@ -473,7 +478,7 @@ PyObject *pyrna_py_from_array_index(BPy_PropertyRNA *self, PointerRNA *ptr, Prop
totdim= RNA_property_array_dimension(ptr, prop, dimsize);
if (arraydim + 1 < totdim) {
- ret= (BPy_PropertyRNA*)pyrna_prop_CreatePyObject(ptr, prop);
+ ret= (BPy_PropertyArrayRNA*)pyrna_prop_CreatePyObject(ptr, prop);
ret->arraydim= arraydim + 1;
/* arr[3][4][5]
@@ -491,7 +496,7 @@ PyObject *pyrna_py_from_array_index(BPy_PropertyRNA *self, PointerRNA *ptr, Prop
}
else {
index = arrayoffset + index;
- ret= (BPy_PropertyRNA*)pyrna_array_item(ptr, prop, index);
+ ret= (BPy_PropertyArrayRNA *)pyrna_array_item(ptr, prop, index);
}
return (PyObject*)ret;
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index af2b5b41961..77d0f4fa90a 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -41,6 +41,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_path_util.h"
#include "BLI_math_base.h"
+#include "BLI_string.h"
#include "BKE_context.h"
#include "BKE_text.h"
diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c
index c6c34fbcaf5..242a9e1fe5c 100644
--- a/source/blender/python/intern/bpy_operator.c
+++ b/source/blender/python/intern/bpy_operator.c
@@ -40,6 +40,45 @@
#include "MEM_guardedalloc.h"
#include "BKE_report.h"
+static PyObject *pyop_poll( PyObject * self, PyObject * args)
+{
+ wmOperatorType *ot;
+ char *opname;
+ PyObject *context_dict= NULL; /* optional args */
+ PyObject *context_dict_back;
+ PyObject *ret;
+
+ // XXX Todo, work out a better solution for passing on context, could make a tuple from self and pack the name and Context into it...
+ bContext *C = BPy_GetContext();
+
+ if (!PyArg_ParseTuple(args, "s|O:_bpy.ops.poll", &opname, &context_dict))
+ return NULL;
+
+ ot= WM_operatortype_find(opname, TRUE);
+
+ if (ot == NULL) {
+ PyErr_Format(PyExc_SystemError, "Polling operator \"bpy.ops.%s\" error, could not be found", opname);
+ return NULL;
+ }
+
+ if(!PyDict_Check(context_dict))
+ context_dict= NULL;
+
+ context_dict_back= CTX_py_dict_get(C);
+
+ CTX_py_dict_set(C, (void *)context_dict);
+ Py_XINCREF(context_dict); /* so we done loose it */
+
+ /* main purpose of thsi function */
+ ret= WM_operator_poll((bContext*)C, ot) ? Py_True : Py_False;
+
+ /* restore with original context dict, probably NULL but need this for nested operator calls */
+ Py_XDECREF(context_dict);
+ CTX_py_dict_set(C, (void *)context_dict_back);
+
+ Py_INCREF(ret);
+ return ret;
+}
static PyObject *pyop_call( PyObject * self, PyObject * args)
{
@@ -252,6 +291,7 @@ static PyObject *pyop_getrna(PyObject *self, PyObject *value)
PyObject *BPY_operator_module( void )
{
+ static PyMethodDef pyop_poll_meth = {"poll", (PyCFunction) pyop_poll, METH_VARARGS, NULL};
static PyMethodDef pyop_call_meth = {"call", (PyCFunction) pyop_call, METH_VARARGS, NULL};
static PyMethodDef pyop_as_string_meth ={"as_string", (PyCFunction) pyop_as_string, METH_VARARGS, NULL};
static PyMethodDef pyop_dir_meth = {"dir", (PyCFunction) pyop_dir, METH_NOARGS, NULL};
@@ -261,6 +301,7 @@ PyObject *BPY_operator_module( void )
PyObject *submodule = PyModule_New("_bpy.ops");
PyDict_SetItemString(PyImport_GetModuleDict(), "_bpy.ops", submodule);
+ PyModule_AddObject( submodule, "poll", PyCFunction_New(&pyop_poll_meth, NULL) );
PyModule_AddObject( submodule, "call", PyCFunction_New(&pyop_call_meth, NULL) );
PyModule_AddObject( submodule, "as_string",PyCFunction_New(&pyop_as_string_meth,NULL) );
PyModule_AddObject( submodule, "dir", PyCFunction_New(&pyop_dir_meth, NULL) );
diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c
index 9afe638908c..9ae7507a72a 100644
--- a/source/blender/python/intern/bpy_props.c
+++ b/source/blender/python/intern/bpy_props.c
@@ -26,11 +26,15 @@
#include "bpy_rna.h"
#include "bpy_util.h"
+#include "BKE_utildefines.h"
+
#include "RNA_define.h" /* for defining our own rna */
#include "RNA_enum_types.h"
#include "MEM_guardedalloc.h"
+#include "../generic/py_capi_utils.h"
+
EnumPropertyItem property_flag_items[] = {
{PROP_HIDDEN, "HIDDEN", 0, "Hidden", ""},
{PROP_ANIMATABLE, "ANIMATABLE", 0, "Animateable", ""},
@@ -219,7 +223,7 @@ PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
return NULL;
}
- if(pydef && BPyAsPrimitiveArray(def, pydef, size, &PyBool_Type, "BoolVectorProperty(default=sequence)") < 0)
+ if(pydef && PyC_AsArray(def, pydef, size, &PyBool_Type, "BoolVectorProperty(default=sequence)") < 0)
return NULL;
// prop= RNA_def_boolean_array(srna, id, size, pydef ? def:NULL, name, description);
@@ -292,7 +296,7 @@ PyObject *BPy_IntProperty(PyObject *self, PyObject *args, PyObject *kw)
RNA_def_property_int_default(prop, def);
RNA_def_property_range(prop, min, max);
RNA_def_property_ui_text(prop, name, description);
- RNA_def_property_ui_range(prop, soft_min, soft_max, step, 3);
+ RNA_def_property_ui_range(prop, MAX2(soft_min, min), MIN2(soft_max, max), step, 3);
if(pyopts) {
if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
@@ -361,7 +365,7 @@ PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
return NULL;
}
- if(pydef && BPyAsPrimitiveArray(def, pydef, size, &PyLong_Type, "IntVectorProperty(default=sequence)") < 0)
+ if(pydef && PyC_AsArray(def, pydef, size, &PyLong_Type, "IntVectorProperty(default=sequence)") < 0)
return NULL;
prop= RNA_def_property(srna, id, PROP_INT, subtype);
@@ -369,7 +373,7 @@ PyObject *BPy_IntVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
if(pydef) RNA_def_property_int_array_default(prop, def);
RNA_def_property_range(prop, min, max);
RNA_def_property_ui_text(prop, name, description);
- RNA_def_property_ui_range(prop, soft_min, soft_max, step, 3);
+ RNA_def_property_ui_range(prop, MAX2(soft_min, min), MIN2(soft_max, max), step, 3);
if(pyopts) {
if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
@@ -446,7 +450,7 @@ PyObject *BPy_FloatProperty(PyObject *self, PyObject *args, PyObject *kw)
RNA_def_property_float_default(prop, def);
RNA_def_property_range(prop, min, max);
RNA_def_property_ui_text(prop, name, description);
- RNA_def_property_ui_range(prop, soft_min, soft_max, step, precision);
+ RNA_def_property_ui_range(prop, MAX2(soft_min, min), MIN2(soft_max, max), step, precision);
if(pyopts) {
if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
@@ -515,7 +519,7 @@ PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
return NULL;
}
- if(pydef && BPyAsPrimitiveArray(def, pydef, size, &PyFloat_Type, "FloatVectorProperty(default=sequence)") < 0)
+ if(pydef && PyC_AsArray(def, pydef, size, &PyFloat_Type, "FloatVectorProperty(default=sequence)") < 0)
return NULL;
prop= RNA_def_property(srna, id, PROP_FLOAT, subtype);
@@ -523,7 +527,7 @@ PyObject *BPy_FloatVectorProperty(PyObject *self, PyObject *args, PyObject *kw)
if(pydef) RNA_def_property_float_array_default(prop, def);
RNA_def_property_range(prop, min, max);
RNA_def_property_ui_text(prop, name, description);
- RNA_def_property_ui_range(prop, soft_min, soft_max, step, precision);
+ RNA_def_property_ui_range(prop, MAX2(soft_min, min), MIN2(soft_max, max), step, precision);
if(pyopts) {
if(opts & PROP_HIDDEN) RNA_def_property_flag(prop, PROP_HIDDEN);
@@ -717,7 +721,7 @@ static StructRNA *pointer_type_from_py(PyObject *value, const char *error_prefix
srna= srna_from_self(value, "BoolProperty(...):");
if(!srna) {
- PyObject *msg= BPY_exception_buffer();
+ PyObject *msg= PyC_ExceptionBuffer();
char *msg_char= _PyUnicode_AsString(msg);
PyErr_Format(PyExc_TypeError, "%.200s expected an RNA type derived from IDPropertyGroup, failed with: %s", error_prefix, msg_char);
Py_DECREF(msg);
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 07b237a40f8..bc688aa1df8 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -49,14 +49,16 @@
#include "ED_keyframing.h"
#define USE_MATHUTILS
+#define USE_STRING_COERCE
#ifdef USE_MATHUTILS
#include "../generic/mathutils.h" /* so we can have mathutils callbacks */
#include "../generic/IDProp.h" /* for IDprop lookups */
+#include "../generic/py_capi_utils.h"
-
-static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyRNA *self, PointerRNA *ptr, PropertyRNA *prop, int start, int stop, int length);
-static Py_ssize_t pyrna_prop_array_length(BPy_PropertyRNA *self);
+static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, void *data, PyObject *value, const char *error_prefix);
+static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, PointerRNA *ptr, PropertyRNA *prop, int start, int stop, int length);
+static Py_ssize_t pyrna_prop_array_length(BPy_PropertyArrayRNA *self);
static Py_ssize_t pyrna_prop_collection_length(BPy_PropertyRNA *self);
static short pyrna_rotation_euler_order_get(PointerRNA *ptr, PropertyRNA **prop_eul_order, short order_fallback);
@@ -100,6 +102,11 @@ static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype)
if(self->prop==NULL)
return 0;
+ if (!RNA_property_editable_flag(&self->ptr, self->prop)) {
+ PyErr_Format(PyExc_AttributeError, "bpy_prop \"%.200s.%.200s\" is read-only", RNA_struct_identifier(self->ptr.type), RNA_property_identifier(self->prop));
+ return 0;
+ }
+
RNA_property_float_range(&self->ptr, self->prop, &min, &max);
if(min != FLT_MIN || max != FLT_MAX) {
@@ -143,6 +150,11 @@ static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int subtype, int
if(self->prop==NULL)
return 0;
+ if (!RNA_property_editable_flag(&self->ptr, self->prop)) {
+ PyErr_Format(PyExc_AttributeError, "bpy_prop \"%.200s.%.200s\" is read-only", RNA_struct_identifier(self->ptr.type), RNA_property_identifier(self->prop));
+ return 0;
+ }
+
RNA_property_float_clamp(&self->ptr, self->prop, &bmo->data[index]);
RNA_property_float_set_index(&self->ptr, self->prop, index, bmo->data[index]);
RNA_property_update(BPy_GetContext(), &self->ptr, self->prop);
@@ -178,6 +190,12 @@ static int mathutils_rna_matrix_set(BaseMathObject *bmo, int subtype)
if(self->prop==NULL)
return 0;
+
+ if (!RNA_property_editable_flag(&self->ptr, self->prop)) {
+ PyErr_Format(PyExc_AttributeError, "bpy_prop \"%.200s.%.200s\" is read-only", RNA_struct_identifier(self->ptr.type), RNA_property_identifier(self->prop));
+ return 0;
+ }
+
/* can ignore clamping here */
RNA_property_float_set_array(&self->ptr, self->prop, bmo->data);
RNA_property_update(BPy_GetContext(), &self->ptr, self->prop);
@@ -483,7 +501,7 @@ static PyObject *pyrna_prop_str( BPy_PropertyRNA *self )
if(type==PROP_COLLECTION) {
len= pyrna_prop_collection_length(self);
} else if (RNA_property_array_check(&self->ptr, self->prop)) {
- len= pyrna_prop_array_length(self);
+ len= pyrna_prop_array_length((BPy_PropertyArrayRNA *)self);
}
if(len != -1)
@@ -768,9 +786,20 @@ PyObject * pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
break;
case PROP_STRING:
{
+ int subtype= RNA_property_subtype(prop);
char *buf;
buf = RNA_property_string_get_alloc(ptr, prop, NULL, -1);
+#ifdef USE_STRING_COERCE
+ /* only file paths get special treatment, they may contain non utf-8 chars */
+ if(ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
+ ret= PyC_UnicodeFromByte(buf);
+ }
+ else {
ret = PyUnicode_FromString( buf );
+ }
+#else
+ ret= PyUnicode_FromString(buf);
+#endif
MEM_freeN(buf);
break;
}
@@ -888,7 +917,7 @@ static PyObject *pyrna_func_to_py(BPy_DummyPointerRNA *pyrna, FunctionRNA *func)
-int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, void *data, PyObject *value, const char *error_prefix)
+static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, void *data, PyObject *value, const char *error_prefix)
{
/* XXX hard limits should be checked here */
int type = RNA_property_type(prop);
@@ -971,16 +1000,31 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, v
}
case PROP_STRING:
{
- char *param = _PyUnicode_AsString(value);
+ const char *param;
+#ifdef USE_STRING_COERCE
+ PyObject *value_coerce= NULL;
+ int subtype= RNA_property_subtype(prop);
+ if(ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
+ param= PuC_UnicodeAsByte(value, &value_coerce);
+ }
+ else {
+ param= _PyUnicode_AsString(value);
+ }
+#else
+ param= _PyUnicode_AsString(value);
+#endif
if (param==NULL) {
PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected a string type", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop));
return -1;
}
else {
- if(data) *((char**)data)= param;
+ if(data) *((char**)data)= param; /*XXX, this assignes a pointer, wouldnt it be better to copy??? */
else RNA_property_string_set(ptr, prop, param);
}
+#ifdef USE_STRING_COERCE
+ Py_XDECREF(value_coerce);
+#endif
break;
}
case PROP_ENUM:
@@ -1016,6 +1060,8 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, v
}
case PROP_POINTER:
{
+ PyObject *value_new= NULL;
+
StructRNA *ptype= RNA_property_pointer_type(ptr, prop);
int flag = RNA_property_flag(prop);
@@ -1025,15 +1071,29 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, v
return pyrna_pydict_to_props(&opptr, value, 0, error_prefix);
}
+ /* another exception, allow to pass a collection as an RNA property */
+ if(Py_TYPE(value)==&pyrna_prop_collection_Type) { /* ok to ignore idprop collections */
+ PointerRNA c_ptr;
+ BPy_PropertyRNA *value_prop= (BPy_PropertyRNA *)value;
+ if(RNA_property_collection_type_get(&value_prop->ptr, value_prop->prop, &c_ptr)) {
+ value= pyrna_struct_CreatePyObject(&c_ptr);
+ value_new= value;
+ }
+ else {
+ PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s collection has no type, cant be used as a %.200s type", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), RNA_struct_identifier(ptype));
+ return -1;
+ }
+ }
+
if(!BPy_StructRNA_Check(value) && value != Py_None) {
PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected a %.200s type", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), RNA_struct_identifier(ptype));
- return -1;
+ Py_XDECREF(value_new); return -1;
} else if((flag & PROP_NEVER_NULL) && value == Py_None) {
PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s does not support a 'None' assignment %.200s type", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), RNA_struct_identifier(ptype));
- return -1;
+ Py_XDECREF(value_new); return -1;
} else if(value != Py_None && ((flag & PROP_ID_SELF_CHECK) && ptr->id.data == ((BPy_StructRNA*)value)->ptr.id.data)) {
PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s ID type does not support assignment to its self", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop));
- return -1;
+ Py_XDECREF(value_new); return -1;
} else {
BPy_StructRNA *param= (BPy_StructRNA*)value;
int raise_error= FALSE;
@@ -1069,7 +1129,7 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, v
PointerRNA tmp;
RNA_pointer_create(NULL, ptype, NULL, &tmp);
PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected a %.200s type", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), RNA_struct_identifier(tmp.type));
- return -1;
+ Py_XDECREF(value_new); return -1;
}
}
@@ -1077,9 +1137,10 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, v
PointerRNA tmp;
RNA_pointer_create(NULL, ptype, NULL, &tmp);
PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s expected a %.200s type", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), RNA_struct_identifier(tmp.type));
- return -1;
+ Py_XDECREF(value_new); return -1;
}
}
+
break;
}
case PROP_COLLECTION:
@@ -1123,7 +1184,7 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, v
RNA_property_collection_add(ptr, prop, &itemptr);
if(pyrna_pydict_to_props(&itemptr, item, 1, "Converting a python list to an RNA collection")==-1) {
- PyObject *msg= BPY_exception_buffer();
+ PyObject *msg= PyC_ExceptionBuffer();
char *msg_char= _PyUnicode_AsString(msg);
PyErr_Format(PyExc_TypeError, "%.200s %.200s.%.200s error converting a member of a collection from a dicts into an RNA collection, failed with: %s", error_prefix, RNA_struct_identifier(ptr->type), RNA_property_identifier(prop), msg_char);
@@ -1150,12 +1211,12 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, v
return 0;
}
-static PyObject * pyrna_prop_to_py_index(BPy_PropertyRNA *self, int index)
+static PyObject * pyrna_prop_array_to_py_index(BPy_PropertyArrayRNA *self, int index)
{
return pyrna_py_from_array_index(self, &self->ptr, self->prop, index);
}
-static int pyrna_py_to_prop_index(BPy_PropertyRNA *self, int index, PyObject *value)
+static int pyrna_py_to_prop_array_index(BPy_PropertyArrayRNA *self, int index, PyObject *value)
{
int ret = 0;
int totdim;
@@ -1225,7 +1286,7 @@ static int pyrna_py_to_prop_index(BPy_PropertyRNA *self, int index, PyObject *va
}
//---------------sequence-------------------------------------------
-static Py_ssize_t pyrna_prop_array_length(BPy_PropertyRNA *self)
+static Py_ssize_t pyrna_prop_array_length(BPy_PropertyArrayRNA *self)
{
if (RNA_property_array_dimension(&self->ptr, self->prop, NULL) > 1)
return RNA_property_multi_array_length(&self->ptr, self->prop, self->arraydim);
@@ -1238,6 +1299,25 @@ static Py_ssize_t pyrna_prop_collection_length( BPy_PropertyRNA *self )
return RNA_property_collection_length(&self->ptr, self->prop);
}
+/* bool funcs are for speed, so we can avoid getting the length
+ * of 1000's of items in a linked list for eg. */
+static int pyrna_prop_array_bool(BPy_PropertyRNA *self)
+{
+ return RNA_property_array_length(&self->ptr, self->prop) ? 1 : 0;
+}
+
+static int pyrna_prop_collection_bool( BPy_PropertyRNA *self )
+{
+ /* no callback defined, just iterate and find the nth item */
+ CollectionPropertyIterator iter;
+ int test;
+
+ RNA_property_collection_begin(&self->ptr, self->prop, &iter);
+ test = iter.valid;
+ RNA_property_collection_end(&iter);
+ return test;
+}
+
/* internal use only */
static PyObject *pyrna_prop_collection_subscript_int(BPy_PropertyRNA *self, Py_ssize_t keynum)
{
@@ -1258,20 +1338,20 @@ static PyObject *pyrna_prop_collection_subscript_int(BPy_PropertyRNA *self, Py_s
return NULL;
}
-static PyObject *pyrna_prop_array_subscript_int(BPy_PropertyRNA *self, int keynum)
+static PyObject *pyrna_prop_array_subscript_int(BPy_PropertyArrayRNA *self, int keynum)
{
int len= pyrna_prop_array_length(self);
if(keynum < 0) keynum += len;
if(keynum >= 0 && keynum < len)
- return pyrna_prop_to_py_index(self, keynum);
+ return pyrna_prop_array_to_py_index(self, keynum);
PyErr_Format(PyExc_IndexError, "bpy_prop_array[index]: index %d out of range", keynum);
return NULL;
}
-static PyObject *pyrna_prop_collection_subscript_str(BPy_PropertyRNA *self, char *keyname)
+static PyObject *pyrna_prop_collection_subscript_str(BPy_PropertyRNA *self, const char *keyname)
{
PointerRNA newptr;
if(RNA_property_collection_lookup_string(&self->ptr, self->prop, keyname, &newptr))
@@ -1306,10 +1386,10 @@ static PyObject *pyrna_prop_collection_subscript_slice(PointerRNA *ptr, Property
}
/* TODO - dimensions
- * note: could also use pyrna_prop_to_py_index(self, count) in a loop but its a lot slower
+ * note: could also use pyrna_prop_array_to_py_index(self, count) in a loop but its a lot slower
* since at the moment it reads (and even allocates) the entire array for each index.
*/
-static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyRNA *self, PointerRNA *ptr, PropertyRNA *prop, int start, int stop, int length)
+static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, PointerRNA *ptr, PropertyRNA *prop, int start, int stop, int length)
{
int count, totdim;
@@ -1319,7 +1399,7 @@ static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyRNA *self, Pointer
if (totdim > 1) {
for (count = start; count < stop; count++)
- PyList_SET_ITEM(list, count - start, pyrna_prop_to_py_index(self, count));
+ PyList_SET_ITEM(list, count - start, pyrna_prop_array_to_py_index(self, count));
}
else {
switch (RNA_property_type(prop)) {
@@ -1417,7 +1497,7 @@ static PyObject *pyrna_prop_collection_subscript(BPy_PropertyRNA *self, PyObject
}
}
-static PyObject *pyrna_prop_array_subscript(BPy_PropertyRNA *self, PyObject *key)
+static PyObject *pyrna_prop_array_subscript(BPy_PropertyArrayRNA *self, PyObject *key)
{
/*if (PyUnicode_Check(key)) {
return pyrna_prop_array_subscript_str(self, _PyUnicode_AsString(key));
@@ -1452,7 +1532,7 @@ static PyObject *pyrna_prop_array_subscript(BPy_PropertyRNA *self, PyObject *key
}
}
-/* could call (pyrna_py_to_prop_index(self, i, value) in a loop but it is slow */
+/* could call (pyrna_py_to_prop_array_index(self, i, value) in a loop but it is slow */
static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop, int start, int stop, int length, PyObject *value_orig)
{
PyObject *value;
@@ -1555,20 +1635,20 @@ static int prop_subscript_ass_array_slice(PointerRNA *ptr, PropertyRNA *prop, in
}
-static int prop_subscript_ass_array_int(BPy_PropertyRNA *self, Py_ssize_t keynum, PyObject *value)
+static int prop_subscript_ass_array_int(BPy_PropertyArrayRNA *self, Py_ssize_t keynum, PyObject *value)
{
int len= pyrna_prop_array_length(self);
if(keynum < 0) keynum += len;
if(keynum >= 0 && keynum < len)
- return pyrna_py_to_prop_index(self, keynum, value);
+ return pyrna_py_to_prop_array_index(self, keynum, value);
PyErr_SetString(PyExc_IndexError, "bpy_prop_array[index] = value: index out of range");
return -1;
}
-static int pyrna_prop_array_ass_subscript( BPy_PropertyRNA *self, PyObject *key, PyObject *value )
+static int pyrna_prop_array_ass_subscript( BPy_PropertyArrayRNA *self, PyObject *key, PyObject *value )
{
/* char *keyname = NULL; */ /* not supported yet */
int ret= -1;
@@ -1630,6 +1710,31 @@ static PyMappingMethods pyrna_prop_collection_as_mapping = {
( objobjargproc ) NULL, /* mp_ass_subscript */
};
+/* only for fast bool's, large structs, assign nb_bool on init */
+static PyNumberMethods pyrna_prop_array_as_number = {
+ NULL, /* nb_add */
+ NULL, /* nb_subtract */
+ NULL, /* nb_multiply */
+ NULL, /* nb_remainder */
+ NULL, /* nb_divmod */
+ NULL, /* nb_power */
+ NULL, /* nb_negative */
+ NULL, /* nb_positive */
+ NULL, /* nb_absolute */
+ (inquiry) pyrna_prop_array_bool, /* nb_bool */
+};
+static PyNumberMethods pyrna_prop_collection_as_number = {
+ NULL, /* nb_add */
+ NULL, /* nb_subtract */
+ NULL, /* nb_multiply */
+ NULL, /* nb_remainder */
+ NULL, /* nb_divmod */
+ NULL, /* nb_power */
+ NULL, /* nb_negative */
+ NULL, /* nb_positive */
+ NULL, /* nb_absolute */
+ (inquiry) pyrna_prop_collection_bool, /* nb_bool */
+};
static int pyrna_prop_array_contains(BPy_PropertyRNA *self, PyObject *value)
{
@@ -2142,25 +2247,42 @@ static PyObject *pyrna_struct_is_property_hidden(BPy_StructRNA *self, PyObject *
}
static char pyrna_struct_path_resolve_doc[] =
-".. method:: path_resolve(path)\n"
+".. method:: path_resolve(path, coerce=True)\n"
+"\n"
+" Returns the property from the path, raise an exception when not found.\n"
"\n"
-" Returns the property from the path given or None if the property is not found.";
+" :arg path: path which this property resolves.\n"
+" :type path: string\n"
+" :arg coerce: optional argument, when True, the property will be converted into its python representation.\n"
+" :type coerce: boolean\n";
-static PyObject *pyrna_struct_path_resolve(BPy_StructRNA *self, PyObject *value)
+static PyObject *pyrna_struct_path_resolve(BPy_StructRNA *self, PyObject *args)
{
- char *path= _PyUnicode_AsString(value);
+ char *path;
+ PyObject *coerce= Py_True;
PointerRNA r_ptr;
PropertyRNA *r_prop;
- if(path==NULL) {
- PyErr_SetString(PyExc_TypeError, "bpy_struct.path_resolve(): accepts only a single string argument");
+ if (!PyArg_ParseTuple(args, "s|O!:path_resolve", &path, &PyBool_Type, &coerce))
return NULL;
- }
- if (RNA_path_resolve(&self->ptr, path, &r_ptr, &r_prop))
+ if (RNA_path_resolve(&self->ptr, path, &r_ptr, &r_prop)) {
+ if(r_prop) {
+ if(coerce == Py_False) {
return pyrna_prop_CreatePyObject(&r_ptr, r_prop);
-
- Py_RETURN_NONE;
+}
+ else {
+ return pyrna_prop_to_py(&r_ptr, r_prop);
+ }
+ }
+ else {
+ return pyrna_struct_CreatePyObject(&r_ptr);
+ }
+ }
+ else {
+ PyErr_Format(PyExc_TypeError, "%.200s.path_resolve(\"%.200s\") could not be resolved", RNA_struct_identifier(self->ptr.type), path);
+ return NULL;
+ }
}
static char pyrna_struct_path_from_id_doc[] =
@@ -2235,15 +2357,15 @@ static PyObject *pyrna_prop_path_from_id(BPy_PropertyRNA *self)
return ret;
}
-static char pyrna_struct_recast_type_doc[] =
-".. method:: recast_type()\n"
+static char pyrna_struct_type_recast_doc[] =
+".. method:: type_recast()\n"
"\n"
" Return a new instance, this is needed because types such as textures can be changed at runtime.\n"
"\n"
" :return: a new instance of this object with the type initialized again.\n"
" :rtype: subclass of :class:`bpy_struct`";
-static PyObject *pyrna_struct_recast_type(BPy_StructRNA *self, PyObject *args)
+static PyObject *pyrna_struct_type_recast(BPy_StructRNA *self, PyObject *args)
{
PointerRNA r_ptr;
RNA_pointer_recast(&self->ptr, &r_ptr);
@@ -2497,11 +2619,17 @@ static int pyrna_struct_setattro( BPy_StructRNA *self, PyObject *pyname, PyObjec
}
/* pyrna_py_to_prop sets its own exceptions */
- if(prop)
+ if(prop) {
+ if(value == NULL) {
+ PyErr_SetString(PyExc_AttributeError, "bpy_struct: del not supported");
+ return -1;
+ }
return pyrna_py_to_prop(&self->ptr, prop, NULL, NULL, value, "bpy_struct: item.attr = val:");
- else
+ }
+ else {
return PyObject_GenericSetAttr((PyObject *)self, pyname, value);
}
+}
static PyObject *pyrna_prop_dir(BPy_PropertyRNA *self)
{
@@ -2565,6 +2693,11 @@ static int pyrna_prop_collection_setattro( BPy_PropertyRNA *self, PyObject *pyna
PropertyRNA *prop;
PointerRNA r_ptr;
+ if(value == NULL) {
+ PyErr_SetString(PyExc_AttributeError, "bpy_prop: del not supported");
+ return -1;
+ }
+
if(RNA_property_collection_type_get(&self->ptr, self->prop, &r_ptr)) {
if ((prop = RNA_struct_find_property(&r_ptr, name))) {
/* pyrna_py_to_prop sets its own exceptions */
@@ -2577,7 +2710,7 @@ static int pyrna_prop_collection_setattro( BPy_PropertyRNA *self, PyObject *pyna
}
/* odd case, we need to be able return a python method from a tp_getset */
-static PyObject *pyrna_prop_add(BPy_PropertyRNA *self)
+static PyObject *pyrna_prop_collection_idprop_add(BPy_PropertyRNA *self)
{
PointerRNA r_ptr;
@@ -2591,7 +2724,7 @@ static PyObject *pyrna_prop_add(BPy_PropertyRNA *self)
}
}
-static PyObject *pyrna_prop_remove(BPy_PropertyRNA *self, PyObject *value)
+static PyObject *pyrna_prop_collection_idprop_remove(BPy_PropertyRNA *self, PyObject *value)
{
PyObject *ret;
int key= PyLong_AsSsize_t(value);
@@ -2612,7 +2745,7 @@ static PyObject *pyrna_prop_remove(BPy_PropertyRNA *self, PyObject *value)
return ret;
}
-static PyObject *pyrna_prop_move(BPy_PropertyRNA *self, PyObject *args)
+static PyObject *pyrna_prop_collection_idprop_move(BPy_PropertyRNA *self, PyObject *args)
{
PyObject *ret;
int key=0, pos=0;
@@ -2633,8 +2766,9 @@ static PyObject *pyrna_prop_move(BPy_PropertyRNA *self, PyObject *args)
return ret;
}
-static PyObject *pyrna_struct_get_id_data(BPy_StructRNA *self)
+static PyObject *pyrna_struct_get_id_data(BPy_DummyPointerRNA *self)
{
+ /* used for struct and pointer since both have a ptr */
if(self->ptr.id.data) {
PointerRNA id_ptr;
RNA_id_pointer_create((ID *)self->ptr.id.data, &id_ptr);
@@ -2647,12 +2781,12 @@ static PyObject *pyrna_struct_get_id_data(BPy_StructRNA *self)
/*****************************************************************************/
/* Python attributes get/set structure: */
/*****************************************************************************/
-#if 0
+
static PyGetSetDef pyrna_prop_getseters[] = {
- {"active", (getter)pyrna_prop_get_active, (setter)pyrna_prop_set_active, "", NULL},
+ {"id_data", (getter)pyrna_struct_get_id_data, (setter)NULL, "The :class:`ID` object this datablock is from or None, (not available for all data types)", NULL},
{NULL,NULL,NULL,NULL,NULL} /* Sentinel */
};
-#endif
+
static PyGetSetDef pyrna_struct_getseters[] = {
{"id_data", (getter)pyrna_struct_get_id_data, (setter)NULL, "The :class:`ID` object this datablock is from or None, (not available for all data types)", NULL},
@@ -2775,19 +2909,16 @@ static PyObject *pyrna_struct_get(BPy_StructRNA *self, PyObject *args)
static char pyrna_struct_as_pointer_doc[] =
".. method:: as_pointer()\n"
"\n"
-" Returns capsule which holds a pointer to blenders internal data\n"
+" Returns the memory address which holds a pointer to blenders internal data\n"
"\n"
" :return: capsule with a name set from the struct type.\n"
-" :rtype: PyCapsule\n"
+" :rtype: int\n"
"\n"
" .. note:: This is intended only for advanced script writers who need to pass blender data to their own C/Python modules.\n";
static PyObject *pyrna_struct_as_pointer(BPy_StructRNA *self)
{
- if(self->ptr.data)
- return PyCapsule_New(self->ptr.data, RNA_struct_identifier(self->ptr.type), NULL);
-
- Py_RETURN_NONE;
+ return PyLong_FromVoidPtr(self->ptr.data);
}
static PyObject *pyrna_prop_get(BPy_PropertyRNA *self, PyObject *args)
@@ -3060,7 +3191,7 @@ static PyObject *pyrna_prop_foreach_set(BPy_PropertyRNA *self, PyObject *args)
/* A bit of a kludge, make a list out of a collection or array,
* then return the lists iter function, not especially fast but convenient for now */
-PyObject *pyrna_prop_array_iter(BPy_PropertyRNA *self)
+PyObject *pyrna_prop_array_iter(BPy_PropertyArrayRNA *self)
{
/* Try get values from a collection */
PyObject *ret;
@@ -3112,15 +3243,29 @@ static struct PyMethodDef pyrna_struct_methods[] = {
{"driver_remove", (PyCFunction)pyrna_struct_driver_remove, METH_VARARGS, pyrna_struct_driver_remove_doc},
{"is_property_set", (PyCFunction)pyrna_struct_is_property_set, METH_VARARGS, pyrna_struct_is_property_set_doc},
{"is_property_hidden", (PyCFunction)pyrna_struct_is_property_hidden, METH_VARARGS, pyrna_struct_is_property_hidden_doc},
- {"path_resolve", (PyCFunction)pyrna_struct_path_resolve, METH_O, pyrna_struct_path_resolve_doc},
+ {"path_resolve", (PyCFunction)pyrna_struct_path_resolve, METH_VARARGS, pyrna_struct_path_resolve_doc},
{"path_from_id", (PyCFunction)pyrna_struct_path_from_id, METH_VARARGS, pyrna_struct_path_from_id_doc},
- {"recast_type", (PyCFunction)pyrna_struct_recast_type, METH_NOARGS, pyrna_struct_recast_type_doc},
+ {"type_recast", (PyCFunction)pyrna_struct_type_recast, METH_NOARGS, pyrna_struct_type_recast_doc},
{"__dir__", (PyCFunction)pyrna_struct_dir, METH_NOARGS, NULL},
/* experemental */
{"callback_add", (PyCFunction)pyrna_callback_add, METH_VARARGS, NULL},
{"callback_remove", (PyCFunction)pyrna_callback_remove, METH_VARARGS, NULL},
+ /* class methods, only valid for subclasses */
+ {"BoolProperty", (PyCFunction)BPy_BoolProperty, METH_VARARGS|METH_KEYWORDS|METH_CLASS, BPy_BoolProperty_doc},
+ {"BoolVectorProperty", (PyCFunction)BPy_BoolVectorProperty, METH_VARARGS|METH_KEYWORDS|METH_CLASS, BPy_BoolVectorProperty_doc},
+ {"IntProperty", (PyCFunction)BPy_IntProperty, METH_VARARGS|METH_KEYWORDS|METH_CLASS, BPy_IntProperty_doc},
+ {"IntVectorProperty", (PyCFunction)BPy_IntVectorProperty, METH_VARARGS|METH_KEYWORDS|METH_CLASS, BPy_IntVectorProperty_doc},
+ {"FloatProperty", (PyCFunction)BPy_FloatProperty, METH_VARARGS|METH_KEYWORDS|METH_CLASS, BPy_FloatProperty_doc},
+ {"FloatVectorProperty", (PyCFunction)BPy_FloatVectorProperty, METH_VARARGS|METH_KEYWORDS|METH_CLASS, BPy_FloatVectorProperty_doc},
+ {"StringProperty", (PyCFunction)BPy_StringProperty, METH_VARARGS|METH_KEYWORDS|METH_CLASS, BPy_StringProperty_doc},
+ {"EnumProperty", (PyCFunction)BPy_EnumProperty, METH_VARARGS|METH_KEYWORDS|METH_CLASS, BPy_EnumProperty_doc},
+ {"PointerProperty", (PyCFunction)BPy_PointerProperty, METH_VARARGS|METH_KEYWORDS|METH_CLASS, BPy_PointerProperty_doc},
+ {"CollectionProperty", (PyCFunction)BPy_CollectionProperty, METH_VARARGS|METH_KEYWORDS|METH_CLASS, BPy_CollectionProperty_doc},
+
+ {"RemoveProperty", (PyCFunction)BPy_RemoveProperty, METH_VARARGS|METH_KEYWORDS|METH_CLASS, BPy_RemoveProperty_doc},
+
{NULL, NULL, 0, NULL}
};
@@ -3143,11 +3288,13 @@ static struct PyMethodDef pyrna_prop_collection_methods[] = {
{"values", (PyCFunction)pyrna_prop_values, METH_NOARGS, NULL},
{"get", (PyCFunction)pyrna_prop_get, METH_VARARGS, NULL},
+ {NULL, NULL, 0, NULL}
+};
- /* moved into a getset */
- {"add", (PyCFunction)pyrna_prop_add, METH_NOARGS, NULL},
- {"remove", (PyCFunction)pyrna_prop_remove, METH_O, NULL},
- {"move", (PyCFunction)pyrna_prop_move, METH_VARARGS, NULL},
+static struct PyMethodDef pyrna_prop_collection_idprop_methods[] = {
+ {"add", (PyCFunction)pyrna_prop_collection_idprop_add, METH_NOARGS, NULL},
+ {"remove", (PyCFunction)pyrna_prop_collection_idprop_remove, METH_O, NULL},
+ {"move", (PyCFunction)pyrna_prop_collection_idprop_move, METH_VARARGS, NULL},
{NULL, NULL, 0, NULL}
};
@@ -3209,9 +3356,9 @@ PyObject *pyrna_param_to_py(PointerRNA *ptr, ParameterList *parms, PropertyRNA *
int len;
if (flag & PROP_DYNAMIC) {
- len= RNA_parameter_length_get_data(parms, prop, data);
-
- data= *((void **)data);
+ ParameterDynAlloc *data_alloc= data;
+ len= data_alloc->array_tot;
+ data= data_alloc->array;
}
else
len= RNA_property_array_length(ptr, prop);
@@ -3273,10 +3420,30 @@ PyObject *pyrna_param_to_py(PointerRNA *ptr, ParameterList *parms, PropertyRNA *
break;
case PROP_STRING:
{
+ char *data_ch;
+ PyObject *value_coerce= NULL;
+ int subtype= RNA_property_subtype(prop);
+
if(flag & PROP_THICK_WRAP)
- ret = PyUnicode_FromString( (char*)data );
+ data_ch= (char *)data;
else
- ret = PyUnicode_FromString( *(char**)data );
+ data_ch= *(char **)data;
+
+#ifdef USE_STRING_COERCE
+ if(ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) {
+ ret= PyC_UnicodeFromByte(data_ch);
+ }
+ else {
+ ret= PyUnicode_FromString(data_ch);
+ }
+#else
+ ret = PyUnicode_FromString(data_ch);
+#endif
+
+#ifdef USE_STRING_COERCE
+ Py_XDECREF(value_coerce);
+#endif
+
break;
}
case PROP_ENUM:
@@ -3713,7 +3880,7 @@ PyTypeObject pyrna_prop_Type = {
/*** Attribute descriptor and subclassing stuff ***/
pyrna_prop_methods, /* struct PyMethodDef *tp_methods; */
NULL, /* struct PyMemberDef *tp_members; */
- NULL /*pyrna_prop_getseters*/, /* struct PyGetSetDef *tp_getset; */
+ pyrna_prop_getseters, /* struct PyGetSetDef *tp_getset; */
NULL, /* struct _typeobject *tp_base; */
NULL, /* PyObject *tp_dict; */
NULL, /* descrgetfunc tp_descr_get; */
@@ -3738,7 +3905,7 @@ PyTypeObject pyrna_prop_Type = {
PyTypeObject pyrna_prop_array_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"bpy_prop_array", /* tp_name */
- sizeof( BPy_PropertyRNA ), /* tp_basicsize */
+ sizeof( BPy_PropertyArrayRNA ), /* tp_basicsize */
0, /* tp_itemsize */
/* methods */
NULL, /* tp_dealloc */
@@ -3750,7 +3917,7 @@ PyTypeObject pyrna_prop_array_Type = {
/* Method suites for standard classes */
- NULL, /* PyNumberMethods *tp_as_number; */
+ &pyrna_prop_array_as_number, /* PyNumberMethods *tp_as_number; */
&pyrna_prop_array_as_sequence, /* PySequenceMethods *tp_as_sequence; */
&pyrna_prop_array_as_mapping, /* PyMappingMethods *tp_as_mapping; */
@@ -3830,7 +3997,7 @@ PyTypeObject pyrna_prop_collection_Type = {
/* Method suites for standard classes */
- NULL, /* PyNumberMethods *tp_as_number; */
+ &pyrna_prop_collection_as_number, /* PyNumberMethods *tp_as_number; */
&pyrna_prop_collection_as_sequence, /* PySequenceMethods *tp_as_sequence; */
&pyrna_prop_collection_as_mapping, /* PyMappingMethods *tp_as_mapping; */
@@ -3895,33 +4062,97 @@ PyTypeObject pyrna_prop_collection_Type = {
NULL
};
-static struct PyMethodDef pyrna_struct_subtype_methods[] = {
- {"BoolProperty", (PyCFunction)BPy_BoolProperty, METH_VARARGS|METH_KEYWORDS, BPy_BoolProperty_doc},
- {"BoolVectorProperty", (PyCFunction)BPy_BoolVectorProperty, METH_VARARGS|METH_KEYWORDS, BPy_BoolVectorProperty_doc},
- {"IntProperty", (PyCFunction)BPy_IntProperty, METH_VARARGS|METH_KEYWORDS, BPy_IntProperty_doc},
- {"IntVectorProperty", (PyCFunction)BPy_IntVectorProperty, METH_VARARGS|METH_KEYWORDS, BPy_IntVectorProperty_doc},
- {"FloatProperty", (PyCFunction)BPy_FloatProperty, METH_VARARGS|METH_KEYWORDS, BPy_FloatProperty_doc},
- {"FloatVectorProperty", (PyCFunction)BPy_FloatVectorProperty, METH_VARARGS|METH_KEYWORDS, BPy_FloatVectorProperty_doc},
- {"StringProperty", (PyCFunction)BPy_StringProperty, METH_VARARGS|METH_KEYWORDS, BPy_StringProperty_doc},
- {"EnumProperty", (PyCFunction)BPy_EnumProperty, METH_VARARGS|METH_KEYWORDS, BPy_EnumProperty_doc},
- {"PointerProperty", (PyCFunction)BPy_PointerProperty, METH_VARARGS|METH_KEYWORDS, BPy_PointerProperty_doc},
- {"CollectionProperty", (PyCFunction)BPy_CollectionProperty, METH_VARARGS|METH_KEYWORDS, BPy_CollectionProperty_doc},
+/* only for add/remove/move methods */
+PyTypeObject pyrna_prop_collection_idprop_Type = {
+ PyVarObject_HEAD_INIT(NULL, 0)
+ "bpy_prop_collection_idprop", /* tp_name */
+ sizeof( BPy_PropertyRNA ), /* tp_basicsize */
+ 0, /* tp_itemsize */
+ /* methods */
+ NULL, /* tp_dealloc */
+ NULL, /* printfunc tp_print; */
+ NULL, /* getattrfunc tp_getattr; */
+ NULL, /* setattrfunc tp_setattr; */
+ NULL, /* tp_compare */ /* DEPRECATED in python 3.0! */
+ NULL, /* subclassed */ /* tp_repr */
- {"RemoveProperty", (PyCFunction)BPy_RemoveProperty, METH_VARARGS|METH_KEYWORDS, BPy_RemoveProperty_doc},
+ /* Method suites for standard classes */
-// {"__get_rna", (PyCFunction)BPy_GetStructRNA, METH_NOARGS, ""},
- {NULL, NULL, 0, NULL}
+ NULL, /* PyNumberMethods *tp_as_number; */
+ NULL, /* PySequenceMethods *tp_as_sequence; */
+ NULL, /* PyMappingMethods *tp_as_mapping; */
+
+ /* More standard operations (here for binary compatibility) */
+
+ NULL, /* hashfunc tp_hash; */
+ NULL, /* ternaryfunc tp_call; */
+ NULL, /* reprfunc tp_str; */
+
+ /* will only use these if this is a subtype of a py class */
+ NULL, /* getattrofunc tp_getattro; */
+ NULL, /* setattrofunc tp_setattro; */
+
+ /* Functions to access object as input/output buffer */
+ NULL, /* PyBufferProcs *tp_as_buffer; */
+
+ /*** Flags to define presence of optional/expanded features ***/
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* long tp_flags; */
+
+ NULL, /* char *tp_doc; Documentation string */
+ /*** Assigned meaning in release 2.0 ***/
+ /* call function for all accessible objects */
+ NULL, /* traverseproc tp_traverse; */
+
+ /* delete references to contained objects */
+ NULL, /* inquiry tp_clear; */
+
+ /*** Assigned meaning in release 2.1 ***/
+ /*** rich comparisons ***/
+ NULL, /* subclassed */ /* richcmpfunc tp_richcompare; */
+
+ /*** weak reference enabler ***/
+ 0, /* long tp_weaklistoffset; */
+
+ /*** Added in release 2.2 ***/
+ /* Iterators */
+ NULL, /* getiterfunc tp_iter; */
+ NULL, /* iternextfunc tp_iternext; */
+
+ /*** Attribute descriptor and subclassing stuff ***/
+ pyrna_prop_collection_idprop_methods, /* struct PyMethodDef *tp_methods; */
+ NULL, /* struct PyMemberDef *tp_members; */
+ NULL /*pyrna_prop_getseters*/, /* struct PyGetSetDef *tp_getset; */
+ &pyrna_prop_collection_Type, /* struct _typeobject *tp_base; */
+ NULL, /* PyObject *tp_dict; */
+ NULL, /* descrgetfunc tp_descr_get; */
+ NULL, /* descrsetfunc tp_descr_set; */
+ 0, /* long tp_dictoffset; */
+ NULL, /* initproc tp_init; */
+ NULL, /* allocfunc tp_alloc; */
+ NULL, /* newfunc tp_new; */
+ /* Low-level free-memory routine */
+ NULL, /* freefunc tp_free; */
+ /* For PyObject_IS_GC */
+ NULL, /* inquiry tp_is_gc; */
+ NULL, /* PyObject *tp_bases; */
+ /* method resolution order */
+ NULL, /* PyObject *tp_mro; */
+ NULL, /* PyObject *tp_cache; */
+ NULL, /* PyObject *tp_subclasses; */
+ NULL, /* PyObject *tp_weaklist; */
+ NULL
};
static void pyrna_subtype_set_rna(PyObject *newclass, StructRNA *srna)
{
PointerRNA ptr;
PyObject *item;
+ PyObject *newclass_dict= ((PyTypeObject *)newclass)->tp_dict;
Py_INCREF(newclass);
if (RNA_struct_py_type_get(srna))
- PyObSpit("RNA WAS SET - ", RNA_struct_py_type_get(srna));
+ PyC_ObSpit("RNA WAS SET - ", RNA_struct_py_type_get(srna));
Py_XDECREF(((PyObject *)RNA_struct_py_type_get(srna)));
@@ -3935,21 +4166,10 @@ static void pyrna_subtype_set_rna(PyObject *newclass, StructRNA *srna)
item = pyrna_struct_CreatePyObject(&ptr);
//item = PyCapsule_New(srna, NULL, NULL);
- PyDict_SetItemString(((PyTypeObject *)newclass)->tp_dict, "bl_rna", item);
+ PyDict_SetItemString(newclass_dict, "bl_rna", item);
Py_DECREF(item);
/* done with rna instance */
-
- /* attach functions into the class
- * so you can do... bpy.types.Scene.SomeFunction()
- */
- {
- PyMethodDef *ml;
-
- for(ml= pyrna_struct_subtype_methods; ml->ml_name; ml++){
- PyObject_SetAttrString(newclass, ml->ml_name, PyCFunction_New(ml, newclass));
}
- }
-}
static PyObject* pyrna_srna_Subtype(StructRNA *srna);
@@ -4018,7 +4238,7 @@ static PyObject* pyrna_srna_ExternalType(StructRNA *srna)
if(base_compare != base) {
fprintf(stderr, "pyrna_srna_ExternalType: incorrect subclassing of SRNA '%s'\nSee bpy_types.py\n", idname);
- PyObSpit("Expected! ", base_compare);
+ PyC_ObSpit("Expected! ", base_compare);
newclass= NULL;
}
else {
@@ -4035,14 +4255,19 @@ static PyObject* pyrna_srna_Subtype(StructRNA *srna)
{
PyObject *newclass = NULL;
+ /* stupid/simple case */
if (srna == NULL) {
newclass= NULL; /* Nothing to do */
- } else if ((newclass= RNA_struct_py_type_get(srna))) {
+ } /* the class may have alredy been declared & allocated */
+ else if ((newclass= RNA_struct_py_type_get(srna))) {
Py_INCREF(newclass);
- } else if ((newclass= pyrna_srna_ExternalType(srna))) {
+ } /* check if bpy_types.py module has the class defined in it */
+ else if ((newclass= pyrna_srna_ExternalType(srna))) {
pyrna_subtype_set_rna(newclass, srna);
Py_INCREF(newclass);
- } else {
+ } /* create a new class instance with the C api
+ * maintly for the purposing of matching the C/rna type hierarchy */
+ else {
/* subclass equivelents
- class myClass(myBase):
some='value' # or ...
@@ -4053,21 +4278,24 @@ static PyObject* pyrna_srna_Subtype(StructRNA *srna)
PyObject *py_base= pyrna_srna_PyBase(srna);
const char *idname= RNA_struct_identifier(srna);
- const char *descr= RNA_struct_ui_description(srna);
- if(!descr) descr= "(no docs)";
+ /* remove __doc__ for now */
+ // const char *descr= RNA_struct_ui_description(srna);
+ // if(!descr) descr= "(no docs)";
+ // "__doc__",descr
/* always use O not N when calling, N causes refcount errors */
- newclass = PyObject_CallFunction( (PyObject*)&PyType_Type, "s(O){sssss()}", idname, py_base, "__module__","bpy.types", "__doc__",descr, "__slots__");
+ newclass = PyObject_CallFunction((PyObject*)&PyType_Type, "s(O){sss()}", idname, py_base, "__module__","bpy.types", "__slots__");
/* newclass will now have 2 ref's, ???, probably 1 is internal since decrefing here segfaults */
- /* PyObSpit("new class ref", newclass); */
+ /* PyC_ObSpit("new class ref", newclass); */
if (newclass) {
/* srna owns one, and the other is owned by the caller */
pyrna_subtype_set_rna(newclass, srna);
- Py_DECREF(newclass); /* let srna own */
+ // XXX, adding this back segfaults blender on load.
+ // Py_DECREF(newclass); /* let srna own */
}
else {
/* this should not happen */
@@ -4126,7 +4354,7 @@ PyObject *pyrna_struct_CreatePyObject( PointerRNA *ptr )
pyrna->ptr= *ptr;
pyrna->freeptr= FALSE;
- // PyObSpit("NewStructRNA: ", (PyObject *)pyrna);
+ // PyC_ObSpit("NewStructRNA: ", (PyObject *)pyrna);
return ( PyObject * ) pyrna;
}
@@ -4134,12 +4362,29 @@ PyObject *pyrna_struct_CreatePyObject( PointerRNA *ptr )
PyObject *pyrna_prop_CreatePyObject( PointerRNA *ptr, PropertyRNA *prop )
{
BPy_PropertyRNA *pyrna;
+
+ if (RNA_property_array_check(ptr, prop) == 0) {
PyTypeObject *type;
- if (RNA_property_type(prop) == PROP_COLLECTION) type= &pyrna_prop_collection_Type;
- else if (RNA_property_array_check(ptr, prop)) type= &pyrna_prop_array_Type;
- else type= &pyrna_prop_Type;
+
+ if (RNA_property_type(prop) != PROP_COLLECTION) {
+ type= &pyrna_prop_Type;
+ }
+ else {
+ if((RNA_property_flag(prop) & PROP_IDPROPERTY) == 0) {
+ type= &pyrna_prop_collection_Type;
+ }
+ else {
+ type= &pyrna_prop_collection_idprop_Type;
+ }
+ }
pyrna = ( BPy_PropertyRNA * ) PyObject_NEW(BPy_PropertyRNA, type);
+ }
+ else {
+ pyrna = (BPy_PropertyRNA *) PyObject_NEW(BPy_PropertyArrayRNA, &pyrna_prop_array_Type);
+ ((BPy_PropertyArrayRNA *)pyrna)->arraydim= 0;
+ ((BPy_PropertyArrayRNA *)pyrna)->arrayoffset= 0;
+ }
if( !pyrna ) {
PyErr_SetString( PyExc_MemoryError, "couldn't create BPy_rna object" );
@@ -4149,9 +4394,6 @@ PyObject *pyrna_prop_CreatePyObject( PointerRNA *ptr, PropertyRNA *prop )
pyrna->ptr = *ptr;
pyrna->prop = prop;
- pyrna->arraydim= 0;
- pyrna->arrayoffset= 0;
-
return ( PyObject * ) pyrna;
}
@@ -4173,6 +4415,9 @@ void BPY_rna_init(void)
if( PyType_Ready( &pyrna_prop_collection_Type ) < 0 )
return;
+
+ if( PyType_Ready( &pyrna_prop_collection_idprop_Type ) < 0 )
+ return;
}
/* bpy.data from python */
@@ -4286,7 +4531,6 @@ PyObject *BPY_rna_types(void)
}
self= (BPy_BaseTypeRNA *)PyObject_NEW( BPy_BaseTypeRNA, &pyrna_basetype_Type );
- self->arraydim = self->arrayoffset = 0; /* unused but better set */
/* avoid doing this lookup for every getattr */
RNA_blender_rna_pointer_create(&self->ptr);
@@ -4391,7 +4635,7 @@ static int deferred_register_prop(StructRNA *srna, PyObject *item, PyObject *key
PyErr_Print();
PyErr_Clear();
- // PyLineSpit();
+ // PyC_LineSpit();
PyErr_Format(PyExc_ValueError, "bpy_struct \"%.200s\" registration error: %.200s could not register\n", RNA_struct_identifier(srna), _PyUnicode_AsString(key));
return -1;
}
@@ -4400,7 +4644,7 @@ static int deferred_register_prop(StructRNA *srna, PyObject *item, PyObject *key
/* Since this is a class dict, ignore args that can't be passed */
/* for testing only */
- /* PyObSpit("Why doesn't this work??", item);
+ /* PyC_ObSpit("Why doesn't this work??", item);
PyErr_Print(); */
PyErr_Clear();
}
@@ -4845,7 +5089,7 @@ static void bpy_class_free(void *pyob_ptr)
if(G.f&G_DEBUG) {
if(self->ob_refcnt > 1) {
- PyObSpit("zombie class - ref should be 1", self);
+ PyC_ObSpit("zombie class - ref should be 1", self);
}
}
@@ -5025,7 +5269,7 @@ static PyObject *pyrna_basetype_unregister(PyObject *self, PyObject *py_class)
/*if(PyDict_GetItemString(((PyTypeObject*)py_class)->tp_dict, "bl_rna")==NULL) {
PWM_cursor_wait(0);
-yErr_SetString(PyExc_ValueError, "bpy.types.unregister(): not a registered as a subclass.");
+ PyErr_SetString(PyExc_ValueError, "bpy.types.unregister(): not a registered as a subclass.");
return NULL;
}*/
diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h
index 63f6997d82c..14c6ff4a1a3 100644
--- a/source/blender/python/intern/bpy_rna.h
+++ b/source/blender/python/intern/bpy_rna.h
@@ -55,11 +55,17 @@ typedef struct {
PyObject_HEAD /* required python macro */
PointerRNA ptr;
PropertyRNA *prop;
+} BPy_PropertyRNA;
+
+typedef struct {
+ PyObject_HEAD /* required python macro */
+ PointerRNA ptr;
+ PropertyRNA *prop;
/* Arystan: this is a hack to allow sub-item r/w access like: face.uv[n][m] */
int arraydim; /* array dimension, e.g: 0 for face.uv, 2 for face.uv[n][m], etc. */
int arrayoffset; /* array first item offset, e.g. if face.uv is [4][2], arrayoffset for face.uv[n] is 2n */
-} BPy_PropertyRNA;
+} BPy_PropertyArrayRNA;
/* cheap trick */
#define BPy_BaseTypeRNA BPy_PropertyRNA
@@ -77,7 +83,6 @@ PyObject *pyrna_struct_CreatePyObject( PointerRNA *ptr );
PyObject *pyrna_prop_CreatePyObject( PointerRNA *ptr, PropertyRNA *prop );
/* operators also need this to set args */
-int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms, void *data, PyObject *value, const char *error_prefix);
int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, int all_args, const char *error_prefix);
PyObject * pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop);
@@ -97,7 +102,7 @@ int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, ParameterList *parms,
int pyrna_py_to_array_index(PointerRNA *ptr, PropertyRNA *prop, int arraydim, int arrayoffset, int index, PyObject *py, const char *error_prefix);
PyObject *pyrna_py_from_array(PointerRNA *ptr, PropertyRNA *prop);
-PyObject *pyrna_py_from_array_index(BPy_PropertyRNA *self, PointerRNA *ptr, PropertyRNA *prop, int index);
+PyObject *pyrna_py_from_array_index(BPy_PropertyArrayRNA *self, PointerRNA *ptr, PropertyRNA *prop, int index);
PyObject *pyrna_math_object_from_array(PointerRNA *ptr, PropertyRNA *prop);
int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value);
diff --git a/source/blender/python/intern/bpy_util.c b/source/blender/python/intern/bpy_util.c
index 1d14ab67510..1a2d7b297b6 100644
--- a/source/blender/python/intern/bpy_util.c
+++ b/source/blender/python/intern/bpy_util.c
@@ -26,136 +26,14 @@
#include "BLI_dynstr.h"
#include "MEM_guardedalloc.h"
#include "BKE_report.h"
+#include "BKE_context.h"
+#include "../generic/py_capi_utils.h"
-#include "BKE_context.h"
bContext* __py_context = NULL;
bContext* BPy_GetContext(void) { return __py_context; };
void BPy_SetContext(bContext *C) { __py_context= C; };
-/* for debugging */
-void PyObSpit(char *name, PyObject *var) {
- fprintf(stderr, "<%s> : ", name);
- if (var==NULL) {
- fprintf(stderr, "<NIL>");
- }
- else {
- PyObject_Print(var, stderr, 0);
- fprintf(stderr, " ref:%d ", (int)var->ob_refcnt);
- fprintf(stderr, " ptr:%p", (void *)var);
-
- fprintf(stderr, " type:");
- if(Py_TYPE(var))
- fprintf(stderr, "%s", Py_TYPE(var)->tp_name);
- else
- fprintf(stderr, "<NIL>");
- }
- fprintf(stderr, "\n");
-}
-
-void PyLineSpit(void) {
- const char *filename;
- int lineno;
-
- PyErr_Clear();
- BPY_getFileAndNum(&filename, &lineno);
-
- fprintf(stderr, "%s:%d\n", filename, lineno);
-}
-
-void BPY_getFileAndNum(const char **filename, int *lineno)
-{
- PyObject *getframe, *frame;
- PyObject *f_lineno= NULL, *co_filename= NULL;
-
- if (filename) *filename= NULL;
- if (lineno) *lineno = -1;
-
- getframe = PySys_GetObject("_getframe"); // borrowed
- if (getframe==NULL) {
- PyErr_Clear();
- return;
- }
-
- frame = PyObject_CallObject(getframe, NULL);
- if (frame==NULL) {
- PyErr_Clear();
- return;
- }
-
- /* when executing a script */
- if (filename) {
- co_filename= PyObject_GetAttrStringArgs(frame, 1, "f_code", "co_filename");
- if (co_filename==NULL) {
- PyErr_SetString(PyExc_SystemError, "Could not access sys._getframe().f_code.co_filename");
- Py_DECREF(frame);
- return;
- }
-
- *filename = _PyUnicode_AsString(co_filename);
- Py_DECREF(co_filename);
- }
-
- /* when executing a module */
- if(filename && *filename == NULL) {
- /* try an alternative method to get the filename - module based
- * references below are all borrowed (double checked) */
- PyObject *mod_name= PyDict_GetItemString(PyEval_GetGlobals(), "__name__");
- if(mod_name) {
- PyObject *mod= PyDict_GetItem(PyImport_GetModuleDict(), mod_name);
- if(mod) {
- *filename= PyModule_GetFilename(mod);
- }
-
- /* unlikely, fallback */
- if(*filename == NULL) {
- *filename= _PyUnicode_AsString(mod_name);
- }
- }
- }
-
-
- if (lineno) {
- f_lineno= PyObject_GetAttrString(frame, "f_lineno");
- if (f_lineno==NULL) {
- PyErr_SetString(PyExc_SystemError, "Could not access sys._getframe().f_lineno");
- Py_DECREF(frame);
- return;
- }
-
- *lineno = (int)PyLong_AsSsize_t(f_lineno);
- Py_DECREF(f_lineno);
- }
-
- Py_DECREF(frame);
-}
-
-/* Would be nice if python had this built in */
-PyObject *PyObject_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...)
-{
- Py_ssize_t i;
- PyObject *item= o;
- char *attr;
-
- va_list vargs;
-
- va_start(vargs, n);
- for (i=0; i<n; i++) {
- attr = va_arg(vargs, char *);
- item = PyObject_GetAttrString(item, attr);
-
- if (item)
- Py_DECREF(item);
- else /* python will set the error value here */
- break;
-
- }
- va_end(vargs);
-
- Py_XINCREF(item); /* final value has is increfed, to match PyObject_GetAttrString */
- return item;
-}
-
int BPY_class_validate(const char *class_type, PyObject *class, PyObject *base_class, BPY_class_attr_check* class_attrs, PyObject **py_class_attrs)
{
PyObject *item, *fitem;
@@ -244,75 +122,6 @@ int BPY_class_validate(const char *class_type, PyObject *class, PyObject *base_c
-/* returns the exception string as a new PyUnicode object, depends on external StringIO module */
-PyObject *BPY_exception_buffer(void)
-{
- PyObject *stdout_backup = PySys_GetObject("stdout"); /* borrowed */
- PyObject *stderr_backup = PySys_GetObject("stderr"); /* borrowed */
- PyObject *string_io = NULL;
- PyObject *string_io_buf = NULL;
- PyObject *string_io_mod= NULL;
- PyObject *string_io_getvalue= NULL;
-
- PyObject *error_type, *error_value, *error_traceback;
-
- if (!PyErr_Occurred())
- return NULL;
-
- PyErr_Fetch(&error_type, &error_value, &error_traceback);
-
- PyErr_Clear();
-
- /* import io
- * string_io = io.StringIO()
- */
-
- if(! (string_io_mod= PyImport_ImportModule("io")) ) {
- goto error_cleanup;
- } else if (! (string_io = PyObject_CallMethod(string_io_mod, "StringIO", NULL))) {
- goto error_cleanup;
- } else if (! (string_io_getvalue= PyObject_GetAttrString(string_io, "getvalue"))) {
- goto error_cleanup;
- }
-
- Py_INCREF(stdout_backup); // since these were borrowed we dont want them freed when replaced.
- Py_INCREF(stderr_backup);
-
- PySys_SetObject("stdout", string_io); // both of these are free'd when restoring
- PySys_SetObject("stderr", string_io);
-
- PyErr_Restore(error_type, error_value, error_traceback);
- PyErr_Print(); /* print the error */
- PyErr_Clear();
-
- string_io_buf = PyObject_CallObject(string_io_getvalue, NULL);
-
- PySys_SetObject("stdout", stdout_backup);
- PySys_SetObject("stderr", stderr_backup);
-
- Py_DECREF(stdout_backup); /* now sys owns the ref again */
- Py_DECREF(stderr_backup);
-
- Py_DECREF(string_io_mod);
- Py_DECREF(string_io_getvalue);
- Py_DECREF(string_io); /* free the original reference */
-
- PyErr_Clear();
- return string_io_buf;
-
-
-error_cleanup:
- /* could not import the module so print the error and close */
- Py_XDECREF(string_io_mod);
- Py_XDECREF(string_io);
-
- PyErr_Restore(error_type, error_value, error_traceback);
- PyErr_Print(); /* print the error */
- PyErr_Clear();
-
- return NULL;
-}
-
char *BPy_enum_as_string(EnumPropertyItem *item)
{
DynStr *dynstr= BLI_dynstr_new();
@@ -363,14 +172,14 @@ int BPy_errors_to_report(ReportList *reports)
return 1;
}
- pystring= BPY_exception_buffer();
+ pystring= PyC_ExceptionBuffer();
if(pystring==NULL) {
BKE_report(reports, RPT_ERROR, "unknown py-exception, could not convert");
return 0;
}
- BPY_getFileAndNum(&filename, &lineno);
+ PyC_FileAndNum(&filename, &lineno);
if(filename==NULL)
filename= "<unknown location>";
@@ -392,7 +201,7 @@ int BPy_errors_to_report(ReportList *reports)
}
/* array utility function */
-int BPyAsPrimitiveArray(void *array, PyObject *value, int length, PyTypeObject *type, char *error_prefix)
+int PyC_AsArray(void *array, PyObject *value, int length, PyTypeObject *type, char *error_prefix)
{
PyObject *value_fast;
int value_len;
diff --git a/source/blender/python/intern/bpy_util.h b/source/blender/python/intern/bpy_util.h
index cfe820b53b0..ae215725087 100644
--- a/source/blender/python/intern/bpy_util.h
+++ b/source/blender/python/intern/bpy_util.h
@@ -36,17 +36,6 @@
struct EnumPropertyItem;
struct ReportList;
-void PyObSpit(char *name, PyObject *var);
-void PyLineSpit(void);
-void BPY_getFileAndNum(const char **filename, int *lineno);
-
-PyObject *BPY_exception_buffer(void);
-
-/* own python like utility function */
-PyObject *PyObject_GetAttrStringArgs(PyObject *o, Py_ssize_t n, ...);
-
-
-
/* Class type checking, use for checking classes can be added as operators, panels etc */
typedef struct BPY_class_attr_check {
const char *name; /* name of the class attribute */
@@ -77,6 +66,4 @@ void BPy_SetContext(struct bContext *C);
extern void bpy_context_set(struct bContext *C, PyGILState_STATE *gilstate);
extern void bpy_context_clear(struct bContext *C, PyGILState_STATE *gilstate);
-
-int BPyAsPrimitiveArray(void *array, PyObject *value, int length, PyTypeObject *type, char *error_prefix);
#endif
diff --git a/source/blender/quicktime/quicktime_import.h b/source/blender/quicktime/quicktime_import.h
index 1fccc776620..150aa07b1c2 100644
--- a/source/blender/quicktime/quicktime_import.h
+++ b/source/blender/quicktime/quicktime_import.h
@@ -72,4 +72,4 @@ ImBuf *qtime_fetchibuf (struct anim *anim, int position);
int imb_is_a_quicktime (char *name);
ImBuf *imb_quicktime_decode(unsigned char *mem, int size, int flags);
-#endif // __QUICKTIME_IMP_H__ \ No newline at end of file
+#endif // __QUICKTIME_IMP_H__
diff --git a/source/blender/render/CMakeLists.txt b/source/blender/render/CMakeLists.txt
index caa0e0a9a41..169e9b7fa87 100644
--- a/source/blender/render/CMakeLists.txt
+++ b/source/blender/render/CMakeLists.txt
@@ -54,4 +54,4 @@ IF(APPLE)
ENDIF(CMAKE_OSX_ARCHITECTURES MATCHES "i386" OR CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
ENDIF(APPLE)
-BLENDERLIB_NOLIST(blender_render "${SRC}" "${INC}")
+BLENDERLIB_NOLIST(bf_render "${SRC}" "${INC}")
diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c
index f08529b3f2c..f78031c9030 100644
--- a/source/blender/render/intern/source/imagetexture.c
+++ b/source/blender/render/intern/source/imagetexture.c
@@ -1784,4 +1784,4 @@ void ibuf_sample(ImBuf *ibuf, float fx, float fy, float dx, float dy, float *res
result[1]= texres.tg;
result[2]= texres.tb;
result[3]= texres.ta;
-} \ No newline at end of file
+}
diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c
index 502bd09c2de..78cad1bd48e 100644
--- a/source/blender/render/intern/source/pipeline.c
+++ b/source/blender/render/intern/source/pipeline.c
@@ -2474,19 +2474,20 @@ static void do_render_seq(Render * re)
if (!rr->rectf)
rr->rectf= MEM_mallocN(4*sizeof(float)*rr->rectx*rr->recty, "render_seq rectf");
+ /* color management: when off ensure rectf is non-lin, since thats what the internal
+ * render engine delivers */
+ if(re->r.color_mgt_flag & R_COLOR_MANAGEMENT) {
+ if(ibuf->profile == IB_PROFILE_LINEAR_RGB)
memcpy(rr->rectf, ibuf->rect_float, 4*sizeof(float)*rr->rectx*rr->recty);
+ else
+ srgb_to_linearrgb_rgba_rgba_buf(rr->rectf, ibuf->rect_float, rr->rectx*rr->recty);
- /* sequencer float buffer is not in linear color space, convert
- * should always be true, use a fake ibuf for the colorspace conversion */
- if(ibuf->profile != IB_PROFILE_LINEAR_RGB) {
- ImBuf ibuf_dummy;
- memset(&ibuf_dummy, 0, sizeof(ImBuf));
- ibuf_dummy.profile= ibuf->profile;
- ibuf_dummy.x= rr->rectx;
- ibuf_dummy.y= rr->recty;
- ibuf_dummy.rect_float= rr->rectf;
- /* only touch the rr->rectf */
- IMB_convert_profile(&ibuf_dummy, IB_PROFILE_LINEAR_RGB);
+ }
+ else {
+ if(ibuf->profile != IB_PROFILE_LINEAR_RGB)
+ memcpy(rr->rectf, ibuf->rect_float, 4*sizeof(float)*rr->rectx*rr->recty);
+ else
+ linearrgb_to_srgb_rgba_rgba_buf(rr->rectf, ibuf->rect_float, rr->rectx*rr->recty);
}
/* TSK! Since sequence render doesn't free the *rr render result, the old rect32
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 9fe09c0836c..9668b2e17c9 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -97,8 +97,8 @@ void WM_paint_cursor_end(struct wmWindowManager *wm, void *handle);
void WM_cursor_warp (struct wmWindow *win, int x, int y);
/* keyconfig and keymap */
-wmKeyConfig *WM_keyconfig_add (struct wmWindowManager *wm, char *idname);
-wmKeyConfig *WM_keyconfig_add_user(struct wmWindowManager *wm, char *idname);
+wmKeyConfig *WM_keyconfig_new (struct wmWindowManager *wm, char *idname);
+wmKeyConfig *WM_keyconfig_new_user(struct wmWindowManager *wm, char *idname);
void WM_keyconfig_remove (struct wmWindowManager *wm, struct wmKeyConfig *keyconf);
void WM_keyconfig_free (struct wmKeyConfig *keyconf);
void WM_keyconfig_userdef(struct wmWindowManager *wm);
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index c84a5e64889..807125765f7 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -184,6 +184,7 @@ typedef struct wmNotifier {
#define ND_TOOLSETTINGS (13<<16)
#define ND_LAYER (14<<16)
#define ND_FRAME_RANGE (15<<16)
+#define ND_LAYER_CONTENT (101<<16)
/* NC_OBJECT Object */
#define ND_TRANSFORM (16<<16)
diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c
index 8d36711032b..5f386170c54 100644
--- a/source/blender/windowmanager/intern/wm.c
+++ b/source/blender/windowmanager/intern/wm.c
@@ -29,6 +29,8 @@
#include <string.h>
#include <stddef.h>
+#include "BLO_sys_types.h"
+
#include "DNA_windowmanager_types.h"
#include "GHOST_C-api.h"
@@ -195,7 +197,7 @@ void WM_keymap_init(bContext *C)
wmWindowManager *wm= CTX_wm_manager(C);
if(!wm->defaultconf)
- wm->defaultconf= WM_keyconfig_add(wm, "Blender");
+ wm->defaultconf= WM_keyconfig_new(wm, "Blender");
if(wm && CTX_py_init_get(C) && (wm->initialized & WM_INIT_KEYMAP) == 0) {
/* create default key config */
diff --git a/source/blender/windowmanager/intern/wm_cursors.c b/source/blender/windowmanager/intern/wm_cursors.c
index b16e82726b4..1803a1cee91 100644
--- a/source/blender/windowmanager/intern/wm_cursors.c
+++ b/source/blender/windowmanager/intern/wm_cursors.c
@@ -32,6 +32,8 @@
#include "GHOST_C-api.h"
+#include "BLO_sys_types.h"
+
#include "DNA_listBase.h"
#include "DNA_userdef_types.h"
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index aa26d4444b1..81417e8f8f1 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -710,6 +710,8 @@ static int wm_automatic_draw_method(wmWindow *win)
/* Windows software driver darkens color on each redraw */
else if(GPU_type_matches(GPU_DEVICE_SOFTWARE, GPU_OS_WIN, GPU_DRIVER_SOFTWARE))
return USER_DRAW_OVERLAP_FLIP;
+ else if(GPU_type_matches(GPU_DEVICE_SOFTWARE, GPU_OS_UNIX, GPU_DRIVER_SOFTWARE))
+ return USER_DRAW_OVERLAP;
/* drawing lower color depth again degrades colors each time */
else if(GPU_color_depth() < 24)
return USER_DRAW_OVERLAP;
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index e1fc934ee3e..3d5ae66236d 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -1800,10 +1800,18 @@ void WM_event_fileselect_event(bContext *C, void *ophandle, int eventval)
void WM_event_add_fileselect(bContext *C, wmOperator *op)
{
- wmEventHandler *handler= MEM_callocN(sizeof(wmEventHandler), "fileselect handler");
+ wmEventHandler *handler;
wmWindow *win= CTX_wm_window(C);
int full= 1; // XXX preset?
+ /* only allow file selector open per window bug [#23553] */
+ for(handler= win->modalhandlers.first; handler; handler=handler->next) {
+ if(handler->type == WM_HANDLER_FILESELECT)
+ return;
+ }
+
+ handler = MEM_callocN(sizeof(wmEventHandler), "fileselect handler");
+
handler->type= WM_HANDLER_FILESELECT;
handler->op= op;
handler->op_area= CTX_wm_area(C);
diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c
index e2293f79e95..5287ce5eb28 100644
--- a/source/blender/windowmanager/intern/wm_files.c
+++ b/source/blender/windowmanager/intern/wm_files.c
@@ -334,6 +334,9 @@ void WM_read_file(bContext *C, char *name, ReportList *reports)
/* called on startup, (context entirely filled with NULLs) */
/* or called for 'New File' */
/* op can be NULL */
+/* note: G.sce is used to store the last saved path so backup and restore after loading
+ * G.main->name is similar to G.sce but when loading from memory set the name to startup.blend
+ * ...this could be changed but seems better then setting to "" */
int WM_read_homefile(bContext *C, wmOperator *op)
{
ListBase wmbase;
@@ -376,6 +379,7 @@ int WM_read_homefile(bContext *C, wmOperator *op)
WM_check(C); /* opens window(s), checks keymaps */
strcpy(G.sce, scestr); /* restore */
+ G.main->name[0]= '\0';
wm_init_userdef(C);
@@ -522,7 +526,7 @@ static ImBuf *blend_file_thumb(const char *path, Scene *scene, int **thumb_pt)
return NULL;
/* gets scaled to BLEN_THUMB_SIZE */
- ibuf= ED_view3d_draw_offscreen_imbuf_simple(scene, BLEN_THUMB_SIZE * 2, BLEN_THUMB_SIZE * 2, OB_SOLID);
+ ibuf= ED_view3d_draw_offscreen_imbuf_simple(scene, BLEN_THUMB_SIZE * 2, BLEN_THUMB_SIZE * 2, IB_rect, OB_SOLID);
if(ibuf) {
float aspect= (scene->r.xsch*scene->r.xasp) / (scene->r.ysch*scene->r.yasp);
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index e79d08dc2f1..f1873b14232 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -74,7 +74,7 @@ void WM_keymap_properties_reset(wmKeyMapItem *kmi)
keymap_properties_set(kmi);
}
-wmKeyConfig *WM_keyconfig_add(wmWindowManager *wm, char *idname)
+wmKeyConfig *WM_keyconfig_new(wmWindowManager *wm, char *idname)
{
wmKeyConfig *keyconf;
@@ -85,9 +85,9 @@ wmKeyConfig *WM_keyconfig_add(wmWindowManager *wm, char *idname)
return keyconf;
}
-wmKeyConfig *WM_keyconfig_add_user(wmWindowManager *wm, char *idname)
+wmKeyConfig *WM_keyconfig_new_user(wmWindowManager *wm, char *idname)
{
- wmKeyConfig *keyconf = WM_keyconfig_add(wm, idname);
+ wmKeyConfig *keyconf = WM_keyconfig_new(wm, idname);
keyconf->flag |= KEYCONF_USER;
diff --git a/source/blenderplayer/CMakeLists.txt b/source/blenderplayer/CMakeLists.txt
index 566bc88e46d..8fcea674ebb 100644
--- a/source/blenderplayer/CMakeLists.txt
+++ b/source/blenderplayer/CMakeLists.txt
@@ -64,8 +64,8 @@ IF(UNIX)
SET(BLENDER_SORTED_LIBS
gp_ghost
gp_common
- bf_string
- bf_ghost
+ bf_intern_string
+ bf_intern_ghost
bf_rna
bf_blenkernel
bf_blenloader
@@ -82,11 +82,11 @@ IF(UNIX)
bf_expressions
bf_scenegraph
bf_ikplugin
- bf_ITASC
- bf_IK
- bf_smoke
+ bf_intern_itasc
+ bf_intern_ik
+ bf_intern_smoke
bf_modifiers
- bf_moto
+ bf_intern_moto
bf_kernel
bf_nodes
bf_gpu
@@ -96,20 +96,20 @@ IF(UNIX)
bf_ngnetwork
bf_loopbacknetwork
extern_bullet
- bf_guardedalloc
- bf_memutil
+ bf_intern_guardedalloc
+ bf_intern_memutil
bf_python
- bf_gen_python
+ bf_python_ext
bf_blenlib
bf_cineon
bf_openexr
- extern_libopenjpeg
+ extern_openjpeg
bf_dds
bf_readblenfile
bf_dna
bf_videotex
bf_blenfont
- bf_audaspace
+ bf_intern_audaspace
blenkernel_blc
extern_binreloc
extern_glew
@@ -120,7 +120,7 @@ IF(UNIX)
ENDIF(WITH_QUICKTIME)
IF(WITH_CXX_GUARDEDALLOC)
- SET(BLENDER_SORTED_LIBS ${BLENDER_SORTED_LIBS} bf_guardedalloc_cpp)
+ SET(BLENDER_SORTED_LIBS ${BLENDER_SORTED_LIBS} bf_intern_guardedalloc_cpp)
ENDIF(WITH_CXX_GUARDEDALLOC)
FOREACH(SORTLIB ${BLENDER_SORTED_LIBS})
diff --git a/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt b/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt
index 9a53997fd66..2449c8050ba 100644
--- a/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt
+++ b/source/blenderplayer/bad_level_call_stubs/CMakeLists.txt
@@ -34,6 +34,7 @@ ENDIF(WITH_BUILDINFO)
SET(INC
.
..
+ ../../../intern/guardedalloc
../../../source/blender/makesdna
../../../source/blender/makesrna
)
diff --git a/source/blenderplayer/bad_level_call_stubs/SConscript b/source/blenderplayer/bad_level_call_stubs/SConscript
index aa84b88932e..a35375f2980 100644
--- a/source/blenderplayer/bad_level_call_stubs/SConscript
+++ b/source/blenderplayer/bad_level_call_stubs/SConscript
@@ -3,7 +3,8 @@ Import ('env')
sources = 'stubs.c'
-incs = '#/source/blender/makesdna'
+incs = '#/intern/guardedalloc'
+incs += ' #/source/blender/makesdna'
incs += ' #/source/blender/makesrna'
defs = ''
diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c
index 1688b6e3d96..7d63d1e07af 100644
--- a/source/blenderplayer/bad_level_call_stubs/stubs.c
+++ b/source/blenderplayer/bad_level_call_stubs/stubs.c
@@ -145,6 +145,9 @@ void WM_operator_stack_clear(struct bContext *C) {}
void WM_autosave_init(struct bContext *C){}
void WM_jobs_stop_all(struct wmWindowManager *wm){}
+char *WM_clipboard_text_get(int selection){return (char*)0;}
+void WM_clipboard_text_set(char *buf, int selection){}
+
struct wmKeyMapItem *WM_keymap_item_find_id(struct wmKeyMap *keymap, int id){return (struct wmKeyMapItem *) NULL;}
int WM_enum_search_invoke(struct bContext *C, struct wmOperator *op, struct wmEvent *event){return 0;}
void WM_event_add_notifier(const struct bContext *C, unsigned int type, void *reference){}
@@ -182,8 +185,8 @@ struct wmKeyMap *WM_keymap_find(struct wmKeyConfig *keyconf, char *idname, int s
struct wmKeyMap *WM_keymap_add_item(struct wmKeyMap *keymap, char *idname, int type, int val, int modifier, int keymodifier){return (struct wmKeyMap *) NULL;}
struct wmKeyMap *WM_keymap_copy_to_user(struct wmKeyMap *kemap){return (struct wmKeyMap *) NULL;}
struct wmKeyMap *WM_keymap_list_find(struct ListBase *lb, char *idname, int spaceid, int regionid){return (struct wmKeyMap *) NULL;}
-struct wmKeyConfig *WM_keyconfig_add(struct wmWindowManager *wm, char *idname){return (struct wmKeyConfig *) NULL;}
-struct wmKeyConfig *WM_keyconfig_add_user(struct wmWindowManager *wm, char *idname){return (struct wmKeyConfig *) NULL;}
+struct wmKeyConfig *WM_keyconfig_new(struct wmWindowManager *wm, char *idname){return (struct wmKeyConfig *) NULL;}
+struct wmKeyConfig *WM_keyconfig_new_user(struct wmWindowManager *wm, char *idname){return (struct wmKeyConfig *) NULL;}
void WM_keyconfig_remove(struct wmWindowManager *wm, char *idname){}
void WM_keymap_remove_item(struct wmKeyMap *keymap, struct wmKeyMapItem *kmi){}
void WM_keymap_restore_to_default(struct wmKeyMap *keymap){}
@@ -245,6 +248,10 @@ void ED_mesh_geometry_add(struct Mesh *mesh, struct ReportList *reports, int ver
void ED_mesh_material_add(struct Mesh *me, struct Material *ma){}
void ED_mesh_transform(struct Mesh *me, float *mat){}
void ED_mesh_update(struct Mesh *mesh, struct bContext *C){}
+void ED_mesh_vertices_add(struct Mesh *mesh, struct ReportList *reports, int count){}
+void ED_mesh_edges_add(struct Mesh *mesh, struct ReportList *reports, int count){}
+void ED_mesh_faces_add(struct Mesh *mesh, struct ReportList *reports, int count){}
+void ED_mesh_material_link(struct Mesh *mesh, struct Material *ma){}
int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me){return 0;}
int ED_mesh_uv_texture_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me){return 0;}
void ED_object_constraint_dependency_update(struct Scene *scene, struct Object *ob){}
@@ -283,6 +290,7 @@ void uiItemsEnumR(struct uiLayout *layout, struct PointerRNA *ptr, char *propnam
void uiItemMenuEnumR(struct uiLayout *layout, struct PointerRNA *ptr, char *propname, char *name, int icon){}
void uiItemEnumR_string(struct uiLayout *layout, struct PointerRNA *ptr, char *propname, char *value, char *name, int icon){}
void uiItemPointerR(struct uiLayout *layout, struct PointerRNA *ptr, char *propname, struct PointerRNA *searchptr, char *searchpropname, char *name, int icon){}
+void uiItemPointerSubR(struct uiLayout *layout, struct PointerRNA *ptr, char *propname, char *searchpropname, char *name, int icon){}
void uiItemsEnumO(struct uiLayout *layout, char *opname, char *propname){}
void uiItemEnumO_string(struct uiLayout *layout, char *name, int icon, char *opname, char *propname, char *value_str){}
void uiItemMenuEnumO(struct uiLayout *layout, char *opname, char *propname, char *name, int icon){}
@@ -309,7 +317,6 @@ void uiTemplateIDPreview(struct uiLayout *layout, struct bContext *C, struct Poi
void uiTemplateCurveMapping(struct uiLayout *layout, struct CurveMapping *cumap, int type, int compact){}
void uiTemplateColorRamp(struct uiLayout *layout, struct ColorBand *coba, int expand){}
void uiTemplateLayers(struct uiLayout *layout, struct PointerRNA *ptr, char *propname){}
-void uiTemplateTriColorSet(struct uiLayout *layout, struct PointerRNA *ptr, char *propname){}
void uiTemplateImageLayers(struct uiLayout *layout, struct bContext *C, struct Image *ima, struct ImageUser *iuser){}
ListBase uiTemplateList(struct uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, char *propname, struct PointerRNA *activeptr, char *activepropname, int rows, int listtype){struct ListBase b = {0,0}; return b;}
void uiTemplateRunningJobs(struct uiLayout *layout, struct bContext *C){}
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index e05b9d33a4a..0ce02926e0d 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -290,40 +290,86 @@ SET(TARGETDIR ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR})
ADD_CUSTOM_COMMAND(TARGET blender
POST_BUILD
MAIN_DEPENDENCY blender
- COMMAND if not exist \"${TARGETDIR}\\.blender\" mkdir \"${TARGETDIR}\\.blender\"
- COMMAND if not exist \"${TARGETDIR}\\.blender\\locale\" mkdir \"${TARGETDIR}\\.blender\\locale\"
- COMMAND if not exist \"${TARGETDIR}\\.blender\\scripts\" mkdir \"${TARGETDIR}\\.blender\\scripts\"
+ COMMAND if not exist \"${TARGETDIR}\\${BLENDER_VERSION}\" mkdir \"${TARGETDIR}\\${BLENDER_VERSION}\"
+ COMMAND if not exist \"${TARGETDIR}\\${BLENDER_VERSION}\\scripts\" mkdir \"${TARGETDIR}\\${BLENDER_VERSION}\\scripts\"
+ COMMAND if not exist \"${TARGETDIR}\\${BLENDER_VERSION}\\config\" mkdir \"${TARGETDIR}\\${BLENDER_VERSION}\\config\"
COMMAND if not exist \"${TARGETDIR}\\plugins\" mkdir \"${TARGETDIR}\\plugins\"
- COMMAND copy /Y \"${CMAKE_SOURCE_DIR}\\release\\bin\\.blender\\.Blanguages\" \"${TARGETDIR}\\.blender\\\"
- COMMAND copy /Y \"${CMAKE_SOURCE_DIR}\\release\\bin\\.blender\\.bfont.ttf\" \"${TARGETDIR}\\.blender\\\"
- COMMAND xcopy /E /Y \"${CMAKE_SOURCE_DIR}\\release\\bin\\.blender\\locale\\*.*\" \"${TARGETDIR}\\.blender\\locale\"
- COMMAND xcopy /E /Y \"${CMAKE_SOURCE_DIR}\\release\\scripts\\*.*\" \"${TARGETDIR}\\.blender\\scripts\"
- COMMAND xcopy /E /Y \"${CMAKE_SOURCE_DIR}\\release\\plugins\\*.*\" \"${TARGETDIR}\\plugins\"
- COMMAND copy /Y \"${CMAKE_SOURCE_DIR}\\release\\text\\*.*\" \"${TARGETDIR}\"
- # TODO, copy python bundle
- # COMMAND copy /Y \"${CMAKE_SOURCE_DIR}\\release\\windows\\extra\\python31.zip\" \"${TARGETDIR}\\\"
+ COMMAND copy /Y \"${CMAKE_SOURCE_DIR}\\release\\bin\\.blender\\.bfont.ttf\" \"${TARGETDIR}\\${BLENDER_VERSION}\\config\\\"
+ COMMAND xcopy /E /Y \"${CMAKE_SOURCE_DIR}\\release\\scripts\\*.*\" \"${TARGETDIR}\\${BLENDER_VERSION}\\scripts\\\"
+ COMMAND xcopy /E /Y \"${CMAKE_SOURCE_DIR}\\release\\plugins\\*.*\" \"${TARGETDIR}\\${BLENDER_VERSION}\\plugins\\\"
+ COMMAND copy /Y \"${CMAKE_SOURCE_DIR}\\release\\text\\*.*\" \"${TARGETDIR}\\\"
)
+ IF(CMAKE_CL_64)
+ # gettext and png are statically linked on win64
ADD_CUSTOM_COMMAND(TARGET blender
POST_BUILD
MAIN_DEPENDENCY blender
- COMMAND copy /Y \"${LIBDIR}\\release\\python31.zip\" \"${TARGETDIR}\\\"
- COMMAND copy /Y \"${LIBDIR}\\release\\python31.zip\" \"${TARGETDIR}\\python31_d.zip\"
+ COMMAND copy /Y \"${LIBDIR}\\zlib\\lib\\zlib.dll\" \"${TARGETDIR}\\\"
+ COMMAND copy /Y \"${LIBDIR}\\pthreads\\lib\\pthreadVC2.dll\" \"${TARGETDIR}\\\"
+ # COMMAND copy /Y \"${LIBDIR}\\samplerate\\lib\\libsamplerate-0.dll\" \"${TARGETDIR}\\\"
+ )
+ ELSE(CMAKE_CL_64)
+ ADD_CUSTOM_COMMAND(TARGET blender
+ POST_BUILD
+ MAIN_DEPENDENCY blender
COMMAND copy /Y \"${LIBDIR}\\gettext\\lib\\gnu_gettext.dll\" \"${TARGETDIR}\\\"
COMMAND copy /Y \"${LIBDIR}\\png\\lib\\libpng.dll\" \"${TARGETDIR}\\\"
- COMMAND copy /Y \"${LIBDIR}\\sdl\\lib\\SDL.dll\" \"${TARGETDIR}\\\"
COMMAND copy /Y \"${LIBDIR}\\zlib\\lib\\zlib.dll\" \"${TARGETDIR}\\\"
- COMMAND copy /Y \"${LIBDIR}\\python\\lib\\python31.dll\" \"${TARGETDIR}\\\"
- COMMAND copy /Y \"${LIBDIR}\\python\\lib\\python31_d.dll\" \"${TARGETDIR}\\\"
COMMAND copy /Y \"${LIBDIR}\\pthreads\\lib\\pthreadVC2.dll\" \"${TARGETDIR}\\\"
# COMMAND copy /Y \"${LIBDIR}\\samplerate\\lib\\libsamplerate-0.dll\" \"${TARGETDIR}\\\"
)
+ ENDIF(CMAKE_CL_64)
+
+ IF(WITH_PYTHON)
+ IF(NOT CMAKE_BUILD_TYPE) # hack: with multi-configuration generator this is "", so for now copy both python31.dll/zip and python31_d.dll/zip
+ ADD_CUSTOM_COMMAND(TARGET blender
+ POST_BUILD
+ MAIN_DEPENDENCY blender
+ COMMAND copy /Y \"${LIBDIR}\\python\\lib\\python31_d.dll\" \"${TARGETDIR}\\\"
+ COMMAND copy /Y \"${LIBDIR}\\release\\python31_d.zip\" \"${TARGETDIR}\\\"
+ COMMAND copy /Y \"${LIBDIR}\\python\\lib\\python31.dll\" \"${TARGETDIR}\\\"
+ COMMAND copy /Y \"${LIBDIR}\\release\\python31.zip\" \"${TARGETDIR}\\\"
+ )
+ ELSE(NOT CMAKE_BUILD_TYPE)
+ IF(CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
+ ADD_CUSTOM_COMMAND(TARGET blender
+ POST_BUILD
+ MAIN_DEPENDENCY blender
+ COMMAND copy /Y \"${LIBDIR}\\python\\lib\\python31_d.dll\" \"${TARGETDIR}\\\"
+ COMMAND copy /Y \"${LIBDIR}\\release\\python31_d.zip\" \"${TARGETDIR}\\\"
+ )
+ ELSE(CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
+ ADD_CUSTOM_COMMAND(TARGET blender
+ POST_BUILD
+ MAIN_DEPENDENCY blender
+ COMMAND copy /Y \"${LIBDIR}\\python\\lib\\python31.dll\" \"${TARGETDIR}\\\"
+ COMMAND copy /Y \"${LIBDIR}\\release\\python31.zip\" \"${TARGETDIR}\\\"
+ )
+ ENDIF(CMAKE_BUILD_TYPE STREQUAL Debug OR CMAKE_BUILD_TYPE STREQUAL RelWithDebInfo)
+ ENDIF(NOT CMAKE_BUILD_TYPE)
+ ENDIF(WITH_PYTHON)
+
IF(WITH_INTERNATIONAL)
+ IF(CMAKE_CL_64)
+ # iconv is statically linked on win64
ADD_CUSTOM_COMMAND(TARGET blender
POST_BUILD
MAIN_DEPENDENCY blender
+ COMMAND if not exist \"${TARGETDIR}\\${BLENDER_VERSION}\\config\\locale\" mkdir \"${TARGETDIR}\\${BLENDER_VERSION}\\config\\locale\"
+ COMMAND copy /Y \"${CMAKE_SOURCE_DIR}\\release\\bin\\.blender\\.Blanguages\" \"${TARGETDIR}\\${BLENDER_VERSION}\\config\\\"
+ COMMAND xcopy /E /Y \"${CMAKE_SOURCE_DIR}\\release\\bin\\.blender\\locale\\*.*\" \"${TARGETDIR}\\${BLENDER_VERSION}\\config\\locale\\\"
+ )
+ ELSE(CMAKE_CL_64)
+ ADD_CUSTOM_COMMAND(TARGET blender
+ POST_BUILD
+ MAIN_DEPENDENCY blender
COMMAND copy /Y \"${LIBDIR}\\iconv\\lib\\iconv.dll\" \"${TARGETDIR}\\\"
+ COMMAND if not exist \"${TARGETDIR}\\${BLENDER_VERSION}\\config\\locale\" mkdir \"${TARGETDIR}\\${BLENDER_VERSION}\\config\\locale\"
+ COMMAND copy /Y \"${CMAKE_SOURCE_DIR}\\release\\bin\\.blender\\.Blanguages\" \"${TARGETDIR}\\${BLENDER_VERSION}\\config\\\"
+ COMMAND xcopy /E /Y \"${CMAKE_SOURCE_DIR}\\release\\bin\\.blender\\locale\\*.*\" \"${TARGETDIR}\\${BLENDER_VERSION}\\config\\locale\\\"
)
+ ENDIF(CMAKE_CL_64)
ENDIF(WITH_INTERNATIONAL)
IF(WITH_FFMPEG)
@@ -368,16 +414,27 @@ SET(TARGETDIR ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR})
)
ENDIF(WITH_OPENAL)
+
+ IF(WITH_SDL)
+ IF(NOT CMAKE_CL_64)
+ ADD_CUSTOM_COMMAND(TARGET blender
+ POST_BUILD
+ MAIN_DEPENDENCY blender
+ COMMAND copy /Y \"${LIBDIR}\\sdl\\lib\\SDL.dll\" \"${TARGETDIR}\\\"
+ )
+ ENDIF(NOT CMAKE_CL_64)
+ ENDIF(WITH_SDL)
+
ENDIF(WIN32)
ADD_DEPENDENCIES(blender makesdna)
FILE(READ ${CMAKE_BINARY_DIR}/cmake_blender_libs.txt BLENDER_LINK_LIBS)
-SET(BLENDER_LINK_LIBS bf_nodes ${BLENDER_LINK_LIBS} bf_windowmanager blender_render)
+SET(BLENDER_LINK_LIBS bf_nodes ${BLENDER_LINK_LIBS} bf_windowmanager bf_render)
IF(WITH_FLUID)
- SET(BLENDER_LINK_LIBS ${BLENDER_LINK_LIBS} bf_elbeem)
+ SET(BLENDER_LINK_LIBS ${BLENDER_LINK_LIBS} bf_intern_elbeem)
ENDIF(WITH_FLUID)
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
@@ -427,11 +484,11 @@ ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
bf_editor_animation
bf_editor_datafiles
- blender_BSP
- blender_render
- blender_ONL
+ bf_intern_bsp
+ bf_render
+ bf_intern_opennl
bf_python
- bf_gen_python
+ bf_python_ext
bf_ikplugin
bf_bmesh
bf_modifiers
@@ -440,8 +497,8 @@ ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
bf_gpu
bf_blenloader
bf_blenlib
- bf_ghost
- bf_string
+ bf_intern_ghost
+ bf_intern_string
bf_blenpluginapi
bf_imbuf
bf_avi
@@ -450,24 +507,24 @@ ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
bf_dds
bf_readblenfile
bf_collada
- blender_BSP
- blender_bop
+ bf_intern_bsp
+ bf_intern_bop
bf_kernel
- bf_decimation
- bf_elbeem
- bf_IK
- bf_memutil
- bf_guardedalloc
- blender_CTR
- bf_moto
+ bf_intern_decimate
+ bf_intern_elbeem
+ bf_intern_ik
+ bf_intern_memutil
+ bf_intern_guardedalloc
+ bf_intern_ctr
+ bf_intern_moto
bf_windowmanager
bf_blroutines
bf_converter
bf_dummy
bf_bullet
- bf_smoke
- bf_minilzo
- bf_lzma
+ bf_intern_smoke
+ extern_minilzo
+ extern_lzma
bf_common
bf_ketsji
bf_logic
@@ -475,31 +532,31 @@ ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
bf_oglrasterizer
bf_expressions
bf_scenegraph
- bf_moto
+ bf_intern_moto
bf_blroutines
kx_network
bf_kernel
bf_ngnetwork
extern_bullet
bf_loopbacknetwork
- bf_ITASC
+ bf_intern_itasc
bf_common
- bf_moto
+ bf_intern_moto
bf_python
- bf_gen_python
+ bf_python_ext
extern_binreloc
extern_glew
- extern_libopenjpeg
+ extern_openjpeg
bf_videotex
bf_rna
bf_dna
bf_blenfont
- bf_audaspace
- bf_decimation
+ bf_intern_audaspace
+ bf_intern_decimate
)
IF(WITH_CXX_GUARDEDALLOC)
- SET(BLENDER_SORTED_LIBS ${BLENDER_SORTED_LIBS} bf_guardedalloc_cpp)
+ SET(BLENDER_SORTED_LIBS ${BLENDER_SORTED_LIBS} bf_intern_guardedalloc_cpp)
ENDIF(WITH_CXX_GUARDEDALLOC)
IF(WITH_QUICKTIME)
diff --git a/source/creator/creator.c b/source/creator/creator.c
index 492864ec05a..709b4bc5047 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -134,6 +134,8 @@ extern int pluginapi_force_ref(void); /* from blenpluginapi:pluginapi.c */
char bprogname[FILE_MAXDIR+FILE_MAXFILE]; /* from blenpluginapi:pluginapi.c */
char btempdir[FILE_MAXDIR+FILE_MAXFILE];
+#define BLEND_VERSION_STRING_FMT "Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION
+
/* Initialise callbacks for the modules that need them */
static void setCallbacks(void);
@@ -178,17 +180,14 @@ static void strip_quotes(char *str)
static int print_version(int argc, char **argv, void *data)
{
+ printf (BLEND_VERSION_STRING_FMT);
#ifdef BUILD_DATE
- printf ("Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
printf ("\tbuild date: %s\n", build_date);
printf ("\tbuild time: %s\n", build_time);
printf ("\tbuild revision: %s\n", build_rev);
printf ("\tbuild platform: %s\n", build_platform);
printf ("\tbuild type: %s\n", build_type);
-#else
- printf ("Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
#endif
-
exit(0);
return 0;
@@ -198,7 +197,7 @@ static int print_help(int argc, char **argv, void *data)
{
bArgs *ba = (bArgs*)data;
- printf ("Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
+ printf (BLEND_VERSION_STRING_FMT);
printf ("Usage: blender [args ...] [file] [args ...]\n\n");
printf ("Render Options:\n");
@@ -375,7 +374,7 @@ static int background_mode(int argc, char **argv, void *data)
static int debug_mode(int argc, char **argv, void *data)
{
G.f |= G_DEBUG; /* std output printf's */
- printf ("Blender %d.%02d (sub %d) Build\n", BLENDER_VERSION/100, BLENDER_VERSION%100, BLENDER_SUBVERSION);
+ printf(BLEND_VERSION_STRING_FMT);
MEM_set_memory_debug();
#ifdef NAN_BUILDINFO
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
index d34e86fd556..ad92048ca13 100644
--- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp
+++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp
@@ -726,16 +726,16 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene,
MVert *mvert = dm->getVertArray(dm);
int totvert = dm->getNumVerts(dm);
- MFace *mface = dm->getFaceArray(dm);
- MTFace *tface = static_cast<MTFace*>(dm->getFaceDataArray(dm, CD_MTFACE));
- MCol *mcol = static_cast<MCol*>(dm->getFaceDataArray(dm, CD_MCOL));
+ MFace *mface = dm->getTessFaceArray(dm);
+ MTFace *tface = static_cast<MTFace*>(dm->getTessFaceDataArray(dm, CD_MTFACE));
+ MCol *mcol = static_cast<MCol*>(dm->getTessFaceDataArray(dm, CD_MCOL));
float (*tangent)[3] = NULL;
- int totface = dm->getNumFaces(dm);
+ int totface = dm->getNumTessFaces(dm);
const char *tfaceName = "";
if(tface) {
DM_add_tangent_layer(dm);
- tangent = (float(*)[3])dm->getFaceDataArray(dm, CD_TANGENT);
+ tangent = (float(*)[3])dm->getTessFaceDataArray(dm, CD_TANGENT);
}
meshobj = new RAS_MeshObject(mesh);
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
index 421a9fc64b8..26265cb7e74 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
@@ -1417,11 +1417,11 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
}
MVert *mvert = dm->getVertArray(dm);
- MFace *mface = dm->getFaceArray(dm);
- numpolys = dm->getNumFaces(dm);
+ MFace *mface = dm->getTessFaceArray(dm);
+ numpolys = dm->getNumTessFaces(dm);
numverts = dm->getNumVerts(dm);
- int* index = (int*)dm->getFaceDataArray(dm, CD_ORIGINDEX);
- MTFace *tface = (MTFace *)dm->getFaceDataArray(dm, CD_MTFACE);
+ int* index = (int*)dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
+ MTFace *tface = (MTFace *)dm->getTessFaceDataArray(dm, CD_MTFACE);
m_shapeType = (polytope) ? PHY_SHAPE_POLYTOPE : PHY_SHAPE_MESH;
@@ -1715,10 +1715,10 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
DerivedMesh* dm= gameobj->GetDeformer()->GetFinalMesh();
MVert *mvert = dm->getVertArray(dm);
- MFace *mface = dm->getFaceArray(dm);
- numpolys = dm->getNumFaces(dm);
+ MFace *mface = dm->getTessFaceArray(dm);
+ numpolys = dm->getNumTessFaces(dm);
numverts = dm->getNumVerts(dm);
- int* index = (int*)dm->getFaceDataArray(dm, CD_ORIGINDEX);
+ int* index = (int*)dm->getTessFaceDataArray(dm, CD_ORIGINDEX);
MFace *mf;
MVert *mv;
@@ -1727,7 +1727,7 @@ bool CcdShapeConstructionInfo::UpdateMesh(class KX_GameObject* gameobj, class RA
if(CustomData_has_layer(&dm->faceData, CD_MTFACE))
{
- MTFace *tface = (MTFace *)dm->getFaceDataArray(dm, CD_MTFACE);
+ MTFace *tface = (MTFace *)dm->getTessFaceDataArray(dm, CD_MTFACE);
MTFace *tf;
vector<bool> vert_tag_array(numverts, false);
diff --git a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
index 122a738e4f3..71f53bc5301 100644
--- a/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
+++ b/source/gameengine/Rasterizer/RAS_OpenGLRasterizer/RAS_OpenGLRasterizer.cpp
@@ -783,7 +783,7 @@ void RAS_OpenGLRasterizer::IndexPrimitivesInternal(RAS_MeshSlot& ms, bool multi)
current_ms = &ms;
current_mesh = ms.m_mesh;
current_wireframe = wireframe;
- MCol *mcol = (MCol*)ms.m_pDerivedMesh->getFaceDataArray(ms.m_pDerivedMesh, CD_MCOL);
+ MCol *mcol = (MCol*)ms.m_pDerivedMesh->getTessFaceDataArray(ms.m_pDerivedMesh, CD_MCOL);
if (current_polymat->GetFlag() & RAS_BLENDERGLSL) {
// GetMaterialIndex return the original mface material index,
// increment by 1 to match what derived mesh is doing
diff --git a/source/kernel/gen_system/GEN_HashedPtr.cpp b/source/kernel/gen_system/GEN_HashedPtr.cpp
index 4713c9d5eed..f6c71c34896 100644
--- a/source/kernel/gen_system/GEN_HashedPtr.cpp
+++ b/source/kernel/gen_system/GEN_HashedPtr.cpp
@@ -54,4 +54,4 @@ unsigned int GEN_Hash(void * inDWord)
return (unsigned int)(key ^ (key>>4));
#endif
}
-#endif \ No newline at end of file
+#endif