Created
August 14, 2015 22:24
-
-
Save thebusytypist/68173569e311ae5b01ed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From d47c6c046b6272b46b3a292f861bbcf2d9173b14 Mon Sep 17 00:00:00 2001 | |
From: thebusytypist <ounanding@gmail.com> | |
Date: Fri, 14 Aug 2015 23:19:59 +0800 | |
Subject: [PATCH 1/2] Render new context button. | |
--- | |
source/blender/editors/space_buttons/buttons_context.c | 3 +++ | |
source/blender/makesdna/DNA_space_types.h | 1 + | |
source/blender/makesrna/intern/rna_space.c | 5 +++++ | |
3 files changed, 9 insertions(+) | |
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c | |
index bc42f1d..f01a4a2 100644 | |
--- a/source/blender/editors/space_buttons/buttons_context.c | |
+++ b/source/blender/editors/space_buttons/buttons_context.c | |
@@ -733,6 +733,9 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts) | |
else | |
sbuts->flag &= ~SB_SHADING_CONTEXT; | |
+ /* Always include BCONTEXT_SIMULATION */ | |
+ flag |= (1 << BCONTEXT_SIMULATION); | |
+ | |
sbuts->pathflag = flag; | |
} | |
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h | |
index 9c02362..a2023f3 100644 | |
--- a/source/blender/makesdna/DNA_space_types.h | |
+++ b/source/blender/makesdna/DNA_space_types.h | |
@@ -179,6 +179,7 @@ typedef enum eSpaceButtons_Context { | |
BCONTEXT_CONSTRAINT = 11, | |
BCONTEXT_BONE_CONSTRAINT = 12, | |
BCONTEXT_RENDER_LAYER = 13, | |
+ BCONTEXT_SIMULATION = 14, | |
/* always as last... */ | |
BCONTEXT_TOT | |
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c | |
index 5cc768a..c0a6964 100644 | |
--- a/source/blender/makesrna/intern/rna_space.c | |
+++ b/source/blender/makesrna/intern/rna_space.c | |
@@ -208,6 +208,7 @@ static EnumPropertyItem buttons_context_items[] = { | |
{BCONTEXT_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture"}, | |
{BCONTEXT_PARTICLE, "PARTICLES", ICON_PARTICLES, "Particles", "Particle"}, | |
{BCONTEXT_PHYSICS, "PHYSICS", ICON_PHYSICS, "Physics", "Physics"}, | |
+ {BCONTEXT_SIMULATION, "SIMULATION", ICON_ANIM, "Simulation", "Simulation"}, | |
{0, NULL, 0, NULL, NULL} | |
}; | |
@@ -1073,6 +1074,10 @@ static EnumPropertyItem *rna_SpaceProperties_context_itemf(bContext *UNUSED(C), | |
RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_PHYSICS); | |
} | |
+ if (sbuts->pathflag & (1 << BCONTEXT_SIMULATION)) { | |
+ RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_SIMULATION); | |
+ } | |
+ | |
RNA_enum_item_end(&item, &totitem); | |
*r_free = true; | |
-- | |
1.9.5.msysgit.1 | |
From 7ee36f427f906269e30e2dad1d726317335ab126 Mon Sep 17 00:00:00 2001 | |
From: thebusytypist <ounanding@gmail.com> | |
Date: Sat, 15 Aug 2015 00:11:08 +0800 | |
Subject: [PATCH 2/2] Draw panels for the new context. | |
--- | |
release/datafiles/locale | 2 +- | |
release/scripts/addons | 2 +- | |
release/scripts/addons_contrib | 2 +- | |
release/scripts/startup/bl_ui/__init__.py | 1 + | |
.../scripts/startup/bl_ui/properties_simulation.py | 41 ++++++++++++++++++++++ | |
.../editors/space_buttons/buttons_context.c | 6 ++-- | |
.../blender/editors/space_buttons/space_buttons.c | 2 ++ | |
7 files changed, 50 insertions(+), 6 deletions(-) | |
create mode 100644 release/scripts/startup/bl_ui/properties_simulation.py | |
diff --git a/release/datafiles/locale b/release/datafiles/locale | |
index da05fa0..06bedbb 160000 | |
--- a/release/datafiles/locale | |
+++ b/release/datafiles/locale | |
@@ -1 +1 @@ | |
-Subproject commit da05fa08d4e80a634a91a82f211589587f9169bc | |
+Subproject commit 06bedbb3d37d4369748c6af4a40db549efe92065 | |
diff --git a/release/scripts/addons b/release/scripts/addons | |
index 45b1e42..0c5b35f 160000 | |
--- a/release/scripts/addons | |
+++ b/release/scripts/addons | |
@@ -1 +1 @@ | |
-Subproject commit 45b1e42fffd550b4250f953a1933892c913b7182 | |
+Subproject commit 0c5b35fda451b6607d348abd0cf199217844004f | |
diff --git a/release/scripts/addons_contrib b/release/scripts/addons_contrib | |
index 5b36ccb..a71b3a5 160000 | |
--- a/release/scripts/addons_contrib | |
+++ b/release/scripts/addons_contrib | |
@@ -1 +1 @@ | |
-Subproject commit 5b36ccbe7d5f830b541540b7befad3b93af51ee8 | |
+Subproject commit a71b3a51be57cc1f76e217e267d117a25d98147a | |
diff --git a/release/scripts/startup/bl_ui/__init__.py b/release/scripts/startup/bl_ui/__init__.py | |
index c110b42..6bfe9e7 100644 | |
--- a/release/scripts/startup/bl_ui/__init__.py | |
+++ b/release/scripts/startup/bl_ui/__init__.py | |
@@ -58,6 +58,7 @@ _modules = [ | |
"properties_render", | |
"properties_render_layer", | |
"properties_scene", | |
+ "properties_simulation", | |
"properties_texture", | |
"properties_world", | |
"space_clip", | |
diff --git a/release/scripts/startup/bl_ui/properties_simulation.py b/release/scripts/startup/bl_ui/properties_simulation.py | |
new file mode 100644 | |
index 0000000..b159834 | |
--- /dev/null | |
+++ b/release/scripts/startup/bl_ui/properties_simulation.py | |
@@ -0,0 +1,41 @@ | |
+# ##### BEGIN GPL LICENSE BLOCK ##### | |
+# | |
+# This program is free software; you can redistribute it and/or | |
+# modify it under the terms of the GNU General Public License | |
+# as published by the Free Software Foundation; either version 2 | |
+# of the License, or (at your option) any later version. | |
+# | |
+# This program is distributed in the hope that it will be useful, | |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
+# GNU General Public License for more details. | |
+# | |
+# You should have received a copy of the GNU General Public License | |
+# along with this program; if not, write to the Free Software Foundation, | |
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
+# | |
+# ##### END GPL LICENSE BLOCK ##### | |
+ | |
+# <pep8 compliant> | |
+import bpy | |
+from bpy.types import Panel, Menu | |
+from rna_prop_ui import PropertyPanel | |
+ | |
+ | |
+class SimulationButtonsPanel: | |
+ bl_space_type = 'PROPERTIES' | |
+ bl_region_type = 'WINDOW' | |
+ bl_context = "simulation" | |
+ | |
+ | |
+class SIMULATION_PT_context_simulation(SimulationButtonsPanel, Panel): | |
+ bl_label = "" | |
+ bl_options = {'HIDE_HEADER'} | |
+ | |
+ def draw(self, context): | |
+ print("SimulationPanel.draw") | |
+ layout = self.layout | |
+ layout.label(text="Coming soon.") | |
+ | |
+if __name__ == "__main__": # only for live edit. | |
+ bpy.utils.register_module(__name__) | |
diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c | |
index f01a4a2..c34c7b1 100644 | |
--- a/source/blender/editors/space_buttons/buttons_context.c | |
+++ b/source/blender/editors/space_buttons/buttons_context.c | |
@@ -667,6 +667,9 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts) | |
PointerRNA *ptr; | |
int a, pflag = 0, flag = 0; | |
+ /* Always include BCONTEXT_SIMULATION */ | |
+ flag |= (1 << BCONTEXT_SIMULATION); | |
+ | |
if (!sbuts->path) | |
sbuts->path = MEM_callocN(sizeof(ButsContextPath), "ButsContextPath"); | |
@@ -733,9 +736,6 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts) | |
else | |
sbuts->flag &= ~SB_SHADING_CONTEXT; | |
- /* Always include BCONTEXT_SIMULATION */ | |
- flag |= (1 << BCONTEXT_SIMULATION); | |
- | |
sbuts->pathflag = flag; | |
} | |
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c | |
index a778df4..72f68f0 100644 | |
--- a/source/blender/editors/space_buttons/space_buttons.c | |
+++ b/source/blender/editors/space_buttons/space_buttons.c | |
@@ -169,6 +169,8 @@ static void buttons_main_area_draw(const bContext *C, ARegion *ar) | |
ED_region_panels(C, ar, vertical, "constraint", sbuts->mainb); | |
else if (sbuts->mainb == BCONTEXT_BONE_CONSTRAINT) | |
ED_region_panels(C, ar, vertical, "bone_constraint", sbuts->mainb); | |
+ else if (sbuts->mainb == BCONTEXT_SIMULATION) | |
+ ED_region_panels(C, ar, vertical, "simulation", sbuts->mainb); | |
sbuts->re_align = 0; | |
sbuts->mainbo = sbuts->mainb; | |
-- | |
1.9.5.msysgit.1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment