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:
authorJoshua Leung <aligorith@gmail.com>2009-06-06 09:00:40 +0400
committerJoshua Leung <aligorith@gmail.com>2009-06-06 09:00:40 +0400
commit964d44e6bcbc4f01e12de0ba097654564df252ab (patch)
treee751f993386f66069a7464f93ff11c619c507e89 /source
parent4e1bb5a806d65982320f89216b24ac7267f64f4a (diff)
parent880c43ad5a53203b64a6d6a51e239a4bfc6ed540 (diff)
NLA SoC: Merge from 2.5
20571 to 20667
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_particle.h2
-rw-r--r--source/blender/blenkernel/intern/modifier.c3
-rw-r--r--source/blender/blenkernel/intern/node.c8
-rw-r--r--source/blender/blenkernel/intern/particle.c55
-rw-r--r--source/blender/blenkernel/intern/particle_system.c36
-rw-r--r--source/blender/blenkernel/intern/pointcache.c2
-rw-r--r--source/blender/blenloader/intern/readfile.c38
-rw-r--r--source/blender/editors/include/ED_fileselect.h5
-rw-r--r--source/blender/editors/include/ED_object.h2
-rw-r--r--source/blender/editors/include/UI_interface.h59
-rw-r--r--source/blender/editors/include/UI_resources.h3
-rw-r--r--source/blender/editors/interface/interface.c57
-rw-r--r--source/blender/editors/interface/interface_api.c15
-rw-r--r--source/blender/editors/interface/interface_handlers.c146
-rw-r--r--source/blender/editors/interface/interface_intern.h15
-rw-r--r--source/blender/editors/interface/interface_layout.c178
-rw-r--r--source/blender/editors/interface/interface_panel.c2
-rw-r--r--source/blender/editors/interface/interface_regions.c359
-rw-r--r--source/blender/editors/interface/interface_style.c2
-rw-r--r--source/blender/editors/interface/interface_templates.c458
-rw-r--r--source/blender/editors/interface/interface_utils.c309
-rw-r--r--source/blender/editors/interface/interface_widgets.c121
-rw-r--r--source/blender/editors/object/editconstraint.c6
-rw-r--r--source/blender/editors/object/object_intern.h1
-rw-r--r--source/blender/editors/object/object_modifier.c162
-rw-r--r--source/blender/editors/object/object_ops.c1
-rw-r--r--source/blender/editors/physics/editparticle.c2
-rw-r--r--source/blender/editors/preview/previewrender.c2
-rw-r--r--source/blender/editors/screen/area.c7
-rw-r--r--source/blender/editors/screen/screen_ops.c62
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c2
-rw-r--r--source/blender/editors/space_buttons/buttons_context.c536
-rw-r--r--source/blender/editors/space_buttons/buttons_intern.h22
-rw-r--r--source/blender/editors/space_buttons/space_buttons.c12
-rw-r--r--source/blender/editors/space_file/file_draw.c4
-rw-r--r--source/blender/editors/space_file/file_header.c39
-rw-r--r--source/blender/editors/space_file/file_ops.c30
-rw-r--r--source/blender/editors/space_file/filelist.c99
-rw-r--r--source/blender/editors/space_file/filelist.h3
-rw-r--r--source/blender/editors/space_file/filesel.c31
-rw-r--r--source/blender/editors/space_file/space_file.c2
-rw-r--r--source/blender/editors/space_info/info_header.c44
-rw-r--r--source/blender/editors/space_outliner/outliner.c6
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c32
-rw-r--r--source/blender/editors/space_view3d/drawobject.c7
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c1
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c1
-rw-r--r--source/blender/makesdna/DNA_particle_types.h23
-rw-r--r--source/blender/makesdna/DNA_space_types.h22
-rw-r--r--source/blender/makesrna/RNA_access.h8
-rw-r--r--source/blender/makesrna/RNA_define.h1
-rw-r--r--source/blender/makesrna/intern/makesrna.c2
-rw-r--r--source/blender/makesrna/intern/rna_ID.c3
-rw-r--r--source/blender/makesrna/intern/rna_access.c83
-rw-r--r--source/blender/makesrna/intern/rna_action.c1
-rw-r--r--source/blender/makesrna/intern/rna_armature.c2
-rw-r--r--source/blender/makesrna/intern/rna_brush.c1
-rw-r--r--source/blender/makesrna/intern/rna_camera.c1
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c3
-rw-r--r--source/blender/makesrna/intern/rna_curve.c1
-rw-r--r--source/blender/makesrna/intern/rna_define.c7
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c1
-rw-r--r--source/blender/makesrna/intern/rna_group.c1
-rw-r--r--source/blender/makesrna/intern/rna_image.c1
-rw-r--r--source/blender/makesrna/intern/rna_internal.h2
-rw-r--r--source/blender/makesrna/intern/rna_internal_types.h2
-rw-r--r--source/blender/makesrna/intern/rna_key.c2
-rw-r--r--source/blender/makesrna/intern/rna_lamp.c5
-rw-r--r--source/blender/makesrna/intern/rna_lattice.c1
-rw-r--r--source/blender/makesrna/intern/rna_main.c3
-rw-r--r--source/blender/makesrna/intern/rna_material.c1
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c8
-rw-r--r--source/blender/makesrna/intern/rna_meta.c4
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c42
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c966
-rw-r--r--source/blender/makesrna/intern/rna_nodetree_types.h213
-rw-r--r--source/blender/makesrna/intern/rna_object.c122
-rw-r--r--source/blender/makesrna/intern/rna_object_force.c213
-rw-r--r--source/blender/makesrna/intern/rna_particle.c413
-rw-r--r--source/blender/makesrna/intern/rna_rna.c7
-rw-r--r--source/blender/makesrna/intern/rna_scene.c1
-rw-r--r--source/blender/makesrna/intern/rna_screen.c1
-rw-r--r--source/blender/makesrna/intern/rna_scriptlink.c1
-rw-r--r--source/blender/makesrna/intern/rna_sound.c1
-rw-r--r--source/blender/makesrna/intern/rna_space.c44
-rw-r--r--source/blender/makesrna/intern/rna_text.c1
-rw-r--r--source/blender/makesrna/intern/rna_texture.c56
-rw-r--r--source/blender/makesrna/intern/rna_ui.c32
-rw-r--r--source/blender/makesrna/intern/rna_vfont.c1
-rw-r--r--source/blender/makesrna/intern/rna_wm.c18
-rw-r--r--source/blender/makesrna/intern/rna_world.c1
-rw-r--r--source/blender/python/intern/bpy_interface.c1
-rw-r--r--source/blender/python/intern/bpy_operator.c69
-rw-r--r--source/blender/python/intern/bpy_operator.h3
-rw-r--r--source/blender/python/intern/bpy_operator_wrap.c2
-rw-r--r--source/blender/python/intern/bpy_rna.c96
-rw-r--r--source/blender/python/intern/bpy_rna.h1
-rw-r--r--source/blender/python/intern/bpy_ui.c4
-rw-r--r--source/blender/render/intern/source/convertblender.c14
-rw-r--r--source/blender/windowmanager/WM_types.h1
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c23
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c92
-rw-r--r--source/blender/windowmanager/wm_event_types.h1
103 files changed, 4268 insertions, 1350 deletions
diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h
index db4d948216e..4efd9a7f8ba 100644
--- a/source/blender/blenkernel/BKE_particle.h
+++ b/source/blender/blenkernel/BKE_particle.h
@@ -251,7 +251,7 @@ struct ParticleSystemModifierData *psys_get_modifier(struct Object *ob, struct P
struct ParticleSettings *psys_new_settings(char *name, struct Main *main);
struct ParticleSettings *psys_copy_settings(struct ParticleSettings *part);
-void psys_flush_settings(struct Scene *scene, struct ParticleSettings *part, int event, int hair_recalc);
+void psys_flush_particle_settings(struct Scene *scene, struct ParticleSettings *part, int recalc);
void make_local_particlesettings(struct ParticleSettings *part);
struct LinkNode *psys_using_settings(struct Scene *scene, struct ParticleSettings *part, int flush_update);
diff --git a/source/blender/blenkernel/intern/modifier.c b/source/blender/blenkernel/intern/modifier.c
index 5610db355e1..ec8d28aee6c 100644
--- a/source/blender/blenkernel/intern/modifier.c
+++ b/source/blender/blenkernel/intern/modifier.c
@@ -6347,8 +6347,7 @@ static void particleSystemModifier_deformVerts(
psmd->dm->getNumFaces(psmd->dm)!=psmd->totdmface){
/* in file read dm hasn't really changed but just wasn't saved in file */
- psys->recalc |= PSYS_RECALC_HAIR;
- psys->recalc |= PSYS_DISTR;
+ psys->recalc |= PSYS_RECALC_RESET;
psmd->flag |= eParticleSystemFlag_DM_changed;
psmd->totdmvert= psmd->dm->getNumVerts(psmd->dm);
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index 941e73982a5..43df11335fe 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -1055,6 +1055,14 @@ bNodeTree *ntreeAddTree(int type)
ntree->type= type;
ntree->alltypes.first = NULL;
ntree->alltypes.last = NULL;
+
+ /* this helps RNA identify ID pointers as nodetree */
+ if(ntree->type==NTREE_SHADER)
+ BLI_strncpy(ntree->id.name, "NTShader Nodetree", sizeof(ntree->id.name));
+ else if(ntree->type==NTREE_COMPOSIT)
+ BLI_strncpy(ntree->id.name, "NTComposit Nodetree", sizeof(ntree->id.name));
+ else if(ntree->type==NTREE_TEXTURE)
+ BLI_strncpy(ntree->id.name, "NTTexture Nodetree", sizeof(ntree->id.name));
ntreeInitTypes(ntree);
return ntree;
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 7d998a481f6..6cef9959d8b 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -348,8 +348,17 @@ void free_hair(ParticleSystem *psys, int softbody)
}
void free_keyed_keys(ParticleSystem *psys)
{
- if(psys->particles && psys->particles->keys)
+ if(psys->particles && psys->particles->keys) {
+ ParticleData *pa;
+ int i, totpart=psys->totpart;
+
MEM_freeN(psys->particles->keys);
+
+ for(i=0, pa=psys->particles; i<totpart; i++,pa++){
+ pa->keys = NULL;
+ pa->totkey = 0;
+ }
+ }
}
void free_child_path_cache(ParticleSystem *psys)
{
@@ -1739,12 +1748,12 @@ static void do_path_effectors(Scene *scene, Object *ob, ParticleSystem *psys, in
Normalize(force);
+ VECADDFAC(ca->co, (ca-1)->co, force, *length);
+
if(k < steps) {
VecSubf(vec, (ca+1)->co, ca->co);
*length = VecLength(vec);
}
-
- VECADDFAC(ca->co, (ca-1)->co, force, *length);
}
static int check_path_length(int k, ParticleCacheKey *keys, ParticleCacheKey *state, float max_length, float *cur_length, float length, float *dvec)
{
@@ -3052,42 +3061,22 @@ void make_local_particlesettings(ParticleSettings *part)
}
}
-/* should be integrated to depgraph signals */
-void psys_flush_settings(struct Scene *scene, ParticleSettings *part, int event, int hair_recalc)
+void psys_flush_particle_settings(Scene *scene, ParticleSettings *part, int recalc)
{
- Base *base;
- Object *ob, *tob;
+ Base *base = scene->base.first;
ParticleSystem *psys;
int flush;
- /* update all that have same particle settings */
- for(base = scene->base.first; base; base= base->next) {
- if(base->object->particlesystem.first) {
- ob=base->object;
- flush=0;
- for(psys=ob->particlesystem.first; psys; psys=psys->next){
- if(psys->part==part){
- psys->recalc |= event;
- if(hair_recalc)
- psys->recalc |= PSYS_RECALC_HAIR;
- flush++;
- }
- else if(psys->part->type==PART_REACTOR){
- ParticleSystem *tpsys;
- tob=psys->target_ob;
- if(tob==0)
- tob=ob;
- tpsys=BLI_findlink(&tob->particlesystem,psys->target_psys-1);
-
- if(tpsys && tpsys->part==part){
- psys->recalc |= event;
- flush++;
- }
- }
+ for(base = scene->base.first; base; base = base->next) {
+ flush = 0;
+ for(psys = base->object->particlesystem.first; psys; psys=psys->next) {
+ if(psys->part == part) {
+ psys->recalc |= recalc;
+ flush++;
}
- if(flush)
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
}
+ if(flush)
+ DAG_object_flush_update(scene, base->object, OB_RECALC_DATA);
}
}
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index f8b1852b728..f097af279b6 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -4173,10 +4173,10 @@ static void psys_update_path_cache(Scene *scene, Object *ob, ParticleSystemModif
ParticleEditSettings *pset=&scene->toolsettings->particle;
int distr=0,alloc=0;
- if((psys->part->childtype && psys->totchild != get_psys_tot_child(scene, psys)) || psys->recalc&PSYS_ALLOC)
+ if((psys->part->childtype && psys->totchild != get_psys_tot_child(scene, psys)) || psys->recalc&PSYS_RECALC_RESET)
alloc=1;
- if(alloc || psys->recalc&PSYS_DISTR || (psys->vgroup[PSYS_VG_DENSITY] && (G.f & G_WEIGHTPAINT)))
+ if(alloc || psys->recalc&PSYS_RECALC_RESET || (psys->vgroup[PSYS_VG_DENSITY] && (G.f & G_WEIGHTPAINT)))
distr=1;
if(distr){
@@ -4194,8 +4194,9 @@ static void psys_update_path_cache(Scene *scene, Object *ob, ParticleSystemModif
}
}
- if((part->type==PART_HAIR || psys->flag&PSYS_KEYED) && (psys_in_edit_mode(scene, psys)
- || (part->type==PART_HAIR || part->draw_as==PART_DRAW_PATH))){
+ if((part->type==PART_HAIR || psys->flag&PSYS_KEYED) && ( psys_in_edit_mode(scene, psys) || (part->type==PART_HAIR
+ || (part->ren_as == PART_DRAW_PATH && (part->draw_as == PART_DRAW_REND || psys->renderdata))))){
+
psys_cache_paths(scene, ob, psys, cfra, 0);
/* for render, child particle paths are computed on the fly */
@@ -4247,7 +4248,7 @@ static void hair_step(Scene *scene, Object *ob, ParticleSystemModifierData *psmd
pa->flag &= ~PARS_NO_DISP;
}
- if(psys->recalc & PSYS_DISTR)
+ if(psys->recalc & PSYS_RECALC_RESET)
/* need this for changing subsurf levels */
psys_calc_dmcache(ob, psmd->dm, psys);
@@ -4367,16 +4368,14 @@ void psys_changed_type(ParticleSystem *psys)
psys->flag &= ~PSYS_KEYED;
if(part->type == PART_HAIR) {
- part->draw_as = PART_DRAW_PATH;
- part->rotfrom = PART_ROT_IINCR;
- }
- else {
- free_hair(psys, 1);
+ if(ELEM4(part->ren_as, PART_DRAW_NOT, PART_DRAW_PATH, PART_DRAW_OB, PART_DRAW_GR)==0)
+ part->ren_as = PART_DRAW_PATH;
- if(part->draw_as == PART_DRAW_PATH)
- if(psys->part->phystype != PART_PHYS_KEYED)
- part->draw_as = PART_DRAW_DOT;
+ if(ELEM3(part->draw_as, PART_DRAW_NOT, PART_DRAW_REND, PART_DRAW_PATH)==0)
+ part->draw_as = PART_DRAW_REND;
}
+ else
+ free_hair(psys, 1);
psys->softflag= 0;
@@ -4574,7 +4573,7 @@ static void system_step(Scene *scene, Object *ob, ParticleSystem *psys, Particle
init= 1;
}
- if(psys->recalc & PSYS_DISTR) {
+ if(psys->recalc & PSYS_RECALC_RESET) {
distr= 1;
init= 1;
}
@@ -4594,6 +4593,8 @@ static void system_step(Scene *scene, Object *ob, ParticleSystem *psys, Particle
}
if(only_children_changed==0) {
+ free_keyed_keys(psys);
+
initialize_all_particles(ob, psys, psmd);
if(alloc)
@@ -4747,8 +4748,8 @@ static void psys_to_softbody(Scene *scene, Object *ob, ParticleSystem *psys)
static int hair_needs_recalc(ParticleSystem *psys)
{
if((psys->flag & PSYS_EDITED)==0 &&
- ((psys->flag & PSYS_HAIR_DONE)==0 || psys->recalc & PSYS_RECALC_HAIR)) {
- psys->recalc &= ~PSYS_RECALC_HAIR;
+ ((psys->flag & PSYS_HAIR_DONE)==0 || psys->recalc & PSYS_RECALC_REDO)) {
+ psys->recalc &= ~PSYS_RECALC_REDO;
return 1;
}
@@ -4778,6 +4779,9 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
if(!psmd->dm)
return;
+ if(psys->recalc & PSYS_RECALC_TYPE)
+ psys_changed_type(psys);
+
/* (re-)create hair */
if(psys->part->type==PART_HAIR && hair_needs_recalc(psys)) {
float hcfra=0.0f;
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 9c74014853d..b00755f7135 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -492,6 +492,8 @@ int BKE_ptcache_object_reset(Object *ob, int mode)
else
skip = 1;
}
+ else if((psys->recalc & PSYS_RECALC_RESET)==0)
+ skip = 1;
if(skip == 0) {
BKE_ptcache_id_from_particles(&pid, ob, psys);
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 160b0943928..e3869d4bc8a 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -4243,6 +4243,7 @@ static void lib_link_screen(FileData *fd, Main *main)
SpaceButs *sbuts= (SpaceButs *)sl;
sbuts->lockpoin= NULL;
sbuts->ri= NULL;
+ sbuts->pinid= newlibadr(fd, sc->id.lib, sbuts->pinid);
if(main->versionfile<132)
butspace_version_132(sbuts);
}
@@ -4444,6 +4445,7 @@ void lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *curscene)
else if(sl->spacetype==SPACE_BUTS) {
SpaceButs *sbuts= (SpaceButs *)sl;
sbuts->lockpoin= NULL;
+ sbuts->pinid = restore_pointer_by_name(newmain, sbuts->pinid, 0);
//XXX if (sbuts->ri) sbuts->ri->curtile = 0;
}
else if(sl->spacetype==SPACE_FILE) {
@@ -4732,6 +4734,10 @@ static void direct_link_screen(FileData *fd, bScreen *sc)
direct_link_gpencil(fd, sseq->gpd);
}
}
+ else if(sl->spacetype==SPACE_BUTS) {
+ SpaceButs *sbuts= (SpaceButs *)sl;
+ sbuts->path= NULL;
+ }
}
sa->actionzones.first= sa->actionzones.last= NULL;
@@ -6802,26 +6808,26 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
if(sbuts->mainb==BUTS_LAMP) {
sbuts->mainb= CONTEXT_SHADING;
- sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_LAMP;
+ //sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_LAMP;
}
else if(sbuts->mainb==BUTS_MAT) {
sbuts->mainb= CONTEXT_SHADING;
- sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_MAT;
+ //sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_MAT;
}
else if(sbuts->mainb==BUTS_TEX) {
sbuts->mainb= CONTEXT_SHADING;
- sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_TEX;
+ //sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_TEX;
}
else if(sbuts->mainb==BUTS_ANIM) {
sbuts->mainb= CONTEXT_OBJECT;
}
else if(sbuts->mainb==BUTS_WORLD) {
sbuts->mainb= CONTEXT_SCENE;
- sbuts->tab[CONTEXT_SCENE]= TAB_SCENE_WORLD;
+ //sbuts->tab[CONTEXT_SCENE]= TAB_SCENE_WORLD;
}
else if(sbuts->mainb==BUTS_RENDER) {
sbuts->mainb= CONTEXT_SCENE;
- sbuts->tab[CONTEXT_SCENE]= TAB_SCENE_RENDER;
+ //sbuts->tab[CONTEXT_SCENE]= TAB_SCENE_RENDER;
}
else if(sbuts->mainb==BUTS_GAME) {
sbuts->mainb= CONTEXT_LOGIC;
@@ -6831,7 +6837,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
else if(sbuts->mainb==BUTS_RADIO) {
sbuts->mainb= CONTEXT_SHADING;
- sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_RAD;
+ //sbuts->tab[CONTEXT_SHADING]= TAB_SHADING_RAD;
}
else if(sbuts->mainb==BUTS_CONSTRAINT) {
sbuts->mainb= CONTEXT_OBJECT;
@@ -8458,7 +8464,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
part->draw_as = PART_DRAW_PATH;
part->type = PART_HAIR;
- psys->recalc |= PSYS_RECALC_HAIR;
+ psys->recalc |= PSYS_RECALC_REDO;
part->normfac *= fac;
part->randfac *= fac;
@@ -8924,6 +8930,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
Mesh *me;
Scene *sce;
Tex *tx;
+ ParticleSettings *part;
for(screen= main->screen.first; screen; screen= screen->id.next) {
do_versions_windowmanager_2_50(screen);
@@ -8965,6 +8972,23 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
for(me= main->mesh.first; me; me= me->id.next) {
me->drawflag= ME_DRAWEDGES|ME_DRAWFACES|ME_DRAWCREASES;
}
+
+ /* particle settings conversion */
+ for(part= main->particle.first; part; part= part->id.next) {
+ if(part->draw_as) {
+ if(part->draw_as == PART_DRAW_DOT) {
+ part->ren_as = PART_DRAW_HALO;
+ part->draw_as = PART_DRAW_REND;
+ }
+ else if(part->draw_as <= PART_DRAW_AXIS) {
+ part->ren_as = PART_DRAW_HALO;
+ }
+ else {
+ part->ren_as = part->draw_as;
+ part->draw_as = PART_DRAW_REND;
+ }
+ }
+ }
}
/* TODO: should be moved into one of the version blocks once this branch moves to trunk and we can
diff --git a/source/blender/editors/include/ED_fileselect.h b/source/blender/editors/include/ED_fileselect.h
index 7cbef4984d7..34aefa91225 100644
--- a/source/blender/editors/include/ED_fileselect.h
+++ b/source/blender/editors/include/ED_fileselect.h
@@ -35,7 +35,6 @@ struct SpaceFile;
#define FILE_IMGDISPLAY 3
typedef struct FileSelectParams {
- int type; /* the mode of the filebrowser, FILE_BLENDER, FILE_SPECIAL, FILE_MAIN or FILE_LOADLIB */
char title[24]; /* title, also used for the text of the execute button */
char dir[240]; /* directory */
char file[80]; /* file */
@@ -96,8 +95,8 @@ typedef struct FileLayout
FileSelectParams* ED_fileselect_get_params(struct SpaceFile *sfile);
-short ED_fileselect_set_params(struct SpaceFile *sfile, int type, const char *title, const char *path,
- short flag, short display, short filter);
+short ED_fileselect_set_params(struct SpaceFile *sfile, const char *title, const char *path,
+ short flag, short display, short filter, short sort);
void ED_fileselect_reset_params(struct SpaceFile *sfile);
diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h
index 3d0de795778..bfa819632c9 100644
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@ -56,7 +56,7 @@ void ED_base_object_free_and_unlink(struct Scene *scene, struct Base *base);
void ED_object_apply_obmat(struct Object *ob);
/* single object duplicate, if dupflag==0, fully linked, else it uses U.dupflag */
-Base *ED_object_add_duplicate(struct Scene *scene, struct Base *base, int usedupflag);
+struct Base *ED_object_add_duplicate(struct Scene *scene, struct Base *base, int usedupflag);
/* bitflags for enter/exit editmode */
diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h
index 97c2da5297f..6511d4d91eb 100644
--- a/source/blender/editors/include/UI_interface.h
+++ b/source/blender/editors/include/UI_interface.h
@@ -52,6 +52,7 @@ struct rctf;
struct uiStyle;
struct uiFontStyle;
struct ColorBand;
+struct CurveMapping;
typedef struct uiBut uiBut;
typedef struct uiBlock uiBlock;
@@ -177,20 +178,21 @@ typedef struct uiLayout uiLayout;
#define INLINK (23<<9)
#define KEYEVT (24<<9)
#define ICONTEXTROW (25<<9)
-#define HSVCUBE (26<<9)
-#define PULLDOWN (27<<9)
-#define ROUNDBOX (28<<9)
-#define CHARTAB (29<<9)
+#define HSVCUBE (26<<9)
+#define PULLDOWN (27<<9)
+#define ROUNDBOX (28<<9)
+#define CHARTAB (29<<9)
#define BUT_COLORBAND (30<<9)
-#define BUT_NORMAL (31<<9)
-#define BUT_CURVE (32<<9)
+#define BUT_NORMAL (31<<9)
+#define BUT_CURVE (32<<9)
#define BUT_TOGDUAL (33<<9)
-#define ICONTOGN (34<<9)
-#define FTPREVIEW (35<<9)
-#define NUMABS (36<<9)
-#define TOGBUT (37<<9)
-#define OPTION (38<<9)
-#define OPTIONN (39<<9)
+#define ICONTOGN (34<<9)
+#define FTPREVIEW (35<<9)
+#define NUMABS (36<<9)
+#define TOGBUT (37<<9)
+#define OPTION (38<<9)
+#define OPTIONN (39<<9)
+#define SEARCH_MENU (40<<9)
#define BUTTYPE (63<<9)
/* Drawing
@@ -401,6 +403,8 @@ uiBut *uiDefIconTextBlockBut(uiBlock *block, uiBlockCreateFunc func, void *arg,
void uiDefKeyevtButS(uiBlock *block, int retval, char *str, short x1, short y1, short x2, short y2, short *spoin, char *tip);
+uiBut *uiDefSearchBut(uiBlock *block, void *arg, int retval, int icon, int maxlen, short x1, short y1, short x2, short y2, char *tip);
+
void uiBlockPickerButtons(struct uiBlock *block, float *col, float *hsv, float *old, char *hexcol, char mode, short retval);
void uiBlockColorbandButtons(struct uiBlock *block, struct ColorBand *coba, struct rctf *butr, int event);
@@ -425,20 +429,34 @@ uiBut *uiFindInlink(uiBlock *block, void *poin);
*
* uiButSetCompleteFunc is for tab completion.
*
+ * uiButSearchFunc is for name buttons, showing a popup with matches
+ *
* uiBlockSetFunc and uiButSetFunc are callbacks run when a button is used,
* in case events, operators or RNA are not sufficient to handle the button.
*
* uiButSetNFunc will free the argument with MEM_freeN. */
+typedef struct uiSearchItems uiSearchItems;
+
typedef void (*uiButHandleFunc)(struct bContext *C, void *arg1, void *arg2);
+typedef void (*uiButHandleRenameFunc)(struct bContext *C, void *arg, char *origstr);
typedef void (*uiButHandleNFunc)(struct bContext *C, void *argN, void *arg2);
typedef void (*uiButCompleteFunc)(struct bContext *C, char *str, void *arg);
+typedef void (*uiButSearchFunc)(const struct bContext *C, void *arg, char *str, uiSearchItems *items);
typedef void (*uiBlockHandleFunc)(struct bContext *C, void *arg, int event);
+
+ /* use inside searchfunc to add items */
+int uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin);
+ /* bfunc gets search item *poin as arg2, or if NULL the old string */
+void uiButSetSearchFunc (uiBut *but, uiButSearchFunc sfunc, void *arg1, uiButHandleFunc bfunc);
+ /* height in pixels, it's using hardcoded values still */
+int uiSearchBoxhHeight(void);
void uiBlockSetHandleFunc(uiBlock *block, uiBlockHandleFunc func, void *arg);
void uiBlockSetButmFunc (uiBlock *block, uiMenuHandleFunc func, void *arg);
void uiBlockSetFunc (uiBlock *block, uiButHandleFunc func, void *arg1, void *arg2);
+void uiBlockSetRenameFunc(uiBlock *block, uiButHandleRenameFunc func, void *arg1);
void uiButSetFunc (uiBut *but, uiButHandleFunc func, void *arg1, void *arg2);
void uiButSetNFunc (uiBut *but, uiButHandleNFunc func, void *argN, void *arg2);
@@ -497,9 +515,9 @@ void test_imapoin_but(struct bContext *C, char *name, struct ID **idpp);
void autocomplete_bone(struct bContext *C, char *str, void *arg_v);
void autocomplete_vgroup(struct bContext *C, char *str, void *arg_v);
-struct CurveMapping;
struct rctf;
void curvemap_buttons(uiBlock *block, struct CurveMapping *cumap, char labeltype, short event, short redraw, struct rctf *rect);
+void colorband_buttons(uiBlock *block, struct ColorBand *coba, struct rctf *rect, int small);
/* Module
@@ -539,9 +557,10 @@ uiBut *uiDefMenuTogR(uiBlock *block, struct PointerRNA *ptr, char *propname, cha
#define UI_UNIT_X 20
#define UI_UNIT_Y 20
-#define UI_LAYOUT_ALIGN_LEFT 0
-#define UI_LAYOUT_ALIGN_CENTER 1
-#define UI_LAYOUT_ALIGN_RIGHT 2
+#define UI_LAYOUT_ALIGN_EXPAND 0
+#define UI_LAYOUT_ALIGN_LEFT 1
+#define UI_LAYOUT_ALIGN_CENTER 2
+#define UI_LAYOUT_ALIGN_RIGHT 3
uiLayout *uiBlockLayout(uiBlock *block, int dir, int type, int x, int y, int size, int em, struct uiStyle *style);
void uiBlockSetCurLayout(uiBlock *block, uiLayout *layout);
@@ -558,14 +577,16 @@ void uiLayoutSetEnabled(uiLayout *layout, int enabled);
void uiLayoutSetRedAlert(uiLayout *layout, int redalert);
void uiLayoutSetAlignment(uiLayout *layout, int alignment);
void uiLayoutSetKeepAspect(uiLayout *layout, int keepaspect);
-void uiLayoutSetScale(uiLayout *layout, float scale);
+void uiLayoutSetScaleX(uiLayout *layout, float scale);
+void uiLayoutSetScaleY(uiLayout *layout, float scale);
int uiLayoutGetActive(uiLayout *layout);
int uiLayoutGetEnabled(uiLayout *layout);
int uiLayoutGetRedAlert(uiLayout *layout);
int uiLayoutGetAlignment(uiLayout *layout);
int uiLayoutGetKeepAspect(uiLayout *layout);
-float uiLayoutGetScale(uiLayout *layout);
+float uiLayoutGetScaleX(uiLayout *layout);
+float uiLayoutGetScaleY(uiLayout *layout);
/* layout specifiers */
uiLayout *uiLayoutRow(uiLayout *layout, int align);
@@ -584,6 +605,8 @@ void uiTemplateHeaderID(uiLayout *layout, struct bContext *C, struct PointerRNA
uiLayout *uiTemplateModifier(uiLayout *layout, struct PointerRNA *ptr);
uiLayout *uiTemplateConstraint(uiLayout *layout, struct PointerRNA *ptr);
void uiTemplatePreview(uiLayout *layout, struct ID *id);
+void uiTemplateColorRamp(uiLayout *layout, struct ColorBand *coba, int expand);
+void uiTemplateCurveMapping(uiLayout *layout, struct CurveMapping *cumap, int type);
/* items */
void uiItemO(uiLayout *layout, char *name, int icon, char *opname);
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index 84ce3762f86..5339a255dbc 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -1098,9 +1098,6 @@ void UI_ColorPtrBlendShade3ubv(char *cp1, char *cp2, float fac, int offset);
// get a 3 byte color, blended and shaded between two other char color pointers
void UI_GetColorPtrBlendShade3ubv(char *cp1, char *cp2, char *col, float fac, int offset);
-// get pointer from RNA pointer
-int UI_GetIconRNA(struct PointerRNA *ptr);
-
// internal (blender) usage only, for init and set active
void UI_SetTheme(int spacetype, int regionid);
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index e9a886375c3..68973fe540c 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -537,10 +537,17 @@ void uiEndBlock(const bContext *C, uiBlock *block)
/* temp? Proper check for greying out */
if(but->optype) {
wmOperatorType *ot= but->optype;
+
+ if(but->context)
+ CTX_store_set((bContext*)C, but->context);
+
if(ot==NULL || (ot->poll && ot->poll((bContext *)C)==0)) {
but->flag |= UI_BUT_DISABLED;
but->lock = 1;
}
+
+ if(but->context)
+ CTX_store_set((bContext*)C, NULL);
}
/* only update soft range while not editing */
@@ -1359,7 +1366,7 @@ int ui_get_but_string_max_length(uiBut *but)
void ui_get_but_string(uiBut *but, char *str, int maxlen)
{
- if(but->rnaprop && ELEM(but->type, TEX, IDPOIN)) {
+ if(but->rnaprop && ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
PropertyType type;
char *buf= NULL;
@@ -1402,6 +1409,11 @@ void ui_get_but_string(uiBut *but, char *str, int maxlen)
BLI_strncpy(str, but->poin, maxlen);
return;
}
+ else if(but->type == SEARCH_MENU) {
+ /* string */
+ BLI_strncpy(str, but->poin, maxlen);
+ return;
+ }
else {
/* number */
double value;
@@ -1491,7 +1503,7 @@ static void ui_rna_ID_autocomplete(bContext *C, char *str, void *arg_but)
int ui_set_but_string(bContext *C, uiBut *but, const char *str)
{
- if(but->rnaprop && ELEM(but->type, TEX, IDPOIN)) {
+ if(but->rnaprop && ELEM3(but->type, TEX, IDPOIN, SEARCH_MENU)) {
if(RNA_property_editable(&but->rnapoin, but->rnaprop)) {
PropertyType type;
@@ -1535,6 +1547,11 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str)
BLI_strncpy(but->poin, str, but->hardmax);
return 1;
}
+ else if(but->type == SEARCH_MENU) {
+ /* string */
+ BLI_strncpy(but->poin, str, but->hardmax);
+ return 1;
+ }
else {
double value;
@@ -1817,11 +1834,11 @@ void ui_check_but(uiBut *but)
/* if something changed in the button */
double value;
float okwidth;
- int transopts= ui_translate_buttons();
+// int transopts= ui_translate_buttons();
ui_is_but_sel(but);
- if(but->type==TEX || but->type==IDPOIN) transopts= 0;
+// if(but->type==TEX || but->type==IDPOIN) transopts= 0;
/* test for min and max, icon sliders, etc */
switch( but->type ) {
@@ -1926,6 +1943,7 @@ void ui_check_but(uiBut *but)
case IDPOIN:
case TEX:
+ case SEARCH_MENU:
if(!but->editstr) {
char str[UI_MAX_DRAW_STR];
@@ -2945,6 +2963,11 @@ void uiBlockSetFunc(uiBlock *block, uiButHandleFunc func, void *arg1, void *arg2
block->func_arg2= arg2;
}
+void uiBlockSetRenameFunc(uiBlock *block, uiButHandleRenameFunc func, void *arg1)
+{
+
+}
+
void uiBlockSetDrawExtraFunc(uiBlock *block, void (*func)())
{
block->drawextra= func;
@@ -3065,6 +3088,32 @@ void uiDefKeyevtButS(uiBlock *block, int retval, char *str, short x1, short y1,
ui_check_but(but);
}
+/* arg is pointer to string/name, use uiButSetSearchFunc() below to make this work */
+uiBut *uiDefSearchBut(uiBlock *block, void *arg, int retval, int icon, int maxlen, short x1, short y1, short x2, short y2, char *tip)
+{
+ uiBut *but= ui_def_but(block, SEARCH_MENU, retval, "", x1, y1, x2, y2, arg, 0.0, maxlen, 0.0, 0.0, tip);
+
+ but->icon= (BIFIconID) icon;
+ but->flag|= UI_HAS_ICON;
+
+ but->flag|= UI_ICON_LEFT|UI_TEXT_LEFT;
+ but->flag|= UI_ICON_SUBMENU;
+
+ ui_check_but(but);
+
+ return but;
+}
+
+/* arg is user value, searchfunc and handlefunc both get it as arg */
+void uiButSetSearchFunc(uiBut *but, uiButSearchFunc sfunc, void *arg, uiButHandleFunc bfunc)
+{
+ but->search_func= sfunc;
+ but->search_arg= arg;
+
+ uiButSetFunc(but, bfunc, arg, NULL);
+}
+
+
/* Program Init/Exit */
void UI_init(void)
diff --git a/source/blender/editors/interface/interface_api.c b/source/blender/editors/interface/interface_api.c
index 2bbaee857d1..5aff0c0ad82 100644
--- a/source/blender/editors/interface/interface_api.c
+++ b/source/blender/editors/interface/interface_api.c
@@ -54,6 +54,12 @@ void RNA_api_ui_layout(StructRNA *srna)
FunctionRNA *func;
PropertyRNA *parm;
+ static EnumPropertyItem curve_type_items[] = {
+ {0, "NONE", "None", ""},
+ {'v', "VECTOR", "Vector", ""},
+ {'c', "COLOR", "Color", ""},
+ {0, NULL, NULL, NULL}};
+
/* simple layout specifiers */
func= RNA_def_function(srna, "row", "uiLayoutRow");
parm= RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in.");
@@ -214,5 +220,14 @@ void RNA_api_ui_layout(StructRNA *srna)
parm= RNA_def_pointer(func, "id", "ID", "", "ID datablock.");
RNA_def_property_flag(parm, PROP_REQUIRED);
+ func= RNA_def_function(srna, "template_curve_mapping", "uiTemplateCurveMapping");
+ parm= RNA_def_pointer(func, "curvemap", "CurveMapping", "", "Curve mapping pointer.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_enum(func, "type", curve_type_items, 0, "Type", "Type of curves to display.");
+
+ func= RNA_def_function(srna, "template_color_ramp", "uiTemplateColorRamp");
+ parm= RNA_def_pointer(func, "ramp", "ColorRamp", "", "Color ramp pointer.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ RNA_def_boolean(func, "expand", 0, "", "Expand button to show more detail.");
}
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c
index ec2f960dd14..933d57c8983 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -97,7 +97,7 @@ typedef struct uiHandleButtonData {
/* overall state */
uiHandleButtonState state;
- int cancel, retval;
+ int cancel, escapecancel, retval;
int applied, appliedinteractive;
wmTimer *flashtimer;
@@ -127,6 +127,9 @@ typedef struct uiHandleButtonData {
/* menu open */
uiPopupBlockHandle *menu;
int menuretval;
+
+ /* search box */
+ ARegion *searchbox;
/* post activate */
uiButtonActivateType posttype;
@@ -139,7 +142,8 @@ typedef struct uiAfterFunc {
uiButHandleFunc func;
void *func_arg1;
void *func_arg2;
-
+ void *func_arg3;
+
uiButHandleNFunc funcN;
void *func_argN;
@@ -157,6 +161,8 @@ typedef struct uiAfterFunc {
PointerRNA rnapoin;
PropertyRNA *rnaprop;
+
+ bContextStore *context;
} uiAfterFunc;
static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState state);
@@ -228,6 +234,7 @@ static void ui_apply_but_func(bContext *C, uiBut *but)
after->func= but->func;
after->func_arg1= but->func_arg1;
after->func_arg2= but->func_arg2;
+ after->func_arg3= but->func_arg3;
after->funcN= but->funcN;
after->func_argN= but->func_argN;
@@ -249,6 +256,9 @@ static void ui_apply_but_func(bContext *C, uiBut *but)
after->rnapoin= but->rnapoin;
after->rnaprop= but->rnaprop;
+ if(but->context)
+ after->context= CTX_store_copy(but->context);
+
but->optype= NULL;
but->opcontext= 0;
but->opptr= NULL;
@@ -270,6 +280,9 @@ static void ui_apply_but_funcs_after(bContext *C)
after= *afterf; /* copy to avoid memleak on exit() */
BLI_freelinkN(&funcs, afterf);
+ if(after.context)
+ CTX_store_set(C, after.context);
+
if(after.func)
after.func(C, after.func_arg1, after.func_arg2);
if(after.funcN)
@@ -289,6 +302,11 @@ static void ui_apply_but_funcs_after(bContext *C)
if(after.rnapoin.data)
RNA_property_update(C, &after.rnapoin, after.rnaprop);
+
+ if(after.context) {
+ CTX_store_set(C, NULL);
+ CTX_store_free(after.context);
+ }
}
}
@@ -402,9 +420,10 @@ static void ui_apply_but_TEX(bContext *C, uiBut *but, uiHandleButtonData *data)
/* give butfunc the original text too */
/* feature used for bone renaming, channels, etc */
- if(but->func_arg2==NULL) but->func_arg2= data->origstr;
+ /* XXX goes via uiButHandleRenameFunc now */
+// if(but->func_arg2==NULL) but->func_arg2= data->origstr;
ui_apply_but_func(C, but);
- if(but->func_arg2==data->origstr) but->func_arg2= NULL;
+// if(but->func_arg2==data->origstr) but->func_arg2= NULL;
data->retval= but->retval;
data->applied= 1;
@@ -557,6 +576,7 @@ static void ui_apply_button(bContext *C, uiBlock *block, uiBut *but, uiHandleBut
ui_apply_but_BUT(C, but, data);
break;
case TEX:
+ case SEARCH_MENU:
ui_apply_but_TEX(C, but, data);
break;
case TOGBUT:
@@ -871,7 +891,7 @@ static int ui_textedit_type_ascii(uiBut *but, uiHandleButtonData *data, char asc
}
}
- return WM_UI_HANDLER_BREAK;
+ return changed;
}
void ui_textedit_move(uiBut *but, uiHandleButtonData *data, int direction, int select, int jump)
@@ -1030,7 +1050,7 @@ static int ui_textedit_delete(uiBut *but, uiHandleButtonData *data, int directio
else { /* backspace */
if(len!=0) {
if ((but->selend - but->selsta) > 0) {
- ui_textedit_delete_selection(but, data);
+ changed= ui_textedit_delete_selection(but, data);
}
else if(but->pos>0) {
for(x=but->pos; x<len; x++)
@@ -1124,7 +1144,7 @@ static int ui_textedit_copypaste(uiBut *but, uiHandleButtonData *data, int paste
return changed;
}
-static void ui_textedit_begin(uiBut *but, uiHandleButtonData *data)
+static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data)
{
if(data->str) {
MEM_freeN(data->str);
@@ -1146,13 +1166,27 @@ static void ui_textedit_begin(uiBut *but, uiHandleButtonData *data)
but->selsta= 0;
but->selend= strlen(but->drawstr) - strlen(but->str);
+ /* optional searchbox */
+ if(but->type==SEARCH_MENU) {
+ data->searchbox= ui_searchbox_create(C, data->region, but);
+ ui_searchbox_update(C, data->searchbox, but, 1); /* 1= reset */
+ }
+
ui_check_but(but);
}
-static void ui_textedit_end(uiBut *but, uiHandleButtonData *data)
+static void ui_textedit_end(bContext *C, uiBut *but, uiHandleButtonData *data)
{
if(but) {
- but->editstr= 0;
+ if(data->searchbox) {
+ if(data->cancel==0)
+ ui_searchbox_apply(but, data->searchbox);
+
+ ui_searchbox_free(C, data->searchbox);
+ data->searchbox= NULL;
+ }
+
+ but->editstr= NULL;
but->pos= -1;
}
}
@@ -1205,18 +1239,30 @@ static void ui_textedit_prev_but(uiBlock *block, uiBut *actbut, uiHandleButtonDa
}
}
+
static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
{
- int mx, my, changed= 0, retval= WM_UI_HANDLER_CONTINUE;
+ int mx, my, changed= 0, inbox=0, retval= WM_UI_HANDLER_CONTINUE;
switch(event->type) {
+ case MOUSEMOVE:
+ if(data->searchbox)
+ ui_searchbox_event(C, data->searchbox, but, event);
+
+ break;
case RIGHTMOUSE:
case ESCKEY:
data->cancel= 1;
+ data->escapecancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
retval= WM_UI_HANDLER_BREAK;
break;
case LEFTMOUSE: {
+
+ /* exit on LMB only on RELEASE for searchbox, to mimic other popups, and allow multiple menu levels */
+ if(data->searchbox)
+ inbox= BLI_in_rcti(&data->searchbox->winrct, event->x, event->y);
+
if(event->val==KM_PRESS) {
mx= event->x;
my= event->y;
@@ -1230,11 +1276,18 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
button_activate_state(C, but, BUTTON_STATE_TEXT_SELECTING);
retval= WM_UI_HANDLER_BREAK;
}
- else {
+ else if(inbox==0) {
+ /* if searchbox, click outside will cancel */
+ if(data->searchbox)
+ data->cancel= data->escapecancel= 1;
button_activate_state(C, but, BUTTON_STATE_EXIT);
retval= WM_UI_HANDLER_BREAK;
}
}
+ else if(inbox) {
+ button_activate_state(C, but, BUTTON_STATE_EXIT);
+ retval= WM_UI_HANDLER_BREAK;
+ }
break;
}
}
@@ -1264,11 +1317,21 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
retval= WM_UI_HANDLER_BREAK;
break;
case DOWNARROWKEY:
+ if(data->searchbox) {
+ ui_searchbox_event(C, data->searchbox, but, event);
+ break;
+ }
+ /* pass on purposedly */
case ENDKEY:
ui_textedit_move_end(but, data, 1, event->shift);
retval= WM_UI_HANDLER_BREAK;
break;
case UPARROWKEY:
+ if(data->searchbox) {
+ ui_searchbox_event(C, data->searchbox, but, event);
+ break;
+ }
+ /* pass on purposedly */
case HOMEKEY:
ui_textedit_move_end(but, data, 0, event->shift);
retval= WM_UI_HANDLER_BREAK;
@@ -1316,6 +1379,9 @@ static void ui_do_but_textedit(bContext *C, uiBlock *block, uiBut *but, uiHandle
if(changed) {
if(data->interactive) ui_apply_button(C, block, but, data, 1);
else ui_check_but(but);
+
+ if(data->searchbox)
+ ui_searchbox_update(C, data->searchbox, but, 1); /* 1 = reset */
}
if(changed || (retval == WM_UI_HANDLER_BREAK))
@@ -1549,7 +1615,7 @@ static int ui_do_but_KEYEVT(bContext *C, uiBut *but, uiHandleButtonData *data, w
static int ui_do_but_TEX(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event)
{
if(data->state == BUTTON_STATE_HIGHLIGHT) {
- if(ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val==KM_PRESS) {
+ if(ELEM4(event->type, LEFTMOUSE, PADENTER, RETKEY, EVT_BUT_OPEN) && event->val==KM_PRESS) {
button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING);
return WM_UI_HANDLER_BREAK;
}
@@ -1710,7 +1776,12 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
}
}
else if(data->state == BUTTON_STATE_NUM_EDITING) {
- if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
+ if(event->type == ESCKEY) {
+ data->cancel= 1;
+ data->escapecancel= 1;
+ button_activate_state(C, but, BUTTON_STATE_EXIT);
+ }
+ else if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
if(data->dragchange)
button_activate_state(C, but, BUTTON_STATE_EXIT);
else
@@ -1906,7 +1977,12 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton
}
}
else if(data->state == BUTTON_STATE_NUM_EDITING) {
- if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
+ if(event->type == ESCKEY) {
+ data->cancel= 1;
+ data->escapecancel= 1;
+ button_activate_state(C, but, BUTTON_STATE_EXIT);
+ }
+ else if(event->type == LEFTMOUSE && event->val!=KM_PRESS) {
if(data->dragchange)
button_activate_state(C, but, BUTTON_STATE_EXIT);
else
@@ -2702,6 +2778,7 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
break;
case TEX:
case IDPOIN:
+ case SEARCH_MENU:
retval= ui_do_but_TEX(C, block, but, data, event);
break;
case MENU:
@@ -2928,9 +3005,9 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s
/* text editing */
if(state == BUTTON_STATE_TEXT_EDITING && data->state != BUTTON_STATE_TEXT_SELECTING)
- ui_textedit_begin(but, data);
+ ui_textedit_begin(C, but, data);
else if(data->state == BUTTON_STATE_TEXT_EDITING && state != BUTTON_STATE_TEXT_SELECTING)
- ui_textedit_end(but, data);
+ ui_textedit_end(C, but, data);
/* number editing */
if(state == BUTTON_STATE_NUM_EDITING)
@@ -2982,7 +3059,9 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA
data= MEM_callocN(sizeof(uiHandleButtonData), "uiHandleButtonData");
data->window= CTX_wm_window(C);
data->region= ar;
- data->interactive= but->type==BUT_CURVE?0:1; // XXX temp
+ if( ELEM(but->type, BUT_CURVE, SEARCH_MENU) ); // XXX curve is temp
+ else data->interactive= 1;
+
data->state = BUTTON_STATE_INIT;
/* activate button */
@@ -3035,12 +3114,14 @@ static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *b
/* if this button is in a menu, this will set the button return
* value to the button value and the menu return value to ok, the
* menu return value will be picked up and the menu will close */
- if(block->handle && !(block->flag & UI_BLOCK_KEEP_OPEN) && !data->cancel) {
- uiPopupBlockHandle *menu;
+ if(block->handle && !(block->flag & UI_BLOCK_KEEP_OPEN)) {
+ if(!data->cancel || data->escapecancel) {
+ uiPopupBlockHandle *menu;
- menu= block->handle;
- menu->butretval= data->retval;
- menu->menuretval= UI_RETURN_OK;
+ menu= block->handle;
+ menu->butretval= data->retval;
+ menu->menuretval= (data->cancel)? UI_RETURN_CANCEL: UI_RETURN_OK;
+ }
}
/* disable tooltips until mousemove */
@@ -3084,16 +3165,35 @@ void ui_button_active_cancel(const bContext *C, uiBut *but)
/************** handle activating a button *************/
+static uiBut *uit_but_find_open_event(ARegion *ar, wmEvent *event)
+{
+ uiBlock *block;
+ uiBut *but;
+
+ for(block=ar->uiblocks.first; block; block=block->next) {
+ for(but=block->buttons.first; but; but= but->next)
+ if(but==event->customdata)
+ return but;
+ }
+ return NULL;
+}
+
static int ui_handle_button_over(bContext *C, wmEvent *event, ARegion *ar)
{
uiBut *but;
if(event->type == MOUSEMOVE) {
but= ui_but_find_mouse_over(ar, event->x, event->y);
-
if(but)
button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER);
}
+ else if(event->type == EVT_BUT_OPEN) {
+ but= uit_but_find_open_event(ar, event);
+ if(but) {
+ button_activate_init(C, ar, but, BUTTON_ACTIVATE_OVER);
+ ui_do_button(C, but->block, but, event);
+ }
+ }
return WM_UI_HANDLER_CONTINUE;
}
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index 25a1dbe3d62..c6a93d8f74a 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -164,6 +164,7 @@ struct uiBut {
uiButHandleFunc func;
void *func_arg1;
void *func_arg2;
+ void *func_arg3;
uiButHandleNFunc funcN;
void *func_argN;
@@ -176,6 +177,9 @@ struct uiBut {
uiButCompleteFunc autocomplete_func;
void *autofunc_arg;
+ uiButSearchFunc search_func;
+ void *search_arg;
+
uiLink *link;
char *tip, *lockstr;
@@ -351,6 +355,13 @@ uiBlock *ui_block_func_COL(struct bContext *C, uiPopupBlockHandle *handle, void
struct ARegion *ui_tooltip_create(struct bContext *C, struct ARegion *butregion, uiBut *but);
void ui_tooltip_free(struct bContext *C, struct ARegion *ar);
+/* searchbox for string button */
+ARegion *ui_searchbox_create(struct bContext *C, struct ARegion *butregion, uiBut *but);
+void ui_searchbox_update(struct bContext *C, struct ARegion *ar, uiBut *but, int reset);
+void ui_searchbox_event(struct bContext *C, struct ARegion *ar, uiBut *but, struct wmEvent *event);
+void ui_searchbox_apply(uiBut *but, struct ARegion *ar);
+void ui_searchbox_free(struct bContext *C, struct ARegion *ar);
+
typedef uiBlock* (*uiBlockHandleCreateFunc)(struct bContext *C, struct uiPopupBlockHandle *handle, void *arg1);
uiPopupBlockHandle *ui_popup_block_create(struct bContext *C, struct ARegion *butregion, uiBut *but,
@@ -389,11 +400,15 @@ extern int ui_button_is_active(struct ARegion *ar);
/* interface_widgets.c */
void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y3);
void ui_draw_menu_back(struct uiStyle *style, uiBlock *block, rcti *rect);
+void ui_draw_search_back(struct uiStyle *style, uiBlock *block, rcti *rect);
+
extern void ui_draw_but(ARegion *ar, struct uiStyle *style, uiBut *but, rcti *rect);
/* theme color init */
struct ThemeUI;
void ui_widget_color_init(struct ThemeUI *tui);
+void ui_draw_menu_item(struct uiFontStyle *fstyle, rcti *rect, char *name, int state);
+
/* interface_style.c */
void uiStyleInit(void);
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 2e123c28339..8ef1cd32f22 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -115,6 +115,7 @@ typedef enum uiItemType {
typedef struct uiItem {
void *next, *prev;
uiItemType type;
+ int flag;
} uiItem;
typedef struct uiButtonItem {
@@ -130,7 +131,7 @@ struct uiLayout {
ListBase items;
int x, y, w, h;
- float scale;
+ float scale[2];
short space;
char align;
char active;
@@ -177,26 +178,29 @@ static char *ui_item_name_add_colon(char *name, char namestr[UI_MAX_NAME_STR])
return name;
}
-#define UI_FIT_EXPAND 1
-
-static int ui_item_fit(int item, int pos, int all, int available, int spacing, int last, int flag)
+static int ui_item_fit(int item, int pos, int all, int available, int last, int alignment, int *offset)
{
/* available == 0 is unlimited */
-
- if(available != 0 && all > available-spacing) {
+ if(available == 0)
+ return item;
+
+ if(offset)
+ *offset= 0;
+
+ if(all > available) {
/* contents is bigger than available space */
if(last)
return available-pos;
else
- return (item*(available-spacing))/all;
+ return (item*available)/all;
}
else {
/* contents is smaller or equal to available space */
- if(available != 0 && (flag & UI_FIT_EXPAND)) {
+ if(alignment == UI_LAYOUT_ALIGN_EXPAND) {
if(last)
return available-pos;
else
- return (item*(available-spacing))/all;
+ return (item*available)/all;
}
else
return item;
@@ -209,7 +213,7 @@ static int ui_item_fit(int item, int pos, int all, int available, int spacing, i
static int ui_layout_vary_direction(uiLayout *layout)
{
- return (layout->root->type == UI_LAYOUT_HEADER)? UI_ITEM_VARY_X: UI_ITEM_VARY_Y;
+ return (layout->root->type == UI_LAYOUT_HEADER || layout->alignment != UI_LAYOUT_ALIGN_EXPAND)? UI_ITEM_VARY_X: UI_ITEM_VARY_Y;
}
/* estimated size of text + icon */
@@ -220,9 +224,9 @@ static int ui_text_icon_width(uiLayout *layout, char *name, int icon)
if(icon && strcmp(name, "") == 0)
return UI_UNIT_X; /* icon only */
else if(icon)
- return (variable)? UI_GetStringWidth(name) + UI_UNIT_X: 10*UI_UNIT_X; /* icon + text */
+ return (variable)? UI_GetStringWidth(name) + 4 + UI_UNIT_X: 10*UI_UNIT_X; /* icon + text */
else
- return (variable)? UI_GetStringWidth(name) + UI_UNIT_X: 10*UI_UNIT_X; /* text only */
+ return (variable)? UI_GetStringWidth(name) + 4 + UI_UNIT_X: 10*UI_UNIT_X; /* text only */
}
static void ui_item_size(uiItem *item, int *r_w, int *r_h)
@@ -655,9 +659,6 @@ static void ui_item_rna_size(uiLayout *layout, char *name, int icon, PropertyRNA
subtype= RNA_property_subtype(prop);
len= RNA_property_array_length(prop);
- if(ELEM(type, PROP_STRING, PROP_ENUM))
- w += 10*UI_UNIT_X;
-
/* increase height for arrays */
if(index == RNA_NO_INDEX && len > 0) {
if(strcmp(name, "") == 0 && icon == 0)
@@ -1033,14 +1034,22 @@ static void ui_litem_estimate_row(uiLayout *litem)
}
}
+static int ui_litem_min_width(int itemw)
+{
+ return MIN2(UI_UNIT_X, itemw);
+}
+
static void ui_litem_layout_row(uiLayout *litem)
{
uiItem *item;
- int neww, itemw, itemh, x, y, w, tot= 0, totw= 0, extra=0, available=0;
+ int x, y, w, tot, totw, neww, itemw, minw, itemh, offset;
+ int fixedw, freew, fixedx, freex, flag= 0, lastw= 0;
x= litem->x;
y= litem->y;
w= litem->w;
+ totw= 0;
+ tot= 0;
for(item=litem->items.first; item; item=item->next) {
ui_item_size(item, &itemw, &itemh);
@@ -1051,40 +1060,81 @@ static void ui_litem_layout_row(uiLayout *litem)
if(totw == 0)
return;
- /* two step to enforce minimum button with .. could be better */
- for(item=litem->items.first; item; item=item->next) {
- ui_item_size(item, &itemw, &itemh);
+ if(w != 0)
+ w -= (tot-1)*litem->space;
+ fixedw= 0;
- itemw= ui_item_fit(itemw, x-litem->x, totw, w, (tot-1)*litem->space, !item->next, UI_FIT_EXPAND);
- x += itemw;
+ /* keep clamping items to fixed minimum size until all are done */
+ do {
+ freew= 0;
+ x= 0;
+ flag= 0;
- if(itemw < UI_UNIT_X)
- extra += UI_UNIT_X - itemw;
- else
- available += itemw - UI_UNIT_X;
+ for(item=litem->items.first; item; item=item->next) {
+ if(item->flag)
+ continue;
- if(item->next)
- x += litem->space;
- }
+ ui_item_size(item, &itemw, &itemh);
+ minw= ui_litem_min_width(itemw);
+
+ if(w - lastw > 0)
+ neww= ui_item_fit(itemw, x, totw, w-lastw, !item->next, litem->alignment, NULL);
+ else
+ neww= 0; /* no space left, all will need clamping to minimum size */
+ x += neww;
+
+ if(neww < minw && w != 0) {
+ /* fixed size */
+ item->flag= 1;
+ fixedw += minw;
+ flag= 1;
+ totw -= itemw;
+ }
+ else {
+ /* keep free size */
+ item->flag= 0;
+ freew += itemw;
+ }
+ }
+
+ lastw= fixedw;
+ } while(flag);
+
+ freex= 0;
+ fixedx= 0;
x= litem->x;
for(item=litem->items.first; item; item=item->next) {
ui_item_size(item, &itemw, &itemh);
+ minw= ui_litem_min_width(itemw);
- neww= ui_item_fit(itemw, x-litem->x, totw, w, (tot-1)*litem->space, !item->next, UI_FIT_EXPAND);
- if(neww < UI_UNIT_X) {
- if(item->next)
- itemw= UI_UNIT_X;
- else
- itemw= litem->w - (x-litem->x);
+ if(item->flag) {
+ /* fixed minimum size items */
+ itemw= ui_item_fit(minw, fixedx, fixedw, MIN2(w, fixedw), !item->next, litem->alignment, NULL);
+ fixedx += itemw;
+ }
+ else {
+ /* free size item */
+ itemw= ui_item_fit(itemw, freex, freew, w-fixedw, !item->next, litem->alignment, NULL);
+ freex += itemw;
}
- else
- itemw= ui_item_fit(itemw, x-litem->x, totw, w-extra, (tot-1)*litem->space, !item->next, UI_FIT_EXPAND);
- ui_item_position(item, x, y-itemh, itemw, itemh);
- x += itemw;
+ /* align right/center */
+ offset= 0;
+ if(litem->alignment == UI_LAYOUT_ALIGN_RIGHT) {
+ if(fixedw == 0 && freew < w-fixedw)
+ offset= (w - fixedw) - freew;
+ }
+ else if(litem->alignment == UI_LAYOUT_ALIGN_CENTER) {
+ if(fixedw == 0 && freew < w-fixedw)
+ offset= ((w - fixedw) - freew)/2;
+ }
+
+ /* position item */
+ ui_item_position(item, x+offset, y-itemh, itemw, itemh);
+ x += itemw;
if(item->next)
x += litem->space;
}
@@ -1263,7 +1313,7 @@ static void ui_litem_layout_column_flow(uiLayout *litem)
uiLayoutItemFlow *flow= (uiLayoutItemFlow*)litem;
uiItem *item;
int col, x, y, w, emh, emy, miny, itemw, itemh;
- int toth, totitem;
+ int toth, totitem, offset;
/* compute max needed width and total height */
toth= 0;
@@ -1280,18 +1330,18 @@ static void ui_litem_layout_column_flow(uiLayout *litem)
emy= 0;
miny= 0;
- w= litem->w;
+ w= litem->w - (flow->totcol-1)*style->columnspace;
emh= toth/flow->totcol;
/* create column per column */
col= 0;
for(item=litem->items.first; item; item=item->next) {
ui_item_size(item, NULL, &itemh);
- itemw= ui_item_fit(1, x-litem->x, flow->totcol, w, (flow->totcol-1)*style->columnspace, col == flow->totcol-1, UI_FIT_EXPAND);
+ itemw= ui_item_fit(1, x-litem->x, flow->totcol, w, col == flow->totcol-1, litem->alignment, &offset);
y -= itemh;
emy -= itemh;
- ui_item_position(item, x, y, itemw, itemh);
+ ui_item_position(item, x+offset, y, itemw, itemh);
y -= style->buttonspacey;
miny= MIN2(miny, y);
@@ -1578,9 +1628,14 @@ void uiLayoutSetAlignment(uiLayout *layout, int alignment)
layout->alignment= alignment;
}
-void uiLayoutSetScale(uiLayout *layout, float scale)
+void uiLayoutSetScaleX(uiLayout *layout, float scale)
{
- layout->scale= scale;
+ layout->scale[0]= scale;
+}
+
+void uiLayoutSetScaleY(uiLayout *layout, float scale)
+{
+ layout->scale[1]= scale;
}
int uiLayoutGetActive(uiLayout *layout)
@@ -1608,13 +1663,41 @@ int uiLayoutGetAlignment(uiLayout *layout)
return layout->alignment;
}
-float uiLayoutGetScale(uiLayout *layout)
+float uiLayoutGetScaleX(uiLayout *layout)
{
- return layout->scale;
+ return layout->scale[0];
+}
+
+float uiLayoutGetScaleY(uiLayout *layout)
+{
+ return layout->scale[0];
}
/********************** Layout *******************/
+static void ui_item_scale(uiLayout *litem, float scale[2])
+{
+ uiItem *item;
+ int x, y, w, h;
+
+ for(item=litem->items.last; item; item=item->prev) {
+ ui_item_size(item, &w, &h);
+ ui_item_offset(item, &x, &y);
+
+ if(scale[0] != 0.0f) {
+ x *= scale[0];
+ w *= scale[0];
+ }
+
+ if(scale[1] != 0.0f) {
+ y *= scale[1];
+ h *= scale[1];
+ }
+
+ ui_item_position(item, x, y, w, h);
+ }
+}
+
static void ui_item_estimate(uiItem *item)
{
uiItem *subitem;
@@ -1628,6 +1711,9 @@ static void ui_item_estimate(uiItem *item)
if(litem->items.first == NULL)
return;
+ if(litem->scale[0] != 0.0f || litem->scale[1] != 0.0f)
+ ui_item_scale(litem, litem->scale);
+
switch(litem->item.type) {
case ITEM_LAYOUT_COLUMN:
ui_litem_estimate_column(litem);
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 539f18c2cd8..a141e58fbe9 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -119,7 +119,7 @@ static int panels_re_align(ScrArea *sa, ARegion *ar, Panel **r_pa)
SpaceButs *sbuts= sa->spacedata.first;
if(sbuts->align)
- if(sbuts->re_align || sbuts->mainbo!=sbuts->mainb || sbuts->tabo!=sbuts->tab[sbuts->mainb])
+ if(sbuts->re_align || sbuts->mainbo!=sbuts->mainb)
return 1;
}
else if(ar->regiontype==RGN_TYPE_UI)
diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c
index 0109612fdc0..8ea686dfbd6 100644
--- a/source/blender/editors/interface/interface_regions.c
+++ b/source/blender/editors/interface/interface_regions.c
@@ -56,6 +56,7 @@
#include "BIF_gl.h"
#include "UI_interface.h"
+#include "UI_interface_icons.h"
#include "UI_view2d.h"
#include "BLF_api.h"
@@ -383,6 +384,358 @@ void ui_tooltip_free(bContext *C, ARegion *ar)
ui_remove_temporary_region(C, CTX_wm_screen(C), ar);
}
+
+/************************* Creating Search Box **********************/
+
+struct uiSearchItems {
+ int maxitem, totitem, maxstrlen;
+
+ int offset, offset_i; /* offset for inserting in array */
+ int more; /* flag indicating there are more items */
+
+ char **names;
+ void **pointers;
+
+};
+
+typedef struct uiSearchboxData {
+ rcti bbox;
+ uiFontStyle fstyle;
+ uiSearchItems items;
+ int active; /* index in items array */
+ int noback; /* when menu opened with enough space for this */
+} uiSearchboxData;
+
+#define SEARCH_ITEMS 10
+
+/* exported for use by search callbacks */
+/* returns zero if nothing to add */
+int uiSearchItemAdd(uiSearchItems *items, const char *name, void *poin)
+{
+
+ if(items->totitem>=items->maxitem) {
+ items->more= 1;
+ return 0;
+ }
+
+ /* skip first items in list */
+ if(items->offset_i > 0) {
+ items->offset_i--;
+ return 1;
+ }
+
+ BLI_strncpy(items->names[items->totitem], name, items->maxstrlen);
+ items->pointers[items->totitem]= poin;
+
+ items->totitem++;
+
+ return 1;
+}
+
+int uiSearchBoxhHeight(void)
+{
+ return SEARCH_ITEMS*MENU_BUTTON_HEIGHT + 2*MENU_TOP;
+}
+
+/* ar is the search box itself */
+static void ui_searchbox_select(bContext *C, ARegion *ar, uiBut *but, int step)
+{
+ uiSearchboxData *data= ar->regiondata;
+
+ /* apply step */
+ data->active+= step;
+
+ if(data->items.totitem==0)
+ data->active= 0;
+ else if(data->active > data->items.totitem) {
+ if(data->items.more) {
+ data->items.offset++;
+ data->active= data->items.totitem;
+ ui_searchbox_update(C, ar, but, 0);
+ }
+ else
+ data->active= data->items.totitem;
+ }
+ else if(data->active < 1) {
+ if(data->items.offset) {
+ data->items.offset--;
+ data->active= 1;
+ ui_searchbox_update(C, ar, but, 0);
+ }
+ else if(data->active < 0)
+ data->active= 0;
+ }
+
+ ED_region_tag_redraw(ar);
+}
+
+static void ui_searchbox_butrect(rcti *rect, uiSearchboxData *data, int itemnr)
+{
+ int buth= (data->bbox.ymax-data->bbox.ymin - 2*MENU_TOP)/SEARCH_ITEMS;
+
+ *rect= data->bbox;
+ rect->xmin= data->bbox.xmin + 3.0f;
+ rect->xmax= data->bbox.xmax - 3.0f;
+
+ rect->ymax= data->bbox.ymax - MENU_TOP - itemnr*buth;
+ rect->ymin= rect->ymax - buth;
+
+}
+
+/* string validated to be of correct length (but->hardmax) */
+void ui_searchbox_apply(uiBut *but, ARegion *ar)
+{
+ uiSearchboxData *data= ar->regiondata;
+
+ but->func_arg2= NULL;
+
+ if(data->active) {
+ char *name= data->items.names[data->active-1];
+ char *cpoin= strchr(name, '|');
+
+ if(cpoin) cpoin[0]= 0;
+ BLI_strncpy(but->editstr, name, data->items.maxstrlen);
+ if(cpoin) cpoin[0]= '|';
+
+ but->func_arg2= data->items.pointers[data->active-1];
+ }
+}
+
+void ui_searchbox_event(bContext *C, ARegion *ar, uiBut *but, wmEvent *event)
+{
+ uiSearchboxData *data= ar->regiondata;
+
+ switch(event->type) {
+ case UPARROWKEY:
+ ui_searchbox_select(C, ar, but, -1);
+ break;
+ case DOWNARROWKEY:
+ ui_searchbox_select(C, ar, but, 1);
+ break;
+ case MOUSEMOVE:
+ if(BLI_in_rcti(&ar->winrct, event->x, event->y)) {
+ rcti rect;
+ int a;
+
+ for(a=0; a<data->items.totitem; a++) {
+ ui_searchbox_butrect(&rect, data, a);
+ if(BLI_in_rcti(&rect, event->x - ar->winrct.xmin, event->y - ar->winrct.ymin)) {
+ if( data->active!= a+1) {
+ data->active= a+1;
+ ui_searchbox_select(C, ar, but, 0);
+ break;
+ }
+ }
+ }
+ }
+ break;
+ }
+}
+
+/* ar is the search box itself */
+void ui_searchbox_update(bContext *C, ARegion *ar, uiBut *but, int reset)
+{
+ uiSearchboxData *data= ar->regiondata;
+
+ /* reset vars */
+ data->items.totitem= 0;
+ data->items.more= 0;
+ if(reset==0)
+ data->items.offset_i= data->items.offset;
+ else {
+ data->items.offset_i= data->items.offset= 0;
+ data->active= 0;
+ }
+
+ /* callback */
+ if(but->search_func)
+ but->search_func(C, but->search_arg, but->editstr, &data->items);
+
+ if(reset) {
+ int a;
+ /* handle case where editstr is equal to one of items */
+ for(a=0; a<data->items.totitem; a++) {
+ char *cpoin= strchr(data->items.names[a], '|');
+
+ if(cpoin) cpoin[0]= 0;
+ if(0==strcmp(but->editstr, data->items.names[a]))
+ data->active= a+1;
+ if(cpoin) cpoin[0]= '|';
+ }
+ }
+
+ /* validate selected item */
+ ui_searchbox_select(C, ar, but, 0);
+
+ ED_region_tag_redraw(ar);
+}
+
+static void ui_searchbox_region_draw(const bContext *C, ARegion *ar)
+{
+ uiSearchboxData *data= ar->regiondata;
+
+ /* pixel space */
+ wmOrtho2(-0.01f, ar->winx-0.01f, -0.01f, ar->winy-0.01f);
+
+ if(!data->noback)
+ ui_draw_search_back(U.uistyles.first, NULL, &data->bbox);
+
+ /* draw text */
+ if(data->items.totitem) {
+ rcti rect;
+ int a;
+
+ /* draw items */
+ for(a=0; a<data->items.totitem; a++) {
+ ui_searchbox_butrect(&rect, data, a);
+
+ ui_draw_menu_item(&data->fstyle, &rect, data->items.names[a], (a+1)==data->active?UI_ACTIVE:0);
+
+ }
+ /* indicate more */
+ if(data->items.more) {
+ glEnable(GL_BLEND);
+ UI_icon_draw((data->bbox.xmax-data->bbox.xmin)/2, 8, ICON_TRIA_DOWN);
+ glDisable(GL_BLEND);
+ }
+ if(data->items.offset) {
+ glEnable(GL_BLEND);
+ UI_icon_draw((data->bbox.xmax-data->bbox.xmin)/2, data->bbox.ymax-13, ICON_TRIA_UP);
+ glDisable(GL_BLEND);
+ }
+ }
+}
+
+static void ui_searchbox_region_free(ARegion *ar)
+{
+ uiSearchboxData *data= ar->regiondata;
+ int a;
+
+ /* free search data */
+ for(a=0; a<SEARCH_ITEMS; a++)
+ MEM_freeN(data->items.names[a]);
+ MEM_freeN(data->items.names);
+ MEM_freeN(data->items.pointers);
+
+ MEM_freeN(data);
+ ar->regiondata= NULL;
+}
+
+ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but)
+{
+ uiStyle *style= U.uistyles.first; // XXX pass on as arg
+ static ARegionType type;
+ ARegion *ar;
+ uiSearchboxData *data;
+ float aspect= but->block->aspect;
+ float x1f, x2f, y1f, y2f;
+ int x1, x2, y1, y2, winx, winy, ofsx, ofsy;
+
+ /* create area region */
+ ar= ui_add_temporary_region(CTX_wm_screen(C));
+
+ memset(&type, 0, sizeof(ARegionType));
+ type.draw= ui_searchbox_region_draw;
+ type.free= ui_searchbox_region_free;
+ ar->type= &type;
+
+ /* create searchbox data */
+ data= MEM_callocN(sizeof(uiSearchboxData), "uiSearchboxData");
+
+ /* set font, get bb */
+ data->fstyle= style->widget; /* copy struct */
+ data->fstyle.align= UI_STYLE_TEXT_CENTER;
+ ui_fontscale(&data->fstyle.points, aspect);
+ uiStyleFontSet(&data->fstyle);
+
+ ar->regiondata= data;
+
+ /* special case, hardcoded feature, not draw backdrop when called from menus,
+ assume for design that popup already added it */
+ if(but->block->flag & UI_BLOCK_LOOP)
+ data->noback= 1;
+
+ /* compute position */
+ ofsx= (but->block->panel)? but->block->panel->ofsx: 0;
+ ofsy= (but->block->panel)? but->block->panel->ofsy: 0;
+
+ x1f= but->x1 - 5; /* align text with button */
+ x2f= but->x2 + 5; /* symmetrical */
+ y2f= but->y1;
+ y1f= y2f - uiSearchBoxhHeight();
+
+ /* minimal width */
+ if(x2f - x1f < 180) x2f= x1f+180; // XXX arbitrary
+
+ /* copy to int, gets projected if possible too */
+ x1= x1f; y1= y1f; x2= x2f; y2= y2f;
+
+ if(butregion) {
+ if(butregion->v2d.cur.xmin != butregion->v2d.cur.xmax) {
+ UI_view2d_to_region_no_clip(&butregion->v2d, x1f, y1f, &x1, &y1);
+ UI_view2d_to_region_no_clip(&butregion->v2d, x2f, y2f, &x2, &y2);
+ }
+
+ x1 += butregion->winrct.xmin;
+ x2 += butregion->winrct.xmin;
+ y1 += butregion->winrct.ymin;
+ y2 += butregion->winrct.ymin;
+ }
+
+ wm_window_get_size(CTX_wm_window(C), &winx, &winy);
+
+ if(x2 > winx) {
+ /* super size */
+ if(x2 > winx + x1) {
+ x2= winx;
+ x1= 0;
+ }
+ else {
+ x1 -= x2-winx;
+ x2= winx;
+ }
+ }
+ if(y1 < 0) {
+ y1 += 36;
+ y2 += 36;
+ }
+
+ /* widget rect, in region coords */
+ data->bbox.xmin= MENU_SHADOW_SIDE;
+ data->bbox.xmax= x2-x1 + MENU_SHADOW_SIDE;
+ data->bbox.ymin= MENU_SHADOW_BOTTOM;
+ data->bbox.ymax= y2-y1 + MENU_SHADOW_BOTTOM;
+
+ /* region bigger for shadow */
+ ar->winrct.xmin= x1 - MENU_SHADOW_SIDE;
+ ar->winrct.xmax= x2 + MENU_SHADOW_SIDE;
+ ar->winrct.ymin= y1 - MENU_SHADOW_BOTTOM;
+ ar->winrct.ymax= y2;
+
+ /* adds subwindow */
+ ED_region_init(C, ar);
+
+ /* notify change and redraw */
+ ED_region_tag_redraw(ar);
+
+ /* prepare search data */
+ data->items.maxitem= SEARCH_ITEMS;
+ data->items.maxstrlen= but->hardmax;
+ data->items.totitem= 0;
+ data->items.names= MEM_callocN(SEARCH_ITEMS*sizeof(void *), "search names");
+ data->items.pointers= MEM_callocN(SEARCH_ITEMS*sizeof(void *), "search pointers");
+ for(x1=0; x1<SEARCH_ITEMS; x1++)
+ data->items.names[x1]= MEM_callocN(but->hardmax+1, "search pointers");
+
+ return ar;
+}
+
+void ui_searchbox_free(bContext *C, ARegion *ar)
+{
+ ui_remove_temporary_region(C, CTX_wm_screen(C), ar);
+}
+
+
/************************* Creating Menu Blocks **********************/
/* position block relative to but, result is in window space */
@@ -703,8 +1056,6 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut
/* get winmat now that we actually have the subwindow */
wmSubWindowSet(window, ar->swinid);
- // XXX ton, AA pixel space...
- wmOrtho2(0.0, (float)ar->winrct.xmax-ar->winrct.xmin+1, 0.0, (float)ar->winrct.ymax-ar->winrct.ymin+1);
wm_subwindow_getmatrix(window, ar->swinid, block->winmat);
@@ -716,7 +1067,9 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C, ARegion *butregion, uiBut
void ui_popup_block_free(bContext *C, uiPopupBlockHandle *handle)
{
- ui_remove_temporary_region(C, CTX_wm_screen(C), handle->region);
+ /* XXX ton added, chrash on load file with popup open... need investigate */
+ if(CTX_wm_screen(C))
+ ui_remove_temporary_region(C, CTX_wm_screen(C), handle->region);
MEM_freeN(handle);
}
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index fca88132771..62a4c01bc6c 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -170,7 +170,7 @@ void uiStyleFontDraw(uiFontStyle *fs, rcti *rect, char *str)
if(fs->align==UI_STYLE_TEXT_CENTER)
xofs= floor( 0.5f*(rect->xmax - rect->xmin - BLF_width(str)));
else if(fs->align==UI_STYLE_TEXT_RIGHT)
- xofs= rect->xmax - rect->xmin - BLF_width(str);
+ xofs= rect->xmax - rect->xmin - BLF_width(str) - 1;
/* clip is very strict, so we give it some space */
BLF_clipping(rect->xmin-1, rect->ymin-4, rect->xmax+1, rect->ymax+4);
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 987b7eef4d6..12954fe77c0 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -240,33 +240,16 @@ void uiTemplateHeaderID(uiLayout *layout, bContext *C, PointerRNA *ptr, char *pr
#define ERROR_LIBDATA_MESSAGE "Can't edit external libdata"
-#define B_NOP 0
-#define B_MODIFIER_RECALC 1
-#define B_MODIFIER_REDRAW 2
-#define B_CHANGEDEP 3
-#define B_ARM_RECALCDATA 4
-
#include <string.h>
-#include "DNA_armature_types.h"
-#include "DNA_curve_types.h"
#include "DNA_object_force.h"
#include "DNA_object_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
-#include "DNA_particle_types.h"
#include "DNA_scene_types.h"
-#include "BKE_bmesh.h"
-#include "BKE_curve.h"
#include "BKE_depsgraph.h"
#include "BKE_DerivedMesh.h"
-#include "BKE_displist.h"
#include "BKE_global.h"
-#include "BKE_lattice.h"
-#include "BKE_main.h"
-#include "BKE_mesh.h"
#include "BKE_modifier.h"
#include "BKE_object.h"
#include "BKE_particle.h"
@@ -280,33 +263,20 @@ void uiTemplateHeaderID(uiLayout *layout, bContext *C, PointerRNA *ptr, char *pr
#include "ED_object.h"
-void do_modifier_panels(bContext *C, void *arg, int event)
+static void modifiers_del(bContext *C, void *ob_v, void *md_v)
{
Scene *scene= CTX_data_scene(C);
- Object *ob = CTX_data_active_object(C);
+ Object *ob= ob_v;
+ ReportList reports;
- switch(event) {
- case B_MODIFIER_REDRAW:
- WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
- break;
+ BKE_reports_init(&reports, RPT_STORE);
- case B_MODIFIER_RECALC:
+ if(ED_object_modifier_delete(&reports, ob_v, md_v)) {
WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
- object_handle_update(scene, ob);
- // XXX countall();
- break;
- }
-}
-
-static void modifiers_del(bContext *C, void *ob_v, void *md_v)
-{
- ReportList reports;
- BKE_reports_init(&reports, RPT_STORE);
-
- if(ED_object_modifier_delete(&reports, ob_v, md_v))
ED_undo_push(C, "Delete modifier");
+ }
else
uiPupMenuReports(C, &reports);
@@ -315,12 +285,18 @@ static void modifiers_del(bContext *C, void *ob_v, void *md_v)
static void modifiers_moveUp(bContext *C, void *ob_v, void *md_v)
{
+ Scene *scene= CTX_data_scene(C);
+ Object *ob= ob_v;
ReportList reports;
BKE_reports_init(&reports, RPT_STORE);
- if(ED_object_modifier_move_up(&reports, ob_v, md_v))
+ if(ED_object_modifier_move_up(&reports, ob_v, md_v)) {
+ WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+
ED_undo_push(C, "Move modifier");
+ }
else
uiPupMenuReports(C, &reports);
@@ -329,12 +305,18 @@ static void modifiers_moveUp(bContext *C, void *ob_v, void *md_v)
static void modifiers_moveDown(bContext *C, void *ob_v, void *md_v)
{
+ Scene *scene= CTX_data_scene(C);
+ Object *ob= ob_v;
ReportList reports;
BKE_reports_init(&reports, RPT_STORE);
- if(ED_object_modifier_move_down(&reports, ob_v, md_v))
+ if(ED_object_modifier_move_down(&reports, ob_v, md_v)) {
+ WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+
ED_undo_push(C, "Move modifier");
+ }
else
uiPupMenuReports(C, &reports);
@@ -344,12 +326,17 @@ static void modifiers_moveDown(bContext *C, void *ob_v, void *md_v)
static void modifiers_convertParticles(bContext *C, void *obv, void *mdv)
{
Scene *scene= CTX_data_scene(C);
+ Object *ob= obv;
ReportList reports;
BKE_reports_init(&reports, RPT_STORE);
- if(ED_object_modifier_convert(&reports, scene, obv, mdv))
+ if(ED_object_modifier_convert(&reports, scene, obv, mdv)) {
+ WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+
ED_undo_push(C, "Convert particles to mesh object(s).");
+ }
else
uiPupMenuReports(C, &reports);
@@ -359,12 +346,17 @@ static void modifiers_convertParticles(bContext *C, void *obv, void *mdv)
static void modifiers_applyModifier(bContext *C, void *obv, void *mdv)
{
Scene *scene= CTX_data_scene(C);
+ Object *ob= obv;
ReportList reports;
BKE_reports_init(&reports, RPT_STORE);
- if(ED_object_modifier_apply(&reports, scene, obv, mdv))
+ if(ED_object_modifier_apply(&reports, scene, obv, mdv)) {
+ WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+
ED_undo_push(C, "Apply modifier");
+ }
else
uiPupMenuReports(C, &reports);
@@ -373,12 +365,17 @@ static void modifiers_applyModifier(bContext *C, void *obv, void *mdv)
static void modifiers_copyModifier(bContext *C, void *ob_v, void *md_v)
{
+ Scene *scene= CTX_data_scene(C);
+ Object *ob= ob_v;
ReportList reports;
BKE_reports_init(&reports, RPT_STORE);
- if(ED_object_modifier_copy(&reports, ob_v, md_v))
+ if(ED_object_modifier_copy(&reports, ob_v, md_v)) {
+ WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
ED_undo_push(C, "Copy modifier");
+ }
else
uiPupMenuReports(C, &reports);
@@ -387,21 +384,27 @@ static void modifiers_copyModifier(bContext *C, void *ob_v, void *md_v)
static void modifiers_setOnCage(bContext *C, void *ob_v, void *md_v)
{
+ Scene *scene= CTX_data_scene(C);
Object *ob = ob_v;
ModifierData *md;
int i, cageIndex = modifiers_getCageIndex(ob, NULL );
- for( i = 0, md=ob->modifiers.first; md; ++i, md=md->next )
- if( md == md_v ) {
- if( i >= cageIndex )
+ for(i = 0, md=ob->modifiers.first; md; ++i, md=md->next) {
+ if(md == md_v) {
+ if(i >= cageIndex)
md->mode ^= eModifierMode_OnCage;
break;
}
+ }
+
+ WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
}
static void modifiers_convertToReal(bContext *C, void *ob_v, void *md_v)
{
+ Scene *scene= CTX_data_scene(C);
Object *ob = ob_v;
ModifierData *md = md_v;
ModifierData *nmd = modifier_new(md->type);
@@ -413,169 +416,56 @@ static void modifiers_convertToReal(bContext *C, void *ob_v, void *md_v)
ob->partype = PAROBJECT;
- ED_undo_push(C, "Modifier convert to real");
-}
-
-#if 0
-static void modifiers_clearHookOffset(bContext *C, void *ob_v, void *md_v)
-{
- Object *ob = ob_v;
- ModifierData *md = md_v;
- HookModifierData *hmd = (HookModifierData*) md;
-
- if (hmd->object) {
- Mat4Invert(hmd->object->imat, hmd->object->obmat);
- Mat4MulSerie(hmd->parentinv, hmd->object->imat, ob->obmat, NULL, NULL, NULL, NULL, NULL, NULL);
- ED_undo_push(C, "Clear hook offset");
- }
-}
-
-static void modifiers_cursorHookCenter(bContext *C, void *ob_v, void *md_v)
-{
- /* XXX
- Object *ob = ob_v;
- ModifierData *md = md_v;
- HookModifierData *hmd = (HookModifierData*) md;
-
- if(G.vd) {
- float *curs = give_cursor();
- float bmat[3][3], imat[3][3];
-
- where_is_object(ob);
-
- Mat3CpyMat4(bmat, ob->obmat);
- Mat3Inv(imat, bmat);
-
- curs= give_cursor();
- hmd->cent[0]= curs[0]-ob->obmat[3][0];
- hmd->cent[1]= curs[1]-ob->obmat[3][1];
- hmd->cent[2]= curs[2]-ob->obmat[3][2];
- Mat3MulVecfl(imat, hmd->cent);
-
- ED_undo_push(C, "Hook cursor center");
- }*/
-}
-
-static void modifiers_selectHook(bContext *C, void *ob_v, void *md_v)
-{
- /* XXX ModifierData *md = md_v;
- HookModifierData *hmd = (HookModifierData*) md;
-
- hook_select(hmd);*/
-}
-
-static void modifiers_reassignHook(bContext *C, void *ob_v, void *md_v)
-{
- /* XXX ModifierData *md = md_v;
- HookModifierData *hmd = (HookModifierData*) md;
- float cent[3];
- int *indexar, tot, ok;
- char name[32];
-
- ok= hook_getIndexArray(&tot, &indexar, name, cent);
-
- if (!ok) {
- uiPupMenuError(C, "Requires selected vertices or active Vertex Group");
- } else {
- if (hmd->indexar) {
- MEM_freeN(hmd->indexar);
- }
-
- VECCOPY(hmd->cent, cent);
- hmd->indexar = indexar;
- hmd->totindex = tot;
- }*/
-}
+ WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob);
+ DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
-static void modifiers_bindMeshDeform(bContext *C, void *ob_v, void *md_v)
-{
- Scene *scene= CTX_data_scene(C);
- MeshDeformModifierData *mmd = (MeshDeformModifierData*) md_v;
- Object *ob = (Object*)ob_v;
-
- if(mmd->bindcos) {
- if(mmd->bindweights) MEM_freeN(mmd->bindweights);
- if(mmd->bindcos) MEM_freeN(mmd->bindcos);
- if(mmd->dyngrid) MEM_freeN(mmd->dyngrid);
- if(mmd->dyninfluences) MEM_freeN(mmd->dyninfluences);
- if(mmd->dynverts) MEM_freeN(mmd->dynverts);
- mmd->bindweights= NULL;
- mmd->bindcos= NULL;
- mmd->dyngrid= NULL;
- mmd->dyninfluences= NULL;
- mmd->dynverts= NULL;
- mmd->totvert= 0;
- mmd->totcagevert= 0;
- mmd->totinfluence= 0;
- }
- else {
- DerivedMesh *dm;
- int mode= mmd->modifier.mode;
-
- /* force modifier to run, it will call binding routine */
- mmd->needbind= 1;
- mmd->modifier.mode |= eModifierMode_Realtime;
-
- if(ob->type == OB_MESH) {
- dm= mesh_create_derived_view(scene, ob, 0);
- dm->release(dm);
- }
- else if(ob->type == OB_LATTICE) {
- lattice_calc_modifiers(scene, ob);
- }
- else if(ob->type==OB_MBALL) {
- makeDispListMBall(scene, ob);
- }
- else if(ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
- makeDispListCurveTypes(scene, ob, 0);
- }
-
- mmd->needbind= 0;
- mmd->modifier.mode= mode;
- }
-}
-
-void modifiers_explodeFacepa(bContext *C, void *arg1, void *arg2)
-{
- ExplodeModifierData *emd=arg1;
-
- emd->flag |= eExplodeFlag_CalcFaces;
-}
-
-void modifiers_explodeDelVg(bContext *C, void *arg1, void *arg2)
-{
- ExplodeModifierData *emd=arg1;
- emd->vgroup = 0;
+ ED_undo_push(C, "Modifier convert to real");
}
-#endif
-static int modifier_is_fluid_particles(ModifierData *md)
+static int modifier_can_delete(ModifierData *md)
{
- if(md->type == eModifierType_ParticleSystem) {
+ // deletion over the deflection panel
+ // fluid particle modifier can't be deleted here
+
+ if(md->type==eModifierType_Fluidsim)
+ return 0;
+ if(md->type==eModifierType_Collision)
+ return 0;
+ if(md->type==eModifierType_Surface)
+ return 0;
+ if(md->type == eModifierType_ParticleSystem)
if(((ParticleSystemModifierData *)md)->psys->part->type == PART_FLUID)
- return 1;
- }
- return 0;
+ return 0;
+
+ return 1;
}
static uiLayout *draw_modifier(uiLayout *layout, Object *ob, ModifierData *md, int index, int cageIndex, int lastCageIndex)
{
ModifierTypeInfo *mti = modifierType_getInfo(md->type);
+ PointerRNA ptr;
uiBut *but;
uiBlock *block;
- uiLayout *column, *row, *result= NULL;
+ uiLayout *column, *row, *subrow, *result= NULL;
int isVirtual = md->mode&eModifierMode_Virtual;
- int x = 0, y = 0; // XXX , color = md->error?TH_REDALERT:TH_BUT_NEUTRAL;
+ // XXX short color = md->error?TH_REDALERT:TH_BUT_NEUTRAL;
short width = 295, buttonWidth = width-120-10;
char str[128];
+ RNA_pointer_create(&ob->id, &RNA_Modifier, md, &ptr);
+
column= uiLayoutColumn(layout, 1);
+ uiLayoutSetContextPointer(column, "modifier", &ptr);
/* rounded header */
/* XXX uiBlockSetCol(block, color); */
/* roundbox 4 free variables: corner-rounding, nop, roundbox type, shade */
- block= uiLayoutFreeBlock(uiLayoutBox(column));
- uiBlockSetHandleFunc(block, do_modifier_panels, NULL);
+
+ row= uiLayoutRow(uiLayoutBox(column), 0);
+ block= uiLayoutGetBlock(row);
+
+ subrow= uiLayoutRow(row, 0);
+ uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_LEFT);
//uiDefBut(block, ROUNDBOX, 0, "", x-10, y-4, width, 25, NULL, 7.0, 0.0,
// (!isVirtual && (md->mode&eModifierMode_Expanded))?3:15, 20, "");
@@ -584,27 +474,27 @@ static uiLayout *draw_modifier(uiLayout *layout, Object *ob, ModifierData *md, i
/* open/close icon */
if (!isVirtual) {
uiBlockSetEmboss(block, UI_EMBOSSN);
- uiDefIconButBitI(block, ICONTOG, eModifierMode_Expanded, B_MODIFIER_REDRAW, ICON_TRIA_RIGHT, x-10, y-2, 20, 20, &md->mode, 0.0, 0.0, 0.0, 0.0, "Collapse/Expand Modifier");
+ uiDefIconButBitI(block, ICONTOG, eModifierMode_Expanded, 0, ICON_TRIA_RIGHT, 0, 0, UI_UNIT_X, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0, "Collapse/Expand Modifier");
}
uiBlockSetEmboss(block, UI_EMBOSS);
if (isVirtual) {
sprintf(str, "%s parent deform", md->name);
- uiDefBut(block, LABEL, 0, str, x+10, y-1, width-110, 19, NULL, 0.0, 0.0, 0.0, 0.0, "Modifier name");
+ uiDefBut(block, LABEL, 0, str, 0, 0, 185, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Modifier name");
- but = uiDefBut(block, BUT, B_MODIFIER_RECALC, "Make Real", x+width-100, y, 80, 16, NULL, 0.0, 0.0, 0.0, 0.0, "Convert virtual modifier to a real modifier");
+ but = uiDefBut(block, BUT, 0, "Make Real", 0, 0, 80, 16, NULL, 0.0, 0.0, 0.0, 0.0, "Convert virtual modifier to a real modifier");
uiButSetFunc(but, modifiers_convertToReal, ob, md);
} else {
uiBlockBeginAlign(block);
- uiDefBut(block, TEX, B_MODIFIER_REDRAW, "", x+10, y-1, buttonWidth-60, 19, md->name, 0.0, sizeof(md->name)-1, 0.0, 0.0, "Modifier name");
+ uiDefBut(block, TEX, 0, "", 0, 0, buttonWidth-60, UI_UNIT_Y, md->name, 0.0, sizeof(md->name)-1, 0.0, 0.0, "Modifier name");
/* Softbody not allowed in this situation, enforce! */
if (((md->type!=eModifierType_Softbody && md->type!=eModifierType_Collision) || !(ob->pd && ob->pd->deflect)) && (md->type!=eModifierType_Surface)) {
- uiDefIconButBitI(block, TOG, eModifierMode_Render, B_MODIFIER_RECALC, ICON_SCENE, x+10+buttonWidth-60, y-1, 19, 19,&md->mode, 0, 0, 1, 0, "Enable modifier during rendering");
- but= uiDefIconButBitI(block, TOG, eModifierMode_Realtime, B_MODIFIER_RECALC, ICON_VIEW3D, x+10+buttonWidth-40, y-1, 19, 19,&md->mode, 0, 0, 1, 0, "Enable modifier during interactive display");
+ uiDefIconButBitI(block, TOG, eModifierMode_Render, 0, ICON_SCENE, 0, 0, 19, UI_UNIT_Y,&md->mode, 0, 0, 1, 0, "Enable modifier during rendering");
+ but= uiDefIconButBitI(block, TOG, eModifierMode_Realtime, 0, ICON_VIEW3D, 0, 0, 19, UI_UNIT_Y,&md->mode, 0, 0, 1, 0, "Enable modifier during interactive display");
if (mti->flags&eModifierTypeFlag_SupportsEditmode) {
- uiDefIconButBitI(block, TOG, eModifierMode_Editmode, B_MODIFIER_RECALC, ICON_EDITMODE_HLT, x+10+buttonWidth-20, y-1, 19, 19,&md->mode, 0, 0, 1, 0, "Enable modifier during Editmode (only if enabled for display)");
+ uiDefIconButBitI(block, TOG, eModifierMode_Editmode, 0, ICON_EDITMODE_HLT, 0, 0, 19, UI_UNIT_Y,&md->mode, 0, 0, 1, 0, "Enable modifier during Editmode (only if enabled for display)");
}
}
uiBlockEndAlign(block);
@@ -625,26 +515,28 @@ static uiLayout *draw_modifier(uiLayout *layout, Object *ob, ModifierData *md, i
icon = ICON_BLANK1;
}
/* XXX uiBlockSetCol(block, color); */
- but = uiDefIconBut(block, BUT, B_MODIFIER_RECALC, icon, x+width-105, y, 16, 16, NULL, 0.0, 0.0, 0.0, 0.0, "Apply modifier to editing cage during Editmode");
+ but = uiDefIconBut(block, BUT, 0, icon, 0, 0, 16, 16, NULL, 0.0, 0.0, 0.0, 0.0, "Apply modifier to editing cage during Editmode");
uiButSetFunc(but, modifiers_setOnCage, ob, md);
/* XXX uiBlockSetCol(block, TH_AUTO); */
}
+ }
+
+ subrow= uiLayoutRow(row, 0);
+ uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_RIGHT);
+ if(!isVirtual) {
/* XXX uiBlockSetCol(block, TH_BUT_ACTION); */
- but = uiDefIconBut(block, BUT, B_MODIFIER_RECALC, VICON_MOVE_UP, x+width-75, y, 16, 16, NULL, 0.0, 0.0, 0.0, 0.0, "Move modifier up in stack");
+ but = uiDefIconBut(block, BUT, 0, VICON_MOVE_UP, 0, 0, 16, 16, NULL, 0.0, 0.0, 0.0, 0.0, "Move modifier up in stack");
uiButSetFunc(but, modifiers_moveUp, ob, md);
- but = uiDefIconBut(block, BUT, B_MODIFIER_RECALC, VICON_MOVE_DOWN, x+width-75+20, y, 16, 16, NULL, 0.0, 0.0, 0.0, 0.0, "Move modifier down in stack");
+ but = uiDefIconBut(block, BUT, 0, VICON_MOVE_DOWN, 0, 0, 16, 16, NULL, 0.0, 0.0, 0.0, 0.0, "Move modifier down in stack");
uiButSetFunc(but, modifiers_moveDown, ob, md);
uiBlockSetEmboss(block, UI_EMBOSSN);
- // deletion over the deflection panel
- // fluid particle modifier can't be deleted here
- if(md->type!=eModifierType_Fluidsim && md->type!=eModifierType_Collision && md->type!=eModifierType_Surface && !modifier_is_fluid_particles(md))
- {
- but = uiDefIconBut(block, BUT, B_MODIFIER_RECALC, VICON_X, x+width-70+40, y, 16, 16, NULL, 0.0, 0.0, 0.0, 0.0, "Delete modifier");
+ if(modifier_can_delete(md)) {
+ but = uiDefIconBut(block, BUT, 0, VICON_X, 0, 0, 16, 16, NULL, 0.0, 0.0, 0.0, 0.0, "Delete modifier");
uiButSetFunc(but, modifiers_del, ob, md);
}
/* XXX uiBlockSetCol(block, TH_AUTO); */
@@ -653,15 +545,11 @@ static uiLayout *draw_modifier(uiLayout *layout, Object *ob, ModifierData *md, i
uiBlockSetEmboss(block, UI_EMBOSS);
if(!isVirtual && (md->mode&eModifierMode_Expanded)) {
- int cy = y - 8;
- int lx = x + width - 60 - 15;
uiLayout *box;
box= uiLayoutBox(column);
row= uiLayoutRow(box, 1);
- y -= 18;
-
if (!isVirtual && (md->type!=eModifierType_Collision) && (md->type!=eModifierType_Surface)) {
uiBlockSetButLock(block, object_data_is_libdata(ob), ERROR_LIBDATA_MESSAGE); /* only here obdata, the rest of modifiers is ob level */
@@ -670,13 +558,13 @@ static uiLayout *draw_modifier(uiLayout *layout, Object *ob, ModifierData *md, i
if(!(G.f & G_PARTICLEEDIT)) {
if(ELEM3(psys->part->draw_as, PART_DRAW_PATH, PART_DRAW_GR, PART_DRAW_OB) && psys->pathcache) {
- but = uiDefBut(block, BUT, B_MODIFIER_RECALC, "Convert", lx,(cy-=19),60,19, 0, 0, 0, 0, 0, "Convert the current particles to a mesh object");
+ but = uiDefBut(block, BUT, 0, "Convert", 0,0,60,19, 0, 0, 0, 0, 0, "Convert the current particles to a mesh object");
uiButSetFunc(but, modifiers_convertParticles, ob, md);
}
}
}
else{
- but = uiDefBut(block, BUT, B_MODIFIER_RECALC, "Apply", lx,(cy-=19),60,19, 0, 0, 0, 0, 0, "Apply the current modifier and remove from the stack");
+ but = uiDefBut(block, BUT, 0, "Apply", 0,0,60,19, 0, 0, 0, 0, 0, "Apply the current modifier and remove from the stack");
uiButSetFunc(but, modifiers_applyModifier, ob, md);
}
@@ -684,16 +572,13 @@ static uiLayout *draw_modifier(uiLayout *layout, Object *ob, ModifierData *md, i
uiBlockSetButLock(block, ob && ob->id.lib, ERROR_LIBDATA_MESSAGE);
if (md->type!=eModifierType_Fluidsim && md->type!=eModifierType_Softbody && md->type!=eModifierType_ParticleSystem && (md->type!=eModifierType_Cloth)) {
- but = uiDefBut(block, BUT, B_MODIFIER_RECALC, "Copy", lx,(cy-=19),60,19, 0, 0, 0, 0, 0, "Duplicate the current modifier at the same position in the stack");
+ but = uiDefBut(block, BUT, 0, "Copy", 0,0,60,19, 0, 0, 0, 0, 0, "Duplicate the current modifier at the same position in the stack");
uiButSetFunc(but, modifiers_copyModifier, ob, md);
}
}
result= uiLayoutColumn(box, 0);
block= uiLayoutFreeBlock(box);
-
- lx = x + 10;
- cy = y + 10 - 1;
}
if (md->error) {
@@ -886,7 +771,7 @@ static void draw_constraint_spaceselect (uiBlock *block, bConstraint *con, short
}
if ((target != -1) && (owner != -1))
- uiDefIconBut(block, LABEL, B_NOP, ICON_ARROW_LEFTRIGHT,
+ uiDefIconBut(block, LABEL, 0, ICON_ARROW_LEFTRIGHT,
iconx, yco, 20, 20, NULL, 0.0, 0.0, 0.0, 0.0, "");
/* Owner-Space */
@@ -906,8 +791,9 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
bPoseChannel *pchan= get_active_posechannel(ob);
bConstraintTypeInfo *cti;
uiBlock *block;
- uiLayout *result= NULL, *col, *box;
+ uiLayout *result= NULL, *col, *box, *row, *subrow;
uiBut *but;
+ PointerRNA ptr;
char typestr[32];
short width = 265;
short proxy_protected, xco=0, yco=0;
@@ -936,11 +822,19 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
uiBlockSetHandleFunc(block, do_constraint_panels, NULL);
uiBlockSetFunc(block, constraint_active_func, ob, con);
+ RNA_pointer_create(&ob->id, &RNA_Constraint, con, &ptr);
+
col= uiLayoutColumn(layout, 1);
+ uiLayoutSetContextPointer(col, "constraint", &ptr);
+
box= uiLayoutBox(col);
+ row= uiLayoutRow(box, 0);
block= uiLayoutFreeBlock(box);
-
+
+ subrow= uiLayoutRow(row, 0);
+ uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_LEFT);
+
/* Draw constraint header */
uiBlockSetEmboss(block, UI_EMBOSSN);
@@ -974,6 +868,9 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
}
// XXX uiBlockSetCol(block, TH_AUTO);
+
+ subrow= uiLayoutRow(row, 0);
+ uiLayoutSetAlignment(subrow, UI_LAYOUT_ALIGN_RIGHT);
/* proxy-protected constraints cannot be edited, so hide up/down + close buttons */
if (proxy_protected) {
@@ -1141,101 +1038,11 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
}
break;
*/
- case CONSTRAINT_TYPE_KINEMATIC:
- {
- bKinematicConstraint *data = con->data;
-
- /* IK Target */
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Target:", xco, yco-24, 80, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- /* Draw target parameters */
- uiBlockBeginAlign(block);
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CONSTRAINT_CHANGETARGET, "OB:", xco, yco-44, 137, 19, &data->tar, "Target Object");
-
- if (is_armature_target(data->tar)) {
- but=uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", xco, yco-62,137,19, &data->subtarget, 0, 24, 0, 0, "Subtarget Bone");
- uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->tar);
- }
- else if (is_geom_target(data->tar)) {
- but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "VG:", xco, yco-62,137,18, &data->subtarget, 0, 24, 0, 0, "Name of Vertex Group defining 'target' points");
- uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)data->tar);
- }
- else {
- strcpy (data->subtarget, "");
- }
-
- uiBlockEndAlign(block);
-
- /* Settings */
- uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, CONSTRAINT_IK_TIP, B_CONSTRAINT_TEST, "Use Tail", xco, yco-92, 137, 19, &data->flag, 0, 0, 0, 0, "Include Bone's tail also last element in Chain");
- uiDefButS(block, NUM, B_CONSTRAINT_TEST, "ChainLen:", xco, yco-112,137,19, &data->rootbone, 0, 255, 0, 0, "If not zero, the amount of bones in this chain");
-
- uiBlockBeginAlign(block);
- uiDefButF(block, NUMSLI, B_CONSTRAINT_TEST, "PosW ", xco+147, yco-92, 137, 19, &data->weight, 0.01, 1.0, 2, 2, "For Tree-IK: weight of position control for this target");
- uiDefButBitS(block, TOG, CONSTRAINT_IK_ROT, B_CONSTRAINT_TEST, "Rot", xco+147, yco-112, 40,19, &data->flag, 0, 0, 0, 0, "Chain follows rotation of target");
- uiDefButF(block, NUMSLI, B_CONSTRAINT_TEST, "W ", xco+187, yco-112, 97, 19, &data->orientweight, 0.01, 1.0, 2, 2, "For Tree-IK: Weight of orientation control for this target");
-
- uiBlockBeginAlign(block);
-
- uiDefButBitS(block, TOG, CONSTRAINT_IK_STRETCH, B_CONSTRAINT_TEST, "Stretch", xco, yco-137,137,19, &data->flag, 0, 0, 0, 0, "Enable IK stretching");
- uiBlockBeginAlign(block);
- uiDefButS(block, NUM, B_CONSTRAINT_TEST, "Iterations:", xco+147, yco-137, 137, 19, &data->iterations, 1, 10000, 0, 0, "Maximum number of solving iterations");
- uiBlockEndAlign(block);
-
- /* Pole Vector */
- uiDefBut(block, LABEL, B_CONSTRAINT_TEST, "Pole Target:", xco+147, yco-24, 100, 18, NULL, 0.0, 0.0, 0.0, 0.0, "");
-
- uiBlockBeginAlign(block);
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CONSTRAINT_CHANGETARGET, "OB:", xco+147, yco-44, 137, 19, &data->poletar, "Pole Target Object");
- if (is_armature_target(data->poletar)) {
- but=uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "BO:", xco+147, yco-62,137,19, &data->polesubtarget, 0, 24, 0, 0, "Pole Subtarget Bone");
- uiButSetCompleteFunc(but, autocomplete_bone, (void *)data->poletar);
- }
- else if (is_geom_target(data->poletar)) {
- but= uiDefBut(block, TEX, B_CONSTRAINT_CHANGETARGET, "VG:", xco+147, yco-62,137,18, &data->polesubtarget, 0, 24, 0, 0, "Name of Vertex Group defining pole 'target' points");
- uiButSetCompleteFunc(but, autocomplete_vgroup, (void *)data->poletar);
- }
- else {
- strcpy(data->polesubtarget, "");
- }
-
- if (data->poletar) {
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Pole Offset ", xco, yco-167, 137, 19, &data->poleangle, -180.0, 180.0, 0, 0, "Pole rotation offset");
- }
- }
- break;
- case CONSTRAINT_TYPE_RIGIDBODYJOINT:
+
+ /*case CONSTRAINT_TYPE_RIGIDBODYJOINT:
{
- bRigidBodyJointConstraint *data = con->data;
- float extremeLin = 999.f;
- float extremeAngX = 180.f;
- float extremeAngY = 45.f;
- float extremeAngZ = 45.f;
- int togButWidth = 70;
- int offsetY = 150;
- int textButWidth = ((width/2)-togButWidth);
-
- uiDefButI(block, MENU, B_CONSTRAINT_TEST, "Joint Types%t|Ball%x1|Hinge%x2|Generic 6DOF%x12",//|Extra Force%x6",
- //uiDefButI(block, MENU, B_CONSTRAINT_TEST, "Joint Types%t|Ball%x1|Hinge%x2|Cone Twist%x4|Generic 6DOF%x12",//|Extra Force%x6",
- xco, yco-25, 150, 18, &data->type, 0, 0, 0, 0, "Choose the joint type");
-
- uiDefButBitS(block, TOG, CONSTRAINT_DISABLE_LINKED_COLLISION, B_CONSTRAINT_TEST, "No Collision", xco+155, yco-25, 111, 18, &data->flag, 0, 24, 0, 0, "Disable Collision Between Linked Bodies");
-
-
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_CONSTRAINT_CHANGETARGET, "toObject:", xco, yco-50, 130, 18, &data->tar, "Child Object");
- uiDefButBitS(block, TOG, CONSTRAINT_DRAW_PIVOT, B_CONSTRAINT_TEST, "ShowPivot", xco+135, yco-50, 130, 18, &data->flag, 0, 24, 0, 0, "Show pivot position and rotation");
-
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Pivot X:", xco, yco-75, 130, 18, &data->pivX, -1000, 1000, 100, 0.0, "Offset pivot on X");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Pivot Y:", xco, yco-100, 130, 18, &data->pivY, -1000, 1000, 100, 0.0, "Offset pivot on Y");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Pivot Z:", xco, yco-125, 130, 18, &data->pivZ, -1000, 1000, 100, 0.0, "Offset pivot on z");
-
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Ax X:", xco+135, yco-75, 130, 18, &data->axX, -360, 360, 1500, 0.0, "Rotate pivot on X Axis (in degrees)");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Ax Y:", xco+135, yco-100, 130, 18, &data->axY, -360, 360, 1500, 0.0, "Rotate pivot on Y Axis (in degrees)");
- uiDefButF(block, NUM, B_CONSTRAINT_TEST, "Ax Z:", xco+135, yco-125, 130, 18, &data->axZ, -360, 360, 1500, 0.0, "Rotate pivot on Z Axis (in degrees)");
-
if (data->type==CONSTRAINT_RB_GENERIC6DOF) {
- /* Draw Pairs of LimitToggle+LimitValue */
+ // Draw Pairs of LimitToggle+LimitValue
uiBlockBeginAlign(block);
uiDefButBitS(block, TOG, 1, B_CONSTRAINT_TEST, "LinMinX", xco, yco-offsetY, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use minimum x limit");
uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", xco+togButWidth, yco-offsetY, (textButWidth-5), 18, &(data->minLimit[0]), -extremeLin, extremeLin, 0.1,0.5,"min x limit");
@@ -1270,7 +1077,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
offsetY += 20;
}
if ((data->type==CONSTRAINT_RB_GENERIC6DOF) || (data->type==CONSTRAINT_RB_CONETWIST)) {
- /* Draw Pairs of LimitToggle+LimitValue */
+ // Draw Pairs of LimitToggle+LimitValue /
uiBlockBeginAlign(block);
uiDefButBitS(block, TOG, 8, B_CONSTRAINT_TEST, "AngMinX", xco, yco-offsetY, togButWidth, 18, &data->flag, 0, 24, 0, 0, "Use minimum x limit");
uiDefButF(block, NUM, B_CONSTRAINT_TEST, "", xco+togButWidth, yco-offsetY, (textButWidth-5), 18, &(data->minLimit[3]), -extremeAngX, extremeAngX, 0.1,0.5,"min x limit");
@@ -1305,6 +1112,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con)
}
break;
+ */
case CONSTRAINT_TYPE_NULL:
{
@@ -1503,3 +1311,37 @@ void uiTemplatePreview(uiLayout *layout, ID *id)
}
+/********************** ColorRamp Template **************************/
+
+void uiTemplateColorRamp(uiLayout *layout, ColorBand *coba, int expand)
+{
+ uiBlock *block;
+ rctf rect;
+
+ if(coba) {
+ rect.xmin= 0; rect.xmax= 200;
+ rect.ymin= 0; rect.ymax= 190;
+
+ block= uiLayoutFreeBlock(layout);
+ colorband_buttons(block, coba, &rect, !expand);
+ }
+}
+
+/********************* CurveMapping Template ************************/
+
+#include "DNA_color_types.h"
+
+void uiTemplateCurveMapping(uiLayout *layout, CurveMapping *cumap, int type)
+{
+ uiBlock *block;
+ rctf rect;
+
+ if(cumap) {
+ rect.xmin= 0; rect.xmax= 200;
+ rect.ymin= 0; rect.ymax= 190;
+
+ block= uiLayoutFreeBlock(layout);
+ curvemap_buttons(block, cumap, type, 0, 0, &rect);
+ }
+}
+
diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c
index 7c739adf1b9..564ae2c0205 100644
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@ -35,6 +35,7 @@
#include "DNA_material_types.h"
#include "DNA_object_types.h"
#include "DNA_screen_types.h"
+#include "DNA_texture_types.h"
#include "DNA_windowmanager_types.h"
#include "BKE_colortools.h"
@@ -42,6 +43,7 @@
#include "BKE_idprop.h"
#include "BKE_library.h"
#include "BKE_main.h"
+#include "BKE_texture.h"
#include "BKE_utildefines.h"
#include "RNA_access.h"
@@ -63,186 +65,6 @@
/*************************** RNA Utilities ******************************/
-int UI_GetIconRNA(PointerRNA *ptr)
-{
- StructRNA *rnatype= ptr->type;
-
- if(rnatype == &RNA_Scene)
- return ICON_SCENE_DATA;
- else if(rnatype == &RNA_World)
- return ICON_WORLD_DATA;
- else if(rnatype == &RNA_Object)
- return ICON_OBJECT_DATA;
- else if(rnatype == &RNA_Mesh)
- return ICON_MESH_DATA;
- else if(rnatype == &RNA_MeshVertex)
- return ICON_VERTEXSEL;
- else if(rnatype == &RNA_MeshEdge)
- return ICON_EDGESEL;
- else if(rnatype == &RNA_MeshFace)
- return ICON_FACESEL;
- else if(rnatype == &RNA_MeshTextureFace)
- return ICON_FACESEL_HLT;
- else if(rnatype == &RNA_VertexGroup)
- return ICON_GROUP_VERTEX;
- else if(rnatype == &RNA_VertexGroupElement)
- return ICON_GROUP_VERTEX;
- else if(rnatype == &RNA_Curve)
- return ICON_CURVE_DATA;
- else if(rnatype == &RNA_MetaBall)
- return ICON_META_DATA;
- else if(rnatype == &RNA_MetaElement)
- return ICON_OUTLINER_DATA_META;
- else if(rnatype == &RNA_Lattice)
- return ICON_LATTICE_DATA;
- else if(rnatype == &RNA_Armature)
- return ICON_ARMATURE_DATA;
- else if(rnatype == &RNA_Bone)
- return ICON_BONE_DATA;
- else if(rnatype == &RNA_Camera)
- return ICON_CAMERA_DATA;
- else if(rnatype == &RNA_LocalLamp)
- return ICON_LAMP_DATA;
- else if(rnatype == &RNA_AreaLamp)
- return ICON_LAMP_DATA;
- else if(rnatype == &RNA_SpotLamp)
- return ICON_LAMP_DATA;
- else if(rnatype == &RNA_SunLamp)
- return ICON_LAMP_DATA;
- else if(rnatype == &RNA_HemiLamp)
- return ICON_LAMP_DATA;
- else if(rnatype == &RNA_Lamp)
- return ICON_LAMP_DATA;
- else if(rnatype == &RNA_Group)
- return ICON_GROUP;
- else if(rnatype == &RNA_ParticleSystem)
- return ICON_PARTICLE_DATA;
- else if(rnatype == &RNA_ParticleSettings)
- return ICON_PARTICLE_DATA;
- else if(rnatype == &RNA_Material)
- return ICON_MATERIAL_DATA;
- else if(rnatype == &RNA_Texture)
- return ICON_TEXTURE_DATA;
- else if(rnatype == &RNA_TextureSlot)
- return ICON_TEXTURE_DATA;
- else if(rnatype == &RNA_WorldTextureSlot)
- return ICON_TEXTURE_DATA;
- else if(rnatype == &RNA_MaterialTextureSlot)
- return ICON_TEXTURE_DATA;
- else if(rnatype == &RNA_Image)
- return ICON_IMAGE_DATA;
- else if(rnatype == &RNA_Screen)
- return ICON_SPLITSCREEN;
- else if(rnatype == &RNA_NodeTree)
- return ICON_NODE;
- else if(rnatype == &RNA_Text)
- return ICON_TEXT;
- else if(rnatype == &RNA_Sound)
- return ICON_SOUND;
- else if(rnatype == &RNA_Brush)
- return ICON_BRUSH_DATA;
- else if(rnatype == &RNA_VectorFont)
- return ICON_FONT_DATA;
- else if(rnatype == &RNA_Library)
- return ICON_LIBRARY_DATA_DIRECT;
- else if(rnatype == &RNA_Action)
- return ICON_ACTION;
- else if(rnatype == &RNA_FCurve)
- return ICON_ANIM_DATA;
- //else if(rnatype == &RNA_Ipo)
- // return ICON_ANIM_DATA;
- else if(rnatype == &RNA_Key)
- return ICON_SHAPEKEY_DATA;
- else if(rnatype == &RNA_Main)
- return ICON_BLENDER;
- else if(rnatype == &RNA_Struct)
- return ICON_RNA;
- else if(rnatype == &RNA_Property)
- return ICON_RNA;
- else if(rnatype == &RNA_BooleanProperty)
- return ICON_RNA;
- else if(rnatype == &RNA_IntProperty)
- return ICON_RNA;
- else if(rnatype == &RNA_FloatProperty)
- return ICON_RNA;
- else if(rnatype == &RNA_StringProperty)
- return ICON_RNA;
- else if(rnatype == &RNA_EnumProperty)
- return ICON_RNA;
- else if(rnatype == &RNA_EnumPropertyItem)
- return ICON_RNA;
- else if(rnatype == &RNA_PointerProperty)
- return ICON_RNA;
- else if(rnatype == &RNA_CollectionProperty)
- return ICON_RNA;
- else if(rnatype == &RNA_GameObjectSettings)
- return ICON_GAME;
- else if(rnatype == &RNA_ScriptLink)
- return ICON_PYTHON;
-
- /* modifiers */
- else if(rnatype == &RNA_SubsurfModifier)
- return ICON_MOD_SUBSURF;
- else if(rnatype == &RNA_ArmatureModifier)
- return ICON_MOD_ARMATURE;
- else if(rnatype == &RNA_LatticeModifier)
- return ICON_MOD_LATTICE;
- else if(rnatype == &RNA_CurveModifier)
- return ICON_MOD_CURVE;
- else if(rnatype == &RNA_BuildModifier)
- return ICON_MOD_BUILD;
- else if(rnatype == &RNA_MirrorModifier)
- return ICON_MOD_MIRROR;
- else if(rnatype == &RNA_DecimateModifier)
- return ICON_MOD_DECIM;
- else if(rnatype == &RNA_WaveModifier)
- return ICON_MOD_WAVE;
- else if(rnatype == &RNA_HookModifier)
- return ICON_HOOK;
- else if(rnatype == &RNA_SoftbodyModifier)
- return ICON_MOD_SOFT;
- else if(rnatype == &RNA_BooleanModifier)
- return ICON_MOD_BOOLEAN;
- else if(rnatype == &RNA_ParticleInstanceModifier)
- return ICON_MOD_PARTICLES;
- else if(rnatype == &RNA_ParticleSystemModifier)
- return ICON_MOD_PARTICLES;
- else if(rnatype == &RNA_EdgeSplitModifier)
- return ICON_MOD_EDGESPLIT;
- else if(rnatype == &RNA_ArrayModifier)
- return ICON_MOD_ARRAY;
- else if(rnatype == &RNA_UVProjectModifier)
- return ICON_MOD_UVPROJECT;
- else if(rnatype == &RNA_DisplaceModifier)
- return ICON_MOD_DISPLACE;
- else if(rnatype == &RNA_ShrinkwrapModifier)
- return ICON_MOD_SHRINKWRAP;
- else if(rnatype == &RNA_CastModifier)
- return ICON_MOD_CAST;
- else if(rnatype == &RNA_MeshDeformModifier)
- return ICON_MOD_MESHDEFORM;
- else if(rnatype == &RNA_BevelModifier)
- return ICON_MOD_BEVEL;
- else if(rnatype == &RNA_SmoothModifier)
- return ICON_MOD_SMOOTH;
- else if(rnatype == &RNA_SimpleDeformModifier)
- return ICON_MOD_SIMPLEDEFORM;
- else if(rnatype == &RNA_MaskModifier)
- return ICON_MOD_MASK;
- else if(rnatype == &RNA_ClothModifier)
- return ICON_MOD_CLOTH;
- else if(rnatype == &RNA_ExplodeModifier)
- return ICON_MOD_EXPLODE;
- else if(rnatype == &RNA_CollisionModifier)
- return ICON_MOD_PHYSICS;
- else if(rnatype == &RNA_FluidSimulationModifier)
- return ICON_MOD_FLUIDSIM;
- else if(rnatype == &RNA_MultiresModifier)
- return ICON_MOD_MULTIRES;
- else
- return ICON_DOT;
-}
-
uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int index, char *name, int icon, int x1, int y1, int x2, int y2)
{
uiBut *but=NULL;
@@ -295,7 +117,7 @@ uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int ind
pptr= RNA_property_pointer_get(ptr, prop);
if(!pptr.type)
pptr.type= RNA_property_pointer_type(prop);
- icon= UI_GetIconRNA(&pptr);
+ icon= RNA_struct_ui_icon(pptr.type);
but= uiDefIconTextButR(block, IDPOIN, 0, icon, name, x1, y1, x2, y2, ptr, propname, index, 0, 0, -1, -1, NULL);
break;
@@ -1098,3 +920,128 @@ void curvemap_buttons(uiBlock *block, CurveMapping *cumap, char labeltype, short
cumap, 0.0f, 1.0f, 0, 0, "");
}
+#define B_BANDCOL 1
+
+static int vergcband(const void *a1, const void *a2)
+{
+ const CBData *x1=a1, *x2=a2;
+
+ if( x1->pos > x2->pos ) return 1;
+ else if( x1->pos < x2->pos) return -1;
+ return 0;
+}
+
+static void colorband_pos_cb(bContext *C, void *coba_v, void *unused_v)
+{
+ ColorBand *coba= coba_v;
+ int a;
+
+ if(coba->tot<2) return;
+
+ for(a=0; a<coba->tot; a++) coba->data[a].cur= a;
+ qsort(coba->data, coba->tot, sizeof(CBData), vergcband);
+ for(a=0; a<coba->tot; a++) {
+ if(coba->data[a].cur==coba->cur) {
+ // XXX if(coba->cur!=a) addqueue(curarea->win, REDRAW, 0); /* button cur */
+ coba->cur= a;
+ break;
+ }
+ }
+}
+
+static void colorband_add_cb(bContext *C, void *coba_v, void *unused_v)
+{
+ ColorBand *coba= coba_v;
+
+ if(coba->tot < MAXCOLORBAND-1) coba->tot++;
+ coba->cur= coba->tot-1;
+
+ colorband_pos_cb(C, coba, NULL);
+ ED_undo_push(C, "Add colorband");
+}
+
+static void colorband_del_cb(bContext *C, void *coba_v, void *unused_v)
+{
+ ColorBand *coba= coba_v;
+ int a;
+
+ if(coba->tot<2) return;
+
+ for(a=coba->cur; a<coba->tot; a++) {
+ coba->data[a]= coba->data[a+1];
+ }
+ if(coba->cur) coba->cur--;
+ coba->tot--;
+
+ ED_undo_push(C, "Delete colorband");
+ // XXX BIF_preview_changed(ID_TE);
+}
+
+
+/* offset aligns from bottom, standard width 300, height 115 */
+static void colorband_buttons_large(uiBlock *block, ColorBand *coba, int xoffs, int yoffs, int redraw)
+{
+ CBData *cbd;
+ uiBut *bt;
+
+ if(coba==NULL) return;
+
+ bt= uiDefBut(block, BUT, redraw, "Add", 80+xoffs,95+yoffs,37,20, 0, 0, 0, 0, 0, "Adds a new color position to the colorband");
+ uiButSetFunc(bt, colorband_add_cb, coba, NULL);
+ uiDefButS(block, NUM, redraw, "Cur:", 117+xoffs,95+yoffs,81,20, &coba->cur, 0.0, (float)(coba->tot-1), 0, 0, "Displays the active color from the colorband");
+ bt= uiDefBut(block, BUT, redraw, "Del", 199+xoffs,95+yoffs,37,20, 0, 0, 0, 0, 0, "Deletes the active position");
+ uiButSetFunc(bt, colorband_del_cb, coba, NULL);
+
+ uiDefButS(block, MENU, redraw, "Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4",
+ 236+xoffs, 95+yoffs, 64, 20, &coba->ipotype, 0.0, 0.0, 0, 0, "Sets interpolation type");
+
+ uiDefBut(block, BUT_COLORBAND, redraw, "", xoffs,65+yoffs,300,30, coba, 0, 0, 0, 0, "");
+
+ cbd= coba->data + coba->cur;
+
+ uiBlockBeginAlign(block);
+ bt= uiDefButF(block, NUM, redraw, "Pos", xoffs,40+yoffs,110,20, &cbd->pos, 0.0, 1.0, 10, 0, "Sets the position of the active color");
+ uiButSetFunc(bt, colorband_pos_cb, coba, NULL);
+ uiDefButF(block, COL, redraw, "", xoffs,20+yoffs,110,20, &(cbd->r), 0, 0, 0, B_BANDCOL, "");
+ uiDefButF(block, NUMSLI, redraw, "A ", xoffs,yoffs,110,20, &cbd->a, 0.0, 1.0, 10, 0, "Sets the alpha value for this position");
+
+ uiBlockBeginAlign(block);
+ uiDefButF(block, NUMSLI, redraw, "R ", 115+xoffs,40+yoffs,185,20, &cbd->r, 0.0, 1.0, B_BANDCOL, 0, "Sets the red value for the active color");
+ uiDefButF(block, NUMSLI, redraw, "G ", 115+xoffs,20+yoffs,185,20, &cbd->g, 0.0, 1.0, B_BANDCOL, 0, "Sets the green value for the active color");
+ uiDefButF(block, NUMSLI, redraw, "B ", 115+xoffs,yoffs,185,20, &cbd->b, 0.0, 1.0, B_BANDCOL, 0, "Sets the blue value for the active color");
+ uiBlockEndAlign(block);
+}
+
+static void colorband_buttons_small(uiBlock *block, ColorBand *coba, rctf *butr, int event)
+{
+ CBData *cbd;
+ uiBut *bt;
+ float unit= (butr->xmax-butr->xmin)/14.0f;
+ float xs= butr->xmin;
+
+ cbd= coba->data + coba->cur;
+
+ uiBlockBeginAlign(block);
+ uiDefButF(block, COL, event, "", xs,butr->ymin+20.0f,2.0f*unit,20, &(cbd->r), 0, 0, 0, B_BANDCOL, "");
+ uiDefButF(block, NUM, event, "A:", xs+2.0f*unit,butr->ymin+20.0f,4.0f*unit,20, &(cbd->a), 0.0f, 1.0f, 10, 2, "");
+ bt= uiDefBut(block, BUT, event, "Add", xs+6.0f*unit,butr->ymin+20.0f,2.0f*unit,20, NULL, 0, 0, 0, 0, "Adds a new color position to the colorband");
+ uiButSetFunc(bt, colorband_add_cb, coba, NULL);
+ bt= uiDefBut(block, BUT, event, "Del", xs+8.0f*unit,butr->ymin+20.0f,2.0f*unit,20, NULL, 0, 0, 0, 0, "Deletes the active position");
+ uiButSetFunc(bt, colorband_del_cb, coba, NULL);
+
+ uiDefButS(block, MENU, event, "Interpolation %t|Ease %x1|Cardinal %x3|Linear %x0|B-Spline %x2|Constant %x4",
+ xs+10.0f*unit, butr->ymin+20.0f, unit*4, 20, &coba->ipotype, 0.0, 0.0, 0, 0, "Sets interpolation type");
+
+ uiDefBut(block, BUT_COLORBAND, event, "", xs,butr->ymin,butr->xmax-butr->xmin,20.0f, coba, 0, 0, 0, 0, "");
+ uiBlockEndAlign(block);
+
+}
+
+void colorband_buttons(uiBlock *block, ColorBand *coba, rctf *butr, int small)
+{
+ if(small)
+ colorband_buttons_small(block, coba, butr, 0);
+ else
+ colorband_buttons_large(block, coba, 0, 0, 0);
+}
+
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index f4e3a7f2899..e3f850ddfd4 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -630,7 +630,8 @@ static void widgetbase_draw(uiWidgetBase *wtb, uiWidgetColors *wcol)
static void widget_draw_icon(uiBut *but, BIFIconID icon, int blend, rcti *rect)
{
- float xs=0, ys=0, aspect, height;
+ int xs=0, ys=0;
+ float aspect, height;
/* this icon doesn't need draw... */
if(icon==ICON_BLANK1 && (but->flag & UI_ICON_SUBMENU)==0) return;
@@ -663,33 +664,36 @@ static void widget_draw_icon(uiBut *but, BIFIconID icon, int blend, rcti *rect)
if(but->flag & UI_ICON_LEFT) {
if (but->type==BUT_TOGDUAL) {
if (but->drawstr[0]) {
- xs= rect->xmin-1.0;
+ xs= rect->xmin-1;
} else {
- xs= (rect->xmin+rect->xmax- height)/2.0;
+ xs= (rect->xmin+rect->xmax- height)/2;
}
}
else if (but->block->flag & UI_BLOCK_LOOP) {
- xs= rect->xmin+1.0;
+ if(but->type==SEARCH_MENU)
+ xs= rect->xmin+4;
+ else
+ xs= rect->xmin+1;
}
else if ((but->type==ICONROW) || (but->type==ICONTEXTROW)) {
- xs= rect->xmin+3.0;
+ xs= rect->xmin+3;
}
else {
- xs= rect->xmin+4.0;
+ xs= rect->xmin+4;
}
- ys= (rect->ymin+rect->ymax- height)/2.0;
+ ys= (rect->ymin+rect->ymax- height)/2;
}
else {
- xs= (rect->xmin+rect->xmax- height)/2.0;
- ys= (rect->ymin+rect->ymax- height)/2.0;
+ xs= (rect->xmin+rect->xmax- height)/2;
+ ys= (rect->ymin+rect->ymax- height)/2;
}
UI_icon_draw_aspect_blended(xs, ys, icon, aspect, blend);
}
if(but->flag & UI_ICON_SUBMENU) {
- xs= rect->xmax-17.0;
- ys= (rect->ymin+rect->ymax- height)/2.0;
+ xs= rect->xmax-17;
+ ys= (rect->ymin+rect->ymax- height)/2;
UI_icon_draw_aspect_blended(xs, ys, ICON_RIGHTARROW_THIN, aspect, blend);
}
@@ -844,29 +848,23 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
widget_draw_icon(but, ICON_DOT, dualset?0:-100, rect);
}
- if(but->drawstr[0]!=0) {
+ /* If there's an icon too (made with uiDefIconTextBut) then draw the icon
+ and offset the text label to accomodate it */
+
+ if (but->flag & UI_HAS_ICON) {
+ widget_draw_icon(but, but->icon, 0, rect);
- /* If there's an icon too (made with uiDefIconTextBut) then draw the icon
- and offset the text label to accomodate it */
+ rect->xmin += UI_icon_get_width(but->icon);
- if (but->flag & UI_HAS_ICON) {
- widget_draw_icon(but, but->icon, 0, rect);
-
- rect->xmin += UI_icon_get_width(but->icon);
-
- if(but->editstr || (but->flag & UI_TEXT_LEFT))
- rect->xmin += 5;
- }
- else if(but->flag & UI_TEXT_LEFT)
+ if(but->editstr || (but->flag & UI_TEXT_LEFT))
rect->xmin += 5;
-
- widget_draw_text(fstyle, wcol, but, rect);
-
- }
- /* if there's no text label, then check to see if there's an icon only and draw it */
- else if( but->flag & UI_HAS_ICON ) {
- widget_draw_icon(but, (BIFIconID) (but->icon+but->iconadd), 0, rect);
}
+ else if(but->flag & UI_TEXT_LEFT)
+ rect->xmin += 5;
+
+ /* always draw text for textbutton cursor */
+ widget_draw_text(fstyle, wcol, but, rect);
+
}
}
@@ -1220,8 +1218,8 @@ static void widget_menu_back(uiWidgetColors *wcol, rcti *rect, int flag, int dir
/* menu is 2nd level or deeper */
if (flag & UI_BLOCK_POPUP) {
- rect->ymin -= 4.0;
- rect->ymax += 4.0;
+ //rect->ymin -= 4.0;
+ //rect->ymax += 4.0;
}
else if (direction == UI_DOWN) {
roundboxalign= 12;
@@ -1473,7 +1471,7 @@ static void widget_textbut(uiWidgetColors *wcol, rcti *rect, int state, int roun
widget_init(&wtb);
/* half rounded */
- round_box_edges(&wtb, roundboxalign, rect, 4.0f);
+ round_box_edges(&wtb, roundboxalign, rect, 5.0f);
widgetbase_draw(&wtb, wcol);
@@ -1827,6 +1825,7 @@ void ui_draw_but(ARegion *ar, uiStyle *style, uiBut *but, rcti *rect)
wt= widget_type(UI_WTYPE_RADIO);
break;
case TEX:
+ case SEARCH_MENU:
wt= widget_type(UI_WTYPE_NAME);
break;
case TOGBUT:
@@ -1918,4 +1917,60 @@ void ui_draw_menu_back(uiStyle *style, uiBlock *block, rcti *rect)
}
+void ui_draw_search_back(uiStyle *style, uiBlock *block, rcti *rect)
+{
+ uiWidgetType *wt= widget_type(UI_WTYPE_BOX);
+
+ glEnable(GL_BLEND);
+ widget_softshadow(rect, 15, 5.0f, 8.0f);
+ glDisable(GL_BLEND);
+
+ wt->state(wt, 0);
+ if(block)
+ wt->draw(&wt->wcol, rect, block->flag, 15);
+ else
+ wt->draw(&wt->wcol, rect, 0, 15);
+
+}
+
+
+/* helper call to draw a menu item without button */
+/* state: UI_ACTIVE or 0 */
+void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, char *name, int state)
+{
+ uiWidgetType *wt= widget_type(UI_WTYPE_MENU_ITEM);
+ rcti _rect= *rect;
+ char *cpoin;
+
+ wt->state(wt, state);
+ wt->draw(&wt->wcol, rect, 0, 0);
+
+ uiStyleFontSet(fstyle);
+ fstyle->align= UI_STYLE_TEXT_LEFT;
+
+ /* text location offset */
+ rect->xmin+=5;
+
+ /* cut string in 2 parts? */
+ cpoin= strchr(name, '|');
+ if(cpoin) {
+ *cpoin= 0;
+ rect->xmax -= BLF_width(cpoin+1) + 10;
+ }
+
+ glColor3ubv(wt->wcol.text);
+ uiStyleFontDraw(fstyle, rect, name);
+
+ /* part text right aligned */
+ if(cpoin) {
+ fstyle->align= UI_STYLE_TEXT_RIGHT;
+ rect->xmax= _rect.xmax - 5;
+ uiStyleFontDraw(fstyle, rect, cpoin+1);
+ *cpoin= '|';
+ }
+
+ /* restore rect, was messed with */
+ *rect= _rect;
+
+}
diff --git a/source/blender/editors/object/editconstraint.c b/source/blender/editors/object/editconstraint.c
index b2cf3be6229..485dd890ac1 100644
--- a/source/blender/editors/object/editconstraint.c
+++ b/source/blender/editors/object/editconstraint.c
@@ -1000,7 +1000,7 @@ static int constraint_add_exec(bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
- bConstraint *con;
+ bConstraint *con, *coniter;
ListBase *list= get_active_constraints(ob);
bPoseChannel *pchan= get_active_posechannel(ob);
int type= RNA_enum_get(op->ptr, "type");
@@ -1015,8 +1015,8 @@ static int constraint_add_exec(bContext *C, wmOperator *op)
con->flag |= CONSTRAINT_PROXY_LOCAL;
con->flag |= CONSTRAINT_ACTIVE;
- for(con= con->prev; con; con= con->prev)
- con->flag &= ~CONSTRAINT_ACTIVE;
+ for(coniter= coniter->prev; coniter; coniter= coniter->prev)
+ coniter->flag &= ~CONSTRAINT_ACTIVE;
}
switch(type) {
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index ce8bd7287f7..1eb867e19a0 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -87,6 +87,7 @@ void GROUP_OT_objects_remove_active(struct wmOperatorType *ot);
/* object_modifier.c */
void OBJECT_OT_modifier_add(struct wmOperatorType *ot);
void OBJECT_OT_multires_subdivide(struct wmOperatorType *ot);
+void OBJECT_OT_modifier_mdef_bind(struct wmOperatorType *ot);
/* editconstraint.c */
void OBJECT_OT_constraint_add(struct wmOperatorType *ot);
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index 2e2c16ee6d6..e6b00fa7155 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -42,8 +42,10 @@
#include "BKE_curve.h"
#include "BKE_context.h"
#include "BKE_depsgraph.h"
+#include "BKE_displist.h"
#include "BKE_DerivedMesh.h"
#include "BKE_global.h"
+#include "BKE_lattice.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
#include "BKE_multires.h"
@@ -396,6 +398,80 @@ void OBJECT_OT_multires_subdivide(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
}
+/************************ mdef bind operator *********************/
+
+static int modifier_mdef_bind_poll(bContext *C)
+{
+ PointerRNA ptr= CTX_data_pointer_get(C, "modifier");
+ return RNA_struct_is_a(ptr.type, &RNA_MeshDeformModifier);
+}
+
+static int modifier_mdef_bind_exec(bContext *C, wmOperator *op)
+{
+ Scene *scene= CTX_data_scene(C);
+ PointerRNA ptr= CTX_data_pointer_get(C, "modifier");
+ Object *ob= ptr.id.data;
+ MeshDeformModifierData *mmd= ptr.data;
+
+ if(mmd->bindcos) {
+ if(mmd->bindweights) MEM_freeN(mmd->bindweights);
+ if(mmd->bindcos) MEM_freeN(mmd->bindcos);
+ if(mmd->dyngrid) MEM_freeN(mmd->dyngrid);
+ if(mmd->dyninfluences) MEM_freeN(mmd->dyninfluences);
+ if(mmd->dynverts) MEM_freeN(mmd->dynverts);
+ mmd->bindweights= NULL;
+ mmd->bindcos= NULL;
+ mmd->dyngrid= NULL;
+ mmd->dyninfluences= NULL;
+ mmd->dynverts= NULL;
+ mmd->totvert= 0;
+ mmd->totcagevert= 0;
+ mmd->totinfluence= 0;
+ }
+ else {
+ DerivedMesh *dm;
+ int mode= mmd->modifier.mode;
+
+ /* force modifier to run, it will call binding routine */
+ mmd->needbind= 1;
+ mmd->modifier.mode |= eModifierMode_Realtime;
+
+ if(ob->type == OB_MESH) {
+ dm= mesh_create_derived_view(scene, ob, 0);
+ dm->release(dm);
+ }
+ else if(ob->type == OB_LATTICE) {
+ lattice_calc_modifiers(scene, ob);
+ }
+ else if(ob->type==OB_MBALL) {
+ makeDispListMBall(scene, ob);
+ }
+ else if(ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT)) {
+ makeDispListCurveTypes(scene, ob, 0);
+ }
+
+ mmd->needbind= 0;
+ mmd->modifier.mode= mode;
+ }
+
+ return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_modifier_mdef_bind(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Mesh Deform Bind";
+ ot->description = "Bind mesh to cage in mesh deform modifier.";
+ ot->idname= "OBJECT_OT_modifier_mdef_bind";
+
+ /* api callbacks */
+ ot->poll= modifier_mdef_bind_poll;
+ ot->exec= modifier_mdef_bind_exec;
+
+ /* flags */
+ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
#if 0
static void modifiers_add(void *ob_v, int type)
{
@@ -469,3 +545,89 @@ static uiBlock *modifiers_add_menu(void *ob_v)
}
#endif
+#if 0
+static void modifiers_clearHookOffset(bContext *C, void *ob_v, void *md_v)
+{
+ Object *ob = ob_v;
+ ModifierData *md = md_v;
+ HookModifierData *hmd = (HookModifierData*) md;
+
+ if (hmd->object) {
+ Mat4Invert(hmd->object->imat, hmd->object->obmat);
+ Mat4MulSerie(hmd->parentinv, hmd->object->imat, ob->obmat, NULL, NULL, NULL, NULL, NULL, NULL);
+ ED_undo_push(C, "Clear hook offset");
+ }
+}
+
+static void modifiers_cursorHookCenter(bContext *C, void *ob_v, void *md_v)
+{
+ /* XXX
+ Object *ob = ob_v;
+ ModifierData *md = md_v;
+ HookModifierData *hmd = (HookModifierData*) md;
+
+ if(G.vd) {
+ float *curs = give_cursor();
+ float bmat[3][3], imat[3][3];
+
+ where_is_object(ob);
+
+ Mat3CpyMat4(bmat, ob->obmat);
+ Mat3Inv(imat, bmat);
+
+ curs= give_cursor();
+ hmd->cent[0]= curs[0]-ob->obmat[3][0];
+ hmd->cent[1]= curs[1]-ob->obmat[3][1];
+ hmd->cent[2]= curs[2]-ob->obmat[3][2];
+ Mat3MulVecfl(imat, hmd->cent);
+
+ ED_undo_push(C, "Hook cursor center");
+ }*/
+}
+
+static void modifiers_selectHook(bContext *C, void *ob_v, void *md_v)
+{
+ /* XXX ModifierData *md = md_v;
+ HookModifierData *hmd = (HookModifierData*) md;
+
+ hook_select(hmd);*/
+}
+
+static void modifiers_reassignHook(bContext *C, void *ob_v, void *md_v)
+{
+ /* XXX ModifierData *md = md_v;
+ HookModifierData *hmd = (HookModifierData*) md;
+ float cent[3];
+ int *indexar, tot, ok;
+ char name[32];
+
+ ok= hook_getIndexArray(&tot, &indexar, name, cent);
+
+ if (!ok) {
+ uiPupMenuError(C, "Requires selected vertices or active Vertex Group");
+ } else {
+ if (hmd->indexar) {
+ MEM_freeN(hmd->indexar);
+ }
+
+ VECCOPY(hmd->cent, cent);
+ hmd->indexar = indexar;
+ hmd->totindex = tot;
+ }*/
+}
+
+void modifiers_explodeFacepa(bContext *C, void *arg1, void *arg2)
+{
+ ExplodeModifierData *emd=arg1;
+
+ emd->flag |= eExplodeFlag_CalcFaces;
+}
+
+void modifiers_explodeDelVg(bContext *C, void *arg1, void *arg2)
+{
+ ExplodeModifierData *emd=arg1;
+ emd->vgroup = 0;
+}
+#endif
+
+
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index 9d8247522e1..cfee6a55152 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -101,6 +101,7 @@ void ED_operatortypes_object(void)
WM_operatortype_append(OBJECT_OT_modifier_add);
WM_operatortype_append(OBJECT_OT_multires_subdivide);
+ WM_operatortype_append(OBJECT_OT_modifier_mdef_bind);
WM_operatortype_append(OBJECT_OT_constraint_add);
}
diff --git a/source/blender/editors/physics/editparticle.c b/source/blender/editors/physics/editparticle.c
index 1c2b3c6b309..f60d5493058 100644
--- a/source/blender/editors/physics/editparticle.c
+++ b/source/blender/editors/physics/editparticle.c
@@ -3759,7 +3759,7 @@ static int set_editable_exec(bContext *C, wmOperator *op)
PE_free_particle_edit(psys);
psys->flag &= ~PSYS_EDITED;
- psys->recalc |= PSYS_RECALC_HAIR;
+ psys->recalc |= PSYS_RECALC_RESET;
DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
}
diff --git a/source/blender/editors/preview/previewrender.c b/source/blender/editors/preview/previewrender.c
index 1d5d809a9ee..85cb1e4e1bf 100644
--- a/source/blender/editors/preview/previewrender.c
+++ b/source/blender/editors/preview/previewrender.c
@@ -586,7 +586,7 @@ void BIF_previewrender_buts(Scene *scene, SpaceButs *sbuts)
sbuts->lockpoin= id;
if(sbuts->mainb==CONTEXT_SHADING) {
- int tab= sbuts->tab[CONTEXT_SHADING];
+ int tab= TAB_SHADING_MAT; // XXX sbuts->tab[CONTEXT_SHADING];
if(tab==TAB_SHADING_MAT)
idshow = sbuts->lockpoin;
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index ad6b6e04b8e..81b63b694ba 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -837,6 +837,11 @@ void ED_region_init(bContext *C, ARegion *ar)
ar->winx= ar->winrct.xmax - ar->winrct.xmin + 1;
ar->winy= ar->winrct.ymax - ar->winrct.ymin + 1;
+
+ /* UI convention */
+ wmLoadIdentity();
+ wmOrtho2(-0.01f, ar->winx-0.01f, -0.01f, ar->winy-0.01f);
+
}
@@ -1132,7 +1137,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, char *contex
for(pt= ar->type->paneltypes.first; pt; pt= pt->next) {
/* verify context */
if(context)
- if(!pt->context || strcmp(context, pt->context) != 0)
+ if(pt->context[0] && strcmp(context, pt->context) != 0)
continue;
/* draw panel */
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index db1a39ed056..3e237bff46a 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -231,7 +231,8 @@ int ED_operator_uvedit(bContext *C)
return 1;
}
- BKE_mesh_end_editmesh(obedit->data, em);
+ if(obedit)
+ BKE_mesh_end_editmesh(obedit->data, em);
return 0;
}
@@ -248,7 +249,8 @@ int ED_operator_uvmap(bContext *C)
return 1;
}
- BKE_mesh_end_editmesh(obedit->data, em);
+ if(obedit)
+ BKE_mesh_end_editmesh(obedit->data, em);
return 0;
}
@@ -612,18 +614,25 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, wmEvent *event)
bScreen *newsc, *sc;
ScrArea *sa;
rcti rect;
- sActionzoneData *sad= event->customdata;
-
- if(sad==NULL)
- return OPERATOR_PASS_THROUGH;
win= CTX_wm_window(C);
sc= CTX_wm_screen(C);
- sa= sad->sa1;
+ sa= CTX_wm_area(C);
+
+ /* XXX hrmf! */
+ if(event->type==EVT_ACTIONZONE_AREA) {
+ sActionzoneData *sad= event->customdata;
+ if(sad==NULL)
+ return OPERATOR_PASS_THROUGH;
+
+ sa= sad->sa1;
+ }
+
/* poll() checks area context, but we don't accept full-area windows */
if(sc->full != SCREENNORMAL) {
- actionzone_exit(C, op);
+ if(event->type==EVT_ACTIONZONE_AREA)
+ actionzone_exit(C, op);
return OPERATOR_CANCELLED;
}
@@ -642,7 +651,8 @@ static int area_dupli_invoke(bContext *C, wmOperator *op, wmEvent *event)
/* screen, areas init */
WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
- actionzone_exit(C, op);
+ if(event->type==EVT_ACTIONZONE_AREA)
+ actionzone_exit(C, op);
return OPERATOR_FINISHED;
}
@@ -1976,37 +1986,6 @@ static int region_flip_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
-static void testfunc(bContext *C, void *argv, int arg)
-{
- printf("arg %d\n", arg);
-}
-
-static void newlevel1(bContext *C, uiLayout *layout, void *arg)
-{
- uiLayoutSetFunc(layout, testfunc, NULL);
-
- uiItemV(layout, "First", ICON_PROP_ON, 1);
- uiItemV(layout, "Second", ICON_PROP_CON, 2);
- uiItemV(layout, "Third", ICON_SMOOTHCURVE, 3);
- uiItemV(layout, "Fourth", ICON_SHARPCURVE, 4);
-}
-
-static int testing123(bContext *C, wmOperator *op, wmEvent *event)
-{
- uiPopupMenu *pup= uiPupMenuBegin(C, "Hello world", 0);
- uiLayout *layout= uiPupMenuLayout(pup);
-
- uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT);
- uiItemO(layout, NULL, ICON_PROP_ON, "SCREEN_OT_region_flip");
- uiItemO(layout, NULL, ICON_PROP_CON, "SCREEN_OT_screen_full_area");
- uiItemO(layout, NULL, ICON_SMOOTHCURVE, "SCREEN_OT_region_foursplit");
- uiItemMenuF(layout, "Submenu", 0, newlevel1);
-
- uiPupMenuEnd(C, pup);
-
- /* this operator is only for a menu, not used further */
- return OPERATOR_CANCELLED;
-}
void SCREEN_OT_region_flip(wmOperatorType *ot)
{
@@ -2015,13 +1994,10 @@ void SCREEN_OT_region_flip(wmOperatorType *ot)
ot->idname= "SCREEN_OT_region_flip";
/* api callbacks */
- ot->invoke= testing123; // XXX WM_operator_confirm;
ot->exec= region_flip_exec;
ot->poll= ED_operator_areaactive;
ot->flag= OPTYPE_REGISTER;
-
- RNA_def_int(ot->srna, "test", 0, INT_MIN, INT_MAX, "test", "", INT_MIN, INT_MAX);
}
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 0c20c0cc1cf..0710079301b 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -1274,7 +1274,7 @@ static void wpaint_exit(bContext *C, wmOperator *op)
for(psys= ob->particlesystem.first; psys; psys= psys->next) {
for(i=0; i<PSYS_TOT_VG; i++) {
if(psys->vgroup[i]==ob->actdef) {
- psys->recalc |= PSYS_RECALC_HAIR;
+ psys->recalc |= PSYS_RECALC_RESET;
break;
}
}
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c
new file mode 100644
index 00000000000..3e6fa9c6cff
--- /dev/null
+++ b/source/blender/editors/space_buttons/buttons_context.c
@@ -0,0 +1,536 @@
+/**
+ * $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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2009 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Blender Foundation
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "MEM_guardedalloc.h"
+
+#include "DNA_armature_types.h"
+#include "DNA_lamp_types.h"
+#include "DNA_material_types.h"
+#include "DNA_modifier_types.h"
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_screen_types.h"
+#include "DNA_space_types.h"
+#include "DNA_particle_types.h"
+#include "DNA_texture_types.h"
+#include "DNA_world_types.h"
+
+#include "BLI_listbase.h"
+
+#include "BKE_context.h"
+#include "BKE_material.h"
+#include "BKE_modifier.h"
+#include "BKE_particle.h"
+#include "BKE_screen.h"
+#include "BKE_utildefines.h"
+
+#include "RNA_access.h"
+
+#include "UI_interface.h"
+#include "UI_resources.h"
+
+#include "buttons_intern.h" // own include
+
+typedef struct ButsContextPath {
+ PointerRNA ptr[8];
+ int len;
+} ButsContextPath;
+
+/************************* Creating the Path ************************/
+
+static int buttons_context_path_scene(ButsContextPath *path)
+{
+ PointerRNA *ptr= &path->ptr[path->len-1];
+
+ /* this one just verifies */
+ return RNA_struct_is_a(ptr->type, &RNA_Scene);
+}
+
+static int buttons_context_path_world(ButsContextPath *path)
+{
+ Scene *scene;
+ PointerRNA *ptr= &path->ptr[path->len-1];
+
+ /* if we already have a (pinned) world, we're done */
+ if(RNA_struct_is_a(ptr->type, &RNA_World)) {
+ return 1;
+ }
+ /* if we have a scene, use the scene's world */
+ else if(buttons_context_path_scene(path)) {
+ scene= path->ptr[path->len-1].data;
+
+ RNA_id_pointer_create(&scene->world->id, &path->ptr[path->len]);
+ path->len++;
+
+ return 1;
+ }
+
+ /* no path to a world possible */
+ return 0;
+}
+
+static int buttons_context_path_object(ButsContextPath *path)
+{
+ Scene *scene;
+ Object *ob;
+ PointerRNA *ptr= &path->ptr[path->len-1];
+
+ /* if we already have a (pinned) object, we're done */
+ if(RNA_struct_is_a(ptr->type, &RNA_Object)) {
+ return 1;
+ }
+ /* if we have a scene, use the scene's active object */
+ else if(buttons_context_path_scene(path)) {
+ scene= path->ptr[path->len-1].data;
+ ob= (scene->basact)? scene->basact->object: NULL;
+
+ if(ob) {
+ RNA_id_pointer_create(&ob->id, &path->ptr[path->len]);
+ path->len++;
+
+ return 1;
+ }
+ }
+
+ /* no path to a object possible */
+ return 0;
+}
+
+static int buttons_context_path_data(ButsContextPath *path, int type)
+{
+ Object *ob;
+
+ /* try to get an object in the path, no pinning supported here */
+ if(buttons_context_path_object(path)) {
+ ob= path->ptr[path->len-1].data;
+
+ if(type == -1 || type == ob->type) {
+ RNA_id_pointer_create(ob->data, &path->ptr[path->len]);
+ path->len++;
+
+ return 1;
+ }
+ }
+
+ /* no path to data possible */
+ return 0;
+}
+
+static int buttons_context_path_material(ButsContextPath *path)
+{
+ Object *ob;
+ PointerRNA *ptr= &path->ptr[path->len-1];
+
+ /* if we already have a (pinned) material, we're done */
+ if(RNA_struct_is_a(ptr->type, &RNA_Material)) {
+ return 1;
+ }
+ /* if we have an object, use the object material slot */
+ else if(buttons_context_path_object(path)) {
+ ob= path->ptr[path->len-1].data;
+
+ if(ob && ob->type && (ob->type<OB_LAMP)) {
+ RNA_pointer_create(&ob->id, &RNA_MaterialSlot, ob->mat+ob->actcol-1, &path->ptr[path->len]);
+ path->len++;
+ return 1;
+ }
+ }
+
+ /* no path to a material possible */
+ return 0;
+}
+
+static Bone *find_active_bone(Bone *bone)
+{
+ Bone *active;
+
+ for(; bone; bone=bone->next) {
+ if(bone->flag & BONE_ACTIVE)
+ return bone;
+
+ active= find_active_bone(bone->childbase.first);
+ if(active)
+ return active;
+ }
+
+ return NULL;
+}
+
+static int buttons_context_path_bone(ButsContextPath *path)
+{
+ bArmature *arm;
+ Bone *bone;
+
+ /* if we have an armature, get the active bone */
+ if(buttons_context_path_data(path, OB_ARMATURE)) {
+ arm= path->ptr[path->len-1].data;
+ bone= find_active_bone(arm->bonebase.first);
+
+ if(bone) {
+ RNA_pointer_create(&arm->id, &RNA_Bone, bone, &path->ptr[path->len]);
+ path->len++;
+ return 1;
+ }
+ }
+
+ /* no path to a bone possible */
+ return 0;
+}
+
+static int buttons_context_path_particle(ButsContextPath *path)
+{
+ Object *ob;
+ ParticleSystem *psys;
+
+ /* if we have an object, get the active particle system */
+ if(buttons_context_path_object(path)) {
+ ob= path->ptr[path->len-1].data;
+ psys= psys_get_current(ob);
+
+ RNA_pointer_create(&ob->id, &RNA_ParticleSystem, psys, &path->ptr[path->len]);
+ path->len++;
+ return 1;
+ }
+
+ /* no path to a particle system possible */
+ return 0;
+}
+
+static int buttons_context_path_texture(ButsContextPath *path)
+{
+ Object *ob;
+ Lamp *la;
+ Material *ma;
+ PointerRNA *ptr= &path->ptr[path->len-1];
+
+ /* if we already have a (pinned) texture, we're done */
+ if(RNA_struct_is_a(ptr->type, &RNA_Texture)) {
+ return 1;
+ }
+ /* try to get the active material */
+ else if(buttons_context_path_material(path)) {
+ ptr= &path->ptr[path->len-1];
+
+ if(RNA_struct_is_a(ptr->type, &RNA_Material)) {
+ ma= ptr->data;
+ }
+ else if(RNA_struct_is_a(ptr->type, &RNA_MaterialSlot)) {
+ ob= ptr->id.data;
+ ma= give_current_material(ob, (Material**)ptr->data - ob->mat);
+ }
+ else
+ ma= NULL;
+
+ if(ma) {
+ RNA_pointer_create(&ma->id, &RNA_TextureSlot, ma->mtex[(int)ma->texact], &path->ptr[path->len]);
+ path->len++;
+ return 1;
+ }
+ }
+ /* try to get the active lamp */
+ else if(buttons_context_path_data(path, OB_LAMP)) {
+ la= path->ptr[path->len-1].data;
+
+ if(la) {
+ RNA_pointer_create(&la->id, &RNA_TextureSlot, la->mtex[(int)la->texact], &path->ptr[path->len]);
+ path->len++;
+ return 1;
+ }
+ }
+ /* TODO: world, brush */
+
+ /* no path to a particle system possible */
+ return 0;
+}
+
+static int buttons_context_path(const bContext *C, ButsContextPath *path)
+{
+ SpaceButs *sbuts= (SpaceButs*)CTX_wm_space_data(C);
+ ID *id;
+ int found;
+
+ memset(path, 0, sizeof(*path));
+
+ /* if some ID datablock is pinned, set the root pointer */
+ if(sbuts->pinid) {
+ id= sbuts->pinid;
+
+ RNA_id_pointer_create(id, &path->ptr[0]);
+ path->len++;
+ }
+
+ /* no pinned root, use scene as root */
+ if(path->len == 0) {
+ id= (ID*)CTX_data_scene(C);
+ RNA_id_pointer_create(id, &path->ptr[0]);
+ path->len++;
+ }
+
+ /* now for each buttons context type, we try to construct a path,
+ * tracing back recursively */
+ switch(sbuts->mainb) {
+ case BCONTEXT_SCENE:
+ found= buttons_context_path_scene(path);
+ break;
+ case BCONTEXT_WORLD:
+ found= buttons_context_path_world(path);
+ break;
+ case BCONTEXT_OBJECT:
+ case BCONTEXT_PHYSICS:
+ case BCONTEXT_MODIFIER:
+ found= buttons_context_path_object(path);
+ break;
+ case BCONTEXT_DATA:
+ found= buttons_context_path_data(path, -1);
+ break;
+ case BCONTEXT_PARTICLE:
+ found= buttons_context_path_particle(path);
+ break;
+ case BCONTEXT_MATERIAL:
+ found= buttons_context_path_material(path);
+ break;
+ case BCONTEXT_TEXTURE:
+ found= buttons_context_path_texture(path);
+ break;
+ case BCONTEXT_BONE:
+ found= buttons_context_path_bone(path);
+ break;
+ default:
+ found= 0;
+ break;
+ }
+
+ return found;
+}
+
+void buttons_context_compute(const bContext *C, SpaceButs *sbuts)
+{
+ if(!sbuts->path)
+ sbuts->path= MEM_callocN(sizeof(ButsContextPath), "ButsContextPath");
+
+ buttons_context_path(C, sbuts->path);
+}
+
+/************************* Context Callback ************************/
+
+static int set_pointer_type(ButsContextPath *path, bContextDataResult *result, StructRNA *type)
+{
+ PointerRNA *ptr;
+ int a;
+
+ for(a=0; a<path->len; a++) {
+ ptr= &path->ptr[a];
+
+ if(RNA_struct_is_a(ptr->type, type)) {
+ CTX_data_pointer_set(result, ptr->id.data, ptr->type, ptr->data);
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+static PointerRNA *get_pointer_type(ButsContextPath *path, StructRNA *type)
+{
+ PointerRNA *ptr;
+ int a;
+
+ for(a=0; a<path->len; a++) {
+ ptr= &path->ptr[a];
+
+ if(RNA_struct_is_a(ptr->type, type))
+ return ptr;
+ }
+
+ return NULL;
+}
+
+int buttons_context(const bContext *C, const char *member, bContextDataResult *result)
+{
+ SpaceButs *sbuts= (SpaceButs*)CTX_wm_space_data(C);
+ ButsContextPath *path= sbuts->path;
+
+ if(!path)
+ return 0;
+
+ /* here we handle context, getting data from precomputed path */
+
+ if(CTX_data_equals(member, "world")) {
+ set_pointer_type(path, result, &RNA_World);
+ return 1;
+ }
+ else if(CTX_data_equals(member, "object")) {
+ set_pointer_type(path, result, &RNA_Object);
+ return 1;
+ }
+ else if(CTX_data_equals(member, "mesh")) {
+ set_pointer_type(path, result, &RNA_Mesh);
+ return 1;
+ }
+ else if(CTX_data_equals(member, "armature")) {
+ set_pointer_type(path, result, &RNA_Armature);
+ return 1;
+ }
+ else if(CTX_data_equals(member, "lattice")) {
+ set_pointer_type(path, result, &RNA_Lattice);
+ return 1;
+ }
+ else if(CTX_data_equals(member, "curve")) {
+ set_pointer_type(path, result, &RNA_Curve);
+ return 1;
+ }
+ else if(CTX_data_equals(member, "meta_ball")) {
+ set_pointer_type(path, result, &RNA_MetaBall);
+ return 1;
+ }
+ else if(CTX_data_equals(member, "lamp")) {
+ set_pointer_type(path, result, &RNA_Lamp);
+ return 1;
+ }
+ else if(CTX_data_equals(member, "camera")) {
+ set_pointer_type(path, result, &RNA_Camera);
+ return 1;
+ }
+ else if(CTX_data_equals(member, "material")) {
+ if(!set_pointer_type(path, result, &RNA_Material)) {
+ PointerRNA *ptr= get_pointer_type(path, &RNA_MaterialSlot);
+
+ if(ptr && ptr->data) {
+ Object *ob= ptr->id.data;
+ Material *ma= give_current_material(ob, (Material**)ptr->data - ob->mat);
+ CTX_data_id_pointer_set(result, &ma->id);
+ }
+ }
+
+ return 1;
+ }
+ else if(CTX_data_equals(member, "texture")) {
+ if(!set_pointer_type(path, result, &RNA_Texture)) {
+ PointerRNA *ptr= get_pointer_type(path, &RNA_TextureSlot);
+
+ if(ptr && ptr->data)
+ CTX_data_id_pointer_set(result, &((MTex*)ptr->data)->tex->id);
+ }
+
+ return 1;
+ }
+ else if(CTX_data_equals(member, "material_slot")) {
+ set_pointer_type(path, result, &RNA_MaterialSlot);
+ return 1;
+ }
+ else if(CTX_data_equals(member, "texture_slot")) {
+ set_pointer_type(path, result, &RNA_TextureSlot);
+ return 1;
+ }
+ else if(CTX_data_equals(member, "bone")) {
+ set_pointer_type(path, result, &RNA_Bone);
+ return 1;
+ }
+ else if(CTX_data_equals(member, "particle_system")) {
+ set_pointer_type(path, result, &RNA_ParticleSystem);
+ return 1;
+ }
+ else if(CTX_data_equals(member, "cloth")) {
+ set_pointer_type(path, result, &RNA_ClothModifier);
+ return 1;
+ }
+ else if(CTX_data_equals(member, "soft_body")) {
+ PointerRNA *ptr= get_pointer_type(path, &RNA_Object);
+
+ if(ptr && ptr->data) {
+ Object *ob= ptr->data;
+ CTX_data_pointer_set(result, &ob->id, &RNA_SoftBodySettings, ob->soft);
+ return 1;
+ }
+ }
+ else if(CTX_data_equals(member, "fluid")) {
+ PointerRNA *ptr= get_pointer_type(path, &RNA_Object);
+
+ if(ptr && ptr->data) {
+ Object *ob= ptr->data;
+ ModifierData *md= modifiers_findByType(ob, eModifierType_Fluidsim);
+ CTX_data_pointer_set(result, &ob->id, &RNA_FluidSimulationModifier, md);
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+/************************* Drawing the Path ************************/
+
+static void buttons_panel_context(const bContext *C, Panel *pa)
+{
+ SpaceButs *sbuts= (SpaceButs*)CTX_wm_space_data(C);
+ ButsContextPath *path= sbuts->path;
+ uiLayout *row;
+ PointerRNA *ptr;
+ PropertyRNA *nameprop;
+ char namebuf[128], *name;
+ int a, icon;
+
+ if(!path)
+ return;
+
+ row= uiLayoutRow(pa->layout, 0);
+ uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_LEFT);
+
+ for(a=0; a<path->len; a++) {
+ ptr= &path->ptr[a];
+
+ if(ptr->data) {
+ icon= RNA_struct_ui_icon(ptr->type);
+ nameprop= RNA_struct_name_property(ptr->type);
+
+ if(nameprop) {
+ name= RNA_property_string_get_alloc(ptr, nameprop, namebuf, sizeof(namebuf));
+
+ uiItemL(row, name, icon);
+
+ if(name != namebuf)
+ MEM_freeN(name);
+ }
+ else
+ uiItemL(row, "", icon);
+ }
+ }
+}
+
+void buttons_context_register(ARegionType *art)
+{
+ PanelType *pt;
+
+ pt= MEM_callocN(sizeof(PanelType), "spacetype buttons panel context");
+ strcpy(pt->idname, "BUTTONS_PT_context");
+ strcpy(pt->label, "Context");
+ pt->draw= buttons_panel_context;
+ BLI_addtail(&art->paneltypes, pt);
+}
+
diff --git a/source/blender/editors/space_buttons/buttons_intern.h b/source/blender/editors/space_buttons/buttons_intern.h
index 6050b4f0562..04c7241c465 100644
--- a/source/blender/editors/space_buttons/buttons_intern.h
+++ b/source/blender/editors/space_buttons/buttons_intern.h
@@ -31,20 +31,7 @@
struct ARegion;
struct ARegionType;
struct bContext;
-
-/* warning: the values of these defines are used in sbuts->tabs[8] */
-/* buts->mainb new */
-#define BCONTEXT_SCENE 0
-#define BCONTEXT_WORLD 1
-#define BCONTEXT_OBJECT 2
-#define BCONTEXT_DATA 3
-#define BCONTEXT_MATERIAL 4
-#define BCONTEXT_TEXTURE 5
-#define BCONTEXT_PARTICLE 6
-#define BCONTEXT_PHYSICS 7
-#define BCONTEXT_GAME 8
-#define BCONTEXT_BONE 9
-#define BCONTEXT_MODIFIER 10
+struct bContextDataResult;
/* buts->scaflag */
#define BUTS_SENS_SEL 1
@@ -61,8 +48,13 @@ struct bContext;
/* internal exports only */
-/* image_header.c */
+/* buttons_header.c */
void buttons_header_buttons(const struct bContext *C, struct ARegion *ar);
+/* buttons_context.c */
+void buttons_context_compute(const struct bContext *C, SpaceButs *sbuts);
+int buttons_context(const struct bContext *C, const char *member, struct bContextDataResult *result);
+void buttons_context_register(struct ARegionType *art);
+
#endif /* ED_BUTTONS_INTERN_H */
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index 9f5e0f5974a..57ca7cc23d8 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -122,9 +122,10 @@ static void buttons_free(SpaceLink *sl)
if (sbuts->ri->rect) MEM_freeN(sbuts->ri->rect);
MEM_freeN(sbuts->ri);
}
-
-}
+ if(sbuts->path)
+ MEM_freeN(sbuts->path);
+}
/* spacetype; init callback */
static void buttons_init(struct wmWindowManager *wm, ScrArea *sa)
@@ -146,6 +147,7 @@ static SpaceLink *buttons_duplicate(SpaceLink *sl)
/* clear or remove stuff from old */
sbutsn->ri= NULL;
+ sbutsn->path= NULL;
return (SpaceLink *)sbutsn;
}
@@ -168,6 +170,8 @@ static void buttons_main_area_draw(const bContext *C, ARegion *ar)
SpaceButs *sbuts= (SpaceButs*)CTX_wm_space_data(C);
int vertical= (sbuts->align == BUT_VERTICAL);
+ buttons_context_compute(C, sbuts);
+
if(sbuts->mainb == BCONTEXT_SCENE)
ED_region_panels(C, ar, vertical, "scene");
else if(sbuts->mainb == BCONTEXT_WORLD)
@@ -191,7 +195,6 @@ static void buttons_main_area_draw(const bContext *C, ARegion *ar)
sbuts->re_align= 0;
sbuts->mainbo= sbuts->mainb;
- sbuts->tabo= sbuts->tab[sbuts->mainb];
}
void buttons_operatortypes(void)
@@ -272,6 +275,7 @@ void ED_spacetype_buttons(void)
st->duplicate= buttons_duplicate;
st->operatortypes= buttons_operatortypes;
st->keymap= buttons_keymap;
+ st->context= buttons_context;
/* regions: main window */
art= MEM_callocN(sizeof(ARegionType), "spacetype buttons region");
@@ -281,6 +285,8 @@ void ED_spacetype_buttons(void)
art->listener= buttons_area_listener;
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_FRAMES;
BLI_addhead(&st->regiontypes, art);
+
+ buttons_context_register(art);
/* regions: header */
art= MEM_callocN(sizeof(ARegionType), "spacetype buttons region");
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index bbe8245a3f7..6ed8f87d987 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -444,13 +444,11 @@ void file_draw_list(const bContext *C, ARegion *ar)
int colorid = 0;
short sx, sy;
int offset;
- short type;
int i;
float sw, spos;
numfiles = filelist_numfiles(files);
- type = filelist_gettype(files);
-
+
sx = ar->v2d.tot.xmin + layout->tile_border_x/2;
sy = ar->v2d.cur.ymax - layout->tile_border_y;
diff --git a/source/blender/editors/space_file/file_header.c b/source/blender/editors/space_file/file_header.c
index bfa0a553334..4799003d6c7 100644
--- a/source/blender/editors/space_file/file_header.c
+++ b/source/blender/editors/space_file/file_header.c
@@ -63,6 +63,7 @@
#define B_SORTIMASELLIST 1
#define B_RELOADIMASELDIR 2
#define B_FILTERIMASELDIR 3
+#define B_HIDEDOTFILES 4
/* ************************ header area region *********************** */
@@ -88,6 +89,14 @@ static void do_file_header_buttons(bContext *C, void *arg, int event)
}
}
WM_event_add_notifier(C, NC_WINDOW, NULL);
+ break;
+ case B_HIDEDOTFILES:
+ if(sfile->params) {
+ filelist_free(sfile->files);
+ filelist_hidedot(sfile->files, sfile->params->flag & FILE_HIDE_DOT);
+ WM_event_add_notifier(C, NC_WINDOW, NULL);
+ }
+ break;
}
}
@@ -126,15 +135,14 @@ void file_header_buttons(const bContext *C, ARegion *ar)
xco += 5;
- if (sfile->params->type != FILE_MAIN) {
- uiBlockBeginAlign(block);
- uiDefIconButS(block, ROW, B_RELOADIMASELDIR, ICON_SHORTDISPLAY, xco+=XIC, yco, XIC,YIC, &params->display, 1.0, FILE_SHORTDISPLAY, 0, 0, "Displays short file description");
- uiDefIconButS(block, ROW, B_RELOADIMASELDIR, ICON_LONGDISPLAY, xco+=XIC, yco, XIC,YIC, &params->display, 1.0, FILE_LONGDISPLAY, 0, 0, "Displays long file description");
- uiDefIconButS(block, ROW, B_RELOADIMASELDIR, ICON_IMGDISPLAY, xco+=XIC, yco, XIC,YIC, &params->display, 1.0, FILE_IMGDISPLAY, 0, 0, "Displays files as thumbnails");
- uiBlockEndAlign(block);
-
- xco+=XIC;
- }
+ uiBlockBeginAlign(block);
+ uiDefIconButS(block, ROW, B_RELOADIMASELDIR, ICON_SHORTDISPLAY, xco+=XIC, yco, XIC,YIC, &params->display, 1.0, FILE_SHORTDISPLAY, 0, 0, "Displays short file description");
+ uiDefIconButS(block, ROW, B_RELOADIMASELDIR, ICON_LONGDISPLAY, xco+=XIC, yco, XIC,YIC, &params->display, 1.0, FILE_LONGDISPLAY, 0, 0, "Displays long file description");
+ uiDefIconButS(block, ROW, B_RELOADIMASELDIR, ICON_IMGDISPLAY, xco+=XIC, yco, XIC,YIC, &params->display, 1.0, FILE_IMGDISPLAY, 0, 0, "Displays files as thumbnails");
+ uiBlockEndAlign(block);
+
+ xco+=XIC;
+
uiBlockBeginAlign(block);
uiDefIconButS(block, ROW, B_SORTIMASELLIST, ICON_SORTALPHA, xco+=XIC, yco, XIC,YIC, &params->sort, 1.0, 0.0, 0, 0, "Sorts files alphabetically");
@@ -144,17 +152,8 @@ void file_header_buttons(const bContext *C, ARegion *ar)
uiBlockEndAlign(block);
xco+=XIC;
-
- /* replace with consistent sub-region collapsing
- if (sfile->params->type != FILE_MAIN) {
- uiBlockBeginAlign(block);
- // uiDefIconButBitS(block, TOG, FILE_BOOKMARKS, B_RELOADIMASELDIR, ICON_BOOKMARKS,xco+=XIC,0,XIC,YIC, &params->flag, 0, 0, 0, 0, "Toggles Bookmarks on/off");
- uiDefIconButO(block, TOG, "FILE_OT_bookmark_toggle", WM_OP_INVOKE_DEFAULT, ICON_BOOKMARKS, xco+XIC,yco,20,20, "Toggle Bookmarks");
- uiBlockEndAlign(block);
- xco+=XIC;
- }
- */
-
+ uiDefIconButBitS(block, TOG, FILE_HIDE_DOT, B_HIDEDOTFILES, ICON_GHOST,xco+=XIC,yco,XIC,YIC, &params->flag, 0, 0, 0, 0, "Hide dot files");
+ xco+=XIC;
uiDefIconButBitS(block, TOG, FILE_FILTER, B_FILTERIMASELDIR, ICON_FILTER,xco+=XIC,yco,XIC,YIC, &params->flag, 0, 0, 0, 0, "Filter files");
if (params->flag & FILE_FILTER) {
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 94c023207f5..01f94741f59 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -480,6 +480,36 @@ int file_exec(bContext *C, wmOperator *unused)
strcat(name, sfile->params->file);
RNA_string_set(op->ptr, "filename", name);
+ /* some ops have multiple files to select */
+ {
+ PointerRNA itemptr;
+ int i, numfiles = filelist_numfiles(sfile->files);
+ struct direntry *file;
+ if(RNA_struct_find_property(op->ptr, "files")) {
+ for (i=0; i<numfiles; i++) {
+ file = filelist_file(sfile->files, i);
+ if(file->flags & ACTIVE) {
+ if ((file->type & S_IFDIR)==0) {
+ RNA_collection_add(op->ptr, "files", &itemptr);
+ RNA_string_set(&itemptr, "name", file->relname);
+ }
+ }
+ }
+ }
+
+ if(RNA_struct_find_property(op->ptr, "dirs")) {
+ for (i=0; i<numfiles; i++) {
+ file = filelist_file(sfile->files, i);
+ if(file->flags & ACTIVE) {
+ if ((file->type & S_IFDIR)) {
+ RNA_collection_add(op->ptr, "dirs", &itemptr);
+ RNA_string_set(&itemptr, "name", file->relname);
+ }
+ }
+ }
+ }
+ }
+
fsmenu_insert_entry(fsmenu_get(), FS_CATEGORY_RECENT, sfile->params->dir,0, 1);
BLI_make_file_string(G.sce, name, BLI_gethome(), ".Bfs");
fsmenu_write_file(fsmenu_get(), name);
diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c
index 01cdf559c58..f60b6f08348 100644
--- a/source/blender/editors/space_file/filelist.c
+++ b/source/blender/editors/space_file/filelist.c
@@ -113,7 +113,6 @@ typedef struct FileList
int numfiles;
int numfiltered;
char dir[FILE_MAX];
- short type;
int has_func;
short prv_w;
short prv_h;
@@ -358,12 +357,6 @@ void filelist_free_icons()
struct FileList* filelist_new()
{
FileList* p = MEM_callocN( sizeof(FileList), "filelist" );
- p->filelist = 0;
- p->numfiles = 0;
- p->dir[0] = '\0';
- p->type = 0;
- p->has_func = 0;
- p->filter = 0;
return p;
}
@@ -373,7 +366,6 @@ struct FileList* filelist_copy(struct FileList* filelist)
BLI_strncpy(p->dir, filelist->dir, FILE_MAX);
p->filelist = NULL;
p->fidx = NULL;
- p->type = filelist->type;
return p;
}
@@ -413,6 +405,7 @@ void filelist_free(struct FileList* filelist)
filelist->filelist = 0;
filelist->filter = 0;
filelist->numfiltered =0;
+ filelist->hide_dot =0;
}
int filelist_numfiles(struct FileList* filelist)
@@ -510,48 +503,46 @@ void filelist_loadimage(struct FileList* filelist, int index)
if (!filelist->filelist[fidx].image)
{
- if (filelist->type != FILE_MAIN)
- {
- if ( (filelist->filelist[fidx].flags & IMAGEFILE) || (filelist->filelist[fidx].flags & MOVIEFILE) ) {
- imb = IMB_thumb_read(filelist->dir, filelist->filelist[fidx].relname, THB_NORMAL);
- }
- if (imb) {
- if (imb->x > imb->y) {
- scaledx = (float)imgwidth;
- scaledy = ( (float)imb->y/(float)imb->x )*imgwidth;
- }
- else {
- scaledy = (float)imgheight;
- scaledx = ( (float)imb->x/(float)imb->y )*imgheight;
- }
- ex = (short)scaledx;
- ey = (short)scaledy;
-
- dx = imgwidth - ex;
- dy = imgheight - ey;
-
- // IMB_scaleImBuf(imb, ex, ey);
- filelist->filelist[fidx].image = imb;
- } else {
- /* prevent loading image twice */
- FileImage* limg = filelist->loadimages.first;
- short found= 0;
- while(limg) {
- if (limg->index == fidx) {
- found= 1;
- break;
- }
- limg= limg->next;
- }
- if (!found) {
- FileImage* limg = MEM_callocN(sizeof(struct FileImage), "loadimage");
- limg->index= fidx;
- limg->lock= 0;
- limg->filelist= filelist;
- BLI_addtail(&filelist->loadimages, limg);
+
+ if ( (filelist->filelist[fidx].flags & IMAGEFILE) || (filelist->filelist[fidx].flags & MOVIEFILE) ) {
+ imb = IMB_thumb_read(filelist->dir, filelist->filelist[fidx].relname, THB_NORMAL);
+ }
+ if (imb) {
+ if (imb->x > imb->y) {
+ scaledx = (float)imgwidth;
+ scaledy = ( (float)imb->y/(float)imb->x )*imgwidth;
+ }
+ else {
+ scaledy = (float)imgheight;
+ scaledx = ( (float)imb->x/(float)imb->y )*imgheight;
+ }
+ ex = (short)scaledx;
+ ey = (short)scaledy;
+
+ dx = imgwidth - ex;
+ dy = imgheight - ey;
+
+ // IMB_scaleImBuf(imb, ex, ey);
+ filelist->filelist[fidx].image = imb;
+ } else {
+ /* prevent loading image twice */
+ FileImage* limg = filelist->loadimages.first;
+ short found= 0;
+ while(limg) {
+ if (limg->index == fidx) {
+ found= 1;
+ break;
}
- }
- }
+ limg= limg->next;
+ }
+ if (!found) {
+ FileImage* limg = MEM_callocN(sizeof(struct FileImage), "loadimage");
+ limg->index= fidx;
+ limg->lock= 0;
+ limg->filelist= filelist;
+ BLI_addtail(&filelist->loadimages, limg);
+ }
+ }
}
}
@@ -826,16 +817,6 @@ void filelist_swapselect(struct FileList* filelist)
}
}
-void filelist_settype(struct FileList* filelist, int type)
-{
- filelist->type = type;
-}
-
-short filelist_gettype(struct FileList* filelist)
-{
- return filelist->type;
-}
-
void filelist_sort(struct FileList* filelist, short sort)
{
struct direntry *file;
diff --git a/source/blender/editors/space_file/filelist.h b/source/blender/editors/space_file/filelist.h
index 4aa8359b068..f10c89926d6 100644
--- a/source/blender/editors/space_file/filelist.h
+++ b/source/blender/editors/space_file/filelist.h
@@ -70,8 +70,7 @@ void filelist_readdir(struct FileList* filelist);
int filelist_empty(struct FileList* filelist);
void filelist_parent(struct FileList* filelist);
void filelist_setfiletypes(struct FileList* filelist, short has_quicktime);
-void filelist_settype(struct FileList* filelist, int type);
-short filelist_gettype(struct FileList* filelist);
+
#ifdef __cplusplus
}
diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c
index 091319cd402..4c2def72de0 100644
--- a/source/blender/editors/space_file/filesel.c
+++ b/source/blender/editors/space_file/filesel.c
@@ -84,13 +84,13 @@
FileSelectParams* ED_fileselect_get_params(struct SpaceFile *sfile)
{
if (!sfile->params) {
- ED_fileselect_set_params(sfile, FILE_UNIX, "", "/", 0, FILE_SHORTDISPLAY, 0);
+ ED_fileselect_set_params(sfile, "", "/", 0, FILE_SHORTDISPLAY, 0, FILE_SORTALPHA);
}
return sfile->params;
}
-short ED_fileselect_set_params(SpaceFile *sfile, int type, const char *title, const char *path,
- short flag, short display, short filter)
+short ED_fileselect_set_params(SpaceFile *sfile, const char *title, const char *path,
+ short flag, short display, short filter, short sort)
{
char name[FILE_MAX], dir[FILE_MAX], file[FILE_MAX];
FileSelectParams *params;
@@ -101,39 +101,26 @@ short ED_fileselect_set_params(SpaceFile *sfile, int type, const char *title, co
params = sfile->params;
- params->type = type;
params->flag = flag;
params->display = display;
params->filter = filter;
+ params->sort = sort;
BLI_strncpy(params->title, title, sizeof(params->title));
BLI_strncpy(name, path, sizeof(name));
BLI_convertstringcode(name, G.sce);
-
- switch(type) {
- case FILE_MAIN:
- break;
- case FILE_LOADLIB:
- break;
- case FILE_BLENDER:
- case FILE_LOADFONT:
- default:
- {
- BLI_split_dirfile(name, dir, file);
- BLI_strncpy(params->file, file, sizeof(params->file));
- BLI_strncpy(params->dir, dir, sizeof(params->dir));
- BLI_make_file_string(G.sce, params->dir, dir, ""); /* XXX needed ? - also solve G.sce */
- }
- break;
- }
+
+ BLI_split_dirfile(name, dir, file);
+ BLI_strncpy(params->file, file, sizeof(params->file));
+ BLI_strncpy(params->dir, dir, sizeof(params->dir));
+ BLI_make_file_string(G.sce, params->dir, dir, ""); /* XXX needed ? - also solve G.sce */
return 1;
}
void ED_fileselect_reset_params(SpaceFile *sfile)
{
- sfile->params->type = FILE_UNIX;
sfile->params->flag = 0;
sfile->params->title[0] = '\0';
}
diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c
index 084fcf1e5f6..37d8f2bffa4 100644
--- a/source/blender/editors/space_file/space_file.c
+++ b/source/blender/editors/space_file/space_file.c
@@ -156,7 +156,6 @@ static SpaceLink *file_duplicate(SpaceLink *sl)
sfilen->params= MEM_dupallocN(sfileo->params);
filelist_setdir(sfilen->files, sfilen->params->dir);
- filelist_settype(sfilen->files, sfilen->params->type);
}
if (sfileo->layout) {
sfilen->layout= MEM_dupallocN(sfileo->layout);
@@ -193,7 +192,6 @@ static void file_main_area_draw(const bContext *C, ARegion *ar)
if (!sfile->files) {
sfile->files = filelist_new();
filelist_setdir(sfile->files, params->dir);
- filelist_settype(sfile->files, params->type);
params->active_file = -1; // added this so it opens nicer (ton)
}
diff --git a/source/blender/editors/space_info/info_header.c b/source/blender/editors/space_info/info_header.c
index fd5d851b0c2..c8dd3df8425 100644
--- a/source/blender/editors/space_info/info_header.c
+++ b/source/blender/editors/space_info/info_header.c
@@ -387,6 +387,40 @@ static void scene_idpoin_handle(bContext *C, ID *id, int event)
}
}
+static void operator_call_cb(struct bContext *C, void *arg1, void *arg2)
+{
+ wmOperatorType *ot= arg2;
+
+ if(ot)
+ WM_operator_name_call(C, ot->idname, WM_OP_INVOKE_DEFAULT, NULL);
+}
+
+static void operator_search_cb(const struct bContext *C, void *arg, char *str, uiSearchItems *items)
+{
+ wmOperatorType *ot = WM_operatortype_first();
+
+ for(; ot; ot= ot->next) {
+
+ if(BLI_strcasestr(ot->name, str)) {
+ if(ot->poll==NULL || ot->poll((bContext *)C)) {
+ char name[256];
+ int len= strlen(ot->name);
+
+ /* display name for menu, can hold hotkey */
+ BLI_strncpy(name, ot->name, 256);
+
+ /* check for hotkey */
+ if(len < 256-6) {
+ if(WM_key_event_operator_string(C, ot->idname, WM_OP_EXEC_DEFAULT, NULL, &name[len+1], 256-len-1))
+ name[len]= '|';
+ }
+
+ if(0==uiSearchItemAdd(items, name, ot))
+ break;
+ }
+ }
+ }
+}
void info_header_buttons(const bContext *C, ARegion *ar)
{
@@ -453,6 +487,16 @@ void info_header_buttons(const bContext *C, ARegion *ar)
xco+= 90;
}
+ {
+ static char search[256]= "";
+ uiBut *but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, 256, xco+5, yco, 120, 19, "");
+
+ uiButSetSearchFunc(but, operator_search_cb, NULL, operator_call_cb);
+
+ xco+= 125;
+ }
+
+
/* always as last */
UI_view2d_totRect_set(&ar->v2d, xco+XIC+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin);
diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c
index 2d544b402ec..16748af39d5 100644
--- a/source/blender/editors/space_outliner/outliner.c
+++ b/source/blender/editors/space_outliner/outliner.c
@@ -1750,7 +1750,7 @@ static int tree_element_active_texture(Scene *scene, SpaceOops *soops, TreeEleme
if(set) {
if(sbuts) {
- sbuts->tabo= TAB_SHADING_TEX; // hack from header_buttonswin.c
+ // XXX sbuts->tabo= TAB_SHADING_TEX; // hack from header_buttonswin.c
sbuts->texfrom= 1;
}
// XXX extern_set_butspace(F6KEY, 0); // force shading buttons texture
@@ -1764,7 +1764,7 @@ static int tree_element_active_texture(Scene *scene, SpaceOops *soops, TreeEleme
Lamp *la= (Lamp *)tselemp->id;
if(set) {
if(sbuts) {
- sbuts->tabo= TAB_SHADING_TEX; // hack from header_buttonswin.c
+ // XXX sbuts->tabo= TAB_SHADING_TEX; // hack from header_buttonswin.c
sbuts->texfrom= 2;
}
// XXX extern_set_butspace(F6KEY, 0); // force shading buttons texture
@@ -3643,7 +3643,7 @@ static void tselem_draw_icon(float x, float y, TreeStoreElem *tselem, TreeElemen
UI_icon_draw(x, y, ICON_OBJECT_DATA);
break;
case TSE_RNA_STRUCT:
- UI_icon_draw(x, y, UI_GetIconRNA(&te->rnaptr));
+ UI_icon_draw(x, y, RNA_struct_ui_icon(te->rnaptr.type));
break;
default:
UI_icon_draw(x, y, ICON_DOT); break;
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index 6e38ff053be..8373f588fb2 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -423,9 +423,7 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
Scene *scene= CTX_data_scene(C);
Editing *ed= seq_give_editing(scene, TRUE);
-
- int tot_images= 1; //XXX FIXME, we need string arrays!
- //int a;
+ int tot_images;
char filename[FILE_MAX];
@@ -440,26 +438,30 @@ static int sequencer_add_image_strip_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "filename", filename);
- seq = alloc_sequence(ed->seqbasep, start_frame, channel);
-
+ seq = alloc_sequence(ed->seqbasep, start_frame, channel);
seq->type= SEQ_IMAGE;
/* basic defaults */
seq->strip= strip= MEM_callocN(sizeof(Strip), "strip");
- strip->len = seq->len = tot_images;
+ BLI_split_dirfile_basic(filename, strip->dir, NULL);
+
+ tot_images= RNA_property_collection_length(op->ptr, RNA_struct_find_property(op->ptr, "files"));
+
+ strip->len = seq->len = tot_images?tot_images:1;
strip->us= 1;
strip->stripdata= se= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
-
- BLI_split_dirfile_basic(filename, strip->dir, se->name); // XXX se->name assignment should be moved into the loop below
-
-#if 0 // XXX
- for(a=0; a<seq->len; a++) {
- strncpy(se->name, name, FILE_MAXFILE-1);
- se++;
+ if(tot_images) {
+ RNA_BEGIN(op->ptr, itemptr, "files") {
+ RNA_string_get(&itemptr, "name", se->name);
+ se++;
+ }
+ RNA_END;
+ }
+ else {
+ BLI_split_dirfile_basic(filename, NULL, se->name);
}
-#endif
RNA_string_get(op->ptr, "name", seq->name);
@@ -507,6 +509,8 @@ void SEQUENCER_OT_image_strip_add(struct wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
sequencer_generic_props__internal(ot, SEQPROP_STARTFRAME|SEQPROP_FILENAME);
+
+ RNA_def_collection_runtime(ot->srna, "files", &RNA_OperatorFileListElement, "Files", "");
}
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 054cd4e966e..a67e8c8a1c3 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -3042,7 +3042,11 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
}
totpart=psys->totpart;
- draw_as=part->draw_as;
+
+ if(part->draw_as==PART_DRAW_REND)
+ draw_as = part->ren_as;
+ else
+ draw_as = part->draw_as;
if(part->flag&PART_GLOB_TIME)
cfra=bsystem_time(scene, 0, (float)CFRA, 0.0f);
@@ -3489,7 +3493,6 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
glColorPointer(3, GL_FLOAT, 0, cdata);
}
-
/* draw created data arrays */
switch(draw_as){
case PART_DRAW_AXIS:
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 3b3fd5109cf..eaff77aabe9 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -394,6 +394,7 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn)
case ND_DRAW:
case ND_MODIFIER:
case ND_KEYS:
+ case ND_PARTICLE:
ED_region_tag_redraw(ar);
break;
}
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 06e5f69bbdf..e1a6f32aa41 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -203,6 +203,7 @@ void smooth_view(bContext *C, Object *oldcamera, Object *camera, float *ofs, flo
struct SmoothViewStore sms;
/* initialize sms */
+ memset(&sms,0,sizeof(struct SmoothViewStore));
VECCOPY(sms.new_ofs, rv3d->ofs);
QUATCOPY(sms.new_quat, rv3d->viewquat);
sms.new_dist= rv3d->dist;
diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h
index 575fcfd8ac7..6805082d094 100644
--- a/source/blender/makesdna/DNA_particle_types.h
+++ b/source/blender/makesdna/DNA_particle_types.h
@@ -106,6 +106,7 @@ typedef struct ParticleSettings {
/* physics modes */
short phystype, rotmode, avemode, reactevent;
short draw, draw_as, draw_size, childtype;
+ short ren_as, rt2[3];
/* number of path segments, power of 2 except */
short draw_step, ren_step;
short hair_step, keys_step;
@@ -302,12 +303,12 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in
/* part->draw */
#define PART_DRAW_VEL 1
-#define PART_DRAW_ANG 2
+//#define PART_DRAW_PATH_LEN 2
#define PART_DRAW_SIZE 4
#define PART_DRAW_EMITTER 8 /* render emitter also */
-//#define PART_DRAW_KEYS 16 /* not used anywhere */
-#define PART_DRAW_ADAPT 32
-#define PART_DRAW_COS 64
+//#define PART_DRAW_HEALTH 16
+//#define PART_DRAW_TIMED_PATH 32
+//#define PART_DRAW_CACHED_PATH 64
#define PART_DRAW_BB_LOCK 128
#define PART_DRAW_PARENT 256
#define PART_DRAW_NUM 512
@@ -341,9 +342,11 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in
#define PART_BB_OFF_LINEAR 1
#define PART_BB_OFF_RANDOM 2
-/* part->draw as */
+/* part->draw_as */
+/* part->ren_as*/
#define PART_DRAW_NOT 0
#define PART_DRAW_DOT 1
+#define PART_DRAW_HALO 1
#define PART_DRAW_CIRC 2
#define PART_DRAW_CROSS 3
#define PART_DRAW_AXIS 4
@@ -352,6 +355,7 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in
#define PART_DRAW_OB 7
#define PART_DRAW_GR 8
#define PART_DRAW_BB 9
+#define PART_DRAW_REND 10
/* part->integrator */
#define PART_INT_EULER 0
@@ -382,11 +386,10 @@ typedef struct ParticleSystem{ /* note, make sure all (runtime) are NULL's in
#define PART_CHILD_FACES 2
/* psys->recalc */
-#define PSYS_INIT 1
-#define PSYS_DISTR 2
-#define PSYS_ALLOC 4
-#define PSYS_TYPE 8
-#define PSYS_RECALC_HAIR 16
+#define PSYS_RECALC_REDO 1 /* only do pathcache etc */
+#define PSYS_RECALC_RESET 2 /* reset everything including pointcache */
+#define PSYS_RECALC_TYPE 4 /* handle system type change */
+#define PSYS_RECALC_CHILD 16 /* only child settings changed */
/* psys->flag */
#define PSYS_CURRENT 1
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index ba4ef1f164a..0a342634753 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -121,7 +121,7 @@ typedef struct SpaceButs {
struct RenderInfo *ri;
short cursens, curact;
- short align, tabo; /* align for panels, tab is old tab */
+ short align, pad; /* align for panels */
View2D v2d; /* depricated, copied to region */
short mainb, menunr; /* texnr and menunr have to remain shorts */
@@ -139,8 +139,8 @@ typedef struct SpaceButs {
short oldkeypress; /* for keeping track of the sub tab key cycling */
char flag, texact;
- char tab[8]; /* storing tabs for each context */
-
+ void *path; /* runtime */
+ ID *pinid;
} SpaceButs;
typedef struct SpaceSeq {
@@ -464,6 +464,22 @@ typedef struct SpaceImaSel {
#define TAB_SCENE_SOUND 3
#define TAB_SCENE_SEQUENCER 4
+
+/* warning: the values of these defines are used in sbuts->tabs[8] */
+/* buts->mainb new */
+#define BCONTEXT_SCENE 0
+#define BCONTEXT_WORLD 1
+#define BCONTEXT_OBJECT 2
+#define BCONTEXT_DATA 3
+#define BCONTEXT_MATERIAL 4
+#define BCONTEXT_TEXTURE 5
+#define BCONTEXT_PARTICLE 6
+#define BCONTEXT_PHYSICS 7
+#define BCONTEXT_GAME 8
+#define BCONTEXT_BONE 9
+#define BCONTEXT_MODIFIER 10
+
+
/* sbuts->flag */
#define SB_PRV_OSA 1
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 523faee79bf..eb355a34f9f 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -89,6 +89,9 @@ extern StructRNA RNA_CurveMapping;
extern StructRNA RNA_CurveModifier;
extern StructRNA RNA_CurvePoint;
extern StructRNA RNA_DecimateModifier;
+extern StructRNA RNA_DefCollision;
+extern StructRNA RNA_DefField;
+extern StructRNA RNA_DefPointcache;
extern StructRNA RNA_DelaySensor;
extern StructRNA RNA_DisplaceModifier;
extern StructRNA RNA_DistortedNoiseTexture;
@@ -153,6 +156,7 @@ extern StructRNA RNA_Material;
extern StructRNA RNA_MaterialHalo;
extern StructRNA RNA_MaterialRaytraceMirror;
extern StructRNA RNA_MaterialRaytraceTransparency;
+extern StructRNA RNA_MaterialSlot;
extern StructRNA RNA_MaterialStrand;
extern StructRNA RNA_MaterialSubsurfaceScattering;
extern StructRNA RNA_MaterialTextureSlot;
@@ -192,6 +196,7 @@ extern StructRNA RNA_NorController;
extern StructRNA RNA_Object;
extern StructRNA RNA_ObstacleFluidSettings;
extern StructRNA RNA_Operator;
+extern StructRNA RNA_OperatorFileListElement;
extern StructRNA RNA_OperatorMousePath;
extern StructRNA RNA_OperatorProperties;
extern StructRNA RNA_OperatorStrokeElement;
@@ -245,6 +250,7 @@ extern StructRNA RNA_Sound;
extern StructRNA RNA_SoundSequence;
extern StructRNA RNA_Space;
extern StructRNA RNA_Space3DView;
+extern StructRNA RNA_SpaceButtonsWindow;
extern StructRNA RNA_SpaceImageEditor;
extern StructRNA RNA_SpaceUVEditor;
extern StructRNA RNA_SpaceTextEditor;
@@ -327,6 +333,7 @@ void RNA_blender_rna_pointer_create(PointerRNA *r_ptr);
const char *RNA_struct_identifier(StructRNA *type);
const char *RNA_struct_ui_name(StructRNA *type);
const char *RNA_struct_ui_description(StructRNA *type);
+int RNA_struct_ui_icon(StructRNA *type);
PropertyRNA *RNA_struct_name_property(StructRNA *type);
PropertyRNA *RNA_struct_iterator_property(StructRNA *type);
@@ -530,6 +537,7 @@ int RNA_property_is_set(PointerRNA *ptr, const char *name);
/* python compatible string representation of this property, (must be freed!) */
char *RNA_property_as_string(PointerRNA *ptr, PropertyRNA *prop);
+char *RNA_pointer_as_string(PointerRNA *ptr);
/* Function */
diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h
index 0754114d7f7..5fcf2a30271 100644
--- a/source/blender/makesrna/RNA_define.h
+++ b/source/blender/makesrna/RNA_define.h
@@ -59,6 +59,7 @@ void RNA_def_struct_register_funcs(StructRNA *srna, const char *reg, const char
void RNA_def_struct_path_func(StructRNA *srna, const char *path);
void RNA_def_struct_identifier(StructRNA *srna, const char *identifier);
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description);
+void RNA_def_struct_ui_icon(StructRNA *srna, int icon);
void RNA_struct_free(BlenderRNA *brna, StructRNA *srna);
/* Compact Property Definitions */
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index 438100243e3..1cfba4286c7 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -1713,7 +1713,7 @@ static void rna_generate_struct(BlenderRNA *brna, StructRNA *srna, FILE *f)
rna_print_c_string(f, srna->name);
fprintf(f, ", ");
rna_print_c_string(f, srna->description);
- fprintf(f, ",\n");
+ fprintf(f, ",\n %d,\n", srna->icon);
prop= srna->nameproperty;
if(prop) {
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index ad1c7eae95e..eb57c91a9f7 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -30,6 +30,8 @@
#include "DNA_ID.h"
+#include "rna_internal.h"
+
#ifdef RNA_RUNTIME
#include "BKE_idprop.h"
@@ -221,6 +223,7 @@ static void rna_def_library(BlenderRNA *brna)
srna= RNA_def_struct(brna, "Library", "ID");
RNA_def_struct_ui_text(srna, "Library", "External .blend file from which data is linked.");
+ RNA_def_struct_ui_icon(srna, ICON_LIBRARY_DATA_DIRECT);
prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH);
RNA_def_property_string_sdna(prop, NULL, "name");
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index cc952528302..64c826d2c1e 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -99,6 +99,17 @@ void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
r_ptr->id.data= id;
r_ptr->type= type;
r_ptr->data= data;
+
+ if(data) {
+ while(r_ptr->type && r_ptr->type->refine) {
+ StructRNA *rtype= r_ptr->type->refine(r_ptr);
+
+ if(rtype == r_ptr->type)
+ break;
+ else
+ r_ptr->type= rtype;
+ }
+ }
}
static void rna_pointer_inherit_id(StructRNA *type, PointerRNA *parent, PointerRNA *ptr)
@@ -328,6 +339,14 @@ const char *RNA_struct_ui_name(StructRNA *type)
return type->name;
}
+int RNA_struct_ui_icon(StructRNA *type)
+{
+ if(type)
+ return type->icon;
+ else
+ return ICON_DOT;
+}
+
const char *RNA_struct_ui_description(StructRNA *type)
{
return type->description;
@@ -1486,6 +1505,7 @@ void *rna_iterator_listbase_get(CollectionPropertyIterator *iter)
void rna_iterator_listbase_end(CollectionPropertyIterator *iter)
{
MEM_freeN(iter->internal);
+ iter->internal= NULL;
}
void rna_iterator_array_begin(CollectionPropertyIterator *iter, void *ptr, int itemsize, int length, IteratorSkipFunc skip)
@@ -1542,6 +1562,7 @@ void *rna_iterator_array_dereference_get(CollectionPropertyIterator *iter)
void rna_iterator_array_end(CollectionPropertyIterator *iter)
{
MEM_freeN(iter->internal);
+ iter->internal= NULL;
}
/* RNA Path - Experiment */
@@ -2166,6 +2187,45 @@ int RNA_property_is_set(PointerRNA *ptr, const char *name)
/* string representation of a property, python
* compatible but can be used for display too*/
+char *RNA_pointer_as_string(PointerRNA *ptr)
+{
+ DynStr *dynstr= BLI_dynstr_new();
+ char *cstring;
+
+ PropertyRNA *prop, *iterprop;
+ CollectionPropertyIterator iter;
+ const char *propname;
+ int first_time = 1;
+
+ BLI_dynstr_append(dynstr, "{");
+
+ iterprop= RNA_struct_iterator_property(ptr->type);
+
+ for(RNA_property_collection_begin(ptr, iterprop, &iter); iter.valid; RNA_property_collection_next(&iter)) {
+ prop= iter.ptr.data;
+ propname = RNA_property_identifier(prop);
+
+ if(strcmp(propname, "rna_type")==0)
+ continue;
+
+ if(first_time==0)
+ BLI_dynstr_append(dynstr, ", ");
+ first_time= 0;
+
+ cstring = RNA_property_as_string(ptr, prop);
+ BLI_dynstr_appendf(dynstr, "\"%s\":%s", propname, cstring);
+ MEM_freeN(cstring);
+ }
+
+ RNA_property_collection_end(&iter);
+ BLI_dynstr_append(dynstr, "}");
+
+
+ cstring = BLI_dynstr_get_cstring(dynstr);
+ BLI_dynstr_free(dynstr);
+ return cstring;
+}
+
char *RNA_property_as_string(PointerRNA *ptr, PropertyRNA *prop)
{
int type = RNA_property_type(prop);
@@ -2243,8 +2303,28 @@ char *RNA_property_as_string(PointerRNA *ptr, PropertyRNA *prop)
break;
}
case PROP_COLLECTION:
- BLI_dynstr_append(dynstr, "'<COLLECTION>'"); /* TODO */
+ {
+ int first_time = 1;
+ CollectionPropertyIterator collect_iter;
+ BLI_dynstr_append(dynstr, "[");
+
+ for(RNA_property_collection_begin(ptr, prop, &collect_iter); collect_iter.valid; RNA_property_collection_next(&collect_iter)) {
+ PointerRNA itemptr= collect_iter.ptr;
+
+ if(first_time==0)
+ BLI_dynstr_append(dynstr, ", ");
+ first_time= 0;
+
+ /* now get every prop of the collection */
+ cstring= RNA_pointer_as_string(&itemptr);
+ BLI_dynstr_append(dynstr, cstring);
+ MEM_freeN(cstring);
+ }
+
+ RNA_property_collection_end(&collect_iter);
+ BLI_dynstr_append(dynstr, "]");
break;
+ }
default:
BLI_dynstr_append(dynstr, "'<UNKNOWN TYPE>'"); /* TODO */
break;
@@ -2330,6 +2410,7 @@ ParameterList *RNA_parameter_list_create(PointerRNA *ptr, FunctionRNA *func)
void RNA_parameter_list_free(ParameterList *parms)
{
MEM_freeN(parms->data);
+ parms->data= NULL;
parms->func= NULL;
diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c
index 0a09462988b..3639d6d3fff 100644
--- a/source/blender/makesrna/intern/rna_action.c
+++ b/source/blender/makesrna/intern/rna_action.c
@@ -84,6 +84,7 @@ void rna_def_action(BlenderRNA *brna)
srna= RNA_def_struct(brna, "Action", "ID");
RNA_def_struct_sdna(srna, "bAction");
RNA_def_struct_ui_text(srna, "Action", "A collection of F-Curves for animation.");
+ RNA_def_struct_ui_icon(srna, ICON_ACTION);
prop= RNA_def_property(srna, "fcurves", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "curves", NULL);
diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c
index c7f7b8cfebc..d49e5d14714 100644
--- a/source/blender/makesrna/intern/rna_armature.c
+++ b/source/blender/makesrna/intern/rna_armature.c
@@ -110,6 +110,7 @@ static void rna_def_bone(BlenderRNA *brna)
srna= RNA_def_struct(brna, "Bone", NULL);
RNA_def_struct_ui_text(srna, "Bone", "Bone in an Armature datablock.");
+ RNA_def_struct_ui_icon(srna, ICON_BONE_DATA);
/* pointers/collections */
/* parent (pointer) */
@@ -266,6 +267,7 @@ void rna_def_armature(BlenderRNA *brna)
srna= RNA_def_struct(brna, "Armature", "ID");
RNA_def_struct_ui_text(srna, "Armature", "Armature datablock containing a hierarchy of bones, usually used for rigging characters.");
+ RNA_def_struct_ui_icon(srna, ICON_ARMATURE_DATA);
RNA_def_struct_sdna(srna, "bArmature");
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 778485c6e20..3deb38a3a07 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -93,6 +93,7 @@ void rna_def_brush(BlenderRNA *brna)
srna= RNA_def_struct(brna, "Brush", "ID");
RNA_def_struct_ui_text(srna, "Brush", "Brush datablock for storing brush settings for painting and sculpting.");
+ RNA_def_struct_ui_icon(srna, ICON_BRUSH_DATA);
/* enums */
prop= RNA_def_property(srna, "blend", PROP_ENUM, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c
index 1b2bd4b4aab..bee8a21ad7d 100644
--- a/source/blender/makesrna/intern/rna_camera.c
+++ b/source/blender/makesrna/intern/rna_camera.c
@@ -52,6 +52,7 @@ void RNA_def_camera(BlenderRNA *brna)
srna= RNA_def_struct(brna, "Camera", "ID");
RNA_def_struct_ui_text(srna, "Camera", "Camera datablock for storing camera settings.");
+ RNA_def_struct_ui_icon(srna, ICON_CAMERA_DATA);
/* Enums */
prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index 02429ffa4bf..d0730cd7bb0 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -1558,4 +1558,5 @@ void RNA_def_constraint(BlenderRNA *brna)
rna_def_constraint_shrinkwrap(brna);
}
-#endif \ No newline at end of file
+#endif
+
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index bdc33715145..c0b75c3c65f 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -459,6 +459,7 @@ void rna_def_curve(BlenderRNA *brna)
srna= RNA_def_struct(brna, "Curve", "ID");
RNA_def_struct_ui_text(srna, "Curve", "Curve datablock storing curves, splines and NURBS.");
+ RNA_def_struct_ui_icon(srna, ICON_CURVE_DATA);
rna_def_animdata_common(srna);
rna_def_texmat_common(srna, "rna_Curve_texspace_editable");
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index 49c8c69fbcf..12d96965e36 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -572,6 +572,8 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *
srna->identifier= identifier;
srna->name= identifier; /* may be overwritten later RNA_def_struct_ui_text */
srna->description= "";
+ if(!srnafrom)
+ srna->icon= ICON_DOT;
rna_addtail(&brna->structs, srna);
@@ -777,6 +779,11 @@ void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *descr
srna->description= description;
}
+void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
+{
+ srna->icon= icon;
+}
+
/* Property Definition */
PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index d57e302263e..ea26118f267 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -586,6 +586,7 @@ void rna_def_fcurve(BlenderRNA *brna)
srna= RNA_def_struct(brna, "FCurve", NULL);
RNA_def_struct_ui_text(srna, "F-Curve", "F-Curve defining values of a period of time.");
+ RNA_def_struct_ui_icon(srna, ICON_ANIM_DATA);
/* Enums */
prop= RNA_def_property(srna, "extrapolation", PROP_ENUM, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_group.c b/source/blender/makesrna/intern/rna_group.c
index 35dddc122fe..059b2ce78f7 100644
--- a/source/blender/makesrna/intern/rna_group.c
+++ b/source/blender/makesrna/intern/rna_group.c
@@ -50,6 +50,7 @@ void RNA_def_group(BlenderRNA *brna)
srna= RNA_def_struct(brna, "Group", "ID");
RNA_def_struct_ui_text(srna, "Group", "Group of Object datablocks.");
+ RNA_def_struct_ui_icon(srna, ICON_GROUP);
prop= RNA_def_property(srna, "dupli_offset", PROP_FLOAT, PROP_VECTOR);
RNA_def_property_float_sdna(prop, NULL, "dupli_ofs");
diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c
index a4a1636d212..8620a933d61 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -113,6 +113,7 @@ static void rna_def_image(BlenderRNA *brna)
srna= RNA_def_struct(brna, "Image", "ID");
RNA_def_struct_ui_text(srna, "Image", "Image datablock referencing an external or packed image.");
+ RNA_def_struct_ui_icon(srna, ICON_IMAGE_DATA);
prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH);
RNA_def_property_string_sdna(prop, NULL, "name");
diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h
index 04779c035d0..9071efe71f7 100644
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@ -25,6 +25,8 @@
#ifndef RNA_INTERNAL_H
#define RNA_INTERNAL_H
+#include "UI_resources.h"
+
#include "rna_internal_types.h"
#define RNA_MAGIC ((int)~0)
diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h
index bd1c82fc049..60f057efa63 100644
--- a/source/blender/makesrna/intern/rna_internal_types.h
+++ b/source/blender/makesrna/intern/rna_internal_types.h
@@ -265,6 +265,8 @@ struct StructRNA {
const char *name;
/* single line description, displayed in the tooltip for example */
const char *description;
+ /* icon ID */
+ int icon;
/* property that defines the name */
PropertyRNA *nameproperty;
diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c
index 0a21ad1d940..d5f28503e4a 100644
--- a/source/blender/makesrna/intern/rna_key.c
+++ b/source/blender/makesrna/intern/rna_key.c
@@ -285,6 +285,7 @@ static void rna_def_keyblock(BlenderRNA *brna)
srna= RNA_def_struct(brna, "ShapeKey", NULL);
RNA_def_struct_ui_text(srna, "Shape Key", "Shape key in a shape keys datablock.");
RNA_def_struct_sdna(srna, "KeyBlock");
+ RNA_def_struct_ui_icon(srna, ICON_SHAPEKEY_DATA);
prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_ui_text(prop, "Name", "");
@@ -344,6 +345,7 @@ static void rna_def_key(BlenderRNA *brna)
srna= RNA_def_struct(brna, "Key", "ID");
RNA_def_struct_ui_text(srna, "Key", "Shape keys datablock containing different shapes of geometric datablocks.");
+ RNA_def_struct_ui_icon(srna, ICON_SHAPEKEY_DATA);
prop= RNA_def_property(srna, "reference_key", PROP_POINTER, PROP_NEVER_NULL);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
diff --git a/source/blender/makesrna/intern/rna_lamp.c b/source/blender/makesrna/intern/rna_lamp.c
index 1c4aa7b4eee..77ac4de814e 100644
--- a/source/blender/makesrna/intern/rna_lamp.c
+++ b/source/blender/makesrna/intern/rna_lamp.c
@@ -263,6 +263,7 @@ static void rna_def_lamp(BlenderRNA *brna)
srna= RNA_def_struct(brna, "Lamp", "ID");
RNA_def_struct_refine_func(srna, "rna_Lamp_refine");
RNA_def_struct_ui_text(srna, "Lamp", "Lamp datablock for lighting a scene.");
+ RNA_def_struct_ui_icon(srna, ICON_LAMP_DATA);
prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, prop_type_items);
@@ -329,7 +330,6 @@ static void rna_def_lamp_falloff(StructRNA *srna)
{0, NULL, NULL, NULL}};
prop= RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* needs to be able to create curve mapping */
RNA_def_property_enum_items(prop, prop_fallofftype_items);
RNA_def_property_ui_text(prop, "Falloff Type", "Intensity Decay with distance.");
RNA_def_property_update(prop, NC_LAMP|ND_LIGHTING, NULL);
@@ -653,6 +653,8 @@ static void rna_def_sun_lamp(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "LampSkySettings");
RNA_def_property_pointer_funcs(prop, "rna_Lamp_sky_settings_get", NULL);
RNA_def_property_ui_text(prop, "Sky Settings", "Sky related settings for sun lamps.");
+
+ rna_def_lamp_sky_settings(brna);
}
static void rna_def_hemi_lamp(BlenderRNA *brna)
@@ -672,7 +674,6 @@ void RNA_def_lamp(BlenderRNA *brna)
rna_def_spot_lamp(brna);
rna_def_sun_lamp(brna);
rna_def_hemi_lamp(brna);
- rna_def_lamp_sky_settings(brna);
rna_def_lamp_mtex(brna);
}
diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c
index ca77d3b519f..26c4ebb7b23 100644
--- a/source/blender/makesrna/intern/rna_lattice.c
+++ b/source/blender/makesrna/intern/rna_lattice.c
@@ -117,6 +117,7 @@ static void rna_def_lattice(BlenderRNA *brna)
srna= RNA_def_struct(brna, "Lattice", "ID");
RNA_def_struct_ui_text(srna, "Lattice", "Lattice datablock defining a grid for deforming other objects.");
+ RNA_def_struct_ui_icon(srna, ICON_LATTICE_DATA);
prop= RNA_def_property(srna, "points_u", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "pntsu");
diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c
index 03ce385be32..fdd0349b25e 100644
--- a/source/blender/makesrna/intern/rna_main.c
+++ b/source/blender/makesrna/intern/rna_main.c
@@ -28,6 +28,8 @@
#include "RNA_define.h"
#include "RNA_types.h"
+#include "rna_internal.h"
+
#ifdef RNA_RUNTIME
#include "BKE_main.h"
@@ -248,6 +250,7 @@ void RNA_def_main(BlenderRNA *brna)
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.");
+ RNA_def_struct_ui_icon(srna, ICON_BLENDER);
prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH);
RNA_def_property_string_maxlength(prop, 240);
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index 15cca0f3dfa..721bf621c22 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -731,6 +731,7 @@ void RNA_def_material(BlenderRNA *brna)
srna= RNA_def_struct(brna, "Material", "ID");
RNA_def_struct_ui_text(srna, "Material", "Material datablock to defined the appearance of geometric objects for rendering.");
+ RNA_def_struct_ui_icon(srna, ICON_MATERIAL_DATA);
prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "material_type");
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index c75558dafe4..92e53cf7606 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -597,9 +597,10 @@ static void rna_def_mvert_group(BlenderRNA *brna)
PropertyRNA *prop;
srna= RNA_def_struct(brna, "VertexGroupElement", NULL);
- RNA_def_struct_ui_text(srna, "Vertex Group Element", "Weight value of a vertex in a vertex group.");
RNA_def_struct_sdna(srna, "MDeformWeight");
RNA_def_struct_path_func(srna, "rna_VertexGroupElement_path");
+ RNA_def_struct_ui_text(srna, "Vertex Group Element", "Weight value of a vertex in a vertex group.");
+ RNA_def_struct_ui_icon(srna, ICON_GROUP_VERTEX);
/* we can't point to actual group, it is in the object and so
* there is no unique group to point to, hence the index */
@@ -622,6 +623,7 @@ static void rna_def_mvert(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "MVert");
RNA_def_struct_ui_text(srna, "Mesh Vertex", "Vertex in a Mesh datablock.");
RNA_def_struct_path_func(srna, "rna_MeshVertex_path");
+ RNA_def_struct_ui_icon(srna, ICON_VERTEXSEL);
prop= RNA_def_property(srna, "co", PROP_FLOAT, PROP_VECTOR);
RNA_def_property_ui_text(prop, "Location", "");
@@ -658,6 +660,7 @@ static void rna_def_medge(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "MEdge");
RNA_def_struct_ui_text(srna, "Mesh Edge", "Edge in a Mesh datablock.");
RNA_def_struct_path_func(srna, "rna_MeshEdge_path");
+ RNA_def_struct_ui_icon(srna, ICON_EDGESEL);
prop= RNA_def_property(srna, "verts", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "v1");
@@ -699,6 +702,7 @@ static void rna_def_mface(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "MFace");
RNA_def_struct_ui_text(srna, "Mesh Face", "Face in a Mesh datablock.");
RNA_def_struct_path_func(srna, "rna_MeshFace_path");
+ RNA_def_struct_ui_icon(srna, ICON_FACESEL);
prop= RNA_def_property(srna, "verts", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "v1");
@@ -763,6 +767,7 @@ static void rna_def_mtface(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "MTFace");
RNA_def_struct_ui_text(srna, "Mesh Texture Face", "UV mapping, texturing and game engine data for a face.");
RNA_def_struct_path_func(srna, "rna_MeshTextureFace_path");
+ RNA_def_struct_ui_icon(srna, ICON_FACESEL_HLT);
prop= RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "tpage");
@@ -1042,6 +1047,7 @@ static void rna_def_mesh(BlenderRNA *brna)
srna= RNA_def_struct(brna, "Mesh", "ID");
RNA_def_struct_ui_text(srna, "Mesh", "Mesh datablock to define geometric surfaces.");
+ RNA_def_struct_ui_icon(srna, ICON_MESH_DATA);
prop= RNA_def_property(srna, "verts", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "mvert", "totvert");
diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c
index 737bb52a466..472e776f500 100644
--- a/source/blender/makesrna/intern/rna_meta.c
+++ b/source/blender/makesrna/intern/rna_meta.c
@@ -55,8 +55,9 @@ void rna_def_metaelement(BlenderRNA *brna)
{0, NULL, NULL, NULL}};
srna= RNA_def_struct(brna, "MetaElement", NULL);
- RNA_def_struct_ui_text(srna, "Meta Element", "Blobby element in a MetaBall datablock.");
RNA_def_struct_sdna(srna, "MetaElem");
+ RNA_def_struct_ui_text(srna, "Meta Element", "Blobby element in a MetaBall datablock.");
+ RNA_def_struct_ui_icon(srna, ICON_OUTLINER_DATA_META);
/* enums */
prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
@@ -112,6 +113,7 @@ void rna_def_metaball(BlenderRNA *brna)
srna= RNA_def_struct(brna, "MetaBall", "ID");
RNA_def_struct_ui_text(srna, "MetaBall", "Metaball datablock to defined blobby surfaces.");
+ RNA_def_struct_ui_icon(srna, ICON_META_DATA);
prop= RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "elems", NULL);
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index bc3da3b5a9e..6673b8d43f7 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -372,6 +372,7 @@ static void rna_def_modifier_subsurf(BlenderRNA *brna)
srna= RNA_def_struct(brna, "SubsurfModifier", "Modifier");
RNA_def_struct_ui_text(srna, "Subsurf Modifier", "Subdivision surface modifier.");
RNA_def_struct_sdna(srna, "SubsurfModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_SUBSURF);
rna_def_property_subdivision_common(srna, "subdivType");
@@ -407,6 +408,7 @@ static void rna_def_modifier_multires(BlenderRNA *brna)
srna= RNA_def_struct(brna, "MultiresModifier", "Modifier");
RNA_def_struct_ui_text(srna, "Multires Modifier", "Multiresolution mesh modifier.");
RNA_def_struct_sdna(srna, "MultiresModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_MULTIRES);
rna_def_property_subdivision_common(srna, "simple");
@@ -425,6 +427,7 @@ static void rna_def_modifier_lattice(BlenderRNA *brna)
srna= RNA_def_struct(brna, "LatticeModifier", "Modifier");
RNA_def_struct_ui_text(srna, "Lattice Modifier", "Lattice deformation modifier.");
RNA_def_struct_sdna(srna, "LatticeModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_LATTICE);
prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
RNA_def_property_ui_text(prop, "Object", "Lattice object to deform with.");
@@ -456,6 +459,7 @@ static void rna_def_modifier_curve(BlenderRNA *brna)
srna= RNA_def_struct(brna, "CurveModifier", "Modifier");
RNA_def_struct_ui_text(srna, "Curve Modifier", "Curve deformation modifier.");
RNA_def_struct_sdna(srna, "CurveModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_CURVE);
prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
RNA_def_property_ui_text(prop, "Object", "Curve object to deform with.");
@@ -484,6 +488,7 @@ static void rna_def_modifier_build(BlenderRNA *brna)
srna= RNA_def_struct(brna, "BuildModifier", "Modifier");
RNA_def_struct_ui_text(srna, "Build Modifier", "Build effect modifier.");
RNA_def_struct_sdna(srna, "BuildModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_BUILD);
prop= RNA_def_property(srna, "start", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 1, MAXFRAMEF);
@@ -513,6 +518,7 @@ static void rna_def_modifier_mirror(BlenderRNA *brna)
srna= RNA_def_struct(brna, "MirrorModifier", "Modifier");
RNA_def_struct_ui_text(srna, "Mirror Modifier", "Mirroring modifier.");
RNA_def_struct_sdna(srna, "MirrorModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_MIRROR);
prop= RNA_def_property(srna, "x", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_AXIS_X);
@@ -571,6 +577,7 @@ static void rna_def_modifier_decimate(BlenderRNA *brna)
srna= RNA_def_struct(brna, "DecimateModifier", "Modifier");
RNA_def_struct_ui_text(srna, "Decimate Modifier", "Decimation modifier.");
RNA_def_struct_sdna(srna, "DecimateModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_DECIM);
prop= RNA_def_property(srna, "ratio", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "percent");
@@ -599,6 +606,7 @@ static void rna_def_modifier_wave(BlenderRNA *brna)
srna= RNA_def_struct(brna, "WaveModifier", "Modifier");
RNA_def_struct_ui_text(srna, "Wave Modifier", "Wave effect modifier.");
RNA_def_struct_sdna(srna, "WaveModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_WAVE);
prop= RNA_def_property(srna, "x", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_X);
@@ -742,6 +750,7 @@ static void rna_def_modifier_armature(BlenderRNA *brna)
srna= RNA_def_struct(brna, "ArmatureModifier", "Modifier");
RNA_def_struct_ui_text(srna, "Armature Modifier", "Armature deformation modifier.");
RNA_def_struct_sdna(srna, "ArmatureModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_ARMATURE);
prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
RNA_def_property_ui_text(prop, "Object", "Armature object to deform with.");
@@ -794,6 +803,7 @@ static void rna_def_modifier_hook(BlenderRNA *brna)
srna= RNA_def_struct(brna, "HookModifier", "Modifier");
RNA_def_struct_ui_text(srna, "Hook Modifier", "Hook modifier to modify the location of vertices.");
RNA_def_struct_sdna(srna, "HookModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_HOOK);
prop= RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0, FLT_MAX);
@@ -825,6 +835,7 @@ static void rna_def_modifier_softbody(BlenderRNA *brna)
srna= RNA_def_struct(brna, "SoftbodyModifier", "Modifier");
RNA_def_struct_ui_text(srna, "Softbody Modifier", "Softbody simulation modifier.");
RNA_def_struct_sdna(srna, "SoftbodyModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_SOFT);
}
static void rna_def_modifier_boolean(BlenderRNA *brna)
@@ -841,6 +852,7 @@ static void rna_def_modifier_boolean(BlenderRNA *brna)
srna= RNA_def_struct(brna, "BooleanModifier", "Modifier");
RNA_def_struct_ui_text(srna, "Boolean Modifier", "Boolean operations modifier.");
RNA_def_struct_sdna(srna, "BooleanModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_BOOLEAN);
prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
RNA_def_property_ui_text(prop, "Object", "Mesh object to use for boolean operation.");
@@ -868,6 +880,7 @@ static void rna_def_modifier_array(BlenderRNA *brna)
srna= RNA_def_struct(brna, "ArrayModifier", "Modifier");
RNA_def_struct_ui_text(srna, "Array Modifier", "Array duplication modifier.");
RNA_def_struct_sdna(srna, "ArrayModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_ARRAY);
/* Length parameters */
prop= RNA_def_property(srna, "fit_type", PROP_ENUM, PROP_NONE);
@@ -967,6 +980,7 @@ static void rna_def_modifier_edgesplit(BlenderRNA *brna)
srna= RNA_def_struct(brna, "EdgeSplitModifier", "Modifier");
RNA_def_struct_ui_text(srna, "EdgeSplit Modifier", "Edge splitting modifier to create sharp edges.");
RNA_def_struct_sdna(srna, "EdgeSplitModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_EDGESPLIT);
prop= RNA_def_property(srna, "split_angle", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0, 180);
@@ -1008,6 +1022,7 @@ static void rna_def_modifier_displace(BlenderRNA *brna)
srna= RNA_def_struct(brna, "DisplaceModifier", "Modifier");
RNA_def_struct_ui_text(srna, "Displace Modifier", "Displacement modifier.");
RNA_def_struct_sdna(srna, "DisplaceModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_DISPLACE);
prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
@@ -1064,6 +1079,7 @@ static void rna_def_modifier_uvproject(BlenderRNA *brna)
srna= RNA_def_struct(brna, "UVProjectModifier", "Modifier");
RNA_def_struct_ui_text(srna, "UVProject Modifier", "UV projection modifier to sets UVs from a projector.");
RNA_def_struct_sdna(srna, "UVProjectModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_UVPROJECT);
prop= RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
@@ -1109,6 +1125,7 @@ static void rna_def_modifier_smooth(BlenderRNA *brna)
srna= RNA_def_struct(brna, "SmoothModifier", "Modifier");
RNA_def_struct_ui_text(srna, "Smooth Modifier", "Smoothing effect modifier.");
RNA_def_struct_sdna(srna, "SmoothModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_SMOOTH);
prop= RNA_def_property(srna, "x", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SMOOTH_X);
@@ -1127,7 +1144,7 @@ static void rna_def_modifier_smooth(BlenderRNA *brna)
prop= RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "fac");
- RNA_def_property_range(prop, FLT_MIN, FLT_MAX);
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
RNA_def_property_ui_range(prop, -10, 10, 0.5, 2);
RNA_def_property_ui_text(prop, "Factor", "");
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
@@ -1158,6 +1175,7 @@ static void rna_def_modifier_cast(BlenderRNA *brna)
srna= RNA_def_struct(brna, "CastModifier", "Modifier");
RNA_def_struct_ui_text(srna, "Cast Modifier", "Cast modifier to cast to other shapes.");
RNA_def_struct_sdna(srna, "CastModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_CAST);
prop= RNA_def_property(srna, "cast_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "type");
@@ -1182,7 +1200,7 @@ static void rna_def_modifier_cast(BlenderRNA *brna)
prop= RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "fac");
- RNA_def_property_range(prop, FLT_MIN, FLT_MAX);
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
RNA_def_property_ui_range(prop, -10, 10, 5, 2);
RNA_def_property_ui_text(prop, "Factor", "");
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
@@ -1214,6 +1232,7 @@ static void rna_def_modifier_meshdeform(BlenderRNA *brna)
srna= RNA_def_struct(brna, "MeshDeformModifier", "Modifier");
RNA_def_struct_ui_text(srna, "MeshDeform Modifier", "Mesh deformation modifier to deform with other meshes.");
RNA_def_struct_sdna(srna, "MeshDeformModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_MESHDEFORM);
prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
RNA_def_property_ui_text(prop, "Object", "Mesh object to deform with.");
@@ -1252,6 +1271,7 @@ static void rna_def_modifier_particlesystem(BlenderRNA *brna)
srna= RNA_def_struct(brna, "ParticleSystemModifier", "Modifier");
RNA_def_struct_ui_text(srna, "ParticleSystem Modifier", "Particle system simulation modifier.");
RNA_def_struct_sdna(srna, "ParticleSystemModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_PARTICLES);
}
static void rna_def_modifier_particleinstance(BlenderRNA *brna)
@@ -1262,6 +1282,7 @@ static void rna_def_modifier_particleinstance(BlenderRNA *brna)
srna= RNA_def_struct(brna, "ParticleInstanceModifier", "Modifier");
RNA_def_struct_ui_text(srna, "ParticleInstance Modifier", "Particle system instancing modifier.");
RNA_def_struct_sdna(srna, "ParticleInstanceModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_PARTICLES);
prop= RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "ob");
@@ -1314,6 +1335,7 @@ static void rna_def_modifier_explode(BlenderRNA *brna)
srna= RNA_def_struct(brna, "ExplodeModifier", "Modifier");
RNA_def_struct_ui_text(srna, "Explode Modifier", "Explosion effect modifier based on a particle system.");
RNA_def_struct_sdna(srna, "ExplodeModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_EXPLODE);
prop= RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
RNA_def_property_string_funcs(prop, "rna_ExplodeModifier_vgroup_get", "rna_ExplodeModifier_vgroup_length", "rna_ExplodeModifier_vgroup_set");
@@ -1353,6 +1375,7 @@ static void rna_def_modifier_cloth(BlenderRNA *brna)
srna= RNA_def_struct(brna, "ClothModifier", "Modifier");
RNA_def_struct_ui_text(srna, "Cloth Modifier", "Cloth simulation modifier.");
RNA_def_struct_sdna(srna, "ClothModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_CLOTH);
prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NEVER_NULL);
RNA_def_property_pointer_sdna(prop, NULL, "sim_parms");
@@ -1369,10 +1392,18 @@ static void rna_def_modifier_cloth(BlenderRNA *brna)
static void rna_def_modifier_collision(BlenderRNA *brna)
{
StructRNA *srna;
+ PropertyRNA *prop;
srna= RNA_def_struct(brna, "CollisionModifier", "Modifier");
RNA_def_struct_ui_text(srna, "Collision Modifier", "Collision modifier defining modifier stack position used for collision.");
RNA_def_struct_sdna(srna, "CollisionModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_PHYSICS);
+
+ prop= RNA_def_property(srna, "absorption", PROP_INT, PROP_PERCENTAGE);
+ RNA_def_property_int_sdna(prop, NULL, "absorption");
+ RNA_def_property_ui_range(prop, 0, 100, 1, 2);
+ RNA_def_property_ui_text(prop, "Absorption %", "How much of effector force gets lost during collision with this object (in percent).");
+ RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
}
static void rna_def_modifier_bevel(BlenderRNA *brna)
@@ -1395,6 +1426,7 @@ static void rna_def_modifier_bevel(BlenderRNA *brna)
srna= RNA_def_struct(brna, "BevelModifier", "Modifier");
RNA_def_struct_ui_text(srna, "Bevel Modifier", "Bevel modifier to make edges and vertices more rounded.");
RNA_def_struct_sdna(srna, "BevelModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_BEVEL);
prop= RNA_def_property(srna, "width", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "value");
@@ -1441,6 +1473,7 @@ static void rna_def_modifier_shrinkwrap(BlenderRNA *brna)
srna= RNA_def_struct(brna, "ShrinkwrapModifier", "Modifier");
RNA_def_struct_ui_text(srna, "Shrinkwrap Modifier", "Shrink wrapping modifier to shrink wrap and object to a target.");
RNA_def_struct_sdna(srna, "ShrinkwrapModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_SHRINKWRAP);
prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "shrinkType");
@@ -1530,6 +1563,7 @@ static void rna_def_modifier_fluidsim(BlenderRNA *brna)
srna= RNA_def_struct(brna, "FluidSimulationModifier", "Modifier");
RNA_def_struct_ui_text(srna, "Fluid Simulation Modifier", "Fluid simulation modifier.");
RNA_def_struct_sdna(srna, "FluidsimModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_FLUIDSIM);
prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NEVER_NULL);
RNA_def_property_pointer_sdna(prop, NULL, "fss");
@@ -1549,6 +1583,7 @@ static void rna_def_modifier_mask(BlenderRNA *brna)
srna= RNA_def_struct(brna, "MaskModifier", "Modifier");
RNA_def_struct_ui_text(srna, "Mask Modifier", "Mask modifier to hide parts of the mesh.");
RNA_def_struct_sdna(srna, "MaskModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_MASK);
prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, prop_mode_items);
@@ -1589,6 +1624,7 @@ static void rna_def_modifier_simpledeform(BlenderRNA *brna)
srna= RNA_def_struct(brna, "SimpleDeformModifier", "Modifier");
RNA_def_struct_ui_text(srna, "SimpleDeform Modifier", "Simple deformation modifier to apply effects such as twisting and bending.");
RNA_def_struct_sdna(srna, "SimpleDeformModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_SIMPLEDEFORM);
prop= RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, prop_mode_items);
@@ -1612,7 +1648,7 @@ static void rna_def_modifier_simpledeform(BlenderRNA *brna)
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
prop= RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, FLT_MIN, FLT_MAX);
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
RNA_def_property_ui_range(prop, -10, 10, 0.5, 2);
RNA_def_property_ui_text(prop, "Factor", "");
RNA_def_property_update(prop, NC_OBJECT|ND_MODIFIER, "rna_Modifier_update");
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 9594a1a4a05..96249b062f6 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -32,7 +32,10 @@
#include "DNA_node_types.h"
#include "DNA_scene_types.h"
+#include "DNA_texture_types.h"
+
#include "BKE_node.h"
+#include "BKE_image.h"
#ifdef RNA_RUNTIME
@@ -165,12 +168,11 @@ static EnumPropertyItem* alloc_node_type_items(int category)
/* -- Common nodes ---------------------------------------------------------- */
-static void def_math(BlenderRNA *brna, int id)
+static void def_math(StructRNA *srna)
{
- StructRNA *srna;
PropertyRNA *prop;
- static EnumPropertyItem items[] ={
+ static EnumPropertyItem items[] = {
{ 0, "ADD", "Add", ""},
{ 1, "SUBTRACT", "Subtract", ""},
{ 2, "MULTIPLY", "Multiply", ""},
@@ -192,20 +194,17 @@ static void def_math(BlenderRNA *brna, int id)
{0, NULL, NULL, NULL}
};
- srna = def_node(brna, id);
-
prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "custom1");
RNA_def_property_enum_items(prop, items);
RNA_def_property_ui_text(prop, "Operation", "");
}
-static void def_vector_math(BlenderRNA *brna, int id)
+static void def_vector_math(StructRNA *srna)
{
- StructRNA *srna;
PropertyRNA *prop;
- static EnumPropertyItem items[] ={
+ static EnumPropertyItem items[] = {
{0, "ADD", "Add", ""},
{1, "SUBTRACT", "Subtract", ""},
{2, "AVERAGE", "Average", ""},
@@ -216,47 +215,36 @@ static void def_vector_math(BlenderRNA *brna, int id)
{0, NULL, NULL, NULL}
};
- srna = def_node(brna, id);
-
prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "custom1");
RNA_def_property_enum_items(prop, items);
RNA_def_property_ui_text(prop, "Operation", "");
}
-static void def_rgb_curve(BlenderRNA *brna, int id)
+static void def_rgb_curve(StructRNA *srna)
{
- StructRNA *srna;
PropertyRNA *prop;
- srna = def_node(brna, id);
-
prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "storage");
RNA_def_property_struct_type(prop, "CurveMapping");
RNA_def_property_ui_text(prop, "Mapping", "");
}
-static void def_vector_curve(BlenderRNA *brna, int id)
+static void def_vector_curve(StructRNA *srna)
{
- StructRNA *srna;
PropertyRNA *prop;
- srna = def_node(brna, id);
-
prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "storage");
RNA_def_property_struct_type(prop, "CurveMapping");
RNA_def_property_ui_text(prop, "Mapping", "");
}
-static void def_time(BlenderRNA *brna, int id)
+static void def_time(StructRNA *srna)
{
- StructRNA *srna;
PropertyRNA *prop;
- srna = def_node(brna, id);
-
prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "storage");
RNA_def_property_struct_type(prop, "CurveMapping");
@@ -271,26 +259,22 @@ static void def_time(BlenderRNA *brna, int id)
RNA_def_property_ui_text(prop, "End Frame", "");
}
-static void def_val_to_rgb(BlenderRNA *brna, int id)
+static void def_val_to_rgb(StructRNA *srna)
{
- StructRNA *srna;
-// PropertyRNA *prop;
-
- srna = def_node(brna, id);
+ /*PropertyRNA *prop;*/
- /* TODO: uncomment when ColorBand is wrapped */
- /*prop = RNA_def_property(srna, "color_band", PROP_POINTER, PROP_NONE);
+ /* TODO: uncomment when ColorBand is wrapped *//*
+ prop = RNA_def_property(srna, "color_band", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "storage");
RNA_def_property_struct_type(prop, "ColorBand");
RNA_def_property_ui_text(prop, "Color Band", "");*/
}
-static void def_mix_rgb(BlenderRNA *brna, int id)
+static void def_mix_rgb(StructRNA *srna)
{
- StructRNA *srna;
PropertyRNA *prop;
- static EnumPropertyItem blend_type_items[] ={
+ static EnumPropertyItem blend_type_items[] = {
{ 0, "MIX", "Mix", ""},
{ 1, "ADD", "Add", ""},
{ 3, "SUBTRACT", "Subtract", ""},
@@ -310,8 +294,6 @@ static void def_mix_rgb(BlenderRNA *brna, int id)
{0, NULL, NULL, NULL}
};
- srna = def_node(brna, id);
-
prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "custom1");
RNA_def_property_enum_items(prop, blend_type_items);
@@ -322,13 +304,10 @@ static void def_mix_rgb(BlenderRNA *brna, int id)
RNA_def_property_ui_text(prop, "Diffuse", "Include alpha of second input in this operation");
}
-static void def_texture(BlenderRNA *brna, int id)
+static void def_texture(StructRNA *srna)
{
- StructRNA *srna;
PropertyRNA *prop;
- srna = def_node(brna, id);
-
prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "id");
RNA_def_property_struct_type(prop, "Texture");
@@ -341,35 +320,12 @@ static void def_texture(BlenderRNA *brna, int id)
}
-/* -- Shader Node Storage Types --------------------------------------------- */
-
-static void rna_def_storage_node_geometry(BlenderRNA *brna)
-{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "NodeGeometry", NULL);
- RNA_def_struct_ui_text(srna, "Node Geometry", "");
-
- prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "uvname");
- RNA_def_property_ui_text(prop, "UV Layer", "");
-
- prop = RNA_def_property(srna, "color_layer", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "colname");
- RNA_def_property_ui_text(prop, "Vertex Color Layer", "");
-}
-
-
/* -- Shader Nodes ---------------------------------------------------------- */
-static void def_sh_material(BlenderRNA *brna, int id)
+static void def_sh_material(StructRNA *srna)
{
- StructRNA *srna;
PropertyRNA *prop;
- srna = def_node(brna, id);
-
prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "id");
RNA_def_property_struct_type(prop, "Material");
@@ -389,41 +345,54 @@ static void def_sh_material(BlenderRNA *brna, int id)
RNA_def_property_ui_text(prop, "Invert Normal", "Material Node uses inverted normal");
}
-static void def_sh_mapping(BlenderRNA *brna, int id)
+static void def_sh_mapping(StructRNA *srna)
{
- StructRNA *srna;
PropertyRNA *prop;
- srna = def_node(brna, id);
-
prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "storage");
RNA_def_property_struct_type(prop, "TexMapping");
RNA_def_property_ui_text(prop, "Mapping", "");
}
-static void def_sh_geometry(BlenderRNA *brna, int id)
+static void def_sh_geometry(StructRNA *srna)
{
- StructRNA *srna;
PropertyRNA *prop;
- srna = def_node(brna, id);
+ RNA_def_struct_sdna_from(srna, "NodeGeometry", "storage");
- prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "storage");
- RNA_def_property_struct_type(prop, "NodeGeometry");
- RNA_def_property_ui_text(prop, "Settings", "");
+ prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "uvname");
+ RNA_def_property_ui_text(prop, "UV Layer", "");
+
+ prop = RNA_def_property(srna, "color_layer", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "colname");
+ RNA_def_property_ui_text(prop, "Vertex Color Layer", "");
}
-/* -- Compositor Node Storage Types ----------------------------------------- */
+/* -- Compositor Nodes ------------------------------------------------------ */
-static void rna_def_storage_node_blur_data(BlenderRNA *brna)
+static void def_cmp_alpha_over(StructRNA *srna)
{
- StructRNA *srna;
PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "convert_premul", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
+ RNA_def_property_ui_text(prop, "convert_premul", "TODO: don't know what this is");
+
+ RNA_def_struct_sdna_from(srna, "NodeTwoFloats", "storage");
- static EnumPropertyItem filter_type_items[] ={
+ prop = RNA_def_property(srna, "premul", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "x");
+ RNA_def_property_ui_text(prop, "Premul", "Mix Factor");
+}
+
+static void def_cmp_blur(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ static EnumPropertyItem filter_type_items[] = {
{R_FILTER_BOX, "FLAT", "Flat", ""},
{R_FILTER_TENT, "TENT", "Tent", ""},
{R_FILTER_QUAD, "QUAD", "Quadratic", ""},
@@ -434,11 +403,8 @@ static void rna_def_storage_node_blur_data(BlenderRNA *brna)
{R_FILTER_MITCH, "MITCH", "Mitch", ""},
{0, NULL, NULL, NULL}
};
-
- srna = RNA_def_struct(brna, "NodeBlurData", NULL);
- RNA_def_struct_ui_text(srna, "Node Blur Data", "");
-
- /**/
+
+ RNA_def_struct_sdna_from(srna, "NodeBlurData", "storage");
prop = RNA_def_property(srna, "sizex", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "sizex");
@@ -448,14 +414,10 @@ static void rna_def_storage_node_blur_data(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "sizey");
RNA_def_property_ui_text(prop, "Size Y", "");
- /**/
-
prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "samples");
RNA_def_property_ui_text(prop, "Samples", "");
- /**/
-
prop = RNA_def_property(srna, "max_speed", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "maxspeed");
RNA_def_property_ui_text(prop, "Max Speed", "");
@@ -464,19 +426,14 @@ static void rna_def_storage_node_blur_data(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "minspeed");
RNA_def_property_ui_text(prop, "Min Speed", "");
- /**/
-
prop = RNA_def_property(srna, "relative", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "relative", 1);
RNA_def_property_ui_text(prop, "Relative", "");
- /**/
-
prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "fac");
RNA_def_property_ui_text(prop, "Factor", "");
- /* These aren't percentages */
prop = RNA_def_property(srna, "factor_x", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "percentx");
RNA_def_property_ui_text(prop, "Relative Size X", "");
@@ -485,15 +442,11 @@ static void rna_def_storage_node_blur_data(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "percenty");
RNA_def_property_ui_text(prop, "Relative Size Y", "");
- /**/
-
prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "filtertype");
RNA_def_property_enum_items(prop, filter_type_items);
RNA_def_property_ui_text(prop, "Filter Type", "");
- /**/
-
prop = RNA_def_property(srna, "bokeh", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "bokeh", 1);
RNA_def_property_ui_text(prop, "Bokeh", "");
@@ -503,122 +456,817 @@ static void rna_def_storage_node_blur_data(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Gamma", "");
/*
- Also:
+ TODO:
curved
image_in_width
image_in_height
- Don't know if these need wrapping
+ Don't know if these need wrapping, can't find them in interface
*/
}
+static void def_cmp_filter(StructRNA *srna)
+{
+ PropertyRNA *prop;
-/* -- Compositor Nodes ------------------------------------------------------ */
+ static EnumPropertyItem type_items[] = {
+ {0, "SOFTEN", "Soften", ""},
+ {1, "SHARPEN", "Sharpen", ""},
+ {2, "LAPLACE", "Laplace", ""},
+ {3, "SOBEL", "Sobel", ""},
+ {4, "PREWITT", "Prewitt", ""},
+ {5, "KIRSCH", "Kirsch", ""},
+ {6, "SHADOW", "Shadow", ""},
+ {0, NULL, NULL, NULL}
+ };
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, type_items);
+ RNA_def_property_ui_text(prop, "Type", "");
+}
-static void def_cmp_alpha_over(BlenderRNA *brna, int id)
+static void def_cmp_map_value(StructRNA *srna)
{
- StructRNA *srna;
PropertyRNA *prop;
+
+ RNA_def_struct_sdna_from(srna, "TexMapping", "storage");
+
+ prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "loc");
+ RNA_def_property_ui_text(prop, "Offset", "");
+
+ prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "size");
+ RNA_def_property_ui_text(prop, "Size", "");
+
+ prop = RNA_def_property(srna, "use_min", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MIN);
+ RNA_def_property_ui_text(prop, "Use Minimum", "");
+
+ prop = RNA_def_property(srna, "use_max", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MAX);
+ RNA_def_property_ui_text(prop, "Use Maximum", "");
+
+ prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "min");
+ RNA_def_property_ui_text(prop, "Minimum", "");
+
+ prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "max");
+ RNA_def_property_ui_text(prop, "Maximum", "");
+}
- srna = def_node(brna, id);
+static void def_cmp_vector_blur(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ RNA_def_struct_sdna_from(srna, "NodeBlurData", "storage");
+
+ prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "samples");
+ RNA_def_property_ui_text(prop, "Samples", "");
+
+ prop = RNA_def_property(srna, "min_speed", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "minspeed");
+ RNA_def_property_ui_text(prop, "Min Speed", "Minimum speed for a pixel to be blurred; used to separate background from foreground");
+
+ prop = RNA_def_property(srna, "max_speed", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "maxspeed");
+ RNA_def_property_ui_text(prop, "Min Speed", "Maximum speed, or zero for none");
+
+ prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "fac");
+ RNA_def_property_ui_text(prop, "Blur Factor", "Scaling factor for motion vectors; actually 'shutter speed' in frames");
+
+ prop = RNA_def_property(srna, "curved", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "curved", 1);
+ RNA_def_property_ui_text(prop, "Curved", "Interpolate between frames in a bezier curve, rather than linearly");
+}
- prop = RNA_def_property(srna, "convert_premul", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
- RNA_def_property_ui_text(prop, "convert_premul", "TODO: don't know what this is");
+static void def_cmp_image(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ static EnumPropertyItem type_items[] = {
+ {IMA_SRC_FILE, "IMAGE", "Image", ""},
+ {IMA_SRC_MOVIE, "MOVIE", "Movie", ""},
+ {IMA_SRC_SEQUENCE, "SEQUENCE", "Sequence", ""},
+ {IMA_SRC_GENERATED, "GENERATED", "Generated", ""},
+ {0, NULL, NULL, NULL}
+ };
+
+ prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "id");
+ RNA_def_property_struct_type(prop, "Image");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Image", "");
+
+ RNA_def_struct_sdna_from(srna, "ImageUser", "storage");
+
+ /* TODO: if movie or sequence { */
+
+ prop = RNA_def_property(srna, "frames", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "frames");
+ RNA_def_property_ui_text(prop, "Frames", "Number of images used in animation");
+
+ prop = RNA_def_property(srna, "start", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "sfra");
+ RNA_def_property_ui_text(prop, "Start Frame", "");
+
+ prop = RNA_def_property(srna, "offset", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "offset");
+ RNA_def_property_ui_text(prop, "Offset", "Offsets the number of the frame to use in the animation");
+
+ prop = RNA_def_property(srna, "cyclic", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "cycl", 1);
+ RNA_def_property_ui_text(prop, "Cyclic", "");
+
+ prop = RNA_def_property(srna, "auto_refresh", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_ANIM_ALWAYS);
+ RNA_def_property_ui_text(prop, "Auto-Refresh", "");
+
+ /* } */
+
+ /* if type == multilayer { */
+
+ prop = RNA_def_property(srna, "layer", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "layer");
+ RNA_def_property_ui_text(prop, "Layer", "");
+
+ /* } */
+
+ /* TODO: refresh on change */
- /* TODO: uses NodeTwoFloats storage */
}
-static void def_cmp_blur(BlenderRNA *brna, int id)
+static void def_cmp_render_layers(StructRNA *srna)
{
- StructRNA *srna;
PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "id");
+ RNA_def_property_struct_type(prop, "Scene");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Scene", "");
+
+ /* TODO: layers in menu */
+ prop = RNA_def_property(srna, "layer", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "custom1");
+ RNA_def_property_ui_text(prop, "Layer", "");
+
+ /* TODO: comments indicate this might be a hack */
+ prop = RNA_def_property(srna, "re_render", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom2", 1);
+ RNA_def_property_ui_text(prop, "Re-render", "");
+}
- srna = def_node(brna, id);
+static void def_cmp_output_file(StructRNA *srna)
+{
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "storage");
- RNA_def_property_struct_type(prop, "NodeBlurData");
- RNA_def_property_ui_text(prop, "Settings", "");
+ static EnumPropertyItem type_items[] = {
+ {R_TARGA, "TARGA", "Targa", ""},
+ {R_RAWTGA, "RAW_TARGA", "Targa Raw", ""},
+ {R_PNG, "PNG", "PNG", ""},
+ {R_BMP, "BMP", "BMP", ""},
+ {R_JPEG90, "JPEG", "JPEG", ""},
+ {R_IRIS, "IRIS", "IRIS", ""},
+ {R_RADHDR, "RADIANCE_HDR", "Radiance HDR", ""},
+ {R_CINEON, "CINEON", "Cineon", ""},
+ {R_DPX, "DPX", "DPX", ""},
+ {R_OPENEXR, "OPENEXR", "OpenEXR", ""},
+ {0, NULL, NULL, NULL}
+ };
+
+ static EnumPropertyItem openexr_codec_items[] = {
+ {0, "NONE", "None", ""},
+ {1, "PXR24", "Pxr24 (lossy)", ""},
+ {2, "ZIP", "ZIP (lossless)", ""},
+ {3, "PIZ", "PIX (lossless)", ""},
+ {4, "RLE", "RLE (lossless)", ""},
+ {0, NULL, NULL, NULL}
+ };
+
+ RNA_def_struct_sdna_from(srna, "NodeImageFile", "storage");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "name");
+ RNA_def_property_ui_text(prop, "Name", "");
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "imtype");
+ RNA_def_property_enum_items(prop, type_items);
+ RNA_def_property_ui_text(prop, "Type", "");
+
+ /* TODO: openexr only { */
+
+ prop = RNA_def_property(srna, "half", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "subimtype", R_OPENEXR_HALF);
+ RNA_def_property_ui_text(prop, "Half", "");
+
+ prop = RNA_def_property(srna, "codec", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "codec");
+ RNA_def_property_enum_items(prop, openexr_codec_items);
+ RNA_def_property_ui_text(prop, "Codec", "");
+
+ /* } else { */
+
+ prop = RNA_def_property(srna, "quality", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "quality");
+ RNA_def_property_ui_text(prop, "Quality", "");
+
+ /* } */
+
+ prop = RNA_def_property(srna, "start", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "sfra");
+ RNA_def_property_ui_text(prop, "Start Frame", "");
+
+ prop = RNA_def_property(srna, "end", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "efra");
+ RNA_def_property_ui_text(prop, "End Frame", "");
}
-static void def_cmp_filter(BlenderRNA *brna, int id)
+static void def_cmp_dilate_erode(StructRNA *srna)
{
- StructRNA *srna;
PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "distance", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "custom2");
+ RNA_def_property_ui_text(prop, "Distance", "Distance to grow/shrink (number of iterations)");
+}
- static EnumPropertyItem type_items[] ={
- {0, "SOFTEN", "Soften", ""},
- {1, "SHARPEN", "Sharpen", ""},
- {2, "LAPLACE", "Laplace", ""},
- {3, "SOBEL", "Sobel", ""},
- {4, "PREWITT", "Prewitt", ""},
- {5, "KIRSCH", "Kirsch", ""},
- {6, "SHADOW", "Shadow", ""},
+static void def_cmp_scale(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ static EnumPropertyItem space_items[] = {
+ {0, "RELATIVE", "Relative", ""},
+ {1, "ABSOLUTE", "Absolute", ""},
+ {2, "SCENE_SIZE", "Scene Size", ""},
+ {0, NULL, NULL, NULL}
+ };
+
+ prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, space_items);
+ RNA_def_property_ui_text(prop, "Space", "Coordinate space to scale relative to");
+}
+
+static void def_cmp_diff_matte(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ static EnumPropertyItem color_space_items[] = {
+ {1, "RGB", "RGB", ""},
+ {2, "HSV", "HSV", ""},
+ {3, "YUV", "YUV", ""},
+ {4, "YCC", "YCbCr", ""},
{0, NULL, NULL, NULL}
};
- srna = def_node(brna, id);
+ prop = RNA_def_property(srna, "color_space", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, color_space_items);
+ RNA_def_property_ui_text(prop, "Color Space", "");
+
+ RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
+
+ /* TODO: nicer wrapping for tolerances */
+
+ prop = RNA_def_property(srna, "tolerance1", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "t1");
+ RNA_def_property_ui_text(prop, "Channel 1 Tolerance", "");
+
+ prop = RNA_def_property(srna, "tolerance2", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "t2");
+ RNA_def_property_ui_text(prop, "Channel 2 Tolerance", "");
+
+ prop = RNA_def_property(srna, "tolerance3", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "t3");
+ RNA_def_property_ui_text(prop, "Channel 3 Tolerance", "");
+
+ prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "fstrength");
+ RNA_def_property_ui_text(prop, "Falloff", "");
+}
+
+static void def_cmp_color_spill(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ static EnumPropertyItem channel_items[] = {
+ {1, "R", "Red", ""},
+ {2, "G", "Green", ""},
+ {3, "B", "Blue", ""},
+ {0, NULL, NULL, NULL}
+ };
+
+ prop = RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, channel_items);
+ RNA_def_property_ui_text(prop, "Channel", "");
+
+ RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
+
+ prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "t1");
+ RNA_def_property_ui_text(prop, "Amount", "How much the selected channel is affected by");
+}
+
+static void def_cmp_chroma(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
+
+ prop = RNA_def_property(srna, "acceptance", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "t1");
+ RNA_def_property_ui_text(prop, "Acceptance", "Tolerance for a color to be considered a keying color");
+
+ prop = RNA_def_property(srna, "cutoff", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "t2");
+ RNA_def_property_ui_text(prop, "Cutoff", "Tolerance below which colors will be considered as exact matches");
+
+ prop = RNA_def_property(srna, "lift", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "fsize");
+ RNA_def_property_ui_text(prop, "Lift", "Alpha lift");
+
+ prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "fstrength");
+ RNA_def_property_ui_text(prop, "Gain", "Alpha gain");
+
+ prop = RNA_def_property(srna, "shadow_adjust", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "t3");
+ RNA_def_property_ui_text(prop, "Shadow Adjust", "Adjusts the brightness of any shadows captured");
+
+ /* TODO:
+ if(c->t2 > c->t1)
+ c->t2=c->t1;
+ */
+}
+
+static void def_cmp_channel_matte(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ static EnumPropertyItem color_space_items[] = {
+ {1, "RGB", "RGB", ""},
+ {2, "HSV", "HSV", ""},
+ {3, "YUV", "YUV", ""},
+ {4, "YCC", "YCbCr", ""},
+ {0, NULL, NULL, NULL}
+ };
+
+ prop = RNA_def_property(srna, "color_space", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, color_space_items);
+ RNA_def_property_ui_text(prop, "Color Space", "");
+
+ /* TODO: channel must be 1, 2 or 3 */
+ prop = RNA_def_property(srna, "channel", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "custom2");
+ RNA_def_property_ui_text(prop, "Channel", "");
+
+ RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
+
+ prop = RNA_def_property(srna, "high", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "t1");
+ RNA_def_property_ui_text(prop, "High", "Values higher than this setting are 100% opaque");
+
+ prop = RNA_def_property(srna, "low", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "t2");
+ RNA_def_property_ui_text(prop, "Low", "Values lower than this setting are 100% keyed");
+
+ /* TODO:
+ if(c->t2 > c->t1)
+ c->t2=c->t1;
+ */
+}
+
+static void def_cmp_flip(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ static EnumPropertyItem axis_items[] = {
+ {0, "X", "X", ""},
+ {1, "Y", "Y", ""},
+ {2, "XY", "X & Y", ""},
+ {0, NULL, NULL, NULL}
+ };
+
+ prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, axis_items);
+ RNA_def_property_ui_text(prop, "Axis", "");
+}
+
+static void def_cmp_splitviewer(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ static EnumPropertyItem axis_items[] = {
+ {0, "X", "X", ""},
+ {1, "Y", "Y", ""},
+ {0, NULL, NULL, NULL}
+ };
+
+ prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom2");
+ RNA_def_property_enum_items(prop, axis_items);
+ RNA_def_property_ui_text(prop, "Axis", "");
+
+ /* TODO: percentage */
+ prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "custom1");
+ RNA_def_property_ui_text(prop, "Factor", "");
+}
+
+static void def_cmp_id_mask(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "custom1");
+ RNA_def_property_ui_text(prop, "Index", "Pass index number to convert to alpha");
+}
+
+static void def_cmp_map_uv(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ /* TODO: percentage */
+ prop = RNA_def_property(srna, "alpha", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "custom1");
+ RNA_def_property_ui_text(prop, "Alpha", "");
+}
+
+static void def_cmp_defocus(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ static EnumPropertyItem bokeh_items[] = {
+ {8, "OCTAGON", "Octagonal", "8 sides"},
+ {7, "HEPTAGON", "Heptagonal", "7 sides"},
+ {6, "HEXAGON", "Hexagonal", "6 sides"},
+ {5, "PENTAGON", "Pentagonal", "5 sides"},
+ {4, "SQUARE", "Square", "4 sides"},
+ {3, "TRIANGLE", "Triangular", "3 sides"},
+ {0, "CIRCLE", "Circular", ""},
+ {0, NULL, NULL, NULL}
+ };
+
+ RNA_def_struct_sdna_from(srna, "NodeDefocus", "storage");
+
+ prop = RNA_def_property(srna, "bokeh", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "bktype");
+ RNA_def_property_enum_items(prop, bokeh_items);
+ RNA_def_property_ui_text(prop, "Bokeh Type", "");
+
+ /* TODO: angle in degrees */
+ prop = RNA_def_property(srna, "angle", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "rotation");
+ RNA_def_property_ui_text(prop, "Angle", "Bokeh shape rotation offset in degrees");
+
+ prop = RNA_def_property(srna, "gamma_correction", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gamco", 1);
+ RNA_def_property_ui_text(prop, "Gamma Correction", "Enable gamma correction before and after main process");
+
+ /* TODO */
+ prop = RNA_def_property(srna, "f_stop", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "fstop");
+ RNA_def_property_ui_text(prop, "fStop", "Amount of focal blur, 128=infinity=perfect focus, half the value doubles the blur radius");
+
+ prop = RNA_def_property(srna, "max_blur", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "maxblur");
+ RNA_def_property_ui_text(prop, "Max Blur", "blur limit, maximum CoC radius, 0=no limit");
+
+ prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "bthresh");
+ RNA_def_property_ui_text(prop, "Threshold", "CoC radius threshold, prevents background bleed on in-focus midground, 0=off");
+
+ prop = RNA_def_property(srna, "preview", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "preview", 1);
+ RNA_def_property_ui_text(prop, "Preview", "Enable sampling mode, useful for preview when using low samplecounts");
+
+ prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "samples");
+ RNA_def_property_ui_text(prop, "Samples", "Number of samples (16=grainy, higher=less noise)");
+
+ prop = RNA_def_property(srna, "use_zbuffer", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "no_zbuf", 1);
+ RNA_def_property_ui_text(prop, "Use Z-Buffer", "Disable when using an image as input instead of actual zbuffer (auto enabled if node not image based, eg. time node)");
+
+ prop = RNA_def_property(srna, "z_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "scale");
+ RNA_def_property_ui_text(prop, "Z-Scale", "Scales the Z input when not using a zbuffer, controls maximum blur designated by the color white or input value 1");
+}
+
+static void def_cmp_luma_matte(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
+
+ prop = RNA_def_property(srna, "high", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "t1");
+ RNA_def_property_ui_text(prop, "High", "Values higher than this setting are 100% opaque");
+
+ prop = RNA_def_property(srna, "low", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "t2");
+ RNA_def_property_ui_text(prop, "Low", "Values lower than this setting are 100% keyed");
+
+ /* TODO: keep low less than high */
+
+}
+
+static void def_cmp_invert(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "rgb", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_CHAN_RGB);
+ RNA_def_property_ui_text(prop, "RGB", "");
+
+ prop = RNA_def_property(srna, "alpha", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_CHAN_A);
+ RNA_def_property_ui_text(prop, "Alpha", "");
+}
+
+static void def_cmp_crop(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "crop_size", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
+ RNA_def_property_ui_text(prop, "Crop Image Size", "Whether to crop the size of the input image");
+
+ RNA_def_struct_sdna_from(srna, "NodeTwoXYs", "storage");
+
+ prop = RNA_def_property(srna, "x1", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "x1");
+ RNA_def_property_ui_text(prop, "X1", "");
+
+ prop = RNA_def_property(srna, "x2", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "x2");
+ RNA_def_property_ui_text(prop, "X2", "");
+
+ prop = RNA_def_property(srna, "y1", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "y1");
+ RNA_def_property_ui_text(prop, "Y1", "");
+
+ prop = RNA_def_property(srna, "y2", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "y2");
+ RNA_def_property_ui_text(prop, "Y2", "");
+}
+
+static void def_cmp_dblur(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ RNA_def_struct_sdna_from(srna, "NodeDBlurData", "storage");
+
+ prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "iter");
+ RNA_def_property_ui_text(prop, "Iterations", "");
+
+ prop = RNA_def_property(srna, "wrap", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "wrap", 1);
+ RNA_def_property_ui_text(prop, "Wrap", "");
+
+ prop = RNA_def_property(srna, "center_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "center_x");
+ RNA_def_property_ui_text(prop, "Center X", "");
+
+ prop = RNA_def_property(srna, "center_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "center_y");
+ RNA_def_property_ui_text(prop, "Center Y", "");
+
+ prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "distance");
+ RNA_def_property_ui_text(prop, "Distance", "");
+
+ prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "angle");
+ RNA_def_property_ui_text(prop, "Angle", "");
+
+ prop = RNA_def_property(srna, "spin", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "spin");
+ RNA_def_property_ui_text(prop, "Spin", "");
+
+ prop = RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "zoom");
+ RNA_def_property_ui_text(prop, "Zoom", "");
+}
+
+static void def_cmp_bilateral_blur(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ RNA_def_struct_sdna_from(srna, "NodeBilateralBlurData", "storage");
+
+ prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "iter");
+ RNA_def_property_ui_text(prop, "Iterations", "");
+
+ prop = RNA_def_property(srna, "sigma_color", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "sigma_color");
+ RNA_def_property_ui_text(prop, "Color Sigma", "");
+
+ prop = RNA_def_property(srna, "sigma_space", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "sigma_space");
+ RNA_def_property_ui_text(prop, "Space Sigma", "");
+
+}
+
+static void def_cmp_premul_key(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ static EnumPropertyItem type_items[] = {
+ {0, "KEY_TO_PREMUL", "Key to Premul", ""},
+ {1, "PREMUL_TO_KEY", "Premul to Key", ""},
+ {0, NULL, NULL, NULL}
+ };
prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "custom1");
RNA_def_property_enum_items(prop, type_items);
- RNA_def_property_ui_text(prop, "Type", "");
+ RNA_def_property_ui_text(prop, "Blend Type", "Conversion between premultiplied alpha and key alpha");
+
}
+static void def_cmp_glare(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ static EnumPropertyItem type_items[] = {
+ {3, "GHOSTS", "Ghosts", ""},
+ {2, "STREAKS", "Streaks", ""},
+ {1, "FOG_GLOW", "Fog Glow", ""},
+ {0, "SIMPLE_STAR", "Simple Star", ""},
+ {0, NULL, NULL, NULL}
+ };
+
+ static EnumPropertyItem quality_items[] = {
+ {0, "HIGH", "High", ""},
+ {1, "MEDIUM", "Medium", ""},
+ {2, "LOW", "Low", ""},
+ {0, NULL, NULL, NULL}
+ };
+
+ RNA_def_struct_sdna_from(srna, "NodeGlare", "storage");
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, type_items);
+ RNA_def_property_ui_text(prop, "Type", "");
+
+ prop = RNA_def_property(srna, "quality", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "quality");
+ RNA_def_property_enum_items(prop, type_items);
+ RNA_def_property_ui_text(prop, "Quality", "If not set to high quality, the effect will be applied to a low-res copy of the source image");
+
+ prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "iter");
+ RNA_def_property_ui_text(prop, "Iterations", "");
+
+ prop = RNA_def_property(srna, "color_modulation", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "colmod");
+ RNA_def_property_ui_text(prop, "Color Modulation", "");
+
+ prop = RNA_def_property(srna, "mix", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "mix");
+ RNA_def_property_ui_text(prop, "Mix", "-1 is original image only, 0 is exact 50/50 mix, 1 is processed image only");
+
+ prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "threshold");
+ RNA_def_property_ui_text(prop, "Threshold", "The glare filter will only be applied to pixels brighter than this value");
+
+ prop = RNA_def_property(srna, "streaks", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "angle");
+ RNA_def_property_ui_text(prop, "Streaks", "Total number of streaks");
+
+ prop = RNA_def_property(srna, "angle_offset", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "angle_ofs");
+ RNA_def_property_ui_text(prop, "Angle Offset", "Streak angle offset in degrees");
+
+ prop = RNA_def_property(srna, "fade", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "fade");
+ RNA_def_property_ui_text(prop, "Fade", "Streak fade-out factor");
+
+ prop = RNA_def_property(srna, "rotate_45", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "angle", 1);
+ RNA_def_property_ui_text(prop, "Rotate 45", "Simple star filter: add 45 degree rotation offset");
+
+ prop = RNA_def_property(srna, "size", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "size");
+ RNA_def_property_ui_text(prop, "Size", "Glow/glare size (not actual size; relative to initial size of bright area of pixels)");
+
+ /* TODO */
+}
-/* -- Texture Node Storage Types --------------------------------------------- */
+static void def_cmp_tonemap(StructRNA *srna)
+{
+ PropertyRNA *prop;
+
+ static EnumPropertyItem type_items[] = {
+ {1, "RD_PHOTORECEPTOR", "R/D Photoreceptor", ""},
+ {0, "RH_SIMPLE", "Rh Simple", ""},
+ {0, NULL, NULL, NULL}
+ };
+
+ RNA_def_struct_sdna_from(srna, "NodeTonemap", "storage");
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, type_items);
+ RNA_def_property_ui_text(prop, "Type", "");
+
+ /* TODO: if type==0 { */
+
+ prop = RNA_def_property(srna, "key", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "key");
+ RNA_def_property_ui_text(prop, "Key", "The value the average luminance is mapped to");
+
+ prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "offset");
+ RNA_def_property_ui_text(prop, "Offset", "Normally always 1, but can be used as an extra control to alter the brightness curve");
+
+ prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "gamma");
+ RNA_def_property_ui_text(prop, "Gamma", "If not used, set to 1");
+
+ /* TODO: } else { */
+
+ prop = RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "f");
+ RNA_def_property_ui_text(prop, "Intensity", "If less than zero, darkens image; otherwise, makes it brighter");
+
+ prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "m");
+ RNA_def_property_ui_text(prop, "Contrast", "Set to 0 to use estimate from input image");
+
+ prop = RNA_def_property(srna, "adaptation", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "a");
+ RNA_def_property_ui_text(prop, "Adaptation", "If 0, global; if 1, based on pixel intensity");
+
+ prop = RNA_def_property(srna, "correction", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "c");
+ RNA_def_property_ui_text(prop, "Color Correction", "If 0, same for all channels; if 1, each independent");
+}
-static void rna_def_storage_tex_node_output(BlenderRNA *brna)
+static void def_cmp_lensdist(StructRNA *srna)
{
- StructRNA *srna;
PropertyRNA *prop;
- srna = RNA_def_struct(brna, "TexNodeOutput", NULL);
- RNA_def_struct_ui_text(srna, "Texture Node Output", "");
+ RNA_def_struct_sdna_from(srna, "NodeLensDist", "storage");
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "name");
- RNA_def_property_ui_text(prop, "Name", "");
+ prop = RNA_def_property(srna, "projector", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "proj", 1);
+ RNA_def_property_ui_text(prop, "Projector", "Enable/disable projector mode. Effect is applied in horizontal direction only.");
+
+ /* TODO: if proj mode is off { */
+
+ prop = RNA_def_property(srna, "jitter", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "jit", 1);
+ RNA_def_property_ui_text(prop, "Jitter", "Enable/disable jittering; faster, but also noisier");
+
+ prop = RNA_def_property(srna, "fit", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "fit", 1);
+ RNA_def_property_ui_text(prop, "Fit", "For positive distortion factor only: scale image such that black areas are not visible");
}
+
/* -- Texture Nodes --------------------------------------------------------- */
-static void def_tex_output(BlenderRNA *brna, int id)
+static void def_tex_output(StructRNA *srna)
{
- StructRNA *srna;
PropertyRNA *prop;
- srna = def_node(brna, id);
+ RNA_def_struct_sdna_from(srna, "TexNodeOutput", "storage");
- prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "storage");
- RNA_def_property_struct_type(prop, "TexNodeOutput");
- RNA_def_property_ui_text(prop, "Settings", "");
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "name");
+ RNA_def_property_ui_text(prop, "Name", "");
}
-static void def_tex_image(BlenderRNA *brna, int id)
+static void def_tex_image(StructRNA *srna)
{
- StructRNA *srna;
PropertyRNA *prop;
- srna = def_node(brna, id);
-
prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "storage");
RNA_def_property_struct_type(prop, "ImageUser");
RNA_def_property_ui_text(prop, "Settings", "");
}
-static void def_tex_bricks(BlenderRNA *brna, int id)
+static void def_tex_bricks(StructRNA *srna)
{
- StructRNA *srna;
PropertyRNA *prop;
- srna = def_node(brna, id);
-
prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "custom3");
RNA_def_property_ui_text(prop, "Offset Amount", "");
@@ -654,9 +1302,6 @@ static void rna_def_shader_node(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_enum_items(prop, node_type_items);
RNA_def_property_ui_text(prop, "Type", "");
-
- /* Shader storage types */
- rna_def_storage_node_geometry(brna);
}
static void rna_def_compositor_node(BlenderRNA *brna)
@@ -675,9 +1320,6 @@ static void rna_def_compositor_node(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_enum_items(prop, node_type_items);
RNA_def_property_ui_text(prop, "Type", "");
-
- /* Compositor storage types */
- rna_def_storage_node_blur_data(brna);
}
static void rna_def_texture_node(BlenderRNA *brna)
@@ -696,9 +1338,6 @@ static void rna_def_texture_node(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_enum_items(prop, node_type_items);
RNA_def_property_ui_text(prop, "Type", "");
-
- /* Texture storage types */
- rna_def_storage_tex_node_output(brna);
}
/* -------------------------------------------------------------------------- */
@@ -732,6 +1371,7 @@ static void rna_def_nodetree(BlenderRNA *brna)
srna = RNA_def_struct(brna, "NodeTree", "ID");
RNA_def_struct_ui_text(srna, "Node Tree", "Node tree consisting of linked nodes used for materials, textures and compositing.");
RNA_def_struct_sdna(srna, "bNodeTree");
+ RNA_def_struct_ui_icon(srna, ICON_NODE);
prop = RNA_def_property(srna, "nodes", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "nodes", NULL);
@@ -739,14 +1379,12 @@ static void rna_def_nodetree(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Nodes", "");
}
-static void define_simple_node(BlenderRNA *brna, int id)
-{
- def_node(brna, id);
-}
-
-static void define_specific_node(BlenderRNA *brna, int id, void (*func)(BlenderRNA*, int))
+static void define_specific_node(BlenderRNA *brna, int id, void (*func)(StructRNA*))
{
- func(brna, id);
+ StructRNA *srna = def_node(brna, id);
+
+ if(func)
+ func(srna);
}
void RNA_def_nodetree(BlenderRNA *brna)
@@ -759,7 +1397,7 @@ void RNA_def_nodetree(BlenderRNA *brna)
rna_def_texture_node(brna);
#define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
- define_specific_node(brna, ID, DefFunc != 0 ? DefFunc : define_simple_node);
+ define_specific_node(brna, ID, DefFunc);
#include "rna_nodetree_types.h"
diff --git a/source/blender/makesrna/intern/rna_nodetree_types.h b/source/blender/makesrna/intern/rna_nodetree_types.h
index 0c333dfef56..47a7be163b1 100644
--- a/source/blender/makesrna/intern/rna_nodetree_types.h
+++ b/source/blender/makesrna/intern/rna_nodetree_types.h
@@ -22,112 +22,109 @@
* ***** END GPL LICENSE BLOCK *****
*/
-#define TODO 0
+/* Tree type Node ID RNA def function Enum name Struct name UI Name UI Description */
+DefNode( ShaderNode, SH_NODE_OUTPUT, 0, "OUTPUT", Output, "Output", "" )
+DefNode( ShaderNode, SH_NODE_MATERIAL, def_sh_material, "MATERIAL", Material, "Material", "" )
+DefNode( ShaderNode, SH_NODE_RGB, 0, "RGB", RGB, "RGB", "" )
+DefNode( ShaderNode, SH_NODE_VALUE, 0, "VALUE", Value, "Value", "" )
+DefNode( ShaderNode, SH_NODE_MIX_RGB, def_mix_rgb, "MIX_RGB", MixRGB, "MixRGB", "" )
+DefNode( ShaderNode, SH_NODE_VALTORGB, def_val_to_rgb, "VALTORGB", ValToRGB, "Value to RGB", "" )
+DefNode( ShaderNode, SH_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB to BW", "" )
+DefNode( ShaderNode, SH_NODE_TEXTURE, def_texture, "TEXTURE", Texture, "Texture", "" )
+DefNode( ShaderNode, SH_NODE_NORMAL, 0, "NORMAL", Normal, "Normal", "" )
+DefNode( ShaderNode, SH_NODE_GEOMETRY, def_sh_geometry, "GEOMETRY", Geometry, "Geometry", "" )
+DefNode( ShaderNode, SH_NODE_MAPPING, def_sh_mapping, "MAPPING", Mapping, "Mapping", "" )
+DefNode( ShaderNode, SH_NODE_CURVE_VEC, def_vector_curve, "CURVE_VEC", VectorCurve, "Vector Curve", "" )
+DefNode( ShaderNode, SH_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", RGBCurve, "RGB Curve", "" )
+DefNode( ShaderNode, SH_NODE_CAMERA, 0, "CAMERA", CameraData, "Camera Data", "" )
+DefNode( ShaderNode, SH_NODE_MATH, def_math, "MATH", Math, "Math", "" )
+DefNode( ShaderNode, SH_NODE_VECT_MATH, def_vector_math, "VECT_MATH", VectorMath, "Vector Math", "" )
+DefNode( ShaderNode, SH_NODE_SQUEEZE, 0, "SQUEEZE", Squeeze, "Squeeze", "" )
+DefNode( ShaderNode, SH_NODE_MATERIAL_EXT, def_sh_material, "MATERIAL_EXT", ExtendedMaterial, "Extended Material", "" )
+DefNode( ShaderNode, SH_NODE_INVERT, 0, "INVERT", Invert, "Invert", "" )
+DefNode( ShaderNode, SH_NODE_SEPRGB, 0, "SEPRGB", SeparateRGB, "Separate RGB", "" )
+DefNode( ShaderNode, SH_NODE_COMBRGB, 0, "COMBRGB", CombineRGB, "Combine RGB", "" )
+DefNode( ShaderNode, SH_NODE_HUE_SAT, 0, "HUE_SAT", HueSaturation, "Hue/Saturation", "" )
+
+DefNode( CompositorNode, CMP_NODE_VIEWER, 0, "VIEWER", Viewer, "Viewer", "" )
+DefNode( CompositorNode, CMP_NODE_RGB, 0, "RGB", RGB, "RGB", "" )
+DefNode( CompositorNode, CMP_NODE_VALUE, 0, "VALUE", Value, "Value", "" )
+DefNode( CompositorNode, CMP_NODE_MIX_RGB, def_mix_rgb, "MIX_RGB", MixRGB, "Mix RGB", "" )
+DefNode( CompositorNode, CMP_NODE_VALTORGB, def_val_to_rgb, "VALTORGB", ValToRGB, "Val to RGB", "" )
+DefNode( CompositorNode, CMP_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB to BW", "" )
+DefNode( CompositorNode, CMP_NODE_NORMAL, 0, "NORMAL", Normal, "Normal", "" )
+DefNode( CompositorNode, CMP_NODE_CURVE_VEC, def_vector_curve, "CURVE_VEC", CurveVec, "Vector Curve", "" )
+DefNode( CompositorNode, CMP_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", CurveRGB, "RGB Curve", "" )
+DefNode( CompositorNode, CMP_NODE_ALPHAOVER, def_cmp_alpha_over, "ALPHAOVER", AlphaOver, "Alpha Over", "" )
+DefNode( CompositorNode, CMP_NODE_BLUR, def_cmp_blur, "BLUR", Blur, "Blur", "" )
+DefNode( CompositorNode, CMP_NODE_FILTER, def_cmp_filter, "FILTER", Filter, "Filter", "" )
+DefNode( CompositorNode, CMP_NODE_MAP_VALUE, def_cmp_map_value, "MAP_VALUE", MapValue, "Map Value", "" )
+DefNode( CompositorNode, CMP_NODE_TIME, def_time, "TIME", Time, "Time", "" )
+DefNode( CompositorNode, CMP_NODE_VECBLUR, def_cmp_vector_blur, "VECBLUR", VecBlur, "Vector Blur", "" )
+DefNode( CompositorNode, CMP_NODE_SEPRGBA, 0, "SEPRGBA", SepRGBA, "Separate RGBA", "" )
+DefNode( CompositorNode, CMP_NODE_SEPHSVA, 0, "SEPHSVA", SepHSVA, "Separate HSVA", "" )
+DefNode( CompositorNode, CMP_NODE_SETALPHA, 0, "SETALPHA", SetAlpha, "Set Alpha", "" )
+DefNode( CompositorNode, CMP_NODE_HUE_SAT, 0, "HUE_SAT", HueSat, "Hue/Saturation", "" )
+DefNode( CompositorNode, CMP_NODE_IMAGE, def_cmp_image, "IMAGE", Image, "Image", "" )
+DefNode( CompositorNode, CMP_NODE_R_LAYERS, def_cmp_render_layers, "R_LAYERS", RLayers, "Render Layers", "" )
+DefNode( CompositorNode, CMP_NODE_COMPOSITE, 0, "COMPOSITE", Composite, "Composite", "" )
+DefNode( CompositorNode, CMP_NODE_OUTPUT_FILE, def_cmp_output_file, "OUTPUT_FILE", OutputFile, "Output File", "" )
+DefNode( CompositorNode, CMP_NODE_TEXTURE, def_texture, "TEXTURE", Texture, "Texture", "" )
+DefNode( CompositorNode, CMP_NODE_TRANSLATE, 0, "TRANSLATE", Translate, "Translate", "" )
+DefNode( CompositorNode, CMP_NODE_ZCOMBINE, 0, "ZCOMBINE", Zcombine, "Z Combine", "" )
+DefNode( CompositorNode, CMP_NODE_COMBRGBA, 0, "COMBRGBA", CombRGBA, "Combine RGBA", "" )
+DefNode( CompositorNode, CMP_NODE_DILATEERODE, def_cmp_dilate_erode, "DILATEERODE", DilateErode, "Dilate/Erode", "" )
+DefNode( CompositorNode, CMP_NODE_ROTATE, 0, "ROTATE", Rotate, "Rotate", "" )
+DefNode( CompositorNode, CMP_NODE_SCALE, def_cmp_scale, "SCALE", Scale, "Scale", "" )
+DefNode( CompositorNode, CMP_NODE_SEPYCCA, 0, "SEPYCCA", SepYCCA, "Separate YCCA", "" )
+DefNode( CompositorNode, CMP_NODE_COMBYCCA, 0, "COMBYCCA", CombYCCA, "Combine YCCA", "" )
+DefNode( CompositorNode, CMP_NODE_SEPYUVA, 0, "SEPYUVA", SepYUVA, "Separate YUVA", "" )
+DefNode( CompositorNode, CMP_NODE_COMBYUVA, 0, "COMBYUVA", CombYUVA, "Combine YUVA", "" )
+DefNode( CompositorNode, CMP_NODE_DIFF_MATTE, def_cmp_diff_matte, "DIFF_MATTE", DiffMatte, "Difference Key", "" )
+DefNode( CompositorNode, CMP_NODE_COLOR_SPILL, def_cmp_color_spill, "COLOR_SPILL", ColorSpill, "Color Spill", "" )
+DefNode( CompositorNode, CMP_NODE_CHROMA, def_cmp_chroma, "CHROMA", Chroma, "Chroma Key", "" )
+DefNode( CompositorNode, CMP_NODE_CHANNEL_MATTE, def_cmp_channel_matte, "CHANNEL_MATTE", ChannelMatte, "Channel Key", "" )
+DefNode( CompositorNode, CMP_NODE_FLIP, def_cmp_flip, "FLIP", Flip, "Flip", "" )
+DefNode( CompositorNode, CMP_NODE_SPLITVIEWER, def_cmp_splitviewer, "SPLITVIEWER", SplitViewer, "Split Viewer", "" )
+DefNode( CompositorNode, CMP_NODE_MAP_UV, def_cmp_map_uv, "MAP_UV", MapUV, "Map UV", "" )
+DefNode( CompositorNode, CMP_NODE_ID_MASK, def_cmp_id_mask, "ID_MASK", IDMask, "ID Mask", "" )
+DefNode( CompositorNode, CMP_NODE_DEFOCUS, def_cmp_defocus, "DEFOCUS", Defocus, "Defocus", "" )
+DefNode( CompositorNode, CMP_NODE_DISPLACE, 0, "DISPLACE", Displace, "Displace", "" )
+DefNode( CompositorNode, CMP_NODE_COMBHSVA, 0, "COMBHSVA", CombHSVA, "Combine HSVA", "" )
+DefNode( CompositorNode, CMP_NODE_MATH, def_math, "MATH", Math, "Math", "" )
+DefNode( CompositorNode, CMP_NODE_LUMA_MATTE, def_cmp_luma_matte, "LUMA_MATTE", LumaMatte, "Luma Matte", "" )
+DefNode( CompositorNode, CMP_NODE_BRIGHTCONTRAST, 0, "BRIGHTCONTRAST", BrightContrast, "Bright Contrast", "" )
+DefNode( CompositorNode, CMP_NODE_GAMMA, 0, "GAMMA", Gamma, "Gamma", "" )
+DefNode( CompositorNode, CMP_NODE_INVERT, def_cmp_invert, "INVERT", Invert, "Invert", "" )
+DefNode( CompositorNode, CMP_NODE_NORMALIZE, 0, "NORMALIZE", Normalize, "Normalize", "" )
+DefNode( CompositorNode, CMP_NODE_CROP, def_cmp_crop, "CROP", Crop, "Crop", "" )
+DefNode( CompositorNode, CMP_NODE_DBLUR, def_cmp_dblur, "DBLUR", DBlur, "DBlur", "" )
+DefNode( CompositorNode, CMP_NODE_BILATERALBLUR, def_cmp_bilateral_blur, "BILATERALBLUR", Bilateralblur, "Bilateral Blur", "" )
+DefNode( CompositorNode, CMP_NODE_PREMULKEY, def_cmp_premul_key, "PREMULKEY", PremulKey, "Premul Key", "" )
+DefNode( CompositorNode, CMP_NODE_GLARE, def_cmp_glare, "GLARE", Glare, "Glare", "" )
+DefNode( CompositorNode, CMP_NODE_TONEMAP, def_cmp_tonemap, "TONEMAP", Tonemap, "Tonemap", "" )
+DefNode( CompositorNode, CMP_NODE_LENSDIST, def_cmp_lensdist, "LENSDIST", Lensdist, "Lensdist", "" )
+
+DefNode( TextureNode, TEX_NODE_OUTPUT, def_tex_output, "OUTPUT", Output, "Output", "" )
+DefNode( TextureNode, TEX_NODE_CHECKER, 0, "CHECKER", Checker, "Checker", "" )
+DefNode( TextureNode, TEX_NODE_TEXTURE, def_texture, "TEXTURE", Texture, "Texture", "" )
+DefNode( TextureNode, TEX_NODE_BRICKS, def_tex_bricks, "BRICKS", Bricks, "Bricks", "" )
+DefNode( TextureNode, TEX_NODE_MATH, def_math, "MATH", Math, "Math", "" )
+DefNode( TextureNode, TEX_NODE_MIX_RGB, def_mix_rgb, "MIX_RGB", MixRGB, "Mix RGB", "" )
+DefNode( TextureNode, TEX_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB To BW", "" )
+DefNode( TextureNode, TEX_NODE_VALTORGB, def_val_to_rgb, "VALTORGB", ValToRGB, "Val To RGB", "" )
+DefNode( TextureNode, TEX_NODE_IMAGE, def_tex_image, "IMAGE", Image, "Image", "" )
+DefNode( TextureNode, TEX_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", CurveRGB, "RGB Curve", "" )
+DefNode( TextureNode, TEX_NODE_INVERT, 0, "INVERT", Invert, "Invert", "" )
+DefNode( TextureNode, TEX_NODE_HUE_SAT, 0, "HUE_SAT", HueSaturation, "Hue/Saturation", "" )
+DefNode( TextureNode, TEX_NODE_CURVE_TIME, def_time, "CURVE_TIME", CurveTime, "Curve Time", "" )
+DefNode( TextureNode, TEX_NODE_ROTATE, 0, "ROTATE", Rotate, "Rotate", "" )
+DefNode( TextureNode, TEX_NODE_VIEWER, 0, "VIEWER", Viewer, "Viewer", "" )
+DefNode( TextureNode, TEX_NODE_TRANSLATE, 0, "TRANSLATE", Translate, "Translate", "" )
+DefNode( TextureNode, TEX_NODE_COORD, 0, "COORD", Coordinates, "Coordinates", "" )
+DefNode( TextureNode, TEX_NODE_DISTANCE, 0, "DISTANCE", Distance, "Distance", "" )
+DefNode( TextureNode, TEX_NODE_COMPOSE, 0, "COMPOSE", Compose, "Compose", "" )
+DefNode( TextureNode, TEX_NODE_DECOMPOSE, 0, "DECOMPOSE", Decompose, "Decompose", "" )
+DefNode( TextureNode, TEX_NODE_VALTONOR, 0, "VALTONOR", ValToNor, "Val to Nor", "" )
+DefNode( TextureNode, TEX_NODE_SCALE, 0, "SCALE", Scale, "Scale", "" )
-/* Tree type Node ID RNA def function Enum name Struct name UI Name UI Description */
-DefNode( ShaderNode, SH_NODE_OUTPUT, 0, "OUTPUT", Output, "Output", "" )
-DefNode( ShaderNode, SH_NODE_MATERIAL, def_sh_material, "MATERIAL", Material, "Material", "" )
-DefNode( ShaderNode, SH_NODE_RGB, 0, "RGB", RGB, "RGB", "" )
-DefNode( ShaderNode, SH_NODE_VALUE, 0, "VALUE", Value, "Value", "" )
-DefNode( ShaderNode, SH_NODE_MIX_RGB, def_mix_rgb, "MIX_RGB", MixRGB, "MixRGB", "" )
-DefNode( ShaderNode, SH_NODE_VALTORGB, def_val_to_rgb, "VALTORGB", ValToRGB, "Value to RGB", "" )
-DefNode( ShaderNode, SH_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB to BW", "" )
-DefNode( ShaderNode, SH_NODE_TEXTURE, def_texture, "TEXTURE", Texture, "Texture", "" )
-DefNode( ShaderNode, SH_NODE_NORMAL, 0, "NORMAL", Normal, "Normal", "" )
-DefNode( ShaderNode, SH_NODE_GEOMETRY, def_sh_geometry, "GEOMETRY", Geometry, "Geometry", "" )
-DefNode( ShaderNode, SH_NODE_MAPPING, def_sh_mapping, "MAPPING", Mapping, "Mapping", "" )
-DefNode( ShaderNode, SH_NODE_CURVE_VEC, def_vector_curve, "CURVE_VEC", VectorCurve, "Vector Curve", "" )
-DefNode( ShaderNode, SH_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", RGBCurve, "RGB Curve", "" )
-DefNode( ShaderNode, SH_NODE_CAMERA, 0, "CAMERA", CameraData, "Camera Data", "" )
-DefNode( ShaderNode, SH_NODE_MATH, def_math, "MATH", Math, "Math", "" )
-DefNode( ShaderNode, SH_NODE_VECT_MATH, def_vector_math, "VECT_MATH", VectorMath, "Vector Math", "" )
-DefNode( ShaderNode, SH_NODE_SQUEEZE, 0, "SQUEEZE", Squeeze, "Squeeze", "" )
-DefNode( ShaderNode, SH_NODE_MATERIAL_EXT, def_sh_material, "MATERIAL_EXT", ExtendedMaterial, "Extended Material", "" )
-DefNode( ShaderNode, SH_NODE_INVERT, 0, "INVERT", Invert, "Invert", "" )
-DefNode( ShaderNode, SH_NODE_SEPRGB, 0, "SEPRGB", SeparateRGB, "Separate RGB", "" )
-DefNode( ShaderNode, SH_NODE_COMBRGB, 0, "COMBRGB", CombineRGB, "Combine RGB", "" )
-DefNode( ShaderNode, SH_NODE_HUE_SAT, 0, "HUE_SAT", HueSaturation, "Hue/Saturation", "" )
-
-DefNode( CompositorNode, CMP_NODE_VIEWER, 0, "VIEWER", Viewer, "Viewer", "" )
-DefNode( CompositorNode, CMP_NODE_RGB, 0, "RGB", RGB, "RGB", "" )
-DefNode( CompositorNode, CMP_NODE_VALUE, 0, "VALUE", Value, "Value", "" )
-DefNode( CompositorNode, CMP_NODE_MIX_RGB, def_mix_rgb, "MIX_RGB", MixRGB, "Mix RGB", "" )
-DefNode( CompositorNode, CMP_NODE_VALTORGB, def_val_to_rgb, "VALTORGB", ValToRGB, "Val to RGB", "" )
-DefNode( CompositorNode, CMP_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB to BW", "" )
-DefNode( CompositorNode, CMP_NODE_NORMAL, 0, "NORMAL", Normal, "Normal", "" )
-DefNode( CompositorNode, CMP_NODE_CURVE_VEC, def_vector_curve, "CURVE_VEC", CurveVec, "Vector Curve", "" )
-DefNode( CompositorNode, CMP_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", CurveRGB, "RGB Curve", "" )
-DefNode( CompositorNode, CMP_NODE_ALPHAOVER, def_cmp_alpha_over, "ALPHAOVER", AlphaOver, "Alpha Over", "" )
-DefNode( CompositorNode, CMP_NODE_BLUR, def_cmp_blur, "BLUR", Blur, "Blur", "" )
-DefNode( CompositorNode, CMP_NODE_FILTER, def_cmp_filter, "FILTER", Filter, "Filter", "" )
-DefNode( CompositorNode, CMP_NODE_MAP_VALUE, TODO, "MAP_VALUE", MapValue, "Map Value", "" )
-DefNode( CompositorNode, CMP_NODE_TIME, def_time, "TIME", Time, "Time", "" )
-DefNode( CompositorNode, CMP_NODE_VECBLUR, TODO, "VECBLUR", VecBlur, "Vector Blur", "" )
-DefNode( CompositorNode, CMP_NODE_SEPRGBA, 0, "SEPRGBA", SepRGBA, "Separate RGBA", "" )
-DefNode( CompositorNode, CMP_NODE_SEPHSVA, 0, "SEPHSVA", SepHSVA, "Separate HSVA", "" )
-DefNode( CompositorNode, CMP_NODE_SETALPHA, 0, "SETALPHA", SetAlpha, "Set Alpha", "" )
-DefNode( CompositorNode, CMP_NODE_HUE_SAT, 0, "HUE_SAT", HueSat, "Hue/Saturation", "" )
-DefNode( CompositorNode, CMP_NODE_IMAGE, TODO, "IMAGE", Image, "Image", "" )
-DefNode( CompositorNode, CMP_NODE_R_LAYERS, TODO, "R_LAYERS", RLayers, "Render Layers", "" )
-DefNode( CompositorNode, CMP_NODE_COMPOSITE, 0, "COMPOSITE", Composite, "Composite", "" )
-DefNode( CompositorNode, CMP_NODE_OUTPUT_FILE, TODO, "OUTPUT_FILE", OutputFile, "Output File", "" )
-DefNode( CompositorNode, CMP_NODE_TEXTURE, TODO, "TEXTURE", Texture, "Texture", "" )
-DefNode( CompositorNode, CMP_NODE_TRANSLATE, 0, "TRANSLATE", Translate, "Translate", "" )
-DefNode( CompositorNode, CMP_NODE_ZCOMBINE, 0, "ZCOMBINE", Zcombine, "Z Combine", "" )
-DefNode( CompositorNode, CMP_NODE_COMBRGBA, 0, "COMBRGBA", CombRGBA, "Combine RGBA", "" )
-DefNode( CompositorNode, CMP_NODE_DILATEERODE, TODO, "DILATEERODE", DilateErode, "Dilate/Erode", "" )
-DefNode( CompositorNode, CMP_NODE_ROTATE, 0, "ROTATE", Rotate, "Rotate", "" )
-DefNode( CompositorNode, CMP_NODE_SCALE, TODO, "SCALE", Scale, "Scale", "" )
-DefNode( CompositorNode, CMP_NODE_SEPYCCA, 0, "SEPYCCA", SepYCCA, "Separate YCCA", "" )
-DefNode( CompositorNode, CMP_NODE_COMBYCCA, 0, "COMBYCCA", CombYCCA, "Combine YCCA", "" )
-DefNode( CompositorNode, CMP_NODE_SEPYUVA, 0, "SEPYUVA", SepYUVA, "Separate YUVA", "" )
-DefNode( CompositorNode, CMP_NODE_COMBYUVA, 0, "COMBYUVA", CombYUVA, "Combine YUVA", "" )
-DefNode( CompositorNode, CMP_NODE_DIFF_MATTE, TODO, "DIFF_MATTE", DiffMatte, "Diff Matte", "" )
-DefNode( CompositorNode, CMP_NODE_COLOR_SPILL, TODO, "COLOR_SPILL", ColorSpill, "Color Spill", "" )
-DefNode( CompositorNode, CMP_NODE_CHROMA, TODO, "CHROMA", Chroma, "Chroma", "" )
-DefNode( CompositorNode, CMP_NODE_CHANNEL_MATTE, TODO, "CHANNEL_MATTE", ChannelMatte, "Channel Matte", "" )
-DefNode( CompositorNode, CMP_NODE_FLIP, TODO, "FLIP", Flip, "Flip", "" )
-DefNode( CompositorNode, CMP_NODE_SPLITVIEWER, TODO, "SPLITVIEWER", SplitViewer, "Split Viewer", "" )
-DefNode( CompositorNode, CMP_NODE_INDEX_MASK, TODO, "INDEX_MASK", IndexMask, "Index Mask", "" )
-DefNode( CompositorNode, CMP_NODE_MAP_UV, TODO, "MAP_UV", MapUV, "Map UV", "" )
-DefNode( CompositorNode, CMP_NODE_ID_MASK, TODO, "ID_MASK", IDMask, "ID Mask", "" )
-DefNode( CompositorNode, CMP_NODE_DEFOCUS, TODO, "DEFOCUS", Defocus, "Defocus", "" )
-DefNode( CompositorNode, CMP_NODE_DISPLACE, 0, "DISPLACE", Displace, "Displace", "" )
-DefNode( CompositorNode, CMP_NODE_COMBHSVA, 0, "COMBHSVA", CombHSVA, "Combine HSVA", "" )
-DefNode( CompositorNode, CMP_NODE_MATH, def_math, "MATH", Math, "Math", "" )
-DefNode( CompositorNode, CMP_NODE_LUMA_MATTE, TODO, "LUMA_MATTE", LumaMatte, "Luma Matte", "" )
-DefNode( CompositorNode, CMP_NODE_BRIGHTCONTRAST, 0, "BRIGHTCONTRAST", BrightContrast, "Bright Contrast", "" )
-DefNode( CompositorNode, CMP_NODE_GAMMA, 0, "GAMMA", Gamma, "Gamma", "" )
-DefNode( CompositorNode, CMP_NODE_INVERT, TODO, "INVERT", Invert, "Invert", "" )
-DefNode( CompositorNode, CMP_NODE_NORMALIZE, 0, "NORMALIZE", Normalize, "Normalize", "" )
-DefNode( CompositorNode, CMP_NODE_CROP, TODO, "CROP", Crop, "Crop", "" )
-DefNode( CompositorNode, CMP_NODE_DBLUR, TODO, "DBLUR", DBlur, "DBlur", "" )
-DefNode( CompositorNode, CMP_NODE_BILATERALBLUR, TODO, "BILATERALBLUR", Bilateralblur, "Bilateral Blur", "" )
-DefNode( CompositorNode, CMP_NODE_PREMULKEY, TODO, "PREMULKEY", PremulKey, "Premul Key", "" )
-DefNode( CompositorNode, CMP_NODE_GLARE, TODO, "GLARE", Glare, "Glare", "" )
-DefNode( CompositorNode, CMP_NODE_TONEMAP, TODO, "TONEMAP", Tonemap, "Tonemap", "" )
-DefNode( CompositorNode, CMP_NODE_LENSDIST, TODO, "LENSDIST", Lensdist, "Lensdist", "" )
-
-DefNode( TextureNode, TEX_NODE_OUTPUT, def_tex_output, "OUTPUT", Output, "Output", "" )
-DefNode( TextureNode, TEX_NODE_CHECKER, 0, "CHECKER", Checker, "Checker", "" )
-DefNode( TextureNode, TEX_NODE_TEXTURE, def_texture, "TEXTURE", Texture, "Texture", "" )
-DefNode( TextureNode, TEX_NODE_BRICKS, def_tex_bricks, "BRICKS", Bricks, "Bricks", "" )
-DefNode( TextureNode, TEX_NODE_MATH, def_math, "MATH", Math, "Math", "" )
-DefNode( TextureNode, TEX_NODE_MIX_RGB, def_mix_rgb, "MIX_RGB", MixRGB, "Mix RGB", "" )
-DefNode( TextureNode, TEX_NODE_RGBTOBW, 0, "RGBTOBW", RGBToBW, "RGB To BW", "" )
-DefNode( TextureNode, TEX_NODE_VALTORGB, def_val_to_rgb, "VALTORGB", ValToRGB, "Val To RGB", "" )
-DefNode( TextureNode, TEX_NODE_IMAGE, def_tex_image, "IMAGE", Image, "Image", "" )
-DefNode( TextureNode, TEX_NODE_CURVE_RGB, def_rgb_curve, "CURVE_RGB", CurveRGB, "RGB Curve", "" )
-DefNode( TextureNode, TEX_NODE_INVERT, 0, "INVERT", Invert, "Invert", "" )
-DefNode( TextureNode, TEX_NODE_HUE_SAT, 0, "HUE_SAT", HueSaturation, "Hue/Saturation", "" )
-DefNode( TextureNode, TEX_NODE_CURVE_TIME, def_time, "CURVE_TIME", CurveTime, "Curve Time", "" )
-DefNode( TextureNode, TEX_NODE_ROTATE, 0, "ROTATE", Rotate, "Rotate", "" )
-DefNode( TextureNode, TEX_NODE_VIEWER, 0, "VIEWER", Viewer, "Viewer", "" )
-DefNode( TextureNode, TEX_NODE_TRANSLATE, 0, "TRANSLATE", Translate, "Translate", "" )
-DefNode( TextureNode, TEX_NODE_COORD, 0, "COORD", Coordinates, "Coordinates", "" )
-DefNode( TextureNode, TEX_NODE_DISTANCE, 0, "DISTANCE", Distance, "Distance", "" )
-DefNode( TextureNode, TEX_NODE_COMPOSE, 0, "COMPOSE", Compose, "Compose", "" )
-DefNode( TextureNode, TEX_NODE_DECOMPOSE, 0, "DECOMPOSE", Decompose, "Decompose", "" )
-DefNode( TextureNode, TEX_NODE_VALTONOR, 0, "VALTONOR", ValToNor, "Val to Nor", "" )
-DefNode( TextureNode, TEX_NODE_SCALE, 0, "SCALE", Scale, "Scale", "" )
-
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 6baf5083d31..d945fb26982 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -22,6 +22,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
+#include <stdio.h>
#include <stdlib.h>
#include "RNA_define.h"
@@ -30,6 +31,7 @@
#include "rna_internal.h"
#include "DNA_customdata_types.h"
+#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_object_types.h"
#include "DNA_property_types.h"
@@ -175,7 +177,7 @@ static void rna_Object_active_material_index_range(PointerRNA *ptr, int *min, in
static PointerRNA rna_Object_active_material_get(PointerRNA *ptr)
{
Object *ob= (Object*)ptr->id.data;
- return rna_pointer_inherit_refine(ptr, &RNA_Material, give_current_material(ob, ob->actcol));
+ return rna_pointer_inherit_refine(ptr, &RNA_MaterialSlot, ob->mat+ob->actcol);
}
#if 0
@@ -187,20 +189,68 @@ static void rna_Object_active_material_set(PointerRNA *ptr, PointerRNA value)
}
#endif
-static int rna_Object_active_material_link_get(PointerRNA *ptr)
+static PointerRNA rna_MaterialSlot_material_get(PointerRNA *ptr)
{
Object *ob= (Object*)ptr->id.data;
- return (ob->colbits & 1<<(ob->actcol)) != 0;
+ Material *ma;
+ int index= (Material**)ptr->data - ob->mat;
+
+ ma= give_current_material(ob, index+1);
+ return rna_pointer_inherit_refine(ptr, &RNA_Material, ma);
}
-static void rna_Object_active_material_link_set(PointerRNA *ptr, int value)
+static void rna_MaterialSlot_material_set(PointerRNA *ptr, PointerRNA value)
{
Object *ob= (Object*)ptr->id.data;
+ int index= (Material**)ptr->data - ob->mat;
+
+ assign_material(ob, value.data, index+1);
+}
+
+static int rna_MaterialSlot_link_get(PointerRNA *ptr)
+{
+ Object *ob= (Object*)ptr->id.data;
+ int index= (Material**)ptr->data - ob->mat;
+
+ return (ob->colbits & (1<<index)) != 0;
+}
+
+static void rna_MaterialSlot_link_set(PointerRNA *ptr, int value)
+{
+ Object *ob= (Object*)ptr->id.data;
+ int index= (Material**)ptr->data - ob->mat;
if(value)
- ob->colbits |= (1<<(ob->actcol));
+ ob->colbits |= (1<<index);
else
- ob->colbits &= ~(1<<(ob->actcol));
+ ob->colbits &= ~(1<<index);
+}
+
+static int rna_MaterialSlot_name_length(PointerRNA *ptr)
+{
+ Object *ob= (Object*)ptr->id.data;
+ Material *ma;
+ int index= (Material**)ptr->data - ob->mat;
+
+ ma= give_current_material(ob, index+1);
+
+ if(ma)
+ return strlen(ma->id.name+2) + 10;
+
+ return 10;
+}
+
+static void rna_MaterialSlot_name_get(PointerRNA *ptr, char *str)
+{
+ Object *ob= (Object*)ptr->id.data;
+ Material *ma;
+ int index= (Material**)ptr->data - ob->mat;
+
+ sprintf(str, "%d: ", index+1);
+
+ ma= give_current_material(ob, index+1);
+ if(ma)
+ strcat(str, ma->id.name+2);
}
static PointerRNA rna_Object_active_particle_system_get(PointerRNA *ptr)
@@ -263,6 +313,7 @@ static void rna_def_vertex_group(BlenderRNA *brna)
srna= RNA_def_struct(brna, "VertexGroup", NULL);
RNA_def_struct_sdna(srna, "bDeformGroup");
RNA_def_struct_ui_text(srna, "Vertex Group", "Group of vertices, used for armature deform and other purposes.");
+ RNA_def_struct_ui_icon(srna, ICON_GROUP_VERTEX);
prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_ui_text(prop, "Name", "Vertex group name.");
@@ -274,6 +325,42 @@ static void rna_def_vertex_group(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Index", "Index number of the vertex group.");
}
+static void rna_def_material_slot(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static EnumPropertyItem link_items[] = {
+ {0, "DATA", "Data", ""},
+ {1, "OBJECT", "Object", ""},
+ {0, NULL, NULL, NULL}};
+
+ /* NOTE: there is no MaterialSlot equivalent in DNA, so the internal
+ * pointer data points to ob->mat + index, and we manually implement
+ * get/set for the properties. */
+
+ srna= RNA_def_struct(brna, "MaterialSlot", NULL);
+ RNA_def_struct_ui_text(srna, "Material Slot", "Material slot in an object.");
+ RNA_def_struct_ui_icon(srna, ICON_MATERIAL_DATA);
+
+ prop= RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Material");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_pointer_funcs(prop, "rna_MaterialSlot_material_get", "rna_MaterialSlot_material_set");
+ RNA_def_property_ui_text(prop, "Material", "Material datablock used by this material slot.");
+
+ prop= RNA_def_property(srna, "link", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, link_items);
+ RNA_def_property_enum_funcs(prop, "rna_MaterialSlot_link_get", "rna_MaterialSlot_link_set", NULL);
+ RNA_def_property_ui_text(prop, "Link", "Link material to object or the object's data.");
+
+ prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop, "rna_MaterialSlot_name_get", "rna_MaterialSlot_name_length", NULL);
+ RNA_def_property_ui_text(prop, "Name", "Material slot name.");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_struct_name_property(srna, prop);
+}
+
static void rna_def_object_game_settings(BlenderRNA *brna)
{
StructRNA *srna;
@@ -301,6 +388,7 @@ static void rna_def_object_game_settings(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "Object");
RNA_def_struct_nested(brna, srna, "Object");
RNA_def_struct_ui_text(srna, "Game Object Settings", "Game engine related settings for the object.");
+ RNA_def_struct_ui_icon(srna, ICON_GAME);
/* logic */
@@ -506,11 +594,6 @@ static StructRNA *rna_def_object(BlenderRNA *brna)
{OB_BOUND_POLYH, "POLYHEDER", "Polyheder", ""},
{0, NULL, NULL, NULL}};
- static EnumPropertyItem material_link_items[] = {
- {0, "DATA", "Data", ""},
- {1, "OBJECT", "Object", ""},
- {0, NULL, NULL, NULL}};
-
static EnumPropertyItem dupli_items[] = {
{0, "NONE", "None", ""},
{OB_DUPLIFRAMES, "FRAMES", "Frames", "Make copy of object for every frame."},
@@ -522,6 +605,7 @@ static StructRNA *rna_def_object(BlenderRNA *brna)
srna= RNA_def_struct(brna, "Object", "ID");
RNA_def_struct_ui_text(srna, "Object", "Object datablock defining an object in a scene..");
RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
+ RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA);
prop= RNA_def_property(srna, "data", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "ID");
@@ -587,26 +671,21 @@ static StructRNA *rna_def_object(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Proxy Group", "Library group duplicator object this proxy object controls.");
/* materials */
-
prop= RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
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_struct_type(prop, "MaterialSlot");
+ RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_iterator_array_get", 0, 0, 0); /* don't dereference pointer! */
+ RNA_def_property_ui_text(prop, "Materials", "Material slots in the object.");
prop= RNA_def_property(srna, "active_material", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Material");
+ RNA_def_property_struct_type(prop, "MaterialSlot");
RNA_def_property_pointer_funcs(prop, "rna_Object_active_material_get", NULL);
RNA_def_property_ui_text(prop, "Active Material", "Active material being displayed.");
prop= RNA_def_property(srna, "active_material_index", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "actcol");
RNA_def_property_int_funcs(prop, NULL, NULL, "rna_Object_active_material_index_range");
- RNA_def_property_ui_text(prop, "Active Material Index", "Index of active material.");
-
- prop= RNA_def_property(srna, "active_material_link", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, material_link_items);
- RNA_def_property_enum_funcs(prop, "rna_Object_active_material_link_get", "rna_Object_active_material_link_set", NULL);
- RNA_def_property_ui_text(prop, "Active Material Link", "Use material from object or data for the active material.");
+ RNA_def_property_ui_text(prop, "Active Material Index", "Index of active material slot.");
/* transform */
@@ -968,6 +1047,7 @@ void RNA_def_object(BlenderRNA *brna)
rna_def_object(brna);
rna_def_object_game_settings(brna);
rna_def_vertex_group(brna);
+ rna_def_material_slot(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c
index 22521528d68..c3e1931c439 100644
--- a/source/blender/makesrna/intern/rna_object_force.c
+++ b/source/blender/makesrna/intern/rna_object_force.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
- * Contributor(s): Blender Foundation (2008).
+ * Contributor(s): Blender Foundation (2008), Thomas Dinges
*
* ***** END GPL LICENSE BLOCK *****
*/
@@ -39,27 +39,237 @@
static void rna_def_pointcache(BlenderRNA *brna)
{
StructRNA *srna;
+ PropertyRNA *prop;
srna= RNA_def_struct(brna, "PointCache", NULL);
RNA_def_struct_ui_text(srna, "Point Cache", "Point cache for physics simulations.");
+
+ prop= RNA_def_property(srna, "start_frame", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "startframe");
+ RNA_def_property_range(prop, 1, 300000);
+ RNA_def_property_ui_text(prop, "Start", "Frame on which the simulation starts.");
+
+ prop= RNA_def_property(srna, "end_frame", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "endframe");
+ RNA_def_property_range(prop, 1, 300000);
+ RNA_def_property_ui_text(prop, "End", "Frame on which the simulation stops.");
+
+ /* flags */
+ prop= RNA_def_property(srna, "baked", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_BAKED);
+
+ prop= RNA_def_property(srna, "baking", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_BAKING);
}
static void rna_def_collision(BlenderRNA *brna)
{
StructRNA *srna;
+ PropertyRNA *prop;
srna= RNA_def_struct(brna, "CollisionSettings", NULL);
RNA_def_struct_sdna(srna, "PartDeflect");
RNA_def_struct_ui_text(srna, "Collision Settings", "Collision settings for object in physics simulation.");
+
+ prop= RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "deflect", 1);
+ RNA_def_property_ui_text(prop, "Enabled", "Enable this objects as a collider for physics systems");
+
+ /* Particle Interaction */
+
+ prop= RNA_def_property(srna, "damping_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "pdef_damp");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Damping Factor", "Amount of damping during particle collision");
+
+ prop= RNA_def_property(srna, "random_damping", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "pdef_rdamp");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Random Damping", "Random variation of damping");
+
+ prop= RNA_def_property(srna, "friction_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "pdef_frict");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Friction Factor", "Amount of friction during particle collision");
+
+ prop= RNA_def_property(srna, "random_friction", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "pdef_rfrict");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Random Friction", "Random variation of friction");
+
+ prop= RNA_def_property(srna, "permeability", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "pdef_perm");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Permeability", "Chance that the particle will pass through the mesh");
+
+ prop= RNA_def_property(srna, "kill_particles", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PDEFLE_KILL_PART);
+ RNA_def_property_ui_text(prop, "Kill Particles", "Kill collided particles");
+
+ /* Soft Body and Cloth Interaction */
+
+ prop= RNA_def_property(srna, "inner_thickness", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "pdef_sbift");
+ RNA_def_property_range(prop, 0.001f, 1.0f);
+ RNA_def_property_ui_text(prop, "Inner Thickness", "Inner face thickness");
+
+ prop= RNA_def_property(srna, "outer_thickness", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "pdef_sboft");
+ RNA_def_property_range(prop, 0.001f, 1.0f);
+ RNA_def_property_ui_text(prop, "Outer Thickness", "Outer face thickness");
+
+ prop= RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "pdef_sbdamp");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Damping", "Amount of damping during collision");
+
+ /* Does this belong here?
+ prop= RNA_def_property(srna, "collision_stack", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "softflag", OB_SB_COLLFINAL);
+ RNA_def_property_ui_text(prop, "Collision from Stack", "Pick collision object from modifier stack (softbody only)");
+ */
}
static void rna_def_field(BlenderRNA *brna)
{
StructRNA *srna;
+ PropertyRNA *prop;
+
+ static EnumPropertyItem field_type_items[] = {
+ {0, "NONE", "None", ""},
+ {PFIELD_FORCE, "SPHERICAL", "Spherical", ""},
+ {PFIELD_VORTEX, "VORTEX", "Vortex", ""},
+ {PFIELD_MAGNET, "MAGNET", "Magnetic", ""},
+ {PFIELD_WIND, "WIND", "Wind", ""},
+ {PFIELD_GUIDE, "GUIDE", "Curve Guide", ""},
+ {PFIELD_TEXTURE, "TEXTURE", "Texture", ""},
+ {PFIELD_HARMONIC, "HARMONIC", "Harmonic", ""},
+ {PFIELD_CHARGE, "CHARGE", "Charge", ""},
+ {PFIELD_LENNARDJ, "LENNARDJ", "Lennard-Jones", ""},
+ {0, NULL, NULL, NULL}};
+
+ static EnumPropertyItem falloff_items[] = {
+ {PFIELD_FALL_SPHERE, "SPHERE", "Sphere", ""},
+ {PFIELD_FALL_TUBE, "TUBE", "Tube", ""},
+ {PFIELD_FALL_CONE, "CONE", "Cone", ""},
+ {0, NULL, NULL, NULL}};
+
+ static EnumPropertyItem texture_items[] = {
+ {PFIELD_TEX_RGB, "RGB", "RGB", ""},
+ {PFIELD_TEX_GRAD, "GRADIENT", "Gradient", ""},
+ {PFIELD_TEX_CURL, "CURL", "Curl", ""},
+ {0, NULL, NULL, NULL}};
srna= RNA_def_struct(brna, "FieldSettings", NULL);
RNA_def_struct_sdna(srna, "PartDeflect");
RNA_def_struct_ui_text(srna, "Field Settings", "Field settings for an object in physics simulation.");
+
+ /* Enums */
+
+ prop= RNA_def_property(srna, "field_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "forcefield");
+ RNA_def_property_enum_items(prop, field_type_items);
+ RNA_def_property_ui_text(prop, "Field Type", "Choose Field Type");
+
+ prop= RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "falloff");
+ RNA_def_property_enum_items(prop, falloff_items);
+ RNA_def_property_ui_text(prop, "Fall-Off", "Fall-Off Shape");
+
+ prop= RNA_def_property(srna, "texture_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "tex_mode");
+ RNA_def_property_enum_items(prop, texture_items);
+ RNA_def_property_ui_text(prop, "Texture Mode", "How the texture effect is calculated (RGB & Curl need a RGB texture else Gradient will be used instead)");
+
+ /* Float */
+
+ prop= RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "f_strength");
+ RNA_def_property_range(prop, -1000.0f, 1000.0f);
+ RNA_def_property_ui_text(prop, "Strength", "Strength of force field");
+
+ prop= RNA_def_property(srna, "falloff_power", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "f_power");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_text(prop, "Falloff Power", "Falloff power (real gravitational falloff = 2)");
+
+ prop= RNA_def_property(srna, "harmonic_damping", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "f_damp");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_text(prop, "Harmonic Damping", "Damping of the harmonic force");
+
+ prop= RNA_def_property(srna, "minimum_distance", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "mindist");
+ RNA_def_property_range(prop, 0.0f, 1000.0f);
+ RNA_def_property_ui_text(prop, "Minimum Distance", "Minimum distance for the field's fall-off");
+
+ prop= RNA_def_property(srna, "maximum_distance", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "maxdist");
+ RNA_def_property_range(prop, 0.0f, 1000.0f);
+ RNA_def_property_ui_text(prop, "Maximum Distance", "Maximum distance for the field to work");
+
+ prop= RNA_def_property(srna, "radial_minimum", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "minrad");
+ RNA_def_property_range(prop, 0.0f, 1000.0f);
+ RNA_def_property_ui_text(prop, "Minimum Radial Distance", "Minimum radial distance for the field's fall-off");
+
+ prop= RNA_def_property(srna, "radial_maximum", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "maxrad");
+ RNA_def_property_range(prop, 0.0f, 1000.0f);
+ RNA_def_property_ui_text(prop, "Maximum Radial Distance", "Maximum radial distance for the field to work");
+
+ prop= RNA_def_property(srna, "radial_falloff", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "f_power_r");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_text(prop, "Radial Falloff Power", "Radial falloff power (real gravitational falloff = 2)");
+
+ /* Boolean */
+
+ prop= RNA_def_property(srna, "use_min_distance", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMIN);
+ RNA_def_property_ui_text(prop, "Use Min", "Use a minimum distance for the field's fall-off");
+
+ prop= RNA_def_property(srna, "use_max_distance", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMAX);
+ RNA_def_property_ui_text(prop, "Use Max", "Use a maximum distance for the field to work");
+
+ prop= RNA_def_property(srna, "use_radial_min", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMINR);
+ RNA_def_property_ui_text(prop, "Use Min", "Use a minimum radial distance for the field's fall-off");
+ // "Use a minimum angle for the field's fall-off"
+
+ prop= RNA_def_property(srna, "use_radial_max", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMAXR);
+ RNA_def_property_ui_text(prop, "Use Max", "Use a maximum radial distance for the field to work");
+ // "Use a maximum angle for the field to work"
+
+ prop= RNA_def_property(srna, "guide_path_add", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_GUIDE_PATH_ADD);
+ RNA_def_property_ui_text(prop, "Additive", "Based on distance/falloff it adds a portion of the entire path");
+
+ prop= RNA_def_property(srna, "planar", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_PLANAR);
+ RNA_def_property_ui_text(prop, "Planar", "Create planar field");
+
+ prop= RNA_def_property(srna, "surface", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_SURFACE);
+ RNA_def_property_ui_text(prop, "Surface", "Use closest point on surface");
+
+ prop= RNA_def_property(srna, "positive_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_POSZ);
+ RNA_def_property_ui_text(prop, "Positive", "Effect only in direction of positive Z axis");
+
+ prop= RNA_def_property(srna, "use_coordinates", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_TEX_OBJECT);
+ RNA_def_property_ui_text(prop, "Use Coordinates", "Use object/global coordinates for texture");
+
+ prop= RNA_def_property(srna, "force_2d", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_TEX_2D);
+ RNA_def_property_ui_text(prop, "2D", "Apply force only in 2d");
+
+ prop= RNA_def_property(srna, "root_coords", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_TEX_ROOTCO);
+ RNA_def_property_ui_text(prop, "Root Texture Coordinates", "Texture coordinates from root particle locations");
}
static void rna_def_game_softbody(BlenderRNA *brna)
@@ -90,4 +300,3 @@ void RNA_def_object_force(BlenderRNA *brna)
}
#endif
-
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index 36a1992670a..7c4f4eba27f 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -22,6 +22,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
+#include <stdio.h>
#include <stdlib.h>
#include "limits.h"
@@ -33,9 +34,60 @@
#include "DNA_particle_types.h"
#include "DNA_object_force.h"
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
+
+#include "WM_types.h"
#ifdef RNA_RUNTIME
+#include "BKE_context.h"
+#include "BKE_depsgraph.h"
+#include "BKE_particle.h"
+
+static void rna_Particle_redo(bContext *C, PointerRNA *ptr)
+{
+ ParticleSettings *part;
+ if(ptr->type==&RNA_ParticleSystem)
+ part = ((ParticleSystem*)ptr->data)->part;
+ else
+ part = ptr->id.data;
+
+ psys_flush_particle_settings(CTX_data_scene(C), part, PSYS_RECALC_REDO);
+}
+
+static void rna_Particle_reset(bContext *C, PointerRNA *ptr)
+{
+ ParticleSettings *part;
+ if(ptr->type==&RNA_ParticleSystem)
+ part = ((ParticleSystem*)ptr->data)->part;
+ else
+ part = ptr->id.data;
+
+ psys_flush_particle_settings(CTX_data_scene(C), part, PSYS_RECALC_RESET|PSYS_RECALC_REDO);
+}
+
+static void rna_Particle_change_type(bContext *C, PointerRNA *ptr)
+{
+ ParticleSettings *part;
+ if(ptr->type==&RNA_ParticleSystem)
+ part = ((ParticleSystem*)ptr->data)->part;
+ else
+ part = ptr->id.data;
+
+ psys_flush_particle_settings(CTX_data_scene(C), part, PSYS_RECALC_RESET|PSYS_RECALC_TYPE|PSYS_RECALC_REDO);
+}
+
+static void rna_Particle_redo_child(bContext *C, PointerRNA *ptr)
+{
+ ParticleSettings *part;
+ if(ptr->type==&RNA_ParticleSystem)
+ part = ((ParticleSystem*)ptr->data)->part;
+ else
+ part = ptr->id.data;
+
+ psys_flush_particle_settings(CTX_data_scene(C), part, PSYS_RECALC_CHILD);
+}
static void rna_PartSettings_start_set(struct PointerRNA *ptr, float value)
{
ParticleSettings *settings = (ParticleSettings*)ptr->data;
@@ -86,6 +138,111 @@ static float rna_PartSetting_linelenhead_get(struct PointerRNA *ptr)
ParticleSettings *settings = (ParticleSettings*)ptr->data;
return settings->draw_line[1];
}
+
+static int rna_ParticleSystem_name_length(PointerRNA *ptr)
+{
+ ParticleSystem *psys= ptr->data;
+
+ if(psys->part)
+ return strlen(psys->part->id.name+2) + 10;
+
+ return 10;
+}
+
+static void rna_ParticleSystem_name_get(PointerRNA *ptr, char *str)
+{
+ Object *ob= ptr->id.data;
+ ParticleSystem *psys= ptr->data;
+ int index= BLI_findindex(&ob->particlesystem, psys);
+
+ sprintf(str, "%d: ", index+1);
+
+ if(psys->part)
+ strcat(str, psys->part->id.name+2);
+}
+
+static EnumPropertyItem from_items[] = {
+ {PART_FROM_VERT, "VERT", "Vertexes", ""},
+ {PART_FROM_FACE, "FACE", "Faces", ""},
+ {PART_FROM_VOLUME, "VOLUME", "Volume", ""},
+ {0, NULL, NULL, NULL}
+};
+
+static EnumPropertyItem reactor_from_items[] = {
+ {PART_FROM_VERT, "VERT", "Vertexes", ""},
+ {PART_FROM_FACE, "FACE", "Faces", ""},
+ {PART_FROM_VOLUME, "VOLUME", "Volume", ""},
+ {PART_FROM_PARTICLE, "PARTICLE", "Particle", ""},
+ {0, NULL, NULL, NULL}
+};
+
+static EnumPropertyItem *rna_Particle_from_itemf(PointerRNA *ptr)
+{
+ ParticleSettings *part = ptr->id.data;
+
+ if(part->type==PART_REACTOR)
+ return reactor_from_items;
+ else
+ return from_items;
+}
+
+static EnumPropertyItem draw_as_items[] = {
+ {PART_DRAW_NOT, "NONE", "None", ""},
+ {PART_DRAW_REND, "RENDER", "Rendered", ""},
+ {PART_DRAW_DOT, "DOT", "Point", ""},
+ {PART_DRAW_CIRC, "CIRC", "Circle", ""},
+ {PART_DRAW_CROSS, "CROSS", "Cross", ""},
+ {PART_DRAW_AXIS, "AXIS", "Axis", ""},
+ {0, NULL, NULL, NULL}
+};
+
+static EnumPropertyItem hair_draw_as_items[] = {
+ {PART_DRAW_NOT, "NONE", "None", ""},
+ {PART_DRAW_REND, "RENDER", "Rendered", ""},
+ {PART_DRAW_PATH, "PATH", "Path", ""},
+ {0, NULL, NULL, NULL}
+};
+
+static EnumPropertyItem ren_as_items[] = {
+ {PART_DRAW_NOT, "NONE", "None", ""},
+ {PART_DRAW_HALO, "HALO", "Halo", ""},
+ {PART_DRAW_LINE, "LINE", "Line", ""},
+ {PART_DRAW_PATH, "PATH", "Path", ""},
+ {PART_DRAW_OB, "OBJECT", "Object", ""},
+ {PART_DRAW_GR, "GROUP", "Group", ""},
+ {PART_DRAW_BB, "BILLBOARD", "Billboard", ""},
+ {0, NULL, NULL, NULL}
+};
+
+static EnumPropertyItem hair_ren_as_items[] = {
+ {PART_DRAW_NOT, "NONE", "None", ""},
+ {PART_DRAW_PATH, "PATH", "Path", ""},
+ {PART_DRAW_OB, "OBJECT", "Object", ""},
+ {PART_DRAW_GR, "GROUP", "Group", ""},
+ {0, NULL, NULL, NULL}
+};
+
+static EnumPropertyItem *rna_Particle_draw_as_itemf(PointerRNA *ptr)
+{
+ ParticleSettings *part = ptr->id.data;
+
+ if(part->type==PART_HAIR)
+ return hair_draw_as_items;
+ else
+ return draw_as_items;
+}
+
+static EnumPropertyItem *rna_Particle_ren_as_itemf(PointerRNA *ptr)
+{
+ ParticleSettings *part = ptr->id.data;
+
+ if(part->type==PART_HAIR)
+ return hair_ren_as_items;
+ else
+ return ren_as_items;
+}
+
+
#else
static void rna_def_particle_hair_key(BlenderRNA *brna)
@@ -301,16 +458,6 @@ static void rna_def_particle_settings(BlenderRNA *brna)
{PART_EMITTER, "EMITTER", "Emitter", ""},
{PART_REACTOR, "REACTOR", "Reactor", ""},
{PART_HAIR, "HAIR", "Hair", ""},
- {PART_FLUID, "FLUID", "Fluid", ""},
- {0, NULL, NULL, NULL}
- };
-
- static EnumPropertyItem from_items[] = {
- {PART_FROM_VERT, "VERT", "Vertexes", ""},
- {PART_FROM_FACE, "FACE", "Faces", ""},
- {PART_FROM_VOLUME, "VOLUME", "Volume", ""},
- {PART_FROM_PARTICLE, "PARTICLE", "Particle", ""},
- {PART_FROM_CHILD, "CHILD", "Child", ""},
{0, NULL, NULL, NULL}
};
@@ -322,7 +469,7 @@ static void rna_def_particle_settings(BlenderRNA *brna)
};
static EnumPropertyItem phys_type_items[] = {
- {PART_PHYS_NO, "NO", "no", ""},
+ {PART_PHYS_NO, "NO", "No", ""},
{PART_PHYS_NEWTON, "NEWTON", "Newtonian", ""},
{PART_PHYS_KEYED, "KEYED", "Keyed", ""},
{PART_PHYS_BOIDS, "BOIDS", "Boids", ""},
@@ -356,20 +503,6 @@ static void rna_def_particle_settings(BlenderRNA *brna)
{0, NULL, NULL, NULL}
};
- static EnumPropertyItem draw_as_items[] = {
- {PART_DRAW_NOT, "NONE", "None", ""},
- {PART_DRAW_DOT, "DOT", "Point", ""},
- {PART_DRAW_CIRC, "CIRC", "Circle", ""},
- {PART_DRAW_CROSS, "CROSS", "Cross", ""},
- {PART_DRAW_AXIS, "AXIS", "Axis", ""},
- {PART_DRAW_LINE, "LINE", "Line", ""},
- {PART_DRAW_PATH, "PATH", "Path", ""},
- {PART_DRAW_OB, "OBJECT", "Object", ""},
- {PART_DRAW_GR, "GROUP", "Group", ""},
- {PART_DRAW_BB, "BILLBOARD", "Billboard", ""},
- {0, NULL, NULL, NULL}
- };
-
static EnumPropertyItem child_type_items[] = {
{0, "NONE", "None", ""},
{PART_CHILD_PARTICLES, "PARTICLES", "Particles", ""},
@@ -435,20 +568,25 @@ static void rna_def_particle_settings(BlenderRNA *brna)
srna= RNA_def_struct(brna, "ParticleSettings", "ID");
RNA_def_struct_ui_text(srna, "Particle Settings", "Particle settings, reusable by multiple particle systems.");
+ RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA);
/* flag */
prop= RNA_def_property(srna, "react_start_end", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_REACT_STA_END);
RNA_def_property_ui_text(prop, "Start/End", "Give birth to unreacted particles eventually.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "react_multiple", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_REACT_MULTIPLE);
RNA_def_property_ui_text(prop, "Multi React", "React multiple times.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "loop", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_LOOP);
RNA_def_property_ui_text(prop, "Loop", "Loop particle lives.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
+ /* TODO: used somewhere? */
prop= RNA_def_property(srna, "hair_geometry", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_HAIR_GEOMETRY);
RNA_def_property_ui_text(prop, "Hair Geometry", "");//TODO: tooltip
@@ -456,83 +594,104 @@ static void rna_def_particle_settings(BlenderRNA *brna)
prop= RNA_def_property(srna, "unborn", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_UNBORN);
RNA_def_property_ui_text(prop, "Unborn", "Show particles before they are emitted.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "died", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_DIED);
RNA_def_property_ui_text(prop, "Died", "Show particles after they have died");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "trand", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_TRAND);
RNA_def_property_ui_text(prop, "Random", "Emit in random order of elements");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "even_distribution", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_EDISTR);
RNA_def_property_ui_text(prop, "Even Distribution", "Use even distribution from faces based on face areas or edge lengths.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "sticky", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_STICKY);
RNA_def_property_ui_text(prop, "Sticky", "Particles stick to collided objects if they die in the collision.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "die_on_collision", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_DIE_ON_COL);
RNA_def_property_ui_text(prop, "Die on hit", "Particles die when they collide with a deflector object.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "size_deflect", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SIZE_DEFL);
RNA_def_property_ui_text(prop, "Size Deflect", "Use particle's size in deflection.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "rotation_dynamic", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_ROT_DYN);
RNA_def_property_ui_text(prop, "Dynamic", "Sets rotation to dynamic/constant");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "sizemass", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SIZEMASS);
RNA_def_property_ui_text(prop, "Mass from Size", "Multiply mass with particle size.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "abs_length", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_ABS_LENGTH);
RNA_def_property_ui_text(prop, "Abs Length", "Use maximum length for children");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "absolute_time", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_ABS_TIME);
RNA_def_property_ui_text(prop, "Absolute Time", "Set all ipos that work on particles to be calculated in absolute/relative time.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "global_time", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_GLOB_TIME);
RNA_def_property_ui_text(prop, "Global Time", "Set all ipos that work on particles to be calculated in global/object time.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "boids_2d", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_BOIDS_2D);
RNA_def_property_ui_text(prop, "Boids 2D", "Constrain boids to a surface");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "branching", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_BRANCHING);
RNA_def_property_ui_text(prop, "Branching", "Branch child paths from each other.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
prop= RNA_def_property(srna, "animate_branching", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_ANIM_BRANCHING);
RNA_def_property_ui_text(prop, "Animated", "Animate branching");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
prop= RNA_def_property(srna, "symmetric_branching", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SYMM_BRANCHING);
RNA_def_property_ui_text(prop, "Symmetric", "Start and end points are the same.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
prop= RNA_def_property(srna, "hair_bspline", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_HAIR_BSPLINE);
RNA_def_property_ui_text(prop, "B-Spline", "Interpolate hair using B-Splines.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "grid_invert", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_GRID_INVERT);
RNA_def_property_ui_text(prop, "Invert", "Invert what is considered object and what is not.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "child_effector", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_EFFECT);
RNA_def_property_ui_text(prop, "Children", "Apply effectors to children.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "child_seams", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_SEAMS);
RNA_def_property_ui_text(prop, "Use seams", "Use seams to determine parents");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
+ /* TODO: used somewhere? */
prop= RNA_def_property(srna, "child_render", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_RENDER);
RNA_def_property_ui_text(prop, "child_render", "");
@@ -540,129 +699,164 @@ static void rna_def_particle_settings(BlenderRNA *brna)
prop= RNA_def_property(srna, "child_guide", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_GUIDE);
RNA_def_property_ui_text(prop, "child_guide", "");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "self_effect", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SELF_EFFECT);
RNA_def_property_ui_text(prop, "Self Effect", "Particle effectors effect themselves.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, type_items);
RNA_def_property_ui_text(prop, "Type", "");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_change_type");
prop= RNA_def_property(srna, "emit_from", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "from");
- RNA_def_property_enum_items(prop, from_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_from_itemf");
RNA_def_property_ui_text(prop, "Emit From", "Where to emit particles from");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "distr");
RNA_def_property_enum_items(prop, dist_items);
RNA_def_property_ui_text(prop, "Distribution", "How to distribute particles on selected element");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
/* physics modes */
prop= RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "phystype");
RNA_def_property_enum_items(prop, phys_type_items);
RNA_def_property_ui_text(prop, "Physics Type", "Particle physics type");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "rotmode");
RNA_def_property_enum_items(prop, rot_mode_items);
RNA_def_property_ui_text(prop, "Rotation", "Particles initial rotation");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "angular_velocity_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "avemode");
RNA_def_property_enum_items(prop, ave_mode_items);
RNA_def_property_ui_text(prop, "Angular Velocity Mode", "Particle angular velocity mode.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "react_event", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "reactevent");
RNA_def_property_enum_items(prop, react_event_items);
RNA_def_property_ui_text(prop, "React On", "The event of target particles to react on.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
/*draw flag*/
prop= RNA_def_property(srna, "velocity", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_VEL);
RNA_def_property_ui_text(prop, "Velocity", "Show particle velocity");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
- /* used?
- prop= RNA_def_property(srna, "angle", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_ANG);
- RNA_def_property_ui_text(prop, "Angle", "");
- */
+ //prop= RNA_def_property(srna, "draw_path_length", PROP_BOOLEAN, PROP_NONE);
+ //RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_PATH_LEN);
+ //RNA_def_property_ui_text(prop, "Path length", "Draw path length");
+ //RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "show_size", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_SIZE);
RNA_def_property_ui_text(prop, "Size", "Show particle size");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "emitter", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_EMITTER);
RNA_def_property_ui_text(prop, "Emitter", "Render emitter Object also.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
- /* used?
- prop= RNA_def_property(srna, "adapt", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_ADAPT);
- RNA_def_property_ui_text(prop, "adapt", "");
+ //prop= RNA_def_property(srna, "draw_health", PROP_BOOLEAN, PROP_NONE);
+ //RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_HEALTH);
+ //RNA_def_property_ui_text(prop, "Health", "Draw boid health");
+ //RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
- prop= RNA_def_property(srna, "cos", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_COS);
- RNA_def_property_ui_text(prop, "cos", "");
- */
+ //prop= RNA_def_property(srna, "timed_path", PROP_BOOLEAN, PROP_NONE);
+ //RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_TIMED_PATH);
+ //RNA_def_property_ui_text(prop, "Clip with time", "Clip path based on time");
+ //RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
+
+ //prop= RNA_def_property(srna, "draw_cached_path", PROP_BOOLEAN, PROP_NONE);
+ //RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_CACHED_PATH);
+ //RNA_def_property_ui_text(prop, "Path", "Draw particle path if the path is baked");
+ //RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "billboard_lock", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_BB_LOCK);
RNA_def_property_ui_text(prop, "Lock Billboard", "Lock the billboards align axis");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "parent", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_PARENT);
RNA_def_property_ui_text(prop, "Parents", "Render parent particles.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "num", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_NUM);
RNA_def_property_ui_text(prop, "Number", "Show particle number");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "rand_group", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_RAND_GR);
RNA_def_property_ui_text(prop, "Pick Random", "Pick objects from group randomly");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "render_adaptive", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_REN_ADAPT);
RNA_def_property_ui_text(prop, "Adaptive render", "Draw steps of the particle path");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "velocity_length", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_VEL_LENGTH);
RNA_def_property_ui_text(prop, "Speed", "Multiply line length by particle speed");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "material_color", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_MAT_COL);
RNA_def_property_ui_text(prop, "Material Color", "Draw particles using material's diffuse color.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "whole_group", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_WHOLE_GR);
- RNA_def_property_ui_text(prop, "Dupli Group", "Use whole group at once.");
+ RNA_def_property_ui_text(prop, "Whole Group", "Use whole group at once.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "render_strand", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_REN_STRAND);
RNA_def_property_ui_text(prop, "Strand render", "Use the strand primitive for rendering");
-
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "draw_as", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, draw_as_items);
- RNA_def_property_ui_text(prop, "Particle Visualization", "How particles are visualized");
+ RNA_def_property_enum_sdna(prop, NULL, "draw_as");
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_draw_as_itemf");
+ RNA_def_property_ui_text(prop, "Particle Drawing", "How particles are drawn in viewport");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
+
+ prop= RNA_def_property(srna, "ren_as", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "ren_as");
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_ren_as_itemf");
+ RNA_def_property_ui_text(prop, "Particle Rendering", "How particles are rendered");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "draw_size", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 0, 10);
RNA_def_property_ui_text(prop, "Draw Size", "Size of particles on viewport in pixels (0=default)");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "child_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "childtype");
RNA_def_property_enum_items(prop, child_type_items);
RNA_def_property_ui_text(prop, "Children From", "Create child particles");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "draw_step", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 0, 7);
RNA_def_property_ui_text(prop, "Steps", "How many steps paths are drawn with (power of 2)");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "render_step", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "ren_step");
@@ -671,7 +865,9 @@ static void rna_def_particle_settings(BlenderRNA *brna)
prop= RNA_def_property(srna, "hair_step", PROP_INT, PROP_NONE);
RNA_def_property_range(prop, 2, 50);
- RNA_def_property_ui_text(prop, "Segments", "Amount of hair segments");
+ RNA_def_property_ui_text(prop, "Segments", "Number of hair segments");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
+
//TODO: not found in UI, readonly?
prop= RNA_def_property(srna, "keys_step", PROP_INT, PROP_NONE);
@@ -693,11 +889,13 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "disp");
RNA_def_property_range(prop, 0, 100);
RNA_def_property_ui_text(prop, "Display", "Percentage of particles to display in 3d view");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "material", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "omat");
RNA_def_property_range(prop, 1, 16);
RNA_def_property_ui_text(prop, "Material", "Specify material used for the particles");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
//interpolation
@@ -712,14 +910,17 @@ static void rna_def_particle_settings(BlenderRNA *brna)
prop= RNA_def_property(srna, "integrator", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, integrator_type_items);
RNA_def_property_ui_text(prop, "Integration", "Select physics integrator type");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "kink", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, kink_type_items);
RNA_def_property_ui_text(prop, "Kink", "Type of periodic offset on the path");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
prop= RNA_def_property(srna, "kink_axis", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, kink_axis_items);
RNA_def_property_ui_text(prop, "Axis", "Which axis to use for offset");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
/* used?
prop= RNA_def_property(srna, "inbetween", PROP_INT, PROP_NONE);
@@ -732,12 +933,14 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "boidneighbours");
RNA_def_property_range(prop, 1, 10);
RNA_def_property_ui_text(prop, "Neighbours", "How many neighbours to consider for each boid");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
/* billboards */
prop= RNA_def_property(srna, "billboard_align", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "bb_align");
RNA_def_property_enum_items(prop, bb_align_items);
RNA_def_property_ui_text(prop, "Align to", "In respect to what the billboards are aligned");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "billboard_uv_split", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "bb_uv_split");
@@ -758,17 +961,20 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "bb_tilt");
RNA_def_property_range(prop, -1.0f, 1.0f);
RNA_def_property_ui_text(prop, "Tilt", "Tilt of the billboards");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "billboard_random_tilt", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "bb_rand_tilt");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Random Tilt", "Random tilt of the billboards");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "billboard_offset", PROP_FLOAT, PROP_VECTOR);
RNA_def_property_float_sdna(prop, NULL, "bb_offset");
RNA_def_property_array(prop, 2);
RNA_def_property_range(prop, -1.0f, 1.0f);
RNA_def_property_ui_text(prop, "Billboard Offset", "");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
/* simplification */
prop= RNA_def_property(srna, "enable_simplify", PROP_BOOLEAN, PROP_NONE);
@@ -802,39 +1008,47 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_range(prop, -30000.0f, 30000.0f); //TODO: replace 30000 with MAXFRAMEF when available in 2.5
RNA_def_property_float_funcs(prop, NULL, "rna_PartSettings_start_set", NULL);
RNA_def_property_ui_text(prop, "Start", "Frame # to start emitting particles.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "end", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, -30000.0f, 30000.0f); //TODO: replace 30000 with MAXFRAMEF when available in 2.5
RNA_def_property_float_funcs(prop, NULL, "rna_PartSettings_end_set", NULL);
RNA_def_property_ui_text(prop, "End", "Frame # to stop emitting particles.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 1.0f, 30000.0f);
RNA_def_property_ui_text(prop, "Lifetime", "Specify the life span of the particles");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "random_lifetime", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "randlife");
- RNA_def_property_range(prop, 0.0f, 2.0f);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Random", "Give the particle life a random variation.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "time_tweak", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "timetweak");
RNA_def_property_range(prop, 0.0f, 10.0f);
RNA_def_property_ui_text(prop, "Tweak", "A multiplier for physics timestep (1.0 means one frame = 1/25 seconds)");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "jitter_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "jitfac");
RNA_def_property_range(prop, 0.0f, 2.0f);
RNA_def_property_ui_text(prop, "Amount", "Amount of jitter applied to the sampling.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "keyed_time", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Time", "Keyed key time relative to remaining particle life.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "effect_hair", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "eff_hair");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Stiffnes", "Hair stiffness for effectors");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
//float rt; TODO:find where rt is used - can't find it in UI
@@ -842,92 +1056,110 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_int_sdna(prop, NULL, "totpart");
RNA_def_property_range(prop, 0, 100000);
RNA_def_property_ui_text(prop, "Amount", "Total number of particles.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "userjit", PROP_INT, PROP_UNSIGNED);//TODO: can we get a better name for userjit?
RNA_def_property_int_sdna(prop, NULL, "userjit");
RNA_def_property_range(prop, 0, 1000);
RNA_def_property_ui_text(prop, "P/F", "Emission locations / face (0 = automatic).");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "grid_resolution", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "grid_res");
RNA_def_property_range(prop, 1, 100);
RNA_def_property_ui_text(prop, "Resolution", "The resolution of the particle grid.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
/* initial velocity factors */
prop= RNA_def_property(srna, "normal_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "normfac");//optional if prop names are the same
RNA_def_property_range(prop, -200.0f, 200.0f);
RNA_def_property_ui_text(prop, "Normal", "Let the surface normal give the particle a starting speed.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "object_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "obfac");
RNA_def_property_range(prop, -1.0f, 1.0f);
RNA_def_property_ui_text(prop, "Object", "Let the object give the particle a starting speed");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "random_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "randfac");//optional if prop names are the same
RNA_def_property_range(prop, 0.0f, 200.0f);
RNA_def_property_ui_text(prop, "Random", "Give the starting speed a random variation.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "particle_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "partfac");
RNA_def_property_range(prop, -10.0f, 10.0f);
RNA_def_property_ui_text(prop, "Particle", "Let the target particle give the particle a starting speed.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "tangent_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "tanfac");
RNA_def_property_range(prop, -200.0f, 200.0f);
RNA_def_property_ui_text(prop, "Tangent", "Let the surface tangent give the particle a starting speed.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "tangent_phase", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "tanphase");
RNA_def_property_range(prop, -1.0f, 1.0f);
RNA_def_property_ui_text(prop, "Rot", "Rotate the surface tangent.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "reactor_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "reactfac");
RNA_def_property_range(prop, -10.0f, 10.0f);
RNA_def_property_ui_text(prop, "Reactor", "Let the vector away from the target particles location give the particle a starting speed.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "angular_velocity_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "avefac");
RNA_def_property_range(prop, -200.0f, 200.0f);
RNA_def_property_ui_text(prop, "Angular Velocity", "Angular velocity amount");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "phase_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "phasefac");
RNA_def_property_range(prop, -1.0f, 1.0f);
RNA_def_property_ui_text(prop, "Phase", "Initial rotation phase");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "random_rotation_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "randrotfac");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Random Rotation", "Randomize rotation");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "random_phase_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "randphasefac");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Random Phase", "Randomize rotation phase");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
/* physical properties */
prop= RNA_def_property(srna, "mass", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.01f, 100.0f);
RNA_def_property_ui_text(prop, "Mass", "Specify the mass of the particles");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "particle_size", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "size");
RNA_def_property_range(prop, 0.01f, 100.0f);
RNA_def_property_ui_text(prop, "Size", "The size of the particles");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "random_size", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "randsize");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Random Size", "Give the particle size a random variation");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "reaction_shape", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "reactshape");
RNA_def_property_range(prop, 0.0f, 10.0f);
RNA_def_property_ui_text(prop, "Shape", "Power of reaction strength dependence on distance to target.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
/* global physical properties */
@@ -936,21 +1168,25 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_array(prop, 3);
RNA_def_property_range(prop, -200.0f, 200.0f);
RNA_def_property_ui_text(prop, "Accelaration", "Constant acceleration");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "drag_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "dragfac");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Drag", "Specify the amount of air-drag.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "brownian_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "brownfac");
RNA_def_property_range(prop, 0.0f, 200.0f);
RNA_def_property_ui_text(prop, "Brownian", "Specify the amount of brownian motion");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "damp_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "dampfac");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Damp", "Specify the amount of damping");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
/* length */
//TODO: is this readonly?
@@ -963,64 +1199,75 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "abslength");
RNA_def_property_range(prop, 0.0f, 10000.0f);
RNA_def_property_ui_text(prop, "Max Length", "Absolute maximum path length for children, in blender units.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "random_length", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "randlength");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Random Length", "Give path length a random variation.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
/* children */
- prop= RNA_def_property(srna, "child_nbr", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "child_nbr");//optional if prop names are the same
- RNA_def_property_range(prop, 0.0f, MAX_PART_CHILDREN);
+ prop= RNA_def_property(srna, "child_nbr", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "child_nbr");//optional if prop names are the same
+ RNA_def_property_range(prop, 0, MAX_PART_CHILDREN);
RNA_def_property_ui_text(prop, "Children Per Parent", "Amount of children/parent");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
- prop= RNA_def_property(srna, "rendered_child_nbr", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "ren_child_nbr");
- RNA_def_property_range(prop, 0.0f, MAX_PART_CHILDREN);
+ prop= RNA_def_property(srna, "rendered_child_nbr", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "ren_child_nbr");
+ RNA_def_property_range(prop, 0, MAX_PART_CHILDREN);
RNA_def_property_ui_text(prop, "Rendered Children", "Amount of children/parent for rendering.");
prop= RNA_def_property(srna, "virtual_parents", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "parents");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Virtual Parents", "Relative amount of virtual parents.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
prop= RNA_def_property(srna, "child_size", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "childsize");
RNA_def_property_range(prop, 0.01f, 100.0f);
RNA_def_property_ui_text(prop, "Child Size", "A multiplier for the child particle size.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
prop= RNA_def_property(srna, "child_random_size", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "childrandsize");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Random Child Size", "Random variation to the size of the child particles.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
prop= RNA_def_property(srna, "child_radius", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "childrad");
RNA_def_property_range(prop, 0.0f, 10.0f);
RNA_def_property_ui_text(prop, "Child Radius", "Radius of children around parent.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
prop= RNA_def_property(srna, "child_roundness", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "childflat");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Child Roundness", "Roundness of children around parent.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
//TODO: is this readonly?
prop= RNA_def_property(srna, "child_spread", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "childspread");
// RNA_def_property_range(prop, 0.0f, upperLimitf); TODO: limits
RNA_def_property_ui_text(prop, "Child Spread", "");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
/* clumping */
prop= RNA_def_property(srna, "clump_factor", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "clumpfac");
RNA_def_property_range(prop, -1.0f, 1.0f);
RNA_def_property_ui_text(prop, "Clump", "Amount of clumping");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
prop= RNA_def_property(srna, "clumppow", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "clumppow");
RNA_def_property_range(prop, -0.999f, 0.999f);
RNA_def_property_ui_text(prop, "Shape", "Shape of clumping");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
/* kink */
@@ -1028,101 +1275,121 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_float_sdna(prop, NULL, "kink_amp");
RNA_def_property_range(prop, 0.0f, 10.0f);
RNA_def_property_ui_text(prop, "Amplitude", "The amplitude of the offset.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
prop= RNA_def_property(srna, "kink_frequency", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "kink_freq");
RNA_def_property_range(prop, 0.0f, 10.0f);
RNA_def_property_ui_text(prop, "Frequency", "The frequency of the offset (1/total length)");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
prop= RNA_def_property(srna, "kink_shape", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, -0.999f, 0.999f);
RNA_def_property_ui_text(prop, "Shape", "Adjust the offset to the beginning/end");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
/* rough */
prop= RNA_def_property(srna, "rough1", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0f, 10.0f);
RNA_def_property_ui_text(prop, "Rough1", "Amount of location dependent rough.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
prop= RNA_def_property(srna, "rough1_size", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.01f, 10.0f);
RNA_def_property_ui_text(prop, "Size1", "Size of location dependent rough.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
prop= RNA_def_property(srna, "rough2", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "rough2");
RNA_def_property_range(prop, 0.0f, 10.0f);
RNA_def_property_ui_text(prop, "Rough2", "Amount of random rough.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
prop= RNA_def_property(srna, "rough2_size", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "rough2_size");
RNA_def_property_range(prop, 0.01f, 10.0f);
RNA_def_property_ui_text(prop, "Size2", "Size of random rough.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
prop= RNA_def_property(srna, "rough2_thres", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "rough2_thres");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Threshold", "Amount of particles left untouched by random rough.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
prop= RNA_def_property(srna, "rough_endpoint", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "rough_end");
RNA_def_property_range(prop, 0.0f, 10.0f);
RNA_def_property_ui_text(prop, "Rough Endpoint", "Amount of end point rough.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
prop= RNA_def_property(srna, "rough_end_shape", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, 0.0f, 10.0f);
RNA_def_property_ui_text(prop, "Shape", "Shape of end point rough");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
/* branching */
prop= RNA_def_property(srna, "branch_threshold", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "branch_thres");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Threshold", "Threshold of branching.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
/* drawing stuff */
prop= RNA_def_property(srna, "line_length_tail", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_funcs(prop, "rna_PartSetting_linelentail_get", "rna_PartSetting_linelentail_set", NULL);
RNA_def_property_range(prop, 0.0f, 10.0f);
RNA_def_property_ui_text(prop, "Back", "Length of the line's tail");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "line_length_head", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_funcs(prop, "rna_PartSetting_linelenhead_get", "rna_PartSetting_linelenhead_set", NULL);
RNA_def_property_range(prop, 0.0f, 10.0f);
RNA_def_property_ui_text(prop, "Head", "Length of the line's head");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
/* boids */
prop= RNA_def_property(srna, "max_velocity", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "max_vel");
RNA_def_property_range(prop, 0.0f, 200.0f);
RNA_def_property_ui_text(prop, "Maximum Velocity", "");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "lateral_acceleration_max", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "max_lat_acc");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Lateral Acceleration", "Lateral acceleration % of max velocity");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "tangential_acceleration_max", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "max_tan_acc");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Tangential acceleration", "Tangential acceleration % of max velocity");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "average_velocity", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "average_vel");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Average Velocity", "The usual speed % of max velocity");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "banking", PROP_FLOAT, PROP_NONE);
RNA_def_property_range(prop, -10.0f, 10.0f);
RNA_def_property_ui_text(prop, "Banking", "Banking of boids on turns (1.0==natural banking)");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "banking_max", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "max_bank");
RNA_def_property_range(prop, 0.0f, 1.0f);
RNA_def_property_ui_text(prop, "Maximum Banking", "How much a boid can bank at a single step");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "ground_z", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "groundz");
RNA_def_property_range(prop, -100.0f, 100.0f);
RNA_def_property_ui_text(prop, "Ground Z", "Default Z value");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
/*TODO: not sure how to deal with this
prop= RNA_def_property(srna, "boid_factor", PROP_FLOAT, PROP_VECTOR);
@@ -1137,24 +1404,28 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_struct_type(prop, "Group");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Dupli Group", "Show Objects in this Group in place of particles");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "effector_group", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "eff_group");
RNA_def_property_struct_type(prop, "Group");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Effector Group", "Limit effectors to this Group.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "dupli_object", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "dup_ob");
RNA_def_property_struct_type(prop, "Object");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Dupli Object", "Show this Object in place of particles.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "billboard_object", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "bb_ob");
RNA_def_property_struct_type(prop, "Object");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Billboard Object", "Billboards face this object (default is active camera)");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
#if 0
prop= RNA_def_property(srna, "ipo", PROP_POINTER, PROP_NONE);
@@ -1175,6 +1446,13 @@ static void rna_def_particle_system(BlenderRNA *brna)
srna= RNA_def_struct(brna, "ParticleSystem", NULL);
RNA_def_struct_ui_text(srna, "Particle System", "Particle system in an object.");
+ RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA);
+
+ prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop, "rna_ParticleSystem_name_get", "rna_ParticleSystem_name_length", NULL);
+ RNA_def_property_ui_text(prop, "Name", "Particle system name.");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_struct_name_property(srna, prop);
prop= RNA_def_property(srna, "settings", PROP_POINTER, PROP_NEVER_NULL);
RNA_def_property_pointer_sdna(prop, NULL, "part");
@@ -1192,6 +1470,7 @@ static void rna_def_particle_system(BlenderRNA *brna)
prop= RNA_def_property(srna, "seed", PROP_INT, PROP_UNSIGNED);
RNA_def_property_ui_text(prop, "Seed", "Offset in the random number table, to get a different randomized result.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
/* hair */
prop= RNA_def_property(srna, "softbody", PROP_POINTER, PROP_NONE);
@@ -1212,37 +1491,43 @@ static void rna_def_particle_system(BlenderRNA *brna)
RNA_def_property_pointer_sdna(prop, NULL, "target_ob");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Reactor Target Object", "For reactor systems, the object that has the target particle system (empty if same object).");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "reactor_target_particle_system", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "target_psys");
RNA_def_property_range(prop, 1, INT_MAX);
RNA_def_property_ui_text(prop, "Reactor Target Particle System", "For reactor systems, index of particle system on the target object.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
/* boids */
prop= RNA_def_property(srna, "boids_surface_object", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "keyed_ob");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Boids Surface Object", "For boids physics systems, constrain boids to this object's surface.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
/* keyed */
prop= RNA_def_property(srna, "keyed_object", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "keyed_ob");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Keyed Object", "For keyed physics systems, the object that has the target particle system.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "keyed_particle_system", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "keyed_psys");
RNA_def_property_range(prop, 1, INT_MAX);
RNA_def_property_ui_text(prop, "Keyed Particle System", "For keyed physics systems, index of particle system on the keyed object.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "keyed_first", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PSYS_FIRST_KEYED);
RNA_def_property_ui_text(prop, "Keyed First", "Set the system to be the starting point of keyed particles");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "keyed_timed", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", PSYS_KEYED_TIME);
RNA_def_property_ui_text(prop, "Keyed Timed", "Use intermediate key times for keyed particles (setting for starting point only).");
-
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
/* billboard */
prop= RNA_def_property(srna, "billboard_normal_uv", PROP_STRING, PROP_NONE);
@@ -1264,98 +1549,122 @@ static void rna_def_particle_system(BlenderRNA *brna)
prop= RNA_def_property(srna, "vertex_group_density", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "vgroup[0]");
RNA_def_property_ui_text(prop, "Vertex Group Density", "Vertex group to control density.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "vertex_group_density_negate", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_DENSITY));
RNA_def_property_ui_text(prop, "Vertex Group Density Negate", "Negate the effect of the density vertex group.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "vertex_group_velocity", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "vgroup[1]");
RNA_def_property_ui_text(prop, "Vertex Group Velocity", "Vertex group to control velocity.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "vertex_group_velocity_negate", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_VEL));
RNA_def_property_ui_text(prop, "Vertex Group Velocity Negate", "Negate the effect of the velocity vertex group.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "vertex_group_length", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "vgroup[2]");
RNA_def_property_ui_text(prop, "Vertex Group Length", "Vertex group to control length.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "vertex_group_length_negate", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_LENGTH));
RNA_def_property_ui_text(prop, "Vertex Group Length Negate", "Negate the effect of the length vertex group.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo");
prop= RNA_def_property(srna, "vertex_group_clump", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "vgroup[3]");
RNA_def_property_ui_text(prop, "Vertex Group Clump", "Vertex group to control clump.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
prop= RNA_def_property(srna, "vertex_group_clump_negate", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_CLUMP));
RNA_def_property_ui_text(prop, "Vertex Group Clump Negate", "Negate the effect of the clump vertex group.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
prop= RNA_def_property(srna, "vertex_group_kink", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "vgroup[4]");
RNA_def_property_ui_text(prop, "Vertex Group Kink", "Vertex group to control kink.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
prop= RNA_def_property(srna, "vertex_group_kink_negate", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_KINK));
RNA_def_property_ui_text(prop, "Vertex Group Kink Negate", "Negate the effect of the kink vertex group.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
prop= RNA_def_property(srna, "vertex_group_roughness1", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "vgroup[5]");
RNA_def_property_ui_text(prop, "Vertex Group Roughness 1", "Vertex group to control roughness 1.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
prop= RNA_def_property(srna, "vertex_group_roughness1_negate", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGH1));
RNA_def_property_ui_text(prop, "Vertex Group Roughness 1 Negate", "Negate the effect of the roughness 1 vertex group.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
prop= RNA_def_property(srna, "vertex_group_roughness2", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "vgroup[6]");
RNA_def_property_ui_text(prop, "Vertex Group Roughness 2", "Vertex group to control roughness 2.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
prop= RNA_def_property(srna, "vertex_group_roughness2_negate", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGH2));
RNA_def_property_ui_text(prop, "Vertex Group Roughness 2 Negate", "Negate the effect of the roughness 2 vertex group.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
prop= RNA_def_property(srna, "vertex_group_roughness_end", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "vgroup[7]");
RNA_def_property_ui_text(prop, "Vertex Group Roughness End", "Vertex group to control roughness end.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
prop= RNA_def_property(srna, "vertex_group_roughness_end_negate", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGHE));
RNA_def_property_ui_text(prop, "Vertex Group Roughness End Negate", "Negate the effect of the roughness end vertex group.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo_child");
prop= RNA_def_property(srna, "vertex_group_size", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "vgroup[8]");
RNA_def_property_ui_text(prop, "Vertex Group Size", "Vertex group to control size.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "vertex_group_size_negate", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_SIZE));
RNA_def_property_ui_text(prop, "Vertex Group Size Negate", "Negate the effect of the size vertex group.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "vertex_group_tangent", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "vgroup[9]");
RNA_def_property_ui_text(prop, "Vertex Group Tangent", "Vertex group to control tangent.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "vertex_group_tangent_negate", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_TAN));
RNA_def_property_ui_text(prop, "Vertex Group Tangent Negate", "Negate the effect of the tangent vertex group.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "vertex_group_rotation", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "vgroup[10]");
RNA_def_property_ui_text(prop, "Vertex Group Rotation", "Vertex group to control rotation.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "vertex_group_rotation_negate", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROT));
RNA_def_property_ui_text(prop, "Vertex Group Rotation Negate", "Negate the effect of the rotation vertex group.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "vertex_group_field", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "vgroup[11]");
RNA_def_property_ui_text(prop, "Vertex Group Field", "Vertex group to control field.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
prop= RNA_def_property(srna, "vertex_group_field_negate", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_EFFECTOR));
RNA_def_property_ui_text(prop, "Vertex Group Field Negate", "Negate the effect of the field vertex group.");
+ RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset");
/* pointcache */
prop= RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NEVER_NULL);
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index 05aa10ec2eb..75bdbebb474 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -30,6 +30,8 @@
#include "RNA_define.h"
#include "RNA_types.h"
+#include "rna_internal.h"
+
#ifdef RNA_RUNTIME
/* Struct */
@@ -570,6 +572,7 @@ static void rna_def_struct(BlenderRNA *brna)
srna= RNA_def_struct(brna, "Struct", NULL);
RNA_def_struct_ui_text(srna, "Struct Definition", "RNA structure definition");
+ RNA_def_struct_ui_icon(srna, ICON_RNA);
prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -647,6 +650,7 @@ static void rna_def_property(BlenderRNA *brna)
srna= RNA_def_struct(brna, "Property", NULL);
RNA_def_struct_ui_text(srna, "Property Definition", "RNA property definition.");
RNA_def_struct_refine_func(srna, "rna_Property_refine");
+ RNA_def_struct_ui_icon(srna, ICON_RNA);
prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -699,6 +703,7 @@ static void rna_def_function(BlenderRNA *brna)
srna= RNA_def_struct(brna, "Function", NULL);
RNA_def_struct_ui_text(srna, "Function Definition", "RNA function definition");
+ RNA_def_struct_ui_icon(srna, ICON_RNA);
prop= RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -800,6 +805,7 @@ static void rna_def_enum_property(BlenderRNA *brna, StructRNA *srna)
srna= RNA_def_struct(brna, "EnumPropertyItem", NULL);
RNA_def_struct_ui_text(srna, "Enum Item Definition", "Definition of a choice in an RNA enum property.");
+ RNA_def_struct_ui_icon(srna, ICON_RNA);
prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
@@ -884,6 +890,7 @@ void RNA_def_rna(BlenderRNA *brna)
/* Blender RNA */
srna= RNA_def_struct(brna, "BlenderRNA", NULL);
RNA_def_struct_ui_text(srna, "Blender RNA", "Blender RNA structure definitions.");
+ RNA_def_struct_ui_icon(srna, ICON_RNA);
prop= RNA_def_property(srna, "structs", PROP_COLLECTION, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index caa6e73903a..226e6b17b47 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -607,6 +607,7 @@ void RNA_def_scene(BlenderRNA *brna)
srna= RNA_def_struct(brna, "Scene", "ID");
RNA_def_struct_ui_text(srna, "Scene", "Scene consisting objects and defining time and render related settings.");
+ RNA_def_struct_ui_icon(srna, ICON_SCENE_DATA);
RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
prop= RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c
index e8b766ff2ea..e153994e7a6 100644
--- a/source/blender/makesrna/intern/rna_screen.c
+++ b/source/blender/makesrna/intern/rna_screen.c
@@ -90,6 +90,7 @@ static void rna_def_bscreen(BlenderRNA *brna)
srna= RNA_def_struct(brna, "Screen", "ID");
RNA_def_struct_sdna(srna, "Screen"); /* it is actually bScreen but for 2.5 the dna is patched! */
RNA_def_struct_ui_text(srna, "Screen", "Screen datablock, defining the layout of areas in a window.");
+ RNA_def_struct_ui_icon(srna, ICON_SPLITSCREEN);
prop= RNA_def_property(srna, "scene", PROP_POINTER, PROP_NEVER_NULL);
RNA_def_property_ui_text(prop, "Scene", "Active scene to be edited in the screen.");
diff --git a/source/blender/makesrna/intern/rna_scriptlink.c b/source/blender/makesrna/intern/rna_scriptlink.c
index f073065f6bc..b486cd4a874 100644
--- a/source/blender/makesrna/intern/rna_scriptlink.c
+++ b/source/blender/makesrna/intern/rna_scriptlink.c
@@ -41,6 +41,7 @@ void RNA_def_scriptlink(BlenderRNA *brna)
srna= RNA_def_struct(brna, "ScriptLink", NULL);
RNA_def_struct_ui_text(srna, "Script Link", "Scripts linked to a datablock, to be executed on changes to the datablock.");
+ RNA_def_struct_ui_icon(srna, ICON_PYTHON);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_sound.c b/source/blender/makesrna/intern/rna_sound.c
index c6515385757..118c39655e8 100644
--- a/source/blender/makesrna/intern/rna_sound.c
+++ b/source/blender/makesrna/intern/rna_sound.c
@@ -134,6 +134,7 @@ static void rna_def_sound(BlenderRNA *brna)
srna= RNA_def_struct(brna, "Sound", "ID");
RNA_def_struct_sdna(srna, "bSound");
RNA_def_struct_ui_text(srna, "Sound", "Sound datablock referencing an external or packed sound file.");
+ RNA_def_struct_ui_icon(srna, ICON_SOUND);
//rna_def_ipo_common(srna);
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 56967a84903..55c56beea7c 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -74,9 +74,9 @@ static StructRNA* rna_Space_refine(struct PointerRNA *ptr)
*/
case SPACE_OUTLINER:
return &RNA_SpaceOutliner;
- /* case SPACE_BUTS:
+ case SPACE_BUTS:
return &RNA_SpaceButtonsWindow;
- case SPACE_FILE:
+ /* case SPACE_FILE:
return &RNA_SpaceFileBrowser;*/
case SPACE_IMAGE:
return &RNA_SpaceImageEditor;
@@ -471,6 +471,45 @@ static void rna_def_space_3dview(BlenderRNA *brna)
}
+static void rna_def_space_buttons(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static EnumPropertyItem buttons_context_items[] = {
+ {BCONTEXT_SCENE, "SCENE", "Scene", ""},
+ {BCONTEXT_WORLD, "WORLD", "World", ""},
+ {BCONTEXT_OBJECT, "OBJECT", "Object", ""},
+ {BCONTEXT_DATA, "DATA", "Data", ""},
+ {BCONTEXT_MATERIAL, "MATERIAL", "Material", ""},
+ {BCONTEXT_TEXTURE, "TEXTURE", "Texture", ""},
+ {BCONTEXT_PARTICLE, "PARTICLE", "Particle", ""},
+ {BCONTEXT_PHYSICS, "PHYSICS", "Physics", ""},
+ {BCONTEXT_GAME, "GAME", "Game", ""},
+ {BCONTEXT_BONE, "BONE", "Bone", ""},
+ {BCONTEXT_MODIFIER, "MODIFIER", "Modifier", ""},
+ {0, NULL, NULL, NULL}};
+
+ static EnumPropertyItem panel_alignment_items[] = {
+ {1, "HORIZONTAL", "Horizontal", ""},
+ {2, "VERTICAL", "Vertical", ""},
+ {0, NULL, NULL, NULL}};
+
+ srna= RNA_def_struct(brna, "SpaceButtonsWindow", "Space");
+ RNA_def_struct_sdna(srna, "SpaceButs");
+ RNA_def_struct_ui_text(srna, "Buttons Space", "Buttons Window space data");
+
+ prop= RNA_def_property(srna, "buttons_context", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mainb");
+ RNA_def_property_enum_items(prop, buttons_context_items);
+ RNA_def_property_ui_text(prop, "Buttons Context", "The type of active data to display and edit in the buttons window");
+
+ prop= RNA_def_property(srna, "panel_alignment", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "align");
+ RNA_def_property_enum_items(prop, panel_alignment_items);
+ RNA_def_property_ui_text(prop, "Panel Alignment", "Arrangement of the panels within the buttons window");
+}
+
static void rna_def_space_image(BlenderRNA *brna)
{
StructRNA *srna;
@@ -624,6 +663,7 @@ void RNA_def_space(BlenderRNA *brna)
rna_def_space_outliner(brna);
rna_def_background_image(brna);
rna_def_space_3dview(brna);
+ rna_def_space_buttons(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_text.c b/source/blender/makesrna/intern/rna_text.c
index d3e4a34b9a7..cd39c317bc5 100644
--- a/source/blender/makesrna/intern/rna_text.c
+++ b/source/blender/makesrna/intern/rna_text.c
@@ -172,6 +172,7 @@ static void rna_def_text(BlenderRNA *brna)
srna = RNA_def_struct(brna, "Text", "ID");
RNA_def_struct_ui_text(srna, "Text", "Text datablock referencing an external or packed text file.");
+ RNA_def_struct_ui_icon(srna, ICON_TEXT);
RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c
index b0fa4458f22..55336b5e8b4 100644
--- a/source/blender/makesrna/intern/rna_texture.c
+++ b/source/blender/makesrna/intern/rna_texture.c
@@ -23,6 +23,7 @@
*/
#include <float.h>
+#include <stdio.h>
#include <stdlib.h>
#include "RNA_define.h"
@@ -30,8 +31,11 @@
#include "rna_internal.h"
+#include "DNA_brush_types.h"
+#include "DNA_lamp_types.h"
#include "DNA_material_types.h"
#include "DNA_texture_types.h"
+#include "DNA_world_types.h"
#ifdef RNA_RUNTIME
@@ -71,6 +75,50 @@ StructRNA *rna_Texture_refine(struct PointerRNA *ptr)
}
}
+static int rna_texture_slot_index(PointerRNA *ptr)
+{
+ ID *id= ptr->id.data;
+ MTex **mtex;
+ int a;
+
+ if(id) {
+ switch(GS(id->name)) {
+ case ID_MA: mtex= ((Material*)id)->mtex; break;
+ case ID_WO: mtex= ((World*)id)->mtex; break;
+ case ID_LA: mtex= ((Lamp*)id)->mtex; break;
+ case ID_BR: mtex= ((Brush*)id)->mtex; break;
+ default: return 0;
+ }
+
+ for(a=0; a<MAX_MTEX; a++)
+ if(mtex[a] == ptr->data)
+ return a;
+ }
+
+ return 0;
+}
+
+static int rna_TextureSlot_name_length(PointerRNA *ptr)
+{
+ MTex *mtex= ptr->data;
+
+ if(mtex->tex)
+ return strlen(mtex->tex->id.name+2) + 10;
+
+ return 10;
+}
+
+static void rna_TextureSlot_name_get(PointerRNA *ptr, char *str)
+{
+ MTex *mtex= ptr->data;
+ int index= rna_texture_slot_index(ptr);
+
+ sprintf(str, "%d: ", index+1);
+
+ if(mtex->tex)
+ strcat(str, mtex->tex->id.name+2);
+}
+
#else
static void rna_def_color_ramp_element(BlenderRNA *brna)
@@ -183,6 +231,7 @@ static void rna_def_mtex(BlenderRNA *brna)
srna= RNA_def_struct(brna, "TextureSlot", NULL);
RNA_def_struct_sdna(srna, "MTex");
RNA_def_struct_ui_text(srna, "Texture Slot", "Texture slot defining the mapping and influence of a texture.");
+ RNA_def_struct_ui_icon(srna, ICON_TEXTURE_DATA);
prop= RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "tex");
@@ -190,6 +239,12 @@ static void rna_def_mtex(BlenderRNA *brna)
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_ui_text(prop, "Texture", "Texture datablock used by this texture slot.");
+ prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop, "rna_TextureSlot_name_get", "rna_TextureSlot_name_length", NULL);
+ RNA_def_property_ui_text(prop, "Name", "Texture slot name.");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_struct_name_property(srna, prop);
+
/* mapping */
prop= RNA_def_property(srna, "offset", PROP_FLOAT, PROP_VECTOR);
RNA_def_property_float_sdna(prop, NULL, "ofs");
@@ -990,6 +1045,7 @@ static void rna_def_texture(BlenderRNA *brna)
srna= RNA_def_struct(brna, "Texture", "ID");
RNA_def_struct_sdna(srna, "Tex");
RNA_def_struct_ui_text(srna, "Texture", "Texture datablock used by materials, lamps, worlds and brushes.");
+ RNA_def_struct_ui_icon(srna, ICON_TEXTURE_DATA);
RNA_def_struct_refine_func(srna, "rna_Texture_refine");
prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c
index 9d3d961c18f..796817e1018 100644
--- a/source/blender/makesrna/intern/rna_ui.c
+++ b/source/blender/makesrna/intern/rna_ui.c
@@ -199,7 +199,7 @@ static StructRNA *rna_Panel_register(const bContext *C, ReportList *reports, voi
static StructRNA* rna_Panel_refine(struct PointerRNA *ptr)
{
Panel *hdr= (Panel*)ptr->data;
- return (hdr->type)? hdr->type->py_srna: &RNA_Panel;
+ return (hdr->type && hdr->type->py_srna)? hdr->type->py_srna: &RNA_Panel;
}
/* Header */
@@ -290,7 +290,7 @@ static StructRNA *rna_Header_register(const bContext *C, ReportList *reports, vo
static StructRNA* rna_Header_refine(struct PointerRNA *htr)
{
Header *hdr= (Header*)htr->data;
- return (hdr->type)? hdr->type->py_srna: &RNA_Header;
+ return (hdr->type && hdr->type->py_srna)? hdr->type->py_srna: &RNA_Header;
}
/* Menu */
@@ -405,7 +405,7 @@ static StructRNA *rna_Menu_register(const bContext *C, ReportList *reports, void
static StructRNA* rna_Menu_refine(struct PointerRNA *mtr)
{
Menu *hdr= (Menu*)mtr->data;
- return (hdr->type)? hdr->type->py_srna: &RNA_Menu;
+ return (hdr->type && hdr->type->py_srna)? hdr->type->py_srna: &RNA_Menu;
}
static int rna_UILayout_active_get(struct PointerRNA *ptr)
@@ -458,14 +458,24 @@ static void rna_UILayout_alignment_set(struct PointerRNA *ptr, int value)
return uiLayoutSetAlignment(ptr->data, value);
}
-static float rna_UILayout_scale_get(struct PointerRNA *ptr)
+static float rna_UILayout_scale_x_get(struct PointerRNA *ptr)
{
- return uiLayoutGetScale(ptr->data);
+ return uiLayoutGetScaleX(ptr->data);
}
-static void rna_UILayout_scale_set(struct PointerRNA *ptr, float value)
+static void rna_UILayout_scale_x_set(struct PointerRNA *ptr, float value)
{
- return uiLayoutSetScale(ptr->data, value);
+ return uiLayoutSetScaleX(ptr->data, value);
+}
+
+static float rna_UILayout_scale_y_get(struct PointerRNA *ptr)
+{
+ return uiLayoutGetScaleY(ptr->data);
+}
+
+static void rna_UILayout_scale_y_set(struct PointerRNA *ptr, float value)
+{
+ return uiLayoutSetScaleY(ptr->data, value);
}
#else
@@ -476,6 +486,7 @@ static void rna_def_ui_layout(BlenderRNA *brna)
PropertyRNA *prop;
static EnumPropertyItem alignment_items[] = {
+ {UI_LAYOUT_ALIGN_EXPAND, "EXPAND", "Expand", ""},
{UI_LAYOUT_ALIGN_LEFT, "LEFT", "Left", ""},
{UI_LAYOUT_ALIGN_CENTER, "CENTER", "Center", ""},
{UI_LAYOUT_ALIGN_RIGHT, "RIGHT", "RIght", ""},
@@ -501,8 +512,11 @@ static void rna_def_ui_layout(BlenderRNA *brna)
prop= RNA_def_property(srna, "keep_aspect", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_funcs(prop, "rna_UILayout_keep_aspect_get", "rna_UILayout_keep_aspect_set");
- prop= RNA_def_property(srna, "scale", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_float_funcs(prop, "rna_UILayout_scale_get", "rna_UILayout_scale_set", NULL);
+ prop= RNA_def_property(srna, "scale_x", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_funcs(prop, "rna_UILayout_scale_x_get", "rna_UILayout_scale_x_set", NULL);
+
+ prop= RNA_def_property(srna, "scale_y", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_funcs(prop, "rna_UILayout_scale_y_get", "rna_UILayout_scale_y_set", NULL);
RNA_api_ui_layout(srna);
}
diff --git a/source/blender/makesrna/intern/rna_vfont.c b/source/blender/makesrna/intern/rna_vfont.c
index d18b87e73ee..aa2aaaf6342 100644
--- a/source/blender/makesrna/intern/rna_vfont.c
+++ b/source/blender/makesrna/intern/rna_vfont.c
@@ -43,6 +43,7 @@ void RNA_def_vfont(BlenderRNA *brna)
srna= RNA_def_struct(brna, "VectorFont", "ID");
RNA_def_struct_ui_text(srna, "Vector Font", "Vector font for Text objects.");
RNA_def_struct_sdna(srna, "VFont");
+ RNA_def_struct_ui_icon(srna, ICON_FONT_DATA);
prop= RNA_def_property(srna, "filename", PROP_STRING, PROP_FILEPATH);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index c1bccad4ffa..b4d2cb35121 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -56,7 +56,7 @@ static StructRNA *rna_OperatorProperties_refine(PointerRNA *ptr)
if(op)
return op->type->srna;
else
- return &RNA_OperatorProperties;
+ return ptr->type;
}
IDProperty *rna_OperatorProperties_idproperties(PointerRNA *ptr, int create)
@@ -133,6 +133,21 @@ static void rna_def_operator_utils(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Time", "Time of mouse location.");
}
+static void rna_def_operator_filelist_element(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna= RNA_def_struct(brna, "OperatorFileListElement", "IDPropertyGroup");
+ RNA_def_struct_ui_text(srna, "Operator File List Element", "");
+
+
+ prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_IDPROPERTY);
+ RNA_def_property_ui_text(prop, "Name", "the name of a file or directory within a file list");
+}
+
+
static void rna_def_windowmanager(BlenderRNA *brna)
{
StructRNA *srna;
@@ -151,6 +166,7 @@ void RNA_def_wm(BlenderRNA *brna)
{
rna_def_operator(brna);
rna_def_operator_utils(brna);
+ rna_def_operator_filelist_element(brna);
rna_def_windowmanager(brna);
}
diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c
index 7fb7fe656f5..81fad658a7e 100644
--- a/source/blender/makesrna/intern/rna_world.c
+++ b/source/blender/makesrna/intern/rna_world.c
@@ -338,6 +338,7 @@ void RNA_def_world(BlenderRNA *brna)
srna= RNA_def_struct(brna, "World", "ID");
RNA_def_struct_ui_text(srna, "World", "World datablock describing the environment and ambient lighting of a scene.");
+ 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", "WorldTextureSlot");
diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c
index 999f6d8e9cb..7b3a67ebff5 100644
--- a/source/blender/python/intern/bpy_interface.c
+++ b/source/blender/python/intern/bpy_interface.c
@@ -19,6 +19,7 @@
#include "bpy_rna.h"
#include "bpy_operator.h"
#include "bpy_ui.h"
+#include "bpy_util.h"
#include "DNA_anim_types.h"
#include "DNA_space_types.h"
diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c
index b03540fb765..004cf2fb7c7 100644
--- a/source/blender/python/intern/bpy_operator.c
+++ b/source/blender/python/intern/bpy_operator.c
@@ -41,73 +41,6 @@
extern ListBase global_ops; /* evil, temp use */
-
-
-/* This function is only used by operators right now
- * Its used for taking keyword args and filling in property values */
-int PYOP_props_from_dict(PointerRNA *ptr, PyObject *kw)
-{
- int error_val = 0;
- int totkw;
- const char *arg_name= NULL;
- PyObject *item;
-
- PropertyRNA *prop, *iterprop;
- CollectionPropertyIterator iter;
-
- iterprop= RNA_struct_iterator_property(ptr->type);
- RNA_property_collection_begin(ptr, iterprop, &iter);
-
- totkw = kw ? PyDict_Size(kw):0;
-
- for(; iter.valid; RNA_property_collection_next(&iter)) {
- prop= iter.ptr.data;
-
- arg_name= RNA_property_identifier(prop);
-
- if (strcmp(arg_name, "rna_type")==0) continue;
-
- if (kw==NULL) {
- PyErr_Format( PyExc_AttributeError, "no args, expected \"%s\"", arg_name ? arg_name : "<UNKNOWN>");
- error_val= -1;
- break;
- }
-
- item= PyDict_GetItemString(kw, arg_name);
-
- if (item == NULL) {
- PyErr_Format( PyExc_AttributeError, "argument \"%s\" missing", arg_name ? arg_name : "<UNKNOWN>");
- error_val = -1; /* pyrna_py_to_prop sets the error */
- break;
- }
-
- if (pyrna_py_to_prop(ptr, prop, NULL, item)) {
- error_val= -1;
- break;
- }
-
- totkw--;
- }
-
- RNA_property_collection_end(&iter);
-
- if (error_val==0 && totkw > 0) { /* some keywords were given that were not used :/ */
- PyObject *key, *value;
- Py_ssize_t pos = 0;
-
- while (PyDict_Next(kw, &pos, &key, &value)) {
- arg_name= _PyUnicode_AsString(key);
- if (RNA_struct_find_property(ptr, arg_name) == NULL) break;
- arg_name= NULL;
- }
-
- PyErr_Format( PyExc_AttributeError, "argument \"%s\" unrecognized", arg_name ? arg_name : "<UNKNOWN>");
- error_val = -1;
- }
-
- return error_val;
-}
-
static PyObject *pyop_base_dir(PyObject *self);
static PyObject *pyop_base_rna(PyObject *self, PyObject *pyname);
static struct PyMethodDef pyop_base_methods[] = {
@@ -148,7 +81,7 @@ static PyObject *pyop_base_call( PyObject * self, PyObject * args, PyObject * k
WM_operator_properties_create(&ptr, opname);
- error_val= PYOP_props_from_dict(&ptr, kw);
+ error_val= pyrna_pydict_to_props(&ptr, kw, "Converting py args to operator properties: ");
if (error_val==0) {
ReportList reports;
diff --git a/source/blender/python/intern/bpy_operator.h b/source/blender/python/intern/bpy_operator.h
index c4741f936bf..46ea144fd4d 100644
--- a/source/blender/python/intern/bpy_operator.h
+++ b/source/blender/python/intern/bpy_operator.h
@@ -42,7 +42,4 @@ typedef struct {
PyObject *BPY_operator_module(void);
-/* fill in properties from a python dict */
-int PYOP_props_from_dict(PointerRNA *ptr, PyObject *kw);
-
#endif
diff --git a/source/blender/python/intern/bpy_operator_wrap.c b/source/blender/python/intern/bpy_operator_wrap.c
index 43d62b3005f..bf92db832af 100644
--- a/source/blender/python/intern/bpy_operator_wrap.c
+++ b/source/blender/python/intern/bpy_operator_wrap.c
@@ -272,7 +272,7 @@ static int PYTHON_OT_generic(int mode, bContext *C, wmOperator *op, wmEvent *eve
* thrown away anyway
*
* If we ever want to do this and use the props again,
- * it can be done with - PYOP_props_from_dict(op->ptr, kw)
+ * it can be done with - pyrna_pydict_to_props(op->ptr, kw, "")
*/
Py_DECREF(ret);
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index c1778faa1cd..d9a0d9408c7 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -204,6 +204,71 @@ PyObject * pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop)
return ret;
}
+/* This function is only used by operators right now
+ * Its used for taking keyword args and filling in property values */
+int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, const char *error_prefix)
+{
+ int error_val = 0;
+ int totkw;
+ const char *arg_name= NULL;
+ PyObject *item;
+
+ PropertyRNA *prop, *iterprop;
+ CollectionPropertyIterator iter;
+
+ iterprop= RNA_struct_iterator_property(ptr->type);
+ RNA_property_collection_begin(ptr, iterprop, &iter);
+
+ totkw = kw ? PyDict_Size(kw):0;
+
+ for(; iter.valid; RNA_property_collection_next(&iter)) {
+ prop= iter.ptr.data;
+
+ arg_name= RNA_property_identifier(prop);
+
+ if (strcmp(arg_name, "rna_type")==0) continue;
+
+ if (kw==NULL) {
+ PyErr_Format( PyExc_AttributeError, "%s: no keywords, expected \"%s\"", error_prefix, arg_name ? arg_name : "<UNKNOWN>");
+ error_val= -1;
+ break;
+ }
+
+ item= PyDict_GetItemString(kw, arg_name);
+
+ if (item == NULL) {
+ PyErr_Format( PyExc_AttributeError, "%s: keyword \"%s\" missing", error_prefix, arg_name ? arg_name : "<UNKNOWN>");
+ error_val = -1; /* pyrna_py_to_prop sets the error */
+ break;
+ }
+
+ if (pyrna_py_to_prop(ptr, prop, NULL, item)) {
+ error_val= -1;
+ break;
+ }
+
+ totkw--;
+ }
+
+ RNA_property_collection_end(&iter);
+
+ if (error_val==0 && totkw > 0) { /* some keywords were given that were not used :/ */
+ PyObject *key, *value;
+ Py_ssize_t pos = 0;
+
+ while (PyDict_Next(kw, &pos, &key, &value)) {
+ arg_name= _PyUnicode_AsString(key);
+ if (RNA_struct_find_property(ptr, arg_name) == NULL) break;
+ arg_name= NULL;
+ }
+
+ PyErr_Format( PyExc_AttributeError, "%s: keyword \"%s\" unrecognized", error_prefix, arg_name ? arg_name : "<UNKNOWN>");
+ error_val = -1;
+ }
+
+ return error_val;
+}
+
static PyObject * pyrna_func_call(PyObject * self, PyObject *args, PyObject *kw);
PyObject *pyrna_func_to_py(PointerRNA *ptr, FunctionRNA *func)
@@ -447,9 +512,36 @@ int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *v
break;
}
case PROP_COLLECTION:
- PyErr_SetString(PyExc_AttributeError, "cant convert collections yet");
- return -1;
+ {
+ int seq_len, i;
+ PyObject *item;
+ PointerRNA itemptr;
+
+ /* convert a sequence of dict's into a collection */
+ if(!PySequence_Check(value)) {
+ PyErr_SetString(PyExc_TypeError, "expected a sequence of dicts for an RNA collection");
+ return -1;
+ }
+
+ seq_len = PySequence_Length(value);
+ for(i=0; i<seq_len; i++) {
+ item= PySequence_GetItem(value, i);
+ if(item==NULL || PyDict_Check(item)==0) {
+ PyErr_SetString(PyExc_TypeError, "expected a sequence of dicts for an RNA collection");
+ Py_XDECREF(item);
+ return -1;
+ }
+
+ RNA_property_collection_add(ptr, prop, &itemptr);
+ if(pyrna_pydict_to_props(&itemptr, item, "Converting a python list to an RNA collection")==-1) {
+ Py_DECREF(item);
+ return -1;
+ }
+ Py_DECREF(item);
+ }
+
break;
+ }
default:
PyErr_SetString(PyExc_AttributeError, "unknown property type (pyrna_py_to_prop)");
return -1;
diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h
index a97d450fb2f..a2a3015912b 100644
--- a/source/blender/python/intern/bpy_rna.h
+++ b/source/blender/python/intern/bpy_rna.h
@@ -69,6 +69,7 @@ PyObject *pyrna_prop_CreatePyObject( PointerRNA *ptr, PropertyRNA *prop );
/* operators also need this to set args */
int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyObject *value);
+int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, const char *error_prefix);
PyObject * pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop);
/* functions for setting up new props - experemental */
diff --git a/source/blender/python/intern/bpy_ui.c b/source/blender/python/intern/bpy_ui.c
index bbfb04719d8..c15315ca350 100644
--- a/source/blender/python/intern/bpy_ui.c
+++ b/source/blender/python/intern/bpy_ui.c
@@ -78,7 +78,7 @@ static PyObject *Method_defButO( PyObject * self, PyObject * args )
/* Optional python doctionary used to set python properties, just like how keyword args are used */
if (py_keywords && PyDict_Size(py_keywords)) {
- if (PYOP_props_from_dict(uiButGetOperatorPtrRNA(but), py_keywords) == -1)
+ if (pyrna_pydict_to_props(uiButGetOperatorPtrRNA(but), py_keywords, "") == -1)
return NULL;
}
@@ -296,7 +296,7 @@ static PyObject *Method_registerKey( PyObject * self, PyObject * args )
/* Optional python doctionary used to set python properties, just like how keyword args are used */
if (py_keywords && PyDict_Size(py_keywords)) {
- if (PYOP_props_from_dict(km->ptr, py_keywords) == -1)
+ if (pyrna_pydict_to_props(km->ptr, py_keywords, "Registering keybinding") == -1)
return NULL;
}
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c
index 6bc88f7499b..996bf2c3b19 100644
--- a/source/blender/render/intern/source/convertblender.c
+++ b/source/blender/render/intern/source/convertblender.c
@@ -1459,7 +1459,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
if(part==NULL || pars==NULL || !psys_check_enabled(ob, psys))
return 0;
- if(part->draw_as==PART_DRAW_OB || part->draw_as==PART_DRAW_GR || part->draw_as==PART_DRAW_NOT)
+ if(part->ren_as==PART_DRAW_OB || part->ren_as==PART_DRAW_GR || part->ren_as==PART_DRAW_NOT)
return 1;
/* 2. start initialising things */
@@ -1522,7 +1522,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
sd.mcol = MEM_callocN(sd.totcol * sizeof(MCol), "particle_mcols");
/* 2.2 setup billboards */
- if(part->draw_as == PART_DRAW_BB) {
+ if(part->ren_as == PART_DRAW_BB) {
int first_uv = CustomData_get_layer_index(&psmd->dm->faceData, CD_MTFACE);
bb.uv[0] = CustomData_get_named_layer_index(&psmd->dm->faceData, CD_MTFACE, psys->bb_uvname[0]);
@@ -1577,7 +1577,7 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
Mat3Transp(nmat);
/* 2.6 setup strand rendering */
- if(part->draw_as == PART_DRAW_PATH && psys->pathcache){
+ if(part->ren_as == PART_DRAW_PATH && psys->pathcache){
path_nbr=(int)pow(2.0,(double) part->ren_step);
if(path_nbr) {
@@ -1884,10 +1884,10 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem
continue;
VECCOPY(loc,state.co);
- if(part->draw_as!=PART_DRAW_BB)
+ if(part->ren_as!=PART_DRAW_BB)
MTC_Mat4MulVecfl(re->viewmat,loc);
- switch(part->draw_as) {
+ switch(part->ren_as) {
case PART_DRAW_LINE:
sd.line = 1;
sd.time = 0.0f;
@@ -4379,7 +4379,7 @@ static int allow_render_dupli_instance(Render *re, DupliObject *dob, Object *obd
}
for(psys=obd->particlesystem.first; psys; psys=psys->next)
- if(!ELEM5(psys->part->draw_as, PART_DRAW_BB, PART_DRAW_LINE, PART_DRAW_PATH, PART_DRAW_OB, PART_DRAW_GR))
+ if(!ELEM5(psys->part->ren_as, PART_DRAW_BB, PART_DRAW_LINE, PART_DRAW_PATH, PART_DRAW_OB, PART_DRAW_GR))
return 0;
/* don't allow lamp, animated duplis, or radio render */
@@ -4402,7 +4402,7 @@ static void dupli_render_particle_set(Render *re, Object *ob, int timeoffset, in
if(ob->transflag & OB_DUPLIPARTS) {
for(psys=ob->particlesystem.first; psys; psys=psys->next) {
- if(ELEM(psys->part->draw_as, PART_DRAW_OB, PART_DRAW_GR)) {
+ if(ELEM(psys->part->ren_as, PART_DRAW_OB, PART_DRAW_GR)) {
if(enable)
psys_render_set(ob, psys, re->viewmat, re->winmat, re->winx, re->winy, timeoffset);
else
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index 09b81d69ac0..8b04d55c696 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -197,6 +197,7 @@ typedef struct wmNotifier {
#define ND_KEYS (24<<16)
#define ND_GEOM_DATA (25<<16)
#define ND_CONSTRAINT (26<<16)
+#define ND_PARTICLE (27<<16)
/* NC_MATERIAL Material */
#define ND_SHADING (30<<16)
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index e142a5f9640..53f70f6ab8f 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -773,12 +773,9 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa
case EVT_FILESELECT_OPEN:
case EVT_FILESELECT_FULL_OPEN:
{
- int filetype= FILE_BLENDER;
+ short flag =0; short display =FILE_SHORTDISPLAY; short filter =0; short sort =FILE_SORTALPHA;
char *path= RNA_string_get_alloc(handler->op->ptr, "filename", NULL, 0);
- if(RNA_struct_find_property(handler->op->ptr, "filetype"))
- filetype= RNA_int_get(handler->op->ptr, "filetype");
-
if(event->val==EVT_FILESELECT_OPEN)
ED_area_newspace(C, handler->op_area, SPACE_FILE);
else
@@ -788,7 +785,16 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa
sfile= (SpaceFile*)CTX_wm_space_data(C);
sfile->op= handler->op;
- ED_fileselect_set_params(sfile, filetype, handler->op->type->name, path, 0, FILE_SHORTDISPLAY, 0);
+ /* XXX for now take the settings from the existing (previous) filebrowser
+ should be stored in settings and passed via the operator */
+ if (sfile->params) {
+ flag = sfile->params->flag;
+ filter = sfile->params->filter;
+ display = sfile->params->display;
+ sort = sfile->params->sort;
+ }
+
+ ED_fileselect_set_params(sfile, handler->op->type->name, path, flag, display, filter, sort);
MEM_freeN(path);
action= WM_HANDLER_BREAK;
@@ -820,7 +826,12 @@ static int wm_handler_fileselect_call(bContext *C, ListBase *handlers, wmEventHa
uiPupMenuSaveOver(C, handler->op, path);
}
else {
- handler->op->type->exec(C, handler->op);
+ int retval= handler->op->type->exec(C, handler->op);
+
+ if (retval & OPERATOR_FINISHED)
+ if(G.f & G_DEBUG)
+ wm_operator_print(handler->op);
+
WM_operator_free(handler->op);
}
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index a76a9ea94bf..3b6d605df61 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -373,6 +373,96 @@ static void WM_OT_debug_menu(wmOperatorType *ot)
RNA_def_int(ot->srna, "debugval", 0, -10000, 10000, "Debug Value", "", INT_MIN, INT_MAX);
}
+/* ***************** Search menu ************************* */
+static void operator_call_cb(struct bContext *C, void *arg1, void *arg2)
+{
+ wmOperatorType *ot= arg2;
+
+ if(ot)
+ WM_operator_name_call(C, ot->idname, WM_OP_INVOKE_DEFAULT, NULL);
+}
+
+static void operator_search_cb(const struct bContext *C, void *arg, char *str, uiSearchItems *items)
+{
+ wmOperatorType *ot = WM_operatortype_first();
+
+ for(; ot; ot= ot->next) {
+
+ if(BLI_strcasestr(ot->name, str)) {
+ if(ot->poll==NULL || ot->poll((bContext *)C)) {
+ char name[256];
+ int len= strlen(ot->name);
+
+ /* display name for menu, can hold hotkey */
+ BLI_strncpy(name, ot->name, 256);
+
+ /* check for hotkey */
+ if(len < 256-6) {
+ if(WM_key_event_operator_string(C, ot->idname, WM_OP_EXEC_DEFAULT, NULL, &name[len+1], 256-len-1))
+ name[len]= '|';
+ }
+
+ if(0==uiSearchItemAdd(items, name, ot))
+ break;
+ }
+ }
+ }
+}
+
+static uiBlock *wm_block_search_menu(bContext *C, ARegion *ar, void *arg_op)
+{
+ static char search[256]= "";
+ wmEvent event;
+ wmWindow *win= CTX_wm_window(C);
+ uiBlock *block;
+ uiBut *but;
+
+ block= uiBeginBlock(C, ar, "_popup", UI_EMBOSS);
+ uiBlockSetFlag(block, UI_BLOCK_LOOP|UI_BLOCK_RET_1);
+
+ but= uiDefSearchBut(block, search, 0, ICON_VIEWZOOM, 256, 10, 10, 180, 19, "");
+ uiButSetSearchFunc(but, operator_search_cb, NULL, operator_call_cb);
+
+ /* fake button, it holds space for search items */
+ uiDefBut(block, LABEL, 0, "", 10, 10 - uiSearchBoxhHeight(), 180, uiSearchBoxhHeight(), NULL, 0, 0, 0, 0, NULL);
+
+ uiPopupBoundsBlock(block, 6.0f, 0, -20); /* move it downwards, mouse over button */
+ uiEndBlock(C, block);
+
+ event= *(win->eventstate); /* XXX huh huh? make api call */
+ event.type= EVT_BUT_OPEN;
+ event.val= KM_PRESS;
+ event.customdata= but;
+ event.customdatafree= FALSE;
+ wm_event_add(win, &event);
+
+ return block;
+}
+
+static int wm_search_menu_exec(bContext *C, wmOperator *op)
+{
+
+ return OPERATOR_FINISHED;
+}
+
+static int wm_search_menu_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+
+ uiPupBlock(C, wm_block_search_menu, op);
+
+ return OPERATOR_CANCELLED;
+}
+
+static void WM_OT_search_menu(wmOperatorType *ot)
+{
+ ot->name= "Search Menu";
+ ot->idname= "WM_OT_search_menu";
+
+ ot->invoke= wm_search_menu_invoke;
+ ot->exec= wm_search_menu_exec;
+ ot->poll= WM_operator_winactive;
+}
+
/* ************ window / screen operator definitions ************** */
@@ -1437,6 +1527,7 @@ void wm_operatortype_init(void)
WM_operatortype_append(WM_OT_save_mainfile);
WM_operatortype_append(WM_OT_ten_timer);
WM_operatortype_append(WM_OT_debug_menu);
+ WM_operatortype_append(WM_OT_search_menu);
}
/* default keymap for windows and screens, only call once per WM */
@@ -1461,6 +1552,7 @@ void wm_window_keymap(wmWindowManager *wm)
/* debug/testing */
WM_keymap_verify_item(keymap, "WM_OT_ten_timer", TKEY, KM_PRESS, KM_ALT|KM_CTRL, 0);
WM_keymap_verify_item(keymap, "WM_OT_debug_menu", DKEY, KM_PRESS, KM_ALT|KM_CTRL, 0);
+ WM_keymap_verify_item(keymap, "WM_OT_search_menu", FKEY, KM_PRESS, KM_ALT|KM_CTRL, 0);
}
diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h
index 4de7f645bfa..39c267b132c 100644
--- a/source/blender/windowmanager/wm_event_types.h
+++ b/source/blender/windowmanager/wm_event_types.h
@@ -238,6 +238,7 @@
#define EVT_FILESELECT_EXEC 3
#define EVT_FILESELECT_CANCEL 4
+#define EVT_BUT_OPEN 0x5021
#endif /* WM_EVENT_TYPES_H */