diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2012-01-17 20:31:13 +0400 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2012-01-17 20:31:13 +0400 |
commit | a8081c1d2bb9115833493b011bb93d6c08112b2d (patch) | |
tree | 4383d080b80786257b291068e48a06bdb0ef5bd6 /source/blender/makesrna/intern | |
parent | fcc54520d1f029b86cb8c6f43c239ef81090a99a (diff) |
Uv Tools branch GSOC 2011
=========================
Documentation: http://wiki.blender.org/index.php/User:Psy-Fi/UV_Tools
Major features include:
*16 bit image support in viewport
*Subsurf aware unwrapping
*Smart Stitch(snap/rotate islands, preview, middlepoint/endpoint stitching)
*Seams from islands tool (marks seams and sharp, depending on settings)
*Uv Sculpting(Grab/Pinch/Rotate)
All tools are complete apart from stitching that is considered stable but with an extra edge mode under development(will be in soc-2011-onion-uv-tools).
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 69 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_sculpt_paint.c | 11 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 48 |
3 files changed, 128 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 9b9bdaf80bb..384453fa9ec 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -63,6 +63,18 @@ #include "BLI_threads.h" +EnumPropertyItem uv_sculpt_relaxation_items[] = { + {UV_SCULPT_TOOL_RELAX_LAPLACIAN, "LAPLACIAN", 0, "Laplacian", "Use Laplacian method for relaxation"}, + {UV_SCULPT_TOOL_RELAX_HC, "HC", 0, "HC", "Use HC method for relaxation"}, + {0, NULL, 0, NULL, NULL}}; + +EnumPropertyItem uv_sculpt_tool_items[] = { + {UV_SCULPT_TOOL_PINCH, "PINCH", 0, "Pinch", "Pinch UVs"}, + {UV_SCULPT_TOOL_RELAX, "RELAX", 0, "Relax", "Relax UVs"}, + {UV_SCULPT_TOOL_GRAB, "GRAB", 0, "Grab", "Grab UVs"}, + {0, NULL, 0, NULL, NULL}}; + + EnumPropertyItem snap_target_items[] = { {SCE_SNAP_TARGET_CLOSEST, "CLOSEST", 0, "Closest", "Snap closest point onto target"}, {SCE_SNAP_TARGET_CENTER, "CENTER", 0, "Center", "Snap center onto target"}, @@ -267,9 +279,15 @@ EnumPropertyItem image_color_depth_items[] = { #include "ED_view3d.h" #include "ED_mesh.h" #include "ED_keyframing.h" +#include "ED_image.h" #include "RE_engine.h" +static void rna_SpaceImageEditor_uv_sculpt_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr)) +{ + ED_space_image_uv_sculpt_update(bmain->wm.first, scene->toolsettings); +} + static int rna_Scene_object_bases_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr) { Scene *scene= (Scene*)ptr->data; @@ -1429,10 +1447,38 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "imapaint"); RNA_def_property_ui_text(prop, "Image Paint", ""); + prop= RNA_def_property(srna, "uv_sculpt", PROP_POINTER, PROP_NONE); + RNA_def_property_pointer_sdna(prop, NULL, "uvsculpt"); + RNA_def_property_ui_text(prop, "UV Sculpt", ""); + prop= RNA_def_property(srna, "particle_edit", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "particle"); RNA_def_property_ui_text(prop, "Particle Edit", ""); + prop= RNA_def_property(srna, "use_uv_sculpt", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "use_uv_sculpt", 1); + RNA_def_property_ui_text(prop, "UV Sculpt", "Enable brush for uv sculpting"); + RNA_def_property_ui_icon(prop, ICON_TPAINT_HLT, 0); + RNA_def_property_update(prop, NC_SPACE|ND_SPACE_IMAGE, "rna_SpaceImageEditor_uv_sculpt_update"); + + prop= RNA_def_property(srna, "uv_sculpt_lock_borders", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "uv_sculpt_settings", UV_SCULPT_LOCK_BORDERS); + RNA_def_property_ui_text(prop, "Lock Borders", "Disables editing of boundary edges"); + + prop= RNA_def_property(srna, "uv_sculpt_all_islands", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "uv_sculpt_settings", UV_SCULPT_ALL_ISLANDS); + RNA_def_property_ui_text(prop, "Sculpt All Islands", "Brush operates on all islands"); + + prop= RNA_def_property(srna, "uv_sculpt_tool", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "uv_sculpt_tool"); + RNA_def_property_enum_items(prop, uv_sculpt_tool_items); + RNA_def_property_ui_text(prop, "UV Sculpt Tools", "Select Tools for the UV sculpt brushes"); + + prop= RNA_def_property(srna, "uv_relax_method", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_sdna(prop, NULL, "uv_relax_method"); + RNA_def_property_enum_items(prop, uv_sculpt_relaxation_items); + RNA_def_property_ui_text(prop, "Relaxation Method", "Algorithm used for UV relaxation"); + /* Transform */ prop= RNA_def_property(srna, "proportional_edit", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "proportional"); @@ -3842,6 +3888,28 @@ static void rna_def_scene_keying_sets_all(BlenderRNA *brna, PropertyRNA *cprop) RNA_def_property_update(prop, NC_SCENE|ND_KEYINGSET, NULL); } +/* Runtime property, used to remember uv indices, used only in UV stitch for now. + */ +static void rna_def_selected_uv_element(BlenderRNA *brna) +{ + StructRNA *srna; + PropertyRNA *prop; + + srna= RNA_def_struct(brna, "SelectedUvElement", "PropertyGroup"); + RNA_def_struct_ui_text(srna, "Selected Uv Element", ""); + + /* store the index to the UV element selected */ + prop= RNA_def_property(srna, "element_index", PROP_INT, PROP_UNSIGNED); + RNA_def_property_flag(prop, PROP_IDPROPERTY); + RNA_def_property_ui_text(prop, "Element Index", ""); + + prop= RNA_def_property(srna, "face_index", PROP_INT, PROP_UNSIGNED); + RNA_def_property_flag(prop, PROP_IDPROPERTY); + RNA_def_property_ui_text(prop, "Face Index", ""); +} + + + void RNA_def_scene(BlenderRNA *brna) { StructRNA *srna; @@ -4175,6 +4243,7 @@ void RNA_def_scene(BlenderRNA *brna) rna_def_scene_game_data(brna); rna_def_scene_render_layer(brna); rna_def_transform_orientation(brna); + rna_def_selected_uv_element(brna); /* Scene API */ RNA_api_scene(srna); diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index cd929d3aeda..c3c84c66567 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -289,6 +289,16 @@ static void rna_def_sculpt(BlenderRNA *brna) RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Sculpt_update"); } + +static void rna_def_uv_sculpt(BlenderRNA *brna) +{ + StructRNA *srna; + + srna= RNA_def_struct(brna, "UvSculpt", "Paint"); + RNA_def_struct_ui_text(srna, "UV Sculpting", ""); +} + + /* use for weight paint too */ static void rna_def_vertex_paint(BlenderRNA *brna) { @@ -548,6 +558,7 @@ void RNA_def_sculpt_paint(BlenderRNA *brna) { rna_def_paint(brna); rna_def_sculpt(brna); + rna_def_uv_sculpt(brna); rna_def_vertex_paint(brna); rna_def_image_paint(brna); rna_def_particle_edit(brna); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 7b3c70aa896..9de6f73dbe7 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -37,6 +37,7 @@ #include "DNA_userdef_types.h" #include "DNA_brush_types.h" #include "DNA_view3d_types.h" +#include "DNA_scene_types.h" #include "WM_api.h" #include "WM_types.h" @@ -147,6 +148,12 @@ static void rna_userdef_gl_texture_limit_update(Main *bmain, Scene *scene, Point rna_userdef_update(bmain, scene, ptr); } +static void rna_userdef_gl_use_16bit_textures(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + GPU_free_images(); + rna_userdef_update(bmain, scene, ptr); +} + static void rna_userdef_select_mouse_set(PointerRNA *ptr,int value) { UserDef *userdef = (UserDef*)ptr->data; @@ -1623,6 +1630,42 @@ static void rna_def_userdef_theme_space_image(BlenderRNA *brna) RNA_def_property_array(prop, 4); RNA_def_property_ui_text(prop, "Scope region background color", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop= RNA_def_property(srna, "preview_stitch_face", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_float_sdna(prop, NULL, "preview_stitch_face"); + RNA_def_property_array(prop, 4); + RNA_def_property_ui_text(prop, "Stitch preview face color", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop= RNA_def_property(srna, "preview_stitch_edge", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_float_sdna(prop, NULL, "preview_stitch_edge"); + RNA_def_property_array(prop, 4); + RNA_def_property_ui_text(prop, "Stitch preview edge color", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop= RNA_def_property(srna, "preview_stitch_vert", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_float_sdna(prop, NULL, "preview_stitch_vert"); + RNA_def_property_array(prop, 4); + RNA_def_property_ui_text(prop, "Stitch preview vertex color", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop= RNA_def_property(srna, "preview_stitch_stitchable", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_float_sdna(prop, NULL, "preview_stitch_stitchable"); + RNA_def_property_array(prop, 4); + RNA_def_property_ui_text(prop, "Stitch preview stitchable color", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop= RNA_def_property(srna, "preview_stitch_unstitchable", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_float_sdna(prop, NULL, "preview_stitch_unstitchable"); + RNA_def_property_array(prop, 4); + RNA_def_property_ui_text(prop, "Stitch preview unstitchable color", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); + + prop= RNA_def_property(srna, "preview_stitch_active", PROP_FLOAT, PROP_COLOR_GAMMA); + RNA_def_property_float_sdna(prop, NULL, "preview_stitch_active"); + RNA_def_property_array(prop, 4); + RNA_def_property_ui_text(prop, "Stitch preview active island", ""); + RNA_def_property_update(prop, 0, "rna_userdef_update"); } static void rna_def_userdef_theme_space_seq(BlenderRNA *brna) @@ -2900,6 +2943,11 @@ static void rna_def_userdef_system(BlenderRNA *brna) "Scale textures for the 3D View (looks nicer but uses more memory and slows image reloading)"); RNA_def_property_update(prop, 0, "rna_userdef_mipmap_update"); + prop= RNA_def_property(srna, "use_16bit_textures", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "use_16bit_textures", 1); + RNA_def_property_ui_text(prop, "16 Bit Float Textures", "Use 16 bit per component texture for float images."); + RNA_def_property_update(prop, 0, "rna_userdef_gl_use_16bit_textures"); + prop= RNA_def_property(srna, "use_vertex_buffer_objects", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "gameflags", USER_DISABLE_VBO); RNA_def_property_ui_text(prop, "VBOs", "Use Vertex Buffer Objects (or Vertex Arrays, if unsupported) for viewport rendering"); |