[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18585] branches/blender2.5/blender/source : 2.5
Ton Roosendaal
ton at blender.org
Tue Jan 20 12:09:32 CET 2009
Revision: 18585
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18585
Author: ton
Date: 2009-01-20 12:09:26 +0100 (Tue, 20 Jan 2009)
Log Message:
-----------
2.5
- Previewrender code back, commented out a lot of bad cruft,
nothing works or is linked even!
- Added NC_GROUP notifier type, used in editgroup.c and
listened to in 3dview and outliner
Modified Paths:
--------------
branches/blender2.5/blender/source/Makefile
branches/blender2.5/blender/source/blender/editors/SConscript
branches/blender2.5/blender/source/blender/editors/include/ED_view3d.h
branches/blender2.5/blender/source/blender/editors/object/editgroup.c
branches/blender2.5/blender/source/blender/editors/space_outliner/space_outliner.c
branches/blender2.5/blender/source/blender/editors/space_view3d/space_view3d.c
branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_intern.h
branches/blender2.5/blender/source/blender/windowmanager/WM_types.h
Added Paths:
-----------
branches/blender2.5/blender/source/blender/editors/preview/previewrender.c
branches/blender2.5/blender/source/blender/editors/preview/previewrender_intern.h
Modified: branches/blender2.5/blender/source/Makefile
===================================================================
--- branches/blender2.5/blender/source/Makefile 2009-01-20 11:07:42 UTC (rev 18584)
+++ branches/blender2.5/blender/source/Makefile 2009-01-20 11:09:26 UTC (rev 18585)
@@ -235,6 +235,7 @@
PULIB += $(OCGDIR)/blender/ed_ipo/libed_ipo.a
PULIB += $(OCGDIR)/blender/ed_outliner/libed_outliner.a
PULIB += $(OCGDIR)/blender/ed_time/libed_time.a
+PULIB += $(OCGDIR)/blender/ed_preview/libed_preview.a
PULIB += $(OCGDIR)/blender/ed_view3d/libed_view3d.a
PULIB += $(OCGDIR)/blender/ed_interface/libed_interface.a
PULIB += $(OCGDIR)/blender/ed_object/libed_object.a
Modified: branches/blender2.5/blender/source/blender/editors/SConscript
===================================================================
--- branches/blender2.5/blender/source/blender/editors/SConscript 2009-01-20 11:07:42 UTC (rev 18584)
+++ branches/blender2.5/blender/source/blender/editors/SConscript 2009-01-20 11:09:26 UTC (rev 18585)
@@ -13,7 +13,7 @@
'curve/SConscript',
'gpencil/SConscript',
#'physics/SConscript', enable this when there is actually code in physics/
- #'preview/SConscript', enable this when there is actually code in preview/
+ 'preview/SConscript'
'space_buttons/SConscript',
'space_file/SConscript',
'space_image/SConscript',
Modified: branches/blender2.5/blender/source/blender/editors/include/ED_view3d.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/ED_view3d.h 2009-01-20 11:07:42 UTC (rev 18584)
+++ branches/blender2.5/blender/source/blender/editors/include/ED_view3d.h 2009-01-20 11:09:26 UTC (rev 18585)
@@ -79,6 +79,8 @@
void viewline(struct ARegion *ar, struct View3D *v3d, short mval[2], float ray_start[3], float ray_end[3]);
void viewray(struct ARegion *ar, struct View3D *v3d, short mval[2], float ray_start[3], float ray_normal[3]);
+int get_view3d_viewplane(struct View3D *v3d, struct RegionView3D *rv3d, int winxi, int winyi, rctf *viewplane, float *clipsta, float *clipend, float *pixsize);
+
/* drawobject.c itterators */
void mesh_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct EditVert *eve, int x, int y, int index), void *userData, int clipVerts);
void mesh_foreachScreenEdge(struct ViewContext *vc, void (*func)(void *userData, struct EditEdge *eed, int x0, int y0, int x1, int y1, int index), void *userData, int clipVerts);
Modified: branches/blender2.5/blender/source/blender/editors/object/editgroup.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/object/editgroup.c 2009-01-20 11:07:42 UTC (rev 18584)
+++ branches/blender2.5/blender/source/blender/editors/object/editgroup.c 2009-01-20 11:09:26 UTC (rev 18585)
@@ -97,7 +97,7 @@
DAG_scene_sort(CTX_data_scene(C));
ED_undo_push(C,"Add To Active Group");
- WM_event_add_notifier(C, NC_SCENE, CTX_data_scene(C));
+ WM_event_add_notifier(C, NC_GROUP|NA_EDITED, NULL);
return OPERATOR_FINISHED;
@@ -149,7 +149,7 @@
DAG_scene_sort(CTX_data_scene(C));
ED_undo_push(C,"Remove From Active Group");
- WM_event_add_notifier(C, NC_SCENE, CTX_data_scene(C));
+ WM_event_add_notifier(C, NC_GROUP|NA_EDITED, NULL);
return OPERATOR_FINISHED;
@@ -185,7 +185,7 @@
DAG_scene_sort(CTX_data_scene(C));
ED_undo_push(C,"Remove From Group");
- WM_event_add_notifier(C, NC_SCENE, CTX_data_scene(C));
+ WM_event_add_notifier(C, NC_GROUP|NA_EDITED, NULL);
return OPERATOR_FINISHED;
@@ -223,7 +223,7 @@
DAG_scene_sort(CTX_data_scene(C));
ED_undo_push(C,"Create Group");
- WM_event_add_notifier(C, NC_SCENE, CTX_data_scene(C));
+ WM_event_add_notifier(C, NC_GROUP|NA_EDITED, NULL);
return OPERATOR_FINISHED;
Copied: branches/blender2.5/blender/source/blender/editors/preview/previewrender.c (from rev 18576, trunk/blender/source/blender/src/previewrender.c)
===================================================================
--- branches/blender2.5/blender/source/blender/editors/preview/previewrender.c (rev 0)
+++ branches/blender2.5/blender/source/blender/editors/preview/previewrender.c 2009-01-20 11:09:26 UTC (rev 18585)
@@ -0,0 +1,962 @@
+/*
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) Blender Foundation.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/* global includes */
+
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+
+#ifndef WIN32
+#include <unistd.h>
+#else
+#include <io.h>
+#endif
+#include "MEM_guardedalloc.h"
+
+#include "BLO_readfile.h"
+
+#include "BLI_arithb.h"
+#include "BLI_blenlib.h"
+
+#include "DNA_texture_types.h"
+#include "DNA_world_types.h"
+#include "DNA_camera_types.h"
+#include "DNA_image_types.h"
+#include "DNA_material_types.h"
+#include "DNA_node_types.h"
+#include "DNA_object_types.h"
+#include "DNA_lamp_types.h"
+#include "DNA_space_types.h"
+#include "DNA_view3d_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_screen_types.h"
+
+#include "BKE_context.h"
+#include "BKE_depsgraph.h"
+#include "BKE_global.h"
+#include "BKE_image.h"
+#include "BKE_icons.h"
+#include "BKE_library.h"
+#include "BKE_main.h"
+#include "BKE_texture.h"
+#include "BKE_material.h"
+#include "BKE_node.h"
+#include "BKE_world.h"
+#include "BKE_texture.h"
+#include "BKE_utildefines.h"
+
+#include "IMB_imbuf.h"
+#include "IMB_imbuf_types.h"
+
+#include "BIF_gl.h"
+#include "BIF_glutil.h"
+
+#include "PIL_time.h"
+
+#include "RE_pipeline.h"
+
+#include "GPU_material.h"
+
+#include "ED_anim_api.h"
+#include "ED_view3d.h"
+
+#include "UI_interface.h"
+
+#include "previewrender_intern.h"
+
+#define PR_XMIN 10
+#define PR_YMIN 5
+#define PR_XMAX 200
+#define PR_YMAX 195
+
+/* XXX */
+static int qtest() {return 0;}
+/* XXX */
+
+static void set_previewrect(ScrArea *sa, RenderInfo *ri)
+{
+ ARegion *ar= NULL; // XXX
+ rctf viewplane;
+
+ BLI_init_rctf(&viewplane, PR_XMIN, PR_XMAX, PR_YMIN, PR_YMAX);
+
+// ui_graphics_to_window_rct(ar->win, &viewplane, &ri->disprect);
+
+ /* correction for gla draw */
+ BLI_translate_rcti(&ri->disprect, -ar->winrct.xmin, -ar->winrct.ymin);
+
+ glMatrixMode(GL_PROJECTION);
+ glPushMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPushMatrix();
+
+ glaDefine2DArea(&ar->winrct);
+
+ ri->pr_rectx= (ri->disprect.xmax-ri->disprect.xmin);
+ ri->pr_recty= (ri->disprect.ymax-ri->disprect.ymin);
+}
+
+static void end_previewrect(ARegion *ar)
+{
+ glMatrixMode(GL_PROJECTION);
+ glPopMatrix();
+ glMatrixMode(GL_MODELVIEW);
+ glPopMatrix();
+
+ // restore viewport / scissor which was set by glaDefine2DArea
+ glViewport(ar->winrct.xmin, ar->winrct.ymin, ar->winx, ar->winy);
+ glScissor(ar->winrct.xmin, ar->winrct.ymin, ar->winx, ar->winy);
+
+}
+
+/* unused now */
+void draw_tex_crop(Tex *tex)
+{
+ rcti rct;
+ int ret= 0;
+
+ if(tex==0) return;
+
+ if(tex->type==TEX_IMAGE) {
+ if(tex->cropxmin==0.0f) ret++;
+ if(tex->cropymin==0.0f) ret++;
+ if(tex->cropxmax==1.0f) ret++;
+ if(tex->cropymax==1.0f) ret++;
+ if(ret==4) return;
+
+ rct.xmin= PR_XMIN+2+tex->cropxmin*(PR_XMAX-PR_XMIN-4);
+ rct.xmax= PR_XMIN+2+tex->cropxmax*(PR_XMAX-PR_XMIN-4);
+ rct.ymin= PR_YMIN+2+tex->cropymin*(PR_YMAX-PR_YMIN-4);
+ rct.ymax= PR_YMIN+2+tex->cropymax*(PR_YMAX-PR_YMIN-4);
+
+ glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
+
+ glColor3ub(0, 0, 0);
+ glRecti(rct.xmin+1, rct.ymin-1, rct.xmax+1, rct.ymax-1);
+
+ glColor3ub(255, 255, 255);
+ glRecti(rct.xmin, rct.ymin, rct.xmax, rct.ymax);
+
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ }
+
+}
+
+/* temporal abuse; if id_code is -1 it only does texture.... solve! */
+void BIF_preview_changed(short id_code)
+{
+#if 0
+ ScrArea *sa;
+
+ for(sa= G.curscreen->areabase.first; sa; sa= sa->next) {
+ if(sa->spacetype==SPACE_BUTS) {
+ SpaceButs *sbuts= sa->spacedata.first;
+ if(sbuts->mainb==CONTEXT_SHADING) {
+ int tab= sbuts->tab[CONTEXT_SHADING];
+ if(tab==TAB_SHADING_MAT && (id_code==ID_MA || id_code==ID_TE)) {
+ if (sbuts->ri) sbuts->ri->curtile= 0;
+ addafterqueue(sa->win, RENDERPREVIEW, 1);
+ }
+ else if(tab==TAB_SHADING_TEX && (id_code==ID_TE || id_code==-1)) {
+ if (sbuts->ri) sbuts->ri->curtile= 0;
+ addafterqueue(sa->win, RENDERPREVIEW, 1);
+ }
+ else if(tab==TAB_SHADING_LAMP && (id_code==ID_LA || id_code==ID_TE)) {
+ if (sbuts->ri) sbuts->ri->curtile= 0;
+ addafterqueue(sa->win, RENDERPREVIEW, 1);
+ }
+ else if(tab==TAB_SHADING_WORLD && (id_code==ID_WO || id_code==ID_TE)) {
+ if (sbuts->ri) sbuts->ri->curtile= 0;
+ addafterqueue(sa->win, RENDERPREVIEW, 1);
+ }
+ }
+ else if (sbuts->ri)
+ sbuts->ri->curtile= 0; /* ensure changes always result in re-render when context is restored */
+ }
+ else if(sa->spacetype==SPACE_NODE) {
+ SpaceNode *snode= sa->spacedata.first;
+ if(snode->treetype==NTREE_SHADER && (id_code==ID_MA || id_code==ID_TE)) {
+ snode_tag_dirty(snode);
+ }
+ }
+ else if(sa->spacetype==SPACE_VIEW3D) {
+ View3D *vd= sa->spacedata.first;
+ /* if is has a renderinfo, we consider that reason for signalling */
+ if (vd->ri) {
+ vd->ri->curtile= 0;
+ addafterqueue(sa->win, RENDERPREVIEW, 1);
+ }
+ }
+ }
+
+ if(ELEM4(id_code, ID_MA, ID_TE, ID_LA, ID_WO)) {
+ Object *ob;
+ Material *ma;
+
+ if(id_code == ID_WO) {
+ for(ma=G.main->mat.first; ma; ma=ma->id.next) {
+ if(ma->gpumaterial.first) {
+ GPU_material_free(ma);
+ }
+ }
+ }
+ else if(id_code == ID_LA) {
+ for(ob=G.main->object.first; ob; ob=ob->id.next) {
+ if(ob->gpulamp.first) {
+ GPU_lamp_free(ob);
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list