「利用者:Koilz/2.67.1 Patch - pp tri」の版間の差分

提供: wiki
移動先: 案内検索
 
(1版 をインポートしました)
 
(相違点なし)

2018年6月29日 (金) 05:57時点における最新版

pp_tri

This adds the show_triangle property to
bTheme->ThemeUI->panel_show_triangle.
User_Preferences->Themes->User_Interface->Panel->Show_Triangle.
I added a short doc of changes + screenshot.

Pp tri.PNG

The patch was tested on 2.67b r58051 with patch.exe for windows.
When the patch is implemented, the theme.xml files will have to be updated.
This can be done by adding "panel_show_triangle" to <bpy><Theme><ThemeUserInterface>.
Before
<bpy>
  <Theme>
    <user_interface>
      <ThemeUserInterface menu_shadow_fac="0.5"
                          menu_shadow_width="12"
                          icon_file=""
                          icon_alpha="1"
                          axis_x="#dc0000"
                          axis_y="#00dc00"
                          axis_z="#0000dc">
After
<bpy>
  <Theme>
    <user_interface>
      <ThemeUserInterface menu_shadow_fac="0.5"
                          menu_shadow_width="12"
                          icon_file=""
                          icon_alpha="1"
                          axis_x="#dc0000"
                          axis_y="#00dc00"
                          axis_z="#0000dc"
                          panel_show_triangle="TRUE">
When the patch is implemented, the init_userdef_do_versions(void) code in resources.c.
The version number should be 1 sub version higher than the implemented version, i think.
Attached "pp_tri.txt"
To apply "patch.exe -p 0 -i pp_tri.txt"
To reverse "patch.exe -p 0 -i pp_tri.txt -R"
http://projects.blender.org/tracker/index.php?func=detail&aid=35931&group_id=9&atid=127

changes

This is a short doc of changes for the pp_tri.txt patch.

DNA

This replaces the "short pad;" with "short panel_show_triangle;".
bTheme->ThemeUI->panel_show_triangle.
source\blender\makesdna\DNA_userdef_types.h
Index: source/blender/makesdna/DNA_userdef_types.h
===================================================================
--- source/blender/makesdna/DNA_userdef_types.h	(revision 58051)
+++ source/blender/makesdna/DNA_userdef_types.h	(working copy)
@@ -171,7 +171,7 @@
 	float menu_shadow_fac;
 	short menu_shadow_width;
 	
-	short pad;
+	short panel_show_triangle;
 	
 	char iconfile[256];	// FILE_MAXFILE length
 	float icon_alpha;

RNA

This adds the bool property "panel_show_triangle".
source\blender\makesrna\intern\rna_userdef.c
Index: source/blender/makesrna/intern/rna_userdef.c
===================================================================
--- source/blender/makesrna/intern/rna_userdef.c	(revision 58051)
+++ source/blender/makesrna/intern/rna_userdef.c	(working copy)
@@ -1005,6 +1005,11 @@
 	RNA_def_property_array(prop, 3);
 	RNA_def_property_ui_text(prop, "Z Axis", "");
 	RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+	/* panel show triangle */
+	prop = RNA_def_property(srna, "panel_show_triangle", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_ui_text(prop, "Panel Show Triangle", "");
+	RNA_def_property_update(prop, 0, "rna_userdef_update");
 }
 
 static void rna_def_userdef_theme_space_generic(BlenderRNA *brna)

Resources

This adds the UI_ThemeGetColorPtr colorid to enum.
source\blender\editors\include\UI_resources.h
Index: source/blender/editors/include/UI_resources.h
===================================================================
--- source/blender/editors/include/UI_resources.h	(revision 58051)
+++ source/blender/editors/include/UI_resources.h	(working copy)
@@ -237,7 +237,9 @@
 
 	TH_LOW_GRAD,
 	TH_HIGH_GRAD,
-	TH_SHOW_BACK_GRAD
+	TH_SHOW_BACK_GRAD,
+
+	TH_PANEL_SHOW_TRIANGLE		/* panel_show_triangle */
 };
 /* XXX WARNING: previous is saved in file, so do not change order! */
 
This returns the color pointer if TH_PANEL_SHOW_TRIANGLE.
source\blender\editors\interface\resources.c
Index: source/blender/editors/interface/resources.c
===================================================================
--- source/blender/editors/interface/resources.c	(revision 58051)
+++ source/blender/editors/interface/resources.c	(working copy)
@@ -556,6 +556,11 @@
 					cp = btheme->tui.yaxis; break;
 				case TH_AXIS_Z:
 					cp = btheme->tui.zaxis; break;
+
+				case TH_PANEL_SHOW_TRIANGLE:
+					cp = &setting;
+					setting = btheme->tui.panel_show_triangle;
+					break;
 			}
 		}
 	}
This sets the 'reset to default' value.
source\blender\editors\interface\resources.c
Index: source/blender/editors/interface/resources.c
===================================================================
--- source/blender/editors/interface/resources.c	(revision 58051)
+++ source/blender/editors/interface/resources.c	(working copy)
@@ -710,6 +710,8 @@
 	rgba_char_args_set(btheme->tui.xaxis, 220,   0,   0, 255);
 	rgba_char_args_set(btheme->tui.yaxis,   0, 220,   0, 255);
 	rgba_char_args_set(btheme->tui.zaxis,   0,   0, 220, 255);
+
+	btheme->tui.panel_show_triangle = TRUE;
 
 	btheme->tui.menu_shadow_fac = 0.5f;
 	btheme->tui.menu_shadow_width = 12;
This sets the do_version default value.
source\blender\editors\interface\resources.c
Index: source/blender/editors/interface/resources.c
===================================================================
--- source/blender/editors/interface/resources.c	(revision 58051)
+++ source/blender/editors/interface/resources.c	(working copy)
@@ -2203,6 +2203,13 @@
 		}
 	}
 
+	if (U.versionfile < 267 || (U.versionfile == 267 && U.subversionfile < 2)) {
+		bTheme *btheme;
+		for (btheme = U.themes.first; btheme; btheme = btheme->next) {
+			btheme->tui.panel_show_triangle = TRUE;
+		}
+	}
+
 	/* NOTE!! from now on use U.versionfile and U.subversionfile */
 	
 	

Draw Code

This makes the draw code optional.
source\blender\editors\interface\interface_panel.c
Index: source/blender/editors/interface/interface_panel.c
===================================================================
--- source/blender/editors/interface/interface_panel.c	(revision 58051)
+++ source/blender/editors/interface/interface_panel.c	(working copy)
@@ -610,23 +610,26 @@
 		ofsx = 22;
 	}
 
-	/* draw collapse icon */
-	UI_ThemeColor(TH_TITLE);
-
-	/* itemrect smaller */
-	itemrect.xmin = headrect.xmin + 5.0f / block->aspect;
-	itemrect.xmax = itemrect.xmin + BLI_rcti_size_y(&headrect);
-	itemrect.ymin = headrect.ymin;
-	itemrect.ymax = headrect.ymax;
-
-	rectf_scale(&itemrect, 0.35f);
-
-	if (panel->flag & PNL_CLOSEDY)
-		ui_draw_tria_rect(&itemrect, 'h');
-	else if (panel->flag & PNL_CLOSEDX)
-		ui_draw_tria_rect(&itemrect, 'h');
-	else
-		ui_draw_tria_rect(&itemrect, 'v');
+
+	if(UI_GetThemeValue(TH_PANEL_SHOW_TRIANGLE)){
+		/* draw collapse icon */
+		UI_ThemeColor(TH_TITLE);
+
+		/* itemrect smaller */
+		itemrect.xmin = headrect.xmin + 5.0f / block->aspect;
+		itemrect.xmax = itemrect.xmin + BLI_rcti_size_y(&headrect);
+		itemrect.ymin = headrect.ymin;
+		itemrect.ymax = headrect.ymax;
+
+		rectf_scale(&itemrect, 0.35f);
+
+		if (panel->flag & PNL_CLOSEDY)
+			ui_draw_tria_rect(&itemrect, 'h');
+		else if (panel->flag & PNL_CLOSEDX)
+			ui_draw_tria_rect(&itemrect, 'h');
+		else
+			ui_draw_tria_rect(&itemrect, 'v');
+	}
 
 	(void)ofsx;
 }

Python

This displays the property, same fashion.
User_preference->Themes->User_Interface->Panel->Show_Triangle.
release\scripts\startup\bl_ui\space_userpref.py
Index: source/blender/editors/interface/resources.c
===================================================================
--- release/scripts/startup/bl_ui/space_userpref.py	(revision 58051)
+++ release/scripts/startup/bl_ui/space_userpref.py	(working copy)
@@ -769,6 +769,27 @@
 
             layout.separator()
             layout.separator()
+
+            col.label("Panel:")
+
+            row = col.row()
+
+            subsplit = row.split(percentage=0.95)
+
+            padding = subsplit.split(percentage=0.15)
+            colsub = padding.column()
+            colsub = padding.column()
+            colsub.row().prop(ui, "panel_show_triangle")
+
+            subsplit = row.split(percentage=0.85)
+
+            padding = subsplit.split(percentage=0.15)
+            colsub = padding.column()
+            colsub = padding.column()
+
+            col.separator()
+            col.separator()
+
         elif theme.theme_area == 'BONE_COLOR_SETS':
             col = split.column()
 
koil 08.07.13