Skip to content

Commit

Permalink
Blender Addon Updates
Browse files Browse the repository at this point in the history
- Make Json export experimental. It can be turned on in the addon preferences now.
- make alpha driver work with bones properly.
  • Loading branch information
ndee85 committed Apr 28, 2016
1 parent b284b97 commit 69c362e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
13 changes: 11 additions & 2 deletions Blender/coa_tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ class ExampleAddonPreferences(bpy.types.AddonPreferences):
show_donate_icon = bpy.props.BoolProperty(name="Show Donate Icon",default=True)
sprite_import_export_scale = bpy.props.FloatProperty(name="Sprite import/export scale",default=0.01)
sprite_thumb_size = bpy.props.IntProperty(name="Sprite thumbnail size",default=48)
json_export = bpy.props.BoolProperty(name="Experimental Json export",default=False)
def draw(self, context):
layout = self.layout
layout.prop(self, "show_donate_icon")
layout.prop(self,"json_export")
layout.prop(self,"sprite_import_export_scale")
layout.prop(self,"sprite_thumb_size")

Expand Down Expand Up @@ -178,21 +180,28 @@ def update_sprites(dummy):
context.scene.frame_current = 0


ticker = 0
@persistent
def scene_update(dummy):
global ticker
ticker += 1
context = bpy.context
if hasattr(context,"visible_objects"):
objects = context.visible_objects
else:
objects = bpy.data.objects
if hasattr(context,"window_manager"):
wm = bpy.context.window_manager
wm = bpy.context.window_manager
if wm.coa_update_uv:
for obj in objects:
if "coa_sprite" in obj and obj.animation_data != None and obj.type == "MESH":
if obj.coa_sprite_frame != obj.coa_sprite_frame_last:
update_uv(bpy.context,obj)
obj.coa_sprite_frame_last = obj.coa_sprite_frame
obj.coa_sprite_frame_last = obj.coa_sprite_frame
if ticker%5 == 0:
if obj.coa_alpha != obj.coa_alpha_last:
set_alpha(obj,bpy.context,obj.coa_alpha)
obj.coa_alpha_last = obj.coa_alpha

if hasattr(bpy.context,"active_object"):
obj = bpy.context.active_object
Expand Down
2 changes: 1 addition & 1 deletion Blender/coa_tools/operators/modal_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def modal(self,context,event):

self.obj_mode_hist = obj.mode

if self.check_event_value(event) == "JUST_PRESSED" and active_object != None and event.type == "G" and active_object.type == "ARMATURE" and active_object.mode == "POSE":
if active_object != None and (self.check_event_value(event) in ["JUST_PRESSED","PRESSED"] and event.type == "G") and active_object.type == "ARMATURE" and active_object.mode == "POSE":
bpy.context.window_manager.coa_update_uv = True
elif self.check_event_value(event) == "JUST_RELEASED" and bpy.context.window_manager.coa_update_uv:
bpy.context.window_manager.coa_update_uv = False
Expand Down
5 changes: 3 additions & 2 deletions Blender/coa_tools/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,9 @@ def draw(self, context):
row = layout.row(align=True)
row.operator("import.coa_import_sprites",text="Import Sprites",icon="IMASEL")

row = layout.row()
row.operator("object.export_to_json",text="Export Json",icon="EXPORT",emboss=True)
if get_addon_prefs(context).json_export:
row = layout.row()
row.operator("object.export_to_json",text="Export Json",icon="EXPORT",emboss=True)

row = layout.row(align=True)
row.label(text="Edit Operator:")
Expand Down

0 comments on commit 69c362e

Please sign in to comment.