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:
authorMartin Poirier <theeth@yahoo.com>2008-11-12 22:16:46 +0300
committerMartin Poirier <theeth@yahoo.com>2008-11-12 22:16:46 +0300
commit913fd3c730be5a38751e7c1f6bca6e298cf8b1a8 (patch)
treed8054fe9fc10f37292884af1cae32389acf694c9 /source
parent5443d2d86b153160201d1ef5c7c2d09bfc2f956e (diff)
Sensible defaults with do_version
Auto names for name templating. When turned on, N will be incremented everytime (after a stroke has been converted) and S will be set to "l" or "r" (or "L or "R" if it already contains a capital L or R) depending on which side of the X axis the stroke started on. Experimental, there might be some bugs left.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_blender.h2
-rw-r--r--source/blender/blenloader/intern/readfile.c74
-rw-r--r--source/blender/makesdna/DNA_scene_types.h2
-rw-r--r--source/blender/src/drawview.c8
-rw-r--r--source/blender/src/editarmature_sketch.c56
5 files changed, 97 insertions, 45 deletions
diff --git a/source/blender/blenkernel/BKE_blender.h b/source/blender/blenkernel/BKE_blender.h
index f392d57521c..a6334e665d1 100644
--- a/source/blender/blenkernel/BKE_blender.h
+++ b/source/blender/blenkernel/BKE_blender.h
@@ -41,7 +41,7 @@ struct ListBase;
struct MemFile;
#define BLENDER_VERSION 248
-#define BLENDER_SUBVERSION 1
+#define BLENDER_SUBVERSION 2
#define BLENDER_MINVERSION 245
#define BLENDER_MINSUBVERSION 15
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 5a12342bb1b..c3937dce041 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -7372,47 +7372,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
ima->flag |= IMA_DO_PREMUL;
}
}
-
- if (main->versionfile < 245 || main->subversionfile < 12)
- {
- /* initialize skeleton generation toolsettings */
- for(sce=main->scene.first; sce; sce = sce->id.next)
- {
- sce->toolsettings->skgen_resolution = 50;
- sce->toolsettings->skgen_threshold_internal = 0.01f;
- sce->toolsettings->skgen_threshold_external = 0.01f;
- sce->toolsettings->skgen_angle_limit = 45.0f;
- sce->toolsettings->skgen_length_ratio = 1.3f;
- sce->toolsettings->skgen_length_limit = 1.5f;
- sce->toolsettings->skgen_correlation_limit = 0.98f;
- sce->toolsettings->skgen_symmetry_limit = 0.1f;
- sce->toolsettings->skgen_postpro = SKGEN_SMOOTH;
- sce->toolsettings->skgen_postpro_passes = 1;
- sce->toolsettings->skgen_options = SKGEN_FILTER_INTERNAL|SKGEN_FILTER_EXTERNAL|SKGEN_SUB_CORRELATION;
- sce->toolsettings->skgen_subdivisions[0] = SKGEN_SUB_CORRELATION;
- sce->toolsettings->skgen_subdivisions[1] = SKGEN_SUB_LENGTH;
- sce->toolsettings->skgen_subdivisions[2] = SKGEN_SUB_ANGLE;
- }
- }
- }
-
- /* sanity check for skgen
- * */
- {
- Scene *sce;
- for(sce=main->scene.first; sce; sce = sce->id.next)
- {
- if (sce->toolsettings->skgen_subdivisions[0] == sce->toolsettings->skgen_subdivisions[1] ||
- sce->toolsettings->skgen_subdivisions[0] == sce->toolsettings->skgen_subdivisions[2] ||
- sce->toolsettings->skgen_subdivisions[1] == sce->toolsettings->skgen_subdivisions[2])
- {
- sce->toolsettings->skgen_subdivisions[0] = SKGEN_SUB_CORRELATION;
- sce->toolsettings->skgen_subdivisions[1] = SKGEN_SUB_LENGTH;
- sce->toolsettings->skgen_subdivisions[2] = SKGEN_SUB_ANGLE;
- }
- }
}
-
if ((main->versionfile < 245) || (main->versionfile == 245 && main->subversionfile < 2)) {
Image *ima;
@@ -7993,6 +7953,40 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
}
}
+ if (main->versionfile < 248 || main->subversionfile < 2)
+ {
+ Scene *sce;
+
+ /* initialize skeleton generation toolsettings */
+ for(sce=main->scene.first; sce; sce = sce->id.next)
+ {
+ sce->toolsettings->skgen_resolution = 250;
+ sce->toolsettings->skgen_threshold_internal = 0.1f;
+ sce->toolsettings->skgen_threshold_external = 0.1f;
+ sce->toolsettings->skgen_angle_limit = 30.0f;
+ sce->toolsettings->skgen_length_ratio = 1.3f;
+ sce->toolsettings->skgen_length_limit = 1.5f;
+ sce->toolsettings->skgen_correlation_limit = 0.98f;
+ sce->toolsettings->skgen_symmetry_limit = 0.1f;
+ sce->toolsettings->skgen_postpro = SKGEN_SMOOTH;
+ sce->toolsettings->skgen_postpro_passes = 3;
+ sce->toolsettings->skgen_options = SKGEN_FILTER_INTERNAL|SKGEN_FILTER_EXTERNAL|SKGEN_FILTER_SMART|SKGEN_SUB_CORRELATION|SKGEN_HARMONIC;
+ sce->toolsettings->skgen_subdivisions[0] = SKGEN_SUB_CORRELATION;
+ sce->toolsettings->skgen_subdivisions[1] = SKGEN_SUB_LENGTH;
+ sce->toolsettings->skgen_subdivisions[2] = SKGEN_SUB_ANGLE;
+
+
+ sce->toolsettings->skgen_retarget_angle_weight = 1.0f;
+ sce->toolsettings->skgen_retarget_length_weight = 1.0f;
+ sce->toolsettings->skgen_retarget_distance_weight = 1.0f;
+
+ /* Skeleton Sketching */
+ sce->toolsettings->bone_sketching = 0;
+ sce->toolsettings->skgen_retarget_options |= SK_RETARGET_ROLL;
+ }
+ }
+
+
/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
/* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 27696e49615..7c99ea57b76 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -865,7 +865,6 @@ typedef struct Scene {
#define SKGEN_DISP_ORIG (1 << 12)
#define SKGEN_DISP_EMBED (1 << 13)
#define SKGEN_DISP_INDEX (1 << 14)
-#define SKGEN_CUT_FIXED 64
#define SKGEN_SUB_LENGTH 0
#define SKGEN_SUB_ANGLE 1
@@ -889,6 +888,7 @@ typedef struct Scene {
/* toolsettings->skgen_retarget_options */
#define SK_RETARGET_ROLL 1
+#define SK_RETARGET_AUTONAME 2
#ifdef __cplusplus
diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c
index 45cf79ca390..0f321504723 100644
--- a/source/blender/src/drawview.c
+++ b/source/blender/src/drawview.c
@@ -2354,7 +2354,6 @@ static void view3d_panel_bonesketch_spaces(short cntrl)
but = uiDefButI(block, MENU, B_REDR, BIF_listTemplates(), 10,yco,150,19, &template_index, 0, 0, 0, 0, "Template");
uiButSetFunc(but, assign_template_sketch_armature, &template_index, NULL);
- //uiDefIDPoinBut(block, test_obpoin_but, ID_OB, B_DIFF, "OB:", 10, yco, 150, 19, &G.scene->toolsettings->skgen_template, "Template Object");
yco -= 20;
uiDefButF(block, NUM, B_DIFF, "Ang:", 10, yco, 50,19, &G.scene->toolsettings->skgen_retarget_angle_weight, 0, 10, 1, 0, "Angle Weight");
@@ -2362,8 +2361,11 @@ static void view3d_panel_bonesketch_spaces(short cntrl)
uiDefButF(block, NUM, B_DIFF, "Dist:", 110,yco, 50,19, &G.scene->toolsettings->skgen_retarget_distance_weight, 0, 10, 1, 0, "Distance Weight");
yco -= 20;
- uiDefBut(block, TEX,0,"S:", 10, yco, 75, 20, G.scene->toolsettings->skgen_side_string, 0.0, 8.0, 0, 0, "Text to replace %S with");
- uiDefBut(block, TEX,0,"N:", 85, yco, 75, 20, G.scene->toolsettings->skgen_num_string, 0.0, 8.0, 0, 0, "Text to replace %N with");
+ uiDefBut(block, TEX,0,"S:", 10, yco, 65, 20, G.scene->toolsettings->skgen_side_string, 0.0, 8.0, 0, 0, "Text to replace %S with");
+ uiDefBut(block, TEX,0,"N:", 75, yco, 65, 20, G.scene->toolsettings->skgen_num_string, 0.0, 8.0, 0, 0, "Text to replace %N with");
+ uiDefIconButBitC(block, TOG, SK_RETARGET_AUTONAME, B_DIFF, ICON_AUTO,140,yco,20,20, &G.scene->toolsettings->skgen_retarget_options, 0, 0, 0, 0, "Use Auto Naming");
+
+ /* auto renaming magic */
uiBlockEndAlign(block);
diff --git a/source/blender/src/editarmature_sketch.c b/source/blender/src/editarmature_sketch.c
index 99c274c6628..a0ba3223d9d 100644
--- a/source/blender/src/editarmature_sketch.c
+++ b/source/blender/src/editarmature_sketch.c
@@ -178,6 +178,11 @@ char *BIF_listTemplates()
char menu_header[] = "Template%t|None%x0|";
char *p;
+ if (TEMPLATES_MENU != NULL)
+ {
+ MEM_freeN(TEMPLATES_MENU);
+ }
+
TEMPLATES_MENU = MEM_callocN(sizeof(char) * (BLI_ghash_size(TEMPLATES_HASH) * 32 + 30), "skeleton template menu");
p = TEMPLATES_MENU;
@@ -472,6 +477,53 @@ int peelObjects(ListBase *depth_peels, short mval[2])
}
/*********************** CONVERSION ***************************/
+void sk_autoname(ReebArc *arc)
+{
+ if (G.scene->toolsettings->skgen_retarget_options & SK_RETARGET_AUTONAME)
+ {
+ if (arc == NULL)
+ {
+ char *num = G.scene->toolsettings->skgen_num_string;
+ int i = atoi(num);
+ i++;
+ BLI_snprintf(num, 8, "%i", i);
+ }
+ else
+ {
+ char *side = G.scene->toolsettings->skgen_side_string;
+ int valid = 0;
+ int caps = 0;
+
+ if (BLI_streq(side, ""))
+ {
+ valid = 1;
+ }
+ else if (BLI_streq(side, "R") || BLI_streq(side, "L"))
+ {
+ valid = 1;
+ caps = 1;
+ }
+ else if (BLI_streq(side, "r") || BLI_streq(side, "l"))
+ {
+ valid = 1;
+ caps = 0;
+ }
+
+ if (valid)
+ {
+ if (arc->head->p[0] < 0)
+ {
+ BLI_snprintf(side, 8, caps?"R":"r");
+ }
+ else
+ {
+ BLI_snprintf(side, 8, caps?"L":"l");
+ }
+ }
+ }
+ }
+}
+
ReebNode *sk_pointToNode(SK_Point *pt, float imat[][4], float tmat[][3])
{
ReebNode *node;
@@ -529,8 +581,12 @@ void sk_retargetStroke(SK_Stroke *stk)
arc = sk_strokeToArc(stk, imat, tmat);
+ sk_autoname(arc);
+
BIF_retargetArc(arc);
+ sk_autoname(NULL);
+
MEM_freeN(arc->head);
MEM_freeN(arc->tail);
REEB_freeArc((BArc*)arc);