* Multiply for panorama cameras
* Some cases of struct name being set where it shouldnt have been. * Spelling: wich --> which * Copy and initialize uv modifier scale, remove unneeded enum. * Ability to pin any object into the context. * Update uv window while transforming (useful when used with UVProject modifier) * Patch by Wahooney, so new template's are internal text and dont get saved over by mistake. * Fix for https://bugzilla.redhat.com/show_bug.cgi?id=572186 Bug 572186 - [abrt] crash in blender-2.49b-5.fc12: Process /usr/bin/blender.bin was killed by signal 6 (SIGABRT). Original fix submitted by Jochen Schmitt. * [#21816] bpy.data.add_image has stopped working on Windows. moved to bpy.data.images.load(), missed this call. (commits 27726,27825,27828,27831,27832,27833,27834,27836,27837,27838,27839,27858 by Campbell from render25 branch)
This commit is contained in:
		@@ -160,7 +160,7 @@ void doblur(struct ImBuf *mbuf, float fac, Cast *cast)
 | 
			
		||||
	char *irect, *prect, *mrect;
 | 
			
		||||
	float *irectf, *prectf, *mrectf;
 | 
			
		||||
	
 | 
			
		||||
	/* wich buffers ? */
 | 
			
		||||
	/* which buffers ? */
 | 
			
		||||
				
 | 
			
		||||
	if(fac>7.0) fac= 7.0;
 | 
			
		||||
	if(fac<=1.0) return;
 | 
			
		||||
 
 | 
			
		||||
@@ -322,7 +322,7 @@ def load_image(imagepath, dirname):
 | 
			
		||||
 | 
			
		||||
    for path in variants:
 | 
			
		||||
        if os.path.exists(path):
 | 
			
		||||
            return bpy.data.add_image(path)
 | 
			
		||||
            return bpy.data.images.load(path)
 | 
			
		||||
        else:
 | 
			
		||||
            print(path, "doesn't exist")
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -490,7 +490,7 @@ class Header(StructRNA, _GenericUI):
 | 
			
		||||
class Menu(StructRNA, _GenericUI):
 | 
			
		||||
    __slots__ = ()
 | 
			
		||||
 | 
			
		||||
    def path_menu(self, searchpaths, operator):
 | 
			
		||||
    def path_menu(self, searchpaths, operator, props_default={}):
 | 
			
		||||
        layout = self.layout
 | 
			
		||||
        # hard coded to set the operators 'path' to the filename.
 | 
			
		||||
 | 
			
		||||
@@ -511,7 +511,12 @@ class Menu(StructRNA, _GenericUI):
 | 
			
		||||
            if f.startswith("."):
 | 
			
		||||
                continue
 | 
			
		||||
 | 
			
		||||
            layout.operator(operator, text=bpy.utils.display_name(f)).path = path
 | 
			
		||||
            props = layout.operator(operator, text=bpy.utils.display_name(f))
 | 
			
		||||
 | 
			
		||||
            for attr, value in props_default.items():
 | 
			
		||||
                setattr(props, attr, value)
 | 
			
		||||
 | 
			
		||||
            props.path = path
 | 
			
		||||
 | 
			
		||||
    def draw_preset(self, context):
 | 
			
		||||
        """Define these on the subclass
 | 
			
		||||
 
 | 
			
		||||
@@ -689,9 +689,12 @@ class DATA_PT_modifiers(DataButtonsPanel):
 | 
			
		||||
            if wide_ui:
 | 
			
		||||
                col = split.column()
 | 
			
		||||
            sub = col.column(align=True)
 | 
			
		||||
            sub.label(text="Aspect Ratio:")
 | 
			
		||||
            sub.prop(md, "horizontal_aspect_ratio", text="Horizontal")
 | 
			
		||||
            sub.prop(md, "vertical_aspect_ratio", text="Vertical")
 | 
			
		||||
            sub.prop(md, "aspect_x", text="Aspect X")
 | 
			
		||||
            sub.prop(md, "aspect_y", text="Aspect Y")
 | 
			
		||||
 | 
			
		||||
            sub = col.column(align=True)
 | 
			
		||||
            sub.prop(md, "scale_x", text="Scale X")
 | 
			
		||||
            sub.prop(md, "scale_y", text="Scale Y")
 | 
			
		||||
 | 
			
		||||
    def WAVE(self, layout, ob, md, wide_ui):
 | 
			
		||||
        split = layout.split()
 | 
			
		||||
 
 | 
			
		||||
@@ -35,12 +35,15 @@ class OBJECT_PT_context_object(ObjectButtonsPanel):
 | 
			
		||||
 | 
			
		||||
    def draw(self, context):
 | 
			
		||||
        layout = self.layout
 | 
			
		||||
 | 
			
		||||
        space = context.space_data
 | 
			
		||||
        ob = context.object
 | 
			
		||||
 | 
			
		||||
        row = layout.row()
 | 
			
		||||
        row.label(text="", icon='OBJECT_DATA')
 | 
			
		||||
        row.prop(ob, "name", text="")
 | 
			
		||||
        if space.use_pin_id:
 | 
			
		||||
            row.template_ID(space, "pin_id")
 | 
			
		||||
        else:
 | 
			
		||||
            row.prop(ob, "name", text="")
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class OBJECT_PT_custom_props(ObjectButtonsPanel, PropertyPanel):
 | 
			
		||||
 
 | 
			
		||||
@@ -177,7 +177,7 @@ class TEXT_MT_templates(bpy.types.Menu):
 | 
			
		||||
    bl_label = "Script Templates"
 | 
			
		||||
 | 
			
		||||
    def draw(self, context):
 | 
			
		||||
        self.path_menu(bpy.utils.script_paths("templates"), "text.open")
 | 
			
		||||
        self.path_menu(bpy.utils.script_paths("templates"), "text.open", {"internal": True})
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class TEXT_MT_edit_view(bpy.types.Menu):
 | 
			
		||||
 
 | 
			
		||||
@@ -53,7 +53,7 @@ int id_unlink(struct ID *id, int test);
 | 
			
		||||
 | 
			
		||||
int new_id(struct ListBase *lb, struct ID *id, const char *name);
 | 
			
		||||
 | 
			
		||||
struct ListBase *wich_libbase(struct Main *mainlib, short type);
 | 
			
		||||
struct ListBase *which_libbase(struct Main *mainlib, short type);
 | 
			
		||||
 | 
			
		||||
#define MAX_LIBARRAY	40
 | 
			
		||||
int set_listbasepointers(struct Main *main, struct ListBase **lb);
 | 
			
		||||
 
 | 
			
		||||
@@ -347,7 +347,7 @@ int id_unlink(ID *id, int test)
 | 
			
		||||
	if(id->us == 0) {
 | 
			
		||||
		if(test) return 1;
 | 
			
		||||
 | 
			
		||||
		lb= wich_libbase(mainlib, GS(id->name));
 | 
			
		||||
		lb= which_libbase(mainlib, GS(id->name));
 | 
			
		||||
		free_libblock(lb, id);
 | 
			
		||||
 | 
			
		||||
		return 1;
 | 
			
		||||
@@ -356,7 +356,7 @@ int id_unlink(ID *id, int test)
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ListBase *wich_libbase(Main *mainlib, short type)
 | 
			
		||||
ListBase *which_libbase(Main *mainlib, short type)
 | 
			
		||||
{
 | 
			
		||||
	switch( type ) {
 | 
			
		||||
		case ID_SCE:
 | 
			
		||||
@@ -658,7 +658,7 @@ void *copy_libblock(void *rt)
 | 
			
		||||
	
 | 
			
		||||
	id= rt;
 | 
			
		||||
 | 
			
		||||
	lb= wich_libbase(G.main, GS(id->name));
 | 
			
		||||
	lb= which_libbase(G.main, GS(id->name));
 | 
			
		||||
	idn= alloc_libblock(lb, GS(id->name), id->name+2);
 | 
			
		||||
	
 | 
			
		||||
	if(idn==NULL) {
 | 
			
		||||
@@ -867,7 +867,7 @@ void free_main(Main *mainvar)
 | 
			
		||||
 | 
			
		||||
ID *find_id(char *type, char *name)		/* type: "OB" or "MA" etc */
 | 
			
		||||
{
 | 
			
		||||
	ListBase *lb= wich_libbase(G.main, GS(type));
 | 
			
		||||
	ListBase *lb= which_libbase(G.main, GS(type));
 | 
			
		||||
	return BLI_findstring(lb, name, offsetof(ID, name) + 2);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -1175,7 +1175,7 @@ int new_id(ListBase *lb, ID *id, const char *tname)
 | 
			
		||||
	if(id->lib) return 0;
 | 
			
		||||
 | 
			
		||||
	/* if no libdata given, look up based on ID */
 | 
			
		||||
	if(lb==NULL) lb= wich_libbase(G.main, GS(id->name));
 | 
			
		||||
	if(lb==NULL) lb= which_libbase(G.main, GS(id->name));
 | 
			
		||||
 | 
			
		||||
	/* if no name given, use name of current ID
 | 
			
		||||
	 * else make a copy (tname args can be const) */
 | 
			
		||||
@@ -1348,7 +1348,7 @@ void test_idbutton(char *name)
 | 
			
		||||
	ID *idtest;
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	lb= wich_libbase(G.main, GS(name-2) );
 | 
			
		||||
	lb= which_libbase(G.main, GS(name-2) );
 | 
			
		||||
	if(lb==0) return;
 | 
			
		||||
	
 | 
			
		||||
	/* search for id */
 | 
			
		||||
@@ -1383,7 +1383,7 @@ void rename_id(ID *id, char *name)
 | 
			
		||||
	ListBase *lb;
 | 
			
		||||
 | 
			
		||||
	strncpy(id->name+2, name, 21);
 | 
			
		||||
	lb= wich_libbase(G.main, GS(id->name) );
 | 
			
		||||
	lb= which_libbase(G.main, GS(id->name) );
 | 
			
		||||
	
 | 
			
		||||
	new_id(lb, id, name);				
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -3606,6 +3606,7 @@ static void uvprojectModifier_initData(ModifierData *md)
 | 
			
		||||
	umd->flags = 0;
 | 
			
		||||
	umd->num_projectors = 1;
 | 
			
		||||
	umd->aspectx = umd->aspecty = 1.0f;
 | 
			
		||||
	umd->scalex = umd->scaley = 1.0f;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void uvprojectModifier_copyData(ModifierData *md, ModifierData *target)
 | 
			
		||||
@@ -3621,6 +3622,8 @@ static void uvprojectModifier_copyData(ModifierData *md, ModifierData *target)
 | 
			
		||||
	tumd->num_projectors = umd->num_projectors;
 | 
			
		||||
	tumd->aspectx = umd->aspectx;
 | 
			
		||||
	tumd->aspecty = umd->aspecty;
 | 
			
		||||
	tumd->scalex = umd->scalex;
 | 
			
		||||
	tumd->scaley = umd->scaley;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static CustomDataMask uvprojectModifier_requiredDataMask(Object *ob, ModifierData *md)
 | 
			
		||||
@@ -3692,6 +3695,8 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
 | 
			
		||||
	char uvname[32];
 | 
			
		||||
	float aspx= umd->aspectx ? umd->aspectx : 1.0f;
 | 
			
		||||
	float aspy= umd->aspecty ? umd->aspecty : 1.0f;
 | 
			
		||||
	float scax= umd->scalex ? umd->scalex : 1.0f;
 | 
			
		||||
	float scay= umd->scaley ? umd->scaley : 1.0f;
 | 
			
		||||
	int free_uci= 0;
 | 
			
		||||
	
 | 
			
		||||
	aspect = aspx / aspy;
 | 
			
		||||
@@ -3829,6 +3834,22 @@ static DerivedMesh *uvprojectModifier_do(UVProjectModifierData *umd,
 | 
			
		||||
						project_from_camera(tface->uv[2], coords[mf->v3], projectors[0].uci);
 | 
			
		||||
						if(mf->v3)
 | 
			
		||||
							project_from_camera(tface->uv[3], coords[mf->v4], projectors[0].uci);
 | 
			
		||||
						
 | 
			
		||||
						if(scax != 1.0f) {
 | 
			
		||||
							tface->uv[0][0] = ((tface->uv[0][0] - 0.5f) * scax) + 0.5f;
 | 
			
		||||
							tface->uv[1][0] = ((tface->uv[1][0] - 0.5f) * scax) + 0.5f;
 | 
			
		||||
							tface->uv[2][0] = ((tface->uv[2][0] - 0.5f) * scax) + 0.5f;
 | 
			
		||||
							if(mf->v3)
 | 
			
		||||
								tface->uv[3][0] = ((tface->uv[3][0] - 0.5f) * scax) + 0.5f;
 | 
			
		||||
						}
 | 
			
		||||
						
 | 
			
		||||
						if(scay != 1.0f) {
 | 
			
		||||
							tface->uv[0][1] = ((tface->uv[0][1] - 0.5f) * scay) + 0.5f;
 | 
			
		||||
							tface->uv[1][1] = ((tface->uv[1][1] - 0.5f) * scay) + 0.5f;
 | 
			
		||||
							tface->uv[2][1] = ((tface->uv[2][1] - 0.5f) * scay) + 0.5f;
 | 
			
		||||
							if(mf->v3)
 | 
			
		||||
								tface->uv[3][1] = ((tface->uv[3][1] - 0.5f) * scay) + 0.5f;
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
					else {
 | 
			
		||||
						/* apply transformed coords as UVs */
 | 
			
		||||
@@ -6489,7 +6510,7 @@ static DerivedMesh *screwModifier_applyModifier(ModifierData *md, Object *ob,
 | 
			
		||||
								ed_loop_flip= 1;
 | 
			
		||||
							}
 | 
			
		||||
							else {
 | 
			
		||||
								/* not so simple to work out wich edge is higher */
 | 
			
		||||
								/* not so simple to work out which edge is higher */
 | 
			
		||||
								sub_v3_v3v3(tmp_vec1, tmpf1, vc_tmp->co);
 | 
			
		||||
								sub_v3_v3v3(tmp_vec1, tmpf2, vc_tmp->co);
 | 
			
		||||
								normalize_v3(tmp_vec1);
 | 
			
		||||
 
 | 
			
		||||
@@ -294,9 +294,7 @@ void BLI_adddirstrings()
 | 
			
		||||
	struct tm *tm;
 | 
			
		||||
	time_t zero= 0;
 | 
			
		||||
	
 | 
			
		||||
	file = &files[0];
 | 
			
		||||
	
 | 
			
		||||
	for(num=0;num<actnum;num++){
 | 
			
		||||
	for(num=0, file= files; num<actnum; num++, file++){
 | 
			
		||||
#ifdef WIN32
 | 
			
		||||
		mode = 0;
 | 
			
		||||
		strcpy(file->mode1, types[0]);
 | 
			
		||||
@@ -325,43 +323,43 @@ void BLI_adddirstrings()
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef WIN32
 | 
			
		||||
		strcpy(files[num].owner,"user");
 | 
			
		||||
		strcpy(file->owner,"user");
 | 
			
		||||
#else
 | 
			
		||||
		{
 | 
			
		||||
			struct passwd *pwuser;
 | 
			
		||||
			pwuser = getpwuid(files[num].s.st_uid);
 | 
			
		||||
			pwuser = getpwuid(file->s.st_uid);
 | 
			
		||||
			if ( pwuser ) {
 | 
			
		||||
			strcpy(files[num].owner, pwuser->pw_name);
 | 
			
		||||
				BLI_strncpy(file->owner, pwuser->pw_name, sizeof(file->owner));
 | 
			
		||||
			} else {
 | 
			
		||||
				sprintf(files[num].owner, "%d", files[num].s.st_uid);
 | 
			
		||||
				snprintf(file->owner, sizeof(file->owner), "%d", file->s.st_uid);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
		tm= localtime(&files[num].s.st_mtime);
 | 
			
		||||
		tm= localtime(&file->s.st_mtime);
 | 
			
		||||
		// prevent impossible dates in windows
 | 
			
		||||
		if(tm==NULL) tm= localtime(&zero);
 | 
			
		||||
		strftime(files[num].time, 8, "%H:%M", tm);
 | 
			
		||||
		strftime(files[num].date, 16, "%d-%b-%y", tm);
 | 
			
		||||
		strftime(file->time, 8, "%H:%M", tm);
 | 
			
		||||
		strftime(file->date, 16, "%d-%b-%y", tm);
 | 
			
		||||
 | 
			
		||||
		/*
 | 
			
		||||
		 * Seems st_size is signed 32-bit value in *nix and Windows.  This
 | 
			
		||||
		 * will buy us some time until files get bigger than 4GB or until
 | 
			
		||||
		 * everyone starts using __USE_FILE_OFFSET64 or equivalent.
 | 
			
		||||
		 */
 | 
			
		||||
		st_size= files[num].s.st_size;
 | 
			
		||||
		st_size= file->s.st_size;
 | 
			
		||||
 | 
			
		||||
		if (st_size > 1024*1024*1024) {
 | 
			
		||||
			sprintf(files[num].size, "%.2f GB", ((double)st_size)/(1024*1024*1024));	
 | 
			
		||||
			sprintf(file->size, "%.2f GB", ((double)st_size)/(1024*1024*1024));	
 | 
			
		||||
		}
 | 
			
		||||
		else if (st_size > 1024*1024) {
 | 
			
		||||
			sprintf(files[num].size, "%.1f MB", ((double)st_size)/(1024*1024));
 | 
			
		||||
			sprintf(file->size, "%.1f MB", ((double)st_size)/(1024*1024));
 | 
			
		||||
		}
 | 
			
		||||
		else if (st_size > 1024) {
 | 
			
		||||
			sprintf(files[num].size, "%d KB", (int)(st_size/1024));
 | 
			
		||||
			sprintf(file->size, "%d KB", (int)(st_size/1024));
 | 
			
		||||
		}
 | 
			
		||||
		else {
 | 
			
		||||
			sprintf(files[num].size, "%d B", (int)st_size);
 | 
			
		||||
			sprintf(file->size, "%d B", (int)st_size);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		strftime(datum, 32, "%d-%b-%y %H:%M", tm);
 | 
			
		||||
@@ -377,15 +375,13 @@ void BLI_adddirstrings()
 | 
			
		||||
			sprintf(size, "%10d", (int) st_size);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		sprintf(buf,"%s %s %s %7s %s %s %10s %s", file->mode1, file->mode2, file->mode3, files[num].owner, files[num].date, files[num].time, size,
 | 
			
		||||
			files[num].relname);
 | 
			
		||||
		sprintf(buf,"%s %s %s %7s %s %s %10s %s", file->mode1, file->mode2, file->mode3, file->owner, file->date, file->time, size,
 | 
			
		||||
			file->relname);
 | 
			
		||||
 | 
			
		||||
		files[num].string=MEM_mallocN(strlen(buf)+1, "filestring");
 | 
			
		||||
		if (files[num].string){
 | 
			
		||||
			strcpy(files[num].string,buf);
 | 
			
		||||
		file->string=MEM_mallocN(strlen(buf)+1, "filestring");
 | 
			
		||||
		if (file->string){
 | 
			
		||||
			strcpy(file->string,buf);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		file++;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -120,7 +120,7 @@
 | 
			
		||||
#include "BKE_group.h"
 | 
			
		||||
#include "BKE_image.h"
 | 
			
		||||
#include "BKE_lattice.h"
 | 
			
		||||
#include "BKE_library.h" // for wich_libbase
 | 
			
		||||
#include "BKE_library.h" // for which_libbase
 | 
			
		||||
#include "BKE_main.h" // for Main
 | 
			
		||||
#include "BKE_mesh.h" // for ME_ defines (patching)
 | 
			
		||||
#include "BKE_modifier.h"
 | 
			
		||||
@@ -429,7 +429,7 @@ static void split_libdata(ListBase *lb, Main *first)
 | 
			
		||||
			mainvar= first;
 | 
			
		||||
			while(mainvar) {
 | 
			
		||||
				if(mainvar->curlib==id->lib) {
 | 
			
		||||
					lbn= wich_libbase(mainvar, GS(id->name));
 | 
			
		||||
					lbn= which_libbase(mainvar, GS(id->name));
 | 
			
		||||
					BLI_remlink(lb, id);
 | 
			
		||||
					BLI_addtail(lbn, id);
 | 
			
		||||
					break;
 | 
			
		||||
@@ -4684,7 +4684,7 @@ static void *restore_pointer_by_name(Main *mainp, ID *id, int user)
 | 
			
		||||
{
 | 
			
		||||
		
 | 
			
		||||
	if(id) {
 | 
			
		||||
		ListBase *lb= wich_libbase(mainp, GS(id->name));
 | 
			
		||||
		ListBase *lb= which_libbase(mainp, GS(id->name));
 | 
			
		||||
		
 | 
			
		||||
		if(lb) {	// there's still risk of checking corrupt mem (freed Ids in oops)
 | 
			
		||||
			ID *idn= lb->first;
 | 
			
		||||
@@ -5377,10 +5377,10 @@ static BHead *read_libblock(FileData *fd, Main *main, BHead *bhead, int flag, ID
 | 
			
		||||
	
 | 
			
		||||
	/* do after read_struct, for dna reconstruct */
 | 
			
		||||
	if(bhead->code==ID_ID) {
 | 
			
		||||
		lb= wich_libbase(main, GS(id->name));
 | 
			
		||||
		lb= which_libbase(main, GS(id->name));
 | 
			
		||||
	}
 | 
			
		||||
	else {
 | 
			
		||||
		lb= wich_libbase(main, bhead->code);
 | 
			
		||||
		lb= which_libbase(main, bhead->code);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	BLI_addtail(lb, id);
 | 
			
		||||
@@ -10959,8 +10959,8 @@ char *bhead_id_name(FileData *fd, BHead *bhead)
 | 
			
		||||
static ID *is_yet_read(FileData *fd, Main *mainvar, BHead *bhead)
 | 
			
		||||
{
 | 
			
		||||
	const char *idname= bhead_id_name(fd, bhead);
 | 
			
		||||
	/* wich_libbase can be NULL, intentionally not using idname+2 */
 | 
			
		||||
	return BLI_findstring(wich_libbase(mainvar, GS(idname)), idname, offsetof(ID, name));
 | 
			
		||||
	/* which_libbase can be NULL, intentionally not using idname+2 */
 | 
			
		||||
	return BLI_findstring(which_libbase(mainvar, GS(idname)), idname, offsetof(ID, name));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void expand_doit(FileData *fd, Main *mainvar, void *old)
 | 
			
		||||
 
 | 
			
		||||
@@ -2693,7 +2693,7 @@ void autocomplete_end(AutoComplete *autocpl, char *autoname)
 | 
			
		||||
static void autocomplete_id(bContext *C, char *str, void *arg_v)
 | 
			
		||||
{
 | 
			
		||||
	int blocktype= (intptr_t)arg_v;
 | 
			
		||||
	ListBase *listb= wich_libbase(CTX_data_main(C), blocktype);
 | 
			
		||||
	ListBase *listb= which_libbase(CTX_data_main(C), blocktype);
 | 
			
		||||
	
 | 
			
		||||
	if(listb==NULL) return;
 | 
			
		||||
	
 | 
			
		||||
 
 | 
			
		||||
@@ -497,7 +497,7 @@ static void ui_template_id(uiLayout *layout, bContext *C, PointerRNA *ptr, char
 | 
			
		||||
		flag |= UI_ID_OPEN;
 | 
			
		||||
	
 | 
			
		||||
	type= RNA_property_pointer_type(ptr, prop);
 | 
			
		||||
	template->idlb= wich_libbase(CTX_data_main(C), RNA_type_to_ID_code(type));
 | 
			
		||||
	template->idlb= which_libbase(CTX_data_main(C), RNA_type_to_ID_code(type));
 | 
			
		||||
	
 | 
			
		||||
	/* create UI elements for this template
 | 
			
		||||
	 *	- template_ID makes a copy of the template data and assigns it to the relevant buttons
 | 
			
		||||
 
 | 
			
		||||
@@ -54,6 +54,7 @@
 | 
			
		||||
 | 
			
		||||
#include "RNA_define.h"
 | 
			
		||||
#include "RNA_access.h"
 | 
			
		||||
#include "RNA_enum_types.h"
 | 
			
		||||
 | 
			
		||||
#include "ED_curve.h"
 | 
			
		||||
#include "ED_mesh.h"
 | 
			
		||||
@@ -529,9 +530,6 @@ void OBJECT_OT_hook_add_newobj(wmOperatorType *ot)
 | 
			
		||||
	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static EnumPropertyItem hook_mod_items[]= {
 | 
			
		||||
{0, NULL, 0, NULL, NULL}};
 | 
			
		||||
 | 
			
		||||
static int object_hook_remove_exec(bContext *C, wmOperator *op)
 | 
			
		||||
{
 | 
			
		||||
	int num= RNA_enum_get(op->ptr, "modifier");
 | 
			
		||||
@@ -566,7 +564,7 @@ static EnumPropertyItem *hook_mod_itemf(bContext *C, PointerRNA *ptr, int *free)
 | 
			
		||||
	int a, totitem= 0;
 | 
			
		||||
	
 | 
			
		||||
	if(!ob)
 | 
			
		||||
		return hook_mod_items;
 | 
			
		||||
		return DummyRNA_NULL_items;
 | 
			
		||||
	
 | 
			
		||||
	for(a=0, md=ob->modifiers.first; md; md= md->next, a++) {
 | 
			
		||||
		if (md->type==eModifierType_Hook) {
 | 
			
		||||
@@ -602,7 +600,7 @@ void OBJECT_OT_hook_remove(wmOperatorType *ot)
 | 
			
		||||
	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 | 
			
		||||
	
 | 
			
		||||
	/* properties */
 | 
			
		||||
	prop= RNA_def_enum(ot->srna, "modifier", hook_mod_items, 0, "Modifier", "Modifier number to remove.");
 | 
			
		||||
	prop= RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to remove.");
 | 
			
		||||
	RNA_def_enum_funcs(prop, hook_mod_itemf);
 | 
			
		||||
	ot->prop= prop;
 | 
			
		||||
}
 | 
			
		||||
@@ -669,7 +667,7 @@ void OBJECT_OT_hook_reset(wmOperatorType *ot)
 | 
			
		||||
	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 | 
			
		||||
	
 | 
			
		||||
	/* properties */
 | 
			
		||||
	prop= RNA_def_enum(ot->srna, "modifier", hook_mod_items, 0, "Modifier", "Modifier number to assign to.");
 | 
			
		||||
	prop= RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to assign to.");
 | 
			
		||||
	RNA_def_enum_funcs(prop, hook_mod_itemf);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -725,7 +723,7 @@ void OBJECT_OT_hook_recenter(wmOperatorType *ot)
 | 
			
		||||
	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 | 
			
		||||
	
 | 
			
		||||
	/* properties */
 | 
			
		||||
	prop= RNA_def_enum(ot->srna, "modifier", hook_mod_items, 0, "Modifier", "Modifier number to assign to.");
 | 
			
		||||
	prop= RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to assign to.");
 | 
			
		||||
	RNA_def_enum_funcs(prop, hook_mod_itemf);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -788,7 +786,7 @@ void OBJECT_OT_hook_assign(wmOperatorType *ot)
 | 
			
		||||
	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 | 
			
		||||
	
 | 
			
		||||
	/* properties */
 | 
			
		||||
	prop= RNA_def_enum(ot->srna, "modifier", hook_mod_items, 0, "Modifier", "Modifier number to assign to.");
 | 
			
		||||
	prop= RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to assign to.");
 | 
			
		||||
	RNA_def_enum_funcs(prop, hook_mod_itemf);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -837,7 +835,7 @@ void OBJECT_OT_hook_select(wmOperatorType *ot)
 | 
			
		||||
	ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
 | 
			
		||||
	
 | 
			
		||||
	/* properties */
 | 
			
		||||
	prop= RNA_def_enum(ot->srna, "modifier", hook_mod_items, 0, "Modifier", "Modifier number to remove.");
 | 
			
		||||
	prop= RNA_def_enum(ot->srna, "modifier", DummyRNA_NULL_items, 0, "Modifier", "Modifier number to remove.");
 | 
			
		||||
	RNA_def_enum_funcs(prop, hook_mod_itemf);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -816,21 +816,9 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r
 | 
			
		||||
static void pin_cb(bContext *C, void *arg1, void *arg2)
 | 
			
		||||
{
 | 
			
		||||
	SpaceButs *sbuts= CTX_wm_space_buts(C);
 | 
			
		||||
	ButsContextPath *path= sbuts->path;
 | 
			
		||||
	PointerRNA *ptr;
 | 
			
		||||
	int a;
 | 
			
		||||
 | 
			
		||||
	if(sbuts->flag & SB_PIN_CONTEXT) {
 | 
			
		||||
		if(path->len) {
 | 
			
		||||
			for(a=path->len-1; a>=0; a--) {
 | 
			
		||||
				ptr= &path->ptr[a];
 | 
			
		||||
 | 
			
		||||
				if(ptr->id.data) {
 | 
			
		||||
					sbuts->pinid= ptr->id.data;
 | 
			
		||||
					break;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		sbuts->pinid= buttons_context_id_path(C);
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
		sbuts->pinid= NULL;
 | 
			
		||||
@@ -901,3 +889,24 @@ void buttons_context_register(ARegionType *art)
 | 
			
		||||
	pt->flag= PNL_NO_HEADER;
 | 
			
		||||
	BLI_addtail(&art->paneltypes, pt);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ID *buttons_context_id_path(const bContext *C)
 | 
			
		||||
{
 | 
			
		||||
	SpaceButs *sbuts= CTX_wm_space_buts(C);
 | 
			
		||||
	ButsContextPath *path= sbuts->path;
 | 
			
		||||
	PointerRNA *ptr;
 | 
			
		||||
	int a;
 | 
			
		||||
 | 
			
		||||
	if(path->len) {
 | 
			
		||||
		for(a=path->len-1; a>=0; a--) {
 | 
			
		||||
			ptr= &path->ptr[a];
 | 
			
		||||
 | 
			
		||||
			if(ptr->id.data) {
 | 
			
		||||
				return ptr->id.data;
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -35,6 +35,7 @@ struct bContextDataResult;
 | 
			
		||||
struct SpaceButs;
 | 
			
		||||
struct uiLayout;
 | 
			
		||||
struct wmOperatorType;
 | 
			
		||||
struct ID;
 | 
			
		||||
 | 
			
		||||
/* buts->scaflag */		
 | 
			
		||||
#define BUTS_SENS_SEL		1
 | 
			
		||||
@@ -62,6 +63,7 @@ void buttons_context_compute(const struct bContext *C, struct SpaceButs *sbuts);
 | 
			
		||||
int buttons_context(const struct bContext *C, const char *member, struct bContextDataResult *result);
 | 
			
		||||
void buttons_context_draw(const struct bContext *C, struct uiLayout *layout);
 | 
			
		||||
void buttons_context_register(struct ARegionType *art);
 | 
			
		||||
struct ID *buttons_context_id_path(const struct bContext *C);
 | 
			
		||||
 | 
			
		||||
/* buttons_ops.c */
 | 
			
		||||
void BUTTONS_OT_file_browse(struct wmOperatorType *ot);
 | 
			
		||||
 
 | 
			
		||||
@@ -1172,7 +1172,7 @@ void filelist_from_main(struct FileList *filelist)
 | 
			
		||||
		/* make files */
 | 
			
		||||
		idcode= groupname_to_code(filelist->dir);
 | 
			
		||||
		
 | 
			
		||||
		lb= wich_libbase(G.main, idcode );
 | 
			
		||||
		lb= which_libbase(G.main, idcode );
 | 
			
		||||
		if(lb==0) return;
 | 
			
		||||
		
 | 
			
		||||
		id= lb->first;
 | 
			
		||||
 
 | 
			
		||||
@@ -625,6 +625,15 @@ static void image_listener(ScrArea *sa, wmNotifier *wmn)
 | 
			
		||||
					ED_area_tag_redraw(sa);
 | 
			
		||||
					break;
 | 
			
		||||
			}
 | 
			
		||||
		case NC_OBJECT:
 | 
			
		||||
			switch(wmn->data) {
 | 
			
		||||
				case ND_TRANSFORM:
 | 
			
		||||
					if(sima->lock && (sima->flag & SI_DRAWSHADOW)) {
 | 
			
		||||
						ED_area_tag_refresh(sa);
 | 
			
		||||
						ED_area_tag_redraw(sa);
 | 
			
		||||
					}
 | 
			
		||||
					break;
 | 
			
		||||
			}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -215,6 +215,7 @@ static int open_exec(bContext *C, wmOperator *op)
 | 
			
		||||
	PropertyPointerRNA *pprop;
 | 
			
		||||
	PointerRNA idptr;
 | 
			
		||||
	char str[FILE_MAX];
 | 
			
		||||
	short internal = RNA_int_get(op->ptr, "internal");
 | 
			
		||||
 | 
			
		||||
	RNA_string_get(op->ptr, "path", str);
 | 
			
		||||
 | 
			
		||||
@@ -245,6 +246,13 @@ static int open_exec(bContext *C, wmOperator *op)
 | 
			
		||||
		st->top= 0;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	if (internal) {
 | 
			
		||||
		if(text->name)
 | 
			
		||||
			MEM_freeN(text->name);
 | 
			
		||||
		
 | 
			
		||||
		text->name = NULL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	WM_event_add_notifier(C, NC_TEXT|NA_ADDED, text);
 | 
			
		||||
 | 
			
		||||
	MEM_freeN(op->customdata);
 | 
			
		||||
@@ -282,6 +290,7 @@ void TEXT_OT_open(wmOperatorType *ot)
 | 
			
		||||
 | 
			
		||||
	/* properties */
 | 
			
		||||
	WM_operator_properties_filesel(ot, FOLDERFILE|TEXTFILE|PYSCRIPTFILE, FILE_SPECIAL, FILE_OPENFILE);
 | 
			
		||||
	RNA_def_boolean(ot->srna, "internal", 0, "Make internal", "Make text file internal after loading");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/******************* reload operator *********************/
 | 
			
		||||
 
 | 
			
		||||
@@ -318,6 +318,7 @@ typedef struct UVProjectModifierData {
 | 
			
		||||
	int flags;
 | 
			
		||||
	int num_projectors;
 | 
			
		||||
	float aspectx, aspecty;
 | 
			
		||||
	float scalex, scaley;												
 | 
			
		||||
	char uvlayer_name[32];
 | 
			
		||||
	int uvlayer_tmp, pad;
 | 
			
		||||
} UVProjectModifierData;
 | 
			
		||||
 
 | 
			
		||||
@@ -1317,20 +1317,34 @@ static void rna_def_modifier_uvproject(BlenderRNA *brna)
 | 
			
		||||
	RNA_def_property_flag(prop, PROP_EDITABLE);
 | 
			
		||||
	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 | 
			
		||||
 | 
			
		||||
	prop= RNA_def_property(srna, "horizontal_aspect_ratio", PROP_FLOAT, PROP_NONE);
 | 
			
		||||
	prop= RNA_def_property(srna, "aspect_x", PROP_FLOAT, PROP_NONE);
 | 
			
		||||
	RNA_def_property_float_sdna(prop, NULL, "aspectx");
 | 
			
		||||
	RNA_def_property_range(prop, 1, FLT_MAX);
 | 
			
		||||
	RNA_def_property_ui_range(prop, 1, 1000, 100, 2);
 | 
			
		||||
	RNA_def_property_ui_range(prop, 1, 1000, 0.2, 2);
 | 
			
		||||
	RNA_def_property_ui_text(prop, "Horizontal Aspect Ratio", "");
 | 
			
		||||
	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 | 
			
		||||
 | 
			
		||||
	prop= RNA_def_property(srna, "vertical_aspect_ratio", PROP_FLOAT, PROP_NONE);
 | 
			
		||||
	prop= RNA_def_property(srna, "aspect_y", PROP_FLOAT, PROP_NONE);
 | 
			
		||||
	RNA_def_property_float_sdna(prop, NULL, "aspecty");
 | 
			
		||||
	RNA_def_property_range(prop, 1, FLT_MAX);
 | 
			
		||||
	RNA_def_property_ui_range(prop, 1, 1000, 100, 2);
 | 
			
		||||
	RNA_def_property_ui_range(prop, 1, 1000, 0.2, 2);
 | 
			
		||||
	RNA_def_property_ui_text(prop, "Vertical Aspect Ratio", "");
 | 
			
		||||
	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 | 
			
		||||
	
 | 
			
		||||
	prop= RNA_def_property(srna, "scale_x", PROP_FLOAT, PROP_NONE);
 | 
			
		||||
	RNA_def_property_float_sdna(prop, NULL, "scalex");
 | 
			
		||||
	RNA_def_property_range(prop, 0, FLT_MAX);
 | 
			
		||||
	RNA_def_property_ui_range(prop, 0, 1000, 0.2, 2);
 | 
			
		||||
	RNA_def_property_ui_text(prop, "Horizontal Scale", "");
 | 
			
		||||
	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 | 
			
		||||
 | 
			
		||||
	prop= RNA_def_property(srna, "scale_y", PROP_FLOAT, PROP_NONE);
 | 
			
		||||
	RNA_def_property_float_sdna(prop, NULL, "scaley");
 | 
			
		||||
	RNA_def_property_range(prop, 0, FLT_MAX);
 | 
			
		||||
	RNA_def_property_ui_range(prop, 0, 1000, 0.2, 2);
 | 
			
		||||
	RNA_def_property_ui_text(prop, "Vertical Scale", "");
 | 
			
		||||
	RNA_def_property_update(prop, 0, "rna_Modifier_update");
 | 
			
		||||
 | 
			
		||||
	prop= RNA_def_property(srna, "override_image", PROP_BOOLEAN, PROP_NONE);
 | 
			
		||||
	RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_UVPROJECT_OVERRIDEIMAGE);
 | 
			
		||||
	RNA_def_property_ui_text(prop, "Override Image", "Override faces' current images with the given image");
 | 
			
		||||
 
 | 
			
		||||
@@ -2332,7 +2332,6 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
 | 
			
		||||
	prop= RNA_def_property(srna, "file_extension", PROP_STRING, PROP_NONE);
 | 
			
		||||
	RNA_def_property_string_funcs(prop, "rna_SceneRender_file_ext_get", "rna_SceneRender_file_ext_length", NULL);
 | 
			
		||||
	RNA_def_property_ui_text(prop, "Extension", "The file extension used for saving renders");
 | 
			
		||||
	RNA_def_struct_name_property(srna, prop);
 | 
			
		||||
	RNA_def_property_clear_flag(prop, PROP_EDITABLE);
 | 
			
		||||
 | 
			
		||||
	prop= RNA_def_property(srna, "is_movie_format", PROP_BOOLEAN, PROP_NONE);
 | 
			
		||||
 
 | 
			
		||||
@@ -1183,6 +1183,10 @@ static void rna_def_space_buttons(BlenderRNA *brna)
 | 
			
		||||
	RNA_def_property_pointer_funcs(prop, NULL, NULL, "rna_SpaceProperties_pin_id_typef");
 | 
			
		||||
	RNA_def_property_flag(prop, PROP_EDITABLE);
 | 
			
		||||
	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_PROPERTIES, NULL);
 | 
			
		||||
 | 
			
		||||
	prop= RNA_def_property(srna, "use_pin_id", PROP_BOOLEAN, PROP_NONE);
 | 
			
		||||
	RNA_def_property_boolean_sdna(prop, NULL, "flag", SB_PIN_CONTEXT);
 | 
			
		||||
	RNA_def_property_ui_text(prop, "Pin ID", "Use the pinned context");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void rna_def_space_image(BlenderRNA *brna)
 | 
			
		||||
@@ -1847,15 +1851,11 @@ static void rna_def_space_console(BlenderRNA *brna)
 | 
			
		||||
	RNA_def_property_ui_text(prop, "Show Error", "Display error text");
 | 
			
		||||
	RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CONSOLE_REPORT, NULL);
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	prop= RNA_def_property(srna, "prompt", PROP_STRING, PROP_NONE);
 | 
			
		||||
	RNA_def_property_ui_text(prop, "Prompt", "Command line prompt");
 | 
			
		||||
	RNA_def_struct_name_property(srna, prop);
 | 
			
		||||
	
 | 
			
		||||
	prop= RNA_def_property(srna, "language", PROP_STRING, PROP_NONE);
 | 
			
		||||
	RNA_def_property_ui_text(prop, "Language", "Command line prompt language");
 | 
			
		||||
	RNA_def_struct_name_property(srna, prop);
 | 
			
		||||
 | 
			
		||||
	prop= RNA_def_property(srna, "history", PROP_COLLECTION, PROP_NONE);
 | 
			
		||||
	RNA_def_property_collection_sdna(prop, NULL, "history", NULL);
 | 
			
		||||
 
 | 
			
		||||
@@ -333,7 +333,7 @@ static int intersect_rayface(RayObject *hit_obj, RayFace *face, Isect *is)
 | 
			
		||||
 | 
			
		||||
		RE_RC_COUNT(is->raycounter->faces.hit);
 | 
			
		||||
 | 
			
		||||
		is->isect= ok;	// wich half of the quad
 | 
			
		||||
		is->isect= ok;	// which half of the quad
 | 
			
		||||
		is->labda= labda;
 | 
			
		||||
		is->u= u; is->v= v;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user