-
Notifications
You must be signed in to change notification settings - Fork 16
Add Funky Blending layer support #250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,28 @@ | |
| msg = "Korlib C Module did not load correctly." | ||
| print(msg, "Using PyKorlib :(", sep=' ') | ||
|
|
||
| def create_funky_ramp(mipmap, additive=False): | ||
| kLUTHeight = 16 | ||
| kLUTWidth = 16 | ||
|
|
||
| buf = bytearray(kLUTHeight * kLUTWidth * 4) | ||
|
|
||
| for i in range(kLUTHeight): | ||
| for j in range(kLUTWidth): | ||
| x = j / (kLUTWidth - 1); | ||
| y = i / (kLUTHeight - 1); | ||
|
|
||
| start = i * kLUTWidth * 4 + j * 4 | ||
| end = start + 4 | ||
|
|
||
| if additive: | ||
| x = max(x, y) | ||
| buf[start:end] = [b for b in (255, 255, 255, int(x * 255.9))] | ||
| else: | ||
| buf[start:end] = [b for b in (255, 255, 255, int((x * y) * 255.9))] | ||
|
|
||
| mipmap.setRawImage(bytes(buf)) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The C++ uses |
||
|
|
||
| def create_bump_LUT(mipmap): | ||
| kLUTHeight = 16 | ||
| kLUTWidth = 16 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -119,3 +119,26 @@ def _has_animation_data(self, context): | |
| return True | ||
|
|
||
| return False | ||
|
|
||
|
|
||
| class PlasmaFunkyLayerPanel(TextureButtonsPanel, bpy.types.Panel): | ||
dpogue marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| bl_label = "Plasma Funky Layer" | ||
|
|
||
| def draw(self, context): | ||
| texture, slot = context.texture, getattr(context, "texture_slot", None) | ||
| use_stencil = slot.use_stencil if slot is not None else False | ||
| layer_props = texture.plasma_layer | ||
| layout = self.layout | ||
|
|
||
| layout.prop(layer_props, "funky_type") | ||
|
|
||
| if layer_props.funky_type != "FunkyNone": | ||
| col = layout.column(align=True) | ||
| col.prop(layer_props, "funky_near_trans") | ||
| col.prop(layer_props, "funky_near_opaq") | ||
| col.prop(layer_props, "funky_far_opaq") | ||
| col.prop(layer_props, "funky_far_trans") | ||
|
|
||
| if layer_props.funky_type != "FunkyDist": | ||
| # Mention that values are angles | ||
| layout.label("Values should be viewing angles in degrees between 0 and 180.", icon="RESTRICT_VIEW_OFF") | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this should probably be a separate set of properties that display as angles in the UI. You could have another set of properties as your universal getters. IIRC angle float types in blender return in radians so the export math would be simpler. |
||
Uh oh!
There was an error while loading. Please reload this page.