Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-05-10 04:45:06 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-05-10 04:45:06 +0400
commit21a9dc8d8bb320212f9a1d823b214424e6d2a244 (patch)
treec31f3d9eac904af799c97b9c3ba36abae94281a6 /source/blender
parenta6b057eeea846e3053d8adc204ca0721551ee3be (diff)
parent14c3714b81b0c264ff8e117f0230330cc0514ed2 (diff)
svn merge -r36564:36583 https://svn.blender.org/svnroot/bf-blender/trunk/blender
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/CMakeLists.txt3
-rw-r--r--source/blender/blenfont/CMakeLists.txt2
-rw-r--r--source/blender/blenkernel/CMakeLists.txt4
-rw-r--r--source/blender/blenkernel/intern/displist.c5
-rw-r--r--source/blender/editors/include/ED_image.h3
-rw-r--r--source/blender/editors/render/CMakeLists.txt2
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c2
-rw-r--r--source/blender/editors/space_view3d/drawobject.c111
-rw-r--r--source/blender/gpu/CMakeLists.txt2
-rw-r--r--source/blender/imbuf/intern/filter.c2
-rw-r--r--source/blender/makesdna/DNA_object_types.h4
-rw-r--r--source/blender/makesrna/intern/CMakeLists.txt2
-rw-r--r--source/blender/makesrna/intern/rna_object.c33
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c2
14 files changed, 148 insertions, 29 deletions
diff --git a/source/blender/CMakeLists.txt b/source/blender/CMakeLists.txt
index 2871c4cd214..995b5fe7255 100644
--- a/source/blender/CMakeLists.txt
+++ b/source/blender/CMakeLists.txt
@@ -124,6 +124,5 @@ if(WITH_PYTHON)
endif()
if(WITH_OPENCOLLADA)
- add_subdirectory(collada)
+ add_subdirectory(collada)
endif()
-
diff --git a/source/blender/blenfont/CMakeLists.txt b/source/blender/blenfont/CMakeLists.txt
index 15fbfaa2de2..48ee4aed033 100644
--- a/source/blender/blenfont/CMakeLists.txt
+++ b/source/blender/blenfont/CMakeLists.txt
@@ -29,7 +29,7 @@ set(INC
../editors/include
../blenkernel
../../../intern/guardedalloc
- ${GLEW_INCLUDE_PATH}
+ ${GLEW_INCLUDE_PATH}
${FREETYPE_INCLUDE_DIRS}
)
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 4040cc7d4f7..68a4dd4ce0c 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -54,7 +54,7 @@ set(INC
../../../intern/opennl/extern
../../../intern/smoke/extern
../../../intern/mikktspace
- ../../../source/blender/windowmanager # XXX - BAD LEVEL CALL WM_api.h
+ ../../../source/blender/windowmanager # XXX - BAD LEVEL CALL WM_api.h
${GLEW_INCLUDE_PATH}
${ZLIB_INCLUDE_DIRS}
)
@@ -317,7 +317,7 @@ if(WITH_LZMA)
endif()
if(MSVC)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
endif()
blender_add_lib(bf_blenkernel "${SRC}" "${INC}")
diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c
index 48192546b0f..6d70572c8a4 100644
--- a/source/blender/blenkernel/intern/displist.c
+++ b/source/blender/blenkernel/intern/displist.c
@@ -1975,8 +1975,9 @@ static void boundbox_displist(Object *ob)
}
if(!doit) {
- min[0] = min[1] = min[2] = -1.0f;
- max[0] = max[1] = max[2] = 1.0f;
+ /* there's no geometry in displist, use zero-sized boundbox */
+ zero_v3(min);
+ zero_v3(max);
}
}
diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h
index 2c866495503..cfe9ea53d9a 100644
--- a/source/blender/editors/include/ED_image.h
+++ b/source/blender/editors/include/ED_image.h
@@ -68,8 +68,5 @@ int ED_space_image_show_uvshadow(struct SpaceImage *sima, struct Object *obedit)
/* UI level image (texture) updating... render calls own stuff (too) */
void ED_image_update_frame(const struct Main *mainp, int cfra);
-/* image_render.c, export for screen_ops.c, render operator */
-void ED_space_image_output(struct bContext *C);
-
#endif /* ED_IMAGE_H */
diff --git a/source/blender/editors/render/CMakeLists.txt b/source/blender/editors/render/CMakeLists.txt
index 2f5641196fe..e8c23954f65 100644
--- a/source/blender/editors/render/CMakeLists.txt
+++ b/source/blender/editors/render/CMakeLists.txt
@@ -33,7 +33,7 @@ set(INC
../../render/extern/include
../../windowmanager
../../../../intern/guardedalloc
- ${GLEW_INCLUDE_PATH}
+ ${GLEW_INCLUDE_PATH}
)
set(SRC
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index b327f7deaed..717d77e65b8 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -440,6 +440,8 @@ static void image_undo_restore(bContext *C, ListBase *lb)
GPU_free_image(ima); /* force OpenGL reload */
if(ibuf->rect_float)
ibuf->userflags |= IB_RECT_INVALID; /* force recreate of char rect */
+ if(ibuf->mipmap[0])
+ ibuf->userflags |= IB_MIPMAP_INVALID; /* force mipmap recreatiom */
}
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 7b0bb2dcf7a..12296bb10b0 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -46,6 +46,7 @@
#include "DNA_scene_types.h"
#include "DNA_smoke_types.h"
#include "DNA_world_types.h"
+#include "DNA_armature_types.h"
#include "BLI_utildefines.h"
#include "BLI_blenlib.h"
@@ -79,6 +80,9 @@
#include "smoke_API.h"
+#include "IMB_imbuf.h"
+#include "IMB_imbuf_types.h"
+
#include "BIF_gl.h"
#include "BIF_glutil.h"
@@ -518,6 +522,96 @@ void drawaxes(float size, char drawtype)
}
}
+
+/* Function to draw an Image on a empty Object */
+static void draw_empty_image(Object *ob)
+{
+ Image *ima = (Image*)ob->data;
+ ImBuf *ibuf = ima ? BKE_image_get_ibuf(ima, NULL) : NULL;
+
+ float scale, ofs_x, ofs_y, sca_x, sca_y;
+ int ima_x, ima_y;
+
+ if(ibuf && (ibuf->rect == NULL) && (ibuf->rect_float != NULL)) {
+ IMB_rect_from_float(ibuf);
+ }
+
+ /* Get the buffer dimensions so we can fallback to fake ones */
+ if(ibuf && ibuf->rect) {
+ ima_x= ibuf->x;
+ ima_y= ibuf->y;
+ }
+ else {
+ ima_x= 1;
+ ima_y= 1;
+ }
+
+ /* Get the image aspect even if the buffer is invalid */
+ if(ima) {
+ if(ima->aspx > ima->aspy) {
+ sca_x= 1.0f;
+ sca_y= ima->aspy / ima->aspx;
+ }
+ else if(ima->aspx < ima->aspy) {
+ sca_x= ima->aspx / ima->aspy;
+ sca_y= 1.0f;
+ }
+ else {
+ sca_x= 1.0f;
+ sca_y= 1.0f;
+ }
+ }
+ else {
+ sca_x= 1.0f;
+ sca_y= 1.0f;
+ }
+
+ /* Calculate the scale center based on objects origin */
+ ofs_x= ob->ima_ofs[0] * ima_x;
+ ofs_y= ob->ima_ofs[1] * ima_y;
+
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+
+ /* Make sure we are drawing at the origin */
+ glTranslatef(0.0f, 0.0f, 0.0f);
+
+ /* Calculate Image scale */
+ scale= (ob->empty_drawsize / (float)MAX2(ima_x * sca_x, ima_y * sca_y));
+
+ /* Set the object scale */
+ glScalef(scale * sca_x, scale * sca_y, 1.0f);
+
+ if(ibuf && ibuf->rect) {
+ /* Setup GL params */
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ /* Use the object color and alpha */
+ glColor4fv(ob->col);
+
+ /* Draw the Image on the screen */
+ glaDrawPixelsTex(ofs_x, ofs_y, ima_x, ima_y, GL_UNSIGNED_BYTE, ibuf->rect);
+ glPixelTransferf(GL_ALPHA_SCALE, 1.0f);
+
+ glDisable(GL_BLEND);
+ }
+
+ UI_ThemeColor((ob->flag & SELECT) ? TH_SELECT : TH_WIRE);
+
+ /* Calculate the outline vertex positions */
+ glBegin(GL_LINE_LOOP);
+ glVertex2f(ofs_x, ofs_y);
+ glVertex2f(ofs_x + ima_x, ofs_y);
+ glVertex2f(ofs_x + ima_x, ofs_y + ima_y);
+ glVertex2f(ofs_x, ofs_y + ima_y);
+ glEnd();
+
+ /* Reset GL settings */
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+}
+
void drawcircball(int mode, const float cent[3], float rad, float tmat[][4])
{
float vec[3], vx[3], vy[3];
@@ -6162,8 +6256,14 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
break;
}
case OB_EMPTY:
- if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0)
- drawaxes(ob->empty_drawsize, ob->empty_drawtype);
+ if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
+ if (ob->empty_drawtype == OB_EMPTY_IMAGE) {
+ draw_empty_image(ob);
+ }
+ else {
+ drawaxes(ob->empty_drawsize, ob->empty_drawtype);
+ }
+ }
break;
case OB_LAMP:
if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) {
@@ -6780,7 +6880,12 @@ void draw_object_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object
draw_object_mesh_instance(scene, v3d, rv3d, ob, dt, outline);
break;
case OB_EMPTY:
- drawaxes(ob->empty_drawsize, ob->empty_drawtype);
+ if (ob->empty_drawtype == OB_EMPTY_IMAGE) {
+ draw_empty_image(ob);
+ }
+ else {
+ drawaxes(ob->empty_drawsize, ob->empty_drawtype);
+ }
break;
}
}
diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt
index fc7e3408683..d6e2b56c065 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -34,7 +34,7 @@ set(INC
../makesrna
../../../intern/guardedalloc
../../../intern/smoke/extern
- ${GLEW_INCLUDE_PATH}
+ ${GLEW_INCLUDE_PATH}
)
set(SRC
diff --git a/source/blender/imbuf/intern/filter.c b/source/blender/imbuf/intern/filter.c
index 2821ba2a361..16fb1fdf4aa 100644
--- a/source/blender/imbuf/intern/filter.c
+++ b/source/blender/imbuf/intern/filter.c
@@ -437,7 +437,7 @@ void IMB_makemipmap(ImBuf *ibuf, int use_filter)
hbuf= ibuf->mipmap[curmap];
hbuf->miplevel= curmap+1;
- if(!hbuf || (hbuf->x == 1 && hbuf->y == 1))
+ if(!hbuf || (hbuf->x <= 2 && hbuf->y <= 2))
break;
curmap++;
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index bca9800d5ad..90eafe82395 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -259,6 +259,9 @@ typedef struct Object {
ListBase gpulamp; /* runtime, for lamps only */
ListBase pc_ids;
ListBase *duplilist; /* for temporary dupli list storage, only for use by RNA API */
+
+ float ima_ofs[2]; /* offset for image empties */
+ char pad3[8];
} Object;
/* Warning, this is not used anymore because hooks are now modifiers */
@@ -399,6 +402,7 @@ extern Object workob;
#define OB_CUBE 5
#define OB_EMPTY_SPHERE 6
#define OB_EMPTY_CONE 7
+#define OB_EMPTY_IMAGE 8
/* boundtype */
#define OB_BOUND_BOX 0
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index 84c3941539a..823844b1524 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -223,7 +223,7 @@ blender_include_dirs(
../../../../intern/audaspace/intern
../../../../intern/guardedalloc
../../../../intern/memutil
- ${GLEW_INCLUDE_PATH}
+ ${GLEW_INCLUDE_PATH}
)
add_executable(makesrna ${SRC} ${SRC_RNA_INC} ${SRC_DNA_INC})
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 5d337e70908..c3ceb31fc4c 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -308,22 +308,26 @@ static void rna_Base_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
WM_main_add_notifier(NC_SCENE|ND_LAYER_CONTENT, scene);
}
-static int rna_Object_data_editable(PointerRNA *ptr)
-{
- Object *ob= (Object*)ptr->data;
-
- return (ob->type == OB_EMPTY)? 0: PROP_EDITABLE;
-}
-
static void rna_Object_data_set(PointerRNA *ptr, PointerRNA value)
{
Object *ob= (Object*)ptr->data;
ID *id= value.data;
- if(ob->type == OB_EMPTY || id == NULL || ob->mode & OB_MODE_EDIT)
+ if (id == NULL || ob->mode & OB_MODE_EDIT)
return;
-
- if(ob->type == OB_MESH) {
+
+ if (ob->type == OB_EMPTY) {
+ if(ob->data) {
+ id_us_min((ID*)ob->data);
+ ob->data = NULL;
+ }
+
+ if (id && GS(id->name) == ID_IM) {
+ id_us_plus(id);
+ ob->data = id;
+ }
+ }
+ else if(ob->type == OB_MESH) {
set_mesh(ob, (Mesh*)id);
}
else {
@@ -347,6 +351,7 @@ static StructRNA *rna_Object_data_typef(PointerRNA *ptr)
Object *ob= (Object*)ptr->data;
switch(ob->type) {
+ case OB_EMPTY: return &RNA_Image;
case OB_MESH: return &RNA_Mesh;
case OB_CURVE: return &RNA_Curve;
case OB_SURF: return &RNA_Curve;
@@ -1692,6 +1697,7 @@ static void rna_def_object(BlenderRNA *brna)
{OB_CUBE, "CUBE", 0, "Cube", ""},
{OB_EMPTY_SPHERE, "SPHERE", 0, "Sphere", ""},
{OB_EMPTY_CONE, "CONE", 0, "Cone", ""},
+ {OB_EMPTY_IMAGE, "IMAGE", 0, "Image", ""},
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem track_items[] = {
@@ -1759,7 +1765,6 @@ static void rna_def_object(BlenderRNA *brna)
prop= RNA_def_property(srna, "data", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "ID");
RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_data_set", "rna_Object_data_typef", NULL);
- RNA_def_property_editable_func(prop, "rna_Object_data_editable");
RNA_def_property_flag(prop, PROP_EDITABLE|PROP_NEVER_UNLINK);
RNA_def_property_ui_text(prop, "Data", "Object data");
RNA_def_property_update(prop, 0, "rna_Object_internal_update_data");
@@ -2044,6 +2049,12 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Empty Display Size", "Size of display for empties in the viewport");
RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
+ prop= RNA_def_property(srna, "empty_image_offset", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "ima_ofs");
+ RNA_def_property_ui_text(prop, "Origin Offset", "Origin offset distance");
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 0.1f, 2);
+ RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
+
/* render */
prop= RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
RNA_def_property_int_sdna(prop, NULL, "index");
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index ae308b9423f..d4ac9880290 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -389,7 +389,7 @@ void RNA_api_ui_layout(StructRNA *srna)
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
api_ui_item_rna_common(func);
parm= RNA_def_pointer(func, "image_user", "ImageUser", "", "");
- RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR);
+ RNA_def_property_flag(parm, PROP_REQUIRED|PROP_RNAPTR|PROP_NEVER_NULL);
RNA_def_boolean(func, "compact", 0, "", "Use more compact layout.");
func= RNA_def_function(srna, "template_list", "uiTemplateList");