2015-12-02 00:05:20 +01:00
import bpy
from bpy . props import *
2017-02-07 12:22:38 +01:00
import os
import shutil
2017-03-15 12:30:14 +01:00
import arm . props_ui as props_ui
import arm . assets as assets
import arm . log as log
import arm . utils
2017-03-20 14:00:55 +01:00
import arm . make
2017-08-23 23:37:55 +02:00
import arm . props_renderpath as props_renderpath
2017-10-17 13:39:50 +02:00
import arm . proxy
2016-09-12 02:24:20 +02:00
2017-03-20 14:00:55 +01:00
# Armory version
2018-09-05 15:52:45 +02:00
arm_version = ' 0.6 '
2017-11-27 17:02:44 +01:00
arm_commit = ' $Id$ '
2017-03-20 14:00:55 +01:00
2016-10-19 13:28:06 +02:00
def init_properties ( ) :
2017-03-20 14:00:55 +01:00
global arm_version
2018-01-20 22:28:08 +01:00
bpy . types . World . arm_recompile = BoolProperty ( name = " Recompile " , description = " Recompile sources on next play " , default = True )
2017-03-20 14:00:55 +01:00
bpy . types . World . arm_version = StringProperty ( name = " Version " , description = " Armory SDK version " , default = " " )
2017-11-27 17:02:44 +01:00
bpy . types . World . arm_commit = StringProperty ( name = " Version Commit " , description = " Armory SDK version " , default = " " )
2019-01-04 15:02:53 +01:00
bpy . types . World . arm_project_name = StringProperty ( name = " Name " , description = " Exported project name " , default = " " , update = assets . invalidate_compiler_cache )
bpy . types . World . arm_project_package = StringProperty ( name = " Package " , description = " Package name for scripts " , default = " arm " , update = assets . invalidate_compiler_cache )
bpy . types . World . arm_project_version = StringProperty ( name = " Version " , description = " Exported project version " , default = " 1.0 " , update = assets . invalidate_compiler_cache )
bpy . types . World . arm_project_bundle = StringProperty ( name = " Bundle " , description = " Exported project bundle " , default = " " , update = assets . invalidate_compiler_cache )
bpy . types . World . arm_project_icon = StringProperty ( name = " Icon (PNG) " , description = " Exported project icon, must be a PNG image " , default = " " , subtype = " FILE_PATH " , update = assets . invalidate_compiler_cache )
bpy . types . World . arm_project_root = StringProperty ( name = " Root " , description = " Set root folder for linked assets " , default = " " , subtype = " DIR_PATH " , update = assets . invalidate_compiler_cache )
2016-10-17 00:02:51 +02:00
bpy . types . World . arm_physics = EnumProperty (
2018-07-21 19:55:51 +02:00
items = [ ( ' Disabled ' , ' Disabled ' , ' Disabled ' ) ,
( ' Auto ' , ' Auto ' , ' Auto ' ) ,
( ' Enabled ' , ' Enabled ' , ' Enabled ' ) ] ,
2019-01-04 15:02:53 +01:00
name = " Physics " , default = ' Auto ' , update = assets . invalidate_compiler_cache )
2018-06-24 13:05:24 +02:00
bpy . types . World . arm_physics_engine = EnumProperty (
2018-07-21 19:55:51 +02:00
items = [ ( ' Bullet ' , ' Bullet ' , ' Bullet ' ) ,
( ' Oimo ' , ' Oimo ' , ' Oimo ' ) ] ,
2019-01-04 15:02:53 +01:00
name = " Physics Engine " , default = ' Bullet ' , update = assets . invalidate_compiler_cache )
2016-10-17 00:02:51 +02:00
bpy . types . World . arm_navigation = EnumProperty (
2018-07-21 19:55:51 +02:00
items = [ ( ' Disabled ' , ' Disabled ' , ' Disabled ' ) ,
( ' Auto ' , ' Auto ' , ' Auto ' ) ,
( ' Enabled ' , ' Enabled ' , ' Enabled ' ) ] ,
2019-01-04 15:02:53 +01:00
name = " Navigation " , default = ' Auto ' , update = assets . invalidate_compiler_cache )
2018-06-24 13:05:24 +02:00
bpy . types . World . arm_navigation_engine = EnumProperty (
2018-07-21 19:55:51 +02:00
items = [ ( ' Recast ' , ' Recast ' , ' Recast ' ) ] ,
name = " Navigation Engine " , default = ' Recast ' )
2017-06-20 11:35:24 +02:00
bpy . types . World . arm_ui = EnumProperty (
2018-07-21 19:55:51 +02:00
items = [ ( ' Disabled ' , ' Disabled ' , ' Disabled ' ) ,
( ' Enabled ' , ' Enabled ' , ' Enabled ' ) ,
( ' Auto ' , ' Auto ' , ' Auto ' ) ] ,
2019-01-04 15:02:53 +01:00
name = " Zui " , default = ' Auto ' , description = " Include UI library " , update = assets . invalidate_compiler_cache )
2017-08-19 03:08:42 +02:00
bpy . types . World . arm_hscript = EnumProperty (
2018-07-21 19:55:51 +02:00
items = [ ( ' Disabled ' , ' Disabled ' , ' Disabled ' ) ,
( ' Enabled ' , ' Enabled ' , ' Enabled ' ) ] ,
2019-01-04 15:02:53 +01:00
name = " Hscript " , default = ' Disabled ' , description = " Include Hscript library " , update = assets . invalidate_compiler_cache )
2018-01-24 22:57:54 +01:00
bpy . types . World . arm_formatlib = EnumProperty (
2018-07-21 19:55:51 +02:00
items = [ ( ' Disabled ' , ' Disabled ' , ' Disabled ' ) ,
( ' Enabled ' , ' Enabled ' , ' Enabled ' ) ] ,
2019-01-04 15:02:53 +01:00
name = " Format " , default = ' Disabled ' , description = " Include Format library " , update = assets . invalidate_compiler_cache )
2017-12-06 19:55:08 +01:00
bpy . types . World . arm_audio = EnumProperty (
2018-07-21 19:55:51 +02:00
items = [ ( ' Disabled ' , ' Disabled ' , ' Disabled ' ) ,
( ' Enabled ' , ' Enabled ' , ' Enabled ' ) ] ,
2019-01-04 15:02:53 +01:00
name = " Audio " , default = ' Enabled ' , update = assets . invalidate_compiler_cache )
bpy . types . World . arm_khafile = StringProperty ( name = " Khafile " , description = " Source appended to khafile.js " , update = assets . invalidate_compiler_cache )
bpy . types . World . arm_texture_quality = FloatProperty ( name = " Texture Quality " , default = 1.0 , min = 0.0 , max = 1.0 , subtype = ' FACTOR ' , update = assets . invalidate_compiler_cache )
bpy . types . World . arm_sound_quality = FloatProperty ( name = " Sound Quality " , default = 0.9 , min = 0.0 , max = 1.0 , subtype = ' FACTOR ' , update = assets . invalidate_compiler_cache )
2016-10-19 13:28:06 +02:00
bpy . types . World . arm_minimize = BoolProperty ( name = " Minimize Data " , description = " Export scene data in binary " , default = True , update = assets . invalidate_compiled_data )
2018-03-04 19:38:40 +01:00
bpy . types . World . arm_minify_js = BoolProperty ( name = " Minify JS " , description = " Minimize JavaScript output when publishing " , default = True )
2018-12-15 19:03:11 +01:00
bpy . types . World . arm_optimize_data = BoolProperty ( name = " Optimize Data " , description = " Export more efficient geometry and shader data, prolongs build times " , default = True , update = assets . invalidate_compiled_data )
2019-01-04 15:02:53 +01:00
bpy . types . World . arm_deinterleaved_buffers = BoolProperty ( name = " Deinterleaved Buffers " , description = " Use deinterleaved vertex buffers " , default = False , update = assets . invalidate_compiler_cache )
2017-03-31 14:18:47 +02:00
bpy . types . World . arm_export_tangents = BoolProperty ( name = " Export Tangents " , description = " Precompute tangents for normal mapping, otherwise computed in shader " , default = True , update = assets . invalidate_compiled_data )
2019-01-04 15:02:53 +01:00
bpy . types . World . arm_batch_meshes = BoolProperty ( name = " Batch Meshes " , description = " Group meshes by materials to speed up rendering " , default = False , update = assets . invalidate_compiler_cache )
2017-03-16 14:53:43 +01:00
bpy . types . World . arm_batch_materials = BoolProperty ( name = " Batch Materials " , description = " Marge similar materials into single pipeline state " , default = False , update = assets . invalidate_shader_cache )
2019-01-04 15:02:53 +01:00
bpy . types . World . arm_stream_scene = BoolProperty ( name = " Stream Scene " , description = " Stream scene content " , default = False , update = assets . invalidate_compiler_cache )
2016-12-05 01:54:01 +01:00
bpy . types . World . arm_lod_gen_levels = IntProperty ( name = " Levels " , description = " Number of levels to generate " , default = 3 , min = 1 )
bpy . types . World . arm_lod_gen_ratio = FloatProperty ( name = " Decimate Ratio " , description = " Decimate ratio " , default = 0.8 )
2018-11-15 17:20:55 +01:00
bpy . types . World . arm_cache_build = BoolProperty ( name = " Cache Build " , description = " Cache build files to speed up compilation " , default = True )
2017-08-19 03:08:42 +02:00
bpy . types . World . arm_play_camera = EnumProperty (
items = [ ( ' Scene ' , ' Scene ' , ' Scene ' ) ,
( ' Viewport ' , ' Viewport ' , ' Viewport ' ) ,
2018-05-22 19:44:54 +02:00
# ('Viewport Shared', 'Shared', 'Viewport Shared')
2017-08-21 12:17:55 +02:00
] ,
2019-01-04 15:02:53 +01:00
name = " Camera " , description = " Viewport camera " , default = ' Scene ' , update = assets . invalidate_compiler_cache )
2018-11-13 14:17:47 +01:00
bpy . types . World . arm_debug_console = BoolProperty ( name = " Debug Console " , description = " Show inspector in player and enable debug draw " , default = False , update = assets . invalidate_shader_cache )
bpy . types . World . arm_runtime = EnumProperty (
items = [ ( ' Krom ' , ' Krom ' , ' Krom ' ) ,
( ' Browser ' , ' Browser ' , ' Browser ' ) ] ,
name = " Runtime " , description = " Runtime to use when launching the game " , default = ' Krom ' , update = assets . invalidate_shader_cache )
2018-01-22 18:46:38 +01:00
bpy . types . World . arm_loadscreen = BoolProperty ( name = " Loading Screen " , description = " Show asset loading progress on published builds " , default = True )
2019-01-04 15:02:53 +01:00
bpy . types . World . arm_vsync = BoolProperty ( name = " VSync " , description = " Vertical Synchronization " , default = True , update = assets . invalidate_compiler_cache )
bpy . types . World . arm_dce = BoolProperty ( name = " DCE " , description = " Enable dead code elimination for publish builds " , default = True , update = assets . invalidate_compiler_cache )
bpy . types . World . arm_asset_compression = BoolProperty ( name = " Asset Compression " , description = " Enable scene data compression " , default = False , update = assets . invalidate_compiler_cache )
bpy . types . World . arm_write_config = BoolProperty ( name = " Write Config " , description = " Allow this project to be configured at runtime via a JSON file " , default = False , update = assets . invalidate_compiler_cache )
bpy . types . World . arm_compiler_inline = BoolProperty ( name = " Compiler Inline " , description = " Favor speed over size " , default = True , update = assets . invalidate_compiler_cache )
2017-06-06 20:01:24 +02:00
bpy . types . World . arm_winmode = EnumProperty (
items = [ ( ' Window ' , ' Window ' , ' Window ' ) ,
( ' Fullscreen ' , ' Fullscreen ' , ' Fullscreen ' ) ] ,
2019-01-04 15:02:53 +01:00
name = " Mode " , default = ' Window ' , description = ' Window mode to start in ' , update = assets . invalidate_compiler_cache )
2017-09-08 14:21:57 +02:00
bpy . types . World . arm_winorient = EnumProperty (
items = [ ( ' Multi ' , ' Multi ' , ' Multi ' ) ,
( ' Portrait ' , ' Portrait ' , ' Portrait ' ) ,
( ' Landscape ' , ' Landscape ' , ' Landscape ' ) ] ,
2017-12-10 10:42:57 +01:00
name = " Orientation " , default = ' Landscape ' , description = ' Set screen orientation on mobile devices ' )
2019-01-04 15:02:53 +01:00
bpy . types . World . arm_winresize = BoolProperty ( name = " Resizable " , description = " Allow window resize " , default = False , update = assets . invalidate_compiler_cache )
bpy . types . World . arm_winmaximize = BoolProperty ( name = " Maximizable " , description = " Allow window maximize " , default = False , update = assets . invalidate_compiler_cache )
bpy . types . World . arm_winminimize = BoolProperty ( name = " Minimizable " , description = " Allow window minimize " , default = True , update = assets . invalidate_compiler_cache )
2016-01-11 21:10:33 +01:00
# For object
2018-08-29 09:35:48 +02:00
bpy . types . Object . arm_instanced = EnumProperty (
items = [ ( ' Off ' , ' Off ' , ' Off ' ) ,
( ' Loc ' , ' Loc ' , ' Loc ' ) ,
( ' Loc + Rot ' , ' Loc + Rot ' , ' Loc + Rot ' ) ,
( ' Loc + Scale ' , ' Loc + Scale ' , ' Loc + Scale ' ) ,
( ' Loc + Rot + Scale ' , ' Loc + Rot + Scale ' , ' Loc + Rot + Scale ' ) ] ,
2019-01-04 15:02:53 +01:00
name = " Instanced Children " , default = ' Off ' , description = ' Use instacing to draw children ' , update = assets . invalidate_instance_cache )
2018-01-20 22:28:08 +01:00
bpy . types . Object . arm_export = BoolProperty ( name = " Export " , description = " Export object data " , default = True )
bpy . types . Object . arm_spawn = BoolProperty ( name = " Spawn " , description = " Auto-add this object when creating scene " , default = True )
2018-02-21 22:18:37 +01:00
bpy . types . Object . arm_mobile = BoolProperty ( name = " Mobile " , description = " Object moves during gameplay " , default = False )
2018-05-24 23:58:55 +02:00
bpy . types . Object . arm_visible = BoolProperty ( name = " Visible " , description = " Render this object " , default = True )
2018-01-20 22:28:08 +01:00
bpy . types . Object . arm_soft_body_margin = FloatProperty ( name = " Soft Body Margin " , description = " Collision margin " , default = 0.04 )
bpy . types . Object . arm_rb_linear_factor = FloatVectorProperty ( name = " Linear Factor " , size = 3 , description = " Set to 0 to lock axis " , default = [ 1 , 1 , 1 ] )
bpy . types . Object . arm_rb_angular_factor = FloatVectorProperty ( name = " Angular Factor " , size = 3 , description = " Set to 0 to lock axis " , default = [ 1 , 1 , 1 ] )
bpy . types . Object . arm_rb_trigger = BoolProperty ( name = " Trigger " , description = " Disable contact response " , default = False )
bpy . types . Object . arm_rb_terrain = BoolProperty ( name = " Terrain " , description = " Set rigid body collision shape to terrain " , default = False )
bpy . types . Object . arm_rb_force_deactivation = BoolProperty ( name = " Force Deactivation " , description = " Force deactivation on all rigid bodies for performance " , default = True )
bpy . types . Object . arm_rb_deactivation_time = FloatProperty ( name = " Deactivation Time " , description = " Delay putting rigid body into sleep " , default = 0.0 )
2018-10-30 12:56:49 +01:00
bpy . types . Object . arm_rb_ccd = BoolProperty ( name = " Continuous Collision Detection " , description = " Improve collision for fast moving objects " , default = False )
2018-01-20 22:28:08 +01:00
bpy . types . Object . arm_animation_enabled = BoolProperty ( name = " Animation " , description = " Enable skinning & timeline animation " , default = True )
bpy . types . Object . arm_tilesheet = StringProperty ( name = " Tilesheet " , description = " Set tilesheet animation " , default = ' ' )
bpy . types . Object . arm_tilesheet_action = StringProperty ( name = " Tilesheet Action " , description = " Set startup action " , default = ' ' )
2019-01-09 11:31:40 +01:00
bpy . types . Object . arm_proxy_sync_loc = BoolProperty ( name = " Location " , description = " Keep location synchronized with proxy object " , default = True , update = arm . proxy . proxy_sync_loc )
bpy . types . Object . arm_proxy_sync_rot = BoolProperty ( name = " Rotation " , description = " Keep rotation synchronized with proxy object " , default = True , update = arm . proxy . proxy_sync_rot )
bpy . types . Object . arm_proxy_sync_scale = BoolProperty ( name = " Scale " , description = " Keep scale synchronized with proxy object " , default = True , update = arm . proxy . proxy_sync_scale )
bpy . types . Object . arm_proxy_sync_materials = BoolProperty ( name = " Materials " , description = " Keep materials synchronized with proxy object " , default = True , update = arm . proxy . proxy_sync_materials )
bpy . types . Object . arm_proxy_sync_modifiers = BoolProperty ( name = " Modifiers " , description = " Keep modifiers synchronized with proxy object " , default = True , update = arm . proxy . proxy_sync_modifiers )
bpy . types . Object . arm_proxy_sync_traits = BoolProperty ( name = " Traits " , description = " Keep traits synchronized with proxy object " , default = True , update = arm . proxy . proxy_sync_traits )
2016-09-23 00:34:42 +02:00
# For speakers
2018-02-21 23:23:23 +01:00
bpy . types . Speaker . arm_play_on_start = BoolProperty ( name = " Play on Start " , description = " Play this sound automatically " , default = False )
2018-01-20 22:28:08 +01:00
bpy . types . Speaker . arm_loop = BoolProperty ( name = " Loop " , description = " Loop this sound " , default = False )
bpy . types . Speaker . arm_stream = BoolProperty ( name = " Stream " , description = " Stream this sound " , default = False )
2016-08-25 00:26:01 +02:00
# For mesh
2018-01-20 22:28:08 +01:00
bpy . types . Mesh . arm_cached = BoolProperty ( name = " Mesh Cached " , description = " No need to reexport mesh data " , default = False )
bpy . types . Mesh . arm_aabb = FloatVectorProperty ( name = " AABB " , size = 3 , default = [ 0 , 0 , 0 ] )
bpy . types . Mesh . arm_dynamic_usage = BoolProperty ( name = " Dynamic Usage " , description = " Mesh data can change at runtime " , default = False )
bpy . types . Curve . arm_cached = BoolProperty ( name = " Mesh Cached " , description = " No need to reexport curve data " , default = False )
2018-12-14 15:27:43 +01:00
bpy . types . Curve . arm_aabb = FloatVectorProperty ( name = " AABB " , size = 3 , default = [ 0 , 0 , 0 ] )
2018-01-20 22:28:08 +01:00
bpy . types . Curve . arm_dynamic_usage = BoolProperty ( name = " Dynamic Data Usage " , description = " Curve data can change at runtime " , default = False )
bpy . types . MetaBall . arm_cached = BoolProperty ( name = " Mesh Cached " , description = " No need to reexport metaball data " , default = False )
2018-12-14 15:27:43 +01:00
bpy . types . MetaBall . arm_aabb = FloatVectorProperty ( name = " AABB " , size = 3 , default = [ 0 , 0 , 0 ] )
2018-01-20 22:28:08 +01:00
bpy . types . MetaBall . arm_dynamic_usage = BoolProperty ( name = " Dynamic Data Usage " , description = " Metaball data can change at runtime " , default = False )
2016-09-30 23:24:18 +02:00
# For grease pencil
2018-01-20 22:28:08 +01:00
# bpy.types.GreasePencil.arm_cached = BoolProperty(name="GP Cached", description="No need to reexport grease pencil data", default=False)
2016-07-28 22:38:11 +02:00
# For armature
2018-01-20 22:28:08 +01:00
bpy . types . Armature . arm_cached = BoolProperty ( name = " Armature Cached " , description = " No need to reexport armature data " , default = False )
2016-01-11 16:03:55 +01:00
# For camera
2018-01-20 22:28:08 +01:00
bpy . types . Camera . arm_frustum_culling = BoolProperty ( name = " Frustum Culling " , description = " Perform frustum culling for this camera " , default = True )
2017-08-19 12:10:06 +02:00
2016-11-14 16:02:10 +01:00
# Render path generator
2017-08-19 12:10:06 +02:00
bpy . types . World . rp_preset = EnumProperty (
2018-11-15 14:35:22 +01:00
items = [ ( ' Desktop ' , ' Desktop ' , ' Desktop ' ) ,
2017-11-18 23:11:53 +01:00
( ' Mobile ' , ' Mobile ' , ' Mobile ' ) ,
2018-11-15 14:35:22 +01:00
( ' VR ' , ' VR ' , ' VR ' ) ,
( ' Max ' , ' Max ' , ' Max ' ) ,
( ' 2D/Baked ' , ' 2D/Baked ' , ' 2D/Baked ' ) ,
2016-12-09 02:08:01 +01:00
] ,
2018-11-15 14:35:22 +01:00
name = " Preset " , description = " Render path preset " , default = ' Desktop ' )
2018-01-20 22:28:08 +01:00
bpy . types . World . arm_envtex_name = StringProperty ( name = " Environment Texture " , default = ' ' )
bpy . types . World . arm_envtex_irr_name = StringProperty ( name = " Environment Irradiance " , default = ' ' )
bpy . types . World . arm_envtex_num_mips = IntProperty ( name = " Number of mips " , default = 0 )
bpy . types . World . arm_envtex_color = FloatVectorProperty ( name = " Environment Color " , size = 4 , default = [ 0 , 0 , 0 , 1 ] )
bpy . types . World . arm_envtex_strength = FloatProperty ( name = " Environment Strength " , default = 1.0 )
bpy . types . World . arm_envtex_sun_direction = FloatVectorProperty ( name = " Sun Direction " , size = 3 , default = [ 0 , 0 , 0 ] )
bpy . types . World . arm_envtex_turbidity = FloatProperty ( name = " Turbidity " , default = 1.0 )
bpy . types . World . arm_envtex_ground_albedo = FloatProperty ( name = " Ground Albedo " , default = 0.0 )
bpy . types . Material . arm_cast_shadow = BoolProperty ( name = " Cast Shadow " , default = True )
2018-08-08 22:43:14 +02:00
bpy . types . Material . arm_receive_shadow = BoolProperty ( name = " Receive Shadow " , description = " Requires forward render path " , default = True )
2018-01-20 22:28:08 +01:00
bpy . types . Material . arm_overlay = BoolProperty ( name = " Overlay " , default = False )
bpy . types . Material . arm_decal = BoolProperty ( name = " Decal " , default = False )
bpy . types . Material . arm_two_sided = BoolProperty ( name = " Two-Sided " , description = " Flip normal when drawing back-face " , default = False )
2017-08-21 12:17:55 +02:00
bpy . types . Material . arm_cull_mode = EnumProperty (
2017-08-19 03:08:42 +02:00
items = [ ( ' none ' , ' Both ' , ' None ' ) ,
2017-09-21 13:21:40 +02:00
( ' clockwise ' , ' Front ' , ' Clockwise ' ) ,
( ' counter_clockwise ' , ' Back ' , ' Counter-Clockwise ' ) ] ,
2018-12-19 13:33:17 +01:00
name = " Cull Mode " , default = ' clockwise ' , description = " Draw geometry faces " )
bpy . types . Material . arm_discard = BoolProperty ( name = " Alpha Test " , default = False , description = " Do not render fragments below specified opacity threshold " )
2018-01-20 22:28:08 +01:00
bpy . types . Material . arm_discard_opacity = FloatProperty ( name = " Mesh Opacity " , default = 0.2 , min = 0 , max = 1 )
bpy . types . Material . arm_discard_opacity_shadows = FloatProperty ( name = " Shadows Opacity " , default = 0.1 , min = 0 , max = 1 )
bpy . types . Material . arm_custom_material = StringProperty ( name = " Custom Material " , description = " Write custom material " , default = ' ' )
2017-09-21 13:21:40 +02:00
bpy . types . Material . arm_billboard = EnumProperty (
2017-09-29 01:18:57 +02:00
items = [ ( ' off ' , ' Off ' , ' Off ' ) ,
2017-09-21 13:21:40 +02:00
( ' spherical ' , ' Spherical ' , ' Spherical ' ) ,
( ' cylindrical ' , ' Cylindrical ' , ' Cylindrical ' ) ] ,
2017-10-01 16:42:16 +02:00
name = " Billboard " , default = ' off ' , description = " Track camera " , update = assets . invalidate_shader_cache )
2018-08-16 17:16:35 +02:00
bpy . types . Material . arm_particle_flag = BoolProperty ( name = " Particle Flag " , description = " This material is used for particles " , default = False )
2018-01-20 22:28:08 +01:00
bpy . types . Material . arm_particle_fade = BoolProperty ( name = " Particle Fade " , description = " Fade particles in and out " , default = False )
bpy . types . Material . arm_tilesheet_mat = BoolProperty ( name = " Tilesheet " , description = " Generate tilesheet shaders " , default = False )
bpy . types . Material . arm_blending = BoolProperty ( name = " Blending " , description = " Enable additive blending " , default = False )
2018-08-08 22:43:14 +02:00
bpy . types . Material . arm_blending_source = EnumProperty (
items = [ ( ' blend_one ' , ' One ' , ' One ' ) ,
( ' blend_zero ' , ' Zero ' , ' Zero ' ) ,
( ' source_alpha ' , ' Source Alpha ' , ' Source Alpha ' ) ,
( ' destination_alpha ' , ' Destination Alpha ' , ' Destination Alpha ' ) ,
( ' inverse_source_alpha ' , ' Inverse Source Alpha ' , ' Inverse Source Alpha ' ) ,
( ' inverse_destination_alpha ' , ' Inverse Destination Alpha ' , ' Inverse Destination Alpha ' ) ,
( ' source_color ' , ' Source Color ' , ' Source Color ' ) ,
( ' destination_color ' , ' Destination Color ' , ' Destination Color ' ) ,
( ' inverse_source_color ' , ' Inverse Source Color ' , ' Inverse Source Color ' ) ,
( ' inverse_destination_color ' , ' Inverse Destination Color ' , ' Inverse Destination Color ' ) ] ,
name = ' Source ' , default = ' blend_one ' , description = ' Blending factor ' , update = assets . invalidate_shader_cache )
bpy . types . Material . arm_blending_destination = EnumProperty (
items = [ ( ' blend_one ' , ' One ' , ' One ' ) ,
( ' blend_zero ' , ' Zero ' , ' Zero ' ) ,
( ' source_alpha ' , ' Source Alpha ' , ' Source Alpha ' ) ,
( ' destination_alpha ' , ' Destination Alpha ' , ' Destination Alpha ' ) ,
( ' inverse_source_alpha ' , ' Inverse Source Alpha ' , ' Inverse Source Alpha ' ) ,
( ' inverse_destination_alpha ' , ' Inverse Destination Alpha ' , ' Inverse Destination Alpha ' ) ,
( ' source_color ' , ' Source Color ' , ' Source Color ' ) ,
( ' destination_color ' , ' Destination Color ' , ' Destination Color ' ) ,
( ' inverse_source_color ' , ' Inverse Source Color ' , ' Inverse Source Color ' ) ,
( ' inverse_destination_color ' , ' Inverse Destination Color ' , ' Inverse Destination Color ' ) ] ,
name = ' Destination ' , default = ' blend_one ' , description = ' Blending factor ' , update = assets . invalidate_shader_cache )
bpy . types . Material . arm_blending_operation = EnumProperty (
items = [ ( ' add ' , ' Add ' , ' Add ' ) ,
( ' subtract ' , ' Subtract ' , ' Subtract ' ) ,
( ' reverse_subtract ' , ' Reverse Subtract ' , ' Reverse Subtract ' ) ,
( ' min ' , ' Min ' , ' Min ' ) ,
( ' max ' , ' Max ' , ' Max ' ) ] ,
name = ' Operation ' , default = ' add ' , description = ' Blending operation ' , update = assets . invalidate_shader_cache )
bpy . types . Material . arm_blending_source_alpha = EnumProperty (
items = [ ( ' blend_one ' , ' One ' , ' One ' ) ,
( ' blend_zero ' , ' Zero ' , ' Zero ' ) ,
( ' source_alpha ' , ' Source Alpha ' , ' Source Alpha ' ) ,
( ' destination_alpha ' , ' Destination Alpha ' , ' Destination Alpha ' ) ,
( ' inverse_source_alpha ' , ' Inverse Source Alpha ' , ' Inverse Source Alpha ' ) ,
( ' inverse_destination_alpha ' , ' Inverse Destination Alpha ' , ' Inverse Destination Alpha ' ) ,
( ' source_color ' , ' Source Color ' , ' Source Color ' ) ,
( ' destination_color ' , ' Destination Color ' , ' Destination Color ' ) ,
( ' inverse_source_color ' , ' Inverse Source Color ' , ' Inverse Source Color ' ) ,
( ' inverse_destination_color ' , ' Inverse Destination Color ' , ' Inverse Destination Color ' ) ] ,
name = ' Source ' , default = ' blend_one ' , description = ' Blending factor ' , update = assets . invalidate_shader_cache )
bpy . types . Material . arm_blending_destination_alpha = EnumProperty (
items = [ ( ' blend_one ' , ' One ' , ' One ' ) ,
( ' blend_zero ' , ' Zero ' , ' Zero ' ) ,
( ' source_alpha ' , ' Source Alpha ' , ' Source Alpha ' ) ,
( ' destination_alpha ' , ' Destination Alpha ' , ' Destination Alpha ' ) ,
( ' inverse_source_alpha ' , ' Inverse Source Alpha ' , ' Inverse Source Alpha ' ) ,
( ' inverse_destination_alpha ' , ' Inverse Destination Alpha ' , ' Inverse Destination Alpha ' ) ,
( ' source_color ' , ' Source Color ' , ' Source Color ' ) ,
( ' destination_color ' , ' Destination Color ' , ' Destination Color ' ) ,
( ' inverse_source_color ' , ' Inverse Source Color ' , ' Inverse Source Color ' ) ,
( ' inverse_destination_color ' , ' Inverse Destination Color ' , ' Inverse Destination Color ' ) ] ,
name = ' Destination ' , default = ' blend_one ' , description = ' Blending factor ' , update = assets . invalidate_shader_cache )
bpy . types . Material . arm_blending_operation_alpha = EnumProperty (
items = [ ( ' add ' , ' Add ' , ' Add ' ) ,
( ' subtract ' , ' Subtract ' , ' Subtract ' ) ,
( ' reverse_subtract ' , ' Reverse Subtract ' , ' Reverse Subtract ' ) ,
( ' min ' , ' Min ' , ' Min ' ) ,
( ' max ' , ' Max ' , ' Max ' ) ] ,
name = ' Operation ' , default = ' add ' , description = ' Blending operation ' , update = assets . invalidate_shader_cache )
2016-06-30 13:22:05 +02:00
# For scene
2018-01-20 22:28:08 +01:00
bpy . types . Scene . arm_export = BoolProperty ( name = " Export " , description = " Export scene data " , default = True )
2018-08-28 15:10:28 +02:00
# For light
2018-12-18 23:48:38 +01:00
bpy . types . Light . arm_clip_start = FloatProperty ( name = " Clip Start " , default = 0.1 )
bpy . types . Light . arm_clip_end = FloatProperty ( name = " Clip End " , default = 50.0 )
bpy . types . Light . arm_fov = FloatProperty ( name = " Field of View " , default = 0.84 )
bpy . types . Light . arm_shadows_bias = FloatProperty ( name = " Bias " , description = " Depth offset to fight shadow acne " , default = 1.0 )
2018-08-28 15:10:28 +02:00
bpy . types . World . arm_light_ies_texture = StringProperty ( name = " IES Texture " , default = " " )
bpy . types . World . arm_light_clouds_texture = StringProperty ( name = " Clouds Texture " , default = " " )
2017-08-21 12:17:55 +02:00
2018-01-20 22:28:08 +01:00
bpy . types . World . arm_rpcache_list = CollectionProperty ( type = bpy . types . PropertyGroup )
bpy . types . World . arm_scripts_list = CollectionProperty ( type = bpy . types . PropertyGroup )
bpy . types . World . arm_bundled_scripts_list = CollectionProperty ( type = bpy . types . PropertyGroup )
bpy . types . World . arm_canvas_list = CollectionProperty ( type = bpy . types . PropertyGroup )
2018-04-15 11:55:42 +02:00
bpy . types . World . arm_wasm_list = CollectionProperty ( type = bpy . types . PropertyGroup )
2018-01-20 22:28:08 +01:00
bpy . types . World . world_defs = StringProperty ( name = " World Shader Defs " , default = ' ' )
bpy . types . World . compo_defs = StringProperty ( name = " Compositor Shader Defs " , default = ' ' )
bpy . types . Material . export_uvs = BoolProperty ( name = " Export UVs " , default = False )
bpy . types . Material . export_vcols = BoolProperty ( name = " Export VCols " , default = False )
bpy . types . Material . export_tangents = BoolProperty ( name = " Export Tangents " , default = False )
bpy . types . Material . arm_skip_context = StringProperty ( name = " Skip Context " , default = ' ' )
bpy . types . Material . arm_material_id = IntProperty ( name = " ID " , default = 0 )
bpy . types . NodeSocket . is_uniform = BoolProperty ( name = " Is Uniform " , description = " Mark node sockets to be processed as material uniforms " , default = False )
2018-12-19 20:10:34 +01:00
bpy . types . NodeTree . arm_cached = BoolProperty ( name = " Node Tree Cached " , description = " No need to reexport node tree " , default = False )
2018-01-20 22:28:08 +01:00
bpy . types . Material . signature = StringProperty ( name = " Signature " , description = " Unique string generated from material nodes " , default = " " )
2018-12-19 20:10:34 +01:00
bpy . types . Material . arm_cached = BoolProperty ( name = " Material Cached " , description = " No need to reexport material data " , default = False )
2018-06-15 00:30:40 +02:00
bpy . types . Node . arm_material_param = BoolProperty ( name = " Parameter " , description = " Control this node from script " , default = False )
bpy . types . Node . arm_logic_id = StringProperty ( name = " ID " , description = " Nodes with equal identifier will share data " , default = ' ' )
2018-06-28 22:39:23 +02:00
bpy . types . Node . arm_watch = BoolProperty ( name = " Watch " , description = " Watch value of this node in debug console " , default = False )
2017-09-29 01:18:57 +02:00
# Particles
2018-01-20 22:28:08 +01:00
bpy . types . ParticleSettings . arm_count_mult = FloatProperty ( name = " Multiply Count " , description = " Multiply particle count when rendering in Armory " , default = 1.0 )
bpy . types . ParticleSettings . arm_loop = BoolProperty ( name = " Loop " , description = " Loop this particle system " , default = False )
2015-12-02 00:05:20 +01:00
2017-09-01 15:24:46 +02:00
create_wrd ( )
def create_wrd ( ) :
2016-10-19 13:28:06 +02:00
if not ' Arm ' in bpy . data . worlds :
wrd = bpy . data . worlds . new ( ' Arm ' )
wrd . use_fake_user = True # Store data world object, add fake user to keep it alive
2017-03-20 14:00:55 +01:00
wrd . arm_version = arm_version
2017-11-27 17:02:44 +01:00
wrd . arm_commit = arm_commit
2016-10-31 19:29:03 +01:00
2016-11-08 11:45:25 +01:00
def init_properties_on_load ( ) :
2018-11-21 20:59:04 +01:00
global arm_version
2016-11-08 22:29:50 +01:00
if not ' Arm ' in bpy . data . worlds :
init_properties ( )
2017-03-15 12:30:14 +01:00
arm . utils . fetch_script_names ( )
2016-11-08 11:45:25 +01:00
wrd = bpy . data . worlds [ ' Arm ' ]
2016-11-25 21:07:38 +01:00
# Outdated project
2017-11-27 17:02:44 +01:00
if bpy . data . filepath != ' ' and ( wrd . arm_version != arm_version or wrd . arm_commit != arm_commit ) : # Call on project load only
2019-01-04 20:13:29 +01:00
# This allows for seamless migration from ealier versions of
# Armory that don't have `item.node_tree_prop` set
for ob in bpy . data . objects : # TODO: deprecated
for trait in ob . arm_traitlist :
if trait != None and \
trait . type_prop == ' Logic Nodes ' and \
trait . node_tree_prop == None and \
trait . name in bpy . data . node_groups :
trait . node_tree_prop = bpy . data . node_groups [ trait . name ]
2019-01-09 11:43:10 +01:00
for scn in bpy . data . scenes : # TODO: deprecated
2019-01-09 16:58:57 +01:00
# Scene traits
for trait in scn . arm_traitlist :
if trait != None and \
trait . type_prop == ' Logic Nodes ' and \
trait . node_tree_prop == None and \
trait . name in bpy . data . node_groups :
trait . node_tree_prop = bpy . data . node_groups [ trait . name ]
# Bake list items
2019-01-09 11:43:10 +01:00
for item in scn . arm_bakelist :
if item != None and \
item . obj == None and \
item . object_name in scn . collection . all_objects :
item . obj = scn . collection . all_objects [ item . object_name ]
2019-01-04 20:13:29 +01:00
print ( ' Project updated to sdk v ' + arm_version + ' ( ' + arm_commit + ' ) ' )
2017-03-20 14:00:55 +01:00
wrd . arm_version = arm_version
2017-11-27 17:02:44 +01:00
wrd . arm_commit = arm_commit
2018-05-24 22:16:28 +02:00
arm . make . clean ( )
2016-08-15 12:08:50 +02:00
2015-12-07 20:04:23 +01:00
def register ( ) :
2016-10-19 13:28:06 +02:00
init_properties ( )
2017-03-15 12:30:14 +01:00
arm . utils . fetch_bundled_script_names ( )
2016-09-12 02:24:20 +02:00
2015-12-07 20:04:23 +01:00
def unregister ( ) :
2016-10-19 13:28:06 +02:00
pass