-
Notifications
You must be signed in to change notification settings - Fork 35
UI improvements #175
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
Merged
Merged
UI improvements #175
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
54a5b9e
feat: new method of adding compositor nodes
BrendanParmer f5317e4
feat: geometry nodes ui port, refactor module registration
BrendanParmer 4c1d966
feat: shader nodes ui port
BrendanParmer f007356
cleanup: add ntp prefix to some scene properties
BrendanParmer 3739248
feat: add ui for adding world, linestyle, and light nodes
BrendanParmer 1d26074
refactor: class renamings, fix bug on some slot removal operators
BrendanParmer d80318a
refactor: more descriptive option names/tooltips
BrendanParmer cc81659
fix: bring back group defaults and node sizes
BrendanParmer 05f798f
refactor: move menu to its own file, rename options file
BrendanParmer b2d4c65
refactor: main menu naming consistency
BrendanParmer 4c24ec0
cleanup: remove unnecessary menu class
BrendanParmer 96946a3
feat: reorganize options panel
BrendanParmer a866f24
feat: shrink default ui list size
BrendanParmer afdc8c8
feat: new export button and node group gatherer class
BrendanParmer 9362e7b
feat: button actually exports node groups
BrendanParmer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,4 +6,9 @@ | |
| from . import operator | ||
| from . import ui | ||
|
|
||
| import bpy | ||
| import bpy | ||
|
|
||
| modules = [ | ||
| operator | ||
| ] | ||
| modules += ui.modules | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| if "bpy" in locals(): | ||
| import importlib | ||
| importlib.reload(panel) | ||
| importlib.reload(scenes) | ||
| importlib.reload(compositor_node_groups) | ||
| else: | ||
| from . import panel | ||
| from . import scenes | ||
| from . import compositor_node_groups | ||
|
|
||
| import bpy | ||
|
|
||
| modules : list = [ | ||
| panel, | ||
| scenes, | ||
| compositor_node_groups | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| import bpy | ||
|
|
||
| from . import panel | ||
|
|
||
| def register_props(): | ||
| bpy.types.Scene.ntp_compositor_node_group_slots = bpy.props.CollectionProperty( | ||
| type=NTP_PG_CompositorNodeGroupSlot | ||
| ) | ||
| bpy.types.Scene.ntp_compositor_node_group_slots_index = bpy.props.IntProperty() | ||
|
|
||
| def unregister_props(): | ||
| del bpy.types.Scene.ntp_compositor_node_group_slots | ||
| del bpy.types.Scene.ntp_compositor_node_group_slots_index | ||
|
|
||
| class NTP_PG_CompositorNodeGroupSlot(bpy.types.PropertyGroup): | ||
| """ | ||
| TODO: There's a bug where the filtering doesn't update when renaming a | ||
| slotted object. For now, we'll need to just remove and re-add the slot | ||
| to the UI list. | ||
| """ | ||
| name: bpy.props.StringProperty( | ||
| name="Node Tree Name", | ||
| default="" | ||
| ) | ||
|
|
||
| def poll_node_tree(self, node_tree: bpy.types.NodeTree) -> bool: | ||
| scene = bpy.context.scene | ||
|
|
||
| for slot in scene.ntp_compositor_node_group_slots: | ||
| if slot is not self and slot.node_tree == node_tree: | ||
| return False | ||
| return node_tree.bl_idname == 'CompositorNodeTree' | ||
|
|
||
| def update_node_tree(self, context): | ||
| if self.node_tree: | ||
| self.name = self.node_tree.name | ||
| else: | ||
| self.name = "Compositor Node Group" | ||
|
|
||
| node_tree: bpy.props.PointerProperty( | ||
| name="Node Tree", | ||
| type=bpy.types.NodeTree, | ||
| poll=poll_node_tree, | ||
| update=update_node_tree | ||
| ) | ||
|
|
||
| class NTP_OT_AddCompositorNodeGroupSlot(bpy.types.Operator): | ||
| bl_idname = "ntp.add_compositor_node_group_slot" | ||
| bl_label = "Add Compositor Node Group Slot" | ||
| bl_description = "Add Compositor Node Group Slot" | ||
|
|
||
| def execute(self, context): | ||
| slots = context.scene.ntp_compositor_node_group_slots | ||
| slots.add() | ||
| context.scene.ntp_compositor_node_group_slots_index = len(slots) - 1 | ||
| return {'FINISHED'} | ||
|
|
||
| class NTP_OT_RemoveCompositorNodeGroupSlot(bpy.types.Operator): | ||
| bl_idname = "ntp.remove_compositor_node_group_slot" | ||
| bl_label = "Remove Compositor Node Group Slot" | ||
| bl_description = "Remove Compositor Node Group Slot" | ||
|
|
||
| def execute(self, context): | ||
| slots = context.scene.ntp_compositor_node_group_slots | ||
| idx = context.scene.ntp_compositor_node_group_slots_index | ||
|
|
||
| if idx >= 0 and idx < len(slots): | ||
| slots.remove(idx) | ||
| context.scene.ntp_compositor_node_group_slots_index = min( | ||
| max(0, idx - 1), len(slots) - 1 | ||
| ) | ||
| return {'FINISHED'} | ||
|
|
||
| class NTP_UL_CompositorNodeGroup(bpy.types.UIList): | ||
| bl_idname = "NTP_UL_compositor_node_group" | ||
|
|
||
| def draw_item(self, context, layout, data, item, icon, active_data, active): | ||
| if item: | ||
| layout.prop_search(item, "node_tree", bpy.data, "node_groups", text="") | ||
|
|
||
| class NTP_PT_CompositorNodeGroup(bpy.types.Panel): | ||
| bl_idname = "NTP_PT_compositor_node_group" | ||
| bl_label = "Node Groups" | ||
| bl_parent_id = panel.NTP_PT_Compositor.bl_idname | ||
| bl_space_type = 'NODE_EDITOR' | ||
| bl_region_type = 'UI' | ||
| bl_context = '' | ||
| bl_category = "NodeToPython" | ||
| bl_description = ("List of compositor node group objects to replicate.\n" | ||
| "These are typically subgroups within a larger scene tree") | ||
| bl_options = {'DEFAULT_CLOSED'} | ||
|
|
||
| def __init__(self, *args, **kwargs): | ||
| super().__init__(*args, **kwargs) | ||
|
|
||
| @classmethod | ||
| def poll(cls, context): | ||
| return True | ||
|
|
||
| def draw(self, context): | ||
| layout = self.layout | ||
| row = layout.row() | ||
| row.template_list( | ||
| NTP_UL_CompositorNodeGroup.bl_idname, "", | ||
| context.scene, "ntp_compositor_node_group_slots", | ||
| context.scene, "ntp_compositor_node_group_slots_index", | ||
| rows=1 | ||
| ) | ||
|
|
||
| col = row.column(align=True) | ||
| col.operator(NTP_OT_AddCompositorNodeGroupSlot.bl_idname, | ||
| icon="ADD", text="") | ||
| col.operator(NTP_OT_RemoveCompositorNodeGroupSlot.bl_idname, | ||
| icon="REMOVE", text="") | ||
|
|
||
| classes: list[type] = [ | ||
| NTP_PG_CompositorNodeGroupSlot, | ||
| NTP_OT_AddCompositorNodeGroupSlot, | ||
| NTP_OT_RemoveCompositorNodeGroupSlot, | ||
| NTP_UL_CompositorNodeGroup, | ||
| NTP_PT_CompositorNodeGroup | ||
| ] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import bpy | ||
|
|
||
| class NTP_PT_Compositor(bpy.types.Panel): | ||
| bl_label = "Compositor to Python" | ||
| bl_idname = "NTP_PT_compositor" | ||
| bl_space_type = 'NODE_EDITOR' | ||
| bl_region_type = 'UI' | ||
| bl_context = '' | ||
| bl_category = "NodeToPython" | ||
| bl_options = {'DEFAULT_CLOSED'} | ||
|
|
||
| def __init__(self, *args, **kwargs): | ||
| super().__init__(*args, **kwargs) | ||
|
|
||
| @classmethod | ||
| def poll(cls, context): | ||
| return True | ||
|
|
||
| def draw_header(self, context): | ||
| layout = self.layout | ||
|
|
||
| def draw(self, context): | ||
| layout = self.layout | ||
|
|
||
| classes: list[type] = [ | ||
| NTP_PT_Compositor | ||
| ] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I imagine a lot of these classes could probably inherit from a common base class, might not have time for this release though