From 5ea992df98d152f83072e886a0b1f9464a4883d6 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 18 Jun 2009 14:20:25 +0000 Subject: UI: * Fix context.cloth, was not being set correct. * Fix errors with context pinning, scripts should not assume context.object to be there. * Always show preview even if e.g. the material is not set, to keep ID buttons from jumping while you're using them. --- source/blender/editors/space_buttons/buttons_context.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'source/blender/editors/space_buttons') diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 255bee1bf5a..42180e7902f 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -574,8 +574,14 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r return 1; } else if(CTX_data_equals(member, "cloth")) { - set_pointer_type(path, result, &RNA_ClothModifier); - return 1; + PointerRNA *ptr= get_pointer_type(path, &RNA_Object); + + if(ptr && ptr->data) { + Object *ob= ptr->data; + ModifierData *md= modifiers_findByType(ob, eModifierType_Cloth); + CTX_data_pointer_set(result, &ob->id, &RNA_ClothModifier, md); + return 1; + } } else if(CTX_data_equals(member, "soft_body")) { PointerRNA *ptr= get_pointer_type(path, &RNA_Object); -- cgit v1.2.3 From 6c139156cf2b47ea9d8e7606204205cb01d4ad21 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Fri, 19 Jun 2009 14:56:49 +0000 Subject: RNA: * EditBone wrapped, using manual get/set function, and used in the UI code. Makes the RNA wrapping code here more complicated, but works. --- .../editors/space_buttons/buttons_context.c | 28 ++++++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'source/blender/editors/space_buttons') diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 42180e7902f..fc280d9b551 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -54,6 +54,7 @@ #include "RNA_access.h" +#include "ED_armature.h" #include "ED_screen.h" #include "UI_interface.h" @@ -249,16 +250,29 @@ static int buttons_context_path_bone(ButsContextPath *path) { bArmature *arm; Bone *bone; + EditBone *edbo; /* if we have an armature, get the active bone */ if(buttons_context_path_data(path, OB_ARMATURE)) { arm= path->ptr[path->len-1].data; - bone= find_active_bone(arm->bonebase.first); - if(bone) { - RNA_pointer_create(&arm->id, &RNA_Bone, bone, &path->ptr[path->len]); - path->len++; - return 1; + if(arm->edbo) { + for(edbo=arm->edbo->first; edbo; edbo=edbo->next) { + if(edbo->flag & BONE_ACTIVE) { + RNA_pointer_create(&arm->id, &RNA_EditBone, edbo, &path->ptr[path->len]); + path->len++; + return 1; + } + } + } + else { + bone= find_active_bone(arm->bonebase.first); + + if(bone) { + RNA_pointer_create(&arm->id, &RNA_Bone, bone, &path->ptr[path->len]); + path->len++; + return 1; + } } } @@ -569,6 +583,10 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r set_pointer_type(path, result, &RNA_Bone); return 1; } + else if(CTX_data_equals(member, "edit_bone")) { + set_pointer_type(path, result, &RNA_EditBone); + return 1; + } else if(CTX_data_equals(member, "particle_system")) { set_pointer_type(path, result, &RNA_ParticleSystem); return 1; -- cgit v1.2.3 From ad07fc19c0fb97540bfe8d259c0b39098b9d7b9b Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 20 Jun 2009 14:55:28 +0000 Subject: Context Python dir(context) now gives the items from the data context too, modified context callbacks to also return a list of items in the context. --- source/blender/editors/space_buttons/buttons_context.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'source/blender/editors/space_buttons') diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index fc280d9b551..d97b4acdb96 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -492,8 +492,17 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r return 0; /* here we handle context, getting data from precomputed path */ - - if(CTX_data_equals(member, "world")) { + if(CTX_data_dir(member)) { + static const char *dir[] = { + "world", "object", "meshe", "armature", "lattice", "curve", + "meta_ball", "lamp", "camera", "material", "material_slot", + "texture", "texture_slot", "bone", "edit_bone", "particle_system", + "cloth", "soft_body", "fluid", NULL}; + + CTX_data_dir_set(result, dir); + return 1; + } + else if(CTX_data_equals(member, "world")) { set_pointer_type(path, result, &RNA_World); return 1; } -- cgit v1.2.3 From c549e75c1690dd740540d1349593983ae6dd08d9 Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Sun, 21 Jun 2009 10:26:39 +0000 Subject: 2.5 Buttons Window: * WIP Commit: Started wrapping the buttons header to python. Still disabled due to some display problems. --- source/blender/editors/space_buttons/space_buttons.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/space_buttons') diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 38ce88019ed..e5d2215be29 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -220,14 +220,23 @@ void buttons_keymap(struct wmWindowManager *wm) } +//#define PY_HEADER /* add handlers, stuff you only do once or on area/region changes */ static void buttons_header_area_init(wmWindowManager *wm, ARegion *ar) { +#ifdef PY_HEADER + ED_region_header_init(ar); +#else UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy); +#endif } static void buttons_header_area_draw(const bContext *C, ARegion *ar) { +#ifdef PY_HEADER + ED_region_header(C, ar); +#else + float col[3]; /* clear */ @@ -243,7 +252,8 @@ static void buttons_header_area_draw(const bContext *C, ARegion *ar) UI_view2d_view_ortho(C, &ar->v2d); buttons_header_buttons(C, ar); - +#endif + /* restore view matrix? */ UI_view2d_view_restore(C); } -- cgit v1.2.3 From 8ead648fd1ca35f02901764445afc7b675524b67 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 21 Jun 2009 16:18:38 +0000 Subject: Spring Cleaning * removed radiosity render code, DNA and RNA (left in radio render pass options), we'll get GI to replace this probably, better allow baking to vertex colors for people who used this. * removed deprecated solid physics library, sumo integrations and qhull, a dependency * removed ODE, was no longer being build or supported * remove BEOS and AMIGA defines and references in Makefiles. --- source/blender/editors/space_buttons/SConscript | 3 --- 1 file changed, 3 deletions(-) (limited to 'source/blender/editors/space_buttons') diff --git a/source/blender/editors/space_buttons/SConscript b/source/blender/editors/space_buttons/SConscript index 541da52f7f9..a0a7dad4077 100644 --- a/source/blender/editors/space_buttons/SConscript +++ b/source/blender/editors/space_buttons/SConscript @@ -12,7 +12,4 @@ defs = [] if env['WITH_BF_GAMEENGINE']: defs.append('GAMEBLENDER=1') - if env['WITH_BF_SOLID']: - defs.append('USE_SUMO_SOLID') - env.BlenderLib ( 'bf_editors_space_buttons', sources, Split(incs), defs, libtype=['core'], priority=[120] ) -- cgit v1.2.3 From 333e231fa6c8e44582d94fedd2dda958e5131316 Mon Sep 17 00:00:00 2001 From: "Guillermo S. Romero" Date: Tue, 23 Jun 2009 00:09:26 +0000 Subject: SVN maintenance. --- source/blender/editors/space_buttons/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/editors/space_buttons') diff --git a/source/blender/editors/space_buttons/Makefile b/source/blender/editors/space_buttons/Makefile index b96d1cc5495..a4894ede06b 100644 --- a/source/blender/editors/space_buttons/Makefile +++ b/source/blender/editors/space_buttons/Makefile @@ -1,5 +1,5 @@ # -# $Id: Makefile 14 2002-10-13 15:57:19Z hans $ +# $Id$ # # ***** BEGIN GPL LICENSE BLOCK ***** # -- cgit v1.2.3 From 242d9c31d3316f99525925eb7da30522457064e8 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 24 Jun 2009 14:03:55 +0000 Subject: RNA * RNA_struct_name_get_alloc function to get the name from a pointer, instead of having to deal with name property. * CTX_data_pointer_get_type to get data from context with a check for the RNA type. --- source/blender/editors/space_buttons/buttons_context.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'source/blender/editors/space_buttons') diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index d97b4acdb96..cba9a4cf8fc 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -668,7 +668,6 @@ void buttons_context_draw(const bContext *C, uiLayout *layout) uiBlock *block; uiBut *but; PointerRNA *ptr; - PropertyRNA *nameprop; char namebuf[128], *name; int a, icon; @@ -688,7 +687,7 @@ void buttons_context_draw(const bContext *C, uiLayout *layout) if(ptr->data) { icon= RNA_struct_ui_icon(ptr->type); - nameprop= RNA_struct_name_property(ptr->type); + name= RNA_struct_name_get_alloc(ptr, namebuf, sizeof(namebuf)); #if 0 if(sbuts->mainb != BCONTEXT_SCENE && ptr->type == &RNA_Scene) { @@ -696,9 +695,7 @@ void buttons_context_draw(const bContext *C, uiLayout *layout) } else #endif - if(nameprop) { - name= RNA_property_string_get_alloc(ptr, nameprop, namebuf, sizeof(namebuf)); - + if(name) { uiItemL(row, name, icon); if(name != namebuf) -- cgit v1.2.3 From a379fdd7fba460fdceb14d6dd164116d9a4744bd Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 24 Jun 2009 14:07:48 +0000 Subject: 2.5: Object material slot operators add/remove/assign/select/deselect. --- .../blender/editors/space_buttons/buttons_intern.h | 6 + source/blender/editors/space_buttons/buttons_ops.c | 261 +++++++++++++++++++-- .../blender/editors/space_buttons/space_buttons.c | 6 + 3 files changed, 250 insertions(+), 23 deletions(-) (limited to 'source/blender/editors/space_buttons') diff --git a/source/blender/editors/space_buttons/buttons_intern.h b/source/blender/editors/space_buttons/buttons_intern.h index 196647a3750..b213e4288be 100644 --- a/source/blender/editors/space_buttons/buttons_intern.h +++ b/source/blender/editors/space_buttons/buttons_intern.h @@ -61,6 +61,12 @@ void buttons_context_draw(const struct bContext *C, struct uiLayout *layout); void buttons_context_register(struct ARegionType *art); /* buttons_ops.c */ +void OBJECT_OT_material_slot_add(struct wmOperatorType *ot); +void OBJECT_OT_material_slot_remove(struct wmOperatorType *ot); +void OBJECT_OT_material_slot_assign(struct wmOperatorType *ot); +void OBJECT_OT_material_slot_select(struct wmOperatorType *ot); +void OBJECT_OT_material_slot_deselect(struct wmOperatorType *ot); + void MATERIAL_OT_new(struct wmOperatorType *ot); void TEXTURE_OT_new(struct wmOperatorType *ot); void WORLD_OT_new(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index 63469a8294d..6755a2be1b7 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -30,6 +30,7 @@ #include "MEM_guardedalloc.h" +#include "DNA_curve_types.h" #include "DNA_object_types.h" #include "DNA_material_types.h" #include "DNA_texture_types.h" @@ -37,31 +38,250 @@ #include "DNA_world_types.h" #include "BKE_context.h" +#include "BKE_depsgraph.h" +#include "BKE_font.h" #include "BKE_library.h" #include "BKE_material.h" #include "BKE_texture.h" +#include "BKE_utildefines.h" #include "BKE_world.h" +#include "BLI_editVert.h" + #include "RNA_access.h" #include "WM_api.h" #include "WM_types.h" +#include "ED_curve.h" +#include "ED_mesh.h" + #include "buttons_intern.h" // own include +/********************** material slot operators *********************/ + +static int material_slot_add_exec(bContext *C, wmOperator *op) +{ + Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + + if(!ob) + return OPERATOR_CANCELLED; + + object_add_material_slot(ob); + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); + + return OPERATOR_FINISHED; +} + +void OBJECT_OT_material_slot_add(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Add Material Slot"; + ot->idname= "OBJECT_OT_material_slot_add"; + + /* api callbacks */ + ot->exec= material_slot_add_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + +static int material_slot_remove_exec(bContext *C, wmOperator *op) +{ + Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + + if(!ob) + return OPERATOR_CANCELLED; + + object_remove_material_slot(ob); + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); + + return OPERATOR_FINISHED; +} + +void OBJECT_OT_material_slot_remove(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Remove Material Slot"; + ot->idname= "OBJECT_OT_material_slot_remove"; + + /* api callbacks */ + ot->exec= material_slot_remove_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + +static int material_slot_assign_exec(bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + + if(!ob) + return OPERATOR_CANCELLED; + + if(ob && ob->actcol>0) { + if(ob->type == OB_MESH) { + EditMesh *em= ((Mesh*)ob->data)->edit_mesh; + EditFace *efa; + + if(em) { + for(efa= em->faces.first; efa; efa=efa->next) + if(efa->f & SELECT) + efa->mat_nr= ob->actcol-1; + } + } + else if(ELEM(ob->type, OB_CURVE, OB_SURF)) { + ListBase *editnurb= ((Curve*)ob->data)->editnurb; + Nurb *nu; + + if(editnurb) { + for(nu= editnurb->first; nu; nu= nu->next) + if(isNurbsel(nu)) + nu->mat_nr= nu->charidx= ob->actcol-1; + } + } + else if(ob->type == OB_FONT) { + EditFont *ef= ((Curve*)ob->data)->editfont; + int i, selstart, selend; + + if(ef && BKE_font_getselection(ob, &selstart, &selend)) { + for(i=selstart; i<=selend; i++) + ef->textbufinfo[i].mat_nr = ob->actcol-1; + } + } + } + + DAG_object_flush_update(scene, ob, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, ob); + + return OPERATOR_FINISHED; +} + +void OBJECT_OT_material_slot_assign(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Assign Material Slot"; + ot->idname= "OBJECT_OT_material_slot_assign"; + + /* api callbacks */ + ot->exec= material_slot_assign_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + +static int material_slot_de_select(bContext *C, int select) +{ + Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + + if(!ob) + return OPERATOR_CANCELLED; + + if(ob->type == OB_MESH) { + EditMesh *em= ((Mesh*)ob->data)->edit_mesh; + + if(em) { + if(select) + EM_select_by_material(em, ob->actcol-1); + else + EM_deselect_by_material(em, ob->actcol-1); + } + } + else if ELEM(ob->type, OB_CURVE, OB_SURF) { + ListBase *editnurb= ((Curve*)ob->data)->editnurb; + Nurb *nu; + BPoint *bp; + BezTriple *bezt; + int a; + + for(nu= editnurb->first; nu; nu=nu->next) { + if(nu->mat_nr==ob->actcol-1) { + if(nu->bezt) { + a= nu->pntsu; + bezt= nu->bezt; + while(a--) { + if(bezt->hide==0) { + if(select) { + bezt->f1 |= SELECT; + bezt->f2 |= SELECT; + bezt->f3 |= SELECT; + } + else { + bezt->f1 &= ~SELECT; + bezt->f2 &= ~SELECT; + bezt->f3 &= ~SELECT; + } + } + bezt++; + } + } + else if(nu->bp) { + a= nu->pntsu*nu->pntsv; + bp= nu->bp; + while(a--) { + if(bp->hide==0) { + if(select) bp->f1 |= SELECT; + else bp->f1 &= ~SELECT; + } + bp++; + } + } + } + } + } + + WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_SELECT, ob); + + return OPERATOR_FINISHED; +} + +static int material_slot_select_exec(bContext *C, wmOperator *op) +{ + return material_slot_de_select(C, 1); +} + +void OBJECT_OT_material_slot_select(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Select Material Slot"; + ot->idname= "OBJECT_OT_material_slot_select"; + + /* api callbacks */ + ot->exec= material_slot_select_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + +static int material_slot_deselect_exec(bContext *C, wmOperator *op) +{ + return material_slot_de_select(C, 0); +} + +void OBJECT_OT_material_slot_deselect(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Deselect Material Slot"; + ot->idname= "OBJECT_OT_material_slot_deselect"; + + /* api callbacks */ + ot->exec= material_slot_deselect_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + /********************** new material operator *********************/ static int new_material_exec(bContext *C, wmOperator *op) { - PointerRNA ptr; - Material *ma; + Material *ma= CTX_data_pointer_get_type(C, "material", &RNA_Material).data; Object *ob; + PointerRNA ptr; int index; /* add or copy material */ - ptr= CTX_data_pointer_get(C, "material"); - ma= (RNA_struct_is_a(ptr.type, &RNA_Material))? ptr.data: NULL; - if(ma) ma= copy_material(ma); else @@ -70,9 +290,9 @@ static int new_material_exec(bContext *C, wmOperator *op) ma->id.us--; /* compensating for us++ in assign_material */ /* attempt to assign to material slot */ - ptr= CTX_data_pointer_get(C, "material_slot"); + ptr= CTX_data_pointer_get_type(C, "material_slot", &RNA_MaterialSlot); - if(RNA_struct_is_a(ptr.type, &RNA_MaterialSlot)) { + if(ptr.data) { ob= ptr.id.data; index= (Material**)ptr.data - ob->mat; @@ -80,6 +300,8 @@ static int new_material_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); } + + WM_event_add_notifier(C, NC_MATERIAL|NA_ADDED, ma); return OPERATOR_FINISHED; } @@ -101,15 +323,12 @@ void MATERIAL_OT_new(wmOperatorType *ot) static int new_texture_exec(bContext *C, wmOperator *op) { - PointerRNA ptr; + Tex *tex= CTX_data_pointer_get_type(C, "texture", &RNA_Texture).data; ID *id; - Tex *tex; MTex *mtex; + PointerRNA ptr; /* add or copy texture */ - ptr= CTX_data_pointer_get(C, "texture"); - tex= (RNA_struct_is_a(ptr.type, &RNA_Texture))? ptr.data: NULL; - if(tex) tex= copy_texture(tex); else @@ -118,9 +337,9 @@ static int new_texture_exec(bContext *C, wmOperator *op) id_us_min(&tex->id); /* attempt to assign to texture slot */ - ptr= CTX_data_pointer_get(C, "texture_slot"); + ptr= CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot); - if(RNA_struct_is_a(ptr.type, &RNA_TextureSlot)) { + if(ptr.data) { id= ptr.id.data; mtex= ptr.data; @@ -133,6 +352,8 @@ static int new_texture_exec(bContext *C, wmOperator *op) /* XXX nodes, notifier .. */ } + + WM_event_add_notifier(C, NC_TEXTURE|NA_ADDED, tex); return OPERATOR_FINISHED; } @@ -154,27 +375,21 @@ void TEXTURE_OT_new(wmOperatorType *ot) static int new_world_exec(bContext *C, wmOperator *op) { - PointerRNA ptr; - Scene *scene; - World *wo; + Scene *scene= CTX_data_scene(C); + World *wo= CTX_data_pointer_get_type(C, "world", &RNA_World).data; /* add or copy world */ - ptr= CTX_data_pointer_get(C, "world"); - wo= (RNA_struct_is_a(ptr.type, &RNA_World))? ptr.data: NULL; - if(wo) wo= copy_world(wo); else wo= add_world("World"); /* assign to scene */ - scene= CTX_data_scene(C); - if(scene->world) id_us_min(&scene->world->id); scene->world= wo; - // XXX notifier + WM_event_add_notifier(C, NC_WORLD|NA_ADDED, wo); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index e5d2215be29..0e444d7f0b7 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -210,6 +210,12 @@ static void buttons_main_area_draw(const bContext *C, ARegion *ar) void buttons_operatortypes(void) { + WM_operatortype_append(OBJECT_OT_material_slot_add); + WM_operatortype_append(OBJECT_OT_material_slot_remove); + WM_operatortype_append(OBJECT_OT_material_slot_assign); + WM_operatortype_append(OBJECT_OT_material_slot_select); + WM_operatortype_append(OBJECT_OT_material_slot_deselect); + WM_operatortype_append(MATERIAL_OT_new); WM_operatortype_append(TEXTURE_OT_new); WM_operatortype_append(WORLD_OT_new); -- cgit v1.2.3 From ee9c260c385d41ec45e67450a59ad7788084aa90 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Wed, 24 Jun 2009 17:22:22 +0000 Subject: 2.5 - Added ND_SHADING notifier on linking materials, so it gives refreshes in UI - Removed reduntant debug prints Crucial fixes in other code while checking warnings; - Particle buttons were assigned to short, whilst data was int - Filesel border select used float rect API, on an int rect. --- source/blender/editors/space_buttons/space_buttons.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/space_buttons') diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 0e444d7f0b7..483a1dc6100 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -343,6 +343,11 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) case ND_GEOM_SELECT: ED_area_tag_redraw(sa); break; + case ND_SHADING: + case ND_SHADING_DRAW: + /* currently works by redraws... if preview is set, it (re)starts job */ + sbuts->preview= 1; + break; } break; case NC_MATERIAL: @@ -353,7 +358,6 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) case ND_SHADING_DRAW: /* currently works by redraws... if preview is set, it (re)starts job */ sbuts->preview= 1; - printf("shader notifier \n"); break; } break; -- cgit v1.2.3 From 169fdf9e9757a8c31d950f5902d7c4cfd1f96a88 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 24 Jun 2009 18:39:00 +0000 Subject: 2.5: bug fixes for some erratice materials buttons drawing. --- source/blender/editors/space_buttons/buttons_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/editors/space_buttons') diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index cba9a4cf8fc..01794d1bba8 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -552,7 +552,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r if(ptr) { Object *ob= ptr->data; - if(ob && ob->type && (ob->typetype && (ob->typetotcol) CTX_data_pointer_set(result, &ob->id, &RNA_MaterialSlot, ob->mat+ob->actcol-1); } -- cgit v1.2.3 From c9513df56196c119dfa947fe76a96ddf095b3c5c Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sat, 27 Jun 2009 14:35:24 +0000 Subject: UI: * Fix issue with icon not being left-aligned in text field. * Put modifier tab after data tab in buttons header. --- source/blender/editors/space_buttons/buttons_header.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/editors/space_buttons') diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c index 79284ada483..7c622f172a2 100644 --- a/source/blender/editors/space_buttons/buttons_header.c +++ b/source/blender/editors/space_buttons/buttons_header.c @@ -173,10 +173,10 @@ void buttons_header_buttons(const bContext *C, ARegion *ar) uiDefIconButS(block, ROW, B_CONTEXT_SWITCH, ICON_OBJECT_DATA, xco+=XIC, yco, XIC, YIC, &(sbuts->mainb), 0.0, (float)BCONTEXT_OBJECT, 0, 0, "Object"); if(sbuts->pathflag & (1<mainb), 0.0, (float)BCONTEXT_CONSTRAINT, 0, 0, "Constraint"); - if(sbuts->pathflag & (1<mainb), 0.0, (float)BCONTEXT_MODIFIER, 0, 0, "Modifier"); if(sbuts->pathflag & (1<dataicon, xco+=XIC, yco, XIC, YIC, &(sbuts->mainb), 0.0, (float)BCONTEXT_DATA, 0, 0, "Object Data"); + if(sbuts->pathflag & (1<mainb), 0.0, (float)BCONTEXT_MODIFIER, 0, 0, "Modifier"); if(sbuts->pathflag & (1<mainb), 0.0, (float)BCONTEXT_BONE, 0, 0, "Bone"); if(sbuts->pathflag & (1< Date: Sat, 27 Jun 2009 15:41:47 +0000 Subject: Particle ID block controls: * Adding/removing particle systems to an object. * Changing of particle settings. * Currently showing an object's particle systems in a list (like materials). --- .../blender/editors/space_buttons/buttons_intern.h | 5 + source/blender/editors/space_buttons/buttons_ops.c | 107 +++++++++++++++++++++ .../blender/editors/space_buttons/space_buttons.c | 5 + 3 files changed, 117 insertions(+) (limited to 'source/blender/editors/space_buttons') diff --git a/source/blender/editors/space_buttons/buttons_intern.h b/source/blender/editors/space_buttons/buttons_intern.h index b213e4288be..13ea778fb00 100644 --- a/source/blender/editors/space_buttons/buttons_intern.h +++ b/source/blender/editors/space_buttons/buttons_intern.h @@ -71,5 +71,10 @@ void MATERIAL_OT_new(struct wmOperatorType *ot); void TEXTURE_OT_new(struct wmOperatorType *ot); void WORLD_OT_new(struct wmOperatorType *ot); +void OBJECT_OT_particle_system_slot_add(struct wmOperatorType *ot); +void OBJECT_OT_particle_system_slot_remove(struct wmOperatorType *ot); + +void PARTICLE_OT_new(struct wmOperatorType *ot); + #endif /* ED_BUTTONS_INTERN_H */ diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index 6755a2be1b7..6ca92674c6e 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -42,6 +42,7 @@ #include "BKE_font.h" #include "BKE_library.h" #include "BKE_material.h" +#include "BKE_particle.h" #include "BKE_texture.h" #include "BKE_utildefines.h" #include "BKE_world.h" @@ -407,3 +408,109 @@ void WORLD_OT_new(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } + + +/********************** particle system slot operators *********************/ + +static int particle_system_slot_add_exec(bContext *C, wmOperator *op) +{ + Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + Scene *scene = CTX_data_scene(C); + + if(!scene || !ob) + return OPERATOR_CANCELLED; + + object_add_particle_system_slot(scene, ob); + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); + + return OPERATOR_FINISHED; +} + +void OBJECT_OT_particle_system_slot_add(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Add Particle System Slot"; + ot->idname= "OBJECT_OT_particle_system_slot_add"; + + /* api callbacks */ + ot->exec= particle_system_slot_add_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + +static int particle_system_slot_remove_exec(bContext *C, wmOperator *op) +{ + Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + Scene *scene = CTX_data_scene(C); + + if(!scene || !ob) + return OPERATOR_CANCELLED; + + object_remove_particle_system_slot(scene, ob); + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); + + return OPERATOR_FINISHED; +} + +void OBJECT_OT_particle_system_slot_remove(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Remove Particle System Slot"; + ot->idname= "OBJECT_OT_particle_system_slot_remove"; + + /* api callbacks */ + ot->exec= particle_system_slot_remove_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + +/********************** new particle settings operator *********************/ + +static int new_particle_settings_exec(bContext *C, wmOperator *op) +{ + Scene *scene = CTX_data_scene(C); + ParticleSettings *part= CTX_data_pointer_get_type(C, "particle_settings", &RNA_ParticleSettings).data; + Object *ob; + PointerRNA ptr; + + /* add or copy particle setting */ + if(part) + part= psys_copy_settings(part); + else + part= psys_new_settings("PSys", NULL); + + /* attempt to assign to material slot */ + ptr= CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); + + if(ptr.data) { + ParticleSystem *psys = (ParticleSystem*)ptr.data; + ob= ptr.id.data; + + if(psys->part) + psys->part->id.us--; + + psys->part = part; + + DAG_scene_sort(scene); + DAG_object_flush_update(scene, ob, OB_RECALC_DATA); + + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); + } + + return OPERATOR_FINISHED; +} + +void PARTICLE_OT_new(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "New Particle Settings"; + ot->idname= "PARTICLE_OT_new"; + + /* api callbacks */ + ot->exec= new_particle_settings_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 483a1dc6100..7954d5254cc 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -219,6 +219,11 @@ void buttons_operatortypes(void) WM_operatortype_append(MATERIAL_OT_new); WM_operatortype_append(TEXTURE_OT_new); WM_operatortype_append(WORLD_OT_new); + + WM_operatortype_append(OBJECT_OT_particle_system_slot_add); + WM_operatortype_append(OBJECT_OT_particle_system_slot_remove); + + WM_operatortype_append(PARTICLE_OT_new); } void buttons_keymap(struct wmWindowManager *wm) -- cgit v1.2.3 From 37864a4273a5f9217f9b5995dc70212bb97a6cf6 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 30 Jun 2009 19:20:45 +0000 Subject: 2.5 Image Window * Unpack operator now works. * Some small layout code tweaks. Info Window Header * Moved to python UI code. * template_running_jobs, template_operator_search added. * Ported external data operators: pack/unpack all, make paths relative/absolute, find/report missing files. Also * Report RPT_INFO too, not only warnings and errors. * Run UI handle functions after RNA and Operators. * Rename particle system add/remove operators, to not include "slot", that's only there for materials because that's what they are called now in RNA. --- .../blender/editors/space_buttons/buttons_intern.h | 4 ++-- source/blender/editors/space_buttons/buttons_ops.c | 20 ++++++++++---------- source/blender/editors/space_buttons/space_buttons.c | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) (limited to 'source/blender/editors/space_buttons') diff --git a/source/blender/editors/space_buttons/buttons_intern.h b/source/blender/editors/space_buttons/buttons_intern.h index 13ea778fb00..65c2976d57c 100644 --- a/source/blender/editors/space_buttons/buttons_intern.h +++ b/source/blender/editors/space_buttons/buttons_intern.h @@ -71,8 +71,8 @@ void MATERIAL_OT_new(struct wmOperatorType *ot); void TEXTURE_OT_new(struct wmOperatorType *ot); void WORLD_OT_new(struct wmOperatorType *ot); -void OBJECT_OT_particle_system_slot_add(struct wmOperatorType *ot); -void OBJECT_OT_particle_system_slot_remove(struct wmOperatorType *ot); +void OBJECT_OT_particle_system_add(struct wmOperatorType *ot); +void OBJECT_OT_particle_system_remove(struct wmOperatorType *ot); void PARTICLE_OT_new(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index 6ca92674c6e..df3e8c62d37 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -412,7 +412,7 @@ void WORLD_OT_new(wmOperatorType *ot) /********************** particle system slot operators *********************/ -static int particle_system_slot_add_exec(bContext *C, wmOperator *op) +static int particle_system_add_exec(bContext *C, wmOperator *op) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Scene *scene = CTX_data_scene(C); @@ -420,26 +420,26 @@ static int particle_system_slot_add_exec(bContext *C, wmOperator *op) if(!scene || !ob) return OPERATOR_CANCELLED; - object_add_particle_system_slot(scene, ob); + object_add_particle_system(scene, ob); WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); return OPERATOR_FINISHED; } -void OBJECT_OT_particle_system_slot_add(wmOperatorType *ot) +void OBJECT_OT_particle_system_add(wmOperatorType *ot) { /* identifiers */ ot->name= "Add Particle System Slot"; - ot->idname= "OBJECT_OT_particle_system_slot_add"; + ot->idname= "OBJECT_OT_particle_system_add"; /* api callbacks */ - ot->exec= particle_system_slot_add_exec; + ot->exec= particle_system_add_exec; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } -static int particle_system_slot_remove_exec(bContext *C, wmOperator *op) +static int particle_system_remove_exec(bContext *C, wmOperator *op) { Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Scene *scene = CTX_data_scene(C); @@ -447,20 +447,20 @@ static int particle_system_slot_remove_exec(bContext *C, wmOperator *op) if(!scene || !ob) return OPERATOR_CANCELLED; - object_remove_particle_system_slot(scene, ob); + object_remove_particle_system(scene, ob); WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); return OPERATOR_FINISHED; } -void OBJECT_OT_particle_system_slot_remove(wmOperatorType *ot) +void OBJECT_OT_particle_system_remove(wmOperatorType *ot) { /* identifiers */ ot->name= "Remove Particle System Slot"; - ot->idname= "OBJECT_OT_particle_system_slot_remove"; + ot->idname= "OBJECT_OT_particle_system_remove"; /* api callbacks */ - ot->exec= particle_system_slot_remove_exec; + ot->exec= particle_system_remove_exec; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 7954d5254cc..f9732551545 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -220,8 +220,8 @@ void buttons_operatortypes(void) WM_operatortype_append(TEXTURE_OT_new); WM_operatortype_append(WORLD_OT_new); - WM_operatortype_append(OBJECT_OT_particle_system_slot_add); - WM_operatortype_append(OBJECT_OT_particle_system_slot_remove); + WM_operatortype_append(OBJECT_OT_particle_system_add); + WM_operatortype_append(OBJECT_OT_particle_system_remove); WM_operatortype_append(PARTICLE_OT_new); } -- cgit v1.2.3 From 421f44278cebff49a1485251f92a4277934c4e4c Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 1 Jul 2009 22:25:49 +0000 Subject: 2.5: Lists for vertex groups, shape keys, uvs, vertex colors. RNA * Added the relevant active_*_index properties, with proper get/set/range, updates and notifiers. * Context.tool_settings. * ToolSettings.vertex_group_weight. Operators * MESH_OT_uv_texture_add/remove * MESH_OT_vertex_color_add/remove * MESH_OT_sticky_add/remove * OBJECT_OT_vertex_group_add/remove/assign/remove_from/ select/deselect/copy/copy_to_linked * OBJECT_OT_shape_key_add/remove UI * Some updates and cleanups in list template code. Known issue: when going in & out of editmode, uv textures and vertex colors dissappear. I thought me->edit_mesh would be NULL when not in edit mode but it is not? --- source/blender/editors/space_buttons/space_buttons.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/editors/space_buttons') diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index f9732551545..b89a13ce218 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -331,6 +331,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) case NC_SCENE: switch(wmn->data) { case ND_FRAME: + case ND_MODE: ED_area_tag_redraw(sa); break; -- cgit v1.2.3 From 093ff8202ced6391a2ef657abe42615672146954 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 2 Jul 2009 19:41:31 +0000 Subject: 2.5: Physics Buttons All kinds of changes to get it ready for UI layouts. This means RNA and operators should be working correct, but most buttons are still not actually there yet. * Added near empty soft body, fluid, field and collision panels, tweaks to cloth panels. * Fluid bake works, but without escape or showing any progress. * Fluid/Softbody/Cloth/Collision can now be both added as modifiers or in the physics panels. * Missing: fields & soft body for particles. * Missing: proper updating softbodies, guess this code still needs updates after pointcache refactor? --- source/blender/editors/space_buttons/buttons_context.c | 15 +++++++++++++-- source/blender/editors/space_buttons/buttons_ops.c | 4 +++- 2 files changed, 16 insertions(+), 3 deletions(-) (limited to 'source/blender/editors/space_buttons') diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 01794d1bba8..02179f347f5 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -497,7 +497,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r "world", "object", "meshe", "armature", "lattice", "curve", "meta_ball", "lamp", "camera", "material", "material_slot", "texture", "texture_slot", "bone", "edit_bone", "particle_system", - "cloth", "soft_body", "fluid", NULL}; + "cloth", "soft_body", "fluid", "collision", NULL}; CTX_data_dir_set(result, dir); return 1; @@ -615,7 +615,8 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r if(ptr && ptr->data) { Object *ob= ptr->data; - CTX_data_pointer_set(result, &ob->id, &RNA_SoftBodySettings, ob->soft); + ModifierData *md= modifiers_findByType(ob, eModifierType_Softbody); + CTX_data_pointer_set(result, &ob->id, &RNA_SoftBodyModifier, md); return 1; } } @@ -629,6 +630,16 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r return 1; } } + else if(CTX_data_equals(member, "collision")) { + PointerRNA *ptr= get_pointer_type(path, &RNA_Object); + + if(ptr && ptr->data) { + Object *ob= ptr->data; + ModifierData *md= modifiers_findByType(ob, eModifierType_Collision); + CTX_data_pointer_set(result, &ob->id, &RNA_CollisionModifier, md); + return 1; + } + } return 0; } diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index df3e8c62d37..2bc3bdaa613 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -41,6 +41,7 @@ #include "BKE_depsgraph.h" #include "BKE_font.h" #include "BKE_library.h" +#include "BKE_main.h" #include "BKE_material.h" #include "BKE_particle.h" #include "BKE_texture.h" @@ -471,6 +472,7 @@ void OBJECT_OT_particle_system_remove(wmOperatorType *ot) static int new_particle_settings_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); + Main *bmain= CTX_data_main(C); ParticleSettings *part= CTX_data_pointer_get_type(C, "particle_settings", &RNA_ParticleSettings).data; Object *ob; PointerRNA ptr; @@ -479,7 +481,7 @@ static int new_particle_settings_exec(bContext *C, wmOperator *op) if(part) part= psys_copy_settings(part); else - part= psys_new_settings("PSys", NULL); + part= psys_new_settings("PSys", bmain); /* attempt to assign to material slot */ ptr= CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); -- cgit v1.2.3 From 761241fcbbeb254cd78aca5f8bb62330ce9369ac Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Tue, 7 Jul 2009 06:56:29 +0000 Subject: NLA SoC: Current Frame can now be negative This commit is quite experimental, and might have to be reverted, but in quite a few places, the cleanups from this commit were already necessary. * I've left most of the image-handling functions alone, since I'm not sure how well they cope with negative indices. * Start/End frames cannot be negative for now... any specific reasons why they should be negative? --- source/blender/editors/space_buttons/buttons_header.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/editors/space_buttons') diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c index 7c622f172a2..99cc85d9a52 100644 --- a/source/blender/editors/space_buttons/buttons_header.c +++ b/source/blender/editors/space_buttons/buttons_header.c @@ -193,7 +193,7 @@ void buttons_header_buttons(const bContext *C, ARegion *ar) uiBlockEndAlign(block); xco+=XIC; - uiDefButI(block, NUM, B_NEWFRAME, "", (xco+20),yco,60,YIC, &(CTX_data_scene(C)->r.cfra), 1.0, MAXFRAMEF, 0, 0, "Displays Current Frame of animation. Click to change."); + uiDefButI(block, NUM, B_NEWFRAME, "", (xco+20),yco,60,YIC, &(CTX_data_scene(C)->r.cfra), MINAFRAMEF, MAXFRAMEF, 0, 0, "Displays Current Frame of animation. Click to change."); xco+= 80; /* always as last */ -- cgit v1.2.3 From 5e749af4295ba3120cd882f6e35b49a80292915e Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 8 Jul 2009 15:34:41 +0000 Subject: 2.5: Various Fixes * Context panel now draws without header, with arrows, no scene name. * Softbody vertex group search popup. * Improve names for autogenerated shortcut keys in menus. * Make most Select menus in the 3D view header work. * Fix armature border select selection syncing. * Add POSE_OT_select_constraint_target, MESH_OT_select_by_number_vertices, MESH_OT_select_vertex_path. * Merge mesh select similar into one operator. * Don't give MESH_OT_select_random Space hotkey. * Add DAG_object_flush_update to many mesh edit tools, not calling this will crash with modifiers. * RNA_def_enum_funcs for dynamic enums in operators, but not very useful without context yet. * Fix refresh issue with image window header + editmode. * Fix drawing of shadow mesh for image painting. * Remove deprecated uiDefMenuButO and uiDefMenuSep functions. * Remove keyval.c, code is in wm_keymap.c already. * Rename WM_operator_redo to WM_operator_props_popup. --- source/blender/editors/space_buttons/buttons_context.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'source/blender/editors/space_buttons') diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 02179f347f5..97644097108 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -685,7 +685,7 @@ void buttons_context_draw(const bContext *C, uiLayout *layout) if(!path) return; - row= uiLayoutRow(layout, 0); + row= uiLayoutRow(layout, 1); uiLayoutSetAlignment(row, UI_LAYOUT_ALIGN_LEFT); block= uiLayoutGetBlock(row); @@ -696,18 +696,18 @@ void buttons_context_draw(const bContext *C, uiLayout *layout) for(a=0; alen; a++) { ptr= &path->ptr[a]; + if(a != 0) + uiDefIconBut(block, LABEL, 0, VICON_SMALL_TRI_RIGHT, 0, 0, 10, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); + if(ptr->data) { icon= RNA_struct_ui_icon(ptr->type); name= RNA_struct_name_get_alloc(ptr, namebuf, sizeof(namebuf)); -#if 0 - if(sbuts->mainb != BCONTEXT_SCENE && ptr->type == &RNA_Scene) { - uiItemL(row, "", icon); /* save some space */ - } - else -#endif if(name) { - uiItemL(row, name, icon); + if(sbuts->mainb != BCONTEXT_SCENE && ptr->type == &RNA_Scene) + uiItemL(row, "", icon); /* save some space */ + else + uiItemL(row, name, icon); if(name != namebuf) MEM_freeN(name); @@ -731,6 +731,7 @@ void buttons_context_register(ARegionType *art) strcpy(pt->idname, "BUTTONS_PT_context"); strcpy(pt->label, "Context"); pt->draw= buttons_panel_context; + pt->flag= PNL_NO_HEADER; BLI_addtail(&art->paneltypes, pt); } -- cgit v1.2.3 From d091856486cffc4351d6ded86de3c33afb3155b4 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 9 Jul 2009 19:45:27 +0000 Subject: 2.5: Buttons Window * Fix poll() callback changes in recent commit, note that these have to work with pinned context too. * Hide header for context panels in py layout. * Don't jump back when collapsing a panel, allow the view to be over some empty space until you scroll back. * Fix follow context icon, order had to be reversed in icon file. * ID template now has icon as part of browse button instead of outside the buttons. --- source/blender/editors/space_buttons/buttons_context.c | 2 +- source/blender/editors/space_buttons/buttons_ops.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/space_buttons') diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 97644097108..24d5fcc648a 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -690,7 +690,7 @@ void buttons_context_draw(const bContext *C, uiLayout *layout) block= uiLayoutGetBlock(row); uiBlockSetEmboss(block, UI_EMBOSSN); - but= uiDefIconButBitC(block, ICONTOG, SB_PIN_CONTEXT, 0, (sbuts->flag & SB_PIN_CONTEXT)? ICON_PINNED: ICON_UNPINNED, 0, 0, UI_UNIT_X, UI_UNIT_Y, &sbuts->flag, 0, 0, 0, 0, "Follow context or keep fixed datablock displayed."); + but= uiDefIconButBitC(block, ICONTOG, SB_PIN_CONTEXT, 0, ICON_UNPINNED, 0, 0, UI_UNIT_X, UI_UNIT_Y, &sbuts->flag, 0, 0, 0, 0, "Follow context or keep fixed datablock displayed."); uiButSetFunc(but, pin_cb, NULL, NULL); for(a=0; alen; a++) { diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index 2bc3bdaa613..66b380ab413 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -516,3 +516,4 @@ void PARTICLE_OT_new(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } + -- cgit v1.2.3 From 3116062a828e24ed2e91c219ab338a38030f2f42 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 12 Jul 2009 02:06:15 +0000 Subject: 2.5: Couple of small fun features * Text window font size now supports full range 8-32, instead of just 12 and 15. I added BLF_fixed_width to get the character width of a fixed size font. * Buttons do undo push on change again. * Animated/Keyframe/Driver colors are now themable, with blend value to blend with original color. Set this to 0.5 now to give colors less constrast. * Fix tooltip popping up with RMB menu open, and missing redraw. * Autokeyframe now works for buttons. * Driver expressions can be edited in place in a button now. (still some refresh issues). * Also made python driver default for the Add Driver function in the RMB button. This way you don't have to open a Graph editor if you just want to type an expression. Also, the default expression then is the current value. * Tooltips now show some extra info, not sure what is good to have, but currently I added: * Shortcut key for operator buttons. * Python struct & property name for RNA buttons. * Expression for driven values. * Value for text/search/pointer buttons. --- source/blender/editors/space_buttons/space_buttons.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source/blender/editors/space_buttons') diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index b89a13ce218..f7be323a4c5 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -377,6 +377,9 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) ED_area_tag_redraw(sa); sbuts->preview= 1; } + + if(wmn->data == ND_KEYS) + ED_area_tag_redraw(sa); } /* only called once, from space/spacetypes.c */ -- cgit v1.2.3 From 6fb0181b50461b529bb960950870de941711041e Mon Sep 17 00:00:00 2001 From: Janne Karhu Date: Sun, 12 Jul 2009 23:38:47 +0000 Subject: Keyed physics refresh: - Keyed targets in one list instead of "chaining", this opens up many more possibilities than before and is much less obscure. - Better keyed timing possibilities (time & duration in frames). - Looping over keyed targets list. Other changes: - New child setting "length" with threshold (great for guard & underfur with a single particle system) - Modularization of path interpolation code. - Cleared "animateable" flags from many particle settings that shouldn't be animateable. Fixes: - Keyed particles weren't copied properly (ancient bug). - Hair rotations depended on global z-axis for root rotation so downward facing strands could flip rotation randomly. Now initial hair rotation is derived from face dependent hair matrix. (This caused for example ugly flipping of child strands on some cases). - Children from faces weren't calculated straight after activating them. - Multiple disk cache fixes: * Disk cache didn't work correctly with frame steps. * Conversion from memory cache to disk cache didn't work with cloth. * Disk cache crashed on some frames trying to close an already closed cache file. * Trails didn't work with disk cached particles. - Child rough effects were effected by emitter object loc/rot making them next to useless with animation, why didn't anybody tell me this!! - Lots of random code cleanup. --- .../blender/editors/space_buttons/buttons_intern.h | 4 + source/blender/editors/space_buttons/buttons_ops.c | 204 +++++++++++++++++++-- .../blender/editors/space_buttons/space_buttons.c | 4 + 3 files changed, 196 insertions(+), 16 deletions(-) (limited to 'source/blender/editors/space_buttons') diff --git a/source/blender/editors/space_buttons/buttons_intern.h b/source/blender/editors/space_buttons/buttons_intern.h index 65c2976d57c..f16a232f26d 100644 --- a/source/blender/editors/space_buttons/buttons_intern.h +++ b/source/blender/editors/space_buttons/buttons_intern.h @@ -75,6 +75,10 @@ void OBJECT_OT_particle_system_add(struct wmOperatorType *ot); void OBJECT_OT_particle_system_remove(struct wmOperatorType *ot); void PARTICLE_OT_new(struct wmOperatorType *ot); +void PARTICLE_OT_new_keyed_target(struct wmOperatorType *ot); +void PARTICLE_OT_remove_keyed_target(struct wmOperatorType *ot); +void PARTICLE_OT_keyed_target_move_up(struct wmOperatorType *ot); +void PARTICLE_OT_keyed_target_move_down(struct wmOperatorType *ot); #endif /* ED_BUTTONS_INTERN_H */ diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index 66b380ab413..6fb52c61131 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -49,6 +49,7 @@ #include "BKE_world.h" #include "BLI_editVert.h" +#include "BLI_listbase.h" #include "RNA_access.h" @@ -473,33 +474,32 @@ static int new_particle_settings_exec(bContext *C, wmOperator *op) { Scene *scene = CTX_data_scene(C); Main *bmain= CTX_data_main(C); - ParticleSettings *part= CTX_data_pointer_get_type(C, "particle_settings", &RNA_ParticleSettings).data; + ParticleSystem *psys; + ParticleSettings *part = NULL; Object *ob; PointerRNA ptr; + ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); + + psys = ptr.data; + /* add or copy particle setting */ - if(part) - part= psys_copy_settings(part); + if(psys->part) + part= psys_copy_settings(psys->part); else part= psys_new_settings("PSys", bmain); - /* attempt to assign to material slot */ - ptr= CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); + ob= ptr.id.data; - if(ptr.data) { - ParticleSystem *psys = (ParticleSystem*)ptr.data; - ob= ptr.id.data; - - if(psys->part) - psys->part->id.us--; + if(psys->part) + psys->part->id.us--; - psys->part = part; + psys->part = part; - DAG_scene_sort(scene); - DAG_object_flush_update(scene, ob, OB_RECALC_DATA); + DAG_scene_sort(scene); + DAG_object_flush_update(scene, ob, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); - } + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); return OPERATOR_FINISHED; } @@ -517,3 +517,175 @@ void PARTICLE_OT_new(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } +/********************** keyed particle target operators *********************/ + +static int new_keyed_particle_target_exec(bContext *C, wmOperator *op) +{ + Scene *scene = CTX_data_scene(C); + PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); + ParticleSystem *psys= ptr.data; + Object *ob = ptr.id.data; + + KeyedParticleTarget *kpt; + + if(!psys) + return OPERATOR_CANCELLED; + + kpt = psys->keyed_targets.first; + for(; kpt; kpt=kpt->next) + kpt->flag &= ~KEYED_TARGET_CURRENT; + + kpt = MEM_callocN(sizeof(KeyedParticleTarget), "keyed particle target"); + + kpt->flag |= KEYED_TARGET_CURRENT; + kpt->psys = 1; + + BLI_addtail(&psys->keyed_targets, kpt); + + DAG_scene_sort(scene); + DAG_object_flush_update(scene, ob, OB_RECALC_DATA); + + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); + + return OPERATOR_FINISHED; +} + +void PARTICLE_OT_new_keyed_target(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "New Keyed Particle Target"; + ot->idname= "PARTICLE_OT_new_keyed_target"; + + /* api callbacks */ + ot->exec= new_keyed_particle_target_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + +static int remove_keyed_particle_target_exec(bContext *C, wmOperator *op) +{ + Scene *scene = CTX_data_scene(C); + PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); + ParticleSystem *psys= ptr.data; + Object *ob = ptr.id.data; + + KeyedParticleTarget *kpt; + + if(!psys) + return OPERATOR_CANCELLED; + + kpt = psys->keyed_targets.first; + for(; kpt; kpt=kpt->next) { + if(kpt->flag & KEYED_TARGET_CURRENT) { + BLI_remlink(&psys->keyed_targets, kpt); + MEM_freeN(kpt); + break; + } + + } + kpt = psys->keyed_targets.last; + + if(kpt) + kpt->flag |= KEYED_TARGET_CURRENT; + + DAG_scene_sort(scene); + DAG_object_flush_update(scene, ob, OB_RECALC_DATA); + + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); + + return OPERATOR_FINISHED; +} + +void PARTICLE_OT_remove_keyed_target(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Remove Keyed Particle Target"; + ot->idname= "PARTICLE_OT_remove_keyed_target"; + + /* api callbacks */ + ot->exec= remove_keyed_particle_target_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + +/************************ move up modifier operator *********************/ + +static int keyed_target_move_up_exec(bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); + ParticleSystem *psys= ptr.data; + Object *ob = ptr.id.data; + KeyedParticleTarget *kpt; + + if(!psys) + return OPERATOR_CANCELLED; + + kpt = psys->keyed_targets.first; + for(; kpt; kpt=kpt->next) { + if(kpt->flag & KEYED_TARGET_CURRENT && kpt->prev) { + BLI_remlink(&psys->keyed_targets, kpt); + BLI_insertlink(&psys->keyed_targets, kpt->prev->prev, kpt); + + DAG_object_flush_update(scene, ob, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); + break; + } + } + + return OPERATOR_FINISHED; +} + +void PARTICLE_OT_keyed_target_move_up(wmOperatorType *ot) +{ + ot->name= "Move Up Keyed Target"; + ot->description= "Move keyed particle target up in the list."; + ot->idname= "PARTICLE_OT_keyed_target_move_up"; + + ot->exec= keyed_target_move_up_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + +/************************ move down modifier operator *********************/ + +static int keyed_target_move_down_exec(bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); + ParticleSystem *psys= ptr.data; + Object *ob = ptr.id.data; + KeyedParticleTarget *kpt; + + if(!psys) + return OPERATOR_CANCELLED; + kpt = psys->keyed_targets.first; + for(; kpt; kpt=kpt->next) { + if(kpt->flag & KEYED_TARGET_CURRENT && kpt->next) { + BLI_remlink(&psys->keyed_targets, kpt); + BLI_insertlink(&psys->keyed_targets, kpt->next, kpt); + + DAG_object_flush_update(scene, ob, OB_RECALC_DATA); + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); + break; + } + } + + return OPERATOR_FINISHED; +} + +void PARTICLE_OT_keyed_target_move_down(wmOperatorType *ot) +{ + ot->name= "Move Down Keyed Target"; + ot->description= "Move keyed particle target down in the list."; + ot->idname= "PARTICLE_OT_keyed_target_move_down"; + + ot->exec= keyed_target_move_down_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index f7be323a4c5..6cdb4dbf93d 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -224,6 +224,10 @@ void buttons_operatortypes(void) WM_operatortype_append(OBJECT_OT_particle_system_remove); WM_operatortype_append(PARTICLE_OT_new); + WM_operatortype_append(PARTICLE_OT_new_keyed_target); + WM_operatortype_append(PARTICLE_OT_remove_keyed_target); + WM_operatortype_append(PARTICLE_OT_keyed_target_move_up); + WM_operatortype_append(PARTICLE_OT_keyed_target_move_down); } void buttons_keymap(struct wmWindowManager *wm) -- cgit v1.2.3 From 41fb3626f3d7c1e75a31aebeb1e488f59aeedf68 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 13 Jul 2009 19:09:13 +0000 Subject: 2.5: Render * UI layout for scene buttons has quite some changes, I tried to better organize things according to the pipeline, and also showing important properties by default, and collapsing less important ones. Some changes compared to 2.4x: * Panorama is now a Camera property. * Sequence and Compositing are now enabled by default, but will only do something when there is a node tree using nodes, or a strip in the sequence editor. * Enabling Full Sample now automatically enables Save Buffers too. * Stamp option to include info in file is removed, it now simply always does this if one of the stamp infos is enabled. * Xvid, H.264 and Ogg Theora are now directly in the file format menu, but still using FFMPEG. Unfortunately Ogg is broken at the moment (also in 2.4x), so that's disabled. And Xvid crashes on 64bit linux, maybe solvable by upgrading extern/xvidcore/, using ubuntu libs makes it work. * Organized file format menu by image/movie types. Added: * Render layers RNA wrapped, operatorized, layouted. * FFMPEG format/codec options are now working. Defaults changed: * Compositing & Sequencer enabled. * Tiles set to 8x8. * Time/Date/Frame/Scene/Camera/Filename enabled for stamp. --- .../blender/editors/space_buttons/buttons_intern.h | 3 + source/blender/editors/space_buttons/buttons_ops.c | 74 ++++++++++++++++++++++ .../blender/editors/space_buttons/space_buttons.c | 3 + 3 files changed, 80 insertions(+) (limited to 'source/blender/editors/space_buttons') diff --git a/source/blender/editors/space_buttons/buttons_intern.h b/source/blender/editors/space_buttons/buttons_intern.h index f16a232f26d..f09f35589b9 100644 --- a/source/blender/editors/space_buttons/buttons_intern.h +++ b/source/blender/editors/space_buttons/buttons_intern.h @@ -80,5 +80,8 @@ void PARTICLE_OT_remove_keyed_target(struct wmOperatorType *ot); void PARTICLE_OT_keyed_target_move_up(struct wmOperatorType *ot); void PARTICLE_OT_keyed_target_move_down(struct wmOperatorType *ot); +void SCENE_OT_render_layer_add(struct wmOperatorType *ot); +void SCENE_OT_render_layer_remove(struct wmOperatorType *ot); + #endif /* ED_BUTTONS_INTERN_H */ diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index 6fb52c61131..fb1e9d1214d 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -33,6 +33,7 @@ #include "DNA_curve_types.h" #include "DNA_object_types.h" #include "DNA_material_types.h" +#include "DNA_node_types.h" #include "DNA_texture_types.h" #include "DNA_scene_types.h" #include "DNA_world_types.h" @@ -43,7 +44,9 @@ #include "BKE_library.h" #include "BKE_main.h" #include "BKE_material.h" +#include "BKE_node.h" #include "BKE_particle.h" +#include "BKE_scene.h" #include "BKE_texture.h" #include "BKE_utildefines.h" #include "BKE_world.h" @@ -689,3 +692,74 @@ void PARTICLE_OT_keyed_target_move_down(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; } +/********************** render layer operators *********************/ + +static int render_layer_add_exec(bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + + scene_add_render_layer(scene); + scene->r.actlay= BLI_countlist(&scene->r.layers) - 1; + + WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene); + + return OPERATOR_FINISHED; +} + +void SCENE_OT_render_layer_add(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Add Render Layer"; + ot->idname= "SCENE_OT_render_layer_add"; + + /* api callbacks */ + ot->exec= render_layer_add_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} + +static int render_layer_remove_exec(bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + SceneRenderLayer *rl; + int act= scene->r.actlay; + + if(BLI_countlist(&scene->r.layers) <= 1) + return OPERATOR_CANCELLED; + + rl= BLI_findlink(&scene->r.layers, scene->r.actlay); + BLI_remlink(&scene->r.layers, rl); + MEM_freeN(rl); + + scene->r.actlay= 0; + + if(scene->nodetree) { + bNode *node; + for(node= scene->nodetree->nodes.first; node; node= node->next) { + if(node->type==CMP_NODE_R_LAYERS && node->id==NULL) { + if(node->custom1==act) + node->custom1= 0; + else if(node->custom1>act) + node->custom1--; + } + } + } + + WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene); + + return OPERATOR_FINISHED; +} + +void SCENE_OT_render_layer_remove(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Remove Render Layer"; + ot->idname= "SCENE_OT_render_layer_remove"; + + /* api callbacks */ + ot->exec= render_layer_remove_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 6cdb4dbf93d..17f55c9395e 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -228,6 +228,9 @@ void buttons_operatortypes(void) WM_operatortype_append(PARTICLE_OT_remove_keyed_target); WM_operatortype_append(PARTICLE_OT_keyed_target_move_up); WM_operatortype_append(PARTICLE_OT_keyed_target_move_down); + + WM_operatortype_append(SCENE_OT_render_layer_add); + WM_operatortype_append(SCENE_OT_render_layer_remove); } void buttons_keymap(struct wmWindowManager *wm) -- cgit v1.2.3