diff options
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/makesrna.c | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_access.c | 31 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_internal.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_object_force.c | 105 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_particle.c | 94 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_radio.c | 140 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_space.c | 25 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_wm.c | 202 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_world.c | 2 |
10 files changed, 418 insertions, 187 deletions
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 18734fbcb18..9ece6684cd8 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -1854,7 +1854,6 @@ RNAProcessItem PROCESS_ITEMS[]= { {"rna_particle.c", NULL, RNA_def_particle}, {"rna_pose.c", NULL, RNA_def_pose}, {"rna_property.c", NULL, RNA_def_gameproperty}, - {"rna_radio.c", NULL, RNA_def_radio}, {"rna_scene.c", NULL, RNA_def_scene}, {"rna_screen.c", NULL, RNA_def_screen}, {"rna_scriptlink.c", NULL, RNA_def_scriptlink}, diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index ba893319ce9..13686809cd2 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -669,6 +669,28 @@ int RNA_property_enum_value(PointerRNA *ptr, PropertyRNA *prop, const char *iden return 0; } +int RNA_enum_identifier(const EnumPropertyItem *item, const int value, const char **identifier) +{ + for (; item->identifier; item++) { + if(item->value==value) { + *identifier = item->identifier; + return 1; + } + } + return 0; +} + +int RNA_enum_name(const EnumPropertyItem *item, const int value, const char **name) +{ + for (; item->identifier; item++) { + if(item->value==value) { + *name = item->name; + return 1; + } + } + return 0; +} + int RNA_property_enum_identifier(PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier) { const EnumPropertyItem *item; @@ -676,14 +698,7 @@ int RNA_property_enum_identifier(PointerRNA *ptr, PropertyRNA *prop, const int v RNA_property_enum_items(ptr, prop, &item, &totitem); - for(i=0; i<totitem; i++) { - if(item[i].value==value) { - *identifier = item[i].identifier; - return 1; - } - } - - return 0; + return RNA_enum_identifier(item, value, identifier); } const char *RNA_property_ui_name(PropertyRNA *prop) diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index a3d5c4fe388..c2f2e1d519f 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -146,7 +146,6 @@ void RNA_def_object_force(struct BlenderRNA *brna); void RNA_def_packedfile(struct BlenderRNA *brna); void RNA_def_particle(struct BlenderRNA *brna); void RNA_def_pose(struct BlenderRNA *brna); -void RNA_def_radio(struct BlenderRNA *brna); void RNA_def_rna(struct BlenderRNA *brna); void RNA_def_scene(struct BlenderRNA *brna); void RNA_def_screen(struct BlenderRNA *brna); diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index d144ed5f28b..bc3f0733a0d 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -32,8 +32,87 @@ #include "DNA_object_types.h" #include "DNA_object_force.h" +#include "WM_types.h" + #ifdef RNA_RUNTIME +#include "MEM_guardedalloc.h" + +#include "BKE_context.h" +#include "BKE_pointcache.h" + +#include "BLI_blenlib.h" + +static void rna_Cache_toggle_disk_cache(bContext *C, PointerRNA *ptr) +{ + Object *ob = CTX_data_active_object(C); + PointCache *cache = (PointCache*)ptr->data; + PTCacheID *pid = NULL; + ListBase pidlist; + + if(!ob) + return; + + BKE_ptcache_ids_from_object(&pidlist, ob); + + for(pid=pidlist.first; pid; pid=pid->next) { + if(pid->cache==cache) + break; + } + + if(pid) + BKE_ptcache_toggle_disk_cache(pid); + + BLI_freelistN(&pidlist); +} + +static void rna_Cache_idname_change(bContext *C, PointerRNA *ptr) +{ + Object *ob = CTX_data_active_object(C); + PointCache *cache = (PointCache*)ptr->data; + PTCacheID *pid = NULL, *pid2; + ListBase pidlist; + int new_name = 1; + char name[80]; + + if(!ob) + return; + + /* TODO: check for proper characters */ + + BKE_ptcache_ids_from_object(&pidlist, ob); + + for(pid=pidlist.first; pid; pid=pid->next) { + if(pid->cache==cache) + pid2 = pid; + else if(strcmp(cache->name, "") && strcmp(cache->name,pid->cache->name)==0) { + /*TODO: report "name exists" to user */ + strcpy(cache->name, cache->prev_name); + new_name = 0; + } + } + + if(new_name) { + if(pid2 && cache->flag & PTCACHE_DISK_CACHE) { + strcpy(name, cache->name); + strcpy(cache->name, cache->prev_name); + + cache->flag &= ~PTCACHE_DISK_CACHE; + + BKE_ptcache_toggle_disk_cache(pid2); + + strcpy(cache->name, name); + + cache->flag |= PTCACHE_DISK_CACHE; + + BKE_ptcache_toggle_disk_cache(pid2); + } + + strcpy(cache->prev_name, cache->name); + } + + BLI_freelistN(&pidlist); +} #else static void rna_def_pointcache(BlenderRNA *brna) @@ -60,6 +139,32 @@ static void rna_def_pointcache(BlenderRNA *brna) prop= RNA_def_property(srna, "baking", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_BAKING); + + prop= RNA_def_property(srna, "disk_cache", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_DISK_CACHE); + RNA_def_property_ui_text(prop, "Disk Cache", "Save cache files to disk"); + RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_toggle_disk_cache"); + + prop= RNA_def_property(srna, "outdated", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_OUTDATED); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Cache is outdated", ""); + + 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", "Cache name"); + RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change"); + + prop= RNA_def_property(srna, "autocache", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_AUTOCACHE); + RNA_def_property_ui_text(prop, "Auto Cache", "Cache changes automatically"); + //RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_toggle_autocache"); + + prop= RNA_def_property(srna, "info", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "info"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Cache Info", "Info on current cache status."); + } static void rna_def_collision(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 8ee71b6fd9e..c48c1006588 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -38,6 +38,7 @@ #include "DNA_scene_types.h" #include "WM_types.h" +#include "WM_api.h" #ifdef RNA_RUNTIME @@ -45,48 +46,93 @@ #include "BKE_depsgraph.h" #include "BKE_particle.h" +#include "BLI_arithb.h" + +/* property update functions */ static void rna_Particle_redo(bContext *C, PointerRNA *ptr) { + Scene *scene = CTX_data_scene(C); ParticleSettings *part; - if(ptr->type==&RNA_ParticleSystem) - part = ((ParticleSystem*)ptr->data)->part; - else + if(ptr->type==&RNA_ParticleSystem) { + ParticleSystem *psys = (ParticleSystem*)ptr->data; + Object *ob = psys_find_object(scene, psys); + + psys->recalc = PSYS_RECALC_REDO; + + if(ob) + DAG_object_flush_update(scene, ob, OB_RECALC_DATA); + } + else { part = ptr->id.data; - - psys_flush_particle_settings(CTX_data_scene(C), part, PSYS_RECALC_REDO); + psys_flush_particle_settings(scene, part, PSYS_RECALC_REDO); + } } static void rna_Particle_reset(bContext *C, PointerRNA *ptr) { + Scene *scene = CTX_data_scene(C); 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); + if(ptr->type==&RNA_ParticleSystem) { + ParticleSystem *psys = (ParticleSystem*)ptr->data; + Object *ob = psys_find_object(scene, psys); + + psys->recalc = PSYS_RECALC_RESET; + + if(ob) { + DAG_object_flush_update(scene, ob, OB_RECALC_DATA); + //WM_event_add_notifier(C, NC_SCENE|ND_CACHE_PHYSICS, scene); + } + } + else { + part = ptr->id.data; + psys_flush_particle_settings(scene, part, PSYS_RECALC_RESET); + //WM_event_add_notifier(C, NC_SCENE|ND_CACHE_PHYSICS, scene); + } } static void rna_Particle_change_type(bContext *C, PointerRNA *ptr) { + Scene *scene = CTX_data_scene(C); 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); + if(ptr->type==&RNA_ParticleSystem) { + ParticleSystem *psys = (ParticleSystem*)ptr->data; + Object *ob = psys_find_object(scene, psys); + + psys->recalc = PSYS_RECALC_RESET|PSYS_RECALC_TYPE; + + if(ob) { + DAG_object_flush_update(scene, ob, OB_RECALC_DATA); + //WM_event_add_notifier(C, NC_SCENE|ND_CACHE_PHYSICS, scene); + } + } + else { + part = ptr->id.data; + psys_flush_particle_settings(scene, part, PSYS_RECALC_RESET|PSYS_RECALC_TYPE); + //WM_event_add_notifier(C, NC_SCENE|ND_CACHE_PHYSICS, scene); + } } static void rna_Particle_redo_child(bContext *C, PointerRNA *ptr) { + Scene *scene = CTX_data_scene(C); ParticleSettings *part; - if(ptr->type==&RNA_ParticleSystem) - part = ((ParticleSystem*)ptr->data)->part; - else + + if(ptr->type==&RNA_ParticleSystem) { + ParticleSystem *psys = (ParticleSystem*)ptr->data; + Object *ob = psys_find_object(scene, psys); + + psys->recalc = PSYS_RECALC_CHILD; + + if(ob) + DAG_object_flush_update(scene, ob, OB_RECALC_DATA); + } + else { part = ptr->id.data; - psys_flush_particle_settings(CTX_data_scene(C), part, PSYS_RECALC_CHILD); + psys_flush_particle_settings(scene, part, PSYS_RECALC_CHILD); + } } static void rna_PartSettings_start_set(struct PointerRNA *ptr, float value) { @@ -887,7 +933,7 @@ 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"); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_reset"); prop= RNA_def_property(srna, "material", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "omat"); @@ -1669,6 +1715,14 @@ static void rna_def_particle_system(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "pointcache"); RNA_def_property_struct_type(prop, "PointCache"); RNA_def_property_ui_text(prop, "Point Cache", ""); + + /* offset ob */ + prop= RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "parent"); + RNA_def_property_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Parent", "Use this object's coordinate system instead of global coordinate system."); + RNA_def_property_update(prop, NC_OBJECT|ND_PARTICLE, "rna_Particle_redo"); + } void RNA_def_particle(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_radio.c b/source/blender/makesrna/intern/rna_radio.c deleted file mode 100644 index 8b862b4c535..00000000000 --- a/source/blender/makesrna/intern/rna_radio.c +++ /dev/null @@ -1,140 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * Contributor(s): Blender Foundation (2008). - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include <stdlib.h> - -#include "RNA_define.h" -#include "RNA_types.h" - -#include "rna_internal.h" - -#include "DNA_radio_types.h" - -#ifdef RNA_RUNTIME - -#else - -void RNA_def_radio(BlenderRNA *brna) -{ - StructRNA *srna; - PropertyRNA *prop; - static EnumPropertyItem prop_drawtype_items[] = { - {RAD_WIREFRAME, "WIREFRAME", 0, "Wireframe", "Enables Wireframe draw mode"}, - {RAD_SOLID, "SOLID", 0, "Solid", "Enables Solid draw mode"}, - {RAD_GOURAUD, "GOURAUD", 0, "Gouraud", "Enables Gouraud draw mode"}, - {0, NULL, 0, NULL, NULL}}; - - srna= RNA_def_struct(brna, "Radiosity", NULL); - RNA_def_struct_ui_text(srna, "Radiosity", "Settings for radiosity simulation of indirect diffuse lighting."); - RNA_def_struct_sdna(srna, "Radio"); - - /* Enums */ - prop= RNA_def_property(srna, "draw_mode", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_sdna(prop, NULL, "drawtype"); - RNA_def_property_enum_items(prop, prop_drawtype_items); - RNA_def_property_ui_text(prop, "Draw Mode", "Radiosity draw modes."); - - /* Number values */ - prop= RNA_def_property(srna, "hemi_resolution", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "hemires"); - RNA_def_property_range(prop, 100, 1000); - RNA_def_property_ui_text(prop, "Hemi Resolution", "Sets the size of a hemicube."); - - prop= RNA_def_property(srna, "max_iterations", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "maxiter"); - RNA_def_property_range(prop, 0, 10000); - RNA_def_property_ui_text(prop, "Max Iterations", "Limits the maximum number of radiosity rounds."); - - prop= RNA_def_property(srna, "multiplier", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "radfac"); - RNA_def_property_range(prop, 0.001f, 250.0f); - RNA_def_property_ui_text(prop, "Multiplier", "Multiplies the energy values."); - - prop= RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "gamma"); - RNA_def_property_range(prop, 0.2f, 10.0f); - RNA_def_property_ui_text(prop, "Gamma", "Changes the contrast of the energy values."); - - prop= RNA_def_property(srna, "convergence", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "convergence"); - RNA_def_property_range(prop, 0.0f, 1.0f); - RNA_def_property_ui_text(prop, "Convergence", "Sets the lower threshold of unshot energy."); - - prop= RNA_def_property(srna, "element_max", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "elma"); - RNA_def_property_range(prop, 1, 500); - RNA_def_property_ui_text(prop, "Element Max", "Sets maximum size of an element"); - - prop= RNA_def_property(srna, "element_min", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "elmi"); - RNA_def_property_range(prop, 1, 100); - RNA_def_property_ui_text(prop, "Element Min", "Sets minimum size of an element"); - - prop= RNA_def_property(srna, "patch_max", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "pama"); - RNA_def_property_range(prop, 10, 1000); - RNA_def_property_ui_text(prop, "Patch Max", "Sets maximum size of a patch."); - - prop= RNA_def_property(srna, "patch_min", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "pami"); - RNA_def_property_range(prop, 10, 1000); - RNA_def_property_ui_text(prop, "Patch Min", "Sets minimum size of a patch."); - - prop= RNA_def_property(srna, "subshoot_patch", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "subshootp"); - RNA_def_property_range(prop, 0, 10); - RNA_def_property_ui_text(prop, "SubShoot Patch", "Sets the number of times the environment is tested to detect paths."); - - prop= RNA_def_property(srna, "subshoot_element", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "subshoote"); - RNA_def_property_range(prop, 0, 10); - RNA_def_property_ui_text(prop, "SubShoot Element", "Sets the number of times the environment is tested to detect elements."); - - prop= RNA_def_property(srna, "max_elements", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "maxnode"); - RNA_def_property_range(prop, 1, 250000); - RNA_def_property_ui_text(prop, "Max Elements", "Sets the maximum allowed number of elements."); - - prop= RNA_def_property(srna, "max_subdiv_shoot", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "maxsublamp"); - RNA_def_property_range(prop, 1, 250); - RNA_def_property_ui_text(prop, "Max Subdiv Shoot", "Sets the maximum number of initial shoot patches that are evaluated"); - - prop= RNA_def_property(srna, "remove_doubles_limit", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "nodelim"); - RNA_def_property_range(prop, 0, 50); - RNA_def_property_ui_text(prop, "Remove Doubles Limit", "Sets the range for removing doubles"); - - /* flag */ - prop= RNA_def_property(srna, "show_limits", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", RAD_SHOWLIMITS); - RNA_def_property_ui_text(prop, "Show Limits", "Draws patch and element limits"); - - prop= RNA_def_property(srna, "show_z", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", RAD_SHOWZ); - RNA_def_property_ui_text(prop, "Show Z", "Draws limits differently"); -} - -#endif - diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 1365ab75fc7..5d4916bb3c6 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -923,10 +923,6 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "ed"); RNA_def_property_struct_type(prop, "SequenceEditor"); RNA_def_property_ui_text(prop, "Sequence Editor", ""); - - prop= RNA_def_property(srna, "radiosity", PROP_POINTER, PROP_NONE); - RNA_def_property_pointer_sdna(prop, NULL, "radio"); - RNA_def_property_ui_text(prop, "Radiosity", ""); prop= RNA_def_property(srna, "keyingsets", PROP_COLLECTION, PROP_NONE); RNA_def_property_collection_sdna(prop, NULL, "keyingsets", NULL); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index d4f7c5b0bd1..ce31cb27c9a 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -575,18 +575,17 @@ static void rna_def_space_buttons(BlenderRNA *brna) PropertyRNA *prop; static EnumPropertyItem buttons_context_items[] = { - {BCONTEXT_SCENE, "SCENE", 0, "Scene", ""}, - {BCONTEXT_WORLD, "WORLD", 0, "World", ""}, - {BCONTEXT_OBJECT, "OBJECT", 0, "Object", ""}, - {BCONTEXT_DATA, "DATA", 0, "Data", ""}, - {BCONTEXT_MATERIAL, "MATERIAL", 0, "Material", ""}, - {BCONTEXT_TEXTURE, "TEXTURE", 0, "Texture", ""}, - {BCONTEXT_PARTICLE, "PARTICLE", 0, "Particle", ""}, - {BCONTEXT_PHYSICS, "PHYSICS", 0, "Physics", ""}, - {BCONTEXT_GAME, "GAME", 0, "Game", ""}, - {BCONTEXT_BONE, "BONE", 0, "Bone", ""}, - {BCONTEXT_MODIFIER, "MODIFIER", 0, "Modifier", ""}, - {BCONTEXT_CONSTRAINT, "CONSTRAINT", 0, "Constraint", ""}, + {BCONTEXT_SCENE, "SCENE", ICON_SCENE, "Scene", "Scene"}, + {BCONTEXT_WORLD, "WORLD", ICON_WORLD, "World", "World"}, + {BCONTEXT_OBJECT, "OBJECT", ICON_OBJECT_DATA, "Object", "Object"}, + {BCONTEXT_CONSTRAINT, "CONSTRAINT", ICON_CONSTRAINT, "Constraint", "Constraint"}, + {BCONTEXT_MODIFIER, "MODIFIER", ICON_MODIFIER, "Modifier", "Modifier"}, + {BCONTEXT_DATA, "DATA", 0, "Data", "Data"}, + {BCONTEXT_BONE, "BONE", ICON_BONE_DATA, "Bone", "Bone"}, + {BCONTEXT_MATERIAL, "MATERIAL", ICON_MATERIAL, "Material", "Material"}, + {BCONTEXT_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture"}, + {BCONTEXT_PARTICLE, "PARTICLE", ICON_PARTICLES, "Particle", "Particle"}, + {BCONTEXT_PHYSICS, "PHYSICS", ICON_PHYSICS, "Physics", "Physics"}, {0, NULL, 0, NULL, NULL}}; static EnumPropertyItem panel_alignment_items[] = { @@ -602,11 +601,13 @@ static void rna_def_space_buttons(BlenderRNA *brna) 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"); + RNA_def_property_update(prop, NC_WINDOW, NULL); 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"); + RNA_def_property_update(prop, NC_WINDOW, NULL); /* pinned data */ prop= RNA_def_property(srna, "pin_id", PROP_POINTER, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index df07e03850a..a1b51084fca 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -30,6 +30,120 @@ #include "rna_internal.h" #include "DNA_windowmanager_types.h" +#include "WM_types.h" /* wmEvent */ + + +EnumPropertyItem event_value_items[] = { + {KM_ANY, "ANY", 0, "Any", ""}, + {KM_NOTHING, "NOTHING", 0, "Nothing", ""}, + {KM_PRESS, "PRESS", 0, "Press", ""}, + {KM_RELEASE, "RELEASE", 0, "Release", ""}, + {0, NULL, 0, NULL, NULL}}; + +/* not returned: CAPSLOCKKEY, UNKNOWNKEY, COMMANDKEY, GRLESSKEY */ +EnumPropertyItem event_type_items[] = { + {AKEY, "A", 0, "A", ""}, + {BKEY, "B", 0, "B", ""}, + {CKEY, "C", 0, "C", ""}, + {DKEY, "D", 0, "D", ""}, + {EKEY, "E", 0, "E", ""}, + {FKEY, "F", 0, "F", ""}, + {GKEY, "G", 0, "G", ""}, + {HKEY, "H", 0, "H", ""}, + {IKEY, "I", 0, "I", ""}, + {JKEY, "J", 0, "J", ""}, + {KKEY, "K", 0, "K", ""}, + {LKEY, "L", 0, "L", ""}, + {MKEY, "M", 0, "M", ""}, + {NKEY, "N", 0, "N", ""}, + {OKEY, "O", 0, "O", ""}, + {PKEY, "P", 0, "P", ""}, + {QKEY, "Q", 0, "Q", ""}, + {RKEY, "R", 0, "R", ""}, + {SKEY, "S", 0, "S", ""}, + {TKEY, "T", 0, "T", ""}, + {UKEY, "U", 0, "U", ""}, + {VKEY, "V", 0, "V", ""}, + {WKEY, "W", 0, "W", ""}, + {XKEY, "X", 0, "X", ""}, + {YKEY, "Y", 0, "Y", ""}, + {ZKEY, "Z", 0, "Z", ""}, + + {ZEROKEY, "ZERO", 0, "Zero Key", ""}, + {ONEKEY, "ONE", 0, "One Key", ""}, + {TWOKEY, "TWO", 0, "Two Key", ""}, + {THREEKEY, "THREE", 0, "Three Key", ""}, + {FOURKEY, "FOUR", 0, "Four Key", ""}, + {FIVEKEY, "FIVE", 0, "Five Key", ""}, + {SIXKEY, "SIX", 0, "Six Key", ""}, + {SEVENKEY, "SEVEN", 0, "Seven Key", ""}, + {EIGHTKEY, "EIGHT", 0, "Eight Key", ""}, + {NINEKEY, "NINE", 0, "Nine Key", ""}, + + {LEFTCTRLKEY, "LEFT_CTRL", 0, "Left Ctrl", ""}, + {LEFTALTKEY, "LEFT_ALT", 0, "Left Alt", ""}, + {RIGHTALTKEY, "RIGHT_ALT", 0, "Right Alt", ""}, + {RIGHTCTRLKEY, "RIGHT_CTRL", 0, "Rightctrl", ""}, + {RIGHTSHIFTKEY, "RIGHT_SHIFT", 0, "Rightshift", ""}, + {LEFTSHIFTKEY, "LEFT_SHIFT", 0, "Leftshift", ""}, + + {ESCKEY, "ESC", 0, "Esc", ""}, + {TABKEY, "TAB", 0, "Tab", ""}, + {RETKEY, "RET", 0, "Return", ""}, + {SPACEKEY, "SPACE", 0, "Spacebar", ""}, + {LINEFEEDKEY, "LINE_FEED", 0, "Line Feed", ""}, + {BACKSPACEKEY, "BACK_SPACE", 0, "Back Space", ""}, + {DELKEY, "DEL", 0, "Delete", ""}, + {SEMICOLONKEY, "SEMI_COLON", 0, "Semicolon", ""}, + {PERIODKEY, "PERIOD", 0, "Period", ""}, + {COMMAKEY, "COMMA", 0, "Comma", ""}, + {QUOTEKEY, "QUOTE", 0, "Quote", ""}, + {ACCENTGRAVEKEY, "ACCENT_GRAVE", 0, "Accentgrave", ""}, + {MINUSKEY, "MINUS", 0, "Minus", ""}, + {SLASHKEY, "SLASH", 0, "Slash", ""}, + {BACKSLASHKEY, "BACK_SLASH", 0, "Backslash", ""}, + {EQUALKEY, "EQUAL", 0, "Equal", ""}, + {LEFTBRACKETKEY, "LEFT_BRACKET", 0, "Leftbracket", ""}, + {RIGHTBRACKETKEY, "RIGHT_BRACKET", 0, "Rightbracket", ""}, + {LEFTARROWKEY, "LEFT_ARROW", 0, "Left Arrow", ""}, + {DOWNARROWKEY, "DOWN_ARROW", 0, "Down Arrow", ""}, + {RIGHTARROWKEY, "RIGHT_ARROW", 0, "Right Arrow", ""}, + {UPARROWKEY, "UP_ARROW", 0, "Up Arrow", ""}, + {PAD2, "NUMPAD_2", 0, "Numpad 2", ""}, + {PAD4, "NUMPAD_4", 0, "Numpad 4", ""}, + {PAD6, "NUMPAD_6", 0, "Numpad 6", ""}, + {PAD8, "NUMPAD_8", 0, "Numpad 8", ""}, + {PAD1, "NUMPAD_1", 0, "Numpad 1", ""}, + {PAD3, "NUMPAD_3", 0, "Numpad 3", ""}, + {PAD5, "NUMPAD_5", 0, "Numpad 5", ""}, + {PAD7, "NUMPAD_7", 0, "Numpad 7", ""}, + {PAD9, "NUMPAD_9", 0, "Numpad 9", ""}, + {PADPERIOD, "NUMPAD_PERIOD", 0, "Numpad .", ""}, + {PADSLASHKEY, "NUMPAD_SLASH", 0, "Numpad /", ""}, + {PADASTERKEY, "NUMPAD_ASTERIX", 0, "Numpad *", ""}, + {PAD0, "NUMPAD_0", 0, "Numpad 0", ""}, + {PADMINUS, "NUMPAD_MINUS", 0, "Numpad -", ""}, + {PADENTER, "NUMPAD_ENTER", 0, "Numpad Enter", ""}, + {PADPLUSKEY, "NUMPAD_PLUS", 0, "Numpad +", ""}, + {F1KEY, "F1", 0, "F1", ""}, + {F2KEY, "F2", 0, "F2", ""}, + {F3KEY, "F3", 0, "F3", ""}, + {F4KEY, "F4", 0, "F4", ""}, + {F5KEY, "F5", 0, "F5", ""}, + {F6KEY, "F6", 0, "F6", ""}, + {F7KEY, "F7", 0, "F7", ""}, + {F8KEY, "F8", 0, "F8", ""}, + {F9KEY, "F9", 0, "F9", ""}, + {F10KEY, "F10", 0, "F10", ""}, + {F11KEY, "F11", 0, "F11", ""}, + {F12KEY, "F12", 0, "F12", ""}, + {PAUSEKEY, "PAUSE", 0, "Pause", ""}, + {INSERTKEY, "INSERT", 0, "Insert", ""}, + {HOMEKEY, "HOME", 0, "Home", ""}, + {PAGEUPKEY, "PAGE_UP", 0, "Page Up", ""}, + {PAGEDOWNKEY, "PAGE_DOWN", 0, "Page Down", ""}, + {ENDKEY, "END", 0, "End", ""}, + {0, NULL, 0, NULL, NULL}}; #ifdef RNA_RUNTIME @@ -87,6 +201,20 @@ static PointerRNA rna_Operator_properties_get(PointerRNA *ptr) return rna_pointer_inherit_refine(ptr, &RNA_OperatorProperties, op->properties); } + +static int rna_Event_ascii_get(PointerRNA *ptr, char *value) +{ + wmEvent *event= (wmEvent*)ptr->id.data; + value[0]= event->ascii; + value[1]= '\0'; +} + +static int rna_Event_ascii_length(PointerRNA *ptr) +{ + wmEvent *event= (wmEvent*)ptr->id.data; + return (event->ascii)? 1 : 0; +} + #else static void rna_def_operator(BlenderRNA *brna) @@ -146,7 +274,80 @@ static void rna_def_operator_filelist_element(BlenderRNA *brna) 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_event(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna= RNA_def_struct(brna, "Event", NULL); + RNA_def_struct_ui_text(srna, "Event", "Window Manager Event"); + RNA_def_struct_sdna(srna, "wmEvent"); + + /* strings */ + prop= RNA_def_property(srna, "ascii", PROP_STRING, PROP_NONE); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_string_funcs(prop, "rna_Event_ascii_get", "rna_Event_ascii_length", NULL); + RNA_def_property_ui_text(prop, "ASCII", "Single ASCII character for this event."); + + + /* enums */ + prop= RNA_def_property(srna, "value", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "val"); + RNA_def_property_enum_items(prop, event_value_items); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Value", "The type of event, only applies to some."); + + prop= RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "type"); + RNA_def_property_enum_items(prop, event_type_items); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Type", ""); + + + /* mouse */ + prop= RNA_def_property(srna, "mouse_x", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "x"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Mouse X Position", "The window relative vertical location of the mouse."); + + prop= RNA_def_property(srna, "mouse_y", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "y"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Mouse Y Position", "The window relative horizontal location of the mouse."); + + prop= RNA_def_property(srna, "mouse_prev_x", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "prevx"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Mouse Previous X Position", "The window relative vertical location of the mouse."); + + prop= RNA_def_property(srna, "mouse_prev_y", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "prevy"); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Mouse Previous Y Position", "The window relative horizontal location of the mouse."); + + /* modifiers */ + prop= RNA_def_property(srna, "shift", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "shift", 1); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Shift", "True when the shift key is held."); + + prop= RNA_def_property(srna, "ctrl", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "ctrl", 1); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Ctrl", "True when the shift key is held."); + + prop= RNA_def_property(srna, "alt", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "alt", 1); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "Alt", "True when the shift key is held."); + + prop= RNA_def_property(srna, "oskey", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "oskey", 1); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_ui_text(prop, "OS Key", "True when the shift key is held."); +} static void rna_def_windowmanager(BlenderRNA *brna) { @@ -169,6 +370,7 @@ void RNA_def_wm(BlenderRNA *brna) rna_def_operator(brna); rna_def_operator_utils(brna); rna_def_operator_filelist_element(brna); + rna_def_event(brna); rna_def_windowmanager(brna); } diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c index 4dba61411f0..f5eb81e3cea 100644 --- a/source/blender/makesrna/intern/rna_world.c +++ b/source/blender/makesrna/intern/rna_world.c @@ -337,7 +337,7 @@ void RNA_def_world(BlenderRNA *brna) static EnumPropertyItem physics_engine_items[] = { {WOPHY_NONE, "NONE", 0, "None", ""}, //{WOPHY_ENJI, "ENJI", 0, "Enji", ""}, - {WOPHY_SUMO, "SUMO", 0, "Sumo (Deprecated)", ""}, + //{WOPHY_SUMO, "SUMO", 0, "Sumo (Deprecated)", ""}, //{WOPHY_DYNAMO, "DYNAMO", 0, "Dynamo", ""}, //{WOPHY_ODE, "ODE", 0, "ODE", ""}, {WOPHY_BULLET, "BULLET", 0, "Bullet", ""}, |