diff options
author | Severin <eiseljulian@gmail.com> | 2018-07-02 15:50:45 +0300 |
---|---|---|
committer | Severin <eiseljulian@gmail.com> | 2018-07-02 15:50:45 +0300 |
commit | 5a17c9bcbca737525fa535ceb45f9769a34a4df7 (patch) | |
tree | c7867d25494d053d11837d04b1ab8b86526a189d | |
parent | 9887b38692e3bcf7ba613ca947fd76e299c58cbd (diff) | |
parent | 20046defd735684a42750c4cb68d20d78ad5180c (diff) |
Merge branch 'blender2.8' into temp-tab_drag_droptemp-tab_drag_drop
310 files changed, 2201 insertions, 1586 deletions
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py index 7a5605e1542..f8bc9ca8512 100644 --- a/intern/cycles/blender/addon/ui.py +++ b/intern/cycles/blender/addon/ui.py @@ -847,7 +847,7 @@ class CYCLES_CAMERA_PT_dof_aperture(CyclesButtonsPanel, Panel): def draw(self, context): layout = self.layout layout.use_property_split = True - flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=False, align=False) + flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False) cam = context.camera ccam = cam.cycles @@ -878,7 +878,7 @@ class CYCLES_CAMERA_PT_dof_viewport(CyclesButtonsPanel, Panel): def draw(self, context): layout = self.layout layout.use_property_split = True - flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=False, align=False) + flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False) cam = context.camera dof_options = cam.gpu_dof @@ -1539,7 +1539,7 @@ class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel): def draw(self, context): layout = self.layout layout.use_property_split = True - layout.use_property_decorate = False # No animation.
+ layout.use_property_decorate = False # No animation. scene = context.scene cscene = scene.cycles @@ -1568,7 +1568,7 @@ class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel): if cscene.bake_type == 'NORMAL': col.prop(cbk, "normal_space", text="Space") - sub = col.column(align=True)
+ sub = col.column(align=True) sub.prop(cbk, "normal_r", text="Swizzle R") sub.prop(cbk, "normal_g", text="G") sub.prop(cbk, "normal_b", text="B") @@ -1590,7 +1590,7 @@ class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel): elif cscene.bake_type in {'DIFFUSE', 'GLOSSY', 'TRANSMISSION', 'SUBSURFACE'}: row = col.row(align=True) - row.use_property_split = False
+ row.use_property_split = False row.prop(cbk, "use_pass_direct", toggle=True) row.prop(cbk, "use_pass_indirect", toggle=True) row.prop(cbk, "use_pass_color", toggle=True) @@ -1609,12 +1609,12 @@ class CYCLES_RENDER_PT_bake(CyclesButtonsPanel, Panel): sub.prop(cbk, "use_cage", text="Cage") if cbk.use_cage: sub.prop(cbk, "cage_extrusion", text="Extrusion") - sub.prop_search(cbk, "cage_object", scene, "objects", text="Cage Object")
+ sub.prop_search(cbk, "cage_object", scene, "objects", text="Cage Object") else: sub.prop(cbk, "cage_extrusion", text="Ray Distance") - layout.separator()
-
+ layout.separator() + layout.operator("object.bake", icon='RENDER_STILL').type = cscene.bake_type diff --git a/intern/cycles/blender/blender_camera.cpp b/intern/cycles/blender/blender_camera.cpp index aea63b6b31f..c5df5842bad 100644 --- a/intern/cycles/blender/blender_camera.cpp +++ b/intern/cycles/blender/blender_camera.cpp @@ -457,6 +457,7 @@ static void blender_camera_sync(Camera *cam, cam->matrix = blender_camera_matrix(bcam->matrix, bcam->type, bcam->panorama_type); + cam->motion.clear(); cam->motion.resize(bcam->motion_steps, cam->matrix); cam->use_perspective_motion = false; cam->shuttertime = bcam->shuttertime; diff --git a/intern/cycles/blender/blender_object.cpp b/intern/cycles/blender/blender_object.cpp index e0737d5118a..6d6b367209d 100644 --- a/intern/cycles/blender/blender_object.cpp +++ b/intern/cycles/blender/blender_object.cpp @@ -448,6 +448,7 @@ Object *BlenderSync::sync_object(BL::Depsgraph& b_depsgraph, mesh->motion_steps = motion_steps; } + object->motion.clear(); object->motion.resize(motion_steps, transform_empty()); if(motion_steps) { diff --git a/intern/cycles/blender/blender_util.h b/intern/cycles/blender/blender_util.h index e9ede91c295..4e754d22984 100644 --- a/intern/cycles/blender/blender_util.h +++ b/intern/cycles/blender/blender_util.h @@ -293,7 +293,7 @@ static inline int4 get_int4(const BL::Array<int, 4>& array) return make_int4(array[0], array[1], array[2], array[3]); } -static inline uint get_layer(const BL::Array<int, 20>& array) +static inline uint get_layer(const BL::Array<bool, 20>& array) { uint layer = 0; @@ -304,8 +304,8 @@ static inline uint get_layer(const BL::Array<int, 20>& array) return layer; } -static inline uint get_layer(const BL::Array<int, 20>& array, - const BL::Array<int, 8>& local_array, +static inline uint get_layer(const BL::Array<bool, 20>& array, + const BL::Array<bool, 8>& local_array, bool is_light = false, uint view_layers = (1 << 20) - 1) { diff --git a/release/datafiles/blender_icons.svg b/release/datafiles/blender_icons.svg index fe4e2015e79..c190fa4dd2a 100644 --- a/release/datafiles/blender_icons.svg +++ b/release/datafiles/blender_icons.svg @@ -92369,7 +92369,7 @@ sodipodi:nodetypes="ccccc" id="path9152-7-3" d="M 46.49945,103.49527 V 92.492523 l 10.996287,2.228527 v 6.75793 z" - style="fill:none;stroke:url(#linearGradient15188);stroke-width:1.0000248px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1"/> + style="fill:none;stroke:url(#linearGradient15188);stroke-width:1.0000248px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" /> <path sodipodi:nodetypes="ccccc" inkscape:connector-curvature="0" @@ -92898,7 +92898,145 @@ inkscape:connector-curvature="0" /> </g> <g - transform="translate(-564,-55.99997)" + style="display:inline;enable-background:new" + id="g8189" + transform="translate(-647.84611,-56.087322)"> + <rect + transform="scale(-1,1)" + y="506.99997" + x="-669" + height="15.999999" + width="15.999999" + id="rect8179" + style="opacity:0;vector-effect:none;fill:#d40000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" /> + <path + sodipodi:nodetypes="cssssssc" + inkscape:connector-curvature="0" + id="path8183" + d="m -655.5,513.49997 v 6.0165 c 0,1.65287 -1.33066,2.98353 -2.98353,2.98353 h -4.03294 c -1.65287,0 -2.98353,-1.33066 -2.98353,-2.98353 v -9.03297 c 0,-1.65287 1.33066,-2.98353 2.98353,-2.98353 H -658.5" + style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" + transform="scale(-1,1)" /> + <g + transform="translate(-20)" + id="g8185" /> + <path + sodipodi:nodetypes="csssccc" + inkscape:connector-curvature="0" + id="path8187" + d="m 659.5,507.49997 h -1.0165 c -0.64696,0 -1.24455,0.20387 -1.73231,0.55112 -0.75838,0.53993 -1.25122,1.4265 -1.25122,2.43241 v 3.01647 l 4.00824,0.008 z" + style="display:inline;opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:new" /> + </g> + <g + style="display:inline;enable-background:new" + id="g8210" + transform="translate(-646.84611,-35.087322)"> + <rect + y="485.99997" + x="673" + height="15.999999" + width="15.999999" + id="rect8201" + style="opacity:0;vector-effect:none;fill:#d40000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" /> + <rect + ry="2.9835341" + rx="2.9835341" + y="486.5" + x="675.5" + height="14.999969" + width="10" + id="rect8203" + style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" /> + <rect + style="opacity:1;vector-effect:none;fill:#f9f9f9;fill-opacity:1;stroke:#ffffff;stroke-width:0.99999994;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" + id="rect8205" + width="2" + height="5.0000005" + x="679.5" + y="489.49997" + rx="0.546875" + ry="0.546875" /> + <g + id="g8208" + transform="translate(0,-21)" /> + </g> + <g + transform="matrix(-1,0,0,1,715.15389,-56.087322)" + id="g8275" + style="display:inline;enable-background:new"> + <rect + style="opacity:0;vector-effect:none;fill:#d40000;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" + id="rect8264" + width="15.999999" + height="15.999999" + x="-669" + y="506.99997" + transform="scale(-1,1)" /> + <path + transform="scale(-1,1)" + style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" + d="m -655.5,513.49997 v 6.0165 c 0,1.65287 -1.33066,2.98353 -2.98353,2.98353 h -4.03294 c -1.65287,0 -2.98353,-1.33066 -2.98353,-2.98353 v -9.03297 c 0,-1.65287 1.33066,-2.98353 2.98353,-2.98353 H -658.5" + id="path8267" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cssssssc" /> + <g + id="g8270" + transform="translate(-20)" /> + <path + style="display:inline;opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:new" + d="m 659.5,507.49997 h -1.0165 c -0.64696,0 -1.24455,0.20387 -1.73231,0.55112 -0.75838,0.53993 -1.25122,1.4265 -1.25122,2.43241 v 3.01647 l 4.00824,0.008 z" + id="path8273" + inkscape:connector-curvature="0" + sodipodi:nodetypes="csssccc" /> + </g> + <g + style="display:inline;enable-background:new" + id="g8244" + transform="translate(-416.84613,479.91244)"> + <g + id="g8231"> + <path + sodipodi:nodetypes="cssssssc" + inkscape:connector-curvature="0" + id="path8225" + d="m 489.50002,-13.49979 h -0.93752 c -1.69663,0 -3.0625,-1.36588 -3.0625,-3.0625 v -8.875 c 0,-1.69662 1.36587,-3.0625 3.0625,-3.0625 h 3.875 c 1.69662,0 3.0625,1.36588 3.0625,3.0625 v 7.9375" + style="opacity:0.6;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" /> + <g + id="g8229" + transform="translate(-190,-535.99976)" + style="opacity:1"> + <path + sodipodi:nodetypes="cc" + inkscape:connector-curvature="0" + d="m 680.5,513.49997 -0.01,-4.03235" + style="opacity:0.6;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" + id="path8227" /> + </g> + </g> + <g + transform="matrix(0,1,1,0,516.49726,-513.49725)" + id="g8242"> + <path + style="display:inline;opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:new" + d="m 497.99746,-15.99726 0.005,-9.961189" + id="path8233" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + <path + style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" + d="m 500.00251,-24.00231 -2,-2 -2,2" + id="path8238" + inkscape:connector-curvature="0" + sodipodi:nodetypes="ccc" /> + <path + sodipodi:nodetypes="ccc" + inkscape:connector-curvature="0" + id="path8240" + d="m 500.00251,-17.997239 -2,2 -2,-2" + style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" /> + </g> + </g> + <g + transform="translate(-565.88191,-56.028557)" id="g10320" style="display:inline;enable-background:new"> <rect @@ -92912,7 +93050,7 @@ <path transform="scale(-1,1)" style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" - d="m -655.5,515.49997 v 4.0165 c 0,1.65287 -1.33066,2.98353 -2.98353,2.98353 h -4.03294 c -1.65287,0 -2.98353,-1.33066 -2.98353,-2.98353 v -9.03297 c 0,-1.65287 1.33066,-2.98353 2.98353,-2.98353 H -660.5" + d="m -655.5,515.49997 v 4.0165 c 0,1.65287 -1.33066,2.98353 -2.98353,2.98353 h -4.03294 c -1.65287,0 -2.98353,-1.33066 -2.98353,-2.98353 v -9.03297 c 0,-1.65287 1.33066,-2.98353 2.98353,-2.98353 H -661.5" id="rect10312" inkscape:connector-curvature="0" sodipodi:nodetypes="cssssssc" /> @@ -92921,14 +93059,15 @@ transform="translate(-20)" /> <path style="display:inline;opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:new" - d="m 658.5,507.49997 h -0.0165 c -1.65287,0 -2.98353,1.33066 -2.98353,2.98353 v 3.01647 l 3.00824,0.008 z" + d="m 659.5,507.49997 h -1.0165 c -0.64696,0 -1.24455,0.20387 -1.73231,0.55112 -0.75838,0.53993 -1.25122,1.4265 -1.25122,2.43241 v 3.01647 l 4.00824,0.008 -0.008,-5.97178 z" id="rect10312-0" inkscape:connector-curvature="0" - sodipodi:nodetypes="cssccc" /> + sodipodi:nodetypes="cssscccc" /> </g> <g style="display:inline;enable-background:new" - id="g10350"> + id="g10350" + transform="translate(0.11808428,-0.02858689)"> <rect y="451.5" x="152.5" @@ -92940,55 +93079,58 @@ ry="3.0625" /> <g id="g10338" - transform="translate(-523,-55.999969)"> + transform="translate(-523,-55.999969)" /> + <g + id="g8140"> + <path + style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" + d="M 165.5,459.5 V 454" + id="path10340" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + <path + style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:fill markers stroke" + id="path10342" + sodipodi:type="arc" + sodipodi:cx="156.12387" + sodipodi:cy="454" + sodipodi:rx="9.3798456" + sodipodi:ry="5.5" + sodipodi:start="5.8166094" + sodipodi:end="0" + d="M 164.50114,451.52593 A 9.3798456,5.5 0 0 1 165.50372,454" + sodipodi:open="true" /> <path sodipodi:nodetypes="cc" inkscape:connector-curvature="0" + id="path10344" + d="m 167.50001,457.60147 v -4.05761" + style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" /> + </g> + <g + id="g8200"> + <path + id="path10336" + style="display:inline;opacity:0.6;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:new" d="m 680.5,513.49997 -0.01,-4.03235" - style="opacity:0.6;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" - id="path10336" /> + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" + transform="translate(-523,-55.99997)" /> + <rect + y="451.5" + x="152.5" + height="15" + width="10" + id="rect8195" + style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" + rx="3.0625" + ry="3.0625" /> </g> - <path - sodipodi:nodetypes="cc" - inkscape:connector-curvature="0" - id="path10340" - d="M 165.5,459.5 V 455" - style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" /> - <path - sodipodi:open="true" - d="M 164.50114,451.52593 A 9.3798456,5.5 0 0 1 165.50372,454" - sodipodi:end="0" - sodipodi:start="5.8166094" - sodipodi:ry="5.5" - sodipodi:rx="9.3798456" - sodipodi:cy="454" - sodipodi:cx="156.12387" - sodipodi:type="arc" - id="path10342" - style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:fill markers stroke" /> - <path - style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" - d="m 167.50001,457.60147 v -4.05761" - id="path10344" - inkscape:connector-curvature="0" - sodipodi:nodetypes="cc" /> - <path - style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" - d="M 165.5,459.5 V 454" - id="path10346" - inkscape:connector-curvature="0" - sodipodi:nodetypes="cc" /> - <path - sodipodi:nodetypes="cc" - inkscape:connector-curvature="0" - id="path10348" - d="m 167.50001,457.60147 v -4.05761" - style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" /> </g> <g style="display:inline;enable-background:new" id="g10432" - transform="translate(-522,-55.99997)"> + transform="translate(-523.88191,-56.028557)"> <rect transform="scale(-1,1)" y="506.99997" @@ -93001,7 +93143,7 @@ sodipodi:nodetypes="cssssssc" inkscape:connector-curvature="0" id="path10426" - d="m 665.49995,515.49997 v 4.0165 c 0,1.65287 -1.33066,2.98353 -2.98353,2.98353 h -4.03294 c -1.65287,0 -2.98353,-1.33066 -2.98353,-2.98353 v -9.03297 c 0,-1.65287 1.33066,-2.98353 2.98353,-2.98353 h 2.01647" + d="m 665.49995,515.49997 v 4.0165 c 0,1.65287 -1.33066,2.98353 -2.98353,2.98353 h -4.03294 c -1.65287,0 -2.98353,-1.33066 -2.98353,-2.98353 v -9.03297 c 0,-1.65287 1.33066,-2.98353 2.98353,-2.98353 h 1.01647" style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" /> <g transform="translate(-20)" @@ -93010,11 +93152,11 @@ sodipodi:nodetypes="cssccc" inkscape:connector-curvature="0" id="path10430" - d="m 662.49995,507.49997 h 0.0165 c 1.65287,0 2.98353,1.33066 2.98353,2.98353 v 3.01647 l -3.00824,0.008 z" + d="m 661.49995,507.49997 h 1.0165 c 1.65287,0 2.98353,1.33066 2.98353,2.98353 v 3.01647 l -4.00824,0.008 z" style="display:inline;opacity:1;vector-effect:none;fill:#ffffff;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:new" /> </g> <g - transform="translate(-563,-34.99997)" + transform="translate(-564.88191,-35.028557)" id="g10308-9" style="display:inline;enable-background:new"> <rect @@ -93046,6 +93188,93 @@ transform="translate(0,-21)" id="g10306-4" /> </g> + <g + transform="translate(-62.825225,-0.25534436)" + style="display:inline;enable-background:new" + id="g8140-4"> + <path + style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" + d="M 165.5,459.5 V 454" + id="path10340-6" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + <path + style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:fill markers stroke" + id="path10342-2" + sodipodi:type="arc" + sodipodi:cx="156.12387" + sodipodi:cy="454" + sodipodi:rx="9.3798456" + sodipodi:ry="5.5" + sodipodi:start="5.8166094" + sodipodi:end="0" + d="M 164.50114,451.52593 A 9.3798456,5.5 0 0 1 165.50372,454" + sodipodi:open="true" /> + <path + sodipodi:nodetypes="cc" + inkscape:connector-curvature="0" + id="path10344-4" + d="m 167.50001,457.60147 v -4.05761" + style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" /> + </g> + <g + id="g8181" + style="display:inline;enable-background:new" + transform="translate(-41.825225,-0.25534436)"> + <path + sodipodi:nodetypes="cc" + inkscape:connector-curvature="0" + id="path8170" + d="M 165.5,459.5 V 454" + style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" /> + <path + sodipodi:open="true" + d="M 164.50114,451.52593 A 9.3798456,5.5 0 0 1 165.50372,454" + sodipodi:end="0" + sodipodi:start="5.8166094" + sodipodi:ry="5.5" + sodipodi:rx="9.3798456" + sodipodi:cy="454" + sodipodi:cx="156.12387" + sodipodi:type="arc" + id="path8175" + style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:fill markers stroke" /> + <path + style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" + d="m 167.50001,457.60147 v -4.05761" + id="path8178" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + </g> + <g + transform="translate(-20.825225,-0.25534436)" + style="display:inline;enable-background:new" + id="g8193"> + <path + style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" + d="M 165.5,459.5 V 454" + id="path8185" + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> + <path + style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;paint-order:fill markers stroke" + id="path8189" + sodipodi:type="arc" + sodipodi:cx="156.12387" + sodipodi:cy="454" + sodipodi:rx="9.3798456" + sodipodi:ry="5.5" + sodipodi:start="5.8166094" + sodipodi:end="0" + d="M 164.50114,451.52593 A 9.3798456,5.5 0 0 1 165.50372,454" + sodipodi:open="true" /> + <path + sodipodi:nodetypes="cc" + inkscape:connector-curvature="0" + id="path8191" + d="m 167.50001,457.60147 v -4.05761" + style="opacity:1;vector-effect:none;fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none" /> + </g> </g> <g inkscape:groupmode="layer" diff --git a/release/datafiles/blender_icons16/icon16_mouse_drag.dat b/release/datafiles/blender_icons16/icon16_mouse_drag.dat Binary files differindex 751421684b1..f925ef9e155 100644 --- a/release/datafiles/blender_icons16/icon16_mouse_drag.dat +++ b/release/datafiles/blender_icons16/icon16_mouse_drag.dat diff --git a/release/datafiles/blender_icons16/icon16_mouse_lmb.dat b/release/datafiles/blender_icons16/icon16_mouse_lmb.dat Binary files differindex 2a0c42f4a6a..df004fd17fb 100644 --- a/release/datafiles/blender_icons16/icon16_mouse_lmb.dat +++ b/release/datafiles/blender_icons16/icon16_mouse_lmb.dat diff --git a/release/datafiles/blender_icons16/icon16_mouse_lmb_drag.dat b/release/datafiles/blender_icons16/icon16_mouse_lmb_drag.dat Binary files differnew file mode 100644 index 00000000000..40145ffb326 --- /dev/null +++ b/release/datafiles/blender_icons16/icon16_mouse_lmb_drag.dat diff --git a/release/datafiles/blender_icons16/icon16_mouse_mmb.dat b/release/datafiles/blender_icons16/icon16_mouse_mmb.dat Binary files differindex 300f6be4ee3..63a172d7a53 100644 --- a/release/datafiles/blender_icons16/icon16_mouse_mmb.dat +++ b/release/datafiles/blender_icons16/icon16_mouse_mmb.dat diff --git a/release/datafiles/blender_icons16/icon16_mouse_mmb_drag.dat b/release/datafiles/blender_icons16/icon16_mouse_mmb_drag.dat Binary files differnew file mode 100644 index 00000000000..6684b18d83b --- /dev/null +++ b/release/datafiles/blender_icons16/icon16_mouse_mmb_drag.dat diff --git a/release/datafiles/blender_icons16/icon16_mouse_move.dat b/release/datafiles/blender_icons16/icon16_mouse_move.dat Binary files differnew file mode 100644 index 00000000000..e9a65e45f2d --- /dev/null +++ b/release/datafiles/blender_icons16/icon16_mouse_move.dat diff --git a/release/datafiles/blender_icons16/icon16_mouse_rmb.dat b/release/datafiles/blender_icons16/icon16_mouse_rmb.dat Binary files differindex 3f13b167eff..af1a76cb54b 100644 --- a/release/datafiles/blender_icons16/icon16_mouse_rmb.dat +++ b/release/datafiles/blender_icons16/icon16_mouse_rmb.dat diff --git a/release/datafiles/blender_icons16/icon16_mouse_rmb_drag.dat b/release/datafiles/blender_icons16/icon16_mouse_rmb_drag.dat Binary files differnew file mode 100644 index 00000000000..1e8051ee667 --- /dev/null +++ b/release/datafiles/blender_icons16/icon16_mouse_rmb_drag.dat diff --git a/release/datafiles/blender_icons32/icon32_mouse_drag.dat b/release/datafiles/blender_icons32/icon32_mouse_drag.dat Binary files differindex 96d3e23181c..ef137d3b2ae 100644 --- a/release/datafiles/blender_icons32/icon32_mouse_drag.dat +++ b/release/datafiles/blender_icons32/icon32_mouse_drag.dat diff --git a/release/datafiles/blender_icons32/icon32_mouse_lmb.dat b/release/datafiles/blender_icons32/icon32_mouse_lmb.dat Binary files differindex 5cb01a4199b..26b78f7e485 100644 --- a/release/datafiles/blender_icons32/icon32_mouse_lmb.dat +++ b/release/datafiles/blender_icons32/icon32_mouse_lmb.dat diff --git a/release/datafiles/blender_icons32/icon32_mouse_lmb_drag.dat b/release/datafiles/blender_icons32/icon32_mouse_lmb_drag.dat Binary files differnew file mode 100644 index 00000000000..f5d3cab77f5 --- /dev/null +++ b/release/datafiles/blender_icons32/icon32_mouse_lmb_drag.dat diff --git a/release/datafiles/blender_icons32/icon32_mouse_mmb.dat b/release/datafiles/blender_icons32/icon32_mouse_mmb.dat Binary files differindex 2c0bc4e1873..d9f6312ac0a 100644 --- a/release/datafiles/blender_icons32/icon32_mouse_mmb.dat +++ b/release/datafiles/blender_icons32/icon32_mouse_mmb.dat diff --git a/release/datafiles/blender_icons32/icon32_mouse_mmb_drag.dat b/release/datafiles/blender_icons32/icon32_mouse_mmb_drag.dat Binary files differnew file mode 100644 index 00000000000..1f33c3e769e --- /dev/null +++ b/release/datafiles/blender_icons32/icon32_mouse_mmb_drag.dat diff --git a/release/datafiles/blender_icons32/icon32_mouse_move.dat b/release/datafiles/blender_icons32/icon32_mouse_move.dat Binary files differnew file mode 100644 index 00000000000..f5832a9e902 --- /dev/null +++ b/release/datafiles/blender_icons32/icon32_mouse_move.dat diff --git a/release/datafiles/blender_icons32/icon32_mouse_rmb.dat b/release/datafiles/blender_icons32/icon32_mouse_rmb.dat Binary files differindex 3e8bf43d306..3e5921e15eb 100644 --- a/release/datafiles/blender_icons32/icon32_mouse_rmb.dat +++ b/release/datafiles/blender_icons32/icon32_mouse_rmb.dat diff --git a/release/datafiles/blender_icons32/icon32_mouse_rmb_drag.dat b/release/datafiles/blender_icons32/icon32_mouse_rmb_drag.dat Binary files differnew file mode 100644 index 00000000000..ca250715757 --- /dev/null +++ b/release/datafiles/blender_icons32/icon32_mouse_rmb_drag.dat diff --git a/release/datafiles/userdef/userdef_default_theme.c b/release/datafiles/userdef/userdef_default_theme.c index 4506d23b49d..76023edca50 100644 --- a/release/datafiles/userdef/userdef_default_theme.c +++ b/release/datafiles/userdef/userdef_default_theme.c @@ -20,7 +20,7 @@ const bTheme U_theme_default = { .name = "Default", .tui = { .wcol_regular = { - .outline = RGBA(0x38393e00), + .outline = RGBA(0x38393eff), .inner = RGBA(0x505158ff), .inner_sel = RGBA(0x80858aff), .item = RGBA(0x38393eff), @@ -30,7 +30,7 @@ const bTheme U_theme_default = { .roundness = 0.2f, }, .wcol_tool = { - .outline = RGBA(0x2f2f3400), + .outline = RGBA(0x2f2f34ff), .inner = RGBA(0x505158ff), .inner_sel = RGBA(0x2f2f34ff), .item = RGBA(0xe6ebffff), @@ -40,7 +40,7 @@ const bTheme U_theme_default = { .roundness = 0.2f, }, .wcol_toolbar_item = { - .outline = RGBA(0x19191900), + .outline = RGBA(0x191919ff), .inner = RGBA(0x505158ff), .inner_sel = RGBA(0x2d2d33ff), .item = RGBA(0x191919ff), @@ -49,7 +49,7 @@ const bTheme U_theme_default = { .roundness = 0.25f, }, .wcol_text = { - .outline = RGBA(0x43454d00), + .outline = RGBA(0x43454dff), .inner = RGBA(0x2d2e33ff), .inner_sel = RGBA(0x717280ff), .item = RGBA(0x599eb3ff), @@ -60,7 +60,7 @@ const bTheme U_theme_default = { .roundness = 0.2f, }, .wcol_radio = { - .outline = RGBA(0x42435200), + .outline = RGBA(0x424352ff), .inner = RGBA(0x505158ff), .inner_sel = RGBA(0x2d2d33ff), .item = RGBA(0xffffffff), @@ -71,7 +71,7 @@ const bTheme U_theme_default = { .roundness = 0.2f, }, .wcol_option = { - .outline = RGBA(0x42435200), + .outline = RGBA(0x424352ff), .inner = RGBA(0x5c5c66cc), .inner_sel = RGBA(0x70707cff), .item = RGBA(0xffffffff), @@ -81,7 +81,7 @@ const bTheme U_theme_default = { .roundness = 0.25f, }, .wcol_toggle = { - .outline = RGBA(0x43434d00), + .outline = RGBA(0x43434dff), .inner = RGBA(0x595966ff), .inner_sel = RGBA(0x3f7d80ff), .item = RGBA(0x191919ff), @@ -90,7 +90,7 @@ const bTheme U_theme_default = { .roundness = 0.25f, }, .wcol_num = { - .outline = RGBA(0x46464d00), + .outline = RGBA(0x46464dff), .inner = RGBA(0x505158ff), .inner_sel = RGBA(0x3f7780ff), .item = RGBA(0x46464dff), @@ -100,7 +100,7 @@ const bTheme U_theme_default = { .roundness = 0.3f, }, .wcol_numslider = { - .outline = RGBA(0x46464d00), + .outline = RGBA(0x46464dff), .inner = RGBA(0x3f3f47ff), .inner_sel = RGBA(0x3f7780ff), .item = RGBA(0x505158ff), @@ -111,7 +111,7 @@ const bTheme U_theme_default = { .roundness = 0.4f, }, .wcol_tab = { - .outline = RGBA(0x28292d00), + .outline = RGBA(0x28292dff), .inner = RGBA(0x323239ff), .inner_sel = RGBA(0x43444bff), .item = RGBA(0x28292dff), @@ -120,7 +120,7 @@ const bTheme U_theme_default = { .roundness = 0.15f, }, .wcol_menu = { - .outline = RGBA(0x43454d00), + .outline = RGBA(0x43454dff), .inner = RGBA(0x29282eff), .inner_sel = RGBA(0x505158ff), .item = RGBA(0xe6e6e6ff), @@ -131,7 +131,7 @@ const bTheme U_theme_default = { .roundness = 0.2f, }, .wcol_pulldown = { - .outline = RGBA(0x43454d00), + .outline = RGBA(0x43454dff), .inner = RGBA(0x29282e99), .inner_sel = RGBA(0x505158ff), .item = RGBA(0x696a72ff), @@ -142,7 +142,7 @@ const bTheme U_theme_default = { .roundness = 0.2f, }, .wcol_menu_back = { - .outline = RGBA(0x29282e00), + .outline = RGBA(0x29282eff), .inner = RGBA(0x1f1f1fef), .inner_sel = RGBA(0x505158ff), .item = RGBA(0x696a72ff), @@ -161,7 +161,7 @@ const bTheme U_theme_default = { .roundness = 0.25f, }, .wcol_tooltip = { - .outline = RGBA(0x2f303500), + .outline = RGBA(0x2f3035ff), .inner = RGBA(0x19191aef), .inner_sel = RGBA(0x19191aef), .item = RGBA(0x19191aef), @@ -172,7 +172,7 @@ const bTheme U_theme_default = { .roundness = 0.25f, }, .wcol_box = { - .outline = RGBA(0x2d2e3300), + .outline = RGBA(0x2d2e33ff), .inner = RGBA(0x43454dff), .inner_sel = RGBA(0x3f7780ff), .item = RGBA(0x191919ff), @@ -181,7 +181,7 @@ const bTheme U_theme_default = { .roundness = 0.2f, }, .wcol_scroll = { - .outline = RGBA(0x2f303500), + .outline = RGBA(0x2f3035ff), .inner = RGBA(0x585a6700), .inner_sel = RGBA(0x599eb3ff), .item = RGBA(0x585a67ff), @@ -192,7 +192,7 @@ const bTheme U_theme_default = { .roundness = 0.5f, }, .wcol_progress = { - .outline = RGBA(0xb3b3b300), + .outline = RGBA(0xb3b3b3ff), .inner = RGBA(0xccccccff), .inner_sel = RGBA(0x646464b4), .item = RGBA(0x599eb3ff), @@ -201,7 +201,7 @@ const bTheme U_theme_default = { .roundness = 0.25f, }, .wcol_list_item = { - .outline = RGBA(0x28292d00), + .outline = RGBA(0x28292dff), .inner = RGBA(0x28292d00), .inner_sel = RGBA(0x5f616fff), .item = RGBA(0x599eb3ff), @@ -210,7 +210,7 @@ const bTheme U_theme_default = { .roundness = 0.2f, }, .wcol_pie_menu = { - .outline = RGBA(0x29282e00), + .outline = RGBA(0x29282eff), .inner = RGBA(0x29282eff), .inner_sel = RGBA(0x505158ff), .item = RGBA(0x696a72ff), @@ -221,7 +221,7 @@ const bTheme U_theme_default = { .roundness = 0.5f, }, .wcol_state = { - .inner_anim = RGBA(0x73be4c00), + .inner_anim = RGBA(0x73be4cff), .inner_anim_sel = RGBA(0x5aa633ff), .inner_key = RGBA(0xf0eb64ff), .inner_key_sel = RGBA(0xd7d34bff), diff --git a/release/scripts/startup/bl_operators/screen_play_rendered_anim.py b/release/scripts/startup/bl_operators/screen_play_rendered_anim.py index 8e95d2b9ac1..46cf07be0f5 100644 --- a/release/scripts/startup/bl_operators/screen_play_rendered_anim.py +++ b/release/scripts/startup/bl_operators/screen_play_rendered_anim.py @@ -75,10 +75,12 @@ class PlayRenderedAnim(Operator): def execute(self, context): import subprocess + from shlex import quote scene = context.scene rd = scene.render prefs = context.user_preferences + fps_final = rd.fps / rd.fps_base preset = prefs.filepaths.animation_player_preset player_path = prefs.filepaths.animation_player @@ -112,7 +114,7 @@ class PlayRenderedAnim(Operator): file = rd.frame_path(frame=scene.frame_start, preview=scene.use_preview_range) file = bpy.path.abspath(file) # expand '//' if not os.path.exists(file): - self.report({'WARNING'}, "File %r not found" % file) + self.report({'WARNING'}, f"File {file!r} not found") path_valid = False # one last try for full range if we used preview range @@ -120,7 +122,7 @@ class PlayRenderedAnim(Operator): file = rd.frame_path(frame=scene.frame_start, preview=False) file = bpy.path.abspath(file) # expand '//' if not os.path.exists(file): - self.report({'WARNING'}, "File %r not found" % file) + self.report({'WARNING'}, f"File {file!r} not found") cmd = [player_path] # extra options, fps controls etc. @@ -131,31 +133,34 @@ class PlayRenderedAnim(Operator): frame_start = scene.frame_start frame_end = scene.frame_end if preset == 'INTERNAL': - opts = ["-a", - "-f", str(rd.fps), str(rd.fps_base), - "-s", str(frame_start), - "-e", str(frame_end), - "-j", str(scene.frame_step), - file] + opts = [ + "-a", + "-f", str(rd.fps), str(rd.fps_base), + "-s", str(frame_start), + "-e", str(frame_end), + "-j", str(scene.frame_step), + file, + ] cmd.extend(opts) elif preset == 'DJV': - opts = [file, "-playback_speed", "%d" % int(rd.fps / rd.fps_base)] + opts = [file, "-playback_speed", str(int(fps_final))] cmd.extend(opts) elif preset == 'FRAMECYCLER': - opts = [file, "%d-%d" % (scene.frame_start, scene.frame_end)] + opts = [file, f"{scene.frame_start:d}-{scene.frame_end:d}"] cmd.extend(opts) elif preset == 'RV': - opts = ["-fps", str(rd.fps), "-play", "[ %s ]" % file] + opts = ["-fps", str(rd.fps), "-play", f"[ {file} ]"] cmd.extend(opts) elif preset == 'MPLAYER': opts = [] if is_movie: opts.append(file) else: - opts += [("mf://%s" % file.replace("#", "?")), - "-mf", - "fps=%.4f" % (rd.fps / rd.fps_base), - ] + opts += [ + ("mf://" + file.replace("#", "?")), + "-mf", + f"fps={fps_final:4f}" + ] opts += ["-loop", "0", "-really-quiet", "-fs"] cmd.extend(opts) @@ -163,7 +168,7 @@ class PlayRenderedAnim(Operator): cmd.append(file) # launch it - print("Executing command:\n %r" % " ".join(cmd)) + print("Executing command:\n ", " ".join(quote(c) for c in cmd)) # workaround for boost 1.46, can be eventually removed. bug: [#32350] env_copy = os.environ.copy() @@ -174,9 +179,11 @@ class PlayRenderedAnim(Operator): try: subprocess.Popen(cmd, env=env_copy) except Exception as e: - self.report({'ERROR'}, - "Couldn't run external animation player with command " - "%r\n%s" % (" ".join(cmd), str(e))) + self.report( + {'ERROR'}, + "Couldn't run external animation player with command " + f"{cmd!r}\n{e!s}", + ) return {'CANCELLED'} return {'FINISHED'} diff --git a/release/scripts/startup/bl_ui/properties_data_camera.py b/release/scripts/startup/bl_ui/properties_data_camera.py index 10709676b85..3b5f21d616e 100644 --- a/release/scripts/startup/bl_ui/properties_data_camera.py +++ b/release/scripts/startup/bl_ui/properties_data_camera.py @@ -242,7 +242,7 @@ class DATA_PT_camera_dof_aperture(CameraButtonsPanel, Panel): cam = context.camera dof_options = cam.gpu_dof - flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=False, align=False) + flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False) if context.engine == 'BLENDER_EEVEE': col = flow.column() diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py index 17034689528..63b708ae059 100644 --- a/release/scripts/startup/bl_ui/properties_object.py +++ b/release/scripts/startup/bl_ui/properties_object.py @@ -50,7 +50,7 @@ class OBJECT_PT_transform(ObjectButtonsPanel, Panel): layout = self.layout layout.use_property_split = True - flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=False, align=False) + flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False) ob = context.object @@ -106,7 +106,7 @@ class OBJECT_PT_delta_transform(ObjectButtonsPanel, Panel): def draw(self, context): layout = self.layout layout.use_property_split = True - flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=True, align=False) + flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=True, align=False) ob = context.object @@ -136,7 +136,7 @@ class OBJECT_PT_relations(ObjectButtonsPanel, Panel): def draw(self, context): layout = self.layout layout.use_property_split = True - flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=False, align=False) + flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False) ob = context.object @@ -222,7 +222,7 @@ class OBJECT_PT_display(ObjectButtonsPanel, Panel): def draw(self, context): layout = self.layout layout.use_property_split = True - flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=False, align=False) + flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False) obj = context.object obj_type = obj.type @@ -285,7 +285,7 @@ class OBJECT_PT_duplication(ObjectButtonsPanel, Panel): row.prop(ob, "dupli_type", expand=True) layout.use_property_split = True - flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=False, align=False) + flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False) if ob.dupli_type == 'FRAMES': diff --git a/release/scripts/startup/bl_ui/properties_physics_field.py b/release/scripts/startup/bl_ui/properties_physics_field.py index 7683c953340..3b01015047f 100644 --- a/release/scripts/startup/bl_ui/properties_physics_field.py +++ b/release/scripts/startup/bl_ui/properties_physics_field.py @@ -212,7 +212,7 @@ class PHYSICS_PT_collision_particle(PhysicButtonsPanel, Panel): md = context.collision layout.use_property_split = True - flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=False, align=False) + flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False) coll = md.settings @@ -252,7 +252,7 @@ class PHYSICS_PT_collision_softbody(PhysicButtonsPanel, Panel): layout = self.layout layout.use_property_split = True - flow = layout.grid_flow(row_major=True, num_columns=0, even_columns=True, even_rows=False, align=False) + flow = layout.grid_flow(row_major=True, columns=0, even_columns=True, even_rows=False, align=False) md = context.collision coll = md.settings diff --git a/release/scripts/startup/bl_ui/space_dopesheet.py b/release/scripts/startup/bl_ui/space_dopesheet.py index 0260864cfb3..22c1f17217e 100644 --- a/release/scripts/startup/bl_ui/space_dopesheet.py +++ b/release/scripts/startup/bl_ui/space_dopesheet.py @@ -120,7 +120,7 @@ class DopesheetFilterPopoverBase: # datablock filters layout.label("Include From Types:") - flow = layout.grid_flow(row_major=True, num_columns=2, even_rows=False, align=False) + flow = layout.grid_flow(row_major=True, columns=2, even_rows=False, align=False) flow.prop(dopesheet, "show_scenes", text="Scenes") flow.prop(dopesheet, "show_worlds", text="Worlds") diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py index 19516fda301..94a8bef0b88 100644 --- a/release/scripts/startup/bl_ui/space_topbar.py +++ b/release/scripts/startup/bl_ui/space_topbar.py @@ -579,11 +579,53 @@ class INFO_MT_help(Menu): layout.operator("wm.splash", icon='BLENDER') +class TOPBAR_MT_file_specials(Menu): + bl_label = "File Context Menu" + + def draw(self, context): + layout = self.layout + + layout.operator_context = 'INVOKE_AREA' + layout.operator("wm.link", text="Link", icon='LINK_BLEND') + layout.operator("wm.append", text="Append", icon='APPEND_BLEND') + + layout.separator() + + layout.menu("INFO_MT_file_import", icon='IMPORT') + layout.menu("INFO_MT_file_export", icon='EXPORT') + + +class TOPBAR_MT_window_specials(Menu): + bl_label = "Window Context Menu" + + def draw(self, context): + layout = self.layout + + layout.operator_context = 'EXEC_AREA' + + layout.operator("wm.window_new") + + layout.operator_context = 'INVOKE_AREA' + + layout.operator("screen.area_dupli") + + layout.separator() + + layout.operator("screen.area_split", text="Horizontal Split").direction = 'HORIZONTAL' + layout.operator("screen.area_split", text="Vertical Split").direction = 'VERTICAL' + + layout.separator() + + layout.operator("screen.userpref_show", text="User Preferences...", icon='PREFERENCES') + + classes = ( TOPBAR_HT_upper_bar, TOPBAR_HT_lower_bar, TOPBAR_PT_pivot_point, TOPBAR_PT_snapping, + TOPBAR_MT_file_specials, + TOPBAR_MT_window_specials, INFO_MT_editor_menus, INFO_MT_file, INFO_MT_file_import, diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py index 6645a1b12ef..8a76963d4a1 100644 --- a/release/scripts/startup/bl_ui/space_view3d.py +++ b/release/scripts/startup/bl_ui/space_view3d.py @@ -3658,7 +3658,7 @@ class VIEW3D_PT_shading_lighting(Panel): sub = row.column() sub.operator('wm.studiolight_userpref_show', emboss=False, text="", icon='PREFERENCES') if shading.selected_studio_light.orientation == 'WORLD': - layout.row().prop(shading, "studiolight_rot_z") + layout.row().prop(shading, "studiolight_rotate_z") elif shading.light == 'MATCAP': row = layout.row() @@ -3673,7 +3673,7 @@ class VIEW3D_PT_shading_lighting(Panel): sub = row.column() sub.operator('wm.studiolight_userpref_show', emboss=False, text="", icon='PREFERENCES') if shading.selected_studio_light.orientation == 'WORLD': - layout.row().prop(shading, "studiolight_rot_z") + layout.row().prop(shading, "studiolight_rotate_z") layout.row().prop(shading, "studiolight_background_alpha") layout.prop(shading, "use_scene_light") diff --git a/source/blender/alembic/intern/abc_customdata.cc b/source/blender/alembic/intern/abc_customdata.cc index 8ab9f1118f4..87545007870 100644 --- a/source/blender/alembic/intern/abc_customdata.cc +++ b/source/blender/alembic/intern/abc_customdata.cc @@ -26,7 +26,14 @@ #include <Alembic/AbcGeom/All.h> #include <algorithm> + +#if (__cplusplus > 199711L) || (defined(_MSC_VER) && _MSC_VER >= 1900) #include <unordered_map> +typedef std::unordered_map<uint64_t, int> uv_index_map; +#else +#include <map> +typedef std::map<uint64_t, int> uv_index_map; +#endif extern "C" { #include "DNA_customdata_types.h" @@ -106,7 +113,7 @@ static void get_uvs(const CDStreamConfig &config, } } else { - std::unordered_map<uint64_t, int> idx_map; + uv_index_map idx_map; int idx_count = 0; for (int i = 0; i < num_poly; ++i) { @@ -117,7 +124,7 @@ static void get_uvs(const CDStreamConfig &config, loopuvpoly--; Imath::V2f uv(loopuvpoly->uv[0], loopuvpoly->uv[1]); uint64_t k = uv_to_hash_key(uv); - std::unordered_map<uint64_t, int>::iterator it = idx_map.find(k); + uv_index_map::iterator it = idx_map.find(k); if (it == idx_map.end()) { idx_map[k] = idx_count; uvs.push_back(uv); diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h index 975cea7364d..4843ee9d9b8 100644 --- a/source/blender/blenkernel/BKE_curve.h +++ b/source/blender/blenkernel/BKE_curve.h @@ -99,7 +99,7 @@ void BKE_curve_transform(struct Curve *cu, float mat[4][4], const bool do_keys, void BKE_curve_translate(struct Curve *cu, float offset[3], const bool do_keys); void BKE_curve_material_index_remove(struct Curve *cu, int index); void BKE_curve_material_index_clear(struct Curve *cu); -int BKE_curve_material_index_validate(struct Curve *cu); +bool BKE_curve_material_index_validate(struct Curve *cu); void BKE_curve_material_remap(struct Curve *cu, const unsigned int *remap, unsigned int remap_len); ListBase *BKE_curve_nurbs_get(struct Curve *cu); diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 76205da9565..c87c22953f1 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -467,9 +467,9 @@ void BKE_mesh_calc_relative_deform( /* *** mesh_validate.c *** */ -int BKE_mesh_validate(struct Mesh *me, const int do_verbose, const int cddata_check_mask); +bool BKE_mesh_validate(struct Mesh *me, const bool do_verbose, const bool cddata_check_mask); bool BKE_mesh_is_valid(struct Mesh *me); -int BKE_mesh_validate_material_indices(struct Mesh *me); +bool BKE_mesh_validate_material_indices(struct Mesh *me); bool BKE_mesh_validate_arrays( struct Mesh *me, diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 63398ec9f5e..1578176d465 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -203,9 +203,9 @@ typedef struct bNodeType { void (*copyfunc_api)(struct PointerRNA *ptr, struct bNode *src_node); /* can this node type be added to a node tree */ - int (*poll)(struct bNodeType *ntype, struct bNodeTree *nodetree); + bool (*poll)(struct bNodeType *ntype, struct bNodeTree *nodetree); /* can this node be added to a node tree */ - int (*poll_instance)(struct bNode *node, struct bNodeTree *nodetree); + bool (*poll_instance)(struct bNode *node, struct bNodeTree *nodetree); /* optional handling of link insertion */ void (*insert_link)(struct bNodeTree *ntree, struct bNode *node, struct bNodeLink *link); @@ -285,7 +285,7 @@ typedef struct bNodeTreeType { void (*free_node_cache)(struct bNodeTree *ntree, struct bNode *node); void (*foreach_nodeclass)(struct Scene *scene, void *calldata, bNodeClassCallback func); /* iteration over all node classes */ /* Check visibility in the node editor */ - int (*poll)(const struct bContext *C, struct bNodeTreeType *ntreetype); + bool (*poll)(const struct bContext *C, struct bNodeTreeType *ntreetype); /* Select a node tree from the context */ void (*get_from_context)(const struct bContext *C, struct bNodeTreeType *ntreetype, struct bNodeTree **r_ntree, struct ID **r_id, struct ID **r_from); @@ -298,7 +298,7 @@ typedef struct bNodeTreeType { /* Tree update. Overrides nodetype->updatetreefunc! */ void (*update)(struct bNodeTree *ntree); - int (*validate_link)(struct bNodeTree *ntree, struct bNodeLink *link); + bool (*validate_link)(struct bNodeTree *ntree, struct bNodeLink *link); void (*node_add_init)(struct bNodeTree *ntree, struct bNode *bnode); diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h index 3f3eca7d34b..53ebc9ba28e 100644 --- a/source/blender/blenkernel/BKE_screen.h +++ b/source/blender/blenkernel/BKE_screen.h @@ -213,7 +213,7 @@ typedef struct PanelType { int flag; /* verify if the panel should draw or not */ - int (*poll)(const struct bContext *C, struct PanelType *pt); + bool (*poll)(const struct bContext *C, struct PanelType *pt); /* draw header (optional) */ void (*draw_header)(const struct bContext *C, struct Panel *pa); /* draw header preset (optional) */ @@ -304,7 +304,7 @@ typedef struct MenuType { const char *description; /* verify if the menu should draw or not */ - int (*poll)(const struct bContext *C, struct MenuType *mt); + bool (*poll)(const struct bContext *C, struct MenuType *mt); /* draw entirely, view changes should be handled here */ void (*draw)(const struct bContext *C, struct Menu *menu); diff --git a/source/blender/blenkernel/intern/blender_user_menu.c b/source/blender/blenkernel/intern/blender_user_menu.c index 387776aa144..3ec46e23cd1 100644 --- a/source/blender/blenkernel/intern/blender_user_menu.c +++ b/source/blender/blenkernel/intern/blender_user_menu.c @@ -76,14 +76,17 @@ bUserMenuItem *BKE_blender_user_menu_item_add(ListBase *lb, int type) { uint size; - if (type == USER_MENU_TYPE_OPERATOR) { + if (type == USER_MENU_TYPE_SEP) { + size = sizeof(bUserMenuItem); + } + else if (type == USER_MENU_TYPE_OPERATOR) { size = sizeof(bUserMenuItem_Op); } else if (type == USER_MENU_TYPE_MENU) { size = sizeof(bUserMenuItem_Menu); } - else if (type == USER_MENU_TYPE_SEP) { - size = sizeof(bUserMenuItem); + else if (type == USER_MENU_TYPE_PROP) { + size = sizeof(bUserMenuItem_Prop); } else { BLI_assert(0); diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index f6dd630e077..33a24f77937 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -5160,7 +5160,7 @@ void BKE_curve_material_index_clear(Curve *cu) } } -int BKE_curve_material_index_validate(Curve *cu) +bool BKE_curve_material_index_validate(Curve *cu) { const int curvetype = BKE_curve_type_get(cu); bool is_valid = true; diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c index 62d8210d147..0dca41e60e6 100644 --- a/source/blender/blenkernel/intern/mesh_validate.c +++ b/source/blender/blenkernel/intern/mesh_validate.c @@ -975,7 +975,7 @@ bool BKE_mesh_validate_all_customdata(CustomData *vdata, CustomData *edata, * * \returns true if a change is made. */ -int BKE_mesh_validate(Mesh *me, const int do_verbose, const int cddata_check_mask) +bool BKE_mesh_validate(Mesh *me, const bool do_verbose, const bool cddata_check_mask) { bool is_valid = true; bool changed; @@ -1050,7 +1050,7 @@ bool BKE_mesh_is_valid(Mesh *me) * Check all material indices of polygons are valid, invalid ones are set to 0. * \returns is_valid. */ -int BKE_mesh_validate_material_indices(Mesh *me) +bool BKE_mesh_validate_material_indices(Mesh *me) { MPoly *mp; const int max_idx = max_ii(0, me->totcol - 1); diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index 9de31205504..f7cd2bd52dc 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -3141,13 +3141,13 @@ static void node_type_base_defaults(bNodeType *ntype) } /* allow this node for any tree type */ -static int node_poll_default(bNodeType *UNUSED(ntype), bNodeTree *UNUSED(ntree)) +static bool node_poll_default(bNodeType *UNUSED(ntype), bNodeTree *UNUSED(ntree)) { return true; } /* use the basic poll function */ -static int node_poll_instance_default(bNode *node, bNodeTree *ntree) +static bool node_poll_instance_default(bNode *node, bNodeTree *ntree) { return node->typeinfo->poll(node->typeinfo, ntree); } @@ -3340,7 +3340,7 @@ void node_type_compatibility(struct bNodeType *ntype, short compatibility) /* callbacks for undefined types */ -static int node_undefined_poll(bNodeType *UNUSED(ntype), bNodeTree *UNUSED(nodetree)) +static bool node_undefined_poll(bNodeType *UNUSED(ntype), bNodeTree *UNUSED(nodetree)) { /* this type can not be added deliberately, it's just a placeholder */ return false; diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 61762b5d7ed..e7bca4c7e5b 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -1254,6 +1254,14 @@ static void write_userdef(WriteData *wd, const UserDef *userdef) IDP_WriteProperty(umi_op->prop, wd); } } + else if (umi->type == USER_MENU_TYPE_MENU) { + const bUserMenuItem_Menu *umi_mt = (const bUserMenuItem_Menu *)umi; + writestruct(wd, DATA, bUserMenuItem_Menu, 1, umi_mt); + } + else if (umi->type == USER_MENU_TYPE_PROP) { + const bUserMenuItem_Prop *umi_pr = (const bUserMenuItem_Prop *)umi; + writestruct(wd, DATA, bUserMenuItem_Prop, 1, umi_pr); + } else { writestruct(wd, DATA, bUserMenuItem, 1, umi); } diff --git a/source/blender/draw/intern/draw_common.c b/source/blender/draw/intern/draw_common.c index d40378dec2d..a1c60be4742 100644 --- a/source/blender/draw/intern/draw_common.c +++ b/source/blender/draw/intern/draw_common.c @@ -254,14 +254,14 @@ DRWShadingGroup *shgroup_dynlines_dashed_uniform_color(DRWPass *pass, float colo { GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR); - static float dash_width = 12.0f; + static float dash_width = 6.0f; static float dash_factor = 0.5f; DRWShadingGroup *grp = DRW_shgroup_line_batch_create(sh, pass); DRW_shgroup_uniform_vec4(grp, "color", color, 1); DRW_shgroup_uniform_vec2(grp, "viewport_size", DRW_viewport_size_get(), 1); DRW_shgroup_uniform_float(grp, "dash_width", &dash_width, 1); DRW_shgroup_uniform_float(grp, "dash_factor", &dash_factor, 1); - DRW_shgroup_uniform_int_copy(grp, "num_colors", 0); /* "simple" mode */ + DRW_shgroup_uniform_int_copy(grp, "colors_len", 0); /* "simple" mode */ return grp; } diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c index 288a7f80e1e..736bde725ae 100644 --- a/source/blender/draw/modes/object_mode.c +++ b/source/blender/draw/modes/object_mode.c @@ -1932,13 +1932,8 @@ static void DRW_shgroup_lightprobe(OBJECT_StorageList *stl, OBJECT_PassList *psl static void DRW_shgroup_relationship_lines(OBJECT_StorageList *stl, Object *ob) { if (ob->parent && DRW_check_object_visible_within_active_context(ob->parent)) { - /* Only draw relationship lines when object or its parent are selected - * as a way of reducing visual clutter. - */ - if ((ob->base_flag & BASE_SELECTED) || (ob->parent->base_flag & BASE_SELECTED)) { - DRW_shgroup_call_dynamic_add(stl->g_data->relationship_lines, ob->parent->obmat[3]); - DRW_shgroup_call_dynamic_add(stl->g_data->relationship_lines, ob->obmat[3]); - } + DRW_shgroup_call_dynamic_add(stl->g_data->relationship_lines, ob->parent->obmat[3]); + DRW_shgroup_call_dynamic_add(stl->g_data->relationship_lines, ob->obmat[3]); } if (ob->rigidbody_constraint) { diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 57a3d52731d..f629c20b04a 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -659,7 +659,7 @@ void ANIM_fcurve_delete_from_animdata(bAnimContext *ac, AnimData *adt, FCurve *f /* ****************** Operator Utilities ********************************** */ /* poll callback for being in an Animation Editor channels list region */ -static int animedit_poll_channels_active(bContext *C) +static bool animedit_poll_channels_active(bContext *C) { ScrArea *sa = CTX_wm_area(C); @@ -675,7 +675,7 @@ static int animedit_poll_channels_active(bContext *C) } /* poll callback for Animation Editor channels list region + not in NLA-tweakmode for NLA */ -static int animedit_poll_channels_nla_tweakmode_off(bContext *C) +static bool animedit_poll_channels_nla_tweakmode_off(bContext *C) { ScrArea *sa = CTX_wm_area(C); Scene *scene = CTX_data_scene(C); @@ -1415,7 +1415,7 @@ static void ANIM_OT_channels_move(wmOperatorType *ot) /* ******************** Group Channel Operator ************************ */ -static int animchannels_grouping_poll(bContext *C) +static bool animchannels_grouping_poll(bContext *C) { ScrArea *sa = CTX_wm_area(C); SpaceLink *sl; @@ -2190,7 +2190,7 @@ static void ANIM_OT_channels_clean_empty(wmOperatorType *ot) /* ******************* Reenable Disabled Operator ******************* */ -static int animchannels_enable_poll(bContext *C) +static bool animchannels_enable_poll(bContext *C) { ScrArea *sa = CTX_wm_area(C); @@ -2264,7 +2264,7 @@ static void ANIM_OT_channels_fcurves_enable(wmOperatorType *ot) /* ****************** Find / Set Filter Operator ******************** */ /* XXX: make this generic? */ -static int animchannels_find_poll(bContext *C) +static bool animchannels_find_poll(bContext *C) { ScrArea *sa = CTX_wm_area(C); @@ -3207,9 +3207,7 @@ void ED_keymap_animchannels(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "ANIM_OT_channels_select_border", EVT_TWEAK_L, KM_ANY, 0, 0); /* delete */ -#ifdef USE_WM_KEYMAP_27X WM_keymap_add_item(keymap, "ANIM_OT_channels_delete", XKEY, KM_PRESS, 0, 0); -#endif WM_keymap_add_item(keymap, "ANIM_OT_channels_delete", DELKEY, KM_PRESS, 0, 0); /* settings */ diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index de133663ee6..f4144d13028 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -541,7 +541,7 @@ void ED_markers_draw(const bContext *C, int flag) /* ------------------------ */ /* special poll() which checks if there are selected markers first */ -static int ed_markers_poll_selected_markers(bContext *C) +static bool ed_markers_poll_selected_markers(bContext *C) { ListBase *markers = ED_context_get_markers(C); @@ -553,7 +553,7 @@ static int ed_markers_poll_selected_markers(bContext *C) return ED_markers_get_first_selected(markers) != NULL; } -static int ed_markers_poll_selected_no_locked_markers(bContext *C) +static bool ed_markers_poll_selected_no_locked_markers(bContext *C) { ListBase *markers = ED_context_get_markers(C); ToolSettings *ts = CTX_data_tool_settings(C); @@ -571,7 +571,7 @@ static int ed_markers_poll_selected_no_locked_markers(bContext *C) /* special poll() which checks if there are any markers at all first */ -static int ed_markers_poll_markers_exist(bContext *C) +static bool ed_markers_poll_markers_exist(bContext *C) { ListBase *markers = ED_context_get_markers(C); ToolSettings *ts = CTX_data_tool_settings(C); @@ -1671,10 +1671,10 @@ void ED_keymap_marker(wmKeyConfig *keyconf) WM_keymap_verify_item(keymap, "MARKER_OT_select_border", BKEY, KM_PRESS, 0, 0); WM_keymap_verify_item(keymap, "MARKER_OT_select_all", AKEY, KM_PRESS, 0, 0); -#ifdef USE_WM_KEYMAP_27X + WM_keymap_add_item(keymap, "MARKER_OT_delete", XKEY, KM_PRESS, 0, 0); -#endif WM_keymap_add_item(keymap, "MARKER_OT_delete", DELKEY, KM_PRESS, 0, 0); + WM_keymap_verify_item(keymap, "MARKER_OT_rename", MKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "MARKER_OT_move", GKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index 4402ca78976..5f6b299c617 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -64,7 +64,7 @@ /* ********************** frame change operator ***************************/ /* Check if the operator can be run from the current context */ -static int change_frame_poll(bContext *C) +static bool change_frame_poll(bContext *C) { ScrArea *sa = CTX_wm_area(C); @@ -279,7 +279,7 @@ static void ANIM_OT_change_frame(wmOperatorType *ot) /* ****************** Start/End Frame Operators *******************************/ -static int anim_set_end_frames_poll(bContext *C) +static bool anim_set_end_frames_poll(bContext *C) { ScrArea *sa = CTX_wm_area(C); diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c index f303be0dd76..99725c7da99 100644 --- a/source/blender/editors/animation/drivers.c +++ b/source/blender/editors/animation/drivers.c @@ -819,7 +819,7 @@ static const EnumPropertyItem *driver_mapping_type_itemsf(bContext *C, PointerRN /* Add Driver (With Menu) Button Operator ------------------------ */ -static int add_driver_button_poll(bContext *C) +static bool add_driver_button_poll(bContext *C) { PointerRNA ptr = {{NULL}}; PropertyRNA *prop = NULL; diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index fe5714aba2e..e234a3a131a 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -1331,7 +1331,7 @@ enum { * This is based on the standard ED_operator_areaactive callback, * except that it does special checks for a few spacetypes too... */ -static int modify_key_op_poll(bContext *C) +static bool modify_key_op_poll(bContext *C) { ScrArea *sa = CTX_wm_area(C); Scene *scene = CTX_data_scene(C); diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index 5bf23a53819..b5a998f60da 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -74,14 +74,14 @@ */ /* poll callback for adding default KeyingSet */ -static int keyingset_poll_default_add(bContext *C) +static bool keyingset_poll_default_add(bContext *C) { /* as long as there's an active Scene, it's fine */ return (CTX_data_scene(C) != NULL); } /* poll callback for editing active KeyingSet */ -static int keyingset_poll_active_edit(bContext *C) +static bool keyingset_poll_active_edit(bContext *C) { Scene *scene = CTX_data_scene(C); @@ -93,7 +93,7 @@ static int keyingset_poll_active_edit(bContext *C) } /* poll callback for editing active KeyingSet Path */ -static int keyingset_poll_activePath_edit(bContext *C) +static bool keyingset_poll_activePath_edit(bContext *C) { Scene *scene = CTX_data_scene(C); KeyingSet *ks; diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c index e54769221f5..067b9fd76a8 100644 --- a/source/blender/editors/armature/armature_ops.c +++ b/source/blender/editors/armature/armature_ops.c @@ -249,12 +249,14 @@ void ED_keymap_armature(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "ARMATURE_OT_shortest_path_pick", SELECTMOUSE, KM_PRESS, KM_CTRL, 0); -#ifdef USE_WM_KEYMAP_27X WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_armature_delete", XKEY, KM_PRESS, 0, 0); -#endif WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_armature_delete", DELKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "ARMATURE_OT_dissolve", XKEY, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "ARMATURE_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0); + + WM_keymap_add_item(keymap, "ARMATURE_OT_dissolve", XKEY, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "ARMATURE_OT_dissolve", DELKEY, KM_PRESS, KM_CTRL, 0); + WM_keymap_add_item(keymap, "ARMATURE_OT_extrude_move", EKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "ARMATURE_OT_extrude_forked", EKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "ARMATURE_OT_click_extrude", ACTIONMOUSE, KM_CLICK, KM_CTRL, 0); diff --git a/source/blender/editors/armature/armature_select.c b/source/blender/editors/armature/armature_select.c index e295e1fd35a..ae2e7339c66 100644 --- a/source/blender/editors/armature/armature_select.c +++ b/source/blender/editors/armature/armature_select.c @@ -349,7 +349,7 @@ static int armature_select_linked_invoke(bContext *C, wmOperator *op, const wmEv return OPERATOR_FINISHED; } -static int armature_select_linked_poll(bContext *C) +static bool armature_select_linked_poll(bContext *C) { return (ED_operator_view3d_active(C) && ED_operator_editarmature(C)); } diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c index ffe64cc24b0..661492ba056 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -294,7 +294,7 @@ void POSE_OT_paths_calculate(wmOperatorType *ot) /* --------- */ -static int pose_update_paths_poll(bContext *C) +static bool pose_update_paths_poll(bContext *C) { if (ED_operator_posemode_exclusive(C)) { Object *ob = CTX_data_active_object(C); @@ -773,7 +773,7 @@ void POSE_OT_rotation_mode_set(wmOperatorType *ot) /* ********************************************** */ -static int armature_layers_poll(bContext *C) +static bool armature_layers_poll(bContext *C) { /* Armature layers operators can be used in posemode OR editmode for armatures */ return ED_operator_posemode(C) || ED_operator_editarmature(C); @@ -806,7 +806,7 @@ static int pose_armature_layers_showall_exec(bContext *C, wmOperator *op) bArmature *arm = armature_layers_get_data(&ob); PointerRNA ptr; int maxLayers = (RNA_boolean_get(op->ptr, "all")) ? 32 : 16; - int layers[32] = {0}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */ + bool layers[32] = {false}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */ int i; /* sanity checking */ @@ -858,7 +858,7 @@ static int armature_layers_invoke(bContext *C, wmOperator *op, const wmEvent *ev Object *ob = CTX_data_active_object(C); bArmature *arm = armature_layers_get_data(&ob); PointerRNA ptr; - int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */ + bool layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */ /* sanity checking */ if (arm == NULL) @@ -879,7 +879,7 @@ static int armature_layers_exec(bContext *C, wmOperator *op) Object *ob = CTX_data_active_object(C); bArmature *arm = armature_layers_get_data(&ob); PointerRNA ptr; - int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */ + bool layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */ if (arm == NULL) { return OPERATOR_CANCELLED; @@ -923,7 +923,7 @@ void ARMATURE_OT_armature_layers(wmOperatorType *ot) /* Present a popup to get the layers that should be used */ static int pose_bone_layers_invoke(bContext *C, wmOperator *op, const wmEvent *event) { - int layers[32] = {0}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */ + bool layers[32] = {0}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */ /* get layers that are active already */ CTX_DATA_BEGIN (C, bPoseChannel *, pchan, selected_pose_bones) @@ -949,7 +949,7 @@ static int pose_bone_layers_exec(bContext *C, wmOperator *op) { Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); PointerRNA ptr; - int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */ + bool layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */ if (ob == NULL || ob->data == NULL) { return OPERATOR_CANCELLED; @@ -998,7 +998,7 @@ void POSE_OT_bone_layers(wmOperatorType *ot) /* Present a popup to get the layers that should be used */ static int armature_bone_layers_invoke(bContext *C, wmOperator *op, const wmEvent *event) { - int layers[32] = {0}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */ + bool layers[32] = {0}; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */ /* get layers that are active already */ CTX_DATA_BEGIN (C, EditBone *, ebone, selected_editable_bones) @@ -1026,7 +1026,7 @@ static int armature_bone_layers_exec(bContext *C, wmOperator *op) { Object *ob = CTX_data_edit_object(C); PointerRNA ptr; - int layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */ + bool layers[32]; /* hardcoded for now - we can only have 32 armature layers, so this should be fine... */ /* get the values set in the operator properties */ RNA_boolean_get_array(op->ptr, "layers", layers); @@ -1262,7 +1262,7 @@ static int toggle_bone_selection_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -static int pose_select_linked_poll(bContext *C) +static bool pose_select_linked_poll(bContext *C) { return (ED_operator_view3d_active(C) && ED_operator_posemode(C)); } diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c index 46663d7a771..2227bf33908 100644 --- a/source/blender/editors/armature/pose_lib.c +++ b/source/blender/editors/armature/pose_lib.c @@ -174,7 +174,7 @@ static Object *get_poselib_object(bContext *C) } /* Poll callback for operators that require existing PoseLib data (with poses) to work */ -static int has_poselib_pose_data_poll(bContext *C) +static bool has_poselib_pose_data_poll(bContext *C) { Object *ob = get_poselib_object(C); return (ob && ob->poselib); @@ -183,7 +183,7 @@ static int has_poselib_pose_data_poll(bContext *C) /* Poll callback for operators that require existing PoseLib data (with poses) * as they need to do some editing work on those poses (i.e. not on lib-linked actions) */ -static int has_poselib_pose_data_for_editing_poll(bContext *C) +static bool has_poselib_pose_data_for_editing_poll(bContext *C) { Object *ob = get_poselib_object(C); return (ob && ob->poselib && !ID_IS_LINKED(ob->poselib)); @@ -379,7 +379,7 @@ void POSELIB_OT_action_sanitize(wmOperatorType *ot) /* ------------------------------------------ */ /* Poll callback for adding poses to a PoseLib */ -static int poselib_add_poll(bContext *C) +static bool poselib_add_poll(bContext *C) { /* There are 2 cases we need to be careful with: * 1) When this operator is invoked from a hotkey, there may be no PoseLib yet diff --git a/source/blender/editors/armature/pose_select.c b/source/blender/editors/armature/pose_select.c index cafebb6ae95..72f0c68f660 100644 --- a/source/blender/editors/armature/pose_select.c +++ b/source/blender/editors/armature/pose_select.c @@ -390,7 +390,7 @@ static int pose_select_connected_invoke(bContext *C, wmOperator *op, const wmEve return OPERATOR_FINISHED; } -static int pose_select_linked_poll(bContext *C) +static bool pose_select_linked_poll(bContext *C) { return (ED_operator_view3d_active(C) && ED_operator_posemode(C)); } diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c index fbdc4219d02..29124f9c895 100644 --- a/source/blender/editors/curve/curve_ops.c +++ b/source/blender/editors/curve/curve_ops.c @@ -269,14 +269,10 @@ void ED_keymap_curve(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "CURVE_OT_make_segment", FKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "CURVE_OT_cyclic_toggle", CKEY, KM_PRESS, KM_ALT, 0); -#ifdef USE_WM_KEYMAP_27X WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_curve_delete", XKEY, KM_PRESS, 0, 0); -#endif WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_curve_delete", DELKEY, KM_PRESS, 0, 0); -#ifdef USE_WM_KEYMAP_27X WM_keymap_add_item(keymap, "CURVE_OT_dissolve_verts", XKEY, KM_PRESS, KM_CTRL, 0); -#endif WM_keymap_add_item(keymap, "CURVE_OT_dissolve_verts", DELKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "CURVE_OT_tilt_clear", TKEY, KM_PRESS, KM_ALT, 0); diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index aa50916f5e0..1d7a9ac46c7 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -6244,7 +6244,7 @@ bool ED_curve_active_center(Curve *cu, float center[3]) /******************** Match texture space operator ***********************/ -static int match_texture_space_poll(bContext *C) +static bool match_texture_space_poll(bContext *C) { Object *object = CTX_data_active_object(C); diff --git a/source/blender/editors/gpencil/gpencil_brush.c b/source/blender/editors/gpencil/gpencil_brush.c index d877ea03c5d..75e4c510bcf 100644 --- a/source/blender/editors/gpencil/gpencil_brush.c +++ b/source/blender/editors/gpencil/gpencil_brush.c @@ -1187,7 +1187,7 @@ static void gpsculpt_brush_exit(bContext *C, wmOperator *op) } /* poll callback for stroke sculpting operator(s) */ -static int gpsculpt_brush_poll(bContext *C) +static bool gpsculpt_brush_poll(bContext *C) { /* NOTE: this is a bit slower, but is the most accurate... */ return CTX_DATA_COUNT(C, editable_gpencil_strokes) != 0; diff --git a/source/blender/editors/gpencil/gpencil_convert.c b/source/blender/editors/gpencil/gpencil_convert.c index d2301337c0e..ccdbcba71f9 100644 --- a/source/blender/editors/gpencil/gpencil_convert.c +++ b/source/blender/editors/gpencil/gpencil_convert.c @@ -1291,7 +1291,7 @@ static void gp_convert_set_end_frame(struct Main *UNUSED(main), struct Scene *UN } } -static int gp_convert_poll(bContext *C) +static bool gp_convert_poll(bContext *C) { bGPdata *gpd = ED_gpencil_data_get_active(C); bGPDlayer *gpl = NULL; diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c index 9f437f28f0f..c28fea0fc41 100644 --- a/source/blender/editors/gpencil/gpencil_data.c +++ b/source/blender/editors/gpencil/gpencil_data.c @@ -131,7 +131,7 @@ void GPENCIL_OT_data_add(wmOperatorType *ot) /* ******************* Unlink Data ************************ */ /* poll callback for adding data/layers - special */ -static int gp_data_unlink_poll(bContext *C) +static bool gp_data_unlink_poll(bContext *C) { bGPdata **gpd_ptr = ED_gpencil_data_get_pointers(C, NULL); @@ -420,7 +420,7 @@ void GPENCIL_OT_hide(wmOperatorType *ot) /* ********************** Show All Layers ***************************** */ /* poll callback for showing layers */ -static int gp_reveal_poll(bContext *C) +static bool gp_reveal_poll(bContext *C) { return ED_gpencil_data_get_active(C) != NULL; } @@ -1811,7 +1811,7 @@ void GPENCIL_OT_palettecolor_hide(wmOperatorType *ot) /* ********************** Show All Colors ***************************** */ /* poll callback for showing colors */ -static int gp_palettecolor_reveal_poll(bContext *C) +static bool gp_palettecolor_reveal_poll(bContext *C) { return ED_gpencil_data_get_active(C) != NULL; } diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 45caadf3742..ec67b2da161 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -86,7 +86,7 @@ /* ************************************************ */ /* Stroke Edit Mode Management */ -static int gpencil_editmode_toggle_poll(bContext *C) +static bool gpencil_editmode_toggle_poll(bContext *C) { return ED_gpencil_data_get_active(C) != NULL; } @@ -131,7 +131,7 @@ void GPENCIL_OT_editmode_toggle(wmOperatorType *ot) /* Stroke Editing Operators */ /* poll callback for all stroke editing operators */ -static int gp_stroke_edit_poll(bContext *C) +static bool gp_stroke_edit_poll(bContext *C) { /* NOTE: this is a bit slower, but is the most accurate... */ return CTX_DATA_COUNT(C, editable_gpencil_strokes) != 0; @@ -517,7 +517,7 @@ void GPENCIL_OT_copy(wmOperatorType *ot) /* --------------------- */ /* Paste selected strokes */ -static int gp_strokes_paste_poll(bContext *C) +static bool gp_strokes_paste_poll(bContext *C) { /* 1) Must have GP datablock to paste to * - We don't need to have an active layer though, as that can easily get added @@ -784,7 +784,7 @@ void GPENCIL_OT_move_to_layer(wmOperatorType *ot) /* ********************* Add Blank Frame *************************** */ /* Basically the same as the drawing op */ -static int UNUSED_FUNCTION(gp_blank_frame_add_poll)(bContext *C) +static bool UNUSED_FUNCTION(gp_blank_frame_add_poll)(bContext *C) { if (ED_operator_regionactive(C)) { /* check if current context can support GPencil data */ @@ -864,7 +864,7 @@ void GPENCIL_OT_blank_frame_add(wmOperatorType *ot) /* ******************* Delete Active Frame ************************ */ -static int gp_actframe_delete_poll(bContext *C) +static bool gp_actframe_delete_poll(bContext *C) { bGPdata *gpd = ED_gpencil_data_get_active(C); bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd); @@ -916,7 +916,7 @@ void GPENCIL_OT_active_frame_delete(wmOperatorType *ot) /* **************** Delete All Active Frames ****************** */ -static int gp_actframe_delete_all_poll(bContext *C) +static bool gp_actframe_delete_all_poll(bContext *C) { bGPdata *gpd = ED_gpencil_data_get_active(C); @@ -1370,7 +1370,7 @@ void GPENCIL_OT_dissolve(wmOperatorType *ot) /* NOTE: For now, we only allow these in the 3D view, as other editors do not * define a cursor or gridstep which can be used */ -static int gp_snap_poll(bContext *C) +static bool gp_snap_poll(bContext *C) { bGPdata *gpd = CTX_data_gpencil_data(C); ScrArea *sa = CTX_wm_area(C); @@ -2090,7 +2090,7 @@ typedef enum eGP_ReprojectModes { GP_REPROJECT_SURFACE, } eGP_ReprojectModes; -static int gp_strokes_reproject_poll(bContext *C) +static bool gp_strokes_reproject_poll(bContext *C) { /* 2 Requirements: * - 1) Editable GP data diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h index 67b88efa285..90ff1e0bb25 100644 --- a/source/blender/editors/gpencil/gpencil_intern.h +++ b/source/blender/editors/gpencil/gpencil_intern.h @@ -94,12 +94,12 @@ bool gp_point_xy_to_3d(GP_SpaceConversion *gsc, struct Scene *scene, const float /* Poll Callbacks ------------------------------------ */ /* gpencil_utils.c */ -int gp_add_poll(struct bContext *C); -int gp_active_layer_poll(struct bContext *C); -int gp_active_brush_poll(struct bContext *C); -int gp_active_palette_poll(struct bContext *C); -int gp_active_palettecolor_poll(struct bContext *C); -int gp_brush_crt_presets_poll(bContext *C); +bool gp_add_poll(struct bContext *C); +bool gp_active_layer_poll(struct bContext *C); +bool gp_active_brush_poll(struct bContext *C); +bool gp_active_palette_poll(struct bContext *C); +bool gp_active_palettecolor_poll(struct bContext *C); +bool gp_brush_crt_presets_poll(bContext *C); /* Copy/Paste Buffer --------------------------------- */ /* gpencil_edit.c */ diff --git a/source/blender/editors/gpencil/gpencil_interpolate.c b/source/blender/editors/gpencil/gpencil_interpolate.c index 1b18c6f6731..cc30d7ec266 100644 --- a/source/blender/editors/gpencil/gpencil_interpolate.c +++ b/source/blender/editors/gpencil/gpencil_interpolate.c @@ -85,7 +85,7 @@ /* Core/Shared Utilities */ /* Poll callback for interpolation operators */ -static int gpencil_view3d_poll(bContext *C) +static bool gpencil_view3d_poll(bContext *C) { bGPdata *gpd = CTX_data_gpencil_data(C); bGPDlayer *gpl = CTX_data_active_gpencil_layer(C); @@ -1036,7 +1036,7 @@ void GPENCIL_OT_interpolate_sequence(wmOperatorType *ot) /* ******************** Remove Breakdowns ************************ */ -static int gpencil_interpolate_reverse_poll(bContext *C) +static bool gpencil_interpolate_reverse_poll(bContext *C) { if (!gpencil_view3d_poll(C)) { return 0; diff --git a/source/blender/editors/gpencil/gpencil_ops.c b/source/blender/editors/gpencil/gpencil_ops.c index 28d8c8c295b..f22d653800e 100644 --- a/source/blender/editors/gpencil/gpencil_ops.c +++ b/source/blender/editors/gpencil/gpencil_ops.c @@ -108,17 +108,14 @@ static void ed_keymap_gpencil_general(wmKeyConfig *keyconf) /* Delete Active Frame - For easier video tutorials/review sessions */ /* NOTE: This works even when not in EditMode */ -#ifdef USE_WM_KEYMAP_27X WM_keymap_add_item(keymap, "GPENCIL_OT_active_frames_delete_all", XKEY, KM_PRESS, 0, DKEY); -#else WM_keymap_add_item(keymap, "GPENCIL_OT_active_frames_delete_all", DELKEY, KM_PRESS, 0, DKEY); -#endif } /* ==================== */ /* Poll callback for stroke editing mode */ -static int gp_stroke_editmode_poll(bContext *C) +static bool gp_stroke_editmode_poll(bContext *C) { bGPdata *gpd = CTX_data_gpencil_data(C); return (gpd && (gpd->flag & GP_DATA_STROKE_EDITMODE)); @@ -242,21 +239,14 @@ static void ed_keymap_gpencil_editing(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "GPENCIL_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0); /* delete */ -#ifdef USE_WM_KEYMAP_27X WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_gpencil_delete", XKEY, KM_PRESS, 0, 0); -#endif WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_gpencil_delete", DELKEY, KM_PRESS, 0, 0); -#ifdef USE_WM_KEYMAP_27X WM_keymap_add_item(keymap, "GPENCIL_OT_dissolve", XKEY, KM_PRESS, KM_CTRL, 0); -#endif WM_keymap_add_item(keymap, "GPENCIL_OT_dissolve", DELKEY, KM_PRESS, KM_CTRL, 0); -#ifdef USE_WM_KEYMAP_27X WM_keymap_add_item(keymap, "GPENCIL_OT_active_frames_delete_all", XKEY, KM_PRESS, KM_SHIFT, 0); -#else WM_keymap_add_item(keymap, "GPENCIL_OT_active_frames_delete_all", DELKEY, KM_PRESS, KM_SHIFT, 0); -#endif /* menu edit specials */ WM_keymap_add_menu(keymap, "GPENCIL_MT_gpencil_edit_specials", WKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 0ae45a9fde8..483966c0c78 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -203,7 +203,7 @@ static void gp_session_validatebuffer(tGPsdata *p); /* Context Wrangling... */ /* check if context is suitable for drawing */ -static int gpencil_draw_poll(bContext *C) +static bool gpencil_draw_poll(bContext *C) { if (ED_operator_regionactive(C)) { /* check if current context can support GPencil data */ @@ -1895,7 +1895,7 @@ static void gpencil_draw_eraser(bContext *UNUSED(C), int x, int y, void *p_ptr) immUniform2f("viewport_size", viewport_size[2], viewport_size[3]); immUniformColor4f(1.0f, 0.39f, 0.39f, 0.78f); - immUniform1i("num_colors", 0); /* "simple" mode */ + immUniform1i("colors_len", 0); /* "simple" mode */ immUniform1f("dash_width", 12.0f); immUniform1f("dash_factor", 0.5f); diff --git a/source/blender/editors/gpencil/gpencil_select.c b/source/blender/editors/gpencil/gpencil_select.c index ac0b046e499..dd556e99264 100644 --- a/source/blender/editors/gpencil/gpencil_select.c +++ b/source/blender/editors/gpencil/gpencil_select.c @@ -67,7 +67,7 @@ /* ********************************************** */ /* Polling callbacks */ -static int gpencil_select_poll(bContext *C) +static bool gpencil_select_poll(bContext *C) { bGPdata *gpd = ED_gpencil_data_get_active(C); diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index 4ee3bdd587e..8b65855f7c4 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -262,14 +262,14 @@ bool ED_gpencil_has_keyframe_v3d(Scene *scene, Object *ob, int cfra) /* Poll Callbacks */ /* poll callback for adding data/layers - special */ -int gp_add_poll(bContext *C) +bool gp_add_poll(bContext *C) { /* the base line we have is that we have somewhere to add Grease Pencil data */ return ED_gpencil_data_get_pointers(C, NULL) != NULL; } /* poll callback for checking if there is an active layer */ -int gp_active_layer_poll(bContext *C) +bool gp_active_layer_poll(bContext *C) { bGPdata *gpd = ED_gpencil_data_get_active(C); bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd); @@ -278,7 +278,7 @@ int gp_active_layer_poll(bContext *C) } /* poll callback for checking if there is an active brush */ -int gp_active_brush_poll(bContext *C) +bool gp_active_brush_poll(bContext *C) { ToolSettings *ts = CTX_data_tool_settings(C); bGPDbrush *brush = BKE_gpencil_brush_getactive(ts); @@ -287,7 +287,7 @@ int gp_active_brush_poll(bContext *C) } /* poll callback for checking if there is an active palette */ -int gp_active_palette_poll(bContext *C) +bool gp_active_palette_poll(bContext *C) { bGPdata *gpd = ED_gpencil_data_get_active(C); bGPDpalette *palette = BKE_gpencil_palette_getactive(gpd); @@ -296,7 +296,7 @@ int gp_active_palette_poll(bContext *C) } /* poll callback for checking if there is an active palette color */ -int gp_active_palettecolor_poll(bContext *C) +bool gp_active_palettecolor_poll(bContext *C) { bGPdata *gpd = ED_gpencil_data_get_active(C); bGPDpalette *palette = BKE_gpencil_palette_getactive(gpd); diff --git a/source/blender/editors/include/ED_clip.h b/source/blender/editors/include/ED_clip.h index 91f8b39f7b9..4844d96e6e8 100644 --- a/source/blender/editors/include/ED_clip.h +++ b/source/blender/editors/include/ED_clip.h @@ -44,13 +44,13 @@ struct Scene; /* ** clip_editor.c ** */ /* common poll functions */ -int ED_space_clip_poll(struct bContext *C); +bool ED_space_clip_poll(struct bContext *C); -int ED_space_clip_view_clip_poll(struct bContext *C); +bool ED_space_clip_view_clip_poll(struct bContext *C); -int ED_space_clip_tracking_poll(struct bContext *C); -int ED_space_clip_maskedit_poll(struct bContext *C); -int ED_space_clip_maskedit_mask_poll(struct bContext *C); +bool ED_space_clip_tracking_poll(struct bContext *C); +bool ED_space_clip_maskedit_poll(struct bContext *C); +bool ED_space_clip_maskedit_mask_poll(struct bContext *C); void ED_space_clip_get_size(struct SpaceClip *sc, int *width, int *height); void ED_space_clip_get_size_fl(struct SpaceClip *sc, float size[2]); diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h index ed9102a2d8b..f8af67b55ff 100644 --- a/source/blender/editors/include/ED_image.h +++ b/source/blender/editors/include/ED_image.h @@ -76,8 +76,8 @@ bool ED_space_image_show_uvedit(struct SpaceImage *sima, struct Object *obedit); bool ED_space_image_paint_curve(const struct bContext *C); bool ED_space_image_check_show_maskedit(struct SpaceImage *sima, struct ViewLayer *view_layer); -int ED_space_image_maskedit_poll(struct bContext *C); -int ED_space_image_maskedit_mask_poll(struct bContext *C); +bool ED_space_image_maskedit_poll(struct bContext *C); +bool ED_space_image_maskedit_mask_poll(struct bContext *C); void ED_image_draw_info(struct Scene *scene, struct ARegion *ar, bool color_manage, bool use_default_view, int channels, int x, int y, const unsigned char cp[4], const float fp[4], const float linearcol[4], int *zp, float *zpf); diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h index 5882c44a9b3..b0807c8e5ae 100644 --- a/source/blender/editors/include/ED_keyframing.h +++ b/source/blender/editors/include/ED_keyframing.h @@ -133,7 +133,7 @@ struct KeyingSetInfo; struct ExtensionRNA; /* Polling Callback for KeyingSets */ -typedef int (*cbKeyingSet_Poll)(struct KeyingSetInfo *ksi, struct bContext *C); +typedef bool (*cbKeyingSet_Poll)(struct KeyingSetInfo *ksi, struct bContext *C); /* Context Iterator Callback for KeyingSets */ typedef void (*cbKeyingSet_Iterator)(struct KeyingSetInfo *ksi, struct bContext *C, struct KeyingSet *ks); /* Property Specifier Callback for KeyingSets (called from iterators) */ diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 32504db6498..a473974eb3f 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -279,7 +279,7 @@ void ED_mesh_edges_remove(struct Mesh *mesh, struct ReportList *reports, int cou void ED_mesh_vertices_remove(struct Mesh *mesh, struct ReportList *reports, int count); void ED_mesh_calc_tessface(struct Mesh *mesh, bool free_mpoly); -void ED_mesh_update(struct Mesh *mesh, struct bContext *C, int calc_edges, int calc_tessface); +void ED_mesh_update(struct Mesh *mesh, struct bContext *C, bool calc_edges, bool calc_tessface); void ED_mesh_uv_texture_ensure(struct Mesh *me, const char *name); int ED_mesh_uv_texture_add(struct Mesh *me, const char *name, const bool active_set); diff --git a/source/blender/editors/include/ED_outliner.h b/source/blender/editors/include/ED_outliner.h index c1b3c3e9e1c..52fdeb2045c 100644 --- a/source/blender/editors/include/ED_outliner.h +++ b/source/blender/editors/include/ED_outliner.h @@ -30,7 +30,7 @@ struct bContext; struct ListBase; -int ED_outliner_collections_editor_poll(struct bContext *C); +bool ED_outliner_collections_editor_poll(struct bContext *C); void ED_outliner_selected_objects_get(const struct bContext *C, struct ListBase *objects); diff --git a/source/blender/editors/include/ED_physics.h b/source/blender/editors/include/ED_physics.h index 70b54a64d6b..32444beb0fe 100644 --- a/source/blender/editors/include/ED_physics.h +++ b/source/blender/editors/include/ED_physics.h @@ -40,9 +40,9 @@ struct Scene; struct Object; /* particle_edit.c */ -int PE_poll(struct bContext *C); -int PE_hair_poll(struct bContext *C); -int PE_poll_view3d(struct bContext *C); +bool PE_poll(struct bContext *C); +bool PE_hair_poll(struct bContext *C); +bool PE_poll_view3d(struct bContext *C); /* rigidbody_object.c */ bool ED_rigidbody_object_add(struct Main *bmain, struct Scene *scene, struct Object *ob, int type, struct ReportList *reports); diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index 0785b63ca37..0e335f89fb4 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -63,6 +63,7 @@ struct wmMsgSubscribeValue; struct wmOperatorType; struct IDProperty; struct MenuType; +struct PropertyRNA; /* regions */ void ED_region_do_listen( @@ -264,59 +265,59 @@ void ED_keymap_screen(struct wmKeyConfig *keyconf); void ED_operatortypes_workspace(void); /* operators; context poll callbacks */ -int ED_operator_screenactive(struct bContext *C); -int ED_operator_screen_mainwinactive(struct bContext *C); -int ED_operator_areaactive(struct bContext *C); -int ED_operator_regionactive(struct bContext *C); - -int ED_operator_scene(struct bContext *C); -int ED_operator_scene_editable(struct bContext *C); -int ED_operator_objectmode(struct bContext *C); - -int ED_operator_view3d_active(struct bContext *C); -int ED_operator_region_view3d_active(struct bContext *C); -int ED_operator_animview_active(struct bContext *C); -int ED_operator_outliner_active(struct bContext *C); -int ED_operator_outliner_active_no_editobject(struct bContext *C); -int ED_operator_file_active(struct bContext *C); -int ED_operator_action_active(struct bContext *C); -int ED_operator_buttons_active(struct bContext *C); -int ED_operator_node_active(struct bContext *C); -int ED_operator_node_editable(struct bContext *C); -int ED_operator_graphedit_active(struct bContext *C); -int ED_operator_sequencer_active(struct bContext *C); -int ED_operator_sequencer_active_editable(struct bContext *C); -int ED_operator_image_active(struct bContext *C); -int ED_operator_nla_active(struct bContext *C); -int ED_operator_info_active(struct bContext *C); -int ED_operator_console_active(struct bContext *C); - - -int ED_operator_object_active(struct bContext *C); -int ED_operator_object_active_editable(struct bContext *C); -int ED_operator_object_active_editable_mesh(struct bContext *C); -int ED_operator_object_active_editable_font(struct bContext *C); -int ED_operator_editmesh(struct bContext *C); -int ED_operator_editmesh_view3d(struct bContext *C); -int ED_operator_editmesh_region_view3d(struct bContext *C); -int ED_operator_editarmature(struct bContext *C); -int ED_operator_editcurve(struct bContext *C); -int ED_operator_editcurve_3d(struct bContext *C); -int ED_operator_editsurf(struct bContext *C); -int ED_operator_editsurfcurve(struct bContext *C); -int ED_operator_editsurfcurve_region_view3d(struct bContext *C); -int ED_operator_editfont(struct bContext *C); -int ED_operator_editlattice(struct bContext *C); -int ED_operator_editmball(struct bContext *C); -int ED_operator_uvedit(struct bContext *C); -int ED_operator_uvedit_space_image(struct bContext *C); -int ED_operator_uvmap(struct bContext *C); -int ED_operator_posemode_exclusive(struct bContext *C); -int ED_operator_posemode_context(struct bContext *C); -int ED_operator_posemode(struct bContext *C); -int ED_operator_posemode_local(struct bContext *C); -int ED_operator_mask(struct bContext *C); -int ED_operator_camera(struct bContext *C); +bool ED_operator_screenactive(struct bContext *C); +bool ED_operator_screen_mainwinactive(struct bContext *C); +bool ED_operator_areaactive(struct bContext *C); +bool ED_operator_regionactive(struct bContext *C); + +bool ED_operator_scene(struct bContext *C); +bool ED_operator_scene_editable(struct bContext *C); +bool ED_operator_objectmode(struct bContext *C); + +bool ED_operator_view3d_active(struct bContext *C); +bool ED_operator_region_view3d_active(struct bContext *C); +bool ED_operator_animview_active(struct bContext *C); +bool ED_operator_outliner_active(struct bContext *C); +bool ED_operator_outliner_active_no_editobject(struct bContext *C); +bool ED_operator_file_active(struct bContext *C); +bool ED_operator_action_active(struct bContext *C); +bool ED_operator_buttons_active(struct bContext *C); +bool ED_operator_node_active(struct bContext *C); +bool ED_operator_node_editable(struct bContext *C); +bool ED_operator_graphedit_active(struct bContext *C); +bool ED_operator_sequencer_active(struct bContext *C); +bool ED_operator_sequencer_active_editable(struct bContext *C); +bool ED_operator_image_active(struct bContext *C); +bool ED_operator_nla_active(struct bContext *C); +bool ED_operator_info_active(struct bContext *C); +bool ED_operator_console_active(struct bContext *C); + + +bool ED_operator_object_active(struct bContext *C); +bool ED_operator_object_active_editable(struct bContext *C); +bool ED_operator_object_active_editable_mesh(struct bContext *C); +bool ED_operator_object_active_editable_font(struct bContext *C); +bool ED_operator_editmesh(struct bContext *C); +bool ED_operator_editmesh_view3d(struct bContext *C); +bool ED_operator_editmesh_region_view3d(struct bContext *C); +bool ED_operator_editarmature(struct bContext *C); +bool ED_operator_editcurve(struct bContext *C); +bool ED_operator_editcurve_3d(struct bContext *C); +bool ED_operator_editsurf(struct bContext *C); +bool ED_operator_editsurfcurve(struct bContext *C); +bool ED_operator_editsurfcurve_region_view3d(struct bContext *C); +bool ED_operator_editfont(struct bContext *C); +bool ED_operator_editlattice(struct bContext *C); +bool ED_operator_editmball(struct bContext *C); +bool ED_operator_uvedit(struct bContext *C); +bool ED_operator_uvedit_space_image(struct bContext *C); +bool ED_operator_uvmap(struct bContext *C); +bool ED_operator_posemode_exclusive(struct bContext *C); +bool ED_operator_posemode_context(struct bContext *C); +bool ED_operator_posemode(struct bContext *C); +bool ED_operator_posemode_local(struct bContext *C); +bool ED_operator_mask(struct bContext *C); +bool ED_operator_camera(struct bContext *C); /* screen_user_menu.c */ @@ -330,6 +331,9 @@ struct bUserMenuItem_Op *ED_screen_user_menu_item_find_operator( struct bUserMenuItem_Menu *ED_screen_user_menu_item_find_menu( struct ListBase *lb, const struct MenuType *mt); +struct bUserMenuItem_Prop *ED_screen_user_menu_item_find_prop( + struct ListBase *lb, + const char *context_data_path, const char *prop_id, int prop_index); void ED_screen_user_menu_item_add_operator( struct ListBase *lb, const char *ui_name, @@ -337,6 +341,9 @@ void ED_screen_user_menu_item_add_operator( void ED_screen_user_menu_item_add_menu( struct ListBase *lb, const char *ui_name, const struct MenuType *mt); +void ED_screen_user_menu_item_add_prop( + ListBase *lb, const char *ui_name, + const char *context_data_path, const char *prop_id, int prop_index); void ED_screen_user_menu_item_remove( struct ListBase *lb, struct bUserMenuItem *umi); diff --git a/source/blender/editors/include/ED_sequencer.h b/source/blender/editors/include/ED_sequencer.h index 94885c2abe0..18446966c4f 100644 --- a/source/blender/editors/include/ED_sequencer.h +++ b/source/blender/editors/include/ED_sequencer.h @@ -35,9 +35,9 @@ struct SpaceSeq; void ED_sequencer_select_sequence_single(struct Scene *scene, struct Sequence *seq, bool deselect_all); void ED_sequencer_deselect_all(struct Scene *scene); -int ED_space_sequencer_maskedit_mask_poll(struct bContext *C); +bool ED_space_sequencer_maskedit_mask_poll(struct bContext *C); bool ED_space_sequencer_check_show_maskedit(struct SpaceSeq *sseq, struct Scene *scene); -int ED_space_sequencer_maskedit_poll(struct bContext *C); +bool ED_space_sequencer_maskedit_poll(struct bContext *C); bool ED_space_sequencer_check_show_imbuf(struct SpaceSeq *sseq); bool ED_space_sequencer_check_show_strip(struct SpaceSeq *sseq); diff --git a/source/blender/editors/include/ED_transverts.h b/source/blender/editors/include/ED_transverts.h index 9005d55feff..363bb31c3dc 100644 --- a/source/blender/editors/include/ED_transverts.h +++ b/source/blender/editors/include/ED_transverts.h @@ -50,7 +50,7 @@ void ED_transverts_create_from_obedit(TransVertStore *tvs, struct Object *obedit void ED_transverts_update_obedit(TransVertStore *tvs, struct Object *obedit); void ED_transverts_free(TransVertStore *tvs); bool ED_transverts_check_obedit(Object *obedit); -int ED_transverts_poll(struct bContext *C); +bool ED_transverts_poll(struct bContext *C); /* currently only used for bmesh index values */ enum { diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 68aeccdcc32..efcf5978968 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -396,7 +396,7 @@ bool edge_inside_circle(const float cent[2], float radius, const float screen_co /* get 3d region from context, also if mouse is in header or toolbar */ struct RegionView3D *ED_view3d_context_rv3d(struct bContext *C); bool ED_view3d_context_user_region(struct bContext *C, struct View3D **r_v3d, struct ARegion **r_ar); -int ED_operator_rv3d_user_region_poll(struct bContext *C); +bool ED_operator_rv3d_user_region_poll(struct bContext *C); void ED_view3d_init_mats_rv3d(struct Object *ob, struct RegionView3D *rv3d); void ED_view3d_init_mats_rv3d_gl(struct Object *ob, struct RegionView3D *rv3d); @@ -407,7 +407,7 @@ void ED_view3d_check_mats_rv3d(struct RegionView3D *rv3d); # define ED_view3d_clear_mats_rv3d(rv3d) (void)(rv3d) # define ED_view3d_check_mats_rv3d(rv3d) (void)(rv3d) #endif -int ED_view3d_view_layer_set(int lay, const int *values, int *active); +int ED_view3d_view_layer_set(int lay, const bool *values, int *active); struct RV3DMatrixStore *ED_view3d_mats_rv3d_backup(struct RegionView3D *rv3d); void ED_view3d_mats_rv3d_restore(struct RegionView3D *rv3d, struct RV3DMatrixStore *rv3dmat); diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h index 75e835ff1d3..6f04107ae03 100644 --- a/source/blender/editors/include/UI_icons.h +++ b/source/blender/editors/include/UI_icons.h @@ -267,17 +267,14 @@ DEF_ICON(GROUP_UVS) DEF_ICON(RNA) DEF_ICON(RNA_ADD) - /* available */ -#ifndef DEF_ICON_BLANK_SKIP - DEF_ICON(BLANK092) - DEF_ICON(BLANK093) - DEF_ICON(BLANK094) - DEF_ICON(BLANK095) -#endif - + /* INPUT */ DEF_ICON(MOUSE_LMB) DEF_ICON(MOUSE_MMB) DEF_ICON(MOUSE_RMB) +DEF_ICON(MOUSE_MOVE) +DEF_ICON(MOUSE_LMB_DRAG) +DEF_ICON(MOUSE_MMB_DRAG) +DEF_ICON(MOUSE_RMB_DRAG) DEF_ICON(MOUSE_DRAG) #ifndef DEF_ICON_BLANK_SKIP diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 946c1822da3..9204f9b62f5 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -999,16 +999,16 @@ bool uiLayoutGetPropSep(uiLayout *layout); bool uiLayoutGetPropDecorate(uiLayout *layout); /* layout specifiers */ -uiLayout *uiLayoutRow(uiLayout *layout, int align); -uiLayout *uiLayoutColumn(uiLayout *layout, int align); -uiLayout *uiLayoutColumnFlow(uiLayout *layout, int number, int align); +uiLayout *uiLayoutRow(uiLayout *layout, bool align); +uiLayout *uiLayoutColumn(uiLayout *layout, bool align); +uiLayout *uiLayoutColumnFlow(uiLayout *layout, int number, bool align); uiLayout *uiLayoutGridFlow( - uiLayout *layout, int row_major, int num_columns, int even_columns, int even_rows, int align); + uiLayout *layout, bool row_major, int columns_len, bool even_columns, bool even_rows, bool align); uiLayout *uiLayoutBox(uiLayout *layout); uiLayout *uiLayoutListBox(uiLayout *layout, struct uiList *ui_list, struct PointerRNA *ptr, struct PropertyRNA *prop, struct PointerRNA *actptr, struct PropertyRNA *actprop); -uiLayout *uiLayoutAbsolute(uiLayout *layout, int align); -uiLayout *uiLayoutSplit(uiLayout *layout, float percentage, int align); +uiLayout *uiLayoutAbsolute(uiLayout *layout, bool align); +uiLayout *uiLayoutSplit(uiLayout *layout, float percentage, bool align); uiLayout *uiLayoutOverlap(uiLayout *layout); uiBlock *uiLayoutAbsoluteBlock(uiLayout *layout); uiLayout *uiLayoutRadial(uiLayout *layout); @@ -1049,22 +1049,22 @@ uiLayout *uiTemplateModifier(uiLayout *layout, struct bContext *C, struct Pointe void uiTemplateOperatorRedoProperties(uiLayout *layout, const struct bContext *C); uiLayout *uiTemplateConstraint(uiLayout *layout, struct PointerRNA *ptr); -void uiTemplatePreview(uiLayout *layout, struct bContext *C, struct ID *id, int show_buttons, struct ID *parent, +void uiTemplatePreview(uiLayout *layout, struct bContext *C, struct ID *id, bool show_buttons, struct ID *parent, struct MTex *slot, const char *preview_id); -void uiTemplateColorRamp(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int expand); +void uiTemplateColorRamp(uiLayout *layout, struct PointerRNA *ptr, const char *propname, bool expand); void uiTemplateIcon(uiLayout *layout, int icon_value, float icon_scale); -void uiTemplateIconView(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int show_labels, float icon_scale); +void uiTemplateIconView(uiLayout *layout, struct PointerRNA *ptr, const char *propname, bool show_labels, float icon_scale); void uiTemplateHistogram(uiLayout *layout, struct PointerRNA *ptr, const char *propname); void uiTemplateWaveform(uiLayout *layout, struct PointerRNA *ptr, const char *propname); void uiTemplateVectorscope(uiLayout *layout, struct PointerRNA *ptr, const char *propname); void uiTemplateCurveMapping(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int type, - int levels, int brush, int neg_slope); -void uiTemplateColorPicker(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int value_slider, int lock, int lock_luminosity, int cubic); -void uiTemplatePalette(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int color); + bool levels, bool brush, bool neg_slope); +void uiTemplateColorPicker(uiLayout *layout, struct PointerRNA *ptr, const char *propname, bool value_slider, bool lock, bool lock_luminosity, bool cubic); +void uiTemplatePalette(uiLayout *layout, struct PointerRNA *ptr, const char *propname, bool color); void uiTemplateLayers(uiLayout *layout, struct PointerRNA *ptr, const char *propname, PointerRNA *used_ptr, const char *used_propname, int active_layer); -void uiTemplateImage(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, struct PointerRNA *userptr, int compact, int multiview); -void uiTemplateImageSettings(uiLayout *layout, struct PointerRNA *imfptr, int color_management); +void uiTemplateImage(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, struct PointerRNA *userptr, bool compact, bool multiview); +void uiTemplateImageSettings(uiLayout *layout, struct PointerRNA *imfptr, bool color_management); void uiTemplateImageStereo3d(uiLayout *layout, struct PointerRNA *stereo3d_format_ptr); void uiTemplateImageViews(uiLayout *layout, struct PointerRNA *imaptr); void uiTemplateImageFormatViews(uiLayout *layout, PointerRNA *imfptr, PointerRNA *ptr); @@ -1098,9 +1098,9 @@ void uiTemplateNodeView(uiLayout *layout, struct bContext *C, struct bNodeTree * void uiTemplateTextureUser(uiLayout *layout, struct bContext *C); void uiTemplateTextureShow(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop); -void uiTemplateMovieClip(struct uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, int compact); +void uiTemplateMovieClip(struct uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, const char *propname, bool compact); void uiTemplateTrack(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname); -void uiTemplateMarker(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname, PointerRNA *userptr, PointerRNA *trackptr, int cmpact); +void uiTemplateMarker(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname, PointerRNA *userptr, PointerRNA *trackptr, bool compact); void uiTemplateMovieclipInformation(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname, struct PointerRNA *userptr); void uiTemplateColorspaceSettings(struct uiLayout *layout, struct PointerRNA *ptr, const char *propname); @@ -1183,7 +1183,7 @@ void ED_operatortypes_ui(void); void ED_keymap_ui(struct wmKeyConfig *keyconf); void UI_drop_color_copy(struct wmDrag *drag, struct wmDropBox *drop); -int UI_drop_color_poll(struct bContext *C, struct wmDrag *drag, const struct wmEvent *event); +bool UI_drop_color_poll(struct bContext *C, struct wmDrag *drag, const struct wmEvent *event); bool UI_context_copy_to_selected_list( struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 5673bc2535c..4199a7c0fdd 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -935,10 +935,11 @@ void ui_but_add_shortcut(uiBut *but, const char *shortcut_str, const bool do_str else { butstr_orig = BLI_strdup(but->str); } - BLI_snprintf(but->strdata, - sizeof(but->strdata), - "%s" UI_SEP_CHAR_S "%s", - butstr_orig, shortcut_str); + BLI_snprintf( + but->strdata, + sizeof(but->strdata), + "%s" UI_SEP_CHAR_S "%s", + butstr_orig, shortcut_str); MEM_freeN(butstr_orig); but->str = but->strdata; but->flag |= UI_BUT_HAS_SEP_CHAR; @@ -2121,8 +2122,9 @@ static void ui_get_but_string_unit(uiBut *but, char *str, int len_max, double va precision = float_precision; } - bUnit_AsString(str, len_max, ui_get_but_scale_unit(but, value), precision, - unit->system, RNA_SUBTYPE_UNIT_VALUE(unit_type), do_split, pad); + bUnit_AsString( + str, len_max, ui_get_but_scale_unit(but, value), precision, + unit->system, RNA_SUBTYPE_UNIT_VALUE(unit_type), do_split, pad); } static float ui_get_but_step_unit(uiBut *but, float step_default) @@ -2343,8 +2345,9 @@ static bool ui_set_but_string_eval_num_unit(bContext *C, uiBut *but, const char /* ugly, use the draw string to get the value, * this could cause problems if it includes some text which resolves to a unit */ - bUnit_ReplaceString(str_unit_convert, sizeof(str_unit_convert), but->drawstr, - ui_get_but_scale_unit(but, 1.0), but->block->unit->system, RNA_SUBTYPE_UNIT_VALUE(unit_type)); + bUnit_ReplaceString( + str_unit_convert, sizeof(str_unit_convert), but->drawstr, + ui_get_but_scale_unit(but, 1.0), but->block->unit->system, RNA_SUBTYPE_UNIT_VALUE(unit_type)); return BPY_execute_string_as_number(C, str_unit_convert, true, r_value); } @@ -3433,12 +3436,14 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu } else { if (item->icon) { - uiDefIconTextButI(block, UI_BTYPE_BUT_MENU, B_NOP, item->icon, item->name, 0, 0, - UI_UNIT_X * 5, UI_UNIT_Y, &handle->retvalue, item->value, 0.0, 0, -1, item->description); + uiDefIconTextButI( + block, UI_BTYPE_BUT_MENU, B_NOP, item->icon, item->name, 0, 0, + UI_UNIT_X * 5, UI_UNIT_Y, &handle->retvalue, item->value, 0.0, 0, -1, item->description); } else { - uiDefButI(block, UI_BTYPE_BUT_MENU, B_NOP, item->name, 0, 0, - UI_UNIT_X * 5, UI_UNIT_X, &handle->retvalue, item->value, 0.0, 0, -1, item->description); + uiDefButI( + block, UI_BTYPE_BUT_MENU, B_NOP, item->name, 0, 0, + UI_UNIT_X * 5, UI_UNIT_X, &handle->retvalue, item->value, 0.0, 0, -1, item->description); } } } diff --git a/source/blender/editors/interface/interface_context_menu.c b/source/blender/editors/interface/interface_context_menu.c index d425ba1f985..240649c8ab0 100644 --- a/source/blender/editors/interface/interface_context_menu.c +++ b/source/blender/editors/interface/interface_context_menu.c @@ -216,12 +216,16 @@ static void popup_add_shortcut_func(bContext *C, void *arg1, void *UNUSED(arg2)) UI_popup_block_ex(C, menu_add_shortcut, NULL, menu_add_shortcut_cancel, but, NULL); } -static bool ui_but_is_user_menu_compatible(uiBut *but) +static bool ui_but_is_user_menu_compatible(bContext *C, uiBut *but) { - return (but->optype || UI_but_menutype_get(but)); + return (but->optype || + (but->rnaprop && + (RNA_property_type(but->rnaprop) == PROP_BOOLEAN) && + (WM_context_member_from_ptr(C, &but->rnapoin) != NULL)) || + UI_but_menutype_get(but)); } -static bUserMenuItem *ui_but_user_menu_find(uiBut *but, bUserMenu *um) +static bUserMenuItem *ui_but_user_menu_find(bContext *C, uiBut *but, bUserMenu *um) { MenuType *mt = NULL; if (but->optype) { @@ -229,6 +233,12 @@ static bUserMenuItem *ui_but_user_menu_find(uiBut *but, bUserMenu *um) return (bUserMenuItem *)ED_screen_user_menu_item_find_operator( &um->items, but->optype, prop, but->opcontext); } + else if (but->rnaprop) { + const char *member_id = WM_context_member_from_ptr(C, &but->rnapoin); + const char *prop_id = RNA_property_identifier(but->rnaprop); + return (bUserMenuItem *)ED_screen_user_menu_item_find_prop( + &um->items, member_id, prop_id, but->rnaindex); + } else if ((mt = UI_but_menutype_get(but))) { return (bUserMenuItem *)ED_screen_user_menu_item_find_menu( &um->items, mt); @@ -238,9 +248,9 @@ static bUserMenuItem *ui_but_user_menu_find(uiBut *but, bUserMenu *um) } } -static void ui_but_user_menu_add(uiBut *but, bUserMenu *um) +static void ui_but_user_menu_add(bContext *C, uiBut *but, bUserMenu *um) { - BLI_assert(ui_but_is_user_menu_compatible(but)); + BLI_assert(ui_but_is_user_menu_compatible(C, but)); char drawstr[sizeof(but->drawstr)]; STRNCPY(drawstr, but->drawstr); @@ -257,6 +267,26 @@ static void ui_but_user_menu_add(uiBut *but, bUserMenu *um) &um->items, drawstr, but->optype, but->opptr ? but->opptr->data : NULL, but->opcontext); } + else if (but->rnaprop) { + /* Note: 'member_id' may be a path. */ + const char *member_id = WM_context_member_from_ptr(C, &but->rnapoin); + const char *data_path = RNA_path_from_ID_to_struct(&but->rnapoin); + const char *member_id_data_path = member_id; + if (data_path) { + member_id_data_path = BLI_sprintfN("%s.%s", member_id, data_path); + } + const char *prop_id = RNA_property_identifier(but->rnaprop); + /* Note, ignore 'drawstr', use property idname always. */ + ED_screen_user_menu_item_add_prop( + &um->items, "", + member_id_data_path, prop_id, but->rnaindex); + if (data_path) { + MEM_freeN((void *)data_path); + } + if (member_id != member_id_data_path) { + MEM_freeN((void *)member_id_data_path); + } + } else if ((mt = UI_but_menutype_get(but))) { ED_screen_user_menu_item_add_menu( &um->items, drawstr, @@ -268,7 +298,7 @@ static void popup_user_menu_add_or_replace_func(bContext *C, void *arg1, void *U { uiBut *but = arg1; bUserMenu *um = ED_screen_user_menu_ensure(C); - ui_but_user_menu_add(but, um); + ui_but_user_menu_add(C, but, um); } static void popup_user_menu_remove_func(bContext *UNUSED(C), void *arg1, void *arg2) @@ -658,7 +688,7 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but) } /* Favorites Menu */ - if (ui_but_is_user_menu_compatible(but)) { + if (ui_but_is_user_menu_compatible(C, but)) { uiBlock *block = uiLayoutGetBlock(layout); const int w = uiLayoutGetWidth(layout); uiBut *but2; @@ -672,7 +702,7 @@ bool ui_popup_context_menu_for_button(bContext *C, uiBut *but) bUserMenu *um = ED_screen_user_menu_find(C); if (um) { - bUserMenuItem *umi = ui_but_user_menu_find(but, um); + bUserMenuItem *umi = ui_but_user_menu_find(C, but, um); if (umi != NULL) { but2 = uiDefIconTextBut( block, UI_BTYPE_BUT, 0, ICON_CANCEL, diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index ab85a3d5326..3e724fd5c5c 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -152,8 +152,10 @@ void UI_draw_roundbox_aa(bool filled, float minx, float miny, float maxx, float void UI_draw_roundbox_4fv(bool filled, float minx, float miny, float maxx, float maxy, float rad, const float col[4]) { #if 0 - float vec[7][2] = {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293}, - {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}}; + float vec[7][2] = { + {0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293}, + {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}, + }; int a; Gwn_VertFormat *format = immVertexFormat(); @@ -267,8 +269,10 @@ void UI_draw_roundbox_shade_x( float rad, float shadetop, float shadedown, const float col[4]) { #if 0 - float vec[7][2] = {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293}, - {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}}; + float vec[7][2] = { + {0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293}, + {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}, + }; const float div = maxy - miny; const float idiv = 1.0f / div; float coltop[3], coldown[3]; @@ -412,8 +416,10 @@ void UI_draw_roundbox_shade_y( bool filled, float minx, float miny, float maxx, float maxy, float rad, float shadeleft, float shaderight, const float col[4]) { - float vec[7][2] = {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293}, - {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}}; + float vec[7][2] = { + {0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293}, + {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}, + }; const float div = maxx - minx; const float idiv = 1.0f / div; float colLeft[3], colRight[3]; @@ -551,10 +557,10 @@ void ui_draw_but_TAB_outline(const rcti *rect, float rad, unsigned char highligh const int miny = rect->ymin + U.pixelsize, maxy = rect->ymax - U.pixelsize; int a; float vec[4][2] = { - {0.195, 0.02}, - {0.55, 0.169}, - {0.831, 0.45}, - {0.98, 0.805}, + {0.195, 0.02}, + {0.55, 0.169}, + {0.831, 0.45}, + {0.98, 0.805}, }; @@ -659,8 +665,9 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w } IMMDrawPixelsTexState state = immDrawPixelsTexSetup(GPU_SHADER_2D_IMAGE_COLOR); - immDrawPixelsTex(&state, (float)rect->xmin, (float)rect->ymin, ibuf->x, ibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, GL_NEAREST, ibuf->rect, - facx, facy, NULL); + immDrawPixelsTex( + &state, (float)rect->xmin, (float)rect->ymin, ibuf->x, ibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, GL_NEAREST, ibuf->rect, + facx, facy, NULL); GPU_blend(false); @@ -804,10 +811,11 @@ void ui_draw_but_HISTOGRAM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUS /* need scissor test, histogram can draw outside of boundary */ int scissor[4]; GPU_scissor_geti(scissor); - GPU_scissor((rect.xmin - 1), - (rect.ymin - 1), - (rect.xmax + 1) - (rect.xmin - 1), - (rect.ymax + 1) - (rect.ymin - 1)); + GPU_scissor( + (rect.xmin - 1), + (rect.ymin - 1), + (rect.xmax + 1) - (rect.xmin - 1), + (rect.ymax + 1) - (rect.ymin - 1)); Gwn_VertFormat *format = immVertexFormat(); unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); @@ -927,10 +935,11 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSE /* need scissor test, waveform can draw outside of boundary */ GPU_scissor_geti(scissor); - GPU_scissor((rect.xmin - 1), - (rect.ymin - 1), - (rect.xmax + 1) - (rect.xmin - 1), - (rect.ymax + 1) - (rect.ymin - 1)); + GPU_scissor( + (rect.xmin - 1), + (rect.ymin - 1), + (rect.xmax + 1) - (rect.xmin - 1), + (rect.ymax + 1) - (rect.ymin - 1)); /* draw scale numbers first before binding any shader */ for (int i = 0; i < 6; i++) { @@ -1199,10 +1208,11 @@ void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UN /* need scissor test, hvectorscope can draw outside of boundary */ int scissor[4]; GPU_scissor_geti(scissor); - GPU_scissor((rect.xmin - 1), - (rect.ymin - 1), - (rect.xmax + 1) - (rect.xmin - 1), - (rect.ymax + 1) - (rect.ymin - 1)); + GPU_scissor( + (rect.xmin - 1), + (rect.ymin - 1), + (rect.xmax + 1) - (rect.xmin - 1), + (rect.ymax + 1) - (rect.ymin - 1)); Gwn_VertFormat *format = immVertexFormat(); unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); @@ -1333,7 +1343,7 @@ static void ui_draw_colorband_handle( GPU_viewport_size_getf(viewport_size); immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC); - immUniform1i("num_colors", 2); /* "advanced" mode */ + immUniform1i("colors_len", 2); /* "advanced" mode */ immUniformArray4fv("colors", (float *)(float[][4]){{0.8f, 0.8f, 0.8f, 1.0f}, {0.0f, 0.0f, 0.0f, 1.0f}}, 2); immUniform1f("dash_width", active ? 4.0f : 2.0f); @@ -1584,8 +1594,9 @@ static void ui_draw_but_curve_grid(unsigned int pos, const rcti *rect, float zoo float fy = rect->ymin + zoomy * (-offsy); if (fy > rect->ymin) fy -= dy * (floorf(fy - rect->ymin)); - float line_count = floorf((rect->xmax - fx) / dx) + 1.0f + - floorf((rect->ymax - fy) / dy) + 1.0f; + float line_count = ( + floorf((rect->xmax - fx) / dx) + 1.0f + + floorf((rect->ymax - fy) / dy) + 1.0f); immBegin(GWN_PRIM_LINES, (int)line_count * 2); while (fx < rect->xmax) { @@ -1604,9 +1615,10 @@ static void ui_draw_but_curve_grid(unsigned int pos, const rcti *rect, float zoo static void gl_shaded_color(unsigned char *col, int shade) { - immUniformColor3ub(col[0] - shade > 0 ? col[0] - shade : 0, - col[1] - shade > 0 ? col[1] - shade : 0, - col[2] - shade > 0 ? col[2] - shade : 0); + immUniformColor3ub( + col[0] - shade > 0 ? col[0] - shade : 0, + col[1] - shade > 0 ? col[1] - shade : 0, + col[2] - shade > 0 ? col[2] - shade : 0); } void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti *rect) @@ -1633,10 +1645,11 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti }; rcti scissor_region = {0, ar->winx, 0, ar->winy}; BLI_rcti_isect(&scissor_new, &scissor_region, &scissor_new); - GPU_scissor(scissor_new.xmin, - scissor_new.ymin, - BLI_rcti_size_x(&scissor_new), - BLI_rcti_size_y(&scissor_new)); + GPU_scissor( + scissor_new.xmin, + scissor_new.ymin, + BLI_rcti_size_x(&scissor_new), + BLI_rcti_size_y(&scissor_new)); /* calculate offset and zoom */ float zoomx = (BLI_rcti_size_x(rect) - 2.0f) / BLI_rctf_size_x(&cumap->curr); @@ -1679,10 +1692,11 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti gl_shaded_color((unsigned char *)wcol->inner, -20); immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax); immUniformColor3ubv((unsigned char *)wcol->inner); - immRectf(pos, rect->xmin + zoomx * (cumap->clipr.xmin - offsx), - rect->ymin + zoomy * (cumap->clipr.ymin - offsy), - rect->xmin + zoomx * (cumap->clipr.xmax - offsx), - rect->ymin + zoomy * (cumap->clipr.ymax - offsy)); + immRectf(pos, + rect->xmin + zoomx * (cumap->clipr.xmin - offsx), + rect->ymin + zoomy * (cumap->clipr.ymin - offsy), + rect->xmin + zoomx * (cumap->clipr.xmax - offsx), + rect->ymin + zoomy * (cumap->clipr.ymax - offsy)); } else { immUniformColor3ubv((unsigned char *)wcol->inner); @@ -1848,10 +1862,11 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *U /* need scissor test, preview image can draw outside of boundary */ int scissor[4]; GPU_scissor_geti(scissor); - GPU_scissor((rect.xmin - 1), - (rect.ymin - 1), - (rect.xmax + 1) - (rect.xmin - 1), - (rect.ymax + 1) - (rect.ymin - 1)); + GPU_scissor( + (rect.xmin - 1), + (rect.ymin - 1), + (rect.xmax + 1) - (rect.xmin - 1), + (rect.ymax + 1) - (rect.ymin - 1)); if (scopes->track_disabled) { float color[4] = {0.7f, 0.3f, 0.3f, 0.3f}; @@ -1867,10 +1882,11 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *U if (scopes->track_preview) IMB_freeImBuf(scopes->track_preview); - ImBuf *tmpibuf = BKE_tracking_sample_pattern(scopes->frame_width, scopes->frame_height, - scopes->track_search, scopes->track, - &scopes->undist_marker, true, scopes->use_track_mask, - width, height, scopes->track_pos); + ImBuf *tmpibuf = BKE_tracking_sample_pattern( + scopes->frame_width, scopes->frame_height, + scopes->track_search, scopes->track, + &scopes->undist_marker, true, scopes->use_track_mask, + width, height, scopes->track_pos); if (tmpibuf) { if (tmpibuf->rect_float) IMB_rect_from_float(tmpibuf); @@ -1903,10 +1919,11 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *U /* draw cross for pixel position */ gpuTranslate2f(rect.xmin + scopes->track_pos[0], rect.ymin + scopes->track_pos[1]); - GPU_scissor(rect.xmin, - rect.ymin, - BLI_rctf_size_x(&rect), - BLI_rctf_size_y(&rect)); + GPU_scissor( + rect.xmin, + rect.ymin, + BLI_rctf_size_x(&rect), + BLI_rctf_size_y(&rect)); Gwn_VertFormat *format = immVertexFormat(); unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); @@ -1991,10 +2008,11 @@ void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol rcti scissor_region = {0, ar->winx, 0, ar->winy}; BLI_rcti_isect(&scissor_new, &scissor_region, &scissor_new); - GPU_scissor(scissor_new.xmin, - scissor_new.ymin, - BLI_rcti_size_x(&scissor_new), - BLI_rcti_size_y(&scissor_new)); + GPU_scissor( + scissor_new.xmin, + scissor_new.ymin, + BLI_rcti_size_x(&scissor_new), + BLI_rcti_size_y(&scissor_new)); float x = 0.5f * (recti->xmin + recti->xmax); float y = 0.5f * (recti->ymin + recti->ymax); diff --git a/source/blender/editors/interface/interface_eyedropper_color.c b/source/blender/editors/interface/interface_eyedropper_color.c index a60b6f3f60b..73efc59feb7 100644 --- a/source/blender/editors/interface/interface_eyedropper_color.c +++ b/source/blender/editors/interface/interface_eyedropper_color.c @@ -319,7 +319,7 @@ static int eyedropper_exec(bContext *C, wmOperator *op) } } -static int eyedropper_poll(bContext *C) +static bool eyedropper_poll(bContext *C) { PointerRNA ptr; PropertyRNA *prop; diff --git a/source/blender/editors/interface/interface_eyedropper_colorband.c b/source/blender/editors/interface/interface_eyedropper_colorband.c index b13d552dbeb..f414d524cd8 100644 --- a/source/blender/editors/interface/interface_eyedropper_colorband.c +++ b/source/blender/editors/interface/interface_eyedropper_colorband.c @@ -289,7 +289,7 @@ static int eyedropper_colorband_exec(bContext *C, wmOperator *op) } } -static int eyedropper_colorband_poll(bContext *C) +static bool eyedropper_colorband_poll(bContext *C) { uiBut *but = UI_context_active_but_get(C); return (but && but->type == UI_BTYPE_COLORBAND); diff --git a/source/blender/editors/interface/interface_eyedropper_datablock.c b/source/blender/editors/interface/interface_eyedropper_datablock.c index f814048c0c0..b1e649f4abe 100644 --- a/source/blender/editors/interface/interface_eyedropper_datablock.c +++ b/source/blender/editors/interface/interface_eyedropper_datablock.c @@ -305,7 +305,7 @@ static int datadropper_exec(bContext *C, wmOperator *op) } } -static int datadropper_poll(bContext *C) +static bool datadropper_poll(bContext *C) { PointerRNA ptr; PropertyRNA *prop; diff --git a/source/blender/editors/interface/interface_eyedropper_depth.c b/source/blender/editors/interface/interface_eyedropper_depth.c index df09c327da1..fb125a3845b 100644 --- a/source/blender/editors/interface/interface_eyedropper_depth.c +++ b/source/blender/editors/interface/interface_eyedropper_depth.c @@ -335,7 +335,7 @@ static int depthdropper_exec(bContext *C, wmOperator *op) } } -static int depthdropper_poll(bContext *C) +static bool depthdropper_poll(bContext *C) { PointerRNA ptr; PropertyRNA *prop; diff --git a/source/blender/editors/interface/interface_eyedropper_driver.c b/source/blender/editors/interface/interface_eyedropper_driver.c index 50a8473135a..852f7ea71b6 100644 --- a/source/blender/editors/interface/interface_eyedropper_driver.c +++ b/source/blender/editors/interface/interface_eyedropper_driver.c @@ -205,7 +205,7 @@ static int driverdropper_exec(bContext *C, wmOperator *op) } } -static int driverdropper_poll(bContext *C) +static bool driverdropper_poll(bContext *C) { if (!CTX_wm_window(C)) return 0; else return 1; diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index f92058137b2..fc0550c37b9 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1325,8 +1325,10 @@ static void ui_drag_toggle_set(bContext *C, uiDragToggleHandle *drag_info, const if (but) { if (but->flag & UI_BUT_DRAG_LOCK) { - const float but_cent_new[2] = {BLI_rctf_cent_x(&but->rect), - BLI_rctf_cent_y(&but->rect)}; + const float but_cent_new[2] = { + BLI_rctf_cent_x(&but->rect), + BLI_rctf_cent_y(&but->rect), + }; /* check if this is a different button, chances are high the button wont move about :) */ if (len_manhattan_v2v2(drag_info->but_cent_start, but_cent_new) > 1.0f) { @@ -1398,10 +1400,11 @@ static int ui_handler_region_drag_toggle(bContext *C, const wmEvent *event, void ui_apply_but_undo(but); } - WM_event_remove_ui_handler(&win->modalhandlers, - ui_handler_region_drag_toggle, - ui_handler_region_drag_toggle_remove, - drag_info, false); + WM_event_remove_ui_handler( + &win->modalhandlers, + ui_handler_region_drag_toggle, + ui_handler_region_drag_toggle_remove, + drag_info, false); ui_handler_region_drag_toggle_remove(C, drag_info); WM_event_add_mousemove(C); @@ -1616,7 +1619,7 @@ static void ui_selectcontext_apply( wmWindow *win = CTX_wm_window(C); if (!win->eventstate->shift) { const int len = RNA_property_array_length(&but->rnapoin, prop); - int *tmparray = MEM_callocN(sizeof(int) * len, __func__); + bool *tmparray = MEM_callocN(sizeof(bool) * len, __func__); tmparray[index] = true; @@ -3273,13 +3276,15 @@ static void ui_do_but_textedit( } break; case RIGHTARROWKEY: - ui_textedit_move(but, data, STRCUR_DIR_NEXT, - event->shift != 0, event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE); + ui_textedit_move( + but, data, STRCUR_DIR_NEXT, + event->shift != 0, event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE); retval = WM_UI_HANDLER_BREAK; break; case LEFTARROWKEY: - ui_textedit_move(but, data, STRCUR_DIR_PREV, - event->shift != 0, event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE); + ui_textedit_move( + but, data, STRCUR_DIR_PREV, + event->shift != 0, event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE); retval = WM_UI_HANDLER_BREAK; break; case WHEELDOWNMOUSE: @@ -3296,8 +3301,9 @@ static void ui_do_but_textedit( } ATTR_FALLTHROUGH; case ENDKEY: - ui_textedit_move(but, data, STRCUR_DIR_NEXT, - event->shift != 0, STRCUR_JUMP_ALL); + ui_textedit_move( + but, data, STRCUR_DIR_NEXT, + event->shift != 0, STRCUR_JUMP_ALL); retval = WM_UI_HANDLER_BREAK; break; case WHEELUPMOUSE: @@ -3314,8 +3320,9 @@ static void ui_do_but_textedit( } ATTR_FALLTHROUGH; case HOMEKEY: - ui_textedit_move(but, data, STRCUR_DIR_PREV, - event->shift != 0, STRCUR_JUMP_ALL); + ui_textedit_move( + but, data, STRCUR_DIR_PREV, + event->shift != 0, STRCUR_JUMP_ALL); retval = WM_UI_HANDLER_BREAK; break; case PADENTER: @@ -3324,14 +3331,16 @@ static void ui_do_but_textedit( retval = WM_UI_HANDLER_BREAK; break; case DELKEY: - changed = ui_textedit_delete(but, data, 1, - event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE); + changed = ui_textedit_delete( + but, data, 1, + event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE); retval = WM_UI_HANDLER_BREAK; break; case BACKSPACEKEY: - changed = ui_textedit_delete(but, data, 0, - event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE); + changed = ui_textedit_delete( + but, data, 0, + event->ctrl ? STRCUR_JUMP_DELIM : STRCUR_JUMP_NONE); retval = WM_UI_HANDLER_BREAK; break; @@ -3346,10 +3355,12 @@ static void ui_do_but_textedit( if (event->ctrl && !IS_EVENT_MOD(event, shift, alt, oskey)) #endif { - ui_textedit_move(but, data, STRCUR_DIR_PREV, - false, STRCUR_JUMP_ALL); - ui_textedit_move(but, data, STRCUR_DIR_NEXT, - true, STRCUR_JUMP_ALL); + ui_textedit_move( + but, data, STRCUR_DIR_PREV, + false, STRCUR_JUMP_ALL); + ui_textedit_move( + but, data, STRCUR_DIR_NEXT, + true, STRCUR_JUMP_ALL); retval = WM_UI_HANDLER_BREAK; } break; @@ -9798,8 +9809,9 @@ static int ui_popup_handler(bContext *C, const wmEvent *event, void *userdata) #ifdef USE_DRAG_TOGGLE { - WM_event_free_ui_handler_all(C, &win->modalhandlers, - ui_handler_region_drag_toggle, ui_handler_region_drag_toggle_remove); + WM_event_free_ui_handler_all( + C, &win->modalhandlers, + ui_handler_region_drag_toggle, ui_handler_region_drag_toggle_remove); } #endif diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 63f51b991ae..4ff19d66bac 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -186,7 +186,7 @@ typedef struct uiLayoutItemGridFlow { /* If positive, absolute fixed number of columns. * If 0, fully automatic (based on available width). * If negative, automatic but only generates number of columns/rows multiple of given (absolute) value. */ - int num_columns; + int columns_len; /* Pure internal runtime storage. */ int tot_items, tot_columns, tot_rows; @@ -393,7 +393,7 @@ static int ui_layout_local_dir(uiLayout *layout) } } -static uiLayout *ui_item_local_sublayout(uiLayout *test, uiLayout *layout, int align) +static uiLayout *ui_item_local_sublayout(uiLayout *test, uiLayout *layout, bool align) { uiLayout *sub; @@ -564,7 +564,7 @@ static void ui_item_array( uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, 0, 0, w, UI_UNIT_Y); } else { - int *boolarr = NULL; + bool *boolarr = NULL; /* even if 'expand' is fale, expanding anyway */ @@ -579,7 +579,7 @@ static void ui_item_array( /* show checkboxes for rna on a non-emboss block (menu for eg) */ if (type == PROP_BOOLEAN && ELEM(layout->root->block->dt, UI_EMBOSS_NONE, UI_EMBOSS_PULLDOWN)) { - boolarr = MEM_callocN(sizeof(int) * len, __func__); + boolarr = MEM_callocN(sizeof(bool) * len, __func__); RNA_property_boolean_get_array(ptr, prop, boolarr); } @@ -594,8 +594,9 @@ static void ui_item_array( icon = boolarr[a] ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT; } - width_item = (compact && type == PROP_BOOLEAN) ? - min_ii(w, ui_text_icon_width(layout, str_buf, icon, false)) : w; + width_item = ( + (compact && type == PROP_BOOLEAN) ? + min_ii(w, ui_text_icon_width(layout, str_buf, icon, false)) : w); but = uiDefAutoButR(block, ptr, prop, a, str_buf, icon, 0, 0, width_item, UI_UNIT_Y); if (slider && but->type == UI_BTYPE_NUM) @@ -776,8 +777,9 @@ static uiBut *ui_item_with_label( but = uiDefAutoButR(block, ptr, prop, index, "", icon, x, y, prop_but_width - UI_UNIT_X, h); /* BUTTONS_OT_file_browse calls UI_context_active_but_prop_get_filebrowser */ - uiDefIconButO(block, UI_BTYPE_BUT, subtype == PROP_DIRPATH ? "BUTTONS_OT_directory_browse" : "BUTTONS_OT_file_browse", - WM_OP_INVOKE_DEFAULT, ICON_FILESEL, x, y, UI_UNIT_X, h, NULL); + uiDefIconButO( + block, UI_BTYPE_BUT, subtype == PROP_DIRPATH ? "BUTTONS_OT_directory_browse" : "BUTTONS_OT_file_browse", + WM_OP_INVOKE_DEFAULT, ICON_FILESEL, x, y, UI_UNIT_X, h, NULL); } else if (flag & UI_ITEM_R_EVENT) { but = uiDefButR_prop(block, UI_BTYPE_KEY_EVENT, 0, name, x, y, prop_but_width, h, ptr, prop, index, 0, 0, -1, -1, NULL); @@ -796,8 +798,9 @@ static uiBut *ui_item_with_label( } else { const char *str = (type == PROP_ENUM && !(flag & UI_ITEM_R_ICON_ONLY)) ? NULL : ""; - but = uiDefAutoButR(block, ptr, prop, index, str, icon, - x, y, prop_but_width, h); + but = uiDefAutoButR( + block, ptr, prop, index, str, icon, + x, y, prop_but_width, h); } UI_block_layout_set_current(block, layout); @@ -1185,8 +1188,9 @@ void uiItemsFullEnumO_items( } else { /* Do not use uiItemL here, as our root layout is a menu one, it will add a fake blank icon! */ - but = uiDefBut(block, UI_BTYPE_LABEL, 0, item->name, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, - 0.0, 0.0, 0, 0, ""); + but = uiDefBut( + block, UI_BTYPE_LABEL, 0, item->name, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, NULL, + 0.0, 0.0, 0, 0, ""); } ui_but_tip_from_enum_item(but, item); } @@ -1964,8 +1968,8 @@ void ui_but_add_search(uiBut *but, PointerRNA *ptr, PropertyRNA *prop, PointerRN } UI_but_func_search_set( - but, ui_searchbox_create_generic, ui_rna_collection_search_cb, - coll_search, NULL, NULL); + but, ui_searchbox_create_generic, ui_rna_collection_search_cb, + coll_search, NULL, NULL); but->free_search_arg = true; } else if (but->type == UI_BTYPE_SEARCH_MENU) { @@ -2386,8 +2390,9 @@ void uiItemMenuEnumO_ptr( BLI_strncpy(lvl->propname, propname, sizeof(lvl->propname)); lvl->opcontext = layout->root->opcontext; - but = ui_item_menu(layout, name, icon, menu_item_enum_opname_menu, NULL, lvl, - RNA_struct_ui_description(ot->srna), true); + but = ui_item_menu( + layout, name, icon, menu_item_enum_opname_menu, NULL, lvl, + RNA_struct_ui_description(ot->srna), true); /* add hotkey here, lower UI code can't detect it */ if ((layout->root->block->flag & UI_BLOCK_LOOP) && @@ -3200,8 +3205,8 @@ static void ui_litem_estimate_grid_flow(uiLayout *litem) /* Even in varying column width case, we fix our columns number from weighted average width of items, * a proper solving of required width would be too costly, and this should give reasonably good results * in all resonable cases... */ - if (gflow->num_columns > 0) { - gflow->tot_columns = gflow->num_columns; + if (gflow->columns_len > 0) { + gflow->tot_columns = gflow->columns_len; } else { if (avg_w == 0.0f) { @@ -3218,7 +3223,7 @@ static void ui_litem_estimate_grid_flow(uiLayout *litem) * Note that modulo does not prevent ending with fewer columns/rows than modulo, if mandatory * to avoid empty column/row. */ { - const int modulo = (gflow->num_columns < -1) ? -gflow->num_columns : 0; + const int modulo = (gflow->columns_len < -1) ? -gflow->columns_len : 0; const int step = modulo ? modulo : 1; if (gflow->row_major) { @@ -3533,7 +3538,7 @@ static void ui_litem_init_from_parent(uiLayout *litem, uiLayout *layout, int ali } /* layout create functions */ -uiLayout *uiLayoutRow(uiLayout *layout, int align) +uiLayout *uiLayoutRow(uiLayout *layout, bool align) { uiLayout *litem; @@ -3548,7 +3553,7 @@ uiLayout *uiLayoutRow(uiLayout *layout, int align) return litem; } -uiLayout *uiLayoutColumn(uiLayout *layout, int align) +uiLayout *uiLayoutColumn(uiLayout *layout, bool align) { uiLayout *litem; @@ -3563,7 +3568,7 @@ uiLayout *uiLayoutColumn(uiLayout *layout, int align) return litem; } -uiLayout *uiLayoutColumnFlow(uiLayout *layout, int number, int align) +uiLayout *uiLayoutColumnFlow(uiLayout *layout, int number, bool align) { uiLayoutItemFlow *flow; @@ -3580,7 +3585,7 @@ uiLayout *uiLayoutColumnFlow(uiLayout *layout, int number, int align) } uiLayout *uiLayoutGridFlow( - uiLayout *layout, int row_major, int num_columns, int even_columns, int even_rows, int align) + uiLayout *layout, bool row_major, int columns_len, bool even_columns, bool even_rows, bool align) { uiLayoutItemGridFlow *flow; @@ -3590,7 +3595,7 @@ uiLayout *uiLayoutGridFlow( flow->litem.space = (flow->litem.align) ? 0 : layout->root->style->columnspace; flow->row_major = row_major; - flow->num_columns = num_columns; + flow->columns_len = columns_len; flow->even_columns = even_columns; flow->even_rows = even_rows; @@ -3689,7 +3694,7 @@ uiLayout *uiLayoutListBox( return (uiLayout *)box; } -uiLayout *uiLayoutAbsolute(uiLayout *layout, int align) +uiLayout *uiLayoutAbsolute(uiLayout *layout, bool align) { uiLayout *litem; @@ -3727,7 +3732,7 @@ uiLayout *uiLayoutOverlap(uiLayout *layout) return litem; } -uiLayout *uiLayoutSplit(uiLayout *layout, float percentage, int align) +uiLayout *uiLayoutSplit(uiLayout *layout, float percentage, bool align) { uiLayoutItemSplit *split; diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 911508ebbfc..8c8fe181387 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -98,7 +98,7 @@ static void UI_OT_reset_default_theme(wmOperatorType *ot) /* Copy Data Path Operator ------------------------ */ -static int copy_data_path_button_poll(bContext *C) +static bool copy_data_path_button_poll(bContext *C) { PointerRNA ptr; PropertyRNA *prop; @@ -177,7 +177,7 @@ static void UI_OT_copy_data_path_button(wmOperatorType *ot) RNA_def_property_flag(prop, PROP_SKIP_SAVE); } -static int copy_python_command_button_poll(bContext *C) +static bool copy_python_command_button_poll(bContext *C) { uiBut *but = UI_context_active_but_get(C); @@ -248,7 +248,7 @@ static int operator_button_property_finish(bContext *C, PointerRNA *ptr, Propert } } -static int reset_default_button_poll(bContext *C) +static bool reset_default_button_poll(bContext *C) { PointerRNA ptr; PropertyRNA *prop; @@ -347,7 +347,7 @@ enum { static EnumPropertyItem override_type_items[] = { {UIOverride_Type_NOOP, "NOOP", 0, "NoOp", - "'No-Operation', place holder preventing automatic override to ever affect the property"}, + "'No-Operation', place holder preventing automatic override to ever affect the property"}, {UIOverride_Type_Replace, "REPLACE", 0, "Replace", "Completely replace value from linked data by local one"}, {UIOverride_Type_Difference, "DIFFERENCE", 0, "Difference", "Store difference to linked data value"}, {UIOverride_Type_Factor, "FACTOR", 0, "Factor", "Store factor to linked data value (useful e.g. for scale)"}, @@ -355,7 +355,7 @@ static EnumPropertyItem override_type_items[] = { }; -static int override_type_set_button_poll(bContext *C) +static bool override_type_set_button_poll(bContext *C) { PointerRNA ptr; PropertyRNA *prop; @@ -408,7 +408,7 @@ static int override_type_set_button_exec(bContext *C, wmOperator *op) } IDOverrideStaticPropertyOperation *opop = RNA_property_override_property_operation_get( - &ptr, prop, operation, index, true, NULL, &created); + &ptr, prop, operation, index, true, NULL, &created); if (!created) { opop->operation = operation; } @@ -443,13 +443,14 @@ static void UI_OT_override_type_set_button(wmOperatorType *ot) /* properties */ RNA_def_boolean(ot->srna, "all", 1, "All", "Reset to default values all elements of the array"); - ot->prop = RNA_def_enum(ot->srna, "type", override_type_items, UIOverride_Type_Replace, - "Type", "Type of override operation"); + ot->prop = RNA_def_enum( + ot->srna, "type", override_type_items, UIOverride_Type_Replace, + "Type", "Type of override operation"); /* TODO: add itemf callback, not all options are available for all data types... */ } -static int override_remove_button_poll(bContext *C) +static bool override_remove_button_poll(bContext *C) { PointerRNA ptr; PropertyRNA *prop; @@ -493,7 +494,7 @@ static int override_remove_button_exec(bContext *C, wmOperator *op) bool is_strict_find; /* Remove override operation for given item, add singular operations for the other items as needed. */ IDOverrideStaticPropertyOperation *opop = BKE_override_static_property_operation_find( - oprop, NULL, NULL, index, index, false, &is_strict_find); + oprop, NULL, NULL, index, index, false, &is_strict_find); BLI_assert(opop != NULL); if (!is_strict_find) { /* No specific override operation, we have to get generic one, @@ -766,7 +767,7 @@ static bool copy_to_selected_button(bContext *C, bool all, bool poll) return success; } -static int copy_to_selected_button_poll(bContext *C) +static bool copy_to_selected_button_poll(bContext *C) { return copy_to_selected_button(C, false, true); } @@ -806,7 +807,7 @@ static void UI_OT_copy_to_selected_button(wmOperatorType *ot) * when there are too many to display... */ -static int reports_to_text_poll(bContext *C) +static bool reports_to_text_poll(bContext *C) { return CTX_wm_reports(C) != NULL; } @@ -1024,9 +1025,10 @@ static int editsource_exec(bContext *C, wmOperator *op) if (but_store) { if (but_store->py_dbg_ln != -1) { - ret = editsource_text_edit(C, op, - but_store->py_dbg_fn, - but_store->py_dbg_ln); + ret = editsource_text_edit( + C, op, + but_store->py_dbg_fn, + but_store->py_dbg_ln); } else { BKE_report(op->reports, RPT_ERROR, "Active button is not from a script, cannot edit source"); @@ -1134,14 +1136,18 @@ static int edittranslation_exec(bContext *C, wmOperator *op) uiStringInfo rna_ctxt = {BUT_GET_RNA_LABEL_CONTEXT, NULL}; if (!BLI_is_dir(root)) { - BKE_report(op->reports, RPT_ERROR, "Please set your User Preferences' 'Translation Branches " - "Directory' path to a valid directory"); + BKE_report( + op->reports, RPT_ERROR, + "Please set your User Preferences' 'Translation Branches " + "Directory' path to a valid directory"); return OPERATOR_CANCELLED; } ot = WM_operatortype_find(EDTSRC_I18N_OP_NAME, 0); if (ot == NULL) { - BKE_reportf(op->reports, RPT_ERROR, "Could not find operator '%s'! Please enable ui_translate add-on " - "in the User Preferences", EDTSRC_I18N_OP_NAME); + BKE_reportf( + op->reports, RPT_ERROR, + "Could not find operator '%s'! Please enable ui_translate add-on " + "in the User Preferences", EDTSRC_I18N_OP_NAME); return OPERATOR_CANCELLED; } /* Try to find a valid po file for current language... */ @@ -1152,8 +1158,9 @@ static int edittranslation_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - UI_but_string_info_get(C, but, &but_label, &rna_label, &enum_label, &but_tip, &rna_tip, &enum_tip, - &rna_struct, &rna_prop, &rna_enum, &rna_ctxt, NULL); + UI_but_string_info_get( + C, but, &but_label, &rna_label, &enum_label, &but_tip, &rna_tip, &enum_tip, + &rna_struct, &rna_prop, &rna_enum, &rna_ctxt, NULL); WM_operator_properties_create_ptr(&ptr, ot); RNA_string_set(&ptr, "lang", uilng); @@ -1233,7 +1240,7 @@ static void UI_OT_reloadtranslation(wmOperatorType *ot) ot->exec = reloadtranslation_exec; } -int UI_drop_color_poll(struct bContext *C, wmDrag *drag, const wmEvent *UNUSED(event)) +bool UI_drop_color_poll(struct bContext *C, wmDrag *drag, const wmEvent *UNUSED(event)) { /* should only return true for regions that include buttons, for now * return true always */ diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 1e3a080c097..8107254f30b 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -558,8 +558,9 @@ static void ui_draw_panel_scalewidget(unsigned int pos, const rcti *rect) GPU_blend(false); } -static void immRectf_tris_color_ex(unsigned int pos, float x1, float y1, float x2, float y2, - unsigned int col, const float color[3]) +static void immRectf_tris_color_ex( + unsigned int pos, float x1, float y1, float x2, float y2, + unsigned int col, const float color[3]) { immAttrib4fv(col, color); immVertex2f(pos, x1, y1); @@ -604,10 +605,12 @@ static void ui_draw_panel_dragwidget(unsigned int pos, unsigned int col, const r const int x_co = (x_min + x_ofs) + (i_x * (box_size + box_margin)); const int y_co = (y_min + y_ofs) + (i_y * (box_size + box_margin)); - immRectf_tris_color_ex(pos, x_co - box_size, y_co - px_zoom, x_co, (y_co + box_size) - px_zoom, - col, col_dark); - immRectf_tris_color_ex(pos, x_co - box_size, y_co, x_co, y_co + box_size, - col, col_high); + immRectf_tris_color_ex( + pos, x_co - box_size, y_co - px_zoom, x_co, (y_co + box_size) - px_zoom, + col, col_dark); + immRectf_tris_color_ex( + pos, x_co - box_size, y_co, x_co, y_co + box_size, + col, col_high); } } immEnd(); @@ -751,9 +754,10 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con #endif { GPU_blend(true); - UI_icon_draw_aspect(headrect.xmax - ((PNL_ICON * 2.2f) / block->aspect), headrect.ymin + (5.0f / block->aspect), - (panel->flag & PNL_PIN) ? ICON_PINNED : ICON_UNPINNED, - (block->aspect / UI_DPI_FAC), 1.0f); + UI_icon_draw_aspect( + headrect.xmax - ((PNL_ICON * 2.2f) / block->aspect), headrect.ymin + (5.0f / block->aspect), + (panel->flag & PNL_PIN) ? ICON_PINNED : ICON_UNPINNED, + (block->aspect / UI_DPI_FAC), 1.0f); GPU_blend(false); } @@ -2004,19 +2008,22 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active) if (is_active) #endif { - ui_panel_category_draw_tab(true, rct->xmin, rct->ymin, rct->xmax, rct->ymax, - tab_curve_radius - px, roundboxtype, true, true, NULL, - is_active ? theme_col_tab_active : theme_col_tab_inactive); + ui_panel_category_draw_tab( + true, rct->xmin, rct->ymin, rct->xmax, rct->ymax, + tab_curve_radius - px, roundboxtype, true, true, NULL, + is_active ? theme_col_tab_active : theme_col_tab_inactive); /* tab outline */ - ui_panel_category_draw_tab(false, rct->xmin - px, rct->ymin - px, rct->xmax - px, rct->ymax + px, - tab_curve_radius, roundboxtype, true, true, NULL, theme_col_tab_outline); + ui_panel_category_draw_tab( + false, rct->xmin - px, rct->ymin - px, rct->xmax - px, rct->ymax + px, + tab_curve_radius, roundboxtype, true, true, NULL, theme_col_tab_outline); /* tab highlight (3d look) */ - ui_panel_category_draw_tab(false, rct->xmin, rct->ymin, rct->xmax, rct->ymax, - tab_curve_radius, roundboxtype, true, false, - is_active ? theme_col_back : theme_col_tab_inactive, - is_active ? theme_col_tab_highlight : theme_col_tab_highlight_inactive); + ui_panel_category_draw_tab( + false, rct->xmin, rct->ymin, rct->xmax, rct->ymax, + tab_curve_radius, roundboxtype, true, false, + is_active ? theme_col_back : theme_col_tab_inactive, + is_active ? theme_col_tab_highlight : theme_col_tab_highlight_inactive); } /* tab blackline */ @@ -2034,8 +2041,9 @@ void UI_panel_category_draw_all(ARegion *ar, const char *category_id_active) } if (do_scaletabs) { - category_draw_len = BLF_width_to_strlen(fontid, category_id_draw, category_draw_len, - category_width, NULL); + category_draw_len = BLF_width_to_strlen( + fontid, category_id_draw, category_draw_len, + category_width, NULL); } BLF_position(fontid, rct->xmax - text_v_ofs, rct->ymin + tab_v_pad_text, 0.0f); diff --git a/source/blender/editors/interface/interface_query.c b/source/blender/editors/interface/interface_query.c index bdd2de05ab4..66f63fef82d 100644 --- a/source/blender/editors/interface/interface_query.c +++ b/source/blender/editors/interface/interface_query.c @@ -41,16 +41,18 @@ bool ui_but_is_editable(const uiBut *but) { - return !ELEM(but->type, - UI_BTYPE_LABEL, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE, - UI_BTYPE_ROUNDBOX, UI_BTYPE_LISTBOX, UI_BTYPE_PROGRESS_BAR); + return !ELEM( + but->type, + UI_BTYPE_LABEL, UI_BTYPE_SEPR, UI_BTYPE_SEPR_LINE, + UI_BTYPE_ROUNDBOX, UI_BTYPE_LISTBOX, UI_BTYPE_PROGRESS_BAR); } bool ui_but_is_editable_as_text(const uiBut *but) { - return ELEM(but->type, - UI_BTYPE_TEXT, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER, - UI_BTYPE_SEARCH_MENU); + return ELEM( + but->type, + UI_BTYPE_TEXT, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER, + UI_BTYPE_SEARCH_MENU); } diff --git a/source/blender/editors/interface/interface_region_hud.c b/source/blender/editors/interface/interface_region_hud.c index 3ac9932fdc9..f3ff6fdf2c0 100644 --- a/source/blender/editors/interface/interface_region_hud.c +++ b/source/blender/editors/interface/interface_region_hud.c @@ -88,7 +88,7 @@ static bool last_redo_poll(const bContext *C) /** \name Redo Panel * \{ */ -static int hud_panel_operator_redo_poll(const bContext *C, PanelType *UNUSED(pt)) +static bool hud_panel_operator_redo_poll(const bContext *C, PanelType *UNUSED(pt)) { return last_redo_poll(C); } diff --git a/source/blender/editors/interface/interface_region_search.c b/source/blender/editors/interface/interface_region_search.c index 257455be27e..9ca79a3dc63 100644 --- a/source/blender/editors/interface/interface_region_search.c +++ b/source/blender/editors/interface/interface_region_search.c @@ -423,8 +423,9 @@ static void ui_searchbox_region_draw_cb(const bContext *C, ARegion *ar) ui_searchbox_butrect(&rect, data, a); /* widget itself */ - ui_draw_preview_item(&data->fstyle, &rect, data->items.names[a], data->items.icons[a], - (a == data->active) ? UI_ACTIVE : 0); + ui_draw_preview_item( + &data->fstyle, &rect, data->items.names[a], data->items.icons[a], + (a == data->active) ? UI_ACTIVE : 0); } /* indicate more */ @@ -448,8 +449,9 @@ static void ui_searchbox_region_draw_cb(const bContext *C, ARegion *ar) ui_searchbox_butrect(&rect, data, a); /* widget itself */ - ui_draw_menu_item(&data->fstyle, &rect, data->items.names[a], data->items.icons[a], - (a == data->active) ? UI_ACTIVE : 0, data->use_sep); + ui_draw_menu_item( + &data->fstyle, &rect, data->items.names[a], data->items.icons[a], + (a == data->active) ? UI_ACTIVE : 0, data->use_sep); } /* indicate more */ @@ -724,8 +726,9 @@ static void ui_searchbox_region_draw_cb__operator(const bContext *UNUSED(C), ARe } rect_pre.xmax += 4; /* sneaky, avoid showing ugly margin */ - ui_draw_menu_item(&data->fstyle, &rect_pre, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, text_pre), - data->items.icons[a], state, false); + ui_draw_menu_item( + &data->fstyle, &rect_pre, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, text_pre), + data->items.icons[a], state, false); ui_draw_menu_item(&data->fstyle, &rect_post, data->items.names[a], 0, state, data->use_sep); } diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index b70468dd508..3e28b5ee20c 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -464,8 +464,8 @@ static uiBlock *id_search_menu(bContext *C, ARegion *ar, void *arg_litem) } return template_common_search_menu( - C, ar, id_search_cb_p, &template_ui, template_ID_set_property_cb, active_item_ptr.data, - template_ui.prv_rows, template_ui.prv_cols); + C, ar, id_search_cb_p, &template_ui, template_ID_set_property_cb, active_item_ptr.data, + template_ui.prv_rows, template_ui.prv_cols); } /************************ ID Template ***************************/ @@ -575,8 +575,9 @@ static void template_id_cb(bContext *C, void *arg_litem, void *arg_event) break; case UI_ID_ALONE: if (id) { - const bool do_scene_obj = (GS(id->name) == ID_OB) && - (template_ui->ptr.type == &RNA_SceneObjects); + const bool do_scene_obj = ( + (GS(id->name) == ID_OB) && + (template_ui->ptr.type == &RNA_SceneObjects)); /* make copy */ if (do_scene_obj) { @@ -667,43 +668,49 @@ static uiBut *template_id_def_new_but( const int but_type = use_tab_but ? UI_BTYPE_TAB : UI_BTYPE_BUT; /* i18n markup, does nothing! */ - BLT_I18N_MSGID_MULTI_CTXT("New", BLT_I18NCONTEXT_DEFAULT, - BLT_I18NCONTEXT_ID_SCENE, - BLT_I18NCONTEXT_ID_OBJECT, - BLT_I18NCONTEXT_ID_MESH, - BLT_I18NCONTEXT_ID_CURVE, - BLT_I18NCONTEXT_ID_METABALL, - BLT_I18NCONTEXT_ID_MATERIAL, - BLT_I18NCONTEXT_ID_TEXTURE, - BLT_I18NCONTEXT_ID_IMAGE, - BLT_I18NCONTEXT_ID_LATTICE, - BLT_I18NCONTEXT_ID_LAMP, - BLT_I18NCONTEXT_ID_CAMERA, - BLT_I18NCONTEXT_ID_WORLD, - BLT_I18NCONTEXT_ID_SCREEN, - BLT_I18NCONTEXT_ID_TEXT, + BLT_I18N_MSGID_MULTI_CTXT( + "New", + BLT_I18NCONTEXT_DEFAULT, + BLT_I18NCONTEXT_ID_SCENE, + BLT_I18NCONTEXT_ID_OBJECT, + BLT_I18NCONTEXT_ID_MESH, + BLT_I18NCONTEXT_ID_CURVE, + BLT_I18NCONTEXT_ID_METABALL, + BLT_I18NCONTEXT_ID_MATERIAL, + BLT_I18NCONTEXT_ID_TEXTURE, + BLT_I18NCONTEXT_ID_IMAGE, + BLT_I18NCONTEXT_ID_LATTICE, + BLT_I18NCONTEXT_ID_LAMP, + BLT_I18NCONTEXT_ID_CAMERA, + BLT_I18NCONTEXT_ID_WORLD, + BLT_I18NCONTEXT_ID_SCREEN, + BLT_I18NCONTEXT_ID_TEXT, ); - BLT_I18N_MSGID_MULTI_CTXT("New", BLT_I18NCONTEXT_ID_SPEAKER, - BLT_I18NCONTEXT_ID_SOUND, - BLT_I18NCONTEXT_ID_ARMATURE, - BLT_I18NCONTEXT_ID_ACTION, - BLT_I18NCONTEXT_ID_NODETREE, - BLT_I18NCONTEXT_ID_BRUSH, - BLT_I18NCONTEXT_ID_PARTICLESETTINGS, - BLT_I18NCONTEXT_ID_GPENCIL, - BLT_I18NCONTEXT_ID_FREESTYLELINESTYLE, - BLT_I18NCONTEXT_ID_WORKSPACE, - BLT_I18NCONTEXT_ID_LIGHTPROBE, + BLT_I18N_MSGID_MULTI_CTXT( + "New", + BLT_I18NCONTEXT_ID_SPEAKER, + BLT_I18NCONTEXT_ID_SOUND, + BLT_I18NCONTEXT_ID_ARMATURE, + BLT_I18NCONTEXT_ID_ACTION, + BLT_I18NCONTEXT_ID_NODETREE, + BLT_I18NCONTEXT_ID_BRUSH, + BLT_I18NCONTEXT_ID_PARTICLESETTINGS, + BLT_I18NCONTEXT_ID_GPENCIL, + BLT_I18NCONTEXT_ID_FREESTYLELINESTYLE, + BLT_I18NCONTEXT_ID_WORKSPACE, + BLT_I18NCONTEXT_ID_LIGHTPROBE, ); if (newop) { - but = uiDefIconTextButO(block, but_type, newop, WM_OP_INVOKE_DEFAULT, ICON_ZOOMIN, - (id) ? "" : CTX_IFACE_(template_id_context(type), "New"), 0, 0, w, but_height, NULL); + but = uiDefIconTextButO( + block, but_type, newop, WM_OP_INVOKE_DEFAULT, ICON_ZOOMIN, + (id) ? "" : CTX_IFACE_(template_id_context(type), "New"), 0, 0, w, but_height, NULL); UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_ADD_NEW)); } else { - but = uiDefIconTextBut(block, but_type, 0, ICON_ZOOMIN, (id) ? "" : CTX_IFACE_(template_id_context(type), "New"), - 0, 0, w, but_height, NULL, 0, 0, 0, 0, NULL); + but = uiDefIconTextBut( + block, but_type, 0, ICON_ZOOMIN, (id) ? "" : CTX_IFACE_(template_id_context(type), "New"), + 0, 0, w, but_height, NULL, 0, 0, 0, 0, NULL); UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_ADD_NEW)); } @@ -763,17 +770,20 @@ static void template_ID( if (id->lib) { if (id->tag & LIB_TAG_INDIRECT) { - but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_LIBRARY_DATA_INDIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y, - NULL, 0, 0, 0, 0, TIP_("Indirect library data-block, cannot change")); + but = uiDefIconBut( + block, UI_BTYPE_BUT, 0, ICON_LIBRARY_DATA_INDIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y, + NULL, 0, 0, 0, 0, TIP_("Indirect library data-block, cannot change")); UI_but_flag_enable(but, UI_BUT_DISABLED); } else { - const bool disabled = (!id_make_local(CTX_data_main(C), id, true /* test */, false) || - (idfrom && idfrom->lib)); - but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_LIBRARY_DATA_DIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y, - NULL, 0, 0, 0, 0, - TIP_("Direct linked library data-block, click to make local, " - "Shift + Click to create a static override")); + const bool disabled = ( + !id_make_local(CTX_data_main(C), id, true /* test */, false) || + (idfrom && idfrom->lib)); + but = uiDefIconBut( + block, UI_BTYPE_BUT, 0, ICON_LIBRARY_DATA_DIRECT, 0, 0, UI_UNIT_X, UI_UNIT_Y, + NULL, 0, 0, 0, 0, + TIP_("Direct linked library data-block, click to make local, " + "Shift + Click to create a static override")); if (disabled) { UI_but_flag_enable(but, UI_BUT_DISABLED); } @@ -783,9 +793,10 @@ static void template_ID( } } else if (ID_IS_STATIC_OVERRIDE(id)) { - but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_LIBRARY_DATA_OVERRIDE, 0, 0, UI_UNIT_X, UI_UNIT_Y, - NULL, 0, 0, 0, 0, - TIP_("Static override of linked library data-block, click to make fully local")); + but = uiDefIconBut( + block, UI_BTYPE_BUT, 0, ICON_LIBRARY_DATA_OVERRIDE, 0, 0, UI_UNIT_X, UI_UNIT_Y, + NULL, 0, 0, 0, 0, + TIP_("Static override of linked library data-block, click to make fully local")); UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_OVERRIDE)); } @@ -795,9 +806,10 @@ static void template_ID( numstr_len = BLI_snprintf(numstr, sizeof(numstr), "%d", id->us); - but = uiDefBut(block, UI_BTYPE_BUT, 0, numstr, 0, 0, - numstr_len * 0.2f * UI_UNIT_X + UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, - TIP_("Display number of users of this data (click to make a single-user copy)")); + but = uiDefBut( + block, UI_BTYPE_BUT, 0, numstr, 0, 0, + numstr_len * 0.2f * UI_UNIT_X + UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, + TIP_("Display number of users of this data (click to make a single-user copy)")); but->flag |= UI_BUT_UNDO; UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_ALONE)); @@ -826,8 +838,9 @@ static void template_ID( /* Due to space limit in UI - skip the "open" icon for packed data, and allow to unpack. * Only for images, sound and fonts */ if (id && BKE_pack_check(id)) { - but = uiDefIconButO(block, UI_BTYPE_BUT, "FILE_OT_unpack_item", WM_OP_INVOKE_REGION_WIN, ICON_PACKAGE, 0, 0, - UI_UNIT_X, UI_UNIT_Y, TIP_("Packed File, click to unpack")); + but = uiDefIconButO( + block, UI_BTYPE_BUT, "FILE_OT_unpack_item", WM_OP_INVOKE_REGION_WIN, ICON_PACKAGE, 0, 0, + UI_UNIT_X, UI_UNIT_Y, TIP_("Packed File, click to unpack")); UI_but_operator_ptr_get(but); RNA_string_set(but->opptr, "id_name", id->name + 2); @@ -838,13 +851,15 @@ static void template_ID( int w = id ? UI_UNIT_X : (flag & UI_ID_ADD_NEW) ? UI_UNIT_X * 3 : UI_UNIT_X * 6; if (openop) { - but = uiDefIconTextButO(block, UI_BTYPE_BUT, openop, WM_OP_INVOKE_DEFAULT, ICON_FILESEL, (id) ? "" : IFACE_("Open"), - 0, 0, w, UI_UNIT_Y, NULL); + but = uiDefIconTextButO( + block, UI_BTYPE_BUT, openop, WM_OP_INVOKE_DEFAULT, ICON_FILESEL, (id) ? "" : IFACE_("Open"), + 0, 0, w, UI_UNIT_Y, NULL); UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_OPEN)); } else { - but = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, ICON_FILESEL, (id) ? "" : IFACE_("Open"), 0, 0, w, UI_UNIT_Y, - NULL, 0, 0, 0, 0, NULL); + but = uiDefIconTextBut( + block, UI_BTYPE_BUT, 0, ICON_FILESEL, (id) ? "" : IFACE_("Open"), 0, 0, w, UI_UNIT_Y, + NULL, 0, 0, 0, 0, NULL); UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_OPEN)); } @@ -865,9 +880,10 @@ static void template_ID( } else { if ((RNA_property_flag(template_ui->prop) & PROP_NEVER_UNLINK) == 0) { - but = uiDefIconBut(block, UI_BTYPE_BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, - TIP_("Unlink data-block " - "(Shift + Click to set users to zero, data will then not be saved)")); + but = uiDefIconBut( + block, UI_BTYPE_BUT, 0, ICON_X, 0, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, + TIP_("Unlink data-block " + "(Shift + Click to set users to zero, data will then not be saved)")); UI_but_funcN_set(but, template_id_cb, MEM_dupallocN(template_ui), SET_INT_IN_POINTER(UI_ID_DELETE)); if (RNA_property_flag(template_ui->prop) & PROP_NEVER_NULL) { @@ -1110,13 +1126,14 @@ static uiBlock *template_search_menu(bContext *C, ARegion *region, void *arg_tem /* arg_template is malloced, can be freed by parent button */ template_search = *((TemplateSearch *)arg_template); - active_ptr = RNA_property_pointer_get(&template_search.search_data.target_ptr, - template_search.search_data.target_prop); + active_ptr = RNA_property_pointer_get( + &template_search.search_data.target_ptr, + template_search.search_data.target_prop); return template_common_search_menu( - C, region, ui_rna_collection_search_cb, &template_search, - template_search_handle_cb, active_ptr.data, - template_search.preview_rows, template_search.preview_cols); + C, region, ui_rna_collection_search_cb, &template_search, + template_search_handle_cb, active_ptr.data, + template_search.preview_rows, template_search.preview_cols); } static void template_search_add_button_searchmenu( @@ -1295,8 +1312,9 @@ void uiTemplateSearchPreview( * - propname: property identifier for property that path gets stored to * - root_ptr: struct that path gets built from */ -void uiTemplatePathBuilder(uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *UNUSED(root_ptr), - const char *text) +void uiTemplatePathBuilder( + uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *UNUSED(root_ptr), + const char *text) { PropertyRNA *propPath; uiLayout *row; @@ -1401,8 +1419,9 @@ static uiLayout *draw_modifier( BLI_snprintf(str, sizeof(str), IFACE_("%s parent deform"), md->name); uiDefBut(block, UI_BTYPE_LABEL, 0, str, 0, 0, 185, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Modifier name")); - but = uiDefBut(block, UI_BTYPE_BUT, 0, IFACE_("Make Real"), 0, 0, 80, 16, NULL, 0.0, 0.0, 0.0, 0.0, - TIP_("Convert virtual modifier to a real modifier")); + but = uiDefBut( + block, UI_BTYPE_BUT, 0, IFACE_("Make Real"), 0, 0, 80, 16, NULL, 0.0, 0.0, 0.0, 0.0, + TIP_("Convert virtual modifier to a real modifier")); UI_but_func_set(but, modifiers_convertToReal, ob, md); } else { @@ -1457,9 +1476,10 @@ static uiLayout *draw_modifier( if (ELEM(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_MeshDeform)) { /* add disabled pre-tessellated button, so users could have * message for this modifiers */ - but = uiDefIconButBitI(block, UI_BTYPE_TOGGLE, eModifierMode_ApplyOnSpline, 0, ICON_SURFACE_DATA, 0, 0, - UI_UNIT_X - 2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0, - TIP_("This modifier can only be applied on splines' points")); + but = uiDefIconButBitI( + block, UI_BTYPE_TOGGLE, eModifierMode_ApplyOnSpline, 0, ICON_SURFACE_DATA, 0, 0, + UI_UNIT_X - 2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0, + TIP_("This modifier can only be applied on splines' points")); UI_but_flag_enable(but, UI_BUT_DISABLED); } else if (mti->type != eModifierTypeType_Constructive) { @@ -1517,13 +1537,15 @@ static uiLayout *draw_modifier( } else { uiLayoutSetOperatorContext(row, WM_OP_INVOKE_DEFAULT); - uiItemEnumO(row, "OBJECT_OT_modifier_apply", CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"), - 0, "apply_as", MODIFIER_APPLY_DATA); + uiItemEnumO( + row, "OBJECT_OT_modifier_apply", CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"), + 0, "apply_as", MODIFIER_APPLY_DATA); if (modifier_isSameTopology(md) && !modifier_isNonGeometrical(md)) { - uiItemEnumO(row, "OBJECT_OT_modifier_apply", - CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply as Shape Key"), - 0, "apply_as", MODIFIER_APPLY_SHAPE); + uiItemEnumO( + row, "OBJECT_OT_modifier_apply", + CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply as Shape Key"), + 0, "apply_as", MODIFIER_APPLY_SHAPE); } } @@ -1902,7 +1924,7 @@ static void do_preview_buttons(bContext *C, void *arg, int event) } void uiTemplatePreview( - uiLayout *layout, bContext *C, ID *id, int show_buttons, ID *parent, MTex *slot, + uiLayout *layout, bContext *C, ID *id, bool show_buttons, ID *parent, MTex *slot, const char *preview_id) { uiLayout *row, *col; @@ -1981,8 +2003,9 @@ void uiTemplatePreview( UI_but_func_drawextra_set(block, ED_preview_draw, pparent, slot); UI_block_func_handle_set(block, do_preview_buttons, NULL); - uiDefIconButS(block, UI_BTYPE_GRIP, 0, ICON_GRIP, 0, 0, UI_UNIT_X * 10, (short)(UI_UNIT_Y * 0.3f), &ui_preview->height, - UI_UNIT_Y, UI_UNIT_Y * 50.0f, 0.0f, 0.0f, ""); + uiDefIconButS( + block, UI_BTYPE_GRIP, 0, ICON_GRIP, 0, 0, UI_UNIT_X * 10, (short)(UI_UNIT_Y * 0.3f), &ui_preview->height, + UI_UNIT_Y, UI_UNIT_Y * 50.0f, 0.0f, 0.0f, ""); /* add buttons */ if (pid && show_buttons) { @@ -2130,17 +2153,20 @@ static void colorband_buttons_layout( UI_block_align_begin(block); row = uiLayoutRow(split, false); - bt = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, ICON_ZOOMIN, "", 0, 0, 2.0f * unit, UI_UNIT_Y, NULL, - 0, 0, 0, 0, TIP_("Add a new color stop to the colorband")); + bt = uiDefIconTextBut( + block, UI_BTYPE_BUT, 0, ICON_ZOOMIN, "", 0, 0, 2.0f * unit, UI_UNIT_Y, NULL, + 0, 0, 0, 0, TIP_("Add a new color stop to the colorband")); UI_but_funcN_set(bt, colorband_add_cb, MEM_dupallocN(cb), coba); - bt = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, ICON_ZOOMOUT, "", xs + 2.0f * unit, ys + UI_UNIT_Y, 2.0f * unit, UI_UNIT_Y, - NULL, 0, 0, 0, 0, TIP_("Delete the active position")); + bt = uiDefIconTextBut( + block, UI_BTYPE_BUT, 0, ICON_ZOOMOUT, "", xs + 2.0f * unit, ys + UI_UNIT_Y, 2.0f * unit, UI_UNIT_Y, + NULL, 0, 0, 0, 0, TIP_("Delete the active position")); UI_but_funcN_set(bt, colorband_del_cb, MEM_dupallocN(cb), coba); - bt = uiDefIconTextBut(block, UI_BTYPE_BUT, 0, ICON_ARROW_LEFTRIGHT, "", xs + 4.0f * unit, ys + UI_UNIT_Y, 2.0f * unit, UI_UNIT_Y, - NULL, 0, 0, 0, 0, TIP_("Flip the color ramp")); + bt = uiDefIconTextBut( + block, UI_BTYPE_BUT, 0, ICON_ARROW_LEFTRIGHT, "", xs + 4.0f * unit, ys + UI_UNIT_Y, 2.0f * unit, UI_UNIT_Y, + NULL, 0, 0, 0, 0, TIP_("Flip the color ramp")); UI_but_funcN_set(bt, colorband_flip_cb, MEM_dupallocN(cb), coba); bt = uiDefIconButO(block, UI_BTYPE_BUT, "UI_OT_eyedropper_colorband", WM_OP_INVOKE_DEFAULT, ICON_EYEDROPPER, xs + 6.0f * unit, ys + UI_UNIT_Y, UI_UNIT_X, UI_UNIT_Y, NULL); @@ -2212,7 +2238,7 @@ static void colorband_buttons_layout( } } -void uiTemplateColorRamp(uiLayout *layout, PointerRNA *ptr, const char *propname, int expand) +void uiTemplateColorRamp(uiLayout *layout, PointerRNA *ptr, const char *propname, bool expand) { PropertyRNA *prop = RNA_struct_find_property(ptr, propname); PointerRNA cptr; @@ -2325,7 +2351,7 @@ static uiBlock *ui_icon_view_menu_cb(bContext *C, ARegion *ar, void *arg_litem) /** * \param icon_scale: Scale of the icon, 1x == button height. */ -void uiTemplateIconView(uiLayout *layout, PointerRNA *ptr, const char *propname, int show_labels, float icon_scale) +void uiTemplateIconView(uiLayout *layout, PointerRNA *ptr, const char *propname, bool show_labels, float icon_scale) { PropertyRNA *prop = RNA_struct_find_property(ptr, propname); IconViewMenuArgs *cb_args; @@ -2561,8 +2587,9 @@ static uiBlock *curvemap_clipping_func(bContext *C, ARegion *ar, void *cumap_v) /* use this for a fake extra empy space around the buttons */ uiDefBut(block, UI_BTYPE_LABEL, 0, "", -4, 16, width + 8, 6 * UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); - bt = uiDefButBitI(block, UI_BTYPE_TOGGLE, CUMA_DO_CLIP, 1, IFACE_("Use Clipping"), - 0, 5 * UI_UNIT_Y, width, UI_UNIT_Y, &cumap->flag, 0.0, 0.0, 10, 0, ""); + bt = uiDefButBitI( + block, UI_BTYPE_TOGGLE, CUMA_DO_CLIP, 1, IFACE_("Use Clipping"), + 0, 5 * UI_UNIT_Y, width, UI_UNIT_Y, &cumap->flag, 0.0, 0.0, 10, 0, ""); UI_but_func_set(bt, curvemap_buttons_setclip, cumap, NULL); UI_block_align_begin(block); @@ -2725,8 +2752,8 @@ static void curvemap_buttons_reset(bContext *C, void *cb_v, void *cumap_v) /* still unsure how this call evolves... we use labeltype for defining what curve-channels to show */ static void curvemap_buttons_layout( - uiLayout *layout, PointerRNA *ptr, char labeltype, int levels, - int brush, int neg_slope, RNAUpdateCb *cb) + uiLayout *layout, PointerRNA *ptr, char labeltype, bool levels, + bool brush, bool neg_slope, RNAUpdateCb *cb) { CurveMapping *cumap = ptr->data; CurveMap *cm = &cumap->cm[cumap->cur]; @@ -2821,11 +2848,13 @@ static void curvemap_buttons_layout( if (brush) bt = uiDefIconBlockBut(block, curvemap_brush_tools_func, cumap, 0, ICON_MODIFIER, 0, 0, dx, dx, TIP_("Tools")); else if (neg_slope) - bt = uiDefIconBlockBut(block, curvemap_tools_negslope_func, cumap, 0, ICON_MODIFIER, - 0, 0, dx, dx, TIP_("Tools")); + bt = uiDefIconBlockBut( + block, curvemap_tools_negslope_func, cumap, 0, ICON_MODIFIER, + 0, 0, dx, dx, TIP_("Tools")); else - bt = uiDefIconBlockBut(block, curvemap_tools_posslope_func, cumap, 0, ICON_MODIFIER, - 0, 0, dx, dx, TIP_("Tools")); + bt = uiDefIconBlockBut( + block, curvemap_tools_posslope_func, cumap, 0, ICON_MODIFIER, + 0, 0, dx, dx, TIP_("Tools")); UI_but_funcN_set(bt, rna_update_cb, MEM_dupallocN(cb), NULL); @@ -2889,7 +2918,7 @@ static void curvemap_buttons_layout( void uiTemplateCurveMapping( uiLayout *layout, PointerRNA *ptr, const char *propname, int type, - int levels, int brush, int neg_slope) + bool levels, bool brush, bool neg_slope) { RNAUpdateCb *cb; PropertyRNA *prop = RNA_struct_find_property(ptr, propname); @@ -2933,8 +2962,8 @@ void uiTemplateCurveMapping( /* This template now follows User Preference for type - name is not correct anymore... */ void uiTemplateColorPicker( - uiLayout *layout, PointerRNA *ptr, const char *propname, int value_slider, - int lock, int lock_luminosity, int cubic) + uiLayout *layout, PointerRNA *ptr, const char *propname, bool value_slider, + bool lock, bool lock_luminosity, bool cubic) { PropertyRNA *prop = RNA_struct_find_property(ptr, propname); uiBlock *block = uiLayoutGetBlock(layout); @@ -2955,24 +2984,28 @@ void uiTemplateColorPicker( switch (U.color_picker_type) { case USER_CP_SQUARE_SV: - but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, - -1, 0.0, 0.0, UI_GRAD_SV, 0, ""); + but = uiDefButR_prop( + block, UI_BTYPE_HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, + -1, 0.0, 0.0, UI_GRAD_SV, 0, ""); break; case USER_CP_SQUARE_HS: - but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, - -1, 0.0, 0.0, UI_GRAD_HS, 0, ""); + but = uiDefButR_prop( + block, UI_BTYPE_HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, + -1, 0.0, 0.0, UI_GRAD_HS, 0, ""); break; case USER_CP_SQUARE_HV: - but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, - -1, 0.0, 0.0, UI_GRAD_HV, 0, ""); + but = uiDefButR_prop( + block, UI_BTYPE_HSVCUBE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, + -1, 0.0, 0.0, UI_GRAD_HV, 0, ""); break; /* user default */ case USER_CP_CIRCLE_HSV: case USER_CP_CIRCLE_HSL: default: - but = uiDefButR_prop(block, UI_BTYPE_HSVCIRCLE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, - -1, 0.0, 0.0, 0, 0, ""); + but = uiDefButR_prop( + block, UI_BTYPE_HSVCIRCLE, 0, "", 0, 0, WHEEL_SIZE, WHEEL_SIZE, ptr, prop, + -1, 0.0, 0.0, 0, 0, ""); break; } @@ -2998,31 +3031,36 @@ void uiTemplateColorPicker( switch (U.color_picker_type) { case USER_CP_CIRCLE_HSL: uiItemS(row); - but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", WHEEL_SIZE + 6, 0, 14, WHEEL_SIZE, ptr, prop, - -1, softmin, softmax, UI_GRAD_L_ALT, 0, ""); + but = uiDefButR_prop( + block, UI_BTYPE_HSVCUBE, 0, "", WHEEL_SIZE + 6, 0, 14, WHEEL_SIZE, ptr, prop, + -1, softmin, softmax, UI_GRAD_L_ALT, 0, ""); break; case USER_CP_SQUARE_SV: uiItemS(col); - but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop, - -1, softmin, softmax, UI_GRAD_SV + 3, 0, ""); + but = uiDefButR_prop( + block, UI_BTYPE_HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop, + -1, softmin, softmax, UI_GRAD_SV + 3, 0, ""); break; case USER_CP_SQUARE_HS: uiItemS(col); - but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop, - -1, softmin, softmax, UI_GRAD_HS + 3, 0, ""); + but = uiDefButR_prop( + block, UI_BTYPE_HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop, + -1, softmin, softmax, UI_GRAD_HS + 3, 0, ""); break; case USER_CP_SQUARE_HV: uiItemS(col); - but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop, - -1, softmin, softmax, UI_GRAD_HV + 3, 0, ""); + but = uiDefButR_prop( + block, UI_BTYPE_HSVCUBE, 0, "", 0, 4, WHEEL_SIZE, 18, ptr, prop, + -1, softmin, softmax, UI_GRAD_HV + 3, 0, ""); break; /* user default */ case USER_CP_CIRCLE_HSV: default: uiItemS(row); - but = uiDefButR_prop(block, UI_BTYPE_HSVCUBE, 0, "", WHEEL_SIZE + 6, 0, 14, WHEEL_SIZE, ptr, prop, - -1, softmin, softmax, UI_GRAD_V_ALT, 0, ""); + but = uiDefButR_prop( + block, UI_BTYPE_HSVCUBE, 0, "", WHEEL_SIZE + 6, 0, 14, WHEEL_SIZE, ptr, prop, + -1, softmin, softmax, UI_GRAD_V_ALT, 0, ""); break; } @@ -3030,7 +3068,7 @@ void uiTemplateColorPicker( } } -void uiTemplatePalette(uiLayout *layout, PointerRNA *ptr, const char *propname, int UNUSED(colors)) +void uiTemplatePalette(uiLayout *layout, PointerRNA *ptr, const char *propname, bool UNUSED(colors)) { PropertyRNA *prop = RNA_struct_find_property(ptr, propname); PointerRNA cptr; @@ -3073,8 +3111,9 @@ void uiTemplatePalette(uiLayout *layout, PointerRNA *ptr, const char *propname, } RNA_pointer_create(&palette->id, &RNA_PaletteColor, color, &color_ptr); - uiDefButR(block, UI_BTYPE_COLOR, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, &color_ptr, "color", -1, 0.0, 1.0, - UI_PALETTE_COLOR, col_id, ""); + uiDefButR( + block, UI_BTYPE_COLOR, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, &color_ptr, "color", -1, 0.0, 1.0, + UI_PALETTE_COLOR, col_id, ""); row_cols++; col_id++; } @@ -3235,8 +3274,9 @@ static int cmpstringp(const void *p1, const void *p2) return BLI_strcasecmp(((StringCmp *) p1)->name, ((StringCmp *) p2)->name); } -static void uilist_filter_items_default(struct uiList *ui_list, struct bContext *UNUSED(C), struct PointerRNA *dataptr, - const char *propname) +static void uilist_filter_items_default( + struct uiList *ui_list, struct bContext *UNUSED(C), struct PointerRNA *dataptr, + const char *propname) { uiListDyn *dyn_data = ui_list->dyn_data; PropertyRNA *prop = RNA_struct_find_property(dataptr, propname); @@ -3678,9 +3718,10 @@ void uiTemplateList( /* list item behind label & other buttons */ sub = uiLayoutRow(overlap, false); - but = uiDefButR_prop(subblock, UI_BTYPE_LISTROW, 0, "", 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, - active_dataptr, activeprop, 0, 0, org_i, 0, 0, - TIP_("Double click to rename")); + but = uiDefButR_prop( + subblock, UI_BTYPE_LISTROW, 0, "", 0, 0, UI_UNIT_X * 10, UI_UNIT_Y, + active_dataptr, activeprop, 0, 0, org_i, 0, 0, + TIP_("Double click to rename")); if ((dyntip_data = uilist_item_use_dynamic_tooltip(itemptr, item_dyntip_propname))) { UI_but_func_tooltip_set(but, uilist_item_tooltip_func, dyntip_data); } @@ -3736,8 +3777,9 @@ void uiTemplateList( /* next/prev button */ BLI_snprintf(numstr, sizeof(numstr), "%d :", dyn_data->items_shown); - but = uiDefIconTextButR_prop(block, UI_BTYPE_NUM, 0, 0, numstr, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, - active_dataptr, activeprop, 0, 0, 0, 0, 0, ""); + but = uiDefIconTextButR_prop( + block, UI_BTYPE_NUM, 0, 0, numstr, 0, 0, UI_UNIT_X * 5, UI_UNIT_Y, + active_dataptr, activeprop, 0, 0, 0, 0, 0, ""); if (dyn_data->items_shown == 0) UI_but_flag_enable(but, UI_BUT_DISABLED); break; @@ -4380,12 +4422,12 @@ void uiTemplateInputStatus(uiLayout *layout, struct bContext *C) uiItemL(row, msg ? msg : "", (ICON_MOUSE_LMB + i)); if (msg_drag) { - uiItemL(row, msg_drag, ICON_MOUSE_DRAG); + uiItemL(row, msg_drag, (ICON_MOUSE_LMB_DRAG + i)); } /* Use trick with empty string to keep icons in same position. */ row = uiLayoutRow(col, false); - uiItemL(row, " ", ICON_NONE); + uiItemL(row, " ", ICON_NONE); } } diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c index e049416ce07..d080397c488 100644 --- a/source/blender/editors/interface/interface_utils.c +++ b/source/blender/editors/interface/interface_utils.c @@ -409,8 +409,9 @@ int UI_calc_float_precision(int prec, double value) bool UI_but_online_manual_id(const uiBut *but, char *r_str, size_t maxlength) { if (but->rnapoin.id.data && but->rnapoin.data && but->rnaprop) { - BLI_snprintf(r_str, maxlength, "%s.%s", RNA_struct_identifier(but->rnapoin.type), - RNA_property_identifier(but->rnaprop)); + BLI_snprintf( + r_str, maxlength, "%s.%s", RNA_struct_identifier(but->rnapoin.type), + RNA_property_identifier(but->rnaprop)); return true; } else if (but->optype) { diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index b81825eba6e..dbd65ade307 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -674,13 +674,16 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, const rcti *re float facxi = (maxxi != minxi) ? 1.0f / (maxxi - minxi) : 0.0f; /* for uv, can divide by zero */ float facyi = (maxyi != minyi) ? 1.0f / (maxyi - minyi) : 0.0f; int a, tot = 0, minsize; - const int hnum = ((roundboxalign & (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT)) == (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT) || - (roundboxalign & (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT)) == (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT)) ? 1 : 2; - const int vnum = ((roundboxalign & (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT)) == (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT) || - (roundboxalign & (UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT)) == (UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT)) ? 1 : 2; + const int hnum = ( + (roundboxalign & (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT)) == (UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT) || + (roundboxalign & (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT)) == (UI_CNR_BOTTOM_RIGHT | UI_CNR_BOTTOM_LEFT)) ? 1 : 2; + const int vnum = ( + (roundboxalign & (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT)) == (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT) || + (roundboxalign & (UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT)) == (UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT)) ? 1 : 2; - minsize = min_ii(BLI_rcti_size_x(rect) * hnum, - BLI_rcti_size_y(rect) * vnum); + minsize = min_ii( + BLI_rcti_size_x(rect) * hnum, + BLI_rcti_size_y(rect) * vnum); if (2.0f * rad > minsize) rad = 0.5f * minsize; @@ -1662,8 +1665,9 @@ static void ui_text_clip_right_label(uiFontStyle *fstyle, uiBut *but, const rcti /* once the label's gone, chop off the least significant digits */ if (but->strwidth > okwidth) { float strwidth; - drawstr_len = BLF_width_to_strlen(fstyle->uifont_id, but->drawstr + but->ofs, - drawstr_len - but->ofs, okwidth, &strwidth) + but->ofs; + drawstr_len = BLF_width_to_strlen( + fstyle->uifont_id, but->drawstr + but->ofs, + drawstr_len - but->ofs, okwidth, &strwidth) + but->ofs; but->strwidth = strwidth; but->drawstr[drawstr_len] = 0; } @@ -1690,8 +1694,9 @@ static void widget_draw_text_ime_underline( ofs_x = 0; } - width = BLF_width(fstyle->uifont_id, drawstr + but->ofs, - ime_data->composite_len + but->pos - but->ofs); + width = BLF_width( + fstyle->uifont_id, drawstr + but->ofs, + ime_data->composite_len + but->pos - but->ofs); rgba_uchar_to_float(fcol, wcol->text); UI_draw_text_underline(rect->xmin + ofs_x, rect->ymin + 6 * U.pixelsize, min_ii(width, rect_x - 2) - ofs_x, 1, fcol); @@ -1708,8 +1713,9 @@ static void widget_draw_text_ime_underline( ofs_x = 0; } - width = BLF_width(fstyle->uifont_id, drawstr + but->ofs, - sel_end + sel_start - but->ofs); + width = BLF_width( + fstyle->uifont_id, drawstr + but->ofs, + sel_end + sel_start - but->ofs); UI_draw_text_underline(rect->xmin + ofs_x, rect->ymin + 6 * U.pixelsize, min_ii(width, rect_x - 2) - ofs_x, 2, fcol); } @@ -1762,9 +1768,10 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b if (ime_data && ime_data->composite_len) { /* insert composite string into cursor pos */ - BLI_snprintf((char *)drawstr, UI_MAX_DRAW_STR, "%s%s%s", - but->editstr, ime_data->str_composite, - but->editstr + but->pos); + BLI_snprintf( + (char *)drawstr, UI_MAX_DRAW_STR, "%s%s%s", + but->editstr, ime_data->str_composite, + but->editstr + but->pos); } else #endif @@ -2443,8 +2450,9 @@ static void ui_hsv_cursor(float x, float y) immUnbindProgram(); } -void ui_hsvcircle_vals_from_pos(float *val_rad, float *val_dist, const rcti *rect, - const float mx, const float my) +void ui_hsvcircle_vals_from_pos( + float *val_rad, float *val_dist, const rcti *rect, + const float mx, const float my) { /* duplication of code... well, simple is better now */ const float centx = BLI_rcti_cent_x_fl(rect); diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 4e9d1fad6e0..fc282e50ce2 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -1755,9 +1755,10 @@ View2DScrollers *UI_view2d_scrollers_calc( scrollers->yclamp = yclamp; scrollers->yunits = yunits; - scrollers->grid = UI_view2d_grid_calc(CTX_data_scene(C), v2d, - xunits, xclamp, yunits, yclamp, - BLI_rcti_size_x(&hor), BLI_rcti_size_y(&vert)); + scrollers->grid = UI_view2d_grid_calc( + CTX_data_scene(C), v2d, + xunits, xclamp, yunits, yclamp, + BLI_rcti_size_x(&hor), BLI_rcti_size_y(&vert)); } /* return scrollers */ @@ -2132,12 +2133,14 @@ void UI_view2d_listview_visible_cells( /* using 'cur' rect coordinates, call the cell-getting function to get the cells for this */ if (v2d) { /* min */ - UI_view2d_listview_view_to_cell(v2d, columnwidth, rowheight, startx, starty, - v2d->cur.xmin, v2d->cur.ymin, column_min, row_min); + UI_view2d_listview_view_to_cell( + v2d, columnwidth, rowheight, startx, starty, + v2d->cur.xmin, v2d->cur.ymin, column_min, row_min); /* max*/ - UI_view2d_listview_view_to_cell(v2d, columnwidth, rowheight, startx, starty, - v2d->cur.xmax, v2d->cur.ymax, column_max, row_max); + UI_view2d_listview_view_to_cell( + v2d, columnwidth, rowheight, startx, starty, + v2d->cur.xmax, v2d->cur.ymax, column_max, row_max); } } @@ -2547,8 +2550,9 @@ void UI_view2d_text_cache_draw(ARegion *ar) } if (v2s->rect.xmin >= v2s->rect.xmax) - BLF_draw_default((float)(v2s->mval[0] + xofs), (float)(v2s->mval[1] + yofs), 0.0, - v2s->str, BLF_DRAW_STR_DUMMY_MAX); + BLF_draw_default( + (float)(v2s->mval[0] + xofs), (float)(v2s->mval[1] + yofs), 0.0, + v2s->str, BLF_DRAW_STR_DUMMY_MAX); else { BLF_enable(font_id, BLF_CLIPPING); BLF_clipping(font_id, v2s->rect.xmin - 4, v2s->rect.ymin - 4, v2s->rect.xmax + 4, v2s->rect.ymax + 4); diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index defb7391bdf..dfc401c1635 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -54,7 +54,7 @@ #include "PIL_time.h" /* USER_ZOOM_CONT */ -static int view2d_poll(bContext *C) +static bool view2d_poll(bContext *C) { ARegion *ar = CTX_wm_region(C); @@ -129,7 +129,7 @@ static int view_pan_init(bContext *C, wmOperator *op) } #ifdef WITH_INPUT_NDOF -static int view_pan_poll(bContext *C) +static bool view_pan_poll(bContext *C) { ARegion *ar = CTX_wm_region(C); View2D *v2d; @@ -183,9 +183,10 @@ static void view_pan_apply(bContext *C, wmOperator *op) { v2dViewPanData *vpd = op->customdata; - view_pan_apply_ex(C, vpd, - RNA_int_get(op->ptr, "deltax"), - RNA_int_get(op->ptr, "deltay")); + view_pan_apply_ex( + C, vpd, + RNA_int_get(op->ptr, "deltax"), + RNA_int_get(op->ptr, "deltay")); } @@ -605,7 +606,7 @@ static int view_zoomdrag_init(bContext *C, wmOperator *op) } /* check if step-zoom can be applied */ -static int view_zoom_poll(bContext *C) +static bool view_zoom_poll(bContext *C) { ARegion *ar = CTX_wm_region(C); View2D *v2d; @@ -736,9 +737,10 @@ static void view_zoomstep_apply_ex( static void view_zoomstep_apply(bContext *C, wmOperator *op) { v2dViewZoomData *vzd = op->customdata; - view_zoomstep_apply_ex(C, vzd, true, - RNA_float_get(op->ptr, "zoomfacx"), - RNA_float_get(op->ptr, "zoomfacy")); + view_zoomstep_apply_ex( + C, vzd, true, + RNA_float_get(op->ptr, "zoomfacx"), + RNA_float_get(op->ptr, "zoomfacy")); } /* --------------- Individual Operators ------------------- */ @@ -791,9 +793,10 @@ static int view_zoomin_invoke(bContext *C, wmOperator *op, const wmEvent *event) ARegion *ar = CTX_wm_region(C); /* store initial mouse position (in view space) */ - UI_view2d_region_to_view(&ar->v2d, - event->mval[0], event->mval[1], - &vzd->mx_2d, &vzd->my_2d); + UI_view2d_region_to_view( + &ar->v2d, + event->mval[0], event->mval[1], + &vzd->mx_2d, &vzd->my_2d); } return view_zoomin_exec(C, op); @@ -856,9 +859,10 @@ static int view_zoomout_invoke(bContext *C, wmOperator *op, const wmEvent *event ARegion *ar = CTX_wm_region(C); /* store initial mouse position (in view space) */ - UI_view2d_region_to_view(&ar->v2d, - event->mval[0], event->mval[1], - &vzd->mx_2d, &vzd->my_2d); + UI_view2d_region_to_view( + &ar->v2d, + event->mval[0], event->mval[1], + &vzd->mx_2d, &vzd->my_2d); } return view_zoomout_exec(C, op); @@ -1066,9 +1070,10 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, const wmEvent *even ARegion *ar = CTX_wm_region(C); /* store initial mouse position (in view space) */ - UI_view2d_region_to_view(&ar->v2d, - event->mval[0], event->mval[1], - &vzd->mx_2d, &vzd->my_2d); + UI_view2d_region_to_view( + &ar->v2d, + event->mval[0], event->mval[1], + &vzd->mx_2d, &vzd->my_2d); } if (v2d->keepofs & V2D_LOCKOFS_X) @@ -1355,9 +1360,10 @@ static int view2d_ndof_invoke(bContext *C, wmOperator *op, const wmEvent *event) vzd = op->customdata; - view_zoomstep_apply_ex(C, vzd, false, - do_zoom_xy[0] ? zoom_factor : 0.0f, - do_zoom_xy[1] ? zoom_factor : 0.0f); + view_zoomstep_apply_ex( + C, vzd, false, + do_zoom_xy[0] ? zoom_factor : 0.0f, + do_zoom_xy[1] ? zoom_factor : 0.0f); view_zoomstep_exit(op); } @@ -1402,14 +1408,18 @@ struct SmoothView2DStore { */ static float smooth_view_rect_to_fac(const rctf *rect_a, const rctf *rect_b) { - const float size_a[2] = {BLI_rctf_size_x(rect_a), - BLI_rctf_size_y(rect_a)}; - const float size_b[2] = {BLI_rctf_size_x(rect_b), - BLI_rctf_size_y(rect_b)}; - const float cent_a[2] = {BLI_rctf_cent_x(rect_a), - BLI_rctf_cent_y(rect_a)}; - const float cent_b[2] = {BLI_rctf_cent_x(rect_b), - BLI_rctf_cent_y(rect_b)}; + const float size_a[2] = { + BLI_rctf_size_x(rect_a), + BLI_rctf_size_y(rect_a)}; + const float size_b[2] = { + BLI_rctf_size_x(rect_b), + BLI_rctf_size_y(rect_b)}; + const float cent_a[2] = { + BLI_rctf_cent_x(rect_a), + BLI_rctf_cent_y(rect_a)}; + const float cent_b[2] = { + BLI_rctf_cent_x(rect_b), + BLI_rctf_cent_y(rect_b)}; float fac_max = 0.0f; float tfac; @@ -1668,7 +1678,7 @@ static short mouse_in_scroller_handle(int mouse, int sc_min, int sc_max, int sh_ return SCROLLHANDLE_BAR; } -static int scroller_activate_poll(bContext *C) +static bool scroller_activate_poll(bContext *C) { if (!view2d_poll(C)) { return false; @@ -1724,9 +1734,10 @@ static void scroller_activate_init(bContext *C, wmOperator *op, const wmEvent *e vsm->fac_round = (BLI_rctf_size_x(&v2d->cur)) / (float)(BLI_rcti_size_x(&ar->winrct) + 1); /* get 'zone' (i.e. which part of scroller is activated) */ - vsm->zone = mouse_in_scroller_handle(event->mval[0], - v2d->hor.xmin, v2d->hor.xmax, - scrollers->hor_min, scrollers->hor_max); + vsm->zone = mouse_in_scroller_handle( + event->mval[0], + v2d->hor.xmin, v2d->hor.xmax, + scrollers->hor_min, scrollers->hor_max); if ((v2d->keepzoom & V2D_LOCKZOOM_X) && ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) { /* default to scroll, as handles not usable */ @@ -1745,9 +1756,10 @@ static void scroller_activate_init(bContext *C, wmOperator *op, const wmEvent *e vsm->fac_round = (BLI_rctf_size_y(&v2d->cur)) / (float)(BLI_rcti_size_y(&ar->winrct) + 1); /* get 'zone' (i.e. which part of scroller is activated) */ - vsm->zone = mouse_in_scroller_handle(event->mval[1], - v2d->vert.ymin, v2d->vert.ymax, - scrollers->vert_min, scrollers->vert_max); + vsm->zone = mouse_in_scroller_handle( + event->mval[1], + v2d->vert.ymin, v2d->vert.ymax, + scrollers->vert_min, scrollers->vert_max); if ((v2d->keepzoom & V2D_LOCKZOOM_Y) && ELEM(vsm->zone, SCROLLHANDLE_MIN, SCROLLHANDLE_MAX)) { /* default to scroll, as handles not usable */ diff --git a/source/blender/editors/lattice/editlattice_tools.c b/source/blender/editors/lattice/editlattice_tools.c index bf60c1e7da6..c6ba0237a68 100644 --- a/source/blender/editors/lattice/editlattice_tools.c +++ b/source/blender/editors/lattice/editlattice_tools.c @@ -56,7 +56,7 @@ /** \name Make Regular Operator * \{ */ -static int make_regular_poll(bContext *C) +static bool make_regular_poll(bContext *C) { Object *ob; diff --git a/source/blender/editors/mask/mask_edit.c b/source/blender/editors/mask/mask_edit.c index f51f05f2d2e..85f5836ecd7 100644 --- a/source/blender/editors/mask/mask_edit.c +++ b/source/blender/editors/mask/mask_edit.c @@ -57,7 +57,7 @@ /********************** generic poll functions *********************/ -int ED_maskedit_poll(bContext *C) +bool ED_maskedit_poll(bContext *C) { ScrArea *sa = CTX_wm_area(C); if (sa) { @@ -73,7 +73,7 @@ int ED_maskedit_poll(bContext *C) return false; } -int ED_maskedit_mask_poll(bContext *C) +bool ED_maskedit_mask_poll(bContext *C) { ScrArea *sa = CTX_wm_area(C); if (sa) { @@ -540,9 +540,8 @@ void ED_keymap_mask(wmKeyConfig *keyconf) /* geometry */ WM_keymap_add_item(keymap, "MASK_OT_add_vertex_slide", ACTIONMOUSE, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "MASK_OT_add_feather_vertex_slide", ACTIONMOUSE, KM_PRESS, KM_SHIFT, 0); -#ifdef USE_WM_KEYMAP_27X + WM_keymap_add_item(keymap, "MASK_OT_delete", XKEY, KM_PRESS, 0, 0); -#endif WM_keymap_add_item(keymap, "MASK_OT_delete", DELKEY, KM_PRESS, 0, 0); /* selection */ diff --git a/source/blender/editors/mask/mask_intern.h b/source/blender/editors/mask/mask_intern.h index 66a6c75272e..e9ef06a368f 100644 --- a/source/blender/editors/mask/mask_intern.h +++ b/source/blender/editors/mask/mask_intern.h @@ -121,8 +121,8 @@ void ED_mask_select_toggle_all(struct Mask *mask, int action); void ED_mask_select_flush_all(struct Mask *mask); /* mask_editor.c */ -int ED_maskedit_poll(struct bContext *C); -int ED_maskedit_mask_poll(struct bContext *C); +bool ED_maskedit_poll(struct bContext *C); +bool ED_maskedit_mask_poll(struct bContext *C); /* mask_shapekey.c */ void MASK_OT_shape_key_insert(struct wmOperatorType *ot); diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c index b6ac23a37e8..a93ef4405dc 100644 --- a/source/blender/editors/mask/mask_ops.c +++ b/source/blender/editors/mask/mask_ops.c @@ -2106,7 +2106,7 @@ void MASK_OT_feather_weight_clear(wmOperatorType *ot) /******************** move mask layer operator *********************/ -static int mask_layer_move_poll(bContext *C) +static bool mask_layer_move_poll(bContext *C) { if (ED_maskedit_mask_poll(C)) { Mask *mask = CTX_data_edit_mask(C); @@ -2335,7 +2335,7 @@ void MASK_OT_copy_splines(wmOperatorType *ot) /********************** paste tracks from clipboard operator *********************/ -static int paste_splines_poll(bContext *C) +static bool paste_splines_poll(bContext *C) { if (ED_maskedit_mask_poll(C)) { return BKE_mask_clipboard_is_empty() == false; diff --git a/source/blender/editors/mesh/editmesh_extrude.c b/source/blender/editors/mesh/editmesh_extrude.c index 4841de3c856..be68bfda09c 100644 --- a/source/blender/editors/mesh/editmesh_extrude.c +++ b/source/blender/editors/mesh/editmesh_extrude.c @@ -480,7 +480,7 @@ static void manipulator_mesh_extrude_setup(const bContext *UNUSED(C), wmManipula for (int i = 0; i < 4; i++) { PointerRNA *ptr = WM_manipulator_operator_set(man->invoke_xyz_no[i], 0, man->ot_extrude, NULL); { - int constraint[3] = {0, 0, 0}; + bool constraint[3] = {0, 0, 0}; constraint[MIN2(i, 2)] = 1; PointerRNA macroptr = RNA_pointer_get(ptr, "TRANSFORM_OT_translate"); RNA_boolean_set(¯optr, "release_confirm", true); @@ -492,7 +492,7 @@ static void manipulator_mesh_extrude_setup(const bContext *UNUSED(C), wmManipula for (int i = 0; i < 4; i++) { PointerRNA *ptr = WM_manipulator_operator_set(man->adjust_xyz_no[i], 0, man->ot_extrude, NULL); { - int constraint[3] = {0, 0, 0}; + bool constraint[3] = {0, 0, 0}; constraint[MIN2(i, 2)] = 1; PointerRNA macroptr = RNA_pointer_get(ptr, "TRANSFORM_OT_translate"); RNA_boolean_set(¯optr, "release_confirm", true); @@ -588,7 +588,7 @@ static void manipulator_mesh_extrude_refresh(const bContext *C, wmManipulatorGro wmOperator *op_transform = op->macro.last; float value[4]; RNA_float_get_array(op_transform->ptr, "value", value); - int constraint_axis[3]; + bool constraint_axis[3]; RNA_boolean_get_array(op_transform->ptr, "constraint_axis", constraint_axis); int orientation_type = RNA_enum_get(op_transform->ptr, "constraint_orientation"); diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index 78d98025476..8493d15a3b1 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -693,7 +693,7 @@ static int loopcut_init(bContext *C, wmOperator *op, const wmEvent *event) { Scene *scene = CTX_data_scene(C); ToolSettings *settings = scene->toolsettings; - const int mesh_select_mode[3] = { + const bool mesh_select_mode[3] = { (settings->selectmode & SCE_SELECT_VERTEX) != 0, (settings->selectmode & SCE_SELECT_EDGE) != 0, (settings->selectmode & SCE_SELECT_FACE) != 0, diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index 99a95c27b7b..2e7cf1fc76f 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -4204,7 +4204,7 @@ void MESH_OT_select_random(wmOperatorType *ot) /** \name Select Ungrouped Operator * \{ */ -static int edbm_select_ungrouped_poll(bContext *C) +static bool edbm_select_ungrouped_poll(bContext *C) { if (ED_operator_editmesh(C)) { Object *obedit = CTX_data_edit_object(C); diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index 5481c52269d..2ee3362063b 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -1382,7 +1382,7 @@ DerivedMesh *EDBM_mesh_deform_dm_get(BMEditMesh *em) * \{ */ /* poll call for mesh operators requiring a view3d context */ -int EDBM_view3d_poll(bContext *C) +bool EDBM_view3d_poll(bContext *C) { if (ED_operator_editmesh(C) && ED_operator_view3d_active(C)) { return 1; diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index b4588257412..d4a6267fa6b 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -497,7 +497,7 @@ bool ED_mesh_color_remove_named(Mesh *me, const char *name) /*********************** UV texture operators ************************/ -static int layers_poll(bContext *C) +static bool layers_poll(bContext *C) { Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; @@ -736,7 +736,7 @@ static int mesh_customdata_clear_exec__internal(bContext *C, } /* Clear Mask */ -static int mesh_customdata_mask_clear_poll(bContext *C) +static bool mesh_customdata_mask_clear_poll(bContext *C) { Object *ob = ED_object_context(C); if (ob && ob->type == OB_MESH) { @@ -809,7 +809,7 @@ static int mesh_customdata_skin_state(bContext *C) return -1; } -static int mesh_customdata_skin_add_poll(bContext *C) +static bool mesh_customdata_skin_add_poll(bContext *C) { return (mesh_customdata_skin_state(C) == 0); } @@ -842,7 +842,7 @@ void MESH_OT_customdata_skin_add(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -static int mesh_customdata_skin_clear_poll(bContext *C) +static bool mesh_customdata_skin_clear_poll(bContext *C) { return (mesh_customdata_skin_state(C) == 1); } @@ -963,7 +963,7 @@ void MESH_OT_customdata_custom_splitnormals_clear(wmOperatorType *ot) /************************** Add Geometry Layers *************************/ -void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges, int calc_tessface) +void ED_mesh_update(Mesh *mesh, bContext *C, bool calc_edges, bool calc_tessface) { bool tessface_input = false; diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index 75fead00534..3800ab9dddd 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -73,7 +73,7 @@ bool EDBM_op_finish(struct BMEditMesh *em, struct BMOperator *bmop, void EDBM_stats_update(struct BMEditMesh *em); -int EDBM_view3d_poll(struct bContext *C); +bool EDBM_view3d_poll(struct bContext *C); struct BMElem *EDBM_elem_from_selectmode( struct BMEditMesh *em, diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index 9e3a4c512c6..ff94223c815 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -485,9 +485,7 @@ void ED_keymap_mesh(wmKeyConfig *keyconf) kmi = WM_keymap_add_item(keymap, "MESH_OT_dupli_extrude_cursor", ACTIONMOUSE, KM_CLICK, KM_SHIFT | KM_CTRL, 0); RNA_boolean_set(kmi->ptr, "rotate_source", false); -#ifdef USE_WM_KEYMAP_27X WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_delete", XKEY, KM_PRESS, 0, 0); -#endif WM_keymap_add_menu(keymap, "VIEW3D_MT_edit_mesh_delete", DELKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "MESH_OT_dissolve_mode", XKEY, KM_PRESS, KM_CTRL, 0); diff --git a/source/blender/editors/metaball/mball_ops.c b/source/blender/editors/metaball/mball_ops.c index b1b1da00fd6..567ef3150bf 100644 --- a/source/blender/editors/metaball/mball_ops.c +++ b/source/blender/editors/metaball/mball_ops.c @@ -83,10 +83,9 @@ void ED_keymap_metaball(wmKeyConfig *keyconf) kmi = WM_keymap_add_item(keymap, "MBALL_OT_hide_metaelems", HKEY, KM_PRESS, KM_SHIFT, 0); RNA_boolean_set(kmi->ptr, "unselected", true); -#ifdef USE_WM_KEYMAP_27X WM_keymap_add_item(keymap, "MBALL_OT_delete_metaelems", XKEY, KM_PRESS, 0, 0); -#endif WM_keymap_add_item(keymap, "MBALL_OT_delete_metaelems", DELKEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "MBALL_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0); kmi = WM_keymap_add_item(keymap, "MBALL_OT_select_all", AKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index ac3f8d58de8..a8c3c905dd4 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -333,7 +333,8 @@ bool ED_object_add_generic_get_opts(bContext *C, wmOperator *op, const char view /* Get layers! */ { - int a, layer_values[20]; + int a; + bool layer_values[20]; if (!layer) layer = &_layer; @@ -1660,7 +1661,7 @@ static void curvetomesh(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object } } -static int convert_poll(bContext *C) +static bool convert_poll(bContext *C) { Scene *scene = CTX_data_scene(C); Base *base_act = CTX_data_active_base(C); @@ -2475,7 +2476,7 @@ void OBJECT_OT_add_named(wmOperatorType *ot) /**************************** Join *************************/ -static int join_poll(bContext *C) +static bool join_poll(bContext *C) { Object *ob = CTX_data_active_object(C); @@ -2527,7 +2528,7 @@ void OBJECT_OT_join(wmOperatorType *ot) /**************************** Join as Shape Key*************************/ -static int join_shapes_poll(bContext *C) +static bool join_shapes_poll(bContext *C) { Object *ob = CTX_data_active_object(C); diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 2ede8caf7de..d7bef459b82 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -578,7 +578,7 @@ static const EnumPropertyItem constraint_owner_items[] = { {0, NULL, 0, NULL, NULL}}; -static int edit_constraint_poll_generic(bContext *C, StructRNA *rna_type) +static bool edit_constraint_poll_generic(bContext *C, StructRNA *rna_type) { PointerRNA ptr = CTX_data_pointer_get_type(C, "constraint", rna_type); Object *ob = (ptr.id.data) ? ptr.id.data : ED_object_active_context(C); @@ -606,7 +606,7 @@ static int edit_constraint_poll_generic(bContext *C, StructRNA *rna_type) return 1; } -static int edit_constraint_poll(bContext *C) +static bool edit_constraint_poll(bContext *C) { return edit_constraint_poll_generic(C, &RNA_Constraint); } @@ -1265,7 +1265,7 @@ void ED_object_constraint_dependency_tag_update(Main *bmain, Object *ob, bConstr DEG_relations_tag_update(bmain); } -static int constraint_poll(bContext *C) +static bool constraint_poll(bContext *C) { PointerRNA ptr = CTX_data_pointer_get_type(C, "constraint", &RNA_Constraint); return (ptr.id.data && ptr.data); diff --git a/source/blender/editors/object/object_data_transfer.c b/source/blender/editors/object/object_data_transfer.c index 788f0826848..f56fd560946 100644 --- a/source/blender/editors/object/object_data_transfer.c +++ b/source/blender/editors/object/object_data_transfer.c @@ -442,7 +442,7 @@ static int data_transfer_exec(bContext *C, wmOperator *op) /* Used by both OBJECT_OT_data_transfer and OBJECT_OT_datalayout_transfer */ /* Note this context poll is only really partial, it cannot check for all possible invalid cases. */ -static int data_transfer_poll(bContext *C) +static bool data_transfer_poll(bContext *C) { Object *ob = ED_object_active_context(C); ID *data = (ob) ? ob->data : NULL; @@ -610,7 +610,7 @@ void OBJECT_OT_data_transfer(wmOperatorType *ot) * or as a DataTransfer modifier tool. */ -static int datalayout_transfer_poll(bContext *C) +static bool datalayout_transfer_poll(bContext *C) { return (edit_modifier_poll_generic(C, &RNA_DataTransferModifier, (1 << OB_MESH)) || data_transfer_poll(C)); } diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index e14842c0daa..0ca797e43b6 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -148,7 +148,7 @@ Object *ED_object_active_context(bContext *C) /* ********************** object hiding *************************** */ -static int object_hide_poll(bContext *C) +static bool object_hide_poll(bContext *C) { if (CTX_wm_space_outliner(C) != NULL) { return ED_outliner_collections_editor_poll(C); @@ -714,7 +714,7 @@ static int editmode_toggle_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int editmode_toggle_poll(bContext *C) +static bool editmode_toggle_poll(bContext *C) { Object *ob = CTX_data_active_object(C); @@ -1325,7 +1325,7 @@ void OBJECT_OT_paths_calculate(wmOperatorType *ot) /* --------- */ -static int object_update_paths_poll(bContext *C) +static bool object_update_paths_poll(bContext *C) { if (ED_operator_object_active_editable(C)) { Object *ob = ED_object_active_context(C); @@ -1494,7 +1494,7 @@ static int shade_smooth_exec(bContext *C, wmOperator *op) return (done) ? OPERATOR_FINISHED : OPERATOR_CANCELLED; } -static int shade_poll(bContext *C) +static bool shade_poll(bContext *C) { return (CTX_data_edit_object(C) == NULL); } @@ -1581,7 +1581,7 @@ static const EnumPropertyItem *object_mode_set_itemsf( return item; } -static int object_mode_set_poll(bContext *C) +static bool object_mode_set_poll(bContext *C) { /* Since Grease Pencil editmode is also handled here, * we have a special exception for allowing this operator @@ -1779,7 +1779,7 @@ bool ED_object_editmode_calc_active_center(Object *obedit, const bool select_onl return false; } -static int move_to_collection_poll(bContext *C) +static bool move_to_collection_poll(bContext *C) { if (CTX_wm_space_outliner(C) != NULL) { return ED_outliner_collections_editor_poll(C); diff --git a/source/blender/editors/object/object_facemap_ops.c b/source/blender/editors/object/object_facemap_ops.c index c5882560083..a561556bba0 100644 --- a/source/blender/editors/object/object_facemap_ops.c +++ b/source/blender/editors/object/object_facemap_ops.c @@ -163,14 +163,14 @@ static void object_facemap_swap(Object *ob, int num1, int num2) object_fmap_swap_object_mode(ob, num1, num2); } -static int face_map_supported_poll(bContext *C) +static bool face_map_supported_poll(bContext *C) { Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; return (ob && !ob->id.lib && ob->type == OB_MESH && data && !data->lib); } -static int face_map_supported_edit_mode_poll(bContext *C) +static bool face_map_supported_edit_mode_poll(bContext *C) { Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index de2c413c690..392fde4ceec 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -434,7 +434,7 @@ static void object_hook_select(Object *ob, HookModifierData *hmd) /* special poll operators for hook operators */ /* TODO: check for properties window modifier context too as alternative? */ -static int hook_op_edit_poll(bContext *C) +static bool hook_op_edit_poll(bContext *C) { Object *obedit = CTX_data_edit_object(C); diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index ce3d6eff7b4..b1ea6d72346 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -145,8 +145,8 @@ void COLLECTION_OT_objects_add_active(struct wmOperatorType *ot); void COLLECTION_OT_objects_remove_active(struct wmOperatorType *ot); /* object_modifier.c */ -int edit_modifier_poll_generic(struct bContext *C, struct StructRNA *rna_type, int obtype_flag); -int edit_modifier_poll(struct bContext *C); +bool edit_modifier_poll_generic(struct bContext *C, struct StructRNA *rna_type, int obtype_flag); +bool edit_modifier_poll(struct bContext *C); void edit_modifier_properties(struct wmOperatorType *ot); int edit_modifier_invoke_properties(struct bContext *C, struct wmOperator *op); struct ModifierData *edit_modifier_property_get(struct wmOperator *op, struct Object *ob, int type); diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index d24cc936ec1..2889f798dd8 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -816,7 +816,7 @@ void OBJECT_OT_modifier_add(wmOperatorType *ot) /************************ generic functions for operators using mod names and data context *********************/ -int edit_modifier_poll_generic(bContext *C, StructRNA *rna_type, int obtype_flag) +bool edit_modifier_poll_generic(bContext *C, StructRNA *rna_type, int obtype_flag) { PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", rna_type); Object *ob = (ptr.id.data) ? ptr.id.data : ED_object_active_context(C); @@ -838,7 +838,7 @@ int edit_modifier_poll_generic(bContext *C, StructRNA *rna_type, int obtype_flag return 1; } -int edit_modifier_poll(bContext *C) +bool edit_modifier_poll(bContext *C) { return edit_modifier_poll_generic(C, &RNA_Modifier, 0); } @@ -1143,7 +1143,7 @@ void OBJECT_OT_modifier_copy(wmOperatorType *ot) /************* multires delete higher levels operator ****************/ -static int multires_poll(bContext *C) +static bool multires_poll(bContext *C) { return edit_modifier_poll_generic(C, &RNA_MultiresModifier, (1 << OB_MESH)); } @@ -1472,13 +1472,13 @@ static void modifier_skin_customdata_delete(Object *ob) CustomData_free_layer_active(&me->vdata, CD_MVERT_SKIN, me->totvert); } -static int skin_poll(bContext *C) +static bool skin_poll(bContext *C) { return (!CTX_data_edit_object(C) && edit_modifier_poll_generic(C, &RNA_SkinModifier, (1 << OB_MESH))); } -static int skin_edit_poll(bContext *C) +static bool skin_edit_poll(bContext *C) { return (CTX_data_edit_object(C) && edit_modifier_poll_generic(C, &RNA_SkinModifier, (1 << OB_MESH))); @@ -1846,7 +1846,7 @@ void OBJECT_OT_skin_armature_create(wmOperatorType *ot) } /************************ delta mush bind operator *********************/ -static int correctivesmooth_poll(bContext *C) +static bool correctivesmooth_poll(bContext *C) { return edit_modifier_poll_generic(C, &RNA_CorrectiveSmoothModifier, 0); } @@ -1914,7 +1914,7 @@ void OBJECT_OT_correctivesmooth_bind(wmOperatorType *ot) /************************ mdef bind operator *********************/ -static int meshdeform_poll(bContext *C) +static bool meshdeform_poll(bContext *C) { return edit_modifier_poll_generic(C, &RNA_MeshDeformModifier, 0); } @@ -2010,7 +2010,7 @@ void OBJECT_OT_meshdeform_bind(wmOperatorType *ot) /****************** explode refresh operator *********************/ -static int explode_poll(bContext *C) +static bool explode_poll(bContext *C) { return edit_modifier_poll_generic(C, &RNA_ExplodeModifier, 0); } @@ -2058,7 +2058,7 @@ void OBJECT_OT_explode_refresh(wmOperatorType *ot) /****************** ocean bake operator *********************/ -static int ocean_bake_poll(bContext *C) +static bool ocean_bake_poll(bContext *C) { return edit_modifier_poll_generic(C, &RNA_OceanModifier, 0); } @@ -2276,7 +2276,7 @@ void OBJECT_OT_ocean_bake(wmOperatorType *ot) /************************ LaplacianDeform bind operator *********************/ -static int laplaciandeform_poll(bContext *C) +static bool laplaciandeform_poll(bContext *C) { return edit_modifier_poll_generic(C, &RNA_LaplacianDeformModifier, 0); } @@ -2352,7 +2352,7 @@ void OBJECT_OT_laplaciandeform_bind(wmOperatorType *ot) /************************ sdef bind operator *********************/ -static int surfacedeform_bind_poll(bContext *C) +static bool surfacedeform_bind_poll(bContext *C) { return edit_modifier_poll_generic(C, &RNA_SurfaceDeformModifier, 0); } diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index 0dafa8905c8..3af7b1e8a1b 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -278,7 +278,7 @@ void ED_operatormacros_object(void) } -static int object_mode_poll(bContext *C) +static bool object_mode_poll(bContext *C) { Object *ob = CTX_data_active_object(C); return (!ob || ob->mode == OB_MODE_OBJECT); @@ -366,13 +366,12 @@ void ED_keymap_object(wmKeyConfig *keyconf) #ifdef USE_WM_KEYMAP_27X WM_keymap_verify_item(keymap, "OBJECT_OT_origin_clear", OKEY, KM_PRESS, KM_ALT, 0); +#endif kmi = WM_keymap_add_item(keymap, "OBJECT_OT_delete", XKEY, KM_PRESS, 0, 0); RNA_boolean_set(kmi->ptr, "use_global", false); - kmi = WM_keymap_add_item(keymap, "OBJECT_OT_delete", XKEY, KM_PRESS, KM_SHIFT, 0); RNA_boolean_set(kmi->ptr, "use_global", true); -#endif kmi = WM_keymap_add_item(keymap, "OBJECT_OT_delete", DELKEY, KM_PRESS, 0, 0); RNA_boolean_set(kmi->ptr, "use_global", false); diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 8db58b17520..324b6eca34a 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -118,7 +118,7 @@ /*********************** Make Vertex Parent Operator ************************/ -static int vertex_parent_set_poll(bContext *C) +static bool vertex_parent_set_poll(bContext *C) { return ED_operator_editmesh(C) || ED_operator_editsurfcurve(C) || ED_operator_editlattice(C); } @@ -2387,7 +2387,7 @@ static int make_override_static_exec(bContext *C, wmOperator *op) return success ? OPERATOR_FINISHED : OPERATOR_CANCELLED; } -static int make_override_static_poll(bContext *C) +static bool make_override_static_poll(bContext *C) { Object *obact = CTX_data_active_object(C); diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index 7d7871c0326..b1dee812f45 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -134,7 +134,7 @@ void ED_object_base_activate(bContext *C, Base *base) /********************** Selection Operators **********************/ -static int objects_selectable_poll(bContext *C) +static bool objects_selectable_poll(bContext *C) { /* we don't check for linked scenes here, selection is * still allowed then for inspection of scene */ diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c index f2cdb0d124f..5e66dc00fd2 100644 --- a/source/blender/editors/object/object_shapekey.c +++ b/source/blender/editors/object/object_shapekey.c @@ -224,14 +224,14 @@ static bool object_shape_key_mirror(bContext *C, Object *ob, /********************** shape key operators *********************/ -static int shape_key_mode_poll(bContext *C) +static bool shape_key_mode_poll(bContext *C) { Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; return (ob && !ID_IS_LINKED(ob) && data && !ID_IS_LINKED(data) && ob->mode != OB_MODE_EDIT); } -static int shape_key_mode_exists_poll(bContext *C) +static bool shape_key_mode_exists_poll(bContext *C) { Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; @@ -242,7 +242,7 @@ static int shape_key_mode_exists_poll(bContext *C) (BKE_keyblock_from_object(ob) != NULL); } -static int shape_key_move_poll(bContext *C) +static bool shape_key_move_poll(bContext *C) { /* Same as shape_key_mode_exists_poll above, but ensure we have at least two shapes! */ Object *ob = ED_object_context(C); @@ -253,7 +253,7 @@ static int shape_key_move_poll(bContext *C) ob->mode != OB_MODE_EDIT && key && key->totkey > 1); } -static int shape_key_poll(bContext *C) +static bool shape_key_poll(bContext *C) { Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 1c1c67c9da4..ca5c000819d 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -2466,7 +2466,7 @@ static void vgroup_assign_verts(Object *ob, const float weight) /********************** vertex group operators *********************/ -static int vertex_group_poll(bContext *C) +static bool vertex_group_poll(bContext *C) { Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; @@ -2477,7 +2477,7 @@ static int vertex_group_poll(bContext *C) ob->defbase.first); } -static int vertex_group_supported_poll(bContext *C) +static bool vertex_group_supported_poll(bContext *C) { Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; @@ -2485,7 +2485,7 @@ static int vertex_group_supported_poll(bContext *C) data && !ID_IS_LINKED(data)); } -static int vertex_group_mesh_poll(bContext *C) +static bool vertex_group_mesh_poll(bContext *C) { Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; @@ -2496,7 +2496,7 @@ static int vertex_group_mesh_poll(bContext *C) ob->defbase.first); } -static int UNUSED_FUNCTION(vertex_group_mesh_supported_poll)(bContext *C) +static bool UNUSED_FUNCTION(vertex_group_mesh_supported_poll)(bContext *C) { Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; @@ -2504,7 +2504,7 @@ static int UNUSED_FUNCTION(vertex_group_mesh_supported_poll)(bContext *C) } -static int UNUSED_FUNCTION(vertex_group_poll_edit) (bContext *C) +static bool UNUSED_FUNCTION(vertex_group_poll_edit) (bContext *C) { Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; @@ -2516,7 +2516,7 @@ static int UNUSED_FUNCTION(vertex_group_poll_edit) (bContext *C) } /* editmode _or_ weight paint vertex sel */ -static int vertex_group_vert_poll_ex(bContext *C, const bool needs_select, const short ob_type_flag) +static bool vertex_group_vert_poll_ex(bContext *C, const bool needs_select, const short ob_type_flag) { Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; @@ -2551,25 +2551,25 @@ static int vertex_group_vert_poll_ex(bContext *C, const bool needs_select, const } #if 0 -static int vertex_group_vert_poll(bContext *C) +static bool vertex_group_vert_poll(bContext *C) { return vertex_group_vert_poll_ex(C, false, 0); } #endif -static int vertex_group_mesh_vert_poll(bContext *C) +static bool vertex_group_mesh_vert_poll(bContext *C) { return vertex_group_vert_poll_ex(C, false, (1 << OB_MESH)); } -static int vertex_group_vert_select_poll(bContext *C) +static bool vertex_group_vert_select_poll(bContext *C) { return vertex_group_vert_poll_ex(C, true, 0); } #if 0 -static int vertex_group_mesh_vert_select_poll(bContext *C) +static bool vertex_group_mesh_vert_select_poll(bContext *C) { return vertex_group_vert_poll_ex(C, true, (1 << OB_MESH)); } @@ -2577,7 +2577,7 @@ static int vertex_group_mesh_vert_select_poll(bContext *C) /* editmode _or_ weight paint vertex sel and active group unlocked */ -static int vertex_group_vert_select_unlocked_poll(bContext *C) +static bool vertex_group_vert_select_unlocked_poll(bContext *C) { Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; @@ -2600,7 +2600,7 @@ static int vertex_group_vert_select_unlocked_poll(bContext *C) return 1; } -static int vertex_group_vert_select_mesh_poll(bContext *C) +static bool vertex_group_vert_select_mesh_poll(bContext *C) { Object *ob = ED_object_context(C); ID *data = (ob) ? ob->data : NULL; diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index f4777eea999..e637a58e8c6 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -101,7 +101,7 @@ /**************************** utilities *******************************/ -int PE_poll(bContext *C) +bool PE_poll(bContext *C) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); @@ -112,7 +112,7 @@ int PE_poll(bContext *C) return (PE_get_current(scene, ob) != NULL); } -int PE_hair_poll(bContext *C) +bool PE_hair_poll(bContext *C) { Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_active_object(C); @@ -126,7 +126,7 @@ int PE_hair_poll(bContext *C) return (edit && edit->psys); } -int PE_poll_view3d(bContext *C) +bool PE_poll_view3d(bContext *C) { ScrArea *sa = CTX_wm_area(C); ARegion *ar = CTX_wm_region(C); @@ -4391,7 +4391,7 @@ void PARTICLE_OT_brush_edit(wmOperatorType *ot) /*********************** cut shape ***************************/ -static int shape_cut_poll(bContext *C) +static bool shape_cut_poll(bContext *C) { if (PE_hair_poll(C)) { Scene *scene = CTX_data_scene(C); @@ -4757,7 +4757,7 @@ void PE_create_particle_edit( } } -static int particle_edit_toggle_poll(bContext *C) +static bool particle_edit_toggle_poll(bContext *C) { Object *ob = CTX_data_active_object(C); diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index 2f96f4e78e6..4431e4f4a54 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -159,7 +159,7 @@ void OBJECT_OT_particle_system_remove(wmOperatorType *ot) /********************** new particle settings operator *********************/ -static int psys_poll(bContext *C) +static bool psys_poll(bContext *C) { PointerRNA ptr = CTX_data_pointer_get_type(C, "particle_system", &RNA_ParticleSystem); return (ptr.data != NULL); @@ -1167,7 +1167,7 @@ static bool copy_particle_systems_to_object(const bContext *C, return true; } -static int copy_particle_systems_poll(bContext *C) +static bool copy_particle_systems_poll(bContext *C) { Object *ob; if (!ED_operator_object_active_editable(C)) @@ -1243,7 +1243,7 @@ void PARTICLE_OT_copy_particle_systems(wmOperatorType *ot) RNA_def_boolean(ot->srna, "use_active", false, "Use Active", "Use the active particle system from the context"); } -static int duplicate_particle_systems_poll(bContext *C) +static bool duplicate_particle_systems_poll(bContext *C) { if (!ED_operator_object_active_editable(C)) { return false; diff --git a/source/blender/editors/physics/physics_ops.c b/source/blender/editors/physics/physics_ops.c index db64aa8811c..73bb2d14505 100644 --- a/source/blender/editors/physics/physics_ops.c +++ b/source/blender/editors/physics/physics_ops.c @@ -129,9 +129,7 @@ static void keymap_particle(wmKeyConfig *keyconf) kmi = WM_keymap_add_item(keymap, "PARTICLE_OT_select_linked", LKEY, KM_PRESS, KM_SHIFT, 0); RNA_boolean_set(kmi->ptr, "deselect", true); -#ifdef USE_WM_KEYMAP_27X WM_keymap_add_item(keymap, "PARTICLE_OT_delete", XKEY, KM_PRESS, 0, 0); -#endif WM_keymap_add_item(keymap, "PARTICLE_OT_delete", DELKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "PARTICLE_OT_reveal", HKEY, KM_PRESS, KM_ALT, 0); diff --git a/source/blender/editors/physics/physics_pointcache.c b/source/blender/editors/physics/physics_pointcache.c index c103a2ed8fb..7fc3dc2e1b8 100644 --- a/source/blender/editors/physics/physics_pointcache.c +++ b/source/blender/editors/physics/physics_pointcache.c @@ -57,12 +57,12 @@ #include "physics_intern.h" -static int ptcache_bake_all_poll(bContext *C) +static bool ptcache_bake_all_poll(bContext *C) { return CTX_data_scene(C) != NULL; } -static int ptcache_poll(bContext *C) +static bool ptcache_poll(bContext *C) { PointerRNA ptr= CTX_data_pointer_get_type(C, "point_cache", &RNA_PointCache); return (ptr.data && ptr.id.data); diff --git a/source/blender/editors/physics/rigidbody_constraint.c b/source/blender/editors/physics/rigidbody_constraint.c index 5704cb8fc0c..7ec814bc142 100644 --- a/source/blender/editors/physics/rigidbody_constraint.c +++ b/source/blender/editors/physics/rigidbody_constraint.c @@ -61,7 +61,7 @@ /* ********************************************** */ /* Helper API's for RigidBody Constraint Editing */ -static int ED_operator_rigidbody_con_active_poll(bContext *C) +static bool ED_operator_rigidbody_con_active_poll(bContext *C) { if (ED_operator_object_active_editable(C)) { Object *ob = CTX_data_active_object(C); diff --git a/source/blender/editors/physics/rigidbody_object.c b/source/blender/editors/physics/rigidbody_object.c index 6ea0212199e..56d80e232c0 100644 --- a/source/blender/editors/physics/rigidbody_object.c +++ b/source/blender/editors/physics/rigidbody_object.c @@ -67,7 +67,7 @@ /* ********************************************** */ /* Helper API's for RigidBody Objects Editing */ -static int ED_operator_rigidbody_active_poll(bContext *C) +static bool ED_operator_rigidbody_active_poll(bContext *C) { if (ED_operator_object_active_editable(C)) { Object *ob = ED_object_active_context(C); @@ -77,7 +77,7 @@ static int ED_operator_rigidbody_active_poll(bContext *C) return 0; } -static int ED_operator_rigidbody_add_poll(bContext *C) +static bool ED_operator_rigidbody_add_poll(bContext *C) { if (ED_operator_object_active_editable(C)) { Object *ob = ED_object_active_context(C); diff --git a/source/blender/editors/physics/rigidbody_world.c b/source/blender/editors/physics/rigidbody_world.c index 52a20ed7cf7..da0099ba469 100644 --- a/source/blender/editors/physics/rigidbody_world.c +++ b/source/blender/editors/physics/rigidbody_world.c @@ -58,12 +58,12 @@ /* API */ /* check if there is an active rigid body world */ -static int ED_rigidbody_world_active_poll(bContext *C) +static bool ED_rigidbody_world_active_poll(bContext *C) { Scene *scene = CTX_data_scene(C); return (scene && scene->rigidbody_world); } -static int ED_rigidbody_world_add_poll(bContext *C) +static bool ED_rigidbody_world_add_poll(bContext *C) { Scene *scene = CTX_data_scene(C); return (scene && scene->rigidbody_world == NULL); diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 3d67095263f..31f25720f8d 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -675,7 +675,7 @@ void SCENE_OT_view_layer_remove(wmOperatorType *ot) /********************** render view operators *********************/ -static int render_view_remove_poll(bContext *C) +static bool render_view_remove_poll(bContext *C) { Scene *scene = CTX_data_scene(C); @@ -753,7 +753,7 @@ static bool freestyle_linestyle_check_report(FreestyleLineSet *lineset, ReportLi return true; } -static int freestyle_active_module_poll(bContext *C) +static bool freestyle_active_module_poll(bContext *C) { PointerRNA ptr = CTX_data_pointer_get_type(C, "freestyle_module", &RNA_FreestyleModuleSettings); FreestyleModuleConfig *module = ptr.data; @@ -886,7 +886,7 @@ void SCENE_OT_freestyle_lineset_add(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; } -static int freestyle_active_lineset_poll(bContext *C) +static bool freestyle_active_lineset_poll(bContext *C) { ViewLayer *view_layer = CTX_data_view_layer(C); @@ -1626,7 +1626,7 @@ static int copy_mtex_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -static int copy_mtex_poll(bContext *C) +static bool copy_mtex_poll(bContext *C) { ID *id = CTX_data_pointer_get_type(C, "texture_slot", &RNA_TextureSlot).id.data; diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 2776bd98a43..d8588d7014d 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -103,7 +103,7 @@ /** \name Public Poll API * \{ */ -int ED_operator_regionactive(bContext *C) +bool ED_operator_regionactive(bContext *C) { if (CTX_wm_window(C) == NULL) return 0; if (CTX_wm_screen(C) == NULL) return 0; @@ -111,7 +111,7 @@ int ED_operator_regionactive(bContext *C) return 1; } -int ED_operator_areaactive(bContext *C) +bool ED_operator_areaactive(bContext *C) { if (CTX_wm_window(C) == NULL) return 0; if (CTX_wm_screen(C) == NULL) return 0; @@ -119,7 +119,7 @@ int ED_operator_areaactive(bContext *C) return 1; } -int ED_operator_screenactive(bContext *C) +bool ED_operator_screenactive(bContext *C) { if (CTX_wm_window(C) == NULL) return 0; if (CTX_wm_screen(C) == NULL) return 0; @@ -127,7 +127,7 @@ int ED_operator_screenactive(bContext *C) } /* XXX added this to prevent anim state to change during renders */ -static int ED_operator_screenactive_norender(bContext *C) +static bool ED_operator_screenactive_norender(bContext *C) { if (G.is_rendering) return 0; if (CTX_wm_window(C) == NULL) return 0; @@ -136,7 +136,7 @@ static int ED_operator_screenactive_norender(bContext *C) } /* when mouse is over area-edge */ -int ED_operator_screen_mainwinactive(bContext *C) +bool ED_operator_screen_mainwinactive(bContext *C) { bScreen *screen; if (CTX_wm_window(C) == NULL) return 0; @@ -146,7 +146,7 @@ int ED_operator_screen_mainwinactive(bContext *C) return 1; } -int ED_operator_scene(bContext *C) +bool ED_operator_scene(bContext *C) { Scene *scene = CTX_data_scene(C); if (scene) @@ -154,7 +154,7 @@ int ED_operator_scene(bContext *C) return 0; } -int ED_operator_scene_editable(bContext *C) +bool ED_operator_scene_editable(bContext *C) { Scene *scene = CTX_data_scene(C); if (scene && !ID_IS_LINKED(scene)) @@ -162,7 +162,7 @@ int ED_operator_scene_editable(bContext *C) return 0; } -int ED_operator_objectmode(bContext *C) +bool ED_operator_objectmode(bContext *C) { Scene *scene = CTX_data_scene(C); Object *obact = CTX_data_active_object(C); @@ -189,12 +189,12 @@ static bool ed_spacetype_test(bContext *C, int type) return 0; } -int ED_operator_view3d_active(bContext *C) +bool ED_operator_view3d_active(bContext *C) { return ed_spacetype_test(C, SPACE_VIEW3D); } -int ED_operator_region_view3d_active(bContext *C) +bool ED_operator_region_view3d_active(bContext *C) { if (CTX_wm_region_view3d(C)) return true; @@ -204,7 +204,7 @@ int ED_operator_region_view3d_active(bContext *C) } /* generic for any view2d which uses anim_ops */ -int ED_operator_animview_active(bContext *C) +bool ED_operator_animview_active(bContext *C) { if (ED_operator_areaactive(C)) { SpaceLink *sl = (SpaceLink *)CTX_wm_space_data(C); @@ -216,12 +216,12 @@ int ED_operator_animview_active(bContext *C) return 0; } -int ED_operator_outliner_active(bContext *C) +bool ED_operator_outliner_active(bContext *C) { return ed_spacetype_test(C, SPACE_OUTLINER); } -int ED_operator_outliner_active_no_editobject(bContext *C) +bool ED_operator_outliner_active_no_editobject(bContext *C) { if (ed_spacetype_test(C, SPACE_OUTLINER)) { Object *ob = ED_object_active_context(C); @@ -234,22 +234,22 @@ int ED_operator_outliner_active_no_editobject(bContext *C) return 0; } -int ED_operator_file_active(bContext *C) +bool ED_operator_file_active(bContext *C) { return ed_spacetype_test(C, SPACE_FILE); } -int ED_operator_action_active(bContext *C) +bool ED_operator_action_active(bContext *C) { return ed_spacetype_test(C, SPACE_ACTION); } -int ED_operator_buttons_active(bContext *C) +bool ED_operator_buttons_active(bContext *C) { return ed_spacetype_test(C, SPACE_BUTS); } -int ED_operator_node_active(bContext *C) +bool ED_operator_node_active(bContext *C) { SpaceNode *snode = CTX_wm_space_node(C); @@ -259,7 +259,7 @@ int ED_operator_node_active(bContext *C) return 0; } -int ED_operator_node_editable(bContext *C) +bool ED_operator_node_editable(bContext *C) { SpaceNode *snode = CTX_wm_space_node(C); @@ -269,75 +269,75 @@ int ED_operator_node_editable(bContext *C) return 0; } -int ED_operator_graphedit_active(bContext *C) +bool ED_operator_graphedit_active(bContext *C) { return ed_spacetype_test(C, SPACE_IPO); } -int ED_operator_sequencer_active(bContext *C) +bool ED_operator_sequencer_active(bContext *C) { return ed_spacetype_test(C, SPACE_SEQ); } -int ED_operator_sequencer_active_editable(bContext *C) +bool ED_operator_sequencer_active_editable(bContext *C) { return ed_spacetype_test(C, SPACE_SEQ) && ED_operator_scene_editable(C); } -int ED_operator_image_active(bContext *C) +bool ED_operator_image_active(bContext *C) { return ed_spacetype_test(C, SPACE_IMAGE); } -int ED_operator_nla_active(bContext *C) +bool ED_operator_nla_active(bContext *C) { return ed_spacetype_test(C, SPACE_NLA); } -int ED_operator_info_active(bContext *C) +bool ED_operator_info_active(bContext *C) { return ed_spacetype_test(C, SPACE_INFO); } -int ED_operator_console_active(bContext *C) +bool ED_operator_console_active(bContext *C) { return ed_spacetype_test(C, SPACE_CONSOLE); } -static int ed_object_hidden(Object *ob) +static bool ed_object_hidden(Object *ob) { /* if hidden but in edit mode, we still display, can happen with animation */ return ((ob->restrictflag & OB_RESTRICT_VIEW) && !(ob->mode & OB_MODE_EDIT)); } -int ED_operator_object_active(bContext *C) +bool ED_operator_object_active(bContext *C) { Object *ob = ED_object_active_context(C); return ((ob != NULL) && !ed_object_hidden(ob)); } -int ED_operator_object_active_editable(bContext *C) +bool ED_operator_object_active_editable(bContext *C) { Object *ob = ED_object_active_context(C); return ((ob != NULL) && !ID_IS_LINKED(ob) && !ed_object_hidden(ob)); } -int ED_operator_object_active_editable_mesh(bContext *C) +bool ED_operator_object_active_editable_mesh(bContext *C) { Object *ob = ED_object_active_context(C); return ((ob != NULL) && !ID_IS_LINKED(ob) && !ed_object_hidden(ob) && (ob->type == OB_MESH) && !ID_IS_LINKED(ob->data)); } -int ED_operator_object_active_editable_font(bContext *C) +bool ED_operator_object_active_editable_font(bContext *C) { Object *ob = ED_object_active_context(C); return ((ob != NULL) && !ID_IS_LINKED(ob) && !ed_object_hidden(ob) && (ob->type == OB_FONT)); } -int ED_operator_editmesh(bContext *C) +bool ED_operator_editmesh(bContext *C) { Object *obedit = CTX_data_edit_object(C); if (obedit && obedit->type == OB_MESH) @@ -345,12 +345,12 @@ int ED_operator_editmesh(bContext *C) return 0; } -int ED_operator_editmesh_view3d(bContext *C) +bool ED_operator_editmesh_view3d(bContext *C) { return ED_operator_editmesh(C) && ED_operator_view3d_active(C); } -int ED_operator_editmesh_region_view3d(bContext *C) +bool ED_operator_editmesh_region_view3d(bContext *C) { if (ED_operator_editmesh(C) && CTX_wm_region_view3d(C)) return 1; @@ -359,7 +359,7 @@ int ED_operator_editmesh_region_view3d(bContext *C) return 0; } -int ED_operator_editarmature(bContext *C) +bool ED_operator_editarmature(bContext *C) { Object *obedit = CTX_data_edit_object(C); if (obedit && obedit->type == OB_ARMATURE) @@ -374,7 +374,7 @@ int ED_operator_editarmature(bContext *C) * when it comes to transforming bones, but managing bones layers/groups * can be left for pose mode only. (not weight paint mode) */ -int ED_operator_posemode_exclusive(bContext *C) +bool ED_operator_posemode_exclusive(bContext *C) { Object *obact = CTX_data_active_object(C); @@ -392,7 +392,7 @@ int ED_operator_posemode_exclusive(bContext *C) /* allows for pinned pose objects to be used in the object buttons * and the non-active pose object to be used in the 3D view */ -int ED_operator_posemode_context(bContext *C) +bool ED_operator_posemode_context(bContext *C) { Object *obpose = ED_pose_object_from_context(C); @@ -405,7 +405,7 @@ int ED_operator_posemode_context(bContext *C) return 0; } -int ED_operator_posemode(bContext *C) +bool ED_operator_posemode(bContext *C) { Object *obact = CTX_data_active_object(C); @@ -421,7 +421,7 @@ int ED_operator_posemode(bContext *C) return 0; } -int ED_operator_posemode_local(bContext *C) +bool ED_operator_posemode_local(bContext *C) { if (ED_operator_posemode(C)) { Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); @@ -433,21 +433,21 @@ int ED_operator_posemode_local(bContext *C) } /* wrapper for ED_space_image_show_uvedit */ -int ED_operator_uvedit(bContext *C) +bool ED_operator_uvedit(bContext *C) { SpaceImage *sima = CTX_wm_space_image(C); Object *obedit = CTX_data_edit_object(C); return ED_space_image_show_uvedit(sima, obedit); } -int ED_operator_uvedit_space_image(bContext *C) +bool ED_operator_uvedit_space_image(bContext *C) { SpaceImage *sima = CTX_wm_space_image(C); Object *obedit = CTX_data_edit_object(C); return sima && ED_space_image_show_uvedit(sima, obedit); } -int ED_operator_uvmap(bContext *C) +bool ED_operator_uvmap(bContext *C) { Object *obedit = CTX_data_edit_object(C); BMEditMesh *em = NULL; @@ -463,7 +463,7 @@ int ED_operator_uvmap(bContext *C) return false; } -int ED_operator_editsurfcurve(bContext *C) +bool ED_operator_editsurfcurve(bContext *C) { Object *obedit = CTX_data_edit_object(C); if (obedit && ELEM(obedit->type, OB_CURVE, OB_SURF)) @@ -471,7 +471,7 @@ int ED_operator_editsurfcurve(bContext *C) return 0; } -int ED_operator_editsurfcurve_region_view3d(bContext *C) +bool ED_operator_editsurfcurve_region_view3d(bContext *C) { if (ED_operator_editsurfcurve(C) && CTX_wm_region_view3d(C)) return 1; @@ -480,7 +480,7 @@ int ED_operator_editsurfcurve_region_view3d(bContext *C) return 0; } -int ED_operator_editcurve(bContext *C) +bool ED_operator_editcurve(bContext *C) { Object *obedit = CTX_data_edit_object(C); if (obedit && obedit->type == OB_CURVE) @@ -488,7 +488,7 @@ int ED_operator_editcurve(bContext *C) return 0; } -int ED_operator_editcurve_3d(bContext *C) +bool ED_operator_editcurve_3d(bContext *C) { Object *obedit = CTX_data_edit_object(C); if (obedit && obedit->type == OB_CURVE) { @@ -499,7 +499,7 @@ int ED_operator_editcurve_3d(bContext *C) return 0; } -int ED_operator_editsurf(bContext *C) +bool ED_operator_editsurf(bContext *C) { Object *obedit = CTX_data_edit_object(C); if (obedit && obedit->type == OB_SURF) @@ -507,7 +507,7 @@ int ED_operator_editsurf(bContext *C) return 0; } -int ED_operator_editfont(bContext *C) +bool ED_operator_editfont(bContext *C) { Object *obedit = CTX_data_edit_object(C); if (obedit && obedit->type == OB_FONT) @@ -515,7 +515,7 @@ int ED_operator_editfont(bContext *C) return 0; } -int ED_operator_editlattice(bContext *C) +bool ED_operator_editlattice(bContext *C) { Object *obedit = CTX_data_edit_object(C); if (obedit && obedit->type == OB_LATTICE) @@ -523,7 +523,7 @@ int ED_operator_editlattice(bContext *C) return 0; } -int ED_operator_editmball(bContext *C) +bool ED_operator_editmball(bContext *C) { Object *obedit = CTX_data_edit_object(C); if (obedit && obedit->type == OB_MBALL) @@ -531,7 +531,7 @@ int ED_operator_editmball(bContext *C) return 0; } -int ED_operator_mask(bContext *C) +bool ED_operator_mask(bContext *C) { ScrArea *sa = CTX_wm_area(C); if (sa && sa->spacedata.first) { @@ -559,7 +559,7 @@ int ED_operator_mask(bContext *C) return false; } -int ED_operator_camera(bContext *C) +bool ED_operator_camera(bContext *C) { struct Camera *cam = CTX_data_pointer_get_type(C, "camera", &RNA_Camera).data; return (cam != NULL); @@ -571,7 +571,7 @@ int ED_operator_camera(bContext *C) /** \name Internal Screen Utilities * \{ */ -static int screen_active_editable(bContext *C) +static bool screen_active_editable(bContext *C) { if (ED_operator_screenactive(C)) { /* no full window splitting allowed */ @@ -635,7 +635,7 @@ typedef struct sActionzoneData { } sActionzoneData; /* quick poll to save operators to be created and handled */ -static int actionzone_area_poll(bContext *C) +static bool actionzone_area_poll(bContext *C) { wmWindow *win = CTX_wm_window(C); ScrArea *sa = CTX_wm_area(C); @@ -1836,8 +1836,11 @@ static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event) int dir; /* no full window splitting allowed */ - if (sc->state != SCREENNORMAL) - return OPERATOR_CANCELLED; + BLI_assert(sc->state == SCREENNORMAL); + + PropertyRNA *prop_dir = RNA_struct_find_property(op->ptr, "direction"); + PropertyRNA *prop_factor = RNA_struct_find_property(op->ptr, "factor"); + PropertyRNA *prop_cursor = RNA_struct_find_property(op->ptr, "cursor"); if (event->type == EVT_ACTIONZONE_AREA) { sActionzoneData *sad = event->customdata; @@ -1857,49 +1860,73 @@ static int area_split_invoke(bContext *C, wmOperator *op, const wmEvent *event) /* prepare operator state vars */ if (sad->gesture_dir == 'n' || sad->gesture_dir == 's') { dir = 'h'; - RNA_float_set(op->ptr, "factor", ((float)(event->x - sad->sa1->v1->vec.x)) / (float)sad->sa1->winx); + RNA_property_float_set( + op->ptr, prop_factor, + ((float)(event->x - sad->sa1->v1->vec.x)) / (float)sad->sa1->winx); } else { dir = 'v'; - RNA_float_set(op->ptr, "factor", ((float)(event->y - sad->sa1->v1->vec.y)) / (float)sad->sa1->winy); + RNA_property_float_set( + op->ptr, prop_factor, + ((float)(event->y - sad->sa1->v1->vec.y)) / (float)sad->sa1->winy); } - RNA_enum_set(op->ptr, "direction", dir); + RNA_property_enum_set(op->ptr, prop_dir, dir); /* general init, also non-UI case, adds customdata, sets area and defaults */ - if (!area_split_init(C, op)) + if (!area_split_init(C, op)) { return OPERATOR_PASS_THROUGH; + } + } + else if (RNA_property_is_set(op->ptr, prop_dir)) { + ScrArea *sa = CTX_wm_area(C); + if (sa == NULL) { + return OPERATOR_CANCELLED; + } + dir = RNA_property_enum_get(op->ptr, prop_dir); + if (dir == 'h') { + RNA_property_float_set( + op->ptr, prop_factor, + ((float)(event->x - sa->v1->vec.x)) / (float)sa->winx); + } + else { + RNA_property_float_set( + op->ptr, prop_factor, + ((float)(event->y - sa->v1->vec.y)) / (float)sa->winy); + } + if (!area_split_init(C, op)) { + return OPERATOR_CANCELLED; + } } else { ScrEdge *actedge; rcti screen_rect; - int x, y; + int event_co[2]; /* retrieve initial mouse coord, so we can find the active edge */ - if (RNA_struct_property_is_set(op->ptr, "mouse_x")) - x = RNA_int_get(op->ptr, "mouse_x"); - else - x = event->x; - - if (RNA_struct_property_is_set(op->ptr, "mouse_y")) - y = RNA_int_get(op->ptr, "mouse_y"); - else - y = event->x; + if (RNA_property_is_set(op->ptr, prop_cursor)) { + RNA_property_int_get_array(op->ptr, prop_cursor, event_co); + } + else { + copy_v2_v2_int(event_co, &event->x); + } WM_window_screen_rect_calc(win, &screen_rect); - actedge = screen_geom_area_map_find_active_scredge(AREAMAP_FROM_SCREEN(sc), &screen_rect, x, y); - if (actedge == NULL) + actedge = screen_geom_area_map_find_active_scredge( + AREAMAP_FROM_SCREEN(sc), &screen_rect, event_co[0], event_co[1]); + if (actedge == NULL) { return OPERATOR_CANCELLED; + } dir = screen_geom_edge_is_horizontal(actedge) ? 'v' : 'h'; - RNA_enum_set(op->ptr, "direction", dir); + RNA_property_enum_set(op->ptr, prop_dir, dir); /* special case, adds customdata, sets defaults */ - if (!area_split_menu_init(C, op)) + if (!area_split_menu_init(C, op)) { return OPERATOR_CANCELLED; - + } } sd = (sAreaSplitData *)op->customdata; @@ -2099,8 +2126,7 @@ static void SCREEN_OT_area_split(wmOperatorType *ot) /* rna */ RNA_def_enum(ot->srna, "direction", prop_direction_items, 'h', "Direction", ""); RNA_def_float(ot->srna, "factor", 0.5f, 0.0, 1.0, "Factor", "", 0.0, 1.0); - RNA_def_int(ot->srna, "mouse_x", -100, INT_MIN, INT_MAX, "Mouse X", "", INT_MIN, INT_MAX); - RNA_def_int(ot->srna, "mouse_y", -100, INT_MIN, INT_MAX, "Mouse Y", "", INT_MIN, INT_MAX); + RNA_def_int_vector(ot->srna, "cursor", 2, NULL, INT_MIN, INT_MAX, "Cursor", "", INT_MIN, INT_MAX); } /** \} */ @@ -2788,7 +2814,7 @@ static int screen_maximize_area_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int screen_maximize_area_poll(bContext *C) +static bool screen_maximize_area_poll(bContext *C) { const bScreen *screen = CTX_wm_screen(C); const ScrArea *area = CTX_wm_area(C); @@ -3128,8 +3154,7 @@ static int screen_area_options_invoke(bContext *C, wmOperator *op, const wmEvent uiItemFullO(layout, "SCREEN_OT_area_split", NULL, ICON_NONE, NULL, WM_OP_INVOKE_DEFAULT, 0, &ptr); /* store initial mouse cursor position */ - RNA_int_set(&ptr, "mouse_x", event->x); - RNA_int_set(&ptr, "mouse_y", event->y); + RNA_int_set_array(&ptr, "cursor", &event->x); uiItemFullO(layout, "SCREEN_OT_area_join", NULL, ICON_NONE, NULL, WM_OP_INVOKE_DEFAULT, 0, &ptr); /* mouse cursor on edge, '4' can fail on wide edges... */ @@ -3523,7 +3548,7 @@ static int region_flip_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -static int region_flip_poll(bContext *C) +static bool region_flip_poll(bContext *C) { ScrArea *area = CTX_wm_area(C); @@ -4546,7 +4571,7 @@ static const EnumPropertyItem space_context_cycle_direction[] = { {0, NULL, 0, NULL, NULL} }; -static int space_context_cycle_poll(bContext *C) +static bool space_context_cycle_poll(bContext *C) { ScrArea *sa = CTX_wm_area(C); /* sa might be NULL if called out of window bounds */ @@ -4754,7 +4779,7 @@ static void keymap_modal_set(wmKeyConfig *keyconf) } -static int open_file_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) +static bool open_file_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) { if (drag->type == WM_DRAG_PATH) { if (drag->icon == ICON_FILE_BLEND) @@ -4832,9 +4857,9 @@ void ED_keymap_screen(wmKeyConfig *keyconf) kmi = WM_keymap_add_item(keymap, "SCREEN_OT_space_context_cycle", TABKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0); RNA_enum_set(kmi->ptr, "direction", SPACE_CONTEXT_CYCLE_PREV); - kmi = WM_keymap_add_item(keymap, "SCREEN_OT_workspace_cycle", TABKEY, KM_PRESS, KM_CTRL, 0); + kmi = WM_keymap_add_item(keymap, "SCREEN_OT_workspace_cycle", PAGEDOWNKEY, KM_PRESS, KM_CTRL, 0); RNA_enum_set(kmi->ptr, "direction", SPACE_CONTEXT_CYCLE_NEXT); - kmi = WM_keymap_add_item(keymap, "SCREEN_OT_workspace_cycle", TABKEY, KM_PRESS, KM_CTRL | KM_SHIFT, 0); + kmi = WM_keymap_add_item(keymap, "SCREEN_OT_workspace_cycle", PAGEUPKEY, KM_PRESS, KM_CTRL, 0); RNA_enum_set(kmi->ptr, "direction", SPACE_CONTEXT_CYCLE_PREV); /* tests */ diff --git a/source/blender/editors/screen/screen_user_menu.c b/source/blender/editors/screen/screen_user_menu.c index c51227d7107..f62dc1ee500 100644 --- a/source/blender/editors/screen/screen_user_menu.c +++ b/source/blender/editors/screen/screen_user_menu.c @@ -56,6 +56,8 @@ #include "UI_interface.h" #include "UI_resources.h" +#include "RNA_access.h" + /* -------------------------------------------------------------------- */ /** \name Menu Type * \{ */ @@ -113,6 +115,24 @@ struct bUserMenuItem_Menu *ED_screen_user_menu_item_find_menu( return NULL; } +struct bUserMenuItem_Prop *ED_screen_user_menu_item_find_prop( + struct ListBase *lb, + const char *context_data_path, const char *prop_id, int prop_index) +{ + for (bUserMenuItem *umi = lb->first; umi; umi = umi->next) { + if (umi->type == USER_MENU_TYPE_PROP) { + bUserMenuItem_Prop *umi_pr = (bUserMenuItem_Prop *)umi; + if (STREQ(context_data_path, umi_pr->context_data_path) && + STREQ(prop_id, umi_pr->prop_id) && + (prop_index == umi_pr->prop_index)) + { + return umi_pr; + } + } + } + return NULL; +} + void ED_screen_user_menu_item_add_operator( ListBase *lb, const char *ui_name, const wmOperatorType *ot, const IDProperty *prop, short opcontext) @@ -137,6 +157,17 @@ void ED_screen_user_menu_item_add_menu( STRNCPY(umi_mt->mt_idname, mt->idname); } +void ED_screen_user_menu_item_add_prop( + ListBase *lb, const char *ui_name, + const char *context_data_path, const char *prop_id, int prop_index) +{ + bUserMenuItem_Prop *umi_pr = (bUserMenuItem_Prop *)BKE_blender_user_menu_item_add(lb, USER_MENU_TYPE_PROP); + STRNCPY(umi_pr->item.ui_name, ui_name); + STRNCPY(umi_pr->context_data_path, context_data_path); + STRNCPY(umi_pr->prop_id, prop_id); + umi_pr->prop_index = prop_index; +} + void ED_screen_user_menu_item_remove(ListBase *lb, bUserMenuItem *umi) { BLI_remlink(lb, umi); @@ -176,6 +207,47 @@ static void screen_user_menu_draw(const bContext *C, Menu *menu) uiItemM(menu->layout, umi_mt->mt_idname, ui_name, ICON_NONE); } + else if (umi->type == USER_MENU_TYPE_PROP) { + bUserMenuItem_Prop *umi_pr = (bUserMenuItem_Prop *)umi; + + char *data_path = strchr(umi_pr->context_data_path, '.'); + if (data_path) { + *data_path = '\0'; + } + PointerRNA ptr = CTX_data_pointer_get(C, umi_pr->context_data_path); + if (ptr.type == NULL) { + PointerRNA ctx_ptr; + RNA_pointer_create(NULL, &RNA_Context, (void *)C, &ctx_ptr); + if (!RNA_path_resolve_full(&ctx_ptr, umi_pr->context_data_path, &ptr, NULL, NULL)) { + ptr.type = NULL; + } + } + if (data_path) { + *data_path = '.'; + data_path += 1; + } + + bool ok = false; + if (ptr.type != NULL) { + PropertyRNA *prop = NULL; + PointerRNA prop_ptr = ptr; + if ((data_path == NULL) || RNA_path_resolve_full(&ptr, data_path, &prop_ptr, NULL, NULL)) { + prop = RNA_struct_find_property(&prop_ptr, umi_pr->prop_id); + if (prop) { + ok = true; + uiItemFullR( + menu->layout, + &prop_ptr, prop, umi_pr->prop_index, + 0, 0, ui_name, ICON_NONE); + } + } + } + if (!ok) { + char label[512]; + SNPRINTF(label, "Missing: %s.%s", umi_pr->context_data_path, umi_pr->prop_id); + uiItemL(menu->layout, label, ICON_NONE); + } + } else if (umi->type == USER_MENU_TYPE_SEP) { uiItemS(menu->layout); } diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c index 387cd7df998..afaad3963d5 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -269,7 +269,7 @@ static void screenshot_draw(bContext *UNUSED(C), wmOperator *op) uiDefAutoButsRNA(layout, &ptr, screenshot_draw_check_prop, UI_BUT_LABEL_ALIGN_NONE, false); } -static int screenshot_poll(bContext *C) +static bool screenshot_poll(bContext *C) { if (G.background) return false; diff --git a/source/blender/editors/screen/workspace_edit.c b/source/blender/editors/screen/workspace_edit.c index 800b1fbe51d..df05cc07352 100644 --- a/source/blender/editors/screen/workspace_edit.c +++ b/source/blender/editors/screen/workspace_edit.c @@ -332,7 +332,7 @@ static void WORKSPACE_OT_workspace_delete(wmOperatorType *ot) ot->exec = workspace_delete_exec; } -static int workspace_append_activate_poll(bContext *C) +static bool workspace_append_activate_poll(bContext *C) { wmOperatorType *ot = WM_operatortype_find("WM_OT_append", false); return WM_operator_poll(C, ot); diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 50d178bc757..94111c9939d 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -1136,7 +1136,7 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) /* Public API */ -void paint_cursor_start(bContext *C, int (*poll)(bContext *C)) +void paint_cursor_start(bContext *C, bool (*poll)(bContext *C)) { Paint *p = BKE_paint_get_active_from_context(C); @@ -1147,7 +1147,7 @@ void paint_cursor_start(bContext *C, int (*poll)(bContext *C)) BKE_paint_invalidate_overlay_all(); } -void paint_cursor_start_explicit(Paint *p, wmWindowManager *wm, int (*poll)(bContext *C)) +void paint_cursor_start_explicit(Paint *p, wmWindowManager *wm, bool (*poll)(bContext *C)) { if (p && !p->paint_cursor) p->paint_cursor = WM_paint_cursor_activate(wm, poll, paint_draw_cursor, NULL); diff --git a/source/blender/editors/sculpt_paint/paint_curve.c b/source/blender/editors/sculpt_paint/paint_curve.c index e2100ceb066..0c3c6e120ed 100644 --- a/source/blender/editors/sculpt_paint/paint_curve.c +++ b/source/blender/editors/sculpt_paint/paint_curve.c @@ -57,7 +57,7 @@ #define PAINT_CURVE_SELECT_THRESHOLD 40.0f #define PAINT_CURVE_POINT_SELECT(pcp, i) (*(&pcp->bez.f1 + i) = SELECT) -int paint_curve_poll(bContext *C) +bool paint_curve_poll(bContext *C) { Object *ob = CTX_data_active_object(C); Paint *p; diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index e2dd043c0c3..02fd685719e 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -268,7 +268,7 @@ static Brush *image_paint_brush(bContext *C) return BKE_paint_brush(&settings->imapaint.paint); } -static int image_paint_poll_ex(bContext *C, bool check_tool) +static bool image_paint_poll_ex(bContext *C, bool check_tool) { Object *obact; @@ -296,17 +296,17 @@ static int image_paint_poll_ex(bContext *C, bool check_tool) return 0; } -static int image_paint_poll(bContext *C) +static bool image_paint_poll(bContext *C) { return image_paint_poll_ex(C, true); } -static int image_paint_ignore_tool_poll(bContext *C) +static bool image_paint_ignore_tool_poll(bContext *C) { return image_paint_poll_ex(C, false); } -static int image_paint_2d_clone_poll(bContext *C) +static bool image_paint_2d_clone_poll(bContext *C) { Brush *brush = image_paint_brush(C); @@ -1039,7 +1039,7 @@ void PAINT_OT_sample_color(wmOperatorType *ot) /******************** texture paint toggle operator ********************/ -static int texture_paint_toggle_poll(bContext *C) +static bool texture_paint_toggle_poll(bContext *C) { Object *ob = CTX_data_active_object(C); if (ob == NULL || ob->type != OB_MESH) @@ -1185,7 +1185,7 @@ static int brush_colors_flip_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -static int brush_colors_flip_poll(bContext *C) +static bool brush_colors_flip_poll(bContext *C) { if (image_paint_poll(C)) { Brush *br = image_paint_brush(C); @@ -1235,7 +1235,7 @@ void ED_imapaint_bucket_fill(struct bContext *C, float color[3], wmOperator *op) } -static int texture_paint_poll(bContext *C) +static bool texture_paint_poll(bContext *C) { if (texture_paint_toggle_poll(C)) if (CTX_data_active_object(C)->mode & OB_MODE_TEXTURE_PAINT) @@ -1244,22 +1244,22 @@ static int texture_paint_poll(bContext *C) return 0; } -int image_texture_paint_poll(bContext *C) +bool image_texture_paint_poll(bContext *C) { return (texture_paint_poll(C) || image_paint_poll(C)); } -int facemask_paint_poll(bContext *C) +bool facemask_paint_poll(bContext *C) { return BKE_paint_select_face_test(CTX_data_active_object(C)); } -int vert_paint_poll(bContext *C) +bool vert_paint_poll(bContext *C) { return BKE_paint_select_vert_test(CTX_data_active_object(C)); } -int mask_paint_poll(bContext *C) +bool mask_paint_poll(bContext *C) { return BKE_paint_select_elem_test(CTX_data_active_object(C)); } diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index f7cac84b728..8c5fdc617c6 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -5803,7 +5803,7 @@ static int add_simple_uvs_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -static int add_simple_uvs_poll(bContext *C) +static bool add_simple_uvs_poll(bContext *C) { Object *ob = CTX_data_active_object(C); diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h index 8d94978f5c6..a7041a5e9ea 100644 --- a/source/blender/editors/sculpt_paint/paint_intern.h +++ b/source/blender/editors/sculpt_paint/paint_intern.h @@ -87,18 +87,18 @@ struct ViewContext *paint_stroke_view_context(struct PaintStroke *stroke); void *paint_stroke_mode_data(struct PaintStroke *stroke); float paint_stroke_distance_get(struct PaintStroke *stroke); void paint_stroke_set_mode_data(struct PaintStroke *stroke, void *mode_data); -int paint_poll(struct bContext *C); -void paint_cursor_start(struct bContext *C, int (*poll)(struct bContext *C)); -void paint_cursor_start_explicit(struct Paint *p, struct wmWindowManager *wm, int (*poll)(struct bContext *C)); +bool paint_poll(struct bContext *C); +void paint_cursor_start(struct bContext *C, bool (*poll)(struct bContext *C)); +void paint_cursor_start_explicit(struct Paint *p, struct wmWindowManager *wm, bool (*poll)(struct bContext *C)); void paint_cursor_delete_textures(void); /* paint_vertex.c */ -int weight_paint_poll(struct bContext *C); -int weight_paint_poll_ignore_tool(bContext *C); -int weight_paint_mode_poll(struct bContext *C); -int vertex_paint_poll(struct bContext *C); -int vertex_paint_poll_ignore_tool(struct bContext *C); -int vertex_paint_mode_poll(struct bContext *C); +bool weight_paint_poll(struct bContext *C); +bool weight_paint_poll_ignore_tool(bContext *C); +bool weight_paint_mode_poll(struct bContext *C); +bool vertex_paint_poll(struct bContext *C); +bool vertex_paint_poll_ignore_tool(struct bContext *C); +bool vertex_paint_mode_poll(struct bContext *C); typedef void (*VPaintTransform_Callback)(const float col[3], const void *user_data, float r_col[3]); @@ -179,7 +179,7 @@ typedef struct ImagePaintPartialRedraw { #define IMAPAINT_TILE_SIZE (1 << IMAPAINT_TILE_BITS) #define IMAPAINT_TILE_NUMBER(size) (((size) + IMAPAINT_TILE_SIZE - 1) >> IMAPAINT_TILE_BITS) -int image_texture_paint_poll(struct bContext *C); +bool image_texture_paint_poll(struct bContext *C); void imapaint_image_update(struct SpaceImage *sima, struct Image *image, struct ImBuf *ibuf, short texpaint); struct ImagePaintPartialRedraw *get_imapaintpartial(void); void set_imapaintpartial(struct ImagePaintPartialRedraw *ippr); @@ -238,8 +238,8 @@ struct ListBase *ED_image_undosys_step_get_tiles(struct UndoStep *us_p); struct ListBase *ED_image_undo_get_tiles(void); /* sculpt_uv.c */ -int uv_sculpt_poll(struct bContext *C); -int uv_sculpt_keymap_poll(struct bContext *C); +bool uv_sculpt_poll(struct bContext *C); +bool uv_sculpt_keymap_poll(struct bContext *C); void SCULPT_OT_uv_sculpt_stroke(struct wmOperatorType *ot); @@ -282,11 +282,11 @@ void PAINT_OT_face_select_reveal(struct wmOperatorType *ot); void PAINT_OT_vert_select_all(struct wmOperatorType *ot); void PAINT_OT_vert_select_ungrouped(struct wmOperatorType *ot); -int vert_paint_poll(struct bContext *C); -int mask_paint_poll(struct bContext *C); -int paint_curve_poll(struct bContext *C); +bool vert_paint_poll(struct bContext *C); +bool mask_paint_poll(struct bContext *C); +bool paint_curve_poll(struct bContext *C); -int facemask_paint_poll(struct bContext *C); +bool facemask_paint_poll(struct bContext *C); void flip_v3_v3(float out[3], const float in[3], const char symm); void flip_qt_qt(float out[3], const float in[3], const char symm); diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 56908811008..c286d41f4b0 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -184,7 +184,7 @@ static void PALETTE_OT_new(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -static int palette_poll(bContext *C) +static bool palette_poll(bContext *C) { Paint *paint = BKE_paint_get_active_from_context(C); @@ -794,7 +794,7 @@ static int stencil_control_modal(bContext *C, wmOperator *op, const wmEvent *eve return OPERATOR_RUNNING_MODAL; } -static int stencil_control_poll(bContext *C) +static bool stencil_control_poll(bContext *C) { ePaintMode mode = BKE_paintmode_get_active_from_context(C); @@ -1230,9 +1230,8 @@ static void paint_keymap_curve(wmKeyMap *keymap) RNA_boolean_set(kmi->ptr, "toggle", true); WM_keymap_add_item(keymap, "PAINTCURVE_OT_cursor", ACTIONMOUSE, KM_PRESS, 0, 0); -#ifdef USE_WM_KEYMAP_27X + WM_keymap_add_item(keymap, "PAINTCURVE_OT_delete_point", XKEY, KM_PRESS, 0, 0); -#endif WM_keymap_add_item(keymap, "PAINTCURVE_OT_delete_point", DELKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "PAINTCURVE_OT_draw", RETKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index ee888c71659..80211c46733 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -189,7 +189,7 @@ static void paint_draw_line_cursor(bContext *C, int x, int y, void *customdata) GPU_viewport_size_getf(viewport_size); immUniform2f("viewport_size", viewport_size[2], viewport_size[3]); - immUniform1i("num_colors", 2); /* "advanced" mode */ + immUniform1i("colors_len", 2); /* "advanced" mode */ const float alpha = (float)paint->paint_cursor_col[3] / 255.0f; immUniformArray4fv("colors", (float *)(float[][4]){{0.0f, 0.0f, 0.0f, alpha}, {1.0f, 1.0f, 1.0f, alpha}}, 2); immUniform1f("dash_width", 6.0f); @@ -1351,7 +1351,7 @@ void paint_stroke_set_mode_data(PaintStroke *stroke, void *mode_data) stroke->mode_data = mode_data; } -int paint_poll(bContext *C) +bool paint_poll(bContext *C) { Paint *p = BKE_paint_get_active_from_context(C); Object *ob = CTX_data_active_object(C); diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index d6de9c235f1..57306eaff45 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -568,7 +568,7 @@ static int brush_curve_preset_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int brush_curve_preset_poll(bContext *C) +static bool brush_curve_preset_poll(bContext *C) { Brush *br = BKE_paint_brush(BKE_paint_get_active_from_context(C)); diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 47bcbdb4a08..59a9ee8f0d2 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -201,14 +201,14 @@ static void paint_last_stroke_update(Scene *scene, ARegion *ar, const float mval /* polling - retrieve whether cursor should be set or operator should be done */ /* Returns true if vertex paint mode is active */ -int vertex_paint_mode_poll(bContext *C) +bool vertex_paint_mode_poll(bContext *C) { Object *ob = CTX_data_active_object(C); return ob && ob->mode == OB_MODE_VERTEX_PAINT && ((Mesh *)ob->data)->totpoly; } -static int vertex_paint_poll_ex(bContext *C, bool check_tool) +static bool vertex_paint_poll_ex(bContext *C, bool check_tool) { if (vertex_paint_mode_poll(C) && BKE_paint_brush(&CTX_data_tool_settings(C)->vpaint->paint)) @@ -226,24 +226,24 @@ static int vertex_paint_poll_ex(bContext *C, bool check_tool) return 0; } -int vertex_paint_poll(bContext *C) +bool vertex_paint_poll(bContext *C) { return vertex_paint_poll_ex(C, true); } -int vertex_paint_poll_ignore_tool(bContext *C) +bool vertex_paint_poll_ignore_tool(bContext *C) { return vertex_paint_poll_ex(C, true); } -int weight_paint_mode_poll(bContext *C) +bool weight_paint_mode_poll(bContext *C) { Object *ob = CTX_data_active_object(C); return ob && ob->mode == OB_MODE_WEIGHT_PAINT && ((Mesh *)ob->data)->totpoly; } -static int weight_paint_poll_ex(bContext *C, bool check_tool) +static bool weight_paint_poll_ex(bContext *C, bool check_tool) { Object *ob = CTX_data_active_object(C); ScrArea *sa; @@ -264,12 +264,12 @@ static int weight_paint_poll_ex(bContext *C, bool check_tool) return 0; } -int weight_paint_poll(bContext *C) +bool weight_paint_poll(bContext *C) { return weight_paint_poll_ex(C, true); } -int weight_paint_poll_ignore_tool(bContext *C) +bool weight_paint_poll_ignore_tool(bContext *C) { return weight_paint_poll_ex(C, false); } @@ -1282,7 +1282,7 @@ static int wpaint_mode_toggle_exec(bContext *C, wmOperator *op) } /* for switching to/from mode */ -static int paint_poll_test(bContext *C) +static bool paint_poll_test(bContext *C) { Object *ob = CTX_data_active_object(C); if (ob == NULL || ob->type != OB_MESH) diff --git a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c index 8516d92214d..4c8ca493cd1 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c @@ -49,7 +49,7 @@ #include "paint_intern.h" /* own include */ -static int vertex_weight_paint_mode_poll(bContext *C) +static bool vertex_weight_paint_mode_poll(bContext *C) { Object *ob = CTX_data_active_object(C); Mesh *me = BKE_mesh_from_object(ob); diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c index 126b3b42e8f..d19a1d3a189 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c @@ -117,7 +117,7 @@ static void wpaint_prev_destroy(struct WPaintPrev *wpp) /** \name Weight from Bones Operator * \{ */ -static int weight_from_bones_poll(bContext *C) +static bool weight_from_bones_poll(bContext *C) { Object *ob = CTX_data_active_object(C); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 88cb6f548e8..a5871c90d56 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -4082,25 +4082,25 @@ static void sculpt_update_tex(const Scene *scene, Sculpt *sd, SculptSession *ss) -int sculpt_mode_poll(bContext *C) +bool sculpt_mode_poll(bContext *C) { Object *ob = CTX_data_active_object(C); return ob && ob->mode & OB_MODE_SCULPT; } -int sculpt_mode_poll_view3d(bContext *C) +bool sculpt_mode_poll_view3d(bContext *C) { return (sculpt_mode_poll(C) && CTX_wm_region_view3d(C)); } -int sculpt_poll_view3d(bContext *C) +bool sculpt_poll_view3d(bContext *C) { return (sculpt_poll(C) && CTX_wm_region_view3d(C)); } -int sculpt_poll(bContext *C) +bool sculpt_poll(bContext *C) { return sculpt_mode_poll(C) && paint_poll(C); } @@ -5537,7 +5537,7 @@ static int sculpt_optimize_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -static int sculpt_and_dynamic_topology_poll(bContext *C) +static bool sculpt_and_dynamic_topology_poll(bContext *C) { Object *ob = CTX_data_active_object(C); @@ -5853,7 +5853,7 @@ static void SCULPT_OT_sculptmode_toggle(wmOperatorType *ot) } -static int sculpt_and_dynamic_topology_constant_detail_poll(bContext *C) +static bool sculpt_and_dynamic_topology_constant_detail_poll(bContext *C) { Object *ob = CTX_data_active_object(C); Sculpt *sd = CTX_data_tool_settings(C)->sculpt; diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h index ff6b5a6f374..2154061da1b 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.h +++ b/source/blender/editors/sculpt_paint/sculpt_intern.h @@ -48,11 +48,11 @@ struct Object; struct SculptUndoNode; struct SculptOrigVertData; -int sculpt_mode_poll(struct bContext *C); -int sculpt_mode_poll_view3d(struct bContext *C); +bool sculpt_mode_poll(struct bContext *C); +bool sculpt_mode_poll_view3d(struct bContext *C); /* checks for a brush, not just sculpt mode */ -int sculpt_poll(struct bContext *C); -int sculpt_poll_view3d(struct bContext *C); +bool sculpt_poll(struct bContext *C); +bool sculpt_poll_view3d(struct bContext *C); /* Stroke */ bool sculpt_stroke_get_location(struct bContext *C, float out[3], const float mouse[2]); diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index 1405de8cfa9..29b258fc80d 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -160,7 +160,7 @@ static Brush *uv_sculpt_brush(bContext *C) } -static int uv_sculpt_brush_poll_do(bContext *C, const bool check_region) +static bool uv_sculpt_brush_poll_do(bContext *C, const bool check_region) { BMEditMesh *em; int ret; @@ -188,7 +188,7 @@ static int uv_sculpt_brush_poll_do(bContext *C, const bool check_region) return ret; } -static int uv_sculpt_brush_poll(bContext *C) +static bool uv_sculpt_brush_poll(bContext *C) { return uv_sculpt_brush_poll_do(C, true); } @@ -247,8 +247,9 @@ void ED_space_image_uv_sculpt_update(Main *bmain, wmWindowManager *wm, Scene *sc BKE_paint_init(bmain, scene, ePaintSculptUV, PAINT_CURSOR_SCULPT); - settings->uvsculpt->paint.paint_cursor = WM_paint_cursor_activate(wm, uv_sculpt_brush_poll, - brush_drawcursor_uvsculpt, NULL); + settings->uvsculpt->paint.paint_cursor = WM_paint_cursor_activate( + wm, uv_sculpt_brush_poll, + brush_drawcursor_uvsculpt, NULL); } else { if (settings->uvsculpt) { @@ -258,12 +259,12 @@ void ED_space_image_uv_sculpt_update(Main *bmain, wmWindowManager *wm, Scene *sc } } -int uv_sculpt_poll(bContext *C) +bool uv_sculpt_poll(bContext *C) { return uv_sculpt_brush_poll_do(C, true); } -int uv_sculpt_keymap_poll(bContext *C) +bool uv_sculpt_keymap_poll(bContext *C) { return uv_sculpt_brush_poll_do(C, false); } diff --git a/source/blender/editors/sound/sound_ops.c b/source/blender/editors/sound/sound_ops.c index 049feea2d8a..3fc68a50057 100644 --- a/source/blender/editors/sound/sound_ops.c +++ b/source/blender/editors/sound/sound_ops.c @@ -703,7 +703,7 @@ static void SOUND_OT_mixdown(wmOperatorType *ot) /* ******************************************************* */ -static int sound_poll(bContext *C) +static bool sound_poll(bContext *C) { Editing *ed = CTX_data_scene(C)->ed; diff --git a/source/blender/editors/space_action/action_data.c b/source/blender/editors/space_action/action_data.c index 74c9f2f8cfb..8d4596a79a7 100644 --- a/source/blender/editors/space_action/action_data.c +++ b/source/blender/editors/space_action/action_data.c @@ -175,7 +175,7 @@ static void actedit_change_action(bContext *C, bAction *act) * The NLA Editor is active (i.e. Animation Data panel -> new action) * 2) The associated AnimData block must not be in tweakmode */ -static int action_new_poll(bContext *C) +static bool action_new_poll(bContext *C) { Scene *scene = CTX_data_scene(C); @@ -295,7 +295,7 @@ void ACTION_OT_new(wmOperatorType *ot) * 2) There must be an action active * 3) The associated AnimData block must not be in tweakmode */ -static int action_pushdown_poll(bContext *C) +static bool action_pushdown_poll(bContext *C) { if (ED_operator_action_active(C)) { SpaceAction *saction = (SpaceAction *)CTX_wm_space_data(C); @@ -426,7 +426,7 @@ void ACTION_OT_stash(wmOperatorType *ot) * 1) There must be an dopesheet/action editor, and it must be in a mode which uses actions * 2) The associated AnimData block must not be in tweakmode */ -static int action_stash_create_poll(bContext *C) +static bool action_stash_create_poll(bContext *C) { if (ED_operator_action_active(C)) { AnimData *adt = ED_actedit_animdata_from_context(C); @@ -618,7 +618,7 @@ void ED_animedit_unlink_action(bContext *C, ID *id, AnimData *adt, bAction *act, /* -------------------------- */ -static int action_unlink_poll(bContext *C) +static bool action_unlink_poll(bContext *C) { if (ED_operator_action_active(C)) { SpaceAction *saction = (SpaceAction *)CTX_wm_space_data(C); @@ -749,7 +749,7 @@ static void action_layer_switch_strip(AnimData *adt, /* ********************** One Layer Up Operator ************************** */ -static int action_layer_next_poll(bContext *C) +static bool action_layer_next_poll(bContext *C) { /* Action Editor's action editing modes only */ if (ED_operator_action_active(C)) { @@ -860,7 +860,7 @@ void ACTION_OT_layer_next(wmOperatorType *ot) /* ********************* One Layer Down Operator ************************* */ -static int action_layer_prev_poll(bContext *C) +static bool action_layer_prev_poll(bContext *C) { /* Action Editor's action editing modes only */ if (ED_operator_action_active(C)) { diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index a9f9488d049..1d8766ba773 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -93,7 +93,7 @@ * 3) that the set of markers being shown are the scene markers, not the list we're merging * 4) that there are some selected markers */ -static int act_markers_make_local_poll(bContext *C) +static bool act_markers_make_local_poll(bContext *C) { SpaceAction *sact = CTX_wm_space_action(C); @@ -1491,7 +1491,7 @@ void ACTION_OT_keyframe_type(wmOperatorType *ot) /* ***************** Jump to Selected Frames Operator *********************** */ -static int actkeys_framejump_poll(bContext *C) +static bool actkeys_framejump_poll(bContext *C) { /* prevent changes during render */ if (G.is_rendering) diff --git a/source/blender/editors/space_action/action_ops.c b/source/blender/editors/space_action/action_ops.c index d32ab8f1db8..bf7f75db95c 100644 --- a/source/blender/editors/space_action/action_ops.c +++ b/source/blender/editors/space_action/action_ops.c @@ -222,9 +222,7 @@ static void action_keymap_keyframes(wmKeyConfig *keyconf, wmKeyMap *keymap) /* destructive */ WM_keymap_add_item(keymap, "ACTION_OT_sample", OKEY, KM_PRESS, KM_SHIFT, 0); -#ifdef USE_WM_KEYMAP_27X WM_keymap_add_menu(keymap, "DOPESHEET_MT_delete", XKEY, KM_PRESS, 0, 0); -#endif WM_keymap_add_menu(keymap, "DOPESHEET_MT_delete", DELKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "ACTION_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0); diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c index f2fe06874d7..db5f6c2451c 100644 --- a/source/blender/editors/space_clip/clip_buttons.c +++ b/source/blender/editors/space_clip/clip_buttons.c @@ -77,7 +77,7 @@ void ED_clip_buttons_register(ARegionType *UNUSED(art)) /********************* MovieClip Template ************************/ -void uiTemplateMovieClip(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, int compact) +void uiTemplateMovieClip(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, bool compact) { PropertyRNA *prop; PointerRNA clipptr; @@ -333,7 +333,7 @@ static void marker_block_handler(bContext *C, void *arg_cb, int event) } void uiTemplateMarker(uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *userptr, - PointerRNA *trackptr, int compact) + PointerRNA *trackptr, bool compact) { PropertyRNA *prop; uiBlock *block; diff --git a/source/blender/editors/space_clip/clip_dopesheet_ops.c b/source/blender/editors/space_clip/clip_dopesheet_ops.c index c8675fc390b..a12e8db6daf 100644 --- a/source/blender/editors/space_clip/clip_dopesheet_ops.c +++ b/source/blender/editors/space_clip/clip_dopesheet_ops.c @@ -53,7 +53,7 @@ #include "clip_intern.h" // own include -static int space_clip_dopesheet_poll(bContext *C) +static bool space_clip_dopesheet_poll(bContext *C) { if (ED_space_clip_tracking_poll(C)) { SpaceClip *sc = CTX_wm_space_clip(C); @@ -70,7 +70,7 @@ static int space_clip_dopesheet_poll(bContext *C) /********************** select channel operator *********************/ -static int dopesheet_select_channel_poll(bContext *C) +static bool dopesheet_select_channel_poll(bContext *C) { SpaceClip *sc = CTX_wm_space_clip(C); diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index d91e039ecb6..c0d17fabe0d 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -368,7 +368,7 @@ static void draw_stabilization_border(SpaceClip *sc, ARegion *ar, int width, int GPU_viewport_size_getf(viewport_size); immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC); - immUniform1i("num_colors", 0); /* "simple" mode */ + immUniform1i("colors_len", 0); /* "simple" mode */ immUniformColor4f(1.0f, 1.0f, 1.0f, 0.0f); immUniform1f("dash_width", 6.0f); immUniform1f("dash_factor", 0.5f); @@ -672,7 +672,7 @@ static void draw_marker_areas(SpaceClip *sc, MovieTrackingTrack *track, MovieTra GPU_viewport_size_getf(viewport_size); immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC); - immUniform1i("num_colors", 0); /* "simple" mode */ + immUniform1i("colors_len", 0); /* "simple" mode */ /* marker position and offset position */ if ((track->flag & SELECT) == sel && (marker->flag & MARKER_DISABLED) == 0) { @@ -1214,7 +1214,7 @@ static void draw_plane_marker_ex(SpaceClip *sc, Scene *scene, MovieTrackingPlane GPU_viewport_size_getf(viewport_size); immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC); - immUniform1i("num_colors", 0); /* "simple" mode */ + immUniform1i("colors_len", 0); /* "simple" mode */ if (draw_plane_quad) { const bool stipple = !draw_outline && tiny; diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c index 67aa7e19de7..0fb7d63180f 100644 --- a/source/blender/editors/space_clip/clip_editor.c +++ b/source/blender/editors/space_clip/clip_editor.c @@ -76,7 +76,7 @@ /* ******** operactor poll functions ******** */ -int ED_space_clip_poll(bContext *C) +bool ED_space_clip_poll(bContext *C) { SpaceClip *sc = CTX_wm_space_clip(C); @@ -86,7 +86,7 @@ int ED_space_clip_poll(bContext *C) return false; } -int ED_space_clip_view_clip_poll(bContext *C) +bool ED_space_clip_view_clip_poll(bContext *C) { SpaceClip *sc = CTX_wm_space_clip(C); @@ -97,7 +97,7 @@ int ED_space_clip_view_clip_poll(bContext *C) return false; } -int ED_space_clip_tracking_poll(bContext *C) +bool ED_space_clip_tracking_poll(bContext *C) { SpaceClip *sc = CTX_wm_space_clip(C); @@ -107,7 +107,7 @@ int ED_space_clip_tracking_poll(bContext *C) return false; } -int ED_space_clip_maskedit_poll(bContext *C) +bool ED_space_clip_maskedit_poll(bContext *C) { SpaceClip *sc = CTX_wm_space_clip(C); @@ -118,7 +118,7 @@ int ED_space_clip_maskedit_poll(bContext *C) return false; } -int ED_space_clip_maskedit_mask_poll(bContext *C) +bool ED_space_clip_maskedit_mask_poll(bContext *C) { if (ED_space_clip_maskedit_poll(C)) { MovieClip *clip = CTX_data_edit_movieclip(C); diff --git a/source/blender/editors/space_clip/clip_graph_ops.c b/source/blender/editors/space_clip/clip_graph_ops.c index 02ea340eb57..b5a0e374431 100644 --- a/source/blender/editors/space_clip/clip_graph_ops.c +++ b/source/blender/editors/space_clip/clip_graph_ops.c @@ -55,7 +55,7 @@ /******************** common graph-editing utilities ********************/ -static int ED_space_clip_graph_poll(bContext *C) +static bool ED_space_clip_graph_poll(bContext *C) { if (ED_space_clip_tracking_poll(C)) { SpaceClip *sc = CTX_wm_space_clip(C); @@ -66,7 +66,7 @@ static int ED_space_clip_graph_poll(bContext *C) return false; } -static int clip_graph_knots_poll(bContext *C) +static bool clip_graph_knots_poll(bContext *C) { if (ED_space_clip_graph_poll(C)) { SpaceClip *sc = CTX_wm_space_clip(C); diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index c026ce8d063..26327dc9b41 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -899,7 +899,7 @@ void CLIP_OT_view_selected(wmOperatorType *ot) /********************** change frame operator *********************/ -static int change_frame_poll(bContext *C) +static bool change_frame_poll(bContext *C) { /* prevent changes during render */ if (G.is_rendering) diff --git a/source/blender/editors/space_clip/clip_toolbar.c b/source/blender/editors/space_clip/clip_toolbar.c index 3e4d0cd5bb4..304954b56e3 100644 --- a/source/blender/editors/space_clip/clip_toolbar.c +++ b/source/blender/editors/space_clip/clip_toolbar.c @@ -87,7 +87,7 @@ ARegion *ED_clip_has_properties_region(ScrArea *sa) return arnew; } -static int properties_poll(bContext *C) +static bool properties_poll(bContext *C) { return (CTX_wm_space_clip(C) != NULL); } @@ -151,7 +151,7 @@ static ARegion *clip_has_tools_region(ScrArea *sa) return artool; } -static int tools_poll(bContext *C) +static bool tools_poll(bContext *C) { return (CTX_wm_space_clip(C) != NULL); } diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index e9acd7320d0..c66a9a42292 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -661,10 +661,8 @@ static void clip_keymap(struct wmKeyConfig *keyconf) /* marker */ WM_keymap_add_item(keymap, "CLIP_OT_add_marker_slide", LEFTMOUSE, KM_PRESS, KM_CTRL, 0); - WM_keymap_add_item(keymap, "CLIP_OT_delete_marker", DELKEY, KM_PRESS, KM_SHIFT, 0); -#ifdef USE_WM_KEYMAP_27X WM_keymap_add_item(keymap, "CLIP_OT_delete_marker", XKEY, KM_PRESS, KM_SHIFT, 0); -#endif + WM_keymap_add_item(keymap, "CLIP_OT_delete_marker", DELKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "CLIP_OT_slide_marker", LEFTMOUSE, KM_PRESS, 0, 0); @@ -672,10 +670,8 @@ static void clip_keymap(struct wmKeyConfig *keyconf) RNA_enum_set(kmi->ptr, "action", 2); /* toggle */ /* tracks */ - WM_keymap_add_item(keymap, "CLIP_OT_delete_track", DELKEY, KM_PRESS, 0, 0); -#ifdef USE_WM_KEYMAP_27X WM_keymap_add_item(keymap, "CLIP_OT_delete_track", XKEY, KM_PRESS, 0, 0); -#endif + WM_keymap_add_item(keymap, "CLIP_OT_delete_track", DELKEY, KM_PRESS, 0, 0); kmi = WM_keymap_add_item(keymap, "CLIP_OT_lock_tracks", LKEY, KM_PRESS, KM_CTRL, 0); RNA_enum_set(kmi->ptr, "action", 0); /* lock */ @@ -774,15 +770,11 @@ static void clip_keymap(struct wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "CLIP_OT_graph_select_border", BKEY, KM_PRESS, 0, 0); /* delete */ - WM_keymap_add_item(keymap, "CLIP_OT_graph_delete_curve", DELKEY, KM_PRESS, 0, 0); -#ifdef USE_WM_KEYMAP_27X WM_keymap_add_item(keymap, "CLIP_OT_graph_delete_curve", XKEY, KM_PRESS, 0, 0); -#endif + WM_keymap_add_item(keymap, "CLIP_OT_graph_delete_curve", DELKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "CLIP_OT_graph_delete_knot", DELKEY, KM_PRESS, KM_SHIFT, 0); -#ifdef USE_WM_KEYMAP_27X WM_keymap_add_item(keymap, "CLIP_OT_graph_delete_knot", XKEY, KM_PRESS, KM_SHIFT, 0); -#endif + WM_keymap_add_item(keymap, "CLIP_OT_graph_delete_knot", DELKEY, KM_PRESS, KM_SHIFT, 0); /* view */ WM_keymap_add_item(keymap, "CLIP_OT_graph_view_all", HOMEKEY, KM_PRESS, 0, 0); @@ -851,7 +843,7 @@ static int clip_context(const bContext *C, const char *member, bContextDataResul } /* dropboxes */ -static int clip_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) +static bool clip_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) { if (drag->type == WM_DRAG_PATH) if (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE, ICON_FILE_BLANK)) /* rule might not work? */ diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c index 1572b9b8f78..42077280cca 100644 --- a/source/blender/editors/space_clip/tracking_ops.c +++ b/source/blender/editors/space_clip/tracking_ops.c @@ -2107,7 +2107,7 @@ void CLIP_OT_copy_tracks(wmOperatorType *ot) /********************* paste tracks from clipboard operator ********************/ -static int paste_tracks_poll(bContext *C) +static bool paste_tracks_poll(bContext *C) { if (ED_space_clip_tracking_poll(C)) { return BKE_tracking_clipboard_has_tracks(); diff --git a/source/blender/editors/space_clip/tracking_ops_orient.c b/source/blender/editors/space_clip/tracking_ops_orient.c index 3db52e6a39b..4d1c3e0b137 100644 --- a/source/blender/editors/space_clip/tracking_ops_orient.c +++ b/source/blender/editors/space_clip/tracking_ops_orient.c @@ -108,7 +108,7 @@ static Object *get_orientation_object(bContext *C) return object; } -static int set_orientation_poll(bContext *C) +static bool set_orientation_poll(bContext *C) { SpaceClip *sc = CTX_wm_space_clip(C); if (sc != NULL) { @@ -754,7 +754,7 @@ void CLIP_OT_set_scale(wmOperatorType *ot) /********************** set solution scale operator *********************/ -static int set_solution_scale_poll(bContext *C) +static bool set_solution_scale_poll(bContext *C) { SpaceClip *sc = CTX_wm_space_clip(C); if (sc != NULL) { @@ -814,7 +814,7 @@ void CLIP_OT_set_solution_scale(wmOperatorType *ot) /********************** apply solution scale operator *********************/ -static int apply_solution_scale_poll(bContext *C) +static bool apply_solution_scale_poll(bContext *C) { SpaceClip *sc = CTX_wm_space_clip(C); if (sc != NULL) { diff --git a/source/blender/editors/space_clip/tracking_ops_stabilize.c b/source/blender/editors/space_clip/tracking_ops_stabilize.c index cb9b40f8a10..2888607a049 100644 --- a/source/blender/editors/space_clip/tracking_ops_stabilize.c +++ b/source/blender/editors/space_clip/tracking_ops_stabilize.c @@ -50,7 +50,7 @@ /********************* add 2d stabilization tracks operator ********************/ -static int stabilize_2d_poll(bContext *C) +static bool stabilize_2d_poll(bContext *C) { if (ED_space_clip_tracking_poll(C)) { SpaceClip *sc = CTX_wm_space_clip(C); diff --git a/source/blender/editors/space_clip/tracking_select.c b/source/blender/editors/space_clip/tracking_select.c index ecbc1f5ae1e..cf4687dca31 100644 --- a/source/blender/editors/space_clip/tracking_select.c +++ b/source/blender/editors/space_clip/tracking_select.c @@ -350,7 +350,7 @@ static int mouse_select(bContext *C, float co[2], int extend) return OPERATOR_FINISHED; } -static int select_poll(bContext *C) +static bool select_poll(bContext *C) { SpaceClip *sc = CTX_wm_space_clip(C); diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index 74bc7e95643..4b577a7cb7e 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -170,7 +170,7 @@ static void console_cursor(wmWindow *win, ScrArea *sa, ARegion *ar) /* ************* dropboxes ************* */ -static int id_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) +static bool id_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) { // SpaceConsole *sc = CTX_wm_space_console(C); if (drag->type == WM_DRAG_ID) @@ -189,7 +189,7 @@ static void id_drop_copy(wmDrag *drag, wmDropBox *drop) MEM_freeN(text); } -static int path_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) +static bool path_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) { // SpaceConsole *sc = CTX_wm_space_console(C); if (drag->type == WM_DRAG_PATH) diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index ad77463300d..7c080044aee 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -1179,9 +1179,9 @@ int file_cancel_exec(bContext *C, wmOperator *UNUSED(unused)) return OPERATOR_FINISHED; } -static int file_operator_poll(bContext *C) +static bool file_operator_poll(bContext *C) { - int poll = ED_operator_file_active(C); + bool poll = ED_operator_file_active(C); SpaceFile *sfile = CTX_wm_space_file(C); if (!sfile || !sfile->op) poll = 0; @@ -2202,7 +2202,7 @@ static int file_rename_exec(bContext *C, wmOperator *UNUSED(op)) } -static int file_rename_poll(bContext *C) +static bool file_rename_poll(bContext *C) { bool poll = ED_operator_file_active(C); SpaceFile *sfile = CTX_wm_space_file(C); @@ -2248,9 +2248,9 @@ void FILE_OT_rename(struct wmOperatorType *ot) } -static int file_delete_poll(bContext *C) +static bool file_delete_poll(bContext *C) { - int poll = ED_operator_file_active(C); + bool poll = ED_operator_file_active(C); SpaceFile *sfile = CTX_wm_space_file(C); if (sfile && sfile->params) { diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c index 11b891d1c1e..812a671ff33 100644 --- a/source/blender/editors/space_file/file_panels.c +++ b/source/blender/editors/space_file/file_panels.c @@ -57,7 +57,7 @@ #include <string.h> -static int file_panel_operator_poll(const bContext *C, PanelType *UNUSED(pt)) +static bool file_panel_operator_poll(const bContext *C, PanelType *UNUSED(pt)) { SpaceFile *sfile = CTX_wm_space_file(C); return (sfile && sfile->op); diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 858bbb06688..853d31edebf 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -506,9 +506,8 @@ static void file_keymap(struct wmKeyConfig *keyconf) kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", HKEY, KM_PRESS, 0, 0); RNA_string_set(kmi->ptr, "data_path", "space_data.params.show_hidden"); WM_keymap_add_item(keymap, "FILE_OT_directory_new", IKEY, KM_PRESS, 0, 0); -#ifdef USE_WM_KEYMAP_27X + WM_keymap_add_item(keymap, "FILE_OT_delete", XKEY, KM_PRESS, 0, 0); -#endif WM_keymap_add_item(keymap, "FILE_OT_delete", DELKEY, KM_PRESS, 0, 0); WM_keymap_verify_item(keymap, "FILE_OT_smoothscroll", TIMER1, KM_ANY, KM_ANY, 0); @@ -722,7 +721,7 @@ static void file_ui_region_listener( } } -static int filepath_drop_poll(bContext *C, wmDrag *drag, const wmEvent *UNUSED(event)) +static bool filepath_drop_poll(bContext *C, wmDrag *drag, const wmEvent *UNUSED(event)) { if (drag->type == WM_DRAG_PATH) { SpaceFile *sfile = CTX_wm_space_file(C); diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index 2a0d5baa5c3..4162e6dec92 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -103,7 +103,7 @@ static int graph_panel_context(const bContext *C, bAnimListElem **ale, FCurve ** return 1; } -static int graph_panel_poll(const bContext *C, PanelType *UNUSED(pt)) +static bool graph_panel_poll(const bContext *C, PanelType *UNUSED(pt)) { return graph_panel_context(C, NULL, NULL); } @@ -564,7 +564,7 @@ static void driver_update_flags_cb(bContext *UNUSED(C), void *fcu_v, void *UNUSE } /* drivers panel poll */ -static int graph_panel_drivers_poll(const bContext *C, PanelType *UNUSED(pt)) +static bool graph_panel_drivers_poll(const bContext *C, PanelType *UNUSED(pt)) { SpaceIpo *sipo = CTX_wm_space_graph(C); @@ -1016,7 +1016,7 @@ static void graph_panel_drivers(const bContext *C, Panel *pa) /* ----------------------------------------------------------------- */ /* poll to make this not show up in the graph editor, as this is only to be used as a popup elsewhere */ -static int graph_panel_drivers_popover_poll(const bContext *C, PanelType *UNUSED(pt)) +static bool graph_panel_drivers_popover_poll(const bContext *C, PanelType *UNUSED(pt)) { return ED_operator_graphedit_active((bContext *)C) == false; } diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 87fe4a62343..16817b89d11 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -96,7 +96,7 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d) GPU_viewport_size_getf(viewport_size); immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC); - immUniform1i("num_colors", 0); /* Simple dashes. */ + immUniform1i("colors_len", 0); /* Simple dashes. */ immUniformColor3f(0.0f, 0.0f, 0.0f); immUniform1f("dash_width", 10.0f); immUniform1f("dash_factor", 0.5f); @@ -850,7 +850,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu) GPU_viewport_size_getf(viewport_size); immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC); - immUniform1i("num_colors", 0); /* Simple dashes. */ + immUniform1i("colors_len", 0); /* Simple dashes. */ /* No curve to modify/visualize the result? * => We still want to show the 1-1 default... @@ -971,7 +971,7 @@ void graph_draw_ghost_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar) GPU_viewport_size_getf(viewport_size); immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC); - immUniform1i("num_colors", 0); /* Simple dashes. */ + immUniform1i("colors_len", 0); /* Simple dashes. */ immUniform1f("dash_width", 20.0f); immUniform1f("dash_factor", 0.5f); @@ -1057,7 +1057,7 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid GPU_viewport_size_getf(viewport_size); immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC); - immUniform1i("num_colors", 0); /* Simple dashes. */ + immUniform1i("colors_len", 0); /* Simple dashes. */ if (BKE_fcurve_is_protected(fcu)) { /* protected curves (non editable) are drawn with dotted lines */ diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 26a6e93ba57..b10141929d5 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -1973,7 +1973,7 @@ void GRAPH_OT_euler_filter(wmOperatorType *ot) /* ***************** Jump to Selected Frames Operator *********************** */ -static int graphkeys_framejump_poll(bContext *C) +static bool graphkeys_framejump_poll(bContext *C) { /* prevent changes during render */ if (G.is_rendering) @@ -2808,7 +2808,7 @@ static int graph_driver_delete_invalid_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int graph_driver_delete_invalid_poll(bContext *C) +static bool graph_driver_delete_invalid_poll(bContext *C) { bAnimContext ac; ScrArea *sa = CTX_wm_area(C); diff --git a/source/blender/editors/space_graph/graph_intern.h b/source/blender/editors/space_graph/graph_intern.h index da352d4ea06..c50e0497519 100644 --- a/source/blender/editors/space_graph/graph_intern.h +++ b/source/blender/editors/space_graph/graph_intern.h @@ -170,10 +170,10 @@ void graph_buttons_register(struct ARegionType *art); struct bAnimListElem *get_active_fcurve_channel(struct bAnimContext *ac); -int graphop_visible_keyframes_poll(struct bContext *C); -int graphop_editable_keyframes_poll(struct bContext *C); -int graphop_active_fcurve_poll(struct bContext *C); -int graphop_selected_fcurve_poll(struct bContext *C); +bool graphop_visible_keyframes_poll(struct bContext *C); +bool graphop_editable_keyframes_poll(struct bContext *C); +bool graphop_active_fcurve_poll(struct bContext *C); +bool graphop_selected_fcurve_poll(struct bContext *C); /* ***************************************** */ /* graph_ops.c */ diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c index 50e09b60b70..8ac2c61b8e9 100644 --- a/source/blender/editors/space_graph/graph_ops.c +++ b/source/blender/editors/space_graph/graph_ops.c @@ -67,7 +67,7 @@ * 2) Value Indicator (stored per Graph Editor instance) */ -static int graphview_cursor_poll(bContext *C) +static bool graphview_cursor_poll(bContext *C) { /* prevent changes during render */ if (G.is_rendering) @@ -611,9 +611,7 @@ static void graphedit_keymap_keyframes(wmKeyConfig *keyconf, wmKeyMap *keymap) WM_keymap_add_item(keymap, "GRAPH_OT_bake", CKEY, KM_PRESS, KM_ALT, 0); -#ifdef USE_WM_KEYMAP_27X WM_keymap_add_menu(keymap, "GRAPH_MT_delete", XKEY, KM_PRESS, 0, 0); -#endif WM_keymap_add_menu(keymap, "GRAPH_MT_delete", DELKEY, KM_PRESS, 0, 0); WM_keymap_add_menu(keymap, "GRAPH_MT_specials", WKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/space_graph/graph_utils.c b/source/blender/editors/space_graph/graph_utils.c index e543111e662..4adb95677b0 100644 --- a/source/blender/editors/space_graph/graph_utils.c +++ b/source/blender/editors/space_graph/graph_utils.c @@ -135,7 +135,7 @@ bAnimListElem *get_active_fcurve_channel(bAnimContext *ac) /* Operator Polling Callbacks */ /* Check if there are any visible keyframes (for selection tools) */ -int graphop_visible_keyframes_poll(bContext *C) +bool graphop_visible_keyframes_poll(bContext *C) { bAnimContext ac; bAnimListElem *ale; @@ -184,7 +184,7 @@ int graphop_visible_keyframes_poll(bContext *C) } /* Check if there are any visible + editable keyframes (for editing tools) */ -int graphop_editable_keyframes_poll(bContext *C) +bool graphop_editable_keyframes_poll(bContext *C) { bAnimContext ac; bAnimListElem *ale; @@ -234,7 +234,7 @@ int graphop_editable_keyframes_poll(bContext *C) } /* has active F-Curve that's editable */ -int graphop_active_fcurve_poll(bContext *C) +bool graphop_active_fcurve_poll(bContext *C) { bAnimContext ac; bAnimListElem *ale; @@ -274,7 +274,7 @@ int graphop_active_fcurve_poll(bContext *C) } /* has selected F-Curve that's editable */ -int graphop_selected_fcurve_poll(bContext *C) +bool graphop_selected_fcurve_poll(bContext *C) { bAnimContext ac; ListBase anim_data = {NULL, NULL}; diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 0cd61f3e330..191f57961c9 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -827,7 +827,7 @@ static void rna_update_cb(bContext *C, void *arg_cb, void *UNUSED(arg)) RNA_property_update(C, &cb->ptr, cb->prop); } -void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, PointerRNA *userptr, int compact, int multiview) +void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char *propname, PointerRNA *userptr, bool compact, bool multiview) { PropertyRNA *prop; PointerRNA imaptr; @@ -1063,7 +1063,7 @@ void uiTemplateImage(uiLayout *layout, bContext *C, PointerRNA *ptr, const char MEM_freeN(cb); } -void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr, int color_management) +void uiTemplateImageSettings(uiLayout *layout, PointerRNA *imfptr, bool color_management) { ImageFormatData *imf = imfptr->data; ID *id = imfptr->id.data; diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 11e06c168b4..ecd608b707a 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -582,7 +582,7 @@ void draw_image_sample_line(SpaceImage *sima) GPU_viewport_size_getf(viewport_size); immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC); - immUniform1i("num_colors", 2); /* Advanced dashes. */ + immUniform1i("colors_len", 2); /* Advanced dashes. */ immUniformArray4fv("colors", (float *)(float[][4]){{1.0f, 1.0f, 1.0f, 1.0f}, {0.0f, 0.0f, 0.0f, 1.0f}}, 2); immUniform1f("dash_width", 2.0f); diff --git a/source/blender/editors/space_image/image_edit.c b/source/blender/editors/space_image/image_edit.c index 8bbca25538a..4388accc534 100644 --- a/source/blender/editors/space_image/image_edit.c +++ b/source/blender/editors/space_image/image_edit.c @@ -388,7 +388,7 @@ bool ED_space_image_check_show_maskedit(SpaceImage *sima, ViewLayer *view_layer) return (sima->mode == SI_MODE_MASK); } -int ED_space_image_maskedit_poll(bContext *C) +bool ED_space_image_maskedit_poll(bContext *C) { SpaceImage *sima = CTX_wm_space_image(C); @@ -415,7 +415,7 @@ bool ED_space_image_paint_curve(const bContext *C) } -int ED_space_image_maskedit_mask_poll(bContext *C) +bool ED_space_image_maskedit_mask_poll(bContext *C) { if (ED_space_image_maskedit_poll(C)) { SpaceImage *sima = CTX_wm_space_image(C); diff --git a/source/blender/editors/space_image/image_intern.h b/source/blender/editors/space_image/image_intern.h index 3725f1d5195..5d9c496d584 100644 --- a/source/blender/editors/space_image/image_intern.h +++ b/source/blender/editors/space_image/image_intern.h @@ -54,7 +54,7 @@ void draw_image_grease_pencil(struct bContext *C, bool onlyv2d); void draw_image_sample_line(struct SpaceImage *sima); /* image_ops.c */ -int space_image_main_region_poll(struct bContext *C); +bool space_image_main_region_poll(struct bContext *C); void IMAGE_OT_view_all(struct wmOperatorType *ot); void IMAGE_OT_view_pan(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 40311594512..3efdce3ea6d 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -179,13 +179,13 @@ static void sima_zoom_set_from_bounds(SpaceImage *sima, ARegion *ar, const rctf } #if 0 // currently unused -static int image_poll(bContext *C) +static bool image_poll(bContext *C) { return (CTX_data_edit_image(C) != NULL); } #endif -static int space_image_buffer_exists_poll(bContext *C) +static bool space_image_buffer_exists_poll(bContext *C) { SpaceImage *sima = CTX_wm_space_image(C); if (sima && ED_space_image_has_buffer(sima)) { @@ -194,7 +194,7 @@ static int space_image_buffer_exists_poll(bContext *C) return false; } -static int image_not_packed_poll(bContext *C) +static bool image_not_packed_poll(bContext *C) { SpaceImage *sima = CTX_wm_space_image(C); @@ -213,7 +213,7 @@ static bool imbuf_format_writeable(const ImBuf *ibuf) return (BKE_image_imtype_to_ftype(im_format.imtype, &options_dummy) == ibuf->ftype); } -static int space_image_file_exists_poll(bContext *C) +static bool space_image_file_exists_poll(bContext *C) { if (space_image_buffer_exists_poll(C)) { Main *bmain = CTX_data_main(C); @@ -249,7 +249,7 @@ static int space_image_file_exists_poll(bContext *C) } #if 0 /* UNUSED */ -static int space_image_poll(bContext *C) +static bool space_image_poll(bContext *C) { SpaceImage *sima = CTX_wm_space_image(C); if (sima && sima->image) { @@ -259,7 +259,7 @@ static int space_image_poll(bContext *C) } #endif -int space_image_main_region_poll(bContext *C) +bool space_image_main_region_poll(bContext *C) { SpaceImage *sima = CTX_wm_space_image(C); /* XXX ARegion *ar = CTX_wm_region(C); */ @@ -271,7 +271,7 @@ int space_image_main_region_poll(bContext *C) } /* For IMAGE_OT_curves_point_set to avoid sampling when in uv smooth mode or editmode */ -static int space_image_main_area_not_uv_brush_poll(bContext *C) +static bool space_image_main_area_not_uv_brush_poll(bContext *C) { SpaceImage *sima = CTX_wm_space_image(C); Scene *scene = CTX_data_scene(C); @@ -284,7 +284,7 @@ static int space_image_main_area_not_uv_brush_poll(bContext *C) return 0; } -static int image_sample_poll(bContext *C) +static bool image_sample_poll(bContext *C) { SpaceImage *sima = CTX_wm_space_image(C); if (sima) { @@ -833,7 +833,7 @@ static int image_view_selected_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -static int image_view_selected_poll(bContext *C) +static bool image_view_selected_poll(bContext *C) { return (space_image_main_region_poll(C) && (ED_operator_uvedit(C) || ED_operator_mask(C))); } @@ -2157,7 +2157,7 @@ static void image_save_as_draw(bContext *UNUSED(C), wmOperator *op) uiTemplateImageFormatViews(layout, &imf_ptr, op->ptr); } -static int image_save_as_poll(bContext *C) +static bool image_save_as_poll(bContext *C) { if (space_image_buffer_exists_poll(C)) { if (G.is_rendering) { @@ -2600,7 +2600,7 @@ void IMAGE_OT_new(wmOperatorType *ot) /********************* invert operators *********************/ -static int image_invert_poll(bContext *C) +static bool image_invert_poll(bContext *C) { Image *ima = CTX_data_edit_image(C); @@ -3444,7 +3444,7 @@ void IMAGE_OT_record_composite(wmOperatorType *ot) /********************* cycle render slot operator *********************/ -static int image_cycle_render_slot_poll(bContext *C) +static bool image_cycle_render_slot_poll(bContext *C) { Image *ima = CTX_data_edit_image(C); @@ -3580,7 +3580,7 @@ void IMAGE_OT_remove_render_slot(wmOperatorType *ot) /********************** change frame operator *********************/ -static int change_frame_poll(bContext *C) +static bool change_frame_poll(bContext *C) { /* prevent changes during render */ if (G.is_rendering) diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 792dc25981e..907b7e51c42 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -387,7 +387,7 @@ static void image_keymap(struct wmKeyConfig *keyconf) } /* dropboxes */ -static int image_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) +static bool image_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) { if (drag->type == WM_DRAG_PATH) if (ELEM(drag->icon, 0, ICON_FILE_IMAGE, ICON_FILE_MOVIE, ICON_FILE_BLANK)) /* rule might not work? */ diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c index c9a94878512..5f9de037409 100644 --- a/source/blender/editors/space_info/space_info.c +++ b/source/blender/editors/space_info/space_info.c @@ -221,10 +221,10 @@ static void info_keymap(struct wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "INFO_OT_select_border", BKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "INFO_OT_report_replay", RKEY, KM_PRESS, 0, 0); -#ifdef USE_WM_KEYMAP_27X + WM_keymap_add_item(keymap, "INFO_OT_report_delete", XKEY, KM_PRESS, 0, 0); -#endif WM_keymap_add_item(keymap, "INFO_OT_report_delete", DELKEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "INFO_OT_report_copy", CKEY, KM_PRESS, KM_CTRL, 0); #ifdef __APPLE__ WM_keymap_add_item(keymap, "INFO_OT_report_copy", CKEY, KM_PRESS, KM_OSKEY, 0); diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c index cafb40626ee..57464cbf092 100644 --- a/source/blender/editors/space_nla/nla_buttons.c +++ b/source/blender/editors/space_nla/nla_buttons.c @@ -184,31 +184,31 @@ bool nla_panel_context(const bContext *C, PointerRNA *adt_ptr, PointerRNA *nlt_p } #if 0 -static int nla_panel_poll(const bContext *C, PanelType *pt) +static bool nla_panel_poll(const bContext *C, PanelType *pt) { return nla_panel_context(C, NULL, NULL); } #endif -static int nla_animdata_panel_poll(const bContext *C, PanelType *UNUSED(pt)) +static bool nla_animdata_panel_poll(const bContext *C, PanelType *UNUSED(pt)) { PointerRNA ptr; return (nla_panel_context(C, &ptr, NULL, NULL) && (ptr.data != NULL)); } -static int nla_track_panel_poll(const bContext *C, PanelType *UNUSED(pt)) +static bool nla_track_panel_poll(const bContext *C, PanelType *UNUSED(pt)) { PointerRNA ptr; return (nla_panel_context(C, NULL, &ptr, NULL) && (ptr.data != NULL)); } -static int nla_strip_panel_poll(const bContext *C, PanelType *UNUSED(pt)) +static bool nla_strip_panel_poll(const bContext *C, PanelType *UNUSED(pt)) { PointerRNA ptr; return (nla_panel_context(C, NULL, NULL, &ptr) && (ptr.data != NULL)); } -static int nla_strip_actclip_panel_poll(const bContext *C, PanelType *UNUSED(pt)) +static bool nla_strip_actclip_panel_poll(const bContext *C, PanelType *UNUSED(pt)) { PointerRNA ptr; NlaStrip *strip; @@ -222,7 +222,7 @@ static int nla_strip_actclip_panel_poll(const bContext *C, PanelType *UNUSED(pt) return (strip->type == NLASTRIP_TYPE_CLIP); } -static int nla_strip_eval_panel_poll(const bContext *C, PanelType *UNUSED(pt)) +static bool nla_strip_eval_panel_poll(const bContext *C, PanelType *UNUSED(pt)) { PointerRNA ptr; NlaStrip *strip; diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index d3725704636..3368ad4fe8d 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -507,7 +507,7 @@ void NLA_OT_action_pushdown(wmOperatorType *ot) /* ******************** Action Unlink ******************************** */ -static int nla_action_unlink_poll(bContext *C) +static bool nla_action_unlink_poll(bContext *C) { if (ED_operator_nla_active(C)) { return nla_panel_context(C, NULL, NULL, NULL); diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index 16fb3576ae8..27ed7a08aa8 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -185,7 +185,7 @@ static void nla_actionclip_draw_markers(NlaStrip *strip, float yminc, float ymax GPU_viewport_size_getf(viewport_size); immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC); - immUniform1i("num_colors", 0); /* "simple" mode */ + immUniform1i("colors_len", 0); /* "simple" mode */ immUniform1f("dash_width", 6.0f); immUniform1f("dash_factor", 0.5f); } @@ -373,7 +373,7 @@ static uint nla_draw_use_dashed_outlines(float color[4], bool muted) GPU_viewport_size_getf(viewport_size); immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC); - immUniform1i("num_colors", 0); /* Simple dashes. */ + immUniform1i("colors_len", 0); /* Simple dashes. */ immUniformColor3fv(color); /* line style: dotted for muted */ diff --git a/source/blender/editors/space_nla/nla_intern.h b/source/blender/editors/space_nla/nla_intern.h index c090b3b8106..a00e71a192d 100644 --- a/source/blender/editors/space_nla/nla_intern.h +++ b/source/blender/editors/space_nla/nla_intern.h @@ -148,8 +148,8 @@ void NLA_OT_selected_objects_add(wmOperatorType *ot); /* **************************************** */ /* nla_ops.c */ -int nlaop_poll_tweakmode_off(bContext *C); -int nlaop_poll_tweakmode_on(bContext *C); +bool nlaop_poll_tweakmode_off(bContext *C); +bool nlaop_poll_tweakmode_on(bContext *C); bool nlaedit_is_tweakmode_on(bAnimContext *ac); diff --git a/source/blender/editors/space_nla/nla_ops.c b/source/blender/editors/space_nla/nla_ops.c index 8109cff58fb..5bfd73b8163 100644 --- a/source/blender/editors/space_nla/nla_ops.c +++ b/source/blender/editors/space_nla/nla_ops.c @@ -52,7 +52,7 @@ /* ************************** poll callbacks for operators **********************************/ /* tweakmode is NOT enabled */ -int nlaop_poll_tweakmode_off(bContext *C) +bool nlaop_poll_tweakmode_off(bContext *C) { Scene *scene; @@ -74,7 +74,7 @@ int nlaop_poll_tweakmode_off(bContext *C) } /* tweakmode IS enabled */ -int nlaop_poll_tweakmode_on(bContext *C) +bool nlaop_poll_tweakmode_on(bContext *C) { Scene *scene; @@ -193,9 +193,7 @@ static void nla_keymap_channels(wmKeyMap *keymap) RNA_boolean_set(kmi->ptr, "above_selected", true); /* delete tracks */ -#ifdef USE_WM_KEYMAP_27X WM_keymap_add_item(keymap, "NLA_OT_tracks_delete", XKEY, KM_PRESS, 0, 0); -#endif WM_keymap_add_item(keymap, "NLA_OT_tracks_delete", DELKEY, KM_PRESS, 0, 0); } @@ -272,9 +270,7 @@ static void nla_keymap_main(wmKeyConfig *keyconf, wmKeyMap *keymap) WM_keymap_add_item(keymap, "NLA_OT_make_single_user", UKEY, KM_PRESS, 0, 0); /* delete */ -#ifdef USE_WM_KEYMAP_27X WM_keymap_add_item(keymap, "NLA_OT_delete", XKEY, KM_PRESS, 0, 0); -#endif WM_keymap_add_item(keymap, "NLA_OT_delete", DELKEY, KM_PRESS, 0, 0); /* split */ diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c index 329676d3061..8f6a0f5c4e2 100644 --- a/source/blender/editors/space_node/node_add.c +++ b/source/blender/editors/space_node/node_add.c @@ -392,7 +392,7 @@ void NODE_OT_add_file(wmOperatorType *ot) /* ****************** Add Mask Node Operator ******************* */ -static int node_add_mask_poll(bContext *C) +static bool node_add_mask_poll(bContext *C) { SpaceNode *snode = CTX_wm_space_node(C); diff --git a/source/blender/editors/space_node/node_buttons.c b/source/blender/editors/space_node/node_buttons.c index 38183637750..c2efc548c30 100644 --- a/source/blender/editors/space_node/node_buttons.c +++ b/source/blender/editors/space_node/node_buttons.c @@ -59,7 +59,7 @@ #if 0 /* poll for active nodetree */ -static int active_nodetree_poll(const bContext *C, PanelType *UNUSED(pt)) +static bool active_nodetree_poll(const bContext *C, PanelType *UNUSED(pt)) { SpaceNode *snode = CTX_wm_space_node(C); @@ -67,7 +67,7 @@ static int active_nodetree_poll(const bContext *C, PanelType *UNUSED(pt)) } #endif -static int node_sockets_poll(const bContext *C, PanelType *UNUSED(pt)) +static bool node_sockets_poll(const bContext *C, PanelType *UNUSED(pt)) { SpaceNode *snode = CTX_wm_space_node(C); @@ -95,7 +95,7 @@ static void node_sockets_panel(const bContext *C, Panel *pa) } } -static int node_tree_interface_poll(const bContext *C, PanelType *UNUSED(pt)) +static bool node_tree_interface_poll(const bContext *C, PanelType *UNUSED(pt)) { SpaceNode *snode = CTX_wm_space_node(C); @@ -216,7 +216,7 @@ static int node_properties_toggle_exec(bContext *C, wmOperator *UNUSED(op)) } /* non-standard poll operator which doesn't care if there are any nodes */ -static int node_properties_poll(bContext *C) +static bool node_properties_poll(bContext *C) { ScrArea *sa = CTX_wm_area(C); return (sa && (sa->spacetype == SPACE_NODE)); diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index ff87dcf409a..cc32e5ef499 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -303,7 +303,7 @@ void ED_node_composite_job(const bContext *C, struct bNodeTree *nodetree, Scene /* ***************************************** */ /* operator poll callback */ -int composite_node_active(bContext *C) +bool composite_node_active(bContext *C) { if (ED_operator_node_active(C)) { SpaceNode *snode = CTX_wm_space_node(C); @@ -314,7 +314,7 @@ int composite_node_active(bContext *C) } /* operator poll callback */ -int composite_node_editable(bContext *C) +bool composite_node_editable(bContext *C) { if (ED_operator_node_editable(C)) { SpaceNode *snode = CTX_wm_space_node(C); @@ -719,7 +719,7 @@ void ED_node_post_apply_transform(bContext *UNUSED(C), bNodeTree *UNUSED(ntree)) #if 0 /* UNUSED */ -static int edit_node_poll(bContext *C) +static bool edit_node_poll(bContext *C) { return ED_operator_node_active(C); } @@ -1617,7 +1617,7 @@ void NODE_OT_delete(wmOperatorType *ot) /* ****************** Switch View ******************* */ -static int node_switch_view_poll(bContext *C) +static bool node_switch_view_poll(bContext *C) { SpaceNode *snode = CTX_wm_space_node(C); @@ -2290,7 +2290,7 @@ void NODE_OT_tree_socket_move(wmOperatorType *ot) /* ********************** Shader Script Update ******************/ -static int node_shader_script_update_poll(bContext *C) +static bool node_shader_script_update_poll(bContext *C) { Scene *scene = CTX_data_scene(C); RenderEngineType *type = RE_engines_find(scene->r.engine); diff --git a/source/blender/editors/space_node/node_group.c b/source/blender/editors/space_node/node_group.c index 926fff7a3b6..a3294211ff9 100644 --- a/source/blender/editors/space_node/node_group.c +++ b/source/blender/editors/space_node/node_group.c @@ -65,7 +65,7 @@ #include "node_intern.h" /* own include */ #include "NOD_common.h" -static int node_group_operator_active(bContext *C) +static bool node_group_operator_active(bContext *C) { if (ED_operator_node_active(C)) { SpaceNode *snode = CTX_wm_space_node(C); @@ -84,7 +84,7 @@ static int node_group_operator_active(bContext *C) return false; } -static int node_group_operator_editable(bContext *C) +static bool node_group_operator_editable(bContext *C) { if (ED_operator_node_editable(C)) { SpaceNode *snode = CTX_wm_space_node(C); diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h index 2cc37a4e0fe..d7a43bda461 100644 --- a/source/blender/editors/space_node/node_intern.h +++ b/source/blender/editors/space_node/node_intern.h @@ -180,8 +180,8 @@ void snode_dag_update(struct bContext *C, struct SpaceNode *snode); void snode_set_context(const struct bContext *C); void snode_update(struct SpaceNode *snode, struct bNode *node); -int composite_node_active(struct bContext *C); -int composite_node_editable(struct bContext *C); +bool composite_node_active(struct bContext *C); +bool composite_node_editable(struct bContext *C); int node_has_hidden_sockets(bNode *node); void node_set_hidden_sockets(SpaceNode *snode, bNode *node, int set); diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c index 2e429155ff7..069d8a500ca 100644 --- a/source/blender/editors/space_node/node_ops.c +++ b/source/blender/editors/space_node/node_ops.c @@ -304,11 +304,10 @@ void node_keymap(struct wmKeyConfig *keyconf) kmi = WM_keymap_add_item(keymap, "NODE_OT_select_border", BKEY, KM_PRESS, 0, 0); RNA_boolean_set(kmi->ptr, "tweak", false); -#ifdef USE_WM_KEYMAP_27X WM_keymap_add_item(keymap, "NODE_OT_delete", XKEY, KM_PRESS, 0, 0); - WM_keymap_add_item(keymap, "NODE_OT_delete_reconnect", XKEY, KM_PRESS, KM_CTRL, 0); -#endif WM_keymap_add_item(keymap, "NODE_OT_delete", DELKEY, KM_PRESS, 0, 0); + + WM_keymap_add_item(keymap, "NODE_OT_delete_reconnect", XKEY, KM_PRESS, KM_CTRL, 0); WM_keymap_add_item(keymap, "NODE_OT_delete_reconnect", DELKEY, KM_PRESS, KM_CTRL, 0); kmi = WM_keymap_add_item(keymap, "NODE_OT_select_all", AKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/space_node/node_toolbar.c b/source/blender/editors/space_node/node_toolbar.c index 21278dd9fa5..b4e7e853330 100644 --- a/source/blender/editors/space_node/node_toolbar.c +++ b/source/blender/editors/space_node/node_toolbar.c @@ -63,7 +63,7 @@ static int node_toolbar_toggle_exec(bContext *C, wmOperator *UNUSED(op)) } /* non-standard poll operator which doesn't care if there are any nodes */ -static int node_toolbar_poll(bContext *C) +static bool node_toolbar_poll(bContext *C) { ScrArea *sa = CTX_wm_area(C); return (sa && (sa->spacetype == SPACE_NODE)); diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index fd485028f8e..fa6fa02cdc5 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -676,7 +676,7 @@ static void node_main_region_draw(const bContext *C, ARegion *ar) /* ************* dropboxes ************* */ -static int node_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) +static bool node_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) { if (drag->type == WM_DRAG_ID) { ID *id = drag->poin; @@ -690,7 +690,7 @@ static int node_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent * return 0; } -static int node_mask_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) +static bool node_mask_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) { if (drag->type == WM_DRAG_ID) { ID *id = drag->poin; diff --git a/source/blender/editors/space_outliner/outliner_collections.c b/source/blender/editors/space_outliner/outliner_collections.c index b97cc13d713..ad94615a0d2 100644 --- a/source/blender/editors/space_outliner/outliner_collections.c +++ b/source/blender/editors/space_outliner/outliner_collections.c @@ -102,7 +102,7 @@ Collection *outliner_collection_from_tree_element(const TreeElement *te) /* -------------------------------------------------------------------- */ /* Poll functions. */ -int ED_outliner_collections_editor_poll(bContext *C) +bool ED_outliner_collections_editor_poll(bContext *C) { SpaceOops *so = CTX_wm_space_outliner(C); return (so != NULL) && ELEM(so->outlinevis, SO_VIEW_LAYER, SO_SCENES, SO_LIBRARIES); @@ -574,7 +574,7 @@ static TreeTraversalAction layer_collection_find_data_to_edit(TreeElement *te, v return TRAVERSE_CONTINUE; } -static int collections_view_layer_poll(bContext *C, bool include) +static bool collections_view_layer_poll(bContext *C, bool include) { /* Poll function so the right click menu show current state of selected collections. */ SpaceOops *soops = CTX_wm_space_outliner(C); @@ -605,12 +605,12 @@ static int collections_view_layer_poll(bContext *C, bool include) return result; } -static int collections_exclude_poll(bContext *C) +static bool collections_exclude_poll(bContext *C) { return collections_view_layer_poll(C, false); } -static int collections_include_poll(bContext *C) +static bool collections_include_poll(bContext *C) { return collections_view_layer_poll(C, true); } diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 990d50ae42a..1c78931b449 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -242,7 +242,7 @@ static int outliner_item_openclose(bContext *C, wmOperator *op, const wmEvent *e void OUTLINER_OT_item_openclose(wmOperatorType *ot) { - ot->name = "Open/Close Item"; + ot->name = "Open/Close"; ot->idname = "OUTLINER_OT_item_openclose"; ot->description = "Toggle whether item under cursor is enabled or closed"; @@ -399,7 +399,7 @@ static int outliner_item_rename(bContext *C, wmOperator *op, const wmEvent *even void OUTLINER_OT_item_rename(wmOperatorType *ot) { - ot->name = "Rename Item"; + ot->name = "Rename"; ot->idname = "OUTLINER_OT_item_rename"; ot->description = "Rename item under cursor"; @@ -1385,7 +1385,7 @@ void OUTLINER_OT_show_hierarchy(wmOperatorType *ot) /* KeyingSet and Driver Creation - Helper functions */ /* specialized poll callback for these operators to work in Datablocks view only */ -static int ed_operator_outliner_datablocks_active(bContext *C) +static bool ed_operator_outliner_datablocks_active(bContext *C) { ScrArea *sa = CTX_wm_area(C); if ((sa) && (sa->spacetype == SPACE_OUTLINER)) { @@ -1873,7 +1873,7 @@ void OUTLINER_OT_keyingset_remove_selected(wmOperatorType *ot) /* ************************************************************** */ /* ORPHANED DATABLOCKS */ -static int ed_operator_outliner_id_orphans_active(bContext *C) +static bool ed_operator_outliner_id_orphans_active(bContext *C) { ScrArea *sa = CTX_wm_area(C); if ((sa) && (sa->spacetype == SPACE_OUTLINER)) { @@ -2110,7 +2110,7 @@ void OUTLINER_OT_parent_drop(wmOperatorType *ot) RNA_def_enum(ot->srna, "type", prop_make_parent_types, 0, "Type", ""); } -static int outliner_parenting_poll(bContext *C) +static bool outliner_parenting_poll(bContext *C) { SpaceOops *soops = CTX_wm_space_outliner(C); diff --git a/source/blender/editors/space_outliner/outliner_ops.c b/source/blender/editors/space_outliner/outliner_ops.c index b0478da55b5..bd31072557a 100644 --- a/source/blender/editors/space_outliner/outliner_ops.c +++ b/source/blender/editors/space_outliner/outliner_ops.c @@ -65,7 +65,7 @@ enum { OUTLINER_ITEM_DRAG_CONFIRM, }; -static int outliner_item_drag_drop_poll(bContext *C) +static bool outliner_item_drag_drop_poll(bContext *C) { SpaceOops *soops = CTX_wm_space_outliner(C); return ED_operator_outliner_active(C) && @@ -389,7 +389,7 @@ static int outliner_item_drag_drop_invoke(bContext *C, wmOperator *op, const wmE */ static void OUTLINER_OT_item_drag_drop(wmOperatorType *ot) { - ot->name = "Drag and Drop Item"; + ot->name = "Drag and Drop"; ot->idname = "OUTLINER_OT_item_drag_drop"; ot->description = "Change the hierarchical position of an item by repositioning it using drag and drop"; @@ -556,11 +556,9 @@ void outliner_keymap(wmKeyConfig *keyconf) WM_keymap_verify_item(keymap, "OUTLINER_OT_drivers_delete_selected", DKEY, KM_PRESS, KM_ALT, 0); WM_keymap_verify_item(keymap, "OUTLINER_OT_collection_new", CKEY, KM_PRESS, 0, 0); -#ifdef USE_WM_KEYMAP_27X + WM_keymap_verify_item(keymap, "OUTLINER_OT_collection_delete", XKEY, KM_PRESS, 0, 0); -#else WM_keymap_verify_item(keymap, "OUTLINER_OT_collection_delete", DELKEY, KM_PRESS, 0, 0); -#endif WM_keymap_verify_item(keymap, "OBJECT_OT_move_to_collection", MKEY, KM_PRESS, 0, 0); WM_keymap_verify_item(keymap, "OBJECT_OT_link_to_collection", MKEY, KM_PRESS, KM_SHIFT, 0); diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c index cfd658eea6c..e1baaf54163 100644 --- a/source/blender/editors/space_outliner/space_outliner.c +++ b/source/blender/editors/space_outliner/space_outliner.c @@ -93,7 +93,7 @@ static void outliner_main_region_init(wmWindowManager *wm, ARegion *ar) WM_event_add_dropbox_handler(&ar->handlers, lb); } -static int outliner_parent_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) +static bool outliner_parent_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) { ARegion *ar = CTX_wm_region(C); SpaceOops *soops = CTX_wm_space_outliner(C); @@ -151,7 +151,7 @@ static void outliner_parent_drop_copy(wmDrag *drag, wmDropBox *drop) RNA_string_set(drop->ptr, "child", id->name + 2); } -static int outliner_parent_clear_poll(bContext *C, wmDrag *drag, const wmEvent *event) +static bool outliner_parent_clear_poll(bContext *C, wmDrag *drag, const wmEvent *event) { ARegion *ar = CTX_wm_region(C); SpaceOops *soops = CTX_wm_space_outliner(C); @@ -197,7 +197,7 @@ static void outliner_parent_clear_copy(wmDrag *drag, wmDropBox *drop) RNA_enum_set(drop->ptr, "type", 0); } -static int outliner_scene_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) +static bool outliner_scene_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) { ARegion *ar = CTX_wm_region(C); SpaceOops *soops = CTX_wm_space_outliner(C); @@ -222,7 +222,7 @@ static void outliner_scene_drop_copy(wmDrag *drag, wmDropBox *drop) RNA_string_set(drop->ptr, "object", id->name + 2); } -static int outliner_material_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) +static bool outliner_material_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) { ARegion *ar = CTX_wm_region(C); SpaceOops *soops = CTX_wm_space_outliner(C); @@ -247,7 +247,7 @@ static void outliner_material_drop_copy(wmDrag *drag, wmDropBox *drop) RNA_string_set(drop->ptr, "material", id->name + 2); } -static int outliner_collection_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) +static bool outliner_collection_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) { ARegion *ar = CTX_wm_region(C); SpaceOops *soops = CTX_wm_space_outliner(C); diff --git a/source/blender/editors/space_sequencer/sequencer_buttons.c b/source/blender/editors/space_sequencer/sequencer_buttons.c index 5c8f8a0c4f1..a4bca555490 100644 --- a/source/blender/editors/space_sequencer/sequencer_buttons.c +++ b/source/blender/editors/space_sequencer/sequencer_buttons.c @@ -52,7 +52,7 @@ /* **************************** buttons ********************************* */ #if 0 -static int sequencer_grease_pencil_panel_poll(const bContext *C, PanelType *UNUSED(pt)) +static bool sequencer_grease_pencil_panel_poll(const bContext *C, PanelType *UNUSED(pt)) { SpaceSeq *sseq = CTX_wm_space_seq(C); diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index bf538611852..e6e37628c43 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -1049,7 +1049,7 @@ static void sequencer_draw_borders(const SpaceSeq *sseq, const View2D *v2d, cons immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC); immUniformThemeColor(TH_BACK); - immUniform1i("num_colors", 0); /* Simple dashes. */ + immUniform1i("colors_len", 0); /* Simple dashes. */ immUniform1f("dash_width", 6.0f); immUniform1f("dash_factor", 0.5f); diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 98f63c791af..cefc6cdd814 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -476,7 +476,7 @@ void recurs_sel_seq(Sequence *seqm) } } -int ED_space_sequencer_maskedit_mask_poll(bContext *C) +bool ED_space_sequencer_maskedit_mask_poll(bContext *C) { /* in this case both funcs are the same, for clip editor not */ return ED_space_sequencer_maskedit_poll(C); @@ -491,7 +491,7 @@ bool ED_space_sequencer_check_show_maskedit(SpaceSeq *sseq, Scene *scene) return false; } -int ED_space_sequencer_maskedit_poll(bContext *C) +bool ED_space_sequencer_maskedit_poll(bContext *C) { SpaceSeq *sseq = CTX_wm_space_seq(C); @@ -1149,27 +1149,27 @@ static int seq_get_snaplimit(View2D *v2d) #endif /* Operator functions */ -int sequencer_edit_poll(bContext *C) +bool sequencer_edit_poll(bContext *C) { return (BKE_sequencer_editing_get(CTX_data_scene(C), false) != NULL); } #if 0 /* UNUSED */ -int sequencer_strip_poll(bContext *C) +bool sequencer_strip_poll(bContext *C) { Editing *ed; return (((ed = BKE_sequencer_editing_get(CTX_data_scene(C), false)) != NULL) && (ed->act_seq != NULL)); } #endif -int sequencer_strip_has_path_poll(bContext *C) +bool sequencer_strip_has_path_poll(bContext *C) { Editing *ed; Sequence *seq; return (((ed = BKE_sequencer_editing_get(CTX_data_scene(C), false)) != NULL) && ((seq = ed->act_seq) != NULL) && (SEQ_HAS_PATH(seq))); } -int sequencer_view_preview_poll(bContext *C) +bool sequencer_view_preview_poll(bContext *C) { SpaceSeq *sseq = CTX_wm_space_seq(C); Editing *ed = BKE_sequencer_editing_get(CTX_data_scene(C), false); @@ -1179,7 +1179,7 @@ int sequencer_view_preview_poll(bContext *C) return 0; } -int sequencer_view_strips_poll(bContext *C) +bool sequencer_view_strips_poll(bContext *C) { SpaceSeq *sseq = CTX_wm_space_seq(C); if (sseq && ED_space_sequencer_check_show_strip(sseq)) @@ -1914,7 +1914,7 @@ void SEQUENCER_OT_reload(struct wmOperatorType *ot) } /* reload operator */ -static int sequencer_refresh_all_poll(bContext *C) +static bool sequencer_refresh_all_poll(bContext *C) { if (G.is_rendering) { return 0; @@ -1976,7 +1976,7 @@ static int sequencer_reassign_inputs_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int sequencer_effect_poll(bContext *C) +static bool sequencer_effect_poll(bContext *C) { Scene *scene = CTX_data_scene(C); Editing *ed = BKE_sequencer_editing_get(scene, false); @@ -2970,7 +2970,7 @@ static bool strip_jump_internal(Scene *scene, return changed; } -static int sequencer_strip_jump_poll(bContext *C) +static bool sequencer_strip_jump_poll(bContext *C) { /* prevent changes during render */ if (G.is_rendering) @@ -3953,7 +3953,7 @@ static int sequencer_export_subtitles_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static int sequencer_strip_is_text_poll(bContext *C) +static bool sequencer_strip_is_text_poll(bContext *C) { Editing *ed; Sequence *seq; diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h index 7c5bbbf52c6..ef1559ca940 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.h +++ b/source/blender/editors/space_sequencer/sequencer_intern.h @@ -75,12 +75,12 @@ void recurs_sel_seq(struct Sequence *seqm); int seq_effect_find_selected(struct Scene *scene, struct Sequence *activeseq, int type, struct Sequence **selseq1, struct Sequence **selseq2, struct Sequence **selseq3, const char **error_str); /* operator helpers */ -int sequencer_edit_poll(struct bContext *C); +bool sequencer_edit_poll(struct bContext *C); /* UNUSED */ -//int sequencer_strip_poll(struct bContext *C); -int sequencer_strip_has_path_poll(struct bContext *C); -int sequencer_view_preview_poll(struct bContext *C); -int sequencer_view_strips_poll(struct bContext *C); +//bool sequencer_strip_poll(struct bContext *C); +bool sequencer_strip_has_path_poll(struct bContext *C); +bool sequencer_view_preview_poll(struct bContext *C); +bool sequencer_view_strips_poll(struct bContext *C); /* externs */ extern EnumPropertyItem sequencer_prop_effect_types[]; diff --git a/source/blender/editors/space_sequencer/sequencer_modifier.c b/source/blender/editors/space_sequencer/sequencer_modifier.c index 107169a48d8..3c4481b32cb 100644 --- a/source/blender/editors/space_sequencer/sequencer_modifier.c +++ b/source/blender/editors/space_sequencer/sequencer_modifier.c @@ -50,7 +50,7 @@ /*********************** Add modifier operator *************************/ -static int strip_modifier_active_poll(bContext *C) +static bool strip_modifier_active_poll(bContext *C) { Scene *scene = CTX_data_scene(C); Editing *ed = BKE_sequencer_editing_get(scene, false); diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c index 80d9cdcc0e7..234989ef244 100644 --- a/source/blender/editors/space_sequencer/sequencer_ops.c +++ b/source/blender/editors/space_sequencer/sequencer_ops.c @@ -183,9 +183,7 @@ void sequencer_keymap(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "SEQUENCER_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0); -#ifdef USE_WM_KEYMAP_27X WM_keymap_add_item(keymap, "SEQUENCER_OT_delete", XKEY, KM_PRESS, 0, 0); -#endif WM_keymap_add_item(keymap, "SEQUENCER_OT_delete", DELKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "SEQUENCER_OT_copy", CKEY, KM_PRESS, KM_CTRL, 0); diff --git a/source/blender/editors/space_sequencer/sequencer_view.c b/source/blender/editors/space_sequencer/sequencer_view.c index 88dcc3a8821..fb4ef3e51ab 100644 --- a/source/blender/editors/space_sequencer/sequencer_view.c +++ b/source/blender/editors/space_sequencer/sequencer_view.c @@ -220,7 +220,7 @@ static void sample_cancel(bContext *C, wmOperator *op) sample_exit(C, op); } -static int sample_poll(bContext *C) +static bool sample_poll(bContext *C) { SpaceSeq *sseq = CTX_wm_space_seq(C); return sseq && BKE_sequencer_editing_get(CTX_data_scene(C), false) != NULL; diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index 756d8de927a..04be1f82a60 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -367,7 +367,7 @@ static void sequencer_listener( /* ************* dropboxes ************* */ -static int image_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) +static bool image_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) { ARegion *ar = CTX_wm_region(C); Scene *scene = CTX_data_scene(C); @@ -381,7 +381,7 @@ static int image_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) return 0; } -static int movie_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) +static bool movie_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) { ARegion *ar = CTX_wm_region(C); Scene *scene = CTX_data_scene(C); @@ -394,7 +394,7 @@ static int movie_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) return 0; } -static int sound_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) +static bool sound_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) { ARegion *ar = CTX_wm_region(C); Scene *scene = CTX_data_scene(C); diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index 8a83f25f093..c3e2945f3ff 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -475,7 +475,7 @@ static void text_cursor(wmWindow *win, ScrArea *sa, ARegion *ar) /* ************* dropboxes ************* */ -static int text_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) +static bool text_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) { if (drag->type == WM_DRAG_PATH) { /* rule might not work? */ @@ -492,7 +492,7 @@ static void text_drop_copy(wmDrag *drag, wmDropBox *drop) RNA_string_set(drop->ptr, "filepath", drag->path); } -static int text_drop_paste_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) +static bool text_drop_paste_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) { if (drag->type == WM_DRAG_ID) return true; diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 99305b143c6..9b4e71ae7a0 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -1510,7 +1510,7 @@ void draw_text_main(SpaceText *st, ARegion *ar) GPU_viewport_size_getf(viewport_size); immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC); - immUniform1i("num_colors", 0); /* "simple" mode */ + immUniform1i("colors_len", 0); /* "simple" mode */ immUniformThemeColor(TH_GRID); /* same color as line number background */ immUniform1f("dash_width", 2.0f); immUniform1f("dash_factor", 0.5f); diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c index 3229d164f27..896b5444a85 100644 --- a/source/blender/editors/space_text/text_header.c +++ b/source/blender/editors/space_text/text_header.c @@ -72,7 +72,7 @@ static ARegion *text_has_properties_region(ScrArea *sa) return arnew; } -static int text_properties_poll(bContext *C) +static bool text_properties_poll(bContext *C) { return (CTX_wm_space_text(C) != NULL); } diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h index 56ce62d0b14..02948d35623 100644 --- a/source/blender/editors/space_text/text_intern.h +++ b/source/blender/editors/space_text/text_intern.h @@ -142,7 +142,7 @@ void TEXT_OT_to_3d_object(struct wmOperatorType *ot); void TEXT_OT_resolve_conflict(struct wmOperatorType *ot); -int text_space_edit_poll(struct bContext *C); +bool text_space_edit_poll(struct bContext *C); /* text_autocomplete.c */ void TEXT_OT_autocomplete(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index e34edc8908f..a8c14a3d4c1 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -80,12 +80,12 @@ BLI_INLINE int text_pixel_x_to_column(SpaceText *st, const int x) return (x + (st->cwidth / 2)) / st->cwidth; } -static int text_new_poll(bContext *UNUSED(C)) +static bool text_new_poll(bContext *UNUSED(C)) { return 1; } -static int text_edit_poll(bContext *C) +static bool text_edit_poll(bContext *C) { Text *text = CTX_data_edit_text(C); @@ -100,7 +100,7 @@ static int text_edit_poll(bContext *C) return 1; } -int text_space_edit_poll(bContext *C) +bool text_space_edit_poll(bContext *C) { SpaceText *st = CTX_wm_space_text(C); Text *text = CTX_data_edit_text(C); @@ -116,7 +116,7 @@ int text_space_edit_poll(bContext *C) return 1; } -static int text_region_edit_poll(bContext *C) +static bool text_region_edit_poll(bContext *C) { SpaceText *st = CTX_wm_space_text(C); Text *text = CTX_data_edit_text(C); @@ -361,7 +361,7 @@ void TEXT_OT_reload(wmOperatorType *ot) /******************* delete operator *********************/ -static int text_unlink_poll(bContext *C) +static bool text_unlink_poll(bContext *C) { /* it should be possible to unlink texts if they're lib-linked in... */ return CTX_data_edit_text(C) != NULL; @@ -447,7 +447,7 @@ void TEXT_OT_make_internal(wmOperatorType *ot) /******************* save operator *********************/ -static int text_save_poll(bContext *C) +static bool text_save_poll(bContext *C) { Text *text = CTX_data_edit_text(C); @@ -590,7 +590,7 @@ void TEXT_OT_save_as(wmOperatorType *ot) /******************* run script operator *********************/ -static int text_run_script_poll(bContext *C) +static bool text_run_script_poll(bContext *C) { return (CTX_data_edit_text(C) != NULL); } @@ -2142,7 +2142,7 @@ typedef struct TextScroll { int zone; } TextScroll; -static int text_scroll_poll(bContext *C) +static bool text_scroll_poll(bContext *C) { /* it should be possible to still scroll linked texts to read them, even if they can't be edited... */ return CTX_data_edit_text(C) != NULL; @@ -2325,7 +2325,7 @@ void TEXT_OT_scroll(wmOperatorType *ot) /******************** scroll bar operator *******************/ -static int text_region_scroll_poll(bContext *C) +static bool text_region_scroll_poll(bContext *C) { /* same as text_region_edit_poll except it works on libdata too */ SpaceText *st = CTX_wm_space_text(C); diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index cb7066d218c..4660255cc6c 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -552,7 +552,7 @@ static void view3d_main_region_exit(wmWindowManager *wm, ARegion *ar) } } -static int view3d_ob_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) +static bool view3d_ob_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) { if (drag->type == WM_DRAG_ID) { ID *id = drag->poin; @@ -562,7 +562,7 @@ static int view3d_ob_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent return 0; } -static int view3d_collection_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) +static bool view3d_collection_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) { if (drag->type == WM_DRAG_ID) { ID *id = drag->poin; @@ -572,7 +572,7 @@ static int view3d_collection_drop_poll(bContext *UNUSED(C), wmDrag *drag, const return 0; } -static int view3d_mat_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) +static bool view3d_mat_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) { if (drag->type == WM_DRAG_ID) { ID *id = drag->poin; @@ -582,7 +582,7 @@ static int view3d_mat_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent return 0; } -static int view3d_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) +static bool view3d_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent *UNUSED(event)) { if (drag->type == WM_DRAG_ID) { ID *id = drag->poin; @@ -596,7 +596,7 @@ static int view3d_ima_drop_poll(bContext *UNUSED(C), wmDrag *drag, const wmEvent return 0; } -static int view3d_ima_bg_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) +static bool view3d_ima_bg_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) { if (event->ctrl) return false; @@ -607,7 +607,7 @@ static int view3d_ima_bg_drop_poll(bContext *C, wmDrag *drag, const wmEvent *eve return 0; } -static int view3d_ima_empty_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) +static bool view3d_ima_empty_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) { Base *base = ED_view3d_give_base_under_cursor(C, event->mval); @@ -621,7 +621,7 @@ static int view3d_ima_empty_drop_poll(bContext *C, wmDrag *drag, const wmEvent * return 0; } -static int view3d_ima_mesh_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) +static bool view3d_ima_mesh_drop_poll(bContext *C, wmDrag *drag, const wmEvent *event) { Base *base = ED_view3d_give_base_under_cursor(C, event->mval); diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 6ebed88728e..f5e8bf10817 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -786,7 +786,7 @@ static void do_view3d_vgroup_buttons(bContext *C, void *UNUSED(arg), int event) } } -static int view3d_panel_vgroup_poll(const bContext *C, PanelType *UNUSED(pt)) +static bool view3d_panel_vgroup_poll(const bContext *C, PanelType *UNUSED(pt)) { ViewLayer *view_layer = CTX_data_view_layer(C); Object *ob = OBACT(view_layer); @@ -1120,7 +1120,7 @@ static void do_view3d_region_buttons(bContext *C, void *UNUSED(index), int event WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d); } -static int view3d_panel_transform_poll(const bContext *C, PanelType *UNUSED(pt)) +static bool view3d_panel_transform_poll(const bContext *C, PanelType *UNUSED(pt)) { ViewLayer *view_layer = CTX_data_view_layer(C); return (view_layer->basact != NULL); diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index e9c2ddbab76..1ffdf8923f5 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -521,7 +521,7 @@ static void drawviewborder(Scene *scene, Depsgraph *depsgraph, ARegion *ar, View GPU_viewport_size_getf(viewport_size); immUniform2f("viewport_size", viewport_size[2], viewport_size[3]); - immUniform1i("num_colors", 0); /* "simple" mode */ + immUniform1i("colors_len", 0); /* "simple" mode */ immUniform1f("dash_width", 6.0f); immUniform1f("dash_factor", 0.5f); @@ -683,7 +683,7 @@ static void drawrenderborder(ARegion *ar, View3D *v3d) GPU_viewport_size_getf(viewport_size); immUniform2f("viewport_size", viewport_size[2], viewport_size[3]); - immUniform1i("num_colors", 0); /* "simple" mode */ + immUniform1i("colors_len", 0); /* "simple" mode */ immUniform4f("color", 1.0f, 0.25f, 0.25f, 1.0f); immUniform1f("dash_width", 6.0f); immUniform1f("dash_factor", 0.5f); diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 590ab80a4c8..cc30375255d 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -940,7 +940,7 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, const wmEvent *event) } /* test for unlocked camera view in quad view */ -static int view3d_camera_user_poll(bContext *C) +static bool view3d_camera_user_poll(bContext *C) { View3D *v3d; ARegion *ar; @@ -955,7 +955,7 @@ static int view3d_camera_user_poll(bContext *C) return 0; } -static int view3d_lock_poll(bContext *C) +static bool view3d_lock_poll(bContext *C) { View3D *v3d = CTX_wm_view3d(C); if (v3d) { diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index 4f81fa7585c..eeddacee808 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -196,7 +196,7 @@ static int view3d_layers_invoke(bContext *C, wmOperator *op, const wmEvent *even return OPERATOR_FINISHED; } -static int view3d_layers_poll(bContext *C) +static bool view3d_layers_poll(bContext *C) { return (ED_operator_view3d_active(C) && CTX_wm_view3d(C)->localvd == NULL); } @@ -234,7 +234,7 @@ static int toggle_show_xray(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_FINISHED; } -static int toggle_show_xray_poll(bContext *C) +static bool toggle_show_xray_poll(bContext *C) { bool result = (ED_operator_view3d_active(C) && !ED_operator_posemode(C) && !ED_operator_editmesh(C)); if (result) { diff --git a/source/blender/editors/space_view3d/view3d_manipulator_ruler.c b/source/blender/editors/space_view3d/view3d_manipulator_ruler.c index 4a9f07c34e8..d8a6a4c0c52 100644 --- a/source/blender/editors/space_view3d/view3d_manipulator_ruler.c +++ b/source/blender/editors/space_view3d/view3d_manipulator_ruler.c @@ -557,7 +557,7 @@ static void manipulator_ruler_draw(const bContext *C, wmManipulator *mpr) GPU_viewport_size_getf(viewport_size); immUniform2f("viewport_size", viewport_size[2], viewport_size[3]); - immUniform1i("num_colors", 2); /* "advanced" mode */ + immUniform1i("colors_len", 2); /* "advanced" mode */ const float *col = is_act ? color_act : color_base; immUniformArray4fv("colors", (float *)(float[][4]){{0.67f, 0.67f, 0.67f, 1.0f}, {col[0], col[1], col[2], col[3]}}, 2); immUniform1f("dash_width", 6.0f); @@ -697,7 +697,7 @@ static void manipulator_ruler_draw(const bContext *C, wmManipulator *mpr) GPU_viewport_size_getf(viewport_size); immUniform2f("viewport_size", viewport_size[2], viewport_size[3]); - immUniform1i("num_colors", 2); /* "advanced" mode */ + immUniform1i("colors_len", 2); /* "advanced" mode */ const float *col = is_act ? color_act : color_base; immUniformArray4fv("colors", (float *)(float[][4]){{0.67f, 0.67f, 0.67f, 1.0f}, {col[0], col[1], col[2], col[3]}}, 2); immUniform1f("dash_width", 6.0f); @@ -1032,7 +1032,7 @@ void VIEW3D_WGT_ruler(wmManipulatorGroupType *wgt) /** \name Add Ruler Operator * \{ */ -static int view3d_ruler_poll(bContext *C) +static bool view3d_ruler_poll(bContext *C) { bToolRef_Runtime *tref_rt = WM_toolsystem_runtime_from_context((bContext *)C); if ((tref_rt == NULL) || diff --git a/source/blender/editors/space_view3d/view3d_ruler.c b/source/blender/editors/space_view3d/view3d_ruler.c index 3a86f70febb..a60baae9b11 100644 --- a/source/blender/editors/space_view3d/view3d_ruler.c +++ b/source/blender/editors/space_view3d/view3d_ruler.c @@ -470,7 +470,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a GPU_viewport_size_getf(viewport_size); immUniform2f("viewport_size", viewport_size[2], viewport_size[3]); - immUniform1i("num_colors", 2); /* "advanced" mode */ + immUniform1i("colors_len", 2); /* "advanced" mode */ const float *col = is_act ? color_act : color_base; immUniformArray4fv("colors", (float *)(float[][4]){{0.67f, 0.67f, 0.67f, 1.0f}, {col[0], col[1], col[2], col[3]}}, 2); immUniform1f("dash_width", 6.0f); @@ -609,7 +609,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a GPU_viewport_size_getf(viewport_size); immUniform2f("viewport_size", viewport_size[2], viewport_size[3]); - immUniform1i("num_colors", 2); /* "advanced" mode */ + immUniform1i("colors_len", 2); /* "advanced" mode */ const float *col = is_act ? color_act : color_base; immUniformArray4fv("colors", (float *)(float[][4]){{0.67f, 0.67f, 0.67f, 1.0f}, {col[0], col[1], col[2], col[3]}}, 2); immUniform1f("dash_width", 6.0f); diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 02a70d91277..b7dbb09e1a4 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -265,7 +265,7 @@ static void view3d_userdata_lassoselect_init( r_data->is_changed = false; } -static int view3d_selectable_data(bContext *C) +static bool view3d_selectable_data(bContext *C) { Object *ob = CTX_data_active_object(C); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 53e3fbb87b0..aad2ac7284f 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -464,7 +464,7 @@ static int view3d_camera_to_view_exec(bContext *C, wmOperator *UNUSED(op)) } -static int view3d_camera_to_view_poll(bContext *C) +static bool view3d_camera_to_view_poll(bContext *C) { View3D *v3d; ARegion *ar; @@ -663,7 +663,7 @@ static int view3d_setobjectascamera_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -int ED_operator_rv3d_user_region_poll(bContext *C) +bool ED_operator_rv3d_user_region_poll(bContext *C) { View3D *v3d_dummy; ARegion *ar_dummy; @@ -1076,7 +1076,7 @@ finally: /** \name View Layer Utilities * \{ */ -int ED_view3d_view_layer_set(int lay, const int *values, int *active) +int ED_view3d_view_layer_set(int lay, const bool *values, int *active) { int i, tot = 0; diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index f233780a85b..721c5f2d3fa 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1705,7 +1705,7 @@ static void drawArc(float size, float angle_start, float angle_end, int segments immEnd(); } -static int helpline_poll(bContext *C) +static bool helpline_poll(bContext *C) { ARegion *ar = CTX_wm_region(C); @@ -1760,7 +1760,7 @@ static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata) GPU_viewport_size_getf(viewport_size); immUniform2f("viewport_size", viewport_size[2], viewport_size[3]); - immUniform1i("num_colors", 0); /* "simple" mode */ + immUniform1i("colors_len", 0); /* "simple" mode */ immUniformThemeColor(TH_VIEW_OVERLAY); immUniform1f("dash_width", 6.0f); immUniform1f("dash_factor", 0.5f); @@ -1951,7 +1951,7 @@ static void drawTransformPixel(const struct bContext *UNUSED(C), ARegion *ar, vo void saveTransform(bContext *C, TransInfo *t, wmOperator *op) { ToolSettings *ts = CTX_data_tool_settings(C); - int constraint_axis[3] = {0, 0, 0}; + bool constraint_axis[3] = {false, false, false}; int proportional = 0; PropertyRNA *prop; @@ -2073,13 +2073,13 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) if (t->con.mode & CON_APPLY) { if (t->con.mode & CON_AXIS0) { - constraint_axis[0] = 1; + constraint_axis[0] = true; } if (t->con.mode & CON_AXIS1) { - constraint_axis[1] = 1; + constraint_axis[1] = true; } if (t->con.mode & CON_AXIS2) { - constraint_axis[2] = 1; + constraint_axis[2] = true; } } @@ -2269,7 +2269,7 @@ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve /* Constraint init from operator */ if ((prop = RNA_struct_find_property(op->ptr, "constraint_axis")) && RNA_property_is_set(op->ptr, prop)) { - int constraint_axis[3]; + bool constraint_axis[3]; RNA_property_boolean_get_array(op->ptr, prop, constraint_axis); @@ -7691,7 +7691,7 @@ static void drawVertSlide(TransInfo *t) GPU_viewport_size_getf(viewport_size); immUniform2f("viewport_size", viewport_size[2], viewport_size[3]); - immUniform1i("num_colors", 0); /* "simple" mode */ + immUniform1i("colors_len", 0); /* "simple" mode */ immUniformColor4f(1.0f, 1.0f, 1.0f, 1.0f); immUniform1f("dash_width", 6.0f); immUniform1f("dash_factor", 0.5f); diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index 7aa1419b0dc..70e7cd27cca 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -755,7 +755,7 @@ void drawConstraint(TransInfo *t) GPU_viewport_size_getf(viewport_size); immUniform2f("viewport_size", viewport_size[2], viewport_size[3]); - immUniform1i("num_colors", 0); /* "simple" mode */ + immUniform1i("colors_len", 0); /* "simple" mode */ immUniformColor4f(1.0f, 1.0f, 1.0f, 1.0f); immUniform1f("dash_width", 2.0f); immUniform1f("dash_factor", 0.5f); diff --git a/source/blender/editors/transform/transform_manipulator_2d.c b/source/blender/editors/transform/transform_manipulator_2d.c index d2743f47000..fd6e7ed5442 100644 --- a/source/blender/editors/transform/transform_manipulator_2d.c +++ b/source/blender/editors/transform/transform_manipulator_2d.c @@ -223,7 +223,7 @@ void ED_widgetgroup_manipulator2d_setup(const bContext *UNUSED(C), wmManipulator /* assign operator */ PointerRNA *ptr = WM_manipulator_operator_set(axis, 0, ot_translate, NULL); - int constraint[3] = {0}; + bool constraint[3] = {0}; constraint[(axis_idx + 1) % 2] = 1; if (RNA_struct_find_property(ptr, "constraint_axis")) RNA_boolean_set_array(ptr, "constraint_axis", constraint); @@ -240,8 +240,8 @@ void ED_widgetgroup_manipulator2d_setup(const bContext *UNUSED(C), wmManipulator ptr = WM_manipulator_operator_set(man->cage, 0, ot_translate, NULL); RNA_boolean_set(ptr, "release_confirm", 1); - int constraint_x[3] = {1, 0, 0}; - int constraint_y[3] = {0, 1, 0}; + bool constraint_x[3] = {1, 0, 0}; + bool constraint_y[3] = {0, 1, 0}; ptr = WM_manipulator_operator_set(man->cage, ED_MANIPULATOR_CAGE2D_PART_SCALE_MIN_X, ot_resize, NULL); PropertyRNA *prop_release_confirm = RNA_struct_find_property(ptr, "release_confirm"); diff --git a/source/blender/editors/transform/transform_manipulator_3d.c b/source/blender/editors/transform/transform_manipulator_3d.c index f584a7cf623..8f547fb7451 100644 --- a/source/blender/editors/transform/transform_manipulator_3d.c +++ b/source/blender/editors/transform/transform_manipulator_3d.c @@ -401,9 +401,9 @@ static void manipulator_get_axis_color( r_col_hi[3] = alpha_hi * alpha_fac; } -static void manipulator_get_axis_constraint(const int axis_idx, int r_axis[3]) +static void manipulator_get_axis_constraint(const int axis_idx, bool r_axis[3]) { - zero_v3_int(r_axis); + ARRAY_SET_ITEMS(r_axis, 0, 0, 0); switch (axis_idx) { case MAN_AXIS_TRANS_X: @@ -1293,7 +1293,7 @@ static void manipulatorgroup_init_properties_from_twtype(wmManipulatorGroup *mgr MAN_ITER_AXES_BEGIN(axis, axis_idx) { const short axis_type = manipulator_get_axis_type(axis_idx); - int constraint_axis[3] = {1, 0, 0}; + bool constraint_axis[3] = {1, 0, 0}; PointerRNA *ptr; manipulator_get_axis_constraint(axis_idx, constraint_axis); @@ -1665,7 +1665,7 @@ static void WIDGETGROUP_xform_cage_setup(const bContext *UNUSED(C), wmManipulato for (int x = 0; x < 3; x++) { for (int y = 0; y < 3; y++) { for (int z = 0; z < 3; z++) { - int constraint[3] = {x != 1, y != 1, z != 1}; + bool constraint[3] = {x != 1, y != 1, z != 1}; ptr = WM_manipulator_operator_set(mpr, i, ot_resize, NULL); if (prop_release_confirm == NULL) { prop_release_confirm = RNA_struct_find_property(ptr, "release_confirm"); diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 61a82d26b2b..a8853743a57 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -223,7 +223,7 @@ static int delete_orientation_invoke(bContext *C, wmOperator *op, const wmEvent return delete_orientation_exec(C, op); } -static int delete_orientation_poll(bContext *C) +static bool delete_orientation_poll(bContext *C) { Scene *scene = CTX_data_scene(C); @@ -304,7 +304,7 @@ static void transformops_loopsel_hack(bContext *C, wmOperator *op) if (op->opm && op->opm->opm && op->opm->opm->prev) { wmOperator *op_prev = op->opm->opm->prev; Scene *scene = CTX_data_scene(C); - int mesh_select_mode[3]; + bool mesh_select_mode[3]; PropertyRNA *prop = RNA_struct_find_property(op_prev->ptr, "mesh_select_mode_init"); if (prop && RNA_property_is_set(op_prev->ptr, prop)) { @@ -649,7 +649,7 @@ static void TRANSFORM_OT_resize(struct wmOperatorType *ot) ot, P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_GEO_SNAP | P_OPTIONS | P_GPENCIL_EDIT | P_CENTER); } -static int skin_resize_poll(bContext *C) +static bool skin_resize_poll(bContext *C) { struct Object *obedit = CTX_data_edit_object(C); if (obedit && obedit->type == OB_MESH) { diff --git a/source/blender/editors/undo/ed_undo.c b/source/blender/editors/undo/ed_undo.c index 478e004743d..c090414bc22 100644 --- a/source/blender/editors/undo/ed_undo.c +++ b/source/blender/editors/undo/ed_undo.c @@ -242,7 +242,7 @@ static int ed_undo_redo_exec(bContext *C, wmOperator *UNUSED(op)) return ret ? OPERATOR_FINISHED : OPERATOR_CANCELLED; } -static int ed_undo_redo_poll(bContext *C) +static bool ed_undo_redo_poll(bContext *C) { wmOperator *last_op = WM_operator_last_redo(C); return last_op && ED_operator_screenactive(C) && diff --git a/source/blender/editors/util/ed_transverts.c b/source/blender/editors/util/ed_transverts.c index 494ae769cf3..3cd74f1266f 100644 --- a/source/blender/editors/util/ed_transverts.c +++ b/source/blender/editors/util/ed_transverts.c @@ -497,7 +497,7 @@ void ED_transverts_free(TransVertStore *tvs) tvs->transverts_tot = 0; } -int ED_transverts_poll(bContext *C) +bool ED_transverts_poll(bContext *C) { Object *obedit = CTX_data_edit_object(C); if (obedit) { diff --git a/source/blender/editors/util/ed_util.c b/source/blender/editors/util/ed_util.c index 10c2f735e0e..98bbb64b48c 100644 --- a/source/blender/editors/util/ed_util.c +++ b/source/blender/editors/util/ed_util.c @@ -350,7 +350,7 @@ void ED_region_draw_mouse_line_cb(const bContext *C, ARegion *ar, void *arg_info GPU_viewport_size_getf(viewport_size); immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC); - immUniform1i("num_colors", 0); /* "simple" mode */ + immUniform1i("colors_len", 0); /* "simple" mode */ immUniformThemeColor(TH_VIEW_OVERLAY); immUniform1f("dash_width", 6.0f); immUniform1f("dash_factor", 0.5f); diff --git a/source/blender/editors/uvedit/uvedit_buttons.c b/source/blender/editors/uvedit/uvedit_buttons.c index b37703d03dd..60500f0211a 100644 --- a/source/blender/editors/uvedit/uvedit_buttons.c +++ b/source/blender/editors/uvedit/uvedit_buttons.c @@ -208,7 +208,7 @@ static void do_uvedit_vertex(bContext *C, void *UNUSED(arg), int event) /* Panels */ -static int image_panel_uv_poll(const bContext *C, PanelType *UNUSED(pt)) +static bool image_panel_uv_poll(const bContext *C, PanelType *UNUSED(pt)) { Object *obedit = CTX_data_edit_object(C); return ED_uvedit_test(obedit); diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index 5fb328a922d..9f67b618722 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -100,7 +100,7 @@ void ED_image_draw_cursor(ARegion *ar, const float cursor[2]) GPU_viewport_size_getf(viewport_size); immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC); - immUniform1i("num_colors", 2); /* "advanced" mode */ + immUniform1i("colors_len", 2); /* "advanced" mode */ immUniformArray4fv("colors", (float *)(float[][4]){{1.0f, 0.0f, 0.0f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}}, 2); immUniform1f("dash_width", 8.0f); @@ -723,7 +723,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, ViewLayer *view_layer, Obje GPU_viewport_size_getf(viewport_size); immUniform2f("viewport_size", viewport_size[2] / UI_DPI_FAC, viewport_size[3] / UI_DPI_FAC); - immUniform1i("num_colors", 2); /* "advanced" mode */ + immUniform1i("colors_len", 2); /* "advanced" mode */ immUniformArray4fv("colors", (float *)(float[][4]){{0.56f, 0.56f, 0.56f, 1.0f}, {0.07f, 0.07f, 0.07f, 1.0f}}, 2); immUniform1f("dash_width", 4.0f); GPU_line_width(1.0f); diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index f26f4af0622..8a00b542eed 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -118,7 +118,7 @@ bool ED_uvedit_test(Object *obedit) return ret; } -static int ED_operator_uvedit_can_uv_sculpt(struct bContext *C) +static bool ED_operator_uvedit_can_uv_sculpt(struct bContext *C) { SpaceImage *sima = CTX_wm_space_image(C); ToolSettings *toolsettings = CTX_data_tool_settings(C); @@ -4060,7 +4060,7 @@ static void UV_OT_reveal(wmOperatorType *ot) /** \name Set 2D Cursor Operator * \{ */ -static int uv_set_2d_cursor_poll(bContext *C) +static bool uv_set_2d_cursor_poll(bContext *C) { return ED_operator_uvedit_space_image(C) || ED_space_image_maskedit_poll(C) || diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index eb14ca9ae2d..52409dc2a1f 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -1579,7 +1579,7 @@ static int uv_from_view_exec(bContext *C, wmOperator *op) } } -static int uv_from_view_poll(bContext *C) +static bool uv_from_view_poll(bContext *C) { RegionView3D *rv3d = CTX_wm_region_view3d(C); diff --git a/source/blender/gpu/intern/gpu_codegen.c b/source/blender/gpu/intern/gpu_codegen.c index 436f43d9c1e..a450b551d4a 100644 --- a/source/blender/gpu/intern/gpu_codegen.c +++ b/source/blender/gpu/intern/gpu_codegen.c @@ -80,11 +80,17 @@ static char *glsl_material_library = NULL; static GPUPass *pass_cache = NULL; static SpinLock pass_cache_spin; -static uint32_t gpu_pass_hash(const char *frag_gen, const char *defs) +static uint32_t gpu_pass_hash(const char *frag_gen, const char *defs, GPUVertexAttribs *attribs) { BLI_HashMurmur2A hm2a; BLI_hash_mm2a_init(&hm2a, 0); BLI_hash_mm2a_add(&hm2a, (unsigned char *)frag_gen, strlen(frag_gen)); + if (attribs) { + for (int att_idx = 0; att_idx < attribs->totlayer; att_idx++) { + char *name = attribs->layer[att_idx].name; + BLI_hash_mm2a_add(&hm2a, (unsigned char *)name, strlen(name)); + } + } if (defs) BLI_hash_mm2a_add(&hm2a, (unsigned char *)defs, strlen(defs)); @@ -1885,7 +1891,7 @@ GPUPass *GPU_generate_pass_new( char *fragmentgen = code_generate_fragment(material, nodes, frag_outlink->output); /* Cache lookup: Reuse shaders already compiled */ - uint32_t hash = gpu_pass_hash(fragmentgen, defines); + uint32_t hash = gpu_pass_hash(fragmentgen, defines, attribs); pass_hash = gpu_pass_cache_lookup(hash); if (pass_hash && (pass_hash->next == NULL || pass_hash->next->hash != hash)) { diff --git a/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl b/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl index 7caf00f58fd..3c5b0d1ca0a 100644 --- a/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_frag.glsl @@ -10,9 +10,9 @@ uniform float dash_width; /* Simple mode, discarding non-dash parts (so no need for blending at all). */ uniform float dash_factor; /* if > 1.0, solid line. */ -/* More advanced mode, allowing for complex, multi-colored patterns. Enabled when num_colors > 0. */ +/* More advanced mode, allowing for complex, multi-colored patterns. Enabled when colors_len > 0. */ /* Note: max number of steps/colors in pattern is 32! */ -uniform int num_colors; /* Enabled if > 0, 1 for solid line. */ +uniform int colors_len; /* Enabled if > 0, 1 for solid line. */ uniform vec4 colors[32]; noperspective in float distance_along_line; @@ -23,15 +23,15 @@ out vec4 fragColor; void main() { /* Multi-color option. */ - if (num_colors > 0) { + if (colors_len > 0) { /* Solid line case, simple. */ - if (num_colors == 1) { + if (colors_len == 1) { fragColor = colors[0]; } /* Actually dashed line... */ else { float normalized_distance = fract(distance_along_line / dash_width); - fragColor = colors[int(normalized_distance * num_colors)]; + fragColor = colors[int(normalized_distance * colors_len)]; } } /* Single color option. */ diff --git a/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_geom.glsl b/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_geom.glsl index db4bdf0a9f0..8fa19f94b39 100644 --- a/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_geom.glsl +++ b/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_geom.glsl @@ -12,7 +12,7 @@ uniform vec2 viewport_size; /* Uniforms from fragment shader, used here to optimize out useless computation in case of solid line. */ uniform float dash_factor; /* if > 1.0, solid line. */ -uniform int num_colors; /* Enabled if > 0, 1 for solid line. */ +uniform int colors_len; /* Enabled if > 0, 1 for solid line. */ layout(lines) in; @@ -34,7 +34,7 @@ void main() gl_Position = v2; color_geom = color_vert[1]; - if ((num_colors == 1) || (dash_factor >= 1.0f)) { + if ((colors_len == 1) || (dash_factor >= 1.0f)) { /* Solid line, optimize out distance computation! */ distance_along_line = 0.0f; } diff --git a/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_width_geom.glsl b/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_width_geom.glsl index 20c72f4407d..5a4da5cc9d4 100644 --- a/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_width_geom.glsl +++ b/source/blender/gpu/shaders/gpu_shader_2D_line_dashed_width_geom.glsl @@ -10,7 +10,7 @@ uniform float width; /* in pixels, screen space. */ /* Uniforms from fragment shader, used here to optimize out useless computation in case of solid line. */ uniform float dash_factor; /* if > 1.0, solid line. */ -uniform int num_colors; /* Enabled if > 0, 1 for solid line. */ +uniform int colors_len; /* Enabled if > 0, 1 for solid line. */ layout(lines) in; @@ -36,7 +36,7 @@ void main() gl_Position = v1 - (wdir * w1); EmitVertex(); - if ((num_colors == 1) || (dash_factor >= 1.0f)) { + if ((colors_len == 1) || (dash_factor >= 1.0f)) { /* Solid line, optimize out distance computation! */ distance_along_line = 0.0f; } diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 59c6aa9bd1b..d2782dee9ff 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -465,10 +465,19 @@ typedef struct bUserMenuItem_Menu { char mt_idname[64]; } bUserMenuItem_Menu; +typedef struct bUserMenuItem_Prop { + bUserMenuItem item; + char context_data_path[256]; + char prop_id[64]; + int prop_index; + char _pad0[4]; +} bUserMenuItem_Prop; + enum { USER_MENU_TYPE_SEP = 1, USER_MENU_TYPE_OPERATOR = 2, USER_MENU_TYPE_MENU = 3, + USER_MENU_TYPE_PROP = 4, }; typedef struct SolidLight { diff --git a/source/blender/makesdna/DNA_windowmanager_types.h b/source/blender/makesdna/DNA_windowmanager_types.h index e41058f356b..c6ad1470561 100644 --- a/source/blender/makesdna/DNA_windowmanager_types.h +++ b/source/blender/makesdna/DNA_windowmanager_types.h @@ -327,7 +327,7 @@ typedef struct wmKeyMap { /* runtime */ /** Verify if enabled in the current context, use #WM_keymap_poll instead of direct calls. */ - int (*poll)(struct bContext *); + bool (*poll)(struct bContext *); /** For modal, #EnumPropertyItem for now. */ const void *modal_items; } wmKeyMap; diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index a135e716770..06bbde0497c 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -874,7 +874,7 @@ bool RNA_property_enum_item_from_value_gettexted( int RNA_property_enum_bitflag_identifiers(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier); StructRNA *RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop); -int RNA_property_pointer_poll(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *value); +bool RNA_property_pointer_poll(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *value); bool RNA_property_editable(PointerRNA *ptr, PropertyRNA *prop); bool RNA_property_editable_info(PointerRNA *ptr, PropertyRNA *prop, const char **r_info); @@ -898,15 +898,15 @@ void RNA_property_update_cache_free(void); /* Property Data */ -int RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop); -void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value); -void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values); -int RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index); -void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *values); -void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, int value); -int RNA_property_boolean_get_default(PointerRNA *ptr, PropertyRNA *prop); -void RNA_property_boolean_get_default_array(PointerRNA *ptr, PropertyRNA *prop, int *values); -int RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index); +bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop); +void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value); +void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, bool *values); +bool RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index); +void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const bool *values); +void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, bool value); +bool RNA_property_boolean_get_default(PointerRNA *ptr, PropertyRNA *prop); +void RNA_property_boolean_get_default_array(PointerRNA *ptr, PropertyRNA *prop, bool *values); +bool RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index); int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop); void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value); @@ -1050,10 +1050,10 @@ char *RNA_path_property_py(struct PointerRNA *ptr, struct PropertyRNA *prop, int * There is no support for pointers and collections here yet, these can be * added when ID properties support them. */ -int RNA_boolean_get(PointerRNA *ptr, const char *name); -void RNA_boolean_set(PointerRNA *ptr, const char *name, int value); -void RNA_boolean_get_array(PointerRNA *ptr, const char *name, int *values); -void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const int *values); +bool RNA_boolean_get(PointerRNA *ptr, const char *name); +void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value); +void RNA_boolean_get_array(PointerRNA *ptr, const char *name, bool *values); +void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const bool *values); int RNA_int_get(PointerRNA *ptr, const char *name); void RNA_int_set(PointerRNA *ptr, const char *name, int value); diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h index 0c269d17072..97a8a4a5546 100644 --- a/source/blender/makesrna/RNA_define.h +++ b/source/blender/makesrna/RNA_define.h @@ -84,11 +84,11 @@ void RNA_def_struct_translation_context(StructRNA *srna, const char *context); typedef void StructOrFunctionRNA; -PropertyRNA *RNA_def_boolean(StructOrFunctionRNA *cont, const char *identifier, int default_value, const char *ui_name, const char *ui_description); -PropertyRNA *RNA_def_boolean_array(StructOrFunctionRNA *cont, const char *identifier, int len, int *default_value, const char *ui_name, const char *ui_description); -PropertyRNA *RNA_def_boolean_layer(StructOrFunctionRNA *cont, const char *identifier, int len, int *default_value, const char *ui_name, const char *ui_description); -PropertyRNA *RNA_def_boolean_layer_member(StructOrFunctionRNA *cont, const char *identifier, int len, int *default_value, const char *ui_name, const char *ui_description); -PropertyRNA *RNA_def_boolean_vector(StructOrFunctionRNA *cont, const char *identifier, int len, int *default_value, const char *ui_name, const char *ui_description); +PropertyRNA *RNA_def_boolean(StructOrFunctionRNA *cont, const char *identifier, bool default_value, const char *ui_name, const char *ui_description); +PropertyRNA *RNA_def_boolean_array(StructOrFunctionRNA *cont, const char *identifier, int len, bool *default_value, const char *ui_name, const char *ui_description); +PropertyRNA *RNA_def_boolean_layer(StructOrFunctionRNA *cont, const char *identifier, int len, bool *default_value, const char *ui_name, const char *ui_description); +PropertyRNA *RNA_def_boolean_layer_member(StructOrFunctionRNA *cont, const char *identifier, int len, bool *default_value, const char *ui_name, const char *ui_description); +PropertyRNA *RNA_def_boolean_vector(StructOrFunctionRNA *cont, const char *identifier, int len, bool *default_value, const char *ui_name, const char *ui_description); PropertyRNA *RNA_def_int(StructOrFunctionRNA *cont, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax); PropertyRNA *RNA_def_int_vector(StructOrFunctionRNA *cont, const char *identifier, int len, const int *default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax); @@ -162,8 +162,8 @@ void RNA_def_property_string_maxlength(PropertyRNA *prop, int maxlength); void RNA_def_property_struct_type(PropertyRNA *prop, const char *type); void RNA_def_property_struct_runtime(PropertyRNA *prop, StructRNA *type); -void RNA_def_property_boolean_default(PropertyRNA *prop, int value); -void RNA_def_property_boolean_array_default(PropertyRNA *prop, const int *array); +void RNA_def_property_boolean_default(PropertyRNA *prop, bool value); +void RNA_def_property_boolean_array_default(PropertyRNA *prop, const bool *array); void RNA_def_property_int_default(PropertyRNA *prop, int value); void RNA_def_property_int_array_default(PropertyRNA *prop, const int *array); void RNA_def_property_float_default(PropertyRNA *prop, float value); diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h index b4edc0dc99d..ce1edba75fd 100644 --- a/source/blender/makesrna/RNA_enum_types.h +++ b/source/blender/makesrna/RNA_enum_types.h @@ -211,18 +211,18 @@ int rna_node_tree_type_to_enum(struct bNodeTreeType *typeinfo); int rna_node_tree_idname_to_enum(const char *idname); struct bNodeTreeType *rna_node_tree_type_from_enum(int value); const EnumPropertyItem *rna_node_tree_type_itemf( - void *data, int (*poll)(void *data, struct bNodeTreeType *), bool *r_free); + void *data, bool (*poll)(void *data, struct bNodeTreeType *), bool *r_free); int rna_node_type_to_enum(struct bNodeType *typeinfo); int rna_node_idname_to_enum(const char *idname); struct bNodeType *rna_node_type_from_enum(int value); -const EnumPropertyItem *rna_node_type_itemf(void *data, int (*poll)(void *data, struct bNodeType *), bool *r_free); +const EnumPropertyItem *rna_node_type_itemf(void *data, bool (*poll)(void *data, struct bNodeType *), bool *r_free); int rna_node_socket_type_to_enum(struct bNodeSocketType *typeinfo); int rna_node_socket_idname_to_enum(const char *idname); struct bNodeSocketType *rna_node_socket_type_from_enum(int value); const EnumPropertyItem *rna_node_socket_type_itemf( - void *data, int (*poll)(void *data, struct bNodeSocketType *), bool *r_free); + void *data, bool (*poll)(void *data, struct bNodeSocketType *), bool *r_free); struct bContext; struct PointerRNA; diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index 9d304018990..ccf9affa1f8 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -337,6 +337,7 @@ typedef enum RawPropertyType { PROP_RAW_INT, // XXX - abused for types that are not set, eg. MFace.verts, needs fixing. PROP_RAW_SHORT, PROP_RAW_CHAR, + PROP_RAW_BOOLEAN, PROP_RAW_DOUBLE, PROP_RAW_FLOAT } RawPropertyType; @@ -371,10 +372,10 @@ typedef struct EnumPropertyItem { } EnumPropertyItem; /* extended versions with PropertyRNA argument */ -typedef int (*BooleanPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop); -typedef void (*BooleanPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int value); -typedef void (*BooleanArrayPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int *values); -typedef void (*BooleanArrayPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, const int *values); +typedef bool (*BooleanPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop); +typedef void (*BooleanPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, bool value); +typedef void (*BooleanArrayPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, bool *values); +typedef void (*BooleanArrayPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, const bool *values); typedef int (*IntPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop); typedef void (*IntPropertySetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int value); typedef void (*IntArrayPropertyGetFunc)(struct PointerRNA *ptr, struct PropertyRNA *prop, int *values); diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index fe063a8e335..1dd4535610c 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -418,6 +418,7 @@ static const char *rna_type_type_name(PropertyRNA *prop) { switch (prop->type) { case PROP_BOOLEAN: + return "bool"; case PROP_INT: case PROP_ENUM: return "int"; @@ -1617,6 +1618,21 @@ static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefR switch (prop->type) { case PROP_BOOLEAN: + { + if (!prop->arraydimension) { + fprintf(f, "bool %sget(PointerRNA *ptr);\n", func); + fprintf(f, "void %sset(PointerRNA *ptr, bool value);\n", func); + } + else if (prop->arraydimension && prop->totarraylength) { + fprintf(f, "void %sget(PointerRNA *ptr, bool values[%u]);\n", func, prop->totarraylength); + fprintf(f, "void %sset(PointerRNA *ptr, const bool values[%u]);\n", func, prop->totarraylength); + } + else { + fprintf(f, "void %sget(PointerRNA *ptr, bool values[]);\n", func); + fprintf(f, "void %sset(PointerRNA *ptr, const bool values[]);\n", func); + } + break; + } case PROP_INT: { if (!prop->arraydimension) { @@ -1749,15 +1765,15 @@ static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, Property { if (!prop->arraydimension) { fprintf(f, "\tinline bool %s(void);\n", rna_safe_id(prop->identifier)); - fprintf(f, "\tinline void %s(int value);", rna_safe_id(prop->identifier)); + fprintf(f, "\tinline void %s(bool value);", rna_safe_id(prop->identifier)); } else if (prop->totarraylength) { - fprintf(f, "\tinline Array<int, %u> %s(void);\n", prop->totarraylength, rna_safe_id(prop->identifier)); - fprintf(f, "\tinline void %s(int values[%u]);", rna_safe_id(prop->identifier), prop->totarraylength); + fprintf(f, "\tinline Array<bool, %u> %s(void);\n", prop->totarraylength, rna_safe_id(prop->identifier)); + fprintf(f, "\tinline void %s(bool values[%u]);", rna_safe_id(prop->identifier), prop->totarraylength); } else if (prop->getlength) { - fprintf(f, "\tinline DynamicArray<int> %s(void);\n", rna_safe_id(prop->identifier)); - fprintf(f, "\tinline void %s(int values[]);", rna_safe_id(prop->identifier)); + fprintf(f, "\tinline DynamicArray<bool> %s(void);\n", rna_safe_id(prop->identifier)); + fprintf(f, "\tinline void %s(bool values[]);", rna_safe_id(prop->identifier)); } break; } @@ -2959,7 +2975,7 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr unsigned int i; if (prop->arraydimension && prop->totarraylength) { - fprintf(f, "static int rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest, + fprintf(f, "static bool rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest, prop->identifier, prop->totarraylength); for (i = 0; i < prop->totarraylength; i++) { @@ -3589,22 +3605,22 @@ static const char *cpp_classes = "" "\n" "#define BOOLEAN_PROPERTY(sname, identifier) \\\n" " inline bool sname::identifier(void) { return sname##_##identifier##_get(&ptr) ? true: false; } \\\n" -" inline void sname::identifier(int value) { sname##_##identifier##_set(&ptr, value); }\n" +" inline void sname::identifier(bool value) { sname##_##identifier##_set(&ptr, value); }\n" "\n" "#define BOOLEAN_ARRAY_PROPERTY(sname, size, identifier) \\\n" -" inline Array<int, size> sname::identifier(void) \\\n" -" { Array<int, size> ar; sname##_##identifier##_get(&ptr, ar.data); return ar; } \\\n" -" inline void sname::identifier(int values[size]) \\\n" +" inline Array<bool, size> sname::identifier(void) \\\n" +" { Array<bool, size> ar; sname##_##identifier##_get(&ptr, ar.data); return ar; } \\\n" +" inline void sname::identifier(bool values[size]) \\\n" " { sname##_##identifier##_set(&ptr, values); } \\\n" "\n" "#define BOOLEAN_DYNAMIC_ARRAY_PROPERTY(sname, identifier) \\\n" -" inline DynamicArray<int> sname::identifier(void) { \\\n" +" inline DynamicArray<bool> sname::identifier(void) { \\\n" " int arraylen[3]; \\\n" " int len = sname##_##identifier##_get_length(&ptr, arraylen); \\\n" -" DynamicArray<int> ar(len); \\\n" +" DynamicArray<bool> ar(len); \\\n" " sname##_##identifier##_get(&ptr, ar.data); \\\n" " return ar; } \\\n" -" inline void sname::identifier(int values[]) \\\n" +" inline void sname::identifier(bool values[]) \\\n" " { sname##_##identifier##_set(&ptr, values); } \\\n" "\n" "#define INT_PROPERTY(sname, identifier) \\\n" diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 5473eec39c5..43535d6f498 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -402,7 +402,7 @@ static void rna_ID_user_remap(ID *id, Main *bmain, ID *new_id) } } -static struct ID *rna_ID_make_local(struct ID *self, Main *bmain, int clear_proxy) +static struct ID *rna_ID_make_local(struct ID *self, Main *bmain, bool clear_proxy) { /* Special case, as we can't rely on id_make_local(); it clears proxies. */ if (!clear_proxy && GS(self->name) == ID_OB) { @@ -475,7 +475,8 @@ static void rna_IDMaterials_append_id(ID *id, Main *bmain, Material *ma) WM_main_add_notifier(NC_OBJECT | ND_OB_SHADING, id); } -static Material *rna_IDMaterials_pop_id(ID *id, Main *bmain, ReportList *reports, int index_i, int remove_material_slot) +static Material *rna_IDMaterials_pop_id( + ID *id, Main *bmain, ReportList *reports, int index_i, bool remove_material_slot) { Material *ma; short *totcol = give_totcolp_id(id); @@ -503,7 +504,7 @@ static Material *rna_IDMaterials_pop_id(ID *id, Main *bmain, ReportList *reports return ma; } -static void rna_IDMaterials_clear_id(ID *id, Main *bmain, int remove_material_slot) +static void rna_IDMaterials_clear_id(ID *id, Main *bmain, bool remove_material_slot) { BKE_material_clear_id(bmain, id, remove_material_slot); diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 9b231f4aa5e..638589c104a 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -1390,7 +1390,7 @@ StructRNA *RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop) return &RNA_UnknownType; } -int RNA_property_pointer_poll(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *value) +bool RNA_property_pointer_poll(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *value) { prop = rna_ensure_property(prop); @@ -2238,17 +2238,17 @@ void RNA_property_update_cache_free(void) /* Property Data */ -int RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop) +bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop) { BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop; IDProperty *idprop; - int value; + bool value; BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); BLI_assert(RNA_property_array_check(prop) == false); if ((idprop = rna_idproperty_check(&prop, ptr))) - value = IDP_Int(idprop); + value = IDP_Int(idprop) != 0; else if (bprop->get) value = bprop->get(ptr); else if (bprop->get_ex) @@ -2261,7 +2261,7 @@ int RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop) return value; } -void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value) +void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value) { BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop; IDProperty *idprop; @@ -2271,10 +2271,10 @@ void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value) BLI_assert(ELEM(value, false, true)); /* just in case other values are passed */ - if (value) value = 1; + BLI_assert(ELEM(value, true, false)); if ((idprop = rna_idproperty_check(&prop, ptr))) { - IDP_Int(idprop) = value; + IDP_Int(idprop) = (int)value; rna_idproperty_touch(idprop); } else if (bprop->set) { @@ -2295,7 +2295,7 @@ void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, int value) } } -void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values) +void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, bool *values) { BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop; IDProperty *idprop; @@ -2304,10 +2304,15 @@ void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int *val BLI_assert(RNA_property_array_check(prop) != false); if ((idprop = rna_idproperty_check(&prop, ptr))) { - if (prop->arraydimension == 0) + if (prop->arraydimension == 0) { values[0] = RNA_property_boolean_get(ptr, prop); - else - memcpy(values, IDP_Array(idprop), sizeof(int) * idprop->len); + } + else { + int *values_src = IDP_Array(idprop); + for (uint i = 0; i < idprop->len; i++) { + values[i] = (bool)values_src[i]; + } + } } else if (prop->arraydimension == 0) values[0] = RNA_property_boolean_get(ptr, prop); @@ -2316,16 +2321,16 @@ void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, int *val else if (bprop->getarray_ex) bprop->getarray_ex(ptr, prop, values); else if (bprop->defaultarray) - memcpy(values, bprop->defaultarray, sizeof(int) * prop->totarraylength); + memcpy(values, bprop->defaultarray, sizeof(bool) * prop->totarraylength); else - memset(values, 0, sizeof(int) * prop->totarraylength); + memset(values, 0, sizeof(bool) * prop->totarraylength); } -int RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index) +bool RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index) { - int tmp[RNA_MAX_ARRAY_LENGTH]; + bool tmp[RNA_MAX_ARRAY_LENGTH]; int len = rna_ensure_property_array_length(ptr, prop); - int value; + bool value; BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); BLI_assert(RNA_property_array_check(prop) != false); @@ -2337,9 +2342,9 @@ int RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index value = tmp[index]; } else { - int *tmparray; + bool *tmparray; - tmparray = MEM_mallocN(sizeof(int) * len, __func__); + tmparray = MEM_mallocN(sizeof(bool) * len, __func__); RNA_property_boolean_get_array(ptr, prop, tmparray); value = tmparray[index]; MEM_freeN(tmparray); @@ -2350,7 +2355,7 @@ int RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index return value; } -void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *values) +void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const bool *values) { BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop; IDProperty *idprop; @@ -2359,11 +2364,15 @@ void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const in BLI_assert(RNA_property_array_check(prop) != false); if ((idprop = rna_idproperty_check(&prop, ptr))) { - if (prop->arraydimension == 0) + if (prop->arraydimension == 0) { IDP_Int(idprop) = values[0]; - else - memcpy(IDP_Array(idprop), values, sizeof(int) * idprop->len); - + } + else { + int *values_dst = IDP_Array(idprop); + for (uint i = 0; i < idprop->len; i++) { + values_dst[i] = (int)values[i]; + } + } rna_idproperty_touch(idprop); } else if (prop->arraydimension == 0) @@ -2383,14 +2392,17 @@ void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const in if (group) { idprop = IDP_New(IDP_ARRAY, &val, prop->identifier); IDP_AddToGroup(group, idprop); - memcpy(IDP_Array(idprop), values, sizeof(int) * idprop->len); + int *values_dst = IDP_Array(idprop); + for (uint i = 0; i < idprop->len; i++) { + values_dst[i] = (int)values[i]; + } } } } -void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, int value) +void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, bool value) { - int tmp[RNA_MAX_ARRAY_LENGTH]; + bool tmp[RNA_MAX_ARRAY_LENGTH]; int len = rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); @@ -2405,9 +2417,9 @@ void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int inde RNA_property_boolean_set_array(ptr, prop, tmp); } else { - int *tmparray; + bool *tmparray; - tmparray = MEM_mallocN(sizeof(int) * len, __func__); + tmparray = MEM_mallocN(sizeof(bool) * len, __func__); RNA_property_boolean_get_array(ptr, prop, tmparray); tmparray[index] = value; RNA_property_boolean_set_array(ptr, prop, tmparray); @@ -2415,7 +2427,7 @@ void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int inde } } -int RNA_property_boolean_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop) +bool RNA_property_boolean_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop) { BoolPropertyRNA *bprop = (BoolPropertyRNA *)rna_ensure_property(prop); @@ -2426,7 +2438,7 @@ int RNA_property_boolean_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop) return bprop->defaultvalue; } -void RNA_property_boolean_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA *prop, int *values) +void RNA_property_boolean_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA *prop, bool *values) { BoolPropertyRNA *bprop = (BoolPropertyRNA *)rna_ensure_property(prop); @@ -2436,14 +2448,14 @@ void RNA_property_boolean_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA if (prop->arraydimension == 0) values[0] = bprop->defaultvalue; else if (bprop->defaultarray) - memcpy(values, bprop->defaultarray, sizeof(int) * prop->totarraylength); + memcpy(values, bprop->defaultarray, sizeof(bool) * prop->totarraylength); else - memset(values, 0, sizeof(int) * prop->totarraylength); + memset(values, 0, sizeof(bool) * prop->totarraylength); } -int RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index) +bool RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index) { - int tmp[RNA_MAX_ARRAY_LENGTH]; + bool tmp[RNA_MAX_ARRAY_LENGTH]; int len = rna_ensure_property_array_length(ptr, prop); BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN); @@ -2456,9 +2468,9 @@ int RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop, i return tmp[index]; } else { - int *tmparray, value; + bool *tmparray, value; - tmparray = MEM_mallocN(sizeof(int) * len, __func__); + tmparray = MEM_mallocN(sizeof(bool) * len, __func__); RNA_property_boolean_get_default_array(ptr, prop, tmparray); value = tmparray[index]; MEM_freeN(tmparray); @@ -3849,6 +3861,7 @@ int RNA_property_collection_raw_array(PointerRNA *ptr, PropertyRNA *prop, Proper case PROP_RAW_CHAR: var = (dtype)((char *)raw.array)[a]; break; \ case PROP_RAW_SHORT: var = (dtype)((short *)raw.array)[a]; break; \ case PROP_RAW_INT: var = (dtype)((int *)raw.array)[a]; break; \ + case PROP_RAW_BOOLEAN: var = (dtype)((bool *)raw.array)[a]; break; \ case PROP_RAW_FLOAT: var = (dtype)((float *)raw.array)[a]; break; \ case PROP_RAW_DOUBLE: var = (dtype)((double *)raw.array)[a]; break; \ default: var = (dtype)0; \ @@ -3861,6 +3874,7 @@ int RNA_property_collection_raw_array(PointerRNA *ptr, PropertyRNA *prop, Proper case PROP_RAW_CHAR: ((char *)raw.array)[a] = (char)var; break; \ case PROP_RAW_SHORT: ((short *)raw.array)[a] = (short)var; break; \ case PROP_RAW_INT: ((int *)raw.array)[a] = (int)var; break; \ + case PROP_RAW_BOOLEAN: ((bool *)raw.array)[a] = (bool)var; break; \ case PROP_RAW_FLOAT: ((float *)raw.array)[a] = (float)var; break; \ case PROP_RAW_DOUBLE: ((double *)raw.array)[a] = (double)var; break; \ default: break; \ @@ -3873,6 +3887,7 @@ int RNA_raw_type_sizeof(RawPropertyType type) case PROP_RAW_CHAR: return sizeof(char); case PROP_RAW_SHORT: return sizeof(short); case PROP_RAW_INT: return sizeof(int); + case PROP_RAW_BOOLEAN: return sizeof(bool); case PROP_RAW_FLOAT: return sizeof(float); case PROP_RAW_DOUBLE: return sizeof(double); default: return 0; @@ -3974,8 +3989,9 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro int err = 0, j, a = 0; int needconv = 1; - if (((itemtype == PROP_BOOLEAN || itemtype == PROP_INT) && in.type == PROP_RAW_INT) || - (itemtype == PROP_FLOAT && in.type == PROP_RAW_FLOAT)) + if (((itemtype == PROP_INT) && (in.type == PROP_RAW_INT)) || + ((itemtype == PROP_BOOLEAN) && (in.type == PROP_RAW_BOOLEAN)) || + ((itemtype == PROP_FLOAT) && (in.type == PROP_RAW_FLOAT))) { /* avoid creating temporary buffer if the data type match */ needconv = 0; @@ -4025,7 +4041,7 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro case PROP_BOOLEAN: { int b; - RAW_GET(int, b, in, a); + RAW_GET(bool, b, in, a); RNA_property_boolean_set(&itemptr, iprop, b); break; } @@ -4052,7 +4068,7 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro case PROP_BOOLEAN: { int b = RNA_property_boolean_get(&itemptr, iprop); - RAW_SET(int, in, a, b); + RAW_SET(bool, in, a, b); break; } case PROP_INT: @@ -4090,7 +4106,7 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro case PROP_BOOLEAN: { for (j = 0; j < itemlen; j++, a++) - RAW_GET(int, ((int *)tmparray)[j], in, a); + RAW_GET(bool, ((bool *)tmparray)[j], in, a); RNA_property_boolean_set_array(&itemptr, iprop, tmparray); break; } @@ -4118,7 +4134,7 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro { RNA_property_boolean_get_array(&itemptr, iprop, tmparray); for (j = 0; j < itemlen; j++, a++) - RAW_SET(int, in, a, ((int *)tmparray)[j]); + RAW_SET(int, in, a, ((bool *)tmparray)[j]); break; } case PROP_INT: @@ -4145,7 +4161,7 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro switch (itemtype) { case PROP_BOOLEAN: { - RNA_property_boolean_set_array(&itemptr, iprop, &((int *)in.array)[a]); + RNA_property_boolean_set_array(&itemptr, iprop, &((bool *)in.array)[a]); a += itemlen; break; } @@ -4169,7 +4185,7 @@ static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *pro switch (itemtype) { case PROP_BOOLEAN: { - RNA_property_boolean_get_array(&itemptr, iprop, &((int *)in.array)[a]); + RNA_property_boolean_get_array(&itemptr, iprop, &((bool *)in.array)[a]); a += itemlen; break; } @@ -4208,7 +4224,7 @@ RawPropertyType RNA_property_raw_type(PropertyRNA *prop) /* this property has no raw access, yet we try to provide a raw type to help building the array */ switch (prop->type) { case PROP_BOOLEAN: - return PROP_RAW_INT; + return PROP_RAW_BOOLEAN; case PROP_INT: return PROP_RAW_INT; case PROP_FLOAT: @@ -5479,7 +5495,7 @@ char *RNA_path_property_py(PointerRNA *UNUSED(ptr), PropertyRNA *prop, int index /* Quick name based property access */ -int RNA_boolean_get(PointerRNA *ptr, const char *name) +bool RNA_boolean_get(PointerRNA *ptr, const char *name) { PropertyRNA *prop = RNA_struct_find_property(ptr, name); @@ -5492,7 +5508,7 @@ int RNA_boolean_get(PointerRNA *ptr, const char *name) } } -void RNA_boolean_set(PointerRNA *ptr, const char *name, int value) +void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value) { PropertyRNA *prop = RNA_struct_find_property(ptr, name); @@ -5502,7 +5518,7 @@ void RNA_boolean_set(PointerRNA *ptr, const char *name, int value) printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } -void RNA_boolean_get_array(PointerRNA *ptr, const char *name, int *values) +void RNA_boolean_get_array(PointerRNA *ptr, const char *name, bool *values) { PropertyRNA *prop = RNA_struct_find_property(ptr, name); @@ -5512,7 +5528,7 @@ void RNA_boolean_get_array(PointerRNA *ptr, const char *name, int *values) printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); } -void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const int *values) +void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const bool *values) { PropertyRNA *prop = RNA_struct_find_property(ptr, name); @@ -6140,8 +6156,8 @@ char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop, in BLI_dynstr_append(dynstr, bool_as_py_string(RNA_property_boolean_get_index(ptr, prop, index))); } else { - int fixedbuf[RNA_MAX_ARRAY_LENGTH]; - int *buf = ARRAY_SIZE(fixedbuf) >= len ? fixedbuf : MEM_mallocN(sizeof(*buf) * len, __func__); + bool fixedbuf[RNA_MAX_ARRAY_LENGTH]; + bool *buf = ARRAY_SIZE(fixedbuf) >= len ? fixedbuf : MEM_mallocN(sizeof(*buf) * len, __func__); RNA_property_boolean_get_array(ptr, prop, buf); BLI_dynstr_append(dynstr, "("); @@ -6762,9 +6778,9 @@ static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, Prop } if (len == 0) - *((int *)dest) = *((int *)src); + *((bool *)dest) = *((bool *)src); else - memcpy(dest, src, len * sizeof(int)); + memcpy(dest, src, len * sizeof(bool)); break; } @@ -7112,7 +7128,7 @@ bool RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index) case PROP_BOOLEAN: if (len) { if (index == -1) { - int *tmparray = MEM_callocN(sizeof(int) * len, "reset_defaults - boolean"); + bool *tmparray = MEM_callocN(sizeof(bool) * len, "reset_defaults - boolean"); RNA_property_boolean_get_default_array(ptr, prop, tmparray); RNA_property_boolean_set_array(ptr, prop, tmparray); diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c index 4f2654bb30e..97c9d5a9866 100644 --- a/source/blender/makesrna/intern/rna_action.c +++ b/source/blender/makesrna/intern/rna_action.c @@ -223,7 +223,7 @@ static void rna_Action_frame_range_get(PointerRNA *ptr, float *values) /* used to check if an action (value pointer) is suitable to be assigned to the ID-block that is ptr */ -int rna_Action_id_poll(PointerRNA *ptr, PointerRNA value) +bool rna_Action_id_poll(PointerRNA *ptr, PointerRNA value) { ID *srcId = (ID *)ptr->id.data; bAction *act = (bAction *)value.id.data; @@ -243,7 +243,7 @@ int rna_Action_id_poll(PointerRNA *ptr, PointerRNA value) } /* used to check if an action (value pointer) can be assigned to Action Editor given current mode */ -int rna_Action_actedit_assign_poll(PointerRNA *ptr, PointerRNA value) +bool rna_Action_actedit_assign_poll(PointerRNA *ptr, PointerRNA value) { SpaceAction *saction = (SpaceAction *)ptr->data; bAction *act = (bAction *)value.id.data; diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index 7b14c6960b5..3faf8710d6e 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -139,7 +139,7 @@ static void rna_AnimData_tweakmode_set(PointerRNA *ptr, const int value) /* ****************************** */ /* wrapper for poll callback */ -static int RKS_POLL_rna_internal(KeyingSetInfo *ksi, bContext *C) +static bool RKS_POLL_rna_internal(KeyingSetInfo *ksi, bContext *C) { extern FunctionRNA rna_KeyingSetInfo_poll_func; @@ -163,7 +163,7 @@ static int RKS_POLL_rna_internal(KeyingSetInfo *ksi, bContext *C) /* read the result */ RNA_parameter_get_lookup(&list, "ok", &ret); - ok = *(int *)ret; + ok = *(bool *)ret; } RNA_parameter_list_free(&list); diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index 7e936fd1e5c..596667a0afd 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -259,7 +259,7 @@ static void rna_Armature_layer_used_refresh(bArmature *arm, ListBase *bones) } } -static void rna_bone_layer_set(int *layer, const int *values) +static void rna_bone_layer_set(int *layer, const bool *values) { int i, tot = 0; @@ -277,7 +277,7 @@ static void rna_bone_layer_set(int *layer, const int *values) } } -static void rna_Bone_layer_set(PointerRNA *ptr, const int *values) +static void rna_Bone_layer_set(PointerRNA *ptr, const bool *values) { bArmature *arm = (bArmature *)ptr->id.data; Bone *bone = (Bone *)ptr->data; @@ -288,7 +288,7 @@ static void rna_Bone_layer_set(PointerRNA *ptr, const int *values) rna_Armature_layer_used_refresh(arm, &arm->bonebase); } -static void rna_Armature_layer_set(PointerRNA *ptr, const int *values) +static void rna_Armature_layer_set(PointerRNA *ptr, const bool *values) { bArmature *arm = (bArmature *)ptr->data; int i, tot = 0; @@ -359,7 +359,7 @@ static void rna_Bone_name_set(PointerRNA *ptr, const char *value) ED_armature_bone_rename(G_MAIN, arm, oldname, newname); } -static void rna_EditBone_layer_set(PointerRNA *ptr, const int values[]) +static void rna_EditBone_layer_set(PointerRNA *ptr, const bool values[]) { EditBone *data = (EditBone *)(ptr->data); rna_bone_layer_set(&data->layer, values); diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index a01f2afa26e..1a0dc6dfea6 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -396,7 +396,7 @@ static void rna_SplineIKConstraint_joint_bindings_set(PointerRNA *ptr, const flo memcpy(ikData->points, values, ikData->numpoints * sizeof(float)); } -static int rna_Constraint_cameraObject_poll(PointerRNA *ptr, PointerRNA value) +static bool rna_Constraint_cameraObject_poll(PointerRNA *ptr, PointerRNA value) { Object *ob = (Object *)value.data; @@ -443,7 +443,7 @@ static void rna_Constraint_followTrack_depthObject_set(PointerRNA *ptr, PointerR } } -static int rna_Constraint_followTrack_depthObject_poll(PointerRNA *ptr, PointerRNA value) +static bool rna_Constraint_followTrack_depthObject_poll(PointerRNA *ptr, PointerRNA value) { Object *ob = (Object *)value.data; diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index 0681a449aa2..2feeba668ce 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -395,7 +395,7 @@ static void rna_Curve_bevelObject_set(PointerRNA *ptr, PointerRNA value) } } -static int rna_Curve_otherObject_poll(PointerRNA *ptr, PointerRNA value) +static bool rna_Curve_otherObject_poll(PointerRNA *ptr, PointerRNA value) { Curve *cu = (Curve *)ptr->id.data; Object *ob = (Object *)value.data; diff --git a/source/blender/makesrna/intern/rna_curve_api.c b/source/blender/makesrna/intern/rna_curve_api.c index b518b0cb5b0..b0c07465958 100644 --- a/source/blender/makesrna/intern/rna_curve_api.c +++ b/source/blender/makesrna/intern/rna_curve_api.c @@ -43,7 +43,7 @@ #include "rna_internal.h" /* own include */ #ifdef RNA_RUNTIME -static void rna_Curve_transform(Curve *cu, float *mat, int shape_keys) +static void rna_Curve_transform(Curve *cu, float *mat, bool shape_keys) { BKE_curve_transform(cu, (float (*)[4])mat, shape_keys, true); diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 5b91a3e43d2..c84ce56c58b 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -1651,7 +1651,7 @@ void RNA_def_property_string_maxlength(PropertyRNA *prop, int maxlength) } } -void RNA_def_property_boolean_default(PropertyRNA *prop, int value) +void RNA_def_property_boolean_default(PropertyRNA *prop, bool value) { StructRNA *srna = DefRNA.laststruct; @@ -1670,7 +1670,7 @@ void RNA_def_property_boolean_default(PropertyRNA *prop, int value) } } -void RNA_def_property_boolean_array_default(PropertyRNA *prop, const int *array) +void RNA_def_property_boolean_array_default(PropertyRNA *prop, const bool *array) { StructRNA *srna = DefRNA.laststruct; @@ -2665,7 +2665,7 @@ void RNA_def_py_data(PropertyRNA *prop, void *py_data) /* Compact definitions */ -PropertyRNA *RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, int default_value, +PropertyRNA *RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description) { ContainerRNA *cont = cont_; @@ -2678,7 +2678,7 @@ PropertyRNA *RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, return prop; } -PropertyRNA *RNA_def_boolean_array(StructOrFunctionRNA *cont_, const char *identifier, int len, int *default_value, +PropertyRNA *RNA_def_boolean_array(StructOrFunctionRNA *cont_, const char *identifier, int len, bool *default_value, const char *ui_name, const char *ui_description) { ContainerRNA *cont = cont_; @@ -2692,7 +2692,7 @@ PropertyRNA *RNA_def_boolean_array(StructOrFunctionRNA *cont_, const char *ident return prop; } -PropertyRNA *RNA_def_boolean_layer(StructOrFunctionRNA *cont_, const char *identifier, int len, int *default_value, +PropertyRNA *RNA_def_boolean_layer(StructOrFunctionRNA *cont_, const char *identifier, int len, bool *default_value, const char *ui_name, const char *ui_description) { ContainerRNA *cont = cont_; @@ -2707,7 +2707,7 @@ PropertyRNA *RNA_def_boolean_layer(StructOrFunctionRNA *cont_, const char *ident } PropertyRNA *RNA_def_boolean_layer_member(StructOrFunctionRNA *cont_, const char *identifier, int len, - int *default_value, const char *ui_name, const char *ui_description) + bool *default_value, const char *ui_name, const char *ui_description) { ContainerRNA *cont = cont_; PropertyRNA *prop; @@ -2720,7 +2720,7 @@ PropertyRNA *RNA_def_boolean_layer_member(StructOrFunctionRNA *cont_, const char return prop; } -PropertyRNA *RNA_def_boolean_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, int *default_value, +PropertyRNA *RNA_def_boolean_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, bool *default_value, const char *ui_name, const char *ui_description) { ContainerRNA *cont = cont_; @@ -3259,6 +3259,7 @@ int rna_parameter_size(PropertyRNA *parm) if (len > 0) { switch (ptype) { case PROP_BOOLEAN: + return sizeof(bool) * len; case PROP_INT: return sizeof(int) * len; case PROP_FLOAT: @@ -3270,6 +3271,7 @@ int rna_parameter_size(PropertyRNA *parm) else { switch (ptype) { case PROP_BOOLEAN: + return sizeof(bool); case PROP_INT: case PROP_ENUM: return sizeof(int); @@ -3430,9 +3432,6 @@ void RNA_def_func_free_pointers(FunctionRNA *func) void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA *prop) { ContainerRNA *cont = cont_; - EnumPropertyItem *earray; - float *farray; - int *iarray; int a; /* annoying since we just added this to a hash, could make this add the correct key to the hash @@ -3447,8 +3446,12 @@ void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA } } - if (prop->name) prop->name = BLI_strdup(prop->name); - if (prop->description) prop->description = BLI_strdup(prop->description); + if (prop->name) { + prop->name = BLI_strdup(prop->name); + } + if (prop->description) { + prop->description = BLI_strdup(prop->description); + } switch (prop->type) { case PROP_BOOLEAN: @@ -3456,9 +3459,9 @@ void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop; if (bprop->defaultarray) { - iarray = MEM_callocN(sizeof(int) * prop->totarraylength, "RNA_def_property_store"); - memcpy(iarray, bprop->defaultarray, sizeof(int) * prop->totarraylength); - bprop->defaultarray = iarray; + bool *array = MEM_mallocN(sizeof(bool) * prop->totarraylength, "RNA_def_property_store"); + memcpy(array, bprop->defaultarray, sizeof(bool) * prop->totarraylength); + bprop->defaultarray = array; } break; } @@ -3467,9 +3470,9 @@ void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA IntPropertyRNA *iprop = (IntPropertyRNA *)prop; if (iprop->defaultarray) { - iarray = MEM_callocN(sizeof(int) * prop->totarraylength, "RNA_def_property_store"); - memcpy(iarray, iprop->defaultarray, sizeof(int) * prop->totarraylength); - iprop->defaultarray = iarray; + int *array = MEM_mallocN(sizeof(int) * prop->totarraylength, "RNA_def_property_store"); + memcpy(array, iprop->defaultarray, sizeof(int) * prop->totarraylength); + iprop->defaultarray = array; } break; } @@ -3478,17 +3481,20 @@ void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop; if (eprop->item) { - earray = MEM_callocN(sizeof(EnumPropertyItem) * (eprop->totitem + 1), "RNA_def_property_store"); - memcpy(earray, eprop->item, sizeof(EnumPropertyItem) * (eprop->totitem + 1)); - eprop->item = earray; + EnumPropertyItem *array = MEM_mallocN(sizeof(EnumPropertyItem) * (eprop->totitem + 1), "RNA_def_property_store"); + memcpy(array, eprop->item, sizeof(EnumPropertyItem) * (eprop->totitem + 1)); + eprop->item = array; for (a = 0; a < eprop->totitem; a++) { - if (earray[a].identifier) - earray[a].identifier = BLI_strdup(earray[a].identifier); - if (earray[a].name) - earray[a].name = BLI_strdup(earray[a].name); - if (earray[a].description) - earray[a].description = BLI_strdup(earray[a].description); + if (array[a].identifier) { + array[a].identifier = BLI_strdup(array[a].identifier); + } + if (array[a].name) { + array[a].name = BLI_strdup(array[a].name); + } + if (array[a].description) { + array[a].description = BLI_strdup(array[a].description); + } } } break; @@ -3498,9 +3504,9 @@ void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop; if (fprop->defaultarray) { - farray = MEM_callocN(sizeof(float) * prop->totarraylength, "RNA_def_property_store"); - memcpy(farray, fprop->defaultarray, sizeof(float) * prop->totarraylength); - fprop->defaultarray = farray; + float *array = MEM_mallocN(sizeof(float) * prop->totarraylength, "RNA_def_property_store"); + memcpy(array, fprop->defaultarray, sizeof(float) * prop->totarraylength); + fprop->defaultarray = array; } break; } diff --git a/source/blender/makesrna/intern/rna_depsgraph.c b/source/blender/makesrna/intern/rna_depsgraph.c index 3e85e225d27..eb069b5e069 100644 --- a/source/blender/makesrna/intern/rna_depsgraph.c +++ b/source/blender/makesrna/intern/rna_depsgraph.c @@ -338,7 +338,7 @@ static ID *rna_Depsgraph_id_eval_get(Depsgraph *depsgraph, ID *id_orig) return DEG_get_evaluated_id(depsgraph, id_orig); } -static int rna_Depsgraph_id_type_updated(Depsgraph *depsgraph, int id_type) +static bool rna_Depsgraph_id_type_updated(Depsgraph *depsgraph, int id_type) { return DEG_id_type_updated(depsgraph, id_type); } diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c index 509265c04df..2801b292df6 100644 --- a/source/blender/makesrna/intern/rna_dynamicpaint.c +++ b/source/blender/makesrna/intern/rna_dynamicpaint.c @@ -240,7 +240,7 @@ static int rna_DynamicPaint_use_color_preview_get(PointerRNA *ptr) } /* does output layer exist*/ -static int rna_DynamicPaint_is_output_exists(DynamicPaintSurface *surface, Object *ob, int index) +static bool rna_DynamicPaint_is_output_exists(DynamicPaintSurface *surface, Object *ob, int index) { return dynamicPaint_outputLayerExists(surface, ob, index); } diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 64d6960d0ff..f70ce67f1b0 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -853,7 +853,7 @@ static void rna_FKeyframe_points_add(FCurve *fcu, int tot) } } -static void rna_FKeyframe_points_remove(FCurve *fcu, ReportList *reports, PointerRNA *bezt_ptr, int do_fast) +static void rna_FKeyframe_points_remove(FCurve *fcu, ReportList *reports, PointerRNA *bezt_ptr, bool do_fast) { BezTriple *bezt = bezt_ptr->data; int index = (int)(bezt - fcu->bezt); diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c index cd7081d07a8..2418102d94c 100644 --- a/source/blender/makesrna/intern/rna_gpencil.c +++ b/source/blender/makesrna/intern/rna_gpencil.c @@ -591,7 +591,7 @@ static bGPDframe *rna_GPencil_frame_copy(bGPDlayer *layer, bGPDframe *src) return frame; } -static bGPDlayer *rna_GPencil_layer_new(bGPdata *gpd, const char *name, int setactive) +static bGPDlayer *rna_GPencil_layer_new(bGPdata *gpd, const char *name, bool setactive) { bGPDlayer *gpl = BKE_gpencil_layer_addnew(gpd, name, setactive != 0); @@ -636,7 +636,7 @@ static void rna_GPencil_clear(bGPdata *gpd) } /* Palettes */ -static bGPDpalette *rna_GPencil_palette_new(bGPdata *gpd, const char *name, int setactive) +static bGPDpalette *rna_GPencil_palette_new(bGPdata *gpd, const char *name, bool setactive) { bGPDpalette *palette = BKE_gpencil_palette_addnew(gpd, name, setactive != 0); diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index 1d2c36e3e3e..70b75efdb36 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -148,7 +148,7 @@ static void rna_Image_save(Image *image, Main *bmain, bContext *C, ReportList *r static void rna_Image_pack( Image *image, Main *bmain, bContext *C, ReportList *reports, - int as_png, const char *data, int data_len) + bool as_png, const char *data, int data_len) { ImBuf *ibuf = BKE_image_acquire_ibuf(image, NULL, NULL); diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index 5ab1297f43c..5784b2a489a 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -280,16 +280,16 @@ void rna_Mesh_update_draw(struct Main *bmain, struct Scene *scene, struct Pointe void rna_TextureSlot_update(struct bContext *C, struct PointerRNA *ptr); /* basic poll functions for object types */ -int rna_Armature_object_poll(struct PointerRNA *ptr, struct PointerRNA value); -int rna_Camera_object_poll(struct PointerRNA *ptr, struct PointerRNA value); -int rna_Curve_object_poll(struct PointerRNA *ptr, struct PointerRNA value); -int rna_Lamp_object_poll(struct PointerRNA *ptr, struct PointerRNA value); -int rna_Lattice_object_poll(struct PointerRNA *ptr, struct PointerRNA value); -int rna_Mesh_object_poll(struct PointerRNA *ptr, struct PointerRNA value); +bool rna_Armature_object_poll(struct PointerRNA *ptr, struct PointerRNA value); +bool rna_Camera_object_poll(struct PointerRNA *ptr, struct PointerRNA value); +bool rna_Curve_object_poll(struct PointerRNA *ptr, struct PointerRNA value); +bool rna_Lamp_object_poll(struct PointerRNA *ptr, struct PointerRNA value); +bool rna_Lattice_object_poll(struct PointerRNA *ptr, struct PointerRNA value); +bool rna_Mesh_object_poll(struct PointerRNA *ptr, struct PointerRNA value); /* basic poll functions for actions (to prevent actions getting set in wrong places) */ -int rna_Action_id_poll(struct PointerRNA *ptr, struct PointerRNA value); -int rna_Action_actedit_assign_poll(struct PointerRNA *ptr, struct PointerRNA value); +bool rna_Action_id_poll(struct PointerRNA *ptr, struct PointerRNA value); +bool rna_Action_actedit_assign_poll(struct PointerRNA *ptr, struct PointerRNA value); char *rna_TextureSlot_path(struct PointerRNA *ptr); char *rna_Node_ImageUser_path(struct PointerRNA *ptr); @@ -482,7 +482,7 @@ int rna_parameter_size(struct PropertyRNA *parm); struct Mesh *rna_Main_meshes_new_from_object( struct Main *bmain, struct ReportList *reports, struct Depsgraph *depsgraph, - struct Object *ob, int apply_modifiers, int calc_tessface, int calc_undeformed); + struct Object *ob, bool apply_modifiers, bool calc_tessface, bool calc_undeformed); /* XXX, these should not need to be defined here~! */ struct MTex *rna_mtex_texture_slots_add(struct ID *self, struct bContext *C, struct ReportList *reports); @@ -493,7 +493,7 @@ void rna_mtex_texture_slots_clear(struct ID *self, struct bContext *C, struct Re int rna_IDMaterials_assign_int(struct PointerRNA *ptr, int key, const struct PointerRNA *assign_ptr); const char *rna_translate_ui_text( - const char *text, const char *text_ctxt, struct StructRNA *type, struct PropertyRNA *prop, int translate); + const char *text, const char *text_ctxt, struct StructRNA *type, struct PropertyRNA *prop, bool translate); /* Internal functions that cycles uses so we need to declare (tsk tsk) */ void rna_RenderLayer_rect_set(PointerRNA *ptr, const float *values); diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h index fcca0c0a3ab..f03752968c9 100644 --- a/source/blender/makesrna/intern/rna_internal_types.h +++ b/source/blender/makesrna/intern/rna_internal_types.h @@ -63,10 +63,10 @@ typedef struct StructRNA *(*StructRefineFunc)(struct PointerRNA *ptr); typedef char *(*StructPathFunc)(struct PointerRNA *ptr); typedef int (*PropArrayLengthGetFunc)(struct PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION]); -typedef int (*PropBooleanGetFunc)(struct PointerRNA *ptr); -typedef void (*PropBooleanSetFunc)(struct PointerRNA *ptr, int value); -typedef void (*PropBooleanArrayGetFunc)(struct PointerRNA *ptr, int *values); -typedef void (*PropBooleanArraySetFunc)(struct PointerRNA *ptr, const int *values); +typedef bool (*PropBooleanGetFunc)(struct PointerRNA *ptr); +typedef void (*PropBooleanSetFunc)(struct PointerRNA *ptr, bool value); +typedef void (*PropBooleanArrayGetFunc)(struct PointerRNA *ptr, bool *values); +typedef void (*PropBooleanArraySetFunc)(struct PointerRNA *ptr, const bool *values); typedef int (*PropIntGetFunc)(struct PointerRNA *ptr); typedef void (*PropIntSetFunc)(struct PointerRNA *ptr, int value); typedef void (*PropIntArrayGetFunc)(struct PointerRNA *ptr, int *values); @@ -88,8 +88,8 @@ typedef const EnumPropertyItem *(*PropEnumItemFunc)( typedef PointerRNA (*PropPointerGetFunc)(struct PointerRNA *ptr); typedef StructRNA *(*PropPointerTypeFunc)(struct PointerRNA *ptr); typedef void (*PropPointerSetFunc)(struct PointerRNA *ptr, const PointerRNA value); -typedef int (*PropPointerPollFunc)(struct PointerRNA *ptr, const PointerRNA value); -typedef int (*PropPointerPollFuncPy)(struct PointerRNA *ptr, const PointerRNA value, const PropertyRNA *prop); +typedef bool (*PropPointerPollFunc)(struct PointerRNA *ptr, const PointerRNA value); +typedef bool (*PropPointerPollFuncPy)(struct PointerRNA *ptr, const PointerRNA value, const PropertyRNA *prop); typedef void (*PropCollectionBeginFunc)(struct CollectionPropertyIterator *iter, struct PointerRNA *ptr); typedef void (*PropCollectionNextFunc)(struct CollectionPropertyIterator *iter); typedef void (*PropCollectionEndFunc)(struct CollectionPropertyIterator *iter); @@ -100,10 +100,10 @@ typedef int (*PropCollectionLookupStringFunc)(struct PointerRNA *ptr, const char typedef int (*PropCollectionAssignIntFunc)(struct PointerRNA *ptr, int key, const struct PointerRNA *assign_ptr); /* extended versions with PropertyRNA argument */ -typedef int (*PropBooleanGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop); -typedef void (*PropBooleanSetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, int value); -typedef void (*PropBooleanArrayGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, int *values); -typedef void (*PropBooleanArraySetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, const int *values); +typedef bool (*PropBooleanGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop); +typedef void (*PropBooleanSetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, bool value); +typedef void (*PropBooleanArrayGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, bool *values); +typedef void (*PropBooleanArraySetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, const bool *values); typedef int (*PropIntGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop); typedef void (*PropIntSetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, int value); typedef void (*PropIntArrayGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, int *values); @@ -294,8 +294,8 @@ typedef struct BoolPropertyRNA { PropBooleanArrayGetFuncEx getarray_ex; PropBooleanArraySetFuncEx setarray_ex; - int defaultvalue; - const int *defaultarray; + bool defaultvalue; + const bool *defaultarray; } BoolPropertyRNA; typedef struct IntPropertyRNA { diff --git a/source/blender/makesrna/intern/rna_lattice_api.c b/source/blender/makesrna/intern/rna_lattice_api.c index 5637f8d9248..231c5ce0c36 100644 --- a/source/blender/makesrna/intern/rna_lattice_api.c +++ b/source/blender/makesrna/intern/rna_lattice_api.c @@ -41,7 +41,7 @@ #include "rna_internal.h" /* own include */ #ifdef RNA_RUNTIME -static void rna_Lattice_transform(Lattice *lt, float *mat, int shape_keys) +static void rna_Lattice_transform(Lattice *lt, float *mat, bool shape_keys) { BKE_lattice_transform(lt, (float (*)[4])mat, shape_keys); diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c index 835d6e5117f..fff53aafcc7 100644 --- a/source/blender/makesrna/intern/rna_main_api.c +++ b/source/blender/makesrna/intern/rna_main_api.c @@ -129,8 +129,9 @@ static void rna_idname_validate(const char *name, char *r_name) } -static void rna_Main_ID_remove(Main *bmain, ReportList *reports, PointerRNA *id_ptr, - int do_unlink, int do_id_user, int do_ui_user) +static void rna_Main_ID_remove( + Main *bmain, ReportList *reports, PointerRNA *id_ptr, + bool do_unlink, bool do_id_user, bool do_ui_user) { ID *id = id_ptr->data; if (do_unlink) { @@ -166,7 +167,7 @@ static Scene *rna_Main_scenes_new(Main *bmain, const char *name) return BKE_scene_add(bmain, safe_name); } -static void rna_Main_scenes_remove(Main *bmain, bContext *C, ReportList *reports, PointerRNA *scene_ptr, int do_unlink) +static void rna_Main_scenes_remove(Main *bmain, bContext *C, ReportList *reports, PointerRNA *scene_ptr, bool do_unlink) { /* don't call BKE_libblock_free(...) directly */ Scene *scene = scene_ptr->data; @@ -299,7 +300,7 @@ static Mesh *rna_Main_meshes_new(Main *bmain, const char *name) /* copied from Mesh_getFromObject and adapted to RNA interface */ Mesh *rna_Main_meshes_new_from_object( Main *bmain, ReportList *reports, Depsgraph *depsgraph, - Object *ob, int apply_modifiers, int calc_tessface, int calc_undeformed) + Object *ob, bool apply_modifiers, bool calc_tessface, bool calc_undeformed) { Scene *sce = DEG_get_evaluated_scene(depsgraph); @@ -329,7 +330,7 @@ static Lamp *rna_Main_lamps_new(Main *bmain, const char *name, int type) return lamp; } -static Image *rna_Main_images_new(Main *bmain, const char *name, int width, int height, int alpha, int float_buffer, int stereo3d) +static Image *rna_Main_images_new(Main *bmain, const char *name, int width, int height, bool alpha, bool float_buffer, bool stereo3d) { char safe_name[MAX_ID_NAME - 2]; rna_idname_validate(name, safe_name); @@ -339,7 +340,7 @@ static Image *rna_Main_images_new(Main *bmain, const char *name, int width, int id_us_min(&image->id); return image; } -static Image *rna_Main_images_load(Main *bmain, ReportList *reports, const char *filepath, int check_existing) +static Image *rna_Main_images_load(Main *bmain, ReportList *reports, const char *filepath, bool check_existing) { Image *ima; @@ -390,7 +391,7 @@ static MetaBall *rna_Main_metaballs_new(Main *bmain, const char *name) return mb; } -static VFont *rna_Main_fonts_load(Main *bmain, ReportList *reports, const char *filepath, int check_existing) +static VFont *rna_Main_fonts_load(Main *bmain, ReportList *reports, const char *filepath, bool check_existing) { VFont *font; errno = 0; @@ -460,7 +461,7 @@ static Speaker *rna_Main_speakers_new(Main *bmain, const char *name) return speaker; } -static bSound *rna_Main_sounds_load(Main *bmain, const char *name, int check_existing) +static bSound *rna_Main_sounds_load(Main *bmain, const char *name, bool check_existing) { bSound *sound; @@ -483,7 +484,7 @@ static Text *rna_Main_texts_new(Main *bmain, const char *name) return BKE_text_add(bmain, safe_name); } -static Text *rna_Main_texts_load(Main *bmain, ReportList *reports, const char *filepath, int is_internal) +static Text *rna_Main_texts_load(Main *bmain, ReportList *reports, const char *filepath, bool is_internal) { Text *txt; @@ -537,7 +538,7 @@ static Palette *rna_Main_palettes_new(Main *bmain, const char *name) return (Palette *)palette; } -static MovieClip *rna_Main_movieclip_load(Main *bmain, ReportList *reports, const char *filepath, int check_existing) +static MovieClip *rna_Main_movieclip_load(Main *bmain, ReportList *reports, const char *filepath, bool check_existing) { MovieClip *clip; @@ -592,7 +593,7 @@ static LightProbe *rna_Main_lightprobe_new(Main *bmain, const char *name) /* tag functions, all the same */ #define RNA_MAIN_ID_TAG_FUNCS_DEF(_func_name, _listbase_name, _id_type) \ - static void rna_Main_##_func_name##_tag(Main *bmain, int value) { \ + static void rna_Main_##_func_name##_tag(Main *bmain, bool value) { \ BKE_main_id_tag_listbase(&bmain->_listbase_name, LIB_TAG_DOIT, value); \ } \ diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c index ed19877ec0f..0087a154f88 100644 --- a/source/blender/makesrna/intern/rna_mesh_api.c +++ b/source/blender/makesrna/intern/rna_mesh_api.c @@ -101,12 +101,12 @@ static void rna_Mesh_free_tangents(Mesh *mesh) CustomData_free_layers(&mesh->ldata, CD_MLOOPTANGENT, mesh->totloop); } -static void rna_Mesh_calc_tessface(Mesh *mesh, int free_mpoly) +static void rna_Mesh_calc_tessface(Mesh *mesh, bool free_mpoly) { ED_mesh_calc_tessface(mesh, free_mpoly != 0); } -static void rna_Mesh_calc_smooth_groups(Mesh *mesh, int use_bitflags, int *r_poly_group_len, +static void rna_Mesh_calc_smooth_groups(Mesh *mesh, bool use_bitflags, int *r_poly_group_len, int **r_poly_group, int *r_group_total) { *r_poly_group_len = mesh->totpoly; @@ -194,7 +194,7 @@ static void rna_Mesh_normals_split_custom_set_from_vertices( DEG_id_tag_update(&mesh->id, 0); } -static void rna_Mesh_transform(Mesh *mesh, float *mat, int shape_keys) +static void rna_Mesh_transform(Mesh *mesh, float *mat, bool shape_keys) { BKE_mesh_transform(mesh, (float (*)[4])mat, shape_keys); @@ -210,7 +210,7 @@ static void rna_Mesh_flip_normals(Mesh *mesh) DEG_id_tag_update(&mesh->id, 0); } -static void rna_Mesh_split_faces(Mesh *mesh, int free_loop_normals) +static void rna_Mesh_split_faces(Mesh *mesh, bool free_loop_normals) { BKE_mesh_split_faces(mesh, free_loop_normals != 0); } diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c index 48ebc02cee0..f0001852da2 100644 --- a/source/blender/makesrna/intern/rna_modifier.c +++ b/source/blender/makesrna/intern/rna_modifier.c @@ -1152,7 +1152,7 @@ static void rna_MeshSequenceCache_object_path_update(Main *bmain, Scene *scene, rna_Modifier_update(bmain, scene, ptr); } -static int rna_ParticleInstanceModifier_particle_system_poll(PointerRNA *ptr, const PointerRNA value) +static bool rna_ParticleInstanceModifier_particle_system_poll(PointerRNA *ptr, const PointerRNA value) { ParticleInstanceModifierData *psmd = ptr->data; ParticleSystem *psys = value.data; @@ -1161,7 +1161,7 @@ static int rna_ParticleInstanceModifier_particle_system_poll(PointerRNA *ptr, co return false; /* make sure psys is in the object */ - return BLI_findindex(&psmd->ob->particlesystem, psys) >= 0; + return BLI_findindex(&psmd->ob->particlesystem, psys) != -1; } static PointerRNA rna_ParticleInstanceModifier_particle_system_get(PointerRNA *ptr) diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 56065df45bb..492335d4d25 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -249,7 +249,7 @@ bNodeTreeType *rna_node_tree_type_from_enum(int value) return result; } -const EnumPropertyItem *rna_node_tree_type_itemf(void *data, int (*poll)(void *data, bNodeTreeType *), bool *r_free) +const EnumPropertyItem *rna_node_tree_type_itemf(void *data, bool (*poll)(void *data, bNodeTreeType *), bool *r_free) { EnumPropertyItem tmp = {0}; EnumPropertyItem *item = NULL; @@ -325,7 +325,7 @@ bNodeType *rna_node_type_from_enum(int value) return result; } -const EnumPropertyItem *rna_node_type_itemf(void *data, int (*poll)(void *data, bNodeType *), bool *r_free) +const EnumPropertyItem *rna_node_type_itemf(void *data, bool (*poll)(void *data, bNodeType *), bool *r_free) { EnumPropertyItem *item = NULL; EnumPropertyItem tmp = {0}; @@ -400,7 +400,7 @@ bNodeSocketType *rna_node_socket_type_from_enum(int value) } const EnumPropertyItem *rna_node_socket_type_itemf( - void *data, int (*poll)(void *data, bNodeSocketType *), bool *r_free) + void *data, bool (*poll)(void *data, bNodeSocketType *), bool *r_free) { EnumPropertyItem *item = NULL; EnumPropertyItem tmp = {0}; @@ -532,7 +532,7 @@ static StructRNA *rna_NodeTree_refine(struct PointerRNA *ptr) return &RNA_NodeTree; } -static int rna_NodeTree_poll(const bContext *C, bNodeTreeType *ntreetype) +static bool rna_NodeTree_poll(const bContext *C, bNodeTreeType *ntreetype) { extern FunctionRNA rna_NodeTree_poll_func; @@ -550,7 +550,7 @@ static int rna_NodeTree_poll(const bContext *C, bNodeTreeType *ntreetype) ntreetype->ext.call((bContext *)C, &ptr, func, &list); RNA_parameter_get_lookup(&list, "visible", &ret); - visible = *(int *)ret; + visible = *(bool *)ret; RNA_parameter_list_free(&list); @@ -794,7 +794,7 @@ static void rna_NodeTree_active_node_set(PointerRNA *ptr, const PointerRNA value static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, Main *bmain, ReportList *reports, bNodeSocket *fromsock, bNodeSocket *tosock, - int verify_limits) + bool verify_limits) { bNodeLink *ret; bNode *fromnode = NULL, *tonode = NULL; @@ -1146,7 +1146,7 @@ char *rna_Node_ImageUser_path(PointerRNA *ptr) return NULL; } -static int rna_Node_poll(bNodeType *ntype, bNodeTree *ntree) +static bool rna_Node_poll(bNodeType *ntype, bNodeTree *ntree) { extern FunctionRNA rna_Node_poll_func; @@ -1154,7 +1154,7 @@ static int rna_Node_poll(bNodeType *ntype, bNodeTree *ntree) ParameterList list; FunctionRNA *func; void *ret; - int visible; + bool visible; RNA_pointer_create(NULL, ntype->ext.srna, NULL, &ptr); /* dummy */ func = &rna_Node_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */ @@ -1164,14 +1164,14 @@ static int rna_Node_poll(bNodeType *ntype, bNodeTree *ntree) ntype->ext.call(NULL, &ptr, func, &list); RNA_parameter_get_lookup(&list, "visible", &ret); - visible = *(int *)ret; + visible = *(bool *)ret; RNA_parameter_list_free(&list); return visible; } -static int rna_Node_poll_instance(bNode *node, bNodeTree *ntree) +static bool rna_Node_poll_instance(bNode *node, bNodeTree *ntree) { extern FunctionRNA rna_Node_poll_instance_func; @@ -1179,7 +1179,7 @@ static int rna_Node_poll_instance(bNode *node, bNodeTree *ntree) ParameterList list; FunctionRNA *func; void *ret; - int visible; + bool visible; RNA_pointer_create(NULL, node->typeinfo->ext.srna, node, &ptr); /* dummy */ func = &rna_Node_poll_instance_func; /* RNA_struct_find_function(&ptr, "poll_instance"); */ @@ -1189,14 +1189,14 @@ static int rna_Node_poll_instance(bNode *node, bNodeTree *ntree) node->typeinfo->ext.call(NULL, &ptr, func, &list); RNA_parameter_get_lookup(&list, "visible", &ret); - visible = *(int *)ret; + visible = *(bool *)ret; RNA_parameter_list_free(&list); return visible; } -static int rna_Node_poll_instance_default(bNode *node, bNodeTree *ntree) +static bool rna_Node_poll_instance_default(bNode *node, bNodeTree *ntree) { /* use the basic poll function */ return rna_Node_poll(node->typeinfo, ntree); @@ -1345,7 +1345,7 @@ static void rna_Node_draw_label(bNodeTree *ntree, bNode *node, char *label, int RNA_parameter_list_free(&list); } -static int rna_Node_is_registered_node_type(StructRNA *type) +static bool rna_Node_is_registered_node_type(StructRNA *type) { return (RNA_struct_blender_type_get(type) != NULL); } @@ -1562,7 +1562,7 @@ static void rna_Node_parent_set(PointerRNA *ptr, PointerRNA value) } } -static int rna_Node_parent_poll(PointerRNA *ptr, PointerRNA value) +static bool rna_Node_parent_poll(PointerRNA *ptr, PointerRNA value) { bNode *node = ptr->data; bNode *parent = value.data; @@ -2397,13 +2397,13 @@ static PointerRNA rna_NodeInternal_output_template(StructRNA *srna, int index) return PointerRNA_NULL; } -static int rna_NodeInternal_poll(StructRNA *srna, bNodeTree *ntree) +static bool rna_NodeInternal_poll(StructRNA *srna, bNodeTree *ntree) { bNodeType *ntype = RNA_struct_blender_type_get(srna); return ntype && (!ntype->poll || ntype->poll(ntype, ntree)); } -static int rna_NodeInternal_poll_instance(bNode *node, bNodeTree *ntree) +static bool rna_NodeInternal_poll_instance(bNode *node, bNodeTree *ntree) { bNodeType *ntype = node->typeinfo; if (ntype->poll_instance) { @@ -2506,7 +2506,7 @@ static void rna_NodeGroup_node_tree_set(PointerRNA *ptr, const PointerRNA value) } } -static int rna_NodeGroup_node_tree_poll(PointerRNA *ptr, const PointerRNA value) +static bool rna_NodeGroup_node_tree_poll(PointerRNA *ptr, const PointerRNA value) { bNodeTree *ntree = ptr->id.data; bNodeTree *ngroup = value.data; diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index e75a03edac1..04f4c41659d 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -1421,32 +1421,32 @@ static void rna_FaceMap_face_remove(ID *id, bFaceMap *fmap, ReportList *reports, } /* generic poll functions */ -int rna_Lattice_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value) +bool rna_Lattice_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value) { return ((Object *)value.id.data)->type == OB_LATTICE; } -int rna_Curve_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value) +bool rna_Curve_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value) { return ((Object *)value.id.data)->type == OB_CURVE; } -int rna_Armature_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value) +bool rna_Armature_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value) { return ((Object *)value.id.data)->type == OB_ARMATURE; } -int rna_Mesh_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value) +bool rna_Mesh_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value) { return ((Object *)value.id.data)->type == OB_MESH; } -int rna_Camera_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value) +bool rna_Camera_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value) { return ((Object *)value.id.data)->type == OB_CAMERA; } -int rna_Lamp_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value) +bool rna_Lamp_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value) { return ((Object *)value.id.data)->type == OB_LAMP; } diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index 4ba7ae4b6d8..b902fa73334 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -122,7 +122,7 @@ static void rna_Object_select_set(Object *ob, bContext *C, ReportList *reports, } } -static int rna_Object_select_get(Object *ob, bContext *C, ReportList *reports) +static bool rna_Object_select_get(Object *ob, bContext *C, ReportList *reports) { ViewLayer *view_layer = CTX_data_view_layer(C); Base *base = BKE_view_layer_base_find(view_layer, ob); @@ -135,7 +135,7 @@ static int rna_Object_select_get(Object *ob, bContext *C, ReportList *reports) return ((base->flag & BASE_SELECTED) != 0) ? 1 : 0; } -static int rna_Object_visible_get(Object *ob, bContext *C, ReportList *reports) +static bool rna_Object_visible_get(Object *ob, bContext *C, ReportList *reports) { ViewLayer *view_layer = CTX_data_view_layer(C); Base *base = BKE_view_layer_base_find(view_layer, ob); @@ -200,7 +200,7 @@ static void rna_Object_camera_fit_coords( /* settings: 0 - preview, 1 - render */ static Mesh *rna_Object_to_mesh( Object *ob, bContext *C, ReportList *reports, Depsgraph *depsgraph, - int apply_modifiers, int calc_tessface, int calc_undeformed) + bool apply_modifiers, bool calc_tessface, bool calc_undeformed) { Main *bmain = CTX_data_main(C); @@ -208,7 +208,7 @@ static Mesh *rna_Object_to_mesh( } static PointerRNA rna_Object_shape_key_add(Object *ob, bContext *C, ReportList *reports, - const char *name, int from_mix) + const char *name, bool from_mix) { Main *bmain = CTX_data_main(C); KeyBlock *kb = NULL; @@ -297,7 +297,7 @@ static int mesh_looptri_to_poly_index(Mesh *me_eval, const MLoopTri *lt) static void rna_Object_ray_cast( Object *ob, ReportList *reports, float origin[3], float direction[3], float distance, - int *r_success, float r_location[3], float r_normal[3], int *r_index) + bool *r_success, float r_location[3], float r_normal[3], int *r_index) { bool success = false; @@ -352,7 +352,7 @@ static void rna_Object_ray_cast( static void rna_Object_closest_point_on_mesh( Object *ob, ReportList *reports, float origin[3], float distance, - int *r_success, float r_location[3], float r_normal[3], int *r_index) + bool *r_success, float r_location[3], float r_normal[3], int *r_index) { BVHTreeFromMesh treeData = {NULL}; @@ -397,12 +397,12 @@ finally: free_bvhtree_from_mesh(&treeData); } -static int rna_Object_is_modified(Object *ob, Scene *scene, int settings) +static bool rna_Object_is_modified(Object *ob, Scene *scene, int settings) { return BKE_object_is_modified(scene, ob) & settings; } -static int rna_Object_is_deform_modified(Object *ob, Scene *scene, int settings) +static bool rna_Object_is_deform_modified(Object *ob, Scene *scene, int settings) { return BKE_object_is_deform_modified(scene, ob) & settings; } @@ -442,7 +442,7 @@ void rna_Object_me_eval_info(struct Object *ob, int type, char *result) } #endif /* NDEBUG */ -static int rna_Object_update_from_editmode(Object *ob, Main *bmain) +static bool rna_Object_update_from_editmode(Object *ob, Main *bmain) { /* fail gracefully if we aren't in edit-mode. */ return ED_object_editmode_load(bmain, ob); diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index 0dd33944dda..47933ff4b43 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -127,7 +127,7 @@ static void engine_tag_update(RenderEngine *engine) engine->flag |= RE_ENGINE_DO_UPDATE; } -static int engine_support_display_space_shader(RenderEngine *UNUSED(engine), Scene *scene) +static bool engine_support_display_space_shader(RenderEngine *UNUSED(engine), Scene *scene) { return IMB_colormanagement_support_glsl_draw(&scene->view_settings); } diff --git a/source/blender/makesrna/intern/rna_rigidbody.c b/source/blender/makesrna/intern/rna_rigidbody.c index 9c3b1fe3063..aa90ba28e23 100644 --- a/source/blender/makesrna/intern/rna_rigidbody.c +++ b/source/blender/makesrna/intern/rna_rigidbody.c @@ -261,7 +261,7 @@ static void rna_RigidBodyOb_collision_margin_set(PointerRNA *ptr, float value) #endif } -static void rna_RigidBodyOb_collision_groups_set(PointerRNA *ptr, const int *values) +static void rna_RigidBodyOb_collision_groups_set(PointerRNA *ptr, const bool *values) { RigidBodyOb *rbo = (RigidBodyOb *)ptr->data; int i; diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 0d3fe1bac33..874f3a8049d 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -762,14 +762,14 @@ static void rna_IntProperty_default_array_get(PointerRNA *ptr, int *values) values[i] = nprop->defaultvalue; } } -static void rna_BoolProperty_default_array_get(PointerRNA *ptr, int *values) +static void rna_BoolProperty_default_array_get(PointerRNA *ptr, bool *values) { PropertyRNA *prop = (PropertyRNA *)ptr->data; BoolPropertyRNA *nprop = (BoolPropertyRNA *)prop; rna_idproperty_check(&prop, ptr); if (nprop->defaultarray) { - memcpy(values, nprop->defaultarray, prop->totarraylength * sizeof(int)); + memcpy(values, nprop->defaultarray, prop->totarraylength * sizeof(bool)); } else { int i; @@ -1308,16 +1308,16 @@ int rna_property_override_diff_default( case PROP_BOOLEAN: { if (len_a) { - int array_stack_a[RNA_STACK_ARRAY], array_stack_b[RNA_STACK_ARRAY]; - int *array_a, *array_b; + bool array_stack_a[RNA_STACK_ARRAY], array_stack_b[RNA_STACK_ARRAY]; + bool *array_a, *array_b; - array_a = (len_a > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(int) * len_a, "RNA equals") : array_stack_a; - array_b = (len_b > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(int) * len_b, "RNA equals") : array_stack_b; + array_a = (len_a > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(bool) * len_a, "RNA equals") : array_stack_a; + array_b = (len_b > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(bool) * len_b, "RNA equals") : array_stack_b; RNA_property_boolean_get_array(ptr_a, prop_a, array_a); RNA_property_boolean_get_array(ptr_b, prop_b, array_b); - const int comp = memcmp(array_a, array_b, sizeof(int) * len_a); + const int comp = memcmp(array_a, array_b, sizeof(bool) * len_a); if (do_create && comp != 0) { /* XXX TODO this will have to be refined to handle array items */ @@ -1342,8 +1342,8 @@ int rna_property_override_diff_default( return comp; } else { - const int value_a = RNA_property_boolean_get(ptr_a, prop_a); - const int value_b = RNA_property_boolean_get(ptr_b, prop_b); + const bool value_a = RNA_property_boolean_get(ptr_a, prop_a); + const bool value_b = RNA_property_boolean_get(ptr_b, prop_b); const int comp = (value_a < value_b) ? -1 : (value_a > value_b) ? 1 : 0; if (do_create && comp != 0) { @@ -2030,8 +2030,8 @@ bool rna_property_override_apply_default( switch (RNA_property_type(prop_dst)) { case PROP_BOOLEAN: if (is_array && index == -1) { - int array_stack_a[RNA_STACK_ARRAY]; - int *array_a; + bool array_stack_a[RNA_STACK_ARRAY]; + bool *array_a; array_a = (len_dst > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(*array_a) * len_dst, __func__) : array_stack_a; @@ -2049,7 +2049,7 @@ bool rna_property_override_apply_default( if (array_a != array_stack_a) MEM_freeN(array_a); } else { - const int value = RNA_PROPERTY_GET_SINGLE(boolean, ptr_src, prop_src, index); + const bool value = RNA_PROPERTY_GET_SINGLE(boolean, ptr_src, prop_src, index); switch (override_op) { case IDOVERRIDESTATIC_OP_REPLACE: diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 1fbb416f3d8..512b99bdd79 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -546,7 +546,7 @@ static void rna_GPencilInterpolateSettings_type_set(PointerRNA *ptr, int value) } /* Grease pencil Drawing Brushes */ -static bGPDbrush *rna_GPencil_brush_new(ToolSettings *ts, const char *name, int setactive) +static bGPDbrush *rna_GPencil_brush_new(ToolSettings *ts, const char *name, bool setactive) { bGPDbrush *brush = BKE_gpencil_brush_addnew(ts, name, setactive != 0); @@ -725,7 +725,7 @@ void rna_Scene_set_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr) } } -static void rna_Scene_layer_set(PointerRNA *ptr, const int *values) +static void rna_Scene_layer_set(PointerRNA *ptr, const bool *values) { Scene *scene = (Scene *)ptr->data; @@ -1548,7 +1548,7 @@ static void rna_Physics_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Pointe DEG_id_tag_update(&scene->id, DEG_TAG_COPY_ON_WRITE); } -static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const int *value) +static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const bool *value) { ToolSettings *ts = (ToolSettings *)ptr->data; int flag = (value[0] ? SCE_SELECT_VERTEX : 0) | (value[1] ? SCE_SELECT_EDGE : 0) | (value[2] ? SCE_SELECT_FACE : 0); diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index 003e2561a22..5a8c9646b0b 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -145,7 +145,7 @@ static void rna_Scene_update_tagged(Scene *scene, Main *bmain) } static void rna_SceneRender_get_frame_path( - RenderData *rd, Main *bmain, int frame, int preview, const char *view, char *name) + RenderData *rd, Main *bmain, int frame, bool preview, const char *view, char *name) { const char *suffix = BKE_scene_multiview_view_suffix_get(rd, view); @@ -166,7 +166,7 @@ static void rna_SceneRender_get_frame_path( static void rna_Scene_ray_cast( Scene *scene, Main *bmain, ViewLayer *view_layer, float origin[3], float direction[3], float ray_dist, - int *r_success, float r_location[3], float r_normal[3], int *r_index, + bool *r_success, float r_location[3], float r_normal[3], int *r_index, Object **r_ob, float r_obmat[16]) { normalize_v3(direction); @@ -214,22 +214,22 @@ static void rna_Scene_alembic_export( int geom_samples, float shutter_open, float shutter_close, - int selected_only, - int uvs, - int normals, - int vcolors, - int apply_subdiv, - int flatten_hierarchy, - int visible_layers_only, - int renderable_only, - int face_sets, - int use_subdiv_schema, - int export_hair, - int export_particles, + bool selected_only, + bool uvs, + bool normals, + bool vcolors, + bool apply_subdiv, + bool flatten_hierarchy, + bool visible_layers_only, + bool renderable_only, + bool face_sets, + bool use_subdiv_schema, + bool export_hair, + bool export_particles, int compression_type, - int packuv, + bool packuv, float scale, - int triangulate, + bool triangulate, int quad_method, int ngon_method) { diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index 2529e687ac2..d41d04a4f11 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -289,7 +289,7 @@ static void rna_View2D_region_to_view(struct View2D *v2d, int x, int y, float re UI_view2d_region_to_view(v2d, x, y, &result[0], &result[1]); } -static void rna_View2D_view_to_region(struct View2D *v2d, float x, float y, int clip, int result[2]) +static void rna_View2D_view_to_region(struct View2D *v2d, float x, float y, bool clip, int result[2]) { if (clip) UI_view2d_view_to_region_clip(v2d, x, y, &result[0], &result[1]); diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index b1118e79354..e68c4c284c6 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -247,7 +247,7 @@ static char *rna_ParticleEdit_path(PointerRNA *UNUSED(ptr)) return BLI_strdup("tool_settings.particle_edit"); } -static int rna_Brush_mode_poll(PointerRNA *ptr, PointerRNA value) +static bool rna_Brush_mode_poll(PointerRNA *ptr, PointerRNA value) { Scene *scene = (Scene *)ptr->id.data; ToolSettings *ts = scene->toolsettings; @@ -424,7 +424,7 @@ static void rna_ImaPaint_canvas_update(bContext *C, PointerRNA *UNUSED(ptr)) } } -static int rna_ImaPaint_detect_data(ImagePaintSettings *imapaint) +static bool rna_ImaPaint_detect_data(ImagePaintSettings *imapaint) { return imapaint->missing_data == 0; } diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c index 0dbec5b5355..6417e48efdb 100644 --- a/source/blender/makesrna/intern/rna_sequencer.c +++ b/source/blender/makesrna/intern/rna_sequencer.c @@ -1046,7 +1046,7 @@ static void rna_SequenceModifier_update(Main *UNUSED(bmain), Scene *UNUSED(scene BKE_sequence_invalidate_cache_for_modifier(scene, seq); } -static int rna_SequenceModifier_otherSequence_poll(PointerRNA *ptr, PointerRNA value) +static bool rna_SequenceModifier_otherSequence_poll(PointerRNA *ptr, PointerRNA value) { Scene *scene = (Scene *) ptr->id.data; Editing *ed = BKE_sequencer_editing_get(scene, false); diff --git a/source/blender/makesrna/intern/rna_sequencer_api.c b/source/blender/makesrna/intern/rna_sequencer_api.c index da8b19a1ff6..509b6da2048 100644 --- a/source/blender/makesrna/intern/rna_sequencer_api.c +++ b/source/blender/makesrna/intern/rna_sequencer_api.c @@ -61,7 +61,7 @@ #include "WM_api.h" -static void rna_Sequence_update_rnafunc(ID *id, Sequence *self, int do_data) +static void rna_Sequence_update_rnafunc(ID *id, Sequence *self, bool do_data) { if (do_data) { BKE_sequencer_update_changed_seq_and_deps((Scene *)id, self, true, true); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index decd0736209..dfad4c07cb3 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -554,7 +554,7 @@ static float rna_View3DOverlay_GridScaleUnit_get(PointerRNA *ptr) return ED_view3d_grid_scale(scene, v3d, NULL); } -static void rna_SpaceView3D_layer_set(PointerRNA *ptr, const int *values) +static void rna_SpaceView3D_layer_set(PointerRNA *ptr, const bool *values) { View3D *v3d = (View3D *)(ptr->data); @@ -1582,7 +1582,7 @@ static void rna_SpaceNodeEditor_node_tree_set(PointerRNA *ptr, const PointerRNA ED_node_tree_start(snode, (bNodeTree *)value.data, NULL, NULL); } -static int rna_SpaceNodeEditor_node_tree_poll(PointerRNA *ptr, const PointerRNA value) +static bool rna_SpaceNodeEditor_node_tree_poll(PointerRNA *ptr, const PointerRNA value) { SpaceNode *snode = (SpaceNode *)ptr->data; bNodeTree *ntree = (bNodeTree *)value.data; @@ -1606,7 +1606,7 @@ static void rna_SpaceNodeEditor_tree_type_set(PointerRNA *ptr, int value) SpaceNode *snode = (SpaceNode *)ptr->data; ED_node_set_tree_type(snode, rna_node_tree_type_from_enum(value)); } -static int rna_SpaceNodeEditor_tree_type_poll(void *Cv, bNodeTreeType *type) +static bool rna_SpaceNodeEditor_tree_type_poll(void *Cv, bNodeTreeType *type) { bContext *C = (bContext *)Cv; if (type->poll) @@ -2436,7 +2436,7 @@ static void rna_def_space_view3d_shading(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE); RNA_define_verify_sdna(1); - prop = RNA_def_property(srna, "studiolight_rot_z", PROP_FLOAT, PROP_ANGLE); + prop = RNA_def_property(srna, "studiolight_rotate_z", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "shading.studiolight_rot_z"); RNA_def_property_float_default(prop, 0.0); RNA_def_property_ui_text(prop, "Studiolight Rotation", "Rotation of the studiolight around the Z-Axis"); diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c index ccc118edfb6..4831f36d20a 100644 --- a/source/blender/makesrna/intern/rna_tracking.c +++ b/source/blender/makesrna/intern/rna_tracking.c @@ -665,7 +665,7 @@ static void rna_trackingObject_remove(MovieTracking *tracking, ReportList *repor WM_main_add_notifier(NC_MOVIECLIP | NA_EDITED, NULL); } -static MovieTrackingMarker *rna_trackingMarkers_find_frame(MovieTrackingTrack *track, int framenr, int exact) +static MovieTrackingMarker *rna_trackingMarkers_find_frame(MovieTrackingTrack *track, int framenr, bool exact) { if (exact) return BKE_tracking_marker_get_exact(track, framenr); @@ -707,7 +707,7 @@ static void rna_trackingMarkers_delete_frame(MovieTrackingTrack *track, int fram } static MovieTrackingPlaneMarker *rna_trackingPlaneMarkers_find_frame(MovieTrackingPlaneTrack *plane_track, - int framenr, int exact) + int framenr, bool exact) { if (exact) return BKE_tracking_plane_marker_get_exact(plane_track, framenr); diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 089f7129316..bb7af5f327d 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -105,7 +105,7 @@ static ARegionType *region_type_find(ReportList *reports, int space_type, int re /* Panel */ -static int panel_poll(const bContext *C, PanelType *pt) +static bool panel_poll(const bContext *C, PanelType *pt) { extern FunctionRNA rna_Panel_poll_func; @@ -123,7 +123,7 @@ static int panel_poll(const bContext *C, PanelType *pt) pt->ext.call((bContext *)C, &ptr, func, &list); RNA_parameter_get_lookup(&list, "visible", &ret); - visible = *(int *)ret; + visible = *(bool *)ret; RNA_parameter_list_free(&list); @@ -690,7 +690,7 @@ static StructRNA *rna_Header_refine(PointerRNA *htr) /* Menu */ -static int menu_poll(const bContext *C, MenuType *pt) +static bool menu_poll(const bContext *C, MenuType *pt) { extern FunctionRNA rna_Menu_poll_func; @@ -698,7 +698,7 @@ static int menu_poll(const bContext *C, MenuType *pt) ParameterList list; FunctionRNA *func; void *ret; - int visible; + bool visible; RNA_pointer_create(NULL, pt->ext.srna, NULL, &ptr); /* dummy */ func = &rna_Menu_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */ @@ -708,7 +708,7 @@ static int menu_poll(const bContext *C, MenuType *pt) pt->ext.call((bContext *)C, &ptr, func, &list); RNA_parameter_get_lookup(&list, "visible", &ret); - visible = *(int *)ret; + visible = *(bool *)ret; RNA_parameter_list_free(&list); diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index a3db061d1fb..f6166733ec0 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -61,7 +61,7 @@ const EnumPropertyItem rna_enum_icon_items[] = { #ifdef RNA_RUNTIME const char *rna_translate_ui_text( - const char *text, const char *text_ctxt, StructRNA *type, PropertyRNA *prop, int translate) + const char *text, const char *text_ctxt, StructRNA *type, PropertyRNA *prop, bool translate) { /* Also return text if UI labels translation is disabled. */ if (!text || !text[0] || !translate || !BLT_translate_iface()) { @@ -97,8 +97,8 @@ const char *rna_translate_ui_text( static void rna_uiItemR( uiLayout *layout, PointerRNA *ptr, const char *propname, const char *name, const char *text_ctxt, - int translate, int icon, int expand, int slider, int toggle, int icon_only, int event, - int full_event, int emboss, int index, int icon_value) + bool translate, int icon, bool expand, bool slider, bool toggle, bool icon_only, bool event, + bool full_event, bool emboss, int index, int icon_value) { PropertyRNA *prop = RNA_struct_find_property(ptr, propname); int flag = 0; @@ -128,7 +128,7 @@ static void rna_uiItemR( static void rna_uiItemMenuEnumR( uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *name, - const char *text_ctxt, int translate, int icon) + const char *text_ctxt, bool translate, int icon) { PropertyRNA *prop = RNA_struct_find_property(ptr, propname); @@ -144,7 +144,7 @@ static void rna_uiItemMenuEnumR( static void rna_uiItemEnumR_string( uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *value, - const char *name, const char *text_ctxt, int translate, int icon) + const char *name, const char *text_ctxt, bool translate, int icon) { PropertyRNA *prop = RNA_struct_find_property(ptr, propname); @@ -163,7 +163,7 @@ static void rna_uiItemEnumR_string( static void rna_uiItemPointerR( uiLayout *layout, struct PointerRNA *ptr, const char *propname, struct PointerRNA *searchptr, const char *searchpropname, - const char *name, const char *text_ctxt, int translate, int icon) + const char *name, const char *text_ctxt, bool translate, int icon) { PropertyRNA *prop = RNA_struct_find_property(ptr, propname); @@ -181,7 +181,7 @@ static void rna_uiItemPointerR( static PointerRNA rna_uiItemO( uiLayout *layout, const char *opname, const char *name, const char *text_ctxt, - int translate, int icon, int emboss, int depress, int icon_value) + bool translate, int icon, bool emboss, bool depress, int icon_value) { wmOperatorType *ot; @@ -207,7 +207,7 @@ static PointerRNA rna_uiItemO( static PointerRNA rna_uiItemOMenuHold( uiLayout *layout, const char *opname, const char *name, const char *text_ctxt, - int translate, int icon, int emboss, int depress, int icon_value, + bool translate, int icon, bool emboss, bool depress, int icon_value, const char *menu) { wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */ @@ -232,7 +232,7 @@ static PointerRNA rna_uiItemOMenuHold( static void rna_uiItemMenuEnumO( uiLayout *layout, bContext *C, const char *opname, const char *propname, const char *name, - const char *text_ctxt, int translate, int icon) + const char *text_ctxt, bool translate, int icon) { wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */ @@ -248,7 +248,7 @@ static void rna_uiItemMenuEnumO( } static void rna_uiItemL( - uiLayout *layout, const char *name, const char *text_ctxt, int translate, + uiLayout *layout, const char *name, const char *text_ctxt, bool translate, int icon, int icon_value) { /* Get translated name (label). */ @@ -263,7 +263,7 @@ static void rna_uiItemL( static void rna_uiItemM( uiLayout *layout, const char *menuname, const char *name, const char *text_ctxt, - int translate, int icon, int icon_value) + bool translate, int icon, int icon_value) { /* Get translated name (label). */ name = rna_translate_ui_text(name, text_ctxt, NULL, NULL, translate); @@ -279,7 +279,7 @@ static void rna_uiItemPopoverPanel( uiLayout *layout, bContext *C, int space_type, int region_type, const char *panel_type, const char *name, const char *text_ctxt, - int translate, int icon, int icon_value) + bool translate, int icon, int icon_value) { /* Get translated name (label). */ name = rna_translate_ui_text(name, text_ctxt, NULL, NULL, translate); @@ -300,7 +300,7 @@ static void rna_uiItemPopoverPanelFromGroup( static void rna_uiTemplateAnyID( uiLayout *layout, PointerRNA *ptr, const char *propname, const char *proptypename, - const char *name, const char *text_ctxt, int translate) + const char *name, const char *text_ctxt, bool translate) { PropertyRNA *prop = RNA_struct_find_property(ptr, propname); @@ -318,7 +318,7 @@ static void rna_uiTemplateAnyID( static void rna_uiTemplatePathBuilder( uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *root_ptr, - const char *name, const char *text_ctxt, int translate) + const char *name, const char *text_ctxt, bool translate) { PropertyRNA *prop = RNA_struct_find_property(ptr, propname); @@ -520,7 +520,7 @@ void RNA_api_ui_layout(StructRNA *srna) func = RNA_def_function(srna, "grid_flow", "uiLayoutGridFlow"); RNA_def_boolean(func, "row_major", false, "", "Fill row by row, instead of column by column"); - RNA_def_int(func, "num_columns", 0, INT_MIN, INT_MAX, "", + RNA_def_int(func, "columns", 0, INT_MIN, INT_MAX, "", "Number of columns, positive are absolute fixed numbers, 0 is automatic, negative are " "automatic multiple numbers along major axis (e.g. -2 will only produce 2, 4, 6 etc. " "columns for row major layout, and 2, 4, 6 etc. rows for column major layout)", diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index c4e15174c88..1c94582c57e 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -751,7 +751,7 @@ static void rna_Window_screen_set(PointerRNA *ptr, PointerRNA value) win->workspace_hook->temp_layout_store = layout_new; } -static int rna_Window_screen_assign_poll(PointerRNA *UNUSED(ptr), PointerRNA value) +static bool rna_Window_screen_assign_poll(PointerRNA *UNUSED(ptr), PointerRNA value) { bScreen *screen = value.id.data; return !screen->temp; @@ -1073,7 +1073,7 @@ static void rna_wmClipboard_set(PointerRNA *UNUSED(ptr), const char *value) #ifdef WITH_PYTHON -static int rna_operator_poll_cb(bContext *C, wmOperatorType *ot) +static bool rna_operator_poll_cb(bContext *C, wmOperatorType *ot) { extern FunctionRNA rna_Operator_poll_func; @@ -1081,7 +1081,7 @@ static int rna_operator_poll_cb(bContext *C, wmOperatorType *ot) ParameterList list; FunctionRNA *func; void *ret; - int visible; + bool visible; RNA_pointer_create(NULL, ot->ext.srna, NULL, &ptr); /* dummy */ func = &rna_Operator_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */ @@ -1091,7 +1091,7 @@ static int rna_operator_poll_cb(bContext *C, wmOperatorType *ot) ot->ext.call(C, &ptr, func, &list); RNA_parameter_get_lookup(&list, "visible", &ret); - visible = *(int *)ret; + visible = *(bool *)ret; RNA_parameter_list_free(&list); @@ -1142,7 +1142,7 @@ static bool rna_operator_check_cb(bContext *C, wmOperator *op) op->type->ext.call(C, &opr, func, &list); RNA_parameter_get_lookup(&list, "result", &ret); - result = (*(int *)ret) != 0; + result = (*(bool *)ret) != 0; RNA_parameter_list_free(&list); diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c index aff696696af..afb12f48e28 100644 --- a/source/blender/makesrna/intern/rna_wm_api.c +++ b/source/blender/makesrna/intern/rna_wm_api.c @@ -89,7 +89,7 @@ static void rna_Operator_report(wmOperator *op, int type, const char *msg) BKE_report(op->reports, type, msg); } -static int rna_Operator_is_repeat(wmOperator *op, bContext *C) +static bool rna_Operator_is_repeat(wmOperator *op, bContext *C) { return WM_operator_is_repeat(C, op); } @@ -101,7 +101,7 @@ static void rna_Operator_enum_search_invoke(bContext *C, wmOperator *op) } -static int rna_event_modal_handler_add(struct bContext *C, struct wmOperator *operator) +static bool rna_event_modal_handler_add(struct bContext *C, struct wmOperator *operator) { return WM_event_add_modal_handler(C, operator) != NULL; } @@ -204,7 +204,7 @@ static int rna_Operator_props_popup(bContext *C, wmOperator *op, wmEvent *event) static wmKeyMapItem *rna_KeyMap_item_new( wmKeyMap *km, ReportList *reports, const char *idname, int type, int value, - int any, int shift, int ctrl, int alt, int oskey, int keymodifier, int head) + bool any, bool shift, bool ctrl, bool alt, bool oskey, int keymodifier, bool head) { /* wmWindowManager *wm = CTX_wm_manager(C); */ wmKeyMapItem *kmi = NULL; @@ -242,8 +242,8 @@ static wmKeyMapItem *rna_KeyMap_item_new( static wmKeyMapItem *rna_KeyMap_item_new_modal( wmKeyMap *km, ReportList *reports, const char *propvalue_str, - int type, int value, int any, int shift, int ctrl, int alt, - int oskey, int keymodifier) + int type, int value, bool any, bool shift, bool ctrl, bool alt, + bool oskey, int keymodifier) { int modifier = 0; int propvalue = 0; @@ -283,7 +283,7 @@ static void rna_KeyMap_item_remove(wmKeyMap *km, ReportList *reports, PointerRNA RNA_POINTER_INVALIDATE(kmi_ptr); } -static wmKeyMap *rna_keymap_new(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid, int modal) +static wmKeyMap *rna_keymap_new(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid, bool modal) { if (modal == 0) { return WM_keymap_find(keyconf, idname, spaceid, regionid); @@ -338,7 +338,7 @@ static PointerRNA rna_KeyConfig_find_item_from_operator( const char *idname, int opcontext, PointerRNA *properties, - int is_hotkey, + bool is_hotkey, PointerRNA *km_ptr) { char idname_bl[OP_MAX_TYPENAME]; diff --git a/source/blender/makesrna/intern/rna_wm_manipulator_api.c b/source/blender/makesrna/intern/rna_wm_manipulator_api.c index c948f84e087..16804042608 100644 --- a/source/blender/makesrna/intern/rna_wm_manipulator_api.c +++ b/source/blender/makesrna/intern/rna_wm_manipulator_api.c @@ -166,7 +166,7 @@ static PointerRNA rna_manipulator_target_set_operator( /** \name Manipulator Property Access * \{ */ -static int rna_manipulator_target_is_valid( +static bool rna_manipulator_target_is_valid( wmManipulator *mpr, ReportList *reports, const char *target_propname) { wmManipulatorProperty *mpr_prop = diff --git a/source/blender/makesrna/intern/rna_workspace.c b/source/blender/makesrna/intern/rna_workspace.c index 041b2b9157f..166d71689d1 100644 --- a/source/blender/makesrna/intern/rna_workspace.c +++ b/source/blender/makesrna/intern/rna_workspace.c @@ -121,13 +121,13 @@ static bToolRef *rna_WorkSpace_tools_from_tkey(WorkSpace *workspace, const bTool } static bToolRef *rna_WorkSpace_tools_from_space_view3d_mode( - WorkSpace *workspace, int mode, int create) + WorkSpace *workspace, int mode, bool create) { return rna_WorkSpace_tools_from_tkey(workspace, &(bToolKey){ .space_type = SPACE_VIEW3D, .mode = mode}, create); } static bToolRef *rna_WorkSpace_tools_from_space_image_mode( - WorkSpace *workspace, int mode, int create) + WorkSpace *workspace, int mode, bool create) { return rna_WorkSpace_tools_from_tkey(workspace, &(bToolKey){ .space_type = SPACE_IMAGE, .mode = mode}, create); } diff --git a/source/blender/nodes/composite/node_composite_util.c b/source/blender/nodes/composite/node_composite_util.c index 022794e8d42..3f67804685c 100644 --- a/source/blender/nodes/composite/node_composite_util.c +++ b/source/blender/nodes/composite/node_composite_util.c @@ -32,7 +32,7 @@ #include "node_composite_util.h" -int cmp_node_poll_default(bNodeType *UNUSED(ntype), bNodeTree *ntree) +bool cmp_node_poll_default(bNodeType *UNUSED(ntype), bNodeTree *ntree) { return STREQ(ntree->idname, "CompositorNodeTree"); } diff --git a/source/blender/nodes/composite/node_composite_util.h b/source/blender/nodes/composite/node_composite_util.h index 193cdb90003..3f05d7d1bef 100644 --- a/source/blender/nodes/composite/node_composite_util.h +++ b/source/blender/nodes/composite/node_composite_util.h @@ -60,7 +60,7 @@ #define CMP_SCALE_MAX 12000 -int cmp_node_poll_default(struct bNodeType *ntype, struct bNodeTree *ntree); +bool cmp_node_poll_default(struct bNodeType *ntype, struct bNodeTree *ntree); void cmp_node_update_default(struct bNodeTree *UNUSED(ntree), struct bNode *node); void cmp_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass, short flag); diff --git a/source/blender/nodes/composite/nodes/node_composite_image.c b/source/blender/nodes/composite/nodes/node_composite_image.c index 124b2fa72b9..8bdaa39f3b7 100644 --- a/source/blender/nodes/composite/nodes/node_composite_image.c +++ b/source/blender/nodes/composite/nodes/node_composite_image.c @@ -390,7 +390,7 @@ static void node_composit_init_rlayers(const bContext *C, PointerRNA *ptr) } } -static int node_composit_poll_rlayers(bNodeType *UNUSED(ntype), bNodeTree *ntree) +static bool node_composit_poll_rlayers(bNodeType *UNUSED(ntype), bNodeTree *ntree) { if (STREQ(ntree->idname, "CompositorNodeTree")) { Scene *scene; diff --git a/source/blender/nodes/intern/node_common.c b/source/blender/nodes/intern/node_common.c index 4a47bf7035c..cb04b341c26 100644 --- a/source/blender/nodes/intern/node_common.c +++ b/source/blender/nodes/intern/node_common.c @@ -81,7 +81,7 @@ void node_group_label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int ma BLI_strncpy(label, (node->id) ? node->id->name + 2 : IFACE_("Missing Data-Block"), maxlen); } -int node_group_poll_instance(bNode *node, bNodeTree *nodetree) +bool node_group_poll_instance(bNode *node, bNodeTree *nodetree) { if (node->typeinfo->poll(node->typeinfo, nodetree)) { bNodeTree *grouptree = (bNodeTree *)node->id; diff --git a/source/blender/nodes/intern/node_common.h b/source/blender/nodes/intern/node_common.h index edc1f19f554..737489474f9 100644 --- a/source/blender/nodes/intern/node_common.h +++ b/source/blender/nodes/intern/node_common.h @@ -38,7 +38,7 @@ struct bNodeTree; void node_group_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen); -int node_group_poll_instance(struct bNode *node, struct bNodeTree *nodetree); +bool node_group_poll_instance(struct bNode *node, struct bNodeTree *nodetree); void ntree_update_reroute_nodes(struct bNodeTree *ntree); diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c index 9d77d45dedf..301fd3c35a8 100644 --- a/source/blender/nodes/shader/node_shader_tree.c +++ b/source/blender/nodes/shader/node_shader_tree.c @@ -65,7 +65,7 @@ #include "node_util.h" #include "node_shader_util.h" -static int shader_tree_poll(const bContext *C, bNodeTreeType *UNUSED(treetype)) +static bool shader_tree_poll(const bContext *C, bNodeTreeType *UNUSED(treetype)) { Scene *scene = CTX_data_scene(C); const char *engine_id = scene->r.engine; diff --git a/source/blender/nodes/shader/node_shader_util.c b/source/blender/nodes/shader/node_shader_util.c index e7069202b64..5cc7d14bc8b 100644 --- a/source/blender/nodes/shader/node_shader_util.c +++ b/source/blender/nodes/shader/node_shader_util.c @@ -37,7 +37,7 @@ #include "node_exec.h" -int sh_node_poll_default(bNodeType *UNUSED(ntype), bNodeTree *ntree) +bool sh_node_poll_default(bNodeType *UNUSED(ntype), bNodeTree *ntree) { return STREQ(ntree->idname, "ShaderNodeTree"); } diff --git a/source/blender/nodes/shader/node_shader_util.h b/source/blender/nodes/shader/node_shader_util.h index 46f99d98026..4fb18b1a9d8 100644 --- a/source/blender/nodes/shader/node_shader_util.h +++ b/source/blender/nodes/shader/node_shader_util.h @@ -81,7 +81,7 @@ #include "GPU_uniformbuffer.h" -int sh_node_poll_default(struct bNodeType *ntype, struct bNodeTree *ntree); +bool sh_node_poll_default(struct bNodeType *ntype, struct bNodeTree *ntree); void sh_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass, short flag); diff --git a/source/blender/nodes/texture/node_texture_util.c b/source/blender/nodes/texture/node_texture_util.c index a6b0d060d93..ff2e3d20155 100644 --- a/source/blender/nodes/texture/node_texture_util.c +++ b/source/blender/nodes/texture/node_texture_util.c @@ -50,7 +50,7 @@ #include "node_texture_util.h" -int tex_node_poll_default(bNodeType *UNUSED(ntype), bNodeTree *ntree) +bool tex_node_poll_default(bNodeType *UNUSED(ntype), bNodeTree *ntree) { return STREQ(ntree->idname, "TextureNodeTree"); } diff --git a/source/blender/nodes/texture/node_texture_util.h b/source/blender/nodes/texture/node_texture_util.h index 8662a8a0e82..63418248b71 100644 --- a/source/blender/nodes/texture/node_texture_util.h +++ b/source/blender/nodes/texture/node_texture_util.h @@ -114,7 +114,7 @@ typedef struct TexDelegate { } TexDelegate; -int tex_node_poll_default(struct bNodeType *ntype, struct bNodeTree *ntree); +bool tex_node_poll_default(struct bNodeType *ntype, struct bNodeTree *ntree); void tex_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass, short flag); void tex_input_rgba(float *out, bNodeStack *in, TexParams *params, short thread); diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index cee9ad3b477..d2d78167fae 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -91,7 +91,7 @@ int PyC_AsArray_FAST( } } else if (type == &PyBool_Type) { - int *array_bool = array; + bool *array_bool = array; for (i = 0; i < length; i++) { array_bool[i] = (PyLong_AsLong(value_fast_items[i]) != 0); } diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index d0b0331430d..edcc2bef0c5 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -263,7 +263,7 @@ static void bpy_prop_update_cb(struct bContext *C, struct PointerRNA *ptr, struc } } -static int bpy_prop_boolean_get_cb(struct PointerRNA *ptr, struct PropertyRNA *prop) +static bool bpy_prop_boolean_get_cb(struct PointerRNA *ptr, struct PropertyRNA *prop) { PyObject **py_data = RNA_property_py_data_get(prop); PyObject *py_func; @@ -273,7 +273,7 @@ static int bpy_prop_boolean_get_cb(struct PointerRNA *ptr, struct PropertyRNA *p PyGILState_STATE gilstate; bool use_gil; const bool is_write_ok = pyrna_write_check(); - int value; + bool value; BLI_assert(py_data != NULL); @@ -301,12 +301,15 @@ static int bpy_prop_boolean_get_cb(struct PointerRNA *ptr, struct PropertyRNA *p value = false; } else { - value = PyC_Long_AsI32(ret); + int value_i = PyC_Long_AsBool(ret); - if (value == -1 && PyErr_Occurred()) { + if (value_i == -1 && PyErr_Occurred()) { PyC_Err_PrintWithFunc(py_func); value = false; } + else { + value = (bool)value_i; + } Py_DECREF(ret); } @@ -321,7 +324,7 @@ static int bpy_prop_boolean_get_cb(struct PointerRNA *ptr, struct PropertyRNA *p return value; } -static void bpy_prop_boolean_set_cb(struct PointerRNA *ptr, struct PropertyRNA *prop, int value) +static void bpy_prop_boolean_set_cb(struct PointerRNA *ptr, struct PropertyRNA *prop, bool value) { PyObject **py_data = RNA_property_py_data_get(prop); PyObject *py_func; @@ -375,7 +378,7 @@ static void bpy_prop_boolean_set_cb(struct PointerRNA *ptr, struct PropertyRNA * } } -static int bpy_prop_poll_cb(struct PointerRNA *self, PointerRNA candidate, struct PropertyRNA *prop) +static bool bpy_prop_poll_cb(struct PointerRNA *self, PointerRNA candidate, struct PropertyRNA *prop) { PyObject *py_self; PyObject *py_candidate; @@ -420,7 +423,7 @@ static int bpy_prop_poll_cb(struct PointerRNA *self, PointerRNA candidate, struc return result; } -static void bpy_prop_boolean_array_get_cb(struct PointerRNA *ptr, struct PropertyRNA *prop, int *values) +static void bpy_prop_boolean_array_get_cb(struct PointerRNA *ptr, struct PropertyRNA *prop, bool *values) { PyObject **py_data = RNA_property_py_data_get(prop); PyObject *py_func; @@ -481,7 +484,7 @@ static void bpy_prop_boolean_array_get_cb(struct PointerRNA *ptr, struct Propert } } -static void bpy_prop_boolean_array_set_cb(struct PointerRNA *ptr, struct PropertyRNA *prop, const int *values) +static void bpy_prop_boolean_array_set_cb(struct PointerRNA *ptr, struct PropertyRNA *prop, const bool *values) { PyObject **py_data = RNA_property_py_data_get(prop); PyObject *py_func; @@ -511,7 +514,7 @@ static void bpy_prop_boolean_array_set_cb(struct PointerRNA *ptr, struct Propert self = pyrna_struct_as_instance(ptr); PyTuple_SET_ITEM(args, 0, self); - py_values = PyC_Tuple_PackArray_I32FromBool(values, len); + py_values = PyC_Tuple_PackArray_Bool(values, len); PyTuple_SET_ITEM(args, 1, py_values); ret = PyObject_CallObject(py_func, args); @@ -2097,7 +2100,7 @@ static PyObject *BPy_BoolVectorProperty(PyObject *self, PyObject *args, PyObject if (srna) { const char *id = NULL, *name = NULL, *description = ""; int id_len; - int def[PYRNA_STACK_ARRAY] = {0}; + bool def[PYRNA_STACK_ARRAY] = {0}; int size = 3; PropertyRNA *prop; PyObject *pydef = NULL; diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index be0e9771a0a..3e1c85d7f9f 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -1667,7 +1667,7 @@ static int pyrna_py_to_prop( return -1; } else { - if (data) *((int *)data) = param; + if (data) *((bool *)data) = param; else RNA_property_boolean_set(ptr, prop, param); } break; @@ -2486,9 +2486,9 @@ static PyObject *pyrna_prop_array_subscript_slice( } case PROP_BOOLEAN: { - int values_stack[PYRNA_STACK_ARRAY]; - int *values; - if (length > PYRNA_STACK_ARRAY) { values = PyMem_MALLOC(sizeof(int) * length); } + bool values_stack[PYRNA_STACK_ARRAY]; + bool *values; + if (length > PYRNA_STACK_ARRAY) { values = PyMem_MALLOC(sizeof(bool) * length); } else { values = values_stack; } RNA_property_boolean_get_array(ptr, prop, values); @@ -2869,7 +2869,7 @@ static int prop_subscript_ass_array_slice__int_recursive( } static int prop_subscript_ass_array_slice__bool_recursive( - PyObject **value_items, int *value, + PyObject **value_items, bool *value, int totdim, const int dimsize[]) { const int length = dimsize[0]; @@ -2992,9 +2992,9 @@ static int prop_subscript_ass_array_slice( } case PROP_BOOLEAN: { - int values_stack[PYRNA_STACK_ARRAY]; - int *values = (length_flat > PYRNA_STACK_ARRAY) ? - (values_alloc = PyMem_MALLOC(sizeof(*values) * length_flat)) : values_stack; + bool values_stack[PYRNA_STACK_ARRAY]; + bool *values = (length_flat > PYRNA_STACK_ARRAY) ? + (values_alloc = PyMem_MALLOC(sizeof(bool) * length_flat)) : values_stack; if (start != 0 || stop != length) { /* partial assignment? - need to get the array */ @@ -4986,6 +4986,8 @@ static bool foreach_compat_buffer(RawPropertyType raw_type, int attr_signed, con case PROP_RAW_INT: if (attr_signed) return (f == 'i') ? 1 : 0; else return (f == 'I') ? 1 : 0; + case PROP_RAW_BOOLEAN: + return (f == '?') ? 1 : 0; case PROP_RAW_FLOAT: return (f == 'f') ? 1 : 0; case PROP_RAW_DOUBLE: @@ -5052,6 +5054,9 @@ static PyObject *foreach_getset(BPy_PropertyRNA *self, PyObject *args, int set) case PROP_RAW_INT: ((int *)array)[i] = (int)PyLong_AsLong(item); break; + case PROP_RAW_BOOLEAN: + ((bool *)array)[i] = (int)PyLong_AsLong(item) != 0; + break; case PROP_RAW_FLOAT: ((float *)array)[i] = (float)PyFloat_AsDouble(item); break; @@ -5386,7 +5391,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat case PROP_BOOLEAN: ret = PyTuple_New(len); for (a = 0; a < len; a++) - PyTuple_SET_ITEM(ret, a, PyBool_FromLong(((int *)data)[a])); + PyTuple_SET_ITEM(ret, a, PyBool_FromLong(((bool *)data)[a])); break; case PROP_INT: ret = PyTuple_New(len); @@ -5429,7 +5434,7 @@ static PyObject *pyrna_param_to_py(PointerRNA *ptr, PropertyRNA *prop, void *dat /* see if we can coerce into a python type - PropertyType */ switch (type) { case PROP_BOOLEAN: - ret = PyBool_FromLong(*(int *)data); + ret = PyBool_FromLong(*(bool *)data); break; case PROP_INT: ret = PyLong_FromLong(*(int *)data); diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c index 571ee0edea2..9a184df8054 100644 --- a/source/blender/python/intern/bpy_rna_array.c +++ b/source/blender/python/intern/bpy_rna_array.c @@ -564,7 +564,7 @@ static void py_to_int(const struct ItemConvertArgData *arg, PyObject *py, char * static void py_to_bool(const struct ItemConvertArgData *UNUSED(arg), PyObject *py, char *data) { - *(int *)data = (int)PyObject_IsTrue(py); + *(bool *)data = (bool)PyObject_IsTrue(py); } static int py_float_check(PyObject *py) @@ -596,7 +596,7 @@ static void int_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, void *v static void bool_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, void *value) { - RNA_property_boolean_set_index(ptr, prop, index, *(int *)value); + RNA_property_boolean_set_index(ptr, prop, index, *(bool *)value); } static void convert_item_init_float( @@ -655,7 +655,7 @@ int pyrna_py_to_array(PointerRNA *ptr, PropertyRNA *prop, char *param_data, convert_item_init_bool(ptr, prop, &convert_item); ret = py_to_array( - py, ptr, prop, param_data, py_bool_check, "boolean", sizeof(int), + py, ptr, prop, param_data, py_bool_check, "boolean", sizeof(bool), &convert_item, (RNA_SetArrayFunc)RNA_property_boolean_set_array, error_prefix); break; } @@ -885,10 +885,9 @@ int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value) } break; } - case PROP_BOOLEAN: case PROP_INT: { - int value_i = PyLong_AsLong(value); + int value_i = PyC_Long_AsI32(value); if (value_i == -1 && PyErr_Occurred()) { PyErr_Clear(); return 0; @@ -904,10 +903,40 @@ int pyrna_array_contains_py(PointerRNA *ptr, PropertyRNA *prop, PyObject *value) tmp_arr = tmp; } - if (type == PROP_BOOLEAN) - RNA_property_boolean_get_array(ptr, prop, tmp_arr); - else - RNA_property_int_get_array(ptr, prop, tmp_arr); + RNA_property_int_get_array(ptr, prop, tmp_arr); + + for (i = 0; i < len; i++) { + if (tmp_arr[i] == value_i) { + break; + } + } + + if (tmp_arr != tmp) + PyMem_FREE(tmp_arr); + + return i < len ? 1 : 0; + } + break; + } + case PROP_BOOLEAN: + { + int value_i = PyC_Long_AsBool(value); + if (value_i == -1 && PyErr_Occurred()) { + PyErr_Clear(); + return 0; + } + else { + bool tmp[32]; + bool *tmp_arr; + + if (len * sizeof(bool) > sizeof(tmp)) { + tmp_arr = PyMem_MALLOC(len * sizeof(bool)); + } + else { + tmp_arr = tmp; + } + + RNA_property_boolean_get_array(ptr, prop, tmp_arr); for (i = 0; i < len; i++) { if (tmp_arr[i] == value_i) { diff --git a/source/blender/render/extern/include/RE_engine.h b/source/blender/render/extern/include/RE_engine.h index 0620ca6d11d..1ca889f2347 100644 --- a/source/blender/render/extern/include/RE_engine.h +++ b/source/blender/render/extern/include/RE_engine.h @@ -153,16 +153,16 @@ void RE_result_load_from_file(struct RenderResult *result, struct ReportList *re struct RenderResult *RE_engine_begin_result(RenderEngine *engine, int x, int y, int w, int h, const char *layername, const char *viewname); void RE_engine_update_result(RenderEngine *engine, struct RenderResult *result); void RE_engine_add_pass(RenderEngine *engine, const char *name, int channels, const char *chan_id, const char *layername); -void RE_engine_end_result(RenderEngine *engine, struct RenderResult *result, int cancel, int highlight, int merge_results); +void RE_engine_end_result(RenderEngine *engine, struct RenderResult *result, bool cancel, bool highlight, bool merge_results); struct RenderResult *RE_engine_get_result(struct RenderEngine *engine); const char *RE_engine_active_view_get(RenderEngine *engine); void RE_engine_active_view_set(RenderEngine *engine, const char *viewname); -float RE_engine_get_camera_shift_x(RenderEngine *engine, struct Object *camera, int use_spherical_stereo); -void RE_engine_get_camera_model_matrix(RenderEngine *engine, struct Object *camera, int use_spherical_stereo, float *r_modelmat); -int RE_engine_get_spherical_stereo(RenderEngine *engine, struct Object *camera); +float RE_engine_get_camera_shift_x(RenderEngine *engine, struct Object *camera, bool use_spherical_stereo); +void RE_engine_get_camera_model_matrix(RenderEngine *engine, struct Object *camera, bool use_spherical_stereo, float *r_modelmat); +bool RE_engine_get_spherical_stereo(RenderEngine *engine, struct Object *camera); -int RE_engine_test_break(RenderEngine *engine); +bool RE_engine_test_break(RenderEngine *engine); void RE_engine_update_stats(RenderEngine *engine, const char *stats, const char *info); void RE_engine_update_progress(RenderEngine *engine, float progress); void RE_engine_update_memory_stats(RenderEngine *engine, float mem_used, float mem_peak); diff --git a/source/blender/render/intern/source/external_engine.c b/source/blender/render/intern/source/external_engine.c index 7a9be04d8f6..5c3f510ffca 100644 --- a/source/blender/render/intern/source/external_engine.c +++ b/source/blender/render/intern/source/external_engine.c @@ -263,7 +263,7 @@ void RE_engine_add_pass(RenderEngine *engine, const char *name, int channels, co render_result_add_pass(re->result, name, channels, chan_id, layername, NULL); } -void RE_engine_end_result(RenderEngine *engine, RenderResult *result, int cancel, int highlight, int merge_results) +void RE_engine_end_result(RenderEngine *engine, RenderResult *result, bool cancel, bool highlight, bool merge_results) { Render *re = engine->re; @@ -314,7 +314,7 @@ RenderResult *RE_engine_get_result(RenderEngine *engine) /* Cancel */ -int RE_engine_test_break(RenderEngine *engine) +bool RE_engine_test_break(RenderEngine *engine) { Render *re = engine->re; @@ -407,7 +407,7 @@ void RE_engine_active_view_set(RenderEngine *engine, const char *viewname) RE_SetActiveRenderView(re, viewname); } -float RE_engine_get_camera_shift_x(RenderEngine *engine, Object *camera, int use_spherical_stereo) +float RE_engine_get_camera_shift_x(RenderEngine *engine, Object *camera, bool use_spherical_stereo) { Render *re = engine->re; @@ -419,7 +419,7 @@ float RE_engine_get_camera_shift_x(RenderEngine *engine, Object *camera, int use } void RE_engine_get_camera_model_matrix( - RenderEngine *engine, Object *camera, int use_spherical_stereo, float *r_modelmat) + RenderEngine *engine, Object *camera, bool use_spherical_stereo, float *r_modelmat) { Render *re = engine->re; @@ -430,7 +430,7 @@ void RE_engine_get_camera_model_matrix( BKE_camera_multiview_model_matrix(re ? &re->r : NULL, camera, re->viewname, (float (*)[4])r_modelmat); } -int RE_engine_get_spherical_stereo(RenderEngine *engine, Object *camera) +bool RE_engine_get_spherical_stereo(RenderEngine *engine, Object *camera) { Render *re = engine->re; return BKE_camera_multiview_spherical_stereo(re ? &re->r : NULL, camera) ? 1 : 0; diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 389eb2a4d71..eddf1379eb7 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -166,10 +166,11 @@ void WM_cursor_grab_enable(struct wmWindow *win, bool wrap, bool hide, int boun void WM_cursor_grab_disable(struct wmWindow *win, const int mouse_ungrab_xy[2]); void WM_cursor_time (struct wmWindow *win, int nr); -void *WM_paint_cursor_activate(struct wmWindowManager *wm, - int (*poll)(struct bContext *C), - void (*draw)(struct bContext *C, int, int, void *customdata), - void *customdata); +void *WM_paint_cursor_activate( + struct wmWindowManager *wm, + bool (*poll)(struct bContext *C), + void (*draw)(struct bContext *C, int, int, void *customdata), + void *customdata); void WM_paint_cursor_end(struct wmWindowManager *wm, void *handle); void WM_paint_cursor_tag_redraw(struct wmWindow *win, struct ARegion *ar); @@ -284,7 +285,7 @@ int WM_operator_confirm (struct bContext *C, struct wmOperator *op, const str int WM_operator_filesel (struct bContext *C, struct wmOperator *op, const struct wmEvent *event); bool WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const struct ImageFormatData *im_format); /* poll callback, context checks */ -int WM_operator_winactive (struct bContext *C); +bool WM_operator_winactive (struct bContext *C); /* invoke callback, exec + redo popup */ int WM_operator_props_popup_confirm(struct bContext *C, struct wmOperator *op, const struct wmEvent *event); int WM_operator_props_popup_call(struct bContext *C, struct wmOperator *op, const struct wmEvent *event); @@ -327,8 +328,8 @@ struct wmOperatorType *WM_operatortype_append_macro(const char *idname, const ch struct wmOperatorTypeMacro *WM_operatortype_macro_define(struct wmOperatorType *ot, const char *idname); -int WM_operator_poll (struct bContext *C, struct wmOperatorType *ot); -int WM_operator_poll_context(struct bContext *C, struct wmOperatorType *ot, short context); +bool WM_operator_poll (struct bContext *C, struct wmOperatorType *ot); +bool WM_operator_poll_context(struct bContext *C, struct wmOperatorType *ot, short context); int WM_operator_call_ex(struct bContext *C, struct wmOperator *op, const bool store); int WM_operator_call (struct bContext *C, struct wmOperator *op); int WM_operator_call_notest(struct bContext *C, struct wmOperator *op); @@ -423,6 +424,7 @@ char *WM_prop_pystring_assign(struct bContext *C, struct PointerRNA *ptr, struc void WM_operator_bl_idname(char *to, const char *from); void WM_operator_py_idname(char *to, const char *from); bool WM_operator_py_idname_ok_or_report(struct ReportList *reports, const char *classname, const char *idname); +const char *WM_context_member_from_ptr(struct bContext *C, const struct PointerRNA *ptr); /* *************** uilist types ******************** */ void WM_uilisttype_init(void); @@ -481,8 +483,8 @@ void WM_event_drag_image(struct wmDrag *, struct ImBuf *, float scale, int sx void WM_drag_free(struct wmDrag *drag); void WM_drag_free_list(struct ListBase *lb); -struct wmDropBox *WM_dropbox_add( - ListBase *lb, const char *idname, int (*poll)(struct bContext *, struct wmDrag *, const struct wmEvent *event), +struct wmDropBox *WM_dropbox_add( + ListBase *lb, const char *idname, bool (*poll)(struct bContext *, struct wmDrag *, const struct wmEvent *event), void (*copy)(struct wmDrag *, struct wmDropBox *)); struct wmDropBox *WM_dropbox_add_custom_drop_handler( ListBase *dropbox_list, void (*drop_handler)(struct wmDrag *, const struct wmEvent *)); diff --git a/source/blender/windowmanager/WM_keymap.h b/source/blender/windowmanager/WM_keymap.h index f5630a9c530..d1f6d268835 100644 --- a/source/blender/windowmanager/WM_keymap.h +++ b/source/blender/windowmanager/WM_keymap.h @@ -81,7 +81,7 @@ bool WM_keymap_remove(struct wmKeyConfig *keyconfig, struct wmKeyMap *keymap); bool WM_keymap_poll(struct bContext *C, struct wmKeyMap *keymap); wmKeyMapItem *WM_keymap_item_find_id(struct wmKeyMap *keymap, int id); -int WM_keymap_item_compare(struct wmKeyMapItem *k1, struct wmKeyMapItem *k2); +bool WM_keymap_item_compare(struct wmKeyMapItem *k1, struct wmKeyMapItem *k2); /* Modal Keymap */ diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index d8133ba06a3..5ffef5f75b9 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -582,7 +582,7 @@ typedef struct wmOperatorType { /* verify if the operator can be executed in the current context, note * that the operator might still fail to execute even if this return true */ - int (*poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT; + bool (*poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT; /* optional panel for redo and repeat, autogenerated if not set */ void (*ui)(struct bContext *, struct wmOperator *); @@ -604,7 +604,7 @@ typedef struct wmOperatorType { struct wmKeyMap *modalkeymap; /* python needs the operator type as well */ - int (*pyop_poll)(struct bContext *, struct wmOperatorType *ot) ATTR_WARN_UNUSED_RESULT; + bool (*pyop_poll)(struct bContext *, struct wmOperatorType *ot) ATTR_WARN_UNUSED_RESULT; /* RNA integration */ ExtensionRNA ext; @@ -680,7 +680,7 @@ typedef struct wmDropBox { struct wmDropBox *next, *prev; /* test if the dropbox is active, then can print optype name */ - int (*poll)(struct bContext *, struct wmDrag *, const wmEvent *); + bool (*poll)(struct bContext *, struct wmDrag *, const wmEvent *); /* before exec, this copies drag info to wmDrop properties */ void (*copy)(struct wmDrag *, struct wmDropBox *); diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c index 4c79f901f53..b3925bc079e 100644 --- a/source/blender/windowmanager/intern/wm_dragdrop.c +++ b/source/blender/windowmanager/intern/wm_dragdrop.c @@ -97,8 +97,9 @@ ListBase *WM_dropboxmap_find(const char *idname, int spaceid, int regionid) -wmDropBox *WM_dropbox_add(ListBase *lb, const char *idname, int (*poll)(bContext *, wmDrag *, const wmEvent *), - void (*copy)(wmDrag *, wmDropBox *)) +wmDropBox *WM_dropbox_add( + ListBase *lb, const char *idname, bool (*poll)(bContext *, wmDrag *, const wmEvent *), + void (*copy)(wmDrag *, wmDropBox *)) { wmDropBox *drop = MEM_callocN(sizeof(wmDropBox), "wmDropBox"); diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 92cda2100c9..cc2dcc40b45 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -598,7 +598,7 @@ static void wm_handler_ui_cancel(bContext *C) /* ********************* operators ******************* */ -int WM_operator_poll(bContext *C, wmOperatorType *ot) +bool WM_operator_poll(bContext *C, wmOperatorType *ot) { wmOperatorTypeMacro *otmacro; @@ -619,7 +619,7 @@ int WM_operator_poll(bContext *C, wmOperatorType *ot) } /* sets up the new context and calls 'wm_operator_invoke()' with poll_only */ -int WM_operator_poll_context(bContext *C, wmOperatorType *ot, short context) +bool WM_operator_poll_context(bContext *C, wmOperatorType *ot, short context) { return wm_operator_call_internal(C, ot, NULL, NULL, context, true); } diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index be805fa7b1f..f00ec500bc0 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -1930,7 +1930,7 @@ static int wm_revert_mainfile_exec(bContext *C, wmOperator *op) } } -static int wm_revert_mainfile_poll(bContext *UNUSED(C)) +static bool wm_revert_mainfile_poll(bContext *UNUSED(C)) { return G.relbase_valid; } diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c index c7d55b290f5..903795d6943 100644 --- a/source/blender/windowmanager/intern/wm_files_link.c +++ b/source/blender/windowmanager/intern/wm_files_link.c @@ -87,7 +87,7 @@ /* **************** link/append *************** */ -static int wm_link_append_poll(bContext *C) +static bool wm_link_append_poll(bContext *C) { if (WM_operator_winactive(C)) { /* linking changes active object which is pretty useful in general, diff --git a/source/blender/windowmanager/intern/wm_gesture.c b/source/blender/windowmanager/intern/wm_gesture.c index 144bb38ae76..4366013084c 100644 --- a/source/blender/windowmanager/intern/wm_gesture.c +++ b/source/blender/windowmanager/intern/wm_gesture.c @@ -174,7 +174,7 @@ static void wm_gesture_draw_line(wmGesture *gt) glGetFloatv(GL_VIEWPORT, viewport_size); immUniform2f("viewport_size", viewport_size[2], viewport_size[3]); - immUniform1i("num_colors", 2); /* "advanced" mode */ + immUniform1i("colors_len", 2); /* "advanced" mode */ immUniformArray4fv("colors", (float *)(float[][4]){{0.4f, 0.4f, 0.4f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}}, 2); immUniform1f("dash_width", 8.0f); @@ -214,7 +214,7 @@ static void wm_gesture_draw_rect(wmGesture *gt) glGetFloatv(GL_VIEWPORT, viewport_size); immUniform2f("viewport_size", viewport_size[2], viewport_size[3]); - immUniform1i("num_colors", 2); /* "advanced" mode */ + immUniform1i("colors_len", 2); /* "advanced" mode */ immUniformArray4fv("colors", (float *)(float[][4]){{0.4f, 0.4f, 0.4f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}}, 2); immUniform1f("dash_width", 8.0f); @@ -248,7 +248,7 @@ static void wm_gesture_draw_circle(wmGesture *gt) glGetFloatv(GL_VIEWPORT, viewport_size); immUniform2f("viewport_size", viewport_size[2], viewport_size[3]); - immUniform1i("num_colors", 2); /* "advanced" mode */ + immUniform1i("colors_len", 2); /* "advanced" mode */ immUniformArray4fv("colors", (float *)(float[][4]){{0.4f, 0.4f, 0.4f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}}, 2); immUniform1f("dash_width", 4.0f); @@ -354,7 +354,7 @@ static void wm_gesture_draw_lasso(wmGesture *gt, bool filled) glGetFloatv(GL_VIEWPORT, viewport_size); immUniform2f("viewport_size", viewport_size[2], viewport_size[3]); - immUniform1i("num_colors", 2); /* "advanced" mode */ + immUniform1i("colors_len", 2); /* "advanced" mode */ immUniformArray4fv("colors", (float *)(float[][4]){{0.4f, 0.4f, 0.4f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}}, 2); immUniform1f("dash_width", 2.0f); @@ -385,7 +385,7 @@ static void wm_gesture_draw_cross(wmWindow *win, wmGesture *gt) glGetFloatv(GL_VIEWPORT, viewport_size); immUniform2f("viewport_size", viewport_size[2], viewport_size[3]); - immUniform1i("num_colors", 2); /* "advanced" mode */ + immUniform1i("colors_len", 2); /* "advanced" mode */ immUniformArray4fv("colors", (float *)(float[][4]){{0.4f, 0.4f, 0.4f, 1.0f}, {1.0f, 1.0f, 1.0f, 1.0f}}, 2); immUniform1f("dash_width", 8.0f); diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index 2b0c550280d..9c435297069 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -1367,7 +1367,7 @@ wmKeyMapItem *WM_key_event_operator( return wm_keymap_item_find(C, opname, opcontext, properties, is_hotkey, true, r_keymap); } -int WM_keymap_item_compare(wmKeyMapItem *k1, wmKeyMapItem *k2) +bool WM_keymap_item_compare(wmKeyMapItem *k1, wmKeyMapItem *k2) { int k1type, k2type; diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 334e4a70f9c..fb4ff4ddb28 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -805,7 +805,7 @@ bool WM_operator_pystring_abbreviate(char *str, int str_len_max) /* return NULL if no match is found */ #if 0 -static const char *wm_context_member_from_ptr(bContext *C, PointerRNA *ptr) +static const char *wm_context_member_from_ptr(bContext *C, const PointerRNA *ptr) { /* loop over all context items and do 2 checks * @@ -860,7 +860,7 @@ static const char *wm_context_member_from_ptr(bContext *C, PointerRNA *ptr) /* use hard coded checks for now */ -static const char *wm_context_member_from_ptr(bContext *C, PointerRNA *ptr) +static const char *wm_context_member_from_ptr(bContext *C, const PointerRNA *ptr) { const char *member_id = NULL; @@ -985,6 +985,11 @@ static char *wm_prop_pystring_from_context(bContext *C, PointerRNA *ptr, Propert return ret; } +const char *WM_context_member_from_ptr(bContext *C, const PointerRNA *ptr) +{ + return wm_context_member_from_ptr(C, ptr); +} + char *WM_prop_pystring_assign(bContext *C, PointerRNA *ptr, PropertyRNA *prop, int index) { char *lhs, *rhs, *ret; @@ -1354,7 +1359,7 @@ bool WM_operator_filesel_ensure_ext_imtype(wmOperator *op, const struct ImageFor } /* op->poll */ -int WM_operator_winactive(bContext *C) +bool WM_operator_winactive(bContext *C) { if (CTX_wm_window(C) == NULL) return 0; return 1; @@ -2150,7 +2155,7 @@ static int wm_search_menu_invoke(bContext *C, wmOperator *UNUSED(op), const wmEv } /* op->poll */ -static int wm_search_menu_poll(bContext *C) +static bool wm_search_menu_poll(bContext *C) { if (CTX_wm_window(C) == NULL) { return 0; @@ -2271,7 +2276,7 @@ static void WM_OT_call_panel(wmOperatorType *ot) /* this poll functions is needed in place of WM_operator_winactive * while it crashes on full screen */ -static int wm_operator_winactive_normal(bContext *C) +static bool wm_operator_winactive_normal(bContext *C) { wmWindow *win = CTX_wm_window(C); bScreen *screen; @@ -2371,8 +2376,9 @@ static void WM_OT_console_toggle(wmOperatorType *ot) * - draw(bContext): drawing callback for paint cursor */ -void *WM_paint_cursor_activate(wmWindowManager *wm, int (*poll)(bContext *C), - wmPaintCursorDraw draw, void *customdata) +void *WM_paint_cursor_activate( + wmWindowManager *wm, bool (*poll)(bContext *C), + wmPaintCursorDraw draw, void *customdata) { wmPaintCursor *pc = MEM_callocN(sizeof(wmPaintCursor), "paint cursor"); @@ -3981,11 +3987,14 @@ void wm_window_keymap(wmKeyConfig *keyconf) /* debug/testing */ WM_keymap_verify_item(keymap, "WM_OT_redraw_timer", TKEY, KM_PRESS, KM_ALT | KM_CTRL, 0); WM_keymap_verify_item(keymap, "WM_OT_debug_menu", DKEY, KM_PRESS, KM_ALT | KM_CTRL, 0); +#else + WM_keymap_add_item(keymap, "WM_OT_doc_view_manual_ui_context", F1KEY, KM_PRESS, 0, 0); + WM_keymap_add_menu(keymap, "TOPBAR_MT_file_specials", F2KEY, KM_PRESS, 0, 0); + WM_keymap_add_item(keymap, "WM_OT_search_menu", F3KEY, KM_PRESS, 0, 0); + WM_keymap_add_menu(keymap, "TOPBAR_MT_window_specials", F4KEY, KM_PRESS, 0, 0); #endif /* menus that can be accessed anywhere in blender */ - - WM_keymap_add_item(keymap, "WM_OT_search_menu", F3KEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "WM_OT_search_menu", ACCENTGRAVEKEY, KM_CLICK, 0, 0); WM_keymap_add_menu(keymap, "SCREEN_MT_user_menu", QKEY, KM_PRESS, 0, 0); diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c index 30b1d6237c4..8c062be2a00 100644 --- a/source/blender/windowmanager/intern/wm_playanim.c +++ b/source/blender/windowmanager/intern/wm_playanim.c @@ -67,6 +67,7 @@ #include "GPU_immediate.h" #include "GPU_immediate_util.h" #include "GPU_batch.h" +#include "GPU_init_exit.h" #include "DNA_scene_types.h" #include "ED_datafiles.h" /* for fonts */ @@ -1266,7 +1267,7 @@ static char *wm_main_playanim_intern(int argc, const char **argv) /* initialize OpenGL immediate mode */ g_WS.gwn_context = GWN_context_create(); - immInit(); + GPU_init(); /* initialize the font */ BLF_init(); @@ -1540,7 +1541,7 @@ static char *wm_main_playanim_intern(int argc, const char **argv) GPU_shader_free_builtin_shaders(); - immDestroy(); + GPU_exit(); if (g_WS.gwn_context) { GWN_context_active_set(g_WS.gwn_context); diff --git a/source/blender/windowmanager/wm.h b/source/blender/windowmanager/wm.h index c92691eb65e..3605e57be36 100644 --- a/source/blender/windowmanager/wm.h +++ b/source/blender/windowmanager/wm.h @@ -42,7 +42,7 @@ typedef struct wmPaintCursor { void *customdata; - int (*poll)(struct bContext *C); + bool (*poll)(struct bContext *C); void (*draw)(bContext *C, int, int, void *customdata); } wmPaintCursor; |