Cleanup: pep8 (indentation, spacing, long lines)
This commit is contained in:
@@ -66,6 +66,7 @@ class Builder:
|
|||||||
# Always 64 bit now
|
# Always 64 bit now
|
||||||
self.bits = 64
|
self.bits = 64
|
||||||
|
|
||||||
|
|
||||||
def create_builder_from_arguments():
|
def create_builder_from_arguments():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('builder_name')
|
parser.add_argument('builder_name')
|
||||||
@@ -106,7 +107,7 @@ class VersionInfo:
|
|||||||
|
|
||||||
def _parse_header_file(self, filename, define):
|
def _parse_header_file(self, filename, define):
|
||||||
import re
|
import re
|
||||||
regex = re.compile("^#\s*define\s+%s\s+(.*)" % define)
|
regex = re.compile(r"^#\s*define\s+%s\s+(.*)" % define)
|
||||||
with open(filename, "r") as file:
|
with open(filename, "r") as file:
|
||||||
for l in file:
|
for l in file:
|
||||||
match = regex.match(l)
|
match = regex.match(l)
|
||||||
|
|||||||
@@ -175,7 +175,11 @@ def pack_linux(builder):
|
|||||||
|
|
||||||
print("Stripping python...")
|
print("Stripping python...")
|
||||||
py_target = os.path.join(builder.install_dir, info.short_version)
|
py_target = os.path.join(builder.install_dir, info.short_version)
|
||||||
buildbot_utils.call(builder.command_prefix + ['find', py_target, '-iname', '*.so', '-exec', 'strip', '-s', '{}', ';'])
|
buildbot_utils.call(
|
||||||
|
builder.command_prefix + [
|
||||||
|
'find', py_target, '-iname', '*.so', '-exec', 'strip', '-s', '{}', ';',
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
# Construct package name
|
# Construct package name
|
||||||
platform_name = 'linux64'
|
platform_name = 'linux64'
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ def create_nb_project_main():
|
|||||||
f.write(' </logicalFolder>\n')
|
f.write(' </logicalFolder>\n')
|
||||||
# default, but this dir is infact not in blender dir so we can ignore it
|
# default, but this dir is infact not in blender dir so we can ignore it
|
||||||
# f.write(' <sourceFolderFilter>^(nbproject)$</sourceFolderFilter>\n')
|
# f.write(' <sourceFolderFilter>^(nbproject)$</sourceFolderFilter>\n')
|
||||||
f.write(' <sourceFolderFilter>^(nbproject|__pycache__|.*\.py|.*\.html|.*\.blend)$</sourceFolderFilter>\n')
|
f.write(r' <sourceFolderFilter>^(nbproject|__pycache__|.*\.py|.*\.html|.*\.blend)$</sourceFolderFilter>\n')
|
||||||
|
|
||||||
f.write(' <sourceRootList>\n')
|
f.write(' <sourceRootList>\n')
|
||||||
f.write(' <Elem>%s</Elem>\n' % SOURCE_DIR) # base_root_rel
|
f.write(' <Elem>%s</Elem>\n' % SOURCE_DIR) # base_root_rel
|
||||||
|
|||||||
@@ -49,8 +49,8 @@ def main():
|
|||||||
check_commands = []
|
check_commands = []
|
||||||
for c, inc_dirs, defs in source_info:
|
for c, inc_dirs, defs in source_info:
|
||||||
|
|
||||||
#~if "source/blender" not in c:
|
# ~if "source/blender" not in c:
|
||||||
#~ continue
|
# ~ continue
|
||||||
|
|
||||||
cmd = ([CHECKER_BIN] +
|
cmd = ([CHECKER_BIN] +
|
||||||
CHECKER_ARGS +
|
CHECKER_ARGS +
|
||||||
|
|||||||
@@ -104,8 +104,10 @@ def svn_update(args, release_version):
|
|||||||
svn_dirpath = os.path.join(dirpath, ".svn")
|
svn_dirpath = os.path.join(dirpath, ".svn")
|
||||||
svn_root_dirpath = os.path.join(lib_dirpath, ".svn")
|
svn_root_dirpath = os.path.join(lib_dirpath, ".svn")
|
||||||
|
|
||||||
if os.path.isdir(dirpath) and \
|
if (
|
||||||
(os.path.exists(svn_dirpath) or os.path.exists(svn_root_dirpath)):
|
os.path.isdir(dirpath) and
|
||||||
|
(os.path.exists(svn_dirpath) or os.path.exists(svn_root_dirpath))
|
||||||
|
):
|
||||||
if make_utils.command_missing(args.svn_command):
|
if make_utils.command_missing(args.svn_command):
|
||||||
sys.stderr.write("svn not found, can't update libraries\n")
|
sys.stderr.write("svn not found, can't update libraries\n")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@@ -127,9 +129,11 @@ def git_update_skip(args, check_remote_exists=True):
|
|||||||
rebase_merge = check_output([args.git_command, 'rev-parse', '--git-path', 'rebase-merge'], exit_on_error=False)
|
rebase_merge = check_output([args.git_command, 'rev-parse', '--git-path', 'rebase-merge'], exit_on_error=False)
|
||||||
rebase_apply = check_output([args.git_command, 'rev-parse', '--git-path', 'rebase-apply'], exit_on_error=False)
|
rebase_apply = check_output([args.git_command, 'rev-parse', '--git-path', 'rebase-apply'], exit_on_error=False)
|
||||||
merge_head = check_output([args.git_command, 'rev-parse', '--git-path', 'MERGE_HEAD'], exit_on_error=False)
|
merge_head = check_output([args.git_command, 'rev-parse', '--git-path', 'MERGE_HEAD'], exit_on_error=False)
|
||||||
if os.path.exists(rebase_merge) or \
|
if (
|
||||||
os.path.exists(rebase_apply) or \
|
os.path.exists(rebase_merge) or
|
||||||
os.path.exists(merge_head):
|
os.path.exists(rebase_apply) or
|
||||||
|
os.path.exists(merge_head)
|
||||||
|
):
|
||||||
return "rebase or merge in progress, complete it first"
|
return "rebase or merge in progress, complete it first"
|
||||||
|
|
||||||
# Abort if uncommitted changes.
|
# Abort if uncommitted changes.
|
||||||
@@ -146,6 +150,7 @@ def git_update_skip(args, check_remote_exists=True):
|
|||||||
|
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
# Update blender repository.
|
# Update blender repository.
|
||||||
def blender_update(args):
|
def blender_update(args):
|
||||||
print_stage("Updating Blender Git Repository")
|
print_stage("Updating Blender Git Repository")
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ def git_branch_release_version(branch, tag):
|
|||||||
if release_version:
|
if release_version:
|
||||||
release_version = release_version.group(1)
|
release_version = release_version.group(1)
|
||||||
elif tag:
|
elif tag:
|
||||||
release_version = re.search("^v([0-9]*\.[0-9]*).*", tag)
|
release_version = re.search(r"^v([0-9]*\.[0-9]*).*", tag)
|
||||||
if release_version:
|
if release_version:
|
||||||
release_version = release_version.group(1)
|
release_version = release_version.group(1)
|
||||||
return release_version
|
return release_version
|
||||||
|
|||||||
@@ -150,8 +150,7 @@ def create(engine, data, region=None, v3d=None, rv3d=None, preview_osl=False):
|
|||||||
screen = screen or rv3d.id_data.as_pointer()
|
screen = screen or rv3d.id_data.as_pointer()
|
||||||
rv3d = rv3d.as_pointer()
|
rv3d = rv3d.as_pointer()
|
||||||
|
|
||||||
engine.session = _cycles.create(
|
engine.session = _cycles.create(engine.as_pointer(), prefs, data, screen, region, v3d, rv3d, preview_osl)
|
||||||
engine.as_pointer(), prefs, data, screen, region, v3d, rv3d, preview_osl)
|
|
||||||
|
|
||||||
|
|
||||||
def free(engine):
|
def free(engine):
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ class CYCLES_OT_use_shading_nodes(Operator):
|
|||||||
|
|
||||||
class CYCLES_OT_add_aov(bpy.types.Operator):
|
class CYCLES_OT_add_aov(bpy.types.Operator):
|
||||||
"""Add an AOV pass"""
|
"""Add an AOV pass"""
|
||||||
bl_idname="cycles.add_aov"
|
bl_idname = "cycles.add_aov"
|
||||||
bl_label="Add AOV"
|
bl_label = "Add AOV"
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
view_layer = context.view_layer
|
view_layer = context.view_layer
|
||||||
@@ -61,8 +61,8 @@ class CYCLES_OT_add_aov(bpy.types.Operator):
|
|||||||
|
|
||||||
class CYCLES_OT_remove_aov(bpy.types.Operator):
|
class CYCLES_OT_remove_aov(bpy.types.Operator):
|
||||||
"""Remove an AOV pass"""
|
"""Remove an AOV pass"""
|
||||||
bl_idname="cycles.remove_aov"
|
bl_idname = "cycles.remove_aov"
|
||||||
bl_label="Remove AOV"
|
bl_label = "Remove AOV"
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
view_layer = context.view_layer
|
view_layer = context.view_layer
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ enum_texture_limit = (
|
|||||||
('8192', "8192", "Limit texture size to 8192 pixels", 7),
|
('8192', "8192", "Limit texture size to 8192 pixels", 7),
|
||||||
)
|
)
|
||||||
|
|
||||||
enum_view3d_shading_render_pass= (
|
enum_view3d_shading_render_pass = (
|
||||||
('', "General", ""),
|
('', "General", ""),
|
||||||
|
|
||||||
('COMBINED', "Combined", "Show the Combined Render pass", 1),
|
('COMBINED', "Combined", "Show the Combined Render pass", 1),
|
||||||
|
|||||||
@@ -843,8 +843,6 @@ class CYCLES_RENDER_PT_passes_data(CyclesButtonsPanel, Panel):
|
|||||||
col.prop(cycles_view_layer, "pass_debug_render_time", text="Render Time")
|
col.prop(cycles_view_layer, "pass_debug_render_time", text="Render Time")
|
||||||
col.prop(cycles_view_layer, "pass_debug_sample_count", text="Sample Count")
|
col.prop(cycles_view_layer, "pass_debug_sample_count", text="Sample Count")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
layout.prop(view_layer, "pass_alpha_threshold")
|
layout.prop(view_layer, "pass_alpha_threshold")
|
||||||
|
|
||||||
|
|
||||||
@@ -959,7 +957,15 @@ class CYCLES_RENDER_PT_passes_aov(CyclesButtonsPanel, Panel):
|
|||||||
|
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
col = row.column()
|
col = row.column()
|
||||||
col.template_list("CYCLES_RENDER_UL_aov", "aovs", cycles_view_layer, "aovs", cycles_view_layer, "active_aov", rows=2)
|
col.template_list(
|
||||||
|
"CYCLES_RENDER_UL_aov",
|
||||||
|
"aovs",
|
||||||
|
cycles_view_layer,
|
||||||
|
"aovs",
|
||||||
|
cycles_view_layer,
|
||||||
|
"active_aov",
|
||||||
|
rows=2,
|
||||||
|
)
|
||||||
|
|
||||||
col = row.column()
|
col = row.column()
|
||||||
sub = col.column(align=True)
|
sub = col.column(align=True)
|
||||||
@@ -1865,6 +1871,7 @@ class CYCLES_RENDER_PT_bake_influence(CyclesButtonsPanel, Panel):
|
|||||||
bl_context = "render"
|
bl_context = "render"
|
||||||
bl_parent_id = "CYCLES_RENDER_PT_bake"
|
bl_parent_id = "CYCLES_RENDER_PT_bake"
|
||||||
COMPAT_ENGINES = {'CYCLES'}
|
COMPAT_ENGINES = {'CYCLES'}
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
scene = context.scene
|
scene = context.scene
|
||||||
@@ -2150,8 +2157,10 @@ class CYCLES_VIEW3D_PT_shading_render_pass(Panel):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
return (context.engine in cls.COMPAT_ENGINES
|
return (
|
||||||
and context.space_data.shading.type == 'RENDERED')
|
context.engine in cls.COMPAT_ENGINES and
|
||||||
|
context.space_data.shading.type == 'RENDERED'
|
||||||
|
)
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
shading = context.space_data.shading
|
shading = context.space_data.shading
|
||||||
@@ -2169,8 +2178,10 @@ class CYCLES_VIEW3D_PT_shading_lighting(Panel):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
return (context.engine in cls.COMPAT_ENGINES
|
return (
|
||||||
and context.space_data.shading.type == 'RENDERED')
|
context.engine in cls.COMPAT_ENGINES and
|
||||||
|
context.space_data.shading.type == 'RENDERED'
|
||||||
|
)
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
@@ -2199,12 +2210,14 @@ class CYCLES_VIEW3D_PT_shading_lighting(Panel):
|
|||||||
col.prop(shading, "studiolight_intensity")
|
col.prop(shading, "studiolight_intensity")
|
||||||
col.prop(shading, "studiolight_background_alpha")
|
col.prop(shading, "studiolight_background_alpha")
|
||||||
|
|
||||||
|
|
||||||
class CYCLES_VIEW3D_PT_simplify_greasepencil(CyclesButtonsPanel, Panel, GreasePencilSimplifyPanel):
|
class CYCLES_VIEW3D_PT_simplify_greasepencil(CyclesButtonsPanel, Panel, GreasePencilSimplifyPanel):
|
||||||
bl_label = "Grease Pencil"
|
bl_label = "Grease Pencil"
|
||||||
bl_parent_id = "CYCLES_RENDER_PT_simplify"
|
bl_parent_id = "CYCLES_RENDER_PT_simplify"
|
||||||
COMPAT_ENGINES = {'CYCLES'}
|
COMPAT_ENGINES = {'CYCLES'}
|
||||||
bl_options = {'DEFAULT_CLOSED'}
|
bl_options = {'DEFAULT_CLOSED'}
|
||||||
|
|
||||||
|
|
||||||
def draw_device(self, context):
|
def draw_device(self, context):
|
||||||
scene = context.scene
|
scene = context.scene
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
|
|||||||
@@ -137,9 +137,11 @@ def do_versions(self):
|
|||||||
# Caustics Reflective/Refractive separation in 272
|
# Caustics Reflective/Refractive separation in 272
|
||||||
if version <= (2, 72, 0):
|
if version <= (2, 72, 0):
|
||||||
cscene = scene.cycles
|
cscene = scene.cycles
|
||||||
if (cscene.get("no_caustics", False) and
|
if (
|
||||||
|
cscene.get("no_caustics", False) and
|
||||||
not cscene.is_property_set("caustics_reflective") and
|
not cscene.is_property_set("caustics_reflective") and
|
||||||
not cscene.is_property_set("caustics_refractive")):
|
not cscene.is_property_set("caustics_refractive")
|
||||||
|
):
|
||||||
cscene.caustics_reflective = False
|
cscene.caustics_reflective = False
|
||||||
cscene.caustics_refractive = False
|
cscene.caustics_refractive = False
|
||||||
|
|
||||||
|
|||||||
@@ -36,14 +36,14 @@ __all__ = (
|
|||||||
"pyFillOcclusionsAbsoluteAndRelativeChainingIterator",
|
"pyFillOcclusionsAbsoluteAndRelativeChainingIterator",
|
||||||
"pyFillQi0AbsoluteAndRelativeChainingIterator",
|
"pyFillQi0AbsoluteAndRelativeChainingIterator",
|
||||||
"pyNoIdChainSilhouetteIterator",
|
"pyNoIdChainSilhouetteIterator",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# module members
|
# module members
|
||||||
from _freestyle import (
|
from _freestyle import (
|
||||||
ChainPredicateIterator,
|
ChainPredicateIterator,
|
||||||
ChainSilhouetteIterator,
|
ChainSilhouetteIterator,
|
||||||
)
|
)
|
||||||
|
|
||||||
# constructs for predicate definition in Python
|
# constructs for predicate definition in Python
|
||||||
from freestyle.types import (
|
from freestyle.types import (
|
||||||
@@ -51,15 +51,15 @@ from freestyle.types import (
|
|||||||
ChainingIterator,
|
ChainingIterator,
|
||||||
Nature,
|
Nature,
|
||||||
TVertex,
|
TVertex,
|
||||||
)
|
)
|
||||||
from freestyle.predicates import (
|
from freestyle.predicates import (
|
||||||
ExternalContourUP1D,
|
ExternalContourUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.utils import (
|
from freestyle.utils import (
|
||||||
ContextFunctions as CF,
|
ContextFunctions as CF,
|
||||||
get_chain_length,
|
get_chain_length,
|
||||||
find_matching_vertex,
|
find_matching_vertex,
|
||||||
)
|
)
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ NATURES = (
|
|||||||
Nature.SUGGESTIVE_CONTOUR,
|
Nature.SUGGESTIVE_CONTOUR,
|
||||||
Nature.VALLEY,
|
Nature.VALLEY,
|
||||||
Nature.RIDGE
|
Nature.RIDGE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def nature_in_preceding(nature, index):
|
def nature_in_preceding(nature, index):
|
||||||
@@ -97,12 +97,12 @@ class pyChainSilhouetteIterator(ChainingIterator):
|
|||||||
|
|
||||||
def traverse(self, iter):
|
def traverse(self, iter):
|
||||||
it = AdjacencyIterator(iter)
|
it = AdjacencyIterator(iter)
|
||||||
## case of TVertex
|
# case of TVertex
|
||||||
vertex = self.next_vertex
|
vertex = self.next_vertex
|
||||||
if type(vertex) is TVertex:
|
if type(vertex) is TVertex:
|
||||||
mate = vertex.get_mate(self.current_edge)
|
mate = vertex.get_mate(self.current_edge)
|
||||||
return find_matching_vertex(mate.id, it)
|
return find_matching_vertex(mate.id, it)
|
||||||
## case of NonTVertex
|
# case of NonTVertex
|
||||||
winner = None
|
winner = None
|
||||||
for i, nat in enumerate(NATURES):
|
for i, nat in enumerate(NATURES):
|
||||||
if (nat & self.current_edge.nature):
|
if (nat & self.current_edge.nature):
|
||||||
@@ -145,12 +145,12 @@ class pyChainSilhouetteGenericIterator(ChainingIterator):
|
|||||||
|
|
||||||
def traverse(self, iter):
|
def traverse(self, iter):
|
||||||
it = AdjacencyIterator(iter)
|
it = AdjacencyIterator(iter)
|
||||||
## case of TVertex
|
# case of TVertex
|
||||||
vertex = self.next_vertex
|
vertex = self.next_vertex
|
||||||
if type(vertex) is TVertex:
|
if type(vertex) is TVertex:
|
||||||
mate = vertex.get_mate(self.current_edge)
|
mate = vertex.get_mate(self.current_edge)
|
||||||
return find_matching_vertex(mate.id, it)
|
return find_matching_vertex(mate.id, it)
|
||||||
## case of NonTVertex
|
# case of NonTVertex
|
||||||
winner = None
|
winner = None
|
||||||
for i, nat in enumerate(NATURES):
|
for i, nat in enumerate(NATURES):
|
||||||
if (nat & self.current_edge.nature):
|
if (nat & self.current_edge.nature):
|
||||||
@@ -227,7 +227,7 @@ class pySketchyChainSilhouetteIterator(ChainingIterator):
|
|||||||
:type stayInSelection: bool
|
:type stayInSelection: bool
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, nRounds=3,stayInSelection=True):
|
def __init__(self, nRounds=3, stayInSelection=True):
|
||||||
ChainingIterator.__init__(self, stayInSelection, False, None, True)
|
ChainingIterator.__init__(self, stayInSelection, False, None, True)
|
||||||
self._timeStamp = CF.get_time_stamp() + nRounds
|
self._timeStamp = CF.get_time_stamp() + nRounds
|
||||||
self._nRounds = nRounds
|
self._nRounds = nRounds
|
||||||
@@ -249,12 +249,12 @@ class pySketchyChainSilhouetteIterator(ChainingIterator):
|
|||||||
|
|
||||||
def traverse(self, iter):
|
def traverse(self, iter):
|
||||||
it = AdjacencyIterator(iter)
|
it = AdjacencyIterator(iter)
|
||||||
## case of TVertex
|
# case of TVertex
|
||||||
vertex = self.next_vertex
|
vertex = self.next_vertex
|
||||||
if type(vertex) is TVertex:
|
if type(vertex) is TVertex:
|
||||||
mate = vertex.get_mate(self.current_edge)
|
mate = vertex.get_mate(self.current_edge)
|
||||||
return self.make_sketchy(find_matching_vertex(mate.id, it))
|
return self.make_sketchy(find_matching_vertex(mate.id, it))
|
||||||
## case of NonTVertex
|
# case of NonTVertex
|
||||||
winner = None
|
winner = None
|
||||||
for i, nat in enumerate(NATURES):
|
for i, nat in enumerate(NATURES):
|
||||||
if (nat & self.current_edge.nature):
|
if (nat & self.current_edge.nature):
|
||||||
@@ -342,13 +342,13 @@ class pyFillOcclusionsRelativeChainingIterator(ChainingIterator):
|
|||||||
winner = None
|
winner = None
|
||||||
winnerOrientation = False
|
winnerOrientation = False
|
||||||
it = AdjacencyIterator(iter)
|
it = AdjacencyIterator(iter)
|
||||||
## case of TVertex
|
# case of TVertex
|
||||||
vertex = self.next_vertex
|
vertex = self.next_vertex
|
||||||
if type(vertex) is TVertex:
|
if type(vertex) is TVertex:
|
||||||
mate = vertex.get_mate(self.current_edge)
|
mate = vertex.get_mate(self.current_edge)
|
||||||
winner = find_matching_vertex(mate.id, it)
|
winner = find_matching_vertex(mate.id, it)
|
||||||
winnerOrientation = not it.is_incoming if not it.is_end else False
|
winnerOrientation = not it.is_incoming if not it.is_end else False
|
||||||
## case of NonTVertex
|
# case of NonTVertex
|
||||||
else:
|
else:
|
||||||
for nat in NATURES:
|
for nat in NATURES:
|
||||||
if (self.current_edge.nature & nat):
|
if (self.current_edge.nature & nat):
|
||||||
@@ -379,7 +379,8 @@ class pyFillOcclusionsRelativeChainingIterator(ChainingIterator):
|
|||||||
while (not _cit.is_end) and _cit.object.time_stamp != self.timestamp:
|
while (not _cit.is_end) and _cit.object.time_stamp != self.timestamp:
|
||||||
connexl += _cit.object.length_2d
|
connexl += _cit.object.length_2d
|
||||||
_cit.increment()
|
_cit.increment()
|
||||||
if _cit.is_begin: break
|
if _cit.is_begin:
|
||||||
|
break
|
||||||
|
|
||||||
if connexl > self._percent * self._length:
|
if connexl > self._percent * self._length:
|
||||||
return None
|
return None
|
||||||
@@ -411,13 +412,13 @@ class pyFillOcclusionsAbsoluteChainingIterator(ChainingIterator):
|
|||||||
winner = None
|
winner = None
|
||||||
winnerOrientation = False
|
winnerOrientation = False
|
||||||
it = AdjacencyIterator(iter)
|
it = AdjacencyIterator(iter)
|
||||||
## case of TVertex
|
# case of TVertex
|
||||||
vertex = self.next_vertex
|
vertex = self.next_vertex
|
||||||
if type(vertex) is TVertex:
|
if type(vertex) is TVertex:
|
||||||
mate = vertex.get_mate(self.current_edge)
|
mate = vertex.get_mate(self.current_edge)
|
||||||
winner = find_matching_vertex(mate.id, it)
|
winner = find_matching_vertex(mate.id, it)
|
||||||
winnerOrientation = not it.is_incoming if not it.is_end else False
|
winnerOrientation = not it.is_incoming if not it.is_end else False
|
||||||
## case of NonTVertex
|
# case of NonTVertex
|
||||||
else:
|
else:
|
||||||
for nat in NATURES:
|
for nat in NATURES:
|
||||||
if (self.current_edge.nature & nat):
|
if (self.current_edge.nature & nat):
|
||||||
@@ -440,7 +441,8 @@ class pyFillOcclusionsAbsoluteChainingIterator(ChainingIterator):
|
|||||||
while (not _cit.is_end) and _cit.object.time_stamp != self.timestamp:
|
while (not _cit.is_end) and _cit.object.time_stamp != self.timestamp:
|
||||||
connexl += _cit.object.length_2d
|
connexl += _cit.object.length_2d
|
||||||
_cit.increment()
|
_cit.increment()
|
||||||
if _cit.is_begin: break
|
if _cit.is_begin:
|
||||||
|
break
|
||||||
|
|
||||||
if connexl > self._length:
|
if connexl > self._length:
|
||||||
return None
|
return None
|
||||||
@@ -463,6 +465,7 @@ class pyFillOcclusionsAbsoluteAndRelativeChainingIterator(ChainingIterator):
|
|||||||
:arg l: Absolute length.
|
:arg l: Absolute length.
|
||||||
:type l: float
|
:type l: float
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, percent, l):
|
def __init__(self, percent, l):
|
||||||
ChainingIterator.__init__(self, False, True, None, True)
|
ChainingIterator.__init__(self, False, True, None, True)
|
||||||
self._length = 0.0
|
self._length = 0.0
|
||||||
@@ -479,13 +482,13 @@ class pyFillOcclusionsAbsoluteAndRelativeChainingIterator(ChainingIterator):
|
|||||||
winner = None
|
winner = None
|
||||||
winnerOrientation = False
|
winnerOrientation = False
|
||||||
it = AdjacencyIterator(iter)
|
it = AdjacencyIterator(iter)
|
||||||
## case of TVertex
|
# case of TVertex
|
||||||
vertex = self.next_vertex
|
vertex = self.next_vertex
|
||||||
if type(vertex) is TVertex:
|
if type(vertex) is TVertex:
|
||||||
mate = vertex.get_mate(self.current_edge)
|
mate = vertex.get_mate(self.current_edge)
|
||||||
winner = find_matching_vertex(mate.id, it)
|
winner = find_matching_vertex(mate.id, it)
|
||||||
winnerOrientation = not it.is_incoming if not it.is_end else False
|
winnerOrientation = not it.is_incoming if not it.is_end else False
|
||||||
## case of NonTVertex
|
# case of NonTVertex
|
||||||
else:
|
else:
|
||||||
for nat in NATURES:
|
for nat in NATURES:
|
||||||
if (self.current_edge.nature & nat):
|
if (self.current_edge.nature & nat):
|
||||||
@@ -511,7 +514,8 @@ class pyFillOcclusionsAbsoluteAndRelativeChainingIterator(ChainingIterator):
|
|||||||
while (not _cit.is_end) and _cit.object.time_stamp != CF.get_time_stamp():
|
while (not _cit.is_end) and _cit.object.time_stamp != CF.get_time_stamp():
|
||||||
connexl += _cit.object.length_2d
|
connexl += _cit.object.length_2d
|
||||||
_cit.increment()
|
_cit.increment()
|
||||||
if _cit.is_begin: break
|
if _cit.is_begin:
|
||||||
|
break
|
||||||
|
|
||||||
if (connexl > self._percent * self._length) or (connexl > self._absLength):
|
if (connexl > self._percent * self._length) or (connexl > self._absLength):
|
||||||
return None
|
return None
|
||||||
@@ -549,13 +553,13 @@ class pyFillQi0AbsoluteAndRelativeChainingIterator(ChainingIterator):
|
|||||||
winner = None
|
winner = None
|
||||||
winnerOrientation = False
|
winnerOrientation = False
|
||||||
it = AdjacencyIterator(iter)
|
it = AdjacencyIterator(iter)
|
||||||
## case of TVertex
|
# case of TVertex
|
||||||
vertex = self.next_vertex
|
vertex = self.next_vertex
|
||||||
if type(vertex) is TVertex:
|
if type(vertex) is TVertex:
|
||||||
mate = vertex.get_mate(self.current_edge)
|
mate = vertex.get_mate(self.current_edge)
|
||||||
winner = find_matching_vertex(mate.id, it)
|
winner = find_matching_vertex(mate.id, it)
|
||||||
winnerOrientation = not it.is_incoming if not it.is_end else False
|
winnerOrientation = not it.is_incoming if not it.is_end else False
|
||||||
## case of NonTVertex
|
# case of NonTVertex
|
||||||
else:
|
else:
|
||||||
for nat in NATURES:
|
for nat in NATURES:
|
||||||
if (self.current_edge.nature & nat):
|
if (self.current_edge.nature & nat):
|
||||||
@@ -569,7 +573,6 @@ class pyFillQi0AbsoluteAndRelativeChainingIterator(ChainingIterator):
|
|||||||
|
|
||||||
if winner is not None and winner.qi:
|
if winner is not None and winner.qi:
|
||||||
|
|
||||||
|
|
||||||
if self._length == 0.0:
|
if self._length == 0.0:
|
||||||
self._length = get_chain_length(winner, winnerOrientation)
|
self._length = get_chain_length(winner, winnerOrientation)
|
||||||
|
|
||||||
@@ -582,7 +585,8 @@ class pyFillQi0AbsoluteAndRelativeChainingIterator(ChainingIterator):
|
|||||||
while (not _cit.is_end) and _cit.object.qi != 0:
|
while (not _cit.is_end) and _cit.object.qi != 0:
|
||||||
connexl += _cit.object.length_2d
|
connexl += _cit.object.length_2d
|
||||||
_cit.increment()
|
_cit.increment()
|
||||||
if _cit.is_begin: break
|
if _cit.is_begin:
|
||||||
|
break
|
||||||
if (connexl > self._percent * self._length) or (connexl > self._absLength):
|
if (connexl > self._percent * self._length) or (connexl > self._absLength):
|
||||||
return None
|
return None
|
||||||
return winner
|
return winner
|
||||||
@@ -637,7 +641,7 @@ class pyNoIdChainSilhouetteIterator(ChainingIterator):
|
|||||||
if vA.id.first == vB.id.first:
|
if vA.id.first == vB.id.first:
|
||||||
return ve
|
return ve
|
||||||
return None
|
return None
|
||||||
## case of NonTVertex
|
# case of NonTVertex
|
||||||
else:
|
else:
|
||||||
for i, nat in enumerate(NATURES):
|
for i, nat in enumerate(NATURES):
|
||||||
if (nat & self.current_edge.nature):
|
if (nat & self.current_edge.nature):
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ __all__ = (
|
|||||||
"pyZBP1D",
|
"pyZBP1D",
|
||||||
"pyZDiscontinuityBP1D",
|
"pyZDiscontinuityBP1D",
|
||||||
"pyZSmallerUP1D",
|
"pyZSmallerUP1D",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# module members
|
# module members
|
||||||
@@ -117,7 +117,7 @@ from _freestyle import (
|
|||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
ViewMapGradientNormBP1D,
|
ViewMapGradientNormBP1D,
|
||||||
WithinImageBoundaryUP1D,
|
WithinImageBoundaryUP1D,
|
||||||
)
|
)
|
||||||
|
|
||||||
# constructs for predicate definition in Python
|
# constructs for predicate definition in Python
|
||||||
from freestyle.types import (
|
from freestyle.types import (
|
||||||
@@ -129,7 +129,7 @@ from freestyle.types import (
|
|||||||
TVertex,
|
TVertex,
|
||||||
UnaryPredicate0D,
|
UnaryPredicate0D,
|
||||||
UnaryPredicate1D,
|
UnaryPredicate1D,
|
||||||
)
|
)
|
||||||
from freestyle.functions import (
|
from freestyle.functions import (
|
||||||
Curvature2DAngleF0D,
|
Curvature2DAngleF0D,
|
||||||
CurveNatureF1D,
|
CurveNatureF1D,
|
||||||
@@ -149,7 +149,7 @@ from freestyle.functions import (
|
|||||||
pyCurvilinearLengthF0D,
|
pyCurvilinearLengthF0D,
|
||||||
pyDensityAnisotropyF1D,
|
pyDensityAnisotropyF1D,
|
||||||
pyViewMapGradientNormF1D,
|
pyViewMapGradientNormF1D,
|
||||||
)
|
)
|
||||||
|
|
||||||
from freestyle.utils import material_from_fedge
|
from freestyle.utils import material_from_fedge
|
||||||
|
|
||||||
@@ -194,6 +194,7 @@ class pyBackTVertexUP0D(UnaryPredicate0D):
|
|||||||
Check whether an Interface0DIterator references a TVertex and is
|
Check whether an Interface0DIterator references a TVertex and is
|
||||||
the one that is hidden (inferred from the context).
|
the one that is hidden (inferred from the context).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
UnaryPredicate0D.__init__(self)
|
UnaryPredicate0D.__init__(self)
|
||||||
self._getQI = QuantitativeInvisibilityF0D()
|
self._getQI = QuantitativeInvisibilityF0D()
|
||||||
@@ -533,7 +534,8 @@ class pyHighViewMapGradientNormUP1D(UnaryPredicate1D):
|
|||||||
|
|
||||||
|
|
||||||
class pyDensityVariableSigmaUP1D(UnaryPredicate1D):
|
class pyDensityVariableSigmaUP1D(UnaryPredicate1D):
|
||||||
def __init__(self, functor, sigmaMin, sigmaMax, lmin, lmax, tmin, tmax, integration=IntegrationType.MEAN, sampling=2.0):
|
def __init__(self, functor, sigmaMin, sigmaMax, lmin, lmax, tmin,
|
||||||
|
tmax, integration=IntegrationType.MEAN, sampling=2.0):
|
||||||
UnaryPredicate1D.__init__(self)
|
UnaryPredicate1D.__init__(self)
|
||||||
self._functor = functor
|
self._functor = functor
|
||||||
self._sigmaMin = float(sigmaMin)
|
self._sigmaMin = float(sigmaMin)
|
||||||
@@ -672,8 +674,10 @@ class pyShuffleBP1D(BinaryPredicate1D):
|
|||||||
def __call__(self, inter1, inter2):
|
def __call__(self, inter1, inter2):
|
||||||
return (random.uniform(0, 1) < random.uniform(0, 1))
|
return (random.uniform(0, 1) < random.uniform(0, 1))
|
||||||
|
|
||||||
|
|
||||||
class MaterialBP1D(BinaryPredicate1D):
|
class MaterialBP1D(BinaryPredicate1D):
|
||||||
"""Checks whether the two supplied ViewEdges have the same material."""
|
"""Checks whether the two supplied ViewEdges have the same material."""
|
||||||
|
|
||||||
def __call__(self, i1, i2):
|
def __call__(self, i1, i2):
|
||||||
fedges = (fe for ve in (i1, i2) for fe in (ve.first_fedge, ve.last_fedge))
|
fedges = (fe for ve in (i1, i2) for fe in (ve.first_fedge, ve.last_fedge))
|
||||||
materials = {material_from_fedge(fe) for fe in fedges}
|
materials = {material_from_fedge(fe) for fe in fedges}
|
||||||
|
|||||||
@@ -170,4 +170,4 @@ from _freestyle import (
|
|||||||
ViewShape,
|
ViewShape,
|
||||||
ViewVertex,
|
ViewVertex,
|
||||||
orientedViewEdgeIterator,
|
orientedViewEdgeIterator,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -51,14 +51,14 @@ __all__ = (
|
|||||||
"stroke_normal",
|
"stroke_normal",
|
||||||
"StrokeCollector",
|
"StrokeCollector",
|
||||||
"tripplewise",
|
"tripplewise",
|
||||||
)
|
)
|
||||||
|
|
||||||
# module members
|
# module members
|
||||||
from _freestyle import (
|
from _freestyle import (
|
||||||
ContextFunctions,
|
ContextFunctions,
|
||||||
getCurrentScene,
|
getCurrentScene,
|
||||||
integrate,
|
integrate,
|
||||||
)
|
)
|
||||||
|
|
||||||
# constructs for helper functions in Python
|
# constructs for helper functions in Python
|
||||||
from freestyle.types import (
|
from freestyle.types import (
|
||||||
@@ -66,7 +66,7 @@ from freestyle.types import (
|
|||||||
Stroke,
|
Stroke,
|
||||||
StrokeShader,
|
StrokeShader,
|
||||||
StrokeVertexIterator,
|
StrokeVertexIterator,
|
||||||
)
|
)
|
||||||
|
|
||||||
from mathutils import Vector
|
from mathutils import Vector
|
||||||
from functools import lru_cache, namedtuple
|
from functools import lru_cache, namedtuple
|
||||||
@@ -319,6 +319,7 @@ class BoundingBox:
|
|||||||
|
|
||||||
class StrokeCollector(StrokeShader):
|
class StrokeCollector(StrokeShader):
|
||||||
"""Collects and Stores stroke objects"""
|
"""Collects and Stores stroke objects"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
StrokeShader.__init__(self)
|
StrokeShader.__init__(self)
|
||||||
self.strokes = []
|
self.strokes = []
|
||||||
|
|||||||
@@ -34,20 +34,20 @@ from freestyle.types import (
|
|||||||
TVertex,
|
TVertex,
|
||||||
Material,
|
Material,
|
||||||
ViewEdge,
|
ViewEdge,
|
||||||
)
|
)
|
||||||
from freestyle.chainingiterators import (
|
from freestyle.chainingiterators import (
|
||||||
ChainPredicateIterator,
|
ChainPredicateIterator,
|
||||||
ChainSilhouetteIterator,
|
ChainSilhouetteIterator,
|
||||||
pySketchyChainSilhouetteIterator,
|
pySketchyChainSilhouetteIterator,
|
||||||
pySketchyChainingIterator,
|
pySketchyChainingIterator,
|
||||||
)
|
)
|
||||||
from freestyle.functions import (
|
from freestyle.functions import (
|
||||||
Curvature2DAngleF0D,
|
Curvature2DAngleF0D,
|
||||||
Normal2DF0D,
|
Normal2DF0D,
|
||||||
QuantitativeInvisibilityF1D,
|
QuantitativeInvisibilityF1D,
|
||||||
VertexOrientation2DF0D,
|
VertexOrientation2DF0D,
|
||||||
CurveMaterialF0D,
|
CurveMaterialF0D,
|
||||||
)
|
)
|
||||||
from freestyle.predicates import (
|
from freestyle.predicates import (
|
||||||
AndUP1D,
|
AndUP1D,
|
||||||
ContourUP1D,
|
ContourUP1D,
|
||||||
@@ -67,7 +67,7 @@ from freestyle.predicates import (
|
|||||||
pyProjectedXBP1D,
|
pyProjectedXBP1D,
|
||||||
pyProjectedYBP1D,
|
pyProjectedYBP1D,
|
||||||
pyZBP1D,
|
pyZBP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
BackboneStretcherShader,
|
BackboneStretcherShader,
|
||||||
BezierCurveShader,
|
BezierCurveShader,
|
||||||
@@ -86,7 +86,7 @@ from freestyle.shaders import (
|
|||||||
StrokeTextureStepShader,
|
StrokeTextureStepShader,
|
||||||
ThicknessNoiseShader as thickness_noise,
|
ThicknessNoiseShader as thickness_noise,
|
||||||
TipRemoverShader,
|
TipRemoverShader,
|
||||||
)
|
)
|
||||||
from freestyle.utils import (
|
from freestyle.utils import (
|
||||||
angle_x_normal,
|
angle_x_normal,
|
||||||
bound,
|
bound,
|
||||||
@@ -103,12 +103,12 @@ from freestyle.utils import (
|
|||||||
pairwise,
|
pairwise,
|
||||||
simplify,
|
simplify,
|
||||||
stroke_normal,
|
stroke_normal,
|
||||||
)
|
)
|
||||||
from _freestyle import (
|
from _freestyle import (
|
||||||
blendRamp,
|
blendRamp,
|
||||||
evaluateColorRamp,
|
evaluateColorRamp,
|
||||||
evaluateCurveMappingF,
|
evaluateCurveMappingF,
|
||||||
)
|
)
|
||||||
|
|
||||||
import time
|
import time
|
||||||
import bpy
|
import bpy
|
||||||
@@ -608,7 +608,9 @@ class NoiseShader:
|
|||||||
|
|
||||||
class ThicknessNoiseShader(ThicknessBlenderMixIn, ScalarBlendModifier, NoiseShader):
|
class ThicknessNoiseShader(ThicknessBlenderMixIn, ScalarBlendModifier, NoiseShader):
|
||||||
"""Thickness based on pseudo-noise"""
|
"""Thickness based on pseudo-noise"""
|
||||||
def __init__(self, thickness_position, thickness_ratio, blend_type, influence, amplitude, period, seed=512, asymmetric=True):
|
|
||||||
|
def __init__(self, thickness_position, thickness_ratio, blend_type,
|
||||||
|
influence, amplitude, period, seed=512, asymmetric=True):
|
||||||
ScalarBlendModifier.__init__(self, blend_type, influence)
|
ScalarBlendModifier.__init__(self, blend_type, influence)
|
||||||
ThicknessBlenderMixIn.__init__(self, thickness_position, thickness_ratio)
|
ThicknessBlenderMixIn.__init__(self, thickness_position, thickness_ratio)
|
||||||
NoiseShader.__init__(self, amplitude, period, seed)
|
NoiseShader.__init__(self, amplitude, period, seed)
|
||||||
|
|||||||
@@ -29,13 +29,13 @@ from freestyle.predicates import (
|
|||||||
QuantitativeInvisibilityUP1D,
|
QuantitativeInvisibilityUP1D,
|
||||||
TrueBP1D,
|
TrueBP1D,
|
||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
ConstantThicknessShader,
|
ConstantThicknessShader,
|
||||||
IncreasingColorShader,
|
IncreasingColorShader,
|
||||||
SamplingShader,
|
SamplingShader,
|
||||||
pyDiffusion2Shader,
|
pyDiffusion2Shader,
|
||||||
)
|
)
|
||||||
from freestyle.types import Operators, Stroke
|
from freestyle.types import Operators, Stroke
|
||||||
|
|
||||||
|
|
||||||
@@ -52,5 +52,5 @@ shaders_list = [
|
|||||||
SamplingShader(2),
|
SamplingShader(2),
|
||||||
pyDiffusion2Shader(offset, nbIter),
|
pyDiffusion2Shader(offset, nbIter),
|
||||||
IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1),
|
IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1),
|
||||||
]
|
]
|
||||||
Operators.create(TrueUP1D(), shaders_list)
|
Operators.create(TrueUP1D(), shaders_list)
|
||||||
|
|||||||
@@ -31,11 +31,11 @@ from freestyle.predicates import (
|
|||||||
TrueBP1D,
|
TrueBP1D,
|
||||||
pyDensityUP1D,
|
pyDensityUP1D,
|
||||||
pyHighViewMapDensityUP1D,
|
pyHighViewMapDensityUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
ConstantColorShader,
|
ConstantColorShader,
|
||||||
ConstantThicknessShader,
|
ConstantThicknessShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import IntegrationType, Operators
|
from freestyle.types import IntegrationType, Operators
|
||||||
|
|
||||||
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), pyHighViewMapDensityUP1D(0.3, IntegrationType.LAST))
|
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), pyHighViewMapDensityUP1D(0.3, IntegrationType.LAST))
|
||||||
@@ -45,5 +45,5 @@ Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(Quan
|
|||||||
shaders_list = [
|
shaders_list = [
|
||||||
ConstantThicknessShader(2),
|
ConstantThicknessShader(2),
|
||||||
ConstantColorShader(0, 0, 0, 1),
|
ConstantColorShader(0, 0, 0, 1),
|
||||||
]
|
]
|
||||||
Operators.create(pyDensityUP1D(1, 0.1, IntegrationType.MEAN), shaders_list)
|
Operators.create(pyDensityUP1D(1, 0.1, IntegrationType.MEAN), shaders_list)
|
||||||
|
|||||||
@@ -29,17 +29,17 @@ from freestyle.predicates import (
|
|||||||
TrueBP1D,
|
TrueBP1D,
|
||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
pyHighViewMapDensityUP1D,
|
pyHighViewMapDensityUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
ConstantColorShader,
|
ConstantColorShader,
|
||||||
ConstantThicknessShader,
|
ConstantThicknessShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import Operators
|
from freestyle.types import Operators
|
||||||
|
|
||||||
|
|
||||||
Operators.select(AndUP1D(QuantitativeInvisibilityUP1D(0), pyHighViewMapDensityUP1D(0.1,5)))
|
Operators.select(AndUP1D(QuantitativeInvisibilityUP1D(0), pyHighViewMapDensityUP1D(0.1, 5)))
|
||||||
bpred = TrueBP1D()
|
bpred = TrueBP1D()
|
||||||
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), pyHighViewMapDensityUP1D(0.0007,5))
|
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), pyHighViewMapDensityUP1D(0.0007, 5))
|
||||||
Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||||
shaders_list = [
|
shaders_list = [
|
||||||
ConstantThicknessShader(2),
|
ConstantThicknessShader(2),
|
||||||
|
|||||||
@@ -30,25 +30,25 @@ from freestyle.predicates import (
|
|||||||
SameShapeIdBP1D,
|
SameShapeIdBP1D,
|
||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
pyHigherLengthUP1D,
|
pyHigherLengthUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
ConstantThicknessShader,
|
ConstantThicknessShader,
|
||||||
IncreasingColorShader,
|
IncreasingColorShader,
|
||||||
pyBluePrintCirclesShader,
|
pyBluePrintCirclesShader,
|
||||||
pyPerlinNoise1DShader,
|
pyPerlinNoise1DShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import Operators
|
from freestyle.types import Operators
|
||||||
|
|
||||||
|
|
||||||
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D())
|
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D())
|
||||||
bpred = SameShapeIdBP1D()
|
bpred = SameShapeIdBP1D()
|
||||||
Operators.select(upred)
|
Operators.select(upred)
|
||||||
Operators.bidirectional_chain(ChainPredicateIterator(upred,bpred), NotUP1D(upred))
|
Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(upred))
|
||||||
Operators.select(pyHigherLengthUP1D(200))
|
Operators.select(pyHigherLengthUP1D(200))
|
||||||
shaders_list = [
|
shaders_list = [
|
||||||
ConstantThicknessShader(5),
|
ConstantThicknessShader(5),
|
||||||
pyBluePrintCirclesShader(3),
|
pyBluePrintCirclesShader(3),
|
||||||
pyPerlinNoise1DShader(0.1, 15, 8),
|
pyPerlinNoise1DShader(0.1, 15, 8),
|
||||||
IncreasingColorShader(0.8, 0.8, 0.3, 0.4, 0.3, 0.3, 0.3, 0.1),
|
IncreasingColorShader(0.8, 0.8, 0.3, 0.4, 0.3, 0.3, 0.3, 0.1),
|
||||||
]
|
]
|
||||||
Operators.create(TrueUP1D(), shaders_list)
|
Operators.create(TrueUP1D(), shaders_list)
|
||||||
|
|||||||
@@ -30,13 +30,13 @@ from freestyle.predicates import (
|
|||||||
SameShapeIdBP1D,
|
SameShapeIdBP1D,
|
||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
pyHigherLengthUP1D,
|
pyHigherLengthUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
ConstantThicknessShader,
|
ConstantThicknessShader,
|
||||||
IncreasingColorShader,
|
IncreasingColorShader,
|
||||||
pyBluePrintEllipsesShader,
|
pyBluePrintEllipsesShader,
|
||||||
pyPerlinNoise1DShader,
|
pyPerlinNoise1DShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import Operators
|
from freestyle.types import Operators
|
||||||
|
|
||||||
|
|
||||||
@@ -50,5 +50,5 @@ shaders_list = [
|
|||||||
pyBluePrintEllipsesShader(3),
|
pyBluePrintEllipsesShader(3),
|
||||||
pyPerlinNoise1DShader(0.1, 10, 8),
|
pyPerlinNoise1DShader(0.1, 10, 8),
|
||||||
IncreasingColorShader(0.6, 0.3, 0.3, 0.7, 0.3, 0.3, 0.3, 0.1),
|
IncreasingColorShader(0.6, 0.3, 0.3, 0.7, 0.3, 0.3, 0.3, 0.1),
|
||||||
]
|
]
|
||||||
Operators.create(TrueUP1D(), shaders_list)
|
Operators.create(TrueUP1D(), shaders_list)
|
||||||
|
|||||||
@@ -30,13 +30,13 @@ from freestyle.predicates import (
|
|||||||
SameShapeIdBP1D,
|
SameShapeIdBP1D,
|
||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
pyHigherLengthUP1D,
|
pyHigherLengthUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
ConstantThicknessShader,
|
ConstantThicknessShader,
|
||||||
IncreasingColorShader,
|
IncreasingColorShader,
|
||||||
pyBluePrintSquaresShader,
|
pyBluePrintSquaresShader,
|
||||||
pyPerlinNoise1DShader,
|
pyPerlinNoise1DShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import Operators
|
from freestyle.types import Operators
|
||||||
|
|
||||||
|
|
||||||
@@ -51,5 +51,5 @@ shaders_list = [
|
|||||||
pyPerlinNoise1DShader(0.07, 10, 8),
|
pyPerlinNoise1DShader(0.07, 10, 8),
|
||||||
IncreasingColorShader(0.6, 0.3, 0.3, 0.7, 0.6, 0.3, 0.3, 0.3),
|
IncreasingColorShader(0.6, 0.3, 0.3, 0.7, 0.6, 0.3, 0.3, 0.3),
|
||||||
ConstantThicknessShader(4),
|
ConstantThicknessShader(4),
|
||||||
]
|
]
|
||||||
Operators.create(TrueUP1D(), shaders_list)
|
Operators.create(TrueUP1D(), shaders_list)
|
||||||
|
|||||||
@@ -28,12 +28,12 @@ from freestyle.predicates import (
|
|||||||
NotUP1D,
|
NotUP1D,
|
||||||
QuantitativeInvisibilityUP1D,
|
QuantitativeInvisibilityUP1D,
|
||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
BezierCurveShader,
|
BezierCurveShader,
|
||||||
ConstantThicknessShader,
|
ConstantThicknessShader,
|
||||||
pyMaterialColorShader,
|
pyMaterialColorShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import Operators
|
from freestyle.types import Operators
|
||||||
|
|
||||||
|
|
||||||
@@ -43,5 +43,5 @@ shaders_list = [
|
|||||||
BezierCurveShader(3),
|
BezierCurveShader(3),
|
||||||
ConstantThicknessShader(4),
|
ConstantThicknessShader(4),
|
||||||
pyMaterialColorShader(0.8),
|
pyMaterialColorShader(0.8),
|
||||||
]
|
]
|
||||||
Operators.create(TrueUP1D(), shaders_list)
|
Operators.create(TrueUP1D(), shaders_list)
|
||||||
|
|||||||
@@ -29,11 +29,11 @@ from freestyle.predicates import (
|
|||||||
QuantitativeInvisibilityUP1D,
|
QuantitativeInvisibilityUP1D,
|
||||||
SameShapeIdBP1D,
|
SameShapeIdBP1D,
|
||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
ConstantThicknessShader,
|
ConstantThicknessShader,
|
||||||
IncreasingColorShader,
|
IncreasingColorShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import Operators
|
from freestyle.types import Operators
|
||||||
|
|
||||||
|
|
||||||
@@ -43,6 +43,6 @@ upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D())
|
|||||||
Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||||
shaders_list = [
|
shaders_list = [
|
||||||
ConstantThicknessShader(5.0),
|
ConstantThicknessShader(5.0),
|
||||||
IncreasingColorShader(0.8,0,0,1,0.1,0,0,1),
|
IncreasingColorShader(0.8, 0, 0, 1, 0.1, 0, 0, 1),
|
||||||
]
|
]
|
||||||
Operators.create(TrueUP1D(), shaders_list)
|
Operators.create(TrueUP1D(), shaders_list)
|
||||||
|
|||||||
@@ -27,11 +27,11 @@ from freestyle.predicates import (
|
|||||||
NotUP1D,
|
NotUP1D,
|
||||||
QuantitativeInvisibilityUP1D,
|
QuantitativeInvisibilityUP1D,
|
||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
ConstantThicknessShader,
|
ConstantThicknessShader,
|
||||||
py2DCurvatureColorShader,
|
py2DCurvatureColorShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import Operators, Stroke
|
from freestyle.types import Operators, Stroke
|
||||||
|
|
||||||
|
|
||||||
@@ -40,5 +40,5 @@ Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInv
|
|||||||
shaders_list = [
|
shaders_list = [
|
||||||
ConstantThicknessShader(5),
|
ConstantThicknessShader(5),
|
||||||
py2DCurvatureColorShader()
|
py2DCurvatureColorShader()
|
||||||
]
|
]
|
||||||
Operators.create(TrueUP1D(), shaders_list)
|
Operators.create(TrueUP1D(), shaders_list)
|
||||||
|
|||||||
@@ -29,11 +29,11 @@ from freestyle.predicates import (
|
|||||||
QuantitativeInvisibilityUP1D,
|
QuantitativeInvisibilityUP1D,
|
||||||
TrueBP1D,
|
TrueBP1D,
|
||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
ConstantColorShader,
|
ConstantColorShader,
|
||||||
ConstantThicknessShader,
|
ConstantThicknessShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import Operators
|
from freestyle.types import Operators
|
||||||
|
|
||||||
|
|
||||||
@@ -44,5 +44,5 @@ Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(upre
|
|||||||
shaders_list = [
|
shaders_list = [
|
||||||
ConstantThicknessShader(3),
|
ConstantThicknessShader(3),
|
||||||
ConstantColorShader(0.0, 0.0, 0.0, 1),
|
ConstantColorShader(0.0, 0.0, 0.0, 1),
|
||||||
]
|
]
|
||||||
Operators.create(TrueUP1D(), shaders_list)
|
Operators.create(TrueUP1D(), shaders_list)
|
||||||
|
|||||||
@@ -30,14 +30,14 @@ from freestyle.predicates import (
|
|||||||
NotUP1D,
|
NotUP1D,
|
||||||
QuantitativeInvisibilityUP1D,
|
QuantitativeInvisibilityUP1D,
|
||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
IncreasingColorShader,
|
IncreasingColorShader,
|
||||||
IncreasingThicknessShader,
|
IncreasingThicknessShader,
|
||||||
SamplingShader,
|
SamplingShader,
|
||||||
SmoothingShader,
|
SmoothingShader,
|
||||||
SpatialNoiseShader,
|
SpatialNoiseShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import Operators
|
from freestyle.types import Operators
|
||||||
|
|
||||||
|
|
||||||
@@ -50,5 +50,5 @@ shaders_list = [
|
|||||||
IncreasingThicknessShader(4, 10),
|
IncreasingThicknessShader(4, 10),
|
||||||
SmoothingShader(400, 0.1, 0, 0.2, 0, 0, 0, 1),
|
SmoothingShader(400, 0.1, 0, 0.2, 0, 0, 0, 1),
|
||||||
IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1),
|
IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1),
|
||||||
]
|
]
|
||||||
Operators.create(TrueUP1D(), shaders_list)
|
Operators.create(TrueUP1D(), shaders_list)
|
||||||
|
|||||||
@@ -29,13 +29,13 @@ from freestyle.predicates import (
|
|||||||
QuantitativeInvisibilityUP1D,
|
QuantitativeInvisibilityUP1D,
|
||||||
TrueBP1D,
|
TrueBP1D,
|
||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
IncreasingColorShader,
|
IncreasingColorShader,
|
||||||
IncreasingThicknessShader,
|
IncreasingThicknessShader,
|
||||||
SamplingShader,
|
SamplingShader,
|
||||||
SmoothingShader,
|
SmoothingShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import Operators
|
from freestyle.types import Operators
|
||||||
|
|
||||||
|
|
||||||
@@ -45,8 +45,8 @@ bpred = TrueBP1D()
|
|||||||
Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(upred))
|
Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(upred))
|
||||||
shaders_list = [
|
shaders_list = [
|
||||||
SamplingShader(2),
|
SamplingShader(2),
|
||||||
IncreasingThicknessShader(4,20),
|
IncreasingThicknessShader(4, 20),
|
||||||
IncreasingColorShader(1.0, 0.0, 0.5,1, 0.5,1, 0.3, 1),
|
IncreasingColorShader(1.0, 0.0, 0.5, 1, 0.5, 1, 0.3, 1),
|
||||||
SmoothingShader(100, 0.05, 0, 0.2, 0, 0, 0, 1),
|
SmoothingShader(100, 0.05, 0, 0.2, 0, 0, 0, 1),
|
||||||
]
|
]
|
||||||
Operators.create(TrueUP1D(), shaders_list)
|
Operators.create(TrueUP1D(), shaders_list)
|
||||||
|
|||||||
@@ -31,28 +31,28 @@ from freestyle.predicates import (
|
|||||||
QuantitativeInvisibilityUP1D,
|
QuantitativeInvisibilityUP1D,
|
||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
pyIsOccludedByUP1D,
|
pyIsOccludedByUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
IncreasingColorShader,
|
IncreasingColorShader,
|
||||||
IncreasingThicknessShader,
|
IncreasingThicknessShader,
|
||||||
SamplingShader,
|
SamplingShader,
|
||||||
TipRemoverShader,
|
TipRemoverShader,
|
||||||
pyTVertexRemoverShader,
|
pyTVertexRemoverShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import Id, Operators
|
from freestyle.types import Id, Operators
|
||||||
|
|
||||||
|
|
||||||
# id corresponds to the id of the target object
|
# id corresponds to the id of the target object
|
||||||
# (accessed by SHIFT+click)
|
# (accessed by SHIFT+click)
|
||||||
id = Id(3,0)
|
id = Id(3, 0)
|
||||||
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), pyIsOccludedByUP1D(id))
|
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), pyIsOccludedByUP1D(id))
|
||||||
Operators.select(upred)
|
Operators.select(upred)
|
||||||
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred))
|
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred))
|
||||||
shaders_list = [
|
shaders_list = [
|
||||||
IncreasingThicknessShader(3, 5),
|
IncreasingThicknessShader(3, 5),
|
||||||
IncreasingColorShader(1,0,0, 1,0,1,0,1),
|
IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1),
|
||||||
SamplingShader(1.0),
|
SamplingShader(1.0),
|
||||||
pyTVertexRemoverShader(),
|
pyTVertexRemoverShader(),
|
||||||
TipRemoverShader(3.0),
|
TipRemoverShader(3.0),
|
||||||
]
|
]
|
||||||
Operators.create(TrueUP1D(), shaders_list)
|
Operators.create(TrueUP1D(), shaders_list)
|
||||||
|
|||||||
@@ -25,21 +25,21 @@ from freestyle.chainingiterators import pyFillOcclusionsAbsoluteChainingIterator
|
|||||||
from freestyle.predicates import (
|
from freestyle.predicates import (
|
||||||
QuantitativeInvisibilityUP1D,
|
QuantitativeInvisibilityUP1D,
|
||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
ConstantColorShader,
|
ConstantColorShader,
|
||||||
ConstantThicknessShader,
|
ConstantThicknessShader,
|
||||||
SamplingShader,
|
SamplingShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import Operators
|
from freestyle.types import Operators
|
||||||
|
|
||||||
|
|
||||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||||
#Operators.bidirectional_chain(pyFillOcclusionsChainingIterator(0.1))
|
# Operators.bidirectional_chain(pyFillOcclusionsChainingIterator(0.1))
|
||||||
Operators.bidirectional_chain(pyFillOcclusionsAbsoluteChainingIterator(12))
|
Operators.bidirectional_chain(pyFillOcclusionsAbsoluteChainingIterator(12))
|
||||||
shaders_list = [
|
shaders_list = [
|
||||||
SamplingShader(5.0),
|
SamplingShader(5.0),
|
||||||
ConstantThicknessShader(3),
|
ConstantThicknessShader(3),
|
||||||
ConstantColorShader(0.0, 0.0, 0.0),
|
ConstantColorShader(0.0, 0.0, 0.0),
|
||||||
]
|
]
|
||||||
Operators.create(TrueUP1D(), shaders_list)
|
Operators.create(TrueUP1D(), shaders_list)
|
||||||
|
|||||||
@@ -27,12 +27,12 @@ from freestyle.predicates import (
|
|||||||
NotUP1D,
|
NotUP1D,
|
||||||
QuantitativeInvisibilityUP1D,
|
QuantitativeInvisibilityUP1D,
|
||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
ConstantColorShader,
|
ConstantColorShader,
|
||||||
ConstantThicknessShader,
|
ConstantThicknessShader,
|
||||||
SamplingShader,
|
SamplingShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import Operators
|
from freestyle.types import Operators
|
||||||
|
|
||||||
|
|
||||||
@@ -43,5 +43,5 @@ shaders_list = [
|
|||||||
SamplingShader(5.0),
|
SamplingShader(5.0),
|
||||||
ConstantThicknessShader(3.0),
|
ConstantThicknessShader(3.0),
|
||||||
ConstantColorShader(0.7, 0.7, 0.7),
|
ConstantColorShader(0.7, 0.7, 0.7),
|
||||||
]
|
]
|
||||||
Operators.create(TrueUP1D(), shaders_list)
|
Operators.create(TrueUP1D(), shaders_list)
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ from freestyle.predicates import (
|
|||||||
pyHigherNumberOfTurnsUP1D,
|
pyHigherNumberOfTurnsUP1D,
|
||||||
pyLengthBP1D,
|
pyLengthBP1D,
|
||||||
pyParameterUP0D,
|
pyParameterUP0D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
BezierCurveShader,
|
BezierCurveShader,
|
||||||
ConstantColorShader,
|
ConstantColorShader,
|
||||||
@@ -40,20 +40,20 @@ from freestyle.shaders import (
|
|||||||
TipRemoverShader,
|
TipRemoverShader,
|
||||||
pyNonLinearVaryingThicknessShader,
|
pyNonLinearVaryingThicknessShader,
|
||||||
pySamplingShader,
|
pySamplingShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import IntegrationType, Operators
|
from freestyle.types import IntegrationType, Operators
|
||||||
|
|
||||||
|
|
||||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||||
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||||
## Splits strokes at points of highest 2D curvature
|
# Splits strokes at points of highest 2D curvature
|
||||||
## when there are too many abrupt turns in it
|
# when there are too many abrupt turns in it
|
||||||
func = pyInverseCurvature2DAngleF0D()
|
func = pyInverseCurvature2DAngleF0D()
|
||||||
Operators.recursive_split(func, pyParameterUP0D(0.2, 0.8), NotUP1D(pyHigherNumberOfTurnsUP1D(3, 0.5)), 2)
|
Operators.recursive_split(func, pyParameterUP0D(0.2, 0.8), NotUP1D(pyHigherNumberOfTurnsUP1D(3, 0.5)), 2)
|
||||||
## Keeps only long enough strokes
|
# Keeps only long enough strokes
|
||||||
Operators.select(pyHigherLengthUP1D(100))
|
Operators.select(pyHigherLengthUP1D(100))
|
||||||
## Sorts so as to draw the longest strokes first
|
# Sorts so as to draw the longest strokes first
|
||||||
## (this will be done using the causal density)
|
# (this will be done using the causal density)
|
||||||
Operators.sort(pyLengthBP1D())
|
Operators.sort(pyLengthBP1D())
|
||||||
shaders_list = [
|
shaders_list = [
|
||||||
pySamplingShader(10),
|
pySamplingShader(10),
|
||||||
@@ -61,8 +61,8 @@ shaders_list = [
|
|||||||
SamplingShader(50),
|
SamplingShader(50),
|
||||||
ConstantThicknessShader(10),
|
ConstantThicknessShader(10),
|
||||||
pyNonLinearVaryingThicknessShader(4, 25, 0.6),
|
pyNonLinearVaryingThicknessShader(4, 25, 0.6),
|
||||||
ConstantColorShader(0.2, 0.2, 0.2,1.0),
|
ConstantColorShader(0.2, 0.2, 0.2, 1.0),
|
||||||
TipRemoverShader(10),
|
TipRemoverShader(10),
|
||||||
]
|
]
|
||||||
## Use the causal density to avoid cluttering
|
# Use the causal density to avoid cluttering
|
||||||
Operators.create(pyDensityUP1D(8, 0.4, IntegrationType.MEAN), shaders_list)
|
Operators.create(pyDensityUP1D(8, 0.4, IntegrationType.MEAN), shaders_list)
|
||||||
|
|||||||
@@ -37,16 +37,16 @@ from freestyle.predicates import (
|
|||||||
pyHighDensityAnisotropyUP1D,
|
pyHighDensityAnisotropyUP1D,
|
||||||
pyHigherLengthUP1D,
|
pyHigherLengthUP1D,
|
||||||
pyLengthBP1D,
|
pyLengthBP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
ConstantColorShader,
|
ConstantColorShader,
|
||||||
ConstantThicknessShader,
|
ConstantThicknessShader,
|
||||||
SamplingShader,
|
SamplingShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import IntegrationType, Operators
|
from freestyle.types import IntegrationType, Operators
|
||||||
|
|
||||||
|
|
||||||
## custom density predicate
|
# custom density predicate
|
||||||
class pyDensityUP1D(UnaryPredicate1D):
|
class pyDensityUP1D(UnaryPredicate1D):
|
||||||
def __init__(self, wsize, threshold, integration=IntegrationType.MEAN, sampling=2.0):
|
def __init__(self, wsize, threshold, integration=IntegrationType.MEAN, sampling=2.0):
|
||||||
UnaryPredicate1D.__init__(self)
|
UnaryPredicate1D.__init__(self)
|
||||||
@@ -61,21 +61,22 @@ class pyDensityUP1D(UnaryPredicate1D):
|
|||||||
m = self._func2(inter)
|
m = self._func2(inter)
|
||||||
if c < self._threshold:
|
if c < self._threshold:
|
||||||
return 1
|
return 1
|
||||||
if m > 4*c:
|
if m > 4 * c:
|
||||||
if c < 1.5*self._threshold:
|
if c < 1.5 * self._threshold:
|
||||||
return 1
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||||
Operators.bidirectional_chain(ChainSilhouetteIterator(),NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||||
Operators.select(pyHigherLengthUP1D(40))
|
Operators.select(pyHigherLengthUP1D(40))
|
||||||
## selects lines having a high anisotropic a priori density
|
# selects lines having a high anisotropic a priori density
|
||||||
Operators.select(pyHighDensityAnisotropyUP1D(0.3,4))
|
Operators.select(pyHighDensityAnisotropyUP1D(0.3, 4))
|
||||||
Operators.sort(pyLengthBP1D())
|
Operators.sort(pyLengthBP1D())
|
||||||
shaders_list = [
|
shaders_list = [
|
||||||
SamplingShader(2.0),
|
SamplingShader(2.0),
|
||||||
ConstantThicknessShader(2),
|
ConstantThicknessShader(2),
|
||||||
ConstantColorShader(0.2,0.2,0.25,1),
|
ConstantColorShader(0.2, 0.2, 0.25, 1),
|
||||||
]
|
]
|
||||||
## uniform culling
|
# uniform culling
|
||||||
Operators.create(pyDensityUP1D(3.0,2.0e-2, IntegrationType.MEAN, 0.1), shaders_list)
|
Operators.create(pyDensityUP1D(3.0, 2.0e-2, IntegrationType.MEAN, 0.1), shaders_list)
|
||||||
|
|||||||
@@ -31,26 +31,26 @@ from freestyle.chainingiterators import ChainSilhouetteIterator
|
|||||||
from freestyle.predicates import (
|
from freestyle.predicates import (
|
||||||
QuantitativeInvisibilityUP1D,
|
QuantitativeInvisibilityUP1D,
|
||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
ConstantColorShader,
|
ConstantColorShader,
|
||||||
IncreasingColorShader,
|
IncreasingColorShader,
|
||||||
IncreasingThicknessShader,
|
IncreasingThicknessShader,
|
||||||
SamplingShader,
|
SamplingShader,
|
||||||
pyHLRShader,
|
pyHLRShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import Operators
|
from freestyle.types import Operators
|
||||||
|
|
||||||
|
|
||||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||||
## Chain following the same nature, but without the restriction
|
# Chain following the same nature, but without the restriction
|
||||||
## of staying inside the selection (False).
|
# of staying inside the selection (False).
|
||||||
Operators.bidirectional_chain(ChainSilhouetteIterator(False))
|
Operators.bidirectional_chain(ChainSilhouetteIterator(False))
|
||||||
shaders_list = [
|
shaders_list = [
|
||||||
SamplingShader(20),
|
SamplingShader(20),
|
||||||
IncreasingThicknessShader(1.5, 30),
|
IncreasingThicknessShader(1.5, 30),
|
||||||
ConstantColorShader(0.0, 0.0, 0.0),
|
ConstantColorShader(0.0, 0.0, 0.0),
|
||||||
IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1),
|
IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1),
|
||||||
pyHLRShader(), ## this shader draws only visible portions
|
pyHLRShader(), # this shader draws only visible portions
|
||||||
]
|
]
|
||||||
Operators.create(TrueUP1D(), shaders_list)
|
Operators.create(TrueUP1D(), shaders_list)
|
||||||
|
|||||||
@@ -30,11 +30,11 @@ from freestyle.predicates import (
|
|||||||
NotUP1D,
|
NotUP1D,
|
||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
pyNatureUP1D,
|
pyNatureUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
IncreasingColorShader,
|
IncreasingColorShader,
|
||||||
IncreasingThicknessShader,
|
IncreasingThicknessShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import Operators, Nature
|
from freestyle.types import Operators, Nature
|
||||||
|
|
||||||
|
|
||||||
@@ -43,5 +43,5 @@ Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(pyNatureUP1D(Na
|
|||||||
shaders_list = [
|
shaders_list = [
|
||||||
IncreasingThicknessShader(3, 10),
|
IncreasingThicknessShader(3, 10),
|
||||||
IncreasingColorShader(0.0, 0.0, 0.0, 1, 0.8, 0, 0, 1),
|
IncreasingColorShader(0.0, 0.0, 0.0, 1, 0.8, 0, 0, 1),
|
||||||
]
|
]
|
||||||
Operators.create(TrueUP1D(), shaders_list)
|
Operators.create(TrueUP1D(), shaders_list)
|
||||||
|
|||||||
@@ -29,11 +29,11 @@ from freestyle.predicates import (
|
|||||||
QuantitativeInvisibilityUP1D,
|
QuantitativeInvisibilityUP1D,
|
||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
pyZSmallerUP1D,
|
pyZSmallerUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
ConstantColorShader,
|
ConstantColorShader,
|
||||||
ConstantThicknessShader,
|
ConstantThicknessShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import IntegrationType, Operators
|
from freestyle.types import IntegrationType, Operators
|
||||||
|
|
||||||
|
|
||||||
@@ -43,5 +43,5 @@ Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred))
|
|||||||
shaders_list = [
|
shaders_list = [
|
||||||
ConstantThicknessShader(5),
|
ConstantThicknessShader(5),
|
||||||
ConstantColorShader(0.0, 0.0, 0.0),
|
ConstantColorShader(0.0, 0.0, 0.0),
|
||||||
]
|
]
|
||||||
Operators.create(TrueUP1D(), shaders_list)
|
Operators.create(TrueUP1D(), shaders_list)
|
||||||
|
|||||||
@@ -28,18 +28,18 @@ from freestyle.predicates import (
|
|||||||
QuantitativeInvisibilityUP1D,
|
QuantitativeInvisibilityUP1D,
|
||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
pyIsInOccludersListUP1D,
|
pyIsInOccludersListUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
ConstantColorShader,
|
ConstantColorShader,
|
||||||
ConstantThicknessShader,
|
ConstantThicknessShader,
|
||||||
SamplingShader,
|
SamplingShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import Id, Operators
|
from freestyle.types import Id, Operators
|
||||||
|
|
||||||
|
|
||||||
## the id of the occluder (use SHIFT+click on the ViewMap to
|
# the id of the occluder (use SHIFT+click on the ViewMap to
|
||||||
## retrieve ids)
|
# retrieve ids)
|
||||||
id = Id(3,0)
|
id = Id(3, 0)
|
||||||
upred = AndUP1D(NotUP1D(QuantitativeInvisibilityUP1D(0)), pyIsInOccludersListUP1D(id))
|
upred = AndUP1D(NotUP1D(QuantitativeInvisibilityUP1D(0)), pyIsInOccludersListUP1D(id))
|
||||||
Operators.select(upred)
|
Operators.select(upred)
|
||||||
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred))
|
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred))
|
||||||
@@ -47,5 +47,5 @@ shaders_list = [
|
|||||||
SamplingShader(5),
|
SamplingShader(5),
|
||||||
ConstantThicknessShader(3),
|
ConstantThicknessShader(3),
|
||||||
ConstantColorShader(0.3, 0.3, 0.3, 1),
|
ConstantColorShader(0.3, 0.3, 0.3, 1),
|
||||||
]
|
]
|
||||||
Operators.create(TrueUP1D(), shaders_list)
|
Operators.create(TrueUP1D(), shaders_list)
|
||||||
|
|||||||
@@ -26,13 +26,13 @@ from freestyle.predicates import (
|
|||||||
NotUP1D,
|
NotUP1D,
|
||||||
QuantitativeInvisibilityUP1D,
|
QuantitativeInvisibilityUP1D,
|
||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
ConstantColorShader,
|
ConstantColorShader,
|
||||||
ConstantThicknessShader,
|
ConstantThicknessShader,
|
||||||
PolygonalizationShader,
|
PolygonalizationShader,
|
||||||
SamplingShader,
|
SamplingShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import Operators
|
from freestyle.types import Operators
|
||||||
|
|
||||||
|
|
||||||
@@ -43,5 +43,5 @@ shaders_list = [
|
|||||||
ConstantThicknessShader(3),
|
ConstantThicknessShader(3),
|
||||||
ConstantColorShader(0.0, 0.0, 0.0),
|
ConstantColorShader(0.0, 0.0, 0.0),
|
||||||
PolygonalizationShader(8),
|
PolygonalizationShader(8),
|
||||||
]
|
]
|
||||||
Operators.create(TrueUP1D(), shaders_list)
|
Operators.create(TrueUP1D(), shaders_list)
|
||||||
|
|||||||
@@ -27,12 +27,12 @@ from freestyle.predicates import (
|
|||||||
NotUP1D,
|
NotUP1D,
|
||||||
QuantitativeInvisibilityUP1D,
|
QuantitativeInvisibilityUP1D,
|
||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
ConstantColorShader,
|
ConstantColorShader,
|
||||||
ConstantThicknessShader,
|
ConstantThicknessShader,
|
||||||
SamplingShader,
|
SamplingShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import Operators
|
from freestyle.types import Operators
|
||||||
|
|
||||||
|
|
||||||
@@ -42,5 +42,5 @@ shaders_list = [
|
|||||||
SamplingShader(5.0),
|
SamplingShader(5.0),
|
||||||
ConstantThicknessShader(4.0),
|
ConstantThicknessShader(4.0),
|
||||||
ConstantColorShader(0.0, 0.0, 0.0)
|
ConstantColorShader(0.0, 0.0, 0.0)
|
||||||
]
|
]
|
||||||
Operators.create(TrueUP1D(), shaders_list)
|
Operators.create(TrueUP1D(), shaders_list)
|
||||||
|
|||||||
@@ -29,14 +29,14 @@ from freestyle.predicates import (
|
|||||||
NotUP1D,
|
NotUP1D,
|
||||||
QuantitativeInvisibilityUP1D,
|
QuantitativeInvisibilityUP1D,
|
||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
BackboneStretcherShader,
|
BackboneStretcherShader,
|
||||||
IncreasingColorShader,
|
IncreasingColorShader,
|
||||||
IncreasingThicknessShader,
|
IncreasingThicknessShader,
|
||||||
SamplingShader,
|
SamplingShader,
|
||||||
SpatialNoiseShader,
|
SpatialNoiseShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import Operators
|
from freestyle.types import Operators
|
||||||
|
|
||||||
|
|
||||||
@@ -49,5 +49,5 @@ shaders_list = [
|
|||||||
IncreasingThicknessShader(2, 5),
|
IncreasingThicknessShader(2, 5),
|
||||||
BackboneStretcherShader(20),
|
BackboneStretcherShader(20),
|
||||||
IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1),
|
IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1),
|
||||||
]
|
]
|
||||||
Operators.create(TrueUP1D(), shaders_list)
|
Operators.create(TrueUP1D(), shaders_list)
|
||||||
|
|||||||
@@ -28,12 +28,12 @@ from freestyle.predicates import (
|
|||||||
NotUP1D,
|
NotUP1D,
|
||||||
QuantitativeInvisibilityUP1D,
|
QuantitativeInvisibilityUP1D,
|
||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
ConstantColorShader,
|
ConstantColorShader,
|
||||||
ConstantThicknessShader,
|
ConstantThicknessShader,
|
||||||
SamplingShader,
|
SamplingShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import Operators
|
from freestyle.types import Operators
|
||||||
|
|
||||||
|
|
||||||
@@ -43,5 +43,5 @@ shaders_list = [
|
|||||||
SamplingShader(5.0),
|
SamplingShader(5.0),
|
||||||
ConstantThicknessShader(3),
|
ConstantThicknessShader(3),
|
||||||
ConstantColorShader(0.5, 0.5, 0.5, 1)
|
ConstantColorShader(0.5, 0.5, 0.5, 1)
|
||||||
]
|
]
|
||||||
Operators.create(TrueUP1D(), shaders_list)
|
Operators.create(TrueUP1D(), shaders_list)
|
||||||
|
|||||||
@@ -28,12 +28,12 @@ from freestyle.predicates import (
|
|||||||
NotUP1D,
|
NotUP1D,
|
||||||
QuantitativeInvisibilityUP1D,
|
QuantitativeInvisibilityUP1D,
|
||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
ConstantColorShader,
|
ConstantColorShader,
|
||||||
ConstantThicknessShader,
|
ConstantThicknessShader,
|
||||||
SamplingShader,
|
SamplingShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import Operators
|
from freestyle.types import Operators
|
||||||
|
|
||||||
|
|
||||||
@@ -43,5 +43,5 @@ shaders_list = [
|
|||||||
SamplingShader(10),
|
SamplingShader(10),
|
||||||
ConstantThicknessShader(1.5),
|
ConstantThicknessShader(1.5),
|
||||||
ConstantColorShader(0.7, 0.7, 0.7, 1),
|
ConstantColorShader(0.7, 0.7, 0.7, 1),
|
||||||
]
|
]
|
||||||
Operators.create(TrueUP1D(), shaders_list)
|
Operators.create(TrueUP1D(), shaders_list)
|
||||||
|
|||||||
@@ -30,19 +30,19 @@ from freestyle.predicates import (
|
|||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
pyBackTVertexUP0D,
|
pyBackTVertexUP0D,
|
||||||
pyVertexNatureUP0D,
|
pyVertexNatureUP0D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
ConstantColorShader,
|
ConstantColorShader,
|
||||||
IncreasingThicknessShader,
|
IncreasingThicknessShader,
|
||||||
SpatialNoiseShader,
|
SpatialNoiseShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import Nature, Operators
|
from freestyle.types import Nature, Operators
|
||||||
|
|
||||||
|
|
||||||
upred = QuantitativeInvisibilityUP1D(0)
|
upred = QuantitativeInvisibilityUP1D(0)
|
||||||
Operators.select(upred)
|
Operators.select(upred)
|
||||||
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred))
|
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred))
|
||||||
## starting and stopping predicates:
|
# starting and stopping predicates:
|
||||||
start = pyVertexNatureUP0D(Nature.NON_T_VERTEX)
|
start = pyVertexNatureUP0D(Nature.NON_T_VERTEX)
|
||||||
stop = pyBackTVertexUP0D()
|
stop = pyBackTVertexUP0D()
|
||||||
Operators.sequential_split(start, stop, 10)
|
Operators.sequential_split(start, stop, 10)
|
||||||
@@ -50,5 +50,5 @@ shaders_list = [
|
|||||||
SpatialNoiseShader(7, 120, 2, True, True),
|
SpatialNoiseShader(7, 120, 2, True, True),
|
||||||
IncreasingThicknessShader(5, 8),
|
IncreasingThicknessShader(5, 8),
|
||||||
ConstantColorShader(0.2, 0.2, 0.2, 1),
|
ConstantColorShader(0.2, 0.2, 0.2, 1),
|
||||||
]
|
]
|
||||||
Operators.create(TrueUP1D(), shaders_list)
|
Operators.create(TrueUP1D(), shaders_list)
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ from freestyle.chainingiterators import pySketchyChainSilhouetteIterator
|
|||||||
from freestyle.predicates import (
|
from freestyle.predicates import (
|
||||||
QuantitativeInvisibilityUP1D,
|
QuantitativeInvisibilityUP1D,
|
||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
IncreasingColorShader,
|
IncreasingColorShader,
|
||||||
IncreasingThicknessShader,
|
IncreasingThicknessShader,
|
||||||
@@ -35,7 +35,7 @@ from freestyle.shaders import (
|
|||||||
SmoothingShader,
|
SmoothingShader,
|
||||||
SpatialNoiseShader,
|
SpatialNoiseShader,
|
||||||
pyHLRShader,
|
pyHLRShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import Operators
|
from freestyle.types import Operators
|
||||||
|
|
||||||
|
|
||||||
@@ -48,5 +48,5 @@ shaders_list = [
|
|||||||
SmoothingShader(100, 0.05, 0, 0.2, 0, 0, 0, 1),
|
SmoothingShader(100, 0.05, 0, 0.2, 0, 0, 0, 1),
|
||||||
IncreasingColorShader(0, 0.2, 0, 1, 0.2, 0.7, 0.2, 1),
|
IncreasingColorShader(0, 0.2, 0, 1, 0.2, 0.7, 0.2, 1),
|
||||||
pyHLRShader(),
|
pyHLRShader(),
|
||||||
]
|
]
|
||||||
Operators.create(TrueUP1D(), shaders_list)
|
Operators.create(TrueUP1D(), shaders_list)
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ from freestyle.chainingiterators import pySketchyChainingIterator
|
|||||||
from freestyle.predicates import (
|
from freestyle.predicates import (
|
||||||
QuantitativeInvisibilityUP1D,
|
QuantitativeInvisibilityUP1D,
|
||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
IncreasingColorShader,
|
IncreasingColorShader,
|
||||||
IncreasingThicknessShader,
|
IncreasingThicknessShader,
|
||||||
@@ -35,13 +35,13 @@ from freestyle.shaders import (
|
|||||||
SmoothingShader,
|
SmoothingShader,
|
||||||
SpatialNoiseShader,
|
SpatialNoiseShader,
|
||||||
pyBackboneStretcherNoCuspShader,
|
pyBackboneStretcherNoCuspShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import Operators
|
from freestyle.types import Operators
|
||||||
|
|
||||||
|
|
||||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||||
## Chain 3 times each ViewEdge independently from the
|
# Chain 3 times each ViewEdge independently from the
|
||||||
## initial objects topology
|
# initial objects topology
|
||||||
Operators.bidirectional_chain(pySketchyChainingIterator(3))
|
Operators.bidirectional_chain(pySketchyChainingIterator(3))
|
||||||
shaders_list = [
|
shaders_list = [
|
||||||
SamplingShader(4),
|
SamplingShader(4),
|
||||||
@@ -50,5 +50,5 @@ shaders_list = [
|
|||||||
SmoothingShader(100, 0.1, 0, 0.2, 0, 0, 0, 1),
|
SmoothingShader(100, 0.1, 0, 0.2, 0, 0, 0, 1),
|
||||||
pyBackboneStretcherNoCuspShader(20),
|
pyBackboneStretcherNoCuspShader(20),
|
||||||
IncreasingColorShader(0.2, 0.2, 0.2, 1, 0.5, 0.5, 0.5, 1),
|
IncreasingColorShader(0.2, 0.2, 0.2, 1, 0.5, 0.5, 0.5, 1),
|
||||||
]
|
]
|
||||||
Operators.create(TrueUP1D(), shaders_list)
|
Operators.create(TrueUP1D(), shaders_list)
|
||||||
|
|||||||
@@ -27,14 +27,14 @@ from freestyle.chainingiterators import pySketchyChainSilhouetteIterator
|
|||||||
from freestyle.predicates import (
|
from freestyle.predicates import (
|
||||||
QuantitativeInvisibilityUP1D,
|
QuantitativeInvisibilityUP1D,
|
||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
ConstantColorShader,
|
ConstantColorShader,
|
||||||
IncreasingThicknessShader,
|
IncreasingThicknessShader,
|
||||||
SamplingShader,
|
SamplingShader,
|
||||||
SmoothingShader,
|
SmoothingShader,
|
||||||
SpatialNoiseShader,
|
SpatialNoiseShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import Operators
|
from freestyle.types import Operators
|
||||||
|
|
||||||
|
|
||||||
@@ -47,5 +47,5 @@ shaders_list = [
|
|||||||
IncreasingThicknessShader(4, 8),
|
IncreasingThicknessShader(4, 8),
|
||||||
SmoothingShader(300, 0.05, 0, 0.2, 0, 0, 0, 0.5),
|
SmoothingShader(300, 0.05, 0, 0.2, 0, 0, 0, 0.5),
|
||||||
ConstantColorShader(0.6, 0.2, 0.0),
|
ConstantColorShader(0.6, 0.2, 0.0),
|
||||||
]
|
]
|
||||||
Operators.create(TrueUP1D(), shaders_list)
|
Operators.create(TrueUP1D(), shaders_list)
|
||||||
|
|||||||
@@ -27,22 +27,22 @@ from freestyle.predicates import (
|
|||||||
QuantitativeInvisibilityUP1D,
|
QuantitativeInvisibilityUP1D,
|
||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
pyVertexNatureUP0D,
|
pyVertexNatureUP0D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
ConstantThicknessShader,
|
ConstantThicknessShader,
|
||||||
IncreasingColorShader,
|
IncreasingColorShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import Nature, Operators
|
from freestyle.types import Nature, Operators
|
||||||
|
|
||||||
|
|
||||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||||
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||||
start = pyVertexNatureUP0D(Nature.T_VERTEX)
|
start = pyVertexNatureUP0D(Nature.T_VERTEX)
|
||||||
## use the same predicate to decide where to start and where to stop
|
# use the same predicate to decide where to start and where to stop
|
||||||
## the strokes:
|
# the strokes:
|
||||||
Operators.sequential_split(start, start, 10)
|
Operators.sequential_split(start, start, 10)
|
||||||
shaders_list = [
|
shaders_list = [
|
||||||
ConstantThicknessShader(5),
|
ConstantThicknessShader(5),
|
||||||
IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1),
|
IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1),
|
||||||
]
|
]
|
||||||
Operators.create(TrueUP1D(), shaders_list)
|
Operators.create(TrueUP1D(), shaders_list)
|
||||||
|
|||||||
@@ -30,11 +30,11 @@ from freestyle.predicates import (
|
|||||||
QuantitativeInvisibilityUP1D,
|
QuantitativeInvisibilityUP1D,
|
||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
pyNatureUP1D,
|
pyNatureUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
ConstantColorShader,
|
ConstantColorShader,
|
||||||
IncreasingThicknessShader,
|
IncreasingThicknessShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import Nature, Operators
|
from freestyle.types import Nature, Operators
|
||||||
|
|
||||||
|
|
||||||
@@ -44,5 +44,5 @@ Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred))
|
|||||||
shaders_list = [
|
shaders_list = [
|
||||||
IncreasingThicknessShader(1, 3),
|
IncreasingThicknessShader(1, 3),
|
||||||
ConstantColorShader(0.2, 0.2, 0.2, 1),
|
ConstantColorShader(0.2, 0.2, 0.2, 1),
|
||||||
]
|
]
|
||||||
Operators.create(TrueUP1D(), shaders_list)
|
Operators.create(TrueUP1D(), shaders_list)
|
||||||
|
|||||||
@@ -26,13 +26,13 @@ from freestyle.predicates import (
|
|||||||
NotUP1D,
|
NotUP1D,
|
||||||
QuantitativeInvisibilityUP1D,
|
QuantitativeInvisibilityUP1D,
|
||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
ConstantColorShader,
|
ConstantColorShader,
|
||||||
ConstantThicknessShader,
|
ConstantThicknessShader,
|
||||||
SamplingShader,
|
SamplingShader,
|
||||||
pyDepthDiscontinuityThicknessShader,
|
pyDepthDiscontinuityThicknessShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import Operators
|
from freestyle.types import Operators
|
||||||
|
|
||||||
|
|
||||||
@@ -43,5 +43,5 @@ shaders_list = [
|
|||||||
ConstantThicknessShader(3),
|
ConstantThicknessShader(3),
|
||||||
ConstantColorShader(0.0, 0.0, 0.0),
|
ConstantColorShader(0.0, 0.0, 0.0),
|
||||||
pyDepthDiscontinuityThicknessShader(0.8, 6),
|
pyDepthDiscontinuityThicknessShader(0.8, 6),
|
||||||
]
|
]
|
||||||
Operators.create(TrueUP1D(), shaders_list)
|
Operators.create(TrueUP1D(), shaders_list)
|
||||||
|
|||||||
@@ -26,13 +26,13 @@ from freestyle.predicates import (
|
|||||||
NotUP1D,
|
NotUP1D,
|
||||||
QuantitativeInvisibilityUP1D,
|
QuantitativeInvisibilityUP1D,
|
||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
ConstantColorShader,
|
ConstantColorShader,
|
||||||
ConstantThicknessShader,
|
ConstantThicknessShader,
|
||||||
SamplingShader,
|
SamplingShader,
|
||||||
TipRemoverShader,
|
TipRemoverShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import Operators
|
from freestyle.types import Operators
|
||||||
|
|
||||||
|
|
||||||
@@ -43,5 +43,5 @@ shaders_list = [
|
|||||||
ConstantThicknessShader(3),
|
ConstantThicknessShader(3),
|
||||||
ConstantColorShader(0, 0, 0),
|
ConstantColorShader(0, 0, 0),
|
||||||
TipRemoverShader(20),
|
TipRemoverShader(20),
|
||||||
]
|
]
|
||||||
Operators.create(TrueUP1D(), shaders_list)
|
Operators.create(TrueUP1D(), shaders_list)
|
||||||
|
|||||||
@@ -26,13 +26,13 @@ from freestyle.predicates import (
|
|||||||
NotUP1D,
|
NotUP1D,
|
||||||
QuantitativeInvisibilityUP1D,
|
QuantitativeInvisibilityUP1D,
|
||||||
TrueUP1D,
|
TrueUP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
ConstantColorShader,
|
ConstantColorShader,
|
||||||
IncreasingThicknessShader,
|
IncreasingThicknessShader,
|
||||||
SamplingShader,
|
SamplingShader,
|
||||||
pyTVertexRemoverShader,
|
pyTVertexRemoverShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import Operators
|
from freestyle.types import Operators
|
||||||
|
|
||||||
|
|
||||||
@@ -43,5 +43,5 @@ shaders_list = [
|
|||||||
ConstantColorShader(0.2, 0.2, 0.2, 1),
|
ConstantColorShader(0.2, 0.2, 0.2, 1),
|
||||||
SamplingShader(10.0),
|
SamplingShader(10.0),
|
||||||
pyTVertexRemoverShader(),
|
pyTVertexRemoverShader(),
|
||||||
]
|
]
|
||||||
Operators.create(TrueUP1D(), shaders_list)
|
Operators.create(TrueUP1D(), shaders_list)
|
||||||
|
|||||||
@@ -25,12 +25,12 @@ from freestyle.predicates import (
|
|||||||
QuantitativeInvisibilityUP1D,
|
QuantitativeInvisibilityUP1D,
|
||||||
pyDensityUP1D,
|
pyDensityUP1D,
|
||||||
pyZBP1D,
|
pyZBP1D,
|
||||||
)
|
)
|
||||||
from freestyle.shaders import (
|
from freestyle.shaders import (
|
||||||
ConstantColorShader,
|
ConstantColorShader,
|
||||||
ConstantThicknessShader,
|
ConstantThicknessShader,
|
||||||
SamplingShader,
|
SamplingShader,
|
||||||
)
|
)
|
||||||
from freestyle.types import IntegrationType, Operators, Stroke
|
from freestyle.types import IntegrationType, Operators, Stroke
|
||||||
|
|
||||||
|
|
||||||
@@ -42,5 +42,5 @@ shaders_list = [
|
|||||||
ConstantThicknessShader(3),
|
ConstantThicknessShader(3),
|
||||||
SamplingShader(5.0),
|
SamplingShader(5.0),
|
||||||
ConstantColorShader(0, 0, 0, 1),
|
ConstantColorShader(0, 0, 0, 1),
|
||||||
]
|
]
|
||||||
Operators.create(pyDensityUP1D(2, 0.05, IntegrationType.MEAN, 4), shaders_list)
|
Operators.create(pyDensityUP1D(2, 0.05, IntegrationType.MEAN, 4), shaders_list)
|
||||||
|
|||||||
@@ -80,7 +80,10 @@ class DataPathBuilder:
|
|||||||
base_new = Ellipsis
|
base_new = Ellipsis
|
||||||
# find the new name
|
# find the new name
|
||||||
if item.startswith("."):
|
if item.startswith("."):
|
||||||
for class_name, item_new, options in rna_update_from_map.get(item[1:], []) + [(None, item[1:], None)]:
|
for class_name, item_new, options in (
|
||||||
|
rna_update_from_map.get(item[1:], []) +
|
||||||
|
[(None, item[1:], None)]
|
||||||
|
):
|
||||||
if callable(item_new):
|
if callable(item_new):
|
||||||
# No type check here, callback is assumed to know what it's doing.
|
# No type check here, callback is assumed to know what it's doing.
|
||||||
base_new, item_new = item_new(base, class_name, item[1:], fcurve, options)
|
base_new, item_new = item_new(base, class_name, item[1:], fcurve, options)
|
||||||
|
|||||||
@@ -37,27 +37,27 @@ import ctypes
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
||||||
#define FRIBIDI_MASK_NEUTRAL 0x00000040L /* Is neutral */
|
# define FRIBIDI_MASK_NEUTRAL 0x00000040L /* Is neutral */
|
||||||
FRIBIDI_PAR_ON = 0x00000040
|
FRIBIDI_PAR_ON = 0x00000040
|
||||||
|
|
||||||
|
|
||||||
#define FRIBIDI_FLAG_SHAPE_MIRRORING 0x00000001
|
# define FRIBIDI_FLAG_SHAPE_MIRRORING 0x00000001
|
||||||
#define FRIBIDI_FLAG_REORDER_NSM 0x00000002
|
# define FRIBIDI_FLAG_REORDER_NSM 0x00000002
|
||||||
|
|
||||||
#define FRIBIDI_FLAG_SHAPE_ARAB_PRES 0x00000100
|
# define FRIBIDI_FLAG_SHAPE_ARAB_PRES 0x00000100
|
||||||
#define FRIBIDI_FLAG_SHAPE_ARAB_LIGA 0x00000200
|
# define FRIBIDI_FLAG_SHAPE_ARAB_LIGA 0x00000200
|
||||||
#define FRIBIDI_FLAG_SHAPE_ARAB_CONSOLE 0x00000400
|
# define FRIBIDI_FLAG_SHAPE_ARAB_CONSOLE 0x00000400
|
||||||
|
|
||||||
#define FRIBIDI_FLAG_REMOVE_BIDI 0x00010000
|
# define FRIBIDI_FLAG_REMOVE_BIDI 0x00010000
|
||||||
#define FRIBIDI_FLAG_REMOVE_JOINING 0x00020000
|
# define FRIBIDI_FLAG_REMOVE_JOINING 0x00020000
|
||||||
#define FRIBIDI_FLAG_REMOVE_SPECIALS 0x00040000
|
# define FRIBIDI_FLAG_REMOVE_SPECIALS 0x00040000
|
||||||
|
|
||||||
#define FRIBIDI_FLAGS_DEFAULT ( \
|
# define FRIBIDI_FLAGS_DEFAULT ( \
|
||||||
# FRIBIDI_FLAG_SHAPE_MIRRORING | \
|
# FRIBIDI_FLAG_SHAPE_MIRRORING | \
|
||||||
# FRIBIDI_FLAG_REORDER_NSM | \
|
# FRIBIDI_FLAG_REORDER_NSM | \
|
||||||
# FRIBIDI_FLAG_REMOVE_SPECIALS )
|
# FRIBIDI_FLAG_REMOVE_SPECIALS )
|
||||||
|
|
||||||
#define FRIBIDI_FLAGS_ARABIC ( \
|
# define FRIBIDI_FLAGS_ARABIC ( \
|
||||||
# FRIBIDI_FLAG_SHAPE_ARAB_PRES | \
|
# FRIBIDI_FLAG_SHAPE_ARAB_PRES | \
|
||||||
# FRIBIDI_FLAG_SHAPE_ARAB_LIGA )
|
# FRIBIDI_FLAG_SHAPE_ARAB_LIGA )
|
||||||
|
|
||||||
|
|||||||
@@ -211,7 +211,8 @@ def do_previews(do_objects, do_collections, do_scenes, do_data_intern):
|
|||||||
bpy.data.lights.remove(bpy.data.lights[render_context.light_data, None])
|
bpy.data.lights.remove(bpy.data.lights[render_context.light_data, None])
|
||||||
else:
|
else:
|
||||||
rna_backup_restore(light, render_context.backup_light)
|
rna_backup_restore(light, render_context.backup_light)
|
||||||
rna_backup_restore(bpy.data.lights[render_context.light_data, None], render_context.backup_light_data)
|
rna_backup_restore(bpy.data.lights[render_context.light_data,
|
||||||
|
None], render_context.backup_light_data)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("ERROR:", e)
|
print("ERROR:", e)
|
||||||
success = False
|
success = False
|
||||||
@@ -229,7 +230,8 @@ def do_previews(do_objects, do_collections, do_scenes, do_data_intern):
|
|||||||
def object_bbox_merge(bbox, ob, ob_space, offset_matrix):
|
def object_bbox_merge(bbox, ob, ob_space, offset_matrix):
|
||||||
# Take collections instances into account (including linked one in this case).
|
# Take collections instances into account (including linked one in this case).
|
||||||
if ob.type == 'EMPTY' and ob.instance_type == 'COLLECTION':
|
if ob.type == 'EMPTY' and ob.instance_type == 'COLLECTION':
|
||||||
grp_objects = tuple((ob.name, ob.library.filepath if ob.library else None) for ob in ob.instance_collection.all_objects)
|
grp_objects = tuple((ob.name, ob.library.filepath if ob.library else None)
|
||||||
|
for ob in ob.instance_collection.all_objects)
|
||||||
if (len(grp_objects) == 0):
|
if (len(grp_objects) == 0):
|
||||||
ob_bbox = ob.bound_box
|
ob_bbox = ob.bound_box
|
||||||
else:
|
else:
|
||||||
@@ -390,7 +392,10 @@ def do_previews(do_objects, do_collections, do_scenes, do_data_intern):
|
|||||||
bpy.context.window.scene = scene
|
bpy.context.window.scene = scene
|
||||||
|
|
||||||
bpy.ops.object.collection_instance_add(collection=grp.name)
|
bpy.ops.object.collection_instance_add(collection=grp.name)
|
||||||
grp_ob = next((ob for ob in scene.objects if ob.instance_collection and ob.instance_collection.name == grp.name))
|
grp_ob = next((
|
||||||
|
ob for ob in scene.objects
|
||||||
|
if ob.instance_collection and ob.instance_collection.name == grp.name
|
||||||
|
))
|
||||||
grp_obname = grp_ob.name
|
grp_obname = grp_ob.name
|
||||||
bpy.context.view_layer.update()
|
bpy.context.view_layer.update()
|
||||||
|
|
||||||
@@ -470,7 +475,8 @@ def main():
|
|||||||
# Get rid of Blender args!
|
# Get rid of Blender args!
|
||||||
argv = sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else []
|
argv = sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else []
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description="Use Blender to generate previews for currently open Blender file's items.")
|
parser = argparse.ArgumentParser(
|
||||||
|
description="Use Blender to generate previews for currently open Blender file's items.")
|
||||||
parser.add_argument('--clear', default=False, action="store_true",
|
parser.add_argument('--clear', default=False, action="store_true",
|
||||||
help="Clear previews instead of generating them.")
|
help="Clear previews instead of generating them.")
|
||||||
parser.add_argument('--no_backups', default=False, action="store_true",
|
parser.add_argument('--no_backups', default=False, action="store_true",
|
||||||
|
|||||||
@@ -78,9 +78,10 @@ def draw_texture_2d(texture_id, position, width, height):
|
|||||||
coords = ((0, 0), (1, 0), (1, 1), (0, 1))
|
coords = ((0, 0), (1, 0), (1, 1), (0, 1))
|
||||||
|
|
||||||
shader = gpu.shader.from_builtin('2D_IMAGE')
|
shader = gpu.shader.from_builtin('2D_IMAGE')
|
||||||
batch = batch_for_shader(shader, 'TRI_FAN',
|
batch = batch_for_shader(
|
||||||
{"pos" : coords,
|
shader, 'TRI_FAN',
|
||||||
"texCoord" : coords})
|
{"pos": coords, "texCoord": coords},
|
||||||
|
)
|
||||||
|
|
||||||
bgl.glActiveTexture(bgl.GL_TEXTURE0)
|
bgl.glActiveTexture(bgl.GL_TEXTURE0)
|
||||||
bgl.glBindTexture(bgl.GL_TEXTURE_2D, texture_id)
|
bgl.glBindTexture(bgl.GL_TEXTURE_2D, texture_id)
|
||||||
|
|||||||
@@ -80,7 +80,13 @@ def graph_armature(obj, filepath, FAKE_PARENT=True, CONSTRAINTS=True, DRIVERS=Tr
|
|||||||
|
|
||||||
label.append("%s = %s" % (key, value))
|
label.append("%s = %s" % (key, value))
|
||||||
|
|
||||||
opts = ["shape=box", "regular=1", "style=filled", "fixedsize=false", 'label="%s"' % compat_str('\n'.join(label))]
|
opts = [
|
||||||
|
"shape=box",
|
||||||
|
"regular=1",
|
||||||
|
"style=filled",
|
||||||
|
"fixedsize=false",
|
||||||
|
'label="%s"' % compat_str('\n'.join(label)),
|
||||||
|
]
|
||||||
|
|
||||||
if bone.name.startswith('ORG'):
|
if bone.name.startswith('ORG'):
|
||||||
opts.append("fillcolor=yellow")
|
opts.append("fillcolor=yellow")
|
||||||
@@ -125,7 +131,15 @@ def graph_armature(obj, filepath, FAKE_PARENT=True, CONSTRAINTS=True, DRIVERS=Tr
|
|||||||
subtarget = getattr(constraint, "subtarget", "")
|
subtarget = getattr(constraint, "subtarget", "")
|
||||||
if subtarget:
|
if subtarget:
|
||||||
# TODO, not internal links
|
# TODO, not internal links
|
||||||
opts = ['dir=forward', "weight=1", "arrowhead=normal", "arrowtail=none", "constraint=false", 'color="red"', 'labelfontsize=4']
|
opts = [
|
||||||
|
'dir=forward',
|
||||||
|
"weight=1",
|
||||||
|
"arrowhead=normal",
|
||||||
|
"arrowtail=none",
|
||||||
|
"constraint=false",
|
||||||
|
'color="red"',
|
||||||
|
'labelfontsize=4',
|
||||||
|
]
|
||||||
if XTRA_INFO:
|
if XTRA_INFO:
|
||||||
label = "%s\n%s" % (constraint.type, constraint.name)
|
label = "%s\n%s" % (constraint.type, constraint.name)
|
||||||
opts.append('label="%s"' % compat_str(label))
|
opts.append('label="%s"' % compat_str(label))
|
||||||
@@ -160,7 +174,15 @@ def graph_armature(obj, filepath, FAKE_PARENT=True, CONSTRAINTS=True, DRIVERS=Tr
|
|||||||
pbone_target = rna_path_as_pbone(target.data_path)
|
pbone_target = rna_path_as_pbone(target.data_path)
|
||||||
rna_path_target = target.data_path
|
rna_path_target = target.data_path
|
||||||
if pbone_target:
|
if pbone_target:
|
||||||
opts = ['dir=forward', "weight=1", "arrowhead=normal", "arrowtail=none", "constraint=false", 'color="blue"', "labelfontsize=4"]
|
opts = [
|
||||||
|
'dir=forward',
|
||||||
|
"weight=1",
|
||||||
|
"arrowhead=normal",
|
||||||
|
"arrowtail=none",
|
||||||
|
"constraint=false",
|
||||||
|
'color="blue"',
|
||||||
|
"labelfontsize=4",
|
||||||
|
]
|
||||||
display_source = rna_path.replace("pose.bones", "")
|
display_source = rna_path.replace("pose.bones", "")
|
||||||
display_target = rna_path_target.replace("pose.bones", "")
|
display_target = rna_path_target.replace("pose.bones", "")
|
||||||
if XTRA_INFO:
|
if XTRA_INFO:
|
||||||
|
|||||||
@@ -625,6 +625,7 @@ class QuickParticles(Operator):
|
|||||||
pointcloud_object.show_bounds = True
|
pointcloud_object.show_bounds = True
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
classes = (
|
classes = (
|
||||||
QuickExplode,
|
QuickExplode,
|
||||||
QuickFur,
|
QuickFur,
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class HAIR_MT_add_attribute(Menu):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def add_standard_attribute(layout, hair, name, data_type, domain):
|
def add_standard_attribute(layout, hair, name, data_type, domain):
|
||||||
exists = hair.attributes.get(name) != None
|
exists = hair.attributes.get(name) is not None
|
||||||
|
|
||||||
col = layout.column()
|
col = layout.column()
|
||||||
col.enabled = not exists
|
col.enabled = not exists
|
||||||
@@ -106,14 +106,21 @@ class DATA_PT_hair_attributes(DataButtonsPanel, Panel):
|
|||||||
row = layout.row()
|
row = layout.row()
|
||||||
|
|
||||||
col = row.column()
|
col = row.column()
|
||||||
col.template_list("HAIR_UL_attributes", "attributes", hair, "attributes", hair.attributes, "active_index", rows=3)
|
col.template_list(
|
||||||
|
"HAIR_UL_attributes",
|
||||||
|
"attributes",
|
||||||
|
hair,
|
||||||
|
"attributes",
|
||||||
|
hair.attributes,
|
||||||
|
"active_index",
|
||||||
|
rows=3,
|
||||||
|
)
|
||||||
|
|
||||||
col = row.column(align=True)
|
col = row.column(align=True)
|
||||||
col.menu("HAIR_MT_add_attribute", icon='ADD', text="")
|
col.menu("HAIR_MT_add_attribute", icon='ADD', text="")
|
||||||
col.operator("geometry.attribute_remove", icon='REMOVE', text="")
|
col.operator("geometry.attribute_remove", icon='REMOVE', text="")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class DATA_PT_custom_props_hair(DataButtonsPanel, PropertyPanel, Panel):
|
class DATA_PT_custom_props_hair(DataButtonsPanel, PropertyPanel, Panel):
|
||||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
|
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
|
||||||
_context_path = "object.data"
|
_context_path = "object.data"
|
||||||
|
|||||||
@@ -478,7 +478,15 @@ class DATA_PT_sculpt_vertex_colors(MeshButtonsPanel, Panel):
|
|||||||
row = layout.row()
|
row = layout.row()
|
||||||
col = row.column()
|
col = row.column()
|
||||||
|
|
||||||
col.template_list("MESH_UL_vcols", "svcols", me, "sculpt_vertex_colors", me.sculpt_vertex_colors, "active_index", rows=2)
|
col.template_list(
|
||||||
|
"MESH_UL_vcols",
|
||||||
|
"svcols",
|
||||||
|
me,
|
||||||
|
"sculpt_vertex_colors",
|
||||||
|
me.sculpt_vertex_colors,
|
||||||
|
"active_index",
|
||||||
|
rows=2,
|
||||||
|
)
|
||||||
|
|
||||||
col = row.column(align=True)
|
col = row.column(align=True)
|
||||||
col.operator("mesh.sculpt_vertex_color_add", icon='ADD', text="")
|
col.operator("mesh.sculpt_vertex_color_add", icon='ADD', text="")
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class POINTCLOUD_MT_add_attribute(Menu):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def add_standard_attribute(layout, pointcloud, name, data_type, domain):
|
def add_standard_attribute(layout, pointcloud, name, data_type, domain):
|
||||||
exists = pointcloud.attributes.get(name) != None
|
exists = pointcloud.attributes.get(name) is not None
|
||||||
|
|
||||||
col = layout.column()
|
col = layout.column()
|
||||||
col.enabled = not exists
|
col.enabled = not exists
|
||||||
@@ -105,14 +105,21 @@ class DATA_PT_pointcloud_attributes(DataButtonsPanel, Panel):
|
|||||||
row = layout.row()
|
row = layout.row()
|
||||||
|
|
||||||
col = row.column()
|
col = row.column()
|
||||||
col.template_list("POINTCLOUD_UL_attributes", "attributes", pointcloud, "attributes", pointcloud.attributes, "active_index", rows=3)
|
col.template_list(
|
||||||
|
"POINTCLOUD_UL_attributes",
|
||||||
|
"attributes",
|
||||||
|
pointcloud,
|
||||||
|
"attributes",
|
||||||
|
pointcloud.attributes,
|
||||||
|
"active_index",
|
||||||
|
rows=3,
|
||||||
|
)
|
||||||
|
|
||||||
col = row.column(align=True)
|
col = row.column(align=True)
|
||||||
col.menu("POINTCLOUD_MT_add_attribute", icon='ADD', text="")
|
col.menu("POINTCLOUD_MT_add_attribute", icon='ADD', text="")
|
||||||
col.operator("geometry.attribute_remove", icon='REMOVE', text="")
|
col.operator("geometry.attribute_remove", icon='REMOVE', text="")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class DATA_PT_custom_props_pointcloud(DataButtonsPanel, PropertyPanel, Panel):
|
class DATA_PT_custom_props_pointcloud(DataButtonsPanel, PropertyPanel, Panel):
|
||||||
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
|
COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
|
||||||
_context_path = "object.data"
|
_context_path = "object.data"
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class RenderFreestyleButtonsPanel:
|
|||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
scene = context.scene
|
scene = context.scene
|
||||||
with_freestyle = bpy.app.build_options.freestyle
|
with_freestyle = bpy.app.build_options.freestyle
|
||||||
return scene and with_freestyle and(context.engine in cls.COMPAT_ENGINES)
|
return scene and with_freestyle and (context.engine in cls.COMPAT_ENGINES)
|
||||||
|
|
||||||
|
|
||||||
class RENDER_PT_freestyle(RenderFreestyleButtonsPanel, Panel):
|
class RENDER_PT_freestyle(RenderFreestyleButtonsPanel, Panel):
|
||||||
|
|||||||
@@ -814,7 +814,7 @@ class GPENCIL_MT_layer_mask_menu(Menu):
|
|||||||
for gpl in gpd.layers:
|
for gpl in gpd.layers:
|
||||||
if gpl != gpl_active and gpl.info not in gpl_active.mask_layers:
|
if gpl != gpl_active and gpl.info not in gpl_active.mask_layers:
|
||||||
done = True
|
done = True
|
||||||
layout.operator("gpencil.layer_mask_add", text=gpl.info).name=gpl.info
|
layout.operator("gpencil.layer_mask_add", text=gpl.info).name = gpl.info
|
||||||
|
|
||||||
if done is False:
|
if done is False:
|
||||||
layout.label(text="No layers to add")
|
layout.label(text="No layers to add")
|
||||||
|
|||||||
@@ -549,8 +549,8 @@ def brush_settings(layout, context, brush, popover=False):
|
|||||||
|
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.prop(brush, "hardness", slider=True)
|
row.prop(brush, "hardness", slider=True)
|
||||||
row.prop(brush, "invert_hardness_pressure", text = "")
|
row.prop(brush, "invert_hardness_pressure", text="")
|
||||||
row.prop(brush, "use_hardness_pressure", text = "")
|
row.prop(brush, "use_hardness_pressure", text="")
|
||||||
|
|
||||||
# auto_smooth_factor and use_inverse_smooth_pressure
|
# auto_smooth_factor and use_inverse_smooth_pressure
|
||||||
if capabilities.has_auto_smooth:
|
if capabilities.has_auto_smooth:
|
||||||
@@ -698,23 +698,23 @@ def brush_settings(layout, context, brush, popover=False):
|
|||||||
elif sculpt_tool == 'PAINT':
|
elif sculpt_tool == 'PAINT':
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.prop(brush, "flow")
|
row.prop(brush, "flow")
|
||||||
row.prop(brush, "invert_flow_pressure", text = "")
|
row.prop(brush, "invert_flow_pressure", text="")
|
||||||
row.prop(brush, "use_flow_pressure", text= "")
|
row.prop(brush, "use_flow_pressure", text="")
|
||||||
|
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.prop(brush, "wet_mix")
|
row.prop(brush, "wet_mix")
|
||||||
row.prop(brush, "invert_wet_mix_pressure", text = "")
|
row.prop(brush, "invert_wet_mix_pressure", text="")
|
||||||
row.prop(brush, "use_wet_mix_pressure", text = "")
|
row.prop(brush, "use_wet_mix_pressure", text="")
|
||||||
|
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.prop(brush, "wet_persistence")
|
row.prop(brush, "wet_persistence")
|
||||||
row.prop(brush, "invert_wet_persistence_pressure", text ="")
|
row.prop(brush, "invert_wet_persistence_pressure", text="")
|
||||||
row.prop(brush, "use_wet_persistence_pressure", text= "")
|
row.prop(brush, "use_wet_persistence_pressure", text="")
|
||||||
|
|
||||||
row = layout.row(align=True)
|
row = layout.row(align=True)
|
||||||
row.prop(brush, "density")
|
row.prop(brush, "density")
|
||||||
row.prop(brush, "invert_density_pressure", text = "")
|
row.prop(brush, "invert_density_pressure", text="")
|
||||||
row.prop(brush, "use_density_pressure", text = "")
|
row.prop(brush, "use_density_pressure", text="")
|
||||||
|
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
row.prop(brush, "tip_roundness")
|
row.prop(brush, "tip_roundness")
|
||||||
|
|||||||
@@ -1232,7 +1232,10 @@ class PHYSICS_PT_export(PhysicButtonsPanel, Panel):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
domain = context.fluid.domain_settings
|
domain = context.fluid.domain_settings
|
||||||
if not PhysicButtonsPanel.poll_fluid_domain(context) or (domain.cache_data_format != 'OPENVDB' and bpy.app.debug_value != 3001):
|
if (
|
||||||
|
not PhysicButtonsPanel.poll_fluid_domain(context) or
|
||||||
|
(domain.cache_data_format != 'OPENVDB' and bpy.app.debug_value != 3001)
|
||||||
|
):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return (context.engine in cls.COMPAT_ENGINES)
|
return (context.engine in cls.COMPAT_ENGINES)
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ class TEXT_PT_find(Panel):
|
|||||||
|
|
||||||
row = col.row(align=True)
|
row = col.row(align=True)
|
||||||
row.operator("text.replace")
|
row.operator("text.replace")
|
||||||
row.operator("text.replace", text = "Replace all").all = True
|
row.operator("text.replace", text="Replace all").all = True
|
||||||
|
|
||||||
layout.separator()
|
layout.separator()
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ def generate_from_enum_ex(
|
|||||||
attr,
|
attr,
|
||||||
cursor='DEFAULT',
|
cursor='DEFAULT',
|
||||||
tooldef_keywords={},
|
tooldef_keywords={},
|
||||||
exclude_filter = {}
|
exclude_filter={}
|
||||||
):
|
):
|
||||||
tool_defs = []
|
tool_defs = []
|
||||||
for enum in type.bl_rna.properties[attr].enum_items_static:
|
for enum in type.bl_rna.properties[attr].enum_items_static:
|
||||||
@@ -787,7 +787,6 @@ class _defs_edit_mesh:
|
|||||||
col.prop(props, "mark_seam", text="Seam")
|
col.prop(props, "mark_seam", text="Seam")
|
||||||
col.prop(props, "mark_sharp", text="Sharp")
|
col.prop(props, "mark_sharp", text="Sharp")
|
||||||
|
|
||||||
|
|
||||||
col = layout.column()
|
col = layout.column()
|
||||||
col.active = edge_bevel
|
col.active = edge_bevel
|
||||||
col.prop(props, "miter_outer", text="Miter Outer")
|
col.prop(props, "miter_outer", text="Miter Outer")
|
||||||
@@ -1215,7 +1214,7 @@ class _defs_sculpt:
|
|||||||
icon_prefix="brush.sculpt.",
|
icon_prefix="brush.sculpt.",
|
||||||
type=bpy.types.Brush,
|
type=bpy.types.Brush,
|
||||||
attr="sculpt_tool",
|
attr="sculpt_tool",
|
||||||
exclude_filter = exclude_filter,
|
exclude_filter=exclude_filter,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ToolDef.from_fn
|
@ToolDef.from_fn
|
||||||
@@ -2094,6 +2093,7 @@ class _defs_gpencil_edit:
|
|||||||
draw_settings=draw_settings,
|
draw_settings=draw_settings,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class _defs_gpencil_sculpt:
|
class _defs_gpencil_sculpt:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -2291,6 +2291,7 @@ class _defs_sequencer_select:
|
|||||||
widget=None,
|
widget=None,
|
||||||
keymap="Sequencer Tool: Select",
|
keymap="Sequencer Tool: Select",
|
||||||
)
|
)
|
||||||
|
|
||||||
@ToolDef.from_fn
|
@ToolDef.from_fn
|
||||||
def box():
|
def box():
|
||||||
def draw_settings(_context, layout, tool):
|
def draw_settings(_context, layout, tool):
|
||||||
@@ -2858,6 +2859,8 @@ class VIEW3D_PT_tools_active(ToolSelectPanelHelper, Panel):
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class SEQUENCER_PT_tools_active(ToolSelectPanelHelper, Panel):
|
class SEQUENCER_PT_tools_active(ToolSelectPanelHelper, Panel):
|
||||||
bl_space_type = 'SEQUENCE_EDITOR'
|
bl_space_type = 'SEQUENCE_EDITOR'
|
||||||
bl_region_type = 'TOOLS'
|
bl_region_type = 'TOOLS'
|
||||||
|
|||||||
@@ -276,9 +276,8 @@ class _draw_tool_settings_context_mode:
|
|||||||
layout.row().prop(brush, "direction", expand=True, text="")
|
layout.row().prop(brush, "direction", expand=True, text="")
|
||||||
|
|
||||||
if capabilities.has_color:
|
if capabilities.has_color:
|
||||||
UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text = "")
|
UnifiedPaintPanel.prop_unified_color(layout, context, brush, "color", text="")
|
||||||
layout.prop(brush, "blend", text="", expand = False)
|
layout.prop(brush, "blend", text="", expand=False)
|
||||||
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -3132,6 +3131,7 @@ class VIEW3D_MT_sculpt_set_pivot(Menu):
|
|||||||
props = layout.operator("sculpt.set_pivot_position", text="Pivot to Surface Under Cursor")
|
props = layout.operator("sculpt.set_pivot_position", text="Pivot to Surface Under Cursor")
|
||||||
props.mode = 'SURFACE'
|
props.mode = 'SURFACE'
|
||||||
|
|
||||||
|
|
||||||
class VIEW3D_MT_face_sets_init(Menu):
|
class VIEW3D_MT_face_sets_init(Menu):
|
||||||
bl_label = "Face Sets Init"
|
bl_label = "Face Sets Init"
|
||||||
|
|
||||||
@@ -5383,7 +5383,6 @@ class VIEW3D_PT_view3d_properties(Panel):
|
|||||||
layout.use_property_split = True
|
layout.use_property_split = True
|
||||||
layout.use_property_decorate = False # No animation.
|
layout.use_property_decorate = False # No animation.
|
||||||
|
|
||||||
|
|
||||||
col = layout.column()
|
col = layout.column()
|
||||||
|
|
||||||
subcol = col.column()
|
subcol = col.column()
|
||||||
@@ -7396,6 +7395,7 @@ class TOPBAR_PT_gpencil_vertexcolor(GreasePencilVertexcolorPanel, Panel):
|
|||||||
ob = context.object
|
ob = context.object
|
||||||
return ob and ob.type == 'GPENCIL'
|
return ob and ob.type == 'GPENCIL'
|
||||||
|
|
||||||
|
|
||||||
classes = (
|
classes = (
|
||||||
VIEW3D_HT_header,
|
VIEW3D_HT_header,
|
||||||
VIEW3D_HT_tool_header,
|
VIEW3D_HT_tool_header,
|
||||||
|
|||||||
@@ -9,18 +9,64 @@ import subprocess
|
|||||||
import zipfile
|
import zipfile
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument("--version", required=True, help="Version string in the form of 2.83.3.0")
|
parser.add_argument(
|
||||||
parser.add_argument("--url", required=True, help="Location of the release ZIP archive to download")
|
"--version",
|
||||||
parser.add_argument("--publisher", required=True, help="A string in the form of 'CN=PUBLISHER'")
|
required=True,
|
||||||
parser.add_argument("--pfx", required=False, help="Absolute path to the PFX file used for signing the resulting MSIX package")
|
help="Version string in the form of 2.83.3.0",
|
||||||
parser.add_argument("--password", required=False, default="blender", help="Password for the PFX file")
|
)
|
||||||
parser.add_argument("--lts", required=False, help="If set this MSIX is for an LTS release", action='store_const', const=1)
|
parser.add_argument(
|
||||||
parser.add_argument("--skipdl", required=False, help="If set skip downloading of the specified URL as blender.zip. The tool assumes blender.zip exists", action='store_const', const=1)
|
"--url",
|
||||||
parser.add_argument("--leavezip", required=False, help="If set don't clean up the downloaded blender.zip", action='store_const', const=1)
|
required=True,
|
||||||
parser.add_argument("--overwrite", required=False, help="If set remove Content folder if it already exists", action='store_const', const=1)
|
help="Location of the release ZIP archive to download",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--publisher",
|
||||||
|
required=True,
|
||||||
|
help="A string in the form of 'CN=PUBLISHER'",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--pfx",
|
||||||
|
required=False,
|
||||||
|
help="Absolute path to the PFX file used for signing the resulting MSIX package",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--password",
|
||||||
|
required=False,
|
||||||
|
default="blender",
|
||||||
|
help="Password for the PFX file",
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--lts",
|
||||||
|
required=False,
|
||||||
|
help="If set this MSIX is for an LTS release",
|
||||||
|
action='store_const',
|
||||||
|
const=1,
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--skipdl",
|
||||||
|
required=False,
|
||||||
|
help="If set skip downloading of the specified URL as blender.zip. The tool assumes blender.zip exists",
|
||||||
|
action='store_const',
|
||||||
|
const=1,
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--leavezip",
|
||||||
|
required=False,
|
||||||
|
help="If set don't clean up the downloaded blender.zip",
|
||||||
|
action='store_const',
|
||||||
|
const=1,
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--overwrite",
|
||||||
|
required=False,
|
||||||
|
help="If set remove Content folder if it already exists",
|
||||||
|
action='store_const',
|
||||||
|
const=1,
|
||||||
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
def execute_command(cmd : list, name : str, errcode : int):
|
|
||||||
|
def execute_command(cmd: list, name: str, errcode: int):
|
||||||
"""
|
"""
|
||||||
Execute given command in cmd. Output is captured. If an error
|
Execute given command in cmd. Output is captured. If an error
|
||||||
occurs name is used to print ERROR message, along with stderr and
|
occurs name is used to print ERROR message, along with stderr and
|
||||||
@@ -29,8 +75,10 @@ def execute_command(cmd : list, name : str, errcode : int):
|
|||||||
cmd_process = subprocess.run(cmd, capture_output=True, encoding="UTF-8")
|
cmd_process = subprocess.run(cmd, capture_output=True, encoding="UTF-8")
|
||||||
if cmd_process.returncode != 0:
|
if cmd_process.returncode != 0:
|
||||||
print(f"ERROR: {name} failed.")
|
print(f"ERROR: {name} failed.")
|
||||||
if cmd_process.stdout: print(cmd_process.stdout)
|
if cmd_process.stdout:
|
||||||
if cmd_process.stderr: print(cmd_process.stderr)
|
print(cmd_process.stdout)
|
||||||
|
if cmd_process.stderr:
|
||||||
|
print(cmd_process.stderr)
|
||||||
exit(errcode)
|
exit(errcode)
|
||||||
|
|
||||||
|
|
||||||
@@ -106,7 +154,8 @@ print(f"Extracting files from ZIP to {content_blender_folder}...")
|
|||||||
# ./Content/Blender/blender-2.83.3-windows64/blender.exe
|
# ./Content/Blender/blender-2.83.3-windows64/blender.exe
|
||||||
with zipfile.ZipFile(local_blender_zip, "r") as blender_zip:
|
with zipfile.ZipFile(local_blender_zip, "r") as blender_zip:
|
||||||
for entry in blender_zip.infolist():
|
for entry in blender_zip.infolist():
|
||||||
if entry.is_dir(): continue
|
if entry.is_dir():
|
||||||
|
continue
|
||||||
entry_location = pathlib.Path(entry.filename)
|
entry_location = pathlib.Path(entry.filename)
|
||||||
target_location = content_blender_folder.joinpath(*entry_location.parts[1:])
|
target_location = content_blender_folder.joinpath(*entry_location.parts[1:])
|
||||||
pathlib.Path(target_location.parent).mkdir(parents=True, exist_ok=True)
|
pathlib.Path(target_location.parent).mkdir(parents=True, exist_ok=True)
|
||||||
|
|||||||
@@ -26,7 +26,10 @@ def write_png(buf, width, height):
|
|||||||
import struct
|
import struct
|
||||||
# reverse the vertical line order and add null bytes at the start
|
# reverse the vertical line order and add null bytes at the start
|
||||||
width_byte_4 = width * 4
|
width_byte_4 = width * 4
|
||||||
raw_data = b"".join(b'\x00' + buf[span:span + width_byte_4] for span in range((height - 1) * width * 4, -1, - width_byte_4))
|
raw_data = b"".join(
|
||||||
|
b'\x00' + buf[span:span + width_byte_4]
|
||||||
|
for span in range((height - 1) * width * 4, -1, - width_byte_4)
|
||||||
|
)
|
||||||
|
|
||||||
def png_pack(png_tag, data):
|
def png_pack(png_tag, data):
|
||||||
chunk_head = png_tag + data
|
chunk_head = png_tag + data
|
||||||
|
|||||||
@@ -26,7 +26,10 @@ def write_png(buf, width, height):
|
|||||||
import struct
|
import struct
|
||||||
# reverse the vertical line order and add null bytes at the start
|
# reverse the vertical line order and add null bytes at the start
|
||||||
width_byte_4 = width * 4
|
width_byte_4 = width * 4
|
||||||
raw_data = b"".join(b'\x00' + buf[span:span + width_byte_4] for span in range((height - 1) * width * 4, -1, - width_byte_4))
|
raw_data = b"".join(
|
||||||
|
b'\x00' + buf[span:span + width_byte_4]
|
||||||
|
for span in range((height - 1) * width * 4, -1, - width_byte_4)
|
||||||
|
)
|
||||||
|
|
||||||
def png_pack(png_tag, data):
|
def png_pack(png_tag, data):
|
||||||
chunk_head = png_tag + data
|
chunk_head = png_tag + data
|
||||||
|
|||||||
@@ -277,7 +277,8 @@ def write_files(basename, props_list, props_length_max):
|
|||||||
indent = '# '
|
indent = '# '
|
||||||
else:
|
else:
|
||||||
indent = ' '
|
indent = ' '
|
||||||
rna += indent + '("%s", "%s", "%s", "%s", "%s"),\n' % tuple(props[2:5] + props[6:]) # description is already string formatted
|
# Description is already string formatted.
|
||||||
|
rna += indent + '("%s", "%s", "%s", "%s", "%s"),\n' % tuple(props[2:5] + props[6:])
|
||||||
# py
|
# py
|
||||||
blanks = [' ' * (x[0] - x[1]) for x in zip(props_length_max, list(map(len, props)))]
|
blanks = [' ' * (x[0] - x[1]) for x in zip(props_length_max, list(map(len, props)))]
|
||||||
props = [('"%s"%s' if props[-1] != x[0] else "%s%s") % (x[0], x[1]) for x in zip(props, blanks)]
|
props = [('"%s"%s' if props[-1] != x[0] else "%s%s") % (x[0], x[1]) for x in zip(props, blanks)]
|
||||||
|
|||||||
@@ -56,7 +56,10 @@ def main():
|
|||||||
if mod_from_dict:
|
if mod_from_dict:
|
||||||
file_path = sys.argv[-2][:-3] + "_lost.py"
|
file_path = sys.argv[-2][:-3] + "_lost.py"
|
||||||
write_work_file(file_path, list(mod_from_dict.values()))
|
write_work_file(file_path, list(mod_from_dict.values()))
|
||||||
print("Warning '%s' contains lost %d items from module %s.py" % (file_path, len(mod_from_dict), mod_from.__name__))
|
print(
|
||||||
|
"Warning '%s' contains lost %d items from module %s.py" %
|
||||||
|
(file_path, len(mod_from_dict), mod_from.__name__)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -592,7 +592,10 @@ class CustomPropertiesExportTest(AbstractAlembicTest):
|
|||||||
|
|
||||||
def _run_export(self, tempdir: pathlib.Path) -> pathlib.Path:
|
def _run_export(self, tempdir: pathlib.Path) -> pathlib.Path:
|
||||||
abc = tempdir / 'custom-properties.abc'
|
abc = tempdir / 'custom-properties.abc'
|
||||||
script = "import bpy; bpy.context.scene.frame_set(1); bpy.ops.wm.alembic_export(filepath='%s', start=1, end=1)" % abc.as_posix()
|
script = (
|
||||||
|
"import bpy; bpy.context.scene.frame_set(1); "
|
||||||
|
"bpy.ops.wm.alembic_export(filepath='%s', start=1, end=1)" % abc.as_posix()
|
||||||
|
)
|
||||||
self.run_blender('custom-properties.blend', script)
|
self.run_blender('custom-properties.blend', script)
|
||||||
return abc
|
return abc
|
||||||
|
|
||||||
|
|||||||
@@ -150,10 +150,20 @@ def main():
|
|||||||
|
|
||||||
# Example background utility, add some text and renders or saves it (with options)
|
# Example background utility, add some text and renders or saves it (with options)
|
||||||
# Possible types are: string, int, long, choice, float and complex.
|
# Possible types are: string, int, long, choice, float and complex.
|
||||||
parser.add_option("-o", "--operator", dest="operator", help="This text will be used to render an image", type="string")
|
parser.add_option(
|
||||||
|
"-o",
|
||||||
|
"--operator",
|
||||||
|
dest="operator",
|
||||||
|
help="This text will be used to render an image",
|
||||||
|
type="string")
|
||||||
parser.add_option("-p", "--path", dest="path", help="Path to use for searching for files", type='string')
|
parser.add_option("-p", "--path", dest="path", help="Path to use for searching for files", type='string')
|
||||||
parser.add_option("-m", "--match", dest="match", help="Wildcard to match filename", type="string")
|
parser.add_option("-m", "--match", dest="match", help="Wildcard to match filename", type="string")
|
||||||
parser.add_option("-s", "--save_path", dest="save_path", help="Save the input file to a blend file in a new location", metavar='string')
|
parser.add_option(
|
||||||
|
"-s",
|
||||||
|
"--save_path",
|
||||||
|
dest="save_path",
|
||||||
|
help="Save the input file to a blend file in a new location",
|
||||||
|
metavar='string')
|
||||||
parser.add_option("-S", "--start", dest="start", help="From collected files, start with this index", metavar='int')
|
parser.add_option("-S", "--start", dest="start", help="From collected files, start with this index", metavar='int')
|
||||||
parser.add_option("-E", "--end", dest="end", help="From collected files, end with this index", metavar='int')
|
parser.add_option("-E", "--end", dest="end", help="From collected files, end with this index", metavar='int')
|
||||||
|
|
||||||
|
|||||||
@@ -313,13 +313,13 @@ class CameraExportImportTest(unittest.TestCase):
|
|||||||
self.loc_rot_scale('CAM_Unit_Transform', (0, 0, 0), (0, 0, 0))
|
self.loc_rot_scale('CAM_Unit_Transform', (0, 0, 0), (0, 0, 0))
|
||||||
|
|
||||||
self.loc_rot_scale('CAM_Look_+Y', (2, 0, 0), (90, 0, 0))
|
self.loc_rot_scale('CAM_Look_+Y', (2, 0, 0), (90, 0, 0))
|
||||||
self.loc_rot_scale('CAM_Static_Child_Left', (2-0.15, 0, 0), (90, 0, 0))
|
self.loc_rot_scale('CAM_Static_Child_Left', (2 - 0.15, 0, 0), (90, 0, 0))
|
||||||
self.loc_rot_scale('CAM_Static_Child_Right', (2+0.15, 0, 0), (90, 0, 0))
|
self.loc_rot_scale('CAM_Static_Child_Right', (2 + 0.15, 0, 0), (90, 0, 0))
|
||||||
self.loc_rot_scale('Static_Child', (2, 0, 1), (90, 0, 0))
|
self.loc_rot_scale('Static_Child', (2, 0, 1), (90, 0, 0))
|
||||||
|
|
||||||
self.loc_rot_scale('CAM_Animated', (4, 0, 0), (90, 0, 0))
|
self.loc_rot_scale('CAM_Animated', (4, 0, 0), (90, 0, 0))
|
||||||
self.loc_rot_scale('CAM_Animated_Child_Left', (4-0.15, 0, 0), (90, 0, 0))
|
self.loc_rot_scale('CAM_Animated_Child_Left', (4 - 0.15, 0, 0), (90, 0, 0))
|
||||||
self.loc_rot_scale('CAM_Animated_Child_Right', (4+0.15, 0, 0), (90, 0, 0))
|
self.loc_rot_scale('CAM_Animated_Child_Right', (4 + 0.15, 0, 0), (90, 0, 0))
|
||||||
self.loc_rot_scale('Animated_Child', (4, 0, 1), (90, 0, 0))
|
self.loc_rot_scale('Animated_Child', (4, 0, 1), (90, 0, 0))
|
||||||
|
|
||||||
bpy.context.scene.frame_set(10)
|
bpy.context.scene.frame_set(10)
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ class TestBlendFileSaveLoadBasic(TestHelper):
|
|||||||
|
|
||||||
TESTS = (
|
TESTS = (
|
||||||
TestBlendFileSaveLoadBasic,
|
TestBlendFileSaveLoadBasic,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def argparse_create():
|
def argparse_create():
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class TestBlendLibLinkSaveLoadBasic(TestHelper):
|
|||||||
|
|
||||||
TESTS = (
|
TESTS = (
|
||||||
TestBlendLibLinkSaveLoadBasic,
|
TestBlendLibLinkSaveLoadBasic,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def argparse_create():
|
def argparse_create():
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ class AbstractConstraintTests(unittest.TestCase):
|
|||||||
actual = self.bone_matrix(object_name, bone_name)
|
actual = self.bone_matrix(object_name, bone_name)
|
||||||
self.assert_matrix(actual, expect, object_name)
|
self.assert_matrix(actual, expect, object_name)
|
||||||
|
|
||||||
def constraint_context(self, constraint_name: str, owner_name: str='') -> dict:
|
def constraint_context(self, constraint_name: str, owner_name: str = '') -> dict:
|
||||||
"""Return a context suitable for calling object constraint operators.
|
"""Return a context suitable for calling object constraint operators.
|
||||||
|
|
||||||
Assumes the owner is called "{constraint_name}.owner" if owner_name=''.
|
Assumes the owner is called "{constraint_name}.owner" if owner_name=''.
|
||||||
@@ -100,7 +100,7 @@ class AbstractConstraintTests(unittest.TestCase):
|
|||||||
}
|
}
|
||||||
return context
|
return context
|
||||||
|
|
||||||
def bone_constraint_context(self, constraint_name: str, owner_name: str='', bone_name: str='') -> dict:
|
def bone_constraint_context(self, constraint_name: str, owner_name: str = '', bone_name: str = '') -> dict:
|
||||||
"""Return a context suitable for calling bone constraint operators.
|
"""Return a context suitable for calling bone constraint operators.
|
||||||
|
|
||||||
Assumes the owner's object is called "{constraint_name}.owner" if owner_name=''.
|
Assumes the owner's object is called "{constraint_name}.owner" if owner_name=''.
|
||||||
|
|||||||
@@ -503,7 +503,7 @@ def main():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
# ~ for i in range(200):
|
# for i in range(200):
|
||||||
# ~ RANDOM_SEED[0] += 1
|
# RANDOM_SEED[0] += 1
|
||||||
#~ main()
|
# main()
|
||||||
main()
|
main()
|
||||||
|
|||||||
@@ -43,13 +43,13 @@ def setup():
|
|||||||
# Simple probe setup
|
# Simple probe setup
|
||||||
bpy.ops.object.lightprobe_add(type='CUBEMAP', location=(0.5, 0, 1.5))
|
bpy.ops.object.lightprobe_add(type='CUBEMAP', location=(0.5, 0, 1.5))
|
||||||
cubemap = bpy.context.selected_objects[0]
|
cubemap = bpy.context.selected_objects[0]
|
||||||
cubemap.scale = (2.5,2.5,1.0)
|
cubemap.scale = (2.5, 2.5, 1.0)
|
||||||
cubemap.data.falloff = 0
|
cubemap.data.falloff = 0
|
||||||
cubemap.data.clip_start = 2.4
|
cubemap.data.clip_start = 2.4
|
||||||
|
|
||||||
bpy.ops.object.lightprobe_add(type='GRID', location=(0, 0, 0.25))
|
bpy.ops.object.lightprobe_add(type='GRID', location=(0, 0, 0.25))
|
||||||
grid = bpy.context.selected_objects[0]
|
grid = bpy.context.selected_objects[0]
|
||||||
grid.scale = (1.735,1.735,1.735)
|
grid.scale = (1.735, 1.735, 1.735)
|
||||||
grid.data.grid_resolution_x = 3
|
grid.data.grid_resolution_x = 3
|
||||||
grid.data.grid_resolution_y = 3
|
grid.data.grid_resolution_y = 3
|
||||||
grid.data.grid_resolution_z = 2
|
grid.data.grid_resolution_z = 2
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ def _write_html(output_dir):
|
|||||||
filepath = os.path.join(output_dir, filename)
|
filepath = os.path.join(output_dir, filename)
|
||||||
combined_reports += pathlib.Path(filepath).read_text()
|
combined_reports += pathlib.Path(filepath).read_text()
|
||||||
|
|
||||||
combined_reports += "<br/>\n";
|
combined_reports += "<br/>\n"
|
||||||
|
|
||||||
html = """
|
html = """
|
||||||
<html>
|
<html>
|
||||||
@@ -67,7 +67,7 @@ def add(output_dir, category, name, filepath, failed=None):
|
|||||||
name=name,
|
name=name,
|
||||||
filepath=filepath)
|
filepath=filepath)
|
||||||
|
|
||||||
dirpath = os.path.join(output_dir, "report", category);
|
dirpath = os.path.join(output_dir, "report", category)
|
||||||
os.makedirs(dirpath, exist_ok=True)
|
os.makedirs(dirpath, exist_ok=True)
|
||||||
filepath = os.path.join(dirpath, name + ".data")
|
filepath = os.path.join(dirpath, name + ".data")
|
||||||
pathlib.Path(filepath).write_text(html)
|
pathlib.Path(filepath).write_text(html)
|
||||||
|
|||||||
@@ -128,7 +128,14 @@ class MeshTest:
|
|||||||
the public method run_test().
|
the public method run_test().
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, test_object_name: str, expected_object_name: str, operations_stack=None, apply_modifiers=False, threshold=None):
|
def __init__(
|
||||||
|
self,
|
||||||
|
test_object_name: str,
|
||||||
|
expected_object_name: str,
|
||||||
|
operations_stack=None,
|
||||||
|
apply_modifiers=False,
|
||||||
|
threshold=None,
|
||||||
|
):
|
||||||
"""
|
"""
|
||||||
Constructs a MeshTest object. Raises a KeyError if objects with names expected_object_name
|
Constructs a MeshTest object. Raises a KeyError if objects with names expected_object_name
|
||||||
or test_object_name don't exist.
|
or test_object_name don't exist.
|
||||||
@@ -259,7 +266,6 @@ class MeshTest:
|
|||||||
if self.apply_modifier:
|
if self.apply_modifier:
|
||||||
bpy.ops.object.modifier_apply(modifier=modifier_spec.modifier_name)
|
bpy.ops.object.modifier_apply(modifier=modifier_spec.modifier_name)
|
||||||
|
|
||||||
|
|
||||||
def _bake_current_simulation(self, obj, test_mod_type, test_mod_name, frame_end):
|
def _bake_current_simulation(self, obj, test_mod_type, test_mod_name, frame_end):
|
||||||
for scene in bpy.data.scenes:
|
for scene in bpy.data.scenes:
|
||||||
for modifier in obj.modifiers:
|
for modifier in obj.modifiers:
|
||||||
@@ -296,11 +302,15 @@ class MeshTest:
|
|||||||
|
|
||||||
scene.frame_set(physics_spec.frame_end + 1)
|
scene.frame_set(physics_spec.frame_end + 1)
|
||||||
|
|
||||||
self._bake_current_simulation(test_object, physics_spec.modifier_type, physics_spec.modifier_name, physics_spec.frame_end)
|
self._bake_current_simulation(
|
||||||
|
test_object,
|
||||||
|
physics_spec.modifier_type,
|
||||||
|
physics_spec.modifier_name,
|
||||||
|
physics_spec.frame_end,
|
||||||
|
)
|
||||||
if self.apply_modifier:
|
if self.apply_modifier:
|
||||||
bpy.ops.object.modifier_apply(modifier=physics_spec.modifier_name)
|
bpy.ops.object.modifier_apply(modifier=physics_spec.modifier_name)
|
||||||
|
|
||||||
|
|
||||||
def _apply_operator(self, test_object, operator: OperatorSpec):
|
def _apply_operator(self, test_object, operator: OperatorSpec):
|
||||||
"""
|
"""
|
||||||
Apply operator on test object.
|
Apply operator on test object.
|
||||||
|
|||||||
@@ -164,7 +164,8 @@ class TestMArray(unittest.TestCase):
|
|||||||
|
|
||||||
def test_assign_item(self):
|
def test_assign_item(self):
|
||||||
# arr[i] = x
|
# arr[i] = x
|
||||||
for arr, func in zip(("fmarr", "imarr", "bmarr", "fdmarr", "idmarr", "bdmarr"), (rand_float, rand_int, rand_bool) * 2):
|
for arr, func in zip(("fmarr", "imarr", "bmarr", "fdmarr", "idmarr", "bdmarr"),
|
||||||
|
(rand_float, rand_int, rand_bool) * 2):
|
||||||
rval = make_random_2d_array((4, 5), func)
|
rval = make_random_2d_array((4, 5), func)
|
||||||
|
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
@@ -172,7 +173,8 @@ class TestMArray(unittest.TestCase):
|
|||||||
self.assertEqual(prop_to_list(getattr(test, arr)[i]), rval)
|
self.assertEqual(prop_to_list(getattr(test, arr)[i]), rval)
|
||||||
|
|
||||||
# arr[i][j] = x
|
# arr[i][j] = x
|
||||||
for arr, func in zip(("fmarr", "imarr", "bmarr", "fdmarr", "idmarr", "bdmarr"), (rand_float, rand_int, rand_bool) * 2):
|
for arr, func in zip(("fmarr", "imarr", "bmarr", "fdmarr", "idmarr", "bdmarr"),
|
||||||
|
(rand_float, rand_int, rand_bool) * 2):
|
||||||
|
|
||||||
arr = getattr(test, arr)
|
arr = getattr(test, arr)
|
||||||
rval = make_random_array(5, func)
|
rval = make_random_array(5, func)
|
||||||
@@ -283,7 +285,10 @@ def prop_to_list(prop):
|
|||||||
|
|
||||||
|
|
||||||
def suite():
|
def suite():
|
||||||
return unittest.TestSuite([unittest.TestLoader().loadTestsFromTestCase(TestArray), unittest.TestLoader().loadTestsFromTestCase(TestMArray)])
|
return unittest.TestSuite([
|
||||||
|
unittest.TestLoader().loadTestsFromTestCase(TestArray),
|
||||||
|
unittest.TestLoader().loadTestsFromTestCase(TestMArray),
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -81,7 +81,10 @@ def api_dump(use_properties=True, use_functions=True):
|
|||||||
|
|
||||||
for prop in v.properties:
|
for prop in v.properties:
|
||||||
if prop.collection_type:
|
if prop.collection_type:
|
||||||
funcs = [(prop.identifier + "." + func.identifier, func) for func in prop.collection_type.functions]
|
funcs = [
|
||||||
|
(prop.identifier + "." + func.identifier, func)
|
||||||
|
for func in prop.collection_type.functions
|
||||||
|
]
|
||||||
for func_id, func in funcs:
|
for func_id, func in funcs:
|
||||||
data.append(func_to_str(struct_id_str, func_id, func))
|
data.append(func_to_str(struct_id_str, func_id, func))
|
||||||
data.sort()
|
data.sort()
|
||||||
@@ -100,7 +103,10 @@ def api_dump(use_properties=True, use_functions=True):
|
|||||||
|
|
||||||
for prop in v.properties:
|
for prop in v.properties:
|
||||||
if prop.collection_type:
|
if prop.collection_type:
|
||||||
props = [(prop.identifier + "." + prop_sub.identifier, prop_sub) for prop_sub in prop.collection_type.properties]
|
props = [
|
||||||
|
(prop.identifier + "." + prop_sub.identifier, prop_sub)
|
||||||
|
for prop_sub in prop.collection_type.properties
|
||||||
|
]
|
||||||
for prop_sub_id, prop_sub in props:
|
for prop_sub_id, prop_sub in props:
|
||||||
data.append(prop_to_str(struct_id_str, prop_sub_id, prop_sub))
|
data.append(prop_to_str(struct_id_str, prop_sub_id, prop_sub))
|
||||||
data.sort()
|
data.sort()
|
||||||
|
|||||||
Reference in New Issue
Block a user