diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-08-02 03:37:52 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2010-08-02 03:37:52 +0400 |
commit | a5692fd67bedf71f849d330c83239a47ad93e3e7 (patch) | |
tree | 8e0ee63a3c9075dee1d50c14795658896c69adf4 | |
parent | 4cfdedbe6167d8c3a596bde24dde23ce578b1764 (diff) | |
parent | c92e3225f3aa5fadb9ad0920dffbdc0c0209a98a (diff) |
Merged changes in the trunk up to revision 30952.
180 files changed, 2337 insertions, 2524 deletions
diff --git a/build_files/scons/config/win32-vc-config.py b/build_files/scons/config/win32-vc-config.py index ce34737fd49..3572dd113bf 100644 --- a/build_files/scons/config/win32-vc-config.py +++ b/build_files/scons/config/win32-vc-config.py @@ -130,7 +130,7 @@ BF_OPENJPEG_LIB = '' BF_OPENJPEG_INC = '${BF_OPENJPEG}' BF_OPENJPEG_LIBPATH='${BF_OPENJPEG}/lib' -WITH_BF_FFTW3 = False +WITH_BF_FFTW3 = True BF_FFTW3 = LIBDIR + '/fftw3' BF_FFTW3_INC = '${BF_FFTW3}/include' BF_FFTW3_LIB = 'libfftw' diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index bec243fc977..b7038a30e00 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -1299,6 +1299,11 @@ GHOST_TUns8 GHOST_SystemCocoa::handleQuitRequest() NSArray *windowsList = [NSApp orderedWindows]; if ([windowsList count]) { [[windowsList objectAtIndex:0] makeKeyAndOrderFront:nil]; + //Handle the modifiers keyes changed state issue + //as recovering from the quit dialog is like application + //gaining focus back. + //Main issue fixed is Cmd modifier not being cleared + handleApplicationBecomeActiveEvent(); } } diff --git a/release/scripts/io/netrender/__init__.py b/release/scripts/io/netrender/__init__.py index 43f3094e628..5a705e95aa8 100644 --- a/release/scripts/io/netrender/__init__.py +++ b/release/scripts/io/netrender/__init__.py @@ -18,16 +18,31 @@ # This directory is a Python package. -from netrender import model -from netrender import operators -from netrender import client -from netrender import slave -from netrender import master -from netrender import master_html -from netrender import utils -from netrender import balancing -from netrender import ui -from netrender import repath +# To support reload properly, try to access a package var, if it's there, reload everything +try: + init_data + + reload(model) + reload(operators) + reload(client) + reload(slave) + reload(master) + reload(master_html) + reload(utils) + reload(balancing) + reload(ui) + reload(repath) +except: + from netrender import model + from netrender import operators + from netrender import client + from netrender import slave + from netrender import master + from netrender import master_html + from netrender import utils + from netrender import balancing + from netrender import ui + from netrender import repath jobs = [] slaves = [] @@ -38,14 +53,10 @@ init_data = True init_address = True def register(): - pass # TODO + ui.addProperties() + def unregister(): import bpy - bpy.types.Scene.RemoveProperty("network_render") - bpy.types.unregister(ui.NetRenderJob) - bpy.types.unregister(ui.NetRenderSettings) - bpy.types.unregister(ui.NetRenderSlave) - diff --git a/release/scripts/io/netrender/repath.py b/release/scripts/io/netrender/repath.py index d9a13ade987..d9a13ade987 100755..100644 --- a/release/scripts/io/netrender/repath.py +++ b/release/scripts/io/netrender/repath.py diff --git a/release/scripts/io/netrender/ui.py b/release/scripts/io/netrender/ui.py index c60b10c484a..c82a031100b 100644 --- a/release/scripts/io/netrender/ui.py +++ b/release/scripts/io/netrender/ui.py @@ -337,138 +337,139 @@ class NetRenderSlave(bpy.types.IDPropertyGroup): class NetRenderJob(bpy.types.IDPropertyGroup): pass -bpy.types.Scene.PointerProperty(attr="network_render", type=NetRenderSettings, name="Network Render", description="Network Render Settings") - -NetRenderSettings.StringProperty( attr="server_address", - name="Server address", - description="IP or name of the master render server", - maxlen = 128, - default = "[default]") - -NetRenderSettings.IntProperty( attr="server_port", - name="Server port", - description="port of the master render server", - default = 8000, - min=1, - max=65535) - -NetRenderSettings.BoolProperty( attr="master_broadcast", - name="Broadcast", - description="broadcast master server address on local network", - default = True) - -NetRenderSettings.BoolProperty( attr="slave_clear", - name="Clear on exit", - description="delete downloaded files on exit", - default = True) - -NetRenderSettings.BoolProperty( attr="slave_thumb", - name="Generate thumbnails", - description="Generate thumbnails on slaves instead of master", - default = False) - -NetRenderSettings.BoolProperty( attr="slave_outputlog", - name="Output render log on console", - description="Output render text log to console as well as sending it to the master", - default = True) - -NetRenderSettings.BoolProperty( attr="master_clear", - name="Clear on exit", - description="delete saved files on exit", - default = False) - -default_path = os.environ.get("TEMP") - -if not default_path: - if os.name == 'nt': - default_path = "c:/tmp/" - else: - default_path = "/tmp/" -elif not default_path.endswith(os.sep): - default_path += os.sep - -NetRenderSettings.StringProperty( attr="path", - name="Path", - description="Path for temporary files", - maxlen = 128, - default = default_path, - subtype='FILE_PATH') - -NetRenderSettings.StringProperty( attr="job_name", - name="Job name", - description="Name of the job", - maxlen = 128, - default = "[default]") - -NetRenderSettings.StringProperty( attr="job_category", - name="Job category", - description="Category of the job", - maxlen = 128, - default = "") - -NetRenderSettings.IntProperty( attr="chunks", - name="Chunks", - description="Number of frame to dispatch to each slave in one chunk", - default = 5, - min=1, - max=65535) - -NetRenderSettings.IntProperty( attr="priority", - name="Priority", - description="Priority of the job", - default = 1, - min=1, - max=10) - -NetRenderSettings.StringProperty( attr="job_id", - name="Network job id", - description="id of the last sent render job", - maxlen = 64, - default = "") - -NetRenderSettings.IntProperty( attr="active_slave_index", - name="Index of the active slave", - description="", - default = -1, - min= -1, - max=65535) - -NetRenderSettings.IntProperty( attr="active_blacklisted_slave_index", - name="Index of the active slave", - description="", - default = -1, - min= -1, - max=65535) - -NetRenderSettings.IntProperty( attr="active_job_index", - name="Index of the active job", - description="", - default = -1, - min= -1, - max=65535) - -NetRenderSettings.EnumProperty(attr="mode", - items=( - ("RENDER_CLIENT", "Client", "Act as render client"), - ("RENDER_MASTER", "Master", "Act as render master"), - ("RENDER_SLAVE", "Slave", "Act as render slave"), - ), - name="Network mode", - description="Mode of operation of this instance", - default="RENDER_CLIENT") - -NetRenderSettings.CollectionProperty(attr="slaves", type=NetRenderSlave, name="Slaves", description="") -NetRenderSettings.CollectionProperty(attr="slaves_blacklist", type=NetRenderSlave, name="Slaves Blacklist", description="") -NetRenderSettings.CollectionProperty(attr="jobs", type=NetRenderJob, name="Job List", description="") - -NetRenderSlave.StringProperty( attr="name", - name="Name of the slave", - description="", - maxlen = 64, - default = "") - -NetRenderJob.StringProperty( attr="name", - name="Name of the job", - description="", - maxlen = 128, - default = "") +def addProperties(): + bpy.types.Scene.PointerProperty(attr="network_render", type=NetRenderSettings, name="Network Render", description="Network Render Settings") + + NetRenderSettings.StringProperty( attr="server_address", + name="Server address", + description="IP or name of the master render server", + maxlen = 128, + default = "[default]") + + NetRenderSettings.IntProperty( attr="server_port", + name="Server port", + description="port of the master render server", + default = 8000, + min=1, + max=65535) + + NetRenderSettings.BoolProperty( attr="master_broadcast", + name="Broadcast", + description="broadcast master server address on local network", + default = True) + + NetRenderSettings.BoolProperty( attr="slave_clear", + name="Clear on exit", + description="delete downloaded files on exit", + default = True) + + NetRenderSettings.BoolProperty( attr="slave_thumb", + name="Generate thumbnails", + description="Generate thumbnails on slaves instead of master", + default = False) + + NetRenderSettings.BoolProperty( attr="slave_outputlog", + name="Output render log on console", + description="Output render text log to console as well as sending it to the master", + default = True) + + NetRenderSettings.BoolProperty( attr="master_clear", + name="Clear on exit", + description="delete saved files on exit", + default = False) + + default_path = os.environ.get("TEMP") + + if not default_path: + if os.name == 'nt': + default_path = "c:/tmp/" + else: + default_path = "/tmp/" + elif not default_path.endswith(os.sep): + default_path += os.sep + + NetRenderSettings.StringProperty( attr="path", + name="Path", + description="Path for temporary files", + maxlen = 128, + default = default_path, + subtype='FILE_PATH') + + NetRenderSettings.StringProperty( attr="job_name", + name="Job name", + description="Name of the job", + maxlen = 128, + default = "[default]") + + NetRenderSettings.StringProperty( attr="job_category", + name="Job category", + description="Category of the job", + maxlen = 128, + default = "") + + NetRenderSettings.IntProperty( attr="chunks", + name="Chunks", + description="Number of frame to dispatch to each slave in one chunk", + default = 5, + min=1, + max=65535) + + NetRenderSettings.IntProperty( attr="priority", + name="Priority", + description="Priority of the job", + default = 1, + min=1, + max=10) + + NetRenderSettings.StringProperty( attr="job_id", + name="Network job id", + description="id of the last sent render job", + maxlen = 64, + default = "") + + NetRenderSettings.IntProperty( attr="active_slave_index", + name="Index of the active slave", + description="", + default = -1, + min= -1, + max=65535) + + NetRenderSettings.IntProperty( attr="active_blacklisted_slave_index", + name="Index of the active slave", + description="", + default = -1, + min= -1, + max=65535) + + NetRenderSettings.IntProperty( attr="active_job_index", + name="Index of the active job", + description="", + default = -1, + min= -1, + max=65535) + + NetRenderSettings.EnumProperty(attr="mode", + items=( + ("RENDER_CLIENT", "Client", "Act as render client"), + ("RENDER_MASTER", "Master", "Act as render master"), + ("RENDER_SLAVE", "Slave", "Act as render slave"), + ), + name="Network mode", + description="Mode of operation of this instance", + default="RENDER_CLIENT") + + NetRenderSettings.CollectionProperty(attr="slaves", type=NetRenderSlave, name="Slaves", description="") + NetRenderSettings.CollectionProperty(attr="slaves_blacklist", type=NetRenderSlave, name="Slaves Blacklist", description="") + NetRenderSettings.CollectionProperty(attr="jobs", type=NetRenderJob, name="Job List", description="") + + NetRenderSlave.StringProperty( attr="name", + name="Name of the slave", + description="", + maxlen = 64, + default = "") + + NetRenderJob.StringProperty( attr="name", + name="Name of the job", + description="", + maxlen = 128, + default = "") diff --git a/release/scripts/modules/bpy/utils.py b/release/scripts/modules/bpy/utils.py index be52986bbad..06dbe8fd4cc 100644 --- a/release/scripts/modules/bpy/utils.py +++ b/release/scripts/modules/bpy/utils.py @@ -238,30 +238,29 @@ def relpath(path, start=None): return path -_unclean_chars = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, \ - 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, \ - 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 46, 47, 58, 59, 60, 61, 62, 63, \ - 64, 91, 92, 93, 94, 96, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, \ - 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, \ - 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, \ - 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, \ - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, \ - 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, \ - 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, \ - 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, \ - 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, \ - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254] - -_unclean_chars = ''.join([chr(i) for i in _unclean_chars]) - - def clean_name(name, replace="_"): """ Returns a name with characters replaced that may cause problems under various circumstances, such as writing to a file. All characters besides A-Z/a-z, 0-9 are replaced with "_" or the replace argument if defined. """ - for ch in _unclean_chars: + + unclean_chars = \ + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\ + \x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\ + \x1e\x1f\x20\x21\x22\x23\x24\x25\x26\x27\x28\x29\x2a\x2b\x2c\ + \x2e\x2f\x3a\x3b\x3c\x3d\x3e\x3f\x40\x5b\x5c\x5d\x5e\x60\x7b\ + \x7c\x7d\x7e\x7f\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\ + \x8b\x8c\x8d\x8e\x8f\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\ + \x9a\x9b\x9c\x9d\x9e\x9f\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\ + \xa9\xaa\xab\xac\xad\xae\xaf\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\ + \xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf\xc0\xc1\xc2\xc3\xc4\xc5\xc6\ + \xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf\xd0\xd1\xd2\xd3\xd4\xd5\ + \xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xe0\xe1\xe2\xe3\xe4\ + \xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\ + \xf4\xf5\xf6\xf7\xf8\xf9\xfa\xfb\xfc\xfd\xfe" + + for ch in unclean_chars: name = name.replace(ch, replace) return name diff --git a/release/scripts/op/console_python.py b/release/scripts/op/console_python.py index cabc741c701..2881e87fe00 100644 --- a/release/scripts/op/console_python.py +++ b/release/scripts/op/console_python.py @@ -22,6 +22,9 @@ import bpy language_id = 'python' +# store our own __main__ module, not 100% needed +# but python expects this in some places +_BPY_MAIN_OWN = True def add_scrollback(text, text_type): for l in text.split('\n'): @@ -67,8 +70,21 @@ def get_console(console_id): stdout = io.StringIO() stderr = io.StringIO() else: - namespace = {"__builtins__": __builtins__, "bpy": bpy, "C": bpy.context} + if _BPY_MAIN_OWN: + import types + bpy_main_mod = types.ModuleType("__main__") + namespace = bpy_main_mod.__dict__ + else: + namespace = {} + + namespace["__builtins__"] = sys.modules["builtins"] + namespace["bpy"] = bpy + namespace["C"] = bpy.context + console = InteractiveConsole(locals=namespace, filename="<blender_console>") + + if _BPY_MAIN_OWN: + console._bpy_main_mod = bpy_main_mod import io stdout = io.StringIO() @@ -105,6 +121,10 @@ def execute(context): stdin_backup = sys.stdin sys.stdin = None + if _BPY_MAIN_OWN: + main_mod_back = sys.modules["__main__"] + sys.modules["__main__"] = console._bpy_main_mod + # incase exception happens line = "" # incase of encodingf error is_multiline = False @@ -121,6 +141,8 @@ def execute(context): import traceback stderr.write(traceback.format_exc()) + if _BPY_MAIN_OWN: + sys.modules["__main__"] = main_mod_back stdout.seek(0) stderr.seek(0) diff --git a/release/scripts/op/object.py b/release/scripts/op/object.py index 0b052195541..403491bfa28 100644 --- a/release/scripts/op/object.py +++ b/release/scripts/op/object.py @@ -528,9 +528,9 @@ class MakeDupliFace(bpy.types.Operator): class IsolateTypeRender(bpy.types.Operator): - '''Select object matching a naming pattern''' + '''Hide unselected render objects of same type as active by setting the hide render flag''' bl_idname = "object.isolate_type_render" - bl_label = "Isolate Render Selection" + bl_label = "Restrict Render Unselected" bl_options = {'REGISTER', 'UNDO'} def execute(self, context): @@ -545,6 +545,17 @@ class IsolateTypeRender(bpy.types.Operator): obj.hide_render = True return {'FINISHED'} + +class ClearAllRestrictRender(bpy.types.Operator): + '''Reveal all render objects by setting the hide render flag''' + bl_idname = "object.hide_render_clear_all" + bl_label = "Clear All Restrict Render" + bl_options = {'REGISTER', 'UNDO'} + + def execute(self, context): + for obj in context.scene.objects: + obj.hide_render = False + return {'FINISHED'} classes = [ @@ -555,7 +566,8 @@ classes = [ ShapeTransfer, JoinUVs, IsolateTypeRender, - MakeDupliFace] + MakeDupliFace, + ClearAllRestrictRender] def register(): @@ -570,4 +582,4 @@ def unregister(): unregister(cls) if __name__ == "__main__": - register() + register()
\ No newline at end of file diff --git a/release/scripts/ui/properties_data_armature_rigify.py b/release/scripts/ui/properties_data_armature_rigify.py index 193ff390b1e..5af676d5aa8 100644 --- a/release/scripts/ui/properties_data_armature_rigify.py +++ b/release/scripts/ui/properties_data_armature_rigify.py @@ -365,7 +365,7 @@ def unregister(): for cls in classes: unregister(cls) - bpy.types.INFO_MT_armature_add.remove(menu_func) + space_info.INFO_MT_armature_add.remove(menu_func) if __name__ == "__main__": register() diff --git a/release/scripts/ui/properties_data_mesh.py b/release/scripts/ui/properties_data_mesh.py index 44d3d19e793..c3170be8860 100644 --- a/release/scripts/ui/properties_data_mesh.py +++ b/release/scripts/ui/properties_data_mesh.py @@ -114,7 +114,6 @@ class DATA_PT_normals(DataButtonsPanel): col = split.column() else: col.separator() - col.prop(mesh, "vertex_normal_flip") col.prop(mesh, "double_sided") diff --git a/release/scripts/ui/properties_data_modifier.py b/release/scripts/ui/properties_data_modifier.py index dfa0d8029b2..37764e20854 100644 --- a/release/scripts/ui/properties_data_modifier.py +++ b/release/scripts/ui/properties_data_modifier.py @@ -437,7 +437,6 @@ class DATA_PT_modifiers(DataButtonsPanel): col.prop(md, "levels", text="Preview") col.prop(md, "sculpt_levels", text="Sculpt") col.prop(md, "render_levels", text="Render") - col.prop(bpy.context.tool_settings.sculpt, "fast_navigate") if wide_ui: col = split.column() diff --git a/release/scripts/ui/space_buttons.py b/release/scripts/ui/space_buttons.py deleted file mode 100644 index 9fc30a8189b..00000000000 --- a/release/scripts/ui/space_buttons.py +++ /dev/null @@ -1,72 +0,0 @@ -# ##### BEGIN GPL LICENSE BLOCK ##### -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -# ##### END GPL LICENSE BLOCK ##### - -# <pep8 compliant> -import bpy - - -class Buttons_HT_header(bpy.types.Header): - bl_space_type = 'PROPERTIES' - - def draw(self, context): - layout = self.layout - - so = context.space_data - scene = context.scene - - row = layout.row(align=True) - row.template_header() - - if context.area.show_menus: - sub = row.row(align=True) - sub.menu("Buttons_MT_view", text="View") - - row = layout.row() - row.prop(so, "buttons_context", expand=True, text="") - row.prop(scene, "frame_current") - - -class Buttons_MT_view(bpy.types.Menu): - bl_label = "View" - - def draw(self, context): - layout = self.layout - so = context.space_data - - col = layout.column() - col.prop(so, "panel_alignment", expand=True) - - -classes = [ - Buttons_HT_header, - Buttons_MT_view] - - -def register(): - register = bpy.types.register - for cls in classes: - register(cls) - - -def unregister(): - unregister = bpy.types.unregister - for cls in classes: - unregister(cls) - -if __name__ == "__main__": - register() diff --git a/release/scripts/ui/space_image.py b/release/scripts/ui/space_image.py index 907725a4ef7..a28ddb90a40 100644 --- a/release/scripts/ui/space_image.py +++ b/release/scripts/ui/space_image.py @@ -673,7 +673,6 @@ class IMAGE_PT_paint_curve(bpy.types.Panel): row.operator("brush.curve_preset", icon="SHARPCURVE", text="").shape = 'SHARP' row.operator("brush.curve_preset", icon="LINCURVE", text="").shape = 'LINE' row.operator("brush.curve_preset", icon="NOCURVE", text="").shape = 'MAX' - row.operator("brush.curve_preset", icon="RNDCURVE", text="").shape = 'MID9' classes = [ IMAGE_MT_view, diff --git a/release/scripts/ui/space_logic.py b/release/scripts/ui/space_logic.py index a01a5ce6305..6003c4d4bd7 100644 --- a/release/scripts/ui/space_logic.py +++ b/release/scripts/ui/space_logic.py @@ -57,9 +57,43 @@ class LOGIC_MT_logicbricks_add(bpy.types.Menu): layout.operator_menu_enum("logic.sensor_add", "type", text="Sensor") layout.operator_menu_enum("logic.controller_add", "type", text="Controller") layout.operator_menu_enum("logic.actuator_add", "type", text="Actuator") + + +class LOGIC_HT_header(bpy.types.Header): + bl_space_type = 'LOGIC_EDITOR' + + def draw(self, context): + layout = self.layout + + st = context.space_data + + row = layout.row(align=True) + row.template_header() + + if context.area.show_menus: + sub = row.row(align=True) + sub.menu("LOGIC_MT_view") + #sub.menu("LOGIC_MT_select") + #sub.menu("LOGIC_MT_add") + + +class LOGIC_MT_view(bpy.types.Menu): + bl_label = "View" + + def draw(self, context): + layout = self.layout + + layout.column() + + layout.operator("logic.properties", icon='MENU_PANEL') + classes = [ - LOGIC_PT_properties, LOGIC_MT_logicbricks_add] + LOGIC_HT_header, + LOGIC_MT_view, + + LOGIC_PT_properties, + LOGIC_MT_logicbricks_add] def register(): diff --git a/release/scripts/ui/space_sequencer.py b/release/scripts/ui/space_sequencer.py index ba17b13775a..adf80635bc1 100644 --- a/release/scripts/ui/space_sequencer.py +++ b/release/scripts/ui/space_sequencer.py @@ -98,6 +98,10 @@ class SEQUENCER_MT_view(bpy.types.Menu): st = context.space_data layout.column() + + layout.operator("sequencer.properties", icon='MENU_PANEL') + + layout.separator() """ uiBlock *block= uiBeginBlock(C, ar, "seq_viewmenu", UI_EMBOSSP); @@ -127,7 +131,6 @@ class SEQUENCER_MT_view(bpy.types.Menu): menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); """ - layout.separator() if (st.view_type == 'SEQUENCER') or (st.view_type == 'SEQUENCER_PREVIEW'): layout.operator("sequencer.view_all", text='View all Sequences') if (st.view_type == 'PREVIEW') or (st.view_type == 'SEQUENCER_PREVIEW'): @@ -357,7 +360,6 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel): sub = row.row() sub.active = (not strip.mute) sub.prop(strip, "blend_opacity", text="Opacity", slider=True) - sub = row.row() row.prop(strip, "mute", toggle=True, icon='RESTRICT_VIEW_ON' if strip.mute else 'RESTRICT_VIEW_OFF', text="") row.prop(strip, "lock", toggle=True, icon='LOCKED' if strip.lock else 'UNLOCKED', text="") @@ -379,30 +381,6 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel): col.label(text="Frame Still %d:%d" % (strip.frame_still_start, strip.frame_still_end)) -class SEQUENCER_PT_preview(bpy.types.Panel): - bl_label = "Scene Preview/Render" - bl_space_type = 'SEQUENCE_EDITOR' - bl_region_type = 'UI' - - def draw(self, context): - layout = self.layout - render = context.scene.render - - col = layout.column() - col.prop(render, "use_sequencer_gl_preview", text="Open GL Preview") - col = layout.column() - col.active = render.use_sequencer_gl_preview - col.prop(render, "sequencer_gl_preview", text="") - - ''' - col = layout.column() - col.prop(render, "use_sequencer_gl_render", text="Open GL Render") - col = layout.column() - col.active = render.use_sequencer_gl_render - col.prop(render, "sequencer_gl_render", text="") - ''' - - class SEQUENCER_PT_effect(SequencerButtonsPanel): bl_label = "Effect Strip" @@ -816,6 +794,30 @@ class SEQUENCER_PT_proxy(SequencerButtonsPanel): flow.prop(strip.proxy, "filepath") +class SEQUENCER_PT_preview(SequencerButtonsPanel_Output): + bl_label = "Scene Preview/Render" + bl_space_type = 'SEQUENCE_EDITOR' + bl_region_type = 'UI' + + def draw(self, context): + layout = self.layout + render = context.scene.render + + col = layout.column() + col.prop(render, "use_sequencer_gl_preview", text="Open GL Preview") + col = layout.column() + col.active = render.use_sequencer_gl_preview + col.prop(render, "sequencer_gl_preview", text="") + + ''' + col = layout.column() + col.prop(render, "use_sequencer_gl_render", text="Open GL Render") + col = layout.column() + col.active = render.use_sequencer_gl_render + col.prop(render, "sequencer_gl_render", text="") + ''' + + class SEQUENCER_PT_view(SequencerButtonsPanel_Output): bl_label = "View Settings" @@ -843,7 +845,6 @@ classes = [ SEQUENCER_MT_strip, SEQUENCER_PT_edit, # sequencer panels - SEQUENCER_PT_preview, SEQUENCER_PT_effect, SEQUENCER_PT_input_movie, SEQUENCER_PT_input_image, @@ -853,6 +854,7 @@ classes = [ SEQUENCER_PT_filter, SEQUENCER_PT_proxy, + SEQUENCER_PT_preview, SEQUENCER_PT_view] # view panels diff --git a/release/scripts/ui/space_text.py b/release/scripts/ui/space_text.py index 692f1581bd6..552621d87c6 100644 --- a/release/scripts/ui/space_text.py +++ b/release/scripts/ui/space_text.py @@ -34,6 +34,7 @@ class TEXT_HT_header(bpy.types.Header): if context.area.show_menus: sub = row.row(align=True) + sub.menu("TEXT_MT_view") sub.menu("TEXT_MT_text") if text: sub.menu("TEXT_MT_edit") @@ -127,6 +128,20 @@ class TEXT_PT_find(bpy.types.Panel): row.prop(st, "find_all", text="All") +class TEXT_MT_view(bpy.types.Menu): + bl_label = "View" + + def draw(self, context): + layout = self.layout + + layout.operator("text.properties", icon='MENU_PANEL') + + layout.separator() + + layout.operator("screen.area_dupli") + layout.operator("screen.screen_full_area") + + class TEXT_MT_text(bpy.types.Menu): bl_label = "Text" @@ -160,15 +175,8 @@ class TEXT_MT_text(bpy.types.Menu): layout.separator() - layout.operator("text.properties", icon='MENU_PANEL') - layout.menu("TEXT_MT_templates") - layout.separator() - - layout.operator("screen.area_dupli") - layout.operator("screen.screen_full_area") - class TEXT_MT_templates(bpy.types.Menu): ''' @@ -294,6 +302,7 @@ classes = [ TEXT_HT_header, TEXT_PT_properties, TEXT_PT_find, + TEXT_MT_view, TEXT_MT_text, TEXT_MT_templates, TEXT_MT_format, diff --git a/release/scripts/ui/space_userpref.py b/release/scripts/ui/space_userpref.py index be386f19b59..c083a62a98e 100644 --- a/release/scripts/ui/space_userpref.py +++ b/release/scripts/ui/space_userpref.py @@ -336,8 +336,7 @@ class USERPREF_PT_edit(bpy.types.Panel): col = row.column() row = col.row(align=True) - row.label("Overlay Color:") - row.prop(edit, "sculpt_paint_overlay_col", text="") + row.prop(edit, "sculpt_paint_overlay_col", text="Sculpt Overlay Color") col.separator() col.separator() diff --git a/release/scripts/ui/space_view3d.py b/release/scripts/ui/space_view3d.py index 5d22c3b41bb..7b59b00dc56 100644 --- a/release/scripts/ui/space_view3d.py +++ b/release/scripts/ui/space_view3d.py @@ -791,7 +791,7 @@ class VIEW3D_MT_object_specials(bpy.types.Menu): layout.separator() props = layout.operator("object.isolate_type_render") - + props = layout.operator("object.hide_render_clear_all") class VIEW3D_MT_object_apply(bpy.types.Menu): bl_label = "Apply" @@ -2388,4 +2388,4 @@ def unregister(): unregister(cls) if __name__ == "__main__": - register() + register()
\ No newline at end of file diff --git a/release/scripts/ui/space_view3d_toolbar.py b/release/scripts/ui/space_view3d_toolbar.py index 3d138d906af..ebf9f8e5af3 100644 --- a/release/scripts/ui/space_view3d_toolbar.py +++ b/release/scripts/ui/space_view3d_toolbar.py @@ -986,7 +986,6 @@ class VIEW3D_PT_tools_brush_curve(PaintPanel): row.operator("brush.curve_preset", icon="SHARPCURVE", text="").shape = 'SHARP' row.operator("brush.curve_preset", icon="LINCURVE", text="").shape = 'LINE' row.operator("brush.curve_preset", icon="NOCURVE", text="").shape = 'MAX' - row.operator("brush.curve_preset", icon="RNDCURVE", text="").shape = 'MID9' class VIEW3D_PT_sculpt_options(PaintPanel): bl_label = "Options" @@ -1009,6 +1008,10 @@ class VIEW3D_PT_sculpt_options(PaintPanel): col = split.column() + col.prop(sculpt, "use_openmp", text="Threaded Sculpt") + col.prop(sculpt, "fast_navigate") + col.prop(sculpt, "show_brush") + col.label(text="Unified Settings:") col.prop(tool_settings, "sculpt_paint_use_unified_size", text="Size") col.prop(tool_settings, "sculpt_paint_use_unified_strength", text="Strength") @@ -1024,6 +1027,8 @@ class VIEW3D_PT_sculpt_options(PaintPanel): row.prop(sculpt, "lock_y", text="Y", toggle=True) row.prop(sculpt, "lock_z", text="Z", toggle=True) + + class VIEW3D_PT_sculpt_symmetry(PaintPanel): bl_label = "Symmetry" bl_default_closed = True diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h index 2c661a74573..242de4d788b 100644 --- a/source/blender/blenkernel/BKE_armature.h +++ b/source/blender/blenkernel/BKE_armature.h @@ -80,7 +80,6 @@ void free_armature(struct bArmature *arm); void make_local_armature(struct bArmature *arm); struct bArmature *copy_armature(struct bArmature *arm); -void bone_flip_name (char *name, int strip_number); int bone_autoside_name (char *name, int strip_number, short axis, float head, float tail); struct Bone *get_named_bone (struct bArmature *arm, const char *name); diff --git a/source/blender/blenkernel/BKE_colortools.h b/source/blender/blenkernel/BKE_colortools.h index 1f2dee6dcfc..e0ebedb320b 100644 --- a/source/blender/blenkernel/BKE_colortools.h +++ b/source/blender/blenkernel/BKE_colortools.h @@ -53,9 +53,11 @@ void curvemapping_free(struct CurveMapping *cumap); struct CurveMapping *curvemapping_copy(struct CurveMapping *cumap); void curvemapping_set_black_white(struct CurveMapping *cumap, float *black, float *white); +#define CURVEMAP_SLOPE_NEGATIVE 0 +#define CURVEMAP_SLOPE_POSITIVE 1 +void curvemap_reset(struct CurveMap *cuma, struct rctf *clipr, int preset, int slope); void curvemap_remove(struct CurveMap *cuma, int flag); void curvemap_insert(struct CurveMap *cuma, float x, float y); -void curvemap_reset(struct CurveMap *cuma, struct rctf *clipr, int preset); void curvemap_sethandle(struct CurveMap *cuma, int type); void curvemapping_changed(struct CurveMapping *cumap, int rem_doubles); diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h index e83ea4b809c..bcc92b477a7 100644 --- a/source/blender/blenkernel/BKE_curve.h +++ b/source/blender/blenkernel/BKE_curve.h @@ -107,5 +107,9 @@ int clamp_nurb_order_v( struct Nurb *nu); ListBase *BKE_curve_nurbs(struct Curve *cu); +int curve_bounds(struct Curve *cu, float min[3], float max[3]); +int curve_center_median(struct Curve *cu, float cent[3]); +int curve_center_bounds(struct Curve *cu, float cent[3]); +void curve_translate(struct Curve *cu, float offset[3], int do_keys); #endif diff --git a/source/blender/blenkernel/BKE_depsgraph.h b/source/blender/blenkernel/BKE_depsgraph.h index 6a44051806e..0b78a1206fe 100644 --- a/source/blender/blenkernel/BKE_depsgraph.h +++ b/source/blender/blenkernel/BKE_depsgraph.h @@ -70,7 +70,7 @@ int queue_count(struct DagNodeQueue *queue); void queue_delete(struct DagNodeQueue *queue); // queries -struct DagForest *build_dag(struct Scene *sce, short mask); +struct DagForest *build_dag(struct Main *bmain, struct Scene *sce, short mask); void free_forest(struct DagForest *Dag); // note : @@ -97,14 +97,14 @@ void draw_all_deps(void); /* Note that the DAG never executes changes in Objects, only sets flags in Objects */ /* (re)-create dependency graph for scene */ -void DAG_scene_sort(struct Scene *sce); +void DAG_scene_sort(struct Main *bmain, struct Scene *sce); /* flag all objects that need recalc because they're animated */ -void DAG_scene_update_flags(struct Scene *sce, unsigned int lay); +void DAG_scene_update_flags(struct Main *bmain, struct Scene *sce, unsigned int lay); /* flushes all recalc flags in objects down the dependency tree */ -void DAG_scene_flush_update(struct Scene *sce, unsigned int lay, int time); +void DAG_scene_flush_update(struct Main *bmain, struct Scene *sce, unsigned int lay, int time); /* tag objects for update on file load */ -void DAG_on_load_update(void); +void DAG_on_load_update(struct Main *bmain); /* flag all IDs that need recalc because they're animated, influencing this ID only. only for objects currently */ @@ -113,7 +113,7 @@ void DAG_id_update_flags(struct ID *id); but note the DAG only supports objects and object data currently */ void DAG_id_flush_update(struct ID *id, short flag); /* when setting manual RECALC flags, call this afterwards */ -void DAG_ids_flush_update(int time); +void DAG_ids_flush_update(struct Main *bmain, int time); /* (re)-create dependency graph for armature pose */ void DAG_pose_sort(struct Object *ob); diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index d7eb5fe8246..c842efaa3b2 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -159,7 +159,7 @@ void BKE_image_memorypack(struct Image *ima); void BKE_image_print_memlist(void); /* empty image block, of similar type and filename */ -struct Image *BKE_image_copy(struct Image *ima); +struct Image *copy_image(struct Image *ima); /* merge source into dest, and free source */ void BKE_image_merge(struct Image *dest, struct Image *source); diff --git a/source/blender/blenkernel/BKE_library.h b/source/blender/blenkernel/BKE_library.h index fcf7ae85738..debccaa02f9 100644 --- a/source/blender/blenkernel/BKE_library.h +++ b/source/blender/blenkernel/BKE_library.h @@ -65,6 +65,7 @@ void tag_main(struct Main *mainvar, int tag); int splitIDname(char *name, char *left, int *nr); void rename_id(struct ID *id, char *name); +void name_uiprefix_id(char *name, struct ID *id); void test_idbutton(char *name); void text_idbutton(struct ID *id, char *text); void all_local(struct Library *lib, int untagged_only); diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h index 07ca5a1c0ee..a220153523e 100644 --- a/source/blender/blenkernel/BKE_material.h +++ b/source/blender/blenkernel/BKE_material.h @@ -35,6 +35,7 @@ extern "C" { #endif +struct Main; struct Material; struct ID; struct Object; @@ -69,9 +70,9 @@ int object_remove_material_slot(struct Object *ob); /* rendering */ void init_render_material(struct Material *, int, float *); -void init_render_materials(int, float *); +void init_render_materials(struct Main *, int, float *); void end_render_material(struct Material *); -void end_render_materials(void); +void end_render_materials(struct Main *); int material_in_material(struct Material *parmat, struct Material *mat); diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 3b6cf8803d8..8c5979222f0 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -140,7 +140,12 @@ int mesh_layers_menu_charlen(struct CustomData *data, int type); /* use this to void mesh_layers_menu_concat(struct CustomData *data, int type, char *str); int mesh_layers_menu(struct CustomData *data, int type); +/* vertex level transformations & checks (no derived mesh) */ +int mesh_bounds(struct Mesh *me, float min[3], float max[3]); +int mesh_center_median(struct Mesh *me, float cent[3]); +int mesh_center_bounds(struct Mesh *me, float cent[3]); +void mesh_translate(struct Mesh *me, float offset[3], int do_keys); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h index 03a86b6566a..63f36a5f103 100644 --- a/source/blender/blenkernel/BKE_pointcache.h +++ b/source/blender/blenkernel/BKE_pointcache.h @@ -70,15 +70,16 @@ #define PTCACHE_READ_OLD 3 /* Structs */ +struct ClothModifierData; +struct ListBase; +struct Main; struct Object; -struct Scene; -struct SoftBody; -struct ParticleSystem; struct ParticleKey; -struct ClothModifierData; -struct SmokeModifierData; +struct ParticleSystem; struct PointCache; -struct ListBase; +struct Scene; +struct SmokeModifierData; +struct SoftBody; /* temp structure for read/write */ typedef struct PTCacheData { @@ -143,6 +144,7 @@ typedef struct PTCacheID { } PTCacheID; typedef struct PTCacheBaker { + struct Main *main; struct Scene *scene; int bake; int render; @@ -286,7 +288,7 @@ struct PointCache *BKE_ptcache_copy_list(struct ListBase *ptcaches_new, struct L /********************** Baking *********************/ /* Bakes cache with cache_step sized jumps in time, not accurate but very fast. */ -void BKE_ptcache_quick_cache_all(struct Scene *scene); +void BKE_ptcache_quick_cache_all(struct Main *bmain, struct Scene *scene); /* Bake cache or simulate to current frame with settings defined in the baker. */ void BKE_ptcache_make_cache(struct PTCacheBaker* baker); diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index f0fb2a65673..96ef8d44cf4 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -31,16 +31,16 @@ #ifndef BKE_SCENE_H #define BKE_SCENE_H +struct AviCodecData; +struct Base; struct bglMats; -struct Scene; +struct Main; struct Object; -struct Base; -struct Text; -struct AviCodecData; struct QuicktimeCodecData; struct RenderData; +struct Scene; +struct Text; struct Text; -struct Main; #define SCE_COPY_EMPTY 0 #define SCE_COPY_LINK_OB 1 @@ -57,8 +57,8 @@ void free_scene(struct Scene *sce); struct Scene *add_scene(char *name); struct Base *object_in_scene(struct Object *ob, struct Scene *sce); -void set_scene_bg(struct Scene *sce); -struct Scene *set_scene_name(char *name); +void set_scene_bg(struct Main *bmain, struct Scene *sce); +struct Scene *set_scene_name(struct Main *bmain, char *name); struct Scene *copy_scene(struct Main *bmain, struct Scene *sce, int type); void unlink_scene(struct Main *bmain, struct Scene *sce, struct Scene *newsce); @@ -78,12 +78,12 @@ void scene_deselect_all(struct Scene *sce); void scene_select_base(struct Scene *sce, struct Base *selbase); /* checks for cycle, returns 1 if it's all OK */ -int scene_check_setscene(struct Scene *sce); +int scene_check_setscene(struct Main *bmain, struct Scene *sce); float BKE_curframe(struct Scene *scene); -void scene_update_tagged(struct Scene *sce); -void scene_update_for_newframe(struct Scene *sce, unsigned int lay); +void scene_update_tagged(struct Main *bmain, struct Scene *sce); +void scene_update_for_newframe(struct Main *bmain, struct Scene *sce, unsigned int lay); void scene_add_render_layer(struct Scene *sce); diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h index 244fffa06ea..bcda86fdae4 100644 --- a/source/blender/blenkernel/BKE_text.h +++ b/source/blender/blenkernel/BKE_text.h @@ -92,7 +92,7 @@ void unindent (struct Text *text); void comment (struct Text *text); void indent (struct Text *text); void uncomment (struct Text *text); -int setcurr_tab (struct Text *text); +int setcurr_tab_spaces (struct Text *text, int space); void txt_add_marker (struct Text *text, struct TextLine *line, int start, int end, char color[4], int group, int flags); short txt_clear_marker_region (struct Text *text, struct TextLine *line, int start, int end, int group, int flags); diff --git a/source/blender/blenkernel/BKE_texture.h b/source/blender/blenkernel/BKE_texture.h index 39c12a2bfd8..380672dae04 100644 --- a/source/blender/blenkernel/BKE_texture.h +++ b/source/blender/blenkernel/BKE_texture.h @@ -61,6 +61,9 @@ void init_colorband(struct ColorBand *coba, int rangetype); struct ColorBand *add_colorband(int rangetype); int do_colorband(struct ColorBand *coba, float in, float out[4]); void colorband_table_RGBA(struct ColorBand *coba, float **array, int *size); +int vergcband(const void *a1, const void *a2); +struct CBData *colorband_element_add(struct ColorBand *coba, float position); +int colorband_element_remove(struct ColorBand *coba, int index); void default_tex(struct Tex *tex); struct Tex *add_texture(const char *name); diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 412084f7cd1..c24ec78dc1c 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -289,7 +289,7 @@ static void motionpaths_calc_optimise_depsgraph(Scene *scene, ListBase *targets) } /* "brew me a list that's sorted a bit faster now depsy" */ - DAG_scene_sort(scene); + DAG_scene_sort(G.main, scene); } /* update scene for current frame */ @@ -299,7 +299,7 @@ static void motionpaths_calc_update_scene(Scene *scene) Base *base, *last=NULL; /* only stuff that moves or needs display still */ - DAG_scene_update_flags(scene, scene->lay); + DAG_scene_update_flags(G.main, scene, scene->lay); /* find the last object with the tag * - all those afterwards are assumed to not be relevant for our calculations @@ -327,7 +327,7 @@ static void motionpaths_calc_update_scene(Scene *scene) * that doesn't force complete update, but for now, this is the * most accurate way! */ - scene_update_for_newframe(scene, scene->lay); // XXX this is the best way we can get anything moving + scene_update_for_newframe(G.main, scene, scene->lay); // XXX this is the best way we can get anything moving #endif } diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 990993b1077..b9b171780c7 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -245,117 +245,6 @@ Bone *get_named_bone (bArmature *arm, const char *name) return bone; } - -#define IS_SEPARATOR(a) (a=='.' || a==' ' || a=='-' || a=='_') - -/* finds the best possible flipped name. For renaming; check for unique names afterwards */ -/* if strip_number: removes number extensions */ -void bone_flip_name (char *name, int strip_number) -{ - int len; - char prefix[128]={""}; /* The part before the facing */ - char suffix[128]={""}; /* The part after the facing */ - char replace[128]={""}; /* The replacement string */ - char number[128]={""}; /* The number extension string */ - char *index=NULL; - - len= strlen(name); - if(len<3) return; // we don't do names like .R or .L - - /* We first check the case with a .### extension, let's find the last period */ - if(isdigit(name[len-1])) { - index= strrchr(name, '.'); // last occurrence - if (index && isdigit(index[1]) ) { // doesnt handle case bone.1abc2 correct..., whatever! - if(strip_number==0) - strcpy(number, index); - *index= 0; - len= strlen(name); - } - } - - strcpy (prefix, name); - - /* first case; separator . - _ with extensions r R l L */ - if( IS_SEPARATOR(name[len-2]) ) { - switch(name[len-1]) { - case 'l': - prefix[len-1]= 0; - strcpy(replace, "r"); - break; - case 'r': - prefix[len-1]= 0; - strcpy(replace, "l"); - break; - case 'L': - prefix[len-1]= 0; - strcpy(replace, "R"); - break; - case 'R': - prefix[len-1]= 0; - strcpy(replace, "L"); - break; - } - } - /* case; beginning with r R l L , with separator after it */ - else if( IS_SEPARATOR(name[1]) ) { - switch(name[0]) { - case 'l': - strcpy(replace, "r"); - strcpy(suffix, name+1); - prefix[0]= 0; - break; - case 'r': - strcpy(replace, "l"); - strcpy(suffix, name+1); - prefix[0]= 0; - break; - case 'L': - strcpy(replace, "R"); - strcpy(suffix, name+1); - prefix[0]= 0; - break; - case 'R': - strcpy(replace, "L"); - strcpy(suffix, name+1); - prefix[0]= 0; - break; - } - } - else if(len > 5) { - /* hrms, why test for a separator? lets do the rule 'ultimate left or right' */ - index = BLI_strcasestr(prefix, "right"); - if (index==prefix || index==prefix+len-5) { - if(index[0]=='r') - strcpy (replace, "left"); - else { - if(index[1]=='I') - strcpy (replace, "LEFT"); - else - strcpy (replace, "Left"); - } - *index= 0; - strcpy (suffix, index+5); - } - else { - index = BLI_strcasestr(prefix, "left"); - if (index==prefix || index==prefix+len-4) { - if(index[0]=='l') - strcpy (replace, "right"); - else { - if(index[1]=='E') - strcpy (replace, "RIGHT"); - else - strcpy (replace, "Right"); - } - *index= 0; - strcpy (suffix, index+4); - } - } - } - - sprintf (name, "%s%s%s%s", prefix, replace, suffix, number); -} - /* Finds the best possible extension to the name on a particular axis. (For renaming, check for unique names afterwards) * This assumes that bone names are at most 32 chars long! * strip_number: removes number extensions (TODO: not used) diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c index 9a624017a16..1a1f3a724ca 100644 --- a/source/blender/blenkernel/intern/blender.c +++ b/source/blender/blenkernel/intern/blender.c @@ -313,7 +313,7 @@ static void setup_app_data(bContext *C, BlendFileData *bfd, char *filename) BLI_strncpy(G.main->name, filename, FILE_MAX); /* is guaranteed current file */ /* baseflags, groups, make depsgraph, etc */ - set_scene_bg(CTX_data_scene(C)); + set_scene_bg(G.main, CTX_data_scene(C)); MEM_freeN(bfd); } @@ -478,7 +478,7 @@ static int read_undosave(bContext *C, UndoElem *uel) G.fileflags= fileflags; if(success) - DAG_on_load_update(); + DAG_on_load_update(G.main); return success; } diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 1e4fb13d1df..b9d7ea177d4 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -452,7 +452,7 @@ void brush_curve_preset(Brush *b, /*CurveMappingPreset*/int preset) cm->flag &= ~CUMA_EXTEND_EXTRAPOLATE; b->curve->preset = preset; - curvemap_reset(cm, &b->curve->clipr, b->curve->preset); + curvemap_reset(cm, &b->curve->clipr, b->curve->preset, CURVEMAP_SLOPE_NEGATIVE); curvemapping_changed(b->curve, 0); } diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index a931a87e8c3..fb1e8c00991 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -241,7 +241,8 @@ static void cdDM_drawVerts(DerivedMesh *dm) else { /* use OpenGL VBOs or Vertex Arrays instead for better, faster rendering */ GPU_vertex_setup(dm); if( !GPU_buffer_legacy(dm) ) { - glDrawArrays(GL_POINTS,0,dm->drawObject->nelements); + if(dm->drawObject->nelements) glDrawArrays(GL_POINTS,0, dm->drawObject->nelements); + else glDrawArrays(GL_POINTS,0, dm->drawObject->nlooseverts); } GPU_buffer_unbind(); } diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index a07c18f42f3..11801557c99 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -236,7 +236,7 @@ void curvemap_insert(CurveMap *cuma, float x, float y) cuma->curve= cmp; } -void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset) +void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset, int slope) { if(cuma->curve) MEM_freeN(cuma->curve); @@ -320,6 +320,20 @@ void curvemap_reset(CurveMap *cuma, rctf *clipr, int preset) break; } + /* mirror curve in x direction to have positive slope + * rather than default negative slope */ + if (slope == CURVEMAP_SLOPE_POSITIVE) { + int i, last=cuma->totpoint-1; + CurveMapPoint *newpoints= MEM_dupallocN(cuma->curve); + + for (i=0; i<cuma->totpoint; i++) { + newpoints[i].y = cuma->curve[last-i].y; + } + + MEM_freeN(cuma->curve); + cuma->curve = newpoints; + } + if(cuma->table) { MEM_freeN(cuma->table); cuma->table= NULL; diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 4142ad7128f..1a30e85c5c4 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -276,7 +276,7 @@ void tex_space_curve(Curve *cu) { DispList *dl; BoundBox *bb; - float *fp, min[3], max[3], loc[3], size[3]; + float *fp, min[3], max[3]; int tot, doit= 0; if(cu->bb==NULL) cu->bb= MEM_callocN(sizeof(BoundBox), "boundbox"); @@ -303,20 +303,15 @@ void tex_space_curve(Curve *cu) min[0] = min[1] = min[2] = -1.0f; max[0] = max[1] = max[2] = 1.0f; } - - loc[0]= (min[0]+max[0])/2.0f; - loc[1]= (min[1]+max[1])/2.0f; - loc[2]= (min[2]+max[2])/2.0f; - - size[0]= (max[0]-min[0])/2.0f; - size[1]= (max[1]-min[1])/2.0f; - size[2]= (max[2]-min[2])/2.0f; boundbox_set_from_min_max(bb, min, max); if(cu->texflag & CU_AUTOSPACE) { - VECCOPY(cu->loc, loc); - VECCOPY(cu->size, size); + mid_v3_v3v3(cu->loc, min, max); + cu->size[0]= (max[0]-min[0])/2.0f; + cu->size[1]= (max[1]-min[1])/2.0f; + cu->size[2]= (max[2]-min[2])/2.0f; + cu->rot[0]= cu->rot[1]= cu->rot[2]= 0.0; if(cu->size[0]==0.0) cu->size[0]= 1.0; @@ -3107,3 +3102,103 @@ ListBase *BKE_curve_nurbs(Curve *cu) return &cu->nurb; } + + +/* basic vertex data functions */ +int curve_bounds(Curve *cu, float min[3], float max[3]) +{ + ListBase *nurb_lb= BKE_curve_nurbs(cu); + Nurb *nu; + + INIT_MINMAX(min, max); + + for(nu= nurb_lb->first; nu; nu= nu->next) + minmaxNurb(nu, min, max); + + return (nurb_lb->first != NULL); +} + +int curve_center_median(Curve *cu, float cent[3]) +{ + ListBase *nurb_lb= BKE_curve_nurbs(cu); + Nurb *nu; + int total= 0; + + zero_v3(cent); + + for(nu= nurb_lb->first; nu; nu= nu->next) { + int i; + + if(nu->type == CU_BEZIER) { + BezTriple *bezt; + i= nu->pntsu; + total += i * 3; + for(bezt= nu->bezt; i--; bezt++) { + add_v3_v3(cent, bezt->vec[0]); + add_v3_v3(cent, bezt->vec[1]); + add_v3_v3(cent, bezt->vec[2]); + } + } + else { + BPoint *bp; + i= nu->pntsu*nu->pntsv; + total += i; + for(bp= nu->bp; i--; bp++) { + add_v3_v3(cent, bp->vec); + } + } + } + + mul_v3_fl(cent, 1.0f/(float)total); + + return (total != 0); +} + +int curve_center_bounds(Curve *cu, float cent[3]) +{ + float min[3], max[3]; + + if(curve_bounds(cu, min, max)) { + mid_v3_v3v3(cent, min, max); + return 1; + } + + return 0; +} + +void curve_translate(Curve *cu, float offset[3], int do_keys) +{ + ListBase *nurb_lb= BKE_curve_nurbs(cu); + Nurb *nu; + int i; + + for(nu= nurb_lb->first; nu; nu= nu->next) { + BezTriple *bezt; + BPoint *bp; + + if(nu->type == CU_BEZIER) { + i= nu->pntsu; + for(bezt= nu->bezt; i--; bezt++) { + add_v3_v3(bezt->vec[0], offset); + add_v3_v3(bezt->vec[1], offset); + add_v3_v3(bezt->vec[2], offset); + } + } + else { + i= nu->pntsu*nu->pntsv; + for(bp= nu->bp; i--; bp++) { + add_v3_v3(bp->vec, offset); + } + } + } + + if (do_keys && cu->key) { + KeyBlock *kb; + for (kb=cu->key->block.first; kb; kb=kb->next) { + float *fp= kb->data; + for (i= kb->totelem; i--; fp+=3) { + add_v3_v3(fp, offset); + } + } + } +} diff --git a/source/blender/blenkernel/intern/depsgraph.c b/source/blender/blenkernel/intern/depsgraph.c index 142f80a350e..1f8360324d5 100644 --- a/source/blender/blenkernel/intern/depsgraph.c +++ b/source/blender/blenkernel/intern/depsgraph.c @@ -658,7 +658,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O dag_add_relation(dag,scenenode,node,DAG_RL_SCENE, "Scene Relation"); } -struct DagForest *build_dag(struct Scene *sce, short mask) +struct DagForest *build_dag(Main *bmain, Scene *sce, short mask) { Base *base; Object *ob; @@ -695,7 +695,7 @@ struct DagForest *build_dag(struct Scene *sce, short mask) } /* add groups used in current scene objects */ - for(group= G.main->group.first; group; group= group->id.next) { + for(group= bmain->group.first; group; group= group->id.next) { if(group->id.flag & LIB_DOIT) { for(go= group->gobject.first; go; go= go->next) { build_dag_object(dag, scenenode, sce, go->ob, mask); @@ -1605,7 +1605,7 @@ static void dag_editors_update(Main *bmain, ID *id) } /* groups with objects in this scene need to be put in the right order as well */ -static void scene_sort_groups(Scene *sce) +static void scene_sort_groups(Main *bmain, Scene *sce) { Base *base; Group *group; @@ -1613,14 +1613,14 @@ static void scene_sort_groups(Scene *sce) Object *ob; /* test; are group objects all in this scene? */ - for(ob= G.main->object.first; ob; ob= ob->id.next) { + for(ob= bmain->object.first; ob; ob= ob->id.next) { ob->id.flag &= ~LIB_DOIT; ob->id.newid= NULL; /* newid abuse for GroupObject */ } for(base = sce->base.first; base; base= base->next) base->object->id.flag |= LIB_DOIT; - for(group= G.main->group.first; group; group= group->id.next) { + for(group= bmain->group.first; group; group= group->id.next) { for(go= group->gobject.first; go; go= go->next) { if((go->ob->id.flag & LIB_DOIT)==0) break; @@ -1649,7 +1649,7 @@ static void scene_sort_groups(Scene *sce) } /* sort the base list on dependency order */ -void DAG_scene_sort(struct Scene *sce) +void DAG_scene_sort(Main *bmain, Scene *sce) { DagNode *node; DagNodeQueue *nqueue; @@ -1661,7 +1661,7 @@ void DAG_scene_sort(struct Scene *sce) tempbase.first= tempbase.last= NULL; - build_dag(sce, DAG_RL_ALL_BUT_DATA); + build_dag(bmain, sce, DAG_RL_ALL_BUT_DATA); dag_check_cycle(sce->theDag); @@ -1731,7 +1731,7 @@ void DAG_scene_sort(struct Scene *sce) queue_delete(nqueue); /* all groups with objects in this scene gets resorted too */ - scene_sort_groups(sce); + scene_sort_groups(bmain, sce); if(G.f & G_DEBUG) { printf("\nordered\n"); @@ -1926,7 +1926,7 @@ static void dag_scene_flush_layers(Scene *sce, int lay) } /* flushes all recalc flags in objects down the dependency tree */ -void DAG_scene_flush_update(Scene *sce, unsigned int lay, int time) +void DAG_scene_flush_update(Main *bmain, Scene *sce, unsigned int lay, int time) { DagNode *firstnode; DagAdjList *itA; @@ -1935,7 +1935,7 @@ void DAG_scene_flush_update(Scene *sce, unsigned int lay, int time) if(sce->theDag==NULL) { printf("DAG zero... not allowed to happen!\n"); - DAG_scene_sort(sce); + DAG_scene_sort(bmain, sce); } firstnode= sce->theDag->DagNode.first; // always scene node @@ -2135,7 +2135,7 @@ static void dag_object_time_update_flags(Object *ob) } } /* flag all objects that need recalc, for changes in time for example */ -void DAG_scene_update_flags(Scene *scene, unsigned int lay) +void DAG_scene_update_flags(Main *bmain, Scene *scene, unsigned int lay) { Base *base; Object *ob; @@ -2157,7 +2157,7 @@ void DAG_scene_update_flags(Scene *scene, unsigned int lay) } /* we do groups each once */ - for(group= G.main->group.first; group; group= group->id.next) { + for(group= bmain->group.first; group; group= group->id.next) { if(group->id.flag & LIB_DOIT) { for(go= group->gobject.first; go; go= go->next) { dag_object_time_update_flags(go->ob); @@ -2166,7 +2166,7 @@ void DAG_scene_update_flags(Scene *scene, unsigned int lay) } for(sce= scene; sce; sce= sce->set) - DAG_scene_flush_update(sce, lay, 1); + DAG_scene_flush_update(bmain, sce, lay, 1); /* test: set time flag, to disable baked systems to update */ for(SETLOOPER(scene, base)) { @@ -2223,21 +2223,19 @@ static void dag_current_scene_layers(Main *bmain, Scene **sce, unsigned int *lay } } -void DAG_ids_flush_update(int time) +void DAG_ids_flush_update(Main *bmain, int time) { - Main *bmain= G.main; Scene *sce; unsigned int lay; dag_current_scene_layers(bmain, &sce, &lay); if(sce) - DAG_scene_flush_update(sce, lay, time); + DAG_scene_flush_update(bmain, sce, lay, time); } -void DAG_on_load_update(void) +void DAG_on_load_update(Main *bmain) { - Main *bmain= G.main; Scene *scene, *sce; Base *base; Object *ob; @@ -2268,7 +2266,7 @@ void DAG_on_load_update(void) } } - for(group= G.main->group.first; group; group= group->id.next) { + for(group= bmain->group.first; group; group= group->id.next) { if(group->id.flag & LIB_DOIT) { for(go= group->gobject.first; go; go= go->next) { if(ELEM5(go->ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL)) @@ -2282,7 +2280,7 @@ void DAG_on_load_update(void) } /* now tag update flags, to ensure deformers get calculated on redraw */ - DAG_scene_update_flags(scene, lay); + DAG_scene_update_flags(bmain, scene, lay); } } @@ -2394,7 +2392,7 @@ void DAG_id_flush_update(ID *id, short flag) } /* flush to other objects that depend on this one */ - DAG_scene_flush_update(sce, lay, 0); + DAG_scene_flush_update(bmain, sce, lay, 0); } /* recursively descends tree, each node only checked once */ @@ -2477,7 +2475,7 @@ void DAG_id_update_flags(ID *id) } /* set recalcs and flushes */ - DAG_scene_update_flags(sce, lay); + DAG_scene_update_flags(bmain, sce, lay); /* now we clear recalcs, unless color is set */ for(node = sce->theDag->DagNode.first; node; node= node->next) { diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 7ebd0c3f457..46f67adeb4b 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -814,7 +814,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) twidth = char_width(cu, che, info); // Calculate positions - if((tb->w != 0.0) && (ct->dobreak==0) && ((xof-(tb->x/cu->fsize)+twidth)*cu->fsize) > tb->w) { + if((tb->w != 0.0) && (ct->dobreak==0) && ((xof-(tb->x/cu->fsize)+twidth)*cu->fsize) > tb->w + cu->xof*cu->fsize) { // fprintf(stderr, "linewidth exceeded: %c%c%c...\n", mem[i], mem[i+1], mem[i+2]); for (j=i; j && (mem[j] != '\n') && (mem[j] != '\r') && (chartransdata[j].dobreak==0); j--) { if (mem[j]==' ' || mem[j]=='-') { @@ -855,7 +855,7 @@ struct chartrans *BKE_text_to_curve(Scene *scene, Object *ob, int mode) linedata4[lnr]= wsnr; if ( (tb->h != 0.0) && - ((-(yof-(tb->y/cu->fsize))) > ((tb->h/cu->fsize)-(linedist*cu->fsize))) && + ((-(yof-(tb->y/cu->fsize))) > ((tb->h/cu->fsize)-(linedist*cu->fsize)) - cu->yof) && (cu->totbox > (curbox+1)) ) { maxlen= 0; tb++; diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index ffd0b378f07..77607ae25b6 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -287,17 +287,25 @@ static void image_assign_ibuf(Image *ima, ImBuf *ibuf, int index, int frame) } /* empty image block, of similar type and filename */ -Image *BKE_image_copy(Image *ima) +Image *copy_image(Image *ima) { - Image *new= image_alloc(ima->id.name+2, ima->source, ima->type); + Image *nima= image_alloc(ima->id.name+2, ima->source, ima->type); - BLI_strncpy(new->name, ima->name, sizeof(ima->name)); - - new->gen_x= ima->gen_x; - new->gen_y= ima->gen_y; - new->gen_type= ima->gen_type; + BLI_strncpy(nima->name, ima->name, sizeof(ima->name)); + + nima->flag= ima->flag; + nima->tpageflag= ima->tpageflag; - return new; + nima->gen_x= ima->gen_x; + nima->gen_y= ima->gen_y; + nima->gen_type= ima->gen_type; + + nima->animspeed= ima->animspeed; + + nima->aspx= ima->aspx; + nima->aspy= ima->aspy; + + return nima; } void BKE_image_merge(Image *dest, Image *source) diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index ef47c8c35b7..967cd5f4520 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -265,7 +265,8 @@ int id_copy(ID *id, ID **newid, int test) if(!test) *newid= (ID*)copy_texture((Tex*)id); return 1; case ID_IM: - return 0; /* not implemented */ + if(!test) *newid= (ID*)copy_image((Image*)id); + return 1; case ID_WV: return 0; /* deprecated */ case ID_LT: @@ -1407,3 +1408,12 @@ void rename_id(ID *id, char *name) new_id(lb, id, name); } + +void name_uiprefix_id(char *name, ID *id) +{ + name[0] = id->lib ? 'L':' '; + name[1] = id->flag & LIB_FAKEUSER ? 'F':' '; + name[2] = ' '; + + strcpy(name+3, id->name+2); +} diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 05a05c157c9..8adc658fccd 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -784,14 +784,14 @@ void init_render_material(Material *mat, int r_mode, float *amb) } } -void init_render_materials(int r_mode, float *amb) +void init_render_materials(Main *bmain, int r_mode, float *amb) { Material *ma; /* clear these flags before going over materials, to make sure they * are cleared only once, otherwise node materials contained in other * node materials can go wrong */ - for(ma= G.main->mat.first; ma; ma= ma->id.next) { + for(ma= bmain->mat.first; ma; ma= ma->id.next) { if(ma->id.us) { ma->texco= 0; ma->mapto= 0; @@ -799,7 +799,7 @@ void init_render_materials(int r_mode, float *amb) } /* two steps, first initialize, then or the flags for layers */ - for(ma= G.main->mat.first; ma; ma= ma->id.next) { + for(ma= bmain->mat.first; ma; ma= ma->id.next) { /* is_used flag comes back in convertblender.c */ ma->flag &= ~MA_IS_USED; if(ma->id.us) @@ -816,10 +816,10 @@ void end_render_material(Material *mat) ntreeEndExecTree(mat->nodetree); /* has internal flag to detect it only does it once */ } -void end_render_materials(void) +void end_render_materials(Main *bmain) { Material *ma; - for(ma= G.main->mat.first; ma; ma= ma->id.next) + for(ma= bmain->mat.first; ma; ma= ma->id.next) if(ma->id.us) end_render_material(ma); } diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index cd8b2eb0a8e..ab7b0694836 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -320,33 +320,22 @@ void make_local_mesh(Mesh *me) void boundbox_mesh(Mesh *me, float *loc, float *size) { - MVert *mvert; BoundBox *bb; float min[3], max[3]; float mloc[3], msize[3]; - int a; if(me->bb==0) me->bb= MEM_callocN(sizeof(BoundBox), "boundbox"); bb= me->bb; - - INIT_MINMAX(min, max); if (!loc) loc= mloc; if (!size) size= msize; - mvert= me->mvert; - for(a=0; a<me->totvert; a++, mvert++) { - DO_MINMAX(mvert->co, min, max); - } - - if(!me->totvert) { + if(!mesh_bounds(me, min, max)) { min[0] = min[1] = min[2] = -1.0f; max[0] = max[1] = max[2] = 1.0f; } - loc[0]= (min[0]+max[0])/2.0f; - loc[1]= (min[1]+max[1])/2.0f; - loc[2]= (min[2]+max[2])/2.0f; + mid_v3_v3v3(loc, min, max); size[0]= (max[0]-min[0])/2.0f; size[1]= (max[1]-min[1])/2.0f; @@ -369,9 +358,9 @@ void tex_space_mesh(Mesh *me) else if(size[a]<0.0 && size[a]> -0.00001) size[a]= -0.00001; } - VECCOPY(me->loc, loc); - VECCOPY(me->size, size); - me->rot[0]= me->rot[1]= me->rot[2]= 0.0; + copy_v3_v3(me->loc, loc); + copy_v3_v3(me->size, size); + zero_v3(me->rot); } } @@ -413,9 +402,7 @@ float *get_mesh_orco_verts(Object *ob) totvert = MIN2(tme->totvert, me->totvert); for(a=0; a<totvert; a++, mvert++) { - vcos[a][0]= mvert->co[0]; - vcos[a][1]= mvert->co[1]; - vcos[a][2]= mvert->co[2]; + copy_v3_v3(vcos[a], mvert->co); } return (float*)vcos; @@ -431,9 +418,7 @@ void transform_mesh_orco_verts(Mesh *me, float (*orco)[3], int totvert, int inve if(invert) { for(a=0; a<totvert; a++) { float *co = orco[a]; - co[0] = co[0]*size[0] + loc[0]; - co[1] = co[1]*size[1] + loc[1]; - co[2] = co[2]*size[2] + loc[2]; + madd_v3_v3v3v3(co, loc, co, size); } } else { @@ -697,7 +682,6 @@ void mball_to_mesh(ListBase *lb, Mesh *me) if(dl==0) return; if(dl->type==DL_INDEX4) { - me->flag= ME_NOPUNOFLIP; me->totvert= dl->nr; me->totface= dl->parts; @@ -1498,3 +1482,60 @@ void mesh_pmv_off(Object *ob, Mesh *me) me->pv= NULL; } } + +/* basic vertex data functions */ +int mesh_bounds(Mesh *me, float min[3], float max[3]) +{ + int i= me->totvert; + MVert *mvert; + INIT_MINMAX(min, max); + for(mvert= me->mvert; i--; mvert++) { + DO_MINMAX(mvert->co, min, max); + } + + return (me->totvert != 0); +} + +int mesh_center_median(Mesh *me, float cent[3]) +{ + int i= me->totvert; + MVert *mvert; + zero_v3(cent); + for(mvert= me->mvert; i--; mvert++) { + add_v3_v3(cent, mvert->co); + } + mul_v3_fl(cent, 1.0f/(float)me->totvert); + + return (me->totvert != 0); +} + +int mesh_center_bounds(Mesh *me, float cent[3]) +{ + float min[3], max[3]; + + if(mesh_bounds(me, min, max)) { + mid_v3_v3v3(cent, min, max); + return 1; + } + + return 0; +} + +void mesh_translate(Mesh *me, float offset[3], int do_keys) +{ + int i= me->totvert; + MVert *mvert; + for(mvert= me->mvert; i--; mvert++) { + add_v3_v3(mvert->co, offset); + } + + if (do_keys && me->key) { + KeyBlock *kb; + for (kb=me->key->block.first; kb; kb=kb->next) { + float *fp= kb->data; + for (i= kb->totelem; i--; fp+=3) { + add_v3_v3(fp, offset); + } + } + } +} diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index add011d0950..ff1887b0883 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -2565,7 +2565,7 @@ bNodeTree *ntreeLocalize(bNodeTree *ntree) if(ELEM(node->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) { if(node->id) { if(node->flag & NODE_DO_OUTPUT) - node->new_node->id= (ID *)BKE_image_copy((Image *)node->id); + node->new_node->id= (ID *)copy_image((Image *)node->id); else node->new_node->id= NULL; } diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 81799a5409d..39e02ee584d 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1837,47 +1837,38 @@ static void give_parvert(Object *par, int nr, float *vec) if(par->type==OB_MESH) { Mesh *me= par->data; - em = BKE_mesh_get_editmesh(me); + DerivedMesh *dm; - if(em) { - EditVert *eve; + em = BKE_mesh_get_editmesh(me); + dm = (em)? em->derivedFinal: par->derivedFinal; - for(eve= em->verts.first; eve; eve= eve->next) { - if(eve->keyindex==nr) { - memcpy(vec, eve->co, sizeof(float)*3); - break; + if(dm) { + MVert *mvert= dm->getVertArray(dm); + int *index = (int *)dm->getVertDataArray(dm, CD_ORIGINDEX); + int i, count = 0, vindex, numVerts = dm->getNumVerts(dm); + + /* get the average of all verts with (original index == nr) */ + for(i = 0; i < numVerts; i++) { + vindex= (index)? index[i]: i; + + if(vindex == nr) { + add_v3_v3(vec, mvert[i].co); + count++; } } - BKE_mesh_end_editmesh(me, em); - } - else { - DerivedMesh *dm = par->derivedFinal; - - if(dm) { - MVert *mvert= dm->getVertArray(dm); - int *index = (int *)dm->getVertDataArray(dm, CD_ORIGINDEX); - int i, count = 0, vindex, numVerts = dm->getNumVerts(dm); - - /* get the average of all verts with (original index == nr) */ - for(i = 0; i < numVerts; i++) { - vindex= (index)? index[i]: i; - - if(vindex == nr) { - add_v3_v3(vec, mvert[i].co); - count++; - } - } - if (count==0) { - /* keep as 0,0,0 */ - } else if(count > 0) { - mul_v3_fl(vec, 1.0f / count); - } else { - /* use first index if its out of range */ - dm->getVertCo(dm, 0, vec); - } + if (count==0) { + /* keep as 0,0,0 */ + } else if(count > 0) { + mul_v3_fl(vec, 1.0f / count); + } else { + /* use first index if its out of range */ + dm->getVertCo(dm, 0, vec); } } + + if(em) + BKE_mesh_end_editmesh(me, em); } else if (ELEM(par->type, OB_CURVE, OB_SURF)) { Nurb *nu; diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index ed63f011342..52ee0180f43 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -3395,7 +3395,7 @@ ModifierData *object_add_particle_system(Scene *scene, Object *ob, char *name) psys->flag = PSYS_ENABLED|PSYS_CURRENT; psys->cfra=bsystem_time(scene,ob,scene->r.cfra+1,0.0); - DAG_scene_sort(scene); + DAG_scene_sort(G.main, scene); DAG_id_flush_update(&ob->id, OB_RECALC_DATA); return md; @@ -3432,7 +3432,7 @@ void object_remove_particle_system(Scene *scene, Object *ob) else ob->mode &= ~OB_MODE_PARTICLE_EDIT; - DAG_scene_sort(scene); + DAG_scene_sort(G.main, scene); DAG_id_flush_update(&ob->id, OB_RECALC_DATA); } static void default_particle_settings(ParticleSettings *part) diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index ced5d116ad0..d44221d2cd3 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -2335,7 +2335,7 @@ PointCache *BKE_ptcache_copy_list(ListBase *ptcaches_new, ListBase *ptcaches_old /* Baking */ -void BKE_ptcache_quick_cache_all(Scene *scene) +void BKE_ptcache_quick_cache_all(Main *bmain, Scene *scene) { PTCacheBaker baker; @@ -2348,6 +2348,7 @@ void BKE_ptcache_quick_cache_all(Scene *scene) baker.progresscontext=NULL; baker.render=0; baker.anim_init = 0; + baker.main=bmain; baker.scene=scene; baker.quick_step=scene->physics_settings.quick_cache_step; @@ -2362,6 +2363,7 @@ typedef struct { int endframe; int step; int *cfra_ptr; + Main *main; Scene *scene; } ptcache_make_cache_data; @@ -2369,7 +2371,7 @@ static void *ptcache_make_cache_thread(void *ptr) { ptcache_make_cache_data *data = (ptcache_make_cache_data*)ptr; for(; (*data->cfra_ptr <= data->endframe) && !data->break_operation; *data->cfra_ptr+=data->step) { - scene_update_for_newframe(data->scene, data->scene->lay); + scene_update_for_newframe(data->main, data->scene, data->scene->lay); if(G.background) { printf("bake: frame %d :: %d\n", (int)*data->cfra_ptr, data->endframe); } @@ -2382,6 +2384,7 @@ static void *ptcache_make_cache_thread(void *ptr) { /* if bake is not given run simulations to current frame */ void BKE_ptcache_make_cache(PTCacheBaker* baker) { + Main *bmain = baker->main; Scene *scene = baker->scene; Scene *sce; /* SETLOOPER macro only */ Base *base; @@ -2401,6 +2404,7 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker) thread_data.step = baker->quick_step; thread_data.cfra_ptr = &CFRA; thread_data.scene = baker->scene; + thread_data.main = baker->main; G.afbreek = 0; @@ -2570,7 +2574,7 @@ void BKE_ptcache_make_cache(PTCacheBaker* baker) CFRA = cfrao; if(bake) /* already on cfra unless baking */ - scene_update_for_newframe(scene, scene->lay); + scene_update_for_newframe(bmain, scene, scene->lay); if (thread_data.break_operation) WM_cursor_wait(0); diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index dacf1dd7307..22f19835f5a 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -402,6 +402,7 @@ Scene *add_scene(char *name) sce->toolsettings->jointrilimit = 0.8f; sce->toolsettings->selectmode= SCE_SELECT_VERTEX; + sce->toolsettings->uv_selectmode= UV_SELECT_VERTEX; sce->toolsettings->normalsize= 0.1; sce->toolsettings->autokey_mode= U.autokey_mode; @@ -507,7 +508,7 @@ Base *object_in_scene(Object *ob, Scene *sce) return NULL; } -void set_scene_bg(Scene *scene) +void set_scene_bg(Main *bmain, Scene *scene) { Scene *sce; Base *base; @@ -517,18 +518,18 @@ void set_scene_bg(Scene *scene) int flag; /* check for cyclic sets, for reading old files but also for definite security (py?) */ - scene_check_setscene(scene); + scene_check_setscene(bmain, scene); /* can happen when switching modes in other scenes */ if(scene->obedit && !(scene->obedit->mode & OB_MODE_EDIT)) scene->obedit= NULL; /* deselect objects (for dataselect) */ - for(ob= G.main->object.first; ob; ob= ob->id.next) + for(ob= bmain->object.first; ob; ob= ob->id.next) ob->flag &= ~(SELECT|OB_FROMGROUP); /* group flags again */ - for(group= G.main->group.first; group; group= group->id.next) { + for(group= bmain->group.first; group; group= group->id.next) { go= group->gobject.first; while(go) { if(go->ob) go->ob->flag |= OB_FROMGROUP; @@ -537,12 +538,12 @@ void set_scene_bg(Scene *scene) } /* sort baselist */ - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); /* ensure dags are built for sets */ for(sce= scene->set; sce; sce= sce->set) if(sce->theDag==NULL) - DAG_scene_sort(sce); + DAG_scene_sort(bmain, sce); /* copy layers and flags from bases to objects */ for(base= scene->base.first; base; base= base->next) { @@ -564,11 +565,11 @@ void set_scene_bg(Scene *scene) } /* called from creator.c */ -Scene *set_scene_name(char *name) +Scene *set_scene_name(Main *bmain, char *name) { Scene *sce= (Scene *)find_id("SC", name); if(sce) { - set_scene_bg(sce); + set_scene_bg(bmain, sce); printf("Scene switch: '%s' in file: '%s'\n", name, G.sce); return sce; } @@ -877,7 +878,7 @@ void scene_select_base(Scene *sce, Base *selbase) } /* checks for cycle, returns 1 if it's all OK */ -int scene_check_setscene(Scene *sce) +int scene_check_setscene(Main *bmain, Scene *sce) { Scene *scene; int a, totscene; @@ -885,7 +886,7 @@ int scene_check_setscene(Scene *sce) if(sce->set==NULL) return 1; totscene= 0; - for(scene= G.main->scene.first; scene; scene= scene->id.next) + for(scene= bmain->scene.first; scene; scene= scene->id.next) totscene++; for(a=0, scene=sce; scene->set; scene=scene->set, a++) { @@ -913,14 +914,14 @@ float BKE_curframe(Scene *scene) return ctime; } -static void scene_update_tagged_recursive(Scene *scene, Scene *scene_parent) +static void scene_update_tagged_recursive(Main *bmain, Scene *scene, Scene *scene_parent) { Base *base; /* sets first, we allow per definition current scene to have dependencies on sets, but not the other way around. */ if(scene->set) - scene_update_tagged_recursive(scene->set, scene_parent); + scene_update_tagged_recursive(bmain, scene->set, scene_parent); for(base= scene->base.first; base; base= base->next) { Object *ob= base->object; @@ -936,14 +937,14 @@ static void scene_update_tagged_recursive(Scene *scene, Scene *scene_parent) } /* this is called in main loop, doing tagged updates before redraw */ -void scene_update_tagged(Scene *scene) +void scene_update_tagged(Main *bmain, Scene *scene) { scene->physics_settings.quick_cache_step= 0; /* update all objects: drivers, matrices, displists, etc. flags set by depgraph or manual, no layer check here, gets correct flushed */ - scene_update_tagged_recursive(scene, scene); + scene_update_tagged_recursive(bmain, scene, scene); /* recalc scene animation data here (for sequencer) */ { @@ -955,14 +956,14 @@ void scene_update_tagged(Scene *scene) } if(scene->physics_settings.quick_cache_step) - BKE_ptcache_quick_cache_all(scene); + BKE_ptcache_quick_cache_all(bmain, scene); /* in the future this should handle updates for all datablocks, not only objects and scenes. - brecht */ } /* applies changes right away, does all sets too */ -void scene_update_for_newframe(Scene *sce, unsigned int lay) +void scene_update_for_newframe(Main *bmain, Scene *sce, unsigned int lay) { float ctime = BKE_curframe(sce); Scene *sce_iter; @@ -972,13 +973,13 @@ void scene_update_for_newframe(Scene *sce, unsigned int lay) for(sce_iter= sce; sce_iter; sce_iter= sce_iter->set) { if(sce_iter->theDag==NULL) - DAG_scene_sort(sce_iter); + DAG_scene_sort(bmain, sce_iter); } /* Following 2 functions are recursive * so dont call within 'scene_update_tagged_recursive' */ - DAG_scene_update_flags(sce, lay); // only stuff that moves or needs display still + DAG_scene_update_flags(bmain, sce, lay); // only stuff that moves or needs display still /* All 'standard' (i.e. without any dependencies) animation is handled here, * with an 'local' to 'macro' order of evaluation. This should ensure that @@ -986,11 +987,11 @@ void scene_update_for_newframe(Scene *sce, unsigned int lay) * can be overridden by settings from Scene, which owns the Texture through a hierarchy * such as Scene->World->MTex/Texture) can still get correctly overridden. */ - BKE_animsys_evaluate_all_animation(G.main, ctime); + BKE_animsys_evaluate_all_animation(bmain, ctime); /*...done with recusrive funcs */ /* object_handle_update() on all objects, groups and sets */ - scene_update_tagged_recursive(sce, sce); + scene_update_tagged_recursive(bmain, sce, sce); } /* return default layer, also used to patch old files */ diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c index 0651f1a6261..aab4e1226b2 100644 --- a/source/blender/blenkernel/intern/sequencer.c +++ b/source/blender/blenkernel/intern/sequencer.c @@ -1800,8 +1800,8 @@ static ImBuf * seq_render_scene_strip_impl( { ImBuf * ibuf = 0; float frame= seq->sfra + nr + seq->anim_startofs; - float oldcfra = seq->scene->r.cfra; - Object *oldcamera= seq->scene->camera; + float oldcfra; + Object *oldcamera; ListBase oldmarkers; /* Hack! This function can be called from do_render_seq(), in that case @@ -1820,21 +1820,20 @@ static ImBuf * seq_render_scene_strip_impl( int doseq; int doseq_gl= G.rendering ? /*(scene->r.seq_flag & R_SEQ_GL_REND)*/ 0 : (scene->r.seq_flag & R_SEQ_GL_PREV); int have_seq= FALSE; - Scene *sce= seq->scene;// *oldsce= scene; + Scene *sce= seq->scene; /* dont refer to seq->scene above this point!, it can be NULL */ int sce_valid= FALSE; - have_seq= (sce->r.scemode & R_DOSEQ) - && sce->ed && sce->ed->seqbase.first; - if(sce) { + have_seq= (sce->r.scemode & R_DOSEQ) && sce->ed && sce->ed->seqbase.first; sce_valid= (sce->camera || have_seq); } - if (!sce_valid) { - return 0; - } + if (!sce_valid) + return NULL; + + oldcfra= seq->scene->r.cfra; + oldcamera= seq->scene->camera; - /* prevent eternal loop */ doseq= scene->r.scemode & R_DOSEQ; scene->r.scemode &= ~R_DOSEQ; @@ -1853,7 +1852,7 @@ static ImBuf * seq_render_scene_strip_impl( if(sequencer_view3d_cb && BLI_thread_is_main() && doseq_gl && (seq->scene == scene || have_seq==0) && seq->scene->camera) { /* opengl offscreen render */ - scene_update_for_newframe(seq->scene, seq->scene->lay); + scene_update_for_newframe(G.main, seq->scene, seq->scene->lay); ibuf= sequencer_view3d_cb(seq->scene, seqrectx, seqrecty, scene->r.seq_prev_type); } @@ -1866,7 +1865,7 @@ static ImBuf * seq_render_scene_strip_impl( else re= RE_NewRender(sce->id.name); - RE_BlenderFrame(re, sce, NULL, sce->lay, frame); + RE_BlenderFrame(re, G.main, sce, NULL, sce->lay, frame); RE_AcquireResultImage(re, &rres); @@ -1877,14 +1876,12 @@ static ImBuf * seq_render_scene_strip_impl( addzbuffloatImBuf(ibuf); memcpy(ibuf->zbuf_float, rres.rectz, sizeof(float)*rres.rectx*rres.recty); } - - /* { - ImBuf *imb= IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rectfloat, 0); - IMB_saveiff(imb, "/tmp/foo.image", IB_rect | IB_metadata); - IMB_freeImBuf(imb); - } */ - - } else if (rres.rect32) { + + /* float buffers in the sequencer are not linear */ + ibuf->profile= IB_PROFILE_LINEAR_RGB; + IMB_convert_profile(ibuf, IB_PROFILE_SRGB); + } + else if (rres.rect32) { ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, IB_rect, 0); memcpy(ibuf->rect, rres.rect32, 4*rres.rectx*rres.recty); } diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 2664a20bd18..97eb3aa866c 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -296,7 +296,7 @@ int smokeModifier_init (SmokeModifierData *smd, Object *ob, Scene *scene, Derive return 1; } - return 1; + return 2; } static void fill_scs_points(Object *ob, DerivedMesh *dm, SmokeCollSettings *scs) @@ -935,7 +935,6 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd) // Add emitter density to temp emission map temp_emission_map[index] = sfs->density; - // Uses particle velocity as initial velocity for smoke if(sfs->flags & MOD_SMOKE_FLOW_INITVELOCITY && (psys->part->phystype != PART_PHYS_NO)) { @@ -943,8 +942,6 @@ static void smoke_calc_domain(Scene *scene, Object *ob, SmokeModifierData *smd) velocity_y[index] = pa->state.vel[1]*sfs->vel_multi; velocity_z[index] = pa->state.vel[2]*sfs->vel_multi; } - - } else if(sfs->type & MOD_SMOKE_FLOW_TYPE_OUTFLOW) // outflow { @@ -1328,6 +1325,7 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM int startframe, endframe, framenr; float timescale; int cache_result = 0, cache_result_wt = 0; + int did_init = 0; framenr = scene->r.cfra; @@ -1357,7 +1355,7 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM // printf("startframe: %d, framenr: %d\n", startframe, framenr); - if(!smokeModifier_init(smd, ob, scene, dm)) + if(!(did_init = smokeModifier_init(smd, ob, scene, dm))) { printf("bad smokeModifier_init\n"); return; @@ -1414,8 +1412,18 @@ void smokeModifier_do(SmokeModifierData *smd, Scene *scene, Object *ob, DerivedM smoke_dissolve(sds->fluid, sds->diss_speed, sds->flags & MOD_SMOKE_DISSOLVE_LOG); smoke_step(sds->fluid, smd->time, scene->r.frs_sec / scene->r.frs_sec_base); } + else + { + /* Smoke did not load cache and was not reset but we're on startframe */ + /* So now reinit the smoke since it was not done yet */ + if(did_init == 2) + { + smokeModifier_reset(smd); + smokeModifier_init(smd, ob, scene, dm); + } + } - // create shadows before writing cache so we get nice shadows for sstartframe, too + // create shadows before writing cache so we get nice shadows for startframe, too if(get_lamp(scene, light)) smoke_calc_transparency(sds->shadow, smoke_get_density(sds->fluid), sds->p0, sds->p1, sds->res, sds->dx, light, calc_voxel_transp, -7.0*sds->dx); diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 71c5963c52b..5a6ebb187cf 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -2683,19 +2683,20 @@ void uncomment(Text *text) } } -int setcurr_tab (Text *text) +int setcurr_tab_spaces (Text *text, int space) { int i = 0; int test = 0; - char *word = ":"; - char *comm = "#"; + const char *word = ":"; + const char *comm = "#"; + const char indent= (text->flags & TXT_TABSTOSPACES) ? ' ' : '\t'; static char *back_words[]= {"return", "break", "continue", "pass", "yield", NULL}; if (!text) return 0; if (!text->curl) return 0; - - while (text->curl->line[i] == '\t') + + while (text->curl->line[i] == indent) { - //we only count thos tabs that are before any text or before the curs; + //we only count those tabs/spaces that are before any text or before the curs; if (i == text->curc) { return i; @@ -2718,7 +2719,7 @@ int setcurr_tab (Text *text) } } if (indent) { - i++; + i += space; } } @@ -2729,7 +2730,7 @@ int setcurr_tab (Text *text) { if(strcspn(text->curl->line, back_words[test]) < strcspn(text->curl->line, comm)) { - i--; + i -= space; } } } diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index 57816b7e470..d05d8ccbc08 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -403,6 +403,73 @@ void colorband_table_RGBA(ColorBand *coba, float **array, int *size) do_colorband(coba, (float)a/(float)CM_TABLE, &(*array)[a*4]); } +int vergcband(const void *a1, const void *a2) +{ + const CBData *x1=a1, *x2=a2; + + if( x1->pos > x2->pos ) return 1; + else if( x1->pos < x2->pos) return -1; + return 0; +} + +CBData *colorband_element_add(struct ColorBand *coba, float position) +{ + int a; + + if(coba->tot==MAXCOLORBAND) { + return NULL; + } + else if(coba->tot > 0) { + CBData *xnew; + float col[4]; + + do_colorband(coba, position, col); + + xnew = &coba->data[coba->tot]; + xnew->pos = position; + + xnew->r = col[0]; + xnew->g = col[1]; + xnew->b = col[2]; + xnew->a = col[3]; + } + + coba->tot++; + coba->cur = coba->tot-1; + + for(a = 0; a < coba->tot; a++) + coba->data[a].cur = a; + + qsort(coba->data, coba->tot, sizeof(CBData), vergcband); + + for(a = 0; a < coba->tot; a++) { + if(coba->data[a].cur == coba->cur) { + coba->cur = a; + break; + } + } + + return coba->data + coba->cur; +} + +int colorband_element_remove(struct ColorBand *coba, int index) +{ + int a; + + if(coba->tot < 2) + return 0; + + if(index < 0 || index >= coba->tot) + return 0; + + for(a = index; a < coba->tot; a++) { + coba->data[a] = coba->data[a + 1]; + } + if(coba->cur) coba->cur--; + coba->tot--; + return 1; +} + /* ******************* TEX ************************ */ void free_texture(Tex *tex) diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index f6b8ab461d7..019cb2fa3d6 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -11219,10 +11219,6 @@ static void do_versions(FileData *fd, Library *lib, Main *main) if((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain) { - GroupObject *go = NULL; - Base *base = NULL; - Scene *scene = NULL; - smd->domain->vorticity = 2.0f; smd->domain->time_scale = 1.0f; @@ -12573,9 +12569,7 @@ static void append_do_cursor(Scene *scene, Library *curlib, short flag) return; /* move from the center of the appended objects to cursor */ - centerloc[0]= (min[0]+max[0])/2; - centerloc[1]= (min[1]+max[1])/2; - centerloc[2]= (min[2]+max[2])/2; + mid_v3_v3v3(centerloc, min, max); curs = scene->cursor; VECSUB(centerloc,curs,centerloc); @@ -12678,7 +12672,7 @@ void BLO_script_library_append(BlendHandle **bh, char *dir, char *name, /* do we need to do this? */ if(scene) - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); *bh= (BlendHandle*)fd; } diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index a415b90ff08..b9052d23511 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -216,6 +216,7 @@ static int set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space return false; Object workob; + Main *bmain = CTX_data_main(C); Scene *sce = CTX_data_scene(C); ob->parent = par; @@ -243,8 +244,8 @@ static int set_parent(Object *ob, Object *par, bContext *C, bool is_parent_space ob->recalc |= OB_RECALC_OB | OB_RECALC_DATA; par->recalc |= OB_RECALC_OB; - DAG_scene_sort(sce); - DAG_ids_flush_update(0); + DAG_scene_sort(bmain, sce); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); return true; @@ -611,9 +612,10 @@ private: void link_armature(bContext *C, Object *ob, std::map<COLLADAFW::UniqueId, COLLADAFW::Node*>& joint_by_uid, TransformReader *tm) { + Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); - ModifierData *md = ED_object_modifier_add(NULL, scene, ob, NULL, eModifierType_Armature); + ModifierData *md = ED_object_modifier_add(NULL, bmain, scene, ob, NULL, eModifierType_Armature); ((ArmatureModifierData *)md)->object = ob_arm; copy_m4_m4(ob->obmat, bind_shape_matrix); @@ -630,8 +632,8 @@ private: ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA; - DAG_scene_sort(scene); - DAG_ids_flush_update(0); + DAG_scene_sort(bmain, scene); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); #endif @@ -3132,7 +3134,7 @@ public: where_is_object(scene, job); // after parenting and layer change - DAG_scene_sort(scene); + DAG_scene_sort(CTX_data_main(C), scene); joint_objects[node->getUniqueId()] = job; } diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c index 3fc228e1c15..9edcf637cdc 100644 --- a/source/blender/editors/animation/drivers.c +++ b/source/blender/editors/animation/drivers.c @@ -389,7 +389,7 @@ static int add_driver_button_exec (bContext *C, wmOperator *op) if (success) { /* send updates */ - DAG_ids_flush_update(0); + DAG_ids_flush_update(CTX_data_main(C), 0); WM_event_add_notifier(C, NC_ANIMATION|ND_FCURVES_ORDER, NULL); // XXX } @@ -440,7 +440,7 @@ static int remove_driver_button_exec (bContext *C, wmOperator *op) if (success) { /* send updates */ - DAG_ids_flush_update(0); + DAG_ids_flush_update(CTX_data_main(C), 0); WM_event_add_notifier(C, NC_ANIMATION|ND_FCURVES_ORDER, NULL); // XXX } diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index f60181d7f6c..ea20a5c2c88 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -51,6 +51,7 @@ #include "BKE_constraint.h" #include "BKE_depsgraph.h" #include "BKE_fcurve.h" +#include "BKE_main.h" #include "BKE_nla.h" #include "BKE_global.h" #include "BKE_utildefines.h" @@ -1060,6 +1061,7 @@ static int modify_key_op_poll(bContext *C) static int insert_key_exec (bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); KeyingSet *ks= NULL; int type= RNA_int_get(op->ptr, "type"); @@ -1106,7 +1108,7 @@ static int insert_key_exec (bContext *C, wmOperator *op) BKE_report(op->reports, RPT_WARNING, "Keying Set failed to insert any keyframes"); /* send updates */ - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); return OPERATOR_FINISHED; } @@ -1202,6 +1204,7 @@ void ANIM_OT_keyframe_insert_menu (wmOperatorType *ot) static int delete_key_exec (bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); KeyingSet *ks= NULL; int type= RNA_int_get(op->ptr, "type"); @@ -1248,7 +1251,7 @@ static int delete_key_exec (bContext *C, wmOperator *op) BKE_report(op->reports, RPT_WARNING, "Keying Set failed to remove any keyframes"); /* send updates */ - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); return OPERATOR_FINISHED; } @@ -1287,6 +1290,7 @@ void ANIM_OT_keyframe_delete (wmOperatorType *ot) static int delete_key_v3d_exec (bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); float cfra= (float)CFRA; // XXX for now, don't bother about all the yucky offset crap @@ -1315,7 +1319,7 @@ static int delete_key_v3d_exec (bContext *C, wmOperator *op) CTX_DATA_END; /* send updates */ - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, NULL); @@ -1343,6 +1347,7 @@ void ANIM_OT_keyframe_delete_v3d (wmOperatorType *ot) static int insert_key_button_exec (bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); PointerRNA ptr; PropertyRNA *prop= NULL; @@ -1400,7 +1405,7 @@ static int insert_key_button_exec (bContext *C, wmOperator *op) if (success) { /* send updates */ - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); /* send notifiers that keyframes have been changed */ WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); @@ -1430,6 +1435,7 @@ void ANIM_OT_keyframe_insert_button (wmOperatorType *ot) static int delete_key_button_exec (bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); PointerRNA ptr; PropertyRNA *prop= NULL; @@ -1470,7 +1476,7 @@ static int delete_key_button_exec (bContext *C, wmOperator *op) if (success) { /* send updates */ - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); /* send notifiers that keyframes have been changed */ WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL); diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index 301111d22fd..033c4713e01 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -289,6 +289,7 @@ void ANIM_OT_keying_set_path_remove (wmOperatorType *ot) static int add_keyingset_button_exec (bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); KeyingSet *ks = NULL; PropertyRNA *prop= NULL; @@ -359,7 +360,7 @@ static int add_keyingset_button_exec (bContext *C, wmOperator *op) if (success) { /* send updates */ - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); /* for now, only send ND_KEYS for KeyingSets */ WM_event_add_notifier(C, NC_SCENE|ND_KEYINGSET, NULL); @@ -389,6 +390,7 @@ void ANIM_OT_keyingset_button_add (wmOperatorType *ot) static int remove_keyingset_button_exec (bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); KeyingSet *ks = NULL; PropertyRNA *prop= NULL; @@ -441,7 +443,7 @@ static int remove_keyingset_button_exec (bContext *C, wmOperator *op) if (success) { /* send updates */ - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); /* for now, only send ND_KEYS for KeyingSets */ WM_event_add_notifier(C, NC_SCENE|ND_KEYINGSET, NULL); diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 5386dbc8b98..3b5c07a8001 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -421,37 +421,45 @@ void ED_armature_apply_transform(Object *ob, float mat[4][4]) /* exported for use in editors/object/ */ /* 0 == do center, 1 == center new, 2 == center cursor */ -void docenter_armature (Scene *scene, View3D *v3d, Object *ob, int centermode) +void docenter_armature (Scene *scene, Object *ob, float cursor[3], int centermode, int around) { Object *obedit= scene->obedit; // XXX get from context EditBone *ebone; bArmature *arm= ob->data; - float cent[3] = {0.0f, 0.0f, 0.0f}; - float min[3], max[3]; - float omat[3][3]; + float cent[3]; /* Put the armature into editmode */ - if(ob!=obedit) + if(ob != obedit) { ED_armature_to_edit(ob); + obedit= NULL; /* we cant use this so behave as if there is no obedit */ + } /* Find the centerpoint */ if (centermode == 2) { - float *fp= give_cursor(scene, v3d); - VECCOPY(cent, fp); + copy_v3_v3(cent, cursor); invert_m4_m4(ob->imat, ob->obmat); mul_m4_v3(ob->imat, cent); } else { - INIT_MINMAX(min, max); - - for (ebone= arm->edbo->first; ebone; ebone=ebone->next) { - DO_MINMAX(ebone->head, min, max); - DO_MINMAX(ebone->tail, min, max); + if(around==V3D_CENTROID) { + int total= 0; + zero_v3(cent); + for (ebone= arm->edbo->first; ebone; ebone=ebone->next) { + total+=2; + add_v3_v3(cent, ebone->head); + add_v3_v3(cent, ebone->tail); + } + mul_v3_fl(cent, 1.0f/(float)total); + } + else { + float min[3], max[3]; + INIT_MINMAX(min, max); + for (ebone= arm->edbo->first; ebone; ebone=ebone->next) { + DO_MINMAX(ebone->head, min, max); + DO_MINMAX(ebone->tail, min, max); + } + mid_v3_v3v3(cent, min, max); } - - cent[0]= (min[0] + max[0]) / 2.0f; - cent[1]= (min[1] + max[1]) / 2.0f; - cent[2]= (min[2] + max[2]) / 2.0f; } /* Do the adjustments */ @@ -461,17 +469,16 @@ void docenter_armature (Scene *scene, View3D *v3d, Object *ob, int centermode) } /* Turn the list into an armature */ - ED_armature_from_edit(ob); - + if(obedit==NULL) { + ED_armature_from_edit(ob); + ED_armature_edit_free(ob); + } + /* Adjust object location for new centerpoint */ if(centermode && obedit==NULL) { - copy_m3_m4(omat, ob->obmat); - - mul_m3_v3(omat, cent); + mul_mat3_m4_v3(ob->obmat, cent); /* ommit translation part */ add_v3_v3(ob->loc, cent); } - else - ED_armature_edit_free(ob); } /* ---------------------- */ @@ -802,6 +809,7 @@ static void joined_armature_fix_links(Object *tarArm, Object *srcArm, bPoseChann /* join armature exec is exported for use in object->join objects operator... */ int join_armature_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); bArmature *arm= (ob)? ob->data: NULL; @@ -894,12 +902,12 @@ int join_armature_exec(bContext *C, wmOperator *op) free_pose_channels_hash(pose); } - ED_base_object_free_and_unlink(scene, base); + ED_base_object_free_and_unlink(bmain, scene, base); } } CTX_DATA_END; - DAG_scene_sort(scene); // because we removed object(s) + DAG_scene_sort(bmain, scene); // because we removed object(s) ED_armature_from_edit(ob); ED_armature_edit_free(ob); @@ -1111,6 +1119,7 @@ static void separate_armature_bones (Scene *scene, Object *ob, short sel) /* separate selected bones into their armature */ static int separate_armature_exec (bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); Object *oldob, *newob; @@ -1151,7 +1160,7 @@ static int separate_armature_exec (bContext *C, wmOperator *op) ED_armature_edit_free(obedit); /* 2) duplicate base */ - newbase= ED_object_add_duplicate(scene, oldbase, USER_DUP_ARM); /* only duplicate linked armature */ + newbase= ED_object_add_duplicate(bmain, scene, oldbase, USER_DUP_ARM); /* only duplicate linked armature */ newob= newbase->object; newbase->flag &= ~SELECT; @@ -1752,9 +1761,8 @@ EditBone *ED_armature_bone_get_mirrored(ListBase *edbo, EditBone *ebo) if (ebo == NULL) return NULL; - - BLI_strncpy(name, ebo->name, sizeof(name)); - bone_flip_name(name, 0); // 0 = don't strip off number extensions + + flip_side_name(name, ebo->name, FALSE); for (eboflip= edbo->first; eboflip; eboflip=eboflip->next) { if (ebo != eboflip) { @@ -2023,7 +2031,6 @@ void ED_armature_edit_free(struct Object *ob) BLI_freelistN(arm->edbo); } - MEM_freeN(arm->edbo); arm->edbo= NULL; } @@ -4741,11 +4748,10 @@ void add_verts_to_dgroups(Scene *scene, Object *ob, Object *par, int heat, int m /* find flipped group */ if (dgroup && mirror) { char name[32]; - - BLI_strncpy(name, dgroup->name, 32); + // 0 = don't strip off number extensions - bone_flip_name(name, 0); - + flip_side_name(name, dgroup->name, FALSE); + for (curdg = ob->defbase.first; curdg; curdg=curdg->next) { if (!strcmp(curdg->name, name)) break; @@ -5540,8 +5546,7 @@ static int armature_flip_names_exec (bContext *C, wmOperator *op) /* loop through selected bones, auto-naming them */ CTX_DATA_BEGIN(C, EditBone *, ebone, selected_editable_bones) { - BLI_strncpy(newname, ebone->name, sizeof(newname)); - bone_flip_name(newname, 1); // 1 = do strip off number extensions + flip_side_name(newname, ebone->name, TRUE); // 1 = do strip off number extensions ED_armature_bone_rename(arm, ebone->name, newname); } CTX_DATA_END; diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 6b71ed1ca7a..633b0b48a38 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -897,7 +897,6 @@ static int pose_paste_exec (bContext *C, wmOperator *op) Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); bPoseChannel *chan, *pchan; - char name[32]; int flip= RNA_boolean_get(op->ptr, "flipped"); /* sanity checks */ @@ -913,10 +912,12 @@ static int pose_paste_exec (bContext *C, wmOperator *op) for (chan= g_posebuf->chanbase.first; chan; chan=chan->next) { if (chan->flag & POSE_KEY) { /* get the name - if flipping, we must flip this first */ - BLI_strncpy(name, chan->name, sizeof(name)); + char name[32]; if (flip) - bone_flip_name(name, 0); /* 0 = don't strip off number extensions */ - + flip_side_name(name, chan->name, 0); /* 0 = don't strip off number extensions */ + else + BLI_strncpy(name, chan->name, sizeof(name)); + /* only copy when channel exists, poses are not meant to add random channels to anymore */ pchan= get_pose_channel(ob->pose, name); @@ -1431,7 +1432,6 @@ static int pose_flip_names_exec (bContext *C, wmOperator *op) { Object *ob= CTX_data_active_object(C); bArmature *arm; - char newname[32]; /* paranoia checks */ if (ELEM(NULL, ob, ob->pose)) @@ -1441,8 +1441,8 @@ static int pose_flip_names_exec (bContext *C, wmOperator *op) /* loop through selected bones, auto-naming them */ CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones) { - BLI_strncpy(newname, pchan->name, sizeof(newname)); - bone_flip_name(newname, 1); // 1 = do strip off number extensions + char newname[32]; + flip_side_name(newname, pchan->name, TRUE); ED_armature_bone_rename(arm, pchan->name, newname); } CTX_DATA_END; @@ -1546,10 +1546,8 @@ void pose_activate_flipped_bone(Scene *scene) if(arm->act_bone) { char name[32]; - - BLI_strncpy(name, arm->act_bone->name, 32); - bone_flip_name(name, 1); // 0 = do not strip off number extensions - + flip_side_name(name, arm->act_bone->name, TRUE); + pchanf= get_pose_channel(ob->pose, name); if(pchanf && pchanf->bone != arm->act_bone) { arm->act_bone->flag &= ~BONE_SELECTED; diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c index d650cecdc3e..47b1fee3cf6 100644 --- a/source/blender/editors/curve/curve_ops.c +++ b/source/blender/editors/curve/curve_ops.c @@ -233,6 +233,6 @@ void ED_keymap_curve(wmKeyConfig *keyconf) /* menus */ WM_keymap_add_menu(keymap, "VIEW3D_MT_hook", HKEY, KM_PRESS, KM_CTRL, 0); - ED_object_generic_keymap(keyconf, keymap, 2); + ED_object_generic_keymap(keyconf, keymap, 3); } diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index d38c91da5c5..16204e9f199 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -1119,6 +1119,7 @@ void CU_select_swap(Object *obedit) static int separate_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Nurb *nu, *nu1; Object *oldob, *newob; @@ -1139,7 +1140,7 @@ static int separate_exec(bContext *C, wmOperator *op) WM_cursor_wait(1); /* 1. duplicate the object and data */ - newbase= ED_object_add_duplicate(scene, oldbase, 0); /* 0 = fully linked */ + newbase= ED_object_add_duplicate(bmain, scene, oldbase, 0); /* 0 = fully linked */ ED_base_object_select(newbase, BA_DESELECT); newob= newbase->object; @@ -5543,6 +5544,7 @@ void CURVE_OT_shade_flat(wmOperatorType *ot) int join_curve_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); Curve *cu; @@ -5594,7 +5596,7 @@ int join_curve_exec(bContext *C, wmOperator *op) } } - ED_base_object_free_and_unlink(scene, base); + ED_base_object_free_and_unlink(bmain, scene, base); } } } @@ -5603,7 +5605,7 @@ int join_curve_exec(bContext *C, wmOperator *op) cu= ob->data; addlisttolist(&cu->nurb, &tempbase); - DAG_scene_sort(scene); // because we removed object(s), call before editmode! + DAG_scene_sort(bmain, scene); // because we removed object(s), call before editmode! ED_object_enter_editmode(C, EM_WAITCURSOR); ED_object_exit_editmode(C, EM_FREEDATA|EM_WAITCURSOR|EM_DO_UNDO); diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h index d2d1e2a1d69..52db36e188d 100644 --- a/source/blender/editors/include/ED_armature.h +++ b/source/blender/editors/include/ED_armature.h @@ -120,7 +120,7 @@ void ED_armature_edit_bone_remove(struct bArmature *arm, EditBone *exBone); void transform_armature_mirror_update(struct Object *obedit); void clear_armature(struct Scene *scene, struct Object *ob, char mode); -void docenter_armature (struct Scene *scene, struct View3D *v3d, struct Object *ob, int centermode); +void docenter_armature (struct Scene *scene, struct Object *ob, float cursor[3], int centermode, int around); void ED_armature_apply_transform(struct Object *ob, float mat[4][4]); diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index a03cd135f1c..f243b4cc497 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -28,24 +28,25 @@ #ifndef ED_OBJECT_H #define ED_OBJECT_H -struct wmKeyConfig; -struct wmKeyMap; -struct Scene; -struct Object; -struct bContext; struct Base; -struct View3D; struct bConstraint; +struct bContext; struct bPoseChannel; +struct Curve; struct KeyBlock; struct Lattice; +struct Main; struct Mesh; -struct Curve; -struct ReportList; struct ModifierData; -struct wmOperatorType; -struct wmOperator; +struct Object; +struct ReportList; +struct Scene; +struct View3D; struct wmEvent; +struct wmKeyConfig; +struct wmKeyMap; +struct wmOperator; +struct wmOperatorType; /* object_edit.c */ struct Object *ED_object_active_context(struct bContext *C); @@ -55,7 +56,13 @@ void ED_operatortypes_object(void); void ED_operatormacros_object(void); void ED_keymap_object(struct wmKeyConfig *keyconf); -/* generic editmode keys like pet */ +/* generic editmode keys like pet + * do_pet + * 0: No + * 1: Object + * 2: Edit + * 3: Edit with connected + * */ void ED_object_generic_keymap(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap, int do_pet); /* send your own notifier for select! */ @@ -63,10 +70,10 @@ void ED_base_object_select(struct Base *base, short mode); /* includes notifier */ void ED_base_object_activate(struct bContext *C, struct Base *base); -void ED_base_object_free_and_unlink(struct Scene *scene, struct Base *base); +void ED_base_object_free_and_unlink(struct Main *bmain, struct Scene *scene, struct Base *base); /* single object duplicate, if dupflag==0, fully linked, else it uses the flags given */ -struct Base *ED_object_add_duplicate(struct Scene *scene, struct Base *base, int dupflag); +struct Base *ED_object_add_duplicate(struct Main *bmain, struct Scene *scene, struct Base *base, int dupflag); void ED_object_parent(struct Object *ob, struct Object *parent, int type, const char *substr); @@ -91,7 +98,7 @@ int ED_object_add_generic_invoke(struct bContext *C, struct wmOperator *op, stru int ED_object_add_generic_get_opts(struct bContext *C, struct wmOperator *op, float *loc, float *rot, int *enter_editmode, unsigned int *layer); struct Object *ED_object_add_type(struct bContext *C, int type, float *loc, float *rot, int enter_editmode, unsigned int layer); -void ED_object_single_users(struct Scene *scene, int full); +void ED_object_single_users(struct Main *bmain, struct Scene *scene, int full); /* cleanup */ int object_is_libdata(struct Object *ob); @@ -110,7 +117,7 @@ void object_test_constraints(struct Object *ob); void ED_object_constraint_set_active(struct Object *ob, struct bConstraint *con); void ED_object_constraint_update(struct Object *ob); -void ED_object_constraint_dependency_update(struct Scene *scene, struct Object *ob); +void ED_object_constraint_dependency_update(struct Main *bmain, struct Scene *scene, struct Object *ob); /* object_lattice.c */ int mouse_lattice(struct bContext *C, short mval[2], int extend); @@ -126,11 +133,11 @@ enum { MODIFIER_APPLY_SHAPE, } eModifier_Apply_Mode; -struct ModifierData *ED_object_modifier_add(struct ReportList *reports, struct Scene *scene, struct Object *ob, char *name, int type); -int ED_object_modifier_remove(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct ModifierData *md); +struct ModifierData *ED_object_modifier_add(struct ReportList *reports, struct Main *bmain, struct Scene *scene, struct Object *ob, char *name, int type); +int ED_object_modifier_remove(struct ReportList *reports, struct Main *bmain, struct Scene *scene, struct Object *ob, struct ModifierData *md); int ED_object_modifier_move_down(struct ReportList *reports, struct Object *ob, struct ModifierData *md); int ED_object_modifier_move_up(struct ReportList *reports, struct Object *ob, struct ModifierData *md); -int ED_object_modifier_convert(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct ModifierData *md); +int ED_object_modifier_convert(struct ReportList *reports, struct Main *bmain, struct Scene *scene, struct Object *ob, struct ModifierData *md); int ED_object_modifier_apply(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct ModifierData *md, int mode); int ED_object_modifier_copy(struct ReportList *reports, struct Object *ob, struct ModifierData *md); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 7b67a458ae2..38c11e507cc 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1644,7 +1644,7 @@ int ui_set_but_string(bContext *C, uiBut *but, const char *str) value= atof(str); #endif - if(!ui_is_but_float(but)) value= (int)value; + if(!ui_is_but_float(but)) value= (int)floor(value + 0.5); if(but->type==NUMABS) value= fabs(value); /* not that we use hard limits here */ diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 0f8f84b94dc..f617cc4ae8d 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3251,24 +3251,8 @@ static int ui_do_but_COLORBAND(bContext *C, uiBlock *block, uiBut *but, uiHandle if(event->ctrl) { /* insert new key on mouse location */ - if(coba->tot < MAXCOLORBAND-1) { - float pos= ((float)(mx - but->x1))/(but->x2-but->x1); - float col[4]; - - do_colorband(coba, pos, col); /* executes it */ - - coba->tot++; - coba->cur= coba->tot-1; - - coba->data[coba->cur].r= col[0]; - coba->data[coba->cur].g= col[1]; - coba->data[coba->cur].b= col[2]; - coba->data[coba->cur].a= col[3]; - coba->data[coba->cur].pos= pos; - - ui_colorband_update(coba); - } - + float pos= ((float)(mx - but->x1))/(but->x2-but->x1); + colorband_element_add(coba, pos); button_activate_state(C, but, BUTTON_STATE_EXIT); } else { diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index c2bcc673c1e..c56b3c31222 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -1111,13 +1111,23 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, char *str, ui if(itemptr.data == but->rnapoin.id.data) continue; - if(itemptr.type && RNA_struct_is_ID(itemptr.type)) - iconid= ui_id_icon_get((bContext*)C, itemptr.data, 1); - else + if(itemptr.type && RNA_struct_is_ID(itemptr.type)) { + ID *id= itemptr.data; + char name_ui[32]; + +#if 0 /* this name is used for a string comparison and can't be modified, TODO */ + name_uiprefix_id(name_ui, id); +#else + strcpy(name_ui, id->name+2); +#endif + name= BLI_strdup(name_ui); + iconid= ui_id_icon_get((bContext*)C, id, 1); + } + else { + name= RNA_struct_name_get_alloc(&itemptr, NULL, 0); iconid = 0; - - name= RNA_struct_name_get_alloc(&itemptr, NULL, 0); - + } + if(name) { if(BLI_strcasestr(name, str)) { cis = MEM_callocN(sizeof(CollItemSearch), "CollectionItemSearch"); @@ -1126,9 +1136,9 @@ static void rna_search_cb(const struct bContext *C, void *arg_but, char *str, ui cis->iconid = iconid; BLI_addtail(items_list, cis); } - MEM_freeN(name); - } - + MEM_freeN(name); + } + i++; } RNA_PROP_END; diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 4c7747a57ac..773e9ddc2d4 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -220,9 +220,12 @@ static void id_search_cb(const bContext *C, void *arg_template, char *str, uiSea continue; if(BLI_strcasestr(id->name+2, str)) { + char name_ui[32]; + name_uiprefix_id(name_ui, id); + iconid= ui_id_icon_get((bContext*)C, id, 1); - if(!uiSearchItemAdd(items, id->name+2, id, iconid)) + if(!uiSearchItemAdd(items, name_ui, id, iconid)) break; } } @@ -960,6 +963,7 @@ uiLayout *uiTemplateModifier(uiLayout *layout, bContext *C, PointerRNA *ptr, int void do_constraint_panels(bContext *C, void *arg, int event) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); @@ -971,7 +975,7 @@ void do_constraint_panels(bContext *C, void *arg, int event) break; // no handling case B_CONSTRAINT_CHANGETARGET: if (ob->pose) ob->pose->flag |= POSE_RECALC; // checks & sorts pose channels - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); break; default: break; @@ -1304,89 +1308,30 @@ static void rna_update_cb(bContext *C, void *arg_cb, void *arg_unused) #define B_BANDCOL 1 -static int vergcband(const void *a1, const void *a2) -{ - const CBData *x1=a1, *x2=a2; - - if( x1->pos > x2->pos ) return 1; - else if( x1->pos < x2->pos) return -1; - return 0; -} - -static void colorband_pos_cb(bContext *C, void *cb_v, void *coba_v) -{ - ColorBand *coba= coba_v; - int a; - - if(coba->tot<2) return; - - for(a=0; a<coba->tot; a++) coba->data[a].cur= a; - qsort(coba->data, coba->tot, sizeof(CBData), vergcband); - for(a=0; a<coba->tot; a++) { - if(coba->data[a].cur==coba->cur) { - coba->cur= a; - break; - } - } - - rna_update_cb(C, cb_v, NULL); -} - static void colorband_add_cb(bContext *C, void *cb_v, void *coba_v) { ColorBand *coba= coba_v; + float pos= 0.5f; - if(coba->tot > 0) { - CBData *xnew, *x1, *x2; - float col[4]; - - xnew= &coba->data[coba->tot]; - - if(coba->tot > 1) { - if(coba->cur > 0) { - x1= &coba->data[coba->cur-1]; - x2= &coba->data[coba->cur]; - } - else { - x1= &coba->data[coba->cur]; - x2= &coba->data[coba->cur+1]; - } - - xnew->pos = x1->pos + ((x2->pos - x1->pos) / 2); - } - - do_colorband(coba, xnew->pos, col); - - xnew->r= col[0]; - xnew->g= col[1]; - xnew->b= col[2]; - xnew->a= col[3]; + if(coba->tot > 1) { + if(coba->cur > 0) pos= (coba->data[coba->cur-1].pos + coba->data[coba->cur].pos) * 0.5f; + else pos= (coba->data[coba->cur+1].pos + coba->data[coba->cur].pos) * 0.5f; } - if(coba->tot < MAXCOLORBAND-1) coba->tot++; - coba->cur= coba->tot-1; - - colorband_pos_cb(C, cb_v, coba_v); - - ED_undo_push(C, "Add colorband"); + if(colorband_element_add(coba, pos)) { + rna_update_cb(C, cb_v, NULL); + ED_undo_push(C, "Add colorband"); + } } static void colorband_del_cb(bContext *C, void *cb_v, void *coba_v) { ColorBand *coba= coba_v; - int a; - if(coba->tot<2) return; - - for(a=coba->cur; a<coba->tot; a++) { - coba->data[a]= coba->data[a+1]; + if(colorband_element_remove(coba, coba->cur)) { + ED_undo_push(C, "Delete colorband"); + rna_update_cb(C, cb_v, NULL); } - if(coba->cur) coba->cur--; - coba->tot--; - - ED_undo_push(C, "Delete colorband"); - - rna_update_cb(C, cb_v, NULL); } static void colorband_flip_cb(bContext *C, void *cb_v, void *coba_v) @@ -1749,7 +1694,7 @@ static void curvemap_tools_dofunc(bContext *C, void *cumap_v, int event) switch(event) { case 0: /* reset */ - curvemap_reset(cuma, &cumap->clipr, cumap->preset); + curvemap_reset(cuma, &cumap->clipr, cumap->preset, CURVEMAP_SLOPE_POSITIVE); curvemapping_changed(cumap, 0); break; case 1: @@ -1829,7 +1774,7 @@ static void curvemap_buttons_reset(bContext *C, void *cb_v, void *cumap_v) cumap->preset = CURVE_PRESET_LINE; for(a=0; a<CM_TOT; a++) - curvemap_reset(cumap->cm+a, &cumap->clipr, cumap->preset); + curvemap_reset(cumap->cm+a, &cumap->clipr, cumap->preset, CURVEMAP_SLOPE_POSITIVE); cumap->black[0]=cumap->black[1]=cumap->black[2]= 0.0f; cumap->white[0]=cumap->white[1]=cumap->white[2]= 1.0f; diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 3f943f7b1b0..4b02e4b1e65 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -979,6 +979,7 @@ void UI_make_axis_color(char *src_col, char *dst_col, char axis) /* patching UserDef struct and Themes */ void init_userdef_do_versions(void) { + Main *bmain= G.main; // countall(); /* the UserDef struct is not corrected with do_versions() .... ugh! */ @@ -1013,18 +1014,18 @@ void init_userdef_do_versions(void) if(U.flag & USER_CUSTOM_RANGE) vDM_ColorBand_store(&U.coba_weight); /* signal for derivedmesh to use colorband */ - if (G.main->versionfile <= 191) { + if (bmain->versionfile <= 191) { strcpy(U.plugtexdir, U.textudir); strcpy(U.sounddir, "/"); } /* patch to set Dupli Armature */ - if (G.main->versionfile < 220) { + if (bmain->versionfile < 220) { U.dupflag |= USER_DUP_ARM; } /* added seam, normal color, undo */ - if (G.main->versionfile <= 234) { + if (bmain->versionfile <= 234) { bTheme *btheme; U.uiflag |= USER_GLOBALUNDO; @@ -1047,12 +1048,12 @@ void init_userdef_do_versions(void) } } } - if (G.main->versionfile <= 235) { + if (bmain->versionfile <= 235) { /* illegal combo... */ if (U.flag & USER_LMOUSESELECT) U.flag &= ~USER_TWOBUTTONMOUSE; } - if (G.main->versionfile <= 236) { + if (bmain->versionfile <= 236) { bTheme *btheme; /* new space type */ for(btheme= U.themes.first; btheme; btheme= btheme->next) { @@ -1069,7 +1070,7 @@ void init_userdef_do_versions(void) } } } - if (G.main->versionfile <= 237) { + if (bmain->versionfile <= 237) { bTheme *btheme; /* bone colors */ for(btheme= U.themes.first; btheme; btheme= btheme->next) { @@ -1080,7 +1081,7 @@ void init_userdef_do_versions(void) } } } - if (G.main->versionfile <= 238) { + if (bmain->versionfile <= 238) { bTheme *btheme; /* bone colors */ for(btheme= U.themes.first; btheme; btheme= btheme->next) { @@ -1091,7 +1092,7 @@ void init_userdef_do_versions(void) } } } - if (G.main->versionfile <= 239) { + if (bmain->versionfile <= 239) { bTheme *btheme; for(btheme= U.themes.first; btheme; btheme= btheme->next) { @@ -1105,7 +1106,7 @@ void init_userdef_do_versions(void) } if(U.obcenter_dia==0) U.obcenter_dia= 6; } - if (G.main->versionfile <= 241) { + if (bmain->versionfile <= 241) { bTheme *btheme; for(btheme= U.themes.first; btheme; btheme= btheme->next) { /* Node editor theme, check for alpha==0 is safe, then color was never set */ @@ -1146,7 +1147,7 @@ void init_userdef_do_versions(void) } } - if (G.main->versionfile <= 242) { + if (bmain->versionfile <= 242) { bTheme *btheme; for(btheme= U.themes.first; btheme; btheme= btheme->next) { @@ -1164,11 +1165,11 @@ void init_userdef_do_versions(void) } } } - if (G.main->versionfile <= 243) { + if (bmain->versionfile <= 243) { /* set default number of recently-used files (if not set) */ if (U.recent_files == 0) U.recent_files = 10; } - if (G.main->versionfile < 245 || (G.main->versionfile == 245 && G.main->subversionfile < 3)) { + if (bmain->versionfile < 245 || (bmain->versionfile == 245 && bmain->subversionfile < 3)) { bTheme *btheme; for(btheme= U.themes.first; btheme; btheme= btheme->next) { SETCOL(btheme->tv3d.editmesh_active, 255, 255, 255, 128); @@ -1176,7 +1177,7 @@ void init_userdef_do_versions(void) if(U.coba_weight.tot==0) init_colorband(&U.coba_weight, 1); } - if ((G.main->versionfile < 245) || (G.main->versionfile == 245 && G.main->subversionfile < 11)) { + if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 11)) { bTheme *btheme; for (btheme= U.themes.first; btheme; btheme= btheme->next) { /* these should all use the same colour */ @@ -1189,7 +1190,7 @@ void init_userdef_do_versions(void) SETCOL(btheme->ttime.cframe, 0x60, 0xc0, 0x40, 255); } } - if ((G.main->versionfile < 245) || (G.main->versionfile == 245 && G.main->subversionfile < 13)) { + if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 13)) { bTheme *btheme; for (btheme= U.themes.first; btheme; btheme= btheme->next) { /* action channel groups (recolor anyway) */ @@ -1262,10 +1263,10 @@ void init_userdef_do_versions(void) } } } - if ((G.main->versionfile < 245) || (G.main->versionfile == 245 && G.main->subversionfile < 16)) { + if ((bmain->versionfile < 245) || (bmain->versionfile == 245 && bmain->subversionfile < 16)) { U.flag |= USER_ADD_VIEWALIGNED|USER_ADD_EDITMODE; } - if ((G.main->versionfile < 247) || (G.main->versionfile == 247 && G.main->subversionfile <= 2)) { + if ((bmain->versionfile < 247) || (bmain->versionfile == 247 && bmain->subversionfile <= 2)) { bTheme *btheme; /* adjust themes */ @@ -1287,7 +1288,7 @@ void init_userdef_do_versions(void) SETCOL(btheme->tseq.vertex_select, col[0], col[1], col[2], 255); } } - if (G.main->versionfile < 250) { + if (bmain->versionfile < 250) { bTheme *btheme; for(btheme= U.themes.first; btheme; btheme= btheme->next) { @@ -1328,7 +1329,7 @@ void init_userdef_do_versions(void) U.ipo_new= BEZT_IPO_BEZ; } - if (G.main->versionfile < 250 || (G.main->versionfile == 250 && G.main->subversionfile < 1)) { + if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 1)) { bTheme *btheme; for(btheme= U.themes.first; btheme; btheme= btheme->next) { @@ -1351,7 +1352,7 @@ void init_userdef_do_versions(void) } } - if (G.main->versionfile < 250 || (G.main->versionfile == 250 && G.main->subversionfile < 3)) { + if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 3)) { /* new audio system */ if(U.audiochannels == 0) U.audiochannels = 2; @@ -1369,10 +1370,10 @@ void init_userdef_do_versions(void) U.audiorate = 44100; } - if (G.main->versionfile < 250 || (G.main->versionfile == 250 && G.main->subversionfile < 5)) + if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 5)) U.gameflags |= USER_DISABLE_VBO; - if (G.main->versionfile < 250 || (G.main->versionfile == 250 && G.main->subversionfile < 8)) { + if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 8)) { wmKeyMap *km; for(km=U.keymaps.first; km; km=km->next) { @@ -1412,16 +1413,16 @@ void init_userdef_do_versions(void) strcpy(km->idname, "Property Editor"); } } - if (G.main->versionfile < 250 || (G.main->versionfile == 250 && G.main->subversionfile < 16)) { + if (bmain->versionfile < 250 || (bmain->versionfile == 250 && bmain->subversionfile < 16)) { if(U.wmdrawmethod == USER_DRAW_TRIPLE) U.wmdrawmethod = USER_DRAW_AUTOMATIC; } - if (G.main->versionfile < 252 || (G.main->versionfile == 252 && G.main->subversionfile < 3)) { + if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 3)) { if (U.flag & USER_LMOUSESELECT) U.flag &= ~USER_TWOBUTTONMOUSE; } - if (G.main->versionfile < 252 || (G.main->versionfile == 252 && G.main->subversionfile < 4)) { + if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 4)) { bTheme *btheme; /* default new handle type is auto handles */ @@ -1454,7 +1455,7 @@ void init_userdef_do_versions(void) SETCOLF(btheme->tv3d.edge_crease, 0.8, 0, 0.6, 1.0); } } - if (G.main->versionfile <= 252) { + if (bmain->versionfile <= 252) { bTheme *btheme; /* init new curve colors */ @@ -1463,7 +1464,7 @@ void init_userdef_do_versions(void) SETCOL(btheme->tv3d.lastsel_point, 0xff, 0xff, 0xff, 255); } } - if (G.main->versionfile < 252 || (G.main->versionfile == 252 && G.main->subversionfile < 5)) { + if (bmain->versionfile < 252 || (bmain->versionfile == 252 && bmain->subversionfile < 5)) { bTheme *btheme; /* interface_widgets.c */ diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c index cdcbb5cb461..a63f4995acc 100644 --- a/source/blender/editors/mesh/editmesh.c +++ b/source/blender/editors/mesh/editmesh.c @@ -1330,7 +1330,7 @@ static EnumPropertyItem prop_separate_types[] = { }; /* return 1: success */ -static int mesh_separate_selected(Scene *scene, Base *editbase) +static int mesh_separate_selected(Main *bmain, Scene *scene, Base *editbase) { EditMesh *em, *emnew; EditVert *eve, *v1; @@ -1372,7 +1372,7 @@ static int mesh_separate_selected(Scene *scene, Base *editbase) */ /* 1 */ - basenew= ED_object_add_duplicate(scene, editbase, 0); /* 0 = fully linked */ + basenew= ED_object_add_duplicate(bmain, scene, editbase, 0); /* 0 = fully linked */ ED_base_object_select(basenew, BA_DESELECT); /* 2 */ @@ -1441,7 +1441,7 @@ static int mesh_separate_selected(Scene *scene, Base *editbase) } /* return 1: success */ -static int mesh_separate_material(Scene *scene, Base *editbase) +static int mesh_separate_material(Main *bmain, Scene *scene, Base *editbase) { Mesh *me= editbase->object->data; EditMesh *em= BKE_mesh_get_editmesh(me); @@ -1453,7 +1453,7 @@ static int mesh_separate_material(Scene *scene, Base *editbase) /* select the material */ EM_select_by_material(em, curr_mat); /* and now separate */ - if(0==mesh_separate_selected(scene, editbase)) { + if(0==mesh_separate_selected(bmain, scene, editbase)) { BKE_mesh_end_editmesh(me, em); return 0; } @@ -1464,7 +1464,7 @@ static int mesh_separate_material(Scene *scene, Base *editbase) } /* return 1: success */ -static int mesh_separate_loose(Scene *scene, Base *editbase) +static int mesh_separate_loose(Main *bmain, Scene *scene, Base *editbase) { Mesh *me; EditMesh *em; @@ -1504,7 +1504,7 @@ static int mesh_separate_loose(Scene *scene, Base *editbase) tot= BLI_countlist(&em->verts); /* and now separate */ - doit= mesh_separate_selected(scene, editbase); + doit= mesh_separate_selected(bmain, scene, editbase); /* with hidden verts this can happen */ if(tot == BLI_countlist(&em->verts)) @@ -1518,16 +1518,17 @@ static int mesh_separate_loose(Scene *scene, Base *editbase) static int mesh_separate_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Base *base= CTX_data_active_base(C); int retval= 0, type= RNA_enum_get(op->ptr, "type"); if(type == 0) - retval= mesh_separate_selected(scene, base); + retval= mesh_separate_selected(bmain, scene, base); else if(type == 1) - retval= mesh_separate_material (scene, base); + retval= mesh_separate_material(bmain, scene, base); else if(type == 2) - retval= mesh_separate_loose(scene, base); + retval= mesh_separate_loose(bmain, scene, base); if(retval) { WM_event_add_notifier(C, NC_GEOM|ND_DATA, base->object->data); diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c index 4bea6488adb..f952820c1f0 100644 --- a/source/blender/editors/mesh/editmesh_mods.c +++ b/source/blender/editors/mesh/editmesh_mods.c @@ -2150,7 +2150,7 @@ static void mouse_mesh_shortest_path(bContext *C, short mval[2]) if(ese && ese->type == EDITEDGE) { eed_act = (EditEdge*)ese->data; if (eed_act != eed) { - if (edgetag_shortest_path(vc.scene, em, eed_act, eed)) { + if (edgetag_shortest_path(vc.scene, em, eed_act, eed)) { /* <- this is where the magic happens */ EM_remove_selection(em, eed_act, EDITEDGE); path = 1; } @@ -2163,13 +2163,19 @@ static void mouse_mesh_shortest_path(bContext *C, short mval[2]) } /* even if this is selected it may not be in the selection list */ - if(edgetag_context_check(vc.scene, eed)==EDGE_MODE_SELECT) + if(edgetag_context_check(vc.scene, eed)==0) { EM_remove_selection(em, eed, EDITEDGE); + } else { /* other modes need to keep the last edge tagged */ - if(eed_act) - EM_select_edge(eed_act, 0); + if(eed_act) { + if(vc.scene->toolsettings->edge_mode!=EDGE_MODE_SELECT) { + /* for non-select modes, always de-select the previous active edge */ + EM_select_edge(eed_act, 0); + } + } + /* set the new edge active */ EM_select_edge(eed, 1); EM_store_selection(em, eed, EDITEDGE); } @@ -2208,6 +2214,16 @@ static int mesh_shortest_path_select_invoke(bContext *C, wmOperator *op, wmEvent return OPERATOR_FINISHED; } + +static int mesh_shortest_path_select_poll(bContext *C) +{ + if(ED_operator_editmesh_view3d(C)) { + Object *obedit= CTX_data_edit_object(C); + EditMesh *em= BKE_mesh_get_editmesh(obedit->data); + return (em->selectmode & SCE_SELECT_EDGE); + } + return 0; +} void MESH_OT_select_shortest_path(wmOperatorType *ot) { @@ -2218,7 +2234,7 @@ void MESH_OT_select_shortest_path(wmOperatorType *ot) /* api callbacks */ ot->invoke= mesh_shortest_path_select_invoke; - ot->poll= ED_operator_editmesh_view3d; + ot->poll= mesh_shortest_path_select_poll; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index e143e4859f5..9eac347c893 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -314,6 +314,6 @@ void ED_keymap_mesh(wmKeyConfig *keyconf) WM_keymap_add_menu(keymap, "VIEW3D_MT_uv_map", UKEY, KM_PRESS, 0, 0); WM_keymap_add_menu(keymap, "VIEW3D_MT_vertex_group", GKEY, KM_PRESS, KM_CTRL, 0); - ED_object_generic_keymap(keyconf, keymap, 2); + ED_object_generic_keymap(keyconf, keymap, 3); } diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 87b5c886b4a..47b7b89ff7a 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -92,6 +92,7 @@ return 0 if no join is made (error) and 1 of the join is done */ int join_mesh_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); Material **matar, *ma; @@ -443,7 +444,7 @@ int join_mesh_exec(bContext *C, wmOperator *op) /* free base, now that data is merged */ if(base->object != ob) - ED_base_object_free_and_unlink(scene, base); + ED_base_object_free_and_unlink(bmain, scene, base); } } CTX_DATA_END; @@ -503,17 +504,17 @@ int join_mesh_exec(bContext *C, wmOperator *op) /* free it's ipo too - both are not actually freed from memory yet as ID-blocks */ if(nkey->ipo) { free_ipo(nkey->ipo); - BLI_remlink(&G.main->ipo, nkey->ipo); + BLI_remlink(&bmain->ipo, nkey->ipo); MEM_freeN(nkey->ipo); } #endif free_key(nkey); - BLI_remlink(&G.main->key, nkey); + BLI_remlink(&bmain->key, nkey); MEM_freeN(nkey); } - DAG_scene_sort(scene); // removed objects, need to rebuild dag before editmode call + DAG_scene_sort(bmain, scene); // removed objects, need to rebuild dag before editmode call ED_object_enter_editmode(C, EM_WAITCURSOR); ED_object_exit_editmode(C, EM_FREEDATA|EM_WAITCURSOR|EM_DO_UNDO); diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index e08661b1795..67cae8d4155 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -241,7 +241,7 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc, floa if(RNA_property_is_set(op->ptr, "layer")) { RNA_boolean_get_array(op->ptr, "layer", layer_values); - + *layer= 0; for(a=0; a<20; a++) { if(layer_values[a]) *layer |= (1 << a); @@ -284,6 +284,7 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc, floa /* for object add primitive operators */ Object *ED_object_add_type(bContext *C, int type, float *loc, float *rot, int enter_editmode, unsigned int layer) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *ob; @@ -300,8 +301,8 @@ Object *ED_object_add_type(bContext *C, int type, float *loc, float *rot, int en /* more editor stuff */ ED_object_base_init_transform(C, BASACT, loc, rot); - DAG_scene_sort(scene); - ED_render_id_flush_update(G.main, ob->data); + DAG_scene_sort(bmain, scene); + ED_render_id_flush_update(bmain, ob->data); if(enter_editmode) ED_object_enter_editmode(C, EM_IGNORE_LAYER); @@ -750,6 +751,8 @@ static int group_instance_add_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; if(group) { + Main *bmain= CTX_data_main(C); + Scene *scene= CTX_data_scene(C); Object *ob= ED_object_add_type(C, OB_EMPTY, loc, rot, FALSE, layer); rename_id(&ob->id, group->id.name+2); ob->dup_group= group; @@ -757,7 +760,7 @@ static int group_instance_add_exec(bContext *C, wmOperator *op) id_lib_extern(&group->id); /* works without this except if you try render right after, see: 22027 */ - DAG_scene_sort(CTX_data_scene(C)); + DAG_scene_sort(bmain, scene); WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, CTX_data_scene(C)); @@ -797,16 +800,17 @@ void OBJECT_OT_group_instance_add(wmOperatorType *ot) /* remove base from a specific scene */ /* note: now unlinks constraints as well */ -void ED_base_object_free_and_unlink(Scene *scene, Base *base) +void ED_base_object_free_and_unlink(Main *bmain, Scene *scene, Base *base) { BLI_remlink(&scene->base, base); - free_libblock_us(&G.main->object, base->object); + free_libblock_us(&bmain->object, base->object); if(scene->basact==base) scene->basact= NULL; MEM_freeN(base); } static int object_delete_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); int islamp= 0; @@ -817,14 +821,14 @@ static int object_delete_exec(bContext *C, wmOperator *op) if(base->object->type==OB_LAMP) islamp= 1; /* remove from current scene only */ - ED_base_object_free_and_unlink(scene, base); + ED_base_object_free_and_unlink(bmain, scene, base); } CTX_DATA_END; if(islamp) reshadeall_displist(scene); /* only frees displist */ - DAG_scene_sort(scene); - DAG_ids_flush_update(0); + DAG_scene_sort(bmain, scene); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, CTX_data_scene(C)); @@ -859,6 +863,7 @@ static void copy_object__forwardModifierLinks(void *userData, Object *ob, /* after copying objects, copied data should get new pointers */ static void copy_object_set_idnew(bContext *C, int dupflag) { + Main *bmain= CTX_data_main(C); Material *ma, *mao; ID *id; int a; @@ -881,7 +886,7 @@ static void copy_object_set_idnew(bContext *C, int dupflag) /* materials */ if( dupflag & USER_DUP_MAT) { - mao= G.main->mat.first; + mao= bmain->mat.first; while(mao) { if(mao->id.newid) { @@ -915,7 +920,7 @@ static void copy_object_set_idnew(bContext *C, int dupflag) #if 0 // XXX old animation system /* lamps */ if( dupflag & USER_DUP_IPO) { - Lamp *la= G.main->lamp.first; + Lamp *la= bmain->lamp.first; while(la) { if(la->id.newid) { Lamp *lan= (Lamp *)la->id.newid; @@ -931,7 +936,7 @@ static void copy_object_set_idnew(bContext *C, int dupflag) } /* ipos */ - ipo= G.main->ipo.first; + ipo= bmain->ipo.first; while(ipo) { if(ipo->id.lib==NULL && ipo->id.newid) { Ipo *ipon= (Ipo *)ipo->id.newid; @@ -1000,6 +1005,7 @@ static void make_object_duplilist_real(bContext *C, Scene *scene, Base *base) static int object_duplicates_make_real_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); clear_id_newpoins(); @@ -1009,8 +1015,8 @@ static int object_duplicates_make_real_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_scene_sort(scene); - DAG_ids_flush_update(0); + DAG_scene_sort(bmain, scene); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_SCENE, scene); WM_main_add_notifier(NC_OBJECT|ND_DRAW, NULL); @@ -1089,6 +1095,7 @@ static Base *duplibase_for_convert(Scene *scene, Base *base, Object *ob) static int convert_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Base *basen=NULL, *basact=NULL, *basedel=NULL; Object *ob, *ob1, *newob, *obact= CTX_data_active_object(C); @@ -1214,7 +1221,7 @@ static int convert_exec(bContext *C, wmOperator *op) if (!keep_original) { /* other users */ if(cu->id.us>1) { - for(ob1= G.main->object.first; ob1; ob1=ob1->id.next) { + for(ob1= bmain->object.first; ob1; ob1=ob1->id.next) { if(ob1->data==ob->data) { ob1->type= OB_CURVE; ob1->recalc |= OB_RECALC_ALL; @@ -1321,7 +1328,7 @@ static int convert_exec(bContext *C, wmOperator *op) /* delete original if needed */ if(basedel) { if(!keep_original) - ED_base_object_free_and_unlink(scene, basedel); + ED_base_object_free_and_unlink(bmain, scene, basedel); basedel = NULL; } @@ -1337,13 +1344,13 @@ static int convert_exec(bContext *C, wmOperator *op) base= base->next; if (ob->type == OB_MBALL) { - ED_base_object_free_and_unlink(scene, tmpbase); + ED_base_object_free_and_unlink(bmain, scene, tmpbase); } } } /* delete object should renew depsgraph */ - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } // XXX ED_object_enter_editmode(C, 0); @@ -1357,7 +1364,7 @@ static int convert_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER|ND_DATA, BASACT->object); } - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); WM_event_add_notifier(C, NC_SCENE|NC_OBJECT|ND_DRAW, scene); /* is NC_SCENE needed ? */ return OPERATOR_FINISHED; @@ -1394,7 +1401,7 @@ void OBJECT_OT_convert(wmOperatorType *ot) /* used below, assumes id.new is correct */ /* leaves selection of base/object unaltered */ -static Base *object_add_duplicate_internal(Scene *scene, Base *base, int dupflag) +static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base, int dupflag) { Base *basen= NULL; Material ***matarar; @@ -1417,7 +1424,7 @@ static Base *object_add_duplicate_internal(Scene *scene, Base *base, int dupflag if(basen->flag & OB_FROMGROUP) { Group *group; - for(group= G.main->group.first; group; group= group->id.next) { + for(group= bmain->group.first; group; group= group->id.next) { if(object_in_group(ob, group)) add_to_group(group, obn, scene, basen); } @@ -1596,7 +1603,7 @@ static Base *object_add_duplicate_internal(Scene *scene, Base *base, int dupflag /* single object duplicate, if dupflag==0, fully linked, else it uses the flags given */ /* leaves selection of base/object unaltered */ -Base *ED_object_add_duplicate(Scene *scene, Base *base, int dupflag) +Base *ED_object_add_duplicate(Main *bmain, Scene *scene, Base *base, int dupflag) { Base *basen; Object *ob; @@ -1604,15 +1611,15 @@ Base *ED_object_add_duplicate(Scene *scene, Base *base, int dupflag) clear_id_newpoins(); clear_sca_new_poins(); /* sensor/contr/act */ - basen= object_add_duplicate_internal(scene, base, dupflag); + basen= object_add_duplicate_internal(bmain, scene, base, dupflag); if (basen == NULL) { return NULL; } ob= basen->object; - DAG_scene_sort(scene); - ED_render_id_flush_update(G.main, ob->data); + DAG_scene_sort(bmain, scene); + ED_render_id_flush_update(bmain, ob->data); return basen; } @@ -1620,6 +1627,7 @@ Base *ED_object_add_duplicate(Scene *scene, Base *base, int dupflag) /* contextual operator dupli */ static int duplicate_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); int linked= RNA_boolean_get(op->ptr, "linked"); int dupflag= (linked)? 0: U.dupflag; @@ -1628,7 +1636,7 @@ static int duplicate_exec(bContext *C, wmOperator *op) clear_sca_new_poins(); /* sensor/contr/act */ CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) { - Base *basen= object_add_duplicate_internal(scene, base, dupflag); + Base *basen= object_add_duplicate_internal(bmain, scene, base, dupflag); /* note that this is safe to do with this context iterator, the list is made in advance */ @@ -1642,14 +1650,14 @@ static int duplicate_exec(bContext *C, wmOperator *op) if(BASACT==base) ED_base_object_activate(C, basen); - ED_render_id_flush_update(G.main, basen->object->data); + ED_render_id_flush_update(bmain, basen->object->data); } CTX_DATA_END; copy_object_set_idnew(C, dupflag); - DAG_scene_sort(scene); - DAG_ids_flush_update(0); + DAG_scene_sort(bmain, scene); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene); @@ -1697,6 +1705,7 @@ static int add_named_poll(bContext *C) static int add_named_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Base *basen, *base; Object *ob; @@ -1718,7 +1727,7 @@ static int add_named_exec(bContext *C, wmOperator *op) clear_id_newpoins(); clear_sca_new_poins(); /* sensor/contr/act */ - basen= object_add_duplicate_internal(scene, base, dupflag); + basen= object_add_duplicate_internal(bmain, scene, base, dupflag); if (basen == NULL) { MEM_freeN(base); @@ -1732,8 +1741,8 @@ static int add_named_exec(bContext *C, wmOperator *op) copy_object_set_idnew(C, dupflag); - DAG_scene_sort(scene); - DAG_ids_flush_update(0); + DAG_scene_sort(bmain, scene); + DAG_ids_flush_update(bmain, 0); MEM_freeN(base); diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index 9f9d41147b6..6261c33a6f7 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -94,6 +94,7 @@ static ScrArea *biggest_image_area(bScreen *screen) typedef struct BakeRender { Render *re; + Main *main; Scene *scene; struct Object *actob; int tot, ready; @@ -139,6 +140,7 @@ static void init_bake_internal(BakeRender *bkr, bContext *C) Scene *scene= CTX_data_scene(C); bkr->sa= biggest_image_area(CTX_wm_screen(C)); /* can be NULL */ + bkr->main= CTX_data_main(C); bkr->scene= scene; bkr->actob= (scene->r.bake_flag & R_BAKE_TO_ACTIVE) ? OBACT : NULL; bkr->re= RE_NewRender("_Bake View_"); @@ -196,6 +198,7 @@ static void bake_startjob(void *bkv, short *stop, short *do_update, float *progr { BakeRender *bkr= bkv; Scene *scene= bkr->scene; + Main *bmain= bkr->main; bkr->stop= stop; bkr->do_update= do_update; @@ -204,7 +207,7 @@ static void bake_startjob(void *bkv, short *stop, short *do_update, float *progr RE_test_break_cb(bkr->re, NULL, thread_break); G.afbreek= 0; /* blender_test_break uses this global */ - RE_Database_Baking(bkr->re, scene, scene->lay, scene->r.bake_mode, bkr->actob); + RE_Database_Baking(bkr->re, bmain, scene, scene->lay, scene->r.bake_mode, bkr->actob); /* baking itself is threaded, cannot use test_break in threads. we also update optional imagewindow */ bkr->tot= RE_bake_shade_all_selected(bkr->re, scene->r.bake_mode, bkr->actob, bkr->do_update, bkr->progress); @@ -284,6 +287,7 @@ static int objects_bake_render_invoke(bContext *C, wmOperator *op, wmEvent *_eve static int bake_image_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); @@ -302,7 +306,7 @@ static int bake_image_exec(bContext *C, wmOperator *op) RE_test_break_cb(bkr.re, NULL, thread_break); G.afbreek= 0; /* blender_test_break uses this global */ - RE_Database_Baking(bkr.re, scene, scene->lay, scene->r.bake_mode, (scene->r.bake_flag & R_BAKE_TO_ACTIVE)? OBACT: NULL); + RE_Database_Baking(bkr.re, bmain, scene, scene->lay, scene->r.bake_mode, (scene->r.bake_flag & R_BAKE_TO_ACTIVE)? OBACT: NULL); /* baking itself is threaded, cannot use test_break in threads */ BLI_init_threads(&threads, do_bake_render, 1); diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index b1dc41531ef..8f83a412c96 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -779,12 +779,12 @@ void ED_object_constraint_update(Object *ob) else DAG_id_flush_update(&ob->id, OB_RECALC_OB); } -void ED_object_constraint_dependency_update(Scene *scene, Object *ob) +void ED_object_constraint_dependency_update(Main *bmain, Scene *scene, Object *ob) { ED_object_constraint_update(ob); if(ob->pose) ob->pose->flag |= POSE_RECALC; // checks & sorts pose channels - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } static int constraint_poll(bContext *C) @@ -931,8 +931,9 @@ void CONSTRAINT_OT_move_up (wmOperatorType *ot) static int pose_constraints_clear_exec(bContext *C, wmOperator *op) { - Object *ob= CTX_data_active_object(C); + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); + Object *ob= CTX_data_active_object(C); /* free constraints for all selected bones */ CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones) @@ -943,7 +944,7 @@ static int pose_constraints_clear_exec(bContext *C, wmOperator *op) CTX_DATA_END; /* force depsgraph to get recalculated since relationships removed */ - DAG_scene_sort(scene); /* sort order of objects */ + DAG_scene_sort(bmain, scene); /* sort order of objects */ /* do updates */ DAG_id_flush_update(&ob->id, OB_RECALC_DATA); @@ -967,6 +968,7 @@ void POSE_OT_constraints_clear(wmOperatorType *ot) static int object_constraints_clear_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); /* do freeing */ @@ -978,7 +980,7 @@ static int object_constraints_clear_exec(bContext *C, wmOperator *op) CTX_DATA_END; /* force depsgraph to get recalculated since relationships removed */ - DAG_scene_sort(scene); /* sort order of objects */ + DAG_scene_sort(bmain, scene); /* sort order of objects */ /* do updates */ WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, NULL); @@ -1002,8 +1004,9 @@ void OBJECT_OT_constraints_clear(wmOperatorType *ot) static int pose_constraint_copy_exec(bContext *C, wmOperator *op) { - bPoseChannel *pchan = CTX_data_active_pose_bone(C); + Main *bmain= CTX_data_main(C); Scene *scene = CTX_data_scene(C); + bPoseChannel *pchan = CTX_data_active_pose_bone(C); /* don't do anything if bone doesn't exist or doesn't have any constraints */ if (ELEM(NULL, pchan, pchan->constraints.first)) { @@ -1021,7 +1024,7 @@ static int pose_constraint_copy_exec(bContext *C, wmOperator *op) CTX_DATA_END; /* force depsgraph to get recalculated since new relationships added */ - DAG_scene_sort(scene); /* sort order of objects/bones */ + DAG_scene_sort(bmain, scene); /* sort order of objects/bones */ return OPERATOR_FINISHED; } @@ -1043,8 +1046,9 @@ void POSE_OT_constraints_copy(wmOperatorType *ot) static int object_constraint_copy_exec(bContext *C, wmOperator *op) { - Object *obact = ED_object_active_context(C); + Main *bmain= CTX_data_main(C); Scene *scene = CTX_data_scene(C); + Object *obact = ED_object_active_context(C); /* copy all constraints from active object to all selected objects */ CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) @@ -1056,7 +1060,7 @@ static int object_constraint_copy_exec(bContext *C, wmOperator *op) CTX_DATA_END; /* force depsgraph to get recalculated since new relationships added */ - DAG_scene_sort(scene); /* sort order of objects */ + DAG_scene_sort(bmain, scene); /* sort order of objects */ return OPERATOR_FINISHED; } @@ -1219,6 +1223,7 @@ static short get_new_constraint_target(bContext *C, int con_type, Object **tar_o /* used by add constraint operators to add the constraint required */ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase *list, int type, short setTarget) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); bPoseChannel *pchan; bConstraint *con; @@ -1316,7 +1321,7 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase /* force depsgraph to get recalculated since new relationships added */ - DAG_scene_sort(scene); /* sort order of objects */ + DAG_scene_sort(bmain, scene); /* sort order of objects */ if ((ob->type==OB_ARMATURE) && (pchan)) { ob->pose->flag |= POSE_RECALC; /* sort pose channels */ diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 0d3ebc7f669..18da264336e 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -137,6 +137,7 @@ Object *ED_object_active_context(bContext *C) /* ********* clear/set restrict view *********/ static int object_hide_view_clear_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); ScrArea *sa= CTX_wm_area(C); View3D *v3d= sa->spacedata.first; Scene *scene= CTX_data_scene(C); @@ -153,7 +154,7 @@ static int object_hide_view_clear_exec(bContext *C, wmOperator *op) } } if (changed) { - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene); } @@ -178,6 +179,7 @@ void OBJECT_OT_hide_view_clear(wmOperatorType *ot) static int object_hide_view_set_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); short changed = 0; int unselected= RNA_boolean_get(op->ptr, "unselected"); @@ -204,7 +206,7 @@ static int object_hide_view_set_exec(bContext *C, wmOperator *op) CTX_DATA_END; if (changed) { - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, CTX_data_scene(C)); @@ -965,144 +967,6 @@ void special_editmenu(Scene *scene, View3D *v3d) } -/* Change subdivision or particle properties of mesh object ob, if level==-1 - * then toggle subsurf, else set to level set allows to toggle multiple - * selections */ - -static void object_has_subdivision_particles(Object *ob, int *havesubdiv, int *havepart, int depth) -{ - if(ob->type==OB_MESH) { - if(modifiers_findByType(ob, eModifierType_Subsurf)) - *havesubdiv= 1; - if(modifiers_findByType(ob, eModifierType_ParticleSystem)) - *havepart= 1; - } - - if(ob->dup_group && depth <= 4) { - GroupObject *go; - - for(go= ob->dup_group->gobject.first; go; go= go->next) - object_has_subdivision_particles(go->ob, havesubdiv, havepart, depth+1); - } -} - -static void object_flip_subdivison_particles(Scene *scene, Object *ob, int *set, int level, int mode, int particles, int depth) -{ - ModifierData *md; - - if(ob->type==OB_MESH) { - if(particles) { - for(md=ob->modifiers.first; md; md=md->next) { - if(md->type == eModifierType_ParticleSystem) { - ParticleSystemModifierData *psmd = (ParticleSystemModifierData*)md; - - if(*set == -1) - *set= psmd->modifier.mode&(mode); - - if (*set) - psmd->modifier.mode &= ~(mode); - else - psmd->modifier.mode |= (mode); - } - } - } - else { - md = modifiers_findByType(ob, eModifierType_Subsurf); - - if (md) { - SubsurfModifierData *smd = (SubsurfModifierData*) md; - - if (level == -1) { - if(*set == -1) - *set= smd->modifier.mode&(mode); - - if (*set) - smd->modifier.mode &= ~(mode); - else - smd->modifier.mode |= (mode); - } else { - smd->levels = level; - } - } - else if(depth == 0 && *set != 0) { - SubsurfModifierData *smd = (SubsurfModifierData*) modifier_new(eModifierType_Subsurf); - - BLI_addtail(&ob->modifiers, smd); - modifier_unique_name(&ob->modifiers, (ModifierData*)smd); - - if (level!=-1) { - smd->levels = level; - } - - if(*set == -1) - *set= 1; - } - } - - DAG_id_flush_update(&ob->id, OB_RECALC_DATA); - } - - if(ob->dup_group && depth<=4) { - GroupObject *go; - - for(go= ob->dup_group->gobject.first; go; go= go->next) - object_flip_subdivison_particles(scene, go->ob, set, level, mode, particles, depth+1); - } -} - -/* Change subdivision properties of mesh object ob, if -* level==-1 then toggle subsurf, else set to level. -*/ - -void flip_subdivison(Scene *scene, View3D *v3d, int level) -{ - Base *base; - int set= -1; - int mode, pupmode, particles= 0, havesubdiv= 0, havepart= 0; - int alt= 0; // XXX - - if(alt) - mode= eModifierMode_Realtime; - else - mode= eModifierMode_Render|eModifierMode_Realtime; - - if(level == -1) { - if (scene->obedit) { // XXX get from context - object_has_subdivision_particles(scene->obedit, &havesubdiv, &havepart, 0); - } else { - for(base= scene->base.first; base; base= base->next) { - if(((level==-1) && (TESTBASE(v3d, base))) || (TESTBASELIB(v3d, base))) { - object_has_subdivision_particles(base->object, &havesubdiv, &havepart, 0); - } - } - } - } - else - havesubdiv= 1; - - if(havesubdiv && havepart) { - pupmode= pupmenu("Switch%t|Subsurf %x1|Particle Systems %x2"); - if(pupmode <= 0) - return; - else if(pupmode == 2) - particles= 1; - } - else if(havepart) - particles= 1; - - if (scene->obedit) { // XXX get from context - object_flip_subdivison_particles(scene, scene->obedit, &set, level, mode, particles, 0); - } else { - for(base= scene->base.first; base; base= base->next) { - if(((level==-1) && (TESTBASE(v3d, base))) || (TESTBASELIB(v3d, base))) { - object_flip_subdivison_particles(scene, base->object, &set, level, mode, particles, 0); - } - } - } - - DAG_ids_flush_update(0); -} - static void copymenu_properties(Scene *scene, View3D *v3d, Object *ob) { //XXX no longer used - to be removed - replaced by game_properties_copy_exec @@ -1197,7 +1061,7 @@ static void copymenu_logicbricks(Scene *scene, View3D *v3d, Object *ob) } } -static void copymenu_modifiers(Scene *scene, View3D *v3d, Object *ob) +static void copymenu_modifiers(Main *bmain, Scene *scene, View3D *v3d, Object *ob) { Base *base; int i, event; @@ -1296,7 +1160,7 @@ static void copymenu_modifiers(Scene *scene, View3D *v3d, Object *ob) // if(errorstr) notice(errorstr); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } @@ -1344,7 +1208,7 @@ static void copy_texture_space(Object *to, Object *ob) } -void copy_attr(Scene *scene, View3D *v3d, short event) +void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event) { Object *ob; Base *base; @@ -1369,7 +1233,7 @@ void copy_attr(Scene *scene, View3D *v3d, short event) return; } else if(event==24) { - copymenu_modifiers(scene, v3d, ob); + copymenu_modifiers(bmain, scene, v3d, ob); return; } @@ -1587,12 +1451,12 @@ void copy_attr(Scene *scene, View3D *v3d, short event) } if(do_scene_sort) - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); } -void copy_attr_menu(Scene *scene, View3D *v3d) +void copy_attr_menu(Main *bmain, Scene *scene, View3D *v3d) { Object *ob; short event; @@ -1643,7 +1507,7 @@ void copy_attr_menu(Scene *scene, View3D *v3d) event= pupmenu(str); if(event<= 0) return; - copy_attr(scene, v3d, event); + copy_attr(bmain, scene, v3d, event); } /* ********************************************** */ diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c index ba609bd9bb3..b0a6c6471a2 100644 --- a/source/blender/editors/object/object_group.c +++ b/source/blender/editors/object/object_group.c @@ -60,6 +60,7 @@ static int objects_add_active_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *ob= OBACT; Group *group; @@ -70,7 +71,7 @@ static int objects_add_active_exec(bContext *C, wmOperator *op) /* linking to same group requires its own loop so we can avoid looking up the active objects groups each time */ - for(group= G.main->group.first; group; group=group->id.next) { + for(group= bmain->group.first; group; group=group->id.next) { if(object_in_group(ob, group)) { /* Assign groups to selected objects */ CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) { @@ -83,7 +84,7 @@ static int objects_add_active_exec(bContext *C, wmOperator *op) if(!ok) BKE_report(op->reports, RPT_ERROR, "Active Object contains no groups"); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); WM_event_add_notifier(C, NC_GROUP|NA_EDITED, NULL); return OPERATOR_FINISHED; @@ -106,6 +107,7 @@ void GROUP_OT_objects_add_active(wmOperatorType *ot) static int objects_remove_active_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *ob= OBACT; Group *group; @@ -116,7 +118,7 @@ static int objects_remove_active_exec(bContext *C, wmOperator *op) /* linking to same group requires its own loop so we can avoid looking up the active objects groups each time */ - for(group= G.main->group.first; group; group=group->id.next) { + for(group= bmain->group.first; group; group=group->id.next) { if(object_in_group(ob, group)) { /* Assign groups to selected objects */ CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) { @@ -129,7 +131,7 @@ static int objects_remove_active_exec(bContext *C, wmOperator *op) if(!ok) BKE_report(op->reports, RPT_ERROR, "Active Object contains no groups"); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); WM_event_add_notifier(C, NC_GROUP|NA_EDITED, NULL); return OPERATOR_FINISHED; @@ -152,6 +154,7 @@ void GROUP_OT_objects_remove_active(wmOperatorType *ot) static int group_objects_remove_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Group *group= NULL; @@ -162,7 +165,7 @@ static int group_objects_remove_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); WM_event_add_notifier(C, NC_GROUP|NA_EDITED, NULL); return OPERATOR_FINISHED; @@ -185,6 +188,7 @@ void GROUP_OT_objects_remove(wmOperatorType *ot) static int group_create_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Group *group= NULL; char name[32]; /* id name */ @@ -198,7 +202,7 @@ static int group_create_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); WM_event_add_notifier(C, NC_GROUP|NA_EDITED, NULL); return OPERATOR_FINISHED; diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index 88e463039a1..fefefae586c 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -45,6 +45,7 @@ #include "BKE_context.h" #include "BKE_customdata.h" #include "BKE_depsgraph.h" +#include "BKE_main.h" #include "BKE_mesh.h" #include "BKE_modifier.h" #include "BKE_object.h" @@ -413,7 +414,7 @@ static Object *add_hook_object_new(Scene *scene, Object *obedit) return ob; } -static void add_hook_object(Scene *scene, Object *obedit, Object *ob, int mode) +static void add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *ob, int mode) { ModifierData *md=NULL; HookModifierData *hmd = NULL; @@ -459,11 +460,12 @@ static void add_hook_object(Scene *scene, Object *obedit, Object *ob, int mode) mul_serie_m4(hmd->parentinv, ob->imat, obedit->obmat, NULL, NULL, NULL, NULL, NULL, NULL); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } static int object_add_hook_selob_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *obedit = CTX_data_edit_object(C); Object *obsel=NULL; @@ -482,7 +484,7 @@ static int object_add_hook_selob_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - add_hook_object(scene, obedit, obsel, OBJECT_ADDHOOK_SELOB); + add_hook_object(bmain, scene, obedit, obsel, OBJECT_ADDHOOK_SELOB); WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, obedit); return OPERATOR_FINISHED; @@ -505,10 +507,11 @@ void OBJECT_OT_hook_add_selobj(wmOperatorType *ot) static int object_add_hook_newob_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *obedit = CTX_data_edit_object(C); - add_hook_object(scene, obedit, NULL, OBJECT_ADDHOOK_NEWOB); + add_hook_object(bmain, scene, obedit, NULL, OBJECT_ADDHOOK_NEWOB); WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene); WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, obedit); diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 0661b675668..a54ed9bd239 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -53,6 +53,7 @@ #include "BKE_global.h" #include "BKE_key.h" #include "BKE_lattice.h" +#include "BKE_main.h" #include "BKE_mesh.h" #include "BKE_modifier.h" #include "BKE_multires.h" @@ -77,7 +78,7 @@ /******************************** API ****************************/ -ModifierData *ED_object_modifier_add(ReportList *reports, Scene *scene, Object *ob, char *name, int type) +ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *scene, Object *ob, char *name, int type) { ModifierData *md=NULL, *new_md=NULL; ModifierTypeInfo *mti = modifierType_getInfo(type); @@ -129,10 +130,10 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Scene *scene, Object * ob->pd= object_add_collision_fields(0); ob->pd->deflect= 1; - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } else if(type == eModifierType_Surface) - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } DAG_id_flush_update(&ob->id, OB_RECALC_DATA); @@ -140,7 +141,7 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Scene *scene, Object * return new_md; } -int ED_object_modifier_remove(ReportList *reports, Scene *scene, Object *ob, ModifierData *md) +int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Object *ob, ModifierData *md) { ModifierData *obmd; @@ -175,13 +176,13 @@ int ED_object_modifier_remove(ReportList *reports, Scene *scene, Object *ob, Mod if(ob->pd) ob->pd->deflect= 0; - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } else if(md->type == eModifierType_Surface) { if(ob->pd && ob->pd->shape == PFIELD_SHAPE_SURFACE) ob->pd->shape = PFIELD_SHAPE_PLANE; - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } else if(md->type == eModifierType_Smoke) { ob->dt = OB_TEXTURE; @@ -243,7 +244,7 @@ int ED_object_modifier_move_down(ReportList *reports, Object *ob, ModifierData * return 1; } -int ED_object_modifier_convert(ReportList *reports, Scene *scene, Object *ob, ModifierData *md) +int ED_object_modifier_convert(ReportList *reports, Main *bmain, Scene *scene, Object *ob, ModifierData *md) { Object *obn; ParticleSystem *psys; @@ -341,7 +342,7 @@ int ED_object_modifier_convert(ReportList *reports, Scene *scene, Object *ob, Mo } } - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); return 1; } @@ -500,11 +501,12 @@ int ED_object_modifier_copy(ReportList *reports, Object *ob, ModifierData *md) static int modifier_add_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *ob = ED_object_active_context(C); int type= RNA_enum_get(op->ptr, "type"); - if(!ED_object_modifier_add(op->reports, scene, ob, NULL, type)) + if(!ED_object_modifier_add(op->reports, bmain, scene, ob, NULL, type)) return OPERATOR_CANCELLED; WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); @@ -626,11 +628,12 @@ static ModifierData *edit_modifier_property_get(bContext *C, wmOperator *op, Obj static int modifier_remove_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *ob = ED_object_active_context(C); ModifierData *md = edit_modifier_property_get(C, op, ob, 0); - if(!ob || !md || !ED_object_modifier_remove(op->reports, scene, ob, md)) + if(!ob || !md || !ED_object_modifier_remove(op->reports, bmain, scene, ob, md)) return OPERATOR_CANCELLED; WM_event_add_notifier(C, NC_OBJECT|ND_MODIFIER, ob); @@ -792,11 +795,12 @@ void OBJECT_OT_modifier_apply(wmOperatorType *ot) static int modifier_convert_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *ob = ED_object_active_context(C); ModifierData *md = edit_modifier_property_get(C, op, ob, 0); - if(!ob || !md || !ED_object_modifier_convert(op->reports, scene, ob, md)) + if(!ob || !md || !ED_object_modifier_convert(op->reports, bmain, scene, ob, md)) return OPERATOR_CANCELLED; DAG_id_flush_update(&ob->id, OB_RECALC_DATA); diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index e1ea7924916..610a82d964c 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -364,7 +364,10 @@ void ED_keymap_object(wmKeyConfig *keyconf) RNA_int_set(kmi->ptr, "level", i); } - /* Lattice -------------------------------------------------------------------- */ + /* ############################################################################ */ + /* ################################ LATTICE ################################### */ + /* ############################################################################ */ + keymap= WM_keymap_find(keyconf, "Lattice", 0, 0); keymap->poll= ED_operator_editlattice; @@ -375,7 +378,7 @@ void ED_keymap_object(wmKeyConfig *keyconf) /* menus */ WM_keymap_add_menu(keymap, "VIEW3D_MT_hook", HKEY, KM_PRESS, KM_CTRL, 0); - ED_object_generic_keymap(keyconf, keymap, 1); + ED_object_generic_keymap(keyconf, keymap, 2); } void ED_object_generic_keymap(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap, int do_pet) @@ -383,22 +386,31 @@ void ED_object_generic_keymap(struct wmKeyConfig *keyconf, struct wmKeyMap *keym wmKeyMapItem *kmi; /* used by mesh, curve & lattice only */ - if(do_pet > 0) { + if(do_pet) { /* context ops */ kmi = WM_keymap_add_item(keymap, "WM_OT_context_cycle_enum", OKEY, KM_PRESS, KM_SHIFT, 0); RNA_string_set(kmi->ptr, "data_path", "tool_settings.proportional_editing_falloff"); - kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", OKEY, KM_PRESS, 0, 0); - RNA_string_set(kmi->ptr, "data_path", "tool_settings.proportional_editing"); - RNA_string_set(kmi->ptr, "value_1", "DISABLED"); - RNA_string_set(kmi->ptr, "value_2", "ENABLED"); + // Object mode + if (do_pet == 1) { + + kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", OKEY, KM_PRESS, 0, 0); + RNA_string_set(kmi->ptr, "data_path", "tool_settings.proportional_editing_objects"); + + } else { // Edit mode - /* for modes/object types that allow 'conencted' mode, add the Alt O key */ - if (do_pet > 1) { - kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", OKEY, KM_PRESS, KM_ALT, 0); + kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", OKEY, KM_PRESS, 0, 0); RNA_string_set(kmi->ptr, "data_path", "tool_settings.proportional_editing"); RNA_string_set(kmi->ptr, "value_1", "DISABLED"); - RNA_string_set(kmi->ptr, "value_2", "CONNECTED"); + RNA_string_set(kmi->ptr, "value_2", "ENABLED"); + + /* for modes/object types that allow 'connected' mode, add the Alt O key */ + if (do_pet == 3) { + kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", OKEY, KM_PRESS, KM_ALT, 0); + RNA_string_set(kmi->ptr, "data_path", "tool_settings.proportional_editing"); + RNA_string_set(kmi->ptr, "value_1", "DISABLED"); + RNA_string_set(kmi->ptr, "value_2", "CONNECTED"); + } } } } diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 8d488eeabac..463db871f55 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -97,6 +97,7 @@ static int vertex_parent_set_poll(bContext *C) static int vertex_parent_set_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); EditVert *eve; @@ -230,7 +231,7 @@ static int vertex_parent_set_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); WM_event_add_notifier(C, NC_OBJECT, NULL); @@ -295,6 +296,7 @@ static int make_proxy_invoke (bContext *C, wmOperator *op, wmEvent *evt) static int make_proxy_exec (bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Object *ob, *gob= CTX_data_active_object(C); GroupObject *go; Scene *scene= CTX_data_scene(C); @@ -338,7 +340,7 @@ static int make_proxy_exec (bContext *C, wmOperator *op) object_make_proxy(newob, ob, gob); /* depsgraph flushes are needed for the new data */ - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); DAG_id_flush_update(&newob->id, OB_RECALC_ALL); WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, newob); } @@ -413,6 +415,8 @@ static EnumPropertyItem prop_clear_parent_types[] = { /* note, poll should check for editable scene */ static int parent_clear_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); + Scene *scene= CTX_data_scene(C); int type= RNA_enum_get(op->ptr, "type"); CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { @@ -431,8 +435,8 @@ static int parent_clear_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_scene_sort(CTX_data_scene(C)); - DAG_ids_flush_update(0); + DAG_scene_sort(bmain, scene); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); return OPERATOR_FINISHED; @@ -517,6 +521,7 @@ void ED_object_parent(Object *ob, Object *par, int type, const char *substr) static int parent_set_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *par= CTX_data_active_object(C); bPoseChannel *pchan= NULL; @@ -594,15 +599,15 @@ static int parent_set_exec(bContext *C, wmOperator *op) switch (partype) { case PAR_CURVE: /* curve deform */ - md= ED_object_modifier_add(op->reports, scene, ob, NULL, eModifierType_Curve); + md= ED_object_modifier_add(op->reports, bmain, scene, ob, NULL, eModifierType_Curve); ((CurveModifierData *)md)->object= par; break; case PAR_LATTICE: /* lattice deform */ - md= ED_object_modifier_add(op->reports, scene, ob, NULL, eModifierType_Lattice); + md= ED_object_modifier_add(op->reports, bmain, scene, ob, NULL, eModifierType_Lattice); ((LatticeModifierData *)md)->object= par; break; default: /* armature deform */ - md= ED_object_modifier_add(op->reports, scene, ob, NULL, eModifierType_Armature); + md= ED_object_modifier_add(op->reports, bmain, scene, ob, NULL, eModifierType_Armature); ((ArmatureModifierData *)md)->object= par; break; } @@ -657,8 +662,8 @@ static int parent_set_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_scene_sort(scene); - DAG_ids_flush_update(0); + DAG_scene_sort(bmain, scene); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); return OPERATOR_FINISHED; @@ -719,6 +724,7 @@ void OBJECT_OT_parent_set(wmOperatorType *ot) static int parent_noinv_set_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Object *par= CTX_data_active_object(C); par->recalc |= OB_RECALC_OB; @@ -745,8 +751,8 @@ static int parent_noinv_set_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_scene_sort(CTX_data_scene(C)); - DAG_ids_flush_update(0); + DAG_scene_sort(bmain, CTX_data_scene(C)); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); return OPERATOR_FINISHED; @@ -772,6 +778,7 @@ void OBJECT_OT_parent_no_inverse_set(wmOperatorType *ot) static int object_slow_parent_clear_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { @@ -786,7 +793,7 @@ static int object_slow_parent_clear_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_SCENE, scene); return OPERATOR_FINISHED; @@ -813,6 +820,7 @@ void OBJECT_OT_slow_parent_clear(wmOperatorType *ot) static int object_slow_parent_set_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { @@ -824,7 +832,7 @@ static int object_slow_parent_set_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_SCENE, scene); return OPERATOR_FINISHED; @@ -858,6 +866,8 @@ static EnumPropertyItem prop_clear_track_types[] = { /* note, poll should check for editable scene */ static int object_track_clear_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); + Scene *scene= CTX_data_scene(C); int type= RNA_enum_get(op->ptr, "type"); if(CTX_data_edit_object(C)) { @@ -883,8 +893,8 @@ static int object_track_clear_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_ids_flush_update(0); - DAG_scene_sort(CTX_data_scene(C)); + DAG_ids_flush_update(bmain, 0); + DAG_scene_sort(bmain, scene); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); return OPERATOR_FINISHED; @@ -920,6 +930,7 @@ static EnumPropertyItem prop_make_track_types[] = { static int track_set_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *obact= CTX_data_active_object(C); @@ -987,8 +998,8 @@ static int track_set_exec(bContext *C, wmOperator *op) CTX_DATA_END; } - DAG_scene_sort(scene); - DAG_ids_flush_update(0); + DAG_scene_sort(bmain, scene); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); return OPERATOR_FINISHED; @@ -1057,6 +1068,7 @@ static int move_to_layer_invoke(bContext *C, wmOperator *op, wmEvent *event) static int move_to_layer_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); View3D *v3d= CTX_wm_view3d(C); unsigned int lay, local; @@ -1097,7 +1109,7 @@ static int move_to_layer_exec(bContext *C, wmOperator *op) /* warning, active object may be hidden now */ WM_event_add_notifier(C, NC_SCENE|NC_OBJECT|ND_DRAW, scene); /* is NC_SCENE needed ? */ - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); return OPERATOR_FINISHED; } @@ -1123,10 +1135,10 @@ void OBJECT_OT_move_to_layer(wmOperatorType *ot) /************************** Link to Scene Operator *****************************/ -void link_to_scene(unsigned short nr) +void link_to_scene(Main *bmain, unsigned short nr) { #if 0 - Scene *sce= (Scene*) BLI_findlink(&G.main->scene, G.curscreen->scenenr-1); + Scene *sce= (Scene*) BLI_findlink(&bmain->scene, G.curscreen->scenenr-1); Base *base, *nbase; if(sce==0) return; @@ -1146,6 +1158,7 @@ void link_to_scene(unsigned short nr) static int make_links_scene_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene_to= BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene")); if(scene_to==NULL) { @@ -1174,7 +1187,7 @@ static int make_links_scene_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); /* one day multiple scenes will be visible, then we should have some update function for them */ return OPERATOR_FINISHED; @@ -1214,6 +1227,7 @@ static int allow_make_links_data(int ev, Object *ob, Object *obt) static int make_links_data_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); int event = RNA_int_get(op->ptr, "type"); Object *ob; ID *id; @@ -1266,7 +1280,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, CTX_wm_view3d(C)); return OPERATOR_FINISHED; } @@ -1396,7 +1410,7 @@ void new_id_matar(Material **matar, int totcol) } } -void single_obdata_users(Scene *scene, int flag) +void single_obdata_users(Main *bmain, Scene *scene, int flag) { Object *ob; Lamp *la; @@ -1512,7 +1526,7 @@ void single_obdata_users(Scene *scene, int flag) } } - me= G.main->mesh.first; + me= bmain->mesh.first; while(me) { ID_NEW(me->texcomesh); me= me->id.next; @@ -1610,10 +1624,9 @@ void do_single_tex_user(Tex **from) } } -void single_tex_users_expand() +void single_tex_users_expand(Main *bmain) { /* only when 'parent' blocks are LIB_NEW */ - Main *bmain= G.main; Material *ma; Lamp *la; World *wo; @@ -1650,10 +1663,9 @@ void single_tex_users_expand() } } -static void single_mat_users_expand(void) +static void single_mat_users_expand(Main *bmain) { /* only when 'parent' blocks are LIB_NEW */ - Main *bmain= G.main; Object *ob; Mesh *me; Curve *cu; @@ -1686,14 +1698,14 @@ static void single_mat_users_expand(void) } /* used for copying scenes */ -void ED_object_single_users(Scene *scene, int full) +void ED_object_single_users(Main *bmain, Scene *scene, int full) { single_object_users(scene, NULL, 0); if(full) { - single_obdata_users(scene, 0); - single_mat_users_expand(); - single_tex_users_expand(); + single_obdata_users(bmain, scene, 0); + single_mat_users_expand(bmain); + single_tex_users_expand(bmain); } clear_id_newpoins(); @@ -1828,6 +1840,7 @@ void OBJECT_OT_make_local(wmOperatorType *ot) static int make_single_user_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); View3D *v3d= CTX_wm_view3d(C); /* ok if this is NULL */ int flag= RNA_enum_get(op->ptr, "type"); /* 0==ALL, SELECTED==selected objecs */ @@ -1836,7 +1849,7 @@ static int make_single_user_exec(bContext *C, wmOperator *op) single_object_users(scene, v3d, flag); if(RNA_boolean_get(op->ptr, "obdata")) - single_obdata_users(scene, flag); + single_obdata_users(bmain, scene, flag); if(RNA_boolean_get(op->ptr, "material")) single_mat_users(scene, flag, FALSE); @@ -1885,6 +1898,7 @@ void OBJECT_OT_make_single_user(wmOperatorType *ot) static int drop_named_material_invoke(bContext *C, wmOperator *op, wmEvent *event) { + Main *bmain= CTX_data_main(C); Base *base= ED_view3d_give_base_under_cursor(C, event->mval); Material *ma; char name[32]; @@ -1896,7 +1910,7 @@ static int drop_named_material_invoke(bContext *C, wmOperator *op, wmEvent *even assign_material(base->object, ma, 1); - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, CTX_wm_view3d(C)); return OPERATOR_FINISHED; diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index 7eedefc358b..3c86c135914 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -53,6 +53,7 @@ #include "BKE_report.h" #include "BKE_scene.h" #include "BKE_utildefines.h" +#include "BKE_deform.h" #include "WM_api.h" #include "WM_types.h" @@ -824,130 +825,17 @@ void OBJECT_OT_select_same_group(wmOperatorType *ot) } /**************************** Select Mirror ****************************/ - -/* finds the best possible flipped name. For renaming; check for unique names afterwards */ -/* if strip_number: removes number extensions */ -void object_flip_name (char *name) -{ - int len; - char prefix[128]={""}; /* The part before the facing */ - char suffix[128]={""}; /* The part after the facing */ - char replace[128]={""}; /* The replacement string */ - char number[128]={""}; /* The number extension string */ - char *index=NULL; - - len= strlen(name); - if(len<3) return; // we don't do names like .R or .L - - /* We first check the case with a .### extension, let's find the last period */ - if(isdigit(name[len-1])) { - index= strrchr(name, '.'); // last occurrence - if (index && isdigit(index[1]) ) { // doesnt handle case bone.1abc2 correct..., whatever! - strcpy(number, index); - *index= 0; - len= strlen(name); - } - } - - strcpy (prefix, name); - -#define IS_SEPARATOR(a) ((a)=='.' || (a)==' ' || (a)=='-' || (a)=='_') - - /* first case; separator . - _ with extensions r R l L */ - if( IS_SEPARATOR(name[len-2]) ) { - switch(name[len-1]) { - case 'l': - prefix[len-1]= 0; - strcpy(replace, "r"); - break; - case 'r': - prefix[len-1]= 0; - strcpy(replace, "l"); - break; - case 'L': - prefix[len-1]= 0; - strcpy(replace, "R"); - break; - case 'R': - prefix[len-1]= 0; - strcpy(replace, "L"); - break; - } - } - /* case; beginning with r R l L , with separator after it */ - else if( IS_SEPARATOR(name[1]) ) { - switch(name[0]) { - case 'l': - strcpy(replace, "r"); - strcpy(suffix, name+1); - prefix[0]= 0; - break; - case 'r': - strcpy(replace, "l"); - strcpy(suffix, name+1); - prefix[0]= 0; - break; - case 'L': - strcpy(replace, "R"); - strcpy(suffix, name+1); - prefix[0]= 0; - break; - case 'R': - strcpy(replace, "L"); - strcpy(suffix, name+1); - prefix[0]= 0; - break; - } - } - else if(len > 5) { - /* hrms, why test for a separator? lets do the rule 'ultimate left or right' */ - index = BLI_strcasestr(prefix, "right"); - if (index==prefix || index==prefix+len-5) { - if(index[0]=='r') - strcpy (replace, "left"); - else { - if(index[1]=='I') - strcpy (replace, "LEFT"); - else - strcpy (replace, "Left"); - } - *index= 0; - strcpy (suffix, index+5); - } - else { - index = BLI_strcasestr(prefix, "left"); - if (index==prefix || index==prefix+len-4) { - if(index[0]=='l') - strcpy (replace, "right"); - else { - if(index[1]=='E') - strcpy (replace, "RIGHT"); - else - strcpy (replace, "Right"); - } - *index= 0; - strcpy (suffix, index+4); - } - } - } - -#undef IS_SEPARATOR - - sprintf (name, "%s%s%s%s", prefix, replace, suffix, number); -} - static int object_select_mirror_exec(bContext *C, wmOperator *op) { - char tmpname[32]; short extend; extend= RNA_boolean_get(op->ptr, "extend"); CTX_DATA_BEGIN(C, Base*, primbase, selected_bases) { - strcpy(tmpname, primbase->object->id.name+2); - object_flip_name(tmpname); - + char tmpname[32]; + flip_side_name(tmpname, primbase->object->id.name+2, TRUE); + CTX_DATA_BEGIN(C, Base*, secbase, visible_bases) { if(!strcmp(secbase->object->id.name+2, tmpname)) { ED_base_object_select(secbase, BA_SELECT); diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index cd66b9ab2ba..d7961a8cd2b 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -68,6 +68,7 @@ static int object_location_clear_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Location"); @@ -102,7 +103,7 @@ static int object_location_clear_exec(bContext *C, wmOperator *op) CTX_DATA_END; /* this is needed so children are also updated */ - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); @@ -126,6 +127,7 @@ void OBJECT_OT_location_clear(wmOperatorType *ot) static int object_rotation_clear_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Rotation"); @@ -182,7 +184,7 @@ static int object_rotation_clear_exec(bContext *C, wmOperator *op) axis_angle_to_eulO( oldeul, EULER_ORDER_DEFAULT,ob->rotAxis, ob->rotAngle); } else { - VECCOPY(oldeul, ob->rot); + copy_v3_v3(oldeul, ob->rot); } eul[0]= eul[1]= eul[2]= 0.0f; @@ -244,7 +246,7 @@ static int object_rotation_clear_exec(bContext *C, wmOperator *op) CTX_DATA_END; /* this is needed so children are also updated */ - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); @@ -268,6 +270,7 @@ void OBJECT_OT_rotation_clear(wmOperatorType *ot) static int object_scale_clear_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); KeyingSet *ks= ANIM_builtin_keyingset_get_named(NULL, "Scaling"); @@ -307,7 +310,7 @@ static int object_scale_clear_exec(bContext *C, wmOperator *op) CTX_DATA_END; /* this is needed so children are also updated */ - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); @@ -331,6 +334,7 @@ void OBJECT_OT_scale_clear(wmOperatorType *ot) static int object_origin_clear_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); float *v1, *v3, mat[3][3]; int armature_clear= 0; @@ -348,7 +352,7 @@ static int object_origin_clear_exec(bContext *C, wmOperator *op) CTX_DATA_END; if(armature_clear==0) /* in this case flush was done */ - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); @@ -694,294 +698,170 @@ void texspace_edit(Scene *scene, View3D *v3d) /********************* Set Object Center ************************/ -static EnumPropertyItem prop_set_center_types[] = { - {0, "GEOMETRY_ORIGIN", 0, "Geometry to Origin", "Move object geometry to object origin"}, - {1, "ORIGIN_GEOMETRY", 0, "Origin to Geometry", "Move object origin to center of object geometry"}, - {2, "ORIGIN_CURSOR", 0, "Origin to 3D Cursor", "Move object origin to position of the 3d cursor"}, - {0, NULL, 0, NULL, NULL} +enum { + GEOMETRY_TO_ORIGIN=0, + ORIGIN_TO_GEOMETRY, + ORIGIN_TO_CURSOR }; -/* 0 == do center, 1 == center new, 2 == center cursor */ static int object_origin_set_exec(bContext *C, wmOperator *op) { Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); - ScrArea *sa= CTX_wm_area(C); - View3D *v3d= sa->spacedata.first; Object *obedit= CTX_data_edit_object(C); Object *tob; - Mesh *me, *tme; - Curve *cu; -/* BezTriple *bezt; - BPoint *bp; */ - Nurb *nu, *nu1; - EditVert *eve; - float cent[3], centn[3], min[3], max[3], omat[3][3]; - int a, total= 0; + float cursor[3], cent[3], cent_neg[3], centn[3], min[3], max[3]; int centermode = RNA_enum_get(op->ptr, "type"); - + int around = RNA_enum_get(op->ptr, "center"); /* initialized from v3d->around */ + /* keep track of what is changed */ int tot_change=0, tot_lib_error=0, tot_multiuser_arm_error=0; - MVert *mvert; - if(scene->id.lib || v3d==NULL){ - BKE_report(op->reports, RPT_ERROR, "Operation cannot be performed on Lib data"); - return OPERATOR_CANCELLED; - } - if (obedit && centermode > 0) { + if (obedit && centermode != GEOMETRY_TO_ORIGIN) { BKE_report(op->reports, RPT_ERROR, "Operation cannot be performed in EditMode"); return OPERATOR_CANCELLED; - } - cent[0]= cent[1]= cent[2]= 0.0; - - if(obedit) { + } + else { + /* get the view settings if 'around' isnt set and the view is available */ + View3D *v3d= CTX_wm_view3d(C); + copy_v3_v3(cursor, give_cursor(scene, v3d)); + if(v3d && !RNA_property_is_set(op->ptr, "around")) + around= v3d->around; + } + + zero_v3(cent); + if(obedit) { INIT_MINMAX(min, max); - + if(obedit->type==OB_MESH) { Mesh *me= obedit->data; EditMesh *em = BKE_mesh_get_editmesh(me); + EditVert *eve; - for(eve= em->verts.first; eve; eve= eve->next) { - if(v3d->around==V3D_CENTROID) { + if(around==V3D_CENTROID) { + int total= 0; + for(eve= em->verts.first; eve; eve= eve->next) { total++; - VECADD(cent, cent, eve->co); + add_v3_v3(cent, eve->co); } - else { - DO_MINMAX(eve->co, min, max); - } - } - - if(v3d->around==V3D_CENTROID) { mul_v3_fl(cent, 1.0f/(float)total); } else { - cent[0]= (min[0]+max[0])/2.0f; - cent[1]= (min[1]+max[1])/2.0f; - cent[2]= (min[2]+max[2])/2.0f; + for(eve= em->verts.first; eve; eve= eve->next) { + DO_MINMAX(eve->co, min, max); + } + mid_v3_v3v3(cent, min, max); } - + for(eve= em->verts.first; eve; eve= eve->next) { - sub_v3_v3(eve->co, cent); + sub_v3_v3(eve->co, cent); } - + recalc_editnormals(em); tot_change++; DAG_id_flush_update(&obedit->id, OB_RECALC_DATA); BKE_mesh_end_editmesh(me, em); } } - + /* reset flags */ CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { ob->flag &= ~OB_DONE; } CTX_DATA_END; - for (tob= G.main->object.first; tob; tob= tob->id.next) { + for (tob= bmain->object.first; tob; tob= tob->id.next) { if(tob->data) ((ID *)tob->data)->flag &= ~LIB_DOIT; } - + CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) { if((ob->flag & OB_DONE)==0) { ob->flag |= OB_DONE; - - if(obedit==NULL && (me=get_mesh(ob)) ) { - if (me->id.lib) { - tot_lib_error++; - } else { - if(centermode==2) { - VECCOPY(cent, give_cursor(scene, v3d)); - invert_m4_m4(ob->imat, ob->obmat); - mul_m4_v3(ob->imat, cent); - } else { - INIT_MINMAX(min, max); - mvert= me->mvert; - for(a=0; a<me->totvert; a++, mvert++) { - DO_MINMAX(mvert->co, min, max); - } - - cent[0]= (min[0]+max[0])/2.0f; - cent[1]= (min[1]+max[1])/2.0f; - cent[2]= (min[2]+max[2])/2.0f; - } - mvert= me->mvert; - for(a=0; a<me->totvert; a++, mvert++) { - sub_v3_v3(mvert->co, cent); - } - - if (me->key) { - KeyBlock *kb; - for (kb=me->key->block.first; kb; kb=kb->next) { - float *fp= kb->data; - - for (a=0; a<kb->totelem; a++, fp+=3) { - sub_v3_v3(fp, cent); - } - } - } + if(ob->data == NULL) { + /* pass */ + } + else if (((ID *)ob->data)->lib) { + tot_lib_error++; + } - tot_change++; - me->id.flag |= LIB_DOIT; - - if(centermode) { - copy_m3_m4(omat, ob->obmat); - - copy_v3_v3(centn, cent); - mul_m3_v3(omat, centn); - ob->loc[0]+= centn[0]; - ob->loc[1]+= centn[1]; - ob->loc[2]+= centn[2]; - - where_is_object(scene, ob); - ignore_parent_tx(bmain, scene, ob); - - /* other users? */ - CTX_DATA_BEGIN(C, Object*, ob_other, selected_editable_objects) { - if((ob_other->flag & OB_DONE)==0) { - tme= get_mesh(ob_other); - - if(tme==me) { - - ob_other->flag |= OB_DONE; - ob_other->recalc= OB_RECALC_OB|OB_RECALC_DATA; - - copy_m3_m4(omat, ob_other->obmat); - copy_v3_v3(centn, cent); - mul_m3_v3(omat, centn); - ob_other->loc[0]+= centn[0]; - ob_other->loc[1]+= centn[1]; - ob_other->loc[2]+= centn[2]; - - where_is_object(scene, ob_other); - ignore_parent_tx(bmain, scene, ob_other); - - if(!(tme->id.flag & LIB_DOIT)) { - mvert= tme->mvert; - for(a=0; a<tme->totvert; a++, mvert++) { - sub_v3_v3(mvert->co, cent); - } - - if (tme->key) { - KeyBlock *kb; - for (kb=tme->key->block.first; kb; kb=kb->next) { - float *fp= kb->data; - - for (a=0; a<kb->totelem; a++, fp+=3) { - sub_v3_v3(fp, cent); - } - } - } - - tot_change++; - tme->id.flag |= LIB_DOIT; - } - } - } - } - CTX_DATA_END; - } + if(obedit==NULL && ob->type==OB_MESH) { + Mesh *me= ob->data; + + if(centermode == ORIGIN_TO_CURSOR) { + copy_v3_v3(cent, cursor); + invert_m4_m4(ob->imat, ob->obmat); + mul_m4_v3(ob->imat, cent); + } else { + if(around==V3D_CENTROID) + mesh_center_median(me, cent); + else + mesh_center_bounds(me, cent); } + + negate_v3_v3(cent_neg, cent); + mesh_translate(me, cent_neg, 1); + + tot_change++; + me->id.flag |= LIB_DOIT; } else if (ELEM(ob->type, OB_CURVE, OB_SURF)) { - - /* weak code here... (ton) */ - if(obedit==ob) { - ListBase *editnurb= curve_get_editcurve(obedit); + Curve *cu= ob->data; - nu1= editnurb->first; - cu= obedit->data; + if(centermode == ORIGIN_TO_CURSOR) { + copy_v3_v3(cent, cursor); + invert_m4_m4(ob->imat, ob->obmat); + mul_m4_v3(ob->imat, cent); } else { - cu= ob->data; - nu1= cu->nurb.first; + if(around==V3D_CENTROID) + curve_center_median(cu, cent); + else + curve_center_bounds(cu, cent); } - - if (cu->id.lib) { - tot_lib_error++; - } else { - if(centermode==2) { - copy_v3_v3(cent, give_cursor(scene, v3d)); - invert_m4_m4(ob->imat, ob->obmat); - mul_m4_v3(ob->imat, cent); - /* don't allow Z change if curve is 2D */ - if( !( cu->flag & CU_3D ) ) - cent[2] = 0.0; - } - else { - INIT_MINMAX(min, max); - - nu= nu1; - while(nu) { - minmaxNurb(nu, min, max); - nu= nu->next; - } - - cent[0]= (min[0]+max[0])/2.0f; - cent[1]= (min[1]+max[1])/2.0f; - cent[2]= (min[2]+max[2])/2.0f; - } - - nu= nu1; - while(nu) { - if(nu->type == CU_BEZIER) { - a= nu->pntsu; - while (a--) { - sub_v3_v3(nu->bezt[a].vec[0], cent); - sub_v3_v3(nu->bezt[a].vec[1], cent); - sub_v3_v3(nu->bezt[a].vec[2], cent); - } - } - else { - a= nu->pntsu*nu->pntsv; - while (a--) - sub_v3_v3(nu->bp[a].vec, cent); - } - nu= nu->next; - } - - if(centermode && obedit==NULL) { - copy_m3_m4(omat, ob->obmat); - - mul_m3_v3(omat, cent); - ob->loc[0]+= cent[0]; - ob->loc[1]+= cent[1]; - ob->loc[2]+= cent[2]; - - where_is_object(scene, ob); - ignore_parent_tx(bmain, scene, ob); - } - - tot_change++; - cu->id.flag |= LIB_DOIT; + /* don't allow Z change if curve is 2D */ + if( !( cu->flag & CU_3D ) ) + cent[2] = 0.0; - if(obedit) { - if (centermode==0) { - DAG_id_flush_update(&obedit->id, OB_RECALC_DATA); - } - break; + negate_v3_v3(cent_neg, cent); + curve_translate(cu, cent_neg, 1); + + tot_change++; + cu->id.flag |= LIB_DOIT; + + if(obedit) { + if (centermode == GEOMETRY_TO_ORIGIN) { + DAG_id_flush_update(&obedit->id, OB_RECALC_DATA); } + break; } } else if(ob->type==OB_FONT) { /* get from bb */ - - cu= ob->data; - - if(cu->bb==NULL) { + + Curve *cu= ob->data; + + if(cu->bb==NULL && (centermode != ORIGIN_TO_CURSOR)) { /* do nothing*/ - } else if (cu->id.lib) { - tot_lib_error++; - } else { - cu->xof= -0.5f*( cu->bb->vec[4][0] - cu->bb->vec[0][0]); - cu->yof= -0.5f -0.5f*( cu->bb->vec[0][1] - cu->bb->vec[2][1]); /* extra 0.5 is the height o above line */ - - /* not really ok, do this better once! */ - cu->xof /= cu->fsize; - cu->yof /= cu->fsize; + } + else { + if(centermode == ORIGIN_TO_CURSOR) { + copy_v3_v3(cent, cursor); + invert_m4_m4(ob->imat, ob->obmat); + mul_m4_v3(ob->imat, cent); + } + else { + cent[0]= 0.5f * ( cu->bb->vec[4][0] + cu->bb->vec[0][0]); + cent[1]= 0.5f * ( cu->bb->vec[0][1] + cu->bb->vec[2][1]) - 0.5f; /* extra 0.5 is the height o above line */ + } + + cent[2]= 0.0f; + + cu->xof= cu->xof - (cent[0] / cu->fsize); + cu->yof= cu->yof - (cent[1] / cu->fsize); tot_change++; cu->id.flag |= LIB_DOIT; @@ -989,58 +869,100 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) } else if(ob->type==OB_ARMATURE) { bArmature *arm = ob->data; - - if (arm->id.lib) { - tot_lib_error++; - } else if(ID_REAL_USERS(arm) > 1) { + + if(ID_REAL_USERS(arm) > 1) { /*BKE_report(op->reports, RPT_ERROR, "Can't apply to a multi user armature"); return;*/ tot_multiuser_arm_error++; - } else { - /* Function to recenter armatures in editarmature.c + } + else { + /* Function to recenter armatures in editarmature.c * Bone + object locations are handled there. */ - docenter_armature(scene, v3d, ob, centermode); + docenter_armature(scene, ob, cursor, centermode, around); tot_change++; - cu->id.flag |= LIB_DOIT; - + arm->id.flag |= LIB_DOIT; + where_is_object(scene, ob); ignore_parent_tx(bmain, scene, ob); - - if(obedit) + + if(obedit) break; } } + + /* offset other selected objects */ + if(centermode != GEOMETRY_TO_ORIGIN) { + /* was the object data modified + * note: the functions above must set 'cent' */ + if(ob->data && (((ID *)ob->data)->flag && LIB_DOIT) && ob->type != OB_ARMATURE) { + copy_v3_v3(centn, cent); + mul_mat3_m4_v3(ob->obmat, centn); /* ommit translation part */ + add_v3_v3(ob->loc, centn); + + where_is_object(scene, ob); + ignore_parent_tx(bmain, scene, ob); + + /* other users? */ + CTX_DATA_BEGIN(C, Object*, ob_other, selected_editable_objects) { + if((ob_other->flag & OB_DONE)==0 && (ob_other->data == ob->data)) { + ob_other->flag |= OB_DONE; + ob_other->recalc= OB_RECALC_OB|OB_RECALC_DATA; + + copy_v3_v3(centn, cent); + mul_mat3_m4_v3(ob_other->obmat, centn); /* ommit translation part */ + add_v3_v3(ob_other->loc, centn); + + where_is_object(scene, ob_other); + ignore_parent_tx(bmain, scene, ob_other); + } + } + CTX_DATA_END; + } + } } } CTX_DATA_END; - for (tob= G.main->object.first; tob; tob= tob->id.next) { + for (tob= bmain->object.first; tob; tob= tob->id.next) { if(tob->data && (((ID *)tob->data)->flag & LIB_DOIT)) { tob->recalc= OB_RECALC_OB|OB_RECALC_DATA; } } - + if (tot_change) { - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); } - + /* Warn if any errors occurred */ if (tot_lib_error+tot_multiuser_arm_error) { - BKE_reportf(op->reports, RPT_WARNING, "%i Object(s) Not Centered, %i Changed:",tot_lib_error+tot_multiuser_arm_error, tot_change); + BKE_reportf(op->reports, RPT_WARNING, "%i Object(s) Not Centered, %i Changed:",tot_lib_error+tot_multiuser_arm_error, tot_change); if (tot_lib_error) BKE_reportf(op->reports, RPT_WARNING, "|%i linked library objects",tot_lib_error); if (tot_multiuser_arm_error) BKE_reportf(op->reports, RPT_WARNING, "|%i multiuser armature object(s)",tot_multiuser_arm_error); } - + return OPERATOR_FINISHED; } void OBJECT_OT_origin_set(wmOperatorType *ot) { + static EnumPropertyItem prop_set_center_types[] = { + {GEOMETRY_TO_ORIGIN, "GEOMETRY_ORIGIN", 0, "Geometry to Origin", "Move object geometry to object origin"}, + {ORIGIN_TO_GEOMETRY, "ORIGIN_GEOMETRY", 0, "Origin to Geometry", "Move object origin to center of object geometry"}, + {ORIGIN_TO_CURSOR, "ORIGIN_CURSOR", 0, "Origin to 3D Cursor", "Move object origin to position of the 3d cursor"}, + {0, NULL, 0, NULL, NULL} + }; + + static EnumPropertyItem prop_set_bounds_types[] = { + {V3D_CENTROID, "MEDIAN", 0, "Median Center", ""}, + {V3D_CENTER, "BOUNDS", 0, "Bounds Center", ""}, + {0, NULL, 0, NULL, NULL} + }; + /* identifiers */ ot->name= "Set Origin"; ot->description = "Set the object's origin, by either moving the data, or set to center of data, or use 3d cursor"; @@ -1050,12 +972,12 @@ void OBJECT_OT_origin_set(wmOperatorType *ot) ot->invoke= WM_menu_invoke; ot->exec= object_origin_set_exec; - ot->poll= ED_operator_view3d_active; + ot->poll= ED_operator_scene_editable; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; ot->prop= RNA_def_enum(ot->srna, "type", prop_set_center_types, 0, "Type", ""); - + RNA_def_enum(ot->srna, "center", prop_set_bounds_types, V3D_CENTROID, "Center", ""); } diff --git a/source/blender/editors/physics/particle_boids.c b/source/blender/editors/physics/particle_boids.c index 37de0d8f873..a18890881a8 100644 --- a/source/blender/editors/physics/particle_boids.c +++ b/source/blender/editors/physics/particle_boids.c @@ -35,6 +35,7 @@ #include "BKE_boids.h" #include "BKE_context.h" #include "BKE_depsgraph.h" +#include "BKE_main.h" #include "BKE_particle.h" #include "BLI_listbase.h" @@ -99,6 +100,7 @@ void BOID_OT_rule_add(wmOperatorType *ot) } static int rule_del_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -125,7 +127,7 @@ static int rule_del_exec(bContext *C, wmOperator *op) if(rule) rule->flag |= BOIDRULE_CURRENT; - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); DAG_id_flush_update(&psys->part->id, OB_RECALC_DATA|PSYS_RECALC_RESET); WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); @@ -266,6 +268,7 @@ void BOID_OT_state_add(wmOperatorType *ot) } static int state_del_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -297,7 +300,7 @@ static int state_del_exec(bContext *C, wmOperator *op) state->flag |= BOIDSTATE_CURRENT; - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); DAG_id_flush_update(&psys->part->id, OB_RECALC_DATA|PSYS_RECALC_RESET); WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index f463da3f6a4..d491b1a9731 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -3336,7 +3336,7 @@ static void brush_edit_apply(bContext *C, wmOperator *op, PointerRNA *itemptr) RNA_float_get_array(itemptr, "mouse", mousef); mouse[0] = mousef[0]; mouse[1] = mousef[1]; - flip= RNA_boolean_get(itemptr, "flip"); + flip= RNA_boolean_get(itemptr, "pen_flip"); if(bedit->first) { bedit->lastmouse[0]= mouse[0]; diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index 059805fdf2d..ba5d1ee5250 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -166,7 +166,7 @@ static int new_particle_settings_exec(bContext *C, wmOperator *op) psys_check_boid_data(psys); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); DAG_id_flush_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob); @@ -193,6 +193,7 @@ void PARTICLE_OT_new(wmOperatorType *ot) static int new_particle_target_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -214,7 +215,7 @@ static int new_particle_target_exec(bContext *C, wmOperator *op) BLI_addtail(&psys->targets, pt); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); DAG_id_flush_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob); @@ -238,6 +239,7 @@ void PARTICLE_OT_new_target(wmOperatorType *ot) static int remove_particle_target_exec(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); ParticleSystem *psys= ptr.data; @@ -262,7 +264,7 @@ static int remove_particle_target_exec(bContext *C, wmOperator *op) if(pt) pt->flag |= PTARGET_CURRENT; - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); DAG_id_flush_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE, ob); diff --git a/source/blender/editors/physics/physics_ops.c b/source/blender/editors/physics/physics_ops.c index 5a51c36cd09..2b7f8e9d5a2 100644 --- a/source/blender/editors/physics/physics_ops.c +++ b/source/blender/editors/physics/physics_ops.c @@ -114,7 +114,7 @@ static void keymap_particle(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "PARTICLE_OT_weight_set", KKEY, KM_PRESS, KM_SHIFT, 0); - ED_object_generic_keymap(keyconf, keymap, 1); + ED_object_generic_keymap(keyconf, keymap, 2); } /******************************* boids *************************************/ diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 7110c3aa7a7..b5392f6dede 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -403,6 +403,7 @@ static int screen_render_exec(bContext *C, wmOperator *op) Render *re= RE_NewRender(scene->id.name); Image *ima; View3D *v3d= CTX_wm_view3d(C); + Main *mainp= G.main; //BKE_undo_get_main(&scene); int lay= (v3d)? v3d->lay: scene->lay; if(re==NULL) { @@ -418,9 +419,11 @@ static int screen_render_exec(bContext *C, wmOperator *op) BKE_image_backup_render(scene, ima); if(RNA_boolean_get(op->ptr, "animation")) - RE_BlenderAnim(re, scene, lay, scene->r.sfra, scene->r.efra, scene->r.frame_step, op->reports); + RE_BlenderAnim(re, mainp, scene, lay, scene->r.sfra, scene->r.efra, scene->r.frame_step, op->reports); else - RE_BlenderFrame(re, scene, NULL, lay, scene->r.cfra); + RE_BlenderFrame(re, mainp, scene, NULL, lay, scene->r.cfra); + + //free_main(mainp); // no redraw needed, we leave state as we entered it ED_update_for_newframe(C, 1); @@ -555,19 +558,18 @@ static void image_rect_update(void *rjv, RenderResult *rr, volatile rcti *renrec static void render_startjob(void *rjv, short *stop, short *do_update, float *progress) { RenderJob *rj= rjv; -// Main *mainp= BKE_undo_get_main(&rj->scene); + Main *mainp= G.main; //BKE_undo_get_main(&rj->scene); rj->stop= stop; rj->do_update= do_update; rj->progress= progress; if(rj->anim) - RE_BlenderAnim(rj->re, rj->scene, rj->lay, rj->scene->r.sfra, rj->scene->r.efra, rj->scene->r.frame_step, rj->reports); + RE_BlenderAnim(rj->re, mainp, rj->scene, rj->lay, rj->scene->r.sfra, rj->scene->r.efra, rj->scene->r.frame_step, rj->reports); else - RE_BlenderFrame(rj->re, rj->scene, rj->srl, rj->lay, rj->scene->r.cfra); + RE_BlenderFrame(rj->re, mainp, rj->scene, rj->srl, rj->lay, rj->scene->r.cfra); -// if(mainp) -// free_main(mainp); + //free_main(mainp); } static void render_endjob(void *rjv) diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 5881d50c309..524e36b3fc9 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -241,6 +241,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op) static void screen_opengl_render_end(bContext *C, OGLRender *oglrender) { + Main *bmain= CTX_data_main(C); Scene *scene= oglrender->scene; if(oglrender->mh) { @@ -250,7 +251,7 @@ static void screen_opengl_render_end(bContext *C, OGLRender *oglrender) if(oglrender->timer) { /* exec will not have a timer */ scene->r.cfra= oglrender->cfrao; - scene_update_for_newframe(scene, screen_opengl_layers(oglrender)); + scene_update_for_newframe(bmain, scene, screen_opengl_layers(oglrender)); WM_event_remove_timer(CTX_wm_manager(C), CTX_wm_window(C), oglrender->timer); } @@ -297,6 +298,7 @@ static int screen_opengl_render_anim_initialize(bContext *C, wmOperator *op) } static int screen_opengl_render_anim_step(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); OGLRender *oglrender= op->customdata; Scene *scene= oglrender->scene; ImBuf *ibuf; @@ -316,11 +318,11 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op) if(lay & 0xFF000000) lay &= 0xFF000000; - scene_update_for_newframe(scene, lay); + scene_update_for_newframe(bmain, scene, lay); CFRA++; } - scene_update_for_newframe(scene, screen_opengl_layers(oglrender)); + scene_update_for_newframe(bmain, scene, screen_opengl_layers(oglrender)); if(view_context) { if(oglrender->rv3d->persp==RV3D_CAMOB && oglrender->v3d->camera && oglrender->v3d->scenelock) { diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 4bb1f630dad..49395f7fb56 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -704,7 +704,7 @@ void BIF_view3d_previewrender_clear(ScrArea *sa) } /* afterqueue call */ -void BIF_view3d_previewrender(Scene *scene, ScrArea *sa) +void BIF_view3d_previewrender(Main *bmain, Scene *scene, ScrArea *sa) { View3D *v3d= sa->spacedata.first; RegionView3D *rv3d= NULL; // XXX @@ -804,7 +804,7 @@ void BIF_view3d_previewrender(Scene *scene, ScrArea *sa) /* database can have created render-resol data... */ if(rstats->convertdone) - DAG_scene_flush_update(scene, scene->lay, 0); + DAG_scene_flush_update(bmain, scene, scene->lay, 0); //printf("dbase update\n"); } @@ -975,7 +975,7 @@ static void shader_preview_render(ShaderPreview *sp, ID *id, int split, int firs ((Camera *)sce->camera->data)->lens *= (float)sp->sizey/(float)sizex; /* entire cycle for render engine */ - RE_PreviewRender(re, sce); + RE_PreviewRender(re, G.main, sce); ((Camera *)sce->camera->data)->lens= oldlens; diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index cd652664f73..ba405260139 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -213,6 +213,21 @@ static void image_changed(Main *bmain, Image *ima) texture_changed(bmain, tex); } +static void scene_changed(Main *bmain, Scene *sce) +{ + Object *ob; + Material *ma; + + /* glsl */ + for(ob=bmain->object.first; ob; ob=ob->id.next) + if(ob->gpulamp.first) + GPU_lamp_free(ob); + + for(ma=bmain->mat.first; ma; ma=ma->id.next) + if(ma->gpumaterial.first) + GPU_material_free(ma); +} + void ED_render_id_flush_update(Main *bmain, ID *id) { if(!id) @@ -234,6 +249,9 @@ void ED_render_id_flush_update(Main *bmain, ID *id) case ID_IM: image_changed(bmain, (Image*)id); break; + case ID_SCE: + scene_changed(bmain, (Scene*)id); + break; default: break; } diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 952f34ae2be..8cee4a24dcc 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -51,6 +51,7 @@ #include "WM_types.h" #include "ED_image.h" +#include "ED_object.h" #include "ED_view3d.h" #include "ED_screen.h" #include "ED_screen_types.h" @@ -1369,6 +1370,8 @@ void ED_screen_set_scene(bContext *C, Scene *scene) bScreen *sc; bScreen *curscreen= CTX_wm_screen(C); + ED_object_exit_editmode(C, EM_FREEDATA|EM_DO_UNDO); + for(sc= CTX_data_main(C)->screen.first; sc; sc= sc->id.next) { if((U.flag & USER_SCENEGLOBAL) || sc==curscreen) { @@ -1423,7 +1426,7 @@ void ED_screen_set_scene(bContext *C, Scene *scene) } CTX_data_scene_set(C, scene); - set_scene_bg(scene); + set_scene_bg(CTX_data_main(C), scene); ED_update_for_newframe(C, 1); @@ -1724,6 +1727,7 @@ void ED_screen_animation_timer_update(bScreen *screen, int redraws, int refresh) /* results in fully updated anim system */ void ED_update_for_newframe(const bContext *C, int mute) { + Main *bmain= CTX_data_main(C); bScreen *screen= CTX_wm_screen(C); Scene *scene= CTX_data_scene(C); @@ -1747,7 +1751,7 @@ void ED_update_for_newframe(const bContext *C, int mute) /* this function applies the changes too */ /* XXX future: do all windows */ - scene_update_for_newframe(scene, BKE_screen_visible_layers(screen, scene)); /* BKE_scene.h */ + scene_update_for_newframe(bmain, scene, BKE_screen_visible_layers(screen, scene)); /* BKE_scene.h */ //if ( (CFRA>1) && (!mute) && (scene->r.audio.flag & AUDIO_SCRUB)) // audiostream_scrub( CFRA ); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index c8192996127..b085c8178b0 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -2838,9 +2838,9 @@ static int scene_new_exec(bContext *C, wmOperator *op) /* these can't be handled in blenkernel curently, so do them here */ if(type == SCE_COPY_LINK_DATA) - ED_object_single_users(newscene, 0); + ED_object_single_users(bmain, newscene, 0); else if(type == SCE_COPY_FULL) - ED_object_single_users(newscene, 1); + ED_object_single_users(bmain, newscene, 1); WM_event_add_notifier(C, NC_SCENE|ND_SCENEBROWSE, newscene); diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index 634829060b4..814b30a6673 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -789,7 +789,7 @@ static void paint_brush_stroke_add_step(bContext *C, wmOperator *op, wmEvent *ev Paint *paint = paint_get_active(CTX_data_scene(C)); // XXX Brush *brush = paint_brush(paint); // XXX - float mouse[2]; + float mouse[3]; PointerRNA itemptr; diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index ecce64f2d10..30b3ddf6e8d 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -216,7 +216,6 @@ void BRUSH_OT_curve_preset(wmOperatorType *ot) {CURVE_PRESET_SHARP, "SHARP", 0, "Sharp", ""}, {CURVE_PRESET_SMOOTH, "SMOOTH", 0, "Smooth", ""}, {CURVE_PRESET_MAX, "MAX", 0, "Max", ""}, - {CURVE_PRESET_MID9, "MID9", 0, "Mid9", ""}, {CURVE_PRESET_LINE, "LINE", 0, "Line", ""}, {CURVE_PRESET_ROUND, "ROUND", 0, "Round", ""}, {CURVE_PRESET_ROOT, "ROOT", 0, "Root", ""}, diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 93555613b07..8832c7c857f 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -386,9 +386,8 @@ void wpaint_fill(VPaint *wp, Object *ob, float paintweight) int actdef= 0; char name[32]; - BLI_strncpy(name, defgroup->name, 32); - bone_flip_name(name, 0); /* 0 = don't strip off number extensions */ - + flip_side_name(name, defgroup->name, FALSE); + for (curdef = ob->defbase.first; curdef; curdef=curdef->next, actdef++) if (!strcmp(curdef->name, name)) break; @@ -1390,10 +1389,9 @@ static int wpaint_stroke_test_start(bContext *C, wmOperator *op, wmEvent *event) bDeformGroup *curdef; int actdef= 0; char name[32]; - - BLI_strncpy(name, defgroup->name, 32); - bone_flip_name(name, 0); /* 0 = don't strip off number extensions */ - + + flip_side_name(name, defgroup->name, FALSE); + for (curdef = ob->defbase.first; curdef; curdef=curdef->next, actdef++) if (!strcmp(curdef->name, name)) break; @@ -1445,7 +1443,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P /* load projection matrix */ mul_m4_m4m4(mat, ob->obmat, vc->rv3d->persmat); - flip = RNA_boolean_get(itemptr, "flip"); + flip = RNA_boolean_get(itemptr, "pen_flip"); pressure = RNA_float_get(itemptr, "pressure"); RNA_float_get_array(itemptr, "mouse", mval); mval[0]-= vc->ar->winrct.xmin; @@ -1860,7 +1858,7 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P float pressure, mval[2]; RNA_float_get_array(itemptr, "mouse", mval); - flip = RNA_boolean_get(itemptr, "flip"); + flip = RNA_boolean_get(itemptr, "pen_flip"); pressure = RNA_float_get(itemptr, "pressure"); view3d_operator_needs_opengl(C); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 546fbc14dfa..3d74496ab67 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -3073,20 +3073,15 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, SculptSession cache->special_rotation = atan2(dx, dy) + M_PI; if (brush->flag & BRUSH_EDGE_TO_EDGE) { - float d[3]; - float halfway[3]; + float halfway[2]; float out[3]; - d[0] = dx; - d[1] = dy; - d[2] = 0; - - mul_v3_v3fl(halfway, d, 0.5f); - add_v3_v3(halfway, cache->initial_mouse); + halfway[0] = dx*0.5 + cache->initial_mouse[0]; + halfway[1] = dy*0.5 + cache->initial_mouse[1]; if (sculpt_stroke_get_location(C, stroke, out, halfway)) { copy_v3_v3(sd->anchored_location, out); - copy_v3_v3(sd->anchored_initial_mouse, halfway); + copy_v2_v2(sd->anchored_initial_mouse, halfway); copy_v2_v2(cache->tex_mouse, halfway); copy_v3_v3(cache->true_location, sd->anchored_location); sd->anchored_size /= 2.0f; @@ -3114,7 +3109,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, SculptSession const float dy = cache->last_rake[1] - cache->mouse[1]; if (cache->first_time) { - copy_v3_v3(cache->last_rake, cache->mouse); + copy_v2_v2(cache->last_rake, cache->mouse); } else if (dx*dx + dy*dy >= r*r) { cache->special_rotation = atan2(dx, dy); @@ -3130,7 +3125,7 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, SculptSession dx = cache->mouse[0] - cache->initial_mouse[0]; dy = cache->mouse[1] - cache->initial_mouse[1]; - cache->vertex_rotation = -atan2(dx, dy) / 4.0f; + cache->vertex_rotation = -atan2(dx, dy); sd->draw_anchored = 1; copy_v2_v2(sd->anchored_initial_mouse, cache->initial_mouse); diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index b002bec2443..a775a0b6e6a 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -191,24 +191,14 @@ void buttons_keymap(struct wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "BUTTONS_OT_toolbox", RIGHTMOUSE, KM_PRESS, 0, 0); } -//#define PY_HEADER /* add handlers, stuff you only do once or on area/region changes */ static void buttons_header_area_init(wmWindowManager *wm, ARegion *ar) { -#ifdef PY_HEADER - ED_region_header_init(ar); -#else UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_HEADER, ar->winx, ar->winy); -#endif } static void buttons_header_area_draw(const bContext *C, ARegion *ar) { -#ifdef PY_HEADER - ED_region_header(C, ar); -#else - - /* clear */ UI_ThemeClearColor(ED_screen_area_active(C)?TH_HEADER:TH_HEADERDESEL); glClear(GL_COLOR_BUFFER_BIT); @@ -217,7 +207,6 @@ static void buttons_header_area_draw(const bContext *C, ARegion *ar) UI_view2d_view_ortho(C, &ar->v2d); buttons_header_buttons(C, ar); -#endif /* restore view matrix? */ UI_view2d_view_restore(C); diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index bf433923707..a6c57126cfe 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -299,16 +299,17 @@ static void graph_panel_key_properties(const bContext *C, Panel *pa) static void do_graph_region_driver_buttons(bContext *C, void *arg, int event) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); switch (event) { case B_IPO_DEPCHANGE: { /* rebuild depsgraph for the new deps */ - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); /* force an update of depsgraph */ - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); } break; } diff --git a/source/blender/editors/space_logic/logic_header.c b/source/blender/editors/space_logic/logic_header.c deleted file mode 100644 index 3e38eb815fb..00000000000 --- a/source/blender/editors/space_logic/logic_header.c +++ /dev/null @@ -1,120 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2009 Blender Foundation. - * All rights reserved. - * - * - * Contributor(s): Blender Foundation - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include <string.h> -#include <stdio.h> - - -#include "MEM_guardedalloc.h" - -#include "BLI_blenlib.h" - -#include "BKE_context.h" -#include "BKE_screen.h" -#include "BKE_main.h" - -#include "ED_screen.h" -#include "ED_types.h" -#include "ED_util.h" - - -#include "BIF_gl.h" -#include "BIF_glutil.h" - -#include "UI_interface.h" -#include "UI_resources.h" -#include "UI_view2d.h" - -#include "logic_intern.h" - -/* ************************ header area region *********************** */ - - -static void do_logic_buttons(bContext *C, void *arg, int event) -{ -// SpaceLogic *slogic= CTX_wm_space_logic(C); -} - -static uiBlock *logic_addmenu(bContext *C, ARegion *ar, void *arg_unused) -{ -// SpaceLogic *slogic= CTX_wm_space_logic(C); - uiBlock *block; - short yco= 0, menuwidth=120; - - block= uiBeginBlock(C, ar, "logic_addmenu", UI_EMBOSSP); -// uiBlockSetButmFunc(block, do_logic_addmenu, NULL); - - uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Nothing yet", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, ""); - - uiTextBoundsBlock(block, 50); - uiBlockSetDirection(block, UI_TOP); - uiEndBlock(C, block); - - return block; -} - -void logic_header_buttons(const bContext *C, ARegion *ar) -{ - ScrArea *sa= CTX_wm_area(C); -// SpaceLogic *slogic= CTX_wm_space_logic(C); - uiBlock *block; - short xco, yco= 3; - - block= uiBeginBlock(C, ar, "header logic", UI_EMBOSS); - uiBlockSetHandleFunc(block, do_logic_buttons, NULL); - - xco= ED_area_header_standardbuttons(C, block, yco); - - if((sa->flag & HEADER_NO_PULLDOWN)==0) { - int xmax; - - xmax= GetButStringLength("View"); - uiDefPulldownBut(block, logic_addmenu, NULL, - "View", xco, yco, xmax-3, 20, ""); - xco+= xmax; - - xmax= GetButStringLength("Select"); - uiDefPulldownBut(block, logic_addmenu, NULL, - "Select", xco, yco, xmax-3, 20, ""); - xco+= xmax; - - xmax= GetButStringLength("Add"); - uiDefPulldownBut(block, logic_addmenu, NULL, - "Add", xco, yco, xmax-3, 20, ""); - xco+= xmax; - } - - uiBlockSetEmboss(block, UI_EMBOSS); - - UI_view2d_totRect_set(&ar->v2d, xco+XIC+100, (int)(ar->v2d.tot.ymax-ar->v2d.tot.ymin)); - - uiEndBlock(C, block); - uiDrawBlock(C, block); -} - - diff --git a/source/blender/editors/space_logic/logic_intern.h b/source/blender/editors/space_logic/logic_intern.h index 3b2b6497cdc..0c30aa711f1 100644 --- a/source/blender/editors/space_logic/logic_intern.h +++ b/source/blender/editors/space_logic/logic_intern.h @@ -42,9 +42,6 @@ struct Scene; /* space_logic.c */ struct ARegion *logic_has_buttons_region(struct ScrArea *sa); -/* logic_header.c */ -void logic_header_buttons(const struct bContext *C, struct ARegion *ar); - /* logic_ops.c */ /* logic_buttons.c */ diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 98422ec2d9f..ae2cee64a23 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -359,6 +359,7 @@ static void old_sca_move_actuator(bContext *C, void *datav, void *move_up) void do_logic_buts(bContext *C, void *arg, int event) { + Main *bmain= CTX_data_main(C); bSensor *sens; bController *cont; bActuator *act; @@ -382,7 +383,7 @@ void do_logic_buts(bContext *C, void *arg, int event) break; case B_ADD_SENS: - for(ob=G.main->object.first; ob; ob=ob->id.next) { + for(ob=bmain->object.first; ob; ob=ob->id.next) { if(ob->scaflag & OB_ADDSENS) { ob->scaflag &= ~OB_ADDSENS; sens= new_sensor(SENS_ALWAYS); @@ -396,7 +397,7 @@ void do_logic_buts(bContext *C, void *arg, int event) break; case B_CHANGE_SENS: - for(ob=G.main->object.first; ob; ob=ob->id.next) { + for(ob=bmain->object.first; ob; ob=ob->id.next) { sens= ob->sensors.first; while(sens) { if(sens->type != sens->otype) { @@ -410,7 +411,7 @@ void do_logic_buts(bContext *C, void *arg, int event) break; case B_DEL_SENS: - for(ob=G.main->object.first; ob; ob=ob->id.next) { + for(ob=bmain->object.first; ob; ob=ob->id.next) { sens= ob->sensors.first; while(sens) { if(sens->flag & SENS_DEL) { @@ -425,7 +426,7 @@ void do_logic_buts(bContext *C, void *arg, int event) break; case B_ADD_CONT: - for(ob=G.main->object.first; ob; ob=ob->id.next) { + for(ob=bmain->object.first; ob; ob=ob->id.next) { if(ob->scaflag & OB_ADDCONT) { ob->scaflag &= ~OB_ADDCONT; cont= new_controller(CONT_LOGIC_AND); @@ -450,7 +451,7 @@ void do_logic_buts(bContext *C, void *arg, int event) break; case B_SET_STATE_BIT: - for(ob=G.main->object.first; ob; ob=ob->id.next) { + for(ob=bmain->object.first; ob; ob=ob->id.next) { if(ob->scaflag & OB_ALLSTATE) { ob->scaflag &= ~OB_ALLSTATE; ob->state = 0x3FFFFFFF; @@ -459,7 +460,7 @@ void do_logic_buts(bContext *C, void *arg, int event) break; case B_INIT_STATE_BIT: - for(ob=G.main->object.first; ob; ob=ob->id.next) { + for(ob=bmain->object.first; ob; ob=ob->id.next) { if(ob->scaflag & OB_INITSTBIT) { ob->scaflag &= ~OB_INITSTBIT; ob->state = ob->init_state; @@ -470,7 +471,7 @@ void do_logic_buts(bContext *C, void *arg, int event) break; case B_CHANGE_CONT: - for(ob=G.main->object.first; ob; ob=ob->id.next) { + for(ob=bmain->object.first; ob; ob=ob->id.next) { cont= ob->controllers.first; while(cont) { if(cont->type != cont->otype) { @@ -485,7 +486,7 @@ void do_logic_buts(bContext *C, void *arg, int event) case B_DEL_CONT: - for(ob=G.main->object.first; ob; ob=ob->id.next) { + for(ob=bmain->object.first; ob; ob=ob->id.next) { cont= ob->controllers.first; while(cont) { if(cont->flag & CONT_DEL) { @@ -501,7 +502,7 @@ void do_logic_buts(bContext *C, void *arg, int event) break; case B_ADD_ACT: - for(ob=G.main->object.first; ob; ob=ob->id.next) { + for(ob=bmain->object.first; ob; ob=ob->id.next) { if(ob->scaflag & OB_ADDACT) { ob->scaflag &= ~OB_ADDACT; act= new_actuator(ACT_OBJECT); @@ -514,7 +515,7 @@ void do_logic_buts(bContext *C, void *arg, int event) break; case B_CHANGE_ACT: - for(ob=G.main->object.first; ob; ob=ob->id.next) { + for(ob=bmain->object.first; ob; ob=ob->id.next) { act= ob->actuators.first; while(act) { if(act->type != act->otype) { @@ -528,7 +529,7 @@ void do_logic_buts(bContext *C, void *arg, int event) break; case B_DEL_ACT: - for(ob=G.main->object.first; ob; ob=ob->id.next) { + for(ob=bmain->object.first; ob; ob=ob->id.next) { act= ob->actuators.first; while(act) { if(act->flag & ACT_DEL) { @@ -546,7 +547,7 @@ void do_logic_buts(bContext *C, void *arg, int event) case B_SOUNDACT_BROWSE: /* since we don't know which... */ didit= 0; - for(ob=G.main->object.first; ob; ob=ob->id.next) { + for(ob=bmain->object.first; ob; ob=ob->id.next) { act= ob->actuators.first; while(act) { @@ -555,11 +556,11 @@ void do_logic_buts(bContext *C, void *arg, int event) bSoundActuator *sa= act->data; if(sa->sndnr) { - bSound *sound= G.main->sound.first; + bSound *sound= bmain->sound.first; int nr= 1; if(sa->sndnr == -2) { -// XXX activate_databrowse((ID *)G.main->sound.first, ID_SO, 0, B_SOUNDACT_BROWSE, +// XXX activate_databrowse((ID *)bmain->sound.first, ID_SO, 0, B_SOUNDACT_BROWSE, // &sa->sndnr, do_logic_buts); break; } @@ -768,6 +769,7 @@ static void set_sca_ob(Object *ob) static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisflag) { Base *base; + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *ob, *obt, *obact= CTX_data_active_object(C); ID **idar; @@ -784,7 +786,7 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf if(scene==NULL) return NULL; - ob= G.main->object.first; + ob= bmain->object.first; while(ob) { ob->scavisflag= 0; set_sca_ob(ob); @@ -818,7 +820,7 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf while(doit) { doit= 0; - ob= G.main->object.first; + ob= bmain->object.first; while(ob) { /* 1st case: select sensor when controller selected */ @@ -899,7 +901,7 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf } /* now we count */ - ob= G.main->object.first; + ob= bmain->object.first; while(ob) { if( ob->scavisflag ) (*count)++; ob= ob->id.next; @@ -910,7 +912,7 @@ static ID **get_selected_and_linked_obs(bContext *C, short *count, short scavisf idar= MEM_callocN( (*count)*sizeof(void *), "idar"); - ob= G.main->object.first; + ob= bmain->object.first; nr= 0; /* make the active object always the first one of the list */ @@ -1817,7 +1819,7 @@ static void check_armature_actuator(bContext *C, void *arg1_but, void *arg2_act) } -static short draw_actuatorbuttons(Object *ob, bActuator *act, uiBlock *block, short xco, short yco, short width) +static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlock *block, short xco, short yco, short width) { bSoundActuator *sa = NULL; bObjectActuator *oa = NULL; @@ -2142,8 +2144,8 @@ static short draw_actuatorbuttons(Object *ob, bActuator *act, uiBlock *block, sh glRects(xco, yco-ysize, xco+width, yco); uiEmboss((float)xco, (float)yco-ysize, (float)xco+width, (float)yco, 1); - if(G.main->sound.first) { - IDnames_to_pupstring(&str, "Sound files", NULL, &(G.main->sound), (ID *)sa->sound, &(sa->sndnr)); + if(bmain->sound.first) { + IDnames_to_pupstring(&str, "Sound files", NULL, &(bmain->sound), (ID *)sa->sound, &(sa->sndnr)); /* reset this value, it is for handling the event */ sa->sndnr = 0; uiDefButS(block, MENU, B_SOUNDACT_BROWSE, str, xco+10,yco-22,20,19, &(sa->sndnr), 0, 0, 0, 0, ""); @@ -4709,6 +4711,7 @@ static void logic_buttons_new(bContext *C, ARegion *ar) void logic_buttons(bContext *C, ARegion *ar) { + Main *bmain= CTX_data_main(C); SpaceLogic *slogic= CTX_wm_space_logic(C); Object *ob= CTX_data_active_object(C); ID **idar; @@ -5033,7 +5036,7 @@ void logic_buttons(bContext *C, ARegion *ar) uiButSetFunc(but, make_unique_prop_names_cb, act->name, (void*) 0); ycoo= yco; - yco= draw_actuatorbuttons(ob, act, block, xco, yco, width); + yco= draw_actuatorbuttons(bmain, ob, act, block, xco, yco, width); if(yco-6 < ycoo) ycoo= (yco+ycoo-20)/2; } else { diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c index ed3d956ce01..3f11c3e6bae 100644 --- a/source/blender/editors/space_logic/space_logic.c +++ b/source/blender/editors/space_logic/space_logic.c @@ -296,17 +296,7 @@ static void logic_header_area_init(wmWindowManager *wm, ARegion *ar) static void logic_header_area_draw(const bContext *C, ARegion *ar) { - /* clear */ - UI_ThemeClearColor(ED_screen_area_active(C)?TH_HEADER:TH_HEADERDESEL); - glClear(GL_COLOR_BUFFER_BIT); - - /* set view2d view matrix for scrolling (without scrollers) */ - UI_view2d_view_ortho(C, &ar->v2d); - - logic_header_buttons(C, ar); - - /* restore view matrix? */ - UI_view2d_view_restore(C); + ED_region_header(C, ar); } /**************************** spacetype *****************************/ diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 082f3f97dfd..01992d225c7 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -190,6 +190,7 @@ static void node_buts_normal(uiLayout *layout, bContext *C, PointerRNA *ptr) #if 0 // not used in 2.5x yet static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v) { + Main *bmain= CTX_data_main(C); bNodeTree *ntree= ntree_v; bNode *node= node_v; Tex *tex; @@ -200,7 +201,7 @@ static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v) node->id->us--; node->id= NULL; } - tex= BLI_findlink(&G.main->tex, node->menunr-1); + tex= BLI_findlink(&bmain->tex, node->menunr-1); node->id= &tex->id; id_us_plus(node->id); @@ -220,6 +221,7 @@ static void node_browse_tex_cb(bContext *C, void *ntree_v, void *node_v) #endif static void node_dynamic_update_cb(bContext *C, void *ntree_v, void *node_v) { + Main *bmain= CTX_data_main(C); Material *ma; bNode *node= (bNode *)node_v; ID *id= node->id; @@ -229,7 +231,7 @@ static void node_dynamic_update_cb(bContext *C, void *ntree_v, void *node_v) /* Users only have to press the "update" button in one pynode * and we also update all others sharing the same script */ - for (ma= G.main->mat.first; ma; ma= ma->id.next) { + for (ma= bmain->mat.first; ma; ma= ma->id.next) { if (ma->nodetree) { bNode *nd; for (nd= ma->nodetree->nodes.first; nd; nd= nd->next) { @@ -277,6 +279,7 @@ static void node_buts_math(uiLayout *layout, bContext *C, PointerRNA *ptr) static void node_browse_text_cb(bContext *C, void *ntree_v, void *node_v) { + Main *bmain= CTX_data_main(C); bNodeTree *ntree= ntree_v; bNode *node= node_v; ID *oldid; @@ -287,7 +290,7 @@ static void node_browse_text_cb(bContext *C, void *ntree_v, void *node_v) node->id->us--; } oldid= node->id; - node->id= BLI_findlink(&G.main->text, node->menunr-1); + node->id= BLI_findlink(&bmain->text, node->menunr-1); id_us_plus(node->id); BLI_strncpy(node->name, node->id->name+2, 21); /* huh? why 21? */ @@ -368,6 +371,7 @@ static void node_shader_buts_geometry(uiLayout *layout, bContext *C, PointerRNA static void node_shader_buts_dynamic(uiLayout *layout, bContext *C, PointerRNA *ptr) { + Main *bmain= CTX_data_main(C); uiBlock *block= uiLayoutAbsoluteBlock(layout); bNode *node= ptr->data; bNodeTree *ntree= ptr->id.data; @@ -380,7 +384,7 @@ static void node_shader_buts_dynamic(uiLayout *layout, bContext *C, PointerRNA * /* B_NODE_EXEC is handled in butspace.c do_node_buts */ if(!node->id) { char *strp; - IDnames_to_pupstring(&strp, NULL, "", &(G.main->text), NULL, NULL); + IDnames_to_pupstring(&strp, NULL, "", &(bmain->text), NULL, NULL); node->menunr= 0; bt= uiDefButS(block, MENU, B_NODE_EXEC/*+node->nr*/, strp, butr->xmin, dy, 19, 19, diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index cea88c33c5b..dcd87b89ea0 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -1852,6 +1852,7 @@ void NODE_OT_links_cut(wmOperatorType *ot) /* goes over all scenes, reads render layers */ static int node_read_renderlayers_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); SpaceNode *snode= CTX_wm_space_node(C); Scene *curscene= CTX_data_scene(C), *scene; bNode *node; @@ -1859,7 +1860,7 @@ static int node_read_renderlayers_exec(bContext *C, wmOperator *op) ED_preview_kill_jobs(C); /* first tag scenes unread */ - for(scene= G.main->scene.first; scene; scene= scene->id.next) + for(scene= bmain->scene.first; scene; scene= scene->id.next) scene->id.flag |= LIB_DOIT; for(node= snode->edittree->nodes.first; node; node= node->next) { diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index fc85d2a80bb..5bdcc5d37fb 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -3186,7 +3186,7 @@ static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, TreeSto if(scene->obedit==base->object) ED_object_exit_editmode(C, EM_FREEDATA|EM_FREEUNDO|EM_WAITCURSOR|EM_DO_UNDO); - ED_base_object_free_and_unlink(scene, base); + ED_base_object_free_and_unlink(CTX_data_main(C), scene, base); te->directdata= NULL; tselem->id= NULL; } @@ -3337,7 +3337,7 @@ void outliner_del(bContext *C, Scene *scene, ARegion *ar, SpaceOops *soops) ;// del_seq(); else { outliner_do_object_operation(C, scene, soops, &soops->tree, object_delete_cb); - DAG_scene_sort(scene); + DAG_scene_sort(CTX_data_main(C), scene); ED_undo_push(C, "Delete Objects"); } } @@ -3356,6 +3356,7 @@ static EnumPropertyItem prop_object_op_types[] = { static int outliner_object_operation_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); SpaceOops *soops= CTX_wm_space_outliner(C); int event; @@ -3382,7 +3383,7 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op) } else if(event==4) { outliner_do_object_operation(C, scene, soops, &soops->tree, object_delete_cb); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); str= "Delete Objects"; } else if(event==5) { /* disabled, see above (ton) */ diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c index 4d51ac05fbd..b00fcfcc22a 100644 --- a/source/blender/editors/space_sequencer/sequencer_add.c +++ b/source/blender/editors/space_sequencer/sequencer_add.c @@ -181,7 +181,9 @@ static void seq_load_operator_info(SeqLoadInfo *seq_load, wmOperator *op) /* used for image strip */ /* best guess, first images name */ RNA_BEGIN(op->ptr, itemptr, "files") { - RNA_string_get(&itemptr, "name", seq_load->name); + char *name= RNA_string_get_alloc(&itemptr, "name", NULL, 0); + BLI_strncpy(seq_load->name, name, sizeof(seq_load->name)); + MEM_freeN(name); break; } RNA_END; diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 5d258ea0054..a55b2e77431 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -2420,9 +2420,9 @@ void SEQUENCER_OT_previous_edit(wmOperatorType *ot) static void swap_sequence(Scene* scene, Sequence* seqa, Sequence* seqb) { int gap = seqb->startdisp - seqa->enddisp; - seqb->start = seqa->start; + seqb->start = (seqb->start - seqb->startdisp) + seqa->startdisp; calc_sequence(scene, seqb); - seqa->start = seqb->enddisp + gap; + seqa->start = (seqa->start - seqa->startdisp) + seqb->enddisp + gap; calc_sequence(scene, seqa); } diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 91fb616a63f..7a3f0ff80e5 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -218,7 +218,7 @@ static int open_exec(bContext *C, wmOperator *op) PropertyPointerRNA *pprop; PointerRNA idptr; char str[FILE_MAX]; - short internal = RNA_int_get(op->ptr, "internal"); + short internal = RNA_boolean_get(op->ptr, "internal"); RNA_string_get(op->ptr, "filepath", str); @@ -902,15 +902,22 @@ void TEXT_OT_unindent(wmOperatorType *ot) static int line_break_exec(bContext *C, wmOperator *op) { + SpaceText *st= CTX_wm_space_text(C); Text *text= CTX_data_edit_text(C); - int a, curtab; + int a, curts; + int space = (text->flags & TXT_TABSTOSPACES) ? st->tabnumber : 1; - // double check tabs before splitting the line - curtab= setcurr_tab(text); + // double check tabs/spaces before splitting the line + curts= setcurr_tab_spaces(text, space); txt_split_curline(text); - for(a=0; a < curtab; a++) - txt_add_char(text, '\t'); + for(a=0; a < curts; a++) { + if (text->flags & TXT_TABSTOSPACES) { + txt_add_char(text, ' '); + } else { + txt_add_char(text, '\t'); + } + } if(text->curl) { if(text->curl->prev) @@ -2352,6 +2359,7 @@ void TEXT_OT_insert(wmOperatorType *ot) static int find_and_replace(bContext *C, wmOperator *op, short mode) { + Main *bmain= CTX_data_main(C); SpaceText *st= CTX_wm_space_text(C); Text *start= NULL, *text= st->text; int flags, first= 1; @@ -2413,7 +2421,7 @@ static int find_and_replace(bContext *C, wmOperator *op, short mode) if(text->id.next) text= st->text= text->id.next; else - text= st->text= G.main->text.first; + text= st->text= bmain->text.first; txt_move_toline(text, 0, 0); text_update_cursor_moved(C); WM_event_add_notifier(C, NC_TEXT|ND_CURSOR, text); diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index d16f89e5785..5e0c49e6224 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -1882,15 +1882,12 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, /* Draw additional axes on the bone tail */ if ( (arm->flag & ARM_DRAWAXES) && (arm->flag & ARM_POSEMODE) ) { - float mat[4][4]; glPushMatrix(); copy_m4_m4(bmat, pchan->pose_mat); bone_matrix_translate_y(bmat, pchan->bone->length); glMultMatrixf(bmat); - mul_m4_m4m4(mat, bmat, rv3d->viewmatob); - - drawaxes(rv3d, mat, pchan->bone->length*0.25f, 0, OB_ARROWS); + drawaxes(pchan->bone->length*0.25f, 0, OB_ARROWS); glPopMatrix(); } @@ -2078,16 +2075,12 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, int dt) } /* Draw additional axes */ if (arm->flag & ARM_DRAWAXES) { - float mat[4][4]; glPushMatrix(); get_matrix_editbone(eBone, bmat); bone_matrix_translate_y(bmat, eBone->length); glMultMatrixf(bmat); - mul_m4_m4m4(mat, bmat, rv3d->viewmatob); - - /* do cached text draw immediate to include transform */ - drawaxes(rv3d, mat, eBone->length*0.25f, 0, OB_ARROWS); + drawaxes(eBone->length*0.25f, 0, OB_ARROWS); glPopMatrix(); } diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 30bfa123007..54775affe3f 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -146,7 +146,7 @@ static void view3d_project_short_clip(ARegion *ar, float *vec, short *adr, int l return; } - VECCOPY(vec4, vec); + copy_v3_v3(vec4, vec); vec4[3]= 1.0; mul_m4_v4(rv3d->persmatob, vec4); @@ -175,7 +175,7 @@ static void view3d_project_short_noclip(ARegion *ar, float *vec, short *adr) adr[0]= IS_CLIPPED; - VECCOPY(vec4, vec); + copy_v3_v3(vec4, vec); vec4[3]= 1.0; mul_m4_v4(rv3d->persmatob, vec4); @@ -321,31 +321,12 @@ static float cosval[32] ={ 1.00000000 }; -static void draw_xyz_wire(RegionView3D *rv3d, float mat[][4], float *c, float size, int axis) +static void draw_xyz_wire(float *c, float size, int axis) { float v1[3]= {0.f, 0.f, 0.f}, v2[3] = {0.f, 0.f, 0.f}; - float imat[4][4]; - float dim; - float dx[3], dy[3]; - - /* hrms, really only works properly after glLoadMatrixf(rv3d->viewmat); */ - float pixscale= rv3d->persmat[0][3]*c[0]+ rv3d->persmat[1][3]*c[1]+ rv3d->persmat[2][3]*c[2] + rv3d->persmat[3][3]; - pixscale*= rv3d->pixsize; - - /* halfway blend between fixed size in worldspace vs viewspace - - * alleviates some of the weirdness due to not using viewmat for gl matrix */ - dim = (0.05*size*0.5) + (size*10.f*pixscale*0.5); - - invert_m4_m4(imat, mat); - normalize_v3(imat[0]); - normalize_v3(imat[1]); - - copy_v3_v3(dx, imat[0]); - copy_v3_v3(dy, imat[1]); + float dim = size * 0.1; + float dx[3]={dim, 0.0, 0.0}, dy[3]={0.0, dim, 0.0}, dz[3]={0.0, 0.0, dim}; - mul_v3_fl(dx, dim); - mul_v3_fl(dy, dim); - switch(axis) { case 0: /* x axis */ glBegin(GL_LINES); @@ -397,7 +378,7 @@ static void draw_xyz_wire(RegionView3D *rv3d, float mat[][4], float *c, float si /* start at top left */ sub_v3_v3v3(v1, c, dx); - add_v3_v3v3(v1, c, dy); + add_v3_v3v3(v1, c, dz); glVertex3fv(v1); @@ -406,9 +387,9 @@ static void draw_xyz_wire(RegionView3D *rv3d, float mat[][4], float *c, float si glVertex3fv(v1); - mul_v3_fl(dy, 2.f); + mul_v3_fl(dz, 2.f); sub_v3_v3(v1, dx); - sub_v3_v3(v1, dy); + sub_v3_v3(v1, dz); glVertex3fv(v1); @@ -423,7 +404,7 @@ static void draw_xyz_wire(RegionView3D *rv3d, float mat[][4], float *c, float si } /* flag is same as for draw_object */ -void drawaxes(RegionView3D *rv3d, float mat[][4], float size, int flag, char drawtype) +void drawaxes(float size, int flag, char drawtype) { int axis; float v1[3]= {0.0, 0.0, 0.0}; @@ -465,11 +446,11 @@ void drawaxes(RegionView3D *rv3d, float mat[][4], float size, int flag, char dra for (axis=0; axis<4; axis++) { if (axis % 2 == 1) { - v2[0] *= -1; - v3[1] *= -1; + v2[0] = -v2[0]; + v3[1] = -v3[1]; } else { - v2[1] *= -1; - v3[0] *= -1; + v2[1] = -v2[1]; + v3[0] = -v3[0]; } glVertex3fv(v1); @@ -522,7 +503,7 @@ void drawaxes(RegionView3D *rv3d, float mat[][4], float size, int flag, char dra v2[axis]+= size*0.125; - draw_xyz_wire(rv3d, mat, v2, size, axis); + draw_xyz_wire(v2, size, axis); } break; } @@ -532,12 +513,10 @@ void drawcircball(int mode, float *cent, float rad, float tmat[][4]) { float vec[3], vx[3], vy[3]; int a, tot=32; - - VECCOPY(vx, tmat[0]); - VECCOPY(vy, tmat[1]); - mul_v3_fl(vx, rad); - mul_v3_fl(vy, rad); - + + mul_v3_v3fl(vx, tmat[0], rad); + mul_v3_v3fl(vy, tmat[1], rad); + glBegin(mode); for(a=0; a<tot; a++) { vec[0]= cent[0] + *(sinval+a) * vx[0] + *(cosval+a) * vy[0]; @@ -777,14 +756,8 @@ static void drawshadbuflimits(Lamp *la, float mat[][4]) negate_v3_v3(lavec, mat[2]); normalize_v3(lavec); - sta[0]= mat[3][0]+ la->clipsta*lavec[0]; - sta[1]= mat[3][1]+ la->clipsta*lavec[1]; - sta[2]= mat[3][2]+ la->clipsta*lavec[2]; - - end[0]= mat[3][0]+ la->clipend*lavec[0]; - end[1]= mat[3][1]+ la->clipend*lavec[1]; - end[2]= mat[3][2]+ la->clipend*lavec[2]; - + madd_v3_v3v3fl(sta, mat[3], lavec, la->clipsta); + madd_v3_v3v3fl(end, mat[3], lavec, la->clipend); glBegin(GL_LINE_STRIP); glVertex3fv(sta); @@ -839,10 +812,7 @@ static void spotvolume(float *lvec, float *vvec, float inp) quat_to_mat3(mat1,q); /* rotate lamp vector now over acos(inp) degrees */ - - vvec[0] = lvec[0] ; - vvec[1] = lvec[1] ; - vvec[2] = lvec[2] ; + copy_v3_v3(vvec, lvec); unit_m3(mat2); co = inp; @@ -967,7 +937,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, } /* Inner Circle */ - VECCOPY(vec, ob->obmat[3]); + copy_v3_v3(vec, ob->obmat[3]); glEnable(GL_BLEND); drawcircball(GL_LINE_LOOP, vec, lampsize, imat); glDisable(GL_BLEND); @@ -1006,10 +976,8 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, vec_rot_to_mat3( mat,imat[2], M_PI/4.0f); /* vectors */ - VECCOPY(v1, imat[0]); - mul_v3_fl(v1, circrad*1.2f); - VECCOPY(v2, imat[0]); - mul_v3_fl(v2, circrad*2.5f); + mul_v3_v3fl(v1, imat[0], circrad * 1.2f); + mul_v3_v3fl(v2, imat[0], circrad * 2.5f); /* center */ glTranslatef(vec[0], vec[1], vec[2]); @@ -1037,7 +1005,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, } glPopMatrix(); /* back in object space */ - vec[0]= vec[1]= vec[2]= 0.0f; + zero_v3(vec); if ((la->type==LA_SPOT) || (la->type==LA_YF_PHOTON)) { lvec[0]=lvec[1]= 0.0; @@ -1129,7 +1097,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, /* draw the hemisphere curves */ short axis, steps, dir; float outdist, zdist, mul; - vec[0]=vec[1]=vec[2]= 0.0; + zero_v3(vec); outdist = 0.14; mul = 1.4; dir = 1; setlinestyle(4); @@ -1178,7 +1146,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, /* and back to viewspace */ glLoadMatrixf(rv3d->viewmat); - VECCOPY(vec, ob->obmat[3]); + copy_v3_v3(vec, ob->obmat[3]); setlinestyle(0); @@ -3289,7 +3257,7 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix case PART_DRAW_DOT: { if(vd) { - VECCOPY(vd,state->co) pdd->vd+=3; + copy_v3_v3(vd,state->co); pdd->vd+=3; } if(cd) { cd[0]=ma_r; @@ -3314,7 +3282,7 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix cd[14]=cd[17]=1.0; pdd->cd+=18; - VECCOPY(vec2,state->co); + copy_v3_v3(vec2,state->co); } else { if(cd) { @@ -3323,47 +3291,47 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix cd[2]=cd[5]=cd[8]=cd[11]=cd[14]=cd[17]=ma_b; pdd->cd+=18; } - VECSUB(vec2,state->co,vec); + sub_v3_v3v3(vec2, state->co, vec); } - VECADD(vec,state->co,vec); - VECCOPY(pdd->vd,vec); pdd->vd+=3; - VECCOPY(pdd->vd,vec2); pdd->vd+=3; + add_v3_v3(vec, state->co); + copy_v3_v3(pdd->vd,vec); pdd->vd+=3; + copy_v3_v3(pdd->vd,vec2); pdd->vd+=3; vec[1]=2.0f*pixsize; vec[0]=vec[2]=0.0; mul_qt_v3(state->rot,vec); if(draw_as==PART_DRAW_AXIS){ - VECCOPY(vec2,state->co); + copy_v3_v3(vec2,state->co); } - else VECSUB(vec2,state->co,vec); + else sub_v3_v3v3(vec2, state->co, vec); - VECADD(vec,state->co,vec); - VECCOPY(pdd->vd,vec); pdd->vd+=3; - VECCOPY(pdd->vd,vec2); pdd->vd+=3; + add_v3_v3(vec, state->co); + copy_v3_v3(pdd->vd,vec); pdd->vd+=3; + copy_v3_v3(pdd->vd,vec2); pdd->vd+=3; vec[2]=2.0f*pixsize; vec[0]=vec[1]=0.0; mul_qt_v3(state->rot,vec); if(draw_as==PART_DRAW_AXIS){ - VECCOPY(vec2,state->co); + copy_v3_v3(vec2,state->co); } - else VECSUB(vec2,state->co,vec); + else sub_v3_v3v3(vec2, state->co, vec); - VECADD(vec,state->co,vec); + add_v3_v3(vec, state->co); - VECCOPY(pdd->vd,vec); pdd->vd+=3; - VECCOPY(pdd->vd,vec2); pdd->vd+=3; + copy_v3_v3(pdd->vd,vec); pdd->vd+=3; + copy_v3_v3(pdd->vd,vec2); pdd->vd+=3; break; } case PART_DRAW_LINE: { - VECCOPY(vec,state->vel); + copy_v3_v3(vec,state->vel); normalize_v3(vec); if(draw & PART_DRAW_VEL_LENGTH) mul_v3_fl(vec,len_v3(state->vel)); - VECADDFAC(pdd->vd,state->co,vec,-draw_line[0]); pdd->vd+=3; - VECADDFAC(pdd->vd,state->co,vec,draw_line[1]); pdd->vd+=3; + madd_v3_v3v3fl(pdd->vd, state->co, vec, -draw_line[0]); pdd->vd+=3; + madd_v3_v3v3fl(pdd->vd, state->co, vec, draw_line[1]); pdd->vd+=3; if(cd) { cd[0]=cd[3]=ma_r; cd[1]=cd[4]=ma_g; @@ -3390,27 +3358,27 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix } - VECCOPY(bb->vec, state->co); - VECCOPY(bb->vel, state->vel); + copy_v3_v3(bb->vec, state->co); + copy_v3_v3(bb->vel, state->vel); psys_make_billboard(bb, xvec, yvec, zvec, bb_center); - VECADD(pdd->vd,bb_center,xvec); - VECADD(pdd->vd,pdd->vd,yvec); pdd->vd+=3; + add_v3_v3v3(pdd->vd, bb_center, xvec); + add_v3_v3(pdd->vd, yvec); pdd->vd+=3; - VECSUB(pdd->vd,bb_center,xvec); - VECADD(pdd->vd,pdd->vd,yvec); pdd->vd+=3; + sub_v3_v3v3(pdd->vd, bb_center, vec); + add_v3_v3(pdd->vd, yvec); pdd->vd+=3; - VECSUB(pdd->vd,bb_center,xvec); - VECSUB(pdd->vd,pdd->vd,yvec); pdd->vd+=3; + sub_v3_v3v3(pdd->vd, bb_center, xvec); + sub_v3_v3v3(pdd->vd, pdd->vd,yvec); pdd->vd+=3; - VECADD(pdd->vd,bb_center,xvec); - VECSUB(pdd->vd,pdd->vd,yvec); pdd->vd+=3; + add_v3_v3v3(pdd->vd, bb_center, xvec); + sub_v3_v3v3(pdd->vd, pdd->vd, yvec); pdd->vd+=3; - VECCOPY(pdd->nd, zvec); pdd->nd+=3; - VECCOPY(pdd->nd, zvec); pdd->nd+=3; - VECCOPY(pdd->nd, zvec); pdd->nd+=3; - VECCOPY(pdd->nd, zvec); pdd->nd+=3; + copy_v3_v3(pdd->nd, zvec); pdd->nd+=3; + copy_v3_v3(pdd->nd, zvec); pdd->nd+=3; + copy_v3_v3(pdd->nd, zvec); pdd->nd+=3; + copy_v3_v3(pdd->nd, zvec); pdd->nd+=3; break; } } @@ -3819,11 +3787,10 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv /* additional things to draw for each particle */ /* (velocity, size and number) */ if((part->draw & PART_DRAW_VEL) && pdd->vedata){ - VECCOPY(pdd->ved,state.co); - pdd->ved+=3; - VECCOPY(vel,state.vel); - mul_v3_fl(vel,timestep); - VECADD(pdd->ved,state.co,vel); + copy_v3_v3(pdd->ved,state.co); + pdd->ved += 3; + mul_v3_v3fl(vel, state.vel, timestep); + add_v3_v3v3(pdd->ved, state.co, vel); pdd->ved+=3; totve++; @@ -4101,7 +4068,7 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, RegionView3D *rv3d, Obj if(timed) { for(k=0, pcol=pathcol, pkey=path; k<steps; k++, pkey++, pcol+=4){ - VECCOPY(pcol, pkey->col); + copy_v3_v3(pcol, pkey->col); pcol[3] = 1.0f - fabs((float)CFRA - pkey->time)/(float)pset->fade_frames; } @@ -4139,15 +4106,15 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, RegionView3D *rv3d, Obj for(k=0, key=point->keys; k<point->totkey; k++, key++){ if(pd) { - VECCOPY(pd, key->co); + copy_v3_v3(pd, key->co); pd += 3; } if(key->flag&PEK_SELECT){ - VECCOPY(cd,sel_col); + copy_v3_v3(cd,sel_col); } else{ - VECCOPY(cd,nosel_col); + copy_v3_v3(cd,nosel_col); } if(timed) @@ -4221,12 +4188,12 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float root[1] = root[2] = 0.0f; root[0] = -drw_size; mul_m3_v3(tr,root); - VECADD(root,root,com); + add_v3_v3(root, com); glVertex3fv(root); tip[1] = tip[2] = 0.0f; tip[0] = drw_size; mul_m3_v3(tr,tip); - VECADD(tip,tip,com); + add_v3_v3(tip, com); glVertex3fv(tip); glEnd(); @@ -4234,7 +4201,7 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float root[0] = th; glBegin(GL_LINES); mul_m3_v3(tr,root); - VECADD(root,root,com); + add_v3_v3(root, com); glVertex3fv(root); glVertex3fv(tip); glEnd(); @@ -4243,7 +4210,7 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float root[0] = th; glBegin(GL_LINES); mul_m3_v3(tr,root); - VECADD(root,root,com); + add_v3_v3(root, com); glVertex3fv(root); glVertex3fv(tip); glEnd(); @@ -4252,7 +4219,7 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float root[0] =th; glBegin(GL_LINES); mul_m3_v3(tr,root); - VECADD(root,root,com); + add_v3_v3(root, com); glVertex3fv(root); glVertex3fv(tip); glEnd(); @@ -4261,7 +4228,7 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float root[0] = th; glBegin(GL_LINES); mul_m3_v3(tr,root); - VECADD(root,root,com); + add_v3_v3(root, com); glVertex3fv(root); glVertex3fv(tip); glEnd(); @@ -4272,12 +4239,12 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float root[0] = root[2] = 0.0f; root[1] = -drw_size; mul_m3_v3(tr,root); - VECADD(root,root,com); + add_v3_v3(root, com); glVertex3fv(root); tip[0] = tip[2] = 0.0f; tip[1] = drw_size; mul_m3_v3(tr,tip); - VECADD(tip,tip,com); + add_v3_v3(tip, com); glVertex3fv(tip); glEnd(); @@ -4285,7 +4252,7 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float root[1] = th; glBegin(GL_LINES); mul_m3_v3(tr,root); - VECADD(root,root,com); + add_v3_v3(root, com); glVertex3fv(root); glVertex3fv(tip); glEnd(); @@ -4294,7 +4261,7 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float root[1] = th; glBegin(GL_LINES); mul_m3_v3(tr,root); - VECADD(root,root,com); + add_v3_v3(root, com); glVertex3fv(root); glVertex3fv(tip); glEnd(); @@ -4303,7 +4270,7 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float root[1] =th; glBegin(GL_LINES); mul_m3_v3(tr,root); - VECADD(root,root,com); + add_v3_v3(root, com); glVertex3fv(root); glVertex3fv(tip); glEnd(); @@ -4312,7 +4279,7 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float root[1] = th; glBegin(GL_LINES); mul_m3_v3(tr,root); - VECADD(root,root,com); + add_v3_v3(root, com); glVertex3fv(root); glVertex3fv(tip); glEnd(); @@ -4322,12 +4289,12 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float root[0] = root[1] = 0.0f; root[2] = -drw_size; mul_m3_v3(tr,root); - VECADD(root,root,com); + add_v3_v3(root, com); glVertex3fv(root); tip[0] = tip[1] = 0.0f; tip[2] = drw_size; mul_m3_v3(tr,tip); - VECADD(tip,tip,com); + add_v3_v3(tip, com); glVertex3fv(tip); glEnd(); @@ -4335,7 +4302,7 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float root[2] = th; glBegin(GL_LINES); mul_m3_v3(tr,root); - VECADD(root,root,com); + add_v3_v3(root, com); glVertex3fv(root); glVertex3fv(tip); glEnd(); @@ -4344,7 +4311,7 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float root[2] = th; glBegin(GL_LINES); mul_m3_v3(tr,root); - VECADD(root,root,com); + add_v3_v3(root, com); glVertex3fv(root); glVertex3fv(tip); glEnd(); @@ -4353,7 +4320,7 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float root[2] = th; glBegin(GL_LINES); mul_m3_v3(tr,root); - VECADD(root,root,com); + add_v3_v3(root, com); glVertex3fv(root); glVertex3fv(tip); glEnd(); @@ -4362,7 +4329,7 @@ static void ob_draw_RE_motion(float com[3],float rotscale[3][3],float itw,float root[2] = th; glBegin(GL_LINES); mul_m3_v3(tr,root); - VECADD(root,root,com); + add_v3_v3(root, com); glVertex3fv(root); glVertex3fv(tip); glEnd(); @@ -4901,12 +4868,10 @@ static void drawspiral(float *cent, float rad, float tmat[][4], int start) start *= -1; } - VECCOPY(vx, tmat[0]); - VECCOPY(vy, tmat[1]); - mul_v3_fl(vx, rad); - mul_v3_fl(vy, rad); + mul_v3_v3fl(vx, tmat[0], rad); + mul_v3_v3fl(vy, tmat[1], rad); - VECCOPY(vec, cent); + copy_v3_v3(vec, cent); if (inverse==0) { for(a=0; a<tot; a++) { @@ -5179,7 +5144,7 @@ static void draw_forcefield(Scene *scene, Object *ob, RegionView3D *rv3d) UI_ThemeColorBlend(curcol, TH_BACK, 0.5); drawcircball(GL_LINE_LOOP, guidevec1, mindist, imat); - VECCOPY(vec, guidevec1); /* max center */ + copy_v3_v3(vec, guidevec1); /* max center */ } } @@ -5265,8 +5230,8 @@ void get_local_bounds(Object *ob, float *center, float *size) BoundBox *bb= object_get_boundbox(ob); if(bb==NULL) { - center[0]= center[1]= center[2]= 0.0; - VECCOPY(size, ob->size); + zero_v3(center); + copy_v3_v3(size, ob->size); } else { size[0]= 0.5*fabs(bb->vec[0][0] - bb->vec[4][0]); @@ -5358,13 +5323,13 @@ static void drawtexspace(Object *ob) } else if ELEM3(ob->type, OB_CURVE, OB_SURF, OB_FONT) { Curve *cu= ob->data; - VECCOPY(size, cu->size); - VECCOPY(loc, cu->loc); + copy_v3_v3(size, cu->size); + copy_v3_v3(loc, cu->loc); } else if(ob->type==OB_MBALL) { MetaBall *mb= ob->data; - VECCOPY(size, mb->size); - VECCOPY(loc, mb->loc); + copy_v3_v3(size, mb->size); + copy_v3_v3(loc, mb->loc); } else return; @@ -5525,9 +5490,7 @@ void drawRBpivot(bRigidBodyJointConstraint *data) dir[axis] = 1.f; glBegin(GL_LINES); mul_m4_v3(mat,dir); - v[0] += dir[0]; - v[1] += dir[1]; - v[2] += dir[2]; + add_v3_v3(v, dir); glVertex3fv(v1); glVertex3fv(v); glEnd(); @@ -5815,8 +5778,8 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if (cu->linewidth != 0.0) { cpack(0xff44ff); UI_ThemeColor(TH_WIRE); - VECCOPY(vec1, ob->orig); - VECCOPY(vec2, ob->orig); + copy_v3_v3(vec1, ob->orig); + copy_v3_v3(vec2, ob->orig); vec1[0] += cu->linewidth; vec2[0] += cu->linewidth; vec1[1] += cu->linedist * cu->fsize; @@ -5836,8 +5799,8 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) UI_ThemeColor(TH_ACTIVE); else UI_ThemeColor(TH_WIRE); - vec1[0] = cu->tb[i].x; - vec1[1] = cu->tb[i].y + cu->fsize; + vec1[0] = (cu->xof * cu->fsize) + cu->tb[i].x; + vec1[1] = (cu->yof * cu->fsize) + cu->tb[i].y + cu->fsize; vec1[2] = 0.001; glBegin(GL_LINE_STRIP); glVertex3fv(vec1); @@ -5925,7 +5888,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) } case OB_EMPTY: if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) - drawaxes(rv3d, rv3d->viewmatob, ob->empty_drawsize, flag, ob->empty_drawtype); + drawaxes(ob->empty_drawsize, flag, ob->empty_drawtype); break; case OB_LAMP: if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) { @@ -5951,7 +5914,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) break; default: if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) { - drawaxes(rv3d, rv3d->viewmatob, 1.0, flag, OB_ARROWS); + drawaxes(1.0, flag, OB_ARROWS); } } @@ -6105,7 +6068,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if(density[index] > FLT_EPSILON) { float color[3]; - VECCOPY(tmp, smd->domain->p0); + copy_v3_v3(tmp, smd->domain->p0); tmp[0] += smd->domain->dx * x + smd->domain->dx * 0.5; tmp[1] += smd->domain->dx * y + smd->domain->dx * 0.5; tmp[2] += smd->domain->dx * z + smd->domain->dx * 0.5; @@ -6151,7 +6114,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if(dtx && (G.f & G_RENDER_OGL)==0) { if(dtx & OB_AXIS) { - drawaxes(rv3d, rv3d->viewmatob, 1.0f, flag, OB_ARROWS); + drawaxes(1.0f, flag, OB_ARROWS); } if(dtx & OB_BOUNDBOX) { if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) @@ -6173,9 +6136,8 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if(dt<OB_SHADED && (v3d->flag2 & V3D_RENDER_OVERRIDE)==0) { if((ob->gameflag & OB_DYNAMIC) || ((ob->gameflag & OB_BOUNDS) && (ob->boundtype == OB_BOUND_SPHERE))) { - float imat[4][4], vec[3]; + float imat[4][4], vec[3]= {0.0f, 0.0f, 0.0f}; - vec[0]= vec[1]= vec[2]= 0.0; invert_m4_m4(imat, rv3d->viewmatob); setlinestyle(2); @@ -6525,7 +6487,7 @@ void draw_object_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object draw_object_mesh_instance(scene, v3d, rv3d, ob, dt, outline); break; case OB_EMPTY: - drawaxes(rv3d, rv3d->viewmatob, ob->empty_drawsize, 0, ob->empty_drawtype); + drawaxes(ob->empty_drawsize, 0, ob->empty_drawtype); break; } } diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 19aaff2cea9..f4ae87c5b60 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -53,6 +53,7 @@ #include "BKE_customdata.h" #include "BKE_depsgraph.h" #include "BKE_idprop.h" +#include "BKE_main.h" #include "BKE_mesh.h" #include "BKE_object.h" #include "BKE_global.h" @@ -997,6 +998,7 @@ static int test_parent_loop(Object *par, Object *ob) static void do_view3d_region_buttons(bContext *C, void *arg, int event) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); // Object *obedit= CTX_data_edit_object(C); View3D *v3d= CTX_wm_view3d(C); @@ -1028,7 +1030,7 @@ static void do_view3d_region_buttons(bContext *C, void *arg, int event) if(ob->id.lib || test_parent_loop(ob->parent, ob) ) ob->parent= NULL; else { - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); DAG_id_flush_update(&ob->id, OB_RECALC_OB); } } diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index a88ec9ead64..69375674d94 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -211,28 +211,37 @@ int view3d_test_clipping(RegionView3D *rv3d, float *vec, int local) static void drawgrid_draw(ARegion *ar, float wx, float wy, float x, float y, float dx) -{ - float fx, fy; - +{ + float v1[2], v2[2]; + x+= (wx); y+= (wy); - fx= x/dx; - fx= x-dx*floor(fx); + + v1[1]= 0.0f; + v2[1]= (float)ar->winy; + + v1[0] = v2[0] = x-dx*floor(x/dx); + + glBegin(GL_LINES); - while(fx< ar->winx) { - fdrawline(fx, 0.0, fx, (float)ar->winy); - fx+= dx; + while(v1[0] < ar->winx) { + glVertex2fv(v1); + glVertex2fv(v2); + v1[0] = v2[0] = v1[0] + dx; } - fy= y/dx; - fy= y-dx*floor(fy); - + v1[0]= 0.0f; + v2[0]= (float)ar->winx; + + v1[1]= v2[1]= y-dx*floor(y/dx); - while(fy< ar->winy) { - fdrawline(0.0, fy, (float)ar->winx, fy); - fy+= dx; + while(v1[1] < ar->winy) { + glVertex2fv(v1); + glVertex2fv(v2); + v1[1] = v2[1] = v1[1] + dx; } + glEnd(); } #define GRID_MIN_PX 6.0f @@ -1798,7 +1807,7 @@ static void gpu_render_lamp_update(Scene *scene, View3D *v3d, Object *ob, Object lamp = GPU_lamp_from_blender(scene, ob, par); if(lamp) { - GPU_lamp_update(lamp, ob->lay, (ob->restrictflag & OB_RESTRICT_VIEW), obmat); + GPU_lamp_update(lamp, ob->lay, (ob->restrictflag & OB_RESTRICT_RENDER), obmat); GPU_lamp_update_colors(lamp, la->r, la->g, la->b, la->energy); if((ob->lay & v3d->lay) && GPU_lamp_has_shadow_buffer(lamp)) { @@ -1968,6 +1977,7 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx, { Scene *sce; Base *base; + float backcol[3]; int bwinx, bwiny; glPushMatrix(); @@ -1987,7 +1997,11 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx, /* set background color, fallback on the view background color */ if(scene->world) { - glClearColor(scene->world->horr, scene->world->horg, scene->world->horb, 0.0); + if(scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) + linearrgb_to_srgb_v3_v3(backcol, &scene->world->horr); + else + copy_v3_v3(backcol, &scene->world->horr); + glClearColor(backcol[0], backcol[1], backcol[2], 0.0); } else { UI_ThemeClearColor(TH_BACK); @@ -2205,6 +2219,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) Scene *sce; Base *base; Object *ob; + float backcol[3]; int retopo= 0, sculptparticle= 0; Object *obact = OBACT; char *grid_unit= NULL; @@ -2223,8 +2238,13 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) } /* clear background */ - if((v3d->flag2 & V3D_RENDER_OVERRIDE) && scene->world) - glClearColor(scene->world->horr, scene->world->horg, scene->world->horb, 0.0); + if((v3d->flag2 & V3D_RENDER_OVERRIDE) && scene->world) { + if(scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) + linearrgb_to_srgb_v3_v3(backcol, &scene->world->horr); + else + copy_v3_v3(backcol, &scene->world->horr); + glClearColor(backcol[0], backcol[1], backcol[2], 0.0); + } else UI_ThemeClearColor(TH_BACK); diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index f4fbb501fc3..2e26988877f 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -826,6 +826,9 @@ void viewmove_modal_keymap(wmKeyConfig *keyconf) { static EnumPropertyItem modal_items[] = { {VIEW_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""}, + + {VIEWROT_MODAL_SWITCH_ZOOM, "SWITCH_TO_ZOOM", 0, "Switch to Zoom"}, + {VIEWROT_MODAL_SWITCH_ROTATE, "SWITCH_TO_ROTATE", 0, "Switch to Rotate"}, {0, NULL, 0, NULL, NULL}}; @@ -968,6 +971,9 @@ void viewzoom_modal_keymap(wmKeyConfig *keyconf) { static EnumPropertyItem modal_items[] = { {VIEW_MODAL_CONFIRM, "CONFIRM", 0, "Confirm", ""}, + + {VIEWROT_MODAL_SWITCH_ROTATE, "SWITCH_TO_ROTATE", 0, "Switch to Rotate"}, + {VIEWROT_MODAL_SWITCH_MOVE, "SWITCH_TO_MOVE", 0, "Switch to Move"}, {0, NULL, 0, NULL, NULL}}; diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 14b769fdf39..761ef436d48 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -152,6 +152,7 @@ static void handle_view3d_lock(bContext *C) static int layers_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); ScrArea *sa= CTX_wm_area(C); View3D *v3d= sa->spacedata.first; @@ -213,7 +214,7 @@ static int layers_exec(bContext *C, wmOperator *op) if(v3d->scenelock) handle_view3d_lock(C); /* new layers might need unflushed events events */ - DAG_scene_update_flags(scene, v3d->lay); /* tags all that moves and flushes */ + DAG_scene_update_flags(bmain, scene, v3d->lay); /* tags all that moves and flushes */ ED_area_tag_redraw(sa); diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 846300ff9a6..fd78c8298e9 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -105,7 +105,7 @@ void draw_object(Scene *scene, struct ARegion *ar, View3D *v3d, Base *base, int int draw_glsl_material(Scene *scene, Object *ob, View3D *v3d, int dt); void draw_object_instance(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob, int dt, int outline); void draw_object_backbufsel(Scene *scene, View3D *v3d, RegionView3D *rv3d, Object *ob); -void drawaxes(struct RegionView3D *rv3d, float mat[][4], float size, int flag, char drawtype); +void drawaxes(float size, int flag, char drawtype); void view3d_cached_text_draw_begin(void); void view3d_cached_text_draw_add(float x, float y, float z, char *str, short xoffs, short flag); diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index 160306ef300..b3763d6cb90 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -45,14 +45,15 @@ #include "BKE_action.h" #include "BKE_anim.h" -#include "BKE_context.h" #include "BKE_armature.h" +#include "BKE_context.h" #include "BKE_curve.h" #include "BKE_depsgraph.h" #include "BKE_DerivedMesh.h" #include "BKE_displist.h" #include "BKE_global.h" #include "BKE_lattice.h" +#include "BKE_main.h" #include "BKE_mesh.h" #include "BKE_modifier.h" #include "BKE_object.h" @@ -365,7 +366,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode) while(ml) { if(ml->flag & SELECT) { tv->loc= &ml->x; - VECCOPY(tv->oldloc, tv->loc); + copy_v3_v3(tv->oldloc, tv->loc); tv->val= &(ml->rad); tv->oldval= ml->rad; tv->flag= 1; @@ -387,7 +388,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode) while(a--) { if((mode & 1) || (bp->f1 & SELECT)) { if(bp->hide==0) { - VECCOPY(tv->oldloc, bp->vec); + copy_v3_v3(tv->oldloc, bp->vec); tv->loc= bp->vec; tv->flag= bp->f1 & SELECT; tv++; @@ -403,23 +404,16 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode) total= 0.0; for(a=0; a<tottrans; a++, tv++) { if(tv->flag & SELECT) { - centroid[0]+= tv->oldloc[0]; - centroid[1]+= tv->oldloc[1]; - centroid[2]+= tv->oldloc[2]; + add_v3_v3(centroid, tv->oldloc); total+= 1.0; DO_MINMAX(tv->oldloc, min, max); } } if(total!=0.0) { - centroid[0]/= total; - centroid[1]/= total; - centroid[2]/= total; + mul_v3_fl(centroid, 1.0f/total); } - center[0]= (min[0]+max[0])/2.0; - center[1]= (min[1]+max[1])/2.0; - center[2]= (min[2]+max[2])/2.0; - + mid_v3_v3v3(center, min, max); } /* *********************** operators ******************** */ @@ -427,6 +421,7 @@ static void make_trans_verts(Object *obedit, float *min, float *max, int mode) static int snap_sel_to_grid(bContext *C, wmOperator *op) { extern float originmat[3][3]; /* XXX object.c */ + Main *bmain= CTX_data_main(C); Object *obedit= CTX_data_edit_object(C); Scene *scene= CTX_data_scene(C); RegionView3D *rv3d= CTX_wm_region_data(C); @@ -533,7 +528,7 @@ static int snap_sel_to_grid(bContext *C, wmOperator *op) CTX_DATA_END; } - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); return OPERATOR_FINISHED; @@ -560,6 +555,7 @@ void VIEW3D_OT_snap_selected_to_grid(wmOperatorType *ot) static int snap_sel_to_curs(bContext *C, wmOperator *op) { extern float originmat[3][3]; /* XXX object.c */ + Main *bmain= CTX_data_main(C); Object *obedit= CTX_data_edit_object(C); Scene *scene= CTX_data_scene(C); View3D *v3d= CTX_wm_view3d(C); @@ -658,7 +654,7 @@ static int snap_sel_to_curs(bContext *C, wmOperator *op) CTX_DATA_END; } - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); return OPERATOR_FINISHED; diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 8ec226ef57e..5e00d17cfab 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1344,7 +1344,7 @@ short view3d_opengl_select(ViewContext *vc, unsigned int *buffer, unsigned int b /* ********************** local view operator ******************** */ -static unsigned int free_localbit(void) +static unsigned int free_localbit(Main *bmain) { unsigned int lay; ScrArea *sa; @@ -1354,7 +1354,7 @@ static unsigned int free_localbit(void) /* sometimes we loose a localview: when an area is closed */ /* check all areas: which localviews are in use? */ - for(sc= G.main->screen.first; sc; sc= sc->id.next) { + for(sc= bmain->screen.first; sc; sc= sc->id.next) { for(sa= sc->areabase.first; sa; sa= sa->next) { SpaceLink *sl= sa->spacedata.first; for(; sl; sl= sl->next) { @@ -1416,7 +1416,7 @@ int ED_view3d_scene_layer_set(int lay, const int *values, int *active) return lay; } -static void initlocalview(Scene *scene, ScrArea *sa) +static void initlocalview(Main *bmain, Scene *scene, ScrArea *sa) { View3D *v3d= sa->spacedata.first; Base *base; @@ -1428,7 +1428,7 @@ static void initlocalview(Scene *scene, ScrArea *sa) INIT_MINMAX(min, max); - locallay= free_localbit(); + locallay= free_localbit(bmain); if(locallay==0) { printf("Sorry, no more than 8 localviews\n"); // XXX error @@ -1592,7 +1592,7 @@ static int localview_exec(bContext *C, wmOperator *unused) if(v3d->localvd) endlocalview(CTX_data_scene(C), CTX_wm_area(C)); else - initlocalview(CTX_data_scene(C), CTX_wm_area(C)); + initlocalview(CTX_data_main(C), CTX_data_scene(C), CTX_wm_area(C)); ED_area_tag_redraw(CTX_wm_area(C)); @@ -1805,8 +1805,8 @@ static int game_engine_exec(bContext *C, wmOperator *op) RestoreState(C); //XXX restore_all_scene_cfra(scene_cfra_store); - set_scene_bg(startscene); - //XXX scene_update_for_newframe(G.scene, G.scene->lay); + set_scene_bg(CTX_data_main(C), startscene); + //XXX scene_update_for_newframe(bmain, scene, scene->lay); ED_area_tag_redraw(CTX_wm_area(C)); diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index ce9dcd9b740..beeacfdc8d0 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1364,17 +1364,17 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) } } - /* XXX convert stupid flag to enum */ + /* convert flag to enum */ switch(t->flag & (T_PROP_EDIT|T_PROP_CONNECTED)) { case (T_PROP_EDIT|T_PROP_CONNECTED): - proportional = 2; + proportional = PROP_EDIT_CONNECTED; break; case T_PROP_EDIT: - proportional = 1; + proportional = PROP_EDIT_ON; break; default: - proportional = 0; + proportional = PROP_EDIT_OFF; } // If modal, save settings back in scene if not set as operator argument @@ -1382,7 +1382,10 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) /* save settings if not set in operator */ if (RNA_struct_find_property(op->ptr, "proportional") && !RNA_property_is_set(op->ptr, "proportional")) { - ts->proportional = proportional; + if (t->obedit) + ts->proportional = proportional; + else + ts->proportional_objects = (proportional != PROP_EDIT_OFF); } if (RNA_struct_find_property(op->ptr, "proportional_size") && !RNA_property_is_set(op->ptr, "proportional_size")) { @@ -2171,21 +2174,19 @@ void initWarp(TransInfo *t) /* we need min/max in view space */ for(i = 0; i < t->total; i++) { float center[3]; - VECCOPY(center, t->data[i].center); + copy_v3_v3(center, t->data[i].center); mul_m3_v3(t->data[i].mtx, center); mul_m4_v3(t->viewmat, center); sub_v3_v3(center, t->viewmat[3]); if (i) minmax_v3_v3v3(min, max, center); else { - VECCOPY(max, center); - VECCOPY(min, center); + copy_v3_v3(max, center); + copy_v3_v3(min, center); } } - - t->center[0]= (min[0]+max[0])/2.0f; - t->center[1]= (min[1]+max[1])/2.0f; - t->center[2]= (min[2]+max[2])/2.0f; + + mid_v3_v3v3(t->center, min, max); if (max[0] == min[0]) max[0] += 0.1; /* not optimal, but flipping is better than invalid garbage (i.e. division by zero!) */ t->val= (max[0]-min[0])/2.0f; /* t->val is X dimension projected boundbox */ diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 0edf6f6d10c..e71b9bd66e0 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -1775,14 +1775,17 @@ static int connectivity_edge(float mtx[][3], EditVert *v1, EditVert *v2) float edge_len; int done = 0; + /* note: hidden verts are not being checked for, this assumes + * flushing of hidden faces & edges is working right */ + + if (v1->f2 + v2->f2 == 4) + return 0; + sub_v3_v3v3(edge_vec, v1->co, v2->co); mul_m3_v3(mtx, edge_vec); edge_len = len_v3(edge_vec); - if (v1->f2 + v2->f2 == 4) - return 0; - if (v1->f2) { if (v2->f2) { if (v2->tmp.fp + edge_len + THRESHOLD < v1->tmp.fp) { @@ -1848,7 +1851,7 @@ static void editmesh_set_connectivity_distance(EditMesh *em, float mtx[][3]) /* do internal edges for quads */ for(efa= em->faces.first; efa; efa= efa->next) { - if (efa->v4) { + if (efa->v4 && efa->h==0) { done |= connectivity_edge(mtx, efa->v1, efa->v3); done |= connectivity_edge(mtx, efa->v2, efa->v4); } @@ -4400,7 +4403,7 @@ static void set_trans_object_base_flags(bContext *C, TransInfo *t) } /* all recalc flags get flushed to all layers, so a layer flip later on works fine */ - DAG_scene_flush_update(t->scene, -1, 0); + DAG_scene_flush_update(G.main, t->scene, -1, 0); /* and we store them temporal in base (only used for transform code) */ /* this because after doing updates, the object->recalc is cleared */ @@ -4478,7 +4481,7 @@ static int count_proportional_objects(TransInfo *t) /* all recalc flags get flushed to all layers, so a layer flip later on works fine */ - DAG_scene_flush_update(t->scene, -1, 0); + DAG_scene_flush_update(G.main, t->scene, -1, 0); /* and we store them temporal in base (only used for transform code) */ /* this because after doing updates, the object->recalc is cleared */ diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 8d98255d3d9..920c5c12ea1 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -38,6 +38,7 @@ #include "DNA_armature_types.h" #include "DNA_lattice_types.h" #include "DNA_screen_types.h" +#include "DNA_scene_types.h" #include "DNA_space_types.h" #include "DNA_view3d_types.h" @@ -1033,9 +1034,9 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) { switch(RNA_enum_get(op->ptr, "proportional")) { - case 2: /* XXX connected constant */ + case PROP_EDIT_CONNECTED: t->flag |= T_PROP_CONNECTED; - case 1: /* XXX prop on constant */ + case PROP_EDIT_ON: t->flag |= T_PROP_EDIT; break; } @@ -1045,11 +1046,19 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event) /* use settings from scene only if modal */ if (t->flag & T_MODAL) { - if ((t->options & CTX_NO_PET) == 0 && (ts->proportional != PROP_EDIT_OFF)) { - t->flag |= T_PROP_EDIT; + if ((t->options & CTX_NO_PET) == 0) + { + if (t->obedit && ts->proportional != PROP_EDIT_OFF) + { + t->flag |= T_PROP_EDIT; - if(ts->proportional == PROP_EDIT_CONNECTED) - t->flag |= T_PROP_CONNECTED; + if(ts->proportional == PROP_EDIT_CONNECTED) + t->flag |= T_PROP_CONNECTED; + } + else if (t->obedit == NULL && ts->proportional_objects) + { + t->flag |= T_PROP_EDIT; + } } } } diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index fbf2051f962..3491c1b4df2 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -77,13 +77,17 @@ void ED_editors_init(bContext *C) /* frees all editmode stuff */ void ED_editors_exit(bContext *C) { + Main *bmain= CTX_data_main(C); Scene *sce; + + if(!bmain) + return; /* frees all editmode undos */ undo_editmode_clear(); ED_undo_paint_free(); - for(sce=G.main->scene.first; sce; sce= sce->id.next) { + for(sce=bmain->scene.first; sce; sce= sce->id.next) { if(sce->obedit) { Object *ob= sce->obedit; diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index bae8d4b7fcf..cbc0eb41f84 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -3241,7 +3241,7 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf) /* menus */ WM_keymap_add_menu(keymap, "IMAGE_MT_uvs_snap", SKEY, KM_PRESS, KM_SHIFT, 0); - ED_object_generic_keymap(keyconf, keymap, 1); + ED_object_generic_keymap(keyconf, keymap, 2); transform_keymap_for_space(keyconf, keymap, SPACE_IMAGE); } diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp index 4c6ea48f692..91c0cca76c9 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp @@ -50,7 +50,7 @@ BlenderStrokeRenderer::BlenderStrokeRenderer(Render* re, int render_count) lb = freestyle_scene->r.layers; freestyle_scene->r= old_scene->r; freestyle_scene->r.layers= lb; - set_scene_bg( freestyle_scene ); + set_scene_bg( G.main, freestyle_scene ); // image dimensions float ycor = ((float)re->r.yasp) / ((float)re->r.xasp); @@ -127,7 +127,7 @@ BlenderStrokeRenderer::~BlenderStrokeRenderer(){ // release material free_libblock( &G.main->mat, material ); - set_scene_bg( old_scene ); + set_scene_bg( G.main, old_scene ); } float BlenderStrokeRenderer::get_stroke_vertex_z(void) const { @@ -336,6 +336,6 @@ Render* BlenderStrokeRenderer::RenderScene( Render *re ) { Render *freestyle_render = RE_NewRender(freestyle_scene->id.name); - RE_RenderFreestyleStrokes(freestyle_render, freestyle_scene); + RE_RenderFreestyleStrokes(freestyle_render, G.main, freestyle_scene); return freestyle_render; } diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 9ed7729fea3..f5898c8d0be 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -1004,6 +1004,10 @@ static void do_material_tex(GPUShadeInput *shi) else GPU_link(mat, "set_value_one", &tin); } + + if(tex->type==TEX_IMAGE) + if(mat->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) + GPU_link(mat, "srgb_to_linearrgb", tcol, tcol); if(mtex->mapto & MAP_COL) { GPUNodeLink *colfac; @@ -1244,6 +1248,9 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr) mat->obcolalpha = 1; GPU_link(mat, "shade_alpha_obcolor", shr->combined, GPU_builtin(GPU_OBCOLOR), &shr->combined); } + + if(mat->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) + GPU_link(mat, "linearrgb_to_srgb", shr->combined, &shr->combined); } GPUNodeLink *GPU_blender_material(GPUMaterial *mat, Material *ma) @@ -1356,7 +1363,7 @@ static void gpu_lamp_from_blender(Scene *scene, Object *ob, Object *par, Lamp *l lamp->col[1]= la->g*lamp->energy; lamp->col[2]= la->b*lamp->energy; - GPU_lamp_update(lamp, ob->lay, (ob->restrictflag & OB_RESTRICT_VIEW), ob->obmat); + GPU_lamp_update(lamp, ob->lay, (ob->restrictflag & OB_RESTRICT_RENDER), ob->obmat); lamp->spotsi= la->spotsize; if(lamp->mode & LA_HALO) diff --git a/source/blender/gpu/intern/gpu_shader_material.glsl b/source/blender/gpu/intern/gpu_shader_material.glsl index c824e755afc..d517018e257 100644 --- a/source/blender/gpu/intern/gpu_shader_material.glsl +++ b/source/blender/gpu/intern/gpu_shader_material.glsl @@ -75,6 +75,38 @@ void hsv_to_rgb(vec4 hsv, out vec4 outcol) outcol = vec4(rgb, hsv.w); } +float srgb_to_linearrgb(float c) +{ + if(c < 0.04045) + return (c < 0.0)? 0.0: c * (1.0/12.92); + else + return pow((c + 0.055)*(1.0/1.055), 2.4); +} + +float linearrgb_to_srgb(float c) +{ + if(c < 0.0031308) + return (c < 0.0)? 0.0: c * 12.92; + else + return 1.055 * pow(c, 1.0/2.4) - 0.055f; +} + +void srgb_to_linearrgb(vec4 col_from, out vec4 col_to) +{ + col_to.r = srgb_to_linearrgb(col_from.r); + col_to.g = srgb_to_linearrgb(col_from.g); + col_to.b = srgb_to_linearrgb(col_from.b); + col_to.a = col_from.a; +} + +void linearrgb_to_srgb(vec4 col_from, out vec4 col_to) +{ + col_to.r = linearrgb_to_srgb(col_from.r); + col_to.g = linearrgb_to_srgb(col_from.g); + col_to.b = linearrgb_to_srgb(col_from.b); + col_to.a = col_from.a; +} + #define M_PI 3.14159265358979323846 /*********** SHADER NODES ***************/ diff --git a/source/blender/gpu/intern/gpu_shader_material.glsl.c b/source/blender/gpu/intern/gpu_shader_material.glsl.c index 920cd16c369..9c447111528 100644 --- a/source/blender/gpu/intern/gpu_shader_material.glsl.c +++ b/source/blender/gpu/intern/gpu_shader_material.glsl.c @@ -1,192 +1,214 @@ /* DataToC output of file <gpu_shader_material_glsl> */ -int datatoc_gpu_shader_material_glsl_size= 33537; +int datatoc_gpu_shader_material_glsl_size= 34246; char datatoc_gpu_shader_material_glsl[]= { - 10, -102,108,111, 97,116, 32,101,120,112, 95, 98,108,101,110,100,101,114, 40,102,108,111, 97,116, 32,102, 41, 10,123, 10, 9,114,101, -116,117,114,110, 32,112,111,119, 40, 50, 46, 55, 49, 56, 50, 56, 49, 56, 50, 56, 52, 54, 44, 32,102, 41, 59, 10,125, 10, 10,118, -111,105,100, 32,114,103, 98, 95,116,111, 95,104,115,118, 40,118,101, 99, 52, 32,114,103, 98, 44, 32,111,117,116, 32,118,101, 99, - 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32, 99,109, 97,120, 44, 32, 99,109,105,110, 44, 32,104, - 44, 32,115, 44, 32,118, 44, 32, 99,100,101,108,116, 97, 59, 10, 9,118,101, 99, 51, 32, 99, 59, 10, 10, 9, 99,109, 97,120, 32, - 61, 32,109, 97,120, 40,114,103, 98, 91, 48, 93, 44, 32,109, 97,120, 40,114,103, 98, 91, 49, 93, 44, 32,114,103, 98, 91, 50, 93, - 41, 41, 59, 10, 9, 99,109,105,110, 32, 61, 32,109,105,110, 40,114,103, 98, 91, 48, 93, 44, 32,109,105,110, 40,114,103, 98, 91, - 49, 93, 44, 32,114,103, 98, 91, 50, 93, 41, 41, 59, 10, 9, 99,100,101,108,116, 97, 32, 61, 32, 99,109, 97,120, 45, 99,109,105, -110, 59, 10, 10, 9,118, 32, 61, 32, 99,109, 97,120, 59, 10, 9,105,102, 32, 40, 99,109, 97,120, 33, 61, 48, 46, 48, 41, 10, 9, - 9,115, 32, 61, 32, 99,100,101,108,116, 97, 47, 99,109, 97,120, 59, 10, 9,101,108,115,101, 32,123, 10, 9, 9,115, 32, 61, 32, - 48, 46, 48, 59, 10, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 10, 9,105,102, 32, 40,115, 32, 61, 61, 32, 48, 46, - 48, 41, 32,123, 10, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9, 99, 32, 61, - 32, 40,118,101, 99, 51, 40, 99,109, 97,120, 44, 32, 99,109, 97,120, 44, 32, 99,109, 97,120, 41, 32, 45, 32,114,103, 98, 46,120, -121,122, 41, 47, 99,100,101,108,116, 97, 59, 10, 10, 9, 9,105,102, 32, 40,114,103, 98, 46,120, 61, 61, 99,109, 97,120, 41, 32, -104, 32, 61, 32, 99, 91, 50, 93, 32, 45, 32, 99, 91, 49, 93, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,114,103, 98, 46, -121, 61, 61, 99,109, 97,120, 41, 32,104, 32, 61, 32, 50, 46, 48, 32, 43, 32, 99, 91, 48, 93, 32, 45, 32, 32, 99, 91, 50, 93, 59, - 10, 9, 9,101,108,115,101, 32,104, 32, 61, 32, 52, 46, 48, 32, 43, 32, 99, 91, 49, 93, 32, 45, 32, 99, 91, 48, 93, 59, 10, 10, - 9, 9,104, 32, 47, 61, 32, 54, 46, 48, 59, 10, 10, 9, 9,105,102, 32, 40,104, 60, 48, 46, 48, 41, 10, 9, 9, 9,104, 32, 43, - 61, 32, 49, 46, 48, 59, 10, 9,125, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,104, 44, 32,115, 44, 32, -118, 44, 32,114,103, 98, 46,119, 41, 59, 10,125, 10, 10,118,111,105,100, 32,104,115,118, 95,116,111, 95,114,103, 98, 40,118,101, - 99, 52, 32,104,115,118, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97, -116, 32,105, 44, 32,102, 44, 32,112, 44, 32,113, 44, 32,116, 44, 32,104, 44, 32,115, 44, 32,118, 59, 10, 9,118,101, 99, 51, 32, -114,103, 98, 59, 10, 10, 9,104, 32, 61, 32,104,115,118, 91, 48, 93, 59, 10, 9,115, 32, 61, 32,104,115,118, 91, 49, 93, 59, 10, - 9,118, 32, 61, 32,104,115,118, 91, 50, 93, 59, 10, 10, 9,105,102, 40,115, 61, 61, 48, 46, 48, 41, 32,123, 10, 9, 9,114,103, - 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,118, 44, 32,118, 41, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9, -105,102, 40,104, 61, 61, 49, 46, 48, 41, 10, 9, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9, 9, 10, 9, 9,104, 32, 42, 61, - 32, 54, 46, 48, 59, 10, 9, 9,105, 32, 61, 32,102,108,111,111,114, 40,104, 41, 59, 10, 9, 9,102, 32, 61, 32,104, 32, 45, 32, -105, 59, 10, 9, 9,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,102, 44, 32,102, 44, 32,102, 41, 59, 10, 9, 9,112, 32, 61, 32, -118, 42, 40, 49, 46, 48, 45,115, 41, 59, 10, 9, 9,113, 32, 61, 32,118, 42, 40, 49, 46, 48, 45, 40,115, 42,102, 41, 41, 59, 10, - 9, 9,116, 32, 61, 32,118, 42, 40, 49, 46, 48, 45, 40,115, 42, 40, 49, 46, 48, 45,102, 41, 41, 41, 59, 10, 9, 9, 10, 9, 9, -105,102, 32, 40,105, 32, 61, 61, 32, 48, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,116, 44, 32,112, - 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 49, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, - 99, 51, 40,113, 44, 32,118, 44, 32,112, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 50, 46, 48, - 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,112, 44, 32,118, 44, 32,116, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, - 32, 40,105, 32, 61, 61, 32, 51, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,112, 44, 32,113, 44, 32,118, 41, 59, - 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 52, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, - 40,116, 44, 32,112, 44, 32,118, 41, 59, 10, 9, 9,101,108,115,101, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32, -112, 44, 32,113, 41, 59, 10, 9,125, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,114,103, 98, 44, 32,104, -115,118, 46,119, 41, 59, 10,125, 10, 10, 35,100,101,102,105,110,101, 32, 77, 95, 80, 73, 32, 51, 46, 49, 52, 49, 53, 57, 50, 54, - 53, 51, 53, 56, 57, 55, 57, 51, 50, 51, 56, 52, 54, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 32, 83, 72, 65, 68, - 69, 82, 32, 78, 79, 68, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, 10,118,111,105,100, 32, -118, 99,111,108, 95, 97,116,116,114,105, 98,117,116,101, 40,118,101, 99, 52, 32, 97,116,116,118, 99,111,108, 44, 32,111,117,116, - 32,118,101, 99, 52, 32,118, 99,111,108, 41, 10,123, 10, 9,118, 99,111,108, 32, 61, 32,118,101, 99, 52, 40, 97,116,116,118, 99, -111,108, 46,120, 47, 50, 53, 53, 46, 48, 44, 32, 97,116,116,118, 99,111,108, 46,121, 47, 50, 53, 53, 46, 48, 44, 32, 97,116,116, -118, 99,111,108, 46,122, 47, 50, 53, 53, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,117,118, 95, 97, -116,116,114,105, 98,117,116,101, 40,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, - 41, 10,123, 10, 9,117,118, 32, 61, 32,118,101, 99, 51, 40, 97,116,116,117,118, 42, 50, 46, 48, 32, 45, 32,118,101, 99, 50, 40, - 49, 46, 48, 44, 32, 49, 46, 48, 41, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,103,101,111,109, 40,118,101, - 99, 51, 32, 99,111, 44, 32,118,101, 99, 51, 32,110,111,114, 44, 32,109, 97,116, 52, 32,118,105,101,119,105,110,118,109, 97,116, - 44, 32,118,101, 99, 51, 32, 97,116,116,111,114, 99,111, 44, 32,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,118,101, 99, 52, - 32, 97,116,116,118, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,103,108,111, 98, 97,108, 44, 32,111,117,116, 32,118, -101, 99, 51, 32,108,111, 99, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118,105,101,119, 44, 32,111,117,116, 32,118,101, - 99, 51, 32,111,114, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,110, -111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,118, 99,111,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32, -102,114,111,110,116, 98, 97, 99,107, 41, 10,123, 10, 9,108,111, 99, 97,108, 32, 61, 32, 99,111, 59, 10, 9,118,105,101,119, 32, - 61, 32,110,111,114,109, 97,108,105,122,101, 40,108,111, 99, 97,108, 41, 59, 10, 9,103,108,111, 98, 97,108, 32, 61, 32, 40,118, -105,101,119,105,110,118,109, 97,116, 42,118,101, 99, 52, 40,108,111, 99, 97,108, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, - 10, 9,111,114, 99,111, 32, 61, 32, 97,116,116,111,114, 99,111, 59, 10, 9,117,118, 95, 97,116,116,114,105, 98,117,116,101, 40, - 97,116,116,117,118, 44, 32,117,118, 41, 59, 10, 9,110,111,114,109, 97,108, 32, 61, 32, 45,110,111,114,109, 97,108,105,122,101, - 40,110,111,114, 41, 59, 9, 47, 42, 32, 98,108,101,110,100,101,114, 32,114,101,110,100,101,114, 32,110,111,114,109, 97,108, 32, -105,115, 32,110,101,103, 97,116,101,100, 32, 42, 47, 10, 9,118, 99,111,108, 95, 97,116,116,114,105, 98,117,116,101, 40, 97,116, -116,118, 99,111,108, 44, 32,118, 99,111,108, 41, 59, 10, 9,102,114,111,110,116, 98, 97, 99,107, 32, 61, 32, 49, 46, 48, 59, 10, -125, 10, 10,118,111,105,100, 32,109, 97,112,112,105,110,103, 40,118,101, 99, 51, 32,118,101, 99, 44, 32,109, 97,116, 52, 32,109, - 97,116, 44, 32,118,101, 99, 51, 32,109,105,110,118,101, 99, 44, 32,118,101, 99, 51, 32,109, 97,120,118,101, 99, 44, 32,102,108, -111, 97,116, 32,100,111,109,105,110, 44, 32,102,108,111, 97,116, 32,100,111,109, 97,120, 44, 32,111,117,116, 32,118,101, 99, 51, - 32,111,117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32, 40,109, 97,116, 32, 42, 32,118,101, 99, 52, - 40,118,101, 99, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10, 9,105,102, 40,100,111,109,105,110, 32, 61, 61, 32, 49, 46, - 48, 41, 10, 9, 9,111,117,116,118,101, 99, 32, 61, 32,109, 97,120, 40,111,117,116,118,101, 99, 44, 32,109,105,110,118,101, 99, - 41, 59, 10, 9,105,102, 40,100,111,109, 97,120, 32, 61, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116,118,101, 99, 32, 61, 32, -109,105,110, 40,111,117,116,118,101, 99, 44, 32,109, 97,120,118,101, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32, 99, 97,109, -101,114, 97, 40,118,101, 99, 51, 32, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,105,101,119, 44, 32,111, -117,116, 32,102,108,111, 97,116, 32,111,117,116,100,101,112,116,104, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116, -100,105,115,116, 41, 10,123, 10, 9,111,117,116,100,101,112,116,104, 32, 61, 32, 97, 98,115, 40, 99,111, 46,122, 41, 59, 10, 9, -111,117,116,100,105,115,116, 32, 61, 32,108,101,110,103,116,104, 40, 99,111, 41, 59, 10, 9,111,117,116,118,105,101,119, 32, 61, - 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,100,100, + 10,102,108,111, 97,116, + 32,101,120,112, 95, 98,108,101,110,100,101,114, 40,102,108,111, 97,116, 32,102, 41, 10,123, 10, 9,114,101,116,117,114,110, 32, +112,111,119, 40, 50, 46, 55, 49, 56, 50, 56, 49, 56, 50, 56, 52, 54, 44, 32,102, 41, 59, 10,125, 10, 10,118,111,105,100, 32,114, +103, 98, 95,116,111, 95,104,115,118, 40,118,101, 99, 52, 32,114,103, 98, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, + 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32, 99,109, 97,120, 44, 32, 99,109,105,110, 44, 32,104, 44, 32,115, 44, 32, +118, 44, 32, 99,100,101,108,116, 97, 59, 10, 9,118,101, 99, 51, 32, 99, 59, 10, 10, 9, 99,109, 97,120, 32, 61, 32,109, 97,120, + 40,114,103, 98, 91, 48, 93, 44, 32,109, 97,120, 40,114,103, 98, 91, 49, 93, 44, 32,114,103, 98, 91, 50, 93, 41, 41, 59, 10, 9, + 99,109,105,110, 32, 61, 32,109,105,110, 40,114,103, 98, 91, 48, 93, 44, 32,109,105,110, 40,114,103, 98, 91, 49, 93, 44, 32,114, +103, 98, 91, 50, 93, 41, 41, 59, 10, 9, 99,100,101,108,116, 97, 32, 61, 32, 99,109, 97,120, 45, 99,109,105,110, 59, 10, 10, 9, +118, 32, 61, 32, 99,109, 97,120, 59, 10, 9,105,102, 32, 40, 99,109, 97,120, 33, 61, 48, 46, 48, 41, 10, 9, 9,115, 32, 61, 32, + 99,100,101,108,116, 97, 47, 99,109, 97,120, 59, 10, 9,101,108,115,101, 32,123, 10, 9, 9,115, 32, 61, 32, 48, 46, 48, 59, 10, + 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 10, 9,105,102, 32, 40,115, 32, 61, 61, 32, 48, 46, 48, 41, 32,123, 10, + 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9, 99, 32, 61, 32, 40,118,101, 99, + 51, 40, 99,109, 97,120, 44, 32, 99,109, 97,120, 44, 32, 99,109, 97,120, 41, 32, 45, 32,114,103, 98, 46,120,121,122, 41, 47, 99, +100,101,108,116, 97, 59, 10, 10, 9, 9,105,102, 32, 40,114,103, 98, 46,120, 61, 61, 99,109, 97,120, 41, 32,104, 32, 61, 32, 99, + 91, 50, 93, 32, 45, 32, 99, 91, 49, 93, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,114,103, 98, 46,121, 61, 61, 99,109, + 97,120, 41, 32,104, 32, 61, 32, 50, 46, 48, 32, 43, 32, 99, 91, 48, 93, 32, 45, 32, 32, 99, 91, 50, 93, 59, 10, 9, 9,101,108, +115,101, 32,104, 32, 61, 32, 52, 46, 48, 32, 43, 32, 99, 91, 49, 93, 32, 45, 32, 99, 91, 48, 93, 59, 10, 10, 9, 9,104, 32, 47, + 61, 32, 54, 46, 48, 59, 10, 10, 9, 9,105,102, 32, 40,104, 60, 48, 46, 48, 41, 10, 9, 9, 9,104, 32, 43, 61, 32, 49, 46, 48, + 59, 10, 9,125, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,104, 44, 32,115, 44, 32,118, 44, 32,114,103, + 98, 46,119, 41, 59, 10,125, 10, 10,118,111,105,100, 32,104,115,118, 95,116,111, 95,114,103, 98, 40,118,101, 99, 52, 32,104,115, +118, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,102,108,111, 97,116, 32,105, 44, 32, +102, 44, 32,112, 44, 32,113, 44, 32,116, 44, 32,104, 44, 32,115, 44, 32,118, 59, 10, 9,118,101, 99, 51, 32,114,103, 98, 59, 10, + 10, 9,104, 32, 61, 32,104,115,118, 91, 48, 93, 59, 10, 9,115, 32, 61, 32,104,115,118, 91, 49, 93, 59, 10, 9,118, 32, 61, 32, +104,115,118, 91, 50, 93, 59, 10, 10, 9,105,102, 40,115, 61, 61, 48, 46, 48, 41, 32,123, 10, 9, 9,114,103, 98, 32, 61, 32,118, +101, 99, 51, 40,118, 44, 32,118, 44, 32,118, 41, 59, 10, 9,125, 10, 9,101,108,115,101, 32,123, 10, 9, 9,105,102, 40,104, 61, + 61, 49, 46, 48, 41, 10, 9, 9, 9,104, 32, 61, 32, 48, 46, 48, 59, 10, 9, 9, 10, 9, 9,104, 32, 42, 61, 32, 54, 46, 48, 59, + 10, 9, 9,105, 32, 61, 32,102,108,111,111,114, 40,104, 41, 59, 10, 9, 9,102, 32, 61, 32,104, 32, 45, 32,105, 59, 10, 9, 9, +114,103, 98, 32, 61, 32,118,101, 99, 51, 40,102, 44, 32,102, 44, 32,102, 41, 59, 10, 9, 9,112, 32, 61, 32,118, 42, 40, 49, 46, + 48, 45,115, 41, 59, 10, 9, 9,113, 32, 61, 32,118, 42, 40, 49, 46, 48, 45, 40,115, 42,102, 41, 41, 59, 10, 9, 9,116, 32, 61, + 32,118, 42, 40, 49, 46, 48, 45, 40,115, 42, 40, 49, 46, 48, 45,102, 41, 41, 41, 59, 10, 9, 9, 10, 9, 9,105,102, 32, 40,105, + 32, 61, 61, 32, 48, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,116, 44, 32,112, 41, 59, 10, 9, 9, +101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 49, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,113, 44, + 32,118, 44, 32,112, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 50, 46, 48, 41, 32,114,103, 98, + 32, 61, 32,118,101, 99, 51, 40,112, 44, 32,118, 44, 32,116, 41, 59, 10, 9, 9,101,108,115,101, 32,105,102, 32, 40,105, 32, 61, + 61, 32, 51, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,112, 44, 32,113, 44, 32,118, 41, 59, 10, 9, 9,101,108, +115,101, 32,105,102, 32, 40,105, 32, 61, 61, 32, 52, 46, 48, 41, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,116, 44, 32,112, + 44, 32,118, 41, 59, 10, 9, 9,101,108,115,101, 32,114,103, 98, 32, 61, 32,118,101, 99, 51, 40,118, 44, 32,112, 44, 32,113, 41, + 59, 10, 9,125, 10, 10, 9,111,117,116, 99,111,108, 32, 61, 32,118,101, 99, 52, 40,114,103, 98, 44, 32,104,115,118, 46,119, 41, + 59, 10,125, 10, 10,102,108,111, 97,116, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40,102,108,111, + 97,116, 32, 99, 41, 10,123, 10, 9,105,102, 40, 99, 32, 60, 32, 48, 46, 48, 52, 48, 52, 53, 41, 10, 9, 9,114,101,116,117,114, +110, 32, 40, 99, 32, 60, 32, 48, 46, 48, 41, 63, 32, 48, 46, 48, 58, 32, 99, 32, 42, 32, 40, 49, 46, 48, 47, 49, 50, 46, 57, 50, + 41, 59, 10, 9,101,108,115,101, 10, 9, 9,114,101,116,117,114,110, 32,112,111,119, 40, 40, 99, 32, 43, 32, 48, 46, 48, 53, 53, + 41, 42, 40, 49, 46, 48, 47, 49, 46, 48, 53, 53, 41, 44, 32, 50, 46, 52, 41, 59, 10,125, 10, 10,102,108,111, 97,116, 32,108,105, +110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40,102,108,111, 97,116, 32, 99, 41, 10,123, 10, 9,105,102, 40, 99, + 32, 60, 32, 48, 46, 48, 48, 51, 49, 51, 48, 56, 41, 10, 9, 9,114,101,116,117,114,110, 32, 40, 99, 32, 60, 32, 48, 46, 48, 41, + 63, 32, 48, 46, 48, 58, 32, 99, 32, 42, 32, 49, 50, 46, 57, 50, 59, 10, 9,101,108,115,101, 10, 9, 9,114,101,116,117,114,110, + 32, 49, 46, 48, 53, 53, 32, 42, 32,112,111,119, 40, 99, 44, 32, 49, 46, 48, 47, 50, 46, 52, 41, 32, 45, 32, 48, 46, 48, 53, 53, +102, 59, 10,125, 10, 10,118,111,105,100, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40,118,101, 99, + 52, 32, 99,111,108, 95,102,114,111,109, 44, 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108, 95,116,111, 41, 10,123, 10, 9, + 99,111,108, 95,116,111, 46,114, 32, 61, 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111,108, + 95,102,114,111,109, 46,114, 41, 59, 10, 9, 99,111,108, 95,116,111, 46,103, 32, 61, 32,115,114,103, 98, 95,116,111, 95,108,105, +110,101, 97,114,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,103, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 98, 32, 61, + 32,115,114,103, 98, 95,116,111, 95,108,105,110,101, 97,114,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46, 98, 41, 59, 10, + 9, 99,111,108, 95,116,111, 46, 97, 32, 61, 32, 99,111,108, 95,102,114,111,109, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32, +108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40,118,101, 99, 52, 32, 99,111,108, 95,102,114,111,109, 44, + 32,111,117,116, 32,118,101, 99, 52, 32, 99,111,108, 95,116,111, 41, 10,123, 10, 9, 99,111,108, 95,116,111, 46,114, 32, 61, 32, +108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46,114, 41, 59, 10, 9, + 99,111,108, 95,116,111, 46,103, 32, 61, 32,108,105,110,101, 97,114,114,103, 98, 95,116,111, 95,115,114,103, 98, 40, 99,111,108, + 95,102,114,111,109, 46,103, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 98, 32, 61, 32,108,105,110,101, 97,114,114,103, 98, 95, +116,111, 95,115,114,103, 98, 40, 99,111,108, 95,102,114,111,109, 46, 98, 41, 59, 10, 9, 99,111,108, 95,116,111, 46, 97, 32, 61, + 32, 99,111,108, 95,102,114,111,109, 46, 97, 59, 10,125, 10, 10, 35,100,101,102,105,110,101, 32, 77, 95, 80, 73, 32, 51, 46, 49, + 52, 49, 53, 57, 50, 54, 53, 51, 53, 56, 57, 55, 57, 51, 50, 51, 56, 52, 54, 10, 10, 47, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 32, 83, 72, 65, 68, 69, 82, 32, 78, 79, 68, 69, 83, 32, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 47, 10, + 10,118,111,105,100, 32,118, 99,111,108, 95, 97,116,116,114,105, 98,117,116,101, 40,118,101, 99, 52, 32, 97,116,116,118, 99,111, +108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,118, 99,111,108, 41, 10,123, 10, 9,118, 99,111,108, 32, 61, 32,118,101, 99, 52, + 40, 97,116,116,118, 99,111,108, 46,120, 47, 50, 53, 53, 46, 48, 44, 32, 97,116,116,118, 99,111,108, 46,121, 47, 50, 53, 53, 46, + 48, 44, 32, 97,116,116,118, 99,111,108, 46,122, 47, 50, 53, 53, 46, 48, 44, 32, 49, 46, 48, 41, 59, 10,125, 10, 10,118,111,105, +100, 32,117,118, 95, 97,116,116,114,105, 98,117,116,101, 40,118,101, 99, 50, 32, 97,116,116,117,118, 44, 32,111,117,116, 32,118, +101, 99, 51, 32,117,118, 41, 10,123, 10, 9,117,118, 32, 61, 32,118,101, 99, 51, 40, 97,116,116,117,118, 42, 50, 46, 48, 32, 45, + 32,118,101, 99, 50, 40, 49, 46, 48, 44, 32, 49, 46, 48, 41, 44, 32, 48, 46, 48, 41, 59, 10,125, 10, 10,118,111,105,100, 32,103, +101,111,109, 40,118,101, 99, 51, 32, 99,111, 44, 32,118,101, 99, 51, 32,110,111,114, 44, 32,109, 97,116, 52, 32,118,105,101,119, +105,110,118,109, 97,116, 44, 32,118,101, 99, 51, 32, 97,116,116,111,114, 99,111, 44, 32,118,101, 99, 50, 32, 97,116,116,117,118, + 44, 32,118,101, 99, 52, 32, 97,116,116,118, 99,111,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,103,108,111, 98, 97,108, 44, + 32,111,117,116, 32,118,101, 99, 51, 32,108,111, 99, 97,108, 44, 32,111,117,116, 32,118,101, 99, 51, 32,118,105,101,119, 44, 32, +111,117,116, 32,118,101, 99, 51, 32,111,114, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,117,118, 44, 32,111,117,116, 32, +118,101, 99, 51, 32,110,111,114,109, 97,108, 44, 32,111,117,116, 32,118,101, 99, 52, 32,118, 99,111,108, 44, 32,111,117,116, 32, +102,108,111, 97,116, 32,102,114,111,110,116, 98, 97, 99,107, 41, 10,123, 10, 9,108,111, 99, 97,108, 32, 61, 32, 99,111, 59, 10, + 9,118,105,101,119, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,108,111, 99, 97,108, 41, 59, 10, 9,103,108,111, 98, 97, +108, 32, 61, 32, 40,118,105,101,119,105,110,118,109, 97,116, 42,118,101, 99, 52, 40,108,111, 99, 97,108, 44, 32, 49, 46, 48, 41, + 41, 46,120,121,122, 59, 10, 9,111,114, 99,111, 32, 61, 32, 97,116,116,111,114, 99,111, 59, 10, 9,117,118, 95, 97,116,116,114, +105, 98,117,116,101, 40, 97,116,116,117,118, 44, 32,117,118, 41, 59, 10, 9,110,111,114,109, 97,108, 32, 61, 32, 45,110,111,114, +109, 97,108,105,122,101, 40,110,111,114, 41, 59, 9, 47, 42, 32, 98,108,101,110,100,101,114, 32,114,101,110,100,101,114, 32,110, +111,114,109, 97,108, 32,105,115, 32,110,101,103, 97,116,101,100, 32, 42, 47, 10, 9,118, 99,111,108, 95, 97,116,116,114,105, 98, +117,116,101, 40, 97,116,116,118, 99,111,108, 44, 32,118, 99,111,108, 41, 59, 10, 9,102,114,111,110,116, 98, 97, 99,107, 32, 61, + 32, 49, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,112,112,105,110,103, 40,118,101, 99, 51, 32,118,101, 99, 44, 32, +109, 97,116, 52, 32,109, 97,116, 44, 32,118,101, 99, 51, 32,109,105,110,118,101, 99, 44, 32,118,101, 99, 51, 32,109, 97,120,118, +101, 99, 44, 32,102,108,111, 97,116, 32,100,111,109,105,110, 44, 32,102,108,111, 97,116, 32,100,111,109, 97,120, 44, 32,111,117, +116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32, 40,109, 97,116, 32, + 42, 32,118,101, 99, 52, 40,118,101, 99, 44, 32, 49, 46, 48, 41, 41, 46,120,121,122, 59, 10, 9,105,102, 40,100,111,109,105,110, + 32, 61, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116,118,101, 99, 32, 61, 32,109, 97,120, 40,111,117,116,118,101, 99, 44, 32, +109,105,110,118,101, 99, 41, 59, 10, 9,105,102, 40,100,111,109, 97,120, 32, 61, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, +118,101, 99, 32, 61, 32,109,105,110, 40,111,117,116,118,101, 99, 44, 32,109, 97,120,118,101, 99, 41, 59, 10,125, 10, 10,118,111, +105,100, 32, 99, 97,109,101,114, 97, 40,118,101, 99, 51, 32, 99,111, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118, +105,101,119, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,100,101,112,116,104, 44, 32,111,117,116, 32,102,108,111, + 97,116, 32,111,117,116,100,105,115,116, 41, 10,123, 10, 9,111,117,116,100,101,112,116,104, 32, 61, 32, 97, 98,115, 40, 99,111, + 46,122, 41, 59, 10, 9,111,117,116,100,105,115,116, 32, 61, 32,108,101,110,103,116,104, 40, 99,111, 41, 59, 10, 9,111,117,116, +118,105,101,119, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40, 99,111, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97, +116,104, 95, 97,100,100, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111, +117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, + 49, 32, 43, 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,115,117, 98,116,114, 97, 99,116, 40, +102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97, +116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 45, 32,118, 97,108, + 50, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,109,117,108,116,105,112,108,121, 40,102,108,111, 97,116, 32,118, + 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97, +108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 42, 32,118, 97,108, 50, 59, 10,125, 10, 10,118, +111,105,100, 32,109, 97,116,104, 95,100,105,118,105,100,101, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97, +116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, + 40,118, 97,108, 50, 32, 61, 61, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10, 9,101, +108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 47, 32,118, 97,108, 50, 59, 10,125, 10, 10,118, +111,105,100, 32,109, 97,116,104, 95,115,105,110,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, + 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,115,105,110, 40,118, 97,108, 41, 59, + 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 99,111,115,105,110,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32, +111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 99,111, +115, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,116, 97,110,103,101,110,116, 40,102,108,111, + 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116, +118, 97,108, 32, 61, 32,116, 97,110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,115,105, +110, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, + 10, 9,105,102, 32, 40,118, 97,108, 32, 60, 61, 32, 49, 46, 48, 32, 38, 38, 32,118, 97,108, 32, 62, 61, 32, 45, 49, 46, 48, 41, + 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 97,115,105,110, 40,118, 97,108, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111, +117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97, 99,111,115, 40,102, +108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105, +102, 32, 40,118, 97,108, 32, 60, 61, 32, 49, 46, 48, 32, 38, 38, 32,118, 97,108, 32, 62, 61, 32, 45, 49, 46, 48, 41, 10, 9, 9, +111,117,116,118, 97,108, 32, 61, 32, 97, 99,111,115, 40,118, 97,108, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, + 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,116, 97,110, 40,102,108,111, 97, +116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, + 97,108, 32, 61, 32, 97,116, 97,110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,112,111,119, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, - 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 43, 32,118, 97, -108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,115,117, 98,116,114, 97, 99,116, 40,102,108,111, 97,116, 32, -118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, - 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 45, 32,118, 97,108, 50, 59, 10,125, 10, 10, -118,111,105,100, 32,109, 97,116,104, 95,109,117,108,116,105,112,108,121, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102, -108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9, -111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 42, 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97, -116,104, 95,100,105,118,105,100,101, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, - 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40,118, 97,108, 50, 32, - 61, 61, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10, 9,101,108,115,101, 10, 9, 9, -111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 49, 32, 47, 32,118, 97,108, 50, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97, -116,104, 95,115,105,110,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116, -118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,115,105,110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111, -105,100, 32,109, 97,116,104, 95, 99,111,115,105,110,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108, -111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 99,111,115, 40,118, 97,108, 41, - 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,116, 97,110,103,101,110,116, 40,102,108,111, 97,116, 32,118, 97,108, - 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, -116, 97,110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,115,105,110, 40,102,108,111, 97, -116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40, -118, 97,108, 32, 60, 61, 32, 49, 46, 48, 32, 38, 38, 32,118, 97,108, 32, 62, 61, 32, 45, 49, 46, 48, 41, 10, 9, 9,111,117,116, -118, 97,108, 32, 61, 32, 97,115,105,110, 40,118, 97,108, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, - 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97, 99,111,115, 40,102,108,111, 97,116, 32,118, - 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40,118, 97,108, - 32, 60, 61, 32, 49, 46, 48, 32, 38, 38, 32,118, 97,108, 32, 62, 61, 32, 45, 49, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, - 32, 61, 32, 97, 99,111,115, 40,118, 97,108, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, - 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95, 97,116, 97,110, 40,102,108,111, 97,116, 32,118, 97,108, 44, - 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 97, -116, 97,110, 40,118, 97,108, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,112,111,119, 40,102,108,111, 97,116, - 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116, -118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40,118, 97,108, 49, 32, 62, 61, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97, -108, 32, 61, 32,112,111,119, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116, -118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,108,111,103, 40,102,108,111, 97, -116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117, -116,118, 97,108, 41, 10,123, 10, 9,105,102, 40,118, 97,108, 49, 32, 62, 32, 48, 46, 48, 32, 32, 38, 38, 32,118, 97,108, 50, 32, - 62, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 61, 32,108,111,103, 50, 40,118, 97,108, 49, 41, 32, 47, 32,108,111, -103, 50, 40,118, 97,108, 50, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 61, 32, 48, 46, 48, 59, 10,125, - 10, 10,118,111,105,100, 32,109, 97,116,104, 95,109, 97,120, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97, -116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116, -118, 97,108, 32, 61, 32,109, 97,120, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, - 97,116,104, 95,109,105,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32, -111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,109,105, -110, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,114,111,117,110, -100, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, - 10, 9,111,117,116,118, 97,108, 61, 32,102,108,111,111,114, 40,118, 97,108, 32, 43, 32, 48, 46, 53, 41, 59, 10,125, 10, 10,118, -111,105,100, 32,109, 97,116,104, 95,108,101,115,115, 95,116,104, 97,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102, -108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9, -105,102, 40,118, 97,108, 49, 32, 60, 32,118, 97,108, 50, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 59, 10, - 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97, -116,104, 95,103,114,101, 97,116,101,114, 95,116,104, 97,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97, -116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 40, -118, 97,108, 49, 32, 62, 32,118, 97,108, 50, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 59, 10, 9,101,108, -115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,115,113,117,101,101, -122,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,102,108,111, 97,116, 32,119,105,100,116,104, 44, 32,102,108,111, 97,116, - 32, 99,101,110,116,101,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117, -116,118, 97,108, 32, 61, 32, 49, 46, 48, 47, 40, 49, 46, 48, 32, 43, 32,112,111,119, 40, 50, 46, 55, 49, 56, 50, 56, 49, 56, 51, - 44, 32, 45, 40, 40,118, 97,108, 45, 99,101,110,116,101,114, 41, 42,119,105,100,116,104, 41, 41, 41, 59, 10,125, 10, 10,118,111, -105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 97,100,100, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, - 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116, -118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 43, 32,118, 50, 59, 10, 9,111,117,116,118, 97, -108, 32, 61, 32, 40, 97, 98,115, 40,111,117,116,118,101, 99, 91, 48, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, - 91, 49, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 50, 93, 41, 41, 47, 51, 46, 48, 59, 10,125, 10, 10,118, -111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,115,117, 98, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, - 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117, -116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 45, 32,118, 50, 59, 10, 9,111,117,116,118, - 97,108, 32, 61, 32, 40, 97, 98,115, 40,111,117,116,118,101, 99, 91, 48, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, - 99, 91, 49, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 50, 93, 41, 41, 47, 51, 46, 48, 59, 10,125, 10, 10, -118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 97,118,101,114, 97,103,101, 40,118,101, 99, 51, 32,118, 49, 44, 32,118, + 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 32, 40,118, 97,108, 49, 32, 62, 61, 32, 48, 46, 48, 41, 10, 9, + 9,111,117,116,118, 97,108, 32, 61, 32,112,111,119, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10, 9,101,108,115,101, + 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,108,111, +103, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108, +111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,105,102, 40,118, 97,108, 49, 32, 62, 32, 48, 46, 48, 32, 32, 38, 38, + 32,118, 97,108, 50, 32, 62, 32, 48, 46, 48, 41, 10, 9, 9,111,117,116,118, 97,108, 61, 32,108,111,103, 50, 40,118, 97,108, 49, + 41, 32, 47, 32,108,111,103, 50, 40,118, 97,108, 50, 41, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 61, 32, + 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,109, 97,120, 40,102,108,111, 97,116, 32,118, 97,108, 49, + 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10, +123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,109, 97,120, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10,125, 10, 10, +118,111,105,100, 32,109, 97,116,104, 95,109,105,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, 44, 32,102,108,111, 97,116, 32, +118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97, +108, 32, 61, 32,109,105,110, 40,118, 97,108, 49, 44, 32,118, 97,108, 50, 41, 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116, +104, 95,114,111,117,110,100, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116, +118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 61, 32,102,108,111,111,114, 40,118, 97,108, 32, 43, 32, 48, 46, 53, 41, + 59, 10,125, 10, 10,118,111,105,100, 32,109, 97,116,104, 95,108,101,115,115, 95,116,104, 97,110, 40,102,108,111, 97,116, 32,118, + 97,108, 49, 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97, +108, 41, 10,123, 10, 9,105,102, 40,118, 97,108, 49, 32, 60, 32,118, 97,108, 50, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, + 32, 49, 46, 48, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118, +111,105,100, 32,109, 97,116,104, 95,103,114,101, 97,116,101,114, 95,116,104, 97,110, 40,102,108,111, 97,116, 32,118, 97,108, 49, + 44, 32,102,108,111, 97,116, 32,118, 97,108, 50, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10, +123, 10, 9,105,102, 40,118, 97,108, 49, 32, 62, 32,118, 97,108, 50, 41, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, + 48, 59, 10, 9,101,108,115,101, 10, 9, 9,111,117,116,118, 97,108, 32, 61, 32, 48, 46, 48, 59, 10,125, 10, 10,118,111,105,100, + 32,115,113,117,101,101,122,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,102,108,111, 97,116, 32,119,105,100,116,104, 44, + 32,102,108,111, 97,116, 32, 99,101,110,116,101,114, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, + 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32, 49, 46, 48, 47, 40, 49, 46, 48, 32, 43, 32,112,111,119, 40, 50, 46, 55, 49, + 56, 50, 56, 49, 56, 51, 44, 32, 45, 40, 40,118, 97,108, 45, 99,101,110,116,101,114, 41, 42,119,105,100,116,104, 41, 41, 41, 59, + 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 97,100,100, 40,118,101, 99, 51, 32,118, 49, 44, 32,118, 101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 43, 32,118, 50, 59, 10, - 9,111,117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,111,117,116,118,101, 99, 41, 59, 10, 9,111,117,116,118,101, - 99, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,111,117,116,118,101, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118, -101, 99, 95,109, 97,116,104, 95,100,111,116, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117, -116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, - 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118,101, 99, 51, 40, 48, 44, 32, 48, 44, 32, 48, 41, 59, 10, 9,111,117,116, -118, 97,108, 32, 61, 32,100,111,116, 40,118, 49, 44, 32,118, 50, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, - 97,116,104, 95, 99,114,111,115,115, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32, -118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, - 10, 9,111,117,116,118,101, 99, 32, 61, 32, 99,114,111,115,115, 40,118, 49, 44, 32,118, 50, 41, 59, 10, 9,111,117,116,118, 97, -108, 32, 61, 32,108,101,110,103,116,104, 40,111,117,116,118,101, 99, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95, -109, 97,116,104, 95,110,111,114,109, 97,108,105,122,101, 40,118,101, 99, 51, 32,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32, -111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116, -118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,118, 41, 59, 10, 9,111,117,116,118,101, 99, 32, 61, 32,110,111,114,109, 97, -108,105,122,101, 40,118, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,110,101,103, 97,116,101, - 40,118,101, 99, 51, 32,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118, 41, 10,123, 10, 9,111,117,116,118, 32, - 61, 32, 45,118, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,114,109, 97,108, 40,118,101, 99, 51, 32,100,105,114, 44, 32,118, -101, 99, 51, 32,110,111,114, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114, 44, 32,111,117,116, 32,102,108, -111, 97,116, 32,111,117,116,100,111,116, 41, 10,123, 10, 9,111,117,116,110,111,114, 32, 61, 32,100,105,114, 59, 10, 9,111,117, -116,100,111,116, 32, 61, 32, 45,100,111,116, 40,100,105,114, 44, 32,110,111,114, 41, 59, 10,125, 10, 10,118,111,105,100, 32, 99, -117,114,118,101,115, 95,118,101, 99, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 51, 32,118,101, 99, 44, 32,115, - 97,109,112,108,101,114, 49, 68, 32, 99,117,114,118,101,109, 97,112, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118, -101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 46,120, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118, -101,109, 97,112, 44, 32, 40,118,101, 99, 46,120, 32, 43, 32, 49, 46, 48, 41, 42, 48, 46, 53, 41, 46,120, 59, 10, 9,111,117,116, -118,101, 99, 46,121, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 40,118,101, 99, - 46,121, 32, 43, 32, 49, 46, 48, 41, 42, 48, 46, 53, 41, 46,121, 59, 10, 9,111,117,116,118,101, 99, 46,122, 32, 61, 32,116,101, -120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 40,118,101, 99, 46,122, 32, 43, 32, 49, 46, 48, 41, 42, - 48, 46, 53, 41, 46,122, 59, 10, 9,105,102, 32, 40,102, 97, 99, 32, 33, 61, 32, 49, 46, 48, 41, 32,123, 10, 9, 9,111,117,116, -118,101, 99, 32, 61, 32, 40,111,117,116,118,101, 99, 42,102, 97, 99, 41, 32, 43, 32, 40,118,101, 99, 42, 40, 49, 46, 48, 45,102, - 97, 99, 41, 41, 59, 10, 9,125, 10,125, 10, 10,118,111,105,100, 32, 99,117,114,118,101,115, 95,114,103, 98, 40,102,108,111, 97, -116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,115, 97,109,112,108,101,114, 49, 68, 32, 99,117,114,118,101, -109, 97,112, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99,111,108, 46, -114, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,116,101,120,116,117,114,101, 49, - 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 99,111,108, 46,114, 41, 46, 97, 41, 46,114, 59, 10, 9,111,117,116, 99,111,108, - 46,103, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,116,101,120,116,117,114,101, - 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 99,111,108, 46,103, 41, 46, 97, 41, 46,103, 59, 10, 9,111,117,116, 99,111, -108, 46, 98, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,116,101,120,116,117,114, -101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 99,111,108, 46, 98, 41, 46, 97, 41, 46, 98, 59, 10, 9,105,102, 32, 40, -102, 97, 99, 32, 33, 61, 32, 49, 46, 48, 41, 32,123, 10, 9, 9,111,117,116, 99,111,108, 32, 61, 32, 40,111,117,116, 99,111,108, - 42,102, 97, 99, 41, 32, 43, 32, 40, 99,111,108, 42, 40, 49, 46, 48, 45,102, 97, 99, 41, 41, 59, 10, 9,125, 10, 9,111,117,116, + 9,111,117,116,118, 97,108, 32, 61, 32, 40, 97, 98,115, 40,111,117,116,118,101, 99, 91, 48, 93, 41, 32, 43, 32, 97, 98,115, 40, +111,117,116,118,101, 99, 91, 49, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 50, 93, 41, 41, 47, 51, 46, 48, + 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,115,117, 98, 40,118,101, 99, 51, 32,118, 49, 44, 32, +118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108, +111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, 45, 32,118, 50, 59, + 10, 9,111,117,116,118, 97,108, 32, 61, 32, 40, 97, 98,115, 40,111,117,116,118,101, 99, 91, 48, 93, 41, 32, 43, 32, 97, 98,115, + 40,111,117,116,118,101, 99, 91, 49, 93, 41, 32, 43, 32, 97, 98,115, 40,111,117,116,118,101, 99, 91, 50, 93, 41, 41, 47, 51, 46, + 48, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95, 97,118,101,114, 97,103,101, 40,118,101, 99, 51, + 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111, +117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118, 49, 32, + 43, 32,118, 50, 59, 10, 9,111,117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,111,117,116,118,101, 99, 41, 59, 10, + 9,111,117,116,118,101, 99, 32, 61, 32,110,111,114,109, 97,108,105,122,101, 40,111,117,116,118,101, 99, 41, 59, 10,125, 10, 10, +118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95,100,111,116, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32, +118, 50, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111, +117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32,118,101, 99, 51, 40, 48, 44, 32, 48, 44, 32, 48, 41, + 59, 10, 9,111,117,116,118, 97,108, 32, 61, 32,100,111,116, 40,118, 49, 44, 32,118, 50, 41, 59, 10,125, 10, 10,118,111,105,100, + 32,118,101, 99, 95,109, 97,116,104, 95, 99,114,111,115,115, 40,118,101, 99, 51, 32,118, 49, 44, 32,118,101, 99, 51, 32,118, 50, + 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116, +118, 97,108, 41, 10,123, 10, 9,111,117,116,118,101, 99, 32, 61, 32, 99,114,111,115,115, 40,118, 49, 44, 32,118, 50, 41, 59, 10, + 9,111,117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,111,117,116,118,101, 99, 41, 59, 10,125, 10, 10,118,111,105, +100, 32,118,101, 99, 95,109, 97,116,104, 95,110,111,114,109, 97,108,105,122,101, 40,118,101, 99, 51, 32,118, 44, 32,111,117,116, + 32,118,101, 99, 51, 32,111,117,116,118,101, 99, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10, +123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,108,101,110,103,116,104, 40,118, 41, 59, 10, 9,111,117,116,118,101, 99, 32, 61, + 32,110,111,114,109, 97,108,105,122,101, 40,118, 41, 59, 10,125, 10, 10,118,111,105,100, 32,118,101, 99, 95,109, 97,116,104, 95, +110,101,103, 97,116,101, 40,118,101, 99, 51, 32,118, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,118, 41, 10,123, 10, + 9,111,117,116,118, 32, 61, 32, 45,118, 59, 10,125, 10, 10,118,111,105,100, 32,110,111,114,109, 97,108, 40,118,101, 99, 51, 32, +100,105,114, 44, 32,118,101, 99, 51, 32,110,111,114, 44, 32,111,117,116, 32,118,101, 99, 51, 32,111,117,116,110,111,114, 44, 32, +111,117,116, 32,102,108,111, 97,116, 32,111,117,116,100,111,116, 41, 10,123, 10, 9,111,117,116,110,111,114, 32, 61, 32,100,105, +114, 59, 10, 9,111,117,116,100,111,116, 32, 61, 32, 45,100,111,116, 40,100,105,114, 44, 32,110,111,114, 41, 59, 10,125, 10, 10, +118,111,105,100, 32, 99,117,114,118,101,115, 95,118,101, 99, 40,102,108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 51, 32, +118,101, 99, 44, 32,115, 97,109,112,108,101,114, 49, 68, 32, 99,117,114,118,101,109, 97,112, 44, 32,111,117,116, 32,118,101, 99, + 51, 32,111,117,116,118,101, 99, 41, 10,123, 10, 9,111,117,116,118,101, 99, 46,120, 32, 61, 32,116,101,120,116,117,114,101, 49, + 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 40,118,101, 99, 46,120, 32, 43, 32, 49, 46, 48, 41, 42, 48, 46, 53, 41, 46,120, + 59, 10, 9,111,117,116,118,101, 99, 46,121, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, + 44, 32, 40,118,101, 99, 46,121, 32, 43, 32, 49, 46, 48, 41, 42, 48, 46, 53, 41, 46,121, 59, 10, 9,111,117,116,118,101, 99, 46, +122, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 40,118,101, 99, 46,122, 32, 43, + 32, 49, 46, 48, 41, 42, 48, 46, 53, 41, 46,122, 59, 10, 10, 9,105,102, 32, 40,102, 97, 99, 32, 33, 61, 32, 49, 46, 48, 41, 10, + 9, 9,111,117,116,118,101, 99, 32, 61, 32, 40,111,117,116,118,101, 99, 42,102, 97, 99, 41, 32, 43, 32, 40,118,101, 99, 42, 40, + 49, 46, 48, 45,102, 97, 99, 41, 41, 59, 10, 10,125, 10, 10,118,111,105,100, 32, 99,117,114,118,101,115, 95,114,103, 98, 40,102, +108,111, 97,116, 32,102, 97, 99, 44, 32,118,101, 99, 52, 32, 99,111,108, 44, 32,115, 97,109,112,108,101,114, 49, 68, 32, 99,117, +114,118,101,109, 97,112, 44, 32,111,117,116, 32,118,101, 99, 52, 32,111,117,116, 99,111,108, 41, 10,123, 10, 9,111,117,116, 99, +111,108, 46,114, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,116,101,120,116,117, +114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 99,111,108, 46,114, 41, 46, 97, 41, 46,114, 59, 10, 9,111,117,116, + 99,111,108, 46,103, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,116,101,120,116, +117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 99,111,108, 46,103, 41, 46, 97, 41, 46,103, 59, 10, 9,111,117, +116, 99,111,108, 46, 98, 32, 61, 32,116,101,120,116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32,116,101,120, +116,117,114,101, 49, 68, 40, 99,117,114,118,101,109, 97,112, 44, 32, 99,111,108, 46, 98, 41, 46, 97, 41, 46, 98, 59, 10, 10, 9, +105,102, 32, 40,102, 97, 99, 32, 33, 61, 32, 49, 46, 48, 41, 10, 9, 9,111,117,116, 99,111,108, 32, 61, 32, 40,111,117,116, 99, +111,108, 42,102, 97, 99, 41, 32, 43, 32, 40, 99,111,108, 42, 40, 49, 46, 48, 45,102, 97, 99, 41, 41, 59, 10, 10, 9,111,117,116, 99,111,108, 46, 97, 32, 61, 32, 99,111,108, 46, 97, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,118, 97,108,117,101, 40,102,108,111, 97,116, 32,118, 97,108, 44, 32,111,117,116, 32,102,108,111, 97,116, 32,111,117,116,118, 97,108, 41, 10,123, 10, 9,111,117,116,118, 97,108, 32, 61, 32,118, 97,108, 59, 10,125, 10, 10,118,111,105,100, 32,115,101,116, 95,114,103, 98, 40,118, diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c index 234c8837b35..dcbd6df7ced 100644 --- a/source/blender/imbuf/intern/thumbs.c +++ b/source/blender/imbuf/intern/thumbs.c @@ -243,12 +243,12 @@ void IMB_thumb_makedirs() /* create thumbnail for file and returns new imbuf for thumbnail */ ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, ImBuf *img) { - char uri[URI_MAX]; + char uri[URI_MAX]= ""; char desc[URI_MAX+22]; char tpath[FILE_MAX]; char tdir[FILE_MAX]; char temp[FILE_MAX]; - char mtime[40]; + char mtime[40]= "0"; /* incase we can't stat the file */ char cwidth[40]; char cheight[40]; char thumb[40]; diff --git a/source/blender/imbuf/intern/tiff.c b/source/blender/imbuf/intern/tiff.c index 99f74fea640..6b94583f17d 100644 --- a/source/blender/imbuf/intern/tiff.c +++ b/source/blender/imbuf/intern/tiff.c @@ -301,17 +301,6 @@ int imb_is_a_tiff(unsigned char *mem) (memcmp(lil_endian, mem, IMB_TIFF_NCB) == 0) ); } -static void scanline_contig_8bit(unsigned char *rect, unsigned char *cbuf, int scanline_w, int spp) -{ - int i; - for (i=0; i < scanline_w; i++) { - rect[i*4 + 0] = cbuf[i*spp + 0]; - rect[i*4 + 1] = cbuf[i*spp + 1]; - rect[i*4 + 2] = cbuf[i*spp + 2]; - rect[i*4 + 3] = (spp==4)?cbuf[i*spp + 3]:255; - } -} - static void scanline_contig_16bit(float *rectf, unsigned short *sbuf, int scanline_w, int spp) { int i; @@ -334,13 +323,6 @@ static void scanline_contig_32bit(float *rectf, float *fbuf, int scanline_w, int } } -static void scanline_separate_8bit(unsigned char *rect, unsigned char *cbuf, int scanline_w, int chan) -{ - int i; - for (i=0; i < scanline_w; i++) - rect[i*4 + chan] = cbuf[i]; -} - static void scanline_separate_16bit(float *rectf, unsigned short *sbuf, int scanline_w, int chan) { int i; @@ -356,40 +338,6 @@ static void scanline_separate_32bit(float *rectf, float *fbuf, int scanline_w, i } -#if 0 -/* - * Use the libTIFF RGBAImage API to read a TIFF image. - * This function uses the "RGBA Image" support from libtiff, which enables - * it to load most commonly-encountered TIFF formats. libtiff handles format - * conversion, color depth conversion, etc. - */ -static int imb_read_tiff_pixels_rgba(ImBuf *ibuf, TIFF *image, int premul) -{ - ImBuf *tmpibuf; - int success; - - tmpibuf= IMB_allocImBuf(ibuf->x, ibuf->y, 32, IB_rect, 0); - success= TIFFReadRGBAImage(image, ibuf->x, ibuf->y, tmpibuf->rect, 0); - - if(ENDIAN_ORDER == B_ENDIAN) - IMB_convert_rgba_to_abgr(tmpibuf); - if(premul) { - IMB_premultiply_alpha(tmpibuf); - ibuf->flags |= IB_premul; - } - - /* assign rect last */ - ibuf->rect= tmpibuf->rect; - ibuf->mall |= IB_rect; - ibuf->flags |= IB_rect; - - tmpibuf->mall &= ~IB_rect; - IMB_freeImBuf(tmpibuf); - - return success; -} -#endif - /* * Use the libTIFF scanline API to read a TIFF image. * This method is most flexible and can handle multiple different bit depths @@ -398,13 +346,12 @@ static int imb_read_tiff_pixels_rgba(ImBuf *ibuf, TIFF *image, int premul) static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul) { ImBuf *tmpibuf; - int success; + int success= 0; short bitspersample, spp, config; size_t scanline; int ib_flag=0, row, chan; float *fbuf=NULL; unsigned short *sbuf=NULL; - unsigned char *cbuf=NULL; TIFFGetField(image, TIFFTAG_BITSPERSAMPLE, &bitspersample); TIFFGetField(image, TIFFTAG_SAMPLESPERPIXEL, &spp); /* number of 'channels' */ @@ -417,30 +364,28 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul) } else if (bitspersample == 16) { ib_flag = IB_rectfloat; sbuf = (unsigned short *)_TIFFmalloc(scanline); - } else if (bitspersample == 8) { + } else { ib_flag = IB_rect; - cbuf = (unsigned char *)_TIFFmalloc(scanline); } tmpibuf= IMB_allocImBuf(ibuf->x, ibuf->y, ibuf->depth, ib_flag, 0); + /* simple RGBA image */ + if (!(bitspersample == 32 || bitspersample == 16)) { + success |= TIFFReadRGBAImage(image, ibuf->x, ibuf->y, tmpibuf->rect, 0); + } /* contiguous channels: RGBRGBRGB */ - if (config == PLANARCONFIG_CONTIG) { + else if (config == PLANARCONFIG_CONTIG) { for (row = 0; row < ibuf->y; row++) { int ib_offset = ibuf->x*ibuf->y*4 - ibuf->x*4 * (row+1); if (bitspersample == 32) { - success = TIFFReadScanline(image, fbuf, row, 0); + success |= TIFFReadScanline(image, fbuf, row, 0); scanline_contig_32bit(tmpibuf->rect_float+ib_offset, fbuf, ibuf->x, spp); } else if (bitspersample == 16) { - success = TIFFReadScanline(image, sbuf, row, 0); + success |= TIFFReadScanline(image, sbuf, row, 0); scanline_contig_16bit(tmpibuf->rect_float+ib_offset, sbuf, ibuf->x, spp); - - } else if (bitspersample == 8) { - unsigned char *crect = (unsigned char*)tmpibuf->rect; - success = TIFFReadScanline(image, cbuf, row, 0); - scanline_contig_8bit(crect+ib_offset, cbuf, ibuf->x, spp); } } /* separate channels: RRRGGGBBB */ @@ -456,53 +401,47 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul) if (chan == 3 && spp == 3) /* fill alpha if only RGB TIFF */ memset(fbuf, 1.0, sizeof(fbuf)); else - success = TIFFReadScanline(image, fbuf, row, chan); + success |= TIFFReadScanline(image, fbuf, row, chan); scanline_separate_32bit(tmpibuf->rect_float+ib_offset, fbuf, ibuf->x, chan); } else if (bitspersample == 16) { if (chan == 3 && spp == 3) /* fill alpha if only RGB TIFF */ memset(sbuf, 65535, sizeof(sbuf)); else - success = TIFFReadScanline(image, sbuf, row, chan); + success |= TIFFReadScanline(image, sbuf, row, chan); scanline_separate_16bit(tmpibuf->rect_float+ib_offset, sbuf, ibuf->x, chan); - } else if (bitspersample == 8) { - unsigned char *crect = (unsigned char*)tmpibuf->rect; - if (chan == 3 && spp == 3) /* fill alpha if only RGB TIFF */ - memset(cbuf, 255, sizeof(cbuf)); - else - success = TIFFReadScanline(image, cbuf, row, chan); - scanline_separate_8bit(crect+ib_offset, cbuf, ibuf->x, chan); } } } } - ibuf->profile = (bitspersample==32)?IB_PROFILE_LINEAR_RGB:IB_PROFILE_SRGB; - if (bitspersample == 32) _TIFFfree(fbuf); else if (bitspersample == 16) _TIFFfree(sbuf); - else if (bitspersample == 8) - _TIFFfree(cbuf); + + if(success) { + ibuf->profile = (bitspersample==32)?IB_PROFILE_LINEAR_RGB:IB_PROFILE_SRGB; + + if(ENDIAN_ORDER == B_ENDIAN) + IMB_convert_rgba_to_abgr(tmpibuf); + if(premul) { + IMB_premultiply_alpha(tmpibuf); + ibuf->flags |= IB_premul; + } - if(ENDIAN_ORDER == B_ENDIAN) - IMB_convert_rgba_to_abgr(tmpibuf); - if(premul) { - IMB_premultiply_alpha(tmpibuf); - ibuf->flags |= IB_premul; + /* assign rect last */ + if (tmpibuf->rect_float) + ibuf->rect_float= tmpibuf->rect_float; + else + ibuf->rect= tmpibuf->rect; + ibuf->mall |= ib_flag; + ibuf->flags |= ib_flag; + + tmpibuf->mall &= ~ib_flag; } - - /* assign rect last */ - if (tmpibuf->rect_float) - ibuf->rect_float= tmpibuf->rect_float; - else - ibuf->rect= tmpibuf->rect; - ibuf->mall |= ib_flag; - ibuf->flags |= ib_flag; - - tmpibuf->mall &= ~ib_flag; + IMB_freeImBuf(tmpibuf); return success; @@ -847,4 +786,4 @@ int imb_savetiff(ImBuf *ibuf, char *name, int flags) return (1); } -#endif /* WITH_TIFF */
\ No newline at end of file +#endif /* WITH_TIFF */ diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h index c13cb08badd..283c810a1f6 100644 --- a/source/blender/makesdna/DNA_curve_types.h +++ b/source/blender/makesdna/DNA_curve_types.h @@ -245,7 +245,7 @@ typedef struct Curve { #define CU_PATH 8 #define CU_FOLLOW 16 #define CU_UV_ORCO 32 -#define CU_NOPUNOFLIP 64 +#define CU_DEPRECATED 64 #define CU_STRETCH 128 #define CU_OFFS_PATHDIST 256 #define CU_FAST 512 /* Font: no filling inside editmode */ diff --git a/source/blender/makesdna/DNA_image_types.h b/source/blender/makesdna/DNA_image_types.h index 1695ceb73a5..d1aa3c00ac4 100644 --- a/source/blender/makesdna/DNA_image_types.h +++ b/source/blender/makesdna/DNA_image_types.h @@ -105,7 +105,7 @@ typedef struct Image { /* **************** IMAGE ********************* */ -/* flag */ +/* Image.flag */ #define IMA_FIELDS 1 #define IMA_STD_FIELD 2 #define IMA_DO_PREMUL 4 @@ -115,7 +115,7 @@ typedef struct Image { #define IMA_DEPRECATED 64 #define IMA_OLD_PREMUL 128 -/* tpageflag */ +/* Image.tpageflag */ #define IMA_TILES 1 #define IMA_TWINANIM 2 #define IMA_COLCYCLE 4 /* Depreciated */ diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h index 68b05dd6595..4e41309cff4 100644 --- a/source/blender/makesdna/DNA_mesh_types.h +++ b/source/blender/makesdna/DNA_mesh_types.h @@ -129,7 +129,7 @@ typedef struct TFace { /* me->flag */ /* #define ME_ISDONE 1 */ -#define ME_NOPUNOFLIP 2 +#define ME_DEPRECATED 2 #define ME_TWOSIDED 4 #define ME_UVEFFECT 8 #define ME_VCOLEFFECT 16 diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index 872d69f3148..e3ac90bf881 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -314,6 +314,7 @@ typedef struct NodeColorBalance { /* temp storage for inverted lift */ float lift_lgg[3]; + float gamma_inv[3]; } NodeColorBalance; typedef struct NodeColorspill { diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index cf1ec0131f0..d58bc3aa9bc 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -729,11 +729,13 @@ typedef struct ToolSettings { /* Transform */ short snap_mode, snap_flag, snap_target; short proportional, prop_mode; + char proportional_objects; /* proportional edit, object mode */ + char pad[3]; - int auto_normalize, intpad; /*auto normalizing mode in wpaint*/ + int auto_normalize; /*auto normalizing mode in wpaint*/ short sculpt_paint_settings; /* user preferences for sculpt and paint */ - short pad; + short pad1; int sculpt_paint_unified_size; /* unified radius of brush in pixels */ float sculpt_paint_unified_unprojected_radius;/* unified radius of brush in Blender units */ float sculpt_paint_unified_alpha; /* unified strength of brush */ diff --git a/source/blender/makesrna/intern/rna_boid.c b/source/blender/makesrna/intern/rna_boid.c index 7e52032687c..c4ed00794b0 100644 --- a/source/blender/makesrna/intern/rna_boid.c +++ b/source/blender/makesrna/intern/rna_boid.c @@ -97,7 +97,7 @@ static void rna_Boids_reset_deps(Main *bmain, Scene *scene, PointerRNA *ptr) else DAG_id_flush_update(ptr->id.data, OB_RECALC_DATA|PSYS_RECALC_RESET); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); WM_main_add_notifier(NC_OBJECT|ND_PARTICLE|NA_EDITED, NULL); } diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index 9e004cd5946..f33ca10f934 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -42,6 +42,7 @@ #include "BKE_colortools.h" #include "BKE_depsgraph.h" #include "BKE_node.h" +#include "BKE_texture.h" #include "WM_api.h" #include "WM_types.h" @@ -270,6 +271,29 @@ static void rna_ColorRamp_update(Main *bmain, Scene *scene, PointerRNA *ptr) } } +static void rna_ColorRamp_eval(struct ColorBand *coba, float position, float color[4]) +{ + do_colorband(coba, position, color); +} + +static CBData *rna_ColorRampElement_new(struct ColorBand *coba, ReportList *reports, float position) +{ + CBData *element= colorband_element_add(coba, position); + + if(element==NULL) + BKE_reportf(reports, RPT_ERROR, "Unable to add element to colorband (limit %d)", MAXCOLORBAND); + + return element; +} + +static void rna_ColorRampElement_remove(struct ColorBand *coba, ReportList *reports, CBData *element) +{ + int index = (int)(element - coba->data); + if(colorband_element_remove(coba, index) == 0) + BKE_report(reports, RPT_ERROR, "Element not found in element collection or last element"); + +} + static void rna_Scopes_update(Main *bmain, Scene *scene, PointerRNA *ptr) { Scopes *s= (Scopes*)ptr->data; @@ -396,7 +420,7 @@ static void rna_def_color_ramp_element(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - + srna= RNA_def_struct(brna, "ColorRampElement", NULL); RNA_def_struct_sdna(srna, "CBData"); RNA_def_struct_path_func(srna, "rna_ColorRampElement_path"); @@ -415,11 +439,42 @@ static void rna_def_color_ramp_element(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_ColorRamp_update"); } +static void rna_def_color_ramp_element_api(BlenderRNA *brna, PropertyRNA *cprop) +{ + StructRNA *srna; + PropertyRNA *parm; + FunctionRNA *func; + + RNA_def_property_srna(cprop, "ColorRampElements"); + srna= RNA_def_struct(brna, "ColorRampElements", NULL); + RNA_def_struct_sdna(srna, "ColorBand"); + RNA_def_struct_path_func(srna, "rna_ColorRampElement_path"); + RNA_def_struct_ui_text(srna, "Color Ramp Elements", "Collection of Color Ramp Elements"); + + /* TODO, make these functions generic in texture.c */ + func = RNA_def_function(srna, "new", "rna_ColorRampElement_new"); + RNA_def_function_ui_description(func, "Add element to ColorRamp"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + parm= RNA_def_float(func, "position", 0.0f, 0.0f, 1.0f, "Position", "Position to add element", 0.0f, 1.0f); + RNA_def_property_flag(parm, PROP_REQUIRED); + /* return type */ + parm= RNA_def_pointer(func, "element", "ColorRampElement", "", "New element."); + RNA_def_function_return(func, parm); + + func = RNA_def_function(srna, "remove", "rna_ColorRampElement_remove"); + RNA_def_function_ui_description(func, "Delete element from ColorRamp"); + RNA_def_function_flag(func, FUNC_USE_REPORTS); + //parm= RNA_def_int(func, "index", 0, 0, 31, "Index", "Element to delete.", 0, 31); + parm= RNA_def_pointer(func, "element", "ColorRampElement", "", "Element to remove."); + RNA_def_property_flag(parm, PROP_REQUIRED); +} + static void rna_def_color_ramp(BlenderRNA *brna) { StructRNA *srna; PropertyRNA *prop; - + FunctionRNA *func; + static EnumPropertyItem prop_interpolation_items[] = { {1, "EASE", 0, "Ease", ""}, {3, "CARDINAL", 0, "Cardinal", ""}, @@ -438,12 +493,30 @@ static void rna_def_color_ramp(BlenderRNA *brna) RNA_def_property_struct_type(prop, "ColorRampElement"); RNA_def_property_ui_text(prop, "Elements", ""); RNA_def_property_update(prop, 0, "rna_ColorRamp_update"); - + rna_def_color_ramp_element_api(brna, prop); + prop= RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "ipotype"); RNA_def_property_enum_items(prop, prop_interpolation_items); RNA_def_property_ui_text(prop, "Interpolation", ""); RNA_def_property_update(prop, 0, "rna_ColorRamp_update"); + + prop= RNA_def_property(srna, "total", PROP_INT, PROP_NONE); + RNA_def_property_int_sdna(prop, NULL, "tot"); + /* needs a function to do the right thing when adding elements like colorband_add_cb() */ + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_range(prop, 0, 31); /* MAXCOLORBAND = 32 */ + RNA_def_property_ui_text(prop, "Total", "Total number of elements"); + RNA_def_property_update(prop, 0, "rna_ColorRamp_update"); + + func = RNA_def_function(srna, "evaluate", "rna_ColorRamp_eval"); + RNA_def_function_ui_description(func, "Evaluate ColorRamp"); + prop= RNA_def_float(func, "position", 1.0f, 0.0f, 1.0f, "Position", "Evaluate ColorRamp at position", 0.0f, 1.0f); + RNA_def_property_flag(prop, PROP_REQUIRED); + /* return */ + prop = RNA_def_float_color(func, "color", 4, NULL, -FLT_MAX, FLT_MAX, "Color", "Color at given position", -FLT_MAX, FLT_MAX); + RNA_def_property_flag(prop, PROP_THICK_WRAP); + RNA_def_function_output(func, prop); } static void rna_def_histogram(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index 1c6c35a88de..05bddfa7a32 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -214,7 +214,7 @@ static void rna_Constraint_update(Main *bmain, Scene *scene, PointerRNA *ptr) static void rna_Constraint_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - ED_object_constraint_dependency_update(scene, ptr->id.data); + ED_object_constraint_dependency_update(bmain, scene, ptr->id.data); } static void rna_Constraint_influence_update(Main *bmain, Scene *scene, PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 84807446f50..335f5919004 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -254,7 +254,7 @@ static void rna_Curve_update_data(Main *bmain, Scene *scene, PointerRNA *ptr) static void rna_Curve_update_deps(Main *bmain, Scene *scene, PointerRNA *ptr) { - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); rna_Curve_update_data(bmain, scene, ptr); } @@ -510,6 +510,18 @@ static void rna_Curve_active_spline_set(PointerRNA *ptr, PointerRNA value) cu->actnu= BLI_findindex(nubase, nu); } +static char *rna_TextBox_path(PointerRNA *ptr) +{ + Curve *cu= (Curve*)ptr->id.data; + TextBox *tb= ptr->data; + int index= (int)(tb - cu->tb); + + if (index >= 0 && index < cu->totbox) + return BLI_sprintfN("textboxes[%d]", index); + else + return BLI_strdup(""); +} + #else static void rna_def_bpoint(BlenderRNA *brna) @@ -694,11 +706,6 @@ static void rna_def_nurbs(BlenderRNA *brna, StructRNA *srna) RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_UV_ORCO); RNA_def_property_ui_text(prop, "Map Along Length", "Generate texture mapping coordinates following the curve direction, rather than the local bounding box"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); - - prop= RNA_def_property(srna, "vertex_normal_flip", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CU_NOPUNOFLIP); - RNA_def_property_ui_text(prop, "Vertex Normal Flip", "Flip vertex normals towards the camera during render"); - RNA_def_property_update(prop, 0, "rna_Curve_update_data"); } static void rna_def_font(BlenderRNA *brna, StructRNA *srna) @@ -841,7 +848,6 @@ static void rna_def_textbox(BlenderRNA *brna) srna= RNA_def_struct(brna, "TextBox", NULL); RNA_def_struct_ui_text(srna, "Text Box", "Text bounding box for layout"); - // XXX: still needs path function /* number values */ prop= RNA_def_property(srna, "x", PROP_FLOAT, PROP_NONE); @@ -867,6 +873,8 @@ static void rna_def_textbox(BlenderRNA *brna) RNA_def_property_range(prop, 0.0f, 50.0f); RNA_def_property_ui_text(prop, "Textbox Height", ""); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); + + RNA_def_struct_path_func(srna, "rna_TextBox_path"); } static void rna_def_charinfo(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index cd58b6574be..09f531cf95d 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -110,7 +110,7 @@ static void rna_ChannelDriver_update_data(Main *bmain, Scene *scene, PointerRNA driver->flag &= ~DRIVER_FLAG_INVALID; // TODO: this really needs an update guard... - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); DAG_id_flush_update(id, OB_RECALC_OB|OB_RECALC_DATA); WM_main_add_notifier(NC_SCENE|ND_FRAME, scene); diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index 289530d4f32..efe3d39d6cd 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -153,10 +153,12 @@ static int rna_Image_gl_load(Image *image, ReportList *reports, int filter, int error = (int)gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, ibuf->x, ibuf->y, GL_RGBA, GL_UNSIGNED_INT, ibuf->rect); if (!error) { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, image->tpageflag & IMA_CLAMP_U ? GL_CLAMP : GL_REPEAT); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, image->tpageflag & IMA_CLAMP_V ? GL_CLAMP : GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (GLint)filter); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (GLint)mag); glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, ibuf->x, ibuf->y, 0, GL_RGBA, GL_UNSIGNED_INT, ibuf->rect); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, ibuf->x, ibuf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); error = (int)glGetError(); } diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 6e172e3bdd0..37d6b2b93de 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1748,10 +1748,6 @@ static void rna_def_mesh(BlenderRNA *brna) RNA_def_property_range(prop, 1, 80); RNA_def_property_ui_text(prop, "Auto Smooth Angle", "Defines maximum angle between face normals that 'Auto Smooth' will operate on"); - prop= RNA_def_property(srna, "vertex_normal_flip", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ME_NOPUNOFLIP); - RNA_def_property_ui_text(prop, "Vertex Normal Flip", "Flip vertex normals towards the camera during render"); - prop= RNA_def_property(srna, "double_sided", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_TWOSIDED); RNA_def_property_ui_text(prop, "Double Sided", "Render/display the mesh with double or single sided lighting"); diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index f4398b99beb..fa5d703a84f 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -214,7 +214,7 @@ static void rna_Modifier_update(Main *bmain, Scene *scene, PointerRNA *ptr) static void rna_Modifier_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) { rna_Modifier_update(bmain, scene, ptr); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } static void rna_Smoke_set_type(Main *bmain, Scene *scene, PointerRNA *ptr) @@ -234,7 +234,7 @@ static void rna_Smoke_set_type(Main *bmain, Scene *scene, PointerRNA *ptr) switch (smd->type) { case MOD_SMOKE_TYPE_DOMAIN: - ob->dt = OB_BOUNDBOX; + ob->dt = OB_WIRE; break; case MOD_SMOKE_TYPE_FLOW: for(psys=ob->particlesystem.first; psys; psys=psys->next) @@ -242,7 +242,7 @@ static void rna_Smoke_set_type(Main *bmain, Scene *scene, PointerRNA *ptr) break; if(ob->type == OB_MESH && !psys) { /* add particle system */ - psmd = object_add_particle_system(scene, ob, NULL); + psmd = (ParticleSystemModifierData *)object_add_particle_system(scene, ob, NULL); if(psmd) { psys = psmd->psys; diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 4576a754f96..29666c6ed04 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -196,7 +196,7 @@ void rna_Object_active_shape_update(Main *bmain, Scene *scene, PointerRNA *ptr) static void rna_Object_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) { DAG_id_flush_update(ptr->id.data, OB_RECALC_OB); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } /* when changing the selection flag the scene needs updating */ @@ -214,7 +214,7 @@ static void rna_Base_select_update(Main *bmain, Scene *scene, PointerRNA *ptr) ED_base_object_select(base, mode); } -static void rna_Object_layer_update__internal(Scene *scene, Base *base, Object *ob) +static void rna_Object_layer_update__internal(Main *bmain, Scene *scene, Base *base, Object *ob) { /* try to avoid scene sort */ if((ob->lay & scene->lay) && (base->lay & scene->lay)) { @@ -222,7 +222,7 @@ static void rna_Object_layer_update__internal(Scene *scene, Base *base, Object * } else if((ob->lay & scene->lay)==0 && (base->lay & scene->lay)==0) { /* pass */ } else { - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } } @@ -237,7 +237,7 @@ static void rna_Object_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr) SWAP(int, base->lay, ob->lay); - rna_Object_layer_update__internal(scene, base, ob); + rna_Object_layer_update__internal(bmain, scene, base, ob); ob->lay= base->lay; } @@ -246,7 +246,7 @@ static void rna_Base_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr) Base *base= (Base*)ptr->data; Object *ob= (Object*)base->object; - rna_Object_layer_update__internal(scene, base, ob); + rna_Object_layer_update__internal(bmain, scene, base, ob); ob->lay= base->lay; } @@ -1031,12 +1031,12 @@ static int rna_Object_constraint_remove(Object *object, int index) static ModifierData *rna_Object_modifier_new(Object *object, bContext *C, ReportList *reports, char *name, int type) { - return ED_object_modifier_add(reports, CTX_data_scene(C), object, name, type); + return ED_object_modifier_add(reports, CTX_data_main(C), CTX_data_scene(C), object, name, type); } static void rna_Object_modifier_remove(Object *object, bContext *C, ReportList *reports, ModifierData *md) { - ED_object_modifier_remove(reports, CTX_data_scene(C), object, md); + ED_object_modifier_remove(reports, CTX_data_main(C), CTX_data_scene(C), object, md); } static void rna_Object_boundbox_get(PointerRNA *ptr, float *values) diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index d253201fbc1..a3a1186eedc 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -510,11 +510,11 @@ static void rna_FieldSettings_shape_update(Main *bmain, Scene *scene, PointerRNA if(!md) { if(pd && (pd->shape == PFIELD_SHAPE_SURFACE) && ELEM(pd->forcefield,PFIELD_GUIDE,PFIELD_TEXTURE)==0) if(ELEM4(ob->type, OB_MESH, OB_SURF, OB_FONT, OB_CURVE)) - ED_object_modifier_add(NULL, scene, ob, NULL, eModifierType_Surface); + ED_object_modifier_add(NULL, bmain, scene, ob, NULL, eModifierType_Surface); } else { if(!pd || pd->shape != PFIELD_SHAPE_SURFACE) - ED_object_modifier_remove(NULL, scene, ob, md); + ED_object_modifier_remove(NULL, bmain, scene, ob, md); } WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob); @@ -538,7 +538,7 @@ static void rna_FieldSettings_dependency_update(Main *bmain, Scene *scene, Point rna_FieldSettings_shape_update(bmain, scene, ptr); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); if(ob->type == OB_CURVE && ob->pd->forcefield == PFIELD_GUIDE) DAG_id_flush_update(&ob->id, OB_RECALC_ALL); @@ -582,7 +582,7 @@ static void rna_EffectorWeight_update(Main *bmain, Scene *scene, PointerRNA *ptr static void rna_EffectorWeight_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) { - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); DAG_id_flush_update((ID*)ptr->id.data, OB_RECALC_DATA|PSYS_RECALC_RESET); @@ -640,9 +640,9 @@ static void rna_CollisionSettings_dependency_update(Main *bmain, Scene *scene, P /* add/remove modifier as needed */ if(ob->pd->deflect && !md) - ED_object_modifier_add(NULL, scene, ob, NULL, eModifierType_Collision); + ED_object_modifier_add(NULL, bmain, scene, ob, NULL, eModifierType_Collision); else if(!ob->pd->deflect && md) - ED_object_modifier_remove(NULL, scene, ob, md); + ED_object_modifier_remove(NULL, bmain, scene, ob, md); WM_main_add_notifier(NC_OBJECT|ND_DRAW, ob); } diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 74bc564064e..4baf81a9427 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -214,7 +214,7 @@ static void rna_Particle_redo(Main *bmain, Scene *scene, PointerRNA *ptr) static void rna_Particle_redo_dependency(Main *bmain, Scene *scene, PointerRNA *ptr) { - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); rna_Particle_redo(bmain, scene, ptr); } @@ -266,7 +266,7 @@ static void rna_Particle_target_reset(Main *bmain, Scene *scene, PointerRNA *ptr psys->recalc = PSYS_RECALC_RESET; DAG_id_flush_update(&ob->id, OB_RECALC_DATA); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } WM_main_add_notifier(NC_OBJECT|ND_PARTICLE|NA_EDITED, NULL); diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index 21ece0ac4a9..d05a3d341ba 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -151,7 +151,7 @@ static void rna_Pose_ik_solver_update(Main *bmain, Scene *scene, PointerRNA *ptr bPose *pose = ptr->data; pose->flag |= POSE_RECALC; // checks & sorts pose channels - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); update_pose_constraint_flags(pose); diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 289d4864e96..5aab403e71a 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -206,7 +206,7 @@ static Base *rna_Scene_object_link(Scene *scene, bContext *C, ReportList *report ob->recalc |= OB_RECALC_ALL; - DAG_scene_sort(scene); + DAG_scene_sort(G.main, scene); return base; } @@ -232,8 +232,8 @@ static void rna_Scene_object_unlink(Scene *scene, ReportList *reports, Object *o ob->id.us--; /* needed otherwise the depgraph will contain free'd objects which can crash, see [#20958] */ - DAG_scene_sort(scene); - DAG_ids_flush_update(0); + DAG_scene_sort(G.main, scene); + DAG_ids_flush_update(G.main, 0); WM_main_add_notifier(NC_SCENE|ND_OB_ACTIVE, scene); } @@ -682,6 +682,13 @@ static int rna_RenderSettings_engine_get(PointerRNA *ptr) return 0; } +static void rna_Scene_glsl_update(Main *bmain, Scene *unused, PointerRNA *ptr) +{ + Scene *scene= (Scene*)ptr->id.data; + + DAG_id_flush_update(&scene->id, 0); +} + static void rna_RenderSettings_color_management_update(Main *bmain, Scene *unused, PointerRNA *ptr) { /* reset image nodes */ @@ -700,6 +707,8 @@ static void rna_RenderSettings_color_management_update(Main *bmain, Scene *unuse } } } + + rna_Scene_glsl_update(bmain, unused, ptr); } static void rna_SceneRenderLayer_name_set(PointerRNA *ptr, const char *value) @@ -832,7 +841,7 @@ static void rna_Scene_use_simplify_update(Main *bmain, Scene *scene, PointerRNA for(SETLOOPER(scene, base)) object_simplify_update(base->object); - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); WM_main_add_notifier(NC_GEOM|ND_DATA, NULL); } @@ -1046,6 +1055,12 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Proportional Editing", "Proportional editing mode"); RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */ + prop= RNA_def_property(srna, "proportional_editing_objects", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "proportional_objects", 0); + RNA_def_property_ui_text(prop, "Proportional Editing Objects", "Proportional editing object mode"); + RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1); + RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */ + prop= RNA_def_property(srna, "proportional_editing_falloff", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "prop_mode"); RNA_def_property_enum_items(prop, proportional_falloff_items); @@ -2026,32 +2041,32 @@ static void rna_def_scene_game_data(BlenderRNA *brna) prop= RNA_def_property(srna, "glsl_lights", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_LIGHTS); RNA_def_property_ui_text(prop, "GLSL Lights", "Use lights for GLSL rendering"); - RNA_def_property_update(prop, NC_SCENE|NA_EDITED, NULL); + RNA_def_property_update(prop, NC_SCENE|NA_EDITED, "rna_Scene_glsl_update"); prop= RNA_def_property(srna, "glsl_shaders", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_SHADERS); RNA_def_property_ui_text(prop, "GLSL Shaders", "Use shaders for GLSL rendering"); - RNA_def_property_update(prop, NC_SCENE|NA_EDITED, NULL); + RNA_def_property_update(prop, NC_SCENE|NA_EDITED, "rna_Scene_glsl_update"); prop= RNA_def_property(srna, "glsl_shadows", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_SHADOWS); RNA_def_property_ui_text(prop, "GLSL Shadows", "Use shadows for GLSL rendering"); - RNA_def_property_update(prop, NC_SCENE|NA_EDITED, NULL); + RNA_def_property_update(prop, NC_SCENE|NA_EDITED, "rna_Scene_glsl_update"); prop= RNA_def_property(srna, "glsl_ramps", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_RAMPS); RNA_def_property_ui_text(prop, "GLSL Ramps", "Use ramps for GLSL rendering"); - RNA_def_property_update(prop, NC_SCENE|NA_EDITED, NULL); + RNA_def_property_update(prop, NC_SCENE|NA_EDITED, "rna_Scene_glsl_update"); prop= RNA_def_property(srna, "glsl_nodes", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_NODES); RNA_def_property_ui_text(prop, "GLSL Nodes", "Use nodes for GLSL rendering"); - RNA_def_property_update(prop, NC_SCENE|NA_EDITED, NULL); + RNA_def_property_update(prop, NC_SCENE|NA_EDITED, "rna_Scene_glsl_update"); prop= RNA_def_property(srna, "glsl_extra_textures", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_GLSL_NO_EXTRA_TEX); RNA_def_property_ui_text(prop, "GLSL Extra Textures", "Use extra textures like normal or specular maps for GLSL rendering"); - RNA_def_property_update(prop, NC_SCENE|NA_EDITED, NULL); + RNA_def_property_update(prop, NC_SCENE|NA_EDITED, "rna_Scene_glsl_update"); } static void rna_def_scene_render_layer(BlenderRNA *brna) diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index eb48fb6c237..c3b60514d2a 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -39,9 +39,10 @@ #ifdef RNA_RUNTIME #include "BKE_animsys.h" -#include "BKE_scene.h" -#include "BKE_image.h" #include "BKE_depsgraph.h" +#include "BKE_global.h" +#include "BKE_image.h" +#include "BKE_scene.h" #include "BKE_writeavi.h" @@ -50,11 +51,16 @@ static void rna_Scene_set_frame(Scene *scene, int frame) { scene->r.cfra= frame; CLAMP(scene->r.cfra, MINAFRAME, MAXFRAME); - scene_update_for_newframe(scene, (1<<20) - 1); + scene_update_for_newframe(G.main, scene, (1<<20) - 1); WM_main_add_notifier(NC_SCENE|ND_FRAME, scene); } +static void rna_Scene_update_tagged(Scene *scene) +{ + scene_update_tagged(G.main, scene); +} + static KeyingSet *rna_Scene_add_keying_set(Scene *sce, ReportList *reports, char name[], int absolute, int insertkey_needed, int insertkey_visual) { @@ -102,7 +108,7 @@ void RNA_api_scene(StructRNA *srna) parm= RNA_def_int(func, "frame", 0, MINAFRAME, MAXFRAME, "", "Frame number to set.", MINAFRAME, MAXFRAME); RNA_def_property_flag(parm, PROP_REQUIRED); - func= RNA_def_function(srna, "update", "scene_update_tagged"); + func= RNA_def_function(srna, "update", "rna_Scene_update_tagged"); RNA_def_function_ui_description(func, "Update data tagged to be updated from previous access to data or operators."); /* Add Keying Set */ diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c index cd2297cc273..f921595304d 100644 --- a/source/blender/makesrna/intern/rna_smoke.c +++ b/source/blender/makesrna/intern/rna_smoke.c @@ -55,7 +55,7 @@ static void rna_Smoke_update(Main *bmain, Scene *scene, PointerRNA *ptr) static void rna_Smoke_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) { rna_Smoke_update(bmain, scene, ptr); - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } static void rna_Smoke_reset(Main *bmain, Scene *scene, PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 227466f808d..8bb736f7976 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -310,22 +310,32 @@ static PointerRNA rna_SpaceView3D_region_3d_get(PointerRNA *ptr) { View3D *v3d= (View3D*)(ptr->data); ScrArea *sa= rna_area_from_space(ptr); - ListBase *regionbase= (sa->spacedata.first == v3d)? &sa->regionbase: &v3d->regionbase; - ARegion *ar= regionbase->last; /* always last in list, weak .. */ + void *regiondata= NULL; + if(sa) { + ListBase *regionbase= (sa->spacedata.first == v3d)? &sa->regionbase: &v3d->regionbase; + ARegion *ar= regionbase->last; /* always last in list, weak .. */ + regiondata= ar->regiondata; + } - return rna_pointer_inherit_refine(ptr, &RNA_RegionView3D, ar->regiondata); + return rna_pointer_inherit_refine(ptr, &RNA_RegionView3D, regiondata); } static PointerRNA rna_SpaceView3D_region_quadview_get(PointerRNA *ptr) { View3D *v3d= (View3D*)(ptr->data); ScrArea *sa= rna_area_from_space(ptr); - ListBase *regionbase= (sa->spacedata.first == v3d)? &sa->regionbase: &v3d->regionbase; - ARegion *ar= regionbase->last; /* always before last in list, weak .. */ - - ar= (ar->alignment == RGN_ALIGN_QSPLIT)? ar->prev: NULL; + void *regiondata= NULL; + if(sa) { + ListBase *regionbase= (sa->spacedata.first == v3d)? &sa->regionbase: &v3d->regionbase; + ARegion *ar= regionbase->last; /* always before last in list, weak .. */ + + ar= (ar->alignment == RGN_ALIGN_QSPLIT)? ar->prev: NULL; + if(ar) { + regiondata= ar->regiondata; + } + } - return rna_pointer_inherit_refine(ptr, &RNA_RegionView3D, (ar)? ar->regiondata: NULL); + return rna_pointer_inherit_refine(ptr, &RNA_RegionView3D, regiondata); } static void rna_RegionView3D_quadview_update(Main *main, Scene *scene, PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 1797df2abf0..84053c0a181 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -980,7 +980,6 @@ static void rna_def_operator(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_string_funcs(prop, "rna_Operator_name_get", "rna_Operator_name_length", NULL); RNA_def_property_ui_text(prop, "Name", ""); - RNA_def_struct_name_property(srna, prop); prop= RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); @@ -1001,6 +1000,7 @@ static void rna_def_operator(BlenderRNA *brna) RNA_def_property_string_sdna(prop, NULL, "type->idname"); RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME); /* else it uses the pointer size! */ RNA_def_property_flag(prop, PROP_REGISTER); + RNA_def_struct_name_property(srna, prop); prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->name"); @@ -1043,7 +1043,6 @@ static void rna_def_macro_operator(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_string_funcs(prop, "rna_Operator_name_get", "rna_Operator_name_length", NULL); RNA_def_property_ui_text(prop, "Name", ""); - RNA_def_struct_name_property(srna, prop); prop= RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE); RNA_def_property_flag(prop, PROP_NEVER_NULL); @@ -1056,6 +1055,7 @@ static void rna_def_macro_operator(BlenderRNA *brna) RNA_def_property_string_sdna(prop, NULL, "type->idname"); RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME); /* else it uses the pointer size! */ RNA_def_property_flag(prop, PROP_REGISTER); + RNA_def_struct_name_property(srna, prop); prop= RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "type->name"); diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index 9ae86ac4ec0..9f102fe6c21 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -126,7 +126,7 @@ static float meshdeform_dynamic_bind(MeshDeformModifierData *mmd, float (*dco)[3 float weight, cageweight, totweight, *cageco; int i, j, a, x, y, z, size; - co[0]= co[1]= co[2]= 0.0f; + zero_v3(co); totweight= 0.0f; size= mmd->dyngridsize; @@ -312,7 +312,7 @@ static void meshdeformModifier_do( } else { totweight= 0.0f; - co[0]= co[1]= co[2]= 0.0f; + zero_v3(co); for(a=offsets[b]; a<offsets[b+1]; a++) { weight= influences[a].weight; diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c b/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c index efd49172f95..43c6c6d791e 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_colorbalance.c @@ -54,15 +54,19 @@ DO_INLINE float colorbalance_cdl(float in, float offset, float power, float slop return powf(x, 1.f/power); } -/* note: lift_lgg is just 2-lift */ -DO_INLINE float colorbalance_lgg(float in, float lift_lgg, float gamma, float gain) -{ - float x= (((in - 1.0f) * lift_lgg) + 1.0f) * gain; +/* note: lift_lgg is just 2-lift, gamma_inv is 1.0/gamma */ +DO_INLINE float colorbalance_lgg(float in, float lift_lgg, float gamma_inv, float gain) +{ + /* 1:1 match with the sequencer with linear/srgb conversions, the conversion isnt pretty + * but best keep it this way, sice testing for durian shows a similar calculation + * without lin/srgb conversions gives bad results (over-saturated shadows) with colors + * slightly below 1.0. some correction can be done but it ends up looking bad for shadows or lighter tones - campbell */ + float x= (((linearrgb_to_srgb(in) - 1.0f) * lift_lgg) + 1.0f) * gain; /* prevent NaN */ if (x < 0.f) x = 0.f; - - return powf(x, (1.f/gamma)); + + return powf(srgb_to_linearrgb(x), gamma_inv); } static void do_colorbalance_cdl(bNode *node, float* out, float *in) @@ -90,9 +94,9 @@ static void do_colorbalance_lgg(bNode *node, float* out, float *in) { NodeColorBalance *n= (NodeColorBalance *)node->storage; - out[0] = colorbalance_lgg(in[0], n->lift_lgg[0], n->gamma[0], n->gain[0]); - out[1] = colorbalance_lgg(in[1], n->lift_lgg[1], n->gamma[1], n->gain[1]); - out[2] = colorbalance_lgg(in[2], n->lift_lgg[2], n->gamma[2], n->gain[2]); + out[0] = colorbalance_lgg(in[0], n->lift_lgg[0], n->gamma_inv[0], n->gain[0]); + out[1] = colorbalance_lgg(in[1], n->lift_lgg[1], n->gamma_inv[1], n->gain[1]); + out[2] = colorbalance_lgg(in[2], n->lift_lgg[2], n->gamma_inv[2], n->gain[2]); out[3] = in[3]; } @@ -101,9 +105,9 @@ static void do_colorbalance_lgg_fac(bNode *node, float* out, float *in, float *f NodeColorBalance *n= (NodeColorBalance *)node->storage; const float mfac= 1.0f - *fac; - out[0] = mfac*in[0] + *fac * colorbalance_lgg(in[0], n->lift_lgg[0], n->gamma[0], n->gain[0]); - out[1] = mfac*in[1] + *fac * colorbalance_lgg(in[1], n->lift_lgg[1], n->gamma[1], n->gain[1]); - out[2] = mfac*in[2] + *fac * colorbalance_lgg(in[2], n->lift_lgg[2], n->gamma[2], n->gain[2]); + out[0] = mfac*in[0] + *fac * colorbalance_lgg(in[0], n->lift_lgg[0], n->gamma_inv[0], n->gain[0]); + out[1] = mfac*in[1] + *fac * colorbalance_lgg(in[1], n->lift_lgg[1], n->gamma_inv[1], n->gain[1]); + out[2] = mfac*in[2] + *fac * colorbalance_lgg(in[2], n->lift_lgg[2], n->gamma_inv[2], n->gain[2]); out[3] = in[3]; } @@ -125,15 +129,9 @@ static void node_composit_exec_colorbalance(void *data, bNode *node, bNodeStack NodeColorBalance *n= (NodeColorBalance *)node->storage; int c; - copy_v3_v3(n->lift_lgg, n->lift); - for (c = 0; c < 3; c++) { - /* tweak to give more subtle results - * values above 1.0 are scaled */ - if(n->lift_lgg[c] > 1.0f) - n->lift_lgg[c] = pow(n->lift_lgg[c] - 1.0f, 2.0f) + 1.0f; - - n->lift_lgg[c] = 2.0f - n->lift_lgg[c]; + n->lift_lgg[c] = 2.0f - n->lift[c]; + n->gamma_inv[c] = (n->gamma[c] != 0.0f) ? 1.0f/n->gamma[c] : 1000000.0f; } } diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c b/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c index 95db66d92f7..9eb79bb8c36 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_huecorrect.c @@ -141,7 +141,7 @@ static void node_composit_init_huecorrect(bNode* node) for (c=0; c<3; c++) { CurveMap *cuma = &cumapping->cm[c]; - curvemap_reset(cuma, &cumapping->clipr, cumapping->preset); + curvemap_reset(cuma, &cumapping->clipr, cumapping->preset, CURVEMAP_SLOPE_POSITIVE); } /* default to showing Saturation */ diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index 5f2f37be062..d20f2a23664 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -148,25 +148,24 @@ void BPY_update_modules( void ) /***************************************************************************** * Description: This function creates a new Python dictionary object. +* note: dict is owned by sys.modules["__main__"] module, reference is borrowed +* note: important we use the dict from __main__, this is what python expects + for 'pickle' to work as well as strings like this... + >> foo = 10 + >> print(__import__("__main__").foo) *****************************************************************************/ -static PyObject *CreateGlobalDictionary( bContext *C, const char *filename ) +static PyObject *CreateGlobalDictionary(bContext *C, const char *filename) { - PyObject *item; - PyObject *dict = PyDict_New( ); - PyDict_SetItemString( dict, "__builtins__", PyEval_GetBuiltins( ) ); + PyInterpreterState *interp= PyThreadState_GET()->interp; + PyObject *mod_main= PyModule_New("__main__"); + PyDict_SetItemString(interp->modules, "__main__", mod_main); + Py_DECREF(mod_main); /* sys.modules owns now */ - item = PyUnicode_FromString( "__main__" ); - PyDict_SetItemString( dict, "__name__", item ); - Py_DECREF(item); - - /* __file__ only for nice UI'ness */ - if(filename) { - PyObject *item = PyUnicode_FromString( filename ); - PyDict_SetItemString( dict, "__file__", item ); - Py_DECREF(item); - } + PyModule_AddObject(mod_main, "__builtins__", interp->builtins); + PyModule_AddStringConstant(mod_main, "__name__", "__main__"); + PyModule_AddStringConstant(mod_main, "__file__", filename); /* __file__ only for nice UI'ness */ - return dict; + return PyModule_GetDict(mod_main); } /* must be called before Py_Initialize */ @@ -229,9 +228,12 @@ void BPY_start_python( int argc, char **argv ) { PyThreadState *py_tstate = NULL; - BPY_start_python_path(); /* allow to use our own included python */ + /* not essential but nice to set our name */ + static wchar_t bprogname_wchar[FILE_MAXDIR+FILE_MAXFILE]; /* python holds a reference */ + utf8towchar(bprogname_wchar, bprogname); + Py_SetProgramName(bprogname_wchar); - // Py_SetProgramName(); // extern char bprogname[FILE_MAXDIR+FILE_MAXFILE]; + BPY_start_python_path(); /* allow to use our own included python */ Py_Initialize( ); @@ -389,7 +391,7 @@ int BPY_run_python_script( bContext *C, const char *fn, struct Text *text, struc Py_DECREF( py_result ); } - Py_DECREF(py_dict); + PyDict_SetItemString(PyThreadState_GET()->interp->modules, "__main__", Py_None); bpy_context_clear(C, &gilstate); @@ -527,7 +529,7 @@ int BPY_run_python_script_space(const char *modulename, const char *func) Py_XDECREF(module); - Py_DECREF(py_dict); + PyDict_SetItemString(PyThreadState_GET()->interp->modules, "__main__", Py_None); PyGILState_Release(gilstate); return 1; @@ -538,7 +540,7 @@ int BPY_run_python_script_space(const char *modulename, const char *func) int BPY_eval_button(bContext *C, const char *expr, double *value) { PyGILState_STATE gilstate; - PyObject *dict, *mod, *retval; + PyObject *py_dict, *mod, *retval; int error_ret = 0; if (!value || !expr) return -1; @@ -550,11 +552,11 @@ int BPY_eval_button(bContext *C, const char *expr, double *value) bpy_context_set(C, &gilstate); - dict= CreateGlobalDictionary(C, NULL); + py_dict= CreateGlobalDictionary(C, "<blender button>"); mod = PyImport_ImportModule("math"); if (mod) { - PyDict_Merge(dict, PyModule_GetDict(mod), 0); /* 0 - dont overwrite existing values */ + PyDict_Merge(py_dict, PyModule_GetDict(mod), 0); /* 0 - dont overwrite existing values */ Py_DECREF(mod); } else { /* highly unlikely but possibly */ @@ -562,7 +564,7 @@ int BPY_eval_button(bContext *C, const char *expr, double *value) PyErr_Clear(); } - retval = PyRun_String(expr, Py_eval_input, dict, dict); + retval = PyRun_String(expr, Py_eval_input, py_dict, py_dict); if (retval == NULL) { error_ret= -1; @@ -599,8 +601,9 @@ int BPY_eval_button(bContext *C, const char *expr, double *value) if(error_ret) { BPy_errors_to_report(CTX_wm_reports(C)); } + + PyDict_SetItemString(PyThreadState_GET()->interp->modules, "__main__", Py_None); - Py_DECREF(dict); bpy_context_clear(C, &gilstate); return error_ret; @@ -609,7 +612,7 @@ int BPY_eval_button(bContext *C, const char *expr, double *value) int BPY_eval_string(bContext *C, const char *expr) { PyGILState_STATE gilstate; - PyObject *dict, *retval; + PyObject *py_dict, *retval; int error_ret = 0; if (!expr) return -1; @@ -620,9 +623,9 @@ int BPY_eval_string(bContext *C, const char *expr) bpy_context_set(C, &gilstate); - dict= CreateGlobalDictionary(C, NULL); + py_dict= CreateGlobalDictionary(C, "<blender string>"); - retval = PyRun_String(expr, Py_eval_input, dict, dict); + retval = PyRun_String(expr, Py_eval_input, py_dict, py_dict); if (retval == NULL) { error_ret= -1; @@ -633,9 +636,10 @@ int BPY_eval_string(bContext *C, const char *expr) Py_DECREF(retval); } - Py_DECREF(dict); + PyDict_SetItemString(PyThreadState_GET()->interp->modules, "__main__", Py_None); + bpy_context_clear(C, &gilstate); - + return error_ret; } diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 4a9c69ebedd..8be9cc4cdae 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -3086,37 +3086,47 @@ static struct PyMethodDef pyrna_prop_collection_methods[] = { * todo - also accept useful args */ static PyObject * pyrna_struct_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - BPy_StructRNA *base = NULL; + BPy_StructRNA *base; if (!PyArg_ParseTuple(args, "O!:bpy_struct.__new__", &pyrna_struct_Type, &base)) return NULL; - - if (type == &pyrna_struct_Type) { - return pyrna_struct_CreatePyObject(&base->ptr); - } else { + + if (type == Py_TYPE(base)) { + Py_INCREF(base); + return (PyObject *)base; + } else if (PyType_IsSubtype(type, &pyrna_struct_Type)) { BPy_StructRNA *ret = (BPy_StructRNA *) type->tp_alloc(type, 0); ret->ptr = base->ptr; return (PyObject *)ret; } + else { + PyErr_Format(PyExc_TypeError, "bpy_struct.__new__(type): type '%.200s' is not a subtype of bpy_struct.", type->tp_name); + return NULL; + } } /* only needed for subtyping, so a new class gets a valid BPy_StructRNA * todo - also accept useful args */ static PyObject * pyrna_prop_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - BPy_PropertyRNA *base = NULL; + BPy_PropertyRNA *base; - if (!PyArg_ParseTuple(args, "O!:Base BPy_PropertyRNA", &pyrna_prop_Type, &base)) + if (!PyArg_ParseTuple(args, "O!:bpy_prop.__new__", &pyrna_prop_Type, &base)) return NULL; - if (ELEM3(type, &pyrna_prop_Type, &pyrna_prop_array_Type, &pyrna_prop_collection_Type)) { - return pyrna_prop_CreatePyObject(&base->ptr, base->prop); - } else { + if (type == Py_TYPE(base)) { + Py_INCREF(base); + return (PyObject *)base; + } else if (PyType_IsSubtype(type, &pyrna_prop_Type)) { BPy_PropertyRNA *ret = (BPy_PropertyRNA *) type->tp_alloc(type, 0); ret->ptr = base->ptr; ret->prop = base->prop; return (PyObject *)ret; } + else { + PyErr_Format(PyExc_TypeError, "bpy_prop.__new__(type): type '%.200s' is not a subtype of bpy_prop.", type->tp_name); + return NULL; + } } PyObject *pyrna_param_to_py(PointerRNA *ptr, ParameterList *parms, PropertyRNA *prop, void *data) @@ -4570,10 +4580,13 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par else { args = PyTuple_New(1); PyTuple_SET_ITEM(args, 0, py_srna); - py_class_instance = PyObject_Call(py_class, args, NULL); + py_class_instance= PyObject_Call(py_class, args, NULL); Py_DECREF(args); - - if(py_class_instance_store) { + + if(py_class_instance == NULL) { + err= -1; /* so the error is not overridden below */ + } + else if(py_class_instance_store) { *py_class_instance_store = py_class_instance; Py_INCREF(py_class_instance); } @@ -4626,8 +4639,11 @@ static int bpy_class_call(PointerRNA *ptr, FunctionRNA *func, ParameterList *par } } else { - PyErr_Format(PyExc_RuntimeError, "could not create instance of %.200s to call callback function %.200s.", RNA_struct_identifier(ptr->type), RNA_function_identifier(func)); - err= -1; + /* the error may be alredy set if the class instance couldnt be created */ + if(err != -1) { + PyErr_Format(PyExc_RuntimeError, "could not create instance of %.200s to call callback function %.200s.", RNA_struct_identifier(ptr->type), RNA_function_identifier(func)); + err= -1; + } } if (ret == NULL) { /* covers py_class_instance failing too */ @@ -4787,7 +4803,7 @@ static PyObject *pyrna_basetype_register(PyObject *self, PyObject *py_class) reg= RNA_struct_register(srna); if(!reg) { - PyErr_SetString(PyExc_ValueError, "bpy.types.register(...): expected a Type subclassed from a registerable rna type (no register supported)."); + PyErr_Format(PyExc_ValueError, "bpy.types.register(...): expected a subclass of a registerable rna type (%.200s does not support registration).", RNA_struct_identifier(srna)); return NULL; } diff --git a/source/blender/render/extern/include/RE_pipeline.h b/source/blender/render/extern/include/RE_pipeline.h index 378a386478d..1ec17b1ba7a 100644 --- a/source/blender/render/extern/include/RE_pipeline.h +++ b/source/blender/render/extern/include/RE_pipeline.h @@ -37,14 +37,15 @@ struct bNodeTree; struct Image; +struct Main; struct NodeBlurData; struct Object; -struct ReportList; struct RenderData; struct RenderEngine; struct RenderEngineType; struct RenderResult; struct ReportList; +struct ReportList; struct Scene; struct SceneRenderLayer; @@ -208,12 +209,12 @@ void RE_init_threadcount(Render *re); void RE_TileProcessor(struct Render *re); /* only RE_NewRender() needed, main Blender render calls */ -void RE_BlenderFrame(struct Render *re, struct Scene *scene, struct SceneRenderLayer *srl, unsigned int lay, int frame); -void RE_BlenderAnim(struct Render *re, struct Scene *scene, unsigned int lay, int sfra, int efra, int tfra, struct ReportList *reports); -void RE_RenderFreestyleStrokes(struct Render *re, struct Scene *scene); +void RE_BlenderFrame(struct Render *re, struct Main *bmain, struct Scene *scene, struct SceneRenderLayer *srl, unsigned int lay, int frame); +void RE_BlenderAnim(struct Render *re, struct Main *bmain, struct Scene *scene, unsigned int lay, int sfra, int efra, int tfra, struct ReportList *reports); +void RE_RenderFreestyleStrokes(struct Render *re, struct Main *bmain, struct Scene *scene); /* main preview render call */ -void RE_PreviewRender(struct Render *re, struct Scene *scene); +void RE_PreviewRender(struct Render *re, struct Main *bmain, struct Scene *scene); void RE_ReadRenderResult(struct Scene *scene, struct Scene *scenode); void RE_WriteRenderResult(RenderResult *rr, char *filename, int compress); @@ -249,7 +250,7 @@ void RE_zbuf_accumulate_vecblur(struct NodeBlurData *nbd, int xsize, int ysize, #define RE_BAKE_DISPLACEMENT 5 #define RE_BAKE_SHADOW 6 -void RE_Database_Baking(struct Render *re, struct Scene *scene, unsigned int lay, int type, struct Object *actob); +void RE_Database_Baking(struct Render *re, struct Main *bmain, struct Scene *scene, unsigned int lay, int type, struct Object *actob); void RE_DataBase_GetView(struct Render *re, float mat[][4]); void RE_GetCameraWindow(struct Render *re, struct Object *camera, int frame, float mat[][4]); diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h index 2af3bf6d26e..65eda26ef9b 100644 --- a/source/blender/render/intern/include/render_types.h +++ b/source/blender/render/intern/include/render_types.h @@ -55,6 +55,7 @@ struct RenderBuckets; struct ObjectInstanceRen; struct RayObject; struct RayFace; +struct Main; #define TABLEINITSIZE 1024 #define LAMPINITSIZE 256 @@ -170,7 +171,8 @@ struct Render /* shadow counter, detect shadow-reuse for shaders */ int shadowsamplenr[BLENDER_MAX_THREADS]; - /* scene, and its full copy of renderdata and world */ + /* main, scene, and its full copy of renderdata and world */ + struct Main *main; Scene *scene; RenderData r; World wrld; @@ -589,23 +591,21 @@ typedef struct LampRen { #define R_HALO 2 #define R_SEC_FIELD 4 #define R_LAMPHALO 8 -#define R_GLOB_NOPUNOFLIP 16 -#define R_NEED_TANGENT 32 -#define R_BAKE_TRACE 128 -#define R_BAKING 256 +#define R_NEED_TANGENT 16 +#define R_BAKE_TRACE 32 +#define R_BAKING 64 /* vlakren->flag (vlak = face in dutch) char!!! */ #define R_SMOOTH 1 #define R_HIDDEN 2 /* strand flag, means special handling */ #define R_STRAND 4 -#define R_NOPUNOFLIP 8 -#define R_FULL_OSA 16 -#define R_FACE_SPLIT 32 +#define R_FULL_OSA 8 +#define R_FACE_SPLIT 16 /* Tells render to divide face other way. */ -#define R_DIVIDE_24 64 +#define R_DIVIDE_24 32 /* vertex normals are tangent or view-corrected vector, for hair strands */ -#define R_TANGENT 128 +#define R_TANGENT 64 /* strandbuffer->flag */ #define R_STRAND_BSPLINE 1 diff --git a/source/blender/render/intern/include/renderdatabase.h b/source/blender/render/intern/include/renderdatabase.h index 2a0086b436c..76e7fe7b4f3 100644 --- a/source/blender/render/intern/include/renderdatabase.h +++ b/source/blender/render/intern/include/renderdatabase.h @@ -115,7 +115,7 @@ struct MCol *RE_vlakren_get_mcol(struct ObjectRen *obr, VlakRen *ren, int n, cha float *RE_vlakren_get_surfnor(struct ObjectRen *obr, VlakRen *ren, int verify); float *RE_vlakren_get_nmap_tangent(struct ObjectRen *obr, VlakRen *ren, int verify); RadFace **RE_vlakren_get_radface(struct ObjectRen *obr, VlakRen *ren, int verify); -int RE_vlakren_get_normal(struct Render *re, struct ObjectInstanceRen *obi, struct VlakRen *vlr, float *nor); +void RE_vlakren_get_normal(struct Render *re, struct ObjectInstanceRen *obi, struct VlakRen *vlr, float *nor); float *RE_strandren_get_surfnor(struct ObjectRen *obr, struct StrandRen *strand, int verify); float *RE_strandren_get_uv(struct ObjectRen *obr, struct StrandRen *strand, int n, char **name, int verify); diff --git a/source/blender/render/intern/include/texture.h b/source/blender/render/intern/include/texture.h index 436b365b352..fb941d1b7f3 100644 --- a/source/blender/render/intern/include/texture.h +++ b/source/blender/render/intern/include/texture.h @@ -65,7 +65,7 @@ void do_lamp_tex(LampRen *la, float *lavec, struct ShadeInput *shi, float *colf, void do_volume_tex(struct ShadeInput *shi, float *xyz, int mapto_flag, float *col, float *val); void init_render_textures(Render *re); -void end_render_textures(void); +void end_render_textures(Render *re); void render_realtime_texture(struct ShadeInput *shi, struct Image *ima); diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index c5d69e69586..e17e3a3c600 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -356,17 +356,6 @@ static void split_v_renderfaces(ObjectRen *obr, int startvlak, int startvert, in } /* ------------------------------------------------------------------------- */ - -static int check_vnormal(float *n, float *veno) -{ - float inp; - - inp=n[0]*veno[0]+n[1]*veno[1]+n[2]*veno[2]; - if(inp < -FLT_EPSILON10) return 1; - return 0; -} - -/* ------------------------------------------------------------------------- */ /* Stress, tangents and normals */ /* ------------------------------------------------------------------------- */ @@ -536,9 +525,6 @@ static void calc_vertexnormals(Render *re, ObjectRen *obr, int do_tangent, int d float n1[3], n2[3], n3[3], n4[3]; float fac1, fac2, fac3, fac4=0.0f; - if(re->flag & R_GLOB_NOPUNOFLIP) - vlr->flag |= R_NOPUNOFLIP; - sub_v3_v3v3(n1, v2->co, v1->co); normalize_v3(n1); sub_v3_v3v3(n2, v3->co, v2->co); @@ -562,21 +548,11 @@ static void calc_vertexnormals(Render *re, ObjectRen *obr, int do_tangent, int d fac3= saacos(-n2[0]*n3[0]-n2[1]*n3[1]-n2[2]*n3[2]); fac4= saacos(-n3[0]*n4[0]-n3[1]*n4[1]-n3[2]*n4[2]); - if(!(vlr->flag & R_NOPUNOFLIP)) { - if( check_vnormal(vlr->n, v4->n) ) fac4= -fac4; - } - v4->n[0] +=fac4*vlr->n[0]; v4->n[1] +=fac4*vlr->n[1]; v4->n[2] +=fac4*vlr->n[2]; } - if(!(vlr->flag & R_NOPUNOFLIP)) { - if( check_vnormal(vlr->n, v1->n) ) fac1= -fac1; - if( check_vnormal(vlr->n, v2->n) ) fac2= -fac2; - if( check_vnormal(vlr->n, v3->n) ) fac3= -fac3; - } - v1->n[0] +=fac1*vlr->n[0]; v1->n[1] +=fac1*vlr->n[1]; v1->n[2] +=fac1*vlr->n[2]; @@ -1021,7 +997,7 @@ static void static_particle_strand(Render *re, ObjectRen *obr, Material *ma, Par else width= 1.0f; if(ma->mode & MA_TANGENT_STR) - flag= R_SMOOTH|R_NOPUNOFLIP|R_TANGENT; + flag= R_SMOOTH|R_TANGENT; else flag= R_SMOOTH; @@ -2431,7 +2407,7 @@ static void init_render_mball(Render *re, ObjectRen *obr) normal_tri_v3( vlr->n,vlr->v3->co, vlr->v2->co, vlr->v1->co); vlr->mat= ma; - vlr->flag= ME_SMOOTH+R_NOPUNOFLIP; + vlr->flag= ME_SMOOTH; vlr->ec= 0; /* mball -too bad- always has triangles, because quads can be non-planar */ @@ -2460,10 +2436,8 @@ static void init_render_mball(Render *re, ObjectRen *obr) /* returns amount of vertices added for orco */ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar, float *orco, float mat[4][4]) { - Object *ob= obr->ob; VertRen *v1, *v2, *v3, *v4, *ver; VlakRen *vlr, *vlr1, *vlr2, *vlr3; - Curve *cu= ob->data; float *data, n1[3]; int u, v, orcoret= 0; int p1, p2, p3, p4, a; @@ -2543,9 +2517,6 @@ static int dl_surf_to_renderdata(ObjectRen *obr, DispList *dl, Material **matar, vlr->mat= matar[ dl->col]; vlr->ec= ME_V1V2+ME_V2V3; vlr->flag= dl->rt; - if( (cu->flag & CU_NOPUNOFLIP) ) { - vlr->flag |= R_NOPUNOFLIP; - } add_v3_v3(v1->n, n1); add_v3_v3(v2->n, n1); @@ -2694,9 +2665,6 @@ static void init_render_dm(DerivedMesh *dm, Render *re, ObjectRen *obr, vlr->mat= ma; vlr->flag= flag; - if(cu &&(cu->flag & ME_NOPUNOFLIP)) { - vlr->flag |= R_NOPUNOFLIP; - } vlr->ec= 0; /* mesh edges rendered separately */ if(len==0) obr->totvlak--; @@ -2904,9 +2872,6 @@ static void init_render_curve(Render *re, ObjectRen *obr, int timeoffset) vlr->mat= matar[ dl->col ]; vlr->flag= 0; - if( (cu->flag & CU_NOPUNOFLIP) ) { - vlr->flag |= R_NOPUNOFLIP; - } vlr->ec= 0; } } @@ -3391,9 +3356,6 @@ static void init_render_mesh(Render *re, ObjectRen *obr, int timeoffset) vlr->mat= ma; vlr->flag= flag; - if((me->flag & ME_NOPUNOFLIP) ) { - vlr->flag |= R_NOPUNOFLIP; - } vlr->ec= 0; /* mesh edges rendered separately */ if(len==0) obr->totvlak--; @@ -3893,12 +3855,12 @@ static void set_material_lightgroups(Render *re) if(re->scene->r.scemode & R_PREVIEWBUTS) return; - for(group= G.main->group.first; group; group=group->id.next) + for(group= re->main->group.first; group; group=group->id.next) group->id.flag |= LIB_DOIT; /* it's a bit too many loops in loops... but will survive */ /* hola! materials not in use...? */ - for(ma= G.main->mat.first; ma; ma=ma->id.next) { + for(ma= re->main->mat.first; ma; ma=ma->id.next) { if(ma->group && (ma->group->id.flag & LIB_DOIT)) add_lightgroup(re, ma->group, ma->mode & MA_GROUP_NOLAY); } @@ -4580,8 +4542,8 @@ void RE_Database_Free(Render *re) #if 0 /* radio can be redone better */ end_radio_render(); #endif - end_render_materials(); - end_render_textures(); + end_render_materials(re->main); + end_render_textures(re); free_pointdensities(re); @@ -4906,7 +4868,7 @@ static void database_init_objects(Render *re, unsigned int renderlay, int nolamp /* objects in groups with OB_RENDER_DUPLI set still need to be created, * since they may not be part of the scene */ - for(group= G.main->group.first; group; group=group->id.next) + for(group= re->main->group.first; group; group=group->id.next) add_group_render_dupli_obs(re, group, nolamps, onlyselected, actob, timeoffset, renderlay, 0); /* imat objects has to be done again, since groups can mess it up */ @@ -4954,7 +4916,7 @@ void RE_Database_FromScene(Render *re, Scene *scene, unsigned int lay, int use_c /* applies changes fully */ if((re->r.scemode & R_PREVIEWBUTS)==0) - scene_update_for_newframe(re->scene, lay); + scene_update_for_newframe(re->main, re->scene, lay); /* if no camera, viewmat should have been set! */ if(use_camera_view && re->scene->camera) { @@ -4981,7 +4943,7 @@ void RE_Database_FromScene(Render *re, Scene *scene, unsigned int lay, int use_c /* still bad... doing all */ init_render_textures(re); VECCOPY(amb, &re->wrld.ambr); - init_render_materials(re->r.mode, amb); + init_render_materials(re->main, re->r.mode, amb); set_node_shader_lamp_loop(shade_material_loop); /* MAKE RENDER DATA */ @@ -5108,7 +5070,7 @@ static void database_fromscene_vectors(Render *re, Scene *scene, unsigned int la /* applies changes fully */ scene->r.cfra += timeoffset; - scene_update_for_newframe(re->scene, lay); + scene_update_for_newframe(re->main, re->scene, lay); /* if no camera, viewmat should have been set! */ if(re->scene->camera) { @@ -5598,12 +5560,13 @@ void RE_Database_FromScene_Vectors(Render *re, Scene *sce, unsigned int lay) RE_BAKE_DISPLACEMENT:for baking, no lamps, only selected objects RE_BAKE_SHADOW: for baking, only shadows, but all objects */ -void RE_Database_Baking(Render *re, Scene *scene, unsigned int lay, int type, Object *actob) +void RE_Database_Baking(Render *re, Main *bmain, Scene *scene, unsigned int lay, int type, Object *actob) { float mat[4][4]; float amb[3]; int onlyselected, nolamps; + re->main= bmain; re->scene= scene; re->lay= lay; @@ -5612,7 +5575,6 @@ void RE_Database_Baking(Render *re, Scene *scene, unsigned int lay, int type, Ob RE_init_threadcount(re); - re->flag |= R_GLOB_NOPUNOFLIP; re->flag |= R_BAKING; re->excludeob= actob; if(actob) @@ -5665,7 +5627,7 @@ void RE_Database_Baking(Render *re, Scene *scene, unsigned int lay, int type, Ob init_render_textures(re); VECCOPY(amb, &re->wrld.ambr); - init_render_materials(re->r.mode, amb); + init_render_materials(re->main, re->r.mode, amb); set_node_shader_lamp_loop(shade_material_loop); diff --git a/source/blender/render/intern/source/envmap.c b/source/blender/render/intern/source/envmap.c index 1accb0fdb60..8977bc7f379 100644 --- a/source/blender/render/intern/source/envmap.c +++ b/source/blender/render/intern/source/envmap.c @@ -46,7 +46,6 @@ #include "BKE_library.h" #include "BKE_main.h" -#include "BKE_global.h" #include "BKE_image.h" // BKE_write_ibuf #include "BKE_texture.h" #include "BKE_utildefines.h" @@ -508,7 +507,7 @@ void make_envmaps(Render *re) /* 5 = hardcoded max recursion level */ while(depth<5) { - tex= G.main->tex.first; + tex= re->main->tex.first; while(tex) { if(tex->id.us && tex->type==TEX_ENVMAP) { if(tex->env && tex->env->object) { diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index 07ffc7b804c..3c690d87f4a 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -2157,7 +2157,7 @@ static void render_scene(Render *re, Scene *sce, int cfra) resc->lay= sce->lay; /* ensure scene has depsgraph, base flags etc OK */ - set_scene_bg(sce); + set_scene_bg(re->main, sce); /* copy callbacks */ resc->display_draw= re->display_draw; @@ -2175,7 +2175,7 @@ static void tag_scenes_for_render(Render *re) bNode *node; Scene *sce; - for(sce= G.main->scene.first; sce; sce= sce->id.next) + for(sce= re->main->scene.first; sce; sce= sce->id.next) sce->id.flag &= ~LIB_DOIT; re->scene->id.flag |= LIB_DOIT; @@ -2393,7 +2393,7 @@ void RE_MergeFullSample(Render *re, Scene *sce, bNodeTree *ntree) /* first call RE_ReadRenderResult on every renderlayer scene. this creates Render structs */ /* tag scenes unread */ - for(scene= G.main->scene.first; scene; scene= scene->id.next) + for(scene= re->main->scene.first; scene; scene= scene->id.next) scene->id.flag |= LIB_DOIT; for(node= ntree->nodes.first; node; node= node->next) { @@ -2468,7 +2468,7 @@ static void do_render_composite_fields_blur_3d(Render *re) R.stats_draw= re->stats_draw; if (update_newframe) - scene_update_for_newframe(re->scene, re->lay); + scene_update_for_newframe(re->main, re->scene, re->lay); if(re->r.scemode & R_FULL_SAMPLE) do_merge_fullsample(re, ntree); @@ -2533,7 +2533,7 @@ static void do_render_seq(Render * re) if(recurs_depth==0) { /* otherwise sequencer animation isnt updated */ - BKE_animsys_evaluate_all_animation(G.main, (float)cfra); // XXX, was BKE_curframe(re->scene) + BKE_animsys_evaluate_all_animation(re->main, (float)cfra); // XXX, was BKE_curframe(re->scene) } recurs_depth++; @@ -2768,7 +2768,7 @@ static void update_physics_cache(Render *re, Scene *scene, int anim_init) BKE_ptcache_make_cache(&baker); } /* evaluating scene options for general Blender render */ -static int render_initialize_from_scene(Render *re, Scene *scene, SceneRenderLayer *srl, unsigned int lay, int anim, int anim_init) +static int render_initialize_from_main(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *srl, unsigned int lay, int anim, int anim_init) { int winx, winy; rcti disprect; @@ -2794,6 +2794,7 @@ static int render_initialize_from_scene(Render *re, Scene *scene, SceneRenderLay disprect.ymax= winy; } + re->main= bmain; re->scene= scene; re->lay= lay; @@ -2836,14 +2837,14 @@ static int render_initialize_from_scene(Render *re, Scene *scene, SceneRenderLay } /* general Blender frame render call */ -void RE_BlenderFrame(Render *re, Scene *scene, SceneRenderLayer *srl, unsigned int lay, int frame) +void RE_BlenderFrame(Render *re, Main *bmain, Scene *scene, SceneRenderLayer *srl, unsigned int lay, int frame) { /* ugly global still... is to prevent preview events and signal subsurfs etc to make full resol */ G.rendering= 1; scene->r.cfra= frame; - if(render_initialize_from_scene(re, scene, srl, lay, 0, 0)) { + if(render_initialize_from_main(re, bmain, scene, srl, lay, 0, 0)) { MEM_reset_peak_memory(); do_render_all_options(re); } @@ -2852,11 +2853,11 @@ void RE_BlenderFrame(Render *re, Scene *scene, SceneRenderLayer *srl, unsigned i G.rendering= 0; } -void RE_RenderFreestyleStrokes(Render *re, Scene *scene) +void RE_RenderFreestyleStrokes(Render *re, Main *bmain, Scene *scene) { re->result_ok= 0; scene->r.cfra= 1; - if(render_initialize_from_scene(re, scene, NULL, scene->lay, 0, 0)) { + if(render_initialize_from_main(re, bmain, scene, NULL, scene->lay, 0, 0)) { do_render_fields_blur_3d(re); } re->result_ok= 1; @@ -2949,14 +2950,14 @@ static int do_write_image_or_movie(Render *re, Scene *scene, bMovieHandle *mh, R } /* saves images to disk */ -void RE_BlenderAnim(Render *re, Scene *scene, unsigned int lay, int sfra, int efra, int tfra, ReportList *reports) +void RE_BlenderAnim(Render *re, Main *bmain, Scene *scene, unsigned int lay, int sfra, int efra, int tfra, ReportList *reports) { bMovieHandle *mh= BKE_get_movie_handle(scene->r.imtype); int cfrao= scene->r.cfra; int nfra; /* do not fully call for each frame, it initializes & pops output window */ - if(!render_initialize_from_scene(re, scene, NULL, lay, 0, 1)) + if(!render_initialize_from_main(re, bmain, scene, NULL, lay, 0, 1)) return; /* ugly global still... is to prevent renderwin events and signal subsurfs etc to make full resol */ @@ -2989,7 +2990,7 @@ void RE_BlenderAnim(Render *re, Scene *scene, unsigned int lay, int sfra, int ef char name[FILE_MAX]; /* only border now, todo: camera lens. (ton) */ - render_initialize_from_scene(re, scene, NULL, lay, 1, 0); + render_initialize_from_main(re, bmain, scene, NULL, lay, 1, 0); if(nfra!=scene->r.cfra) { /* @@ -3004,7 +3005,7 @@ void RE_BlenderAnim(Render *re, Scene *scene, unsigned int lay, int sfra, int ef else updatelay= re->lay; - scene_update_for_newframe(scene, updatelay); + scene_update_for_newframe(bmain, scene, updatelay); continue; } else @@ -3060,7 +3061,7 @@ void RE_BlenderAnim(Render *re, Scene *scene, unsigned int lay, int sfra, int ef G.rendering= 0; } -void RE_PreviewRender(Render *re, Scene *sce) +void RE_PreviewRender(Render *re, Main *bmain, Scene *sce) { int winx, winy; @@ -3069,6 +3070,7 @@ void RE_PreviewRender(Render *re, Scene *sce) RE_InitState(re, NULL, &sce->r, NULL, winx, winy, NULL); + re->main = bmain; re->scene = sce; re->lay = sce->lay; diff --git a/source/blender/render/intern/source/pointdensity.c b/source/blender/render/intern/source/pointdensity.c index 32ae3ba12dc..a09c16b7ed9 100644 --- a/source/blender/render/intern/source/pointdensity.c +++ b/source/blender/render/intern/source/pointdensity.c @@ -282,7 +282,7 @@ void make_pointdensities(Render *re) re->i.infostr= "Caching Point Densities"; re->stats_draw(re->sdh, &re->i); - for (tex= G.main->tex.first; tex; tex= tex->id.next) { + for (tex= re->main->tex.first; tex; tex= tex->id.next) { if(tex->id.us && tex->type==TEX_POINTDENSITY) { cache_pointdensity(re, tex); } @@ -299,7 +299,7 @@ void free_pointdensities(Render *re) if(re->scene->r.scemode & R_PREVIEWBUTS) return; - for (tex= G.main->tex.first; tex; tex= tex->id.next) { + for (tex= re->main->tex.first; tex; tex= tex->id.next) { if(tex->id.us && tex->type==TEX_POINTDENSITY) { free_pointdensity(re, tex); } diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c index ed52f37fcfa..724fd9a3110 100644 --- a/source/blender/render/intern/source/rayshade.c +++ b/source/blender/render/intern/source/rayshade.c @@ -531,10 +531,6 @@ void shade_ray(Isect *is, ShadeInput *shi, ShadeResult *shr) shade_input_set_normals(shi); - /* point normals to viewing direction */ - if(INPR(shi->facenor, shi->view) < 0.0f) - shade_input_flip_normals(shi); - shade_input_set_shade_texco(shi); if (shi->mat->material_type == MA_TYPE_VOLUME) { if(ELEM(is->mode, RE_RAY_SHADOW, RE_RAY_SHADOW_TRA)) { @@ -558,19 +554,9 @@ void shade_ray(Isect *is, ShadeInput *shi, ShadeResult *shr) shi->mat= vlr->mat; /* shi->mat is being set in nodetree */ } else { - int tempdepth; - /* XXX dodgy business here, set ray depth to -1 - * to ignore raytrace in shade_material_loop() - * this could really use a refactor --Matt */ - if (shi->volume_depth == 0) { - tempdepth = shi->depth; - shi->depth = -1; - shade_material_loop(shi, shr); - shi->depth = tempdepth; - } else { - shade_material_loop(shi, shr); - } + shade_material_loop(shi, shr); } + /* raytrace likes to separate the spec color */ VECSUB(shr->diff, shr->combined, shr->spec); } diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c index 2bfc8f6c1ef..ce55935d392 100644 --- a/source/blender/render/intern/source/renderdatabase.c +++ b/source/blender/render/intern/source/renderdatabase.c @@ -440,10 +440,9 @@ VlakRen *RE_vlakren_copy(ObjectRen *obr, VlakRen *vlr) return vlr1; } -int RE_vlakren_get_normal(Render *re, ObjectInstanceRen *obi, VlakRen *vlr, float *nor) +void RE_vlakren_get_normal(Render *re, ObjectInstanceRen *obi, VlakRen *vlr, float *nor) { - float v1[3], (*nmat)[3]= obi->nmat; - int flipped= 0; + float (*nmat)[3]= obi->nmat; if(obi->flag & R_TRANSFORMED) { VECCOPY(nor, vlr->n); @@ -453,29 +452,6 @@ int RE_vlakren_get_normal(Render *re, ObjectInstanceRen *obi, VlakRen *vlr, floa } else VECCOPY(nor, vlr->n); - - if((vlr->flag & R_NOPUNOFLIP)==0) { - if(re->r.mode & R_ORTHO) { - if(nor[2] > 0.0f) - flipped= 1; - } - else { - VECCOPY(v1, vlr->v1->co); - if(obi->flag & R_TRANSFORMED) - mul_m4_v3(obi->mat, v1); - if(INPR(v1, nor) < 0.0f) { - flipped= 1; - } - } - - if(flipped) { - nor[0]= -nor[0]; - nor[1]= -nor[1]; - nor[2]= -nor[2]; - } - } - - return flipped; } void RE_set_customdata_names(ObjectRen *obr, CustomData *data) diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c index 4c31e6ea9be..394f90fea5e 100644 --- a/source/blender/render/intern/source/shadeinput.c +++ b/source/blender/render/intern/source/shadeinput.c @@ -130,7 +130,7 @@ void shade_material_loop(ShadeInput *shi, ShadeResult *shr) } /* depth >= 1 when ray-shading */ - if(shi->depth==0) { + if(shi->depth==0 || shi->volume_depth > 0) { if(R.r.mode & R_RAYTRACE) { if(shi->ray_mirror!=0.0f || ((shi->mat->mode & MA_TRANSP) && (shi->mat->mode & MA_RAYTRANSP) && shr->alpha!=1.0f)) { /* ray trace works on combined, but gives pass info */ @@ -273,7 +273,8 @@ void shade_input_set_triangle_i(ShadeInput *shi, ObjectInstanceRen *obi, VlakRen shi->mode= shi->mat->mode_l; /* or-ed result for all nodes */ /* facenormal copy, can get flipped */ - shi->flippednor= RE_vlakren_get_normal(&R, obi, vlr, shi->facenor); + shi->flippednor= 0; + RE_vlakren_get_normal(&R, obi, vlr, shi->facenor); /* calculate vertexnormals */ if(vlr->flag & R_SMOOTH) { @@ -286,24 +287,6 @@ void shade_input_set_triangle_i(ShadeInput *shi, ObjectInstanceRen *obi, VlakRen mul_m3_v3(obi->nmat, shi->n2); mul_m3_v3(obi->nmat, shi->n3); } - - if(!(vlr->flag & (R_NOPUNOFLIP|R_TANGENT))) { - if(INPR(shi->facenor, shi->n1) < 0.0f) { - shi->n1[0]= -shi->n1[0]; - shi->n1[1]= -shi->n1[1]; - shi->n1[2]= -shi->n1[2]; - } - if(INPR(shi->facenor, shi->n2) < 0.0f) { - shi->n2[0]= -shi->n2[0]; - shi->n2[1]= -shi->n2[1]; - shi->n2[2]= -shi->n2[2]; - } - if(INPR(shi->facenor, shi->n3) < 0.0f) { - shi->n3[0]= -shi->n3[0]; - shi->n3[1]= -shi->n3[1]; - shi->n3[2]= -shi->n3[2]; - } - } } } @@ -826,6 +809,10 @@ void shade_input_set_normals(ShadeInput *shi) /* used in nodes */ VECCOPY(shi->vno, shi->vn); + /* flip normals to viewing direction */ + if(!(shi->vlr->flag & R_TANGENT)) + if(dot_v3v3(shi->facenor, shi->view) < 0.0f) + shade_input_flip_normals(shi); } /* use by raytrace, sss, bake to flip into the right direction */ diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index 449d3da0b6d..00eb6e3d17d 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -1644,7 +1644,7 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr) if(((passflag & SCE_PASS_COMBINED) && (shi->combinedflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) || (passflag & (SCE_PASS_AO|SCE_PASS_ENVIRONMENT|SCE_PASS_INDIRECT))) { /* AO was calculated for scanline already */ - if(shi->depth) + if(shi->depth || shi->volume_depth) ambient_occlusion(shi); VECCOPY(shr->ao, shi->ao); VECCOPY(shr->env, shi->env); // XXX multiply diff --git a/source/blender/render/intern/source/sss.c b/source/blender/render/intern/source/sss.c index aa285401524..e8c95a34ac4 100644 --- a/source/blender/render/intern/source/sss.c +++ b/source/blender/render/intern/source/sss.c @@ -56,7 +56,6 @@ #include "DNA_material_types.h" #include "BKE_colortools.h" -#include "BKE_global.h" #include "BKE_main.h" #include "BKE_material.h" #include "BKE_node.h" @@ -993,7 +992,7 @@ void make_sss_tree(Render *re) re->i.infostr= "SSS preprocessing"; re->stats_draw(re->sdh, &re->i); - for(mat= G.main->mat.first; mat; mat= mat->id.next) + for(mat= re->main->mat.first; mat; mat= mat->id.next) if(mat->id.us && (mat->flag & MA_IS_USED) && (mat->sss_flag & MA_DIFF_SSS)) sss_create_tree_mat(re, mat); } diff --git a/source/blender/render/intern/source/texture.c b/source/blender/render/intern/source/texture.c index c8a15372e21..60565d0ff16 100644 --- a/source/blender/render/intern/source/texture.c +++ b/source/blender/render/intern/source/texture.c @@ -131,7 +131,7 @@ void init_render_textures(Render *re) { Tex *tex; - tex= G.main->tex.first; + tex= re->main->tex.first; while(tex) { if(tex->id.us) init_render_texture(re, tex); tex= tex->id.next; @@ -144,10 +144,10 @@ void end_render_texture(Tex *tex) ntreeEndExecTree(tex->nodetree); } -void end_render_textures(void) +void end_render_textures(Render *re) { Tex *tex; - for(tex= G.main->tex.first; tex; tex= tex->id.next) + for(tex= re->main->tex.first; tex; tex= tex->id.next) if(tex->id.us) end_render_texture(tex); } @@ -1731,7 +1731,7 @@ void do_material_tex(ShadeInput *shi) co= shi->tang; dx= shi->dxno; dy= shi->dyno; } else if(mtex->texco==TEXCO_GLOB) { - co= shi->gl; dx= shi->dxco; dy= shi->dyco; + co= shi->gl; dx= shi->dxgl; dy= shi->dygl; } else if(mtex->texco==TEXCO_UV) { if(mtex->texflag & MTEX_DUPLI_MAPTO) { diff --git a/source/blender/render/intern/source/volumetric.c b/source/blender/render/intern/source/volumetric.c index 21a0ab1d2a8..a58d96736d5 100644 --- a/source/blender/render/intern/source/volumetric.c +++ b/source/blender/render/intern/source/volumetric.c @@ -193,7 +193,7 @@ static void vol_trace_behind(ShadeInput *shi, VlakRen *vlr, float *co, float *co isect.labda = FLT_MAX; isect.mode= RE_RAY_MIRROR; - isect.skip = RE_SKIP_VLR_NEIGHBOUR | RE_SKIP_VLR_RENDER_CHECK; + isect.skip = RE_SKIP_VLR_NEIGHBOUR; isect.orig.ob = (void*) shi->obi; isect.orig.face = (void*)vlr; isect.last_hit = NULL; @@ -446,7 +446,7 @@ static void vol_get_transmittance(ShadeInput *shi, float *tr, float *co, float * const float stepd = (t0 - pt0) * d; float sigma_t[3]; - vol_get_sigma_t(shi, sigma_t, co); + vol_get_sigma_t(shi, sigma_t, p); tau[0] += stepd * sigma_t[0]; tau[1] += stepd * sigma_t[1]; @@ -609,7 +609,10 @@ static void volumeintegrate(struct ShadeInput *shi, float *col, float *co, float /* transmittance component (alpha) */ vol_get_transmittance_seg(shi, tr, stepsize, co, density); - if (luminance(tr) < shi->mat->vol.depth_cutoff) break; + if (t0 > t1 * 0.25) { + /* only use depth cutoff after we've traced a little way into the volume */ + if (luminance(tr) < shi->mat->vol.depth_cutoff) break; + } vol_get_emission(shi, emit_col, p); @@ -783,8 +786,7 @@ void shade_volume_inside(ShadeInput *shi, ShadeResult *shr) MatInside *m; Material *mat_backup; ObjectInstanceRen *obi_backup; - float prev_alpha = shr->alpha; - + /* XXX: extend to multiple volumes perhaps later */ mat_backup = shi->mat; obi_backup = shi->obi; @@ -794,10 +796,10 @@ void shade_volume_inside(ShadeInput *shi, ShadeResult *shr) shi->obi = m->obi; shi->obr = m->obi->obr; - volume_trace(shi, shr, VOL_SHADE_INSIDE); - shr->alpha += prev_alpha; - CLAMP(shr->alpha, 0.f, 1.f); + memset(shr, 0, sizeof(ShadeResult)); + volume_trace(shi, shr, VOL_SHADE_INSIDE); + shi->mat = mat_backup; shi->obi = obi_backup; shi->obr = obi_backup->obr; diff --git a/source/blender/render/intern/source/voxeldata.c b/source/blender/render/intern/source/voxeldata.c index 64ba206bb86..076d6355585 100644 --- a/source/blender/render/intern/source/voxeldata.c +++ b/source/blender/render/intern/source/voxeldata.c @@ -39,7 +39,6 @@ #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" -#include "BKE_global.h" #include "BKE_image.h" #include "BKE_main.h" #include "BKE_modifier.h" @@ -318,7 +317,7 @@ void make_voxeldata(struct Render *re) re->stats_draw(re->sdh, &re->i); /* XXX: should be doing only textures used in this render */ - for (tex= G.main->tex.first; tex; tex= tex->id.next) { + for (tex= re->main->tex.first; tex; tex= tex->id.next) { if(tex->id.us && tex->type==TEX_VOXELDATA) { cache_voxeldata(re, tex); } diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 63dcda3c12e..867700980af 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -296,7 +296,7 @@ void wm_event_do_notifiers(bContext *C) /* XXX make lock in future, or separated derivedmesh users in scene */ if(!G.rendering) /* depsgraph & animation: update tagged datablocks */ - scene_update_tagged(win->screen->scene); + scene_update_tagged(CTX_data_main(C), win->screen->scene); } CTX_wm_window_set(C, NULL); diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 04f5175b1bf..e2293f79e95 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -314,7 +314,7 @@ void WM_read_file(bContext *C, char *name, ReportList *reports) CTX_wm_window_set(C, CTX_wm_manager(C)->windows.first); ED_editors_init(C); - DAG_on_load_update(); + DAG_on_load_update(CTX_data_main(C)); #ifndef DISABLE_PYTHON /* run any texts that were loaded in and flagged as modules */ @@ -394,7 +394,7 @@ int WM_read_homefile(bContext *C, wmOperator *op) BKE_write_undo(C, "original"); /* save current state */ ED_editors_init(C); - DAG_on_load_update(); + DAG_on_load_update(CTX_data_main(C)); WM_event_add_notifier(C, NC_WM|ND_FILEREAD, NULL); CTX_wm_window_set(C, NULL); /* exits queues */ diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 9fff73165b8..2ab0a055156 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1629,8 +1629,8 @@ static int wm_link_append_exec(bContext *C, wmOperator *op) flag_all_listbases_ids(LIB_PRE_EXISTING, 0); /* recreate dependency graph to include new objects */ - DAG_scene_sort(scene); - DAG_ids_flush_update(0); + DAG_scene_sort(bmain, scene); + DAG_ids_flush_update(bmain, 0); BLO_blendhandle_close(bh); @@ -2954,15 +2954,17 @@ static int redraw_timer_exec(bContext *C, wmOperator *op) redraw_timer_window_swap(C); } else if (type==4) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); if(a & 1) scene->r.cfra--; else scene->r.cfra++; - scene_update_for_newframe(scene, scene->lay); + scene_update_for_newframe(bmain, scene, scene->lay); } else if (type==5) { /* play anim, return on same frame as started with */ + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); int tot= (scene->r.efra - scene->r.sfra) + 1; @@ -2972,7 +2974,7 @@ static int redraw_timer_exec(bContext *C, wmOperator *op) if(scene->r.cfra > scene->r.efra) scene->r.cfra= scene->r.sfra; - scene_update_for_newframe(scene, scene->lay); + scene_update_for_newframe(bmain, scene, scene->lay); redraw_timer_window_swap(C); } } diff --git a/source/creator/creator.c b/source/creator/creator.c index fbe9d100b14..8deb66d7f1f 100644 --- a/source/creator/creator.c +++ b/source/creator/creator.c @@ -680,6 +680,7 @@ static int render_frame(int argc, char **argv, void *data) { bContext *C = data; if (CTX_data_scene(C)) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); if (argc > 1) { @@ -703,7 +704,7 @@ static int render_frame(int argc, char **argv, void *data) frame = MIN2(MAXFRAME, MAX2(MINAFRAME, frame)); - RE_BlenderAnim(re, scene, scene->lay, frame, frame, scene->r.frame_step, &reports); + RE_BlenderAnim(re, bmain, scene, scene->lay, frame, frame, scene->r.frame_step, &reports); return 1; } else { printf("\nError: frame number must follow '-f / --render-frame'.\n"); @@ -719,11 +720,12 @@ static int render_animation(int argc, char **argv, void *data) { bContext *C = data; if (CTX_data_scene(C)) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Render *re= RE_NewRender(scene->id.name); ReportList reports; BKE_reports_init(&reports, RPT_PRINT); - RE_BlenderAnim(re, scene, scene->lay, scene->r.sfra, scene->r.efra, scene->r.frame_step, &reports); + RE_BlenderAnim(re, bmain, scene, scene->lay, scene->r.sfra, scene->r.efra, scene->r.frame_step, &reports); } else { printf("\nError: no blend loaded. cannot use '-a'.\n"); } @@ -734,7 +736,7 @@ static int set_scene(int argc, char **argv, void *data) { if(argc > 1) { bContext *C= data; - Scene *sce= set_scene_name(argv[1]); + Scene *sce= set_scene_name(CTX_data_main(C), argv[1]); if(sce) { CTX_data_scene_set(C, sce); } diff --git a/source/darwin/Makefile b/source/darwin/Makefile index 9095f1d8e92..7e65d399d44 100644 --- a/source/darwin/Makefile +++ b/source/darwin/Makefile @@ -47,9 +47,9 @@ ifeq ($(APPLICATION), blender) @echo "---> copying message files" @cp -R $(NANBLENDERHOME)/release/bin/.blender/locale $(DIR)/bin/$(APPLICATION).app/Contents/Resources @echo "---> copying .Blanguages" - @cp $(NANBLENDERHOME)/bin/.blender/.Blanguages $(DIR)/bin/$(APPLICATION).app/Contents/Resources + @cp $(NANBLENDERHOME)/release/bin/.blender/.Blanguages $(DIR)/bin/$(APPLICATION).app/Contents/Resources @echo "---> copying .blender/ scripts" - @cp -R $(NANBLENDERHOME)/bin/.blender $(DIR)/bin/$(APPLICATION).app/Contents/MacOS + @cp -R $(NANBLENDERHOME)/release/bin/.blender $(DIR)/bin/$(APPLICATION).app/Contents/MacOS @cp -R $(NANBLENDERHOME)/release/scripts $(DIR)/bin/$(APPLICATION).app/Contents/MacOS/.blender/ @echo "---> copying python modules" @mkdir $(DIR)/bin/$(APPLICATION).app/Contents/MacOS/.blender/python diff --git a/source/gameengine/Converter/BL_ArmatureChannel.cpp b/source/gameengine/Converter/BL_ArmatureChannel.cpp index 2ce29a76b56..424c8441c0e 100644 --- a/source/gameengine/Converter/BL_ArmatureChannel.cpp +++ b/source/gameengine/Converter/BL_ArmatureChannel.cpp @@ -120,7 +120,7 @@ PyAttributeDef BL_ArmatureChannel::AttributesPtr[] = { KX_PYATTRIBUTE_FLOAT_VECTOR_RW("location",-FLT_MAX,FLT_MAX,bPoseChannel,loc,3), KX_PYATTRIBUTE_FLOAT_VECTOR_RW("scale",-FLT_MAX,FLT_MAX,bPoseChannel,size,3), KX_PYATTRIBUTE_FLOAT_VECTOR_RW("rotation_quaternion",-1.0f,1.0f,bPoseChannel,quat,4), - KX_PYATTRIBUTE_FLOAT_VECTOR_RW("rotaion_euler",-10.f,10.f,bPoseChannel,eul,3), + KX_PYATTRIBUTE_FLOAT_VECTOR_RW("rotation_euler",-10.f,10.f,bPoseChannel,eul,3), KX_PYATTRIBUTE_SHORT_RW("rotation_mode",0,ROT_MODE_MAX-1,false,bPoseChannel,rotmode), KX_PYATTRIBUTE_FLOAT_MATRIX_RO("channel_matrix",bPoseChannel,chan_mat,4), KX_PYATTRIBUTE_FLOAT_MATRIX_RO("pose_matrix",bPoseChannel,pose_mat,4), diff --git a/source/gameengine/PyDoc/bge.types.rst b/source/gameengine/PyDoc/bge.types.rst index e0ace6ad85b..028b4fa72f3 100644 --- a/source/gameengine/PyDoc/bge.types.rst +++ b/source/gameengine/PyDoc/bge.types.rst @@ -4927,7 +4927,7 @@ Game Engine bge.types Module Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`) - .. attribute:: rotation + .. attribute:: rotation_quaternion rotation of the bone relative to its parent expressed as a quaternion, read-write. @@ -4941,7 +4941,7 @@ Game Engine bge.types Module Changing this field has no immediate effect, the pose is updated when the armature is updated during the graphic render (see :data:`BL_ArmatureObject.update`) - .. attribute:: euler_rotation + .. attribute:: rotation_euler rotation of the bone relative to its parent expressed as a set of euler angles, read-write. |