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
diff options
context:
space:
mode:
authorMichael Fox <mfoxdogg@gmail.com>2009-03-30 12:17:43 +0400
committerMichael Fox <mfoxdogg@gmail.com>2009-03-30 12:17:43 +0400
commit78a3db7d64f5e021a9c9db2d31712f2f8dd12267 (patch)
tree4d28ebdf41838006ea88cfb6ab669888067b194a /source/blender/editors
parent89b906db9f758fb9642e01d9b4433b97557369fb (diff)
2.5
******* ported some of the scene buttons to the new system - added RNA_SceneRenderData struct to rna - added a warning print to uiItemR when it can't find the property - what is not there is due to relating entry not being in RNA - anim button does not work Im commiting this so we have much more wider test area then text and object buttons
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/interface/interface_layout.c4
-rw-r--r--source/blender/editors/space_buttons/buttons_intern.h2
-rw-r--r--source/blender/editors/space_buttons/buttons_scene.c167
-rw-r--r--source/blender/editors/space_buttons/space_buttons.c13
4 files changed, 167 insertions, 19 deletions
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index f6f5bae5fa5..5ede83fafd6 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -526,8 +526,10 @@ void uiItemFullR(uiLayout *layout, int slot, const char *name, int icon, Pointer
uiItemRNA *rnaitem;
prop= RNA_struct_find_property(ptr, propname);
- if(!prop)
+ if(!prop){
+ printf("Property not found : %s \n",propname);
return;
+ }
rnaitem= MEM_callocN(sizeof(uiItemRNA), "uiItemRNA");
diff --git a/source/blender/editors/space_buttons/buttons_intern.h b/source/blender/editors/space_buttons/buttons_intern.h
index e979e815e18..50b4f7ba5eb 100644
--- a/source/blender/editors/space_buttons/buttons_intern.h
+++ b/source/blender/editors/space_buttons/buttons_intern.h
@@ -78,7 +78,7 @@ struct bContext;
/* image_header.c */
void buttons_header_buttons(const struct bContext *C, struct ARegion *ar);
-void buttons_scene(const struct bContext *C, struct ARegion *ar);
+void buttons_scene_register(struct ARegionType *art);
void buttons_object_register(struct ARegionType *art);
#endif /* ED_BUTTONS_INTERN_H */
diff --git a/source/blender/editors/space_buttons/buttons_scene.c b/source/blender/editors/space_buttons/buttons_scene.c
index ca645ab1845..25afaa6928c 100644
--- a/source/blender/editors/space_buttons/buttons_scene.c
+++ b/source/blender/editors/space_buttons/buttons_scene.c
@@ -29,14 +29,18 @@
#include <stdio.h>
#include <stdlib.h>
+#include "MEM_guardedalloc.h"
+
#include "DNA_space_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "BLI_threads.h"
+#include "BLI_listbase.h"
#include "BKE_context.h"
#include "BKE_global.h"
+#include "BKE_screen.h"
#include "RE_pipeline.h"
@@ -47,6 +51,7 @@
#include "UI_resources.h"
#include "WM_types.h"
+#include "WM_api.h"
#include "buttons_intern.h"
@@ -206,13 +211,124 @@ static void render_panel_bake(const bContext *C, ARegion *ar)
uiEndBlock(C, block);
}
+static void render_panel_shading(const bContext *C, Panel *pnl)
+{
+ uiLayout *layout= pnl->layout;
+ Scene *scene= CTX_data_scene(C);
+ PointerRNA sceneptr, renderptr;
+
+ RNA_id_pointer_create(&scene->id, &sceneptr);
+ renderptr = RNA_pointer_get(&sceneptr, "render_data");
+
+ uiTemplateColumn(layout);
+ uiItemR(layout, UI_TSLOT_COLUMN_1, "Shadow", 0, &renderptr, "render_shadows");
+ uiItemR(layout, UI_TSLOT_COLUMN_2, "SSS", 0, &renderptr, "render_sss");
+ uiItemR(layout, UI_TSLOT_COLUMN_3, "EnvMap", 0, &renderptr, "render_envmaps");
+ uiItemR(layout, UI_TSLOT_COLUMN_4, "Radio", 0, &renderptr, "render_radiosity");
+
+ uiTemplateColumn(layout);
+ uiItemLabel(layout, UI_TSLOT_COLUMN_1, "Ray Tracing:", 0);
+ uiTemplateColumn(layout);
+ uiItemR(layout, UI_TSLOT_COLUMN_1, "Enable", 0, &renderptr, "render_raytracing");
+ uiItemR(layout, UI_TSLOT_COLUMN_2, NULL, 0, &renderptr, "octree_resolution");
+
+ uiTemplateColumn(layout);
+ uiItemLabel(layout, UI_TSLOT_COLUMN_1, "Alpha:", 0);
+ uiTemplateColumn(layout);
+ uiItemR(layout, UI_TSLOT_COLUMN_1, NULL, 0, &renderptr, "alpha_mode");
+
+}
+static void render_panel_image(const bContext *C, Panel *pnl)
+{
+ uiLayout *layout= pnl->layout;
+ Scene *scene= CTX_data_scene(C);
+ PointerRNA sceneptr, renderptr;
+
+ RNA_id_pointer_create(&scene->id, &sceneptr);
+ renderptr = RNA_pointer_get(&sceneptr, "render_data");
+
+ uiTemplateColumn(layout);
+ uiItemR(layout, UI_TSLOT_COLUMN_1, "SizeX", 0, &renderptr, "resolution_x");
+ uiItemR(layout, UI_TSLOT_COLUMN_2, "SizeY", 0, &renderptr, "resolution_y");
+ uiItemR(layout, UI_TSLOT_COLUMN_1, "AspX", 0, &renderptr, "pixel_aspect_x");
+ uiItemR(layout, UI_TSLOT_COLUMN_2, "AspY", 0, &renderptr, "pixel_aspect_y");
+ uiTemplateColumn(layout);
+ uiItemR(layout, UI_TSLOT_COLUMN_1, NULL, 0, &renderptr, "crop_to_border");
-static void render_panel_render(const bContext *C, ARegion *ar)
+}
+static void render_panel_antialiasing(const bContext *C, Panel *pnl)
{
- uiBlock *block;
+ uiLayout *layout= pnl->layout;
+ Scene *scene= CTX_data_scene(C);
+ PointerRNA sceneptr, renderptr;
+
+ RNA_id_pointer_create(&scene->id, &sceneptr);
+ renderptr = RNA_pointer_get(&sceneptr, "render_data");
+
+ uiTemplateColumn(layout);
+ uiItemR(layout, UI_TSLOT_COLUMN_1, "Enable", 0, &renderptr, "antialiasing");
+ uiItemR(layout, UI_TSLOT_COLUMN_1, "Num Samples", 0, &renderptr, "antialiasing_samples");
+ uiItemR(layout, UI_TSLOT_COLUMN_2, NULL, 0, &renderptr, "pixel_filter");
+ uiItemR(layout, UI_TSLOT_COLUMN_2, NULL, 0, &renderptr, "filter_size");
+
+}
+
+static void render_panel_render(const bContext *C, Panel *pnl)
+{
+ uiLayout *layout= pnl->layout;
Scene *scene= CTX_data_scene(C);
- char str[256];
+ PointerRNA sceneptr, renderptr, animptr;
+
+ RNA_id_pointer_create(&scene->id, &sceneptr);
+ renderptr = RNA_pointer_get(&sceneptr, "render_data");
+ WM_operator_properties_create(&animptr, "SCREEN_OT_render");
+
+ uiTemplateColumn(layout);
+ uiItemO(layout, UI_TSLOT_COLUMN_1, "RENDER", ICON_SCENE, "SCREEN_OT_render");
+ uiItemR(layout, UI_TSLOT_COLUMN_2, "ANIM", 0, &animptr, "anim");
+
+ uiTemplateColumn(layout);
+ uiItemR(layout, UI_TSLOT_COLUMN_1, "Sfra", 0, &sceneptr, "start_frame");
+ uiItemR(layout, UI_TSLOT_COLUMN_2, "Cfra", 0, &sceneptr, "current_frame");
+ uiItemR(layout, UI_TSLOT_COLUMN_3, "Efra", 0, &sceneptr, "end_frame");
+
+ uiTemplateColumn(layout);
+ uiItemR(layout, UI_TSLOT_COLUMN_1, NULL, 0, &renderptr, "do_composite");
+ uiItemR(layout, UI_TSLOT_COLUMN_2, NULL, 0, &renderptr, "do_sequence");
+ uiTemplateColumn(layout);
+ uiItemR(layout, UI_TSLOT_COLUMN_1, "Camera:", 0, &sceneptr, "camera");
+
+ uiTemplateColumn(layout);
+ uiItemLabel(layout, UI_TSLOT_COLUMN_1, "General:", 0);
+ uiTemplateColumn(layout);
+ uiItemR(layout, UI_TSLOT_COLUMN_1, "Size ", 0, &renderptr, "resolution_percentage");
+ uiItemR(layout, UI_TSLOT_COLUMN_1, NULL, 0, &renderptr, "dither_intensity");
+
+ uiTemplateColumn(layout);
+ uiItemR(layout, UI_TSLOT_COLUMN_1, NULL, 0, &renderptr, "parts_x");
+ uiItemR(layout, UI_TSLOT_COLUMN_2, NULL, 0, &renderptr, "parts_y");
+
+ uiTemplateColumn(layout);
+ uiItemLabel(layout, UI_TSLOT_COLUMN_1, "Multi-Threading:", 0);
+ uiTemplateColumn(layout);
+ uiItemR(layout, UI_TSLOT_COLUMN_1, NULL, 0, &renderptr, "threads_mode");
+ uiItemR(layout, UI_TSLOT_COLUMN_1, NULL, 0, &renderptr, "threads");
+
+ uiTemplateColumn(layout);
+ uiItemLabel(layout, UI_TSLOT_COLUMN_1, "Fields:", 0);
+ uiTemplateColumn(layout);
+ uiItemR(layout, UI_TSLOT_COLUMN_1, "Enable", 0, &renderptr, "fields");
+ uiItemR(layout, UI_TSLOT_COLUMN_2, NULL, 0, &renderptr, "field_order");
+ uiItemR(layout, UI_TSLOT_COLUMN_3, NULL, 0, &renderptr, "fields_still");
+
+ uiTemplateColumn(layout);
+ uiItemLabel(layout, UI_TSLOT_COLUMN_1, "Extra:", 0);
+ uiTemplateColumn(layout);
+ uiItemR(layout, UI_TSLOT_COLUMN_1, "Border Render", 0, &renderptr, "border");
+ uiItemR(layout, UI_TSLOT_COLUMN_2, NULL, 0, &renderptr, "panorama");
+
+#if 0
block= uiBeginBlock(C, ar, "render_panel_render", UI_EMBOSS, UI_HELV);
if(uiNewPanel(C, ar, block, "Render", "Render", 320, 0, 318, 204)==0) return;
@@ -284,6 +400,7 @@ static void render_panel_render(const bContext *C, ARegion *ar)
uiBlockEndAlign(block);
uiEndBlock(C, block);
+#endif
}
@@ -318,16 +435,40 @@ void render_panel_anim(const bContext *C, ARegion *ar)
uiEndBlock(C, block);
}
-void buttons_scene(const bContext *C, ARegion *ar)
+void buttons_scene_register(ARegionType *art)
{
- SpaceButs *sbuts= (SpaceButs*)CTX_wm_space_data(C);
- int tab= sbuts->tab[CONTEXT_SCENE];
-
- if(tab == TAB_SCENE_RENDER) {
- render_panel_output(C, ar);
- render_panel_render(C, ar);
- render_panel_anim(C, ar);
- render_panel_bake(C, ar);
- }
+ PanelType *pt;
+
+ /* panels: Render */
+ pt= MEM_callocN(sizeof(PanelType), "spacetype buttons panel");
+ pt->idname= "RENDER_PT_render";
+ pt->name= "Render";
+ pt->context= "render";
+ pt->draw= render_panel_render;
+ BLI_addtail(&art->paneltypes, pt);
+
+ /* panels: Shading */
+ pt= MEM_callocN(sizeof(PanelType), "spacetype buttons panel");
+ pt->idname= "RENDER_PT_image";
+ pt->name= "Image";
+ pt->context= "render";
+ pt->draw= render_panel_image;
+ BLI_addtail(&art->paneltypes, pt);
+
+ /* panels: AntiAliasing */
+ pt= MEM_callocN(sizeof(PanelType), "spacetype buttons panel");
+ pt->idname= "RENDER_PT_antialias";
+ pt->name= "AntiAliasing";
+ pt->context= "render";
+ pt->draw= render_panel_antialiasing;
+ BLI_addtail(&art->paneltypes, pt);
+
+ /* panels: Shading */
+ pt= MEM_callocN(sizeof(PanelType), "spacetype buttons panel");
+ pt->idname= "RENDER_PT_shading";
+ pt->name= "Shading";
+ pt->context= "render";
+ pt->draw= render_panel_shading;
+ BLI_addtail(&art->paneltypes, pt);
}
diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c
index bae318ff454..61946744196 100644
--- a/source/blender/editors/space_buttons/space_buttons.c
+++ b/source/blender/editors/space_buttons/space_buttons.c
@@ -166,6 +166,13 @@ static void buttons_main_area_draw(const bContext *C, ARegion *ar)
if(tab == TAB_OBJECT_OBJECT)
uiRegionPanelLayout(C, ar, vertical, "object");
}
+ else if (sbuts->mainb == CONTEXT_SCENE){
+ int tab= sbuts->tab[CONTEXT_SCENE];
+ int vertical= (sbuts->align == 2);
+
+ if(tab == TAB_SCENE_RENDER)
+ uiRegionPanelLayout(C, ar, vertical, "render");
+ }
else {
View2D *v2d= &ar->v2d;
float col[3], fac;
@@ -184,10 +191,7 @@ static void buttons_main_area_draw(const bContext *C, ARegion *ar)
glRecti(20, v2d->cur.ymin+2, 30, v2d->cur.ymin+12);
/* panels */
- if(sbuts->mainb == CONTEXT_SCENE)
- buttons_scene(C, ar);
- else
- drawnewstuff();
+ drawnewstuff();
#if 0
if(sbuts->align)
@@ -282,6 +286,7 @@ void ED_spacetype_buttons(void)
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES;
buttons_object_register(art);
+ buttons_scene_register(art);
BLI_addhead(&st->regiontypes, art);