Merging r38694 through r38739 from trunk into vgroup_modifiers

This commit is contained in:
Bastien Montagne 2011-07-26 18:28:43 +00:00
commit 07dc73fa31
23 changed files with 171 additions and 44 deletions

@ -1,15 +1,15 @@
import mathutils
# zero length vector
vec = mathutils.Vector((0, 0, 1))
vec = mathutils.Vector((0.0, 0.0, 1.0))
# unit length vector
vec_a = vec.copy().normalize()
vec_b = mathutils.Vector((0, 1, 2))
vec_b = mathutils.Vector((0.0, 1.0, 2.0))
vec2d = mathutils.Vector((1, 2))
vec3d = mathutils.Vector((1, 0, 0))
vec2d = mathutils.Vector((1.0, 2.0))
vec3d = mathutils.Vector((1.0, 0.0, 0.0))
vec4d = vec_a.to_4d()
# other mathutuls types
@ -34,9 +34,9 @@ vec_a + vec_b
vec_a - vec_b
vec_a * vec_b
vec_a * 10.0
vec_a * matrix
matrix * vec_a
quat * vec_a
vec_a * vec_b
vec_a * quat
-vec_a
@ -44,6 +44,7 @@ vec_a * quat
x = vec_a[0]
len(vec)
vec_a[:] = vec_b
vec_a[:] = 1.0, 2.0, 3.0
vec2d[:] = vec3d[:2]

@ -16,7 +16,7 @@
#
# ##### END GPL LICENSE BLOCK #####
# <pep8 compliant>
# <pep8-80 compliant>
import bpy
@ -36,10 +36,13 @@ class TEXT_HT_header(bpy.types.Header):
sub = row.row(align=True)
sub.menu("TEXT_MT_view")
sub.menu("TEXT_MT_text")
if text:
sub.menu("TEXT_MT_edit")
sub.menu("TEXT_MT_format")
sub.menu("TEXT_MT_templates")
if text and text.is_modified:
row = layout.row()
row.alert = True
@ -63,11 +66,13 @@ class TEXT_HT_header(bpy.types.Header):
row = layout.row()
if text.filepath:
if text.is_dirty:
row.label(text="File: *%s (unsaved)" % text.filepath)
row.label(text="File: *%r (unsaved)" % text.filepath)
else:
row.label(text="File: %s" % text.filepath)
row.label(text="File: %r" % text.filepath)
else:
row.label(text="Text: External" if text.library else "Text: Internal")
row.label(text="Text: External"
if text.library
else "Text: Internal")
class TEXT_PT_properties(bpy.types.Panel):
@ -150,8 +155,12 @@ class TEXT_MT_view(bpy.types.Menu):
layout.separator()
layout.operator("text.move", text="Top of File").type = 'FILE_TOP'
layout.operator("text.move", text="Bottom of File").type = 'FILE_BOTTOM'
layout.operator("text.move",
text="Top of File",
).type = 'FILE_TOP'
layout.operator("text.move",
text="Bottom of File",
).type = 'FILE_BOTTOM'
class TEXT_MT_text(bpy.types.Menu):
@ -185,19 +194,15 @@ class TEXT_MT_text(bpy.types.Menu):
# XXX uiMenuItemO(head, 0, "text.refresh_pyconstraints");
#endif
layout.separator()
layout.menu("TEXT_MT_templates")
class TEXT_MT_templates(bpy.types.Menu):
'''
Creates the menu items by scanning scripts/templates
'''
bl_label = "Script Templates"
bl_label = "Templates"
def draw(self, context):
self.path_menu(bpy.utils.script_paths("templates"), "text.open", {"internal": True})
self.path_menu(bpy.utils.script_paths("templates"),
"text.open",
{"internal": True},
)
class TEXT_MT_edit_select(bpy.types.Menu):
@ -246,8 +251,12 @@ class TEXT_MT_edit_to3d(bpy.types.Menu):
def draw(self, context):
layout = self.layout
layout.operator("text.to_3d_object", text="One Object").split_lines = False
layout.operator("text.to_3d_object", text="One Object Per Line").split_lines = True
layout.operator("text.to_3d_object",
text="One Object",
).split_lines = False
layout.operator("text.to_3d_object",
text="One Object Per Line",
).split_lines = True
class TEXT_MT_edit(bpy.types.Menu):

@ -0,0 +1,49 @@
import bpy
class CustomMenu(bpy.types.Menu):
bl_label = "Custom Menu"
bl_idname = "OBJECT_MT_custom_menu"
def draw(self, context):
layout = self.layout
layout.operator("wm.open_mainfile")
layout.operator("wm.save_as_mainfile").copy = True
layout.operator("object.shade_smooth")
layout.label(text="Hello world!", icon='WORLD_DATA')
# use an operator enum property to populate a submenu
layout.operator_menu_enum("object.select_by_type",
property="type",
text="Select All by Type...",
)
# call another menu
layout.operator("wm.call_menu", text="Unwrap").name = "VIEW3D_MT_uv_map"
def draw_item(self, context):
layout = self.layout
layout.menu(CustomMenu.bl_idname)
def register():
bpy.utils.register_class(CustomMenu)
# lets add ourselves to the main header
bpy.types.INFO_HT_header.append(draw_item)
def unregister():
bpy.utils.unregister_class(CustomMenu)
bpy.types.INFO_HT_header.remove(draw_item)
if __name__ == "__main__":
register()
# The menu can also be called from scripts
bpy.ops.wm.call_menu(name=CustomMenu.bl_idname)

@ -0,0 +1,26 @@
import bpy
class SimpleCustomMenu(bpy.types.Menu):
bl_label = "Simple Custom Menu"
bl_idname = "OBJECT_MT_simple_custom_menu"
def draw(self, context):
layout = self.layout
layout.operator("wm.open_mainfile")
layout.operator("wm.save_as_mainfile")
def register():
bpy.utils.register_class(SimpleCustomMenu)
def unregister():
bpy.utils.unregister_class(SimpleCustomMenu)
if __name__ == "__main__":
register()
# The menu can also be called from scripts
bpy.ops.wm.call_menu(name=SimpleCustomMenu.bl_idname)

@ -1,8 +1,9 @@
import bpy
class OBJECT_PT_hello(bpy.types.Panel):
class HelloWorldPanel(bpy.types.Panel):
bl_label = "Hello World Panel"
bl_idname = "OBJECT_PT_hello"
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_context = "object"
@ -22,11 +23,11 @@ class OBJECT_PT_hello(bpy.types.Panel):
def register():
bpy.utils.register_class(OBJECT_PT_hello)
bpy.utils.register_class(HelloWorldPanel)
def unregister():
bpy.utils.unregister_class(OBJECT_PT_hello)
bpy.utils.unregister_class(HelloWorldPanel)
if __name__ == "__main__":

@ -53,7 +53,7 @@ extern "C" {
/* can be left blank, otherwise a,b,c... etc with no quotes */
#define BLENDER_VERSION_CHAR a
/* alpha/beta/rc/release, docs use this */
#define BLENDER_VERSION_CYCLE release
#define BLENDER_VERSION_CYCLE beta
struct ListBase;
struct MemFile;

@ -400,7 +400,13 @@ Text *add_text(const char *file, const char *relpath)
llen++;
}
if (llen!=0 || ta->nlines==0) {
/* create new line in cases:
- rest of line (if last line in file hasn't got \n terminator).
in this case content of such line would be used to fill text line buffer
- file is empty. in this case new line is needed to start editing from.
- last characted in buffer is \n. in this case new line is needed to
deal with newline at end of file. (see [#28087]) (sergey) */
if (llen!=0 || ta->nlines==0 || buffer[len-1]=='\n') {
tmp= (TextLine*) MEM_mallocN(sizeof(TextLine), "textline");
tmp->line= (char*) MEM_mallocN(llen+1, "textline_string");
tmp->format= NULL;

@ -484,6 +484,17 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
}
}
}
else if (ELEM(but->type, MENU, PULLDOWN)) {
if ((U.flag & USER_TOOLTIPS_PYTHON) == 0) {
if(but->menu_create_func && WM_menutype_contains((MenuType *)but->poin)) {
MenuType *mt= (MenuType *)but->poin;
BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "Python: %s", mt->idname);
data->color[data->totline]= 0x888888;
data->totline++;
}
}
}
assert(data->totline < MAX_TOOLTIP_LINES);

@ -806,14 +806,14 @@ static int object_delete_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain= CTX_data_main(C);
Scene *scene= CTX_data_scene(C);
int islamp= 0;
/* int islamp= 0; */ /* UNUSED */
if(CTX_data_edit_object(C))
return OPERATOR_CANCELLED;
CTX_DATA_BEGIN(C, Base*, base, selected_bases) {
if(base->object->type==OB_LAMP) islamp= 1;
/* if(base->object->type==OB_LAMP) islamp= 1; */
/* deselect object -- it could be used in other scenes */
base->object->flag &= ~SELECT;

@ -129,7 +129,6 @@ void ED_view3d_camera_lock_sync(View3D *v3d, RegionView3D *rv3d)
}
else {
ED_view3d_to_object(v3d->camera, rv3d->ofs, rv3d->viewquat, rv3d->dist);
root_parent= v3d->camera;
DAG_id_tag_update(&v3d->camera->id, OB_RECALC_OB);
WM_main_add_notifier(NC_OBJECT|ND_TRANSFORM, v3d->camera);
}

@ -1070,7 +1070,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
}
}
// Need stuff to take it from edit mesh or whatnot here
else
else if (t->spacetype == SPACE_VIEW3D)
{
if (t->obedit && t->obedit->type == OB_MESH && (((Mesh *)t->obedit->data)->editflag & ME_EDIT_MIRROR_X))
{

@ -1944,6 +1944,11 @@ static void applyGrid(TransInfo *t, float *val, int max_index, float fac[3], Gea
int i;
float asp[3] = {1.0f, 1.0f, 1.0f}; // TODO: Remove hard coded limit here (3)
if(max_index > 3) {
printf("applyGrid: invalid index %d, clamping\n", max_index);
max_index= 3;
}
// Early bailing out if no need to snap
if (fac[action] == 0.0f)
return;

@ -358,19 +358,25 @@ int ED_undo_operator_repeat(bContext *C, struct wmOperator *op)
ret= 1;
}
}
else {
if (G.f & G_DEBUG) {
printf("redo_cb: WM_operator_repeat_check returned false %s\n", op->type->name);
}
}
/* set region back */
CTX_wm_region_set(C, ar);
}
else {
if (G.f & G_DEBUG) {
printf("redo_cb: WM_operator_repeat_check returned false %s\n", op->type->name);
printf("redo_cb: ED_undo_operator_repeat called with NULL 'op'\n");
}
}
return ret;
}
void ED_undo_operator_repeat_cb(bContext *C, void *arg_op, void *UNUSED(arg_unused))
{
ED_undo_operator_repeat(C, (wmOperator *)arg_op);

@ -1060,8 +1060,8 @@ static void weld_align_uv(bContext *C, int tool)
if(tool == 's' || tool == 't' || tool == 'u') {
/* pass 1&2 variables */
int i, j;
int starttmpl= -1, connectedtostarttmpl, startcorner;
int endtmpl= -1, connectedtoendtmpl, endcorner;
int starttmpl= -1, connectedtostarttmpl= -1, startcorner;
int endtmpl= -1, connectedtoendtmpl= -1, endcorner;
MTFace *startface, *endface;
int itmpl, jtmpl;
EditVert *eve;

@ -4407,15 +4407,15 @@ ParameterList *RNA_parameter_list_create(ParameterList *parms, PointerRNA *UNUSE
if(!(parm->flag & PROP_REQUIRED) && !(parm->flag & PROP_DYNAMIC)) {
switch(parm->type) {
case PROP_BOOLEAN:
if(parm->arraydimension) memcpy(data, &((BooleanPropertyRNA*)parm)->defaultarray, size);
if(parm->arraydimension) memcpy(data, ((BooleanPropertyRNA*)parm)->defaultarray, size);
else memcpy(data, &((BooleanPropertyRNA*)parm)->defaultvalue, size);
break;
case PROP_INT:
if(parm->arraydimension) memcpy(data, &((IntPropertyRNA*)parm)->defaultarray, size);
if(parm->arraydimension) memcpy(data, ((IntPropertyRNA*)parm)->defaultarray, size);
else memcpy(data, &((IntPropertyRNA*)parm)->defaultvalue, size);
break;
case PROP_FLOAT:
if(parm->arraydimension) memcpy(data, &((FloatPropertyRNA*)parm)->defaultarray, size);
if(parm->arraydimension) memcpy(data, ((FloatPropertyRNA*)parm)->defaultarray, size);
else memcpy(data, &((FloatPropertyRNA*)parm)->defaultvalue, size);
break;
case PROP_ENUM:

@ -544,7 +544,7 @@ void RNA_api_object(StructRNA *srna)
/* location of point for test and max distance */
parm= RNA_def_float_vector(func, "point", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
RNA_def_property_flag(parm, PROP_REQUIRED);
parm= RNA_def_float(func, "max_dist", sqrt(FLT_MAX), 0.0, FLT_MAX, "", "", 0.0, FLT_MAX);
RNA_def_float(func, "max_dist", sqrt(FLT_MAX), 0.0, FLT_MAX, "", "", 0.0, FLT_MAX);
/* return location and normal */
parm= RNA_def_float_vector(func, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "The location on the object closest to the point", -1e4, 1e4);

@ -940,7 +940,7 @@ static StructRNA *rna_Operator_register(Main *bmain, ReportList *reports, void *
rna_Operator_unregister(bmain, ot->ext.srna);
}
/* create a new menu type */
/* create a new operator type */
dummyot.ext.srna= RNA_def_struct(&BLENDER_RNA, dummyot.idname, "Operator");
RNA_def_struct_flag(dummyot.ext.srna, STRUCT_NO_IDPROPERTIES); /* operator properties are registered separately */
dummyot.ext.data= data;

@ -5778,6 +5778,14 @@ void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, unsigned int lay,
if(re->r.mode & R_RAYTRACE)
makeraytree(re);
/* point density texture */
if(!re->test_break(re->tbh))
make_pointdensities(re);
/* voxel data texture */
if(!re->test_break(re->tbh))
make_voxeldata(re);
/* occlusion */
if((re->wrld.mode & (WO_AMB_OCC|WO_ENV_LIGHT|WO_INDIRECT_LIGHT)) && !re->test_break(re->tbh))
if(re->wrld.ao_gather_method == WO_AOGATHER_APPROX)

@ -272,6 +272,7 @@ void WM_operator_py_idname(char *to, const char *from);
/* *************** menu types ******************** */
struct MenuType *WM_menutype_find(const char *idname, int quiet);
int WM_menutype_add(struct MenuType* mt);
int WM_menutype_contains(struct MenuType* mt);
void WM_menutype_freelink(struct MenuType* mt);
void WM_menutype_free(void);

@ -175,6 +175,12 @@ int WM_menutype_add(MenuType* mt)
return 1;
}
/* inefficient but only used for tooltip code */
int WM_menutype_contains(MenuType* mt)
{
return (mt != NULL && BLI_findindex(&menutypes, mt) != -1);
}
void WM_menutype_freelink(MenuType* mt)
{
BLI_freelinkN(&menutypes, mt);

@ -136,7 +136,6 @@ int RE_RenderInProgress(struct Render *re){return 0;}
struct Scene *RE_GetScene(struct Render *re){return (struct Scene *) NULL;}
void RE_Database_Free(struct Render *re){}
void RE_FreeRender(struct Render *re){}
void RE_shade_external(struct Render *re, struct ShadeInput *shi, struct ShadeResult *shr){}
void RE_DataBase_GetView(struct Render *re, float mat[][4]){}
int externtex(struct MTex *mtex, float *vec, float *tin, float *tr, float *tg, float *tb, float *ta){return 0;}
float texture_value_blend(float tex, float out, float fact, float facg, int blendtype, int flip){return 0.0f;}

@ -89,7 +89,7 @@ SCA_Joystick *SCA_Joystick::GetInstance( short int joyindex )
{
int i;
// do this once only
if(SDL_InitSubSystem(SDL_INIT_JOYSTICK) == -1 ){
if(SDL_InitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO) == -1 ){
echo("Error-Initializing-SDL: " << SDL_GetError());
return NULL;
}
@ -124,7 +124,7 @@ void SCA_Joystick::ReleaseInstance()
m_instance[i]= NULL;
}
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
SDL_QuitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO);
#endif
}
}

@ -1220,7 +1220,7 @@ void KX_KetsjiEngine::RenderFrame(KX_Scene* scene, KX_Camera* cam)
projmat.setValue(m_overrideCamProjMat.getPointer());
cam->SetProjectionMatrix(projmat);
}
} else if (cam->hasValidProjectionMatrix() && !cam->GetViewport() )
} else if (cam->hasValidProjectionMatrix())
{
m_rasterizer->SetProjectionMatrix(cam->GetProjectionMatrix());
} else