Skip to content

Commit

Permalink
Add atelier 2 beta
Browse files Browse the repository at this point in the history
  • Loading branch information
jfranmatheu committed Dec 28, 2020
1 parent e04f3da commit e3ce924
Show file tree
Hide file tree
Showing 315 changed files with 15,050 additions and 0 deletions.
7 changes: 7 additions & 0 deletions atelier/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"python.linting.enabled": false,
"python.formatting.provider": "autopep8",
"python.formatting.autopep8Args": ["--max-line-length", "120"],
"python.formatting.yapfArgs": ["--style", "{based_on_style: chromium, indent_width: 20}"],
"python.formatting.blackArgs": ["--line-length", "100"]
}
102 changes: 102 additions & 0 deletions atelier/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTIBILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

'''
Copyright (C) 2019-2020 Juan Fran Matheu G.
Contact: [email protected]
'''

bl_info = {
"name" : "AtelierSculpt",
"author" : "J. Fran Matheu (@jfranmatheu)",
"description" : "New and custom UI plus brand new Sculpt Tools for Sculpt Mode! :D",
"blender" : (2, 91, 0),
"version" : (2, 0, 0),
"location" : "Everywhere in Sculpt Mode!",
"warning" : "Beta version! REMAKE OF BLENDER ATELIER: SCULPT",
"category" : "Generic"
}

# ----------------------------------------------------------------- #
# PRE-CHECKING
# ----------------------------------------------------------------- #
from os.path import basename, dirname, realpath
root = dirname(realpath(__file__))

if basename(root) != "AtelierSculpt":
message = ("\n\n"
"The name of the folder containing this addon has to be 'AtelierSculpt'.\n"
"Please rename it.")
raise Exception(message)

# ----------------------------------------------------------------- #
# INITIALIZATION - DEPENDENCIES
# ----------------------------------------------------------------- #
'''
try:
import mouse
except Exception as e:
print(e, "Package have to be installed")
from .utils.package_installer import admin_install_package
admin_install_package('mouse')
'''

# ----------------------------------------------------------------- #
# REGISTRATION
# ----------------------------------------------------------------- #

def register():
from .icons import load_icons
load_icons()

from .addon_utils import register as register_addon_utils
#from .data import register as register_data
from .tools import register as register_tools
from .custom_ui import register as register_interface

register_addon_utils()
#register_data()
register_tools()

try:
from .experimental import register as register_experimental
except:
pass
finally:
register_experimental()

register_interface()

def unregister():
from .addon_utils import unregister as unregister_addon_utils
#from .data import unregister as unregister_data
from .tools import unregister as unregister_tools
from .custom_ui import unregister as unregister_interface

# REVERSED
unregister_interface()

try:
from .experimental import unregister as unregister_experimental
except:
pass
finally:
unregister_experimental()

unregister_tools()
#unregister_data()
unregister_addon_utils()


from .icons import remove_icons
remove_icons()
Binary file added atelier/__pycache__/__init__.cpython-37.pyc
Binary file not shown.
21 changes: 21 additions & 0 deletions atelier/addon_utils/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from .prefs import BAS_Preferences
from .updates import BAS_OT_CheckUpdates
from .save import FILE_OT_incremental_save
from .support import BAS_PT_dev_support

classes = [
BAS_Preferences,
BAS_OT_CheckUpdates,
FILE_OT_incremental_save,
BAS_PT_dev_support
]

def register():
from bpy.utils import register_class
for cls in classes:
register_class(cls)

def unregister():
from bpy.utils import unregister_class
for cls in reversed(classes):
unregister_class(cls)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
158 changes: 158 additions & 0 deletions atelier/addon_utils/prefs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
from os.path import dirname
import platform
platform = platform.system()

from bpy.types import AddonPreferences, UILayout
from bpy.props import StringProperty, FloatVectorProperty, BoolProperty, BoolVectorProperty, EnumProperty, IntVectorProperty
from ..icons import preview_collections
from ..import __package__ as main_package
from os.path import join

### PREFERENCES DATA SOURCES ###

from ..tools.dyntopo_pro.prefs import *
from ..custom_ui.prefs import *
from .updates import update_properties, update_auto_check_updates

prefs_properties = (
dyntopo_properties,
custom_ui_properties,
update_properties
)

# ----------------------------------------------------------------- #
# ADDON PREFERENCES #
# ----------------------------------------------------------------- #

class BAS_Preferences(AddonPreferences):
bl_idname = main_package

'''
prefs_properties = {}
prefs_properties.update(dyntopo_properties)
prefs_properties.update(custom_ui_properties)
for key, value in prefs_properties.items():
code = key + ' : ' + value[0] + '('
for pptkey, pptvalue in value[1].items():
# isinstance(pptvalue, str) and not pptvalue.startswith('update_') and not pptvalue.endswith('_items')
val = '"' + str(pptvalue) + '"' if isinstance(pptvalue, str) and not pptvalue.startswith('x_') else str(pptvalue)
code += pptkey + '=' + val + ','
code = code[:-1] + ')'
exec(code)
'''

for props in prefs_properties: exec(props)

def get_custom_ui_presets(self, with_extension=True):
real_name = UILayout.enum_item_name(self, 'custom_ui_presets', self.custom_ui_presets)
return join(self.saved_custom_ui_folder, (real_name + ".json") if with_extension else real_name)

is_custom_tool_header_active : BoolProperty(name="Is Custom Tool Header Active", description="", default=True)
is_custom_header_active : BoolProperty(name="Is Custom Header Active", description="", default=True)

# FILE SAVE
file_incremental_notation : StringProperty(
description = "Incremental save notation for file",
name = "Incremental Notation",
default = "_v"
)

def draw(self, context):
layout = self.layout

box = layout.box()
row = box.row()
row.operator("bas.check_updates", text="Check for Updates", icon='RECOVER_LAST')
row.prop(self, 'auto_check_updates', text="Auto-Check updates")
row.scale_y = 1.3
if self.need_updating:
pcoll = preview_collections["main"]
box.label(text="The version " + self.last_version + " is available !", icon='ERROR')
row = box.row()
prop = row.operator('wm.url_open', text="Cubebrush", icon_value=pcoll["cubebrush_icon"].icon_id)
prop.url = "http://cbr.sh/qako92"
prop = row.operator('wm.url_open', text="B3D Market", icon_value=pcoll["bMarket_icon"].icon_id)
prop.url = "https://blendermarket.com/products/advanced-new-sculpt-mode-ui"

box = layout.box()
box.scale_y = 1.2
box.active_default = self.is_custom_tool_header_active
box.operator('bas.toolheader_activator', text="Use custom sculpt Tool Header")

col = box.column(align=True)
col.enabled = self.is_custom_tool_header_active
col.prop(self, 'saved_custom_ui_folder')
col.prop(self, 'custom_ui_presets')

box = layout.box()
box.scale_y = 1.2
box.active_default = self.is_custom_header_active
box.operator('bas.header_activator', text="Use custom sculpt Header")





'''
layout = self.layout
layout.prop(self, "dyntopo_UseCustomValues", text="Use Custom Values for Dyntopo")
box = layout.box()
box.label(text="DYNTOPO: PER STAGES")
box.active = self.dyntopo_UseCustomValues
col = box.column(align=True)
row = col.row(align=True)
row.separator(factor=6)
row.label(text="SKETCH")
row.label(text="DETAIL")
row.label(text="POLISH")
_col = col.split().column(align=True)
#col.label(text="Relative Values")
_row = _col.row(align=False)
_row.prop(self, "relative_Low", text="Relative")
_row.prop(self, "relative_Mid", text="")
_row.prop(self, "relative_High", text="")
_col = col.split().column(align=True)
#_col.label(text="Constant Values")
_row = _col.row(align=False)
_row.prop(self, "constant_Low", text="Constant")
_row.prop(self, "constant_Mid", text="")
_row.prop(self, "constant_High", text="")
_col = col.split().column(align=True)
#_col.label(text="Brush")
_row = _col.row(align=False)
_row.prop(self, "brush_Low", text="Brush")
_row.prop(self, "brush_Mid", text="")
_row.prop(self, "brush_High", text="")
layout.separator()
box = layout.box()
col = box.column(align=True)
col.label(text="CUSTOM UI PRESETS : ")
row = col.row(align=True)
row.prop(self, "create_custom_UI_Slot_1", text="Slot 1")
#row = col.row(align=True)
#row.prop(self, "custom_UI_Slot_1", text="UI Toggles")
row = col.row(align=True)
row.prop(self, "create_custom_UI_Slot_2", text="Slot 2")
#layout.separator()
#box = layout.box()
#col = box.column()
#row = col.row(align=True)
#row.operator("bas.check_updates", text="Check for Updates")
#row.operator("bas.update", text="Update")
'''

#def invoke(self, context, event):
# adress = 'https://newsmui-check-version.blogspot.com/p/recent-version.html' #https://newsmui-check-version.blogspot.com/
# response = urllib.request.urlopen(adress)
# html = str(response.read())
# version = html[536:545]

#layout.label(text="PER LEVELS (BY DEFAULT MODE) : ")

25 changes: 25 additions & 0 deletions atelier/addon_utils/save.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import bpy
from os.path import basename, join, dirname
from bpy.types import Operator
from ..import __package__ as main_package

class FILE_OT_incremental_save(Operator):
bl_idname = "file.incremental_save"
bl_label = "Incremental Save"
bl_description = "Save new version of the actual project"
bl_options = {"REGISTER", "UNDO"}
def execute(self, context):
nota = context.preferences.addons[main_package].preferences.file_incremental_notation
filepath = bpy.data.filepath
if filepath.count(nota):
strnum = filepath.rpartition(nota)[-1].rpartition(".blend")[0]
intnum = int(strnum)
modnum = strnum.replace(str(intnum), str(intnum+1))
output = filepath.replace(strnum, modnum)
base = basename(filepath)
bpy.ops.wm.save_as_mainfile(filepath=join(dirname(filepath),("%s"+nota+"%s.blend") % (base.rpartition(nota)[0],str(modnum))))
else:
output = filepath.rpartition(".blend")[0]+nota+"01"
bpy.ops.wm.save_as_mainfile(filepath=output+".blend")

return {'FINISHED'}
58 changes: 58 additions & 0 deletions atelier/addon_utils/support.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
from bpy.types import Panel
from .. import bl_info, __package__ as main_package
from ..icons import Icon

# ----------------------------------------------------------------- #
# DEV SUPPORT #
# ----------------------------------------------------------------- #

class BAS_PT_dev_support(Panel):
bl_label = "Updates"
bl_description = "Check for updates. Support."
bl_category = 'Sculpt'
bl_space_type = "VIEW_3D"
bl_region_type = "UI"
bl_context = "NONE"
bl_options = {'DEFAULT_CLOSED'}

def draw(self, context):
# LOAD COLLECTION OF ICONS
prefs = context.preferences.addons[main_package].preferences
row = self.layout.row()
row.label(text="SUPPORT THE DEVELOPMENT :")

box = self.layout.box().column()
box.label(text="Report a Bug / Make a Proposal")
_prop = box.operator('wm.url_open', text="GO !")
_prop.url = "https://trello.com/invite/b/rGqXWJjA/78593a39edca80af604e0f2b62e0851d/blender-atelier-sculpt" # https://trello.com/b/rGqXWJjA/blender-atelier-sculpt


box = self.layout.box()
row = box.row()
row.label(text="DONATION")
row = box.row()
prop = row.operator('wm.url_open', text="Paypal", icon_value=Icon.PAYPAL())
prop.url = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=BA3UXNSDLE55E&source=url"

row = box.row()
row.label(text="DOWNLOAD / UPDATES")
row = box.row()

row.operator("bas.check_updates", text="Check for Updates", icon='RECOVER_LAST')
row.scale_y = 1.3

row = box.row()
if prefs.need_updating:
row.alert = True
row.label(text="New Version ! - " + prefs.last_version)

row = box.row()
row.alert = True
else:
_row = box.row()
_row.label(text="Version is up to date ! - " + str(bl_info['version']))

_prop = row.operator('wm.url_open', text="Cubebrush", icon_value=Icon.CUBEBRUSH())
_prop.url = "http://cbr.sh/qako92"
__prop = row.operator('wm.url_open', text="B3d Market", icon_value=Icon.BMARKET())
__prop.url = "https://blendermarket.com/products/advanced-new-sculpt-mode-ui"
Loading

0 comments on commit e3ce924

Please sign in to comment.