diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_scene.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 130 |
1 files changed, 87 insertions, 43 deletions
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index e434fad5ff1..02665cf9b90 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -151,8 +151,14 @@ EnumPropertyItem image_type_items[] = { #include "DNA_object_types.h" #include "DNA_mesh_types.h" +#include "RNA_access.h" + #include "MEM_guardedalloc.h" +#include "BLI_threads.h" +#include "BLI_editVert.h" +#include "BLI_blenlib.h" + #include "BKE_context.h" #include "BKE_global.h" #include "BKE_image.h" @@ -167,10 +173,6 @@ EnumPropertyItem image_type_items[] = { #include "BKE_screen.h" #include "BKE_animsys.h" -#include "BLI_threads.h" -#include "BLI_editVert.h" -#include "BLI_blenlib.h" - #include "WM_api.h" #include "ED_info.h" @@ -181,6 +183,21 @@ EnumPropertyItem image_type_items[] = { #include "RE_pipeline.h" +static int rna_Scene_object_bases_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr) +{ + Scene *scene= (Scene*)ptr->data; + Base *base; + + for(base= scene->base.first; base; base= base->next) { + if(strncmp(base->object->id.name+2, key, sizeof(base->object->id.name)-2)==0) { + *r_ptr= rna_pointer_inherit_refine(ptr, &RNA_ObjectBase, base); + return TRUE; + } + } + + return FALSE; +} + static PointerRNA rna_Scene_objects_get(CollectionPropertyIterator *iter) { ListBaseIterator *internal= iter->internal; @@ -209,7 +226,7 @@ static Base *rna_Scene_object_link(Scene *scene, bContext *C, ReportList *report if(scene == scene_act) ob->lay= base->lay; - ob->recalc |= OB_RECALC_ALL; + ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME; /* slows down importers too much, run scene.update() */ /* DAG_scene_sort(G.main, scene); */ @@ -298,6 +315,12 @@ static void rna_Scene_view3d_update(Main *bmain, Scene *unused, PointerRNA *ptr) BKE_screen_view3d_main_sync(&bmain->screen, scene); } +static void rna_Scene_framelen_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + scene->r.framelen= (float)scene->r.framapto/(float)scene->r.images; +} + + static void rna_Scene_current_frame_set(PointerRNA *ptr, int value) { Scene *data= (Scene*)ptr->data; @@ -404,7 +427,7 @@ static int rna_Scene_active_keying_set_index_get(PointerRNA *ptr) } /* get KeyingSet index stuff for list of Keying Sets editing UI - * - value+1 since 0 is reserved for 'none'= + * - value+1 since 0 is reserved for 'none' */ static void rna_Scene_active_keying_set_index_set(PointerRNA *ptr, int value) { @@ -710,7 +733,7 @@ static void rna_Scene_glsl_update(Main *bmain, Scene *unused, PointerRNA *ptr) { Scene *scene= (Scene*)ptr->id.data; - DAG_id_flush_update(&scene->id, 0); + DAG_id_tag_update(&scene->id, 0); } static void rna_RenderSettings_color_management_update(Main *bmain, Scene *unused, PointerRNA *ptr) @@ -859,10 +882,10 @@ static void object_simplify_update(Object *ob) static void rna_Scene_use_simplify_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - Scene *sce; + Scene *sce_iter; Base *base; - for(SETLOOPER(scene, base)) + for(SETLOOPER(scene, sce_iter, base)) object_simplify_update(base->object); DAG_ids_flush_update(bmain, 0); @@ -918,7 +941,7 @@ static void rna_GameSettings_auto_start_set(PointerRNA *ptr, int value) } -static TimeMarker *rna_TimeLine_add(Scene *scene, char name[]) +static TimeMarker *rna_TimeLine_add(Scene *scene, const char name[]) { TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker"); marker->flag= SELECT; @@ -940,7 +963,7 @@ static void rna_TimeLine_remove(Scene *scene, ReportList *reports, TimeMarker *m MEM_freeN(marker); } -static KeyingSet *rna_Scene_keying_set_new(Scene *sce, ReportList *reports, char name[]) +static KeyingSet *rna_Scene_keying_set_new(Scene *sce, ReportList *reports, const char name[]) { KeyingSet *ks= NULL; @@ -964,7 +987,7 @@ static void rna_def_transform_orientation(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - int matrix_dimsize[]= {3, 3}; + const int matrix_dimsize[]= {3, 3}; srna= RNA_def_struct(brna, "TransformOrientation", NULL); @@ -1065,6 +1088,11 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Proportional Editing Falloff", "Falloff type for proportional editing mode"); RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */ + prop= RNA_def_property(srna, "proportional_size", PROP_FLOAT, PROP_DISTANCE); + RNA_def_property_float_sdna(prop, NULL, "proportional_size"); + RNA_def_property_ui_text(prop, "Proportional Size", "Display size for proportional editing circle"); + RNA_def_property_range(prop, 0.00001, 5000.0); + prop= RNA_def_property(srna, "normal_size", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_float_sdna(prop, NULL, "normalsize"); RNA_def_property_ui_text(prop, "Normal Size", "Display size for normals in the 3D view"); @@ -1108,10 +1136,16 @@ static void rna_def_tool_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "use_snap_project", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PROJECT); - RNA_def_property_ui_text(prop, "Project Individual Elements", "Project vertices on the surface of other objects"); + RNA_def_property_ui_text(prop, "Project Individual Elements", "Project individual elements on the surface of other objects"); RNA_def_property_ui_icon(prop, ICON_RETOPO, 0); RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */ - + + /* Grease Pencil */ + prop = RNA_def_property(srna, "use_grease_pencil_sessions", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_PAINTSESSIONS_ON); + RNA_def_property_ui_text(prop, "Use Sketching Sessions", "Allow drawing multiple strokes at a time with Grease Pencil"); + RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); // xxx: need toolbar to be redrawn... + /* Auto Keying */ prop= RNA_def_property(srna, "use_keyframe_insert_auto", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "autokey_mode", AUTOKEY_ON); @@ -1126,7 +1160,12 @@ static void rna_def_tool_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "use_record_with_nla", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", ANIMRECORD_FLAG_WITHNLA); RNA_def_property_ui_text(prop, "Layered", "Add a new NLA Track + Strip for every loop/pass made over the animation to allow non-destructive tweaking"); - + + prop= RNA_def_property(srna, "use_keyframe_insert_keyingset", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_ONLYKEYINGSET); + RNA_def_property_ui_text(prop, "Auto Keyframe Insert Keying Set", "Automatic keyframe insertion using active Keying Set only"); + RNA_def_property_ui_icon(prop, ICON_KEY_HLT, 0); // XXX: we need a dedicated icon + /* UV */ prop= RNA_def_property(srna, "uv_select_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "uv_selectmode"); @@ -1198,7 +1237,7 @@ static void rna_def_tool_settings(BlenderRNA *brna) prop= RNA_def_property(srna, "etch_subdivision_number", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "skgen_subdivision_number"); - RNA_def_property_range(prop, 1, 10000); + RNA_def_property_range(prop, 1, 255); RNA_def_property_ui_text(prop, "Subdivisions", "Number of bones in the subdivided stroke"); RNA_def_property_update(prop, NC_SPACE|ND_SPACE_VIEW3D, NULL); @@ -1263,6 +1302,11 @@ static void rna_def_unit_settings(BlenderRNA *brna) RNA_def_property_enum_items(prop, unit_systems); RNA_def_property_ui_text(prop, "Unit System", "The unit system to use for button display"); RNA_def_property_update(prop, NC_WINDOW, NULL); + + prop= RNA_def_property(srna, "system_rotation", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_items(prop, rotation_units); + RNA_def_property_ui_text(prop, "Rotation Units", "Unit to use for displaying/editing rotation values"); + RNA_def_property_update(prop, NC_WINDOW, NULL); prop= RNA_def_property(srna, "scale_length", PROP_FLOAT, PROP_UNSIGNED); RNA_def_property_ui_text(prop, "Unit Scale", "Scale to use when converting between blender units and dimensions"); @@ -1274,12 +1318,6 @@ static void rna_def_unit_settings(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_UNIT_OPT_SPLIT); RNA_def_property_ui_text(prop, "Separate Units", "Display units in pairs"); RNA_def_property_update(prop, NC_WINDOW, NULL); - - prop= RNA_def_property(srna, "rotation_units", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); - RNA_def_property_enum_items(prop, rotation_units); - RNA_def_property_ui_text(prop, "Rotation Units", "Unit to use for displaying/editing rotation values"); - RNA_def_property_update(prop, NC_WINDOW, NULL); } void rna_def_render_layer_common(StructRNA *srna, int scene) @@ -1560,31 +1598,31 @@ static void rna_def_scene_game_recast_data(BlenderRNA *brna) prop= RNA_def_property(srna, "cell_size", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "cellsize"); - RNA_def_property_ui_range(prop, 0.1, 1, 0.01, 2); + RNA_def_property_ui_range(prop, 0.1, 1, 1, 2); RNA_def_property_ui_text(prop, "Cell Size", "Rasterized cell size"); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "cell_height", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "cellheight"); - RNA_def_property_ui_range(prop, 0.1, 1, 0.01, 2); + RNA_def_property_ui_range(prop, 0.1, 1, 1, 2); RNA_def_property_ui_text(prop, "Cell Height", "Rasterized cell height"); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "agent_height", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "agentheight"); - RNA_def_property_ui_range(prop, 0.1, 5, 0.1, 2); + RNA_def_property_ui_range(prop, 0.1, 5, 1, 2); RNA_def_property_ui_text(prop, "Agent Height", "Minimum height where the agent can still walk"); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "agent_radius", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "agentradius"); - RNA_def_property_ui_range(prop, 0.1, 5, 0.1, 2); + RNA_def_property_ui_range(prop, 0.1, 5, 1, 2); RNA_def_property_ui_text(prop, "Agent Radius", "Radius of the agent"); RNA_def_property_update(prop, NC_SCENE, NULL); prop= RNA_def_property(srna, "max_climb", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "agentmaxclimb"); - RNA_def_property_ui_range(prop, 0.1, 5, 0.1, 2); + RNA_def_property_ui_range(prop, 0.1, 5, 1, 2); RNA_def_property_ui_text(prop, "Max Climb", "Maximum height between grid cells the agent can climb"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -1615,7 +1653,7 @@ static void rna_def_scene_game_recast_data(BlenderRNA *brna) prop= RNA_def_property(srna, "edge_max_error", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "edgemaxerror"); - RNA_def_property_ui_range(prop, 0.1, 3.0, 0.1, 2); + RNA_def_property_ui_range(prop, 0.1, 3.0, 1, 2); RNA_def_property_ui_text(prop, "Max Edge Error", "Maximum distance error from contour to cells"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -1737,8 +1775,9 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop= RNA_def_property(srna, "frame_color", PROP_FLOAT, PROP_COLOR); RNA_def_property_float_sdna(prop, NULL, "framing.col"); + RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Framing Color", "Set colour of the bars"); + RNA_def_property_ui_text(prop, "Framing Color", "Set color of the bars"); RNA_def_property_update(prop, NC_SCENE, NULL); /* Stereo */ @@ -1811,8 +1850,8 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Physics Gravity", "Gravitational constant used for physics simulation in the game engine"); RNA_def_property_update(prop, NC_SCENE, NULL); - prop= RNA_def_property(srna, "occlusion_culling_resolution", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "occlusionRes"); + prop= RNA_def_property(srna, "occlusion_culling_resolution", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "occlusionRes"); RNA_def_property_range(prop, 128.0, 1024.0); RNA_def_property_ui_text(prop, "Occlusion Resolution", "The size of the occlusion buffer in pixel, use higher value for better precision (slower)"); RNA_def_property_update(prop, NC_SCENE, NULL); @@ -1874,6 +1913,10 @@ static void rna_def_scene_game_data(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_PHYSICS); RNA_def_property_ui_text(prop, "Show Physics Visualization", "Show a visualization of physics bounds and interactions"); + prop= RNA_def_property(srna, "show_mouse", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_MOUSE); + RNA_def_property_ui_text(prop, "Show Mouse", "Start player with a visible mouse cursor"); + prop= RNA_def_property(srna, "use_frame_rate", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_ENABLE_ALL_FRAMES); RNA_def_property_ui_text(prop, "Use Frame Rate", "Respect the frame rate rather than rendering as many frames as possible"); @@ -1957,7 +2000,6 @@ static void rna_def_scene_game_data(BlenderRNA *brna) /* Nestled Data */ rna_def_scene_game_recast_data(brna); - } static void rna_def_scene_render_layer(BlenderRNA *brna) @@ -2510,14 +2552,14 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 1, 900); RNA_def_property_ui_text(prop, "Frame Map Old", "Specify old mapping value in frames"); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_FRAME, "rna_Scene_framelen_update"); prop= RNA_def_property(srna, "frame_map_new", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "images"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 1, 900); RNA_def_property_ui_text(prop, "Frame Map New", "Specify how many frames the Map Old will last"); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_FRAME, "rna_Scene_framelen_update"); prop= RNA_def_property(srna, "dither_intensity", PROP_FLOAT, PROP_NONE); @@ -2778,11 +2820,6 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_full_sample_get", NULL); RNA_def_property_ui_text(prop, "Full Sample","Save for every anti-aliasing sample the entire RenderLayer results. This solves anti-aliasing issues with compositing"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); - - prop= RNA_def_property(srna, "use_backbuf", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "bufflag", R_BACKBUF); - RNA_def_property_ui_text(prop, "Back Buffer", "Render backbuffer image"); - RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "displaymode"); @@ -2790,7 +2827,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Display", "Select where rendered images will be displayed"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); - prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_DIRPATH); + prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); RNA_def_property_string_sdna(prop, NULL, "pic"); RNA_def_property_ui_text(prop, "Output Path", "Directory/name to save animations, # characters defines the position and length of frame numbers"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); @@ -2868,6 +2905,11 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_CAMERA); RNA_def_property_ui_text(prop, "Stamp Camera", "Include the name of the active camera in image metadata"); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); + + prop= RNA_def_property(srna, "use_stamp_lens", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_CAMERALENS); + RNA_def_property_ui_text(prop, "Stamp Lens", "Include the name of the active cameras lens in image metadata"); + RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); prop= RNA_def_property(srna, "use_stamp_scene", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_SCENE); @@ -2962,6 +3004,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) prop= RNA_def_property(srna, "use_single_layer", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_SINGLE_LAYER); RNA_def_property_ui_text(prop, "Single Layer", "Only render the active layer"); + RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1); RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL); /* engine */ @@ -3035,7 +3078,7 @@ static void rna_def_scene_objects(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Link object to scene, run scene.update() after."); RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS); parm= RNA_def_pointer(func, "object", "Object", "", "Object to add to scene."); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); parm= RNA_def_pointer(func, "base", "ObjectBase", "", "The newly created base."); RNA_def_function_return(func, parm); @@ -3043,7 +3086,7 @@ static void rna_def_scene_objects(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_function_ui_description(func, "Unlink object from scene."); RNA_def_function_flag(func, FUNC_USE_REPORTS); parm= RNA_def_pointer(func, "object", "Object", "", "Object to remove from scene."); - RNA_def_property_flag(parm, PROP_REQUIRED); + RNA_def_property_flag(parm, PROP_REQUIRED|PROP_NEVER_NULL); prop= RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "Object"); @@ -3218,7 +3261,7 @@ void RNA_def_scene(BlenderRNA *brna) prop= RNA_def_property(srna, "world", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "World", "World used for rendering the scene"); - RNA_def_property_update(prop, NC_SCENE|NC_WORLD, NULL); + RNA_def_property_update(prop, NC_SCENE|ND_WORLD, NULL); prop= RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ_LENGTH); RNA_def_property_float_sdna(prop, NULL, "cursor"); @@ -3231,6 +3274,7 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_collection_sdna(prop, NULL, "base", NULL); RNA_def_property_struct_type(prop, "ObjectBase"); RNA_def_property_ui_text(prop, "Bases", ""); + RNA_def_property_collection_funcs(prop, 0, 0, 0, 0, 0, 0, "rna_Scene_object_bases_lookup_string"); rna_def_scene_bases(brna, prop); prop= RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE); |