- Right click menu can open links directly to API reference docs (rna and operators)
authorCampbell Barton <ideasman42@gmail.com>
Tue, 27 Oct 2009 02:54:25 +0000 (02:54 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 27 Oct 2009 02:54:25 +0000 (02:54 +0000)
- Generated and uploaded api docs - http://www.blender.org/documentation/250PythonDoc
- Added Edit docs menu item & operators as discussed with Mindrones, Brecht, Stani & Letterip @ bconf, needs some web backend. python operator can aparently use xml/rpc to upload docstrings.
- Added operator invoke function - context.manager.invoke_props_popup(self.__operator__, event)
  this calls a popup for invoke by default (which intern calls execute())

- Own recent commit to game framing applied to non-camera views too.
- v3d->persp is deprecated but still used in some places.

- Transforming strips could overlap 1 frame if moving them below frame 0
- Transforming overlapping strips could go into an eternal loop (though overlapping strips should not exist)

25 files changed:
release/scripts/io/export_3ds.py
release/scripts/io/import_3ds.py
release/scripts/modules/bpy_ops.py
release/scripts/ui/space_info.py
source/blender/blenkernel/intern/sequence.c
source/blender/editors/interface/interface_anim.c
source/blender/editors/interface/interface_handlers.c
source/blender/editors/interface/interface_intern.h
source/blender/editors/interface/interface_utils.c
source/blender/editors/screen/screen_edit.c
source/blender/editors/screen/screen_ops.c
source/blender/editors/space_buttons/buttons_context.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/editors/space_view3d/view3d_edit.c
source/blender/editors/space_view3d/view3d_header.c
source/blender/editors/space_view3d/view3d_ops.c
source/blender/editors/space_view3d/view3d_view.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_generics.c
source/blender/makesdna/DNA_view3d_types.h
source/blender/makesrna/RNA_access.h
source/blender/makesrna/intern/rna_access.c
source/blender/makesrna/intern/rna_wm_api.c
source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp

index 5ca7d56..9991352 100644 (file)
@@ -1091,9 +1091,9 @@ def save_3ds(filename, context):
 #         Blender.Draw.PupMenu("Error%t|This script requires a full python installation")
 # # save_3ds('/test_b.3ds')
 
-class EXPORT_OT_3ds(bpy.types.Operator):
+class EXPORT_OT_autodesk_3ds(bpy.types.Operator):
        '''Export to 3DS file format (.3ds).'''
-       __idname__ = "export.3ds"
+       __idname__ = "export.autodesk_3ds"
        __label__ = 'Export 3DS'
        
        # List of operator properties, the attributes will be assigned
@@ -1117,9 +1117,9 @@ class EXPORT_OT_3ds(bpy.types.Operator):
                print("Poll")
                return context.active_object != None
 
-bpy.ops.add(EXPORT_OT_3ds)
+bpy.ops.add(EXPORT_OT_autodesk_3ds)
 
 # Add to a menu
 import dynamic_menu
-menu_func = lambda self, context: self.layout.itemO("export.3ds", text="Autodesk 3DS...")
+menu_func = lambda self, context: self.layout.itemO("export.autodesk_3ds", text="Autodesk 3DS...")
 menu_item = dynamic_menu.add(bpy.types.INFO_MT_file_export, menu_func)
index cbd9d89..da0634a 100644 (file)
@@ -1122,9 +1122,9 @@ else:
 
 '''
 
-class IMPORT_OT_3ds(bpy.types.Operator):
+class IMPORT_OT_autodesk_3ds(bpy.types.Operator):
        '''Import from 3DS file format (.3ds)'''
-       __idname__ = "import.3ds"
+       __idname__ = "import.autodesk_3ds"
        __label__ = 'Import 3DS'
        
        # List of operator properties, the attributes will be assigned
@@ -1147,10 +1147,10 @@ class IMPORT_OT_3ds(bpy.types.Operator):
                wm.add_fileselect(self.__operator__)
                return ('RUNNING_MODAL',)
 
-bpy.ops.add(IMPORT_OT_3ds)
+bpy.ops.add(IMPORT_OT_autodesk_3ds)
 
 import dynamic_menu
-menu_func = lambda self, context: self.layout.itemO("import.3ds", text="3D Studio (.3ds)...")
+menu_func = lambda self, context: self.layout.itemO("import.autodesk_3ds", text="3D Studio (.3ds)...")
 menu_item = dynamic_menu.add(bpy.types.INFO_MT_file_import, menu_func)
 
 # NOTES:
index 639b983..240b0e2 100644 (file)
@@ -311,6 +311,67 @@ class WM_OT_context_cycle_enum(bpy.types.Operator):
                exec("context.%s=advance_enum" % self.path)
                return ('FINISHED',)
 
+doc_id = bpy.props.StringProperty(attr="doc_id", name="Doc ID", description="ID for the documentation", maxlen= 1024, default= "")
+doc_new = bpy.props.StringProperty(attr="doc_new", name="Doc New", description="", maxlen= 1024, default= "")
+
+class WM_OT_doc_view(bpy.types.Operator):
+       '''Load online reference docs'''
+       __idname__ = "wm.doc_view"
+       __label__ = "View Documentation"
+       __props__ = [doc_id]
+       _prefix = 'http://www.blender.org/documentation/250PythonDoc'
+       def execute(self, context):
+               id_split = self.doc_id.split('.')
+               # Example url, http://www.graphicall.org/ftp/ideasman42/html/bpy.types.Space3DView-class.html#background_image
+               # Example operator http://www.graphicall.org/ftp/ideasman42/html/bpy.ops.boid-module.html#boidrule_add
+               if len(id_split) == 1: # rna, class
+                       url= '%s/bpy.types.%s-class.html' % (self._prefix, id_split[0])
+               elif len(id_split) == 2: # rna, class.prop
+                       class_name, class_prop = id_split
+                       
+                       if hasattr(bpy.types, class_name.upper() + '_OT_' + class_prop):
+                               url= '%s/bpy.ops.%s-module.html#%s' % (self._prefix, class_name, class_prop)
+                       else:
+                               url= '%s/bpy.types.%s-class.html#%s' % (self._prefix, class_name, class_prop)
+                       
+               else:
+                       return ('PASS_THROUGH',)
+               
+               import webbrowser
+               webbrowser.open(url)
+               
+               return ('FINISHED',)
+
+
+class WM_OT_doc_edit(bpy.types.Operator):
+       '''Load online reference docs'''
+       __idname__ = "wm.doc_edit"
+       __label__ = "Edit Documentation"
+       __props__ = [doc_id, doc_new]
+       
+       def execute(self, context):
+               
+               class_name, class_prop = self.doc_id.split('.')
+               
+               if self.doc_new:
+                       
+                       if hasattr(bpy.types, class_name.upper() + '_OT_' + class_prop):
+                               # operator
+                               print("operator - old:'%s' -> new:'%s'" % ('<TODO>', self.doc_new))
+                       else:
+                               doc_orig = getattr(bpy.types, class_name).__rna__.properties[class_prop].description
+                               if doc_orig != self.doc_new:
+                                       print("rna - old:'%s' -> new:'%s'" % (doc_orig, self.doc_new))
+                                       # aparently we can use xml/rpc to upload docs to an online review board
+                                       # Ugh, will run this on every edit.... better not make any mistakes
+                               
+               return ('FINISHED',)
+       
+       def invoke(self, context, event):
+               wm = context.manager
+               wm.invoke_props_popup(self.__operator__, event)
+               return ('RUNNING_MODAL',)
+
 
 bpy.ops.add(MESH_OT_delete_edgeloop)
 
@@ -324,3 +385,5 @@ bpy.ops.add(WM_OT_context_toggle_enum)
 bpy.ops.add(WM_OT_context_cycle_enum)
 bpy.ops.add(WM_OT_context_cycle_int)
 
+bpy.ops.add(WM_OT_doc_view)
+bpy.ops.add(WM_OT_doc_edit)
index d1e4ac1..fd1c23c 100644 (file)
@@ -241,14 +241,8 @@ bpy.types.register(INFO_MT_help)
 
 class HelpOperator(bpy.types.Operator):
        def execute(self, context):
-               try: import webbrowser
-               except: webbrowser = None
-
-               if webbrowser:
-                       webbrowser.open(self.__URL__)
-               else:
-                       raise Exception("Operator requires a full Python installation")
-
+               import webbrowser
+               webbrowser.open(self.__URL__)
                return ('FINISHED',)
 
 class HELP_OT_manual(HelpOperator):
index 48eb586..42251cc 100644 (file)
@@ -3425,7 +3425,7 @@ static int shuffle_seq_time_offset_test(ListBase * seqbasep, char dir)
        for(seq= seqbasep->first; seq; seq= seq->next) {
                if(seq->tmp) {
                        for(seq_other= seqbasep->first; seq_other; seq_other= seq_other->next) {
-                               if(seq_overlap(seq, seq_other)) {
+                               if(!seq_other->tmp && seq_overlap(seq, seq_other)) {
                                        if(dir=='L') {
                                                offset= MIN2(offset, seq_other->startdisp - seq->enddisp);
                                        }
index ca7401c..4ddfde5 100644 (file)
@@ -240,11 +240,9 @@ void ui_but_anim_menu(bContext *C, uiBut *but)
        int length;
 
        if(but->rnapoin.data && but->rnaprop) {
-               pup= uiPupMenuBegin(C, RNA_property_ui_name(but->rnaprop), 0);
-               layout= uiPupMenuLayout(pup);
-               
+
                length= RNA_property_array_length(&but->rnapoin, but->rnaprop);
-               
+
                if(but->flag & UI_BUT_ANIMATED_KEY) {
                        if(length) {
                                uiItemBooleanO(layout, "Replace Keyframes", 0, "ANIM_OT_insert_keyframe_button", "all", 1);
@@ -263,20 +261,20 @@ void ui_but_anim_menu(bContext *C, uiBut *but)
                                uiItemBooleanO(layout, "Insert Keyframes", 0, "ANIM_OT_insert_keyframe_button", "all", 1);
                                uiItemBooleanO(layout, "Insert Single Keyframe", 0, "ANIM_OT_insert_keyframe_button", "all", 0);
                        }
-                       else 
+                       else
                                uiItemBooleanO(layout, "Insert Keyframe", 0, "ANIM_OT_insert_keyframe_button", "all", 0);
                }
-               
+
                if(but->flag & UI_BUT_DRIVEN) {
                        uiItemS(layout);
-                       
+
                        if(length) {
                                uiItemBooleanO(layout, "Delete Drivers", 0, "ANIM_OT_remove_driver_button", "all", 1);
                                uiItemBooleanO(layout, "Delete Single Driver", 0, "ANIM_OT_remove_driver_button", "all", 0);
                        }
                        else
                                uiItemBooleanO(layout, "Delete Driver", 0, "ANIM_OT_remove_driver_button", "all", 0);
-                               
+
                        uiItemO(layout, "Copy Driver", 0, "ANIM_OT_copy_driver_button");
                        if (ANIM_driver_can_paste())
                                uiItemO(layout, "Paste Driver", 0, "ANIM_OT_paste_driver_button");
@@ -284,21 +282,21 @@ void ui_but_anim_menu(bContext *C, uiBut *but)
                else if(but->flag & UI_BUT_ANIMATED_KEY);
                else if(RNA_property_animateable(&but->rnapoin, but->rnaprop)) {
                        uiItemS(layout);
-                       
+
                        if(length) {
                                uiItemBooleanO(layout, "Add Drivers", 0, "ANIM_OT_add_driver_button", "all", 1);
                                uiItemBooleanO(layout, "Add Single Driver", 0, "ANIM_OT_add_driver_button", "all", 0);
                        }
                        else
                                uiItemBooleanO(layout, "Add Driver", 0, "ANIM_OT_add_driver_button", "all", 0);
-                       
-                       if (ANIM_driver_can_paste())                    
+
+                       if (ANIM_driver_can_paste())
                                uiItemO(layout, "Paste Driver", 0, "ANIM_OT_paste_driver_button");
                }
-               
+
                if(RNA_property_animateable(&but->rnapoin, but->rnaprop)) {
                        uiItemS(layout);
-                       
+
                        if(length) {
                                uiItemBooleanO(layout, "Add All to Keying Set", 0, "ANIM_OT_add_keyingset_button", "all", 1);
                                uiItemBooleanO(layout, "Add Single to Keying Set", 0, "ANIM_OT_add_keyingset_button", "all", 0);
@@ -309,11 +307,15 @@ void ui_but_anim_menu(bContext *C, uiBut *but)
                                uiItemO(layout, "Remove from Keying Set", 0, "ANIM_OT_remove_keyingset_button");
                        }
                }
-               
+
                uiItemS(layout);
-               
+
                uiItemO(layout, "Copy Data Path", 0, "ANIM_OT_copy_clipboard_button");
-               
+
+               uiItemS(layout);
+
+               //ui_but_doc_menu(layout, &but->rnapoin, but->rnaprop);
+
                uiPupMenuEnd(C, pup);
        }
 }
index c963848..3386a2e 100644 (file)
@@ -51,6 +51,7 @@
 
 #include "ED_screen.h"
 #include "ED_util.h"
+#include "ED_keyframing.h"
 
 #include "UI_interface.h"
 
@@ -3378,6 +3379,145 @@ static uiBlock *menu_change_hotkey(bContext *C, ARegion *ar, void *arg_but)
        return block;
 }
 
+static int ui_but_menu(bContext *C, uiBut *but)
+{
+       uiPopupMenu *pup;
+       uiLayout *layout;
+       int length;
+       char *name;
+
+       if((but->rnapoin.data && but->rnaprop)==0 && but->optype==NULL)
+               return 0;
+
+
+       if(but->rnaprop)
+               name= RNA_property_ui_name(but->rnaprop);
+       else if (but->optype)
+               name= but->optype->name;
+       else
+               name= "<needs_name>"; // XXX - should never happen.
+
+       pup= uiPupMenuBegin(C, name, 0);
+       layout= uiPupMenuLayout(pup);
+
+       if(but->rnapoin.data && but->rnaprop) {
+
+               length= RNA_property_array_length(&but->rnapoin, but->rnaprop);
+
+               if(but->flag & UI_BUT_ANIMATED_KEY) {
+                       if(length) {
+                               uiItemBooleanO(layout, "Replace Keyframes", 0, "ANIM_OT_insert_keyframe_button", "all", 1);
+                               uiItemBooleanO(layout, "Replace Single Keyframe", 0, "ANIM_OT_insert_keyframe_button", "all", 0);
+                               uiItemBooleanO(layout, "Delete Keyframes", 0, "ANIM_OT_delete_keyframe_button", "all", 1);
+                               uiItemBooleanO(layout, "Delete Single Keyframe", 0, "ANIM_OT_delete_keyframe_button", "all", 0);
+                       }
+                       else {
+                               uiItemBooleanO(layout, "Replace Keyframe", 0, "ANIM_OT_insert_keyframe_button", "all", 0);
+                               uiItemBooleanO(layout, "Delete Keyframe", 0, "ANIM_OT_delete_keyframe_button", "all", 0);
+                       }
+               }
+               else if(but->flag & UI_BUT_DRIVEN);
+               else if(RNA_property_animateable(&but->rnapoin, but->rnaprop)) {
+                       if(length) {
+                               uiItemBooleanO(layout, "Insert Keyframes", 0, "ANIM_OT_insert_keyframe_button", "all", 1);
+                               uiItemBooleanO(layout, "Insert Single Keyframe", 0, "ANIM_OT_insert_keyframe_button", "all", 0);
+                       }
+                       else
+                               uiItemBooleanO(layout, "Insert Keyframe", 0, "ANIM_OT_insert_keyframe_button", "all", 0);
+               }
+
+               if(but->flag & UI_BUT_DRIVEN) {
+                       uiItemS(layout);
+
+                       if(length) {
+                               uiItemBooleanO(layout, "Delete Drivers", 0, "ANIM_OT_remove_driver_button", "all", 1);
+                               uiItemBooleanO(layout, "Delete Single Driver", 0, "ANIM_OT_remove_driver_button", "all", 0);
+                       }
+                       else
+                               uiItemBooleanO(layout, "Delete Driver", 0, "ANIM_OT_remove_driver_button", "all", 0);
+
+                       uiItemO(layout, "Copy Driver", 0, "ANIM_OT_copy_driver_button");
+                       if (ANIM_driver_can_paste())
+                               uiItemO(layout, "Paste Driver", 0, "ANIM_OT_paste_driver_button");
+               }
+               else if(but->flag & UI_BUT_ANIMATED_KEY);
+               else if(RNA_property_animateable(&but->rnapoin, but->rnaprop)) {
+                       uiItemS(layout);
+
+                       if(length) {
+                               uiItemBooleanO(layout, "Add Drivers", 0, "ANIM_OT_add_driver_button", "all", 1);
+                               uiItemBooleanO(layout, "Add Single Driver", 0, "ANIM_OT_add_driver_button", "all", 0);
+                       }
+                       else
+                               uiItemBooleanO(layout, "Add Driver", 0, "ANIM_OT_add_driver_button", "all", 0);
+
+                       if (ANIM_driver_can_paste())
+                               uiItemO(layout, "Paste Driver", 0, "ANIM_OT_paste_driver_button");
+               }
+
+               if(RNA_property_animateable(&but->rnapoin, but->rnaprop)) {
+                       uiItemS(layout);
+
+                       if(length) {
+                               uiItemBooleanO(layout, "Add All to Keying Set", 0, "ANIM_OT_add_keyingset_button", "all", 1);
+                               uiItemBooleanO(layout, "Add Single to Keying Set", 0, "ANIM_OT_add_keyingset_button", "all", 0);
+                               uiItemO(layout, "Remove from Keying Set", 0, "ANIM_OT_remove_keyingset_button");
+                       }
+                       else {
+                               uiItemBooleanO(layout, "Add to Keying Set", 0, "ANIM_OT_add_keyingset_button", "all", 0);
+                               uiItemO(layout, "Remove from Keying Set", 0, "ANIM_OT_remove_keyingset_button");
+                       }
+               }
+
+               uiItemS(layout);
+
+               uiItemO(layout, "Copy Data Path", 0, "ANIM_OT_copy_clipboard_button");
+
+               uiItemS(layout);
+
+
+       }
+
+
+       {       /* Docs */
+               char buf[512];
+               PointerRNA ptr_props;
+
+               if(but->rnapoin.data && but->rnaprop) {
+                       sprintf(buf, "%s.%s", RNA_struct_identifier(but->rnapoin.type), RNA_property_identifier(but->rnaprop));
+
+                       WM_operator_properties_create(&ptr_props, "WM_OT_doc_view");
+                       RNA_string_set(&ptr_props, "doc_id", buf);
+                       uiItemFullO(layout, "View Docs", 0, "WM_OT_doc_view", ptr_props.data, WM_OP_EXEC_DEFAULT, 0);
+
+
+                       WM_operator_properties_create(&ptr_props, "WM_OT_doc_edit");
+                       RNA_string_set(&ptr_props, "doc_id", buf);
+                       RNA_string_set(&ptr_props, "doc_new", RNA_property_description(but->rnaprop));
+
+                       uiItemFullO(layout, "Edit Docs (TODO)", 0, "WM_OT_doc_edit", ptr_props.data, WM_OP_INVOKE_DEFAULT, 0);
+               }
+               else if (but->optype) {
+                       WM_operator_py_idname(buf, but->optype->idname);
+
+                       WM_operator_properties_create(&ptr_props, "WM_OT_doc_view");
+                       RNA_string_set(&ptr_props, "doc_id", buf);
+                       uiItemFullO(layout, "View Docs", 0, "WM_OT_doc_view", ptr_props.data, WM_OP_EXEC_DEFAULT, 0);
+
+
+                       WM_operator_properties_create(&ptr_props, "WM_OT_doc_edit");
+                       RNA_string_set(&ptr_props, "doc_id", buf);
+                       RNA_string_set(&ptr_props, "doc_new", but->optype->description);
+
+                       uiItemFullO(layout, "Edit Docs (TODO)", 0, "WM_OT_doc_edit", ptr_props.data, WM_OP_INVOKE_DEFAULT, 0);
+               }
+       }
+
+       uiPupMenuEnd(C, pup);
+
+       return 1;
+}
+
 static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
 {
        uiHandleButtonData *data;
@@ -3431,12 +3571,8 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
                /* handle menu */
                else if(event->type == RIGHTMOUSE && event->val == KM_PRESS) {
                        /* RMB has two options now */
-                       if(but->rnapoin.data && but->rnaprop) {
-                               button_timers_tooltip_remove(C, but);
-                               ui_but_anim_menu(C, but);
-                               return WM_UI_HANDLER_BREAK;
-                       }
-                       else if((but->block->flag & UI_BLOCK_LOOP) && but->optype) {
+
+                       if((but->block->flag & UI_BLOCK_LOOP) && but->optype) {
                                IDProperty *prop= (but->opptr)? but->opptr->data: NULL;
                                char buf[512];
                                
@@ -3446,6 +3582,9 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, wmEvent *event)
 
                                }
                        }
+                       else if (ui_but_menu(C, but)) {
+                               return WM_UI_HANDLER_BREAK;
+                       }
                }
        }
 
index 97bbee0..3c3b289 100644 (file)
@@ -475,7 +475,6 @@ void ui_but_anim_copy_driver(struct bContext *C);
 void ui_but_anim_paste_driver(struct bContext *C);
 void ui_but_anim_add_keyingset(struct bContext *C);
 void ui_but_anim_remove_keyingset(struct bContext *C);
-void ui_but_anim_menu(struct bContext *C, uiBut *but);
 int ui_but_anim_expression_get(uiBut *but, char *str, int maxlen);
 int ui_but_anim_expression_set(uiBut *but, const char *str);
 void ui_but_anim_autokey(uiBut *but, struct Scene *scene, float cfra);
index eca4eef..5ac3b2f 100644 (file)
@@ -37,6 +37,9 @@
 #include "UI_interface.h"
 #include "UI_resources.h"
 
+#include "WM_api.h"
+#include "WM_types.h"
+
 /*************************** RNA Utilities ******************************/
 
 uiBut *uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int index, char *name, int icon, int x1, int y1, int x2, int y2)
@@ -183,4 +186,3 @@ int uiIconFromID(ID *id)
 
        return (ptr.type)? RNA_struct_ui_icon(ptr.type): 0;
 }
-
index 9fb472b..57319df 100644 (file)
@@ -1364,8 +1364,17 @@ void ED_screen_set_scene(bContext *C, Scene *scene)
                                                if (!v3d->camera || !object_in_scene(v3d->camera, scene)) {
                                                        v3d->camera= scene_find_camera(sc->scene);
                                                        // XXX if (sc==curscreen) handle_view3d_lock();
-                                                       if (!v3d->camera && v3d->persp==V3D_CAMOB) 
-                                                               v3d->persp= V3D_PERSP;
+                                                       if (!v3d->camera) {
+                                                               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;
+                                                                       }
+                                                               }
+                                                       }
                                                }
                                        }
                                        sl= sl->next;
@@ -1429,7 +1438,7 @@ ScrArea *ed_screen_fullarea(bContext *C, wmWindow *win, ScrArea *sa)
                                if(old->full) break;
                        if(old==NULL) {
                                printf("something wrong in areafullscreen\n"); 
-                               return;
+                               return NULL;
                        }
                            // old feature described below (ton)
                                // in autoplay screens the headers are disabled by 
@@ -1455,7 +1464,8 @@ ScrArea *ed_screen_fullarea(bContext *C, wmWindow *win, ScrArea *sa)
                oldscreen= win->screen;
 
                /* is there only 1 area? */
-               if(oldscreen->areabase.first==oldscreen->areabase.last) return;
+               if(oldscreen->areabase.first==oldscreen->areabase.last)
+                       return NULL;
                
                oldscreen->full = SCREENFULL;
                
index efcbc95..e65ad22 100644 (file)
@@ -2087,19 +2087,19 @@ static int region_foursplit_exec(bContext *C, wmOperator *op)
                        RegionView3D *rv3d;
                        
                        rv3d= ar->regiondata;
-                       rv3d->viewlock= RV3D_LOCKED; rv3d->view= V3D_VIEW_FRONT; rv3d->persp= V3D_ORTHO;
+                       rv3d->viewlock= RV3D_LOCKED; rv3d->view= RV3D_VIEW_FRONT; rv3d->persp= RV3D_ORTHO;
                        
                        ar= ar->next;
                        rv3d= ar->regiondata;
-                       rv3d->viewlock= RV3D_LOCKED; rv3d->view= V3D_VIEW_TOP; rv3d->persp= V3D_ORTHO;
+                       rv3d->viewlock= RV3D_LOCKED; rv3d->view= RV3D_VIEW_TOP; rv3d->persp= RV3D_ORTHO;
                        
                        ar= ar->next;
                        rv3d= ar->regiondata;
-                       rv3d->viewlock= RV3D_LOCKED; rv3d->view= V3D_VIEW_RIGHT; rv3d->persp= V3D_ORTHO;
+                       rv3d->viewlock= RV3D_LOCKED; rv3d->view= RV3D_VIEW_RIGHT; rv3d->persp= RV3D_ORTHO;
                        
                        ar= ar->next;
                        rv3d= ar->regiondata;
-                       rv3d->view= V3D_VIEW_CAMERA; rv3d->persp= V3D_CAMOB;
+                       rv3d->view= RV3D_VIEW_CAMERA; rv3d->persp= RV3D_CAMOB;
                }
                
                WM_event_add_notifier(C, NC_SCREEN|NA_EDITED, NULL);
index d7375ee..8100bf3 100644 (file)
@@ -60,6 +60,7 @@
 
 #include "ED_armature.h"
 #include "ED_screen.h"
+#include "ED_physics.h"
 
 #include "UI_interface.h"
 #include "UI_resources.h"
index 15e41a6..487c55b 100644 (file)
@@ -395,14 +395,14 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, char **grid_u
        setlinestyle(0);
        
        /* center cross */
-       if( ELEM(rv3d->view, V3D_VIEW_RIGHT, V3D_VIEW_LEFT)) 
+       if( ELEM(rv3d->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT)) 
                UI_make_axis_color(col, col2, 'y');
        else UI_make_axis_color(col, col2, 'x');
        glColor3ubv((GLubyte *)col2);
        
        fdrawline(0.0,  y,  (float)ar->winx,  y); 
        
-       if( ELEM(rv3d->view, V3D_VIEW_TOP, V3D_VIEW_BOTTOM)) 
+       if( ELEM(rv3d->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM)) 
                UI_make_axis_color(col, col2, 'y');
        else UI_make_axis_color(col, col2, 'z');
        glColor3ubv((GLubyte *)col2);
@@ -662,11 +662,11 @@ static void draw_view_icon(RegionView3D *rv3d)
 {
        BIFIconID icon;
        
-       if( ELEM(rv3d->view, V3D_VIEW_TOP, V3D_VIEW_BOTTOM)) 
+       if( ELEM(rv3d->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM)) 
                icon= ICON_AXIS_TOP;
-       else if( ELEM(rv3d->view, V3D_VIEW_FRONT, V3D_VIEW_BACK)) 
+       else if( ELEM(rv3d->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK)) 
                icon= ICON_AXIS_FRONT;
-       else if( ELEM(rv3d->view, V3D_VIEW_RIGHT, V3D_VIEW_LEFT)) 
+       else if( ELEM(rv3d->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT)) 
                icon= ICON_AXIS_SIDE;
        else return ;
        
@@ -683,33 +683,33 @@ static char *view3d_get_name(View3D *v3d, RegionView3D *rv3d)
        char *name = NULL;
        
        switch (rv3d->view) {
-               case V3D_VIEW_FRONT:
-                       if (rv3d->persp == V3D_ORTHO) name = "Front Ortho";
+               case RV3D_VIEW_FRONT:
+                       if (rv3d->persp == RV3D_ORTHO) name = "Front Ortho";
                        else name = "Front Persp";
                        break;
-               case V3D_VIEW_BACK:
-                       if (rv3d->persp == V3D_ORTHO) name = "Back Ortho";
+               case RV3D_VIEW_BACK:
+                       if (rv3d->persp == RV3D_ORTHO) name = "Back Ortho";
                        else name = "Back Persp";
                        break;
-               case V3D_VIEW_TOP:
-                       if (rv3d->persp == V3D_ORTHO) name = "Top Ortho";
+               case RV3D_VIEW_TOP:
+                       if (rv3d->persp == RV3D_ORTHO) name = "Top Ortho";
                        else name = "Top Persp";
                        break;
-               case V3D_VIEW_BOTTOM:
-                       if (rv3d->persp == V3D_ORTHO) name = "Bottom Ortho";
+               case RV3D_VIEW_BOTTOM:
+                       if (rv3d->persp == RV3D_ORTHO) name = "Bottom Ortho";
                        else name = "Bottom Persp";
                        break;
-               case V3D_VIEW_RIGHT:
-                       if (rv3d->persp == V3D_ORTHO) name = "Right Ortho";
+               case RV3D_VIEW_RIGHT:
+                       if (rv3d->persp == RV3D_ORTHO) name = "Right Ortho";
                        else name = "Right Persp";
                        break;
-               case V3D_VIEW_LEFT:
-                       if (rv3d->persp == V3D_ORTHO) name = "Left Ortho";
+               case RV3D_VIEW_LEFT:
+                       if (rv3d->persp == RV3D_ORTHO) name = "Left Ortho";
                        else name = "Left Persp";
                        break;
                        
                default:
-                       if (rv3d->persp==V3D_CAMOB) {
+                       if (rv3d->persp==RV3D_CAMOB) {
                                if ((v3d->camera) && (v3d->camera->type == OB_CAMERA)) {
                                        Camera *cam;
                                        cam = v3d->camera->data;
@@ -718,7 +718,7 @@ static char *view3d_get_name(View3D *v3d, RegionView3D *rv3d)
                                        name = "Object as Camera";
                                }
                        } else { 
-                               name = (rv3d->persp == V3D_ORTHO) ? "User Ortho" : "User Persp";
+                               name = (rv3d->persp == RV3D_ORTHO) ? "User Ortho" : "User Persp";
                        }
                        break;
        }
index 51f257d..46e188b 100644 (file)
@@ -103,7 +103,7 @@ static void view3d_boxview_clip(ScrArea *sa)
                        RegionView3D *rv3d= ar->regiondata;
 
                        if(rv3d->viewlock & RV3D_BOXCLIP) {
-                               if(ELEM(rv3d->view, V3D_VIEW_TOP, V3D_VIEW_BOTTOM)) {
+                               if(ELEM(rv3d->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM)) {
                                        if(ar->winx>ar->winy) x1= rv3d->dist;
                                        else x1= ar->winx*rv3d->dist/ar->winy;
 
@@ -113,7 +113,7 @@ static void view3d_boxview_clip(ScrArea *sa)
                                        ofs[0]= rv3d->ofs[0];
                                        ofs[1]= rv3d->ofs[1];
                                }
-                               else if(ELEM(rv3d->view, V3D_VIEW_FRONT, V3D_VIEW_BACK)) {
+                               else if(ELEM(rv3d->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK)) {
                                        ofs[2]= rv3d->ofs[2];
 
                                        if(ar->winx>ar->winy) z1= ar->winy*rv3d->dist/ar->winx;
@@ -181,22 +181,22 @@ static void view3d_boxview_sync(ScrArea *sa, ARegion *ar)
                        if(rv3dtest->viewlock) {
                                rv3dtest->dist= rv3d->dist;
 
-                               if( ELEM(rv3d->view, V3D_VIEW_TOP, V3D_VIEW_BOTTOM) ) {
-                                       if( ELEM(rv3dtest->view, V3D_VIEW_FRONT, V3D_VIEW_BACK))
+                               if( ELEM(rv3d->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM) ) {
+                                       if( ELEM(rv3dtest->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK))
                                                rv3dtest->ofs[0]= rv3d->ofs[0];
-                                       else if( ELEM(rv3dtest->view, V3D_VIEW_RIGHT, V3D_VIEW_LEFT))
+                                       else if( ELEM(rv3dtest->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT))
                                                rv3dtest->ofs[1]= rv3d->ofs[1];
                                }
-                               else if( ELEM(rv3d->view, V3D_VIEW_FRONT, V3D_VIEW_BACK) ) {
-                                       if( ELEM(rv3dtest->view, V3D_VIEW_TOP, V3D_VIEW_BOTTOM))
+                               else if( ELEM(rv3d->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK) ) {
+                                       if( ELEM(rv3dtest->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM))
                                                rv3dtest->ofs[0]= rv3d->ofs[0];
-                                       else if( ELEM(rv3dtest->view, V3D_VIEW_RIGHT, V3D_VIEW_LEFT))
+                                       else if( ELEM(rv3dtest->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT))
                                                rv3dtest->ofs[2]= rv3d->ofs[2];
                                }
-                               else if( ELEM(rv3d->view, V3D_VIEW_RIGHT, V3D_VIEW_LEFT) ) {
-                                       if( ELEM(rv3dtest->view, V3D_VIEW_TOP, V3D_VIEW_BOTTOM))
+                               else if( ELEM(rv3d->view, RV3D_VIEW_RIGHT, RV3D_VIEW_LEFT) ) {
+                                       if( ELEM(rv3dtest->view, RV3D_VIEW_TOP, RV3D_VIEW_BOTTOM))
                                                rv3dtest->ofs[1]= rv3d->ofs[1];
-                                       if( ELEM(rv3dtest->view, V3D_VIEW_FRONT, V3D_VIEW_BACK))
+                                       if( ELEM(rv3dtest->view, RV3D_VIEW_FRONT, RV3D_VIEW_BACK))
                                                rv3dtest->ofs[2]= rv3d->ofs[2];
                                }
 
@@ -325,12 +325,12 @@ static const float thres = 0.93f; //cos(20 deg);
 
 static float snapquats[39][6] = {
        /*{q0, q1, q3, q4, view, oposite_direction}*/
-{COS45, -SIN45, 0.0, 0.0, V3D_VIEW_FRONT, 0},  //front
-{0.0, 0.0, -SIN45, -SIN45, V3D_VIEW_BACK, 0}, //back
-{1.0, 0.0, 0.0, 0.0, V3D_VIEW_TOP, 0},       //top
-{0.0, -1.0, 0.0, 0.0, V3D_VIEW_BOTTOM, 0},      //bottom
-{0.5, -0.5, -0.5, -0.5, V3D_VIEW_LEFT, 0},    //left
-{0.5, -0.5, 0.5, 0.5, V3D_VIEW_RIGHT, 0},      //right
+{COS45, -SIN45, 0.0, 0.0, RV3D_VIEW_FRONT, 0},  //front
+{0.0, 0.0, -SIN45, -SIN45, RV3D_VIEW_BACK, 0}, //back
+{1.0, 0.0, 0.0, 0.0, RV3D_VIEW_TOP, 0},       //top
+{0.0, -1.0, 0.0, 0.0, RV3D_VIEW_BOTTOM, 0},      //bottom
+{0.5, -0.5, -0.5, -0.5, RV3D_VIEW_LEFT, 0},    //left
+{0.5, -0.5, 0.5, 0.5, RV3D_VIEW_RIGHT, 0},      //right
 
        /* some more 45 deg snaps */
 {0.65328145027160645, -0.65328145027160645, 0.27059805393218994, 0.27059805393218994, 0, 0},
@@ -601,12 +601,12 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event)
        vod= op->customdata;
 
        /* switch from camera view when: */
-       if(vod->rv3d->persp != V3D_PERSP) {
+       if(vod->rv3d->persp != RV3D_PERSP) {
 
                if (U.uiflag & USER_AUTOPERSP)
-                       vod->rv3d->persp= V3D_PERSP;
-               else if(vod->rv3d->persp==V3D_CAMOB)
-                       vod->rv3d->persp= V3D_PERSP;
+                       vod->rv3d->persp= RV3D_PERSP;
+               else if(vod->rv3d->persp==RV3D_CAMOB)
+                       vod->rv3d->persp= RV3D_PERSP;
                ED_region_tag_redraw(vod->ar);
        }
 
@@ -665,7 +665,7 @@ void viewmove_modal_keymap(wmKeyConfig *keyconf)
 
 static void viewmove_apply(ViewOpsData *vod, int x, int y)
 {
-       if(vod->rv3d->persp==V3D_CAMOB) {
+       if(vod->rv3d->persp==RV3D_CAMOB) {
                float max= (float)MAX2(vod->ar->winx, vod->ar->winy);
 
                vod->rv3d->camdx += (vod->oldx - x)/(max);
@@ -861,7 +861,7 @@ static void viewzoom_apply(ViewOpsData *vod, int x, int y)
                view_zoom_mouseloc(vod->ar, zfac, vod->oldx, vod->oldy);
 
 
-       if ((U.uiflag & USER_ORBIT_ZBUF) && (U.viewzoom==USER_ZOOM_CONT) && (vod->rv3d->persp==V3D_PERSP)) {
+       if ((U.uiflag & USER_ORBIT_ZBUF) && (U.viewzoom==USER_ZOOM_CONT) && (vod->rv3d->persp==RV3D_PERSP)) {
                float upvec[3], mat[3][3];
 
                /* Secret apricot feature, translate the view when in continues mode */
@@ -877,7 +877,7 @@ static void viewzoom_apply(ViewOpsData *vod, int x, int y)
                if(vod->rv3d->dist>10.0*vod->far) vod->rv3d->dist=10.0*vod->far;
        }
 
-// XXX if(vod->rv3d->persp==V3D_ORTHO || vod->rv3d->persp==V3D_CAMOB) preview3d_event= 0;
+// XXX if(vod->rv3d->persp==RV3D_ORTHO || vod->rv3d->persp==RV3D_CAMOB) preview3d_event= 0;
 
        if(vod->rv3d->viewlock & RV3D_BOXVIEW)
                view3d_boxview_sync(vod->sa, vod->ar);
@@ -931,7 +931,7 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
 
        if(delta < 0) {
                /* this min and max is also in viewmove() */
-               if(rv3d->persp==V3D_CAMOB) {
+               if(rv3d->persp==RV3D_CAMOB) {
                        rv3d->camzoom-= 10;
                        if(rv3d->camzoom<-30) rv3d->camzoom= -30;
                }
@@ -940,7 +940,7 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
                }
        }
        else {
-               if(rv3d->persp==V3D_CAMOB) {
+               if(rv3d->persp==RV3D_CAMOB) {
                        rv3d->camzoom+= 10;
                        if(rv3d->camzoom>300) rv3d->camzoom= 300;
                }
@@ -1062,8 +1062,8 @@ static int viewhome_exec(bContext *C, wmOperator *op) /* was view3d_home() in 2.
                        new_dist*= size;
                }
 
-               if (rv3d->persp==V3D_CAMOB) {
-                       rv3d->persp= V3D_PERSP;
+               if (rv3d->persp==RV3D_CAMOB) {
+                       rv3d->persp= RV3D_PERSP;
                        smooth_view(C, NULL, v3d->camera, new_ofs, NULL, &new_dist, NULL);
                }
         else {
@@ -1179,7 +1179,7 @@ static int viewcenter_exec(bContext *C, wmOperator *op) /* like a localview with
        afm[2]= (max[2]-min[2]);
        size= MAX3(afm[0], afm[1], afm[2]);
        /* perspective should be a bit farther away to look nice */
-       if(rv3d->persp==V3D_ORTHO)
+       if(rv3d->persp==RV3D_ORTHO)
                size*= 0.7;
 
        if(size <= v3d->near*1.5f) size= v3d->near*1.5f;
@@ -1201,8 +1201,8 @@ static int viewcenter_exec(bContext *C, wmOperator *op) /* like a localview with
        v3d->cursor[1]= -new_ofs[1];
        v3d->cursor[2]= -new_ofs[2];
 
-       if (rv3d->persp==V3D_CAMOB) {
-               rv3d->persp= V3D_PERSP;
+       if (rv3d->persp==RV3D_CAMOB) {
+               rv3d->persp= RV3D_PERSP;
                smooth_view(C, v3d->camera, NULL, new_ofs, NULL, &new_dist, NULL);
        }
        else {
@@ -1284,7 +1284,7 @@ static int view3d_render_border_invoke(bContext *C, wmOperator *op, wmEvent *eve
        RegionView3D *rv3d= CTX_wm_region_view3d(C);
 
        /* if not in camera view do not exec the operator*/
-       if (rv3d->persp == V3D_CAMOB) return WM_border_select_invoke(C, op, event);
+       if (rv3d->persp == RV3D_CAMOB) return WM_border_select_invoke(C, op, event);
        else return OPERATOR_PASS_THROUGH;
 }
 
@@ -1384,7 +1384,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op)
        cent[0] = (((double)rect.xmin)+((double)rect.xmax)) / 2;
        cent[1] = (((double)rect.ymin)+((double)rect.ymax)) / 2;
 
-       if (rv3d->persp==V3D_PERSP) {
+       if (rv3d->persp==RV3D_PERSP) {
                double p_corner[3];
 
                /* no depths to use, we cant do anything! */
@@ -1455,7 +1455,7 @@ static int view3d_zoom_border_invoke(bContext *C, wmOperator *op, wmEvent *event
        RegionView3D *rv3d= CTX_wm_region_view3d(C);
 
        /* if in camera view do not exec the operator so we do not conflict with set render border*/
-       if (rv3d->persp != V3D_CAMOB)
+       if (rv3d->persp != RV3D_CAMOB)
                return WM_border_select_invoke(C, op, event);
        else
                return OPERATOR_PASS_THROUGH;
@@ -1489,13 +1489,13 @@ void VIEW3D_OT_zoom_border(wmOperatorType *ot)
 /* ********************* Changing view operator ****************** */
 
 static EnumPropertyItem prop_view_items[] = {
-       {V3D_VIEW_FRONT, "FRONT", 0, "Front", "View From the Front"},
-       {V3D_VIEW_BACK, "BACK", 0, "Back", "View From the Back"},
-       {V3D_VIEW_LEFT, "LEFT", 0, "Left", "View From the Left"},
-       {V3D_VIEW_RIGHT, "RIGHT", 0, "Right", "View From the Right"},
-       {V3D_VIEW_TOP, "TOP", 0, "Top", "View From the Top"},
-       {V3D_VIEW_BOTTOM, "BOTTOM", 0, "Bottom", "View From the Bottom"},
-       {V3D_VIEW_CAMERA, "CAMERA", 0, "Camera", "View From the active amera"},
+       {RV3D_VIEW_FRONT, "FRONT", 0, "Front", "View From the Front"},
+       {RV3D_VIEW_BACK, "BACK", 0, "Back", "View From the Back"},
+       {RV3D_VIEW_LEFT, "LEFT", 0, "Left", "View From the Left"},
+       {RV3D_VIEW_RIGHT, "RIGHT", 0, "Right", "View From the Right"},
+       {RV3D_VIEW_TOP, "TOP", 0, "Top", "View From the Top"},
+       {RV3D_VIEW_BOTTOM, "BOTTOM", 0, "Bottom", "View From the Bottom"},
+       {RV3D_VIEW_CAMERA, "CAMERA", 0, "Camera", "View From the active amera"},
        {0, NULL, 0, NULL, NULL}};
 
 static void axis_set_view(bContext *C, float q1, float q2, float q3, float q4, short view, int perspo)
@@ -1506,12 +1506,12 @@ static void axis_set_view(bContext *C, float q1, float q2, float q3, float q4, s
 
        if(rv3d->viewlock) {
                /* only pass on if */
-               if(rv3d->view==V3D_VIEW_FRONT && view==V3D_VIEW_BACK);
-               else if(rv3d->view==V3D_VIEW_BACK && view==V3D_VIEW_FRONT);
-               else if(rv3d->view==V3D_VIEW_RIGHT && view==V3D_VIEW_LEFT);
-               else if(rv3d->view==V3D_VIEW_LEFT && view==V3D_VIEW_RIGHT);
-               else if(rv3d->view==V3D_VIEW_BOTTOM && view==V3D_VIEW_TOP);
-               else if(rv3d->view==V3D_VIEW_TOP && view==V3D_VIEW_BOTTOM);
+               if(rv3d->view==RV3D_VIEW_FRONT && view==RV3D_VIEW_BACK);
+               else if(rv3d->view==RV3D_VIEW_BACK && view==RV3D_VIEW_FRONT);
+               else if(rv3d->view==RV3D_VIEW_RIGHT && view==RV3D_VIEW_LEFT);
+               else if(rv3d->view==RV3D_VIEW_LEFT && view==RV3D_VIEW_RIGHT);
+               else if(rv3d->view==RV3D_VIEW_BOTTOM && view==RV3D_VIEW_TOP);
+               else if(rv3d->view==RV3D_VIEW_TOP && view==RV3D_VIEW_BOTTOM);
                else return;
        }
 
@@ -1525,17 +1525,17 @@ static void axis_set_view(bContext *C, float q1, float q2, float q3, float q4, s
                return;
        }
 
-       if (rv3d->persp==V3D_CAMOB && v3d->camera) {
+       if (rv3d->persp==RV3D_CAMOB && v3d->camera) {
 
-               if (U.uiflag & USER_AUTOPERSP) rv3d->persp= V3D_ORTHO;
-               else if(rv3d->persp==V3D_CAMOB) rv3d->persp= perspo;
+               if (U.uiflag & USER_AUTOPERSP) rv3d->persp= RV3D_ORTHO;
+               else if(rv3d->persp==RV3D_CAMOB) rv3d->persp= perspo;
 
                smooth_view(C, v3d->camera, NULL, rv3d->ofs, new_quat, NULL, NULL);
        }
        else {
 
-               if (U.uiflag & USER_AUTOPERSP) rv3d->persp= V3D_ORTHO;
-               else if(rv3d->persp==V3D_CAMOB) rv3d->persp= perspo;
+               if (U.uiflag & USER_AUTOPERSP) rv3d->persp= RV3D_ORTHO;
+               else if(rv3d->persp==RV3D_CAMOB) rv3d->persp= perspo;
 
                smooth_view(C, NULL, NULL, NULL, new_quat, NULL, NULL);
        }
@@ -1547,7 +1547,7 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
        View3D *v3d = CTX_wm_view3d(C);
        RegionView3D *rv3d= CTX_wm_region_view3d(C);
        Scene *scene= CTX_data_scene(C);
-       static int perspo=V3D_PERSP;
+       static int perspo=RV3D_PERSP;
        int viewnum;
 
        viewnum = RNA_enum_get(op->ptr, "type");
@@ -1555,35 +1555,35 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
        /* Use this to test if we started out with a camera */
 
        switch (viewnum) {
-               case V3D_VIEW_BOTTOM :
+               case RV3D_VIEW_BOTTOM :
                        axis_set_view(C, 0.0, -1.0, 0.0, 0.0, viewnum, perspo);
                        break;
 
-               case V3D_VIEW_BACK:
+               case RV3D_VIEW_BACK:
                        axis_set_view(C, 0.0, 0.0, (float)-cos(M_PI/4.0), (float)-cos(M_PI/4.0), viewnum, perspo);
                        break;
 
-               case V3D_VIEW_LEFT:
+               case RV3D_VIEW_LEFT:
                        axis_set_view(C, 0.5, -0.5, 0.5, 0.5, viewnum, perspo);
                        break;
 
-               case V3D_VIEW_TOP:
+               case RV3D_VIEW_TOP:
                        axis_set_view(C, 1.0, 0.0, 0.0, 0.0, viewnum, perspo);
                        break;
 
-               case V3D_VIEW_FRONT:
+               case RV3D_VIEW_FRONT:
                        axis_set_view(C, (float)cos(M_PI/4.0), (float)-sin(M_PI/4.0), 0.0, 0.0, viewnum, perspo);
                        break;
 
-               case V3D_VIEW_RIGHT:
+               case RV3D_VIEW_RIGHT:
                        axis_set_view(C, 0.5, -0.5, -0.5, -0.5, viewnum, perspo);
                        break;
 
-               case V3D_VIEW_CAMERA:
+               case RV3D_VIEW_CAMERA:
                        if(rv3d->viewlock==0) {
                                /* lastview -  */
 
-                               if(rv3d->persp != V3D_CAMOB) {
+                               if(rv3d->persp != RV3D_CAMOB) {
                                        /* store settings of current view before allowing overwriting with camera view */
                                        QUATCOPY(rv3d->lviewquat, rv3d->viewquat);
                                        rv3d->lview= rv3d->view;
@@ -1610,7 +1610,7 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
                                                v3d->camera= scene_find_camera(scene);
                                                /*handle_view3d_lock();*/
                                        }
-                                       rv3d->persp= V3D_CAMOB;
+                                       rv3d->persp= RV3D_CAMOB;
                                        smooth_view(C, NULL, v3d->camera, rv3d->ofs, rv3d->viewquat, &rv3d->dist, &v3d->lens);
 
                                }
@@ -1626,7 +1626,7 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
                        break;
        }
 
-       if(rv3d->persp != V3D_CAMOB) perspo= rv3d->persp;
+       if(rv3d->persp != RV3D_CAMOB) perspo= rv3d->persp;
 
        return OPERATOR_FINISHED;
 }
@@ -1665,7 +1665,7 @@ static int vieworbit_exec(bContext *C, wmOperator *op)
 
        if(rv3d->viewlock==0) {
 
-               if(rv3d->persp != V3D_CAMOB) {
+               if(rv3d->persp != RV3D_CAMOB) {
                        if(orbitdir == V3D_VIEW_STEPLEFT || orbitdir == V3D_VIEW_STEPRIGHT) {
                                /* z-axis */
                                phi= (float)(M_PI/360.0)*U.pad_rot_angle;
@@ -1771,9 +1771,9 @@ static int viewpersportho_exec(bContext *C, wmOperator *op)
        RegionView3D *rv3d= CTX_wm_region_view3d(C);
 
        if(rv3d->viewlock==0) {
-               if(rv3d->persp!=V3D_ORTHO)
-                       rv3d->persp=V3D_ORTHO;
-               else rv3d->persp=V3D_PERSP;
+               if(rv3d->persp!=RV3D_ORTHO)
+                       rv3d->persp=RV3D_ORTHO;
+               else rv3d->persp=RV3D_PERSP;
                ED_region_tag_redraw(ar);
        }
 
@@ -2195,7 +2195,7 @@ void viewmoveNDOFfly(ARegion *ar, View3D *v3d, int mode)
        // until the first draw and doesn't update the menu
        // to reflect persp mode.
 
-       rv3d->persp = V3D_PERSP;
+       rv3d->persp = RV3D_PERSP;
 
 
        // Correct the distance jump if rv3d->dist != 0
@@ -2357,7 +2357,7 @@ void viewmoveNDOF(Scene *scene, ARegion *ar, View3D *v3d, int mode)
        fval[6] = fval[6] / 1000000.0f;
 
     // scale more if not in perspective mode
-       if (rv3d->persp == V3D_ORTHO) {
+       if (rv3d->persp == RV3D_ORTHO) {
                fval[0] = fval[0] * 0.05f;
                fval[1] = fval[1] * 0.05f;
                fval[2] = fval[2] * 0.05f;
@@ -2405,8 +2405,8 @@ void viewmoveNDOF(Scene *scene, ARegion *ar, View3D *v3d, int mode)
      */
     len = zsens * sbadjust * fval[2];
 
-    if (rv3d->persp==V3D_CAMOB) {
-        if(rv3d->persp==V3D_CAMOB) { /* This is stupid, please fix - TODO */
+    if (rv3d->persp==RV3D_CAMOB) {
+        if(rv3d->persp==RV3D_CAMOB) { /* This is stupid, please fix - TODO */
             rv3d->camzoom+= 10.0f * -len;
         }
         if (rv3d->camzoom < minZoom) rv3d->camzoom = minZoom;
index 1e11699..7bf50dc 100644 (file)
@@ -168,21 +168,30 @@ static RegionView3D *wm_region_view3d(const bContext *C)
        return NULL;
 }
 
-static void copy_view3d_lock_space(View3D *vd, Scene *scene)
+static void copy_view3d_lock_space(View3D *v3d, Scene *scene)
 {
        int bit;
 
-       if(vd->scenelock && vd->localvd==NULL) {
-               vd->lay= scene->lay;
-               vd->camera= scene->camera;
+       if(v3d->scenelock && v3d->localvd==NULL) {
+               v3d->lay= scene->lay;
+               v3d->camera= scene->camera;
                
-               if(vd->camera==0 && vd->persp==V3D_CAMOB)
-                       vd->persp= V3D_PERSP;
+               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((vd->lay & vd->layact) == 0) {
+               if((v3d->lay & v3d->layact) == 0) {
                        for(bit= 0; bit<32; bit++) {
-                               if(vd->lay & (1<<bit)) {
-                                       vd->layact= 1<<bit;
+                               if(v3d->lay & (1<<bit)) {
+                                       v3d->layact= 1<<bit;
                                        break;
                                }
                        }
index 4b692e5..13324e6 100644 (file)
@@ -137,19 +137,19 @@ void view3d_keymap(wmKeyConfig *keyconf)
        RNA_boolean_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_all", CKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "center", 1);
 
        /* numpad view hotkeys*/
-       RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD0, KM_PRESS, 0, 0)->ptr, "type", V3D_VIEW_CAMERA);
-       RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, 0, 0)->ptr, "type", V3D_VIEW_FRONT);
+       RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD0, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_CAMERA);
+       RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_FRONT);
        RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", PAD2, KM_PRESS, 0, 0)->ptr, "type", V3D_VIEW_STEPDOWN);
-       RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, 0, 0)->ptr, "type", V3D_VIEW_RIGHT);
+       RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_RIGHT);
        RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", PAD4, KM_PRESS, 0, 0)->ptr, "type", V3D_VIEW_STEPLEFT);
        WM_keymap_add_item(keymap, "VIEW3D_OT_view_persportho", PAD5, KM_PRESS, 0, 0);
        
        RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", PAD6, KM_PRESS, 0, 0)->ptr, "type", V3D_VIEW_STEPRIGHT);
-       RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, 0, 0)->ptr, "type", V3D_VIEW_TOP);
+       RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, 0, 0)->ptr, "type", RV3D_VIEW_TOP);
        RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_orbit", PAD8, KM_PRESS, 0, 0)->ptr, "type", V3D_VIEW_STEPUP);
-       RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_BACK);
-       RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_LEFT);
-       RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_BOTTOM);
+       RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD1, KM_PRESS, KM_CTRL, 0)->ptr, "type", RV3D_VIEW_BACK);
+       RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD3, KM_PRESS, KM_CTRL, 0)->ptr, "type", RV3D_VIEW_LEFT);
+       RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_viewnumpad", PAD7, KM_PRESS, KM_CTRL, 0)->ptr, "type", RV3D_VIEW_BOTTOM);
        RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", PAD2, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_PANDOWN);
        RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", PAD4, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_PANLEFT);
        RNA_enum_set(WM_keymap_add_item(keymap, "VIEW3D_OT_view_pan", PAD6, KM_PRESS, KM_CTRL, 0)->ptr, "type", V3D_VIEW_PANRIGHT);
index b108d38..300825b 100644 (file)
@@ -285,7 +285,7 @@ void smooth_view(bContext *C, Object *oldcamera, Object *camera, float *ofs, flo
                        rv3d->view= 0;
                        
                        /* ensure it shows correct */
-                       if(sms.to_camera) rv3d->persp= V3D_PERSP;
+                       if(sms.to_camera) rv3d->persp= RV3D_PERSP;
                        
                        /* keep track of running timer! */
                        if(rv3d->sms==NULL)
@@ -329,7 +329,7 @@ static int view3d_smoothview_invoke(bContext *C, wmOperator *op, wmEvent *event)
                
                /* if we went to camera, store the original */
                if(sms->to_camera) {
-                       rv3d->persp= V3D_CAMOB;
+                       rv3d->persp= RV3D_CAMOB;
                        VECCOPY(rv3d->ofs, sms->orig_ofs);
                        QUATCOPY(rv3d->viewquat, sms->orig_quat);
                        rv3d->dist = sms->orig_dist;
@@ -411,7 +411,7 @@ static int view3d_setcameratoview_exec(bContext *C, wmOperator *op)
        RegionView3D *rv3d= CTX_wm_region_view3d(C);
 
        setcameratoview3d(v3d, rv3d, v3d->camera);
-       rv3d->persp = V3D_CAMOB;
+       rv3d->persp = RV3D_CAMOB;
        
        WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, CTX_data_scene(C));
        
@@ -452,7 +452,7 @@ static int view3d_setobjectascamera_exec(bContext *C, wmOperator *op)
        Scene *scene= CTX_data_scene(C);
        
        if(BASACT) {
-               rv3d->persp= V3D_CAMOB;
+               rv3d->persp= RV3D_CAMOB;
                v3d->camera= OBACT;
                if(v3d->scenelock)
                        scene->camera= OBACT;
@@ -487,7 +487,7 @@ void viewline(ARegion *ar, View3D *v3d, float mval[2], float ray_start[3], float
        RegionView3D *rv3d= ar->regiondata;
        float vec[4];
        
-       if(rv3d->persp != V3D_ORTHO){
+       if(rv3d->persp != RV3D_ORTHO){
                vec[0]= 2.0f * mval[0] / ar->winx - 1;
                vec[1]= 2.0f * mval[1] / ar->winy - 1;
                vec[2]= -1.0f;
@@ -820,7 +820,7 @@ int get_view3d_ortho(View3D *v3d, RegionView3D *rv3d)
 {
   Camera *cam;
   
-  if(rv3d->persp==V3D_CAMOB) {
+  if(rv3d->persp==RV3D_CAMOB) {
       if(v3d->camera && v3d->camera->type==OB_CAMERA) {
           cam= v3d->camera->data;
 
@@ -833,7 +833,7 @@ int get_view3d_ortho(View3D *v3d, RegionView3D *rv3d)
           return 0;
   }
   
-  if(rv3d->persp==V3D_ORTHO)
+  if(rv3d->persp==RV3D_ORTHO)
       return 1;
 
   return 0;
@@ -852,7 +852,7 @@ int get_view3d_viewplane(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi,
        *clipsta= v3d->near;
        *clipend= v3d->far;
        
-       if(rv3d->persp==V3D_CAMOB) {
+       if(rv3d->persp==RV3D_CAMOB) {
                if(v3d->camera) {
                        if(v3d->camera->type==OB_LAMP ) {
                                Lamp *la;
@@ -875,7 +875,7 @@ int get_view3d_viewplane(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi,
                }
        }
        
-       if(rv3d->persp==V3D_ORTHO) {
+       if(rv3d->persp==RV3D_ORTHO) {
                if(winx>winy) x1= -rv3d->dist;
                else x1= -winx*rv3d->dist/winy;
                x2= -x1;
@@ -890,7 +890,7 @@ int get_view3d_viewplane(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi,
        }
        else {
                /* fac for zoom, also used for camdx */
-               if(rv3d->persp==V3D_CAMOB) {
+               if(rv3d->persp==RV3D_CAMOB) {
                        fac= (1.41421+( (float)rv3d->camzoom )/50.0);
                        fac*= fac;
                }
@@ -1009,7 +1009,7 @@ static void obmat_to_viewmat(View3D *v3d, RegionView3D *rv3d, Object *ob, short
        Mat3CpyMat4(tmat, rv3d->viewmat);
        if (smooth) {
                float new_quat[4];
-               if (rv3d->persp==V3D_CAMOB && v3d->camera) {
+               if (rv3d->persp==RV3D_CAMOB && v3d->camera) {
                        /* were from a camera view */
                        
                        float orig_ofs[3];
@@ -1020,13 +1020,13 @@ static void obmat_to_viewmat(View3D *v3d, RegionView3D *rv3d, Object *ob, short
                        /* Switch from camera view */
                        Mat3ToQuat(tmat, new_quat);
                        
-                       rv3d->persp=V3D_PERSP;
+                       rv3d->persp=RV3D_PERSP;
                        rv3d->dist= 0.0;
                        
                        view_settings_from_ob(v3d->camera, rv3d->ofs, NULL, NULL, &v3d->lens);
                        smooth_view(NULL, NULL, NULL, orig_ofs, new_quat, &orig_dist, &orig_lens); // XXX
                        
-                       rv3d->persp=V3D_CAMOB; /* just to be polite, not needed */
+                       rv3d->persp=RV3D_CAMOB; /* just to be polite, not needed */
                        
                } else {
                        Mat3ToQuat(tmat, new_quat);
@@ -1042,27 +1042,27 @@ static void obmat_to_viewmat(View3D *v3d, RegionView3D *rv3d, Object *ob, short
 static void view3d_viewlock(RegionView3D *rv3d)
 {
        switch(rv3d->view) {
-       case V3D_VIEW_BOTTOM :
+       case RV3D_VIEW_BOTTOM :
                QUATSET(rv3d->viewquat,0.0, -1.0, 0.0, 0.0);
                break;
                
-       case V3D_VIEW_BACK:
+       case RV3D_VIEW_BACK:
                QUATSET(rv3d->viewquat,0.0, 0.0, (float)-cos(M_PI/4.0), (float)-cos(M_PI/4.0));
                break;
                
-       case V3D_VIEW_LEFT:
+       case RV3D_VIEW_LEFT:
                QUATSET(rv3d->viewquat,0.5, -0.5, 0.5, 0.5);
                break;
                
-       case V3D_VIEW_TOP:
+       case RV3D_VIEW_TOP:
                QUATSET(rv3d->viewquat,1.0, 0.0, 0.0, 0.0);
                break;
                
-       case V3D_VIEW_FRONT:
+       case RV3D_VIEW_FRONT:
                QUATSET(rv3d->viewquat,(float)cos(M_PI/4.0), (float)-sin(M_PI/4.0), 0.0, 0.0);
                break;
                
-       case V3D_VIEW_RIGHT:
+       case RV3D_VIEW_RIGHT:
                QUATSET(rv3d->viewquat, 0.5, -0.5, -0.5, -0.5);
                break;
        }
@@ -1071,7 +1071,7 @@ static void view3d_viewlock(RegionView3D *rv3d)
 /* dont set windows active in in here, is used by renderwin too */
 void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d)
 {
-       if(rv3d->persp==V3D_CAMOB) {        /* obs/camera */
+       if(rv3d->persp==RV3D_CAMOB) {       /* obs/camera */
                if(v3d->camera) {
                        where_is_object(scene, v3d->camera);    
                        obmat_to_viewmat(v3d, rv3d, v3d->camera, 0);
@@ -1087,7 +1087,7 @@ void setviewmatrixview3d(Scene *scene, View3D *v3d, RegionView3D *rv3d)
                        view3d_viewlock(rv3d);
                
                QuatToMat4(rv3d->viewquat, rv3d->viewmat);
-               if(rv3d->persp==V3D_PERSP) rv3d->viewmat[3][2]-= rv3d->dist;
+               if(rv3d->persp==RV3D_PERSP) rv3d->viewmat[3][2]-= rv3d->dist;
                if(v3d->ob_centre) {
                        Object *ob= v3d->ob_centre;
                        float vec[3];
@@ -1324,7 +1324,7 @@ static void initlocalview(Scene *scene, ScrArea *sa)
 
                                rv3d->dist= size;
                                /* perspective should be a bit farther away to look nice */
-                               if(rv3d->persp==V3D_ORTHO)
+                               if(rv3d->persp==RV3D_ORTHO)
                                        rv3d->dist*= 0.7;
 
                                // correction for window aspect ratio
@@ -1334,7 +1334,7 @@ static void initlocalview(Scene *scene, ScrArea *sa)
                                        rv3d->dist*= asp;
                                }
                                
-                               if (rv3d->persp==V3D_CAMOB) rv3d->persp= V3D_PERSP;
+                               if (rv3d->persp==RV3D_CAMOB) rv3d->persp= RV3D_PERSP;
                                
                                v3d->cursor[0]= -rv3d->ofs[0];
                                v3d->cursor[1]= -rv3d->ofs[1];
@@ -1566,8 +1566,10 @@ static int game_engine_exec(bContext *C, wmOperator *unused)
        bScreen *sc= CTX_wm_screen(C);
        ScrArea *sa, *prevsa= CTX_wm_area(C);
        ARegion *ar, *prevar= CTX_wm_region(C);
+       RegionView3D *rv3d;
        rcti cam_frame;
 
+
        sa= prevsa;
        if(sa->spacetype != SPACE_VIEW3D) {
                for(sa=sc->areabase.first; sa; sa= sa->next)
@@ -1588,12 +1590,13 @@ static int game_engine_exec(bContext *C, wmOperator *unused)
        // bad context switch ..
        CTX_wm_area_set(C, sa);
        CTX_wm_region_set(C, ar);
+       rv3d= ar->regiondata;
 
        view3d_operator_needs_opengl(C);
        
        game_set_commmandline_options(&startscene->gm);
 
-       if(startscene->gm.framing.type == SCE_GAMEFRAMING_BARS) { /* Letterbox */
+       if(rv3d->persp==RV3D_CAMOB && startscene->gm.framing.type == SCE_GAMEFRAMING_BARS) { /* Letterbox */
                rctf cam_framef;
                calc_viewborder(startscene, ar, CTX_wm_view3d(C), &cam_framef);
                cam_frame.xmin = cam_framef.xmin + ar->winrct.xmin;
@@ -1788,7 +1791,7 @@ int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *event)
        fly->ar = CTX_wm_region(C);
        fly->scene= CTX_data_scene(C);
 
-       if(fly->rv3d->persp==V3D_CAMOB && fly->v3d->camera->id.lib) {
+       if(fly->rv3d->persp==RV3D_CAMOB && fly->v3d->camera->id.lib) {
                BKE_report(op->reports, RPT_ERROR, "Cannot fly a camera from an external library");
                return FALSE;
        }
@@ -1798,7 +1801,7 @@ int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *event)
                return FALSE;
        }
 
-       if(fly->rv3d->persp==V3D_CAMOB && fly->v3d->camera->constraints.first) {
+       if(fly->rv3d->persp==RV3D_CAMOB && fly->v3d->camera->constraints.first) {
                BKE_report(op->reports, RPT_ERROR, "Cannot fly an object with constraints");
                return FALSE;
        }
@@ -1842,7 +1845,7 @@ int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *event)
 
        fly->persp_backup= fly->rv3d->persp;
        fly->dist_backup= fly->rv3d->dist;
-       if (fly->rv3d->persp==V3D_CAMOB) {
+       if (fly->rv3d->persp==RV3D_CAMOB) {
                /* store the origoinal camera loc and rot */
                VECCOPY(fly->ofs_backup, fly->v3d->camera->loc);
                VECCOPY(fly->rot_backup, fly->v3d->camera->rot);
@@ -1860,8 +1863,8 @@ int initFlyInfo (bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *event)
 
        } else {
                /* perspective or ortho */
-               if (fly->rv3d->persp==V3D_ORTHO)
-                       fly->rv3d->persp= V3D_PERSP; /*if ortho projection, make perspective */
+               if (fly->rv3d->persp==RV3D_ORTHO)
+                       fly->rv3d->persp= RV3D_PERSP; /*if ortho projection, make perspective */
                QUATCOPY(fly->rot_backup, fly->rv3d->viewquat);
                VECCOPY(fly->ofs_backup, fly->rv3d->ofs);
                fly->rv3d->dist= 0.0;
@@ -1891,7 +1894,7 @@ static int flyEnd(bContext *C, FlyInfo *fly)
 
        if (fly->state == FLY_CANCEL) {
        /* Revert to original view? */
-               if (fly->persp_backup==V3D_CAMOB) { /* a camera view */
+               if (fly->persp_backup==RV3D_CAMOB) { /* a camera view */
                        rv3d->viewbut=1;
                        VECCOPY(v3d->camera->loc, fly->ofs_backup);
                        VECCOPY(v3d->camera->rot, fly->rot_backup);
@@ -1903,7 +1906,7 @@ static int flyEnd(bContext *C, FlyInfo *fly)
                        rv3d->persp= fly->persp_backup;
                }
        }
-       else if (fly->persp_backup==V3D_CAMOB) {        /* camera */
+       else if (fly->persp_backup==RV3D_CAMOB) {       /* camera */
                float mat3[3][3];
                Mat3CpyMat4(mat3, v3d->camera->obmat);
                Mat3ToCompatibleEul(mat3, v3d->camera->rot, fly->rot_backup);
@@ -2289,7 +2292,7 @@ int flyApply(FlyInfo *fly)
                        /* impose a directional lag */
                        VecLerpf(dvec, dvec_tmp, fly->dvec_prev, (1.0f/(1.0f+(time_redraw*5.0f))));
 
-                       if (rv3d->persp==V3D_CAMOB) {
+                       if (rv3d->persp==RV3D_CAMOB) {
                                if (v3d->camera->protectflag & OB_LOCK_LOCX)
                                        dvec[0] = 0.0;
                                if (v3d->camera->protectflag & OB_LOCK_LOCY)
@@ -2313,8 +2316,8 @@ int flyApply(FlyInfo *fly)
 //XXX2.5                       do_screenhandlers(G.curscreen); /* advance the next frame */
 
                        /* we are in camera view so apply the view ofs and quat to the view matrix and set the camera to the view */
-                       if (rv3d->persp==V3D_CAMOB) {
-                               rv3d->persp= V3D_PERSP; /*set this so setviewmatrixview3d uses the ofs and quat instead of the camera */
+                       if (rv3d->persp==RV3D_CAMOB) {
+                               rv3d->persp= RV3D_PERSP; /*set this so setviewmatrixview3d uses the ofs and quat instead of the camera */
                                setviewmatrixview3d(scene, v3d, rv3d);
 
                                setcameratoview3d(v3d, rv3d, v3d->camera);
@@ -2324,7 +2327,7 @@ int flyApply(FlyInfo *fly)
                                        VecNegf(v3d->camera->loc);
                                }
 
-                               rv3d->persp= V3D_CAMOB;
+                               rv3d->persp= RV3D_CAMOB;
 #if 0 //XXX2.5
                                /* record the motion */
                                if (IS_AUTOKEY_MODE(NORMAL) && (!playing_anim || cfra != G.scene->r.cfra)) {
@@ -2457,19 +2460,19 @@ void view3d_align_axis_to_vector(View3D *v3d, RegionView3D *rv3d, int axisidx, f
        
        rv3d->view= 0;
        
-       if (rv3d->persp==V3D_CAMOB && v3d->camera) {
+       if (rv3d->persp==RV3D_CAMOB && v3d->camera) {
                /* switch out of camera view */
                float orig_ofs[3];
                float orig_dist= rv3d->dist;
                float orig_lens= v3d->lens;
                
                VECCOPY(orig_ofs, rv3d->ofs);
-               rv3d->persp= V3D_PERSP;
+               rv3d->persp= RV3D_PERSP;
                rv3d->dist= 0.0;
                view_settings_from_ob(v3d->camera, rv3d->ofs, NULL, NULL, &v3d->lens);
                smooth_view(NULL, NULL, NULL, orig_ofs, new_quat, &orig_dist, &orig_lens); // XXX
        } else {
-               if (rv3d->persp==V3D_CAMOB) rv3d->persp= V3D_PERSP; /* switch out of camera mode */
+               if (rv3d->persp==RV3D_CAMOB) rv3d->persp= RV3D_PERSP; /* switch out of camera mode */
                smooth_view(NULL, NULL, NULL, NULL, new_quat, NULL, NULL); // XXX
        }
 }
index a3e1ac3..5fd728f 100644 (file)
@@ -140,7 +140,7 @@ void setTransformViewMatrices(TransInfo *t)
                Mat4One(t->viewinv);
                Mat4One(t->persmat);
                Mat4One(t->persinv);
-               t->persp = V3D_ORTHO;
+               t->persp = RV3D_ORTHO;
        }
 
        calculateCenter2D(t);
index cefb774..077e39d 100644 (file)
@@ -2355,7 +2355,7 @@ void flushTransSeq(TransInfo *t)
 
                tdsq= (TransDataSeq *)td->extra;
                seq= tdsq->seq;
-               new_frame= (int)(td2d->loc[0] + 0.5f);
+               new_frame= (int)floor(td2d->loc[0] + 0.5f);
 
                switch (tdsq->sel_flag) {
                case SELECT:
@@ -2363,7 +2363,7 @@ void flushTransSeq(TransInfo *t)
                                seq->start= new_frame - tdsq->start_offset;
 
                        if (seq->depth==0) {
-                               seq->machine= (int)(td2d->loc[1] + 0.5f);
+                               seq->machine= (int)floor(td2d->loc[1] + 0.5f);
                                CLAMP(seq->machine, 1, MAXSEQ);
                        }
                        break;
@@ -5207,7 +5207,7 @@ void createTransData(bContext *C, TransInfo *t)
                {
                        View3D *v3d = t->view;
                        RegionView3D *rv3d = CTX_wm_region_view3d(C);
-                       if(rv3d && (t->flag & T_OBJECT) && v3d->camera == OBACT && rv3d->persp==V3D_CAMOB)
+                       if(rv3d && (t->flag & T_OBJECT) && v3d->camera == OBACT && rv3d->persp==RV3D_CAMOB)
                        {
                                t->flag |= T_CAMERA;
                        }
index 4b800ba..32078cb 100644 (file)
@@ -123,7 +123,7 @@ extern ListBase editelems;
 
 void getViewVector(TransInfo *t, float coord[3], float vec[3])
 {
-       if (t->persp != V3D_ORTHO)
+       if (t->persp != RV3D_ORTHO)
        {
                float p1[4], p2[4];
                
@@ -1340,7 +1340,7 @@ void calculateCenter(TransInfo *t)
                        Scene *scene = t->scene;
                        RegionView3D *rv3d = t->ar->regiondata;
                        
-                       if(v3d->camera == OBACT && rv3d->persp==V3D_CAMOB)
+                       if(v3d->camera == OBACT && rv3d->persp==RV3D_CAMOB)
                        {
                                float axis[3];
                                /* persinv is nasty, use viewinv instead, always right */
index f67a242..564d674 100644 (file)
@@ -202,6 +202,11 @@ typedef struct View3D {
 #define V3D_GLOBAL_STATS       8192
 #define V3D_DRAW_CENTERS       32768
 
+/* RegionView3d->persp */
+#define RV3D_ORTHO                             0
+#define RV3D_PERSP                             1
+#define RV3D_CAMOB                             2
+
 /* RegionView3d->rflag */
 #define RV3D_FLYMODE                           2
 #define RV3D_CLIPPING                          4
@@ -211,6 +216,16 @@ typedef struct View3D {
 #define RV3D_BOXVIEW           2
 #define RV3D_BOXCLIP           4
 
+/* RegionView3d->view */
+#define RV3D_VIEW_FRONT                 1
+#define RV3D_VIEW_BACK                  2
+#define RV3D_VIEW_LEFT                  3
+#define RV3D_VIEW_RIGHT                 4
+#define RV3D_VIEW_TOP                   5
+#define RV3D_VIEW_BOTTOM                6
+#define RV3D_VIEW_PERSPORTHO    7
+#define RV3D_VIEW_CAMERA                8
+
 /* View3d->flag2 (short) */
 #define V3D_SOLID_TEX                  8
 #define V3D_DISPGP                             16
@@ -222,28 +237,15 @@ typedef struct View3D {
 #define V3D_LOCAL               2
 #define V3D_ACTIVE              4
 
-/*View3D view types*/
-#define V3D_VIEW_FRONT          1
-#define V3D_VIEW_BACK           2
-#define V3D_VIEW_LEFT           3
-#define V3D_VIEW_RIGHT          4
-#define V3D_VIEW_TOP            5
-#define V3D_VIEW_BOTTOM                 6
-#define V3D_VIEW_PERSPORTHO             7
-#define V3D_VIEW_CAMERA                 8
-#define V3D_VIEW_STEPLEFT               9
-#define V3D_VIEW_STEPRIGHT              10
-#define V3D_VIEW_STEPDOWN               11
-#define V3D_VIEW_STEPUP                 12
-#define V3D_VIEW_PANLEFT                13
-#define V3D_VIEW_PANRIGHT               14
-#define V3D_VIEW_PANDOWN                15
-#define V3D_VIEW_PANUP          16
-
-/* View3d->persp */
-#define V3D_ORTHO                              0
-#define V3D_PERSP                              1
-#define V3D_CAMOB                              2
+/*View3D types (only used in tools, not actually saved)*/
+#define V3D_VIEW_STEPLEFT               1
+#define V3D_VIEW_STEPRIGHT              2
+#define V3D_VIEW_STEPDOWN               3
+#define V3D_VIEW_STEPUP                 4
+#define V3D_VIEW_PANLEFT                5
+#define V3D_VIEW_PANRIGHT               6
+#define V3D_VIEW_PANDOWN                7
+#define V3D_VIEW_PANUP                  8
 
 /* View3d->gridflag */
 #define V3D_SHOW_FLOOR                 1
index 810fb11..7de309c 100644 (file)
@@ -593,6 +593,8 @@ char *RNA_struct_name_get_alloc(PointerRNA *ptr, char *fixedbuf, int fixedlen);
 /* Property Information */
 
 const char *RNA_property_identifier(PropertyRNA *prop);
+const char *RNA_property_description(PropertyRNA *prop);
+
 PropertyType RNA_property_type(PropertyRNA *prop);
 PropertySubType RNA_property_subtype(PropertyRNA *prop);
 PropertyUnit RNA_property_unit(PropertyRNA *prop);
index 525218c..f499065 100644 (file)
@@ -381,6 +381,14 @@ static const char *rna_ensure_property_identifier(PropertyRNA *prop)
                return ((IDProperty*)prop)->name;
 }
 
+static const char *rna_ensure_property_description(PropertyRNA *prop)
+{
+       if(prop->magic == RNA_MAGIC)
+               return prop->description;
+       else
+               return ((IDProperty*)prop)->name; /* XXX - not correct */
+}
+
 static const char *rna_ensure_property_name(PropertyRNA *prop)
 {
        if(prop->magic == RNA_MAGIC)
@@ -561,6 +569,11 @@ const char *RNA_property_identifier(PropertyRNA *prop)
        return rna_ensure_property_identifier(prop);
 }
 
+const char *RNA_property_description(PropertyRNA *prop)
+{
+       return rna_ensure_property_description(prop);
+}
+
 PropertyType RNA_property_type(PropertyRNA *prop)
 {
        return rna_ensure_property(prop)->type;
index 44c6967..5960505 100644 (file)
@@ -73,6 +73,16 @@ void RNA_api_wm(StructRNA *srna)
        RNA_def_property_flag(parm, PROP_REQUIRED);
        parm= RNA_def_pointer(func, "keyconfig", "KeyConfig", "Key Configuration", "Added key configuration.");
        RNA_def_function_return(func, parm);
+       
+       /* invoke functions, for use with python */
+       func= RNA_def_function(srna, "invoke_props_popup", "WM_operator_props_popup");
+       RNA_def_function_flag(func, FUNC_NO_SELF|FUNC_USE_CONTEXT);
+       RNA_def_function_ui_description(func, "Operator popup invoke.");
+       parm= RNA_def_pointer(func, "operator", "Operator", "", "Operator to call.");
+       RNA_def_property_flag(parm, PROP_REQUIRED);
+       parm= RNA_def_pointer(func, "event", "Event", "", "Event.");
+       RNA_def_property_flag(parm, PROP_REQUIRED);
+       RNA_def_function_return(func, RNA_def_int(func, "mode",  0, 0, INT_MAX, "Mode", "", 0, INT_MAX)); // XXX, should be an enum/flag thingo
 }
 
 void RNA_api_keyconfig(StructRNA *srna)
index d4421f9..cb1c054 100644 (file)
@@ -245,7 +245,7 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
                        projmat.setElem(i, projmat_linear[i]);
                }
                
-               if(rv3d->persp==V3D_CAMOB) {
+               if(rv3d->persp==RV3D_CAMOB) {
                        if(scene->gm.framing.type == SCE_GAMEFRAMING_BARS) { /* Letterbox */
                                camzoom = 1.0f;
                        }
@@ -349,10 +349,10 @@ extern "C" void StartKetsjiShell(struct bContext *C, struct ARegion *ar, rcti *c
                
                if (exitrequested != KX_EXIT_REQUEST_QUIT_GAME)
                {
-                       if (rv3d->persp != V3D_CAMOB)
+                       if (rv3d->persp != RV3D_CAMOB)
                        {
                                ketsjiengine->EnableCameraOverride(startscenename);
-                               ketsjiengine->SetCameraOverrideUseOrtho((rv3d->persp == V3D_ORTHO));
+                               ketsjiengine->SetCameraOverrideUseOrtho((rv3d->persp == RV3D_ORTHO));
                                ketsjiengine->SetCameraOverrideProjectionMatrix(projmat);
                                ketsjiengine->SetCameraOverrideViewMatrix(viewmat);
                                ketsjiengine->SetCameraOverrideClipping(v3d->near, v3d->far);