WIP: GEO: Copy curve selection #117869
@ -25,9 +25,14 @@ vendor,product,version,cve_number,remarks,comment
|
||||
@TIFF_ID@,CVE-2022-3599,Ignored,issue in tiff command line tool not used by blender
|
||||
@TIFF_ID@,CVE-2022-3626,Ignored,issue in tiff command line tool not used by blender
|
||||
@TIFF_ID@,CVE-2022-3627,Ignored,issue in tiff command line tool not used by blender
|
||||
@TIFF_ID@,CVE-2023-40745,Ignored,issue in tiff command line tool not used by blender
|
||||
@TIFF_ID@,CVE-2023-41175,Ignored,issue in tiff command line tool not used by blender
|
||||
@XML2_ID@,CVE-2016-3709,Ignored,not affecting blender and not considered a security issue upstream
|
||||
@XML2_ID@,CVE-2023-39615,Ignored,not affecting blender and not considered a security issue upstream
|
||||
@XML2_ID@,CVE-2020-7595,Ignored,already fixed in the libxml2 version used
|
||||
@GMP_ID@,CVE-2021-43618,Mitigated,patched using upstream commit 561a9c25298e
|
||||
@SQLITE_ID@,CVE-2022-35737,Ignored,only affects SQLITE_ENABLE_STAT4 compile option not used by blender or python
|
||||
@SQLITE_ID@,CVE-2023-7104,Ignored,does not affect blender use of sqlite
|
||||
@SQLITE_ID@,CVE-2024-0232,Ignored,does not affect blender use of sqlite
|
||||
@ZLIB_ID@,CVE-2023-45853,Ignored,only affects minizip not used by blender
|
||||
@SBOMCONTENTS@
|
||||
|
@ -56,7 +56,7 @@ set(BLOSC_URI https://github.com/Blosc/c-blosc/archive/v${BLOSC_VERSION}.tar.gz)
|
||||
set(BLOSC_HASH 134b55813b1dca57019d2a2dc1f7a923)
|
||||
set(BLOSC_HASH_TYPE MD5)
|
||||
set(BLOSC_FILE blosc-${BLOSC_VERSION}.tar.gz)
|
||||
set(BLOSC_CPE "cpe:2.3:a:c-blosc2_project:c-blosc2:${BLOSC_VERSION}:*:*:*:*:*:*:*")
|
||||
set(BLOSC_CPE "cpe:2.3:a:c-blosc_project:c-blosc:${BLOSC_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(PTHREADS_VERSION 3.0.0)
|
||||
set(PTHREADS_URI http://prdownloads.sourceforge.net/pthreads4w/pthreads4w-code-v${PTHREADS_VERSION}.zip)
|
||||
@ -218,11 +218,11 @@ set(OSL_FILE OpenShadingLanguage-${OSL_VERSION}.tar.gz)
|
||||
# BZIP2, FFI, SQLITE and change the versions in this file as well. For compliance
|
||||
# reasons there can be no exceptions to this.
|
||||
|
||||
set(PYTHON_VERSION 3.11.6)
|
||||
set(PYTHON_VERSION 3.11.7)
|
||||
set(PYTHON_SHORT_VERSION 3.11)
|
||||
set(PYTHON_SHORT_VERSION_NO_DOTS 311)
|
||||
set(PYTHON_URI https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tar.xz)
|
||||
set(PYTHON_HASH d0c5a1a31efe879723e51addf56dd206)
|
||||
set(PYTHON_HASH d96c7e134c35a8c46236f8a0e566b69c)
|
||||
set(PYTHON_HASH_TYPE MD5)
|
||||
set(PYTHON_FILE Python-${PYTHON_VERSION}.tar.xz)
|
||||
set(PYTHON_CPE "cpe:2.3:a:python:python:${PYTHON_VERSION}:-:*:*:*:*:*:*")
|
||||
@ -318,9 +318,9 @@ set(FLAC_FILE flac-${FLAC_VERSION}.tar.xz)
|
||||
set(FLAC_CPE "cpe:2.3:a:flac_project:flac:${FLAC_VERSION}:*:*:*:*:*:*:*")
|
||||
set(FLAC_HOMEPAGE https://xiph.org/flac/)
|
||||
|
||||
set(VPX_VERSION 1.11.0)
|
||||
set(VPX_VERSION 1.14.0)
|
||||
set(VPX_URI https://github.com/webmproject/libvpx/archive/v${VPX_VERSION}/libvpx-v${VPX_VERSION}.tar.gz)
|
||||
set(VPX_HASH 965e51c91ad9851e2337aebcc0f517440c637c506f3a03948062e3d5ea129a83)
|
||||
set(VPX_HASH 5f21d2db27071c8a46f1725928a10227ae45c5cd1cad3727e4aafbe476e321fa)
|
||||
set(VPX_HASH_TYPE SHA256)
|
||||
set(VPX_FILE libvpx-v${VPX_VERSION}.tar.gz)
|
||||
set(VPX_CPE "cpe:2.3:a:webmproject:libvpx:${VPX_VERSION}:*:*:*:*:*:*:*")
|
||||
@ -347,9 +347,9 @@ set(OPENJPEG_HASH_TYPE SHA256)
|
||||
set(OPENJPEG_FILE openjpeg-v${OPENJPEG_VERSION}.tar.gz)
|
||||
set(OPENJPEG_CPE "cpe:2.3:a:uclouvain:openjpeg:${OPENJPEG_VERSION}:*:*:*:*:*:*:*")
|
||||
|
||||
set(FFMPEG_VERSION 6.0)
|
||||
set(FFMPEG_VERSION 6.1.1)
|
||||
set(FFMPEG_URI http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2)
|
||||
set(FFMPEG_HASH 47d062731c9f66a78380e35a19aac77cebceccd1c7cc309b9c82343ffc430c3d)
|
||||
set(FFMPEG_HASH 5e3133939a61ef64ac9b47ffd29a5ea6e337a4023ef0ad972094b4da844e3a20)
|
||||
set(FFMPEG_HASH_TYPE SHA256)
|
||||
set(FFMPEG_FILE ffmpeg-${FFMPEG_VERSION}.tar.bz2)
|
||||
set(FFMPEG_CPE "cpe:2.3:a:ffmpeg:ffmpeg:${FFMPEG_VERSION}:*:*:*:*:*:*:*")
|
||||
@ -479,9 +479,9 @@ set(LZMA_FILE xz-${LZMA_VERSION}.tar.bz2)
|
||||
set(LZMA_HOMEPAGE https://tukaani.org/lzma/)
|
||||
|
||||
# NOTE: Python's build has been modified to use our ssl version.
|
||||
set(SSL_VERSION 3.1.2)
|
||||
set(SSL_VERSION 3.1.5)
|
||||
set(SSL_URI https://www.openssl.org/source/openssl-${SSL_VERSION}.tar.gz)
|
||||
set(SSL_HASH a0ce69b8b97ea6a35b96875235aa453b966ba3cba8af2de23657d8b6767d6539)
|
||||
set(SSL_HASH 6ae015467dabf0469b139ada93319327be24b98251ffaeceda0221848dc09262)
|
||||
set(SSL_HASH_TYPE SHA256)
|
||||
set(SSL_FILE openssl-${SSL_VERSION}.tar.gz)
|
||||
set(SSL_CPE "cpe:2.3:a:openssl:openssl:${SSL_VERSION}:*:*:*:*:*:*:*")
|
||||
@ -490,9 +490,9 @@ set(SSL_HOMEPAGE https://www.openssl.org)
|
||||
# Note: This will *HAVE* to match the version python ships on windows which
|
||||
# is hardcoded in pythons PCbuild/get_externals.bat for compliance reasons there
|
||||
# can be no exceptions to this.
|
||||
set(SQLITE_VERSION 3.42.0)
|
||||
set(SQLLITE_LONG_VERSION 3420000)
|
||||
set(SQLITE_URI https://www.sqlite.org/2023/sqlite-autoconf-${SQLLITE_LONG_VERSION}.tar.gz)
|
||||
set(SQLITE_VERSION 3.45.1)
|
||||
set(SQLLITE_LONG_VERSION 3450100)
|
||||
set(SQLITE_URI https://www.sqlite.org/2024/sqlite-autoconf-${SQLLITE_LONG_VERSION}.tar.gz)
|
||||
set(SQLITE_HASH 036575929b174c1b829769255491ba2b32bda9ee)
|
||||
set(SQLITE_HASH_TYPE SHA1)
|
||||
set(SQLITE_FILE sqlite-autoconf-${SQLLITE_LONG_VERSION}.tar.gz)
|
||||
|
@ -4612,6 +4612,8 @@ def km_grease_pencil_edit_mode(params):
|
||||
# Dissolve
|
||||
("grease_pencil.dissolve", {"type": 'X', "value": 'PRESS', "ctrl": True}, None),
|
||||
("grease_pencil.dissolve", {"type": 'DEL', "value": 'PRESS', "ctrl": True}, None),
|
||||
# Separate
|
||||
("grease_pencil.separate", {"type": 'P', "value": 'PRESS'}, None),
|
||||
# Delete all active frames
|
||||
("grease_pencil.delete_frame", {"type": 'DEL', "value": 'PRESS', "shift": True},
|
||||
{"properties": [("type", "ALL_FRAMES")]}),
|
||||
|
@ -1431,8 +1431,11 @@ class IMAGE_PT_view_vectorscope(ImageScopesPanel, Panel):
|
||||
layout = self.layout
|
||||
|
||||
sima = context.space_data
|
||||
|
||||
layout.template_vectorscope(sima, "scopes")
|
||||
layout.prop(sima.scopes, "vectorscope_alpha")
|
||||
row = layout.split(factor=0.75)
|
||||
row.prop(sima.scopes, "vectorscope_alpha")
|
||||
row.prop(sima.scopes, "vectorscope_mode", text="")
|
||||
|
||||
|
||||
class IMAGE_PT_sample_line(ImageScopesPanel, Panel):
|
||||
|
@ -1597,12 +1597,12 @@ class USERPREF_UL_asset_libraries(UIList):
|
||||
class USERPREF_UL_extension_repos(UIList):
|
||||
def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname, _index):
|
||||
repo = item
|
||||
|
||||
icon = 'WORLD' if repo.use_remote_path else 'DISK_DRIVE'
|
||||
if self.layout_type in {'DEFAULT', 'COMPACT'}:
|
||||
layout.prop(repo, "name", text="", emboss=False)
|
||||
layout.prop(repo, "name", text="", icon=icon, emboss=False)
|
||||
elif self.layout_type == 'GRID':
|
||||
layout.alignment = 'CENTER'
|
||||
layout.prop(repo, "name", text="", emboss=False)
|
||||
layout.prop(repo, "name", text="", icon=icon, emboss=False)
|
||||
|
||||
# Show an error icon if this repository has unusable settings.
|
||||
if repo.enabled:
|
||||
@ -2047,7 +2047,7 @@ class USERPREF_PT_extensions_repos(Panel):
|
||||
layout.use_property_decorate = False
|
||||
|
||||
paths = context.preferences.filepaths
|
||||
active_library_index = paths.active_extension_repo
|
||||
active_repo_index = paths.active_extension_repo
|
||||
|
||||
row = layout.row()
|
||||
|
||||
@ -2060,10 +2060,14 @@ class USERPREF_PT_extensions_repos(Panel):
|
||||
col = row.column(align=True)
|
||||
col.operator_menu_enum("preferences.extension_repo_add", "type", text="", icon='ADD')
|
||||
props = col.operator_menu_enum("preferences.extension_repo_remove", "type", text="", icon='REMOVE')
|
||||
props.index = active_library_index
|
||||
props.index = active_repo_index
|
||||
|
||||
col.separator()
|
||||
col.operator("preferences.extension_repo_sync", text="", icon='FILE_REFRESH')
|
||||
col.operator("preferences.extension_repo_upgrade", text="", icon='IMPORT')
|
||||
|
||||
try:
|
||||
active_repo = None if active_library_index < 0 else paths.extension_repos[active_library_index]
|
||||
active_repo = None if active_repo_index < 0 else paths.extension_repos[active_repo_index]
|
||||
except IndexError:
|
||||
active_repo = None
|
||||
|
||||
@ -2072,14 +2076,16 @@ class USERPREF_PT_extensions_repos(Panel):
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.prop(active_repo, "use_remote_path", text="Use Remote URL")
|
||||
row = layout.row()
|
||||
# NOTE: changing repositories from remote to local & vice versa could be supported but is obscure enough
|
||||
# that it can be hidden entirely. If there is a some justification to show this, it can be exposed.
|
||||
# For now it can be accessed from Python if someone is.
|
||||
# `layout.prop(active_repo, "use_remote_path", text="Use Remote URL")`
|
||||
|
||||
if active_repo.use_remote_path:
|
||||
row = layout.row()
|
||||
if active_repo.remote_path == "":
|
||||
row.alert = True
|
||||
else:
|
||||
row.active = False
|
||||
row.prop(active_repo, "remote_path", text="")
|
||||
row.prop(active_repo, "remote_path", text="URL")
|
||||
|
||||
if layout_panel := self._panel_layout_kludge(layout, text="Advanced"):
|
||||
|
||||
|
@ -5825,6 +5825,10 @@ class VIEW3D_MT_edit_greasepencil(Menu):
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.operator_menu_enum("grease_pencil.separate", "mode", text="Separate")
|
||||
|
||||
layout.separator()
|
||||
|
||||
layout.menu("GREASE_PENCIL_MT_layer_active", text="Active Layer")
|
||||
|
||||
layout.separator()
|
||||
@ -8225,6 +8229,10 @@ class VIEW3D_MT_greasepencil_edit_context_menu(Menu):
|
||||
|
||||
col.menu("VIEW3D_MT_mirror", text="Mirror Points")
|
||||
|
||||
col.separator()
|
||||
|
||||
col.operator("grease_pencil.separate", text="Separate").mode = 'SELECTED'
|
||||
|
||||
# Removal Operators
|
||||
col.separator()
|
||||
|
||||
@ -8254,6 +8262,10 @@ class VIEW3D_MT_greasepencil_edit_context_menu(Menu):
|
||||
|
||||
col.menu("VIEW3D_MT_mirror")
|
||||
|
||||
col.separator()
|
||||
|
||||
col.operator("grease_pencil.separate", text="Separate").mode = 'SELECTED'
|
||||
|
||||
|
||||
def draw_gpencil_layer_active(context, layout):
|
||||
gpl = context.active_gpencil_layer
|
||||
|
@ -112,6 +112,8 @@ typedef enum {
|
||||
BKE_CB_EVT_TRANSLATION_UPDATE_POST,
|
||||
BKE_CB_EVT_EXTENSION_REPOS_UPDATE_PRE,
|
||||
BKE_CB_EVT_EXTENSION_REPOS_UPDATE_POST,
|
||||
BKE_CB_EVT_EXTENSION_REPOS_SYNC,
|
||||
BKE_CB_EVT_EXTENSION_REPOS_UPGRADE,
|
||||
BKE_CB_EVT_TOT,
|
||||
} eCbEvent;
|
||||
|
||||
|
@ -93,7 +93,7 @@ void BKE_object_defgroup_unique_name(bDeformGroup *dg, Object *ob);
|
||||
|
||||
MDeformWeight *BKE_defvert_find_index(const MDeformVert *dv, int defgroup);
|
||||
/**
|
||||
* Ensures that `dv` has a deform weight entry for the specified defweight group.
|
||||
* Ensures that `dv` has a deform weight entry for the specified group (`defgroup`).
|
||||
*
|
||||
* \note this function is mirrored in editmesh_tools.cc, for use for edit-vertices.
|
||||
*/
|
||||
|
@ -706,6 +706,7 @@ TREENODE_COMMON_METHODS_FORWARD_IMPL(LayerGroup);
|
||||
namespace convert {
|
||||
|
||||
void legacy_gpencil_frame_to_grease_pencil_drawing(const bGPDframe &gpf,
|
||||
const ListBase &vertex_group_names,
|
||||
GreasePencilDrawing &r_drawing);
|
||||
void legacy_gpencil_to_grease_pencil(Main &main, GreasePencil &grease_pencil, bGPdata &gpd);
|
||||
|
||||
|
@ -1359,6 +1359,12 @@ static void save_sample_line(
|
||||
scopes->vecscope[idx + 0] = yuv[1];
|
||||
scopes->vecscope[idx + 1] = yuv[2];
|
||||
|
||||
int color_idx = (idx / 2) * 4;
|
||||
scopes->vecscope_rgb[color_idx + 0] = rgb[0];
|
||||
scopes->vecscope_rgb[color_idx + 1] = rgb[1];
|
||||
scopes->vecscope_rgb[color_idx + 2] = rgb[2];
|
||||
scopes->vecscope_rgb[color_idx + 3] = scopes->vecscope_alpha;
|
||||
|
||||
/* Waveform. */
|
||||
switch (scopes->wavefrm_mode) {
|
||||
case SCOPES_WAVEFRM_RGB:
|
||||
@ -1707,6 +1713,7 @@ void BKE_scopes_update(Scopes *scopes,
|
||||
}
|
||||
if (scopes->vecscope) {
|
||||
MEM_freeN(scopes->vecscope);
|
||||
MEM_freeN(scopes->vecscope_rgb);
|
||||
}
|
||||
|
||||
scopes->waveform_1 = static_cast<float *>(
|
||||
@ -1717,6 +1724,8 @@ void BKE_scopes_update(Scopes *scopes,
|
||||
MEM_callocN(scopes->waveform_tot * 2 * sizeof(float), "waveform point channel 3"));
|
||||
scopes->vecscope = static_cast<float *>(
|
||||
MEM_callocN(scopes->waveform_tot * 2 * sizeof(float), "vectorscope point channel"));
|
||||
scopes->vecscope_rgb = static_cast<float *>(
|
||||
MEM_callocN(scopes->waveform_tot * 4 * sizeof(float), "vectorscope color channel"));
|
||||
|
||||
if (ibuf->float_buffer.data) {
|
||||
cm_processor = IMB_colormanagement_display_processor_new(view_settings, display_settings);
|
||||
@ -1794,6 +1803,7 @@ void BKE_scopes_free(Scopes *scopes)
|
||||
MEM_SAFE_FREE(scopes->waveform_2);
|
||||
MEM_SAFE_FREE(scopes->waveform_3);
|
||||
MEM_SAFE_FREE(scopes->vecscope);
|
||||
MEM_SAFE_FREE(scopes->vecscope_rgb);
|
||||
}
|
||||
|
||||
void BKE_scopes_new(Scopes *scopes)
|
||||
@ -1810,6 +1820,7 @@ void BKE_scopes_new(Scopes *scopes)
|
||||
scopes->waveform_2 = nullptr;
|
||||
scopes->waveform_3 = nullptr;
|
||||
scopes->vecscope = nullptr;
|
||||
scopes->vecscope_rgb = nullptr;
|
||||
}
|
||||
|
||||
void BKE_color_managed_display_settings_init(ColorManagedDisplaySettings *settings)
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include "BKE_attribute.hh"
|
||||
#include "BKE_curves.hh"
|
||||
#include "BKE_deform.hh"
|
||||
#include "BKE_grease_pencil.hh"
|
||||
#include "BKE_material.h"
|
||||
|
||||
@ -19,10 +20,52 @@
|
||||
|
||||
#include "DNA_gpencil_legacy_types.h"
|
||||
#include "DNA_grease_pencil_types.h"
|
||||
#include "DNA_meshdata_types.h"
|
||||
|
||||
namespace blender::bke::greasepencil::convert {
|
||||
|
||||
/**
|
||||
* Find vertex groups that have assigned vertices in this drawing.
|
||||
* Returns:
|
||||
* - ListBase with used vertex group names (bDeformGroup)
|
||||
* - Array of indices in the new vertex group list for remapping
|
||||
*/
|
||||
static void find_used_vertex_groups(const bGPDframe &gpf,
|
||||
const ListBase &all_names,
|
||||
ListBase &r_vertex_group_names,
|
||||
Array<int> &r_indices)
|
||||
{
|
||||
const int num_vertex_groups = BLI_listbase_count(&all_names);
|
||||
Array<int> is_group_used(num_vertex_groups, false);
|
||||
LISTBASE_FOREACH (bGPDstroke *, gps, &gpf.strokes) {
|
||||
if (!gps->dvert) {
|
||||
continue;
|
||||
}
|
||||
Span<MDeformVert> dverts = {gps->dvert, gps->totpoints};
|
||||
for (const MDeformVert &dvert : dverts) {
|
||||
for (const MDeformWeight &weight : Span<MDeformWeight>{dvert.dw, dvert.totweight}) {
|
||||
is_group_used[weight.def_nr] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
BLI_listbase_clear(&r_vertex_group_names);
|
||||
r_indices.reinitialize(num_vertex_groups);
|
||||
int new_group_i = 0;
|
||||
int old_group_i;
|
||||
LISTBASE_FOREACH_INDEX (const bDeformGroup *, def_group, &all_names, old_group_i) {
|
||||
if (!is_group_used[old_group_i]) {
|
||||
r_indices[old_group_i] = -1;
|
||||
continue;
|
||||
}
|
||||
r_indices[old_group_i] = new_group_i++;
|
||||
|
||||
bDeformGroup *def_group_copy = static_cast<bDeformGroup *>(MEM_dupallocN(def_group));
|
||||
BLI_addtail(&r_vertex_group_names, def_group_copy);
|
||||
}
|
||||
}
|
||||
|
||||
void legacy_gpencil_frame_to_grease_pencil_drawing(const bGPDframe &gpf,
|
||||
const ListBase &vertex_group_names,
|
||||
GreasePencilDrawing &r_drawing)
|
||||
{
|
||||
/* Construct an empty CurvesGeometry in-place. */
|
||||
@ -54,6 +97,25 @@ void legacy_gpencil_frame_to_grease_pencil_drawing(const bGPDframe &gpf,
|
||||
/* All strokes are poly curves. */
|
||||
curves.fill_curve_types(CURVE_TYPE_POLY);
|
||||
|
||||
/* Find used vertex groups in this drawing. */
|
||||
ListBase stroke_vertex_group_names;
|
||||
Array<int> stroke_def_nr_map;
|
||||
find_used_vertex_groups(gpf, vertex_group_names, stroke_vertex_group_names, stroke_def_nr_map);
|
||||
BLI_assert(BLI_listbase_is_empty(&curves.vertex_group_names));
|
||||
curves.vertex_group_names = stroke_vertex_group_names;
|
||||
const bool use_dverts = !BLI_listbase_is_empty(&curves.vertex_group_names);
|
||||
|
||||
/* Copy vertex weights and map the vertex group indices. */
|
||||
auto copy_dvert = [&](const MDeformVert &src_dvert, MDeformVert &dst_dvert) {
|
||||
dst_dvert = src_dvert;
|
||||
dst_dvert.dw = static_cast<MDeformWeight *>(MEM_dupallocN(src_dvert.dw));
|
||||
const MutableSpan<MDeformWeight> vertex_weights = {dst_dvert.dw, dst_dvert.totweight};
|
||||
for (MDeformWeight &weight : vertex_weights) {
|
||||
/* Map def_nr to the reduced vertex group list. */
|
||||
weight.def_nr = stroke_def_nr_map[weight.def_nr];
|
||||
}
|
||||
};
|
||||
|
||||
/* Point Attributes. */
|
||||
MutableSpan<float3> positions = curves.positions_for_write();
|
||||
MutableSpan<float> radii = drawing.radii_for_write();
|
||||
@ -66,6 +128,8 @@ void legacy_gpencil_frame_to_grease_pencil_drawing(const bGPDframe &gpf,
|
||||
attributes.lookup_or_add_for_write_span<ColorGeometry4f>("vertex_color", AttrDomain::Point);
|
||||
SpanAttributeWriter<bool> selection = attributes.lookup_or_add_for_write_span<bool>(
|
||||
".selection", AttrDomain::Point);
|
||||
MutableSpan<MDeformVert> dverts = use_dverts ? curves.wrap().deform_verts_for_write() :
|
||||
MutableSpan<MDeformVert>();
|
||||
|
||||
/* Curve Attributes. */
|
||||
SpanAttributeWriter<bool> stroke_cyclic = attributes.lookup_or_add_for_write_span<bool>(
|
||||
@ -126,6 +190,8 @@ void legacy_gpencil_frame_to_grease_pencil_drawing(const bGPDframe &gpf,
|
||||
MutableSpan<ColorGeometry4f> stroke_vertex_colors = vertex_colors.span.slice(
|
||||
stroke_points_range);
|
||||
MutableSpan<bool> stroke_selections = selection.span.slice(stroke_points_range);
|
||||
MutableSpan<MDeformVert> stroke_dverts = use_dverts ? dverts.slice(stroke_points_range) :
|
||||
MutableSpan<MDeformVert>();
|
||||
|
||||
/* Do first point. */
|
||||
const bGPDspoint &first_pt = stroke_points.first();
|
||||
@ -143,6 +209,9 @@ void legacy_gpencil_frame_to_grease_pencil_drawing(const bGPDframe &gpf,
|
||||
stroke_rotations.first() = first_pt.uv_rot;
|
||||
stroke_vertex_colors.first() = ColorGeometry4f(first_pt.vert_color);
|
||||
stroke_selections.first() = (first_pt.flag & GP_SPOINT_SELECT) != 0;
|
||||
if (use_dverts && gps->dvert) {
|
||||
copy_dvert(gps->dvert[0], stroke_dverts.first());
|
||||
}
|
||||
|
||||
/* Do the rest of the points. */
|
||||
for (const int i : stroke_points.index_range().drop_back(1)) {
|
||||
@ -156,6 +225,9 @@ void legacy_gpencil_frame_to_grease_pencil_drawing(const bGPDframe &gpf,
|
||||
stroke_rotations[point_i] = pt.uv_rot;
|
||||
stroke_vertex_colors[point_i] = ColorGeometry4f(pt.vert_color);
|
||||
stroke_selections[point_i] = (pt.flag & GP_SPOINT_SELECT) != 0;
|
||||
if (use_dverts && gps->dvert) {
|
||||
copy_dvert(gps->dvert[point_i], stroke_dverts[point_i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -225,7 +297,7 @@ void legacy_gpencil_to_grease_pencil(Main &bmain, GreasePencil &grease_pencil, b
|
||||
grease_pencil.drawing_array[i]);
|
||||
|
||||
/* Convert the frame to a drawing. */
|
||||
legacy_gpencil_frame_to_grease_pencil_drawing(*gpf, drawing);
|
||||
legacy_gpencil_frame_to_grease_pencil_drawing(*gpf, gpd.vertex_group_names, drawing);
|
||||
|
||||
/* Add the frame to the layer. */
|
||||
if (GreasePencilFrame *new_frame = new_layer.add_frame(gpf->framenum, i)) {
|
||||
@ -242,6 +314,10 @@ void legacy_gpencil_to_grease_pencil(Main &bmain, GreasePencil &grease_pencil, b
|
||||
/* TODO: Update drawing user counts. */
|
||||
}
|
||||
|
||||
/* Copy vertex group names and settings. */
|
||||
BKE_defgroup_copy_list(&grease_pencil.vertex_group_names, &gpd.vertex_group_names);
|
||||
grease_pencil.vertex_group_active_index = gpd.vertex_group_active_index;
|
||||
|
||||
/* Convert the onion skinning settings. */
|
||||
grease_pencil.onion_skinning_settings.opacity = gpd.onion_factor;
|
||||
grease_pencil.onion_skinning_settings.mode = gpd.onion_mode;
|
||||
|
@ -428,7 +428,7 @@ static ImageGPUTextures image_get_gpu_texture(Image *ima,
|
||||
void *lock;
|
||||
ImBuf *ibuf = BKE_image_acquire_ibuf(ima, iuser, (use_viewers) ? &lock : nullptr);
|
||||
if (ibuf == nullptr) {
|
||||
BKE_image_release_ibuf(ima, ibuf, (use_viewers) ? &lock : nullptr);
|
||||
BKE_image_release_ibuf(ima, ibuf, (use_viewers) ? lock : nullptr);
|
||||
*tex = image_gpu_texture_error_create(textarget);
|
||||
result.texture = *tex;
|
||||
|
||||
@ -473,7 +473,7 @@ static ImageGPUTextures image_get_gpu_texture(Image *ima,
|
||||
GPU_texture_original_size_set(*tex, ibuf->x, ibuf->y);
|
||||
}
|
||||
|
||||
BKE_image_release_ibuf(ima, ibuf, (use_viewers) ? &lock : nullptr);
|
||||
BKE_image_release_ibuf(ima, ibuf, (use_viewers) ? lock : nullptr);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -1844,6 +1844,18 @@ static bool ch_is_op(char op)
|
||||
}
|
||||
}
|
||||
|
||||
static bool ch_is_op_unary(char op)
|
||||
{
|
||||
switch (op) {
|
||||
case '+':
|
||||
case '-':
|
||||
case '~':
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function for #unit_distribute_negatives to find the next negative to distribute.
|
||||
*
|
||||
@ -1912,6 +1924,18 @@ static char *find_next_op(const char *str, char *remaining_str, int remaining_st
|
||||
return remaining_str + i;
|
||||
}
|
||||
|
||||
/**
|
||||
* Skip over multiple successive unary operators (typically `-`), skipping spaces.
|
||||
* This allows for `--90d` to be handled properly, see: #117783.
|
||||
*/
|
||||
static char *skip_unary_op(char *str)
|
||||
{
|
||||
while (*str == ' ' || ch_is_op_unary(*str)) {
|
||||
str++;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Put parentheses around blocks of values after negative signs to get rid of an implied "+"
|
||||
* between numbers without an operation between them. For example:
|
||||
@ -1937,8 +1961,9 @@ static bool unit_distribute_negatives(char *str, const int str_maxncpy)
|
||||
memmove(remaining_str + 1, remaining_str, remaining_str_maxncpy - 2);
|
||||
*remaining_str = '(';
|
||||
|
||||
/* Add the ')' before the next operation or at the end. */
|
||||
remaining_str = find_next_op(str, remaining_str + 1, remaining_str_maxncpy);
|
||||
/* Add the ')' before the next operation or at the end.
|
||||
* Unary operators are skipped to allow `--` to be a supported prefix. */
|
||||
remaining_str = find_next_op(str, skip_unary_op(remaining_str + 1), remaining_str_maxncpy);
|
||||
remaining_str_maxncpy = str_maxncpy - int(remaining_str - str);
|
||||
memmove(remaining_str + 1, remaining_str, remaining_str_maxncpy - 2);
|
||||
*remaining_str = ')';
|
||||
|
@ -308,7 +308,7 @@ class Any {
|
||||
}
|
||||
else {
|
||||
/* Using #malloc so that the #unique_ptr can free the memory. */
|
||||
T *value = static_cast<T *>(malloc(sizeof(T)));
|
||||
T *value = static_cast<T *>(::operator new(sizeof(T)));
|
||||
new (&buffer_) std::unique_ptr<T>(value);
|
||||
return value;
|
||||
}
|
||||
|
@ -626,7 +626,7 @@ constexpr bool operator>=(StringRef a, StringRef b)
|
||||
* \{ */
|
||||
|
||||
/**
|
||||
* Support using the fmt library with #StringRef and implicitly also #StringRefNull.
|
||||
* Support using the `fmt` library with #StringRef and implicitly also #StringRefNull.
|
||||
*/
|
||||
inline std::string_view format_as(StringRef str)
|
||||
{
|
||||
|
@ -593,6 +593,8 @@ if(WITH_COMPOSITOR_CPU)
|
||||
|
||||
algorithms/COM_JumpFloodingAlgorithm.cc
|
||||
algorithms/COM_JumpFloodingAlgorithm.h
|
||||
algorithms/COM_SymmetricSeparableBlurVariableSizeAlgorithm.cc
|
||||
algorithms/COM_SymmetricSeparableBlurVariableSizeAlgorithm.h
|
||||
)
|
||||
|
||||
set(LIB
|
||||
|
@ -0,0 +1,105 @@
|
||||
/* SPDX-FileCopyrightText: 2024 Blender Authors
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "BLI_index_range.hh"
|
||||
#include "BLI_math_base.hh"
|
||||
#include "BLI_task.hh"
|
||||
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
#include "RE_pipeline.h"
|
||||
|
||||
#include "COM_MemoryBuffer.h"
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
static MemoryBuffer compute_symmetric_separable_blur_weights(int type, float radius)
|
||||
{
|
||||
const int size = math::ceil(radius) + 1;
|
||||
rcti rect;
|
||||
BLI_rcti_init(&rect, 0, size, 0, 1);
|
||||
MemoryBuffer weights = MemoryBuffer(DataType::Value, rect);
|
||||
|
||||
float sum = 0.0f;
|
||||
|
||||
const float center_weight = RE_filter_value(type, 0.0f);
|
||||
*weights.get_elem(0, 0) = center_weight;
|
||||
sum += center_weight;
|
||||
|
||||
const float scale = radius > 0.0f ? 1.0f / radius : 0.0f;
|
||||
for (const int i : IndexRange(size).drop_front(1)) {
|
||||
const float weight = RE_filter_value(type, i * scale);
|
||||
*weights.get_elem(i, 0) = weight;
|
||||
sum += weight * 2.0f;
|
||||
}
|
||||
|
||||
for (const int i : IndexRange(size)) {
|
||||
*weights.get_elem(i, 0) /= sum;
|
||||
}
|
||||
|
||||
return weights;
|
||||
}
|
||||
|
||||
static float sample_weight(const MemoryBuffer &weights, float parameter)
|
||||
{
|
||||
const int size = weights.get_width();
|
||||
float weight;
|
||||
weights.read_elem_bilinear(parameter * size, 0.0f, &weight);
|
||||
return weight;
|
||||
}
|
||||
|
||||
static void blur_pass(const MemoryBuffer &input,
|
||||
const MemoryBuffer &radius_buffer,
|
||||
const MemoryBuffer &weights,
|
||||
MemoryBuffer &output,
|
||||
bool is_vertical)
|
||||
{
|
||||
const int2 size = int2(input.get_width(), input.get_height());
|
||||
threading::parallel_for(IndexRange(size.y), 1, [&](const IndexRange sub_y_range) {
|
||||
for (const int64_t y : sub_y_range) {
|
||||
for (const int64_t x : IndexRange(size.x)) {
|
||||
int2 texel = int2(x, y);
|
||||
|
||||
float accumulated_weight = 0.0f;
|
||||
float4 accumulated_color = float4(0.0f);
|
||||
|
||||
float4 center_color = float4(input.get_elem(x, y));
|
||||
float center_weight = *weights.get_elem(0, 0);
|
||||
accumulated_color += center_color * center_weight;
|
||||
accumulated_weight += center_weight;
|
||||
|
||||
int radius = int(
|
||||
*(is_vertical ? radius_buffer.get_elem(y, x) : radius_buffer.get_elem(x, y)));
|
||||
|
||||
for (int i = 1; i <= radius; i++) {
|
||||
float weight = sample_weight(weights, (float(i) + 0.5f) / float(radius + 1));
|
||||
accumulated_color += float4(input.get_elem_clamped(x + i, y)) * weight;
|
||||
accumulated_color += float4(input.get_elem_clamped(x - i, y)) * weight;
|
||||
accumulated_weight += weight * 2.0f;
|
||||
}
|
||||
|
||||
const float4 final_color = accumulated_color / accumulated_weight;
|
||||
copy_v4_v4(output.get_elem(y, x), final_color);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void symmetric_separable_blur_variable_size(const MemoryBuffer &input,
|
||||
MemoryBuffer &output,
|
||||
const MemoryBuffer &radius,
|
||||
int filter_type,
|
||||
int weights_resolution)
|
||||
{
|
||||
const MemoryBuffer weights = compute_symmetric_separable_blur_weights(filter_type,
|
||||
weights_resolution);
|
||||
rcti rect;
|
||||
BLI_rcti_init(&rect, 0, input.get_height(), 0, input.get_width());
|
||||
MemoryBuffer horizontal_pass_result = MemoryBuffer(DataType::Color, rect);
|
||||
|
||||
blur_pass(input, radius, weights, horizontal_pass_result, false);
|
||||
blur_pass(horizontal_pass_result, radius, weights, output, true);
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
@ -0,0 +1,21 @@
|
||||
/* SPDX-FileCopyrightText: 2024 Blender Authors
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
#include "COM_MemoryBuffer.h"
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
/* Identical to the same function in COM_algorithm_symmetric_separable_blur_variable_size.hh, see
|
||||
* the function and its implementation for more details. */
|
||||
void symmetric_separable_blur_variable_size(const MemoryBuffer &input,
|
||||
MemoryBuffer &output,
|
||||
const MemoryBuffer &radius,
|
||||
int filter_type = R_FILTER_GAUSS,
|
||||
int weights_resolution = 128);
|
||||
|
||||
} // namespace blender::compositor
|
@ -21,7 +21,7 @@ void InpaintNode::convert_to_operations(NodeConverter &converter,
|
||||
/* if (editor_node->custom1 == CMP_NODE_INPAINT_SIMPLE) { */
|
||||
if (true) {
|
||||
InpaintSimpleOperation *operation = new InpaintSimpleOperation();
|
||||
operation->set_iterations(editor_node->custom2);
|
||||
operation->set_max_distance(editor_node->custom2);
|
||||
converter.add_operation(operation);
|
||||
|
||||
converter.map_input_socket(get_input_socket(0), operation->get_input_socket(0));
|
||||
|
@ -2,6 +2,9 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "BLI_math_vector.h"
|
||||
#include "BLI_math_vector.hh"
|
||||
|
||||
#include "COM_BokehBlurOperation.h"
|
||||
#include "COM_ConstantOperation.h"
|
||||
|
||||
@ -40,16 +43,6 @@ void BokehBlurOperation::init_data()
|
||||
if (execution_model_ == eExecutionModel::FullFrame) {
|
||||
update_size();
|
||||
}
|
||||
|
||||
NodeOperation *bokeh = get_input_operation(BOKEH_INPUT_INDEX);
|
||||
const int width = bokeh->get_width();
|
||||
const int height = bokeh->get_height();
|
||||
|
||||
const float dimension = std::min(width, height);
|
||||
|
||||
bokeh_mid_x_ = width / 2.0f;
|
||||
bokeh_mid_y_ = height / 2.0f;
|
||||
bokehDimension_ = dimension / 2.0f;
|
||||
}
|
||||
|
||||
void *BokehBlurOperation::initialize_tile_data(rcti * /*rect*/)
|
||||
@ -76,63 +69,37 @@ void BokehBlurOperation::init_execution()
|
||||
|
||||
void BokehBlurOperation::execute_pixel(float output[4], int x, int y, void *data)
|
||||
{
|
||||
float color_accum[4];
|
||||
MemoryBuffer *input_buffer = (MemoryBuffer *)data;
|
||||
|
||||
float temp_bounding_box[4];
|
||||
float bokeh[4];
|
||||
|
||||
input_bounding_box_reader_->read_sampled(temp_bounding_box, x, y, PixelSampler::Nearest);
|
||||
if (temp_bounding_box[0] > 0.0f) {
|
||||
float multiplier_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
MemoryBuffer *input_buffer = (MemoryBuffer *)data;
|
||||
const rcti &input_rect = input_buffer->get_rect();
|
||||
float *buffer = input_buffer->get_buffer();
|
||||
int bufferwidth = input_buffer->get_width();
|
||||
int bufferstartx = input_rect.xmin;
|
||||
int bufferstarty = input_rect.ymin;
|
||||
const float max_dim = std::max(this->get_width(), this->get_height());
|
||||
int pixel_size = size_ * max_dim / 100.0f;
|
||||
zero_v4(color_accum);
|
||||
|
||||
if (pixel_size < 2) {
|
||||
input_program_->read_sampled(color_accum, x, y, PixelSampler::Nearest);
|
||||
multiplier_accum[0] = 1.0f;
|
||||
multiplier_accum[1] = 1.0f;
|
||||
multiplier_accum[2] = 1.0f;
|
||||
multiplier_accum[3] = 1.0f;
|
||||
}
|
||||
int miny = y - pixel_size;
|
||||
int maxy = y + pixel_size;
|
||||
int minx = x - pixel_size;
|
||||
int maxx = x + pixel_size;
|
||||
miny = std::max(miny, input_rect.ymin);
|
||||
minx = std::max(minx, input_rect.xmin);
|
||||
maxy = std::min(maxy, input_rect.ymax);
|
||||
maxx = std::min(maxx, input_rect.xmax);
|
||||
|
||||
int step = get_step();
|
||||
int offsetadd = get_offset_add() * COM_DATA_TYPE_COLOR_CHANNELS;
|
||||
|
||||
float m = bokehDimension_ / pixel_size;
|
||||
for (int ny = miny; ny < maxy; ny += step) {
|
||||
int bufferindex = ((minx - bufferstartx) * COM_DATA_TYPE_COLOR_CHANNELS) +
|
||||
((ny - bufferstarty) * COM_DATA_TYPE_COLOR_CHANNELS * bufferwidth);
|
||||
for (int nx = minx; nx < maxx; nx += step) {
|
||||
float u = bokeh_mid_x_ - (nx - x) * m;
|
||||
float v = bokeh_mid_y_ - (ny - y) * m;
|
||||
input_bokeh_program_->read_sampled(bokeh, u, v, PixelSampler::Nearest);
|
||||
madd_v4_v4v4(color_accum, bokeh, &buffer[bufferindex]);
|
||||
add_v4_v4(multiplier_accum, bokeh);
|
||||
bufferindex += offsetadd;
|
||||
}
|
||||
}
|
||||
output[0] = color_accum[0] * (1.0f / multiplier_accum[0]);
|
||||
output[1] = color_accum[1] * (1.0f / multiplier_accum[1]);
|
||||
output[2] = color_accum[2] * (1.0f / multiplier_accum[2]);
|
||||
output[3] = color_accum[3] * (1.0f / multiplier_accum[3]);
|
||||
if (temp_bounding_box[0] <= 0.0f) {
|
||||
copy_v4_v4(output, input_buffer->get_elem(x, y));
|
||||
return;
|
||||
}
|
||||
else {
|
||||
input_program_->read_sampled(output, x, y, PixelSampler::Nearest);
|
||||
|
||||
const float max_dim = std::max(this->get_width(), this->get_height());
|
||||
int radius = size_ * max_dim / 100.0f;
|
||||
const int2 bokeh_size = int2(input_bokeh_program_->get_width(),
|
||||
input_bokeh_program_->get_height());
|
||||
|
||||
float4 accumulated_color = float4(0.0f);
|
||||
float4 accumulated_weight = float4(0.0f);
|
||||
int step = get_step();
|
||||
for (int yi = -radius; yi <= radius; yi += step) {
|
||||
for (int xi = -radius; xi <= radius; xi += step) {
|
||||
const float2 normalized_texel = (float2(xi, yi) + radius + 0.5f) / (radius * 2.0f + 1.0f);
|
||||
const float2 weight_texel = (1.0f - normalized_texel) * float2(bokeh_size - 1);
|
||||
float4 weight;
|
||||
input_bokeh_program_->read(weight, int(weight_texel.x), int(weight_texel.y), nullptr);
|
||||
const float4 color = float4(input_buffer->get_elem_clamped(x + xi, y + yi)) * weight;
|
||||
accumulated_color += color;
|
||||
accumulated_weight += weight;
|
||||
}
|
||||
}
|
||||
|
||||
const float4 final_color = math::safe_divide(accumulated_color, accumulated_weight);
|
||||
copy_v4_v4(output, final_color);
|
||||
}
|
||||
|
||||
void BokehBlurOperation::deinit_execution()
|
||||
@ -261,8 +228,9 @@ void BokehBlurOperation::determine_canvas(const rcti &preferred_area, rcti &r_ar
|
||||
case eExecutionModel::Tiled: {
|
||||
NodeOperation::determine_canvas(preferred_area, r_area);
|
||||
const float max_dim = std::max(BLI_rcti_size_x(&r_area), BLI_rcti_size_y(&r_area));
|
||||
r_area.xmax += 2 * size_ * max_dim / 100.0f;
|
||||
r_area.ymax += 2 * size_ * max_dim / 100.0f;
|
||||
float add_size = round_to_even(2 * size_ * max_dim / 100.0f);
|
||||
r_area.xmax += add_size;
|
||||
r_area.ymax += add_size;
|
||||
break;
|
||||
}
|
||||
case eExecutionModel::FullFrame: {
|
||||
@ -313,14 +281,13 @@ void BokehBlurOperation::update_memory_buffer_partial(MemoryBuffer *output,
|
||||
Span<MemoryBuffer *> inputs)
|
||||
{
|
||||
const float max_dim = std::max(this->get_width(), this->get_height());
|
||||
const int pixel_size = size_ * max_dim / 100.0f;
|
||||
const float m = bokehDimension_ / pixel_size;
|
||||
const int radius = size_ * max_dim / 100.0f;
|
||||
|
||||
const MemoryBuffer *image_input = inputs[IMAGE_INPUT_INDEX];
|
||||
const MemoryBuffer *bokeh_input = inputs[BOKEH_INPUT_INDEX];
|
||||
const int2 bokeh_size = int2(bokeh_input->get_width(), bokeh_input->get_height());
|
||||
MemoryBuffer *bounding_input = inputs[BOUNDING_BOX_INPUT_INDEX];
|
||||
BuffersIterator<float> it = output->iterate_with({bounding_input}, area);
|
||||
const rcti &image_rect = image_input->get_rect();
|
||||
for (; !it.is_end(); ++it) {
|
||||
const int x = it.x;
|
||||
const int y = it.y;
|
||||
@ -330,38 +297,22 @@ void BokehBlurOperation::update_memory_buffer_partial(MemoryBuffer *output,
|
||||
continue;
|
||||
}
|
||||
|
||||
float color_accum[4] = {0};
|
||||
float multiplier_accum[4] = {0};
|
||||
if (pixel_size < 2) {
|
||||
image_input->read_elem(x, y, color_accum);
|
||||
multiplier_accum[0] = 1.0f;
|
||||
multiplier_accum[1] = 1.0f;
|
||||
multiplier_accum[2] = 1.0f;
|
||||
multiplier_accum[3] = 1.0f;
|
||||
}
|
||||
const int miny = std::max(y - pixel_size, image_rect.ymin);
|
||||
const int maxy = std::min(y + pixel_size, image_rect.ymax);
|
||||
const int minx = std::max(x - pixel_size, image_rect.xmin);
|
||||
const int maxx = std::min(x + pixel_size, image_rect.xmax);
|
||||
float4 accumulated_color = float4(0.0f);
|
||||
float4 accumulated_weight = float4(0.0f);
|
||||
const int step = get_step();
|
||||
const int elem_stride = image_input->elem_stride * step;
|
||||
const int row_stride = image_input->row_stride * step;
|
||||
const float *row_color = image_input->get_elem(minx, miny);
|
||||
for (int ny = miny; ny < maxy; ny += step, row_color += row_stride) {
|
||||
const float *color = row_color;
|
||||
const float v = bokeh_mid_y_ - (ny - y) * m;
|
||||
for (int nx = minx; nx < maxx; nx += step, color += elem_stride) {
|
||||
const float u = bokeh_mid_x_ - (nx - x) * m;
|
||||
float bokeh[4];
|
||||
bokeh_input->read_elem_checked(u, v, bokeh);
|
||||
madd_v4_v4v4(color_accum, bokeh, color);
|
||||
add_v4_v4(multiplier_accum, bokeh);
|
||||
for (int yi = -radius; yi <= radius; yi += step) {
|
||||
for (int xi = -radius; xi <= radius; xi += step) {
|
||||
const float2 normalized_texel = (float2(xi, yi) + radius + 0.5f) / (radius * 2.0f + 1.0f);
|
||||
const float2 weight_texel = (1.0f - normalized_texel) * float2(bokeh_size - 1);
|
||||
const float4 weight = bokeh_input->get_elem(int(weight_texel.x), int(weight_texel.y));
|
||||
const float4 color = float4(image_input->get_elem_clamped(x + xi, y + yi)) * weight;
|
||||
accumulated_color += color;
|
||||
accumulated_weight += weight;
|
||||
}
|
||||
}
|
||||
it.out[0] = color_accum[0] * (1.0f / multiplier_accum[0]);
|
||||
it.out[1] = color_accum[1] * (1.0f / multiplier_accum[1]);
|
||||
it.out[2] = color_accum[2] * (1.0f / multiplier_accum[2]);
|
||||
it.out[3] = color_accum[3] * (1.0f / multiplier_accum[3]);
|
||||
|
||||
const float4 final_color = math::safe_divide(accumulated_color, accumulated_weight);
|
||||
copy_v4_v4(it.out, final_color);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,9 +18,6 @@ class BokehBlurOperation : public MultiThreadedOperation, public QualityStepHelp
|
||||
float size_;
|
||||
bool sizeavailable_;
|
||||
|
||||
float bokeh_mid_x_;
|
||||
float bokeh_mid_y_;
|
||||
float bokehDimension_;
|
||||
bool extend_bounds_;
|
||||
|
||||
public:
|
||||
|
@ -2,203 +2,174 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "MEM_guardedalloc.h"
|
||||
#include "BLI_array.hh"
|
||||
#include "BLI_math_base.hh"
|
||||
#include "BLI_math_numbers.hh"
|
||||
#include "BLI_math_vector.h"
|
||||
#include "BLI_math_vector.hh"
|
||||
#include "BLI_span.hh"
|
||||
#include "BLI_task.hh"
|
||||
|
||||
#include "COM_InpaintOperation.h"
|
||||
#include "COM_JumpFloodingAlgorithm.h"
|
||||
#include "COM_SymmetricSeparableBlurVariableSizeAlgorithm.h"
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
#define ASSERT_XY_RANGE(x, y) \
|
||||
BLI_assert(x >= 0 && x < this->get_width() && y >= 0 && y < this->get_height())
|
||||
void InpaintSimpleOperation::compute_inpainting_region(
|
||||
const MemoryBuffer *input,
|
||||
const MemoryBuffer &inpainted_region,
|
||||
const MemoryBuffer &distance_to_boundary_buffer,
|
||||
MemoryBuffer *output)
|
||||
{
|
||||
const int2 size = int2(this->get_width(), this->get_height());
|
||||
threading::parallel_for(IndexRange(size.y), 1, [&](const IndexRange sub_y_range) {
|
||||
for (const int64_t y : sub_y_range) {
|
||||
for (const int64_t x : IndexRange(size.x)) {
|
||||
int2 texel = int2(x, y);
|
||||
|
||||
float4 color = float4(input->get_elem(x, y));
|
||||
|
||||
if (color.w == 1.0f) {
|
||||
copy_v4_v4(output->get_elem(x, y), color);
|
||||
continue;
|
||||
}
|
||||
|
||||
float distance_to_boundary = *distance_to_boundary_buffer.get_elem(x, y);
|
||||
|
||||
if (distance_to_boundary > max_distance_) {
|
||||
copy_v4_v4(output->get_elem(x, y), color);
|
||||
continue;
|
||||
}
|
||||
|
||||
float4 inpainted_color = float4(inpainted_region.get_elem(x, y));
|
||||
float4 final_color = float4(math::interpolate(inpainted_color, color, color.w).xyz(),
|
||||
1.0f);
|
||||
copy_v4_v4(output->get_elem(x, y), final_color);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void InpaintSimpleOperation::fill_inpainting_region(const MemoryBuffer *input,
|
||||
Span<int2> flooded_boundary,
|
||||
MemoryBuffer &filled_region,
|
||||
MemoryBuffer &distance_to_boundary_buffer,
|
||||
MemoryBuffer &smoothing_radius_buffer)
|
||||
{
|
||||
const int2 size = int2(this->get_width(), this->get_height());
|
||||
threading::parallel_for(IndexRange(size.y), 1, [&](const IndexRange sub_y_range) {
|
||||
for (const int64_t y : sub_y_range) {
|
||||
for (const int64_t x : IndexRange(size.x)) {
|
||||
int2 texel = int2(x, y);
|
||||
const size_t index = size_t(y) * size.x + x;
|
||||
|
||||
float4 color = float4(input->get_elem(x, y));
|
||||
|
||||
if (color.w == 1.0f) {
|
||||
copy_v4_v4(filled_region.get_elem(x, y), color);
|
||||
*smoothing_radius_buffer.get_elem(x, y) = 0.0f;
|
||||
*distance_to_boundary_buffer.get_elem(x, y) = 0.0f;
|
||||
continue;
|
||||
}
|
||||
|
||||
int2 closest_boundary_texel = flooded_boundary[index];
|
||||
float distance_to_boundary = math::distance(float2(texel), float2(closest_boundary_texel));
|
||||
*distance_to_boundary_buffer.get_elem(x, y) = distance_to_boundary;
|
||||
|
||||
float blur_window_size = math::min(float(max_distance_), distance_to_boundary) /
|
||||
math::numbers::sqrt2;
|
||||
bool skip_smoothing = distance_to_boundary > (max_distance_ * 2.0f);
|
||||
float smoothing_radius = skip_smoothing ? 0.0f : blur_window_size;
|
||||
*smoothing_radius_buffer.get_elem(x, y) = smoothing_radius;
|
||||
|
||||
float4 boundary_color = float4(
|
||||
input->get_elem_clamped(closest_boundary_texel.x, closest_boundary_texel.y));
|
||||
float4 final_color = math::interpolate(boundary_color, color, color.w);
|
||||
copy_v4_v4(filled_region.get_elem(x, y), final_color);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Array<int2> InpaintSimpleOperation::compute_inpainting_boundary(const MemoryBuffer *input)
|
||||
{
|
||||
const int2 size = int2(this->get_width(), this->get_height());
|
||||
Array<int2> boundary(size_t(size.x) * size.y);
|
||||
|
||||
threading::parallel_for(IndexRange(size.y), 1, [&](const IndexRange sub_y_range) {
|
||||
for (const int64_t y : sub_y_range) {
|
||||
for (const int64_t x : IndexRange(size.x)) {
|
||||
int2 texel = int2(x, y);
|
||||
|
||||
bool has_transparent_neighbors = false;
|
||||
for (int j = -1; j <= 1; j++) {
|
||||
for (int i = -1; i <= 1; i++) {
|
||||
int2 offset = int2(i, j);
|
||||
|
||||
if (offset != int2(0)) {
|
||||
if (float4(input->get_elem_clamped(x + i, y + j)).w < 1.0f) {
|
||||
has_transparent_neighbors = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool is_opaque = float4(input->get_elem(x, y)).w == 1.0f;
|
||||
bool is_boundary_pixel = is_opaque && has_transparent_neighbors;
|
||||
|
||||
int2 jump_flooding_value = initialize_jump_flooding_value(texel, is_boundary_pixel);
|
||||
|
||||
const size_t index = size_t(y) * size.x + x;
|
||||
boundary[index] = jump_flooding_value;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return boundary;
|
||||
}
|
||||
|
||||
/* Identical to realtime_compositor::InpaintOperation::execute see that function, its
|
||||
* sub-functions and shaders for more details. */
|
||||
void InpaintSimpleOperation::inpaint(const MemoryBuffer *input, MemoryBuffer *output)
|
||||
{
|
||||
const int2 size = int2(this->get_width(), this->get_height());
|
||||
Array<int2> inpainting_boundary = compute_inpainting_boundary(input);
|
||||
Array<int2> flooded_boundary = jump_flooding(inpainting_boundary, size);
|
||||
|
||||
MemoryBuffer filled_region(DataType::Color, input->get_rect());
|
||||
MemoryBuffer distance_to_boundary(DataType::Value, input->get_rect());
|
||||
MemoryBuffer smoothing_radius(DataType::Value, input->get_rect());
|
||||
fill_inpainting_region(
|
||||
input, flooded_boundary, filled_region, distance_to_boundary, smoothing_radius);
|
||||
|
||||
MemoryBuffer smoothed_region(DataType::Color, input->get_rect());
|
||||
symmetric_separable_blur_variable_size(
|
||||
filled_region, smoothed_region, smoothing_radius, R_FILTER_GAUSS, max_distance_);
|
||||
|
||||
compute_inpainting_region(input, smoothed_region, distance_to_boundary, output);
|
||||
}
|
||||
|
||||
InpaintSimpleOperation::InpaintSimpleOperation()
|
||||
{
|
||||
this->add_input_socket(DataType::Color);
|
||||
this->add_output_socket(DataType::Color);
|
||||
flags_.complex = true;
|
||||
input_image_program_ = nullptr;
|
||||
pixelorder_ = nullptr;
|
||||
manhattan_distance_ = nullptr;
|
||||
cached_buffer_ = nullptr;
|
||||
cached_buffer_ready_ = false;
|
||||
flags_.complex = true;
|
||||
flags_.is_fullframe_operation = true;
|
||||
flags_.can_be_constant = true;
|
||||
}
|
||||
void InpaintSimpleOperation::init_execution()
|
||||
{
|
||||
input_image_program_ = this->get_input_socket_reader(0);
|
||||
|
||||
pixelorder_ = nullptr;
|
||||
manhattan_distance_ = nullptr;
|
||||
cached_buffer_ = nullptr;
|
||||
cached_buffer_ready_ = false;
|
||||
|
||||
this->init_mutex();
|
||||
}
|
||||
|
||||
void InpaintSimpleOperation::clamp_xy(int &x, int &y)
|
||||
{
|
||||
int width = this->get_width();
|
||||
int height = this->get_height();
|
||||
|
||||
if (x < 0) {
|
||||
x = 0;
|
||||
}
|
||||
else if (x >= width) {
|
||||
x = width - 1;
|
||||
}
|
||||
|
||||
if (y < 0) {
|
||||
y = 0;
|
||||
}
|
||||
else if (y >= height) {
|
||||
y = height - 1;
|
||||
}
|
||||
}
|
||||
|
||||
float *InpaintSimpleOperation::get_pixel(int x, int y)
|
||||
{
|
||||
int width = this->get_width();
|
||||
|
||||
ASSERT_XY_RANGE(x, y);
|
||||
|
||||
return &cached_buffer_[y * width * COM_DATA_TYPE_COLOR_CHANNELS +
|
||||
x * COM_DATA_TYPE_COLOR_CHANNELS];
|
||||
}
|
||||
|
||||
int InpaintSimpleOperation::mdist(int x, int y)
|
||||
{
|
||||
int width = this->get_width();
|
||||
|
||||
ASSERT_XY_RANGE(x, y);
|
||||
|
||||
return manhattan_distance_[y * width + x];
|
||||
}
|
||||
|
||||
bool InpaintSimpleOperation::next_pixel(int &x, int &y, int &curr, int iters)
|
||||
{
|
||||
int width = this->get_width();
|
||||
|
||||
if (curr >= area_size_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int r = pixelorder_[curr++];
|
||||
|
||||
x = r % width;
|
||||
y = r / width;
|
||||
|
||||
if (this->mdist(x, y) > iters) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void InpaintSimpleOperation::calc_manhattan_distance()
|
||||
{
|
||||
int width = this->get_width();
|
||||
int height = this->get_height();
|
||||
short *m = manhattan_distance_ = (short *)MEM_mallocN(sizeof(short) * width * height, __func__);
|
||||
int *offsets;
|
||||
|
||||
offsets = (int *)MEM_callocN(sizeof(int) * (width + height + 1),
|
||||
"InpaintSimpleOperation offsets");
|
||||
|
||||
for (int j = 0; j < height; j++) {
|
||||
for (int i = 0; i < width; i++) {
|
||||
int r = 0;
|
||||
/* no need to clamp here */
|
||||
if (this->get_pixel(i, j)[3] < 1.0f) {
|
||||
r = width + height;
|
||||
if (i > 0) {
|
||||
r = min_ii(r, m[j * width + i - 1] + 1);
|
||||
}
|
||||
if (j > 0) {
|
||||
r = min_ii(r, m[(j - 1) * width + i] + 1);
|
||||
}
|
||||
}
|
||||
m[j * width + i] = r;
|
||||
}
|
||||
}
|
||||
|
||||
for (int j = height - 1; j >= 0; j--) {
|
||||
for (int i = width - 1; i >= 0; i--) {
|
||||
int r = m[j * width + i];
|
||||
|
||||
if (i + 1 < width) {
|
||||
r = min_ii(r, m[j * width + i + 1] + 1);
|
||||
}
|
||||
if (j + 1 < height) {
|
||||
r = min_ii(r, m[(j + 1) * width + i] + 1);
|
||||
}
|
||||
|
||||
m[j * width + i] = r;
|
||||
|
||||
offsets[r]++;
|
||||
}
|
||||
}
|
||||
|
||||
offsets[0] = 0;
|
||||
|
||||
for (int i = 1; i < width + height + 1; i++) {
|
||||
offsets[i] += offsets[i - 1];
|
||||
}
|
||||
|
||||
area_size_ = offsets[width + height];
|
||||
pixelorder_ = (int *)MEM_mallocN(sizeof(int) * area_size_, __func__);
|
||||
|
||||
for (int i = 0; i < width * height; i++) {
|
||||
if (m[i] > 0) {
|
||||
pixelorder_[offsets[m[i] - 1]++] = i;
|
||||
}
|
||||
}
|
||||
|
||||
MEM_freeN(offsets);
|
||||
}
|
||||
|
||||
void InpaintSimpleOperation::pix_step(int x, int y)
|
||||
{
|
||||
const int d = this->mdist(x, y);
|
||||
float pix[3] = {0.0f, 0.0f, 0.0f};
|
||||
float pix_divider = 0.0f;
|
||||
|
||||
for (int dx = -1; dx <= 1; dx++) {
|
||||
for (int dy = -1; dy <= 1; dy++) {
|
||||
/* changing to both != 0 gives dithering artifacts */
|
||||
if (dx != 0 || dy != 0) {
|
||||
int x_ofs = x + dx;
|
||||
int y_ofs = y + dy;
|
||||
|
||||
this->clamp_xy(x_ofs, y_ofs);
|
||||
|
||||
if (this->mdist(x_ofs, y_ofs) < d) {
|
||||
|
||||
float weight;
|
||||
|
||||
if (dx == 0 || dy == 0) {
|
||||
weight = 1.0f;
|
||||
}
|
||||
else {
|
||||
weight = M_SQRT1_2; /* `1.0f / sqrt(2)`. */
|
||||
}
|
||||
|
||||
madd_v3_v3fl(pix, this->get_pixel(x_ofs, y_ofs), weight);
|
||||
pix_divider += weight;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float *output = this->get_pixel(x, y);
|
||||
if (pix_divider != 0.0f) {
|
||||
mul_v3_fl(pix, 1.0f / pix_divider);
|
||||
/* use existing pixels alpha to blend into */
|
||||
interp_v3_v3v3(output, pix, output, output[3]);
|
||||
output[3] = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void *InpaintSimpleOperation::initialize_tile_data(rcti *rect)
|
||||
{
|
||||
if (cached_buffer_ready_) {
|
||||
@ -206,17 +177,9 @@ void *InpaintSimpleOperation::initialize_tile_data(rcti *rect)
|
||||
}
|
||||
lock_mutex();
|
||||
if (!cached_buffer_ready_) {
|
||||
MemoryBuffer *buf = (MemoryBuffer *)input_image_program_->initialize_tile_data(rect);
|
||||
cached_buffer_ = (float *)MEM_dupallocN(buf->get_buffer());
|
||||
|
||||
this->calc_manhattan_distance();
|
||||
|
||||
int curr = 0;
|
||||
int x, y;
|
||||
|
||||
while (this->next_pixel(x, y, curr, iterations_)) {
|
||||
this->pix_step(x, y);
|
||||
}
|
||||
MemoryBuffer *input = (MemoryBuffer *)input_image_program_->initialize_tile_data(rect);
|
||||
cached_buffer_ = new MemoryBuffer(DataType::Color, *rect);
|
||||
inpaint(input, cached_buffer_);
|
||||
cached_buffer_ready_ = true;
|
||||
}
|
||||
|
||||
@ -226,8 +189,7 @@ void *InpaintSimpleOperation::initialize_tile_data(rcti *rect)
|
||||
|
||||
void InpaintSimpleOperation::execute_pixel(float output[4], int x, int y, void * /*data*/)
|
||||
{
|
||||
this->clamp_xy(x, y);
|
||||
copy_v4_v4(output, this->get_pixel(x, y));
|
||||
copy_v4_v4(output, cached_buffer_->get_elem(x, y));
|
||||
}
|
||||
|
||||
void InpaintSimpleOperation::deinit_execution()
|
||||
@ -235,19 +197,10 @@ void InpaintSimpleOperation::deinit_execution()
|
||||
input_image_program_ = nullptr;
|
||||
this->deinit_mutex();
|
||||
if (cached_buffer_) {
|
||||
MEM_freeN(cached_buffer_);
|
||||
delete cached_buffer_;
|
||||
cached_buffer_ = nullptr;
|
||||
}
|
||||
|
||||
if (pixelorder_) {
|
||||
MEM_freeN(pixelorder_);
|
||||
pixelorder_ = nullptr;
|
||||
}
|
||||
|
||||
if (manhattan_distance_) {
|
||||
MEM_freeN(manhattan_distance_);
|
||||
manhattan_distance_ = nullptr;
|
||||
}
|
||||
cached_buffer_ready_ = false;
|
||||
}
|
||||
|
||||
@ -278,10 +231,9 @@ void InpaintSimpleOperation::get_area_of_interest(const int input_idx,
|
||||
}
|
||||
|
||||
void InpaintSimpleOperation::update_memory_buffer(MemoryBuffer *output,
|
||||
const rcti &area,
|
||||
const rcti & /*area*/,
|
||||
Span<MemoryBuffer *> inputs)
|
||||
{
|
||||
/* TODO(manzanilla): once tiled implementation is removed, run multi-threaded where possible. */
|
||||
MemoryBuffer *input = inputs[0];
|
||||
|
||||
if (input->is_a_single_elem()) {
|
||||
@ -290,21 +242,9 @@ void InpaintSimpleOperation::update_memory_buffer(MemoryBuffer *output,
|
||||
}
|
||||
|
||||
if (!cached_buffer_ready_) {
|
||||
cached_buffer_ = (float *)MEM_dupallocN(input->get_buffer());
|
||||
|
||||
this->calc_manhattan_distance();
|
||||
|
||||
int curr = 0;
|
||||
int x, y;
|
||||
while (this->next_pixel(x, y, curr, iterations_)) {
|
||||
this->pix_step(x, y);
|
||||
}
|
||||
inpaint(input, output);
|
||||
cached_buffer_ready_ = true;
|
||||
}
|
||||
|
||||
const int num_channels = COM_data_type_num_channels(get_output_socket()->get_data_type());
|
||||
MemoryBuffer buf(cached_buffer_, num_channels, input->get_width(), input->get_height());
|
||||
output->copy_from(&buf, area);
|
||||
}
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
@ -4,49 +4,50 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "BLI_array.hh"
|
||||
#include "BLI_math_vector_types.hh"
|
||||
#include "BLI_span.hh"
|
||||
|
||||
#include "COM_NodeOperation.h"
|
||||
|
||||
namespace blender::compositor {
|
||||
|
||||
class InpaintSimpleOperation : public NodeOperation {
|
||||
protected:
|
||||
/**
|
||||
* Cached reference to the input_program
|
||||
*/
|
||||
SocketReader *input_image_program_;
|
||||
|
||||
int iterations_;
|
||||
|
||||
float *cached_buffer_;
|
||||
MemoryBuffer *cached_buffer_;
|
||||
bool cached_buffer_ready_;
|
||||
|
||||
int *pixelorder_;
|
||||
int area_size_;
|
||||
short *manhattan_distance_;
|
||||
int max_distance_;
|
||||
|
||||
public:
|
||||
/** In-paint (simple convolve using average of known pixels). */
|
||||
InpaintSimpleOperation();
|
||||
|
||||
/**
|
||||
* The inner loop of this operation.
|
||||
*/
|
||||
void compute_inpainting_region(const MemoryBuffer *input,
|
||||
const MemoryBuffer &inpainted_region,
|
||||
const MemoryBuffer &distance_to_boundary,
|
||||
MemoryBuffer *output);
|
||||
|
||||
void fill_inpainting_region(const MemoryBuffer *input,
|
||||
Span<int2> flooded_boundary,
|
||||
MemoryBuffer &filled_region,
|
||||
MemoryBuffer &distance_to_boundary_buffer,
|
||||
MemoryBuffer &smoothing_radius_buffer);
|
||||
|
||||
Array<int2> compute_inpainting_boundary(const MemoryBuffer *input);
|
||||
|
||||
void inpaint(const MemoryBuffer *input, MemoryBuffer *output);
|
||||
|
||||
void execute_pixel(float output[4], int x, int y, void *data) override;
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
*/
|
||||
void init_execution() override;
|
||||
|
||||
void *initialize_tile_data(rcti *rect) override;
|
||||
/**
|
||||
* Deinitialize the execution
|
||||
*/
|
||||
|
||||
void deinit_execution() override;
|
||||
|
||||
void set_iterations(int iterations)
|
||||
void set_max_distance(int max_distance)
|
||||
{
|
||||
iterations_ = iterations;
|
||||
max_distance_ = max_distance;
|
||||
}
|
||||
|
||||
bool determine_depending_area_of_interest(rcti *input,
|
||||
@ -57,14 +58,6 @@ class InpaintSimpleOperation : public NodeOperation {
|
||||
void update_memory_buffer(MemoryBuffer *output,
|
||||
const rcti &area,
|
||||
Span<MemoryBuffer *> inputs) override;
|
||||
|
||||
private:
|
||||
void calc_manhattan_distance();
|
||||
void clamp_xy(int &x, int &y);
|
||||
float *get_pixel(int x, int y);
|
||||
int mdist(int x, int y);
|
||||
bool next_pixel(int &x, int &y, int &curr, int iters);
|
||||
void pix_step(int x, int y);
|
||||
};
|
||||
|
||||
} // namespace blender::compositor
|
||||
|
@ -69,7 +69,8 @@ class Context {
|
||||
* the compositing region. In the base case, the compositing region covers the entirety of the
|
||||
* render region with a lower bound of zero and an upper bound of the render size returned by the
|
||||
* get_render_size method. In other cases, the compositing region might be a subset of the render
|
||||
* region. */
|
||||
* region. Callers should check the validity of the region through is_valid_compositing_region(),
|
||||
* since the region can be zero sized. */
|
||||
virtual rcti get_compositing_region() const = 0;
|
||||
|
||||
/* Get the texture where the result of the compositor should be written. This should be called by
|
||||
@ -111,9 +112,15 @@ class Context {
|
||||
* render pipeline. */
|
||||
virtual RenderContext *render_context() const;
|
||||
|
||||
/* Get the size of the compositing region. See get_compositing_region(). */
|
||||
/* Get the size of the compositing region. See get_compositing_region(). The output size is
|
||||
* sanitized such that it is at least 1 in both dimensions. However, the developer is expected to
|
||||
* gracefully handled zero sizes regions by checking the is_valid_compositing_region method. */
|
||||
int2 get_compositing_region_size() const;
|
||||
|
||||
/* Returns true if the compositing region has a valid size, that is, has at least one pixel in
|
||||
* both dimensions, returns false otherwise. */
|
||||
bool is_valid_compositing_region() const;
|
||||
|
||||
/* Get the normalized render percentage of the active scene. */
|
||||
float get_render_percentage() const;
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "BLI_math_vector.hh"
|
||||
#include "BLI_rect.h"
|
||||
|
||||
#include "DNA_vec_types.h"
|
||||
@ -25,7 +26,17 @@ RenderContext *Context::render_context() const
|
||||
int2 Context::get_compositing_region_size() const
|
||||
{
|
||||
const rcti compositing_region = get_compositing_region();
|
||||
return int2(BLI_rcti_size_x(&compositing_region), BLI_rcti_size_y(&compositing_region));
|
||||
const int x = BLI_rcti_size_x(&compositing_region);
|
||||
const int y = BLI_rcti_size_y(&compositing_region);
|
||||
return math::max(int2(1), int2(x, y));
|
||||
}
|
||||
|
||||
bool Context::is_valid_compositing_region() const
|
||||
{
|
||||
const rcti compositing_region = get_compositing_region();
|
||||
const int x = BLI_rcti_size_x(&compositing_region);
|
||||
const int y = BLI_rcti_size_y(&compositing_region);
|
||||
return x != 0 && y != 0;
|
||||
}
|
||||
|
||||
float Context::get_render_percentage() const
|
||||
|
@ -184,6 +184,7 @@ void deg_graph_build_finalize(Main *bmain, Depsgraph *graph)
|
||||
/* Re-tag IDs for update if it was tagged before the relations
|
||||
* update tag. */
|
||||
for (IDNode *id_node : graph->id_nodes) {
|
||||
const ID_Type id_type = id_node->id_type;
|
||||
ID *id_orig = id_node->id_orig;
|
||||
id_node->finalize_build(graph);
|
||||
int flag = 0;
|
||||
@ -200,21 +201,28 @@ void deg_graph_build_finalize(Main *bmain, Depsgraph *graph)
|
||||
flag |= ID_RECALC_COPY_ON_WRITE;
|
||||
/* This means ID is being added to the dependency graph first
|
||||
* time, which is similar to "ob-visible-change" */
|
||||
if (GS(id_orig->name) == ID_OB) {
|
||||
if (id_type == ID_OB) {
|
||||
flag |= ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY;
|
||||
}
|
||||
if (GS(id_orig->name) == ID_NT) {
|
||||
if (id_type == ID_NT) {
|
||||
flag |= ID_RECALC_NTREE_OUTPUT;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Collection content might have changed (children collection might have been added or
|
||||
* removed from the graph based on their inclusion and visibility flags). */
|
||||
const ID_Type id_type = GS(id_node->id_cow->name);
|
||||
if (id_type == ID_GR) {
|
||||
/* Collection content might have changed (children collection might have been added or
|
||||
* removed from the graph based on their inclusion and visibility flags). */
|
||||
BKE_collection_object_cache_free(
|
||||
nullptr, reinterpret_cast<Collection *>(id_node->id_cow), LIB_ID_CREATE_NO_DEG_TAG);
|
||||
}
|
||||
else if (id_type == ID_SCE) {
|
||||
/* During undo the sequence strips might obtain a new session ID, which will disallow the
|
||||
* audio handles to be re-used. Tag for the audio and sequence update to ensure the audio
|
||||
* handles are open.
|
||||
* NOTE: This is not something that should be required, and perhaps indicates a weakness in
|
||||
* design somewhere else. For the cause of the problem check #117760. */
|
||||
flag |= ID_RECALC_AUDIO | ID_RECALC_SEQUENCER_STRIPS;
|
||||
}
|
||||
}
|
||||
/* Restore recalc flags from original ID, which could possibly contain recalc flags set by
|
||||
* an operator and then were carried on by the undo system.
|
||||
|
@ -1273,14 +1273,14 @@ bool ShadowModule::shadow_update_finished()
|
||||
{
|
||||
if (inst_.is_viewport()) {
|
||||
/* For viewport, only run the shadow update once per redraw.
|
||||
* This avoids the stall from the readback and freezes from long shadow update. */
|
||||
* This avoids the stall from the read-back and freezes from long shadow update. */
|
||||
return true;
|
||||
}
|
||||
|
||||
int max_updated_view_count = tilemap_pool.tilemaps_data.size() * SHADOW_TILEMAP_LOD;
|
||||
if (max_updated_view_count <= SHADOW_VIEW_MAX) {
|
||||
/* There is enough shadow views to cover all tilemap updates.
|
||||
* No readback needed as it is guaranteed that all of them will be updated. */
|
||||
/* There is enough shadow views to cover all tile-map updates.
|
||||
* No read-back needed as it is guaranteed that all of them will be updated. */
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -467,7 +467,7 @@ void gbuffer_additional_info_load(inout GBufferReader gbuf, samplerGBufferNormal
|
||||
*
|
||||
* \{ */
|
||||
|
||||
/* Outputing dummy closure is required for correct render passes in case of unlit materials. */
|
||||
/** Outputting dummy closure is required for correct render passes in case of unlit materials. */
|
||||
void gbuffer_closure_unlit_pack(inout GBufferWriter gbuf, vec3 N)
|
||||
{
|
||||
gbuffer_append_closure(gbuf, GBUF_UNLIT);
|
||||
|
@ -496,7 +496,15 @@ class PassSortable : public PassMain {
|
||||
int64_t index = sub_passes_.append_and_get_index(
|
||||
PassBase(name, draw_commands_buf_, sub_passes_, shader_));
|
||||
headers_.append({Type::SubPass, uint(index)});
|
||||
sorting_values_.append(sorting_value);
|
||||
/* Some sub-pass can also create sub-sub-passes (curve, point-clouds...) which will de-sync
|
||||
* the `sub_passes_.size()` and `sorting_values_.size()`, making the `Header::index` not
|
||||
* reusable for the sorting value in the `sort()` function. To fix this, we flood the
|
||||
* `sorting_values_` to ensure the same index is valid for `sorting_values_` and
|
||||
* `sub_passes_`. */
|
||||
int64_t sorting_index;
|
||||
do {
|
||||
sorting_index = sorting_values_.append_and_get_index(sorting_value);
|
||||
} while (sorting_index != index);
|
||||
return sub_passes_[index];
|
||||
}
|
||||
|
||||
|
@ -5616,8 +5616,6 @@ void ANIM_channel_draw_widgets(const bContext *C,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
-1,
|
||||
nullptr);
|
||||
|
||||
/* copy what outliner does here, see outliner_buttons */
|
||||
|
@ -154,8 +154,6 @@ class AssetCatalogSelectorTree : public ui::AbstractTreeView {
|
||||
(char *)&catalog_path_enabled_,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
TIP_("Toggle catalog visibility in the asset shelf"));
|
||||
UI_but_func_set(toggle_but, [&tree](bContext &C) {
|
||||
tree.update_shelf_settings_from_enabled_catalogs();
|
||||
|
@ -35,6 +35,7 @@
|
||||
|
||||
#include "ED_curves.hh"
|
||||
#include "ED_grease_pencil.hh"
|
||||
#include "ED_object.hh"
|
||||
#include "ED_screen.hh"
|
||||
|
||||
#include "GEO_curve_copy_selection.hh"
|
||||
@ -1728,6 +1729,366 @@ static void GREASE_PENCIL_OT_move_to_layer(wmOperatorType *ot)
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Stroke Separate Operator
|
||||
* \{ */
|
||||
|
||||
enum class SeparateMode : int8_t {
|
||||
/* Selected Points/Strokes. */
|
||||
SELECTED = 0,
|
||||
/* By Material. */
|
||||
MATERIAL = 1,
|
||||
/* By Active Layer. */
|
||||
LAYER = 2,
|
||||
};
|
||||
|
||||
static const EnumPropertyItem prop_separate_modes[] = {
|
||||
{int(SeparateMode::SELECTED), "SELECTED", 0, "Selection", "Separate selected geometry"},
|
||||
{int(SeparateMode::MATERIAL), "MATERIAL", 0, "By Material", "Separate by material"},
|
||||
{int(SeparateMode::LAYER), "LAYER", 0, "By Layer", "Separate by layer"},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static void remove_unused_materials(Main *bmain, Object *object)
|
||||
{
|
||||
int actcol = object->actcol;
|
||||
for (int slot = 1; slot <= object->totcol; slot++) {
|
||||
while (slot <= object->totcol && !BKE_object_material_slot_used(object, slot)) {
|
||||
object->actcol = slot;
|
||||
BKE_object_material_slot_remove(bmain, object);
|
||||
if (actcol >= slot) {
|
||||
actcol--;
|
||||
}
|
||||
}
|
||||
}
|
||||
object->actcol = actcol;
|
||||
}
|
||||
|
||||
static Object *duplicate_grease_pencil_object(Main *bmain,
|
||||
Scene *scene,
|
||||
ViewLayer *view_layer,
|
||||
Base *base_prev,
|
||||
GreasePencil &grease_pencil_src)
|
||||
{
|
||||
const eDupli_ID_Flags dupflag = eDupli_ID_Flags(U.dupflag & USER_DUP_ACT);
|
||||
Base *base_new = ED_object_add_duplicate(bmain, scene, view_layer, base_prev, dupflag);
|
||||
Object *object_dst = base_new->object;
|
||||
object_dst->mode = OB_MODE_OBJECT;
|
||||
object_dst->data = BKE_grease_pencil_add(bmain, grease_pencil_src.id.name + 2);
|
||||
|
||||
return object_dst;
|
||||
}
|
||||
|
||||
static bke::greasepencil::Layer &find_or_create_layer_in_dst_by_name(
|
||||
const int layer_index, const GreasePencil &grease_pencil_src, GreasePencil &grease_pencil_dst)
|
||||
{
|
||||
using namespace bke::greasepencil;
|
||||
|
||||
Layer layer_src = *grease_pencil_src.layers().get(layer_index, &layer_src);
|
||||
|
||||
const int dst_layer_index = grease_pencil_dst.layers_for_write().first_index_try(&layer_src);
|
||||
if (dst_layer_index != -1) {
|
||||
return *grease_pencil_dst.layers_for_write()[dst_layer_index];
|
||||
}
|
||||
|
||||
/* Transfer Layer attributes. */
|
||||
bke::gather_attributes(grease_pencil_src.attributes(),
|
||||
bke::AttrDomain::Layer,
|
||||
{},
|
||||
{},
|
||||
Span({layer_index}),
|
||||
grease_pencil_dst.attributes_for_write());
|
||||
|
||||
return grease_pencil_dst.add_layer(layer_src.name());
|
||||
}
|
||||
|
||||
static bool grease_pencil_separate_selected(bContext &C,
|
||||
Main &bmain,
|
||||
Scene &scene,
|
||||
ViewLayer &view_layer,
|
||||
Base &base_prev,
|
||||
Object &object_src)
|
||||
{
|
||||
using namespace bke::greasepencil;
|
||||
bool changed = false;
|
||||
|
||||
GreasePencil &grease_pencil_src = *static_cast<GreasePencil *>(object_src.data);
|
||||
Object *object_dst = duplicate_grease_pencil_object(
|
||||
&bmain, &scene, &view_layer, &base_prev, grease_pencil_src);
|
||||
GreasePencil &grease_pencil_dst = *static_cast<GreasePencil *>(object_dst->data);
|
||||
|
||||
/* Iterate through all the drawings at current scene frame. */
|
||||
const Array<MutableDrawingInfo> drawings_src = retrieve_editable_drawings(scene,
|
||||
grease_pencil_src);
|
||||
for (const MutableDrawingInfo &info : drawings_src) {
|
||||
bke::CurvesGeometry &curves_src = info.drawing.strokes_for_write();
|
||||
IndexMaskMemory memory;
|
||||
const IndexMask selected_points = ed::curves::retrieve_selected_points(curves_src, memory);
|
||||
if (selected_points.is_empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Insert Keyframe at current frame/layer. */
|
||||
Layer &layer_dst = find_or_create_layer_in_dst_by_name(
|
||||
info.layer_index, grease_pencil_src, grease_pencil_dst);
|
||||
grease_pencil_dst.insert_blank_frame(layer_dst, info.frame_number, 0, BEZT_KEYTYPE_KEYFRAME);
|
||||
|
||||
/* Copy strokes to new CurvesGeometry. */
|
||||
Drawing &drawing_dst = *grease_pencil_dst.get_editable_drawing_at(layer_dst,
|
||||
info.frame_number);
|
||||
drawing_dst.strokes_for_write() = bke::curves_copy_point_selection(
|
||||
curves_src, selected_points, {});
|
||||
curves_src = remove_points_and_split(curves_src, selected_points);
|
||||
|
||||
info.drawing.tag_topology_changed();
|
||||
drawing_dst.tag_topology_changed();
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
grease_pencil_dst.set_active_layer(0);
|
||||
|
||||
/* Add object materials to target object. */
|
||||
BKE_object_material_array_assign(&bmain,
|
||||
object_dst,
|
||||
BKE_object_material_array_p(&object_src),
|
||||
*BKE_object_material_len_p(&object_src),
|
||||
false);
|
||||
|
||||
remove_unused_materials(&bmain, object_dst);
|
||||
DEG_id_tag_update(&grease_pencil_dst.id, ID_RECALC_GEOMETRY);
|
||||
WM_event_add_notifier(&C, NC_OBJECT | ND_DRAW, &grease_pencil_dst);
|
||||
}
|
||||
return changed;
|
||||
}
|
||||
|
||||
static bool grease_pencil_separate_layer(bContext &C,
|
||||
Main &bmain,
|
||||
Scene &scene,
|
||||
ViewLayer &view_layer,
|
||||
Base &base_prev,
|
||||
Object &object_src)
|
||||
{
|
||||
using namespace bke::greasepencil;
|
||||
bool changed = false;
|
||||
|
||||
GreasePencil &grease_pencil_src = *static_cast<GreasePencil *>(object_src.data);
|
||||
|
||||
/* Create a new object for each layer. */
|
||||
for (const Layer *layer_src : grease_pencil_src.layers()) {
|
||||
if (layer_src->is_selected() || layer_src->is_locked()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Object *object_dst = duplicate_grease_pencil_object(
|
||||
&bmain, &scene, &view_layer, &base_prev, grease_pencil_src);
|
||||
GreasePencil &grease_pencil_dst = *static_cast<GreasePencil *>(object_dst->data);
|
||||
Layer &layer_dst = find_or_create_layer_in_dst_by_name(
|
||||
grease_pencil_src.layers().first_index(layer_src), grease_pencil_src, grease_pencil_dst);
|
||||
|
||||
/* Iterate through all the drawings at current frame. */
|
||||
const Array<MutableDrawingInfo> drawings_src = retrieve_editable_drawings_from_layer(
|
||||
scene, grease_pencil_src, *layer_src);
|
||||
for (const MutableDrawingInfo &info : drawings_src) {
|
||||
bke::CurvesGeometry &curves_src = info.drawing.strokes_for_write();
|
||||
IndexMaskMemory memory;
|
||||
const IndexMask strokes = retrieve_editable_strokes(object_src, info.drawing, memory);
|
||||
if (strokes.is_empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Add object materials. */
|
||||
BKE_object_material_array_assign(&bmain,
|
||||
object_dst,
|
||||
BKE_object_material_array_p(&object_src),
|
||||
*BKE_object_material_len_p(&object_src),
|
||||
false);
|
||||
|
||||
/* Insert Keyframe at current frame/layer. */
|
||||
grease_pencil_dst.insert_blank_frame(layer_dst, info.frame_number, 0, BEZT_KEYTYPE_KEYFRAME);
|
||||
|
||||
/* Copy strokes to new CurvesGeometry. */
|
||||
Drawing &drawing_dst = *grease_pencil_dst.get_editable_drawing_at(layer_dst,
|
||||
info.frame_number);
|
||||
drawing_dst.strokes_for_write() = bke::curves_copy_curve_selection(
|
||||
info.drawing.strokes(), strokes, {});
|
||||
curves_src.remove_curves(strokes, {});
|
||||
|
||||
info.drawing.tag_topology_changed();
|
||||
drawing_dst.tag_topology_changed();
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
remove_unused_materials(&bmain, object_dst);
|
||||
|
||||
DEG_id_tag_update(&grease_pencil_dst.id, ID_RECALC_GEOMETRY);
|
||||
WM_event_add_notifier(&C, NC_OBJECT | ND_DRAW, &grease_pencil_dst);
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
static bool grease_pencil_separate_material(bContext &C,
|
||||
Main &bmain,
|
||||
Scene &scene,
|
||||
ViewLayer &view_layer,
|
||||
Base &base_prev,
|
||||
Object &object_src)
|
||||
{
|
||||
using namespace blender::bke;
|
||||
using namespace bke::greasepencil;
|
||||
bool changed = false;
|
||||
|
||||
GreasePencil &grease_pencil_src = *static_cast<GreasePencil *>(object_src.data);
|
||||
|
||||
/* Create a new object for each material. */
|
||||
for (const int mat_i : IndexRange(object_src.totcol).drop_front(1)) {
|
||||
Object *object_dst = duplicate_grease_pencil_object(
|
||||
&bmain, &scene, &view_layer, &base_prev, grease_pencil_src);
|
||||
|
||||
/* Add object materials. */
|
||||
BKE_object_material_array_assign(&bmain,
|
||||
object_dst,
|
||||
BKE_object_material_array_p(&object_src),
|
||||
*BKE_object_material_len_p(&object_src),
|
||||
false);
|
||||
|
||||
/* Iterate through all the drawings at current scene frame. */
|
||||
const Array<MutableDrawingInfo> drawings_src = retrieve_editable_drawings(scene,
|
||||
grease_pencil_src);
|
||||
for (const MutableDrawingInfo &info : drawings_src) {
|
||||
bke::CurvesGeometry &curves_src = info.drawing.strokes_for_write();
|
||||
IndexMaskMemory memory;
|
||||
const IndexMask strokes = retrieve_editable_strokes_by_material(
|
||||
object_src, info.drawing, mat_i, memory);
|
||||
if (strokes.is_empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
GreasePencil &grease_pencil_dst = *static_cast<GreasePencil *>(object_dst->data);
|
||||
|
||||
/* Insert Keyframe at current frame/layer. */
|
||||
Layer &layer_dst = find_or_create_layer_in_dst_by_name(
|
||||
info.layer_index, grease_pencil_src, grease_pencil_dst);
|
||||
grease_pencil_dst.insert_blank_frame(layer_dst, info.frame_number, 0, BEZT_KEYTYPE_KEYFRAME);
|
||||
|
||||
/* Copy strokes to new CurvesGeometry. */
|
||||
Drawing &drawing_dst = *grease_pencil_dst.get_editable_drawing_at(layer_dst,
|
||||
info.frame_number);
|
||||
drawing_dst.strokes_for_write() = bke::curves_copy_curve_selection(curves_src, strokes, {});
|
||||
curves_src.remove_curves(strokes, {});
|
||||
|
||||
info.drawing.tag_topology_changed();
|
||||
drawing_dst.tag_topology_changed();
|
||||
DEG_id_tag_update(&grease_pencil_dst.id, ID_RECALC_GEOMETRY);
|
||||
WM_event_add_notifier(&C, NC_OBJECT | ND_DRAW, &grease_pencil_dst);
|
||||
|
||||
changed = true;
|
||||
}
|
||||
|
||||
remove_unused_materials(&bmain, object_dst);
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
remove_unused_materials(&bmain, &object_src);
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
static int grease_pencil_separate_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
using namespace bke::greasepencil;
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
Base *base_prev = CTX_data_active_base(C);
|
||||
Object *object_src = CTX_data_active_object(C);
|
||||
GreasePencil &grease_pencil_src = *static_cast<GreasePencil *>(object_src->data);
|
||||
|
||||
const SeparateMode mode = SeparateMode(RNA_enum_get(op->ptr, "mode"));
|
||||
bool changed = false;
|
||||
|
||||
WM_cursor_wait(true);
|
||||
|
||||
switch (mode) {
|
||||
case SeparateMode::SELECTED: {
|
||||
/* Cancel if nothing selected. */
|
||||
const Array<MutableDrawingInfo> drawings = retrieve_editable_drawings(*scene,
|
||||
grease_pencil_src);
|
||||
const bool has_selection = std::any_of(
|
||||
drawings.begin(), drawings.end(), [&](const MutableDrawingInfo &info) {
|
||||
return ed::curves::has_anything_selected(info.drawing.strokes());
|
||||
});
|
||||
if (!has_selection) {
|
||||
BKE_report(op->reports, RPT_ERROR, "Nothing selected");
|
||||
WM_cursor_wait(false);
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
changed = grease_pencil_separate_selected(
|
||||
*C, *bmain, *scene, *view_layer, *base_prev, *object_src);
|
||||
break;
|
||||
}
|
||||
case SeparateMode::MATERIAL: {
|
||||
/* Cancel if the object only has one material. */
|
||||
if (object_src->totcol == 1) {
|
||||
BKE_report(op->reports, RPT_ERROR, "The object has only one material");
|
||||
WM_cursor_wait(false);
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
changed = grease_pencil_separate_material(
|
||||
*C, *bmain, *scene, *view_layer, *base_prev, *object_src);
|
||||
break;
|
||||
}
|
||||
case SeparateMode::LAYER: {
|
||||
/* Cancel if the object only has one layer. */
|
||||
if (grease_pencil_src.layers().size() == 1) {
|
||||
BKE_report(op->reports, RPT_ERROR, "The object has only one layer");
|
||||
WM_cursor_wait(false);
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
changed = grease_pencil_separate_layer(
|
||||
*C, *bmain, *scene, *view_layer, *base_prev, *object_src);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
WM_cursor_wait(false);
|
||||
|
||||
if (changed) {
|
||||
DEG_id_tag_update(&grease_pencil_src.id, ID_RECALC_GEOMETRY);
|
||||
WM_event_add_notifier(C, NC_GEOM | ND_DATA | NA_EDITED, &grease_pencil_src);
|
||||
}
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static void GREASE_PENCIL_OT_separate(wmOperatorType *ot)
|
||||
{
|
||||
/* identifiers. */
|
||||
ot->name = "Separate";
|
||||
ot->idname = "GREASE_PENCIL_OT_separate";
|
||||
ot->description = "Separate the selected geometry into a new grease pencil object";
|
||||
|
||||
/* callbacks. */
|
||||
ot->invoke = WM_menu_invoke;
|
||||
ot->exec = grease_pencil_separate_exec;
|
||||
ot->poll = editable_grease_pencil_poll;
|
||||
|
||||
/* flags. */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
||||
/* properties. */
|
||||
ot->prop = RNA_def_enum(
|
||||
ot->srna, "mode", prop_separate_modes, int(SeparateMode::SELECTED), "Mode", "");
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
} // namespace blender::ed::greasepencil
|
||||
|
||||
void ED_operatortypes_grease_pencil_edit()
|
||||
@ -1748,6 +2109,7 @@ void ED_operatortypes_grease_pencil_edit()
|
||||
WM_operatortype_append(GREASE_PENCIL_OT_duplicate);
|
||||
WM_operatortype_append(GREASE_PENCIL_OT_set_material);
|
||||
WM_operatortype_append(GREASE_PENCIL_OT_clean_loose);
|
||||
WM_operatortype_append(GREASE_PENCIL_OT_separate);
|
||||
WM_operatortype_append(GREASE_PENCIL_OT_stroke_subdivide);
|
||||
WM_operatortype_append(GREASE_PENCIL_OT_stroke_reorder);
|
||||
WM_operatortype_append(GREASE_PENCIL_OT_move_to_layer);
|
||||
|
@ -224,6 +224,29 @@ Array<MutableDrawingInfo> retrieve_editable_drawings(const Scene &scene,
|
||||
return editable_drawings.as_span();
|
||||
}
|
||||
|
||||
Array<MutableDrawingInfo> retrieve_editable_drawings_from_layer(
|
||||
const Scene &scene,
|
||||
GreasePencil &grease_pencil,
|
||||
const blender::bke::greasepencil::Layer &layer)
|
||||
{
|
||||
using namespace blender::bke::greasepencil;
|
||||
const int current_frame = scene.r.cfra;
|
||||
const ToolSettings *toolsettings = scene.toolsettings;
|
||||
const bool use_multi_frame_editing = (toolsettings->gpencil_flags &
|
||||
GP_USE_MULTI_FRAME_EDITING) != 0;
|
||||
|
||||
Vector<MutableDrawingInfo> editable_drawings;
|
||||
const Array<int> frame_numbers = get_frame_numbers_for_layer(
|
||||
layer, current_frame, use_multi_frame_editing);
|
||||
for (const int frame_number : frame_numbers) {
|
||||
if (Drawing *drawing = grease_pencil.get_editable_drawing_at(layer, frame_number)) {
|
||||
editable_drawings.append({*drawing, layer.drawing_index_at(frame_number), frame_number});
|
||||
}
|
||||
}
|
||||
|
||||
return editable_drawings.as_span();
|
||||
}
|
||||
|
||||
Array<DrawingInfo> retrieve_visible_drawings(const Scene &scene, const GreasePencil &grease_pencil)
|
||||
{
|
||||
using namespace blender::bke::greasepencil;
|
||||
@ -315,6 +338,42 @@ IndexMask retrieve_editable_strokes(Object &object,
|
||||
});
|
||||
}
|
||||
|
||||
IndexMask retrieve_editable_strokes_by_material(Object &object,
|
||||
const bke::greasepencil::Drawing &drawing,
|
||||
const int mat_i,
|
||||
IndexMaskMemory &memory)
|
||||
{
|
||||
using namespace blender;
|
||||
|
||||
/* Get all the editable material indices */
|
||||
VectorSet<int> editable_material_indices = get_editable_material_indices(object);
|
||||
if (editable_material_indices.is_empty()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const bke::CurvesGeometry &curves = drawing.strokes();
|
||||
const IndexRange curves_range = drawing.strokes().curves_range();
|
||||
const bke::AttributeAccessor attributes = curves.attributes();
|
||||
|
||||
const VArray<int> materials = *attributes.lookup<int>("material_index", bke::AttrDomain::Curve);
|
||||
if (!materials) {
|
||||
/* If the attribute does not exist then the default is the first material. */
|
||||
if (editable_material_indices.contains(0)) {
|
||||
return curves_range;
|
||||
}
|
||||
return {};
|
||||
}
|
||||
/* Get all the strokes that share the same material and have it unlocked. */
|
||||
return IndexMask::from_predicate(
|
||||
curves_range, GrainSize(4096), memory, [&](const int64_t curve_i) {
|
||||
const int material_index = materials[curve_i];
|
||||
if (material_index == mat_i) {
|
||||
return editable_material_indices.contains(material_index);
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
IndexMask retrieve_editable_points(Object &object,
|
||||
const bke::greasepencil::Drawing &drawing,
|
||||
IndexMaskMemory &memory)
|
||||
|
@ -171,12 +171,18 @@ struct MutableDrawingInfo {
|
||||
};
|
||||
Array<MutableDrawingInfo> retrieve_editable_drawings(const Scene &scene,
|
||||
GreasePencil &grease_pencil);
|
||||
Array<MutableDrawingInfo> retrieve_editable_drawings_from_layer(
|
||||
const Scene &scene, GreasePencil &grease_pencil, const bke::greasepencil::Layer &layer);
|
||||
Array<DrawingInfo> retrieve_visible_drawings(const Scene &scene,
|
||||
const GreasePencil &grease_pencil);
|
||||
|
||||
IndexMask retrieve_editable_strokes(Object &grease_pencil_object,
|
||||
const bke::greasepencil::Drawing &drawing,
|
||||
IndexMaskMemory &memory);
|
||||
IndexMask retrieve_editable_strokes_by_material(Object &object,
|
||||
const bke::greasepencil::Drawing &drawing,
|
||||
const int mat_i,
|
||||
IndexMaskMemory &memory);
|
||||
IndexMask retrieve_editable_points(Object &object,
|
||||
const bke::greasepencil::Drawing &drawing,
|
||||
IndexMaskMemory &memory);
|
||||
|
@ -1037,8 +1037,6 @@ uiBut *uiDefButBitI(uiBlock *block,
|
||||
int *poin,
|
||||
float min,
|
||||
float max,
|
||||
float a1,
|
||||
float a2,
|
||||
const char *tip);
|
||||
uiBut *uiDefButS(uiBlock *block,
|
||||
int type,
|
||||
@ -1066,8 +1064,6 @@ uiBut *uiDefButBitS(uiBlock *block,
|
||||
short *poin,
|
||||
float min,
|
||||
float max,
|
||||
float a1,
|
||||
float a2,
|
||||
const char *tip);
|
||||
uiBut *uiDefButC(uiBlock *block,
|
||||
int type,
|
||||
@ -1080,8 +1076,6 @@ uiBut *uiDefButC(uiBlock *block,
|
||||
char *poin,
|
||||
float min,
|
||||
float max,
|
||||
float a1,
|
||||
float a2,
|
||||
const char *tip);
|
||||
uiBut *uiDefButBitC(uiBlock *block,
|
||||
int type,
|
||||
@ -1095,8 +1089,6 @@ uiBut *uiDefButBitC(uiBlock *block,
|
||||
char *poin,
|
||||
float min,
|
||||
float max,
|
||||
float a1,
|
||||
float a2,
|
||||
const char *tip);
|
||||
uiBut *uiDefButR(uiBlock *block,
|
||||
int type,
|
||||
@ -1111,8 +1103,6 @@ uiBut *uiDefButR(uiBlock *block,
|
||||
int index,
|
||||
float min,
|
||||
float max,
|
||||
float a1,
|
||||
float a2,
|
||||
const char *tip);
|
||||
uiBut *uiDefButR_prop(uiBlock *block,
|
||||
int type,
|
||||
@ -1127,8 +1117,6 @@ uiBut *uiDefButR_prop(uiBlock *block,
|
||||
int index,
|
||||
float min,
|
||||
float max,
|
||||
float a1,
|
||||
float a2,
|
||||
const char *tip);
|
||||
uiBut *uiDefButO(uiBlock *block,
|
||||
int type,
|
||||
@ -1254,8 +1242,6 @@ uiBut *uiDefIconButR(uiBlock *block,
|
||||
int index,
|
||||
float min,
|
||||
float max,
|
||||
float a1,
|
||||
float a2,
|
||||
const char *tip);
|
||||
uiBut *uiDefIconButR_prop(uiBlock *block,
|
||||
int type,
|
||||
@ -1270,8 +1256,6 @@ uiBut *uiDefIconButR_prop(uiBlock *block,
|
||||
int index,
|
||||
float min,
|
||||
float max,
|
||||
float a1,
|
||||
float a2,
|
||||
const char *tip);
|
||||
uiBut *uiDefIconButO(uiBlock *block,
|
||||
int type,
|
||||
@ -1356,8 +1340,6 @@ uiBut *uiDefIconTextButR(uiBlock *block,
|
||||
int index,
|
||||
float min,
|
||||
float max,
|
||||
float a1,
|
||||
float a2,
|
||||
const char *tip);
|
||||
uiBut *uiDefIconTextButR_prop(uiBlock *block,
|
||||
int type,
|
||||
@ -1373,8 +1355,6 @@ uiBut *uiDefIconTextButR_prop(uiBlock *block,
|
||||
int index,
|
||||
float min,
|
||||
float max,
|
||||
float a1,
|
||||
float a2,
|
||||
const char *tip);
|
||||
uiBut *uiDefIconTextButO(uiBlock *block,
|
||||
int type,
|
||||
@ -2304,7 +2284,7 @@ uiLayout *uiLayoutPanelProp(const bContext *C,
|
||||
/**
|
||||
* Variant of #uiLayoutPanelProp that automatically stores the open-close-state in the root
|
||||
* panel. When a dynamic number of panels is required, it's recommended to use #uiLayoutPanelProp
|
||||
* instead of passing in generated idnames.
|
||||
* instead of passing in generated id names.
|
||||
*
|
||||
* \param idname: String that identifies the open-close-state in the root panel.
|
||||
*/
|
||||
|
@ -4546,14 +4546,11 @@ static uiBut *ui_def_but_rna(uiBlock *block,
|
||||
int index,
|
||||
float min,
|
||||
float max,
|
||||
float a1,
|
||||
float a2,
|
||||
const char *tip)
|
||||
{
|
||||
const PropertyType proptype = RNA_property_type(prop);
|
||||
int icon = 0;
|
||||
uiMenuCreateFunc func = nullptr;
|
||||
const bool always_set_a1_a2 = ELEM(type, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER);
|
||||
|
||||
if (ELEM(type, UI_BTYPE_COLOR, UI_BTYPE_HSVCIRCLE, UI_BTYPE_HSVCUBE)) {
|
||||
BLI_assert(index == -1);
|
||||
@ -4617,61 +4614,51 @@ static uiBut *ui_def_but_rna(uiBlock *block,
|
||||
tip = RNA_property_ui_description(prop);
|
||||
}
|
||||
|
||||
if (min == max || a1 == -1 || a2 == -1 || always_set_a1_a2) {
|
||||
if (proptype == PROP_INT) {
|
||||
int hardmin, hardmax, softmin, softmax, step;
|
||||
float step = -1.0f;
|
||||
float precision = -1.0f;
|
||||
if (proptype == PROP_INT) {
|
||||
int hardmin, hardmax, softmin, softmax, int_step;
|
||||
|
||||
RNA_property_int_range(ptr, prop, &hardmin, &hardmax);
|
||||
RNA_property_int_ui_range(ptr, prop, &softmin, &softmax, &step);
|
||||
RNA_property_int_range(ptr, prop, &hardmin, &hardmax);
|
||||
RNA_property_int_ui_range(ptr, prop, &softmin, &softmax, &int_step);
|
||||
|
||||
if (!ELEM(type, UI_BTYPE_ROW, UI_BTYPE_LISTROW) && min == max) {
|
||||
min = hardmin;
|
||||
max = hardmax;
|
||||
}
|
||||
if (a1 == -1 || always_set_a1_a2) {
|
||||
a1 = step;
|
||||
}
|
||||
if (a2 == -1 || always_set_a1_a2) {
|
||||
a2 = 0;
|
||||
}
|
||||
if (!ELEM(type, UI_BTYPE_ROW, UI_BTYPE_LISTROW) && min == max) {
|
||||
min = hardmin;
|
||||
max = hardmax;
|
||||
}
|
||||
else if (proptype == PROP_FLOAT) {
|
||||
float hardmin, hardmax, softmin, softmax, step, precision;
|
||||
step = int_step;
|
||||
precision = 0;
|
||||
}
|
||||
else if (proptype == PROP_FLOAT) {
|
||||
float hardmin, hardmax, softmin, softmax;
|
||||
|
||||
RNA_property_float_range(ptr, prop, &hardmin, &hardmax);
|
||||
RNA_property_float_ui_range(ptr, prop, &softmin, &softmax, &step, &precision);
|
||||
RNA_property_float_range(ptr, prop, &hardmin, &hardmax);
|
||||
RNA_property_float_ui_range(ptr, prop, &softmin, &softmax, &step, &precision);
|
||||
|
||||
if (!ELEM(type, UI_BTYPE_ROW, UI_BTYPE_LISTROW) && min == max) {
|
||||
min = hardmin;
|
||||
max = hardmax;
|
||||
}
|
||||
if (a1 == -1 || always_set_a1_a2) {
|
||||
a1 = step;
|
||||
}
|
||||
if (a2 == -1 || always_set_a1_a2) {
|
||||
a2 = precision;
|
||||
}
|
||||
}
|
||||
else if (proptype == PROP_STRING) {
|
||||
min = 0;
|
||||
max = RNA_property_string_maxlength(prop);
|
||||
/* NOTE: 'max' may be zero (code for dynamically resized array). */
|
||||
if (!ELEM(type, UI_BTYPE_ROW, UI_BTYPE_LISTROW) && min == max) {
|
||||
min = hardmin;
|
||||
max = hardmax;
|
||||
}
|
||||
}
|
||||
else if (proptype == PROP_STRING) {
|
||||
min = 0;
|
||||
max = RNA_property_string_maxlength(prop);
|
||||
/* NOTE: 'max' may be zero (code for dynamically resized array). */
|
||||
}
|
||||
|
||||
/* now create button */
|
||||
uiBut *but = ui_def_but(
|
||||
block, type, retval, str, x, y, width, height, nullptr, min, max, a1, a2, tip);
|
||||
block, type, retval, str, x, y, width, height, nullptr, min, max, step, precision, tip);
|
||||
|
||||
if (but->type == UI_BTYPE_NUM) {
|
||||
/* Set default values, can be overridden later. */
|
||||
UI_but_number_step_size_set(but, a1);
|
||||
UI_but_number_precision_set(but, a2);
|
||||
UI_but_number_step_size_set(but, step);
|
||||
UI_but_number_precision_set(but, precision);
|
||||
}
|
||||
else if (but->type == UI_BTYPE_NUM_SLIDER) {
|
||||
/* Set default values, can be overridden later. */
|
||||
UI_but_number_slider_step_size_set(but, a1);
|
||||
UI_but_number_slider_precision_set(but, a2);
|
||||
UI_but_number_slider_step_size_set(but, step);
|
||||
UI_but_number_slider_precision_set(but, precision);
|
||||
}
|
||||
|
||||
but->rnapoin = *ptr;
|
||||
@ -4754,8 +4741,6 @@ static uiBut *ui_def_but_rna_propname(uiBlock *block,
|
||||
int index,
|
||||
float min,
|
||||
float max,
|
||||
float a1,
|
||||
float a2,
|
||||
const char *tip)
|
||||
{
|
||||
PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
|
||||
@ -4763,11 +4748,11 @@ static uiBut *ui_def_but_rna_propname(uiBlock *block,
|
||||
uiBut *but;
|
||||
if (prop) {
|
||||
but = ui_def_but_rna(
|
||||
block, type, retval, str, x, y, width, height, ptr, prop, index, min, max, a1, a2, tip);
|
||||
block, type, retval, str, x, y, width, height, ptr, prop, index, min, max, tip);
|
||||
}
|
||||
else {
|
||||
but = ui_def_but(
|
||||
block, type, retval, propname, x, y, width, height, nullptr, min, max, a1, a2, tip);
|
||||
block, type, retval, propname, x, y, width, height, nullptr, min, max, -1.0f, -1.0f, tip);
|
||||
|
||||
UI_but_disable(but, "Unknown Property.");
|
||||
}
|
||||
@ -5114,8 +5099,6 @@ uiBut *uiDefButBitI(uiBlock *block,
|
||||
int *poin,
|
||||
float min,
|
||||
float max,
|
||||
float a1,
|
||||
float a2,
|
||||
const char *tip)
|
||||
{
|
||||
return uiDefButBit(block,
|
||||
@ -5130,8 +5113,8 @@ uiBut *uiDefButBitI(uiBlock *block,
|
||||
(void *)poin,
|
||||
min,
|
||||
max,
|
||||
a1,
|
||||
a2,
|
||||
0.0f,
|
||||
0.0f,
|
||||
tip);
|
||||
}
|
||||
uiBut *uiDefButS(uiBlock *block,
|
||||
@ -5176,8 +5159,6 @@ uiBut *uiDefButBitS(uiBlock *block,
|
||||
short *poin,
|
||||
float min,
|
||||
float max,
|
||||
float a1,
|
||||
float a2,
|
||||
const char *tip)
|
||||
{
|
||||
return uiDefButBit(block,
|
||||
@ -5192,8 +5173,8 @@ uiBut *uiDefButBitS(uiBlock *block,
|
||||
(void *)poin,
|
||||
min,
|
||||
max,
|
||||
a1,
|
||||
a2,
|
||||
0.0f,
|
||||
0.0f,
|
||||
tip);
|
||||
}
|
||||
uiBut *uiDefButC(uiBlock *block,
|
||||
@ -5207,8 +5188,6 @@ uiBut *uiDefButC(uiBlock *block,
|
||||
char *poin,
|
||||
float min,
|
||||
float max,
|
||||
float a1,
|
||||
float a2,
|
||||
const char *tip)
|
||||
{
|
||||
return uiDefBut(block,
|
||||
@ -5222,8 +5201,8 @@ uiBut *uiDefButC(uiBlock *block,
|
||||
(void *)poin,
|
||||
min,
|
||||
max,
|
||||
a1,
|
||||
a2,
|
||||
0.0f,
|
||||
0.0f,
|
||||
tip);
|
||||
}
|
||||
uiBut *uiDefButBitC(uiBlock *block,
|
||||
@ -5238,8 +5217,6 @@ uiBut *uiDefButBitC(uiBlock *block,
|
||||
char *poin,
|
||||
float min,
|
||||
float max,
|
||||
float a1,
|
||||
float a2,
|
||||
const char *tip)
|
||||
{
|
||||
return uiDefButBit(block,
|
||||
@ -5254,8 +5231,8 @@ uiBut *uiDefButBitC(uiBlock *block,
|
||||
(void *)poin,
|
||||
min,
|
||||
max,
|
||||
a1,
|
||||
a2,
|
||||
0,
|
||||
0,
|
||||
tip);
|
||||
}
|
||||
uiBut *uiDefButR(uiBlock *block,
|
||||
@ -5271,12 +5248,10 @@ uiBut *uiDefButR(uiBlock *block,
|
||||
int index,
|
||||
float min,
|
||||
float max,
|
||||
float a1,
|
||||
float a2,
|
||||
const char *tip)
|
||||
{
|
||||
uiBut *but = ui_def_but_rna_propname(
|
||||
block, type, retval, str, x, y, width, height, ptr, propname, index, min, max, a1, a2, tip);
|
||||
block, type, retval, str, x, y, width, height, ptr, propname, index, min, max, tip);
|
||||
ui_but_update(but);
|
||||
return but;
|
||||
}
|
||||
@ -5293,12 +5268,10 @@ uiBut *uiDefButR_prop(uiBlock *block,
|
||||
int index,
|
||||
float min,
|
||||
float max,
|
||||
float a1,
|
||||
float a2,
|
||||
const char *tip)
|
||||
{
|
||||
uiBut *but = ui_def_but_rna(
|
||||
block, type, retval, str, x, y, width, height, ptr, prop, index, min, max, a1, a2, tip);
|
||||
block, type, retval, str, x, y, width, height, ptr, prop, index, min, max, tip);
|
||||
ui_but_update(but);
|
||||
return but;
|
||||
}
|
||||
@ -5561,12 +5534,10 @@ uiBut *uiDefIconButR(uiBlock *block,
|
||||
int index,
|
||||
float min,
|
||||
float max,
|
||||
float a1,
|
||||
float a2,
|
||||
const char *tip)
|
||||
{
|
||||
uiBut *but = ui_def_but_rna_propname(
|
||||
block, type, retval, "", x, y, width, height, ptr, propname, index, min, max, a1, a2, tip);
|
||||
block, type, retval, "", x, y, width, height, ptr, propname, index, min, max, tip);
|
||||
ui_but_update_and_icon_set(but, icon);
|
||||
return but;
|
||||
}
|
||||
@ -5583,12 +5554,10 @@ uiBut *uiDefIconButR_prop(uiBlock *block,
|
||||
int index,
|
||||
float min,
|
||||
float max,
|
||||
float a1,
|
||||
float a2,
|
||||
const char *tip)
|
||||
{
|
||||
uiBut *but = ui_def_but_rna(
|
||||
block, type, retval, "", x, y, width, height, ptr, prop, index, min, max, a1, a2, tip);
|
||||
block, type, retval, "", x, y, width, height, ptr, prop, index, min, max, tip);
|
||||
ui_but_update_and_icon_set(but, icon);
|
||||
return but;
|
||||
}
|
||||
@ -5723,12 +5692,10 @@ uiBut *uiDefIconTextButR(uiBlock *block,
|
||||
int index,
|
||||
float min,
|
||||
float max,
|
||||
float a1,
|
||||
float a2,
|
||||
const char *tip)
|
||||
{
|
||||
uiBut *but = ui_def_but_rna_propname(
|
||||
block, type, retval, str, x, y, width, height, ptr, propname, index, min, max, a1, a2, tip);
|
||||
block, type, retval, str, x, y, width, height, ptr, propname, index, min, max, tip);
|
||||
ui_but_update_and_icon_set(but, icon);
|
||||
but->drawflag |= UI_BUT_ICON_LEFT;
|
||||
return but;
|
||||
@ -5747,12 +5714,10 @@ uiBut *uiDefIconTextButR_prop(uiBlock *block,
|
||||
int index,
|
||||
float min,
|
||||
float max,
|
||||
float a1,
|
||||
float a2,
|
||||
const char *tip)
|
||||
{
|
||||
uiBut *but = ui_def_but_rna(
|
||||
block, type, retval, str, x, y, width, height, ptr, prop, index, min, max, a1, a2, tip);
|
||||
block, type, retval, str, x, y, width, height, ptr, prop, index, min, max, tip);
|
||||
ui_but_update_and_icon_set(but, icon);
|
||||
but->drawflag |= UI_BUT_ICON_LEFT;
|
||||
return but;
|
||||
|
@ -610,6 +610,44 @@ static void waveform_draw_one(float *waveform, int waveform_num, const float col
|
||||
GPU_batch_discard(batch);
|
||||
}
|
||||
|
||||
static void waveform_draw_rgb(float *waveform, int waveform_num, float *col)
|
||||
{
|
||||
GPUVertFormat format = {0};
|
||||
const uint pos_id = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
const uint col_id = GPU_vertformat_attr_add(&format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT);
|
||||
|
||||
GPUVertBuf *vbo = GPU_vertbuf_create_with_format(&format);
|
||||
|
||||
GPU_vertbuf_data_alloc(vbo, waveform_num);
|
||||
GPU_vertbuf_attr_fill(vbo, pos_id, waveform);
|
||||
GPU_vertbuf_attr_fill(vbo, col_id, col);
|
||||
|
||||
GPUBatch *batch = GPU_batch_create_ex(GPU_PRIM_POINTS, vbo, nullptr, GPU_BATCH_OWNS_VBO);
|
||||
|
||||
GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_SMOOTH_COLOR);
|
||||
GPU_batch_draw(batch);
|
||||
GPU_batch_discard(batch);
|
||||
}
|
||||
|
||||
static void circle_draw_rgb(float *points, int tot_points, float *col, GPUPrimType prim)
|
||||
{
|
||||
GPUVertFormat format = {0};
|
||||
const uint pos_id = GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
const uint col_id = GPU_vertformat_attr_add(&format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT);
|
||||
|
||||
GPUVertBuf *vbo = GPU_vertbuf_create_with_format(&format);
|
||||
|
||||
GPU_vertbuf_data_alloc(vbo, tot_points);
|
||||
GPU_vertbuf_attr_fill(vbo, pos_id, points);
|
||||
GPU_vertbuf_attr_fill(vbo, col_id, col);
|
||||
|
||||
GPUBatch *batch = GPU_batch_create_ex(prim, vbo, nullptr, GPU_BATCH_OWNS_VBO);
|
||||
|
||||
GPU_batch_program_set_builtin(batch, GPU_SHADER_3D_SMOOTH_COLOR);
|
||||
GPU_batch_draw(batch);
|
||||
GPU_batch_discard(batch);
|
||||
}
|
||||
|
||||
void ui_draw_but_WAVEFORM(ARegion * /*region*/,
|
||||
uiBut *but,
|
||||
const uiWidgetColors * /*wcol*/,
|
||||
@ -687,8 +725,6 @@ void ui_draw_but_WAVEFORM(ARegion * /*region*/,
|
||||
/* Flush text cache before drawing things on top. */
|
||||
BLF_batch_draw_flush();
|
||||
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
|
||||
GPUVertFormat *format = immVertexFormat();
|
||||
const uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
|
||||
@ -863,11 +899,12 @@ static float polar_to_y(float center, float diam, float ampli, float angle)
|
||||
}
|
||||
|
||||
static void vectorscope_draw_target(
|
||||
uint pos, float centerx, float centery, float diam, const float colf[3])
|
||||
uint pos, float centerx, float centery, float diam, const float colf[3], char label)
|
||||
{
|
||||
float y, u, v;
|
||||
float tangle = 0.0f, tampli;
|
||||
float dangle, dampli, dangle2, dampli2;
|
||||
float dangle, dampli;
|
||||
char labelstr[2] = {label, '\0'};
|
||||
|
||||
rgb_to_yuv(colf[0], colf[1], colf[2], &y, &u, &v, BLI_YUV_ITU_BT709);
|
||||
|
||||
@ -905,56 +942,15 @@ static void vectorscope_draw_target(
|
||||
immVertex2f(pos,
|
||||
polar_to_x(centerx, diam, tampli + dampli, tangle - dangle),
|
||||
polar_to_y(centery, diam, tampli + dampli, tangle - dangle));
|
||||
immEnd();
|
||||
/* big target vary by 10 degree and 20% amplitude */
|
||||
immUniformColor4f(1.0f, 1.0f, 1.0f, 0.12f);
|
||||
dangle = DEG2RADF(10.0f);
|
||||
dampli = 0.2f * tampli;
|
||||
dangle2 = DEG2RADF(5.0f);
|
||||
dampli2 = 0.5f * dampli;
|
||||
immBegin(GPU_PRIM_LINE_STRIP, 3);
|
||||
immVertex2f(pos,
|
||||
polar_to_x(centerx, diam, tampli + dampli - dampli2, tangle + dangle),
|
||||
polar_to_y(centery, diam, tampli + dampli - dampli2, tangle + dangle));
|
||||
immVertex2f(pos,
|
||||
polar_to_x(centerx, diam, tampli + dampli, tangle + dangle),
|
||||
polar_to_y(centery, diam, tampli + dampli, tangle + dangle));
|
||||
immVertex2f(pos,
|
||||
polar_to_x(centerx, diam, tampli + dampli, tangle + dangle - dangle2),
|
||||
polar_to_y(centery, diam, tampli + dampli, tangle + dangle - dangle2));
|
||||
immEnd();
|
||||
immBegin(GPU_PRIM_LINE_STRIP, 3);
|
||||
immVertex2f(pos,
|
||||
polar_to_x(centerx, diam, tampli - dampli + dampli2, tangle + dangle),
|
||||
polar_to_y(centery, diam, tampli - dampli + dampli2, tangle + dangle));
|
||||
immVertex2f(pos,
|
||||
polar_to_x(centerx, diam, tampli - dampli, tangle + dangle),
|
||||
polar_to_y(centery, diam, tampli - dampli, tangle + dangle));
|
||||
immVertex2f(pos,
|
||||
polar_to_x(centerx, diam, tampli - dampli, tangle + dangle - dangle2),
|
||||
polar_to_y(centery, diam, tampli - dampli, tangle + dangle - dangle2));
|
||||
immEnd();
|
||||
immBegin(GPU_PRIM_LINE_STRIP, 3);
|
||||
immVertex2f(pos,
|
||||
polar_to_x(centerx, diam, tampli - dampli + dampli2, tangle - dangle),
|
||||
polar_to_y(centery, diam, tampli - dampli + dampli2, tangle - dangle));
|
||||
immVertex2f(pos,
|
||||
polar_to_x(centerx, diam, tampli - dampli, tangle - dangle),
|
||||
polar_to_y(centery, diam, tampli - dampli, tangle - dangle));
|
||||
immVertex2f(pos,
|
||||
polar_to_x(centerx, diam, tampli - dampli, tangle - dangle + dangle2),
|
||||
polar_to_y(centery, diam, tampli - dampli, tangle - dangle + dangle2));
|
||||
immEnd();
|
||||
immBegin(GPU_PRIM_LINE_STRIP, 3);
|
||||
immVertex2f(pos,
|
||||
polar_to_x(centerx, diam, tampli + dampli - dampli2, tangle - dangle),
|
||||
polar_to_y(centery, diam, tampli + dampli - dampli2, tangle - dangle));
|
||||
immVertex2f(pos,
|
||||
polar_to_x(centerx, diam, tampli + dampli, tangle - dangle),
|
||||
polar_to_y(centery, diam, tampli + dampli, tangle - dangle));
|
||||
immVertex2f(pos,
|
||||
polar_to_x(centerx, diam, tampli + dampli, tangle - dangle + dangle2),
|
||||
polar_to_y(centery, diam, tampli + dampli, tangle - dangle + dangle2));
|
||||
|
||||
/* draw color letter as text */
|
||||
BLF_color4f(BLF_default(), 1.0f, 1.0f, 1.0f, 0.3f);
|
||||
BLF_draw_default(polar_to_x(centerx, diam, tampli, tangle) + 5,
|
||||
polar_to_y(centery, diam, tampli, tangle),
|
||||
0,
|
||||
labelstr,
|
||||
strlen(labelstr));
|
||||
|
||||
immEnd();
|
||||
}
|
||||
|
||||
@ -967,14 +963,16 @@ void ui_draw_but_VECTORSCOPE(ARegion * /*region*/,
|
||||
Scopes *scopes = (Scopes *)but->poin;
|
||||
|
||||
const float colors[6][3] = {
|
||||
{0.75, 0.0, 0.0},
|
||||
{0.75, 0.75, 0.0},
|
||||
{0.0, 0.75, 0.0},
|
||||
{0.0, 0.75, 0.75},
|
||||
{0.0, 0.0, 0.75},
|
||||
{0.75, 0.0, 0.75},
|
||||
{0.75, 0.0, 0.0}, /* Red */
|
||||
{0.75, 0.75, 0.0}, /* Yellow */
|
||||
{0.0, 0.75, 0.0}, /* Green */
|
||||
{0.0, 0.75, 0.75}, /* Cyan */
|
||||
{0.0, 0.0, 0.75}, /* Blue */
|
||||
{0.75, 0.0, 0.75}, /* Magenta */
|
||||
};
|
||||
|
||||
const char color_names[] = {'R', 'Y', 'G', 'C', 'B', 'M'};
|
||||
|
||||
rctf rect{};
|
||||
rect.xmin = float(recti->xmin + 1);
|
||||
rect.xmax = float(recti->xmax - 1);
|
||||
@ -987,8 +985,9 @@ void ui_draw_but_VECTORSCOPE(ARegion * /*region*/,
|
||||
const float centery = rect.ymin + h * 0.5f;
|
||||
const float diam = (w < h) ? w : h;
|
||||
|
||||
const float alpha = scopes->vecscope_alpha * scopes->vecscope_alpha * scopes->vecscope_alpha;
|
||||
const float alpha = scopes->vecscope_alpha;
|
||||
|
||||
GPU_line_smooth(true);
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
|
||||
float color[4];
|
||||
@ -1013,10 +1012,118 @@ void ui_draw_but_VECTORSCOPE(ARegion * /*region*/,
|
||||
const uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
|
||||
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
|
||||
const int increment = 6;
|
||||
const int tot_points = int(360 / increment);
|
||||
const float r = 0.5f;
|
||||
float step = 360.0f / (tot_points - 1);
|
||||
|
||||
float circle_fill_points[(tot_points * 2) + 2];
|
||||
float circle_fill_vertex_colors[(tot_points * 4) + 4];
|
||||
|
||||
/* draw filled RGB circle for background, only for LUMA mode */
|
||||
if (scopes->vecscope_mode == SCOPES_VECSCOPE_LUMA) {
|
||||
/* Initialize center point and color */
|
||||
circle_fill_points[0] = centerx;
|
||||
circle_fill_points[1] = centery;
|
||||
circle_fill_vertex_colors[0] = 0.2f;
|
||||
circle_fill_vertex_colors[1] = 0.2f;
|
||||
circle_fill_vertex_colors[2] = 0.2f;
|
||||
circle_fill_vertex_colors[3] = 0.8f;
|
||||
|
||||
for (int i = 0; i < tot_points; i++) {
|
||||
float angle = step * i;
|
||||
const float a = DEG2RADF(angle);
|
||||
|
||||
const float x = polar_to_x(centerx, diam, r, a);
|
||||
const float y = polar_to_y(centery, diam, r, a);
|
||||
|
||||
const float u = polar_to_x(0.0f, 1.0, 1.0f, a);
|
||||
const float v = polar_to_y(0.0f, 1.0, 1.0f, a);
|
||||
|
||||
circle_fill_points[(i + 1) * 2] = x;
|
||||
circle_fill_points[(i + 1) * 2 + 1] = y;
|
||||
|
||||
float r, g, b;
|
||||
yuv_to_rgb(0.5f, u, v, &r, &g, &b, BLI_YUV_ITU_BT709);
|
||||
|
||||
circle_fill_vertex_colors[(i + 1) * 4] = r * 0.2f;
|
||||
circle_fill_vertex_colors[(i + 1) * 4 + 1] = g * 0.2f;
|
||||
circle_fill_vertex_colors[(i + 1) * 4 + 2] = b * 0.2f;
|
||||
circle_fill_vertex_colors[(i + 1) * 4 + 3] = 0.8f;
|
||||
}
|
||||
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
circle_draw_rgb(
|
||||
circle_fill_points, tot_points + 1, circle_fill_vertex_colors, GPU_PRIM_TRI_FAN);
|
||||
}
|
||||
/* draw filled Gray circle for background, only for RGB mode */
|
||||
else if (scopes->vecscope_mode == SCOPES_VECSCOPE_RGB) {
|
||||
GPU_blend(GPU_BLEND_NONE);
|
||||
immBegin(GPU_PRIM_TRI_FAN, tot_points + 2);
|
||||
immUniformColor3f(0.16f, 0.16f, 0.16f);
|
||||
immVertex2f(pos, centerx, centery);
|
||||
|
||||
for (int i = 0; i <= 360; i += increment) {
|
||||
const float a = DEG2RADF(float(i));
|
||||
immVertex2f(pos, polar_to_x(centerx, diam, r, a), polar_to_y(centery, diam, r, a));
|
||||
}
|
||||
immEnd();
|
||||
}
|
||||
|
||||
/* draw RGB ring */
|
||||
float circle_points[(tot_points * 2) + 3] = {};
|
||||
float circle_vertex_colors[(tot_points * 4) + 5] = {};
|
||||
|
||||
for (int i = 0; i < tot_points; i++) {
|
||||
float angle = step * i;
|
||||
const float a = DEG2RADF(angle);
|
||||
|
||||
const float x = polar_to_x(centerx, diam, 0.5f, a);
|
||||
const float y = polar_to_y(centery, diam, 0.5f, a);
|
||||
circle_points[i * 2] = x;
|
||||
circle_points[i * 2 + 1] = y;
|
||||
|
||||
const float u = polar_to_x(0.0f, 1.0, 1.0f, a);
|
||||
const float v = polar_to_y(0.0f, 1.0, 1.0f, a);
|
||||
float r, g, b;
|
||||
yuv_to_rgb(0.5f, u, v, &r, &g, &b, BLI_YUV_ITU_BT709);
|
||||
|
||||
circle_vertex_colors[i * 4] = r;
|
||||
circle_vertex_colors[i * 4 + 1] = g;
|
||||
circle_vertex_colors[i * 4 + 2] = b;
|
||||
circle_vertex_colors[i * 4 + 3] = 0.8f;
|
||||
}
|
||||
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
GPU_line_width(2.5f);
|
||||
circle_draw_rgb(circle_points, tot_points, circle_vertex_colors, GPU_PRIM_LINE_LOOP);
|
||||
GPU_line_width(1.5f);
|
||||
|
||||
/* inner circles */
|
||||
GPU_blend(GPU_BLEND_ADDITIVE);
|
||||
for (int j = 0; j < 4; j++) {
|
||||
float inner_circle_points[(tot_points * 2) + 3] = {};
|
||||
float inner_circle_colors[(tot_points * 4) + 5] = {};
|
||||
const float r = (j + 1) * 0.1f;
|
||||
|
||||
for (int i = 0; i < tot_points; i++) {
|
||||
float angle = step * i;
|
||||
const float a = DEG2RADF(angle);
|
||||
|
||||
inner_circle_points[i * 2] = polar_to_x(centerx, diam, r, a);
|
||||
inner_circle_points[i * 2 + 1] = polar_to_y(centery, diam, r, a);
|
||||
|
||||
inner_circle_colors[i * 4] = 0.1f;
|
||||
inner_circle_colors[i * 4 + 1] = 0.1f;
|
||||
inner_circle_colors[i * 4 + 2] = 0.1f;
|
||||
inner_circle_colors[i * 4 + 3] = 0.8f;
|
||||
}
|
||||
circle_draw_rgb(inner_circle_points, tot_points, inner_circle_colors, GPU_PRIM_LINE_LOOP);
|
||||
}
|
||||
|
||||
immUniformColor4f(1.0f, 1.0f, 1.0f, 0.08f);
|
||||
/* draw grid elements */
|
||||
/* cross */
|
||||
immUniformColor4f(1.0f, 1.0f, 1.0f, 0.1f);
|
||||
immBegin(GPU_PRIM_LINES, 4);
|
||||
|
||||
immVertex2f(pos, centerx - (diam * 0.5f) - 5, centery);
|
||||
@ -1027,19 +1134,9 @@ void ui_draw_but_VECTORSCOPE(ARegion * /*region*/,
|
||||
|
||||
immEnd();
|
||||
|
||||
/* circles */
|
||||
for (int j = 0; j < 5; j++) {
|
||||
const int increment = 15;
|
||||
immBegin(GPU_PRIM_LINE_LOOP, int(360 / increment));
|
||||
for (int i = 0; i <= 360 - increment; i += increment) {
|
||||
const float a = DEG2RADF(float(i));
|
||||
const float r = (j + 1) * 0.1f;
|
||||
immVertex2f(pos, polar_to_x(centerx, diam, r, a), polar_to_y(centery, diam, r, a));
|
||||
}
|
||||
immEnd();
|
||||
}
|
||||
/* skin tone line */
|
||||
immUniformColor4f(1.0f, 0.4f, 0.0f, 0.2f);
|
||||
GPU_blend(GPU_BLEND_ADDITIVE);
|
||||
immUniformColor3f(0.25f, 0.25f, 0.25f);
|
||||
|
||||
immBegin(GPU_PRIM_LINES, 2);
|
||||
immVertex2f(
|
||||
@ -1050,21 +1147,26 @@ void ui_draw_but_VECTORSCOPE(ARegion * /*region*/,
|
||||
|
||||
/* saturation points */
|
||||
for (int i = 0; i < 6; i++) {
|
||||
vectorscope_draw_target(pos, centerx, centery, diam, colors[i]);
|
||||
vectorscope_draw_target(pos, centerx, centery, diam, colors[i], color_names[i]);
|
||||
}
|
||||
|
||||
if (scopes->ok && scopes->vecscope != nullptr) {
|
||||
/* pixel point cloud */
|
||||
const float col[3] = {alpha, alpha, alpha};
|
||||
|
||||
GPU_blend(GPU_BLEND_ADDITIVE);
|
||||
GPU_point_size(1.0);
|
||||
|
||||
GPU_matrix_push();
|
||||
GPU_matrix_translate_2f(centerx, centery);
|
||||
GPU_matrix_scale_1f(diam);
|
||||
|
||||
waveform_draw_one(scopes->vecscope, scopes->waveform_tot, col);
|
||||
const float col[3] = {alpha, alpha, alpha};
|
||||
if (scopes->vecscope_mode == SCOPES_VECSCOPE_RGB) {
|
||||
GPU_blend(GPU_BLEND_ALPHA);
|
||||
waveform_draw_rgb(scopes->vecscope, scopes->waveform_tot, scopes->vecscope_rgb);
|
||||
}
|
||||
else if (scopes->vecscope_mode == SCOPES_VECSCOPE_LUMA) {
|
||||
GPU_blend(GPU_BLEND_ADDITIVE);
|
||||
waveform_draw_one(scopes->vecscope, scopes->waveform_tot, col);
|
||||
}
|
||||
|
||||
GPU_matrix_pop();
|
||||
}
|
||||
|
@ -679,8 +679,6 @@ static void ui_item_array(uiLayout *layout,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
-1,
|
||||
nullptr);
|
||||
}
|
||||
else {
|
||||
@ -794,16 +792,16 @@ static void ui_item_enum_expand_elem_exec(uiLayout *layout,
|
||||
uiBut *but;
|
||||
if (icon && name[0] && !icon_only) {
|
||||
but = uiDefIconTextButR_prop(
|
||||
block, but_type, 0, icon, name, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, nullptr);
|
||||
block, but_type, 0, icon, name, 0, 0, itemw, h, ptr, prop, -1, 0, value, nullptr);
|
||||
}
|
||||
else if (icon) {
|
||||
const int w = (is_first) ? itemw : ceilf(itemw - U.pixelsize);
|
||||
but = uiDefIconButR_prop(
|
||||
block, but_type, 0, icon, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, nullptr);
|
||||
block, but_type, 0, icon, 0, 0, w, h, ptr, prop, -1, 0, value, nullptr);
|
||||
}
|
||||
else {
|
||||
but = uiDefButR_prop(
|
||||
block, but_type, 0, name, 0, 0, itemw, h, ptr, prop, -1, 0, value, -1, -1, nullptr);
|
||||
block, but_type, 0, name, 0, 0, itemw, h, ptr, prop, -1, 0, value, nullptr);
|
||||
}
|
||||
|
||||
if (RNA_property_flag(prop) & PROP_ENUM_FLAG) {
|
||||
@ -1095,8 +1093,6 @@ static uiBut *ui_item_with_label(uiLayout *layout,
|
||||
index,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
-1,
|
||||
nullptr);
|
||||
}
|
||||
else if ((flag & UI_ITEM_R_FULL_EVENT) && is_keymapitem_ptr) {
|
||||
@ -1118,8 +1114,6 @@ static uiBut *ui_item_with_label(uiLayout *layout,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
-1,
|
||||
nullptr);
|
||||
UI_but_func_set(but, ui_keymap_but_cb, but, nullptr);
|
||||
if (flag & UI_ITEM_R_IMMEDIATE) {
|
||||
@ -2405,31 +2399,15 @@ void uiItemFullR(uiLayout *layout,
|
||||
/* enum item */
|
||||
else if (type == PROP_ENUM && index == RNA_ENUM_VALUE) {
|
||||
if (icon && name[0] && !icon_only) {
|
||||
uiDefIconTextButR_prop(block,
|
||||
UI_BTYPE_ROW,
|
||||
0,
|
||||
icon,
|
||||
name,
|
||||
0,
|
||||
0,
|
||||
w,
|
||||
h,
|
||||
ptr,
|
||||
prop,
|
||||
-1,
|
||||
0,
|
||||
value,
|
||||
-1,
|
||||
-1,
|
||||
nullptr);
|
||||
uiDefIconTextButR_prop(
|
||||
block, UI_BTYPE_ROW, 0, icon, name, 0, 0, w, h, ptr, prop, -1, 0, value, nullptr);
|
||||
}
|
||||
else if (icon) {
|
||||
uiDefIconButR_prop(
|
||||
block, UI_BTYPE_ROW, 0, icon, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, nullptr);
|
||||
block, UI_BTYPE_ROW, 0, icon, 0, 0, w, h, ptr, prop, -1, 0, value, nullptr);
|
||||
}
|
||||
else {
|
||||
uiDefButR_prop(
|
||||
block, UI_BTYPE_ROW, 0, name, 0, 0, w, h, ptr, prop, -1, 0, value, -1, -1, nullptr);
|
||||
uiDefButR_prop(block, UI_BTYPE_ROW, 0, name, 0, 0, w, h, ptr, prop, -1, 0, value, nullptr);
|
||||
}
|
||||
}
|
||||
/* expanded enum */
|
||||
|
@ -371,8 +371,6 @@ static void ui_colorpicker_circle(uiBlock *block,
|
||||
-1,
|
||||
0.0,
|
||||
0.0,
|
||||
0.0,
|
||||
0,
|
||||
TIP_("Color"));
|
||||
UI_but_func_set(bt, ui_colorpicker_rgba_update_cb, bt, nullptr);
|
||||
bt->custom_data = cpicker;
|
||||
@ -392,8 +390,6 @@ static void ui_colorpicker_circle(uiBlock *block,
|
||||
-1,
|
||||
0.0,
|
||||
0.0,
|
||||
0,
|
||||
0,
|
||||
"Lightness");
|
||||
hsv_but->gradient_type = UI_GRAD_L_ALT;
|
||||
UI_but_func_set(hsv_but, ui_colorpicker_rgba_update_cb, hsv_but, nullptr);
|
||||
@ -412,8 +408,6 @@ static void ui_colorpicker_circle(uiBlock *block,
|
||||
-1,
|
||||
0.0,
|
||||
0.0,
|
||||
0,
|
||||
0,
|
||||
CTX_TIP_(BLT_I18NCONTEXT_COLOR, "Value"));
|
||||
hsv_but->gradient_type = UI_GRAD_V_ALT;
|
||||
UI_but_func_set(hsv_but, ui_colorpicker_rgba_update_cb, hsv_but, nullptr);
|
||||
@ -445,8 +439,6 @@ static void ui_colorpicker_square(uiBlock *block,
|
||||
-1,
|
||||
0.0,
|
||||
0.0,
|
||||
0,
|
||||
0,
|
||||
TIP_("Color"));
|
||||
hsv_but->gradient_type = type;
|
||||
UI_but_func_set(hsv_but, ui_colorpicker_rgba_update_cb, hsv_but, nullptr);
|
||||
@ -466,8 +458,6 @@ static void ui_colorpicker_square(uiBlock *block,
|
||||
-1,
|
||||
0.0,
|
||||
0.0,
|
||||
0,
|
||||
0,
|
||||
CTX_TIP_(BLT_I18NCONTEXT_COLOR, "Value"));
|
||||
hsv_but->gradient_type = (eButGradientType)(type + 3);
|
||||
UI_but_func_set(hsv_but, ui_colorpicker_rgba_update_cb, hsv_but, nullptr);
|
||||
@ -542,8 +532,6 @@ static void ui_block_colorpicker(uiBlock *block,
|
||||
&colormode,
|
||||
0.0,
|
||||
float(PICKER_TYPE_RGB),
|
||||
0,
|
||||
0,
|
||||
TIP_("Red, Green, Blue"));
|
||||
UI_but_flag_disable(bt, UI_BUT_UNDO);
|
||||
UI_but_drawflag_disable(bt, UI_BUT_TEXT_LEFT);
|
||||
@ -560,8 +548,6 @@ static void ui_block_colorpicker(uiBlock *block,
|
||||
&colormode,
|
||||
0.0,
|
||||
PICKER_TYPE_HSV,
|
||||
0,
|
||||
0,
|
||||
(U.color_picker_type == USER_CP_CIRCLE_HSL) ? TIP_("Hue, Saturation, Lightness") :
|
||||
TIP_("Hue, Saturation, Value"));
|
||||
UI_but_flag_disable(bt, UI_BUT_UNDO);
|
||||
@ -579,8 +565,6 @@ static void ui_block_colorpicker(uiBlock *block,
|
||||
&colormode,
|
||||
0.0,
|
||||
PICKER_TYPE_HEX,
|
||||
0,
|
||||
0,
|
||||
TIP_("Color as hexadecimal values"));
|
||||
UI_but_flag_disable(bt, UI_BUT_UNDO);
|
||||
UI_but_drawflag_disable(bt, UI_BUT_TEXT_LEFT);
|
||||
@ -623,8 +607,6 @@ static void ui_block_colorpicker(uiBlock *block,
|
||||
0,
|
||||
0.0,
|
||||
0.0,
|
||||
0,
|
||||
0,
|
||||
TIP_("Red"));
|
||||
UI_but_number_slider_step_size_set(bt, 10);
|
||||
UI_but_number_slider_precision_set(bt, 3);
|
||||
@ -643,8 +625,6 @@ static void ui_block_colorpicker(uiBlock *block,
|
||||
1,
|
||||
0.0,
|
||||
0.0,
|
||||
0,
|
||||
0,
|
||||
TIP_("Green"));
|
||||
UI_but_number_slider_step_size_set(bt, 10);
|
||||
UI_but_number_slider_precision_set(bt, 3);
|
||||
@ -663,8 +643,6 @@ static void ui_block_colorpicker(uiBlock *block,
|
||||
2,
|
||||
0.0,
|
||||
0.0,
|
||||
0,
|
||||
0,
|
||||
TIP_("Blue"));
|
||||
UI_but_number_slider_step_size_set(bt, 10);
|
||||
UI_but_number_slider_precision_set(bt, 3);
|
||||
@ -766,8 +744,6 @@ static void ui_block_colorpicker(uiBlock *block,
|
||||
3,
|
||||
0.0,
|
||||
0.0,
|
||||
0,
|
||||
0,
|
||||
TIP_("Alpha"));
|
||||
UI_but_number_slider_step_size_set(bt, 10);
|
||||
UI_but_number_slider_precision_set(bt, 3);
|
||||
|
@ -268,8 +268,6 @@ class LayerViewItem : public AbstractTreeViewItem {
|
||||
0,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
nullptr);
|
||||
if (!layer_.parent_group().is_visible()) {
|
||||
UI_but_flag_enable(but, UI_BUT_INACTIVE);
|
||||
@ -288,8 +286,6 @@ class LayerViewItem : public AbstractTreeViewItem {
|
||||
0,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
nullptr);
|
||||
if (layer_.parent_group().is_locked()) {
|
||||
UI_but_flag_enable(but, UI_BUT_INACTIVE);
|
||||
|
@ -306,8 +306,6 @@ class CollectionViewItem : public BasicTreeViewItem {
|
||||
0,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
nullptr);
|
||||
|
||||
UI_but_func_set(button, [&collection_light_linking = collection_light_linking_](bContext &) {
|
||||
|
@ -780,8 +780,6 @@ static void ui_template_list_layout_draw(const bContext *C,
|
||||
0,
|
||||
0,
|
||||
org_i,
|
||||
0,
|
||||
0,
|
||||
editable ? TIP_("Double click to rename") : "");
|
||||
if ((dyntip_data = uilist_item_use_dynamic_tooltip(itemptr,
|
||||
input_data->item_dyntip_propname)))
|
||||
@ -889,8 +887,6 @@ static void ui_template_list_layout_draw(const bContext *C,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
"");
|
||||
if (dyn_data->items_shown == 0) {
|
||||
UI_but_flag_enable(but, UI_BUT_DISABLED);
|
||||
@ -939,8 +935,6 @@ static void ui_template_list_layout_draw(const bContext *C,
|
||||
0,
|
||||
0,
|
||||
org_i,
|
||||
0,
|
||||
0,
|
||||
nullptr);
|
||||
UI_but_drawflag_enable(but, UI_BUT_NO_TOOLTIP);
|
||||
|
||||
@ -1041,8 +1035,6 @@ static void ui_template_list_layout_draw(const bContext *C,
|
||||
0,
|
||||
0,
|
||||
org_i,
|
||||
0,
|
||||
0,
|
||||
nullptr);
|
||||
UI_but_drawflag_enable(but, UI_BUT_NO_TOOLTIP);
|
||||
|
||||
|
@ -1363,8 +1363,6 @@ static void template_ID(const bContext *C,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
-1,
|
||||
RNA_struct_ui_description(type));
|
||||
UI_but_funcN_set(
|
||||
but, template_id_cb, MEM_dupallocN(template_ui), POINTER_FROM_INT(UI_ID_RENAME));
|
||||
@ -1509,8 +1507,6 @@ static void template_ID(const bContext *C,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
-1,
|
||||
nullptr);
|
||||
}
|
||||
}
|
||||
@ -1692,8 +1688,6 @@ static void template_ID_tabs(const bContext *C,
|
||||
0,
|
||||
0.0f,
|
||||
sizeof(id->name) - 2,
|
||||
0.0f,
|
||||
0.0f,
|
||||
"");
|
||||
UI_but_funcN_set(tab, template_ID_set_property_exec_fn, MEM_dupallocN(template_id), id);
|
||||
UI_but_drag_set_id(tab, id);
|
||||
@ -3904,27 +3898,11 @@ static uiBlock *ui_icon_view_menu_cb(bContext *C, ARegion *region, void *arg_lit
|
||||
-1,
|
||||
0,
|
||||
value,
|
||||
-1,
|
||||
-1,
|
||||
nullptr);
|
||||
}
|
||||
else {
|
||||
but = uiDefIconButR_prop(block,
|
||||
UI_BTYPE_ROW,
|
||||
0,
|
||||
icon,
|
||||
x,
|
||||
y,
|
||||
w,
|
||||
h,
|
||||
&args.ptr,
|
||||
args.prop,
|
||||
-1,
|
||||
0,
|
||||
value,
|
||||
-1,
|
||||
-1,
|
||||
nullptr);
|
||||
but = uiDefIconButR_prop(
|
||||
block, UI_BTYPE_ROW, 0, icon, x, y, w, h, &args.ptr, args.prop, -1, 0, value, nullptr);
|
||||
}
|
||||
ui_def_but_icon(but, icon, UI_HAS_ICON | UI_BUT_ICON_PREVIEW);
|
||||
}
|
||||
@ -4299,8 +4277,6 @@ static uiBlock *curvemap_clipping_func(bContext *C, ARegion *region, void *cumap
|
||||
&cumap->flag,
|
||||
0.0,
|
||||
0.0,
|
||||
10,
|
||||
0,
|
||||
"");
|
||||
UI_but_func_set(bt, curvemap_buttons_setclip, cumap, nullptr);
|
||||
|
||||
@ -5664,8 +5640,6 @@ void uiTemplateColorPicker(uiLayout *layout,
|
||||
-1,
|
||||
0.0,
|
||||
0.0,
|
||||
0,
|
||||
0,
|
||||
"");
|
||||
switch (U.color_picker_type) {
|
||||
case USER_CP_SQUARE_SV:
|
||||
@ -5698,8 +5672,6 @@ void uiTemplateColorPicker(uiLayout *layout,
|
||||
-1,
|
||||
0.0,
|
||||
0.0,
|
||||
0,
|
||||
0,
|
||||
"");
|
||||
break;
|
||||
}
|
||||
@ -5734,8 +5706,6 @@ void uiTemplateColorPicker(uiLayout *layout,
|
||||
-1,
|
||||
softmin,
|
||||
softmax,
|
||||
0,
|
||||
0,
|
||||
"");
|
||||
hsv_but->gradient_type = UI_GRAD_L_ALT;
|
||||
break;
|
||||
@ -5754,8 +5724,6 @@ void uiTemplateColorPicker(uiLayout *layout,
|
||||
-1,
|
||||
softmin,
|
||||
softmax,
|
||||
0,
|
||||
0,
|
||||
"");
|
||||
hsv_but->gradient_type = eButGradientType(UI_GRAD_SV + 3);
|
||||
break;
|
||||
@ -5774,8 +5742,6 @@ void uiTemplateColorPicker(uiLayout *layout,
|
||||
-1,
|
||||
softmin,
|
||||
softmax,
|
||||
0,
|
||||
0,
|
||||
"");
|
||||
hsv_but->gradient_type = eButGradientType(UI_GRAD_HS + 3);
|
||||
break;
|
||||
@ -5794,8 +5760,6 @@ void uiTemplateColorPicker(uiLayout *layout,
|
||||
-1,
|
||||
softmin,
|
||||
softmax,
|
||||
0,
|
||||
0,
|
||||
"");
|
||||
hsv_but->gradient_type = eButGradientType(UI_GRAD_HV + 3);
|
||||
break;
|
||||
@ -5817,8 +5781,6 @@ void uiTemplateColorPicker(uiLayout *layout,
|
||||
-1,
|
||||
softmin,
|
||||
softmax,
|
||||
0,
|
||||
0,
|
||||
"");
|
||||
hsv_but->gradient_type = UI_GRAD_V_ALT;
|
||||
break;
|
||||
@ -5942,8 +5904,6 @@ void uiTemplatePalette(uiLayout *layout, PointerRNA *ptr, const char *propname,
|
||||
-1,
|
||||
0.0,
|
||||
1.0,
|
||||
0.0,
|
||||
0.0,
|
||||
"");
|
||||
color_but->is_pallete_color = true;
|
||||
color_but->palette_color_index = col_id;
|
||||
|
@ -79,8 +79,6 @@ uiBut *uiDefAutoButR(uiBlock *block,
|
||||
index,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
-1,
|
||||
nullptr);
|
||||
}
|
||||
else if (icon) {
|
||||
@ -98,8 +96,6 @@ uiBut *uiDefAutoButR(uiBlock *block,
|
||||
index,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
-1,
|
||||
nullptr);
|
||||
}
|
||||
else {
|
||||
@ -116,8 +112,6 @@ uiBut *uiDefAutoButR(uiBlock *block,
|
||||
index,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
-1,
|
||||
nullptr);
|
||||
}
|
||||
break;
|
||||
@ -126,22 +120,8 @@ uiBut *uiDefAutoButR(uiBlock *block,
|
||||
case PROP_FLOAT: {
|
||||
if (RNA_property_array_check(prop) && index == -1) {
|
||||
if (ELEM(RNA_property_subtype(prop), PROP_COLOR, PROP_COLOR_GAMMA)) {
|
||||
but = uiDefButR_prop(block,
|
||||
UI_BTYPE_COLOR,
|
||||
0,
|
||||
name,
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
ptr,
|
||||
prop,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
nullptr);
|
||||
but = uiDefButR_prop(
|
||||
block, UI_BTYPE_COLOR, 0, name, x, y, width, height, ptr, prop, -1, 0, 0, nullptr);
|
||||
}
|
||||
else {
|
||||
return nullptr;
|
||||
@ -163,27 +143,11 @@ uiBut *uiDefAutoButR(uiBlock *block,
|
||||
index,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
nullptr);
|
||||
}
|
||||
else {
|
||||
but = uiDefButR_prop(block,
|
||||
UI_BTYPE_NUM,
|
||||
0,
|
||||
name,
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
ptr,
|
||||
prop,
|
||||
index,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
nullptr);
|
||||
but = uiDefButR_prop(
|
||||
block, UI_BTYPE_NUM, 0, name, x, y, width, height, ptr, prop, index, 0, 0, nullptr);
|
||||
}
|
||||
|
||||
if (RNA_property_flag(prop) & PROP_TEXTEDIT_UPDATE) {
|
||||
@ -193,22 +157,8 @@ uiBut *uiDefAutoButR(uiBlock *block,
|
||||
}
|
||||
case PROP_ENUM:
|
||||
if (icon && name && name[0] == '\0') {
|
||||
but = uiDefIconButR_prop(block,
|
||||
UI_BTYPE_MENU,
|
||||
0,
|
||||
icon,
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
ptr,
|
||||
prop,
|
||||
index,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
-1,
|
||||
nullptr);
|
||||
but = uiDefIconButR_prop(
|
||||
block, UI_BTYPE_MENU, 0, icon, x, y, width, height, ptr, prop, index, 0, 0, nullptr);
|
||||
}
|
||||
else if (icon) {
|
||||
but = uiDefIconTextButR_prop(block,
|
||||
@ -225,47 +175,17 @@ uiBut *uiDefAutoButR(uiBlock *block,
|
||||
index,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
-1,
|
||||
nullptr);
|
||||
}
|
||||
else {
|
||||
but = uiDefButR_prop(block,
|
||||
UI_BTYPE_MENU,
|
||||
0,
|
||||
name,
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
ptr,
|
||||
prop,
|
||||
index,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
-1,
|
||||
nullptr);
|
||||
but = uiDefButR_prop(
|
||||
block, UI_BTYPE_MENU, 0, name, x, y, width, height, ptr, prop, index, 0, 0, nullptr);
|
||||
}
|
||||
break;
|
||||
case PROP_STRING:
|
||||
if (icon && name && name[0] == '\0') {
|
||||
but = uiDefIconButR_prop(block,
|
||||
UI_BTYPE_TEXT,
|
||||
0,
|
||||
icon,
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
ptr,
|
||||
prop,
|
||||
index,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
-1,
|
||||
nullptr);
|
||||
but = uiDefIconButR_prop(
|
||||
block, UI_BTYPE_TEXT, 0, icon, x, y, width, height, ptr, prop, index, 0, 0, nullptr);
|
||||
}
|
||||
else if (icon) {
|
||||
but = uiDefIconTextButR_prop(block,
|
||||
@ -282,27 +202,11 @@ uiBut *uiDefAutoButR(uiBlock *block,
|
||||
index,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
-1,
|
||||
nullptr);
|
||||
}
|
||||
else {
|
||||
but = uiDefButR_prop(block,
|
||||
UI_BTYPE_TEXT,
|
||||
0,
|
||||
name,
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
ptr,
|
||||
prop,
|
||||
index,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
-1,
|
||||
nullptr);
|
||||
but = uiDefButR_prop(
|
||||
block, UI_BTYPE_TEXT, 0, name, x, y, width, height, ptr, prop, index, 0, 0, nullptr);
|
||||
}
|
||||
|
||||
if (RNA_property_flag(prop) & PROP_TEXTEDIT_UPDATE) {
|
||||
@ -334,8 +238,6 @@ uiBut *uiDefAutoButR(uiBlock *block,
|
||||
index,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
-1,
|
||||
nullptr);
|
||||
ui_but_add_search(but, ptr, prop, nullptr, nullptr, false);
|
||||
break;
|
||||
|
@ -2796,8 +2796,6 @@ int ED_area_header_switchbutton(const bContext *C, uiBlock *block, int yco)
|
||||
0,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
"");
|
||||
|
||||
return xco + 1.7 * U.widget_unit;
|
||||
|
@ -491,8 +491,10 @@ static void face_sets_update(Object &object,
|
||||
threading::parallel_for(nodes.index_range(), 1, [&](const IndexRange range) {
|
||||
TLS &tls = all_tls.local();
|
||||
for (PBVHNode *node : nodes.slice(range)) {
|
||||
const Span<int> faces = bke::pbvh::node_face_indices_calc_mesh(
|
||||
pbvh, *node, tls.face_indices);
|
||||
const Span<int> faces =
|
||||
BKE_pbvh_type(&pbvh) == PBVH_FACES ?
|
||||
bke::pbvh::node_face_indices_calc_mesh(pbvh, *node, tls.face_indices) :
|
||||
bke::pbvh::node_face_indices_calc_grids(pbvh, *node, tls.face_indices);
|
||||
|
||||
tls.new_face_sets.reinitialize(faces.size());
|
||||
MutableSpan<int> new_face_sets = tls.new_face_sets;
|
||||
|
@ -520,8 +520,6 @@ void uiTemplateMarker(uiLayout *layout,
|
||||
&cb->marker_flag,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
tip);
|
||||
|
||||
uiLayout *col = uiLayoutColumn(layout, true);
|
||||
|
@ -403,8 +403,6 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *region)
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
nullptr);
|
||||
UI_block_emboss_set(block, UI_EMBOSS);
|
||||
}
|
||||
|
@ -96,8 +96,6 @@ void ED_file_path_button(bScreen *screen,
|
||||
0,
|
||||
0.0f,
|
||||
float(FILE_MAX),
|
||||
0.0f,
|
||||
0.0f,
|
||||
TIP_("File path"));
|
||||
|
||||
BLI_assert(!UI_but_flag_is_set(but, UI_BUT_UNDO));
|
||||
|
@ -163,9 +163,7 @@ static void file_panel_execution_buttons_draw(const bContext *C, Panel *panel)
|
||||
0,
|
||||
0.0f,
|
||||
float(FILE_MAXFILE),
|
||||
0,
|
||||
0,
|
||||
TIP_(overwrite_alert ? N_("File name, overwrite existing") : N_("File name")));
|
||||
overwrite_alert ? TIP_("File name, overwrite existing") : TIP_("File name"));
|
||||
|
||||
BLI_assert(!UI_but_flag_is_set(but, UI_BUT_UNDO));
|
||||
BLI_assert(!UI_but_is_utf8(but));
|
||||
|
@ -431,8 +431,6 @@ static void graph_panel_key_properties(const bContext *C, Panel *panel)
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
nullptr);
|
||||
UI_but_func_set(but, graphedit_activekey_update_cb, fcu, bezt);
|
||||
|
||||
@ -450,8 +448,6 @@ static void graph_panel_key_properties(const bContext *C, Panel *panel)
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
nullptr);
|
||||
UI_but_func_set(but, graphedit_activekey_update_cb, fcu, bezt);
|
||||
UI_but_unit_type_set(but, unit);
|
||||
@ -475,8 +471,6 @@ static void graph_panel_key_properties(const bContext *C, Panel *panel)
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
-1,
|
||||
"Type of left handle");
|
||||
UI_but_func_set(but, graphedit_activekey_handles_cb, fcu, bezt);
|
||||
|
||||
@ -494,8 +488,6 @@ static void graph_panel_key_properties(const bContext *C, Panel *panel)
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
nullptr);
|
||||
UI_but_func_set(but, graphedit_activekey_left_handle_coord_cb, fcu, bezt);
|
||||
|
||||
@ -513,8 +505,6 @@ static void graph_panel_key_properties(const bContext *C, Panel *panel)
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
nullptr);
|
||||
UI_but_func_set(but, graphedit_activekey_left_handle_coord_cb, fcu, bezt);
|
||||
UI_but_unit_type_set(but, unit);
|
||||
@ -539,8 +529,6 @@ static void graph_panel_key_properties(const bContext *C, Panel *panel)
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
-1,
|
||||
"Type of right handle");
|
||||
UI_but_func_set(but, graphedit_activekey_handles_cb, fcu, bezt);
|
||||
|
||||
@ -558,8 +546,6 @@ static void graph_panel_key_properties(const bContext *C, Panel *panel)
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
nullptr);
|
||||
UI_but_func_set(but, graphedit_activekey_right_handle_coord_cb, fcu, bezt);
|
||||
|
||||
@ -577,8 +563,6 @@ static void graph_panel_key_properties(const bContext *C, Panel *panel)
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
nullptr);
|
||||
UI_but_func_set(but, graphedit_activekey_right_handle_coord_cb, fcu, bezt);
|
||||
UI_but_unit_type_set(but, unit);
|
||||
@ -958,8 +942,6 @@ static void graph_draw_driven_property_enabled_btn(uiLayout *layout,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
TIP_("Let the driver determine this property's value"));
|
||||
}
|
||||
|
||||
|
@ -247,8 +247,6 @@ void node_geometry_add_attribute_search_button(const bContext & /*C*/,
|
||||
0,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
0.0f,
|
||||
"");
|
||||
|
||||
const bNodeSocket &socket = *static_cast<const bNodeSocket *>(socket_ptr.data);
|
||||
|
@ -1189,8 +1189,6 @@ static void outliner_draw_restrictbuts(uiBlock *block,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
TIP_("Temporarily hide in viewport\n"
|
||||
"* Shift to set children"));
|
||||
UI_but_func_set(
|
||||
@ -1216,8 +1214,6 @@ static void outliner_draw_restrictbuts(uiBlock *block,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
-1,
|
||||
TIP_("Disable selection in viewport\n"
|
||||
"* Shift to set children"));
|
||||
UI_but_func_set(bt, outliner__object_set_flag_recursive_fn, ob, (char *)"hide_select");
|
||||
@ -1241,8 +1237,6 @@ static void outliner_draw_restrictbuts(uiBlock *block,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
-1,
|
||||
TIP_("Globally disable in viewports\n"
|
||||
"* Shift to set children"));
|
||||
UI_but_func_set(bt, outliner__object_set_flag_recursive_fn, ob, (void *)"hide_viewport");
|
||||
@ -1266,8 +1260,6 @@ static void outliner_draw_restrictbuts(uiBlock *block,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
-1,
|
||||
TIP_("Globally disable in renders\n"
|
||||
"* Shift to set children"));
|
||||
UI_but_func_set(bt, outliner__object_set_flag_recursive_fn, ob, (char *)"hide_render");
|
||||
@ -1296,8 +1288,6 @@ static void outliner_draw_restrictbuts(uiBlock *block,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
-1,
|
||||
nullptr);
|
||||
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
|
||||
if (!props_active.constraint_enable) {
|
||||
@ -1324,8 +1314,6 @@ static void outliner_draw_restrictbuts(uiBlock *block,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
-1,
|
||||
nullptr);
|
||||
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
|
||||
if (!props_active.modifier_show_viewport) {
|
||||
@ -1347,8 +1335,6 @@ static void outliner_draw_restrictbuts(uiBlock *block,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
-1,
|
||||
nullptr);
|
||||
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
|
||||
if (!props_active.modifier_show_render) {
|
||||
@ -1378,8 +1364,6 @@ static void outliner_draw_restrictbuts(uiBlock *block,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
-1,
|
||||
TIP_("Restrict visibility in the 3D View\n"
|
||||
"* Shift to set children"));
|
||||
UI_but_func_set(bt, restrictbutton_bone_visibility_fn, bone, nullptr);
|
||||
@ -1531,8 +1515,6 @@ static void outliner_draw_restrictbuts(uiBlock *block,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
-1,
|
||||
-1,
|
||||
nullptr);
|
||||
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
|
||||
if (node.parent_group() && node.parent_group()->is_visible()) {
|
||||
@ -1569,8 +1551,6 @@ static void outliner_draw_restrictbuts(uiBlock *block,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
nullptr);
|
||||
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
|
||||
}
|
||||
@ -1589,8 +1569,6 @@ static void outliner_draw_restrictbuts(uiBlock *block,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
TIP_("Temporarily hide in viewport\n"
|
||||
"* Ctrl to isolate collection\n"
|
||||
"* Shift to set inside collections and objects"));
|
||||
@ -1618,8 +1596,6 @@ static void outliner_draw_restrictbuts(uiBlock *block,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
TIP_("Mask out objects in collection from view layer\n"
|
||||
"* Ctrl to isolate collection\n"
|
||||
"* Shift to set inside collections"));
|
||||
@ -1648,8 +1624,6 @@ static void outliner_draw_restrictbuts(uiBlock *block,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
TIP_("Objects in collection only contribute indirectly (through shadows and "
|
||||
"reflections) in the view layer\n"
|
||||
"* Ctrl to isolate collection\n"
|
||||
@ -1681,8 +1655,6 @@ static void outliner_draw_restrictbuts(uiBlock *block,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
TIP_("Globally disable in viewports\n"
|
||||
"* Ctrl to isolate collection\n"
|
||||
"* Shift to set inside collections and objects"));
|
||||
@ -1718,8 +1690,6 @@ static void outliner_draw_restrictbuts(uiBlock *block,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
TIP_("Globally disable in renders\n"
|
||||
"* Ctrl to isolate collection\n"
|
||||
"* Shift to set inside collections and objects"));
|
||||
@ -1753,8 +1723,6 @@ static void outliner_draw_restrictbuts(uiBlock *block,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
TIP_("Disable selection in viewport\n"
|
||||
"* Ctrl to isolate collection\n"
|
||||
"* Shift to set inside collections and objects"));
|
||||
@ -3024,8 +2992,8 @@ static bool tselem_draw_icon(uiBlock *block,
|
||||
nullptr,
|
||||
0.0,
|
||||
0.0,
|
||||
1.0,
|
||||
alpha,
|
||||
0.0,
|
||||
0.0f,
|
||||
(data.drag_id && ID_IS_LINKED(data.drag_id)) ? data.drag_id->lib->filepath : "");
|
||||
}
|
||||
|
||||
|
@ -126,8 +126,6 @@ static float draw_channel_widget_mute(const SeqChannelDrawContext *context,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
nullptr);
|
||||
|
||||
char *tooltip = BLI_sprintfN(
|
||||
@ -166,8 +164,6 @@ static float draw_channel_widget_lock(const SeqChannelDrawContext *context,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
"");
|
||||
|
||||
char *tooltip = BLI_sprintfN(
|
||||
@ -244,8 +240,6 @@ static void draw_channel_labels(const SeqChannelDrawContext *context,
|
||||
-1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
nullptr);
|
||||
UI_block_emboss_set(block, UI_EMBOSS_NONE);
|
||||
|
||||
|
@ -640,7 +640,7 @@ static void draw_vectorscope_graticule(ARegion *region, SeqQuadsBatch &quads, co
|
||||
const float w = BLI_rctf_size_x(&area);
|
||||
const float h = BLI_rctf_size_y(&area);
|
||||
const float2 center{BLI_rctf_cent_x(&area), BLI_rctf_cent_y(&area)};
|
||||
/* Vectorscope image is scaled over UV range (+/-0.615). */
|
||||
/* Vector-scope image is scaled over UV range (+/-0.615). */
|
||||
const float radius = ((w < h) ? w : h) * 0.5f * (0.5f / 0.615f);
|
||||
|
||||
/* Precalculate circle points/colors. */
|
||||
|
@ -10,6 +10,8 @@ set(INC
|
||||
../../makesrna
|
||||
../../windowmanager
|
||||
|
||||
# RNA_prototypes.h
|
||||
${CMAKE_BINARY_DIR}/source/blender/makesrna
|
||||
)
|
||||
|
||||
set(INC_SYS
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
#include "RNA_access.hh"
|
||||
#include "RNA_define.hh"
|
||||
#include "RNA_prototypes.h"
|
||||
#include "RNA_types.hh"
|
||||
|
||||
#include "UI_interface.hh"
|
||||
@ -285,6 +286,8 @@ static int preferences_extension_repo_add_exec(bContext *C, wmOperator *op)
|
||||
|
||||
BKE_callback_exec_null(bmain, BKE_CB_EVT_EXTENSION_REPOS_UPDATE_POST);
|
||||
|
||||
BKE_callback_exec_null(bmain, BKE_CB_EVT_EXTENSION_REPOS_SYNC);
|
||||
|
||||
/* There's no dedicated notifier for the Preferences. */
|
||||
WM_event_add_notifier(C, NC_WINDOW, nullptr);
|
||||
|
||||
@ -363,27 +366,65 @@ static void PREFERENCES_OT_extension_repo_add(wmOperatorType *ot)
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
PropertyRNA *prop;
|
||||
/* After creating a new repository some settings can't be easily changed
|
||||
* (especially the custom directory). To avoid showing a partially initialized repository,
|
||||
* set these values upon creation instead of having the user create the repository and change
|
||||
* them afterwards.
|
||||
*
|
||||
* An alternative solution could be implemented by creating an "uninitialized" repository,
|
||||
* setting up all it's properties then running an "initialize" operator however this seems
|
||||
* unnecessarily confusing as in most cases a user can do this in one step by naming and
|
||||
* setting the repositories URL (optionally the custom-directory). */
|
||||
|
||||
prop = RNA_def_string(ot->srna, "name", nullptr, sizeof(bUserExtensionRepo::name), "Name", "");
|
||||
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
|
||||
/* Copy the RNA values are copied into the operator to avoid repetition. */
|
||||
StructRNA *type_ref = &RNA_UserExtensionRepo;
|
||||
|
||||
prop = RNA_def_string(
|
||||
ot->srna, "remote_path", nullptr, sizeof(bUserExtensionRepo::remote_path), "URL", "");
|
||||
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
|
||||
{ /* Name. */
|
||||
const char *prop_id = "name";
|
||||
PropertyRNA *prop_ref = RNA_struct_type_find_property(type_ref, prop_id);
|
||||
PropertyRNA *prop = RNA_def_string(ot->srna,
|
||||
prop_id,
|
||||
nullptr,
|
||||
sizeof(bUserExtensionRepo::name),
|
||||
RNA_property_ui_name_raw(prop_ref),
|
||||
RNA_property_ui_description_raw(prop_ref));
|
||||
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
|
||||
}
|
||||
|
||||
prop = RNA_def_boolean(ot->srna, "use_custom_directory", false, "Custom Directory", "");
|
||||
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
|
||||
{ /* Remote Path. */
|
||||
const char *prop_id = "remote_path";
|
||||
PropertyRNA *prop_ref = RNA_struct_type_find_property(type_ref, prop_id);
|
||||
PropertyRNA *prop = RNA_def_string(ot->srna,
|
||||
prop_id,
|
||||
nullptr,
|
||||
sizeof(bUserExtensionRepo::remote_path),
|
||||
RNA_property_ui_name_raw(prop_ref),
|
||||
RNA_property_ui_description_raw(prop_ref));
|
||||
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
|
||||
}
|
||||
|
||||
/* WARNING: `RNA_def_string_dir_path` should be used but the file selector crashes from
|
||||
* #WM_operator_props_popup_confirm as it closes the popup before showing the file-selector. */
|
||||
prop = RNA_def_string(ot->srna,
|
||||
"custom_directory",
|
||||
nullptr,
|
||||
sizeof(bUserExtensionRepo::remote_path),
|
||||
"Directory",
|
||||
"");
|
||||
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
|
||||
{ /* Use Custom Directory. */
|
||||
const char *prop_id = "use_custom_directory";
|
||||
PropertyRNA *prop_ref = RNA_struct_type_find_property(type_ref, prop_id);
|
||||
PropertyRNA *prop = RNA_def_boolean(ot->srna,
|
||||
prop_id,
|
||||
false,
|
||||
RNA_property_ui_name_raw(prop_ref),
|
||||
RNA_property_ui_description_raw(prop_ref));
|
||||
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
|
||||
}
|
||||
|
||||
{ /* Custom Directory. */
|
||||
const char *prop_id = "custom_directory";
|
||||
PropertyRNA *prop_ref = RNA_struct_type_find_property(type_ref, prop_id);
|
||||
PropertyRNA *prop = RNA_def_string_dir_path(ot->srna,
|
||||
prop_id,
|
||||
nullptr,
|
||||
sizeof(bUserExtensionRepo::remote_path),
|
||||
RNA_property_ui_name_raw(prop_ref),
|
||||
RNA_property_ui_description_raw(prop_ref));
|
||||
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
|
||||
}
|
||||
|
||||
ot->prop = RNA_def_enum(
|
||||
ot->srna, "type", repo_type_items, 0, "Type", "The kind of repository to add");
|
||||
@ -392,6 +433,23 @@ static void PREFERENCES_OT_extension_repo_add(wmOperatorType *ot)
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Generic Extension Repository Utilities
|
||||
* \{ */
|
||||
|
||||
static bool preferences_extension_repo_active_enabled_poll(bContext *C)
|
||||
{
|
||||
const bUserExtensionRepo *repo = BKE_preferences_extension_repo_find_index(
|
||||
&U, U.active_extension_repo);
|
||||
if (repo == nullptr || (repo->flag & USER_EXTENSION_REPO_FLAG_DISABLED)) {
|
||||
CTX_wm_operator_poll_msg_set(C, "An enabled repository must be selected");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Remove Extension Repository Operator
|
||||
* \{ */
|
||||
@ -520,6 +578,58 @@ static void PREFERENCES_OT_extension_repo_remove(wmOperatorType *ot)
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Check for Extension Repository Updates Operator
|
||||
* \{ */
|
||||
|
||||
static int preferences_extension_repo_sync_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
BKE_callback_exec_null(bmain, BKE_CB_EVT_EXTENSION_REPOS_SYNC);
|
||||
WM_event_add_notifier(C, NC_WINDOW, nullptr);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static void PREFERENCES_OT_extension_repo_sync(wmOperatorType *ot)
|
||||
{
|
||||
ot->name = "Check for Updates";
|
||||
ot->idname = "PREFERENCES_OT_extension_repo_sync";
|
||||
ot->description = "Synchronize the active extension repository with its remote URL";
|
||||
|
||||
ot->exec = preferences_extension_repo_sync_exec;
|
||||
ot->poll = preferences_extension_repo_active_enabled_poll;
|
||||
|
||||
ot->flag = OPTYPE_INTERNAL;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Update Extension Repository Operator
|
||||
* \{ */
|
||||
|
||||
static int preferences_extension_repo_upgrade_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
BKE_callback_exec_null(bmain, BKE_CB_EVT_EXTENSION_REPOS_UPGRADE);
|
||||
WM_event_add_notifier(C, NC_WINDOW, nullptr);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static void PREFERENCES_OT_extension_repo_upgrade(wmOperatorType *ot)
|
||||
{
|
||||
ot->name = "Update Repository";
|
||||
ot->idname = "PREFERENCES_OT_extension_repo_upgrade";
|
||||
ot->description = "Update any outdated extensions for the active extension repository";
|
||||
|
||||
ot->exec = preferences_extension_repo_upgrade_exec;
|
||||
ot->poll = preferences_extension_repo_active_enabled_poll;
|
||||
|
||||
ot->flag = OPTYPE_INTERNAL;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Associate File Type Operator (Windows only)
|
||||
* \{ */
|
||||
@ -648,6 +758,8 @@ void ED_operatortypes_userpref()
|
||||
|
||||
WM_operatortype_append(PREFERENCES_OT_extension_repo_add);
|
||||
WM_operatortype_append(PREFERENCES_OT_extension_repo_remove);
|
||||
WM_operatortype_append(PREFERENCES_OT_extension_repo_sync);
|
||||
WM_operatortype_append(PREFERENCES_OT_extension_repo_upgrade);
|
||||
|
||||
WM_operatortype_append(PREFERENCES_OT_associate_blend);
|
||||
WM_operatortype_append(PREFERENCES_OT_unassociate_blend);
|
||||
|
@ -627,8 +627,6 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
|
||||
&v3d->flag,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
TIP_("Displays global values"));
|
||||
uiDefButBitS(block,
|
||||
UI_BTYPE_TOGGLE_N,
|
||||
@ -642,8 +640,6 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
|
||||
&v3d->flag,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
TIP_("Displays local values"));
|
||||
UI_block_align_end(block);
|
||||
|
||||
@ -792,8 +788,6 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
|
||||
0,
|
||||
0.0,
|
||||
1.0,
|
||||
0,
|
||||
0,
|
||||
nullptr);
|
||||
UI_but_number_step_size_set(but, 1);
|
||||
UI_but_number_precision_set(but, 3);
|
||||
@ -810,8 +804,6 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
|
||||
0,
|
||||
0.0,
|
||||
100.0,
|
||||
0,
|
||||
0,
|
||||
nullptr);
|
||||
UI_but_number_step_size_set(but, 1);
|
||||
UI_but_number_precision_set(but, 3);
|
||||
@ -828,8 +820,6 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
|
||||
0,
|
||||
-tilt_limit,
|
||||
tilt_limit,
|
||||
0,
|
||||
0,
|
||||
nullptr);
|
||||
UI_but_number_step_size_set(but, 1);
|
||||
UI_but_number_precision_set(but, 3);
|
||||
@ -897,8 +887,6 @@ static void v3d_editvertex_buts(uiLayout *layout, View3D *v3d, Object *ob, float
|
||||
0,
|
||||
0.0,
|
||||
1.0,
|
||||
0,
|
||||
0,
|
||||
nullptr);
|
||||
UI_but_number_step_size_set(but, 1);
|
||||
UI_but_number_precision_set(but, 3);
|
||||
|
@ -121,42 +121,42 @@ set(SRC
|
||||
usd.h
|
||||
usd.hh
|
||||
|
||||
intern/usd_armature_utils.h
|
||||
intern/usd_asset_utils.h
|
||||
intern/usd_blend_shape_utils.h
|
||||
intern/usd_exporter_context.h
|
||||
intern/usd_hash_types.h
|
||||
intern/usd_hierarchy_iterator.h
|
||||
intern/usd_hook.h
|
||||
intern/usd_writer_abstract.h
|
||||
intern/usd_writer_armature.h
|
||||
intern/usd_writer_camera.h
|
||||
intern/usd_writer_curves.h
|
||||
intern/usd_writer_hair.h
|
||||
intern/usd_writer_light.h
|
||||
intern/usd_writer_material.h
|
||||
intern/usd_writer_mesh.h
|
||||
intern/usd_writer_metaball.h
|
||||
intern/usd_writer_transform.h
|
||||
intern/usd_writer_volume.h
|
||||
intern/usd_armature_utils.hh
|
||||
intern/usd_asset_utils.hh
|
||||
intern/usd_blend_shape_utils.hh
|
||||
intern/usd_exporter_context.hh
|
||||
intern/usd_hash_types.hh
|
||||
intern/usd_hierarchy_iterator.hh
|
||||
intern/usd_hook.hh
|
||||
intern/usd_writer_abstract.hh
|
||||
intern/usd_writer_armature.hh
|
||||
intern/usd_writer_camera.hh
|
||||
intern/usd_writer_curves.hh
|
||||
intern/usd_writer_hair.hh
|
||||
intern/usd_writer_light.hh
|
||||
intern/usd_writer_material.hh
|
||||
intern/usd_writer_mesh.hh
|
||||
intern/usd_writer_metaball.hh
|
||||
intern/usd_writer_transform.hh
|
||||
intern/usd_writer_volume.hh
|
||||
|
||||
intern/usd_reader_camera.h
|
||||
intern/usd_reader_curve.h
|
||||
intern/usd_reader_geom.h
|
||||
intern/usd_reader_instance.h
|
||||
intern/usd_reader_light.h
|
||||
intern/usd_reader_material.h
|
||||
intern/usd_reader_mesh.h
|
||||
intern/usd_reader_nurbs.h
|
||||
intern/usd_reader_prim.h
|
||||
intern/usd_reader_shape.h
|
||||
intern/usd_reader_skeleton.h
|
||||
intern/usd_reader_stage.h
|
||||
intern/usd_reader_volume.h
|
||||
intern/usd_reader_xform.h
|
||||
intern/usd_reader_pointinstancer.h
|
||||
intern/usd_skel_convert.h
|
||||
intern/usd_skel_root_utils.h
|
||||
intern/usd_reader_camera.hh
|
||||
intern/usd_reader_curve.hh
|
||||
intern/usd_reader_geom.hh
|
||||
intern/usd_reader_instance.hh
|
||||
intern/usd_reader_light.hh
|
||||
intern/usd_reader_material.hh
|
||||
intern/usd_reader_mesh.hh
|
||||
intern/usd_reader_nurbs.hh
|
||||
intern/usd_reader_prim.hh
|
||||
intern/usd_reader_shape.hh
|
||||
intern/usd_reader_skeleton.hh
|
||||
intern/usd_reader_stage.hh
|
||||
intern/usd_reader_volume.hh
|
||||
intern/usd_reader_xform.hh
|
||||
intern/usd_reader_pointinstancer.hh
|
||||
intern/usd_skel_convert.hh
|
||||
intern/usd_skel_root_utils.hh
|
||||
)
|
||||
|
||||
if(WITH_HYDRA)
|
||||
@ -175,19 +175,19 @@ if(WITH_HYDRA)
|
||||
hydra/volume_modifier.cc
|
||||
hydra/world.cc
|
||||
|
||||
hydra/curves.h
|
||||
hydra/hydra_scene_delegate.h
|
||||
hydra/id.h
|
||||
hydra/image.h
|
||||
hydra/instancer.h
|
||||
hydra/light.h
|
||||
hydra/material.h
|
||||
hydra/mesh.h
|
||||
hydra/object.h
|
||||
hydra/usd_scene_delegate.h
|
||||
hydra/volume.h
|
||||
hydra/volume_modifier.h
|
||||
hydra/world.h
|
||||
hydra/curves.hh
|
||||
hydra/hydra_scene_delegate.hh
|
||||
hydra/id.hh
|
||||
hydra/image.hh
|
||||
hydra/instancer.hh
|
||||
hydra/light.hh
|
||||
hydra/material.hh
|
||||
hydra/mesh.hh
|
||||
hydra/object.hh
|
||||
hydra/usd_scene_delegate.hh
|
||||
hydra/volume.hh
|
||||
hydra/volume_modifier.hh
|
||||
hydra/world.hh
|
||||
)
|
||||
endif()
|
||||
|
||||
@ -236,7 +236,7 @@ blender_add_lib(bf_io_usd "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
|
||||
add_dependencies(bf_io_usd bf_rna)
|
||||
|
||||
if(COMMAND target_precompile_headers)
|
||||
target_precompile_headers(bf_io_usd PRIVATE intern/usd_precomp.h)
|
||||
target_precompile_headers(bf_io_usd PRIVATE intern/usd_precomp.hh)
|
||||
endif()
|
||||
|
||||
if(WITH_GTESTS)
|
||||
@ -245,7 +245,7 @@ if(WITH_GTESTS)
|
||||
tests/usd_export_test.cc
|
||||
tests/usd_stage_creation_test.cc
|
||||
tests/usd_usdz_export_test.cc
|
||||
intern/usd_writer_material.h
|
||||
intern/usd_writer_material.hh
|
||||
)
|
||||
if(USD_IMAGING_HEADERS)
|
||||
list(APPEND TEST_SRC tests/usd_imaging_test.cc)
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "curves.h"
|
||||
#include "curves.hh"
|
||||
|
||||
#include <pxr/base/gf/vec2f.h>
|
||||
#include <pxr/imaging/hd/tokens.h>
|
||||
@ -19,7 +19,7 @@
|
||||
#include "DNA_meshdata_types.h"
|
||||
#include "DNA_modifier_types.h"
|
||||
|
||||
#include "hydra_scene_delegate.h"
|
||||
#include "hydra_scene_delegate.hh"
|
||||
|
||||
namespace blender::io::hydra {
|
||||
|
||||
|
@ -14,8 +14,8 @@
|
||||
#include "DNA_curves_types.h"
|
||||
#include "DNA_particle_types.h"
|
||||
|
||||
#include "material.h"
|
||||
#include "object.h"
|
||||
#include "material.hh"
|
||||
#include "object.hh"
|
||||
|
||||
namespace blender::io::hydra {
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "hydra_scene_delegate.h"
|
||||
#include "hydra_scene_delegate.hh"
|
||||
|
||||
#include <bitset>
|
||||
|
||||
|
@ -13,14 +13,14 @@
|
||||
|
||||
#include "CLG_log.h"
|
||||
|
||||
#include "curves.h"
|
||||
#include "instancer.h"
|
||||
#include "light.h"
|
||||
#include "mesh.h"
|
||||
#include "object.h"
|
||||
#include "volume.h"
|
||||
#include "volume_modifier.h"
|
||||
#include "world.h"
|
||||
#include "curves.hh"
|
||||
#include "instancer.hh"
|
||||
#include "light.hh"
|
||||
#include "mesh.hh"
|
||||
#include "object.hh"
|
||||
#include "volume.hh"
|
||||
#include "volume_modifier.hh"
|
||||
#include "world.hh"
|
||||
|
||||
struct Depsgraph;
|
||||
struct Main;
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "id.h"
|
||||
#include "id.hh"
|
||||
|
||||
#include "BKE_lib_id.hh"
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "image.h"
|
||||
#include "image.hh"
|
||||
|
||||
#include <pxr/imaging/hio/imageRegistry.h>
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
#include "IMB_imbuf.hh"
|
||||
#include "IMB_imbuf_types.hh"
|
||||
|
||||
#include "hydra_scene_delegate.h"
|
||||
#include "hydra_scene_delegate.hh"
|
||||
|
||||
namespace blender::io::hydra {
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "instancer.h"
|
||||
#include "instancer.hh"
|
||||
|
||||
#include <pxr/base/gf/vec2f.h>
|
||||
#include <pxr/imaging/hd/light.h>
|
||||
@ -16,7 +16,7 @@
|
||||
|
||||
#include "DNA_particle_types.h"
|
||||
|
||||
#include "hydra_scene_delegate.h"
|
||||
#include "hydra_scene_delegate.hh"
|
||||
|
||||
namespace blender::io::hydra {
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "BLI_map.hh"
|
||||
#include "BLI_set.hh"
|
||||
|
||||
#include "mesh.h"
|
||||
#include "mesh.hh"
|
||||
|
||||
struct ParticleSystem;
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "light.h"
|
||||
#include "light.hh"
|
||||
|
||||
#include <pxr/imaging/hd/light.h>
|
||||
#include <pxr/imaging/hd/tokens.h>
|
||||
@ -12,7 +12,7 @@
|
||||
|
||||
#include "BLI_math_rotation.h"
|
||||
|
||||
#include "hydra_scene_delegate.h"
|
||||
#include "hydra_scene_delegate.hh"
|
||||
|
||||
namespace blender::io::hydra {
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
#include "BKE_light.h"
|
||||
|
||||
#include "object.h"
|
||||
#include "object.hh"
|
||||
|
||||
namespace blender::io::hydra {
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "material.h"
|
||||
#include "material.hh"
|
||||
|
||||
#include <Python.h>
|
||||
#include <unicodeobject.h>
|
||||
@ -30,11 +30,11 @@
|
||||
|
||||
#include "bpy_rna.h"
|
||||
|
||||
#include "hydra_scene_delegate.h"
|
||||
#include "image.h"
|
||||
#include "hydra_scene_delegate.hh"
|
||||
#include "image.hh"
|
||||
|
||||
#include "intern/usd_exporter_context.h"
|
||||
#include "intern/usd_writer_material.h"
|
||||
#include "intern/usd_exporter_context.hh"
|
||||
#include "intern/usd_writer_material.hh"
|
||||
|
||||
#ifdef WITH_MATERIALX
|
||||
# include "shader/materialx/node_parser.h"
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#include "BLI_map.hh"
|
||||
|
||||
#include "id.h"
|
||||
#include "id.hh"
|
||||
|
||||
namespace blender::io::hydra {
|
||||
|
@ -16,8 +16,8 @@
|
||||
#include "BKE_mesh.hh"
|
||||
#include "BKE_mesh_runtime.hh"
|
||||
|
||||
#include "hydra_scene_delegate.h"
|
||||
#include "mesh.h"
|
||||
#include "hydra_scene_delegate.hh"
|
||||
#include "mesh.hh"
|
||||
|
||||
namespace blender::io::hydra {
|
||||
|
||||
|
@ -11,8 +11,8 @@
|
||||
|
||||
#include "BKE_duplilist.h"
|
||||
|
||||
#include "material.h"
|
||||
#include "object.h"
|
||||
#include "material.hh"
|
||||
#include "object.hh"
|
||||
|
||||
namespace blender::io::hydra {
|
||||
|
@ -4,12 +4,12 @@
|
||||
|
||||
#include "DEG_depsgraph_query.hh"
|
||||
|
||||
#include "curves.h"
|
||||
#include "hydra_scene_delegate.h"
|
||||
#include "light.h"
|
||||
#include "mesh.h"
|
||||
#include "object.h"
|
||||
#include "volume.h"
|
||||
#include "curves.hh"
|
||||
#include "hydra_scene_delegate.hh"
|
||||
#include "light.hh"
|
||||
#include "mesh.hh"
|
||||
#include "object.hh"
|
||||
#include "volume.hh"
|
||||
|
||||
namespace blender::io::hydra {
|
||||
|
||||
|
@ -15,8 +15,8 @@
|
||||
#include "BKE_layer.hh"
|
||||
#include "BKE_object.hh"
|
||||
|
||||
#include "id.h"
|
||||
#include "material.h"
|
||||
#include "id.hh"
|
||||
#include "material.hh"
|
||||
|
||||
namespace blender::io::hydra {
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "usd_scene_delegate.h"
|
||||
#include "usd_scene_delegate.hh"
|
||||
|
||||
#include "BLI_fileops.h"
|
||||
#include "BLI_path_util.h"
|
||||
|
@ -14,8 +14,8 @@
|
||||
#include "BLI_index_range.hh"
|
||||
#include "DNA_volume_types.h"
|
||||
|
||||
#include "hydra_scene_delegate.h"
|
||||
#include "volume.h"
|
||||
#include "hydra_scene_delegate.hh"
|
||||
#include "volume.hh"
|
||||
|
||||
namespace blender::io::hydra {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include <pxr/imaging/hd/sceneDelegate.h>
|
||||
|
||||
#include "object.h"
|
||||
#include "object.hh"
|
||||
|
||||
namespace blender::io::hydra {
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "volume_modifier.h"
|
||||
#include "volume_modifier.hh"
|
||||
|
||||
#include <pxr/usdImaging/usdVolImaging/tokens.h>
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
#include "BKE_mesh.h"
|
||||
#include "BKE_modifier.hh"
|
||||
|
||||
#include "hydra_scene_delegate.h"
|
||||
#include "hydra_scene_delegate.hh"
|
||||
|
||||
namespace blender::io::hydra {
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#include "DNA_fluid_types.h"
|
||||
|
||||
#include "volume.h"
|
||||
#include "volume.hh"
|
||||
|
||||
namespace blender::io::hydra {
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "world.h"
|
||||
#include "world.hh"
|
||||
|
||||
#include <pxr/base/gf/rotation.h>
|
||||
#include <pxr/base/gf/vec2f.h>
|
||||
@ -24,8 +24,8 @@
|
||||
|
||||
#include "NOD_shader.h"
|
||||
|
||||
#include "hydra_scene_delegate.h"
|
||||
#include "image.h"
|
||||
#include "hydra_scene_delegate.hh"
|
||||
#include "image.hh"
|
||||
|
||||
/* TODO: add custom `tftoken` "transparency"? */
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "DNA_view3d_types.h"
|
||||
#include "DNA_world_types.h"
|
||||
|
||||
#include "light.h"
|
||||
#include "light.hh"
|
||||
|
||||
namespace blender::io::hydra {
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "usd_armature_utils.h"
|
||||
#include "usd_armature_utils.hh"
|
||||
|
||||
#include "BKE_armature.hh"
|
||||
#include "BKE_modifier.hh"
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "usd_asset_utils.h"
|
||||
#include "usd_asset_utils.hh"
|
||||
|
||||
#include <pxr/usd/ar/asset.h>
|
||||
#include <pxr/usd/ar/packageUtils.h>
|
||||
|
@ -2,8 +2,8 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
#include "usd_blend_shape_utils.h"
|
||||
#include "usd_skel_convert.h"
|
||||
#include "usd_blend_shape_utils.hh"
|
||||
#include "usd_skel_convert.hh"
|
||||
|
||||
#include "usd.h"
|
||||
|
||||
|
@ -7,8 +7,8 @@
|
||||
#include "IO_subdiv_disabler.hh"
|
||||
#include "usd.h"
|
||||
#include "usd.hh"
|
||||
#include "usd_hierarchy_iterator.h"
|
||||
#include "usd_hook.h"
|
||||
#include "usd_hierarchy_iterator.hh"
|
||||
#include "usd_hook.hh"
|
||||
|
||||
#include <pxr/base/plug/registry.h>
|
||||
#include <pxr/base/tf/token.h>
|
||||
|
@ -4,11 +4,11 @@
|
||||
|
||||
#include "IO_types.hh"
|
||||
#include "usd.h"
|
||||
#include "usd_hierarchy_iterator.h"
|
||||
#include "usd_hook.h"
|
||||
#include "usd_reader_geom.h"
|
||||
#include "usd_reader_prim.h"
|
||||
#include "usd_reader_stage.h"
|
||||
#include "usd_hierarchy_iterator.hh"
|
||||
#include "usd_hook.hh"
|
||||
#include "usd_reader_geom.hh"
|
||||
#include "usd_reader_prim.hh"
|
||||
#include "usd_reader_stage.hh"
|
||||
|
||||
#include "BKE_appdir.hh"
|
||||
#include "BKE_blender_version.h"
|
||||
|
@ -3,21 +3,21 @@
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
#include "usd.h"
|
||||
|
||||
#include "usd_armature_utils.h"
|
||||
#include "usd_blend_shape_utils.h"
|
||||
#include "usd_hierarchy_iterator.h"
|
||||
#include "usd_skel_convert.h"
|
||||
#include "usd_skel_root_utils.h"
|
||||
#include "usd_writer_abstract.h"
|
||||
#include "usd_writer_armature.h"
|
||||
#include "usd_writer_camera.h"
|
||||
#include "usd_writer_curves.h"
|
||||
#include "usd_writer_hair.h"
|
||||
#include "usd_writer_light.h"
|
||||
#include "usd_writer_mesh.h"
|
||||
#include "usd_writer_metaball.h"
|
||||
#include "usd_writer_transform.h"
|
||||
#include "usd_writer_volume.h"
|
||||
#include "usd_armature_utils.hh"
|
||||
#include "usd_blend_shape_utils.hh"
|
||||
#include "usd_hierarchy_iterator.hh"
|
||||
#include "usd_skel_convert.hh"
|
||||
#include "usd_skel_root_utils.hh"
|
||||
#include "usd_writer_abstract.hh"
|
||||
#include "usd_writer_armature.hh"
|
||||
#include "usd_writer_camera.hh"
|
||||
#include "usd_writer_curves.hh"
|
||||
#include "usd_writer_hair.hh"
|
||||
#include "usd_writer_light.hh"
|
||||
#include "usd_writer_mesh.hh"
|
||||
#include "usd_writer_metaball.hh"
|
||||
#include "usd_writer_transform.hh"
|
||||
#include "usd_writer_volume.hh"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
@ -5,8 +5,8 @@
|
||||
|
||||
#include "IO_abstract_hierarchy_iterator.h"
|
||||
#include "usd.h"
|
||||
#include "usd_exporter_context.h"
|
||||
#include "usd_skel_convert.h"
|
||||
#include "usd_exporter_context.hh"
|
||||
#include "usd_skel_convert.hh"
|
||||
|
||||
#include <string>
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include "usd.h"
|
||||
|
||||
#include "usd_hook.h"
|
||||
#include "usd_hook.hh"
|
||||
|
||||
#include <boost/python/call_method.hpp>
|
||||
#include <boost/python/class.hpp>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user