diff options
Diffstat (limited to 'ant_landscape/__init__.py')
-rw-r--r-- | ant_landscape/__init__.py | 198 |
1 files changed, 98 insertions, 100 deletions
diff --git a/ant_landscape/__init__.py b/ant_landscape/__init__.py index 49432e81..b9888d52 100644 --- a/ant_landscape/__init__.py +++ b/ant_landscape/__init__.py @@ -23,7 +23,7 @@ bl_info = { "name": "A.N.T.Landscape", "author": "Jimmy Hazevoet", "version": (0, 1, 8), - "blender": (2, 78, 0), + "blender": (2, 80, 0), "location": "View3D > Tool Shelf", "description": "Another Noise Tool: Landscape and Displace", "warning": "", @@ -75,13 +75,13 @@ def menu_func_landscape(self, context): # Landscape Add Panel -class panel_func_add_landscape(bpy.types.Panel): +class AntLandscapeAddPanel(bpy.types.Panel): bl_idname = "ANTLANDSCAPE_PT_add" bl_space_type = "VIEW_3D" bl_context = "objectmode" - bl_region_type = "TOOLS" + bl_region_type = "UI" bl_label = "Landscape" - bl_category = "Create" + bl_category = "A.N.T. Landscape" bl_options = {'DEFAULT_CLOSED'} def draw(self, context): @@ -94,9 +94,9 @@ class AntLandscapeToolsPanel(bpy.types.Panel): bl_idname = "ANTLANDSCAPE_PT_tools" bl_space_type = "VIEW_3D" bl_context = "objectmode" - bl_region_type = "TOOLS" + bl_region_type = "UI" bl_label = "Landscape Tools" - bl_category = "Tools" + bl_category = "A.N.T. Landscape" bl_options = {'DEFAULT_CLOSED'} @classmethod @@ -412,128 +412,128 @@ class AntDisplaceSettingsPanel(bpy.types.Panel): # Properties group class AntLandscapePropertiesGroup(bpy.types.PropertyGroup): - ant_terrain_name = StringProperty( + ant_terrain_name: StringProperty( name="Name", default="Landscape" ) - land_material = StringProperty( + land_material: StringProperty( name='Material', default="", description="Terrain material" ) - water_material = StringProperty( + water_material: StringProperty( name='Material', default="", description="Water plane material" ) - texture_block = StringProperty( + texture_block: StringProperty( name="Texture", default="" ) - at_cursor = BoolProperty( + at_cursor: BoolProperty( name="Cursor", default=True, description="Place at cursor location", ) - smooth_mesh = BoolProperty( + smooth_mesh: BoolProperty( name="Smooth", default=True, description="Shade smooth" ) - tri_face = BoolProperty( + tri_face: BoolProperty( name="Triangulate", default=False, description="Triangulate faces" ) - sphere_mesh = BoolProperty( + sphere_mesh: BoolProperty( name="Sphere", default=False, description="Generate uv sphere - remove doubles when ready" ) - subdivision_x = IntProperty( + subdivision_x: IntProperty( name="Subdivisions X", default=128, min=4, max=6400, description="Mesh X subdivisions" ) - subdivision_y = IntProperty( + subdivision_y: IntProperty( default=128, name="Subdivisions Y", min=4, max=6400, description="Mesh Y subdivisions" ) - mesh_size = FloatProperty( + mesh_size: FloatProperty( default=2.0, name="Mesh Size", min=0.01, max=100000.0, description="Mesh size" ) - mesh_size_x = FloatProperty( + mesh_size_x: FloatProperty( default=2.0, name="Mesh Size X", min=0.01, description="Mesh x size" ) - mesh_size_y = FloatProperty( + mesh_size_y: FloatProperty( name="Mesh Size Y", default=2.0, min=0.01, description="Mesh y size" ) - random_seed = IntProperty( + random_seed: IntProperty( name="Random Seed", default=0, min=0, description="Randomize noise origin" ) - noise_offset_x = FloatProperty( + noise_offset_x: FloatProperty( name="Offset X", default=0.0, description="Noise X Offset" ) - noise_offset_y = FloatProperty( + noise_offset_y: FloatProperty( name="Offset Y", default=0.0, description="Noise Y Offset" ) - noise_offset_z = FloatProperty( + noise_offset_z: FloatProperty( name="Offset Z", default=0.0, description="Noise Z Offset" ) - noise_size_x = FloatProperty( + noise_size_x: FloatProperty( default=1.0, name="Size X", min=0.01, max=1000.0, description="Noise x size" ) - noise_size_y = FloatProperty( + noise_size_y: FloatProperty( name="Size Y", default=1.0, min=0.01, max=1000.0, description="Noise y size" ) - noise_size_z = FloatProperty( + noise_size_z: FloatProperty( name="Size Z", default=1.0, min=0.01, max=1000.0, description="Noise Z size" ) - noise_size = FloatProperty( + noise_size: FloatProperty( name="Noise Size", default=1.0, min=0.01, max=1000.0, description="Noise size" ) - noise_type = EnumProperty( + noise_type: EnumProperty( name="Noise Type", default='hetero_terrain', description="Noise type", @@ -558,46 +558,26 @@ class AntLandscapePropertiesGroup(bpy.types.PropertyGroup): ('planet_noise', "Planet Noise", "Planet Noise by: Farsthary", 17), ('blender_texture', "Blender Texture - Texture Nodes", "Blender texture data block", 18)] ) - basis_type = EnumProperty( + basis_type: EnumProperty( name="Noise Basis", - default="0", + default=ant_noise.noise_basis_default, description="Noise basis algorithms", - items = [ - ("0", "Blender", "Blender default noise", 0), - ("1", "Perlin", "Perlin noise", 1), - ("2", "New Perlin", "New Perlin noise", 2), - ("3", "Voronoi F1", "Voronoi F1", 3), - ("4", "Voronoi F2", "Voronoi F2", 4), - ("5", "Voronoi F3", "Voronoi F3", 5), - ("6", "Voronoi F4", "Voronoi F4", 6), - ("7", "Voronoi F2-F1", "Voronoi F2-F1", 7), - ("8", "Voronoi Crackle", "Voronoi Crackle", 8), - ("9", "Cell Noise", "Cell noise", 9)] - ) - vl_basis_type = EnumProperty( + items = ant_noise.noise_basis + ) + vl_basis_type: EnumProperty( name="vlNoise Basis", - default="0", + default=ant_noise.noise_basis_default, description="VLNoise basis algorithms", - items = [ - ("0", "Blender", "Blender default noise", 0), - ("1", "Perlin", "Perlin noise", 1), - ("2", "New Perlin", "New Perlin noise", 2), - ("3", "Voronoi F1", "Voronoi F1", 3), - ("4", "Voronoi F2", "Voronoi F2", 4), - ("5", "Voronoi F3", "Voronoi F3", 5), - ("6", "Voronoi F4", "Voronoi F4", 6), - ("7", "Voronoi F2-F1", "Voronoi F2-F1", 7), - ("8", "Voronoi Crackle", "Voronoi Crackle", 8), - ("9", "Cell Noise", "Cell noise", 9)] - ) - distortion = FloatProperty( + items = ant_noise.noise_basis + ) + distortion: FloatProperty( name="Distortion", default=1.0, min=0.01, max=100.0, description="Distortion amount" ) - hard_noise = EnumProperty( + hard_noise: EnumProperty( name="Soft Hard", default="0", description="Soft Noise, Hard noise", @@ -605,56 +585,56 @@ class AntLandscapePropertiesGroup(bpy.types.PropertyGroup): ("0", "Soft", "Soft Noise", 0), ("1", "Hard", "Hard noise", 1)] ) - noise_depth = IntProperty( + noise_depth: IntProperty( name="Depth", default=8, min=0, max=16, description="Noise Depth - number of frequencies in the fBm" ) - amplitude = FloatProperty( + amplitude: FloatProperty( name="Amp", default=0.5, min=0.01, max=1.0, description="Amplitude" ) - frequency = FloatProperty( + frequency: FloatProperty( name="Freq", default=2.0, min=0.01, max=5.0, description="Frequency" ) - dimension = FloatProperty( + dimension: FloatProperty( name="Dimension", default=1.0, min=0.01, max=2.0, description="H - fractal dimension of the roughest areas" ) - lacunarity = FloatProperty( + lacunarity: FloatProperty( name="Lacunarity", min=0.01, max=6.0, default=2.0, description="Lacunarity - gap between successive frequencies" ) - offset = FloatProperty( + offset: FloatProperty( name="Offset", default=1.0, min=0.01, max=6.0, description="Offset - raises the terrain from sea level" ) - gain = FloatProperty( + gain: FloatProperty( name="Gain", default=1.0, min=0.01, max=6.0, description="Gain - scale factor" ) - marble_bias = EnumProperty( + marble_bias: EnumProperty( name="Bias", default="0", description="Marble bias", @@ -664,7 +644,7 @@ class AntLandscapePropertiesGroup(bpy.types.PropertyGroup): ("2", "Tri", "Tri", 2), ("3", "Saw", "Saw", 3)] ) - marble_sharp = EnumProperty( + marble_sharp: EnumProperty( name="Sharp", default="0", description="Marble sharpness", @@ -676,7 +656,7 @@ class AntLandscapePropertiesGroup(bpy.types.PropertyGroup): ("4", "Sharp inv.", "Sharp", 4), ("5", "Sharper inv.", "Sharper", 5)] ) - marble_shape = EnumProperty( + marble_shape: EnumProperty( name="Shape", default="0", description="Marble shape", @@ -690,33 +670,33 @@ class AntLandscapePropertiesGroup(bpy.types.PropertyGroup): ("6", "Y", "Y", 6), ("7", "X", "X", 7)] ) - height = FloatProperty( + height: FloatProperty( name="Height", default=0.5, min=-10000.0, max=10000.0, description="Noise intensity scale" ) - height_invert = BoolProperty( + height_invert: BoolProperty( name="Invert", default=False, description="Height invert", ) - height_offset = FloatProperty( + height_offset: FloatProperty( name="Offset", default=0.0, min=-10000.0, max=10000.0, description="Height offset" ) - fx_mixfactor = FloatProperty( + fx_mixfactor: FloatProperty( name="Mix Factor", default=0.0, min=-1.0, max=1.0, description="Effect mix factor: -1.0 = Noise, +1.0 = Effect" ) - fx_mix_mode = EnumProperty( + fx_mix_mode: EnumProperty( name="Effect Mix", default="0", description="Effect mix mode", @@ -732,7 +712,7 @@ class AntLandscapePropertiesGroup(bpy.types.PropertyGroup): ("8", "Max", "Maximum", 8) ] ) - fx_type = EnumProperty( + fx_type: EnumProperty( name="Effect Type", default="0", description="Effect type", @@ -761,7 +741,7 @@ class AntLandscapePropertiesGroup(bpy.types.PropertyGroup): ("21", "Flat Voronoi", "Flat voronoi", 21) ] ) - fx_bias = EnumProperty( + fx_bias: EnumProperty( name="Effect Bias", default="0", description="Effect bias type", @@ -772,64 +752,64 @@ class AntLandscapePropertiesGroup(bpy.types.PropertyGroup): ("3", "Saw", "Saw", 3), ("4", "None", "None", 4)] ) - fx_turb = FloatProperty( + fx_turb: FloatProperty( name="Distortion", default=0.0, min=0.0, max=1000.0, description="Effect turbulence distortion" ) - fx_depth = IntProperty( + fx_depth: IntProperty( name="Depth", default=0, min=0, max=16, description="Effect depth - number of frequencies" ) - fx_amplitude = FloatProperty( + fx_amplitude: FloatProperty( name="Amp", default=0.5, min=0.01, max=1.0, description="Amplitude" ) - fx_frequency = FloatProperty( + fx_frequency: FloatProperty( name="Freq", default=2.0, min=0.01, max=5.0, description="Frequency" ) - fx_size = FloatProperty( + fx_size: FloatProperty( name="Effect Size", default=1.0, min=0.01, max=1000.0, description="Effect size" ) - fx_loc_x = FloatProperty( + fx_loc_x: FloatProperty( name="Offset X", default=0.0, description="Effect x offset" ) - fx_loc_y = FloatProperty( + fx_loc_y: FloatProperty( name="Offset Y", default=0.0, description="Effect y offset" ) - fx_height = FloatProperty( + fx_height: FloatProperty( name="Intensity", default=1.0, min=-1000.0, max=1000.0, description="Effect intensity scale" ) - fx_invert = BoolProperty( + fx_invert: BoolProperty( name="Invert", default=False, description="Effect invert" ) - fx_offset = FloatProperty( + fx_offset: FloatProperty( name="Offset", default=0.0, min=-1000.0, @@ -837,7 +817,7 @@ class AntLandscapePropertiesGroup(bpy.types.PropertyGroup): description="Effect height offset" ) - edge_falloff = EnumProperty( + edge_falloff: EnumProperty( name="Falloff", default="3", description="Flatten edges", @@ -847,42 +827,42 @@ class AntLandscapePropertiesGroup(bpy.types.PropertyGroup): ("2", "X", "X Falloff", 2), ("3", "X Y", "X Y Falloff", 3)] ) - falloff_x = FloatProperty( + falloff_x: FloatProperty( name="Falloff X", default=4.0, min=0.1, max=100.0, description="Falloff x scale" ) - falloff_y = FloatProperty( + falloff_y: FloatProperty( name="Falloff Y", default=4.0, min=0.1, max=100.0, description="Falloff y scale" ) - edge_level = FloatProperty( + edge_level: FloatProperty( name="Edge Level", default=0.0, min=-10000.0, max=10000.0, description="Edge level, sealevel offset" ) - maximum = FloatProperty( + maximum: FloatProperty( name="Maximum", default=1.0, min=-10000.0, max=10000.0, description="Maximum, flattens terrain at plateau level" ) - minimum = FloatProperty( + minimum: FloatProperty( name="Minimum", default=-1.0, min=-10000.0, max=10000.0, description="Minimum, flattens terrain at seabed level" ) - vert_group = StringProperty( + vert_group: StringProperty( name="Vertex Group", default="" ) @@ -893,7 +873,7 @@ class AntLandscapePropertiesGroup(bpy.types.PropertyGroup): max=1000.0, description="Strata layers / terraces" ) - strata_type = EnumProperty( + strata_type: EnumProperty( name="Strata", default="0", description="Strata types", @@ -905,29 +885,29 @@ class AntLandscapePropertiesGroup(bpy.types.PropertyGroup): ("4", "Quantize", "Quantize", 4), ("5", "Quantize Mix", "Quantize mixed", 5)] ) - water_plane = BoolProperty( + water_plane: BoolProperty( name="Water Plane", default=False, description="Add water plane" ) - water_level = FloatProperty( + water_level: FloatProperty( name="Level", default=0.01, min=-10000.0, max=10000.0, description="Water level" ) - remove_double = BoolProperty( + remove_double: BoolProperty( name="Remove Doubles", default=False, description="Remove doubles" ) - refresh = BoolProperty( + refresh: BoolProperty( name="Refresh", default=False, description="Refresh" ) - auto_refresh = BoolProperty( + auto_refresh: BoolProperty( name="Auto", default=True, description="Automatic refresh" @@ -936,15 +916,33 @@ class AntLandscapePropertiesGroup(bpy.types.PropertyGroup): # ------------------------------------------------------------ # Register: +classes = ( + AntLandscapeAddPanel, + AntLandscapeToolsPanel, + AntMainSettingsPanel, + AntNoiseSettingsPanel, + AntDisplaceSettingsPanel, + AntLandscapePropertiesGroup, + add_mesh_ant_landscape.AntAddLandscape, + mesh_ant_displace.AntMeshDisplace, + ant_functions.AntLandscapeRefresh, + ant_functions.AntLandscapeRegenerate, + ant_functions.AntVgSlopeMap, + ant_functions.Eroder, +) + def register(): - bpy.utils.register_module(__name__) + for cls in classes: + bpy.utils.register_class(cls) + bpy.types.VIEW3D_MT_mesh_add.append(menu_func_landscape) bpy.types.Object.ant_landscape = PointerProperty(type=AntLandscapePropertiesGroup, name="ANT_Landscape", description="Landscape properties") bpy.types.VIEW3D_MT_paint_weight.append(menu_func_eroder) def unregister(): - bpy.utils.unregister_module(__name__) + for cls in reversed(classes): + bpy.utils.unregister_class(cls) bpy.types.VIEW3D_MT_mesh_add.remove(menu_func_landscape) bpy.types.VIEW3D_MT_paint_weight.remove(menu_func_eroder) |