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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-09-29 23:12:12 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-09-29 23:12:12 +0400
commit15d07720e515a2e9caada6ee9900c388c5e06490 (patch)
tree8154e70a86e3b9b0cf42a581db95f0a7d4029238 /source/blender/editors/physics/ed_pointcache.c
parent7f5dc4644f72ffb56d23db79cc3208dbca2d5eab (diff)
Sorry, three commits in one, became difficult to untangle..
Editors Modules * render/ module added in editors, moved the preview render code there and also shading related operators. * physics/ module made more consistent with other modules. renaming files, making a single physics_ops.c for operators and keymaps. Also move all particle related operators here now. * space_buttons/ now should have only operators relevant to the buttons specificially. Updates & Notifiers * Material/Texture/World/Lamp can now be passed to DAG_id_flush_update, which will go back to a callback in editors. Eventually these should be in the depsgraph itself, but for now this gives a unified call for doing updates. * GLSL materials are now refreshed on changes. There's still various cases missing, * Preview icons now hook into this system, solving various update cases that were missed before. * Also fixes issue in my last commit, where some preview would not render, problem is avoided in the new system. Icon Rendering * On systems with support for non-power of two textures, an OpenGL texture is now used instead of glDrawPixels. This avoids problems with icons get clipped on region borders. On my Linux desktop, this gives an 1.1x speedup, and on my Mac laptop a 2.3x speedup overall in redrawing the full window, with the default setup. The glDrawPixels implementation on Mac seems to have a lot of overhread. * Preview icons are now drawn using proper premul alpha, and never faded so you can see them clearly. * Also tried to fix issue with texture node preview rendering, globals can't be used with threads reliably.
Diffstat (limited to 'source/blender/editors/physics/ed_pointcache.c')
-rw-r--r--source/blender/editors/physics/ed_pointcache.c357
1 files changed, 0 insertions, 357 deletions
diff --git a/source/blender/editors/physics/ed_pointcache.c b/source/blender/editors/physics/ed_pointcache.c
deleted file mode 100644
index ed3aaf0cfd1..00000000000
--- a/source/blender/editors/physics/ed_pointcache.c
+++ /dev/null
@@ -1,357 +0,0 @@
-/*
- * $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) 2007 by Janne Karhu.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_scene_types.h"
-#include "DNA_object_force.h"
-#include "DNA_modifier_types.h"
-
-#include "BKE_context.h"
-#include "BKE_particle.h"
-#include "BKE_report.h"
-#include "BKE_scene.h"
-#include "BKE_utildefines.h"
-#include "BKE_pointcache.h"
-#include "BKE_global.h"
-#include "BKE_modifier.h"
-
-#include "BLI_blenlib.h"
-
-#include "ED_screen.h"
-#include "ED_physics.h"
-#include "ED_particle.h"
-
-#include "UI_interface.h"
-#include "UI_resources.h"
-
-#include "WM_api.h"
-#include "WM_types.h"
-
-#include "RNA_access.h"
-#include "RNA_define.h"
-
-#include "physics_intern.h"
-
-static int cache_break_test(void *cbd) {
- return G.afbreek==1;
-}
-static int ptcache_bake_all_poll(bContext *C)
-{
- Scene *scene= CTX_data_scene(C);
-
- if(!scene)
- return 0;
-
- return 1;
-}
-
-static int ptcache_poll(bContext *C)
-{
- PointerRNA ptr= CTX_data_pointer_get_type(C, "PointCache", &RNA_PointCache);
- return (ptr.data && ptr.id.data);
-}
-
-static int ptcache_bake_all_exec(bContext *C, wmOperator *op)
-{
- Scene *scene= CTX_data_scene(C);
- PTCacheBaker baker;
-
-
- baker.scene = scene;
- baker.pid = NULL;
- baker.bake = RNA_boolean_get(op->ptr, "bake");
- baker.render = 0;
- baker.anim_init = 0;
- baker.quick_step = 1;
- baker.break_test = cache_break_test;
- baker.break_data = NULL;
- baker.progressbar = (void (*)(void *, int))WM_timecursor;
- baker.progresscontext = CTX_wm_window(C);
-
- BKE_ptcache_make_cache(&baker);
-
- WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
-
- return OPERATOR_FINISHED;
-}
-static int ptcache_free_bake_all_exec(bContext *C, wmOperator *op)
-{
- Scene *scene= CTX_data_scene(C);
- Base *base;
- PTCacheID *pid;
- ListBase pidlist;
-
- for(base=scene->base.first; base; base= base->next) {
- BKE_ptcache_ids_from_object(&pidlist, base->object);
-
- for(pid=pidlist.first; pid; pid=pid->next) {
- pid->cache->flag &= ~PTCACHE_BAKED;
- }
-
- BLI_freelistN(&pidlist);
- }
-
- WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
-
- return OPERATOR_FINISHED;
-}
-
-void PTCACHE_OT_bake_all(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name= "Bake All Physics";
- ot->idname= "PTCACHE_OT_bake_all";
-
- /* api callbacks */
- ot->exec= ptcache_bake_all_exec;
- ot->poll= ptcache_bake_all_poll;
-
- /* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
- RNA_def_boolean(ot->srna, "bake", 1, "Bake", "");
-}
-void PTCACHE_OT_free_bake_all(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name= "Free All Physics Bakes";
- ot->idname= "PTCACHE_OT_free_bake_all";
-
- /* api callbacks */
- ot->exec= ptcache_free_bake_all_exec;
- ot->poll= ptcache_bake_all_poll;
-
- /* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-}
-static int ptcache_bake_exec(bContext *C, wmOperator *op)
-{
- Scene *scene = CTX_data_scene(C);
- PointerRNA ptr= CTX_data_pointer_get_type(C, "PointCache", &RNA_PointCache);
- Object *ob= ptr.id.data;
- PointCache *cache= ptr.data;
- PTCacheBaker baker;
- PTCacheID *pid;
- ListBase pidlist;
-
- BKE_ptcache_ids_from_object(&pidlist, ob);
-
- for(pid=pidlist.first; pid; pid=pid->next) {
- if(pid->cache == cache)
- break;
- }
-
- baker.scene = scene;
- baker.pid = pid;
- baker.bake = RNA_boolean_get(op->ptr, "bake");
- baker.render = 0;
- baker.anim_init = 0;
- baker.quick_step = 1;
- baker.break_test = cache_break_test;
- baker.break_data = NULL;
- baker.progressbar = (void (*)(void *, int))WM_timecursor;
- baker.progresscontext = CTX_wm_window(C);
-
- BKE_ptcache_make_cache(&baker);
-
- BLI_freelistN(&pidlist);
-
- WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
-
- return OPERATOR_FINISHED;
-}
-static int ptcache_free_bake_exec(bContext *C, wmOperator *op)
-{
- PointerRNA ptr= CTX_data_pointer_get_type(C, "PointCache", &RNA_PointCache);
- PointCache *cache= ptr.data;
-
- if(cache->edit) {
- if(!cache->edit->edited || 1) {// XXX okee("Lose changes done in particle mode?")) {
- PE_free_ptcache_edit(cache->edit);
- cache->edit = NULL;
- cache->flag &= ~PTCACHE_BAKED;
- }
- }
- else
- cache->flag &= ~PTCACHE_BAKED;
-
- return OPERATOR_FINISHED;
-}
-static int ptcache_bake_from_cache_exec(bContext *C, wmOperator *op)
-{
- PointerRNA ptr= CTX_data_pointer_get_type(C, "PointCache", &RNA_PointCache);
- PointCache *cache= ptr.data;
-
- cache->flag |= PTCACHE_BAKED;
-
- return OPERATOR_FINISHED;
-}
-void PTCACHE_OT_bake(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name= "Bake Physics";
- ot->idname= "PTCACHE_OT_bake";
-
- /* api callbacks */
- ot->exec= ptcache_bake_exec;
- ot->poll= ptcache_poll;
-
- /* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-
- RNA_def_boolean(ot->srna, "bake", 0, "Bake", "");
-}
-void PTCACHE_OT_free_bake(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name= "Free Physics Bake";
- ot->idname= "PTCACHE_OT_free_bake";
-
- /* api callbacks */
- ot->exec= ptcache_free_bake_exec;
- ot->poll= ptcache_poll;
-
- /* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-}
-void PTCACHE_OT_bake_from_cache(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name= "Bake From Cache";
- ot->idname= "PTCACHE_OT_bake_from_cache";
-
- /* api callbacks */
- ot->exec= ptcache_bake_from_cache_exec;
- ot->poll= ptcache_poll;
-
- /* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-}
-
-static int ptcache_add_new_exec(bContext *C, wmOperator *op)
-{
- Scene *scene = CTX_data_scene(C);
- PointerRNA ptr= CTX_data_pointer_get_type(C, "PointCache", &RNA_PointCache);
- Object *ob= ptr.id.data;
- PointCache *cache= ptr.data;
- PTCacheID *pid;
- ListBase pidlist;
-
- BKE_ptcache_ids_from_object(&pidlist, ob);
-
- for(pid=pidlist.first; pid; pid=pid->next) {
- if(pid->cache == cache) {
- *(pid->cache_ptr) = BKE_ptcache_add(pid->ptcaches);
- break;
- }
- }
-
- BLI_freelistN(&pidlist);
-
- WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene);
-
- return OPERATOR_FINISHED;
-}
-static int ptcache_remove_exec(bContext *C, wmOperator *op)
-{
- PointerRNA ptr= CTX_data_pointer_get_type(C, "PointCache", &RNA_PointCache);
- Object *ob= ptr.id.data;
- PointCache *cache= ptr.data;
- PTCacheID *pid;
- ListBase pidlist;
-
- BKE_ptcache_ids_from_object(&pidlist, ob);
-
- for(pid=pidlist.first; pid; pid=pid->next) {
- if(pid->cache == cache) {
- if(pid->ptcaches->first == pid->ptcaches->last)
- continue; /* don't delete last cache */
-
- BLI_remlink(pid->ptcaches, pid->cache);
- BKE_ptcache_free(pid->cache);
- *(pid->cache_ptr) = pid->ptcaches->first;
-
- break;
- }
- }
-
- BLI_freelistN(&pidlist);
-
- return OPERATOR_FINISHED;
-}
-void PTCACHE_OT_add_new(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name= "Add new cache";
- ot->idname= "PTCACHE_OT_add_new";
-
- /* api callbacks */
- ot->exec= ptcache_add_new_exec;
- ot->poll= ptcache_poll; // ptcache_bake_all_poll;
-
- /* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-}
-void PTCACHE_OT_remove(wmOperatorType *ot)
-{
- /* identifiers */
- ot->name= "Delete current cache";
- ot->idname= "PTCACHE_OT_remove";
-
- /* api callbacks */
- ot->exec= ptcache_remove_exec;
- ot->poll= ptcache_poll;
-
- /* flags */
- ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-}
-/**************************** registration **********************************/
-
-void ED_operatortypes_pointcache(void)
-{
- WM_operatortype_append(PTCACHE_OT_bake_all);
- WM_operatortype_append(PTCACHE_OT_free_bake_all);
- WM_operatortype_append(PTCACHE_OT_bake);
- WM_operatortype_append(PTCACHE_OT_free_bake);
- WM_operatortype_append(PTCACHE_OT_bake_from_cache);
- WM_operatortype_append(PTCACHE_OT_add_new);
- WM_operatortype_append(PTCACHE_OT_remove);
-}
-
-//void ED_keymap_pointcache(wmWindowManager *wm)
-//{
-// wmKeyMap *keymap= WM_keymap_find(wm, "Pointcache", 0, 0);
-//
-// WM_keymap_add_item(keymap, "PHYSICS_OT_bake_all", AKEY, KM_PRESS, 0, 0);
-// WM_keymap_add_item(keymap, "PHYSICS_OT_free_all", PADPLUSKEY, KM_PRESS, KM_CTRL, 0);
-// WM_keymap_add_item(keymap, "PHYSICS_OT_bake_particle_system", PADMINUS, KM_PRESS, KM_CTRL, 0);
-// WM_keymap_add_item(keymap, "PHYSICS_OT_free_particle_system", LKEY, KM_PRESS, 0, 0);
-//}
-