Skip to content

Commit a168229

Browse files
Merge pull request #251 from nxt-dev/enalbed_targeted_comp
Enabled - Targeted Comp
2 parents a8b38df + 1c769fd commit a168229

2 files changed

Lines changed: 19 additions & 6 deletions

File tree

nxt_editor/commands.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,8 @@ def undo(self):
376376
layer=layer, create=False,
377377
comp_layer=comp,
378378
**self.prev_data)
379-
if self.attr_name == INTERNAL_ATTRS.INSTANCE_PATH:
379+
if self.attr_name in (INTERNAL_ATTRS.INSTANCE_PATH,
380+
INTERNAL_ATTRS.ENABLED):
380381
dirties += result
381382
if self.attr_name in INTERNAL_ATTRS.ALL:
382383
dirties += comp.get_node_dirties(self.node_path)
@@ -389,7 +390,8 @@ def undo(self):
389390
else:
390391
if (self.remove_attr or self.created_node_paths or
391392
self.attr_name in (INTERNAL_ATTRS.INSTANCE_PATH,
392-
INTERNAL_ATTRS.PARENT_PATH)):
393+
INTERNAL_ATTRS.PARENT_PATH,
394+
INTERNAL_ATTRS.ENABLED)):
393395
self.model.nodes_changed.emit(dirties)
394396
else:
395397
self.model.attrs_changed.emit(changed_attrs)
@@ -401,7 +403,7 @@ def undo(self):
401403

402404
@processing
403405
def redo(self):
404-
start = time.time()
406+
# start = time.time()
405407
created_node = False
406408
self.prev_selection = self.model.selection
407409
layer = self.model.lookup_layer(self.layer_path)
@@ -446,16 +448,20 @@ def redo(self):
446448
create=True,
447449
comp_layer=comp,
448450
**self.data)
449-
if self.attr_name == INTERNAL_ATTRS.INSTANCE_PATH:
451+
if self.attr_name in (INTERNAL_ATTRS.INSTANCE_PATH,
452+
INTERNAL_ATTRS.ENABLED):
450453
dirties += self.return_value
451454
if self.attr_name in INTERNAL_ATTRS.ALL:
455+
# TODO: Some functions already calculated the dirty nodes,
456+
# do we really need to do it again here?
452457
dirties += comp.get_node_dirties(self.node_path)
453458
if self.recomp:
454459
self.model.update_comp_layer(rebuild=self.recomp)
455460
else:
456461
if (self.remove_attr or self.created_node_paths or
457462
self.attr_name in (INTERNAL_ATTRS.INSTANCE_PATH,
458-
INTERNAL_ATTRS.PARENT_PATH)):
463+
INTERNAL_ATTRS.PARENT_PATH,
464+
INTERNAL_ATTRS.ENABLED)):
459465
self.model.nodes_changed.emit(dirties)
460466
else:
461467
changed_attrs = ()

nxt_editor/dockwidgets/widget_builder.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,14 @@ def selection_widget(self, node_path, title):
883883
attr_name=self.ITEM_LIST_PATH_ATTR,
884884
layer=None)
885885

886-
target_node, target_attr = list_path_attr.split('.')
886+
try:
887+
target_node, target_attr = list_path_attr.split('.')
888+
except ValueError:
889+
logger.error('You must enter a /valid/node/path.attr in "{}.{}",'
890+
'Invalid: {}'
891+
''.format(node_path, self.ITEM_LIST_PATH_ATTR,
892+
list_path_attr))
893+
return
887894
self.stage_model.set_node_attr_value(
888895
node_path=target_node,
889896
attr_name=target_attr,

0 commit comments

Comments
 (0)