diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2016-04-15 18:59:54 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2016-04-15 18:59:54 +0300 |
commit | fbed29a246ed51023c3303115d060d7a455b4fc2 (patch) | |
tree | 44947031e32ba4549cecc2a4fb3d0a18f65151be /source/blender/makesrna/intern | |
parent | 987bb50a74132e1f2489083c59daab892f24806f (diff) | |
parent | 6bc2ba21117a25c8a7100b282cc2377e1adf7075 (diff) |
Merge branch 'master' into temp_remove_particles
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_brush.c | 12 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_fcurve.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_internal.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 102 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_smoke.c | 59 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_texture.c | 28 |
6 files changed, 175 insertions, 29 deletions
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index e3733ff2850..e13919dd1a1 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -653,34 +653,34 @@ static void rna_def_brush_texture_slot(BlenderRNA *brna) RNA_def_property_enum_sdna(prop, NULL, "brush_map_mode"); RNA_def_property_enum_items(prop, prop_map_mode_items); RNA_def_property_ui_text(prop, "Mode", ""); - RNA_def_property_update(prop, 0, "rna_TextureSlot_brush_update"); + RNA_def_property_update(prop, 0, "rna_TextureSlot_update"); prop = RNA_def_property(srna, "tex_paint_map_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "brush_map_mode"); RNA_def_property_enum_items(prop, prop_tex_paint_map_mode_items); RNA_def_property_ui_text(prop, "Mode", ""); - RNA_def_property_update(prop, 0, "rna_TextureSlot_brush_update"); + RNA_def_property_update(prop, 0, "rna_TextureSlot_update"); prop = RNA_def_property(srna, "mask_map_mode", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "brush_map_mode"); RNA_def_property_enum_items(prop, prop_mask_paint_map_mode_items); RNA_def_property_ui_text(prop, "Mode", ""); - RNA_def_property_update(prop, 0, "rna_TextureSlot_brush_update"); + RNA_def_property_update(prop, 0, "rna_TextureSlot_update"); prop = RNA_def_property(srna, "use_rake", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "brush_angle_mode", MTEX_ANGLE_RAKE); RNA_def_property_ui_text(prop, "Rake", ""); - RNA_def_property_update(prop, 0, "rna_TextureSlot_brush_update"); + RNA_def_property_update(prop, 0, "rna_TextureSlot_update"); prop = RNA_def_property(srna, "use_random", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "brush_angle_mode", MTEX_ANGLE_RANDOM); RNA_def_property_ui_text(prop, "Random", ""); - RNA_def_property_update(prop, 0, "rna_TextureSlot_brush_update"); + RNA_def_property_update(prop, 0, "rna_TextureSlot_update"); prop = RNA_def_property(srna, "random_angle", PROP_FLOAT, PROP_ANGLE); RNA_def_property_range(prop, 0, M_PI * 2); RNA_def_property_ui_text(prop, "Random Angle", "Brush texture random angle"); - RNA_def_property_update(prop, 0, "rna_TextureSlot_brush_update"); + RNA_def_property_update(prop, 0, "rna_TextureSlot_update"); TEXTURE_CAPABILITY(has_texture_angle_source, "Has Texture Angle Source"); TEXTURE_CAPABILITY(has_random_texture_angle, "Has Random Texture Angle"); diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index b765ca10eec..32008640930 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -300,7 +300,7 @@ static void rna_Driver_remove_variable(ChannelDriver *driver, ReportList *report return; } - driver_free_variable(driver, dvar); + driver_free_variable_ex(driver, dvar); RNA_POINTER_INVALIDATE(dvar_ptr); } diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 38b9673b68c..6a993940513 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -233,7 +233,6 @@ int rna_object_shapekey_index_set(struct ID *id, PointerRNA value, int current); void rna_Object_internal_update_data(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr); void rna_Mesh_update_draw(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr); void rna_TextureSlot_update(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr); -void rna_TextureSlot_brush_update(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr); /* basic poll functions for object types */ int rna_Armature_object_poll(struct PointerRNA *ptr, struct PointerRNA value); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 925d81f92bf..7316c748442 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1762,6 +1762,11 @@ static char *rna_UnifiedPaintSettings_path(PointerRNA *UNUSED(ptr)) return BLI_strdup("tool_settings.unified_paint_settings"); } +static char *rna_CurvePaintSettings_path(PointerRNA *UNUSED(ptr)) +{ + return BLI_strdup("tool_settings.curve_paint_settings"); +} + /* generic function to recalc geometry */ static void rna_EditMesh_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr)) { @@ -2488,6 +2493,12 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_struct_type(prop, "UnifiedPaintSettings"); RNA_def_property_ui_text(prop, "Unified Paint Settings", NULL); + /* Curve Paint Settings */ + prop = RNA_def_property(srna, "curve_paint_settings", PROP_POINTER, PROP_NONE); + RNA_def_property_flag(prop, PROP_NEVER_NULL); + RNA_def_property_struct_type(prop, "CurvePaintSettings"); + RNA_def_property_ui_text(prop, "Curve Paint Settings", NULL); + /* Mesh Statistics */ prop = RNA_def_property(srna, "statvis", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); @@ -2586,6 +2597,96 @@ static void rna_def_unified_paint_settings(BlenderRNA *brna) "when unlocked brush size is given in pixels"); } + +static void rna_def_curve_paint_settings(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna = RNA_def_struct(brna, "CurvePaintSettings", NULL); + RNA_def_struct_path_func(srna, "rna_CurvePaintSettings_path"); + RNA_def_struct_ui_text(srna, "Curve Paint Settings", ""); + + static EnumPropertyItem curve_type_items[] = { + {CU_POLY, "POLY", 0, "Poly", ""}, + {CU_BEZIER, "BEZIER", 0, "Bezier", ""}, + {0, NULL, 0, NULL, NULL}}; + + prop = RNA_def_property(srna, "curve_type", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "curve_type"); + RNA_def_property_enum_items(prop, curve_type_items); + RNA_def_property_ui_text(prop, "Type", "Type of curve to use for new strokes"); + + prop = RNA_def_property(srna, "use_corners_detect", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", CURVE_PAINT_FLAG_CORNERS_DETECT); + RNA_def_property_ui_text(prop, "Detect Corners", "Detect corners and use non-aligned handles"); + + prop = RNA_def_property(srna, "use_pressure_radius", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", CURVE_PAINT_FLAG_PRESSURE_RADIUS); + RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0); + RNA_def_property_ui_text(prop, "Use Pressure", "Map tablet pressure to curve radius"); + + prop = RNA_def_property(srna, "use_stroke_endpoints", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", CURVE_PAINT_FLAG_DEPTH_STROKE_ENDPOINTS); + RNA_def_property_ui_text(prop, "Only First", "Use the start of the stroke for the depth"); + + prop = RNA_def_property(srna, "error_threshold", PROP_INT, PROP_PIXEL); + RNA_def_property_range(prop, 1, 100); + RNA_def_property_ui_text(prop, "Tolerance", "Allow deviation for a smoother, less preceise line"); + + prop = RNA_def_property(srna, "corner_angle", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_range(prop, 0, M_PI); + RNA_def_property_ui_text(prop, "Corner Angle", "Angles above this are considered corners"); + + prop = RNA_def_property(srna, "radius_min", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.0, 100.0); + RNA_def_property_ui_range(prop, 0.0f, 10.0, 10, 2); + RNA_def_property_ui_text(prop, "Radius Min", + "Minimum radius when the minimum pressure is applied (also the minimum when tapering)"); + + prop = RNA_def_property(srna, "radius_max", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.0, 100.0); + RNA_def_property_ui_range(prop, 0.0f, 10.0, 10, 2); + RNA_def_property_ui_text(prop, "Radius Max", + "Radius to use when the maximum pressure is applied (or when a tablet isn't used)"); + + prop = RNA_def_property(srna, "radius_taper_start", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.0, 1.0); + RNA_def_property_ui_range(prop, 0.0f, 1.0, 1, 2); + RNA_def_property_ui_text(prop, "Radius Min", "Taper factor for the radius of each point along the curve"); + + prop = RNA_def_property(srna, "radius_taper_end", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.0, 10.0); + RNA_def_property_ui_range(prop, 0.0f, 1.0, 1, 2); + RNA_def_property_ui_text(prop, "Radius Max", "Taper factor for the radius of each point along the curve"); + + prop = RNA_def_property(srna, "radius_offset", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, -10.0, 10.0); + RNA_def_property_ui_range(prop, -1.0f, 1.0, 1, 2); + RNA_def_property_ui_text(prop, "Offset", "Offset the stroke from the surface"); + + static EnumPropertyItem depth_mode_items[] = { + {CURVE_PAINT_PROJECT_CURSOR, "CURSOR", 0, "Cursor", ""}, + {CURVE_PAINT_PROJECT_SURFACE, "SURFACE", 0, "Surface", ""}, + {0, NULL, 0, NULL, NULL}}; + + prop = RNA_def_property(srna, "depth_mode", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "depth_mode"); + RNA_def_property_enum_items(prop, depth_mode_items); + RNA_def_property_ui_text(prop, "Depth", "Method of projecting depth"); + + static EnumPropertyItem surface_plane_items[] = { + {CURVE_PAINT_SURFACE_PLANE_NORMAL_VIEW, "NORMAL_VIEW", 0, "Normal/View", "Draw perpendicular to the surface"}, + {CURVE_PAINT_SURFACE_PLANE_NORMAL_SURFACE, "NORMAL_SURFACE", 0, "Normal/Surface", "Draw aligned to the surface"}, + {CURVE_PAINT_SURFACE_PLANE_VIEW, "VIEW", 0, "View", "Draw aligned to the viewport"}, + {0, NULL, 0, NULL, NULL}}; + + prop = RNA_def_property(srna, "surface_plane", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "surface_plane"); + RNA_def_property_enum_items(prop, surface_plane_items); + RNA_def_property_ui_text(prop, "Plane", "Plane for projected stroke"); +} + static void rna_def_statvis(BlenderRNA *brna) { StructRNA *srna; @@ -6701,6 +6802,7 @@ void RNA_def_scene(BlenderRNA *brna) RNA_define_animate_sdna(false); rna_def_tool_settings(brna); rna_def_unified_paint_settings(brna); + rna_def_curve_paint_settings(brna); rna_def_statvis(brna); rna_def_unit_settings(brna); rna_def_scene_image_format_data(brna); diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index 0fbefed96cb..d2dca37d072 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -190,6 +190,29 @@ static int rna_SmokeModifier_velocity_grid_get_length(PointerRNA *ptr, int lengt return length[0]; } +static int rna_SmokeModifier_heat_grid_get_length( + PointerRNA *ptr, + int length[RNA_MAX_ARRAY_DIMENSION]) +{ +#ifdef WITH_SMOKE + SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data; + float *heat = NULL; + int size = 0; + + /* Heat data is always low-resolution. */ + if (sds->fluid) { + size = sds->res[0] * sds->res[1] * sds->res[2]; + heat = smoke_get_heat(sds->fluid); + } + + length[0] = (heat) ? size : 0; +#else + (void)ptr; + length[0] = 0; +#endif + return length[0]; +} + static void rna_SmokeModifier_density_grid_get(PointerRNA *ptr, float *values) { #ifdef WITH_SMOKE @@ -292,6 +315,34 @@ static void rna_SmokeModifier_flame_grid_get(PointerRNA *ptr, float *values) #endif } +static void rna_SmokeModifier_heat_grid_get(PointerRNA *ptr, float *values) +{ +#ifdef WITH_SMOKE + SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data; + int length[RNA_MAX_ARRAY_DIMENSION]; + int size = rna_SmokeModifier_heat_grid_get_length(ptr, length); + float *heat; + + BLI_rw_mutex_lock(sds->fluid_mutex, THREAD_LOCK_READ); + + heat = smoke_get_heat(sds->fluid); + + if (heat != NULL) { + /* scale heat values from -2.0-2.0 to -1.0-1.0. */ + for (int i = 0; i < size; i++) { + values[i] = heat[i] * 0.5f; + } + } + else { + memset(values, 0, size * sizeof(float)); + } + + BLI_rw_mutex_unlock(sds->fluid_mutex); +#else + UNUSED_VARS(ptr, values); +#endif +} + static void rna_SmokeFlow_density_vgroup_get(PointerRNA *ptr, char *value) { SmokeFlowSettings *flow = (SmokeFlowSettings *)ptr->data; @@ -562,6 +613,14 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna) RNA_def_property_float_funcs(prop, "rna_SmokeModifier_color_grid_get", NULL, NULL); RNA_def_property_ui_text(prop, "Color Grid", "Smoke color grid"); + prop = RNA_def_property(srna, "heat_grid", PROP_FLOAT, PROP_NONE); + RNA_def_property_array(prop, 32); + RNA_def_property_flag(prop, PROP_DYNAMIC); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_dynamic_array_funcs(prop, "rna_SmokeModifier_heat_grid_get_length"); + RNA_def_property_float_funcs(prop, "rna_SmokeModifier_heat_grid_get", NULL, NULL); + RNA_def_property_ui_text(prop, "Heat Grid", "Smoke heat grid"); + prop = RNA_def_property(srna, "cell_size", PROP_FLOAT, PROP_XYZ); /* can change each frame when using adaptive domain */ RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_ui_text(prop, "cell_size", "Cell Size"); diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index d6762495499..959f30170f5 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -224,7 +224,7 @@ static void rna_Texture_type_set(PointerRNA *ptr, int value) BKE_texture_type_set(tex, value); } -void rna_TextureSlot_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) +void rna_TextureSlot_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr) { ID *id = ptr->id.data; @@ -243,32 +243,18 @@ void rna_TextureSlot_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRN WM_main_add_notifier(NC_LAMP | ND_LIGHTING_DRAW, id); break; case ID_BR: - WM_main_add_notifier(NC_BRUSH, id); - break; - case ID_LS: - WM_main_add_notifier(NC_LINESTYLE, id); - break; - } -} - -void rna_TextureSlot_brush_update(Main *bmain, Scene *scene, PointerRNA *ptr) -{ - ID *id = ptr->id.data; - - DAG_id_tag_update(id, 0); - - switch (GS(id->name)) { - case ID_BR: { MTex *mtex = ptr->data; BKE_paint_invalidate_overlay_tex(scene, mtex->tex); + WM_main_add_notifier(NC_BRUSH, id); break; } + case ID_LS: + WM_main_add_notifier(NC_LINESTYLE, id); + break; } - rna_TextureSlot_update(bmain, scene, ptr); } - char *rna_TextureSlot_path(PointerRNA *ptr) { MTex *mtex = ptr->data; @@ -637,14 +623,14 @@ static void rna_def_mtex(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "ofs"); RNA_def_property_ui_range(prop, -10, 10, 10, RNA_TRANSLATION_PREC_DEFAULT); RNA_def_property_ui_text(prop, "Offset", "Fine tune of the texture mapping X, Y and Z locations"); - RNA_def_property_update(prop, 0, "rna_TextureSlot_brush_update"); + RNA_def_property_update(prop, 0, "rna_TextureSlot_update"); prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ); RNA_def_property_float_sdna(prop, NULL, "size"); RNA_def_property_flag(prop, PROP_PROPORTIONAL); RNA_def_property_ui_range(prop, -100, 100, 10, 2); RNA_def_property_ui_text(prop, "Size", "Set scaling for the texture's X, Y and Z sizes"); - RNA_def_property_update(prop, 0, "rna_TextureSlot_brush_update"); + RNA_def_property_update(prop, 0, "rna_TextureSlot_update"); prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR); RNA_def_property_float_sdna(prop, NULL, "r"); |