Skip to content

Commit

Permalink
added new option to rotate the gas layer
Browse files Browse the repository at this point in the history
  • Loading branch information
MCOfficer committed Jan 2, 2018
1 parent 2695c7f commit a734b74
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
16 changes: 11 additions & 5 deletions CreatePlanet.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import os
import random
from math import radians

from gimpfu import *

Expand Down Expand Up @@ -82,7 +83,7 @@ def get_outputwidth(planetrand, planettype, generate2x, planetwidth):
return outputwidth


def createplanet(image, atmospherecolor, postprocessing, planetrand, planetwidth, planettype, bumplayeropacity, distance, gasopacity, atmothickness, texturelayer, groupundo, filename, savexcf, generate2x):
def createplanet(image, atmospherecolor, postprocessing, planetrand, planetwidth, planettype, bumplayeropacity, distance, gasopacity, gasangle, atmothickness, texturelayer, groupundo, filename, savexcf, generate2x):

if groupundo:
image.undo_group_start()
Expand Down Expand Up @@ -188,6 +189,8 @@ def createplanet(image, atmospherecolor, postprocessing, planetrand, planetwidth
while counter < 3:
image.lower_layer(gaslayer)
counter = counter + 1
if gasangle is not 0:
pdb.gimp_item_transform_rotate(gaslayer, radians(float(gasangle)), TRUE, 0, 0)

# crop the image around the planet
cropoff = int(round(width / 4.3)) # minimal distance between the edge of the image and the atmosphere, with tolerance
Expand Down Expand Up @@ -226,14 +229,15 @@ def createplanet(image, atmospherecolor, postprocessing, planetrand, planetwidth
"""
WRAPPERS
"""
def createplanet_gas(image, atmospherecolor, planetrand, planetwidth, distance, gasopacity, atmothickness, texturelayer, groupundo, filename, savexcf, generate2x):
createplanet(image, atmospherecolor, 2, planetrand, planetwidth, 4, 0, distance, gasopacity, atmothickness, texturelayer, groupundo, filename, savexcf, generate2x)

def createplanet_gas(image, atmospherecolor, planetrand, planetwidth, distance, gasopacity, gasangle, atmothickness, texturelayer, groupundo, filename, savexcf, generate2x):
createplanet(image, atmospherecolor, 2, planetrand, planetwidth, 4, 0, distance, gasopacity, gasangle, atmothickness, texturelayer, groupundo, filename, savexcf, generate2x)

def createplanet_ice(image, atmospherecolor, planetrand, planetwidth, atmothickness, texturelayer, groupundo, filename, savexcf, generate2x):
createplanet(image, atmospherecolor, 0, planetrand, planetwidth, 3, 0, 0, 0, atmothickness, texturelayer, groupundo, filename, savexcf, generate2x)
createplanet(image, atmospherecolor, 0, planetrand, planetwidth, 3, 0, 0, 0, 0, atmothickness, texturelayer, groupundo, filename, savexcf, generate2x)

def createplanet_terrestrials(image, planetrand, planettype, planetwidth, bumplayeropacity, atmothickness, texturelayer, groupundo, filename, savexcf, generate2x):
createplanet(image, (0, 0, 0), 1, planetrand, planetwidth, planettype, bumplayeropacity, 0, 0, atmothickness, texturelayer, groupundo, filename, savexcf, generate2x)
createplanet(image, (0, 0, 0), 1, planetrand, planetwidth, planettype, bumplayeropacity, 0, 0, 0, atmothickness, texturelayer, groupundo, filename, savexcf, generate2x)


"""
Expand All @@ -259,6 +263,7 @@ def createplanet_terrestrials(image, planetrand, planettype, planetwidth, bumpla
(PF_SLIDER, "bumplayeropacity", "The opacity of the bumpmap layer. Only effective for terrestrial planets.", 80, (0, 100, 1)),
(PF_SLIDER, "distance", "The motion blur distance. Only effective for gas giants.", 150, (100, 200, 1)),
(PF_SLIDER, "gasopacity", "The gas layer opacity. Only effective for gas giants.", 70, (0, 100, 1)),
(PF_SLIDER, "gasangle", "The rotation of the gas layer. Only effective for gas giants.", 0, (-180, 180, 1)),
(PF_SLIDER, "atmothickness", "The thickness of the atmosphere, in pixels.", 1, (0, 3, 0.05)),
(PF_DRAWABLE, "texturelayer", "Select your texture layer here.", None),
(PF_BOOL, "groupundo", "Group undo steps? If this is true, you can undo the entire script at once.", False ),
Expand Down Expand Up @@ -288,6 +293,7 @@ def createplanet_terrestrials(image, planetrand, planettype, planetwidth, bumpla
(PF_SLIDER, "planetwidth", "The width of the new planet. Only applies if random planet size is disabled.", 1, (360, 450, 5)),
(PF_SLIDER, "distance", "The motion blur distance. Only effective for gas giants.", 150, (100, 200, 1)),
(PF_SLIDER, "gasopacity", "The gas layer opacity. Only effective for gas giants.", 70, (0, 100, 1)),
(PF_SLIDER, "gasangle", "The rotation of the gas layer.", 0, (-180, 180, 1)),
(PF_SLIDER, "atmothickness", "The thickness of the atmosphere, in pixels.", 1, (0, 3, 0.05)),
(PF_DRAWABLE, "texturelayer", "Select your texture layer here.", None),
(PF_BOOL, "groupundo", "Group undo steps? If this is true, you can undo the entire script at once.", False ),
Expand Down
4 changes: 2 additions & 2 deletions CreatePlanet_Batch.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python

import os

from gimpfu import *

pdb = gimp.pdb
Expand Down Expand Up @@ -58,7 +57,7 @@ def createplanet_batch(atmospherecolor, postprocessing, planetrand, planetwidth,
planettype = 4

# let createplanet do the rest
pdb.python_fu_createplanet(image, atmospherecolor, postprocessing, planetrand, planetwidth, planettype, bumplayeropacity, distance, gasopacity, atmothickness, layer, groupundo, outputpath, savexcf)
pdb.python_fu_createplanet(image, atmospherecolor, postprocessing, planetrand, planetwidth, planettype, bumplayeropacity, distance, gasopacity, gasangle, atmothickness, layer, groupundo, outputpath, savexcf)



Expand All @@ -80,6 +79,7 @@ def createplanet_batch(atmospherecolor, postprocessing, planetrand, planetwidth,
(PF_SLIDER, "bumplayeropacity", "The opacity of the bumpmap layer. Only effective for terrestrial planets.", 80, (0, 100, 1)),
(PF_SLIDER, "distance", "The motion blur distance. Only effective for gas giants.", 150, (100, 200, 1)),
(PF_SLIDER, "gasopacity", "The gas layer opacity. Only effective for gas giants.", 70, (0, 100, 1)),
(PF_SLIDER, "gasangle", "The rotation of the gas layer.", 0, (-180, 180, 1)),
(PF_SLIDER, "atmothickness", "The thickness of the atmosphere, in pixels.", 1, (0, 3, 0.05)),
(PF_BOOL, "groupundo", "Group undo steps? If this is true, you can undo the entire script at once.", False ),
(PF_BOOL, "prefixdetection", "Prefix Detection sets planet type and post processing depending on the file's prefix. Possible prefixes are: 'hp-', 'otp-', 'm-', 'ig-', 'gg-'. Example filename: 'hp-texture00303423.jpg'.", True),
Expand Down

0 comments on commit a734b74

Please sign in to comment.