[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21129] branches/blender2.5/blender/source /blender: 2.5: Object material slot operators add/remove/assign/select/ deselect.

Brecht Van Lommel brecht at blender.org
Wed Jun 24 16:07:48 CEST 2009


Revision: 21129
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21129
Author:   blendix
Date:     2009-06-24 16:07:48 +0200 (Wed, 24 Jun 2009)

Log Message:
-----------
2.5: Object material slot operators add/remove/assign/select/deselect.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/blenkernel/BKE_material.h
    branches/blender2.5/blender/source/blender/blenkernel/intern/material.c
    branches/blender2.5/blender/source/blender/editors/curve/curve_intern.h
    branches/blender2.5/blender/source/blender/editors/curve/curve_ops.c
    branches/blender2.5/blender/source/blender/editors/curve/editcurve.c
    branches/blender2.5/blender/source/blender/editors/curve/editfont.c
    branches/blender2.5/blender/source/blender/editors/include/ED_curve.h
    branches/blender2.5/blender/source/blender/editors/include/ED_mesh.h
    branches/blender2.5/blender/source/blender/editors/mesh/editmesh.c
    branches/blender2.5/blender/source/blender/editors/mesh/editmesh_mods.c
    branches/blender2.5/blender/source/blender/editors/space_buttons/buttons_intern.h
    branches/blender2.5/blender/source/blender/editors/space_buttons/buttons_ops.c
    branches/blender2.5/blender/source/blender/editors/space_buttons/space_buttons.c

Modified: branches/blender2.5/blender/source/blender/blenkernel/BKE_material.h
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/BKE_material.h	2009-06-24 14:03:55 UTC (rev 21128)
+++ branches/blender2.5/blender/source/blender/blenkernel/BKE_material.h	2009-06-24 14:07:48 UTC (rev 21129)
@@ -39,6 +39,8 @@
 struct ID;
 struct Object;
 
+/* materials */
+
 void init_def_material(void);
 void free_material(struct Material *sc); 
 void test_object_materials(struct ID *id);
@@ -47,16 +49,23 @@
 struct Material *copy_material(struct Material *ma);
 void make_local_material(struct Material *ma);
 
+void automatname(struct Material *);
+
+/* material slots */
+
 struct Material ***give_matarar(struct Object *ob);
 short *give_totcolp(struct Object *ob);
 struct Material *give_current_material(struct Object *ob, int act);
 struct ID *material_from(struct Object *ob, int act);
 void assign_material(struct Object *ob, struct Material *ma, int act);
-void new_material_to_objectdata(struct Object *ob);
 
 int find_material_index(struct Object *ob, struct Material *ma);
 
+void object_add_material_slot(struct Object *ob);
+void object_remove_material_slot(struct Object *ob);
 
+/* rendering */
+
 void init_render_material(struct Material *, int, float *);
 void init_render_materials(int, float *);
 void end_render_material(struct Material *);
@@ -64,12 +73,8 @@
 
 int material_in_material(struct Material *parmat, struct Material *mat);
 
-void automatname(struct Material *);
-void delete_material_index(struct Object *ob);            
-
 void ramp_blend(int type, float *r, float *g, float *b, float fac, float *col);
 
-
 #ifdef __cplusplus
 }
 #endif

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/material.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/material.c	2009-06-24 14:03:55 UTC (rev 21128)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/material.c	2009-06-24 14:07:48 UTC (rev 21129)
@@ -615,7 +615,7 @@
 	return 0;	   
 }
 
-void new_material_to_objectdata(Object *ob)
+void object_add_material_slot(Object *ob)
 {
 	Material *ma;
 	
@@ -854,7 +854,7 @@
 }
 
 
-void delete_material_index(Object *ob)
+void object_remove_material_slot(Object *ob)
 {
 	Material *mao, ***matarar;
 	Object *obt;

Modified: branches/blender2.5/blender/source/blender/editors/curve/curve_intern.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/curve/curve_intern.h	2009-06-24 14:03:55 UTC (rev 21128)
+++ branches/blender2.5/blender/source/blender/editors/curve/curve_intern.h	2009-06-24 14:07:48 UTC (rev 21129)
@@ -49,7 +49,6 @@
 void FONT_OT_case_set(struct wmOperatorType *ot);
 void FONT_OT_style_toggle(struct wmOperatorType *ot);
 void FONT_OT_style_set(struct wmOperatorType *ot);
-void FONT_OT_material_set(struct wmOperatorType *ot);
 
 void FONT_OT_text_copy(struct wmOperatorType *ot);
 void FONT_OT_text_cut(struct wmOperatorType *ot);

Modified: branches/blender2.5/blender/source/blender/editors/curve/curve_ops.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/curve/curve_ops.c	2009-06-24 14:03:55 UTC (rev 21128)
+++ branches/blender2.5/blender/source/blender/editors/curve/curve_ops.c	2009-06-24 14:07:48 UTC (rev 21129)
@@ -106,7 +106,6 @@
 	WM_operatortype_append(FONT_OT_case_set);
 	WM_operatortype_append(FONT_OT_style_toggle);
 	WM_operatortype_append(FONT_OT_style_set);
-	WM_operatortype_append(FONT_OT_material_set);
 
 	WM_operatortype_append(FONT_OT_text_copy);
 	WM_operatortype_append(FONT_OT_text_cut);

Modified: branches/blender2.5/blender/source/blender/editors/curve/editcurve.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/curve/editcurve.c	2009-06-24 14:03:55 UTC (rev 21128)
+++ branches/blender2.5/blender/source/blender/editors/curve/editcurve.c	2009-06-24 14:07:48 UTC (rev 21129)
@@ -189,7 +189,7 @@
 		return select_bpoint(bp, SELECT, 1, VISIBLE);
 }
 
-short isNurbsel(Nurb *nu)
+int isNurbsel(Nurb *nu)
 {
 	BezTriple *bezt;
 	BPoint *bp;

Modified: branches/blender2.5/blender/source/blender/editors/curve/editfont.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/curve/editfont.c	2009-06-24 14:03:55 UTC (rev 21128)
+++ branches/blender2.5/blender/source/blender/editors/curve/editfont.c	2009-06-24 14:07:48 UTC (rev 21129)
@@ -700,50 +700,6 @@
 	RNA_def_enum(ot->srna, "style", style_items, CU_BOLD, "Style", "Style to set selection to.");
 }
 
-/******************* set material operator ********************/
-
-static int set_material_exec(bContext *C, wmOperator *op)
-{
-	Scene *scene= CTX_data_scene(C);
-	Object *obedit= CTX_data_edit_object(C);
-	Curve *cu= obedit->data;
-	EditFont *ef= cu->editfont;
-	int i, mat_nr, selstart, selend;
-
-	if(!BKE_font_getselection(obedit, &selstart, &selend))
-		return OPERATOR_CANCELLED;
-
-	if(RNA_property_is_set(op->ptr, "index"))
-		mat_nr= RNA_int_get(op->ptr, "index");
-	else
-		mat_nr= obedit->actcol;
-
-	for(i=selstart; i<=selend; i++)
-		ef->textbufinfo[i].mat_nr = mat_nr;
-
-	DAG_object_flush_update(scene, obedit, OB_RECALC_DATA);
-	WM_event_add_notifier(C, NC_OBJECT|ND_GEOM_DATA, obedit);
-
-	return OPERATOR_FINISHED;
-}
-
-void FONT_OT_material_set(wmOperatorType *ot)
-{
-	/* identifiers */
-	ot->name= "Set Material";
-	ot->idname= "FONT_OT_material_set";
-	
-	/* api callbacks */
-	ot->exec= set_material_exec;
-	ot->poll= ED_operator_editfont;
-	
-	/* flags */
-	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
-	/* properties */
-	RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Material Index", "Material slot index.", 0, INT_MAX);
-}
-
 /******************* copy text operator ********************/
 
 static void copy_selection(Object *obedit)

Modified: branches/blender2.5/blender/source/blender/editors/include/ED_curve.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/ED_curve.h	2009-06-24 14:03:55 UTC (rev 21128)
+++ branches/blender2.5/blender/source/blender/editors/include/ED_curve.h	2009-06-24 14:07:48 UTC (rev 21129)
@@ -30,6 +30,7 @@
 
 struct Base;
 struct bContext;
+struct Nurb;
 struct Object;
 struct Scene;
 struct Text;
@@ -52,6 +53,8 @@
 
 struct Nurb *add_nurbs_primitive(struct bContext *C, int type, int newname);
 
+int		isNurbsel		(struct Nurb *nu);;
+
 /* editfont.h */
 void	undo_push_font	(struct bContext *C, char *name);
 void	make_editText	(struct Object *obedit);

Modified: branches/blender2.5/blender/source/blender/editors/include/ED_mesh.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/ED_mesh.h	2009-06-24 14:03:55 UTC (rev 21128)
+++ branches/blender2.5/blender/source/blender/editors/include/ED_mesh.h	2009-06-24 14:07:48 UTC (rev 21129)
@@ -147,6 +147,9 @@
 void		EM_hide_mesh(struct EditMesh *em, int swap);
 void		EM_reveal_mesh(struct EditMesh *em);
 
+void		EM_select_by_material(struct EditMesh *em, int index);
+void		EM_deselect_by_material(struct EditMesh *em, int index); 
+
 /* editface.c */
 struct MTFace	*EM_get_active_mtface(struct EditMesh *em, struct EditFace **act_efa, struct MCol **mcol, int sloppy);
 

Modified: branches/blender2.5/blender/source/blender/editors/mesh/editmesh.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/mesh/editmesh.c	2009-06-24 14:03:55 UTC (rev 21128)
+++ branches/blender2.5/blender/source/blender/editors/mesh/editmesh.c	2009-06-24 14:07:48 UTC (rev 21129)
@@ -1556,7 +1556,7 @@
 		/* clear selection, we're going to use that to select material group */
 		EM_clear_flag_all(em, SELECT);
 		/* select the material */
-		editmesh_select_by_material(em, curr_mat);
+		EM_select_by_material(em, curr_mat);
 		/* and now separate */
 		if(0==mesh_separate_selected(scene, editbase)) {
 			BKE_mesh_end_editmesh(me, em);

Modified: branches/blender2.5/blender/source/blender/editors/mesh/editmesh_mods.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/mesh/editmesh_mods.c	2009-06-24 14:03:55 UTC (rev 21128)
+++ branches/blender2.5/blender/source/blender/editors/mesh/editmesh_mods.c	2009-06-24 14:07:48 UTC (rev 21129)
@@ -3484,7 +3484,7 @@
 	RNA_def_float_percentage(ot->srna, "percent", 0.5f, 0.0f, 1.0f, "Percent", "Percentage of vertices to select randomly.", 0.0001f, 1.0f);
 }
 
-void editmesh_select_by_material(EditMesh *em, int index) 
+void EM_select_by_material(EditMesh *em, int index) 
 {
 	EditFace *efa;
 	
@@ -3497,7 +3497,7 @@
 	EM_selectmode_flush(em);
 }
 
-void editmesh_deselect_by_material(EditMesh *em, int index) 
+void EM_deselect_by_material(EditMesh *em, int index) 
 {
 	EditFace *efa;
 	

Modified: branches/blender2.5/blender/source/blender/editors/space_buttons/buttons_intern.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_buttons/buttons_intern.h	2009-06-24 14:03:55 UTC (rev 21128)
+++ branches/blender2.5/blender/source/blender/editors/space_buttons/buttons_intern.h	2009-06-24 14:07:48 UTC (rev 21129)
@@ -61,6 +61,12 @@
 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);

Modified: branches/blender2.5/blender/source/blender/editors/space_buttons/buttons_ops.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_buttons/buttons_ops.c	2009-06-24 14:03:55 UTC (rev 21128)

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list