chaning the camera from the scene buttons didnt update the views. moved some scene/view functions from view3d_view.c into BKE_screen since they need to be accessed when changing cameras from outside the view.
This commit is contained in:
parent
5b666c95ce
commit
230eec9917
|
@ -235,6 +235,11 @@ void BKE_screen_area_free(struct ScrArea *sa);
|
|||
|
||||
struct ARegion *BKE_area_find_region_type(struct ScrArea *sa, int type);
|
||||
|
||||
void BKE_screen_view3d_sync(struct View3D *v3d, struct Scene *scene);
|
||||
void BKE_screen_view3d_scene_sync(struct bScreen *sc);
|
||||
void BKE_screen_view3d_main_sync(ListBase *screen_lb, struct Scene *scene);
|
||||
|
||||
|
||||
/* screen */
|
||||
void free_screen(struct bScreen *sc);
|
||||
unsigned int BKE_screen_visible_layers(struct bScreen *screen, struct Scene *scene);
|
||||
|
|
|
@ -330,3 +330,67 @@ ARegion *BKE_area_find_region_type(ScrArea *sa, int type)
|
|||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void BKE_screen_view3d_sync(struct View3D *v3d, struct Scene *scene)
|
||||
{
|
||||
int bit;
|
||||
|
||||
if(v3d->scenelock && v3d->localvd==NULL) {
|
||||
v3d->lay= scene->lay;
|
||||
v3d->camera= scene->camera;
|
||||
|
||||
if(v3d->camera==NULL) {
|
||||
ARegion *ar;
|
||||
|
||||
for(ar=v3d->regionbase.first; ar; ar= ar->next) {
|
||||
if(ar->regiontype == RGN_TYPE_WINDOW) {
|
||||
RegionView3D *rv3d= ar->regiondata;
|
||||
if(rv3d->persp==RV3D_CAMOB)
|
||||
rv3d->persp= RV3D_PERSP;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if((v3d->lay & v3d->layact) == 0) {
|
||||
for(bit= 0; bit<32; bit++) {
|
||||
if(v3d->lay & (1<<bit)) {
|
||||
v3d->layact= 1<<bit;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BKE_screen_view3d_scene_sync(bScreen *sc)
|
||||
{
|
||||
/* are there cameras in the views that are not in the scene? */
|
||||
ScrArea *sa;
|
||||
for(sa= sc->areabase.first; sa; sa= sa->next) {
|
||||
SpaceLink *sl;
|
||||
for(sl= sa->spacedata.first; sl; sl= sl->next) {
|
||||
if(sl->spacetype==SPACE_VIEW3D) {
|
||||
View3D *v3d= (View3D*) sl;
|
||||
BKE_screen_view3d_sync(v3d, sc->scene);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BKE_screen_view3d_main_sync(ListBase *screen_lb, Scene *scene)
|
||||
{
|
||||
bScreen *sc;
|
||||
ScrArea *sa;
|
||||
SpaceLink *sl;
|
||||
|
||||
/* from scene copy to the other views */
|
||||
for(sc=screen_lb->first; sc; sc=sc->id.next) {
|
||||
if(sc->scene!=scene)
|
||||
continue;
|
||||
|
||||
for(sa=sc->areabase.first; sa; sa=sa->next)
|
||||
for(sl=sa->spacedata.first; sl; sl=sl->next)
|
||||
if(sl->spacetype==SPACE_VIEW3D)
|
||||
BKE_screen_view3d_sync((View3D*)sl, scene);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -153,8 +153,6 @@ struct RegionView3D *ED_view3d_context_rv3d(struct bContext *C);
|
|||
|
||||
void ED_view3d_init_mats_rv3d(struct Object *ob, struct RegionView3D *rv3d);
|
||||
|
||||
void ED_view3d_scene_layers_copy(struct View3D *v3d, struct Scene *scene);
|
||||
void ED_view3d_scene_layers_update(struct Main *bmain, struct Scene *scene);
|
||||
int ED_view3d_scene_layer_set(int lay, const int *values);
|
||||
|
||||
int ED_view3d_context_activate(struct bContext *C);
|
||||
|
|
|
@ -1395,7 +1395,7 @@ void ED_screen_set_scene(bContext *C, Scene *scene)
|
|||
if(sl->spacetype==SPACE_VIEW3D) {
|
||||
View3D *v3d= (View3D*) sl;
|
||||
|
||||
ED_view3d_scene_layers_copy(v3d, scene);
|
||||
BKE_screen_view3d_sync(v3d, scene);
|
||||
|
||||
if (!v3d->camera || !object_in_scene(v3d->camera, scene)) {
|
||||
v3d->camera= scene_find_camera(sc->scene);
|
||||
|
@ -1729,20 +1729,7 @@ void ED_update_for_newframe(const bContext *C, int mute)
|
|||
bScreen *sc;
|
||||
/* are there cameras in the views that are not in the scene? */
|
||||
for(sc= CTX_data_main(C)->screen.first; sc; sc= sc->id.next) {
|
||||
ScrArea *sa= sc->areabase.first;
|
||||
while(sa) {
|
||||
SpaceLink *sl= sa->spacedata.first;
|
||||
while(sl) {
|
||||
if(sl->spacetype==SPACE_VIEW3D) {
|
||||
View3D *v3d= (View3D*) sl;
|
||||
if (v3d->scenelock) {
|
||||
v3d->camera= camera;
|
||||
}
|
||||
}
|
||||
sl= sl->next;
|
||||
}
|
||||
sa= sa->next;
|
||||
}
|
||||
BKE_screen_view3d_scene_sync(sc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ static void handle_view3d_lock(bContext *C)
|
|||
|
||||
/* not through notifiery, listener don't have context
|
||||
and non-open screens or spaces need to be updated too */
|
||||
ED_view3d_scene_layers_update(bmain, scene);
|
||||
BKE_screen_view3d_main_sync(&bmain->screen, scene);
|
||||
|
||||
/* notifiers for scene update */
|
||||
WM_event_add_notifier(C, NC_SCENE|ND_LAYER, scene);
|
||||
|
|
|
@ -1385,60 +1385,6 @@ static unsigned int free_localbit(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void copy_view3d_lock_space(View3D *v3d, Scene *scene)
|
||||
{
|
||||
int bit;
|
||||
|
||||
if(v3d->scenelock && v3d->localvd==NULL) {
|
||||
v3d->lay= scene->lay;
|
||||
v3d->camera= scene->camera;
|
||||
|
||||
if(v3d->camera==NULL) {
|
||||
ARegion *ar;
|
||||
|
||||
for(ar=v3d->regionbase.first; ar; ar= ar->next) {
|
||||
if(ar->regiontype == RGN_TYPE_WINDOW) {
|
||||
RegionView3D *rv3d= ar->regiondata;
|
||||
if(rv3d->persp==RV3D_CAMOB)
|
||||
rv3d->persp= RV3D_PERSP;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if((v3d->lay & v3d->layact) == 0) {
|
||||
for(bit= 0; bit<32; bit++) {
|
||||
if(v3d->lay & (1<<bit)) {
|
||||
v3d->layact= 1<<bit;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ED_view3d_scene_layers_copy(struct View3D *v3d, struct Scene *scene)
|
||||
{
|
||||
copy_view3d_lock_space(v3d, scene);
|
||||
}
|
||||
|
||||
void ED_view3d_scene_layers_update(Main *bmain, Scene *scene)
|
||||
{
|
||||
bScreen *sc;
|
||||
ScrArea *sa;
|
||||
SpaceLink *sl;
|
||||
|
||||
/* from scene copy to the other views */
|
||||
for(sc=bmain->screen.first; sc; sc=sc->id.next) {
|
||||
if(sc->scene!=scene)
|
||||
continue;
|
||||
|
||||
for(sa=sc->areabase.first; sa; sa=sa->next)
|
||||
for(sl=sa->spacedata.first; sl; sl=sl->next)
|
||||
if(sl->spacetype==SPACE_VIEW3D)
|
||||
copy_view3d_lock_space((View3D*)sl, scene);
|
||||
}
|
||||
}
|
||||
|
||||
int ED_view3d_scene_layer_set(int lay, const int *values)
|
||||
{
|
||||
int i, tot= 0;
|
||||
|
|
|
@ -156,6 +156,7 @@ EnumPropertyItem image_type_items[] = {
|
|||
#include "BKE_image.h"
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_sound.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "BLI_threads.h"
|
||||
#include "BLI_editVert.h"
|
||||
|
@ -273,11 +274,11 @@ static void rna_Scene_layer_set(PointerRNA *ptr, const int *values)
|
|||
scene->lay= ED_view3d_scene_layer_set(scene->lay, values);
|
||||
}
|
||||
|
||||
static void rna_Scene_layer_update(Main *bmain, Scene *unused, PointerRNA *ptr)
|
||||
static void rna_Scene_view3d_update(Main *bmain, Scene *unused, PointerRNA *ptr)
|
||||
{
|
||||
Scene *scene= (Scene*)ptr->data;
|
||||
|
||||
ED_view3d_scene_layers_update(bmain, scene);
|
||||
BKE_screen_view3d_main_sync(&bmain->screen, scene);
|
||||
}
|
||||
|
||||
static void rna_Scene_current_frame_set(PointerRNA *ptr, int value)
|
||||
|
@ -2860,7 +2861,7 @@ void RNA_def_scene(BlenderRNA *brna)
|
|||
prop= RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_flag(prop, PROP_EDITABLE);
|
||||
RNA_def_property_ui_text(prop, "Camera", "Active camera used for rendering the scene");
|
||||
RNA_def_property_update(prop, NC_SCENE, NULL);
|
||||
RNA_def_property_update(prop, NC_SCENE|NA_EDITED, "rna_Scene_view3d_update");
|
||||
|
||||
prop= RNA_def_property(srna, "set", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, NULL, "set");
|
||||
|
@ -2901,7 +2902,7 @@ void RNA_def_scene(BlenderRNA *brna)
|
|||
RNA_def_property_array(prop, 20);
|
||||
RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_layer_set");
|
||||
RNA_def_property_ui_text(prop, "Visible Layers", "Layers visible when rendering the scene");
|
||||
RNA_def_property_update(prop, NC_SCENE|ND_LAYER, "rna_Scene_layer_update");
|
||||
RNA_def_property_update(prop, NC_SCENE|ND_LAYER, "rna_Scene_view3d_update");
|
||||
|
||||
/* Frame Range Stuff */
|
||||
prop= RNA_def_property(srna, "frame_current", PROP_INT, PROP_TIME);
|
||||
|
|
Loading…
Reference in New Issue