rna context rename

* context.main & bpy.types.Main --> context.blend_data & bpy.types.BlendData
* context.manager --> context.window_manager
This commit is contained in:
Campbell Barton 2010-09-02 04:53:05 +00:00
parent 6e1e638313
commit ddbfb05c84
24 changed files with 48 additions and 49 deletions

@ -28,9 +28,9 @@ class ExportHelper:
def invoke(self, context, event):
import os
if not self.properties.is_property_set("filepath"):
self.properties.filepath = os.path.splitext(context.main.filepath)[0] + self.filename_ext
self.properties.filepath = os.path.splitext(context.blend_data.filepath)[0] + self.filename_ext
context.manager.add_fileselect(self)
context.window_manager.add_fileselect(self)
return {'RUNNING_MODAL'}
@ -38,8 +38,7 @@ class ImportHelper:
filepath = StringProperty(name="File Path", description="Filepath used for importing the file", maxlen= 1024, default= "", subtype='FILE_PATH')
def invoke(self, context, event):
wm = context.manager
wm.add_fileselect(self)
context.window_manager.add_fileselect(self)
return {'RUNNING_MODAL'}

@ -44,7 +44,7 @@ def get_console(console_id):
from code import InteractiveConsole
consoles = getattr(get_console, "consoles", None)
hash_next = hash(bpy.context.manager)
hash_next = hash(bpy.context.window_manager)
if consoles is None:
consoles = get_console.consoles = {}

@ -169,7 +169,7 @@ class BakeAction(bpy.types.Operator):
return {'FINISHED'}
def invoke(self, context, event):
wm = context.manager
wm = context.window_manager
return wm.invoke_props_dialog(self)

@ -59,7 +59,7 @@ class SelectPattern(bpy.types.Operator):
return {'FINISHED'}
def invoke(self, context, event):
wm = context.manager
wm = context.window_manager
# return wm.invoke_props_popup(self, event)
wm.invoke_props_popup(self, event)
return {'RUNNING_MODAL'}

@ -64,7 +64,7 @@ class AddPresetBase():
return {'FINISHED'}
def invoke(self, context, event):
wm = context.manager
wm = context.window_manager
#crashes, TODO - fix
#return wm.invoke_props_popup(self, event)

@ -207,7 +207,7 @@ class ExportUVLayout(bpy.types.Operator):
return {'FINISHED'}
def invoke(self, context, event):
wm = context.manager
wm = context.window_manager
wm.add_fileselect(self)
return {'RUNNING_MODAL'}

@ -449,7 +449,7 @@ class WM_OT_context_modal_mouse(bpy.types.Operator):
else:
self.properties.initial_x = event.mouse_x
context.manager.add_modal_handler(self)
context.window_manager.add_modal_handler(self)
return {'RUNNING_MODAL'}
@ -608,7 +608,7 @@ class WM_OT_doc_edit(bpy.types.Operator):
layout.prop(props, "doc_new", text="")
def invoke(self, context, event):
wm = context.manager
wm = context.window_manager
return wm.invoke_props_dialog(self, width=600)
@ -692,7 +692,7 @@ class WM_OT_properties_edit(bpy.types.Operator):
self.properties.max = prop_ui.get("max", 1000000000)
self.properties.description = prop_ui.get("description", "")
wm = context.manager
wm = context.window_manager
# This crashes, TODO - fix
#return wm.invoke_props_popup(self, event)

@ -1,7 +1,7 @@
# Configuration Blender
import bpy
wm = bpy.context.manager
wm = bpy.context.window_manager
wm.keyconfigs.active = wm.keyconfigs['Blender']
bpy.context.user_preferences.view.use_mouse_auto_depth = False

@ -1,7 +1,7 @@
# Configuration Maya
import bpy
wm = bpy.context.manager
wm = bpy.context.window_manager
kc = wm.keyconfigs.new('Maya')
# Map 3D View

@ -38,7 +38,7 @@ class ExportSomeData(bpy.types.Operator):
return {'FINISHED'}
def invoke(self, context, event):
wm = context.manager
wm = context.window_manager
if True:
# File selector

@ -25,7 +25,7 @@ class ModalOperator(bpy.types.Operator):
def invoke(self, context, event):
if context.object:
context.manager.add_modal_handler(self)
context.window_manager.add_modal_handler(self)
self.properties.first_mouse_x = event.mouse_x
self.properties.first_value = context.object.location.x
return {'RUNNING_MODAL'}

@ -52,7 +52,7 @@ class ModalDrawOperator(bpy.types.Operator):
def invoke(self, context, event):
if context.area.type == 'VIEW_3D':
context.manager.add_modal_handler(self)
context.window_manager.add_modal_handler(self)
# Add the region OpenGL drawing callback
# draw in view space with 'POST_VIEW' and 'PRE_VIEW'

@ -39,7 +39,7 @@ class ViewOperator(bpy.types.Operator):
v3d = context.space_data
rv3d = v3d.region_3d
context.manager.add_modal_handler(self)
context.window_manager.add_modal_handler(self)
if rv3d.view_perspective == 'CAMERA':
rv3d.view_perspective = 'PERSP'

@ -250,7 +250,7 @@ class AsScript(bpy.types.Operator):
import os
obj = context.object
self.properties.filepath = os.path.splitext(bpy.data.filepath)[0] + "-" + bpy.path.clean_name(obj.name) + ".py"
wm = context.manager
wm = context.window_manager
wm.add_fileselect(self)
return {'RUNNING_MODAL'}

@ -314,7 +314,7 @@ class ANIM_OT_keying_set_export(bpy.types.Operator):
return {'FINISHED'}
def invoke(self, context, event):
wm = context.manager
wm = context.window_manager
wm.add_fileselect(self)
return {'RUNNING_MODAL'}

@ -26,7 +26,7 @@ class INFO_HT_header(bpy.types.Header):
def draw(self, context):
layout = self.layout
wm = context.manager
wm = context.window_manager
window = context.window
scene = context.scene
rd = scene.render

@ -789,7 +789,7 @@ class USERPREF_PT_input(InputKeyMapPanel):
#start = time.time()
userpref = context.user_preferences
wm = context.manager
wm = context.window_manager
inputs = userpref.inputs
@ -1183,7 +1183,7 @@ class WM_OT_addon_install(bpy.types.Operator):
self.report({'ERROR'}, "No 'addons' path could be found in " + str(bpy.utils.script_paths()))
return {'CANCELLED'}
wm = context.manager
wm = context.window_manager
wm.add_fileselect(self)
return {'RUNNING_MODAL'}

@ -352,7 +352,7 @@ class InputKeyMapPanel(bpy.types.Panel):
self.draw_entry(display_keymaps, entry, layout)
def draw_keymaps(self, context, layout):
wm = context.manager
wm = context.window_manager
kc = wm.keyconfigs.active
defkc = wm.keyconfigs.default
@ -486,7 +486,7 @@ class WM_OT_keyconfig_test(bpy.types.Operator):
return result
def execute(self, context):
wm = context.manager
wm = context.window_manager
kc = wm.keyconfigs.default
if self.testConfig(kc):
@ -552,23 +552,23 @@ class WM_OT_keyconfig_import(bpy.types.Operator):
shutil.move(self.properties.filepath, path)
# sneaky way to check we're actually running the code.
wm = context.manager
wm = context.window_manager
while config_name in wm.keyconfigs:
wm.keyconfigs.remove(wm.keyconfigs[config_name])
wm = context.manager
wm = context.window_manager
totmap = len(wm.keyconfigs)
mod = __import__(config_name)
if totmap == len(wm.keyconfigs):
reload(mod)
wm = bpy.context.manager
wm = bpy.context.window_manager
wm.keyconfigs.active = wm.keyconfigs[config_name]
return {'FINISHED'}
def invoke(self, context, event):
wm = context.manager
wm = context.window_manager
wm.add_fileselect(self)
return {'RUNNING_MODAL'}
@ -594,7 +594,7 @@ class WM_OT_keyconfig_export(bpy.types.Operator):
if not f:
raise Exception("Could not open file")
wm = context.manager
wm = context.window_manager
kc = wm.keyconfigs.active
if self.properties.kc_name != '':
@ -607,7 +607,7 @@ class WM_OT_keyconfig_export(bpy.types.Operator):
f.write("# Configuration %s\n" % name)
f.write("import bpy\n\n")
f.write("wm = bpy.context.manager\n")
f.write("wm = bpy.context.window_manager\n")
f.write("kc = wm.keyconfigs.new('%s')\n\n" % name)
# Generate a list of keymaps to export:
@ -667,7 +667,7 @@ class WM_OT_keyconfig_export(bpy.types.Operator):
return {'FINISHED'}
def invoke(self, context, event):
wm = context.manager
wm = context.window_manager
wm.add_fileselect(self)
return {'RUNNING_MODAL'}
@ -678,7 +678,7 @@ class WM_OT_keymap_edit(bpy.types.Operator):
bl_label = "Edit Key Map"
def execute(self, context):
wm = context.manager
wm = context.window_manager
km = context.keymap
km.copy_to_user()
return {'FINISHED'}
@ -692,7 +692,7 @@ class WM_OT_keymap_restore(bpy.types.Operator):
all = BoolProperty(attr="all", name="All Keymaps", description="Restore all keymaps to default")
def execute(self, context):
wm = context.manager
wm = context.window_manager
if self.properties.all:
for km in wm.keyconfigs.default.keymaps:
@ -712,7 +712,7 @@ class WM_OT_keyitem_restore(bpy.types.Operator):
item_id = IntProperty(attr="item_id", name="Item Identifier", description="Identifier of the item to remove")
def execute(self, context):
wm = context.manager
wm = context.window_manager
km = context.keymap
kmi = km.items.from_id(self.properties.item_id)
@ -727,7 +727,7 @@ class WM_OT_keyitem_add(bpy.types.Operator):
bl_label = "Add Key Map Item"
def execute(self, context):
wm = context.manager
wm = context.window_manager
km = context.keymap
kc = wm.keyconfigs.default
@ -753,7 +753,7 @@ class WM_OT_keyitem_remove(bpy.types.Operator):
item_id = IntProperty(attr="item_id", name="Item Identifier", description="Identifier of the item to remove")
def execute(self, context):
wm = context.manager
wm = context.window_manager
km = context.keymap
kmi = km.items.from_id(self.properties.item_id)
km.items.remove(kmi)
@ -767,12 +767,12 @@ class WM_OT_keyconfig_remove(bpy.types.Operator):
@classmethod
def poll(cls, context):
wm = context.manager
wm = context.window_manager
return wm.keyconfigs.active.is_user_defined
def execute(self, context):
import sys
wm = context.manager
wm = context.window_manager
keyconfig = wm.keyconfigs.active

@ -701,7 +701,7 @@ Main *CTX_data_main(const bContext *C)
{
Main *bmain;
if(ctx_data_pointer_verify(C, "main", (void*)&bmain))
if(ctx_data_pointer_verify(C, "blend_data", (void*)&bmain))
return bmain;
else
return C->data.main;

@ -276,7 +276,7 @@ extern StructRNA RNA_LimitScaleConstraint;
extern StructRNA RNA_LockedTrackConstraint;
extern StructRNA RNA_Macro;
extern StructRNA RNA_MagicTexture;
extern StructRNA RNA_Main;
extern StructRNA RNA_BlendData;
extern StructRNA RNA_MarbleTexture;
extern StructRNA RNA_MaskModifier;
extern StructRNA RNA_Material;

@ -95,7 +95,7 @@ PointerRNA PointerRNA_NULL = {{0}, 0, 0};
void RNA_main_pointer_create(struct Main *main, PointerRNA *r_ptr)
{
r_ptr->id.data= NULL;
r_ptr->type= &RNA_Main;
r_ptr->type= &RNA_BlendData;
r_ptr->data= main;
}

@ -93,7 +93,7 @@ static PointerRNA rna_Context_region_data_get(PointerRNA *ptr)
static PointerRNA rna_Context_main_get(PointerRNA *ptr)
{
bContext *C= (bContext*)ptr->data;
return rna_pointer_inherit_refine(ptr, &RNA_Main, CTX_data_main(C));
return rna_pointer_inherit_refine(ptr, &RNA_BlendData, CTX_data_main(C));
}
static PointerRNA rna_Context_scene_get(PointerRNA *ptr)
@ -151,7 +151,7 @@ void RNA_def_context(BlenderRNA *brna)
RNA_def_struct_sdna(srna, "bContext");
/* WM */
prop= RNA_def_property(srna, "manager", PROP_POINTER, PROP_NONE);
prop= RNA_def_property(srna, "window_manager", PROP_POINTER, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_struct_type(prop, "WindowManager");
RNA_def_property_pointer_funcs(prop, "rna_Context_manager_get", NULL, NULL, NULL);
@ -187,9 +187,9 @@ void RNA_def_context(BlenderRNA *brna)
RNA_def_property_pointer_funcs(prop, "rna_Context_region_data_get", NULL, NULL, NULL);
/* Data */
prop= RNA_def_property(srna, "main", PROP_POINTER, PROP_NONE);
prop= RNA_def_property(srna, "blend_data", PROP_POINTER, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_struct_type(prop, "Main");
RNA_def_property_struct_type(prop, "BlendData");
RNA_def_property_pointer_funcs(prop, "rna_Context_main_get", NULL, NULL, NULL);
prop= RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);

@ -302,8 +302,8 @@ void RNA_def_main(BlenderRNA *brna)
int i;
srna= RNA_def_struct(brna, "Main", NULL);
RNA_def_struct_ui_text(srna, "Main", "Main data structure representing a .blend file and all its datablocks");
srna= RNA_def_struct(brna, "BlendData", NULL);
RNA_def_struct_ui_text(srna, "Blendfile Data", "Main data structure representing a .blend file and all its datablocks");
RNA_def_struct_ui_icon(srna, ICON_BLENDER);
prop= RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);

@ -436,7 +436,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
vc= vert_connect;
for (i=0; i < totvert; i++, vc++) {
int v_best=-1, ed_loop_closed=0; /* vert and vert new */
int ed_loop_flip;
int ed_loop_flip= 0; /* compiler complains if not initialized, but it should be initialized below */
float fl= -1.0f;
ScrewVertIter lt_iter;