diff --git a/intern/cycles/blender/blender_session.cpp b/intern/cycles/blender/blender_session.cpp index 31b096956325..dbe87ce2b13c 100644 --- a/intern/cycles/blender/blender_session.cpp +++ b/intern/cycles/blender/blender_session.cpp @@ -168,9 +168,13 @@ void BlenderSession::create_session() void BlenderSession::reset_session(BL::BlendData &b_data, BL::Depsgraph &b_depsgraph) { + /* Update data, scene and depsgraph pointers. These can change after undo. */ this->b_data = b_data; this->b_depsgraph = b_depsgraph; this->b_scene = b_depsgraph.scene_eval(); + if (sync) { + sync->reset(this->b_data, this->b_scene); + } if (preview_osl) { PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles"); diff --git a/intern/cycles/blender/blender_sync.cpp b/intern/cycles/blender/blender_sync.cpp index f16305e737d1..2605799f5933 100644 --- a/intern/cycles/blender/blender_sync.cpp +++ b/intern/cycles/blender/blender_sync.cpp @@ -78,6 +78,14 @@ BlenderSync::~BlenderSync() { } +void BlenderSync::reset(BL::BlendData &b_data, BL::Scene &b_scene) +{ + /* Update data and scene pointers in case they change in session reset, + * for example after undo. */ + this->b_data = b_data; + this->b_scene = b_scene; +} + /* Sync */ void BlenderSync::sync_recalc(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d) diff --git a/intern/cycles/blender/blender_sync.h b/intern/cycles/blender/blender_sync.h index 650b4f5bb4e0..f0ea5194c290 100644 --- a/intern/cycles/blender/blender_sync.h +++ b/intern/cycles/blender/blender_sync.h @@ -61,6 +61,8 @@ class BlenderSync { Progress &progress); ~BlenderSync(); + void reset(BL::BlendData &b_data, BL::Scene &b_scene); + /* sync */ void sync_recalc(BL::Depsgraph &b_depsgraph, BL::SpaceView3D &b_v3d); void sync_data(BL::RenderSettings &b_render, diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h index 75527d50c6af..c7737392e7bc 100644 --- a/intern/ghost/GHOST_C-api.h +++ b/intern/ghost/GHOST_C-api.h @@ -435,7 +435,7 @@ extern GHOST_TSuccess GHOST_SetCursorGrab(GHOST_WindowHandle windowhandle, ***************************************************************************************/ /** - * Returns the state of a modifier key (ouside the message queue). + * Returns the state of a modifier key (outside the message queue). * \param systemhandle The handle to the system * \param mask The modifier key state to retrieve. * \param isDown Pointer to return modifier state in. @@ -446,7 +446,7 @@ extern GHOST_TSuccess GHOST_GetModifierKeyState(GHOST_SystemHandle systemhandle, int *isDown); /** - * Returns the state of a mouse button (ouside the message queue). + * Returns the state of a mouse button (outside the message queue). * \param systemhandle The handle to the system * \param mask The button state to retrieve. * \param isDown Pointer to return button state in. diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h index 9b619f5c6844..33600fd1219a 100644 --- a/intern/ghost/GHOST_ISystem.h +++ b/intern/ghost/GHOST_ISystem.h @@ -382,7 +382,7 @@ class GHOST_ISystem { ***************************************************************************************/ /** - * Returns the state of a modifier key (ouside the message queue). + * Returns the state of a modifier key (outside the message queue). * \param mask The modifier key state to retrieve. * \param isDown The state of a modifier key (true == pressed). * \return Indication of success. @@ -390,7 +390,7 @@ class GHOST_ISystem { virtual GHOST_TSuccess getModifierKeyState(GHOST_TModifierKeyMask mask, bool &isDown) const = 0; /** - * Returns the state of a mouse button (ouside the message queue). + * Returns the state of a mouse button (outside the message queue). * \param mask The button state to retrieve. * \param isDown Button state. * \return Indication of success. diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h index 0f58be49dfff..c2d712c11cd6 100644 --- a/intern/ghost/intern/GHOST_System.h +++ b/intern/ghost/intern/GHOST_System.h @@ -219,7 +219,7 @@ class GHOST_System : public GHOST_ISystem { ***************************************************************************************/ /** - * Returns the state of a modifier key (ouside the message queue). + * Returns the state of a modifier key (outside the message queue). * \param mask The modifier key state to retrieve. * \param isDown The state of a modifier key (true == pressed). * \return Indication of success. @@ -227,7 +227,7 @@ class GHOST_System : public GHOST_ISystem { GHOST_TSuccess getModifierKeyState(GHOST_TModifierKeyMask mask, bool &isDown) const; /** - * Returns the state of a mouse button (ouside the message queue). + * Returns the state of a mouse button (outside the message queue). * \param mask The button state to retrieve. * \param isDown Button state. * \return Indication of success. @@ -247,8 +247,8 @@ class GHOST_System : public GHOST_ISystem { ***************************************************************************************/ /** - * Sets 3D mouse deadzone - * \param deadzone: Deadzone of the 3D mouse (both for rotation and pan) relative to full range + * Sets 3D mouse dead-zone + * \param deadzone: Dead-zone of the 3D mouse (both for rotation and pan) relative to full range. */ void setNDOFDeadZone(float deadzone); #endif @@ -295,7 +295,7 @@ class GHOST_System : public GHOST_ISystem { virtual GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys &keys) const = 0; /** - * Returns the state of the mouse buttons (ouside the message queue). + * Returns the state of the mouse buttons (outside the message queue). * \param buttons The state of the buttons. * \return Indication of success. */ diff --git a/intern/ghost/intern/GHOST_SystemCocoa.h b/intern/ghost/intern/GHOST_SystemCocoa.h index d058697470a8..bbd6f1d89957 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.h +++ b/intern/ghost/intern/GHOST_SystemCocoa.h @@ -198,7 +198,7 @@ class GHOST_SystemCocoa : public GHOST_System { GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys &keys) const; /** - * Returns the state of the mouse buttons (ouside the message queue). + * Returns the state of the mouse buttons (outside the message queue). * \param buttons The state of the buttons. * \return Indication of success. */ diff --git a/intern/ghost/intern/GHOST_SystemWin32.h b/intern/ghost/intern/GHOST_SystemWin32.h index b23f907608cb..6b7901c2ade1 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.h +++ b/intern/ghost/intern/GHOST_SystemWin32.h @@ -212,7 +212,7 @@ class GHOST_SystemWin32 : public GHOST_System { GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys &keys) const; /** - * Returns the state of the mouse buttons (ouside the message queue). + * Returns the state of the mouse buttons (outside the message queue). * \param buttons The state of the buttons. * \return Indication of success. */ diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h index bb01ef7e0cc2..5888605ec95e 100644 --- a/intern/ghost/intern/GHOST_SystemX11.h +++ b/intern/ghost/intern/GHOST_SystemX11.h @@ -182,7 +182,7 @@ class GHOST_SystemX11 : public GHOST_System { GHOST_TSuccess getModifierKeys(GHOST_ModifierKeys &keys) const; /** - * Returns the state of the mouse buttons (ouside the message queue). + * Returns the state of the mouse buttons (outside the message queue). * \param buttons The state of the buttons. * \return Indication of success. */ @@ -211,7 +211,7 @@ class GHOST_SystemX11 : public GHOST_System { } #endif - /* Helped function for get data from the clipboard. */ + /** Helped function for get data from the clipboard. */ void getClipboard_xcout(const XEvent *evt, Atom sel, Atom target, @@ -337,7 +337,7 @@ class GHOST_SystemX11 : public GHOST_System { private: Display *m_display; - /* Use for scancode lookups. */ + /** Use for scan-code look-ups. */ XkbDescRec *m_xkb_descr; #if defined(WITH_X11_XINPUT) && defined(X_HAVE_UTF8_STRING) @@ -349,20 +349,22 @@ class GHOST_SystemX11 : public GHOST_System { std::vector m_xtablets; #endif - /// The vector of windows that need to be updated. + /** The vector of windows that need to be updated. */ std::vector m_dirty_windows; - /// Start time at initialization. + /** Start time at initialization. */ GHOST_TUns64 m_start_time; - /// A vector of keyboard key masks + /** A vector of keyboard key masks. */ char m_keyboard_vector[32]; - /* to prevent multiple warp, we store the time of the last warp event - * and stop accumulating all events generated before that */ + /** + * To prevent multiple warp, we store the time of the last warp event + * and stop accumulating all events generated before that. + */ Time m_last_warp; - /* detect autorepeat glitch */ + /* Detect auto-repeat glitch. */ unsigned int m_last_release_keycode; Time m_last_release_time; diff --git a/release/scripts/modules/bpy_types.py b/release/scripts/modules/bpy_types.py index dfc58c2700ae..7931650abe6f 100644 --- a/release/scripts/modules/bpy_types.py +++ b/release/scripts/modules/bpy_types.py @@ -25,12 +25,7 @@ StructMetaPropGroup = bpy_types.bpy_struct_meta_idprop # StructRNA = bpy_types.Struct -bpy_types.BlendDataLibraries.load = _bpy._library_load -bpy_types.BlendDataLibraries.write = _bpy._library_write -bpy_types.BlendData.user_map = _bpy._rna_id_collection_user_map -bpy_types.BlendData.batch_remove = _bpy._rna_id_collection_batch_remove -bpy_types.BlendData.orphans_purge = _bpy._rna_id_collection_orphans_purge - +# Note that methods extended in C are defined in: 'bpy_rna_types_capi.c' class Context(StructRNA): __slots__ = () @@ -118,14 +113,19 @@ class Object(bpy_types.ID): @property def children(self): - """All the children of this object. Warning: takes O(len(bpy.data.objects)) time.""" + """All the children of this object. + + .. note:: Takes ``O(len(bpy.data.objects))`` time.""" import bpy return tuple(child for child in bpy.data.objects if child.parent == self) @property def users_collection(self): - """The collections this object is in. Warning: takes O(len(bpy.data.collections) + len(bpy.data.scenes)) time.""" + """ + The collections this object is in. + + .. note:: Takes ``O(len(bpy.data.collections) + len(bpy.data.scenes))`` time.""" import bpy return ( tuple( @@ -139,7 +139,9 @@ def users_collection(self): @property def users_scene(self): - """The scenes this object is in. Warning: takes O(len(bpy.data.scenes) * len(bpy.data.objects)) time.""" + """The scenes this object is in. + + .. note:: Takes ``O(len(bpy.data.scenes) * len(bpy.data.objects))`` time.""" import bpy return tuple(scene for scene in bpy.data.scenes if self in scene.objects[:]) @@ -292,12 +294,16 @@ def vector(self): @property def children(self): - """A list of all the bones children. Warning: takes O(len(bones)) time.""" + """A list of all the bones children. + + .. note:: Takes ``O(len(bones))`` time.""" return [child for child in self._other_bones if child.parent == self] @property def children_recursive(self): - """A list of all children from this bone. Warning: takes O(len(bones)**2) time.""" + """A list of all children from this bone. + + .. note:: Takes ``O(len(bones)**2)`` time.""" bones_children = [] for bone in self._other_bones: index = bone.parent_index(self) @@ -314,7 +320,9 @@ def children_recursive_basename(self): Returns a chain of children with the same base name as this bone. Only direct chains are supported, forks caused by multiple children with matching base names will terminate the function - and not be returned. Warning: takes O(len(bones)**2) time. + and not be returned. + + .. note:: Takes ``O(len(bones)**2)`` time. """ basename = self.basename chain = [] @@ -1017,7 +1025,10 @@ class NodeSocket(StructRNA, metaclass=RNAMetaPropGroup): @property def links(self): - """List of node links from or to this socket. Warning: takes O(len(nodetree.links)) time.""" + """ + List of node links from or to this socket. + + .. note:: Takes ``O(len(nodetree.links))`` time.""" return tuple( link for link in self.id_data.links if (link.from_socket == self or diff --git a/release/scripts/modules/rna_info.py b/release/scripts/modules/rna_info.py index 71d7ee5a7bc6..964eff0e572b 100644 --- a/release/scripts/modules/rna_info.py +++ b/release/scripts/modules/rna_info.py @@ -303,7 +303,9 @@ def build(self): for dim in self.array_dimensions[::-1]: if dim != 0: self.default = tuple(zip(*((iter(self.default),) * dim))) - self.default_str = tuple("(%s)" % ", ".join(s for s in b) for b in zip(*((iter(self.default_str),) * dim))) + self.default_str = tuple( + "(%s)" % ", ".join(s for s in b) for b in zip(*((iter(self.default_str),) * dim)) + ) self.default_str = self.default_str[0] elif self.type == "enum" and self.is_enum_flag: self.default = getattr(rna_prop, "default_flag", set()) @@ -349,7 +351,9 @@ def get_type_description(self, as_ret=False, as_arg=False, class_fmt="%s", colle type_str += self.type if self.array_length: if self.array_dimensions[1] != 0: - type_str += " multi-dimensional array of %s items" % (" * ".join(str(d) for d in self.array_dimensions if d != 0)) + type_str += " multi-dimensional array of %s items" % ( + " * ".join(str(d) for d in self.array_dimensions if d != 0) + ) else: type_str += " array of %d items" % (self.array_length) diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py index bd03a2673b91..47538e1396d8 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -4975,14 +4975,14 @@ def km_view3d_interactive_add_tool_modal_map(_params): ) items.extend([ - ("FIXED_ASPECT_ON", {"type": 'LEFT_ALT', "value": 'PRESS', "any": True}, None), - ("FIXED_ASPECT_OFF", {"type": 'LEFT_ALT', "value": 'RELEASE', "any": True}, None), - ("FIXED_ASPECT_ON", {"type": 'RIGHT_ALT', "value": 'PRESS', "any": True}, None), - ("FIXED_ASPECT_OFF", {"type": 'RIGHT_ALT', "value": 'RELEASE', "any": True}, None), - ("PIVOT_CENTER_ON", {"type": 'LEFT_SHIFT', "value": 'PRESS', "any": True}, None), - ("PIVOT_CENTER_OFF", {"type": 'LEFT_SHIFT', "value": 'RELEASE', "any": True}, None), - ("PIVOT_CENTER_ON", {"type": 'RIGHT_SHIFT', "value": 'PRESS', "any": True}, None), - ("PIVOT_CENTER_OFF", {"type": 'RIGHT_SHIFT', "value": 'RELEASE', "any": True}, None), + ("PIVOT_CENTER_ON", {"type": 'LEFT_ALT', "value": 'PRESS', "any": True}, None), + ("PIVOT_CENTER_OFF", {"type": 'LEFT_ALT', "value": 'RELEASE', "any": True}, None), + ("PIVOT_CENTER_ON", {"type": 'RIGHT_ALT', "value": 'PRESS', "any": True}, None), + ("PIVOT_CENTER_OFF", {"type": 'RIGHT_ALT', "value": 'RELEASE', "any": True}, None), + ("FIXED_ASPECT_ON", {"type": 'LEFT_SHIFT', "value": 'PRESS', "any": True}, None), + ("FIXED_ASPECT_OFF", {"type": 'LEFT_SHIFT', "value": 'RELEASE', "any": True}, None), + ("FIXED_ASPECT_ON", {"type": 'RIGHT_SHIFT', "value": 'PRESS', "any": True}, None), + ("FIXED_ASPECT_OFF", {"type": 'RIGHT_SHIFT', "value": 'RELEASE', "any": True}, None), ("SNAP_ON", {"type": 'LEFT_CTRL', "value": 'PRESS', "any": True}, None), ("SNAP_OFF", {"type": 'LEFT_CTRL', "value": 'RELEASE', "any": True}, None), ("SNAP_ON", {"type": 'RIGHT_CTRL', "value": 'PRESS', "any": True}, None), @@ -5907,7 +5907,6 @@ def km_3d_view_tool_interactive_add(params): "3D View Tool: Object, Add Primitive", {"space_type": 'VIEW_3D', "region_type": 'WINDOW'}, {"items": [ - ("view3d.cursor3d", {"type": params.tool_mouse, "value": 'CLICK'}, None), ("view3d.interactive_add", {"type": params.tool_tweak, "value": 'ANY', "any": True}, {"properties": [("wait_for_input", False)]}), ]}, diff --git a/release/scripts/startup/bl_operators/uvcalc_follow_active.py b/release/scripts/startup/bl_operators/uvcalc_follow_active.py index 83d451fbc890..6f4412386069 100644 --- a/release/scripts/startup/bl_operators/uvcalc_follow_active.py +++ b/release/scripts/startup/bl_operators/uvcalc_follow_active.py @@ -18,9 +18,6 @@ # -# for full docs see... -# https://docs.blender.org/manual/en/latest/editors/uv_image/uv/editing/unwrapping/mapping_types.html#follow-active-quads - import bpy from bpy.types import Operator diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py index dbe3ced04b38..5fadb31c83f8 100644 --- a/release/scripts/startup/bl_ui/properties_paint_common.py +++ b/release/scripts/startup/bl_ui/properties_paint_common.py @@ -125,7 +125,7 @@ def prop_unified( if unified_name and not header: # NOTE: We don't draw UnifiedPaintSettings in the header to reduce clutter. D5928#136281 - row.prop(ups, unified_name, text="", icon="BRUSHES_ALL") + row.prop(ups, unified_name, text="", icon='BRUSHES_ALL') return row diff --git a/release/scripts/startup/bl_ui/space_sequencer.py b/release/scripts/startup/bl_ui/space_sequencer.py index ca25c29960c9..41c220f7ee42 100644 --- a/release/scripts/startup/bl_ui/space_sequencer.py +++ b/release/scripts/startup/bl_ui/space_sequencer.py @@ -307,12 +307,15 @@ def draw(self, context): layout.separator() layout.operator_context = 'INVOKE_DEFAULT' - layout.prop(st, "show_seconds") layout.prop(st, "show_locked_time") + + layout.separator() + layout.prop(st, "show_seconds") layout.prop(st, "show_strip_offset") layout.prop(st, "show_fcurves") - layout.separator() layout.prop(st, "show_markers") + layout.menu("SEQUENCER_MT_view_cache", text="Show Cache") + layout.prop_menu_enum(st, "waveform_display_type", text="Show Waveforms") if is_preview: layout.separator() @@ -324,12 +327,6 @@ def draw(self, context): elif st.display_mode == 'WAVEFORM': layout.prop(st, "show_separate_color", text="Show Separate Color Channels") - if is_sequencer_view: - layout.separator() - - layout.menu("SEQUENCER_MT_view_cache") - layout.prop_menu_enum(st, "waveform_display_type") - layout.separator() layout.operator("render.opengl", text="Sequence Render Image", icon='RENDER_STILL').sequencer = True @@ -338,7 +335,7 @@ def draw(self, context): props.sequencer = True layout.separator() - layout.operator("sequencer.export_subtitles", text="Export Subtitles", icon="EXPORT") + layout.operator("sequencer.export_subtitles", text="Export Subtitles", icon='EXPORT') layout.separator() @@ -1033,10 +1030,14 @@ def draw(self, context): if strip.input_count > 0: col = layout.column() - col.enabled = False - col.prop(strip, "input_1") + row = col.row() + row.prop(strip, "input_1") + if strip.input_count > 1: - col.prop(strip, "input_2") + row.operator("sequencer.swap_inputs", text="", icon='SORT_ASC') + row = col.row() + row.prop(strip, "input_2") + row.operator("sequencer.swap_inputs", text="", icon='SORT_DESC') strip_type = strip.type @@ -1195,31 +1196,14 @@ def draw(self, context): col.prop(strip, "font_size") col.prop(strip, "color") - -class SEQUENCER_PT_effect_text_style_shadow(SequencerButtonsPanel, Panel): - bl_label = "Shadow" - bl_parent_id = "SEQUENCER_PT_effect_text_style" - bl_options = {'DEFAULT_CLOSED'} - bl_category = "Strip" - - @classmethod - def poll(cls, context): - strip = act_strip(context) - return strip.type != 'SOUND' - - def draw_header(self, context): - strip = act_strip(context) - self.layout.prop(strip, "use_shadow", text="") - - def draw(self, context): - strip = act_strip(context) - layout = self.layout - layout.use_property_split = True - - layout.active = strip.use_shadow and (not strip.mute) - - col = layout.column(align=True) - col.prop(strip, "shadow_color", text="Color") + row = layout.row(align=True, heading="Shadow") + row.use_property_decorate = False + sub = row.row(align=True) + sub.prop(strip, "use_shadow", text="") + subsub = sub.row(align=True) + subsub.active = strip.use_shadow and (not strip.mute) + subsub.prop(strip, "shadow_color", text="") + row.prop_decorator(strip, "shadow_color") class SEQUENCER_PT_source(SequencerButtonsPanel, Panel): @@ -1931,7 +1915,7 @@ def draw(self, context): class SEQUENCER_PT_preview(SequencerButtonsPanel_Output, Panel): - bl_label = "Scene Preview/Render" + bl_label = "Scene Strip Display" bl_space_type = 'SEQUENCE_EDITOR' bl_region_type = 'UI' bl_options = {'DEFAULT_CLOSED'} @@ -1945,7 +1929,7 @@ def draw(self, context): render = context.scene.render col = layout.column() - col.prop(render, "sequencer_gl_preview", text="Preview Shading") + col.prop(render, "sequencer_gl_preview", text="Shading") if render.sequencer_gl_preview in {'SOLID', 'WIREFRAME'}: col.prop(render, "use_sequencer_override_scene_strip") @@ -2232,10 +2216,16 @@ class SEQUENCER_PT_custom_props(SequencerButtonsPanel, PropertyPanel, Panel): SEQUENCER_MT_strip_input, SEQUENCER_MT_strip_lock_mute, SEQUENCER_MT_context_menu, + SEQUENCER_PT_active_tool, SEQUENCER_PT_strip, SEQUENCER_PT_effect, + SEQUENCER_PT_scene, + SEQUENCER_PT_mask, + SEQUENCER_PT_effect_text_style, + SEQUENCER_PT_effect_text_layout, + SEQUENCER_PT_adjust, SEQUENCER_PT_adjust_comp, SEQUENCER_PT_adjust_transform, @@ -2245,12 +2235,6 @@ class SEQUENCER_PT_custom_props(SequencerButtonsPanel, PropertyPanel, Panel): SEQUENCER_PT_adjust_color, SEQUENCER_PT_adjust_sound, - SEQUENCER_PT_scene, - SEQUENCER_PT_mask, - SEQUENCER_PT_effect_text_style, - SEQUENCER_PT_effect_text_layout, - SEQUENCER_PT_effect_text_style_shadow, - SEQUENCER_PT_time, SEQUENCER_PT_source, @@ -2263,11 +2247,11 @@ class SEQUENCER_PT_custom_props(SequencerButtonsPanel, PropertyPanel, Panel): SEQUENCER_PT_custom_props, - SEQUENCER_PT_preview, SEQUENCER_PT_view, SEQUENCER_PT_frame_overlay, SEQUENCER_PT_view_safe_areas, SEQUENCER_PT_view_safe_areas_center_cut, + SEQUENCER_PT_preview, SEQUENCER_PT_annotation, SEQUENCER_PT_annotation_onion, diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 4e389e847098..83f216873ff3 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -736,7 +736,12 @@ def draw(self, context): row.prop(tool_settings, "use_gpencil_vertex_select_mask_stroke", text="") row.prop(tool_settings, "use_gpencil_vertex_select_mask_segment", text="") - if gpd.use_stroke_edit_mode or gpd.is_stroke_sculpt_mode or gpd.is_stroke_weight_mode or gpd.is_stroke_vertex_mode: + if ( + gpd.use_stroke_edit_mode or + gpd.is_stroke_sculpt_mode or + gpd.is_stroke_weight_mode or + gpd.is_stroke_vertex_mode + ): row = layout.row(align=True) row.prop(gpd, "use_multiedit", text="", icon='GP_MULTIFRAME_EDITING') diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h index eceb161c4bed..8ea84327f030 100644 --- a/source/blender/blenkernel/BKE_screen.h +++ b/source/blender/blenkernel/BKE_screen.h @@ -236,17 +236,17 @@ typedef struct PanelType { /** Reorder function, called when drag and drop finishes. */ void (*reorder)(struct bContext *C, struct Panel *pa, int new_index); /** - * Get the panel and subpanel's expansion state from the expansion flag in the corresponding data - * item. Called on draw updates. - * \note Subpanels are indexed in depth first order, the visualorder you would see if all panels - * were expanded. + * Get the panel and sub-panel's expansion state from the expansion flag in the corresponding + * data item. Called on draw updates. + * \note Sub-panels are indexed in depth first order, + * the visual order you would see if all panels were expanded. */ short (*get_list_data_expand_flag)(const struct bContext *C, struct Panel *pa); /** - * Set the expansion bitfield from the closed / open state of this panel and its subpanels. + * Set the expansion bit-field from the closed / open state of this panel and its sub-panels. * Called when the expansion state of the panel changes with user input. - * \note Subpanels are indexed in depth first order, the visual order you would see if all panels - * were expanded. + * \note Sub-panels are indexed in depth first order, + * the visual order you would see if all panels were expanded. */ void (*set_list_data_expand_flag)(const struct bContext *C, struct Panel *pa, short expand_flag); diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index f3cc17f46f64..dae8a59fe430 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -2704,15 +2704,16 @@ static void dynamic_paint_find_island_border(const DynamicPaintCreateUVSurfaceDa } } + const int final_tri_index = tempPoints[final_index].tri_index; /* If found pixel still lies on wrong face ( mesh has smaller than pixel sized faces) */ - if (tempPoints[final_index].tri_index != target_tri) { + if (final_tri_index != target_tri && final_tri_index != -1) { /* Check if it's close enough to likely touch the intended triangle. Any triangle * becomes thinner than a pixel at its vertices, so robustness requires some margin. */ const float final_pt[2] = {((final_index % w) + 0.5f) / w, ((final_index / w) + 0.5f) / h}; const float threshold = square_f(0.7f) / (w * h); - if (dist_squared_to_looptri_uv_edges( - mlooptri, mloopuv, tempPoints[final_index].tri_index, final_pt) > threshold) { + if (dist_squared_to_looptri_uv_edges(mlooptri, mloopuv, final_tri_index, final_pt) > + threshold) { continue; } } diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index 0eaf7cf2f416..f03bf60817fe 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -694,14 +694,14 @@ int BKE_layer_collection_findindex(ViewLayer *view_layer, const LayerCollection * in at least one layer collection. That list is also synchronized here, and * stores state like selection. */ -static short layer_collection_sync(ViewLayer *view_layer, - const ListBase *lb_scene, - ListBase *lb_layer, - ListBase *new_object_bases, - short parent_exclude, - short parent_restrict, - short parent_layer_restrict, - unsigned short parent_local_collections_bits) +static void layer_collection_sync(ViewLayer *view_layer, + const ListBase *lb_scene, + ListBase *lb_layer, + ListBase *new_object_bases, + short parent_exclude, + short parent_restrict, + short parent_layer_restrict, + unsigned short parent_local_collections_bits) { /* TODO: support recovery after removal of intermediate collections, reordering, .. * For local edits we can make editing operating do the appropriate thing, but for @@ -732,7 +732,6 @@ static short layer_collection_sync(ViewLayer *view_layer, /* Add layer collections for any new scene collections, and ensure order is the same. */ ListBase new_lb_layer = {NULL, NULL}; - short runtime_flag = 0; LISTBASE_FOREACH (const CollectionChild *, child, lb_scene) { Collection *collection = child->collection; @@ -763,23 +762,20 @@ static short layer_collection_sync(ViewLayer *view_layer, } /* Sync child collections. */ - short child_runtime_flag = layer_collection_sync(view_layer, - &collection->children, - &lc->layer_collections, - new_object_bases, - lc->flag, - child_restrict, - child_layer_restrict, - local_collections_bits); + layer_collection_sync(view_layer, + &collection->children, + &lc->layer_collections, + new_object_bases, + lc->flag, + child_restrict, + child_layer_restrict, + local_collections_bits); /* Layer collection exclude is not inherited. */ + lc->runtime_flag = 0; if (lc->flag & LAYER_COLLECTION_EXCLUDE) { - lc->runtime_flag = 0; continue; } - else { - lc->runtime_flag = child_runtime_flag; - } /* We separate restrict viewport and visible view layer because a layer collection can be * hidden in the view layer yet (locally) visible in a viewport (if it is not restricted).*/ @@ -846,15 +842,11 @@ static short layer_collection_sync(ViewLayer *view_layer, lc->runtime_flag |= LAYER_COLLECTION_HAS_OBJECTS; } - - runtime_flag |= lc->runtime_flag; } /* Replace layer collection list with new one. */ *lb_layer = new_lb_layer; BLI_assert(BLI_listbase_count(lb_scene) == BLI_listbase_count(lb_layer)); - - return runtime_flag; } /** diff --git a/source/blender/draw/engines/eevee/eevee_lightprobes.c b/source/blender/draw/engines/eevee/eevee_lightprobes.c index 5690fcec35a4..30b08bb57e87 100644 --- a/source/blender/draw/engines/eevee/eevee_lightprobes.c +++ b/source/blender/draw/engines/eevee/eevee_lightprobes.c @@ -403,7 +403,7 @@ void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedat DRW_shgroup_uniform_texture_ref(grp, "probeCubes", &lcache->cube_tx.tex); DRW_shgroup_uniform_block(grp, "probe_block", sldata->probe_ubo); DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo); - DRW_shgroup_uniform_vec3(grp, "screen_vecs[0]", DRW_viewport_screenvecs_get(), 2); + DRW_shgroup_uniform_vec3(grp, "screen_vecs", DRW_viewport_screenvecs_get(), 2); DRW_shgroup_uniform_float_copy( grp, "sphere_size", scene_eval->eevee.gi_cubemap_draw_size * 0.5f); /* TODO (fclem) get rid of those UBO. */ @@ -428,7 +428,7 @@ void EEVEE_lightprobes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedat DRW_shgroup_uniform_vec3(shgrp, "increment_x", egrid->increment_x, 1); DRW_shgroup_uniform_vec3(shgrp, "increment_y", egrid->increment_y, 1); DRW_shgroup_uniform_vec3(shgrp, "increment_z", egrid->increment_z, 1); - DRW_shgroup_uniform_vec3(shgrp, "screen_vecs[0]", DRW_viewport_screenvecs_get(), 2); + DRW_shgroup_uniform_vec3(shgrp, "screen_vecs", DRW_viewport_screenvecs_get(), 2); DRW_shgroup_uniform_texture_ref(shgrp, "irradianceGrid", &lcache->grid_tx.tex); DRW_shgroup_uniform_float_copy( shgrp, "sphere_size", scene_eval->eevee.gi_irradiance_draw_size * 0.5f); diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c index 50e4e8d2ec4d..4f586a1e9f3a 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine.c +++ b/source/blender/draw/engines/gpencil/gpencil_engine.c @@ -292,7 +292,7 @@ void GPENCIL_cache_init(void *ved) grp = DRW_shgroup_create(sh, psl->merge_depth_ps); DRW_shgroup_uniform_texture_ref(grp, "depthBuf", &pd->depth_tx); DRW_shgroup_uniform_bool(grp, "strokeOrder3d", &pd->is_stroke_order_3d, 1); - DRW_shgroup_uniform_vec4(grp, "gpModelMatrix[0]", pd->object_bound_mat[0], 4); + DRW_shgroup_uniform_vec4(grp, "gpModelMatrix", pd->object_bound_mat[0], 4); DRW_shgroup_call_procedural_triangles(grp, NULL, 1); } { diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl index fb5073b3dc74..1e75f6dd5bb3 100644 --- a/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl +++ b/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl @@ -317,7 +317,7 @@ vec2 safe_normalize_len(vec2 v, out float len) } } -float stroke_thickness_modulate(float thickness) +float stroke_thickness_modulate(float thickness, out float opacity) { /* Modify stroke thickness by object and layer factors.-*/ thickness *= thicknessScale; @@ -333,6 +333,11 @@ float stroke_thickness_modulate(float thickness) /* World space point size. */ thickness *= thicknessWorldScale * ProjectionMatrix[1][1] * sizeViewport.y; } + /* To avoid aliasing artifact, we clamp the line thickness and reduce its opacity. */ + float min_thickness = gl_Position.w * 1.3; + opacity = smoothstep(0.0, gl_Position.w * 1.0, thickness); + thickness = max(min_thickness, thickness); + return thickness; } @@ -414,8 +419,9 @@ void stroke_vertex() vec2 line = safe_normalize_len(ss2 - ss1, line_len); vec2 line_adj = safe_normalize((use_curr) ? (ss1 - ss_adj) : (ss_adj - ss2)); + float small_line_opacity; float thickness = abs((use_curr) ? thickness1 : thickness2); - thickness = stroke_thickness_modulate(thickness); + thickness = stroke_thickness_modulate(thickness, small_line_opacity); finalUvs = vec2(x, y) * 0.5 + 0.5; strokeHardeness = decode_hardness(use_curr ? hardness1 : hardness2); @@ -505,7 +511,7 @@ void stroke_vertex() vec4 stroke_col = MATERIAL(m).stroke_color; float mix_tex = MATERIAL(m).stroke_texture_mix; - color_output(stroke_col, vert_col, vert_strength, mix_tex); + color_output(stroke_col, vert_col, vert_strength * small_line_opacity, mix_tex); matFlag = MATERIAL(m).flag & ~GP_FILL_FLAGS; # endif diff --git a/source/blender/draw/engines/overlay/overlay_extra.c b/source/blender/draw/engines/overlay/overlay_extra.c index 1edc36da6d57..c72ca54f33d3 100644 --- a/source/blender/draw/engines/overlay/overlay_extra.c +++ b/source/blender/draw/engines/overlay/overlay_extra.c @@ -788,10 +788,7 @@ void OVERLAY_lightprobe_cache_populate(OVERLAY_Data *vedata, Object *ob) uint cell_count = prb->grid_resolution_x * prb->grid_resolution_y * prb->grid_resolution_z; DRWShadingGroup *grp = DRW_shgroup_create_sub(vedata->stl->pd->extra_grid_grp); - DRW_shgroup_uniform_vec4_copy(grp, "gridModelMatrix[0]", instdata.mat[0]); - DRW_shgroup_uniform_vec4_copy(grp, "gridModelMatrix[1]", instdata.mat[1]); - DRW_shgroup_uniform_vec4_copy(grp, "gridModelMatrix[2]", instdata.mat[2]); - DRW_shgroup_uniform_vec4_copy(grp, "gridModelMatrix[3]", instdata.mat[3]); + DRW_shgroup_uniform_vec4_array_copy(grp, "gridModelMatrix", instdata.mat, 4); DRW_shgroup_call_procedural_points(grp, NULL, cell_count); } break; diff --git a/source/blender/draw/engines/overlay/overlay_wireframe.c b/source/blender/draw/engines/overlay/overlay_wireframe.c index 309c7c1021a0..cb36f0ed3267 100644 --- a/source/blender/draw/engines/overlay/overlay_wireframe.c +++ b/source/blender/draw/engines/overlay/overlay_wireframe.c @@ -157,10 +157,7 @@ static void wireframe_hair_cache_populate(OVERLAY_Data *vedata, Object *ob, Part const bool use_coloring = true; DRWShadingGroup *shgrp = DRW_shgroup_create_sub(pd->wires_hair_grp[is_xray][use_coloring]); - DRW_shgroup_uniform_vec4_copy(shgrp, "hairDupliMatrix[0]", dupli_mat[0]); - DRW_shgroup_uniform_vec4_copy(shgrp, "hairDupliMatrix[1]", dupli_mat[1]); - DRW_shgroup_uniform_vec4_copy(shgrp, "hairDupliMatrix[2]", dupli_mat[2]); - DRW_shgroup_uniform_vec4_copy(shgrp, "hairDupliMatrix[3]", dupli_mat[3]); + DRW_shgroup_uniform_vec4_array_copy(shgrp, "hairDupliMatrix", dupli_mat, 4); DRW_shgroup_call_no_cull(shgrp, hairs, ob); } diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h index cb4940f70dd4..2e7cd1203d2f 100644 --- a/source/blender/draw/intern/DRW_render.h +++ b/source/blender/draw/intern/DRW_render.h @@ -527,6 +527,10 @@ void DRW_shgroup_uniform_float_copy(DRWShadingGroup *shgroup, const char *name, void DRW_shgroup_uniform_vec2_copy(DRWShadingGroup *shgroup, const char *name, const float *value); void DRW_shgroup_uniform_vec3_copy(DRWShadingGroup *shgroup, const char *name, const float *value); void DRW_shgroup_uniform_vec4_copy(DRWShadingGroup *shgroup, const char *name, const float *value); +void DRW_shgroup_uniform_vec4_array_copy(DRWShadingGroup *shgroup, + const char *name, + const float (*value)[4], + int arraysize); bool DRW_shgroup_is_empty(DRWShadingGroup *shgroup); diff --git a/source/blender/draw/intern/draw_hair.c b/source/blender/draw/intern/draw_hair.c index ed7c72ac1167..27de7cc1c7cd 100644 --- a/source/blender/draw/intern/draw_hair.c +++ b/source/blender/draw/intern/draw_hair.c @@ -240,10 +240,7 @@ static DRWShadingGroup *drw_shgroup_create_hair_procedural_ex(Object *object, DRW_shgroup_uniform_int(shgrp, "hairStrandsRes", &hair_cache->final[subdiv].strands_res, 1); DRW_shgroup_uniform_int_copy(shgrp, "hairThicknessRes", thickness_res); DRW_shgroup_uniform_float_copy(shgrp, "hairRadShape", hair_rad_shape); - DRW_shgroup_uniform_vec4_copy(shgrp, "hairDupliMatrix[0]", dupli_mat[0]); - DRW_shgroup_uniform_vec4_copy(shgrp, "hairDupliMatrix[1]", dupli_mat[1]); - DRW_shgroup_uniform_vec4_copy(shgrp, "hairDupliMatrix[2]", dupli_mat[2]); - DRW_shgroup_uniform_vec4_copy(shgrp, "hairDupliMatrix[3]", dupli_mat[3]); + DRW_shgroup_uniform_vec4_array_copy(shgrp, "hairDupliMatrix", dupli_mat, 4); DRW_shgroup_uniform_float_copy(shgrp, "hairRadRoot", hair_rad_root); DRW_shgroup_uniform_float_copy(shgrp, "hairRadTip", hair_rad_tip); DRW_shgroup_uniform_bool_copy(shgrp, "hairCloseTip", hair_close_tip); diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c index ff27fa958ef6..aa401bcffa5e 100644 --- a/source/blender/draw/intern/draw_manager_data.c +++ b/source/blender/draw/intern/draw_manager_data.c @@ -436,6 +436,24 @@ void DRW_shgroup_uniform_vec4_copy(DRWShadingGroup *shgroup, const char *name, c drw_shgroup_uniform(shgroup, name, DRW_UNIFORM_FLOAT_COPY, value, 4, 1); } +void DRW_shgroup_uniform_vec4_array_copy(DRWShadingGroup *shgroup, + const char *name, + const float (*value)[4], + int arraysize) +{ + int location = GPU_shader_get_uniform_ensure(shgroup->shader, name); + + if (location == -1) { + /* Nice to enable eventually, for now eevee uses uniforms that might not exist. */ + // BLI_assert(0); + return; + } + + for (int i = 0; i < arraysize; i++) { + drw_shgroup_uniform_create_ex(shgroup, location + i, DRW_UNIFORM_FLOAT_COPY, &value[i], 4, 1); + } +} + /** \} */ /* -------------------------------------------------------------------- */ diff --git a/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c index 19370f345fd8..1fdf1160d098 100644 --- a/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c +++ b/source/blender/editors/gizmo_library/gizmo_types/snap3d_gizmo.c @@ -253,7 +253,7 @@ short ED_gizmotypes_snap_3d_update(wmGizmo *gz, } #ifdef USE_SNAP_DETECT_FROM_KEYMAP_HACK - if (wm) { + if (wm && wm->winactive) { gizmo_snap->invert_snap = invert_snap(gz, wm, wm->winactive->eventstate); } diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 2d7b230258bf..0b1ba01cc7eb 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -2077,7 +2077,7 @@ void ED_object_single_users(Main *bmain, /* Duplicating obdata and other IDs may require another update of the collections and objects * pointers, especially regarding drivers and custom props, see T66641. - * Note that this whole scene duplication code and 'make single user' functions have te be + * Note that this whole scene duplication code and 'make single user' functions have to be * rewritten at some point to make use of proper modern ID management code, * but that is no small task. * For now we are doomed to that kind of band-aid to try to cover most of remapping cases. */ diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 77f68eed883e..6f0042385224 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -305,30 +305,28 @@ int area_getorientation(ScrArea *area, ScrArea *sb) ScrVert *sbTR = sb->v3; ScrVert *sbBR = sb->v4; - int tolerance = U.pixelsize * 4; - if (saBL->vec.x == sbBR->vec.x && saTL->vec.x == sbTR->vec.x) { /* area to right of sb = W */ - if ((abs(saBL->vec.y - sbBR->vec.y) <= tolerance) && - (abs(saTL->vec.y - sbTR->vec.y) <= tolerance)) { + if ((abs(saBL->vec.y - sbBR->vec.y) <= AREAJOINTOLERANCE) && + (abs(saTL->vec.y - sbTR->vec.y) <= AREAJOINTOLERANCE)) { return 0; } } else if (saTL->vec.y == sbBL->vec.y && saTR->vec.y == sbBR->vec.y) { /* area to bottom of sb = N */ - if ((abs(saTL->vec.x - sbBL->vec.x) <= tolerance) && - (abs(saTR->vec.x - sbBR->vec.x) <= tolerance)) { + if ((abs(saTL->vec.x - sbBL->vec.x) <= AREAJOINTOLERANCE) && + (abs(saTR->vec.x - sbBR->vec.x) <= AREAJOINTOLERANCE)) { return 1; } } else if (saTR->vec.x == sbTL->vec.x && saBR->vec.x == sbBL->vec.x) { /* area to left of sb = E */ - if ((abs(saTR->vec.y - sbTL->vec.y) <= tolerance) && - (abs(saBR->vec.y - sbBL->vec.y) <= tolerance)) { + if ((abs(saTR->vec.y - sbTL->vec.y) <= AREAJOINTOLERANCE) && + (abs(saBR->vec.y - sbBL->vec.y) <= AREAJOINTOLERANCE)) { return 2; } } else if (saBL->vec.y == sbTL->vec.y && saBR->vec.y == sbTR->vec.y) { /* area on top of sb = S*/ - if ((abs(saBL->vec.x - sbTL->vec.x) <= tolerance) && - (abs(saBR->vec.x - sbTR->vec.x) <= tolerance)) { + if ((abs(saBL->vec.x - sbTL->vec.x) <= AREAJOINTOLERANCE) && + (abs(saBR->vec.x - sbTR->vec.x) <= AREAJOINTOLERANCE)) { return 3; } } @@ -336,6 +334,69 @@ int area_getorientation(ScrArea *area, ScrArea *sb) return -1; } +/* Screen verts with horizontal position equal to from_x are moved to to_x. */ +static void screen_verts_halign(const wmWindow *win, + const bScreen *screen, + const short from_x, + const short to_x) +{ + ED_screen_verts_iter(win, screen, v1) + { + if (v1->vec.x == from_x) { + v1->vec.x = to_x; + } + } +} + +/* Screen verts with vertical position equal to from_y are moved to to_y. */ +static void screen_verts_valign(const wmWindow *win, + const bScreen *screen, + const short from_y, + const short to_y) +{ + ED_screen_verts_iter(win, screen, v1) + { + if (v1->vec.y == from_y) { + v1->vec.y = to_y; + } + } +} + +/* Adjust all screen edges to allow joining two areas. 'dir' value is like area_getorientation(). + */ +static void screen_areas_align( + bContext *C, bScreen *screen, ScrArea *sa1, ScrArea *sa2, const int dir) +{ + wmWindow *win = CTX_wm_window(C); + + if (dir == 0 || dir == 2) { + /* horizontal join, use average for new top and bottom. */ + int top = (sa1->v2->vec.y + sa2->v2->vec.y) / 2; + int bottom = (sa1->v4->vec.y + sa2->v4->vec.y) / 2; + + /* Move edges exactly matching source top and bottom. */ + screen_verts_valign(win, screen, sa1->v2->vec.y, top); + screen_verts_valign(win, screen, sa1->v4->vec.y, bottom); + + /* Move edges exactly matching target top and bottom. */ + screen_verts_valign(win, screen, sa2->v2->vec.y, top); + screen_verts_valign(win, screen, sa2->v4->vec.y, bottom); + } + else { + /* Vertical join, use averages for new left and right. */ + int left = (sa1->v1->vec.x + sa2->v1->vec.x) / 2; + int right = (sa1->v3->vec.x + sa2->v3->vec.x) / 2; + + /* Move edges exactly matching source left and right. */ + screen_verts_halign(win, screen, sa1->v1->vec.x, left); + screen_verts_halign(win, screen, sa1->v3->vec.x, right); + + /* Move edges exactly matching target left and right */ + screen_verts_halign(win, screen, sa2->v1->vec.x, left); + screen_verts_halign(win, screen, sa2->v3->vec.x, right); + } +} + /* Helper function to join 2 areas, it has a return value, 0=failed 1=success * used by the split, join operators */ @@ -348,21 +409,7 @@ int screen_area_join(bContext *C, bScreen *screen, ScrArea *sa1, ScrArea *sa2) } /* Align areas if they are not. Do sanity checking before getting here. */ - - if (dir == 0 || dir == 2) { - /* horizontal join, so vertically align source vert to target */ - sa2->v1->vec.y = sa1->v1->vec.y; /* vertical align sa1 BL */ - sa2->v2->vec.y = sa1->v2->vec.y; /* vertical align sa1 TL */ - sa2->v3->vec.y = sa1->v3->vec.y; /* vertical align sa1 TR */ - sa2->v4->vec.y = sa1->v4->vec.y; /* vertical align sa1 BR */ - } - else { - /* vertical join, so horizontally align source verts to target */ - sa2->v1->vec.x = sa1->v1->vec.x; /* vertical align sa1 BL */ - sa2->v2->vec.x = sa1->v2->vec.x; /* vertical align sa1 TL */ - sa2->v3->vec.x = sa1->v3->vec.x; /* vertical align sa1 TR */ - sa2->v4->vec.x = sa1->v4->vec.x; /* vertical align sa1 BR */ - } + screen_areas_align(C, screen, sa1, sa2, dir); if (dir == 0) { /* sa1 to right of sa2 = W */ sa1->v1 = sa2->v1; /* BL */ diff --git a/source/blender/editors/screen/screen_intern.h b/source/blender/editors/screen/screen_intern.h index a5e0263104d8..2d42313d528b 100644 --- a/source/blender/editors/screen/screen_intern.h +++ b/source/blender/editors/screen/screen_intern.h @@ -35,6 +35,8 @@ struct bContextDataResult; #define AZONEFADEIN (5.0f * U.widget_unit) /* when azone is totally visible */ #define AZONEFADEOUT (6.5f * U.widget_unit) /* when we start seeing the azone */ +#define AREAJOINTOLERANCE (1.0f * U.widget_unit) /* Edges must be close to allow joining. */ + /* Expanded interaction influence of area borders. */ #define BORDERPADDING (U.dpi_fac + U.pixelsize) diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index a18a0145faa2..6172b77de077 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -2694,19 +2694,19 @@ void PAINT_OT_vertex_paint_toggle(wmOperatorType *ot) /* Implementation notes: * * Operator->invoke() - * - validate context (add mcol) - * - create customdata storage - * - call paint once (mouse click) - * - add modal handler + * - Validate context (add #Mesh.mloopcol). + * - Create custom-data storage. + * - Call paint once (mouse click). + * - Add modal handler. * * Operator->modal() - * - for every mousemove, apply vertex paint - * - exit on mouse release, free customdata + * - For every mouse-move, apply vertex paint. + * - Exit on mouse release, free custom-data. * (return OPERATOR_FINISHED also removes handler and operator) * * For future: - * - implement a stroke event (or mousemove with past positions) - * - revise whether op->customdata should be added in object, in set_vpaint + * - implement a stroke event (or mouse-move with past positions). + * - revise whether op->customdata should be added in object, in set_vpaint. */ struct VPaintData { @@ -2718,8 +2718,10 @@ struct VPaintData { struct VertProjHandle *vp_handle; struct CoNo *vertexcosnos; - /* modify 'me->mcol' directly, since the derived mesh is drawing from this - * array, otherwise we need to refresh the modifier stack */ + /** + * Modify #Mesh.mloopcol directly, since the derived mesh is drawing from this + * array, otherwise we need to refresh the modifier stack. + */ bool use_fast_update; /* loops tagged as having been painted, to apply shared vertex color diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c index dc258157afdd..b03df01a02be 100644 --- a/source/blender/editors/space_file/fsmenu.c +++ b/source/blender/editors/space_file/fsmenu.c @@ -418,7 +418,7 @@ void fsmenu_insert_entry(struct FSMenu *fsmenu, else { /* if we're bookmarking this, file should come * before the last separator, only automatically added - * current dir go after the last sep. */ + * current dir go after the last separator. */ if (flag & FS_INSERT_SAVE) { break; } diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index c910f1d23820..d80614e0440e 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -1652,10 +1652,10 @@ static void sequencer_slip_update_header(Scene *scene, ScrArea *area, SlipData * if (hasNumInput(&data->num_input)) { char num_str[NUM_STR_REP_LEN]; outputNumInput(&data->num_input, num_str, &scene->unit); - BLI_snprintf(msg, sizeof(msg), TIP_("Trim offset: %s"), num_str); + BLI_snprintf(msg, sizeof(msg), TIP_("Slip offset: %s"), num_str); } else { - BLI_snprintf(msg, sizeof(msg), TIP_("Trim offset: %d"), offset); + BLI_snprintf(msg, sizeof(msg), TIP_("Slip offset: %d"), offset); } } diff --git a/source/blender/gpu/intern/gpu_texture.c b/source/blender/gpu/intern/gpu_texture.c index 56eac6f77c84..6eacdfaffec6 100644 --- a/source/blender/gpu/intern/gpu_texture.c +++ b/source/blender/gpu/intern/gpu_texture.c @@ -1637,6 +1637,7 @@ void GPU_texture_clear(GPUTexture *tex, eGPUDataFormat gpu_data_format, const vo } default: BLI_assert(!"Unhandled data format"); + depth = 0.0f; break; } glClearDepth(depth); @@ -1671,6 +1672,7 @@ void GPU_texture_clear(GPUTexture *tex, eGPUDataFormat gpu_data_format, const vo } default: BLI_assert(!"Unhandled data format"); + r = g = b = a = 0.0f; break; } glClearColor(r, g, b, a); diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 0dd93242a172..7d3631888c3a 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -75,6 +75,7 @@ extern StructRNA RNA_BackgroundImage; extern StructRNA RNA_BevelModifier; extern StructRNA RNA_BezierSplinePoint; extern StructRNA RNA_BlendData; +extern StructRNA RNA_BlendDataLibraries; extern StructRNA RNA_BlendTexture; extern StructRNA RNA_BlenderRNA; extern StructRNA RNA_BoidRule; diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index cd7875d84e30..8454d5c125fa 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -1327,7 +1327,7 @@ static void rna_def_edit_bone(BlenderRNA *brna) prop, "Editbone Matrix", "Matrix combining loc/rot of the bone (head position, direction and roll), " - "in armature space (WARNING: does not include/support bone's length/size)"); + "in armature space (does not include/support bone's length/size)"); RNA_def_property_float_funcs(prop, "rna_EditBone_matrix_get", "rna_EditBone_matrix_set", NULL); RNA_api_armature_edit_bone(srna); diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c index 0f204e8d1bcc..bcd0c3a14857 100644 --- a/source/blender/python/intern/bpy.c +++ b/source/blender/python/intern/bpy.c @@ -380,10 +380,7 @@ void BPy_init_modules(void) PyModule_AddObject(mod, "types", BPY_rna_types()); /* needs to be first so bpy_types can run */ - BPY_library_load_module(mod); - BPY_library_write_module(mod); - - BPY_rna_id_collection_module(mod); + BPY_library_load_type_ready(); BPY_rna_gizmo_module(mod); diff --git a/source/blender/python/intern/bpy_library.h b/source/blender/python/intern/bpy_library.h index 3fd116d70285..6840807d2b0f 100644 --- a/source/blender/python/intern/bpy_library.h +++ b/source/blender/python/intern/bpy_library.h @@ -21,7 +21,9 @@ #ifndef __BPY_LIBRARY_H__ #define __BPY_LIBRARY_H__ -int BPY_library_load_module(PyObject *mod_par); -int BPY_library_write_module(PyObject *mod_par); +int BPY_library_load_type_ready(void); +extern PyMethodDef BPY_library_load_method_def; + +extern PyMethodDef BPY_library_write_method_def; #endif /* __BPY_LIBRARY_H__ */ diff --git a/source/blender/python/intern/bpy_library_load.c b/source/blender/python/intern/bpy_library_load.c index 989b79314445..05cbc9af6013 100644 --- a/source/blender/python/intern/bpy_library_load.c +++ b/source/blender/python/intern/bpy_library_load.c @@ -459,15 +459,15 @@ static PyObject *bpy_lib_dir(BPy_Library *self) return PyDict_Keys(self->dict); } -int BPY_library_load_module(PyObject *mod_par) +PyMethodDef BPY_library_load_method_def = { + "load", + (PyCFunction)bpy_lib_load, + METH_STATIC | METH_VARARGS | METH_KEYWORDS, + bpy_lib_load_doc, +}; + +int BPY_library_load_type_ready(void) { - static PyMethodDef load_meth = { - "load", - (PyCFunction)bpy_lib_load, - METH_STATIC | METH_VARARGS | METH_KEYWORDS, - bpy_lib_load_doc, - }; - PyModule_AddObject(mod_par, "_library_load", PyCFunction_New(&load_meth, NULL)); /* some compilers don't like accessing this directly, delay assignment */ bpy_lib_Type.tp_getattro = PyObject_GenericGetAttr; diff --git a/source/blender/python/intern/bpy_library_write.c b/source/blender/python/intern/bpy_library_write.c index 6c8f1deb1267..fec0cef7b05f 100644 --- a/source/blender/python/intern/bpy_library_write.c +++ b/source/blender/python/intern/bpy_library_write.c @@ -204,16 +204,9 @@ static PyObject *bpy_lib_write(PyObject *UNUSED(self), PyObject *args, PyObject return ret; } -int BPY_library_write_module(PyObject *mod_par) -{ - static PyMethodDef write_meth = { - "write", - (PyCFunction)bpy_lib_write, - METH_STATIC | METH_VARARGS | METH_KEYWORDS, - bpy_lib_write_doc, - }; - - PyModule_AddObject(mod_par, "_library_write", PyCFunction_New(&write_meth, NULL)); - - return 0; -} +PyMethodDef BPY_library_write_method_def = { + "write", + (PyCFunction)bpy_lib_write, + METH_STATIC | METH_VARARGS | METH_KEYWORDS, + bpy_lib_write_doc, +}; diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 39485f322d41..179daad2f603 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -9040,32 +9040,41 @@ void pyrna_struct_type_extend_capi(struct StructRNA *srna, struct PyMethodDef *method, struct PyGetSetDef *getset) { - PyObject *cls = pyrna_srna_Subtype(srna); + /* See 'add_methods' in Python's 'typeobject.c'. */ + PyTypeObject *type = (PyTypeObject *)pyrna_srna_Subtype(srna); + PyObject *dict = type->tp_dict; if (method != NULL) { for (; method->ml_name != NULL; method++) { - PyObject *func = PyCFunction_New(method, NULL); - PyObject *args = PyTuple_New(1); - PyTuple_SET_ITEM(args, 0, func); - PyObject *classmethod = PyObject_CallObject((PyObject *)&PyClassMethod_Type, args); + PyObject *py_method; - PyObject_SetAttrString(cls, method->ml_name, classmethod); + if (method->ml_flags & METH_CLASS) { + PyObject *cfunc = PyCFunction_New(method, (PyObject *)type); + py_method = PyClassMethod_New(cfunc); + Py_DECREF(cfunc); + } + else { + /* Currently only static and class methods are used. */ + BLI_assert(method->ml_flags & METH_STATIC); + py_method = PyCFunction_New(method, NULL); + } - Py_DECREF(classmethod); - Py_DECREF(args); /* Clears 'func' too. */ + int err = PyDict_SetItemString(dict, method->ml_name, py_method); + Py_DECREF(py_method); + BLI_assert(!(err < 0)); + UNUSED_VARS_NDEBUG(err); } } if (getset != NULL) { - PyObject *dict = ((PyTypeObject *)cls)->tp_dict; for (; getset->name != NULL; getset++) { - PyObject *descr = PyDescr_NewGetSet((PyTypeObject *)cls, getset); + PyObject *descr = PyDescr_NewGetSet(type, getset); /* Ensure we're not overwriting anything that already exists. */ BLI_assert(PyDict_GetItem(dict, PyDescr_NAME(descr)) == NULL); PyDict_SetItem(dict, PyDescr_NAME(descr), descr); Py_DECREF(descr); } } - Py_DECREF(cls); + Py_DECREF(type); } /* Access to 'owner_id' internal global. */ diff --git a/source/blender/python/intern/bpy_rna_id_collection.c b/source/blender/python/intern/bpy_rna_id_collection.c index 6b6ffa979951..b607f1635e63 100644 --- a/source/blender/python/intern/bpy_rna_id_collection.c +++ b/source/blender/python/intern/bpy_rna_id_collection.c @@ -385,32 +385,21 @@ static PyObject *bpy_orphans_purge(PyObject *UNUSED(self), return Py_None; } -int BPY_rna_id_collection_module(PyObject *mod_par) -{ - static PyMethodDef user_map = { - "user_map", (PyCFunction)bpy_user_map, METH_VARARGS | METH_KEYWORDS, bpy_user_map_doc}; - - PyModule_AddObject(mod_par, "_rna_id_collection_user_map", PyCFunction_New(&user_map, NULL)); - - static PyMethodDef batch_remove = { - "batch_remove", - (PyCFunction)bpy_batch_remove, - METH_VARARGS | METH_KEYWORDS, - bpy_batch_remove_doc, - }; - - PyModule_AddObject( - mod_par, "_rna_id_collection_batch_remove", PyCFunction_New(&batch_remove, NULL)); - - static PyMethodDef orphans_purge = { - "orphans_purge", - (PyCFunction)bpy_orphans_purge, - METH_VARARGS | METH_KEYWORDS, - bpy_orphans_purge_doc, - }; - - PyModule_AddObject( - mod_par, "_rna_id_collection_orphans_purge", PyCFunction_New(&orphans_purge, NULL)); - - return 0; -} +PyMethodDef BPY_rna_id_collection_user_map_method_def = { + "user_map", + (PyCFunction)bpy_user_map, + METH_STATIC | METH_VARARGS | METH_KEYWORDS, + bpy_user_map_doc, +}; +PyMethodDef BPY_rna_id_collection_batch_remove_method_def = { + "batch_remove", + (PyCFunction)bpy_batch_remove, + METH_STATIC | METH_VARARGS | METH_KEYWORDS, + bpy_batch_remove_doc, +}; +PyMethodDef BPY_rna_id_collection_orphans_purge_method_def = { + "orphans_purge", + (PyCFunction)bpy_orphans_purge, + METH_STATIC | METH_VARARGS | METH_KEYWORDS, + bpy_orphans_purge_doc, +}; diff --git a/source/blender/python/intern/bpy_rna_id_collection.h b/source/blender/python/intern/bpy_rna_id_collection.h index 8cb375960a9a..ee8f4c666a83 100644 --- a/source/blender/python/intern/bpy_rna_id_collection.h +++ b/source/blender/python/intern/bpy_rna_id_collection.h @@ -21,6 +21,8 @@ #ifndef __BPY_RNA_ID_COLLECTION_H__ #define __BPY_RNA_ID_COLLECTION_H__ -int BPY_rna_id_collection_module(PyObject *); +extern PyMethodDef BPY_rna_id_collection_user_map_method_def; +extern PyMethodDef BPY_rna_id_collection_batch_remove_method_def; +extern PyMethodDef BPY_rna_id_collection_orphans_purge_method_def; #endif /* __BPY_RNA_ID_COLLECTION_H__ */ diff --git a/source/blender/python/intern/bpy_rna_types_capi.c b/source/blender/python/intern/bpy_rna_types_capi.c index cfd6b7f54a82..5a2ba4a5cdb4 100644 --- a/source/blender/python/intern/bpy_rna_types_capi.c +++ b/source/blender/python/intern/bpy_rna_types_capi.c @@ -33,8 +33,10 @@ #include "BLI_utildefines.h" +#include "bpy_library.h" #include "bpy_rna.h" #include "bpy_rna_callback.h" +#include "bpy_rna_id_collection.h" #include "bpy_rna_types_capi.h" #include "../generic/py_capi_utils.h" @@ -45,6 +47,31 @@ #include "WM_api.h" +/* -------------------------------------------------------------------- */ +/** \name Blend Data + * \{ */ + +static struct PyMethodDef pyrna_blenddata_methods[] = { + {NULL, NULL, 0, NULL}, /* #BPY_rna_id_collection_user_map_method_def */ + {NULL, NULL, 0, NULL}, /* #BPY_rna_id_collection_batch_remove_method_def */ + {NULL, NULL, 0, NULL}, /* #BPY_rna_id_collection_orphans_purge_method_def */ + {NULL, NULL, 0, NULL}, +}; + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Blend Data Libraries + * \{ */ + +static struct PyMethodDef pyrna_blenddatalibraries_methods[] = { + {NULL, NULL, 0, NULL}, /* #BPY_library_load_method_def */ + {NULL, NULL, 0, NULL}, /* #BPY_library_write_method_def */ + {NULL, NULL, 0, NULL}, +}; + +/** \} */ + /* -------------------------------------------------------------------- */ /** \name Window Manager Clipboard Property * @@ -86,11 +113,11 @@ static int pyrna_WindowManager_clipboard_set(PyObject *UNUSED(self), static struct PyMethodDef pyrna_windowmanager_methods[] = { {"draw_cursor_add", (PyCFunction)pyrna_callback_classmethod_add, - METH_VARARGS | METH_STATIC, + METH_VARARGS | METH_CLASS, ""}, {"draw_cursor_remove", (PyCFunction)pyrna_callback_classmethod_remove, - METH_VARARGS | METH_STATIC, + METH_VARARGS | METH_CLASS, ""}, {NULL, NULL, 0, NULL}, }; @@ -147,11 +174,11 @@ PyDoc_STRVAR(pyrna_draw_handler_remove_doc, static struct PyMethodDef pyrna_space_methods[] = { {"draw_handler_add", (PyCFunction)pyrna_callback_classmethod_add, - METH_VARARGS | METH_STATIC, + METH_VARARGS | METH_CLASS, pyrna_draw_handler_add_doc}, {"draw_handler_remove", (PyCFunction)pyrna_callback_classmethod_remove, - METH_VARARGS | METH_STATIC, + METH_VARARGS | METH_CLASS, pyrna_draw_handler_remove_doc}, {NULL, NULL, 0, NULL}, }; @@ -164,7 +191,24 @@ static struct PyMethodDef pyrna_space_methods[] = { void BPY_rna_types_extend_capi(void) { + /* BlendData */ + ARRAY_SET_ITEMS(pyrna_blenddata_methods, + BPY_rna_id_collection_user_map_method_def, + BPY_rna_id_collection_batch_remove_method_def, + BPY_rna_id_collection_orphans_purge_method_def); + BLI_assert(ARRAY_SIZE(pyrna_blenddata_methods) == 4); + pyrna_struct_type_extend_capi(&RNA_BlendData, pyrna_blenddata_methods, NULL); + + /* BlendDataLibraries */ + ARRAY_SET_ITEMS( + pyrna_blenddatalibraries_methods, BPY_library_load_method_def, BPY_library_write_method_def); + BLI_assert(ARRAY_SIZE(pyrna_blenddatalibraries_methods) == 3); + pyrna_struct_type_extend_capi(&RNA_BlendDataLibraries, pyrna_blenddatalibraries_methods, NULL); + + /* Space */ pyrna_struct_type_extend_capi(&RNA_Space, pyrna_space_methods, NULL); + + /* WindowManager */ pyrna_struct_type_extend_capi( &RNA_WindowManager, pyrna_windowmanager_methods, pyrna_windowmanager_getset); }