[Bf-blender-cvs] [e3d76bb5e95] PSketch-279: Starting new branch for developing PSculpt/Sketching using 2.79 as a base

Joshua Leung noreply at git.blender.org
Tue May 8 18:02:42 CEST 2018


Commit: e3d76bb5e9557e63df934508cbb8d0ebd183afcf
Author: Joshua Leung
Date:   Sun Dec 24 00:42:12 2017 +1300
Branches: PSketch-279
https://developer.blender.org/rBe3d76bb5e9557e63df934508cbb8d0ebd183afcf

Starting new branch for developing PSculpt/Sketching using 2.79 as a base

===================================================================

M	release/scripts/startup/bl_ui/space_view3d_toolbar.py
M	source/blender/blenkernel/intern/scene.c
M	source/blender/blenloader/intern/versioning_270.c
M	source/blender/blenloader/intern/versioning_defaults.c
M	source/blender/editors/armature/CMakeLists.txt
M	source/blender/editors/armature/armature_intern.h
M	source/blender/editors/armature/armature_ops.c
A	source/blender/editors/armature/pose_sculpt.c
A	source/blender/editors/armature/pose_sketch.c
M	source/blender/makesdna/DNA_scene_types.h
M	source/blender/makesrna/intern/rna_scene.c
M	source/blender/makesrna/intern/rna_sculpt_paint.c

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 3792ac13d18..7e6d6670234 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -875,6 +875,102 @@ class VIEW3D_PT_tools_posemode_options(View3DPanel, Panel):
 
         self.layout.prop(arm, "use_auto_ik")
 
+
+class VIEW3D_PT_tools_posemode_sculpt(View3DPanel, Panel):
+    bl_category = "Sculpt"
+    bl_context = "posemode"
+    bl_label = "Pose Sculpt"
+
+    def draw(self, context):
+        layout = self.layout
+
+        settings = context.tool_settings.pose_sculpt
+
+        tool = settings.tool
+        brush = settings.brush
+
+        layout.column().prop(settings, "tool", expand=True)
+
+        layout.separator()
+
+        if tool != 'NONE':
+            col = layout.column()
+            col.prop(brush, "size", slider=True)
+            subcol = col.row(align=True)
+            subcol.prop(brush, "strength", slider=True)
+            subcol.prop(brush, "use_pressure_strength", text="")
+            col.prop(brush, "use_falloff") # XXX: should be with rate?
+
+        if tool in ('CURL', 'TWIST', 'RESET', 'SMOOTH'):
+            col.separator()
+            col.prop(brush, "rate", slider=True)
+
+
+        layout.separator()
+        if tool == 'ADJUST':
+            row = layout.row(align=True)
+            row.prop_enum(brush, "direction", 'ADD', text="Tumble")      # Trackball
+            row.prop_enum(brush, "direction", 'SUBTRACT', text="Follow") # Rotate
+        elif tool in ('CURL', 'TWIST'):
+            row = layout.row(align=True)
+            row.prop_enum(brush, "direction", 'ADD', text="CCW")
+            row.prop_enum(brush, "direction", 'SUBTRACT', text="CW")
+        elif tool == 'RESET':
+            row = layout.row(align=True)
+            row.prop_enum(brush, "direction", 'ADD', text="Rest Pose")
+            #row.prop_enum(brush, "direction", 'SUBTRACT', text="Keyed")
+            row.prop_enum(brush, "direction", 'SUBTRACT', text="Pre-Sculpt")
+        elif tool not in ('NONE', 'GRAB', 'SMOOTH'):
+            layout.row().prop(brush, "direction", expand=True)
+
+        if tool in ('GRAB', 'DRAW', 'ADJUST'):
+            layout.prop(brush, "use_initial_only")
+        if tool in ('CURL', 'STRETCH'):
+            layout.row().prop(brush, "xz_mode", expand=True)
+
+        if tool == 'STRETCH':
+            layout.separator()
+            layout.prop(brush, "use_volume_preserve")
+
+            if brush.use_volume_preserve:
+                layout.prop(brush, "bulge", text="Volume Variation")
+                split = layout.split()
+                col = split.column(align=True)
+                col.prop(brush, "use_bulge_min", text="Volume Min")
+                sub = col.column()
+                sub.active = brush.use_bulge_min
+                sub.prop(brush, "bulge_min", text="")
+                col = split.column(align=True)
+                col.prop(brush, "use_bulge_max", text="Volume Max")
+                sub = col.column()
+                sub.active = brush.use_bulge_max
+                sub.prop(brush, "bulge_max", text="")
+                col = layout.column()
+                col.active = brush.use_bulge_min or brush.use_bulge_max
+                col.prop(brush, "bulge_smooth", text="Smooth")
+
+        if tool != 'SELECT':
+            layout.separator()
+            layout.prop(settings, "use_select_mask")
+
+
+class VIEW3D_PT_tools_posemode_sketch(View3DPanel, Panel):
+    bl_category = "Sketch"
+    bl_context = "posemode"
+    bl_label = "Pose Sketch"
+
+    def draw(self, context):
+        layout = self.layout
+        settings = context.tool_settings.pose_sketch
+
+        # XXX
+        layout.prop(settings, "use_offset")
+        layout.prop(settings, "use_stretch")
+        layout.prop(settings, "use_closest_end_first")
+        layout.prop(settings, "axis_mode", expand=True)
+        layout.prop(settings, "keep_stroke")
+	
+
 # ********** default tools for paint modes ****************
 
 
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index e45d2887250..5330950a171 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -550,6 +550,8 @@ void BKE_scene_free(Scene *sce)
 void BKE_scene_init(Scene *sce)
 {
 	ParticleEditSettings *pset;
+	PSculptSettings *psculpt;
+	PSketchSettings *psketch;
 	int a;
 	const char *colorspace_name;
 	SceneRenderView *srv;
@@ -742,6 +744,36 @@ void BKE_scene_init(Scene *sce)
 		pset->brush[a].count = 10;
 	}
 	pset->brush[PE_BRUSH_CUT].strength = 1.0f;
+	
+	psculpt = &sce->toolsettings->psculpt;
+	for (a = 0; a < PSCULPT_TOT_BRUSH; a++) {
+		psculpt->brush[a].strength = 0.5f;
+		psculpt->brush[a].size = 50;
+		psculpt->brush[a].rate = 0.01f;
+		psculpt->brush[a].flag = PSCULPT_BRUSH_FLAG_USE_PRESSURE | PSCULPT_BRUSH_FLAG_USE_FALLOFF;
+		
+		psculpt->brush[a].bulge = 1.0f;
+		psculpt->brush[a].bulge_min = 1.0f;
+		psculpt->brush[a].bulge_max = 1.0f;
+	}
+	psculpt->brush[PSCULPT_BRUSH_SMOOTH].strength = 0.25f;
+	psculpt->brush[PSCULPT_BRUSH_GRAB].strength = 1.0f;
+	psculpt->brush[PSCULPT_BRUSH_CURL].strength = 0.25f;
+	psculpt->brush[PSCULPT_BRUSH_TWIST].strength = 0.25f;
+	//psculpt->brush[PSCULPT_BRUSH_RESET].strength = 1.0f;
+	psculpt->brush[PSCULPT_BRUSH_CURL].xzMode = PSCULPT_BRUSH_DO_X;
+	psculpt->brush[PSCULPT_BRUSH_ADJUST].flag &= ~PSCULPT_BRUSH_FLAG_USE_FALLOFF;
+	psculpt->brush[PSCULPT_BRUSH_GRAB].flag |= PSCULPT_BRUSH_FLAG_GRAB_INITIAL;
+	psculpt->brush[PSCULPT_BRUSH_STRETCH].flag |= PSCULPT_BRUSH_FLAG_VOL_PRESERVE;
+	
+	psketch = &sce->toolsettings->psketch;
+	const float default_psketch_color[4] = {1.0f, 0.9f, 0.4f, 0.9f};
+	copy_v3_v3(psketch->color, default_psketch_color);
+	psketch->color[3] = default_psketch_color[3];
+	psketch->thickness = 4;
+	strcpy(psketch->layer_name, "PSketch");
+	
+	psketch->flag = PSKETCH_FLAG_USE_CLOSEST_END_FIRST;
 
 	sce->r.ffcodecdata.audio_mixrate = 48000;
 	sce->r.ffcodecdata.audio_volume = 1.0f;
diff --git a/source/blender/blenloader/intern/versioning_270.c b/source/blender/blenloader/intern/versioning_270.c
index fa7bf0c7dee..db87a93b7bf 100644
--- a/source/blender/blenloader/intern/versioning_270.c
+++ b/source/blender/blenloader/intern/versioning_270.c
@@ -344,6 +344,66 @@ static void do_version_bbone_easing_fcurve_fix(ID *UNUSED(id), FCurve *fcu, void
 			}
 		}
 	}
+	
+	
+	/* Pose Sculpt... */
+	if (!DNA_struct_elem_find(fd->filesdna, "ToolSettings", "PSculptSettings", "psculpt")) {
+		Scene *scene;
+		
+		/* init defaults for pose sculpt settings 
+		 * ! Keep in sync with blenkernel/scene.c - BKE_scene_init()
+		 *                and  blenloader/versioning_defaults.c
+		 */
+		for (scene = main->scene.first; scene; scene = scene->id.next) {
+			PSculptSettings *psculpt = &scene->toolsettings->psculpt;
+			
+			//if (psculpt->brush[0].size == 0) 
+			{
+				int i;
+				
+				for (i = 0; i < PSCULPT_TOT_BRUSH; i++) {
+					psculpt->brush[i].strength = 0.5f;
+					psculpt->brush[i].size = 50;
+					psculpt->brush[i].rate = 0.01f;
+					psculpt->brush[i].flag = PSCULPT_BRUSH_FLAG_USE_PRESSURE | PSCULPT_BRUSH_FLAG_USE_FALLOFF;
+					
+					psculpt->brush[i].bulge = 1.0f;
+					psculpt->brush[i].bulge_min = 1.0f;
+					psculpt->brush[i].bulge_max = 1.0f;
+				}
+				psculpt->brush[PSCULPT_BRUSH_SMOOTH].strength = 0.25f;
+				psculpt->brush[PSCULPT_BRUSH_GRAB].strength = 1.0f;
+				psculpt->brush[PSCULPT_BRUSH_CURL].strength = 0.25f;
+				psculpt->brush[PSCULPT_BRUSH_TWIST].strength = 0.25f;
+				//psculpt->brush[PSCULPT_BRUSH_RESET].strength = 1.0f;
+				psculpt->brush[PSCULPT_BRUSH_CURL].xzMode = PSCULPT_BRUSH_DO_X;
+				psculpt->brush[PSCULPT_BRUSH_ADJUST].flag &= ~PSCULPT_BRUSH_FLAG_USE_FALLOFF;
+				psculpt->brush[PSCULPT_BRUSH_GRAB].flag |= PSCULPT_BRUSH_FLAG_GRAB_INITIAL;
+				psculpt->brush[PSCULPT_BRUSH_STRETCH].flag |= PSCULPT_BRUSH_FLAG_VOL_PRESERVE;
+			}
+		}
+	}
+	
+	/* Pose Sketching */
+	if (!DNA_struct_elem_find(fd->filesdna, "ToolSettings", "PSketchSettings", "psketch")) {
+		Scene *scene;
+		
+		/* init defaults for pose sculpt settings 
+		 * ! Keep in sync with blenkernel/scene.c - BKE_scene_init()
+		 *                and  blenloader/versioning_defaults.c
+		 */
+		for (scene = main->scene.first; scene; scene = scene->id.next) {
+			PSketchSettings *psketch = &scene->toolsettings->psketch;
+			const float default_psketch_color[4] = {1.0f, 0.9f, 0.4f, 0.9f};
+			
+			copy_v3_v3(psketch->color, default_psketch_color);
+			psketch->color[3] = default_psketch_color[3];
+			psketch->thickness = 4;
+			strcpy(psketch->layer_name, "PSketch");
+			
+			psketch->flag = PSKETCH_FLAG_USE_CLOSEST_END_FIRST;
+		}
+	}
 }
 
 
diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c
index 3d3e73eb470..a5db47fb299 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -307,5 +307,55 @@ void BLO_update_defaults_startup_blend(Main *bmain)
 			br->flag |= BRUSH_ACCUMULATE;
 		}
 	}
+	
+	
+	/* Pose Sculpt and Pose Sketching */
+	{
+		Scene *scene;
+		
+		/* init defaults for pose sculpt settings 
+		 * ! Keep in sync with blenkernel/scene.c - BKE_scene_init()
+		 */
+		for (scene = bmain->scene.first; scene; scene = scene->id.next) {
+			PSculptSettings *psculpt = &scene->toolsettings->psculpt;
+			PSketchSettings *psketch = &scene->toolsettings->psketch;
+			
+			if (psculpt->brush[0].size == 0) {
+				int i;
+				
+				for (i = 0; i < PSCULPT_TOT_BRUSH; i++) {
+					psculpt->brush[i].strength = 0.5f;
+					psculpt->brush[i].size = 50;
+					psculpt->brush[i].rate = 0.01f;
+					psculpt->brush[i].flag = PSCULPT_BRUSH_FLAG_USE_PRESSURE | PSCULPT_BRUSH_FLAG_USE_FALLOFF;
+					
+					psculpt->brush[i].bulge = 1.0f;
+					psculpt->brush[i].bulge_min = 1.0f;
+					psculpt->brush[i].bulge_max = 1.0f;
+				}
+				psculpt->brush[PSCULPT_BRUSH_SMOOTH].strength = 0.25f;
+				psculpt->brush[PSCULPT_BRUSH_GRAB].strength = 1.0f;
+				psculpt->brush[PSCULPT_BRUSH_CURL].strength = 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list